Documentation

Mathlib.Data.Fintype.Basic

Instances for finite types #

This file is a collection of basic Fintype instances for types such as Fin, Prod and pi types.

instance Fin.fintype (n : ) :
Equations
theorem Fin.univ_def (n : ) :
Finset.univ = { val := (List.finRange n), nodup := }
theorem nonempty_fintype (α : Type u_4) [Finite α] :

See also nonempty_encodable, nonempty_denumerable.

@[simp]
theorem Fin.univ_val_map {α : Type u_1} {n : } (f : Fin nα) :
theorem Fin.univ_image_def {α : Type u_1} {n : } [DecidableEq α] (f : Fin nα) :
theorem Fin.univ_map_def {α : Type u_1} {n : } (f : Fin n α) :
Finset.map f Finset.univ = { val := (List.ofFn f), nodup := }
theorem Fin.univ_succ (n : ) :
Finset.univ = Finset.cons 0 (Finset.map { toFun := succ, inj' := } Finset.univ)

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

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

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

@[simp]
@[simp]
theorem Fin.univ_image_getElem' {α : Type u_1} {β : Type u_2} [DecidableEq β] (l : List α) (f : αβ) :
Finset.image (fun (i : Fin l.length) => f l[i]) Finset.univ = (List.map f l).toFinset
theorem Fin.univ_image_get' {α : Type u_1} {β : Type u_2} [DecidableEq β] (l : List α) (f : αβ) :
Finset.image (fun (x : Fin l.length) => f (l.get x)) Finset.univ = (List.map f l).toFinset
instance Fintype.subtypeEq {α : 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.

Equations
instance Fintype.subtypeEq' {α : 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.

Equations
def Fintype.prodLeft {α : Type u_4} {β : Type u_5} [DecidableEq α] [Fintype (α × β)] [Nonempty β] :

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

Equations
Instances For
    def Fintype.prodRight {α : Type u_4} {β : Type u_5} [DecidableEq β] [Fintype (α × β)] [Nonempty α] :

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

    Equations
    Instances For
      instance PLift.fintypeProp (p : Prop) [Decidable p] :
      Equations
      instance Quotient.fintype {α : Type u_1} [Fintype α] (s : Setoid α) [DecidableRel fun (x1 x2 : α) => x1 x2] :
      Equations
      instance PSigma.fintypePropLeft {α : Prop} {β : αType u_4} [Decidable α] [(a : α) → Fintype (β a)] :
      Fintype ((a : α) ×' β a)
      Equations
      instance PSigma.fintypePropRight {α : Type u_4} {β : αProp} [(a : α) → Decidable (β a)] [Fintype α] :
      Fintype ((a : α) ×' β a)
      Equations
      • One or more equations did not get rendered due to their size.
      instance PSigma.fintypePropProp {α : Prop} {β : αProp} [Decidable α] [(a : α) → Decidable (β a)] :
      Fintype ((a : α) ×' β a)
      Equations
      • PSigma.fintypePropProp = if h : ∃ (a : α), β a then { elems := {, }, complete := } else { elems := , complete := }
      instance pfunFintype (p : Prop) [Decidable p] (α : pType u_4) [(hp : p) → Fintype (α hp)] :
      Fintype ((hp : p) → α hp)
      Equations
      • One or more equations did not get rendered due to their size.
      def truncOfMultisetExistsMem {α : Type u_4} (s : Multiset α) :
      (∃ (x : α), x s)Trunc α

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

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def truncOfNonemptyFintype (α : Type u_4) [Nonempty α] [Fintype α] :

        A Nonempty Fintype constructively contains an element.

        Equations
        Instances For
          def truncSigmaOfExists {α : Type u_4} [Fintype α] {P : αProp} [DecidablePred P] (h : ∃ (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.

          Equations
          Instances For
            @[simp]
            theorem Multiset.count_univ {α : Type u_1} [Fintype α] [DecidableEq α] (a : α) :
            @[simp]
            theorem Multiset.map_univ_val_equiv {α : Type u_1} {β : Type u_2} [Fintype α] [Fintype β] (e : α β) :
            @[simp]

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

            @[irreducible]
            noncomputable def seqOfForallFinsetExistsAux {α : Type u_4} [DecidableEq α] (P : αProp) (r : ααProp) (h : ∀ (s : Finset α), ∃ (y : α), (∀ xs, P x)P y xs, r x y) :
            α

            Auxiliary definition to show exists_seq_of_forall_finset_exists.

            Equations
            Instances For
              theorem exists_seq_of_forall_finset_exists {α : Type u_4} (P : αProp) (r : ααProp) (h : ∀ (s : Finset α), (∀ xs, P x)∃ (y : α), P y xs, r x y) :
              ∃ (f : α), (∀ (n : ), P (f n)) ∀ (m n : ), m < nr (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' {α : Type u_4} (P : αProp) (r : ααProp) [IsSymm α r] (h : ∀ (s : Finset α), (∀ xs, P x)∃ (y : α), P y xs, 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.