Skip to content

feat: more lemmas on Euclidean relations#574

Open
chenson2018 wants to merge 20 commits into
mainfrom
chenson2018/more-euclidean
Open

feat: more lemmas on Euclidean relations#574
chenson2018 wants to merge 20 commits into
mainfrom
chenson2018/more-euclidean

Conversation

@chenson2018
Copy link
Copy Markdown
Collaborator

A few more lemmas on Euclidean relations. Some other changes to note:

  • The addition of Relation.{cod,dom}, mirroring what is done in Mathlib with SetRel but for unbundled relations. I am mulling over making a dedicated definition for restrictions of an unbundled relation, but wanted to have a few theorems to test with first.
  • I change the name RightEuclidean.refl_range to RightEuclidean.refl_cod for naming consistency
  • Using Relator.LeftTotal for the definition of Serial. None of the modal logic proofs change at all, as these are identical.

Copy link
Copy Markdown
Collaborator

@ctchou ctchou left a comment

Choose a reason for hiding this comment

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

An overall comment is that this file is getting large and probably should be split.

Comment thread Cslib/Foundations/Data/Relation.lean Outdated
Comment on lines +80 to +84
@[simp]
lemma cod_inv : cod (fun a b => r b a) = dom r := rfl

@[simp]
lemma dom_inv : dom (fun a b => r b a) = cod r := rfl
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.

Perhaps we can defined something like:

def RelInv r a b := r b a

Then the cod versions of many of these theorems can be derived from their dom versions plus properties of RelInv.

Copy link
Copy Markdown
Collaborator Author

@chenson2018 chenson2018 May 20, 2026

Choose a reason for hiding this comment

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

If taking this approach, I would have used the existing flip or Function.swap. They cause some problems that I attribute to there being a mismatch between core and Mathlib API. (Though maybe there's something more technical I've missed.) In a recent poll this form had more support, so I've tried to standardize on this approach, though I agree it is a bit ugly looking.

Comment thread Cslib/Foundations/Data/Relation.lean
@chenson2018
Copy link
Copy Markdown
Collaborator Author

chenson2018 commented May 20, 2026

An overall comment is that this file is getting large and probably should be split.

Agreed. The limit in Mathlib is 1500 lines. I'll think about where best to split this as we approach that size in future PRs.

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