Equivalence between Fin (length l) and elements of a list #
Given a list l,
-
if
lhas no duplicates, thenList.Nodup.getEquivis the equivalence betweenFin (length l)and{x // x ∈ l}sendingito⟨get l i, _⟩with the inverse sending⟨x, hx⟩to⟨indexOf x l, _⟩; -
if
lhas no duplicates and contains every element of a typeα, thenList.Nodup.getEquivOfForallMemListdefines an equivalence betweenFin (length l)andα; ifαdoes not have decidable equality, then there is a bijectionList.Nodup.getBijectionOfForallMemList; -
if
lis sorted w.r.t.(<), thenList.Sorted.getIsois the same bijection reinterpreted as anOrderIso.
If l lists all the elements of α without duplicates, then List.get defines
a bijection Fin l.length → α. See List.Nodup.getEquivOfForallMemList
for a version giving an equivalence when there is decidable equality.
Equations
- List.Nodup.getBijectionOfForallMemList l nd h = { val := fun i => List.get l i, property := (_ : (Function.Injective fun i => List.get l i) ∧ Function.Surjective fun i => List.get l i) }
Instances For
If l has no duplicates, then List.get defines an equivalence between Fin (length l) and
the set of elements of l.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If l lists all the elements of α without duplicates, then List.get defines
an equivalence between Fin l.length and α.
See List.Nodup.getBijectionOfForallMemList for a version without
decidable equality.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If l is a list sorted w.r.t. (<), then List.get defines an order isomorphism between
Fin (length l) and the set of elements of l.
Equations
- List.Sorted.getIso l H = { toEquiv := List.Nodup.getEquiv l (_ : List.Nodup l), map_rel_iff' := (_ : ∀ {a b : Fin (List.length l)}, List.get l a ≤ List.get l b ↔ a ≤ b) }
Instances For
If there is f, an order-preserving embedding of ℕ into ℕ such that
any element of l found at index ix can be found at index f ix in l',
then Sublist l l'.
A l : List α is Sublist l l' for l' : List α iff
there is f, an order-preserving embedding of Fin l.length into Fin l'.length such that
any element of l found at index ix can be found at index f ix in l'.
An element x : α of l : List α is a duplicate iff it can be found
at two distinct indices n m : ℕ inside the list l.