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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/logic/hydra.lean
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ begin
end

/-- `cut_expand r` is well-founded when `r` is. -/
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⟩⟩
Comment on lines -139 to +141
Copy link
Collaborator

@alreadydone alreadydone Apr 7, 2023

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
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
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
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 ...


end relation