Skip to content

feat(Data/Set): add Set.Uncountable#34245

Closed
staroperator wants to merge 10 commits intoleanprover-community:masterfrom
staroperator:set_uncountable
Closed

feat(Data/Set): add Set.Uncountable#34245
staroperator wants to merge 10 commits intoleanprover-community:masterfrom
staroperator:set_uncountable

Conversation

@staroperator
Copy link
Copy Markdown
Collaborator

@staroperator staroperator commented Jan 22, 2026

There are Set specialized shortcuts Set.Finite, Set.Infinite and Set.Countable, but lacking Set.Uncountable. I find this useful in #34246.


Open in Gitpod

@github-actions github-actions bot added the t-data Data (lists, quotients, numbers, etc) label Jan 22, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 22, 2026

PR summary 7c260e7c29

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ Countable.not_uncountable
+ Countable.uncountable_compl
+ Uncountable
+ Uncountable.diff
+ Uncountable.image
+ Uncountable.infinite
+ Uncountable.mono
+ Uncountable.nonempty
+ Uncountable.nontrivial
+ Uncountable.not_countable
+ Uncountable.of_image
+ Uncountable.range
+ Uncountable.to_subtype
+ aleph0_lt_iff_set_uncountable
+ not_countable_iff_uncountable
+ not_uncountable_iff_countable
+ uncountable_coe_iff
+ uncountable_of_countable_compl
+ uncountable_union
+ uncountable_univ
+ uncountable_univ_iff

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

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

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


No changes to technical debt.

You can run this locally as

./scripts/reporting/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).

Copy link
Copy Markdown
Collaborator

@vihdzp vihdzp left a comment

Choose a reason for hiding this comment

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

Sure, why not.

Comment thread Mathlib/Data/Set/Countable.lean
Comment thread Mathlib/Data/Set/Countable.lean
@joneugster joneugster added the awaiting-author A reviewer has asked the author a question or requested changes. label Jan 30, 2026
@staroperator staroperator added awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. and removed awaiting-author A reviewer has asked the author a question or requested changes. labels Jan 30, 2026
@github-actions github-actions bot removed the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Jan 30, 2026
Comment on lines +330 to +331
protected def Uncountable (s : Set α) : Prop :=
¬s.Countable
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One question which arose in a discussion about the simp-question below is whether it is really sensible to add such a definition.

[...] we already have a nice phrasing as ¬s.Countable, I am not convinced it is useful, because it will force us to introduce quite a lot of API for a gain I don't really see.

and

[...] If the concept is really used a lot, and in particular makes it possible to have several lemmas expressed with dot notation, then we should definitely have it. If it's less used, it's less obvious we should have it. For Infinite, it's a natural assumption in many many lemmas so we should definitely have it. For Uncountable, I don't know. [...]

Is there some more motivation you could provide besides the analogy to Infinite?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Besides analogy, I find I need the result of "removing a countable set from an uncountable set is still countable" (Set.Uncountable.diff) and "any uncountable set is non-empty" (Set.Uncountable.nonempty) in #34246. If I represent this as ¬s.Countable, I can definitely use Set.Countable.of_diff for the former but the latter is not quite easy (grind may help I guess). These are exactly "several lemmas expressed with dot notation" in my feeling.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Though I agree that "uncountable sets" do not occur in a lot of lemmas. In fact I would likely generalize #34246 to any regular cardinal so this PR may become unnecessary then.

Copy link
Copy Markdown
Collaborator Author

@staroperator staroperator Jan 31, 2026

Choose a reason for hiding this comment

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

Another thing I'd like to point out is that besides ¬s.Countable, another way to write "a set is uncountable" is Uncountable s (where s is coerced to a type). They are of course equivalent via Set.countable_coe_iff and not_countable_iff, but I don't think there is one representation that is more canonical than another (while Set.Uncountable would definitely be the most canonical way to say it).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

FYI, I have generalized #34246, so I don't need this PR now. Still, it doesn't harm to introduce such a shortcut.

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.

I'm somewhat unsure as to why we even have an Uncountable predicate. I don't believe there's many useful theorems to be stated about it other than ℵ₁ ≤ #α? And considering you were able to generalize your use of it, I think that signals we don't need this either.

Copy link
Copy Markdown
Collaborator Author

@staroperator staroperator Feb 2, 2026

Choose a reason for hiding this comment

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

I'm somewhat unsure as to why we even have an Uncountable predicate. I don't believe there's many useful theorems to be stated about it other than ℵ₁ ≤ #α? And considering you were able to generalize your use of it, I think that signals we don't need this either.

I guess Uncountable exists because it's a typeclass. That's useful because instance synthesis automates proof that some complicate type is actually uncountable.

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.

There's only three dozen theorems about uncountable, and most are just boilerplate conversions. I don't think anyone would miss this typeclass if it were gone.

Comment thread Mathlib/Data/Set/Countable.lean
@joneugster
Copy link
Copy Markdown
Contributor

Thanks for the motivation. I personally don't see anything against introducing it and the analogy to all the other declarations listed seems already reasonably compelling to me.

I'll leave this to the maintainer to decide; for context: #mathlib reviewers > @[simp] @ 💬

maintainer merge?

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by joneugster.

@ghost ghost added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Jan 31, 2026
Copy link
Copy Markdown
Collaborator

@vihdzp vihdzp left a comment

Choose a reason for hiding this comment

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

I'm increasingly convinced that we don't want this, and furthermore, that we don't want Uncountable either.

I've opened a Zulip thread for discussion.

@staroperator staroperator added the awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there label Feb 3, 2026
@joneugster joneugster removed the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Feb 18, 2026
@joneugster
Copy link
Copy Markdown
Contributor

@staroperator if the zulip discussion has been fruitful, could you please act on it or write about the conclusion here and remove the label by commenting -awaiting-zulip (I think it needs to be on its own line, maybe a separate message)

@staroperator
Copy link
Copy Markdown
Collaborator Author

@staroperator if the zulip discussion has been fruitful, could you please act on it or write about the conclusion here and remove the label by commenting -awaiting-zulip (I think it needs to be on its own line, maybe a separate message)

Thanks for the reminder. I guess the conclusion is that Uncountable is still useful for some theorems, and there is no need to remove it.

There is no discussion about whether Set.Uncountable should be introduced, but feel free to continue the discussion in the Zulip thread above.

-awaiting-zulip

@github-actions github-actions bot removed the awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there label Apr 14, 2026
@joneugster
Copy link
Copy Markdown
Contributor

So far I've only heard the opinion of @vihdzp and @sgouezel voicing concerns that the API Set.Uncountable is useful, so I'm hesitant on moving this further without stronger evidence that this is useful.

If you believe it to be useful, it would be nice if you could take the initiative of gathering such evidence.

meanwhile I'm going to unassign myself for now. This should mean other people might see the PR and voice their opinion.

@joneugster joneugster removed their assignment Apr 17, 2026
@staroperator
Copy link
Copy Markdown
Collaborator Author

So far I've only heard the opinion of @vihdzp and @sgouezel voicing concerns that the API Set.Uncountable is useful, so I'm hesitant on moving this further without stronger evidence that this is useful.

If you believe it to be useful, it would be nice if you could take the initiative of gathering such evidence.

meanwhile I'm going to unassign myself for now. This should mean other people might see the PR and voice their opinion.

Actually, I'm also not sure whether introducing this is useful now, so I will close the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants