fintype instances for option #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
@[protected, instance]
Equations
- option.fintype = {elems := ⇑finset.insert_none finset.univ, complete := _}
@[simp]
theorem
fintype.card_option
{α : Type u_1}
[fintype α] :
fintype.card (option α) = fintype.card α + 1
If option α
is a fintype
then so is α
Equations
- fintype_of_option = {elems := ⇑finset.erase_none (fintype.elems (option α)), complete := _}
def
fintype.trunc_rec_empty_option
{P : Type u → Sort v}
(of_equiv : Π {α β : Type u}, α ≃ β → P α → P β)
(h_empty : P pempty)
(h_option : Π {α : Type u} [_inst_1 : fintype α] [_inst_2 : decidable_eq α], P α → P (option α))
(α : Type u)
[fintype α]
[decidable_eq α] :
trunc (P α)
A recursor principle for finite types, analogous to nat.rec
. It effectively says
that every fintype
is either empty
or option α
, up to an equiv
.
Equations
- fintype.trunc_rec_empty_option of_equiv h_empty h_option α = trunc.bind ((λ (n : ℕ), nat.rec ((fintype.trunc_equiv_of_card_eq fintype.trunc_rec_empty_option._proof_1).bind (λ (e : pempty ≃ ulift (fin 0)), trunc.mk (of_equiv e h_empty))) (λ (n : ℕ) (ih : trunc (P (ulift (fin n)))), (fintype.trunc_equiv_of_card_eq _).bind (λ (e : option (ulift (fin n)) ≃ ulift (fin n.succ)), trunc.map (λ (ih : P (ulift (fin n))), of_equiv e (h_option ih)) ih)) n) (fintype.card α)) (λ (h : P (ulift (fin (fintype.card α)))), trunc.map (λ (e : α ≃ fin (fintype.card α)), of_equiv (equiv.ulift.trans e.symm) h) (fintype.trunc_equiv_fin α))
theorem
fintype.induction_empty_option
{P : Π (α : Type u) [_inst_1 : fintype α], Prop}
(of_equiv : ∀ (α β : Type u) [_inst_2 : fintype β] (e : α ≃ β), P α → P β)
(h_empty : P pempty)
(h_option : ∀ (α : Type u) [_inst_3 : fintype α], P α → P (option α))
(α : Type u)
[fintype α] :
P α
An induction principle for finite types, analogous to nat.rec
. It effectively says
that every fintype
is either empty
or option α
, up to an equiv
.
theorem
finite.induction_empty_option
{P : Type u → Prop}
(of_equiv : ∀ {α β : Type u}, α ≃ β → P α → P β)
(h_empty : P pempty)
(h_option : ∀ {α : Type u} [_inst_1 : fintype α], P α → P (option α))
(α : Type u)
[finite α] :
P α
An induction principle for finite types, analogous to nat.rec
. It effectively says
that every fintype
is either empty
or option α
, up to an equiv
.