File: Mathlib/Data/Vector/Snoc.lean

full_name: Mathlib.Vector.snoc
code: /-- Append a single element to the end of a vector -/
def snoc : Vector α n → α → Vector α (n+1) 
goal: Mathlib.Vector α n → α → Mathlib.Vector α (n + 1)

full_name: Mathlib.Vector.snoc_cons
code: @[simp]
theorem snoc_cons : (x ::ᵥ xs).snoc y = x ::ᵥ (xs.snoc y) 
goal: (x ::ᵥ xs).snoc y = x ::ᵥ xs.snoc y

full_name: Mathlib.Vector.snoc_nil
code: @[simp]
theorem snoc_nil : (nil.snoc x) = x ::ᵥ nil 
goal: ∀ {α : Type u_1} {x : α}, Mathlib.Vector.nil.snoc x = x ::ᵥ Mathlib.Vector.nil

full_name: Mathlib.Vector.reverse_cons
code: @[simp]
theorem reverse_cons : reverse (x ::ᵥ xs) = (reverse xs).snoc x 
goal: (x ::ᵥ xs).reverse = xs.reverse.snoc x

full_name: Mathlib.Vector.reverse_snoc
code: @[simp]
theorem reverse_snoc : reverse (xs.snoc x) = x ::ᵥ (reverse xs) 
goal: (xs.snoc x).reverse = x ::ᵥ xs.reverse

full_name: Mathlib.Vector.replicate_succ_to_snoc
code: theorem replicate_succ_to_snoc (val : α) :
    replicate (n+1) val = (replicate n val).snoc val 
goal: Mathlib.Vector.replicate (n + 1) val = (Mathlib.Vector.replicate n val).snoc val

full_name: Mathlib.Vector.revInductionOn
code: /-- 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`. -/
@[elab_as_elim]
def revInductionOn {C : ∀ {n : ℕ}, Vector α n → Sort*} {n : ℕ} (v : Vector α n)
    (nil : C nil)
    (snoc : ∀ {n : ℕ} (xs : Vector α n) (x : α), C xs → C (xs.snoc x)) :
    C v 
goal: C v

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

full_name: Mathlib.Vector.revCasesOn
code: /-- Define `C v` by *reverse* case analysis, i.e. by handling the cases `nil` and `xs.snoc x`
    separately -/
@[elab_as_elim]
def revCasesOn {C : ∀ {n : ℕ}, Vector α n → Sort*} {n : ℕ} (v : Vector α n)
    (nil : C nil)
    (snoc : ∀ {n : ℕ} (xs : Vector α n) (x : α), C (xs.snoc x)) :
    C v 
goal: C v

full_name: Mathlib.Vector.map_snoc
code: @[simp]
theorem map_snoc : map f (xs.snoc x) = (map f xs).snoc (f x) 
goal: ∀ {α_1 : Type u_1} {f : α → α_1} {x : α}, Mathlib.Vector.map f (xs.snoc x) = (Mathlib.Vector.map f xs).snoc (f x)

full_name: Mathlib.Vector.mapAccumr_nil
code: @[simp]
theorem mapAccumr_nil : mapAccumr f Vector.nil s = (s, Vector.nil) 
goal: ∀ {α : Type u_1} {α_1 : Type} {β : Type u_2} {f : α → α_1 → α_1 × β} {s : α_1},
  Mathlib.Vector.mapAccumr f Mathlib.Vector.nil s = (s, Mathlib.Vector.nil)

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

full_name: Mathlib.Vector.map₂_snoc
code: @[simp]
theorem map₂_snoc : map₂ f (xs.snoc x) (ys.snoc y) = (map₂ f xs ys).snoc (f x y) 
goal: ∀ {α_1 : Type u_1} {f : α → β → α_1} {x : α} {y : β},
  Mathlib.Vector.map₂ f (xs.snoc x) (ys.snoc y) = (Mathlib.Vector.map₂ f xs ys).snoc (f x y)

full_name: Mathlib.Vector.mapAccumr₂_nil
code: @[simp]
theorem mapAccumr₂_nil : mapAccumr₂ f Vector.nil Vector.nil s = (s, Vector.nil) 
goal: ∀ {α β α_1 β_1 : Type} {f : α → β → α_1 → α_1 × β_1} {s : α_1},
  Mathlib.Vector.mapAccumr₂ f Mathlib.Vector.nil Mathlib.Vector.nil s = (s, Mathlib.Vector.nil)

full_name: Mathlib.Vector.mapAccumr₂_snoc
code: @[simp]
theorem mapAccumr₂_snoc (f : α → β → σ → σ × φ) (x : α) (y : β) :
    mapAccumr₂ f (xs.snoc x) (ys.snoc y) c
    = let q := f x y c
      let r := mapAccumr₂ f xs ys q.1
      (r.1, r.2.snoc q.2) 
goal: Mathlib.Vector.mapAccumr₂ f (xs.snoc x) (ys.snoc y) c =
  let q := f x y c;
  let r := Mathlib.Vector.mapAccumr₂ f xs ys q.1;
  (r.1, r.2.snoc q.2)