Skip to content
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(set_theory/zfc/basic): tweak of_Set and to_Set #18694

Closed
wants to merge 3 commits into from
Closed

Conversation

vihdzp
Copy link
Collaborator

@vihdzp vihdzp commented Mar 29, 2023

We rename some things to better fit general Mathlib convention. In summary, we:

  • rename Class.of_Set to Class.coe
  • rename of_Set.inj to coe_injective, add coe_inj
  • remove Class.to_Set, as it's identical to Class.mem

Will be ported to Lean 4 along with the rest of the file here: leanprover-community/mathlib4#3165

Open in Gitpod

@vihdzp vihdzp added the awaiting-review The author would like community review of the PR label Mar 29, 2023
@vihdzp vihdzp requested a review from YaelDillies March 29, 2023 15:31
@@ -1095,7 +1092,7 @@ mem_univ.2 $ or.elim (classical.em $ ∃ x, ∀ y, A y ↔ y = x)
(λ hn, ⟨∅, ext (λ z, coe_empty.symm ▸ ⟨false.rec _, λ ⟨._, ⟨x, rfl, H⟩, zA⟩, hn ⟨x, H⟩⟩)⟩)

/-- Function value -/
def fval (F A : Class.{u}) : Class.{u} := iota (λ y, to_Set (λ x, F (Set.pair x y)) A)
def fval (F A : Class.{u}) : Class.{u} := iota $ λ y, Class.has_mem.mem A $ λ x, F (Set.pair x y)
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, this feels pretty weird. Do we not have syntax to construct a Class from a lambda?

Copy link
Member

@eric-wieser eric-wieser Mar 29, 2023

Choose a reason for hiding this comment

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

Perhaps

Suggested change
def fval (F A : Class.{u}) : Class.{u} := iota $ λ y, Class.has_mem.mem A $ λ x, F (Set.pair x y)
def fval (F A : Class.{u}) : Class.{u} := iota $ λ y, A ∈ ({x | F (Set.pair x y)} : Class)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This isn't able to find the instance, since the instance searcher can't see through the def-eq set Set = Class.

Copy link
Collaborator Author

@vihdzp vihdzp Mar 30, 2023

Choose a reason for hiding this comment

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

We don't have special syntax to construct classes, I'm afraid. We probably should though, this reminds me of the situation with matrix.of.

I'll add this after the file is ported.

Comment on lines -948 to -949
/-- Assert that `A` is a ZFC set satisfying `B` -/
def to_Set (B : Class.{u}) (A : Class.{u}) : Prop := ∃ x, ↑x = A ∧ B x
Copy link
Member

Choose a reason for hiding this comment

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

Based on @digama0's comments on Zulip it sounds like they would prefer to keep this; and I certainly trust their judgement over my own.

So I don't think this PR is going anywhere unless Mario both finds time to review this, and can also be persuaded of the change.

Copy link
Member

Choose a reason for hiding this comment

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

To add to the statements made on Zulip, I'm fairly sure that this is one of the constructors used in the metamath -> lean translation, so I would prefer to keep of_Set and to_Set as is, potential almost-duplication notwithstanding. The definitions are all trivial, so refactoring them doesn't gain us much in terms of shortened proofs but the type signatures are important. I think this is best revisited after the port.

@vihdzp
Copy link
Collaborator Author

vihdzp commented Mar 30, 2023

I still have more to say on this topic, but I agree with postponing it until the port.

@vihdzp vihdzp closed this Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review The author would like community review of the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants