File: Mathlib/Data/Vector/Basic.lean

full_name: Mathlib.Vector.«_aux_Mathlib_Data_Vector_Basic___macroRules_Mathlib_Vector_term_::ᵥ__1»
code: @[inherit_doc]
infixr:67 " ::ᵥ " => Vector.cons
goal: Lean.Macro

full_name: Mathlib.Vector._aux_Mathlib_Data_Vector_Basic___unexpand_Mathlib_Vector_cons_1
code: @[inherit_doc]
infixr:67 " ::ᵥ " => Vector.cons
goal: Lean.PrettyPrinter.Unexpander

full_name: Mathlib.Vector.instInhabited
code: instance [Inhabited α] : Inhabited (Vector α n) 
goal: Inhabited (Mathlib.Vector α n)

full_name: Mathlib.Vector.toList_injective
code: theorem toList_injective : Function.Injective (@toList α n) 
goal: Function.Injective Mathlib.Vector.toList

full_name: Mathlib.Vector.ext
code: /-- Two `v w : Vector α n` are equal iff they are equal at every single index. -/
@[ext]
theorem ext : ∀ {v w : Vector α n} (_ : ∀ m : Fin n, Vector.get v m = Vector.get w m), v = w
  
goal: (∀ (m : Fin n), v.get m = w.get m) → v = w

full_name: Mathlib.Vector.zero_subsingleton
code: /-- The empty `Vector` is a `Subsingleton`. -/
instance zero_subsingleton : Subsingleton (Vector α 0) 
goal: Subsingleton (Mathlib.Vector α 0)

full_name: Mathlib.Vector.cons_val
code: @[simp]
theorem cons_val (a : α) : ∀ v : Vector α n, (a ::ᵥ v).val = a :: v.val
  
goal: ↑(a ::ᵥ v) = a :: ↑v

full_name: Mathlib.Vector.eq_cons_iff
code: theorem eq_cons_iff (a : α) (v : Vector α n.succ) (v' : Vector α n) :
    v = a ::ᵥ v' ↔ v.head = a ∧ v.tail = v' 
goal: v = a ::ᵥ v' ↔ v.head = a ∧ v.tail = v'

full_name: Mathlib.Vector.ne_cons_iff
code: theorem ne_cons_iff (a : α) (v : Vector α n.succ) (v' : Vector α n) :
    v ≠ a ::ᵥ v' ↔ v.head ≠ a ∨ v.tail ≠ v' 
goal: v ≠ a ::ᵥ v' ↔ v.head ≠ a ∨ v.tail ≠ v'

full_name: Mathlib.Vector.exists_eq_cons
code: theorem exists_eq_cons (v : Vector α n.succ) : ∃ (a : α) (as : Vector α n), v = a ::ᵥ as 
goal: ∃ a as, v = a ::ᵥ as

full_name: Mathlib.Vector.toList_ofFn
code: @[simp]
theorem toList_ofFn : ∀ {n} (f : Fin n → α), toList (ofFn f) = List.ofFn f
  
goal: (Mathlib.Vector.ofFn f).toList = List.ofFn f

full_name: Mathlib.Vector.mk_toList
code: @[simp]
theorem mk_toList : ∀ (v : Vector α n) (h), (⟨toList v, h⟩ : Vector α n) = v
  
goal: ⟨v.toList, h⟩ = v

full_name: Mathlib.Vector.length_val
code: @[simp] theorem length_val (v : Vector α n) : v.val.length = n 
goal: (↑v).length = n

full_name: Mathlib.Vector.toList_map
code: @[simp]
theorem toList_map {β : Type*} (v : Vector α n) (f : α → β) :
    (v.map f).toList = v.toList.map f 
goal: (Mathlib.Vector.map f v).toList = List.map f v.toList

full_name: Mathlib.Vector.head_map
code: @[simp]
theorem head_map {β : Type*} (v : Vector α (n + 1)) (f : α → β) : (v.map f).head = f v.head 
goal: (Mathlib.Vector.map f v).head = f v.head

full_name: Mathlib.Vector.tail_map
code: @[simp]
theorem tail_map {β : Type*} (v : Vector α (n + 1)) (f : α → β) :
    (v.map f).tail = v.tail.map f 
goal: (Mathlib.Vector.map f v).tail = Mathlib.Vector.map f v.tail

full_name: Mathlib.Vector.get_eq_get
code: theorem get_eq_get (v : Vector α n) (i : Fin n) :
    v.get i = v.toList.get (Fin.cast v.toList_length.symm i) 
goal: v.get i = v.toList.get (Fin.cast ⋯ i)

full_name: Mathlib.Vector.get_replicate
code: @[simp]
theorem get_replicate (a : α) (i : Fin n) : (Vector.replicate n a).get i = a 
goal: (Mathlib.Vector.replicate n a).get i = a

full_name: Mathlib.Vector.get_map
code: @[simp]
theorem get_map {β : Type*} (v : Vector α n) (f : α → β) (i : Fin n) :
    (v.map f).get i = f (v.get i) 
goal: (Mathlib.Vector.map f v).get i = f (v.get i)

full_name: Mathlib.Vector.map₂_nil
code: @[simp]
theorem map₂_nil (f : α → β → γ) : Vector.map₂ f nil nil = nil 
goal: Mathlib.Vector.map₂ f Mathlib.Vector.nil Mathlib.Vector.nil = Mathlib.Vector.nil

full_name: Mathlib.Vector.map₂_cons
code: @[simp]
theorem map₂_cons (hd₁ : α) (tl₁ : Vector α n) (hd₂ : β) (tl₂ : Vector β n) (f : α → β → γ) :
    Vector.map₂ f (hd₁ ::ᵥ tl₁) (hd₂ ::ᵥ tl₂) = f hd₁ hd₂ ::ᵥ (Vector.map₂ f tl₁ tl₂) 
goal: Mathlib.Vector.map₂ f (hd₁ ::ᵥ tl₁) (hd₂ ::ᵥ tl₂) = f hd₁ hd₂ ::ᵥ Mathlib.Vector.map₂ f tl₁ tl₂

full_name: Mathlib.Vector.get_ofFn
code: @[simp]
theorem get_ofFn {n} (f : Fin n → α) (i) : get (ofFn f) i = f i 
goal: (Mathlib.Vector.ofFn f).get i = f i

full_name: Mathlib.Vector.ofFn_get
code: @[simp]
theorem ofFn_get (v : Vector α n) : ofFn (get v) = v 
goal: Mathlib.Vector.ofFn v.get = v

full_name: Equiv.vectorEquivFin
code: /-- The natural equivalence between length-`n` vectors and functions from `Fin n`. -/
def _root_.Equiv.vectorEquivFin (α : Type*) (n : ℕ) : Vector α n ≃ (Fin n → α) 
goal: Mathlib.Vector α n ≃ (Fin n → α)

full_name: Mathlib.Vector.get_tail
code: theorem get_tail (x : Vector α n) (i) : x.tail.get i = x.get ⟨i.1 + 1, by omega⟩ 
goal: x.tail.get i = x.get ⟨↑i + 1, ⋯⟩

full_name: Mathlib.Vector.get_tail_succ
code: @[simp]
theorem get_tail_succ : ∀ (v : Vector α n.succ) (i : Fin n), get (tail v) i = get v i.succ
  
goal: v.tail.get i = v.get i.succ

full_name: Mathlib.Vector.tail_val
code: @[simp]
theorem tail_val : ∀ v : Vector α n.succ, v.tail.val = v.val.tail
  
goal: ↑v.tail = (↑v).tail

full_name: Mathlib.Vector.tail_nil
code: /-- The `tail` of a `nil` vector is `nil`. -/
@[simp]
theorem tail_nil : (@nil α).tail = nil 
goal: Mathlib.Vector.nil.tail = Mathlib.Vector.nil

full_name: Mathlib.Vector.singleton_tail
code: /-- The `tail` of a vector made up of one element is `nil`. -/
@[simp]
theorem singleton_tail : ∀ (v : Vector α 1), v.tail = Vector.nil
  
goal: v.tail = Mathlib.Vector.nil

full_name: Mathlib.Vector.tail_ofFn
code: @[simp]
theorem tail_ofFn {n : ℕ} (f : Fin n.succ → α) : tail (ofFn f) = ofFn fun i => f i.succ 
goal: (Mathlib.Vector.ofFn f).tail = Mathlib.Vector.ofFn fun i => f i.succ

full_name: Mathlib.Vector.toList_empty
code: @[simp]
theorem toList_empty (v : Vector α 0) : v.toList = [] 
goal: v.toList = []

full_name: Mathlib.Vector.toList_singleton
code: /-- The list that makes up a `Vector` made up of a single element,
retrieved via `toList`, is equal to the list of that single element. -/
@[simp]
theorem toList_singleton (v : Vector α 1) : v.toList = [v.head] 
goal: v.toList = [v.head]

full_name: Mathlib.Vector.empty_toList_eq_ff
code: @[simp]
theorem empty_toList_eq_ff (v : Vector α (n + 1)) : v.toList.isEmpty = false 
goal: v.toList.isEmpty = false

full_name: Mathlib.Vector.not_empty_toList
code: theorem not_empty_toList (v : Vector α (n + 1)) : ¬v.toList.isEmpty 
goal: ¬v.toList.isEmpty = true

full_name: Mathlib.Vector.map_id
code: /-- Mapping under `id` does not change a vector. -/
@[simp]
theorem map_id {n : ℕ} (v : Vector α n) : Vector.map id v = v 
goal: Mathlib.Vector.map id v = v

full_name: Mathlib.Vector.nodup_iff_injective_get
code: theorem nodup_iff_injective_get {v : Vector α n} : v.toList.Nodup ↔ Function.Injective v.get 
goal: v.toList.Nodup ↔ Function.Injective v.get

full_name: Mathlib.Vector.head?_toList
code: theorem head?_toList : ∀ v : Vector α n.succ, (toList v).head? = some (head v)
  
goal: v.toList.head? = some v.head

full_name: Mathlib.Vector.reverse
code: /-- Reverse a vector. -/
def reverse (v : Vector α n) : Vector α n 
goal: Mathlib.Vector α n

full_name: Mathlib.Vector.toList_reverse
code: /-- The `List` of a vector after a `reverse`, retrieved by `toList` is equal
to the `List.reverse` after retrieving a vector's `toList`. -/
theorem toList_reverse {v : Vector α n} : v.reverse.toList = v.toList.reverse 
goal: v.reverse.toList = v.toList.reverse

full_name: Mathlib.Vector.reverse_reverse
code: @[simp]
theorem reverse_reverse {v : Vector α n} : v.reverse.reverse = v 
goal: v.reverse.reverse = v

full_name: Mathlib.Vector.get_zero
code: @[simp]
theorem get_zero : ∀ v : Vector α n.succ, get v 0 = head v
  
goal: v.get 0 = v.head

full_name: Mathlib.Vector.head_ofFn
code: @[simp]
theorem head_ofFn {n : ℕ} (f : Fin n.succ → α) : head (ofFn f) = f 0 
goal: (Mathlib.Vector.ofFn f).head = f 0

full_name: Mathlib.Vector.get_cons_zero
code: theorem get_cons_zero (a : α) (v : Vector α n) : get (a ::ᵥ v) 0 = a 
goal: (a ::ᵥ v).get 0 = a

full_name: Mathlib.Vector.get_cons_nil
code: /-- Accessing the nth element of a vector made up
of one element `x : α` is `x` itself. -/
@[simp]
theorem get_cons_nil : ∀ {ix : Fin 1} (x : α), get (x ::ᵥ nil) ix = x
  
goal: (x ::ᵥ Mathlib.Vector.nil).get ix = x

full_name: Mathlib.Vector.get_cons_succ
code: @[simp]
theorem get_cons_succ (a : α) (v : Vector α n) (i : Fin n) : get (a ::ᵥ v) i.succ = get v i 
goal: (a ::ᵥ v).get i.succ = v.get i

full_name: Mathlib.Vector.last
code: /-- The last element of a `Vector`, given that the vector is at least one element. -/
def last (v : Vector α (n + 1)) : α 
goal: α

full_name: Mathlib.Vector.last_def
code: /-- The last element of a `Vector`, given that the vector is at least one element. -/
theorem last_def {v : Vector α (n + 1)} : v.last = v.get (Fin.last n) 
goal: v.last = v.get (Fin.last n)

full_name: Mathlib.Vector.reverse_get_zero
code: /-- The `last` element of a vector is the `head` of the `reverse` vector. -/
theorem reverse_get_zero {v : Vector α (n + 1)} : v.reverse.head = v.last 
goal: v.reverse.head = v.last

full_name: Mathlib.Vector.scanl
code: /-- Construct a `Vector β (n + 1)` from a `Vector α n` by scanning `f : β → α → β`
from the "left", that is, from 0 to `Fin.last n`, using `b : β` as the starting value.
-/
def scanl : Vector β (n + 1) 
goal: Mathlib.Vector β (n + 1)

full_name: Mathlib.Vector.scanl_nil
code: /-- Providing an empty vector to `scanl` gives the starting value `b : β`. -/
@[simp]
theorem scanl_nil : scanl f b nil = b ::ᵥ nil 
goal: Mathlib.Vector.scanl f b Mathlib.Vector.nil = b ::ᵥ Mathlib.Vector.nil

full_name: Mathlib.Vector.scanl_cons
code: /-- The recursive step of `scanl` splits a vector `x ::ᵥ v : Vector α (n + 1)`
into the provided starting value `b : β` and the recursed `scanl`
`f b x : β` as the starting value.

This lemma is the `cons` version of `scanl_get`.
-/
@[simp]
theorem scanl_cons (x : α) : scanl f b (x ::ᵥ v) = b ::ᵥ scanl f (f b x) v 
goal: Mathlib.Vector.scanl f b (x ::ᵥ v) = b ::ᵥ Mathlib.Vector.scanl f (f b x) v

full_name: Mathlib.Vector.scanl_val
code: /-- The underlying `List` of a `Vector` after a `scanl` is the `List.scanl`
of the underlying `List` of the original `Vector`.
-/
@[simp]
theorem scanl_val : ∀ {v : Vector α n}, (scanl f b v).val = List.scanl f b v.val
  
goal: ↑(Mathlib.Vector.scanl f b v) = List.scanl f b ↑v

full_name: Mathlib.Vector.toList_scanl
code: /-- The `toList` of a `Vector` after a `scanl` is the `List.scanl`
of the `toList` of the original `Vector`.
-/
@[simp]
theorem toList_scanl : (scanl f b v).toList = List.scanl f b v.toList 
goal: (Mathlib.Vector.scanl f b v).toList = List.scanl f b v.toList

full_name: Mathlib.Vector.scanl_singleton
code: /-- The recursive step of `scanl` splits a vector made up of a single element
`x ::ᵥ nil : Vector α 1` into a `Vector` of the provided starting value `b : β`
and the mapped `f b x : β` as the last value.
-/
@[simp]
theorem scanl_singleton (v : Vector α 1) : scanl f b v = b ::ᵥ f b v.head ::ᵥ nil 
goal: Mathlib.Vector.scanl f b v = b ::ᵥ f b v.head ::ᵥ Mathlib.Vector.nil

full_name: Mathlib.Vector.scanl_head
code: /-- The first element of `scanl` of a vector `v : Vector α n`,
retrieved via `head`, is the starting value `b : β`.
-/
@[simp]
theorem scanl_head : (scanl f b v).head = b 
goal: (Mathlib.Vector.scanl f b v).head = b

full_name: Mathlib.Vector.scanl_get
code: /-- For an index `i : Fin n`, the nth element of `scanl` of a
vector `v : Vector α n` at `i.succ`, is equal to the application
function `f : β → α → β` of the `castSucc i` element of
`scanl f b v` and `get v i`.

This lemma is the `get` version of `scanl_cons`.
-/
@[simp]
theorem scanl_get (i : Fin n) :
    (scanl f b v).get i.succ = f ((scanl f b v).get (Fin.castSucc i)) (v.get i) 
goal: (Mathlib.Vector.scanl f b v).get i.succ = f ((Mathlib.Vector.scanl f b v).get i.castSucc) (v.get i)

full_name: Mathlib.Vector.mOfFn
code: /-- Monadic analog of `Vector.ofFn`.
Given a monadic function on `Fin n`, return a `Vector α n` inside the monad. -/
def mOfFn {m} [Monad m] {α : Type u} : ∀ {n}, (Fin n → m α) → m (Vector α n)
  
goal: (Fin n → m α) → m (Mathlib.Vector α n)

full_name: Mathlib.Vector.mOfFn_pure
code: theorem mOfFn_pure {m} [Monad m] [LawfulMonad m] {α} :
    ∀ {n} (f : Fin n → α), (@mOfFn m _ _ _ fun i => pure (f i)) = pure (ofFn f)
  
goal: (Mathlib.Vector.mOfFn fun i => pure (f i)) = pure (Mathlib.Vector.ofFn f)

full_name: Mathlib.Vector.mmap
code: /-- Apply a monadic function to each component of a vector,
returning a vector inside the monad. -/
def mmap {m} [Monad m] {α} {β : Type u} (f : α → m β) : ∀ {n}, Vector α n → m (Vector β n)
  
goal: Mathlib.Vector α n → m (Mathlib.Vector β n)

full_name: Mathlib.Vector.mmap_nil
code: @[simp]
theorem mmap_nil {m} [Monad m] {α β} (f : α → m β) : mmap f nil = pure nil 
goal: Mathlib.Vector.mmap f Mathlib.Vector.nil = pure Mathlib.Vector.nil

full_name: Mathlib.Vector.mmap_cons
code: @[simp]
theorem mmap_cons {m} [Monad m] {α β} (f : α → m β) (a) :
    ∀ {n} (v : Vector α n),
      mmap f (a ::ᵥ v) = do
        let h' ← f a
        let t' ← mmap f v
        pure (h' ::ᵥ t')
  
goal: Mathlib.Vector.mmap f (a ::ᵥ v) = do
  let h' ← f a
  let t' ← Mathlib.Vector.mmap f v
  pure (h' ::ᵥ t')

full_name: Mathlib.Vector.inductionOn
code: /--
Define `C v` by induction on `v : Vector α n`.

This function has two arguments: `nil` handles the base case on `C nil`,
and `cons` defines the inductive step using `∀ x : α, C w → C (x ::ᵥ w)`.

It is used as the default induction principle for the `induction` tactic.
-/
@[elab_as_elim, induction_eliminator]
def inductionOn {C : ∀ {n : ℕ}, Vector α n → Sort*} {n : ℕ} (v : Vector α n)
    (nil : C nil) (cons : ∀ {n : ℕ} {x : α} {w : Vector α n}, C w → C (x ::ᵥ w)) : C v 
goal: C v

full_name: Mathlib.Vector.inductionOn_nil
code: @[simp]
theorem inductionOn_nil {C : ∀ {n : ℕ}, Vector α n → Sort*}
    (nil : C nil) (cons : ∀ {n : ℕ} {x : α} {w : Vector α n}, C w → C (x ::ᵥ w)) :
    Vector.nil.inductionOn nil cons = nil 
goal: (Mathlib.Vector.nil.inductionOn nil fun {n} {x} {w} => cons) = nil

full_name: Mathlib.Vector.inductionOn_cons
code: @[simp]
theorem inductionOn_cons {C : ∀ {n : ℕ}, Vector α n → Sort*} {n : ℕ} (x : α) (v : Vector α n)
    (nil : C nil) (cons : ∀ {n : ℕ} {x : α} {w : Vector α n}, C w → C (x ::ᵥ w)) :
    (x ::ᵥ v).inductionOn nil cons = cons (v.inductionOn nil cons : C v) 
goal: ((x ::ᵥ v).inductionOn nil fun {n} {x} {w} => cons) = cons (v.inductionOn nil fun {n} {x} {w} => cons)

full_name: Mathlib.Vector.inductionOn₂
code: /-- Define `C v w` by induction on a pair of vectors `v : Vector α n` and `w : Vector β n`. -/
@[elab_as_elim]
def inductionOn₂ {C : ∀ {n}, Vector α n → Vector β n → Sort*}
    (v : Vector α n) (w : Vector β n)
    (nil : C nil nil) (cons : ∀ {n a b} {x : Vector α n} {y}, C x y → C (a ::ᵥ x) (b ::ᵥ y)) :
    C v w 
goal: C v w

full_name: Mathlib.Vector.inductionOn₃
code: /-- Define `C u v w` by induction on a triplet of vectors
`u : Vector α n`, `v : Vector β n`, and `w : Vector γ b`. -/
@[elab_as_elim]
def inductionOn₃ {C : ∀ {n}, Vector α n → Vector β n → Vector γ n → Sort*}
    (u : Vector α n) (v : Vector β n) (w : Vector γ n) (nil : C nil nil nil)
    (cons : ∀ {n a b c} {x : Vector α n} {y z}, C x y z → C (a ::ᵥ x) (b ::ᵥ y) (c ::ᵥ z)) :
    C u v w 
goal: C u v w

full_name: Mathlib.Vector.casesOn
code: /-- Define `motive v` by case-analysis on `v : Vector α n`. -/
def casesOn {motive : ∀ {n}, Vector α n → Sort*} (v : Vector α m)
    (nil : motive nil)
    (cons : ∀ {n}, (hd : α) → (tl : Vector α n) → motive (Vector.cons hd tl)) :
    motive v 
goal: motive v

full_name: Mathlib.Vector.casesOn₂
code: /-- Define `motive v₁ v₂` by case-analysis on `v₁ : Vector α n` and `v₂ : Vector β n`. -/
def casesOn₂  {motive : ∀{n}, Vector α n → Vector β n → Sort*} (v₁ : Vector α m) (v₂ : Vector β m)
    (nil : motive nil nil)
    (cons : ∀{n}, (x : α) → (y : β) → (xs : Vector α n) → (ys : Vector β n)
      → motive (x ::ᵥ xs) (y ::ᵥ ys)) :
    motive v₁ v₂ 
goal: motive v₁ v₂

full_name: Mathlib.Vector.casesOn₃
code: /-- Define `motive v₁ v₂ v₃` by case-analysis on `v₁ : Vector α n`, `v₂ : Vector β n`, and
    `v₃ : Vector γ n`. -/
def casesOn₃  {motive : ∀{n}, Vector α n → Vector β n → Vector γ n → Sort*} (v₁ : Vector α m)
    (v₂ : Vector β m) (v₃ : Vector γ m) (nil : motive nil nil nil)
    (cons : ∀{n}, (x : α) → (y : β) → (z : γ) → (xs : Vector α n) → (ys : Vector β n)
      → (zs : Vector γ n) → motive (x ::ᵥ xs) (y ::ᵥ ys) (z ::ᵥ zs)) :
    motive v₁ v₂ v₃ 
goal: motive v₁ v₂ v₃

full_name: Mathlib.Vector.toArray
code: /-- Cast a vector to an array. -/
def toArray : Vector α n → Array α
  
goal: Mathlib.Vector α n → Array α

full_name: Mathlib.Vector.insertNth
code: /-- `v.insertNth a i` inserts `a` into the vector `v` at position `i`
(and shifting later components to the right). -/
def insertNth (a : α) (i : Fin (n + 1)) (v : Vector α n) : Vector α (n + 1) 
goal: Mathlib.Vector α (n + 1)

full_name: Mathlib.Vector.insertNth_val
code: theorem insertNth_val {i : Fin (n + 1)} {v : Vector α n} :
    (v.insertNth a i).val = v.val.insertNth i.1 a 
goal: ↑(Mathlib.Vector.insertNth a i v) = List.insertNth (↑i) a ↑v

full_name: Mathlib.Vector.eraseIdx_val
code: @[simp]
theorem eraseIdx_val {i : Fin n} : ∀ {v : Vector α n}, (eraseIdx i v).val = v.val.eraseIdx i
  
goal: ↑(Mathlib.Vector.eraseIdx i v) = (↑v).eraseIdx ↑i

full_name: Mathlib.Vector.eraseIdx_insertNth
code: theorem eraseIdx_insertNth {v : Vector α n} {i : Fin (n + 1)} :
    eraseIdx i (insertNth a i v) = v 
goal: Mathlib.Vector.eraseIdx i (Mathlib.Vector.insertNth a i v) = v

full_name: Mathlib.Vector.eraseIdx_insertNth'
code: theorem eraseIdx_insertNth' {v : Vector α (n + 1)} :
    ∀ {i : Fin (n + 1)} {j : Fin (n + 2)},
      eraseIdx (j.succAbove i) (insertNth a j v) = insertNth a (i.predAbove j) (eraseIdx i v)
  
goal: Mathlib.Vector.eraseIdx (j.succAbove i) (Mathlib.Vector.insertNth a j v) =
  Mathlib.Vector.insertNth a (i.predAbove j) (Mathlib.Vector.eraseIdx i v)

full_name: Mathlib.Vector.insertNth_comm
code: theorem insertNth_comm (a b : α) (i j : Fin (n + 1)) (h : i ≤ j) :
    ∀ v : Vector α n,
      (v.insertNth a i).insertNth b j.succ = (v.insertNth b j).insertNth a (Fin.castSucc i)
  
goal: Mathlib.Vector.insertNth b j.succ (Mathlib.Vector.insertNth a i v) =
  Mathlib.Vector.insertNth a i.castSucc (Mathlib.Vector.insertNth b j v)

full_name: Mathlib.Vector.set
code: /-- `set v n a` replaces the `n`th element of `v` with `a`. -/
def set (v : Vector α n) (i : Fin n) (a : α) : Vector α n 
goal: Mathlib.Vector α n

full_name: Mathlib.Vector.toList_set
code: @[simp]
theorem toList_set (v : Vector α n) (i : Fin n) (a : α) :
    (v.set i a).toList = v.toList.set i a 
goal: (v.set i a).toList = v.toList.set (↑i) a

full_name: Mathlib.Vector.get_set_same
code: @[simp]
theorem get_set_same (v : Vector α n) (i : Fin n) (a : α) : (v.set i a).get i = a 
goal: (v.set i a).get i = a

full_name: Mathlib.Vector.get_set_of_ne
code: theorem get_set_of_ne {v : Vector α n} {i j : Fin n} (h : i ≠ j) (a : α) :
    (v.set i a).get j = v.get j 
goal: (v.set i a).get j = v.get j

full_name: Mathlib.Vector.get_set_eq_if
code: theorem get_set_eq_if {v : Vector α n} {i j : Fin n} (a : α) :
    (v.set i a).get j = if i = j then a else v.get j 
goal: (v.set i a).get j = if i = j then a else v.get j

full_name: Mathlib.Vector.sum_set
code: @[to_additive]
theorem prod_set [Monoid α] (v : Vector α n) (i : Fin n) (a : α) :
    (v.set i a).toList.prod = (v.take i).toList.prod * a * (v.drop (i + 1)).toList.prod 
goal: (v.set i a).toList.sum = (Mathlib.Vector.take (↑i) v).toList.sum + a + (Mathlib.Vector.drop (↑i + 1) v).toList.sum

full_name: Mathlib.Vector.prod_set
code: @[to_additive]
theorem prod_set [Monoid α] (v : Vector α n) (i : Fin n) (a : α) :
    (v.set i a).toList.prod = (v.take i).toList.prod * a * (v.drop (i + 1)).toList.prod 
goal: (v.set i a).toList.prod = (Mathlib.Vector.take (↑i) v).toList.prod * a * (Mathlib.Vector.drop (↑i + 1) v).toList.prod

full_name: Mathlib.Vector.prod_set'
code: @[to_additive]
theorem prod_set' [CommGroup α] (v : Vector α n) (i : Fin n) (a : α) :
    (v.set i a).toList.prod = v.toList.prod * (v.get i)⁻¹ * a 
goal: (v.set i a).toList.prod = v.toList.prod * (v.get i)⁻¹ * a

full_name: Mathlib.Vector.sum_set'
code: @[to_additive]
theorem prod_set' [CommGroup α] (v : Vector α n) (i : Fin n) (a : α) :
    (v.set i a).toList.prod = v.toList.prod * (v.get i)⁻¹ * a 
goal: (v.set i a).toList.sum = v.toList.sum + -v.get i + a

full_name: _private.Mathlib.Data.Vector.Basic.0.Mathlib.Vector.traverseAux
code: private def traverseAux {α β : Type u} (f : α → F β) : ∀ x : List α, F (Vector β x.length)
  
goal: F (Mathlib.Vector β x.length)

full_name: Mathlib.Vector.traverse
code: /-- Apply an applicative function to each component of a vector. -/
protected def traverse {α β : Type u} (f : α → F β) : Vector α n → F (Vector β n)
  
goal: Mathlib.Vector α n → F (Mathlib.Vector β n)

full_name: Mathlib.Vector.traverse_def
code: @[simp]
protected theorem traverse_def (f : α → F β) (x : α) :
    ∀ xs : Vector α n, (x ::ᵥ xs).traverse f = cons <$> f x <*> xs.traverse f 
goal: Mathlib.Vector.traverse f (x ::ᵥ xs) = Seq.seq (Mathlib.Vector.cons <$> f x) fun x => Mathlib.Vector.traverse f xs

full_name: Mathlib.Vector.id_traverse
code: protected theorem id_traverse : ∀ x : Vector α n, x.traverse (pure : _ → Id _) = x 
goal: Mathlib.Vector.traverse pure x = x

full_name: Mathlib.Vector.comp_traverse
code: @[nolint unusedArguments]
protected theorem comp_traverse (f : β → F γ) (g : α → G β) (x : Vector α n) :
    Vector.traverse (Comp.mk ∘ Functor.map f ∘ g) x =
      Comp.mk (Vector.traverse f <$> Vector.traverse g x) 
goal: Mathlib.Vector.traverse (Functor.Comp.mk ∘ Functor.map f ∘ g) x =
  Functor.Comp.mk (Mathlib.Vector.traverse f <$> Mathlib.Vector.traverse g x)

full_name: Mathlib.Vector.traverse_eq_map_id
code: protected theorem traverse_eq_map_id {α β} (f : α → β) :
    ∀ x : Vector α n, x.traverse ((pure : _ → Id _) ∘ f) = (pure : _ → Id _) (map f x) 
goal: Mathlib.Vector.traverse (pure ∘ f) x = pure (Mathlib.Vector.map f x)

full_name: Mathlib.Vector.naturality
code: protected theorem naturality {α β : Type u} (f : α → F β) (x : Vector α n) :
    η (x.traverse f) = x.traverse (@η _ ∘ f) 
goal: (fun {α} => η.app α) (Mathlib.Vector.traverse f x) = Mathlib.Vector.traverse ((fun {α} => η.app α) ∘ f) x

full_name: Mathlib.Vector.instTraversableFlipNat
code: instance : Traversable.{u} (flip Vector n) 
goal: Traversable (flip Mathlib.Vector n)

full_name: Mathlib.Vector.instLawfulTraversableFlipNat
code: instance : LawfulTraversable.{u} (flip Vector n) 
goal: LawfulTraversable (flip Mathlib.Vector n)

full_name: Mathlib.Vector.replicate_succ
code: @[simp]
theorem replicate_succ (val : α) :
    replicate (n+1) val = val ::ᵥ (replicate n val) 
goal: Mathlib.Vector.replicate (n + 1) val = val ::ᵥ Mathlib.Vector.replicate n val

full_name: Mathlib.Vector.get_append_cons_zero
code: @[simp] lemma get_append_cons_zero : get (append (x ::ᵥ xs) ys) ⟨0, by omega⟩ = x 
goal: ((x ::ᵥ xs).append ys).get ⟨0, ⋯⟩ = x

full_name: Mathlib.Vector.get_append_cons_succ
code: @[simp]
theorem get_append_cons_succ {i : Fin (n + m)} {h} :
    get (append (x ::ᵥ xs) ys) ⟨i+1, h⟩ = get (append xs ys) i 
goal: ((x ::ᵥ xs).append ys).get ⟨↑i + 1, h⟩ = (xs.append ys).get i

full_name: Mathlib.Vector.append_nil
code: @[simp]
theorem append_nil : append xs nil = xs 
goal: xs.append Mathlib.Vector.nil = xs

full_name: Mathlib.Vector.get_map₂
code: @[simp]
theorem get_map₂ (v₁ : Vector α n) (v₂ : Vector β n) (f : α → β → γ) (i : Fin n) :
    get (map₂ f v₁ v₂) i = f (get v₁ i) (get v₂ i) 
goal: (Mathlib.Vector.map₂ f v₁ v₂).get i = f (v₁.get i) (v₂.get i)

full_name: Mathlib.Vector.mapAccumr_cons
code: @[simp]
theorem mapAccumr_cons :
    mapAccumr f (x ::ᵥ xs) s
    = let r := mapAccumr f xs s
      let q := f x r.1
      (q.1, q.2 ::ᵥ r.2) 
goal: ∀ {α_1 : Type} {β : Type u_1} {f : α → α_1 → α_1 × β} {x : α} {s : α_1},
  Mathlib.Vector.mapAccumr f (x ::ᵥ xs) s =
    let r := Mathlib.Vector.mapAccumr f xs s;
    let q := f x r.1;
    (q.1, q.2 ::ᵥ r.2)

full_name: Mathlib.Vector.mapAccumr₂_cons
code: @[simp]
theorem mapAccumr₂_cons :
    mapAccumr₂ f (x ::ᵥ xs) (y ::ᵥ ys) s
    = let r := mapAccumr₂ f xs ys s
      let q := f x y r.1
      (q.1, q.2 ::ᵥ r.2) 
goal: ∀ {α_1 β_1 : Type} {f : α → β → α_1 → α_1 × β_1} {x : α} {y : β} {s : α_1},
  Mathlib.Vector.mapAccumr₂ f (x ::ᵥ xs) (y ::ᵥ ys) s =
    let r := Mathlib.Vector.mapAccumr₂ f xs ys s;
    let q := f x y r.1;
    (q.1, q.2 ::ᵥ r.2)