This file establishes a snoc : Vector α n → α → Vector α (n+1)
operation, that appends a single
element to the back of a vector.
It provides a collection of lemmas that show how different Vector
operations reduce when their
argument is snoc xs x
.
Also, an alternative, reverse, induction principle is added, that breaks down a vector into
snoc xs x
for its inductive case. Effectively doing induction from right-to-left
Append a single element to the end of a vector
Instances For
Simplification lemmas #
Reverse induction principle #
Define C v
by reverse induction on v : Vector α n
.
That is, break the vector down starting from the right-most element, using snoc
This function has two arguments: nil
handles the base case on C nil
,
and snoc
defines the inductive step using ∀ x : α, C xs → C (xs.snoc x)
.
This can be used as induction v using Vector.revInductionOn
.
Equations
- v.revInductionOn nil snoc = cast ⋯ (v.reverse.inductionOn nil fun (n : ℕ) (x : α) (xs : Mathlib.Vector α n) (r : C xs.reverse) => cast ⋯ (snoc xs.reverse x r))
Instances For
Define C v w
by reverse induction on a pair of vectors v : Vector α n
and
w : Vector β n
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Define C v
by reverse case analysis, i.e. by handling the cases nil
and xs.snoc x
separately
Equations
- v.revCasesOn nil snoc = v.revInductionOn nil fun {n : ℕ} (xs : Mathlib.Vector α n) (x : α) (x_1 : C xs) => snoc xs x