Equivalence between Fin (length l) and elements of a list #
Given a list l,
- if - lhas no duplicates, then- List.Nodup.getEquivis the equivalence between- Fin (length l)and- {x // x ∈ l}sending- ito- ⟨get l i, _⟩with the inverse sending- ⟨x, hx⟩to- ⟨indexOf x l, _⟩;
- if - lhas no duplicates and contains every element of a type- α, then- List.Nodup.getEquivOfForallMemListdefines an equivalence between- Fin (length l)and- α; if- αdoes not have decidable equality, then there is a bijection- List.Nodup.getBijectionOfForallMemList;
- if - lis sorted w.r.t.- (<), then- List.Sorted.getIsois the same bijection reinterpreted as an- OrderIso.
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.
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
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
- List.Nodup.getEquivOfForallMemList l nd h = { toFun := fun (i : Fin l.length) => l.get i, invFun := fun (a : α) => ⟨List.idxOf a l, ⋯⟩, left_inv := ⋯, right_inv := ⋯ }
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 ⋯, map_rel_iff' := ⋯ }
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 ℕ into ℕ 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.