File: Mathlib/Data/Vector/Defs.lean

full_name: Mathlib.Vector
code: /-- `Vector α n` is the type of lists of length `n` with elements of type `α`. -/
def Vector (α : Type u) (n : ℕ) 
goal: Type u

full_name: Mathlib.Vector.instDecidableEq
code: instance [DecidableEq α] : DecidableEq (Vector α n) 
goal: DecidableEq (Mathlib.Vector α n)

full_name: Mathlib.Vector.nil
code: /-- The empty vector with elements of type `α` -/
@[match_pattern]
def nil : Vector α 0 
goal: Mathlib.Vector α 0

full_name: Mathlib.Vector.cons
code: /-- If `a : α` and `l : Vector α n`, then `cons a l`, is the vector of length `n + 1`
whose first element is a and with l as the rest of the list. -/
@[match_pattern]
def cons : α → Vector α n → Vector α (Nat.succ n)
  
goal: α → Mathlib.Vector α n → Mathlib.Vector α n.succ

full_name: Mathlib.Vector.length
code: /-- The length of a vector. -/
@[reducible, nolint unusedArguments]
def length (_ : Vector α n) : ℕ 
goal: Mathlib.Vector α n → ℕ

full_name: Mathlib.Vector.head
code: /-- The first element of a vector with length at least `1`. -/
def head : Vector α (Nat.succ n) → α
  
goal: Mathlib.Vector α n.succ → α

full_name: Mathlib.Vector.head_cons
code: /-- The head of a vector obtained by prepending is the element prepended. -/
theorem head_cons (a : α) : ∀ v : Vector α n, head (cons a v) = a
  
goal: (Mathlib.Vector.cons a v).head = a

full_name: Mathlib.Vector.tail
code: /-- The tail of a vector, with an empty vector having empty tail.  -/
def tail : Vector α n → Vector α (n - 1)
  
goal: Mathlib.Vector α n → Mathlib.Vector α (n - 1)

full_name: Mathlib.Vector.tail_cons
code: /-- The tail of a vector obtained by prepending is the vector prepended. to -/
theorem tail_cons (a : α) : ∀ v : Vector α n, tail (cons a v) = v
  
goal: (Mathlib.Vector.cons a v).tail = v

full_name: Mathlib.Vector.cons_head_tail
code: /-- Prepending the head of a vector to its tail gives the vector. -/
@[simp]
theorem cons_head_tail : ∀ v : Vector α (succ n), cons (head v) (tail v) = v
  
goal: Mathlib.Vector.cons v.head v.tail = v

full_name: Mathlib.Vector.toList
code: /-- The list obtained from a vector. -/
def toList (v : Vector α n) : List α 
goal: List α

full_name: Mathlib.Vector.get
code: /-- nth element of a vector, indexed by a `Fin` type. -/
def get (l : Vector α n) (i : Fin n) : α 
goal: α

full_name: Mathlib.Vector.append
code: /-- Appending a vector to another. -/
def append {n m : Nat} : Vector α n → Vector α m → Vector α (n + m)
  
goal: Mathlib.Vector α n → Mathlib.Vector α m → Mathlib.Vector α (n + m)

full_name: Mathlib.Vector.elim
code: /-- Elimination rule for `Vector`. -/
@[elab_as_elim]
def elim {α} {C : ∀ {n}, Vector α n → Sort u}
    (H : ∀ l : List α, C ⟨l, rfl⟩) {n : ℕ} : ∀ v : Vector α n, C v
  
goal: C v

full_name: Mathlib.Vector.map
code: /-- Map a vector under a function. -/
def map (f : α → β) : Vector α n → Vector β n
  
goal: Mathlib.Vector α n → Mathlib.Vector β n

full_name: Mathlib.Vector.map_nil
code: /-- A `nil` vector maps to a `nil` vector. -/
@[simp]
theorem map_nil (f : α → β) : map f nil = nil 
goal: Mathlib.Vector.map f Mathlib.Vector.nil = Mathlib.Vector.nil

full_name: Mathlib.Vector.map_cons
code: /-- `map` is natural with respect to `cons`. -/
@[simp]
theorem map_cons (f : α → β) (a : α) : ∀ v : Vector α n, map f (cons a v) = cons (f a) (map f v)
  
goal: Mathlib.Vector.map f (Mathlib.Vector.cons a v) = Mathlib.Vector.cons (f a) (Mathlib.Vector.map f v)

full_name: Mathlib.Vector.map₂
code: /-- Mapping two vectors under a curried function of two variables. -/
def map₂ (f : α → β → φ) : Vector α n → Vector β n → Vector φ n
  
goal: Mathlib.Vector α n → Mathlib.Vector β n → Mathlib.Vector φ n

full_name: Mathlib.Vector.replicate
code: /-- Vector obtained by repeating an element. -/
def replicate (n : ℕ) (a : α) : Vector α n 
goal: Mathlib.Vector α n

full_name: Mathlib.Vector.drop
code: /-- Drop `i` elements from a vector of length `n`; we can have `i > n`. -/
def drop (i : ℕ) : Vector α n → Vector α (n - i)
  
goal: Mathlib.Vector α n → Mathlib.Vector α (n - i)

full_name: Mathlib.Vector.take
code: /-- Take `i` elements from a vector of length `n`; we can have `i > n`. -/
def take (i : ℕ) : Vector α n → Vector α (min i n)
  
goal: Mathlib.Vector α n → Mathlib.Vector α (min i n)

full_name: Mathlib.Vector.eraseIdx
code: /-- Remove the element at position `i` from a vector of length `n`. -/
def eraseIdx (i : Fin n) : Vector α n → Vector α (n - 1)
  
goal: Mathlib.Vector α n → Mathlib.Vector α (n - 1)

full_name: Mathlib.Vector.ofFn
code: /-- Vector of length `n` from a function on `Fin n`. -/
def ofFn : ∀ {n}, (Fin n → α) → Vector α n
  
goal: (Fin n → α) → Mathlib.Vector α n

full_name: Mathlib.Vector.congr
code: /-- Create a vector from another with a provably equal length. -/
protected def congr {n m : ℕ} (h : n = m) : Vector α n → Vector α m
  
goal: Mathlib.Vector α n → Mathlib.Vector α m

full_name: Mathlib.Vector.mapAccumr
code: /-- Runs a function over a vector returning the intermediate results and a
final result.
-/
def mapAccumr (f : α → σ → σ × β) : Vector α n → σ → σ × Vector β n
  
goal: Mathlib.Vector α n → σ → σ × Mathlib.Vector β n

full_name: Mathlib.Vector.mapAccumr₂
code: /-- Runs a function over a pair of vectors returning the intermediate results and a
final result.
-/
def mapAccumr₂ {α β σ φ : Type} (f : α → β → σ → σ × φ) :
    Vector α n → Vector β n → σ → σ × Vector φ n
  
goal: Mathlib.Vector α n → Mathlib.Vector β n → σ → σ × Mathlib.Vector φ n

full_name: Mathlib.Vector.shiftLeftFill
code: /-- `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`. -/
def shiftLeftFill (v : Vector α n) (i : ℕ) (fill : α) : Vector α n 
goal: Mathlib.Vector α n

full_name: Mathlib.Vector.shiftRightFill
code: /-- `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`. -/
def shiftRightFill (v : Vector α n) (i : ℕ) (fill : α) : Vector α n 
goal: Mathlib.Vector α n

full_name: Mathlib.Vector.eq
code: /-- Vector is determined by the underlying list. -/
protected theorem eq {n : ℕ} : ∀ a1 a2 : Vector α n, toList a1 = toList a2 → a1 = a2
  
goal: a1.toList = a2.toList → a1 = a2

full_name: Mathlib.Vector.eq_nil
code: /-- A vector of length `0` is a `nil` vector. -/
protected theorem eq_nil (v : Vector α 0) : v = nil 
goal: v = Mathlib.Vector.nil

full_name: Mathlib.Vector.toList_mk
code: /-- Vector of length from a list `v`
with witness that `v` has length `n` maps to `v` under `toList`.  -/
@[simp]
theorem toList_mk (v : List α) (P : List.length v = n) : toList (Subtype.mk v P) = v 
goal: Mathlib.Vector.toList ⟨v, P⟩ = v

full_name: Mathlib.Vector.toList_nil
code: /-- A nil vector maps to a nil list. -/
@[simp]
theorem toList_nil : toList nil = @List.nil α 
goal: Mathlib.Vector.nil.toList = []

full_name: Mathlib.Vector.toList_length
code: /-- The length of the list to which a vector of length `n` maps is `n`. -/
@[simp]
theorem toList_length (v : Vector α n) : (toList v).length = n 
goal: v.toList.length = n

full_name: Mathlib.Vector.toList_cons
code: /-- `toList` of `cons` of a vector and an element is
the `cons` of the list obtained by `toList` and the element -/
@[simp]
theorem toList_cons (a : α) (v : Vector α n) : toList (cons a v) = a :: toList v 
goal: (Mathlib.Vector.cons a v).toList = a :: v.toList

full_name: Mathlib.Vector.toList_append
code: /-- Appending of vectors corresponds under `toList` to appending of lists. -/
@[simp]
theorem toList_append {n m : ℕ} (v : Vector α n) (w : Vector α m) :
    toList (append v w) = toList v ++ toList w 
goal: (v.append w).toList = v.toList ++ w.toList

full_name: Mathlib.Vector.toList_drop
code: /-- `drop` of vectors corresponds under `toList` to `drop` of lists. -/
@[simp]
theorem toList_drop {n m : ℕ} (v : Vector α m) : toList (drop n v) = List.drop n (toList v) 
goal: (Mathlib.Vector.drop n v).toList = List.drop n v.toList

full_name: Mathlib.Vector.toList_take
code: /-- `take` of vectors corresponds under `toList` to `take` of lists. -/
@[simp]
theorem toList_take {n m : ℕ} (v : Vector α m) : toList (take n v) = List.take n (toList v) 
goal: (Mathlib.Vector.take n v).toList = List.take n v.toList

full_name: Mathlib.Vector.instGetElemNatLt
code: instance : GetElem (Vector α n) Nat α fun _ i => i < n 
goal: GetElem (Mathlib.Vector α n) ℕ α fun x i => i < n