The type List.Vector represents lists with fixed length.
TODO: The API of List.Vector is quite incomplete relative to Vector,
and in particular does not use x[i] (that is GetElem notation) as the preferred accessor.
Any combination of reducing the use of List.Vector in Mathlib, or modernising its API,
would be welcome.
List.Vector α n is the type of lists of length n with elements of type α.
Note that there is also Vector α n in the root namespace,
which is the type of arrays of length n with elements of type α.
Typically, if you are doing programming or verification, you will primarily use Vector α n,
and if you are doing mathematics, you may want to use List.Vector α n instead.
Instances For
Equations
- List.Vector.instDecidableEq = inferInstanceAs (DecidableEq { l : List α // l.length = n })
The empty vector with elements of type α
Instances For
Vector obtained by repeating an element.
Equations
- List.Vector.replicate n a = ⟨List.replicate n a, ⋯⟩
Instances For
Vector of length n from a function on Fin n.
Equations
- List.Vector.ofFn x_2 = List.Vector.nil
- List.Vector.ofFn f = List.Vector.cons (f 0) (List.Vector.ofFn fun (i : Fin n) => f i.succ)
Instances For
Runs a function over a vector returning the intermediate results and a final result.
Equations
- List.Vector.mapAccumr f ⟨x_2, px⟩ x✝ = ((List.mapAccumr f x_2 x✝).fst, ⟨(List.mapAccumr f x_2 x✝).snd, ⋯⟩)
Instances For
Runs a function over a pair of vectors returning the intermediate results and a final result.
Equations
- List.Vector.mapAccumr₂ f ⟨x_3, px⟩ ⟨y, py⟩ x✝ = ((List.mapAccumr₂ f x_3 y x✝).fst, ⟨(List.mapAccumr₂ f x_3 y x✝).snd, ⋯⟩)
Instances For
Shift Primitives #
shiftLeftFill v i is the vector obtained by left-shifting v i times and padding with the
fill argument. If v.length < i then this will return replicate n fill.
Equations
- v.shiftLeftFill i fill = List.Vector.congr ⋯ (List.Vector.drop i v ++ List.Vector.replicate (min n i) fill)
Instances For
shiftRightFill v i is the vector obtained by right-shifting v i times and padding with the
fill argument. If v.length < i then this will return replicate n fill.
Equations
- v.shiftRightFill i fill = List.Vector.congr ⋯ (List.Vector.replicate (min n i) fill ++ List.Vector.take (n - i) v)