Equivalence between Fin (length l)
and elements of a list #
Given a list l
,
-
if
l
has no duplicates, thenList.Nodup.getEquiv
is the equivalence betweenFin (length l)
and{x // x ∈ l}
sendingi
to⟨get l i, _⟩
with the inverse sending⟨x, hx⟩
to⟨indexOf x l, _⟩
; -
if
l
has no duplicates and contains every element of a typeα
, thenList.Nodup.getEquivOfForallMemList
defines an equivalence betweenFin (length l)
andα
; ifα
does not have decidable equality, then there is a bijectionList.Nodup.getBijectionOfForallMemList
; -
if
l
is sorted w.r.t.(<)
, thenList.Sorted.getIso
is 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
- One or more equations did not get rendered due to their size.
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
.
An element x : α
of l : List α
is a duplicate iff it can be found
at two distinct indices n m : ℕ
inside the list l
.