Skip to content

chore(Foundations/Relation/Confluence): cleanup - #855

Open
thomaskwaring wants to merge 4 commits into
mainfrom
confluence
Open

chore(Foundations/Relation/Confluence): cleanup#855
thomaskwaring wants to merge 4 commits into
mainfrom
confluence

Conversation

@thomaskwaring

@thomaskwaring thomaskwaring commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Several proofs in Foundations/Relations/Confluence can be vastly simplified using results from Mathlib — possibly some results could be deleted entirely, though evidently the Mathlib equivalents are not particularly discoverable. I have also fixed some naming conventions, with deprecation labels for the old names.

Comment on lines +364 to +365
lemma ReflGen.symmGen_symm : ReflGen (SymmGen r) a b → ReflGen (SymmGen r) b a :=
Std.Symm.symm a b

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.

This one seems worth deprecating

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.

i've done so, though i'm not sure the line @[deprecated Relation.ReflGen.stdSymm (since := "2026-09-03")] is exactly correct since that instance doesn't exactly reproduce the signature of the result, is there a better way?

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.

Is this an appropriate place to use the new deprecated +typeChanged flag?

Comment thread Cslib/Foundations/Relation/Confluence.lean
Comment thread Cslib/Foundations/Relation/Confluence.lean Outdated
@chenson2018

chenson2018 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

For some historical context here. At the time I initially added these the state of Mathlib was

  • several theorems about EqvGen didn't exist yet.
  • Mathlib.Logic.Relation didn't use

so I added these in a consistent style. Now that these are no longer the case, could we just deprecate some (most?) of these entirely?

Edit: From Eric's comments I remember now that Mathlib doesn't have the various *.to_eqvGen theorems, so these shouldn't be deprecated.

Comment on lines +43 to +53
theorem ReflGen.to_eqvGen (h : ReflGen r a b) : EqvGen r a b :=
EqvGen.reflGen_le_eqvGen r _ _ h

theorem TransGen.to_eqvGen (h : TransGen r a b) : EqvGen r a b := by
induction h <;> grind
theorem TransGen.to_eqvGen (h : TransGen r a b) : EqvGen r a b :=
EqvGen.transGen_le_eqvGen r _ _ h

theorem ReflTransGen.to_eqvGen (h : ReflTransGen r a b) : EqvGen r a b := by
induction h <;> grind
theorem ReflTransGen.to_eqvGen (h : ReflTransGen r a b) : EqvGen r a b :=
EqvGen.reflTransGen_le_eqvGen r _ _ h

theorem SymmGen.to_eqvGen (h : SymmGen r a b) : EqvGen r a b := by
induction h <;> grind
theorem SymmGen.to_eqvGen (h : SymmGen r a b) : EqvGen r a b :=
EqvGen.symmGen_le_eqvGen r _ _ h

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.

These ones look perhaps worth keeping for dot notation (and upstreaming to mathlib), but could maybe become aliases. I'd probably argue that the to_ should be dropped from the name.

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.

Mathlib has other pairs of theorems like Relation.reflGen_le_reflTransGen and Relation.ReflGen.to_reflTransGen that this matches, so if to_ were to be dropped, it should be coordinated with these I guess?

(There also seems to be a bit of disagreement on if both versions are really needed for dot notation, see this discussion)

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.

i've left them as-is for the moment, lmk if that's appropriate. in particular i'm not sure how to alias them since the signature is slightly different.

thomaskwaring and others added 2 commits September 3, 2026 10:52
Co-authored-by: Eric Wieser <efw@google.com>
@thomaskwaring thomaskwaring changed the title chore(Foundations/Relation/Confluence): deduplicate Mathlib results chore(Foundations/Relation/Confluence): cleanup Sep 3, 2026
@thomaskwaring

Copy link
Copy Markdown
Collaborator Author

@chenson2018 i see, that makes a lot of sense.

since it's being discussed i've gone ahead and updated the naming conventions throughout, aligned with the mathlib to_ convention at least until that changes upstream — if you'd prefer to review this separately i can revert.

@chenson2018 chenson2018 left a comment

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.

I think the only outstanding question is about deprecation procedures, so I'll approve and feel free to merge once that is settled.

@thomaskwaring

Copy link
Copy Markdown
Collaborator Author

okay great, thanks. working with deprecations / aliases is a little new to me so i might have to defer to your and @eric-wieser's opinions on that — the current status looks okay to my eyes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants