Instances for finite types #
This file is a collection of basic Fintype
instances for types such as Fin
, Prod
and pi types.
Equations
- Fin.fintype n = { elems := { val := ↑(List.finRange n), nodup := ⋯ }, complete := ⋯ }
Embed Fin n
into Fin (n + 1)
by appending a new Fin.last n
to the univ
Equations
Short-circuit instance to decrease search for Unique.fintype
,
since that relies on a subsingleton elimination for Unique
.
Equations
Short-circuit instance to decrease search for Unique.fintype
,
since that relies on a subsingleton elimination for Unique
.
Equations
Equations
Given that α × β
is a fintype, α
is also a fintype.
Equations
- Fintype.prodLeft = { elems := Finset.image Prod.fst Finset.univ, complete := ⋯ }
Instances For
Given that α × β
is a fintype, β
is also a fintype.
Equations
- Fintype.prodRight = { elems := Finset.image Prod.snd Finset.univ, complete := ⋯ }
Instances For
Equations
Equations
Equations
Equations
- PSigma.fintypePropLeft = if h : α then Fintype.ofEquiv (β h) { toFun := fun (x : β h) => ⟨h, x⟩, invFun := PSigma.snd, left_inv := ⋯, right_inv := ⋯ } else { elems := ∅, complete := ⋯ }
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
- truncSigmaOfExists h = truncOfNonemptyFintype ((a : α) ×' P a)
Instances For
For functions on finite sets, they are bijections iff they map universes into universes.
Auxiliary definition to show exists_seq_of_forall_finset_exists
.
Equations
- seqOfForallFinsetExistsAux P r h x✝ = Classical.choose ⋯
Instances For
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
.
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
.