Skip to content
1 change: 1 addition & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4032,6 +4032,7 @@ public import Mathlib.Data.FinEnum
public import Mathlib.Data.FinEnum.Option
public import Mathlib.Data.Finite.Card
public import Mathlib.Data.Finite.Defs
public import Mathlib.Data.Finite.Option
public import Mathlib.Data.Finite.Perm
public import Mathlib.Data.Finite.Prod
public import Mathlib.Data.Finite.Set
Expand Down
34 changes: 34 additions & 0 deletions Mathlib/Data/Finite/Option.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/-
Copyright (c) 2026 Alex Brodbelt. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alex Brodbelt, Eric Wieser
-/
module

public import Mathlib.Basic.Finite.Defs

import Mathlib.Data.Fintype.Option
import Mathlib.Logic.Equiv.Fin.Basic

/-!
# Finiteness conditions for `Option` types
Comment thread
AlexBrodbelt marked this conversation as resolved.

This file shows that `Option α` is finite iff `α` is. Similarly, `Option α` is infinite iff `α` is.
-/

public section

/-- `Option α` is finite if and only if the underlying type `α` is finite. -/
@[simp]
theorem Option.finite_iff {α : Type*} : Finite (Option α) ↔ Finite α where
mpr _ := inferInstance
mp
| @Finite.intro _ 0 e => (e none).elim0
| @Finite.intro _ (n + 1) e => ⟨(e.trans (finSuccEquiv n)).removeNone⟩
Comment on lines +25 to +27

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.

Suggested change
mp
| @Finite.intro _ 0 e => (e none).elim0
| @Finite.intro _ (n + 1) e => ⟨(e.trans (finSuccEquiv n)).removeNone⟩
mp _ := .of_injective _ (Option.some_injective α)


/-- `Option α` is infinite if and only if the underlying type `α` is infinite. -/
@[simp]
theorem Option.infinite_iff {α : Type*} : Infinite (Option α) ↔ Infinite α := by
rw [← not_finite_iff_infinite, ← not_finite_iff_infinite, Option.finite_iff]

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.

Suggested change
rw [← not_finite_iff_infinite, ← not_finite_iff_infinite, Option.finite_iff]
simp [← not_finite_iff_infinite]


end
Loading