Skip to content

feat(Mathlib/Data/Finite/Option): option type is finite iff type is finite#39567

Open
AlexBrodbelt wants to merge 7 commits into
leanprover-community:masterfrom
AlexBrodbelt:AlexBrodbelt/Finite/Option
Open

feat(Mathlib/Data/Finite/Option): option type is finite iff type is finite#39567
AlexBrodbelt wants to merge 7 commits into
leanprover-community:masterfrom
AlexBrodbelt:AlexBrodbelt/Finite/Option

Conversation

@AlexBrodbelt

@AlexBrodbelt AlexBrodbelt commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Option type is finite if and only if the type is finite.

This is an intermediate result to proving that if the GroupWithZero is (in)finite then the Units are (in)finite.


Open in Gitpod

@github-actions github-actions Bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label May 19, 2026
@github-actions

Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions github-actions Bot added the t-data Data (lists, quotients, numbers, etc) label May 19, 2026
@github-actions

github-actions Bot commented May 19, 2026

Copy link
Copy Markdown

PR summary a5cd43ac9c

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Data.Finite.Option (new file) 486

Declarations diff

+ Option.finite_iff

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

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

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.


No changes to strong technical debt.
No changes to weak technical debt.

Comment thread Mathlib/Data/Finite/Option.lean Outdated
Comment thread Mathlib/Data/Finite/Option.lean Outdated
Comment thread Mathlib/Data/Finite/Option.lean Outdated
Comment thread Mathlib/Data/Finite/Option.lean Outdated
Comment thread Mathlib/Data/Finite/Option.lean Outdated
Comment on lines +8 to +9
public import Mathlib.Data.Fintype.Option
import Mathlib.Logic.Equiv.Fin.Basic

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.

What's the reason for public import Mathlib.Data.Fintype.Option but import Mathlib.Logic.Equiv.Fin.Basic?

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.

because only finSuccEquiv (which is in Logic.Equiv.Fin.Basic) in the proof uses it

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.

Then, why not just public import Mathlib.Data.Finite.Defs and everything else is privately imported?

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.

Yeah, why not!

Suggested change
public import Mathlib.Data.Fintype.Option
import Mathlib.Logic.Equiv.Fin.Basic
public import Mathlib.Data.Finite.Defs
import Mathlib.Data.Fintype.Option
import Mathlib.Logic.Equiv.Fin.Basic

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.

Will modify the imports - but maybe it is a good idea to improve the #min_imports command to take into account access modifiers as well?

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 think some people are trying to work on making this better (also trying to make shake work properly). We're still trying to adjust to the new module system (even though it's been a few months now).


public section

/-- The `Option` type on a type is finite if and only if the underlying type is finite. -/

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.

How about just

Suggested change
/-- The `Option` type on a type is finite if and only if the underlying type is finite. -/
/-- `Option α` is finite if and only if the underlying type `α` is finite. -/

import Mathlib.Logic.Equiv.Fin.Basic

/-!
# Finiteness conditions for `Option` types

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.

Suggested change
# Finiteness conditions for `Option` types
# Finiteness conditions for `Option` types
This file shows that `Option α` is finite iff ` is.

@mathlib-triage mathlib-triage Bot assigned TwoFX and unassigned joneugster Jun 21, 2026
@mathlib-triage mathlib-triage Bot assigned eric-wieser and unassigned TwoFX Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants