-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: linear order is isomorphic to lexicographic sum of two intervals #20409
base: master
Are you sure you want to change the base?
Conversation
PR summary 962da91995Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have the specialisation to preorders?
This adds a bunch of imports and makes the PR twice as big. But I think they're an useful addition, so I've done a few changes to accomodate it: mainly, I've moved all of this to its own file. |
map_rel_iff' := by simp_rw [Lex.forall]; rintro (a | a) (b | b) <;> simp | ||
|
||
@[simp] | ||
theorem sumLexCongr_symm {α₁ α₂ β₁ β₂ : Type*} [LE α₁] [LE α₂] [LE β₁] [LE β₂] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have the trans
and refl
versions of this too.
variable (r x) in | ||
/-- A relation is isomorphic to the lexicographic sum of elements less than `x` and elements not | ||
less than `x`. -/ | ||
-- The explicit type signature stops `simp` from complaining. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this complaining happen? If you're able to make a mwe, can you file an issue with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This complaining is addressed in #20479, I can make this a dependent PR so that this doesn't come up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean #20475?
greater or equal to `x`. -/ | ||
def sumLexIioIci : Iio x ⊕ₗ Ici x ≃o α := | ||
(sumLexCongr (refl _) (setCongr (Ici x) {y | ¬ y < x} (by ext; simp))).trans <| | ||
ofRelIsoLT (RelIso.sumLexComplLeft (· < ·) x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should be composing with ofLex
here somehow. Do we have ofLex
as a RelIso
for Sum
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some pretty subtle def-eq finagling going on here: the reason ofRelIsoLT
works is because Sum.Lex (· < ·) (· < ·) (Iio x) (Ici x)
is def-eq to the <
relation on Iio x ⊕ₗ Ici x
. I'm not sure this can be made less abusive by just inserting ofLex
.
In any case things should probably be fine as long as we keep the actual API free of def-eq abuse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should introduce a Sum.toLexRelIso : Sum.Lex (. < .) (. < .) ≃r (fun a b : Lex (Sum _ _) => a < b)
or whatever the true version is, with simp
lemmas reducing to toLex
, and cast through that here
Mathlib/Order/Hom/Lex.lean
Outdated
theorem sumLexIioIci_apply_inl (a : Iio x) : sumLexIioIci x (Sum.inl a) = a := | ||
rfl | ||
|
||
@[simp] | ||
theorem sumLexIioIci_apply_inr (a : Ici x) : sumLexIioIci x (Sum.inr a) = a := | ||
rfl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theorem sumLexIioIci_apply_inl (a : Iio x) : sumLexIioIci x (Sum.inl a) = a := | |
rfl | |
@[simp] | |
theorem sumLexIioIci_apply_inr (a : Ici x) : sumLexIioIci x (Sum.inr a) = a := | |
rfl | |
theorem sumLexIioIci_apply_inl (a : Iio x) : sumLexIioIci x (ofLex <| Sum.inl a) = a := | |
rfl | |
@[simp] | |
theorem sumLexIioIci_apply_inr (a : Ici x) : sumLexIioIci x (ofLex <| Sum.inr a) = a := | |
rfl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be better for simp
to instead put toLex
on the RHS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That suggestion doesn't make any sense to me, the type of this bundled map is Lex (Sum (Iio x) (Ici x)) ≃o α
, so when applying the map to a Sum
you have to call toLex
first.
(I realize I made a type above too...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nevermind, I see why what I was saying is nonsense. And in fact I'm missing some other ofLex
elsewhere.
The material in this PR was previously in #18893.