Skip to content

[Merged by Bors] - refactor(SetTheory/ZFC): deduplicate coercion to sets#31287

Closed
YaelDillies wants to merge 7 commits intoleanprover-community:masterfrom
YaelDillies:zfset_set_like
Closed

[Merged by Bors] - refactor(SetTheory/ZFC): deduplicate coercion to sets#31287
YaelDillies wants to merge 7 commits intoleanprover-community:masterfrom
YaelDillies:zfset_set_like

Conversation

@YaelDillies
Copy link
Copy Markdown
Contributor

Currently, we have both ZFSet.toSet and SetLike.coe to turn a ZFSet into a Set ZFSet. This is bad for simp normal form. This PR removes the first spelling in favor of the second one.


Open in Gitpod

Currently, we have both `ZFSet.toSet` and `SetLike.coe` to turn a `ZFSet` into a `Set ZFSet`. This is bad for simp normal form. This PR removes the first spelling in favor of the second one.
@github-actions github-actions bot added the t-set-theory Set theory label Nov 5, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 5, 2025

PR summary 7df0b99484

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ coeEquiv
+ coe_empty
+ coe_iUnion
+ coe_image
+ coe_insert
+ coe_inter
+ coe_pair
+ coe_range
+ coe_sInter
+ coe_sUnion
+ coe_sdiff
+ coe_sep
+ coe_singleton
+ coe_subset_coe
+ coe_union
+ instance : HasSubset ZFSet := ⟨ZFSet.Subset⟩
+ instance : SetLike ZFSet.{u} ZFSet.{u}
+ mem_sdiff
+ nonempty_coe
+ notMem_singleton
+ sep_mem
+ sep_notMem
+ sep_subset
+ small_coe
- hasSubset
- instance : SetLike ZFSet ZFSet

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).

Quotient.inductionOn₂ x y fun _ _ h => Quotient.sound (Mem.ext fun w => h ⟦w⟧)

instance : SetLike ZFSet.{u} ZFSet.{u} where
coe x := {y | y ∈ x}
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.

Since this file used { x | p } only, could you please follow this style?

Suggested change
coe x := {y | y ∈ x}
coe x := { y | y ∈ x }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This looks like remnants from the port, since mathport was wrongly inserting the spaces. I'll keep it like that

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.

So {y | y ∈ x} is actually preferred in Mathlib?

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.

OK, resolved

Copy link
Copy Markdown
Collaborator

@staroperator staroperator left a comment

Choose a reason for hiding this comment

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

Looks good! Maybe beyond this PR, what should we do with PSet.toSet after deprecating ZFSet.toSet (note that PSet is not SetLike)?

@YaelDillies
Copy link
Copy Markdown
Contributor Author

We keep it, most likely

@jcommelin
Copy link
Copy Markdown
Member

Thanks 🎉

bors merge

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Nov 21, 2025
mathlib-bors bot pushed a commit that referenced this pull request Nov 21, 2025
Currently, we have both `ZFSet.toSet` and `SetLike.coe` to turn a `ZFSet` into a `Set ZFSet`. This is bad for simp normal form. This PR removes the first spelling in favor of the second one.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Nov 21, 2025

Build failed (retrying...):

mathlib-bors bot pushed a commit that referenced this pull request Nov 21, 2025
Currently, we have both `ZFSet.toSet` and `SetLike.coe` to turn a `ZFSet` into a `Set ZFSet`. This is bad for simp normal form. This PR removes the first spelling in favor of the second one.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Nov 21, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title refactor(SetTheory/ZFC): deduplicate coercion to sets [Merged by Bors] - refactor(SetTheory/ZFC): deduplicate coercion to sets Nov 21, 2025
@mathlib-bors mathlib-bors bot closed this Nov 21, 2025
@YaelDillies YaelDillies deleted the zfset_set_like branch November 21, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-set-theory Set theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants