Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

chore(logic/hydra): instance well_founded.cut_expand - #18757

Open
vihdzp wants to merge 1 commit into
masterfrom
hydra_typeclass
Open

chore(logic/hydra): instance well_founded.cut_expand#18757
vihdzp wants to merge 1 commit into
masterfrom
hydra_typeclass

Conversation

@vihdzp

@vihdzp vihdzp commented Apr 7, 2023

Copy link
Copy Markdown
Collaborator

Open in Gitpod

@vihdzp vihdzp added the awaiting-review The author would like community review of the PR label Apr 7, 2023
@vihdzp
vihdzp requested a review from alreadydone April 7, 2023 16:15
@vihdzp vihdzp added the modifies-synchronized-file This PR touches a files that has already been ported to mathlib4, and may need a synchronization PR. label Apr 7, 2023
Comment thread src/logic/hydra.lean
Comment on lines -139 to +141
theorem _root_.well_founded.cut_expand (hr : well_founded r) : well_founded (cut_expand r) :=
⟨by { letI h := hr.is_irrefl, exact λ s, acc_of_singleton $ λ a _, (hr.apply a).cut_expand }⟩
instance _root_.is_well_founded.cut_expand [is_well_founded α r] :
is_well_founded _ (cut_expand r) :=
⟨⟨λ s, acc_of_singleton $ λ a _, (is_well_founded.apply r a).cut_expand⟩⟩

@alreadydone alreadydone Apr 7, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The instance is good but I don't see why you'd like to remove the theorem.

It's also tempting to add a has_well_founded instance but when I look into the surreal multiplication proof I see we're using (trans_gen $ cut_expand is_option) as the well-founded relation ...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The has_well_founded instance is not needed, as there already exists an instance is_well_founded α (has_well_founded α).r.

As for removing the theorem, I guess this is a matter of code style. It seems like the pattern throughout Mathlib is to prefer bundled predicates like these, e.g. using is_irrefl instead of irreflexive, etc. We get many convenient instances this way - for instance, is_well_founded _ (trans_gen $ cut_expand is_option) could be inferred entirely automatically. So I don't see the need for having both the theorem and the instance.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's telling that we're using well_founded.is_irrefl, which turns the non-instance well_founded into an instance is_well_founded.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we change well_founded.trans_gen to instance at the same time? Anyway it looks like you can't have any PRs merged before you port all your PRs ...

@YaelDillies YaelDillies added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Apr 19, 2023
@kim-em kim-em added the too-late This PR was ready too late for inclusion in mathlib3 label Jul 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

awaiting-author A reviewer has asked the author a question or requested changes modifies-synchronized-file This PR touches a files that has already been ported to mathlib4, and may need a synchronization PR. too-late This PR was ready too late for inclusion in mathlib3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants