-
Notifications
You must be signed in to change notification settings - Fork 985
feat(ULift): conjugation by ULift.up/down, misc cast/heq lemmas #24533
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
base: master
Are you sure you want to change the base?
Conversation
PR summary 0d63fa4ea4Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
| Function.rec_update up_injective (ULift.rec ·) (fun _ _ => rfl) (fun | ||
| | _, _, .up _, h => (h _ rfl).elim) _ _ _ | ||
|
|
||
| def conj {α β : Type*} (f : ULift α → ULift β) : α → β := fun x => (f ⟨x⟩).down |
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.
What do you need this for? Can you just use Equiv.ulift.conj in your application instead?
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.
- Convenience and clarity. It's not strictly necessary but it gets annoying writing the definition out too often. And, we do have
ULift.map, so it'd be good to have its inverse. - I don't think so.
Equiv.ulift.conjwould have type(ULift α → ULift α) ≃ (α → α), there's no good way to introduce aβthere.
Co-authored-by: Eric Wieser <[email protected]>
Mathlib/Data/ULift.lean
Outdated
| lemma conj_map {α β : Type*} (f : α → β) : conj (ULift.map f) = f := by | ||
| ext x; rfl | ||
|
|
||
| lemma down_heq_inj {α β : Type u} (x : ULift.{u'} α) (y : ULift.{u'} β) |
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 looks like ext_heq to me, comparing to ULift.ext
Mathlib/Data/ULift.lean
Outdated
| cases x; cases y; cases h; rfl | ||
|
|
||
| @[simp] | ||
| lemma down_heq_inj_iff {α β : Type u} (h : α = β) |
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 is either heq_iff or ext_heq_iff; maybe see if you can find any precedent either way.
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 are no existing ext_heqs in the library, so no real precedent I don't think. I'm going to lean towards ext_heq_iff.
Mathlib/Data/ULift.lean
Outdated
| cases h; cases h'; rfl | ||
|
|
||
| @[simp] | ||
| lemma cast_up_comm {α β} {a : α} (h : α = β) (h' : ULift α = ULift β := congrArg ULift h) |
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.
The naming convention says this is cast_up, or up_cast only if you change the statement to be reversed.
What's your rationale for choosing to push cast to the inside instead of pulling it to the outside as in the lemma below?
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.
cast_up it is, I suppose, though I thought of this as "commuting cast and ULift.up when I wrote it".
The thing that is likely to have cast lemmas permitting further simplification is the "bare" object, the thing inside the ULift wrapper. Both lemmas are therefore written so that the cast is applied to something not ULifted.
Mathlib/Data/ULift.lean
Outdated
|
|
||
| @[simp] | ||
| lemma cast_up_comm {α β} {a : α} (h : α = β) (h' : ULift α = ULift β := congrArg ULift h) | ||
| : (cast h' ⟨a⟩) = ⟨cast h a⟩ := by |
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.
The prevailing style is that the : goes on the previous line.
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.
Oops!
Mathlib/Data/ULift.lean
Outdated
| cases h; cases h'; rfl | ||
|
|
||
| @[simp] | ||
| lemma cast_down {α β} {a : ULift α} (h : α = β) (h' : ULift α = ULift β := congrArg ULift h) : |
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 this one is down_cast, because the down is on the outside of the cast
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 suppose. I'm a little concerned about discoverability, but sure, I guess.
|
@eric-wieser Would you like to finish reviewing this? (If not, I'll try to find somebody else.) |
|
|
||
| @[simp] | ||
| lemma ext_heq_iff {α β : Type u} (h : α = β) | ||
| (x : ULift.{u'} α) (y : ULift.{u'} β) : HEq x y ↔ HEq x.down y.down := by |
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 should use the new HEq notation
|
@grunweg: happy for you to assign someone else. My feeling is that we don't want |
|
As the name implies, all PRs in the |
|
I have labelled this awaiting-author to address the last PR feedback. Please click resolve on any review comment you have addressed, and remove the awaiting-author label once you have addressed all review comments. (You can do so by commenting just the word |
| ext x; rfl | ||
|
|
||
| lemma ext_heq {α β : Type u} (x : ULift.{u'} α) (y : ULift.{u'} β) | ||
| (h : HEq x.down y.down) : HEq x y := by |
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.
| (h : HEq x.down y.down) : HEq x y := by | |
| (h : x.down ≍ y.down) : x ≍ y := by |
|
|
||
| @[simp] | ||
| lemma ext_heq_iff {α β : Type u} (h : α = β) | ||
| (x : ULift.{u'} α) (y : ULift.{u'} β) : HEq x y ↔ HEq x.down y.down := by |
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.
| (x : ULift.{u'} α) (y : ULift.{u'} β) : HEq x y ↔ HEq x.down y.down := by | |
| (x : ULift.{u'} α) (y : ULift.{u'} β) : x ≍ y ↔ x.down ≍ y.down := by |
|
@grunweg Unfortunately, I don't think I can address that last comment properly anymore; am I going to have to make a new PR for this to go through? |
|
@robertmaxton42 Indeed, it seems you need to migrate your PR to a fork now. (There's a |
ULift.conj x :=down (f (up x))`, and corresponding basic lemmasULift.upand.downcommute with casts and preserveHEq.