Skip to content

Conversation

urkud
Copy link
Member

@urkud urkud commented Nov 17, 2024

No description provided.

@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Nov 17, 2024

Mathlib CI status (docs):

@fgdorais fgdorais added awaiting-review This PR is ready for review; the author thinks it is ready to be merged. awaiting-author Waiting for PR author to address issues and removed awaiting-review This PR is ready for review; the author thinks it is ready to be merged. labels Nov 17, 2024
@digama0
Copy link
Member

digama0 commented Nov 17, 2024

I'm not a fan, this turns things that would be recursive on lists into well founded recursions.

@urkud
Copy link
Member Author

urkud commented Nov 17, 2024

What about renaming Chain' -> IsChain, Chain -> IsChain' or IsChain.Aux?

@digama0
Copy link
Member

digama0 commented Nov 17, 2024

IsChain1? IsChainSucc?

@urkud
Copy link
Member Author

urkud commented Nov 17, 2024

BTW, what things start using well founded recursions with my def?

@fgdorais
Copy link
Collaborator

I'm partial to IsChain1. Any particular reason why IsChain (and IsChain1) are def instead of inductive?

@urkud
Copy link
Member Author

urkud commented Nov 18, 2024

My main motivation is that we get isChain_cons_cons for free.

@urkud
Copy link
Member Author

urkud commented Nov 18, 2024

What's wrong with using IsChain (a::l) when you want IsChain1 a l?


/-- Recursion principle for `List.IsChain. -/
@[elab_as_elim]
protected def IsChain.rec {p : ∀ l : List α, IsChain R l → Sort u}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use motive instead of p.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add recOn for convenience? I'm not sure if casesOn would be useful but it doesn't hurt to have it.


/-- Induction principle for `List.IsChain. -/
@[elab_as_elim]
protected theorem IsChain.induction {p : ∀ l : List α, IsChain R l → Prop}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this redundant?


theorem IsChain.imp_of_mem (hRS : ∀ a ∈ l, ∀ b ∈ l, R a b → S a b) (h : IsChain R l) :
IsChain S l := by
induction l with
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this be simpler using IsChain.rec?

@fgdorais
Copy link
Collaborator

I would like to merge this sooner than later. It looks like there's just a few small issues and a Mathlib adaptation.

@urkud
Copy link
Member Author

urkud commented Dec 22, 2024

I'm sorry for the delay. I'll have some time to work on this tomorrow.

@fgdorais
Copy link
Collaborator

Umm, I this PR still active?

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author Waiting for PR author to address issues breaks-mathlib merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants