Skip to content

Conversation

@robertmaxton42
Copy link
Collaborator

  • Adds the convenience def ULift.conj x := down (f (up x))`, and corresponding basic lemmas
  • Adds lemmas showing that ULift.up and .down commute with casts and preserve HEq.

Open in Gitpod

@robertmaxton42 robertmaxton42 requested a review from eric-wieser May 2, 2025 00:53
@github-actions
Copy link

github-actions bot commented May 2, 2025

PR summary 0d63fa4ea4

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ cast_up
+ conj
+ conj_map
+ down_cast
+ ext_heq
+ ext_heq_iff
+ map_conj

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions bot added the t-data Data (lists, quotients, numbers, etc) label May 2, 2025
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
Copy link
Member

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?

Copy link
Collaborator Author

@robertmaxton42 robertmaxton42 May 2, 2025

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.conj would have type (ULift α → ULift α) ≃ (α → α), there's no good way to introduce a β there.

@eric-wieser eric-wieser added the awaiting-author A reviewer has asked the author a question or requested changes. label May 2, 2025
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'} β)
Copy link
Member

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

cases x; cases y; cases h; rfl

@[simp]
lemma down_heq_inj_iff {α β : Type u} (h : α = β)
Copy link
Member

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.

Copy link
Collaborator Author

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.

cases h; cases h'; rfl

@[simp]
lemma cast_up_comm {α β} {a : α} (h : α = β) (h' : ULift α = ULift β := congrArg ULift h)
Copy link
Member

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?

Copy link
Collaborator Author

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.


@[simp]
lemma cast_up_comm {α β} {a : α} (h : α = β) (h' : ULift α = ULift β := congrArg ULift h)
: (cast h' ⟨a⟩) = ⟨cast h a⟩ := by
Copy link
Member

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops!

cases h; cases h'; rfl

@[simp]
lemma cast_down {α β} {a : ULift α} (h : α = β) (h' : ULift α = ULift β := congrArg ULift h) :
Copy link
Member

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

Copy link
Collaborator Author

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.

@robertmaxton42 robertmaxton42 removed the awaiting-author A reviewer has asked the author a question or requested changes. label May 2, 2025
@grunweg
Copy link
Collaborator

grunweg commented Aug 27, 2025

@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
Copy link
Member

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

@eric-wieser
Copy link
Member

@grunweg: happy for you to assign someone else. My feeling is that we don't want conj without more justification (e.g. a downstream PR), but the other lemmas are close to ready.

@robertmaxton42
Copy link
Collaborator Author

As the name implies, all PRs in the quiv-helpers series are helper lemmas used in the construction of limits and colimits in Quiv; I haven't added the downstream PRs because I'm still rather unfamiliar with git and would prefer not to deal with git's unfortunate inconveniences around PRs that depend on other PRs.

@grunweg grunweg added the awaiting-author A reviewer has asked the author a question or requested changes. label Aug 28, 2025
@grunweg
Copy link
Collaborator

grunweg commented Aug 28, 2025

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 -awaiting-author in a comment.)

ext x; rfl

lemma ext_heq {α β : Type u} (x : ULift.{u'} α) (y : ULift.{u'} β)
(h : HEq x.down y.down) : HEq x y := by
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
(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
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
(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

@robertmaxton42
Copy link
Collaborator Author

@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?

@grunweg
Copy link
Collaborator

grunweg commented Sep 8, 2025

@robertmaxton42 Indeed, it seems you need to migrate your PR to a fork now. (There's a migrate_to_fork.py script now; using the latest version on the master branch is recommended.)

@grunweg grunweg changed the title feat (ULift): conjugation by ULift.up/down, misc cast/heq lemmas feat(ULift): conjugation by ULift.up/down, misc cast/heq lemmas Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author A reviewer has asked the author a question or requested changes. t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants