The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V03. Sets, finite structures and big operators

Mathlib.Data.Fintype.Basic

48 declarations. Mathlib docs · Source

theorem PLift.up.congr_simp E1 #

∀ {α : Sort u} (down down_1 : α), down = down_1 → { down := down } = { down := down_1 }

instance Fin.fintype E0 #

(n : ℕ) → Fintype (Fin n)

theorem Fin.univ_def E0 #

∀ (n : ℕ), Finset.univ = { val := ↑(List.finRange n), nodup := ⋯ }

theorem Finset.univ_fin2 E1 #

Finset.univ = {0, 1}

theorem Finset.val_univ_fin E0 #

∀ (n : ℕ), Finset.univ.val = ↑(List.finRange n)

theorem nonempty_fintype E1 #

∀ (α : Type u_3) [Finite α], Nonempty (Fintype α)

See also nonempty_encodable, nonempty_denumerable.

theorem List.toFinset_finRange E0 #

∀ (n : ℕ), (List.finRange n).toFinset = Finset.univ

theorem Fin.univ_val_map E0 #

∀ {α : Type u_1} {n : ℕ} (f : Fin n → α), Multiset.map f Finset.univ.val = ↑(List.ofFn f)

theorem Fin.univ_image_def E0 #

∀ {α : Type u_1} {n : ℕ} [inst : DecidableEq α] (f : Fin n → α), Finset.image f Finset.univ = (List.ofFn f).toFinset

theorem Fin.univ_map_def E0 #

∀ {α : Type u_1} {n : ℕ} (f : Fin n ↪ α), Finset.map f Finset.univ = { val := ↑(List.ofFn ⇑f), nodup := ⋯ }

theorem Fin.image_succAbove_univ E0 #

∀ {n : ℕ} (i : Fin (n + 1)), Finset.image i.succAbove Finset.univ = {i}ᶜ

theorem Fin.image_succ_univ E0 #

∀ (n : ℕ), Finset.image Fin.succ Finset.univ = {0}ᶜ

theorem Fin.image_castSucc E0 #

∀ (n : ℕ), Finset.image Fin.castSucc Finset.univ = {Fin.last n}ᶜ

theorem Fin.univ_succ E1 #

∀ (n : ℕ), Finset.univ = Finset.cons 0 (Finset.map { toFun := Fin.succ, inj' := ⋯ } Finset.univ) ⋯

Embed Fin n into Fin (n + 1) by prepending zero to the univ

theorem Fin.univ_castSuccEmb E1 #

∀ (n : ℕ), Finset.univ = Finset.cons (Fin.last n) (Finset.map Fin.castSuccEmb Finset.univ) ⋯

Embed Fin n into Fin (n + 1) by appending a new Fin.last n to the univ

theorem Fin.univ_succAbove E1 #

∀ (n : ℕ) (p : Fin (n + 1)), Finset.univ = Finset.cons p (Finset.map p.succAboveEmb Finset.univ) ⋯

Embed Fin n into Fin (n + 1) by inserting around a specified pivot p : Fin (n + 1) into the univ

theorem Fin.univ_image_get E0 #

∀ {α : Type u_1} [inst : DecidableEq α] (l : List α), Finset.image l.get Finset.univ = l.toFinset

theorem Fin.univ_image_getElem' E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] (l : List α) (f : α → β),
  Finset.image (fun i ↦ f l[↑i]) Finset.univ = (List.map f l).toFinset

theorem Fin.univ_image_get' E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : DecidableEq β] (l : List α) (f : α → β),
  Finset.image (fun x ↦ f (l.get x)) Finset.univ = (List.map f l).toFinset

instance Unique.fintype E0 #

{α : Type u_3} → [Unique α] → Fintype α

instance Fintype.subtypeEq E0 #

{α : Type u_1} → (y : α) → Fintype { x // x = y }

Short-circuit instance to decrease search for Unique.fintype, since that relies on a subsingleton elimination for Unique.

instance Fintype.subtypeEq' E0 #

{α : Type u_1} → (y : α) → Fintype { x // y = x }

Short-circuit instance to decrease search for Unique.fintype, since that relies on a subsingleton elimination for Unique.

theorem Fintype.univ_empty E1 #

Finset.univ = ∅

theorem Fintype.univ_pempty E1 #

Finset.univ = ∅

instance Unit.fintype E0 #

Fintype Unit

theorem Fintype.univ_unit E1 #

Finset.univ = {()}

instance PUnit.fintype E0 #

Fintype PUnit.{u_3 + 1}

theorem Fintype.univ_punit E1 #

Finset.univ = {PUnit.unit}

theorem Fintype.univ_bool E0 #

Finset.univ = {true, false}

def Fintype.prodLeft E1 #

{α : Type u_3} → {β : Type u_4} → [DecidableEq α] → [Fintype (α × β)] → [Nonempty β] → Fintype α

Given that α × β is a fintype, α is also a fintype.

def Fintype.prodRight E1 #

{α : Type u_3} → {β : Type u_4} → [DecidableEq β] → [Fintype (α × β)] → [Nonempty α] → Fintype β

Given that α × β is a fintype, β is also a fintype.

instance ULift.fintype E0 #

(α : Type u_3) → [Fintype α] → Fintype (ULift.{u_4, u_3} α)

instance PLift.fintype E0 #

(α : Type u_3) → [Fintype α] → Fintype (PLift α)

instance PLift.fintypeProp E0 #

(p : Prop) → [Decidable p] → Fintype (PLift p)

instance Quotient.fintype E0 #

{α : Type u_1} → [Fintype α] → (s : Setoid α) → [DecidableRel fun x1 x2 ↦ x1 ≈ x2] → Fintype (Quotient s)

instance PSigma.fintypePropLeft E0 #

{α : Prop} → {β : α → Type u_3} → [Decidable α] → [(a : α) → Fintype (β a)] → Fintype ((a : α) ×' β a)

instance PSigma.fintypePropRight E0 #

{α : Type u_3} → {β : α → Prop} → [(a : α) → Decidable (β a)] → [Fintype α] → Fintype ((a : α) ×' β a)

instance PSigma.fintypePropProp E0 #

{α : Prop} → {β : α → Prop} → [Decidable α] → [(a : α) → Decidable (β a)] → Fintype ((a : α) ×' β a)

instance pfunFintype E0 #

(p : Prop) → [Decidable p] → (α : p → Type u_3) → [(hp : p) → Fintype (α hp)] → Fintype ((hp : p) → α hp)

def truncOfMultisetExistsMem E1 #

{α : Type u_3} → (s : Multiset α) → (∃ x, x ∈ s) → Trunc α

For s : Multiset α, we can lift the existential statement that ∃ x, x ∈ s to a Trunc α.

def truncOfNonemptyFintype E1 #

(α : Type u_3) → [Nonempty α] → [Fintype α] → Trunc α

A Nonempty Fintype constructively contains an element.

def truncSigmaOfExists E1 #

{α : Type u_3} → [Fintype α] → {P : α → Prop} → [DecidablePred P] → (∃ a, P a) → Trunc ((a : α) ×' P a)

By iterating over the elements of a fintype, we can lift an existential statement ∃ a, P a to Trunc (Σ' a, P a), containing data.

theorem Multiset.count_univ E0 #

∀ {α : Type u_1} [inst : Fintype α] [inst_1 : DecidableEq α] (a : α), Multiset.count a Finset.univ.val = 1

theorem Multiset.map_univ_val_equiv E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] [inst_1 : Fintype β] (e : α ≃ β),
  Multiset.map (⇑e) Finset.univ.val = Finset.univ.val

theorem Multiset.bijective_iff_map_univ_eq_univ E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] [inst_1 : Fintype β] (f : α → β),
  Function.Bijective f ↔ Multiset.map f Finset.univ.val = Finset.univ.val

For functions on finite sets, they are bijections iff they map universes into universes.

def seqOfForallFinsetExistsAux E0 #

{α : Type u_3} →
  [DecidableEq α] →
    (P : α → Prop) → (r : α → α → Prop) → (∀ (s : Finset α), ∃ y, (∀ x ∈ s, P x) → P y ∧ ∀ x ∈ s, r x y) → ℕ → α

Auxiliary definition to show exists_seq_of_forall_finset_exists.

theorem exists_seq_of_forall_finset_exists E2 #

∀ {α : Type u_3} (P : α → Prop) (r : α → α → Prop),
  (∀ (s : Finset α), (∀ x ∈ s, P x) → ∃ y, P y ∧ ∀ x ∈ s, r x y) →
    ∃ f, (∀ (n : ℕ), P (f n)) ∧ ∀ (m n : ℕ), m < n → r (f m) (f n)

Induction principle to build a sequence, by adding one point at a time satisfying a given relation with respect to all the previously chosen points.

More precisely, Assume that, for any finite set s, one can find another point satisfying some relation r with respect to all the points in s. Then one may construct a function f : ℕ → α such that r (f m) (f n) holds whenever m < n. We also ensure that all constructed points satisfy a given predicate P.

theorem exists_seq_of_forall_finset_exists' E2 #

∀ {α : Type u_3} (P : α → Prop) (r : α → α → Prop) [Std.Symm r],
  (∀ (s : Finset α), (∀ x ∈ s, P x) → ∃ y, P y ∧ ∀ x ∈ s, r x y) →
    ∃ f, (∀ (n : ℕ), P (f n)) ∧ Pairwise (Function.onFun r f)

Induction principle to build a sequence, by adding one point at a time satisfying a given symmetric relation with respect to all the previously chosen points.

More precisely, Assume that, for any finite set s, one can find another point satisfying some relation r with respect to all the points in s. Then one may construct a function f : ℕ → α such that r (f m) (f n) holds whenever m ≠ n. We also ensure that all constructed points satisfy a given predicate P.