Skip to content

[Merged by Bors] - chore: fix some Set defeq abuse, golf - #6114

Closed
urkud wants to merge 4 commits into
masterfrom
YK-setof-defeq
Closed

urkud wants to merge 4 commits into
masterfrom
YK-setof-defeq

Conversation

@urkud

@urkud urkud commented Jul 24, 2023 •

Copy link
Copy Markdown
Member
  • Use {x | p x} instead of fun x ↦ p x to define a set here and there.
  • Golf some proofs.
  • Replace Con.ker_apply_eq_preimage with Con.ker_apply. The old version used to abuse definitional equality between Set M and M → Prop.
  • Fix Submonoid.mk* lemmas to use ⟨_, _⟩, not ⟨⟨_, _⟩, _⟩.

I found these while trying to make Set a one-field structure. While I'm not sure that I'll complete that other refactor, these changes seem good to me in any case.

Open in Gitpod

Comment thread Mathlib/Data/Set/Image.lean Resolved

/-- `M.accepts` is the language of `x` such that `M.eval x` is an accept state. -/
def accepts : Language α := fun x => M.eval x ∈ M.accept
def accepts : Language α := {x | M.eval x ∈ M.accept}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is still a defeq abuse because Language and Set are not interchangeable.
leanprover-community/mathlib3#18451 had a path to resolve this, but was more trouble that I cared to deal with.

Having said that, this change is certainly not harmful, so fine to leave it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

They are not interchangeable but Language is defined as Set, not _ → Prop, so this is a step in the right direction. The proper fix would be to introduce Language.mk.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Set.up is pretty much exactly that function, as SetSemiring has all the same instances as Language.

Comment thread Mathlib/GroupTheory/Congruence.lean Resolved

@eric-wieser eric-wieser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't look at the CategoryTheory files but the rest look fine.

Comment thread Mathlib/GroupTheory/Congruence.lean Resolved
@ocfnash

ocfnash commented Jul 26, 2023

Copy link
Copy Markdown
Contributor

Thanks!

bors merge

@github-actions github-actions Bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Jul 26, 2023
bors Bot pushed a commit that referenced this pull request Jul 26, 2023
- Use `{x | p x}` instead of `fun x ↦ p x` to define a set here and there.
- Golf some proofs.
- Replace `Con.ker_apply_eq_preimage` with `Con.ker_apply`. The old version used to abuse definitional equality between `Set M` and `M → Prop`.
- Fix `Submonoid.mk*` lemmas to use `⟨_, _⟩`, not `⟨⟨_, _⟩, _⟩`.
@bors

bors Bot commented Jul 26, 2023

Copy link
Copy Markdown

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors Bot changed the title chore: fix some Set defeq abuse, golf [Merged by Bors] - chore: fix some Set defeq abuse, golf Jul 26, 2023
@bors bors Bot closed this Jul 26, 2023
@bors
bors Bot deleted the YK-setof-defeq branch July 26, 2023 10:47
kim-em pushed a commit that referenced this pull request Aug 14, 2023
- Use `{x | p x}` instead of `fun x ↦ p x` to define a set here and there.
- Golf some proofs.
- Replace `Con.ker_apply_eq_preimage` with `Con.ker_apply`. The old version used to abuse definitional equality between `Set M` and `M → Prop`.
- Fix `Submonoid.mk*` lemmas to use `⟨_, _⟩`, not `⟨⟨_, _⟩, _⟩`.
mathlib-bors Bot pushed a commit that referenced this pull request May 11, 2026
…in Cantor's theorem (#39147)

#6114 and #35752 removed the defeq abuse in `Function.cantor_surjective`, then #35239 golfed it, reintroducing defeq abuse.
This reverts the golf to avoid defeq abuse, and cleans up a bit.
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants