Lists from functions #
Theorems and lemmas for dealing with List.ofFn, which converts a function on Fin n to a list
of length n.
Main Statements #
The main statements pertain to lists generated using List.ofFn
List.get?_ofFn, which tells us the nth element of such a listList.equivSigmaTuple, which is anEquivbetween lists and the functions that generate them viaList.ofFn.
theorem
List.ofFn_add
{α : Type u}
{m n : ℕ}
(f : Fin (m + n) → α)
:
ofFn f = (ofFn fun (i : Fin m) => f (Fin.castAdd n i)) ++ ofFn fun (j : Fin n) => f (Fin.natAdd m j)
Note this matches the convention of List.ofFn_succ', putting the Fin m elements first.
Lists are equivalent to the sigma type of tuples of a given length.
Equations
Instances For
@[simp]
@[simp]
@[simp]
def
List.ofFnRec
{α : Type u}
{C : List α → Sort u_1}
(h : (n : ℕ) → (f : Fin n → α) → C (ofFn f))
(l : List α)
:
C l
A recursor for lists that expands a list into a function mapping to its elements.
This can be used with induction l using List.ofFnRec.
Equations
- List.ofFnRec h l = cast ⋯ (h l.length l.get)
Instances For
Note we can only state this when the two functions are indexed by defeq n.