Documentation

Mathlib.Data.Vector.Basic

Additional theorems and definitions about the Vector type #

This file introduces the infix notation ::ᵥ for Vector.cons.

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.

Equations
Instances For
    instance List.Vector.instInhabited {α : Type u_1} {n : } [Inhabited α] :
    Equations
    theorem List.Vector.toList_injective {α : Type u_1} {n : } :
    Function.Injective List.Vector.toList
    theorem List.Vector.ext {α : Type u_1} {n : } {v w : List.Vector α n} :
    (∀ (m : Fin n), v.get m = w.get m)v = w

    Two v w : Vector α n are equal iff they are equal at every single index.

    @[simp]
    theorem List.Vector.cons_val {α : Type u_1} {n : } (a : α) (v : List.Vector α n) :
    (a ::ᵥ v) = a :: v
    theorem List.Vector.eq_cons_iff {α : Type u_1} {n : } (a : α) (v : List.Vector α n.succ) (v' : List.Vector α n) :
    v = a ::ᵥ v' v.head = a v.tail = v'
    theorem List.Vector.ne_cons_iff {α : Type u_1} {n : } (a : α) (v : List.Vector α n.succ) (v' : List.Vector α n) :
    v a ::ᵥ v' v.head a v.tail v'
    theorem List.Vector.exists_eq_cons {α : Type u_1} {n : } (v : List.Vector α n.succ) :
    ∃ (a : α) (as : List.Vector α n), v = a ::ᵥ as
    @[simp]
    theorem List.Vector.toList_ofFn {α : Type u_1} {n : } (f : Fin nα) :
    @[simp]
    theorem List.Vector.mk_toList {α : Type u_1} {n : } (v : List.Vector α n) (h : v.toList.length = n) :
    v.toList, h = v
    @[simp]
    theorem List.Vector.length_val {α : Type u_1} {n : } (v : List.Vector α n) :
    (↑v).length = n
    @[simp]
    theorem List.Vector.pmap_cons {α : Type u_1} {β : Type u_2} {n : } {p : αProp} (f : (a : α) → p aβ) (a : α) (v : List.Vector α n) (hp : x(a ::ᵥ v).toList, p x) :
    List.Vector.pmap f (a ::ᵥ v) hp = f a ::ᵥ List.Vector.pmap f v
    theorem List.Vector.pmap_cons' {α : Type u_1} {β : Type u_2} {n : } {p : αProp} (f : (a : α) → p aβ) (a : α) (v : List.Vector α n) (ha : p a) (hp : xv.toList, p x) :
    f a ha ::ᵥ List.Vector.pmap f v hp = List.Vector.pmap f (a ::ᵥ v)

    Opposite direction of Vector.pmap_cons

    @[simp]
    theorem List.Vector.toList_map {α : Type u_1} {n : } {β : Type u_6} (v : List.Vector α n) (f : αβ) :
    (List.Vector.map f v).toList = List.map f v.toList
    @[simp]
    theorem List.Vector.head_map {α : Type u_1} {n : } {β : Type u_6} (v : List.Vector α (n + 1)) (f : αβ) :
    (List.Vector.map f v).head = f v.head
    @[simp]
    theorem List.Vector.tail_map {α : Type u_1} {n : } {β : Type u_6} (v : List.Vector α (n + 1)) (f : αβ) :
    (List.Vector.map f v).tail = List.Vector.map f v.tail
    @[simp]
    theorem List.Vector.getElem_map {α : Type u_1} {n : } {β : Type u_6} (v : List.Vector α n) (f : αβ) {i : } (hi : i < n) :
    (List.Vector.map f v)[i] = f v[i]
    @[simp]
    theorem List.Vector.toList_pmap {α : Type u_1} {β : Type u_2} {n : } {p : αProp} (f : (a : α) → p aβ) (v : List.Vector α n) (hp : xv.toList, p x) :
    (List.Vector.pmap f v hp).toList = List.pmap f v.toList hp
    @[simp]
    theorem List.Vector.head_pmap {α : Type u_1} {β : Type u_2} {n : } {p : αProp} (f : (a : α) → p aβ) (v : List.Vector α (n + 1)) (hp : xv.toList, p x) :
    (List.Vector.pmap f v hp).head = f v.head
    @[simp]
    theorem List.Vector.tail_pmap {α : Type u_1} {β : Type u_2} {n : } {p : αProp} (f : (a : α) → p aβ) (v : List.Vector α (n + 1)) (hp : xv.toList, p x) :
    (List.Vector.pmap f v hp).tail = List.Vector.pmap f v.tail
    @[simp]
    theorem List.Vector.getElem_pmap {α : Type u_1} {β : Type u_2} {n : } {p : αProp} (f : (a : α) → p aβ) (v : List.Vector α n) (hp : xv.toList, p x) {i : } (hi : i < n) :
    (List.Vector.pmap f v hp)[i] = f v[i]
    theorem List.Vector.get_eq_get_toList {α : Type u_1} {n : } (v : List.Vector α n) (i : Fin n) :
    v.get i = v.toList.get (Fin.cast i)
    @[deprecated List.Vector.get_eq_get_toList]
    theorem List.Vector.get_eq_get {α : Type u_1} {n : } (v : List.Vector α n) (i : Fin n) :
    v.get i = v.toList.get (Fin.cast i)

    Alias of List.Vector.get_eq_get_toList.

    @[simp]
    theorem List.Vector.get_replicate {α : Type u_1} {n : } (a : α) (i : Fin n) :
    (List.Vector.replicate n a).get i = a
    @[simp]
    theorem List.Vector.get_map {α : Type u_1} {n : } {β : Type u_6} (v : List.Vector α n) (f : αβ) (i : Fin n) :
    (List.Vector.map f v).get i = f (v.get i)
    @[simp]
    theorem List.Vector.map₂_nil {α : Type u_1} {β : Type u_2} {γ : Type u_3} (f : αβγ) :
    List.Vector.map₂ f List.Vector.nil List.Vector.nil = List.Vector.nil
    @[simp]
    theorem List.Vector.map₂_cons {α : Type u_1} {β : Type u_2} {γ : Type u_3} {n : } (hd₁ : α) (tl₁ : List.Vector α n) (hd₂ : β) (tl₂ : List.Vector β n) (f : αβγ) :
    List.Vector.map₂ f (hd₁ ::ᵥ tl₁) (hd₂ ::ᵥ tl₂) = f hd₁ hd₂ ::ᵥ List.Vector.map₂ f tl₁ tl₂
    @[simp]
    theorem List.Vector.get_ofFn {α : Type u_1} {n : } (f : Fin nα) (i : Fin n) :
    (List.Vector.ofFn f).get i = f i
    @[simp]
    theorem List.Vector.ofFn_get {α : Type u_1} {n : } (v : List.Vector α n) :
    def Equiv.vectorEquivFin (α : Type u_6) (n : ) :
    List.Vector α n (Fin nα)

    The natural equivalence between length-n vectors and functions from Fin n.

    Equations
    • Equiv.vectorEquivFin α n = { toFun := List.Vector.get, invFun := List.Vector.ofFn, left_inv := , right_inv := }
    Instances For
      theorem List.Vector.get_tail {α : Type u_1} {n : } (x : List.Vector α n) (i : Fin (n - 1)) :
      x.tail.get i = x.get i + 1,
      @[simp]
      theorem List.Vector.get_tail_succ {α : Type u_1} {n : } (v : List.Vector α n.succ) (i : Fin n) :
      v.tail.get i = v.get i.succ
      @[simp]
      theorem List.Vector.tail_val {α : Type u_1} {n : } (v : List.Vector α n.succ) :
      v.tail = (↑v).tail
      @[simp]
      theorem List.Vector.tail_nil {α : Type u_1} :
      List.Vector.nil.tail = List.Vector.nil

      The tail of a nil vector is nil.

      @[simp]
      theorem List.Vector.singleton_tail {α : Type u_1} (v : List.Vector α 1) :
      v.tail = List.Vector.nil

      The tail of a vector made up of one element is nil.

      @[simp]
      theorem List.Vector.tail_ofFn {α : Type u_1} {n : } (f : Fin n.succα) :
      (List.Vector.ofFn f).tail = List.Vector.ofFn fun (i : Fin n) => f i.succ
      @[simp]
      theorem List.Vector.toList_empty {α : Type u_1} (v : List.Vector α 0) :
      v.toList = []
      @[simp]
      theorem List.Vector.toList_singleton {α : Type u_1} (v : List.Vector α 1) :
      v.toList = [v.head]

      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 List.Vector.empty_toList_eq_ff {α : Type u_1} {n : } (v : List.Vector α (n + 1)) :
      v.toList.isEmpty = false
      theorem List.Vector.not_empty_toList {α : Type u_1} {n : } (v : List.Vector α (n + 1)) :
      ¬v.toList.isEmpty = true
      @[simp]
      theorem List.Vector.map_id {α : Type u_1} {n : } (v : List.Vector α n) :

      Mapping under id does not change a vector.

      theorem List.Vector.nodup_iff_injective_get {α : Type u_1} {n : } {v : List.Vector α n} :
      v.toList.Nodup Function.Injective v.get
      theorem List.Vector.head?_toList {α : Type u_1} {n : } (v : List.Vector α n.succ) :
      v.toList.head? = some v.head
      def List.Vector.reverse {α : Type u_1} {n : } (v : List.Vector α n) :

      Reverse a vector.

      Equations
      • v.reverse = v.toList.reverse,
      Instances For
        theorem List.Vector.toList_reverse {α : Type u_1} {n : } {v : List.Vector α n} :
        v.reverse.toList = v.toList.reverse

        The List of a vector after a reverse, retrieved by toList is equal to the List.reverse after retrieving a vector's toList.

        @[simp]
        theorem List.Vector.reverse_reverse {α : Type u_1} {n : } {v : List.Vector α n} :
        v.reverse.reverse = v
        @[simp]
        theorem List.Vector.get_zero {α : Type u_1} {n : } (v : List.Vector α n.succ) :
        v.get 0 = v.head
        @[simp]
        theorem List.Vector.head_ofFn {α : Type u_1} {n : } (f : Fin n.succα) :
        (List.Vector.ofFn f).head = f 0
        theorem List.Vector.get_cons_zero {α : Type u_1} {n : } (a : α) (v : List.Vector α n) :
        (a ::ᵥ v).get 0 = a
        @[simp]
        theorem List.Vector.get_cons_nil {α : Type u_1} {ix : Fin 1} (x : α) :
        (x ::ᵥ List.Vector.nil).get ix = x

        Accessing the nth element of a vector made up of one element x : α is x itself.

        @[simp]
        theorem List.Vector.get_cons_succ {α : Type u_1} {n : } (a : α) (v : List.Vector α n) (i : Fin n) :
        (a ::ᵥ v).get i.succ = v.get i
        def List.Vector.last {α : Type u_1} {n : } (v : List.Vector α (n + 1)) :
        α

        The last element of a Vector, given that the vector is at least one element.

        Equations
        Instances For
          theorem List.Vector.last_def {α : Type u_1} {n : } {v : List.Vector α (n + 1)} :
          v.last = v.get (Fin.last n)

          The last element of a Vector, given that the vector is at least one element.

          theorem List.Vector.reverse_get_zero {α : Type u_1} {n : } {v : List.Vector α (n + 1)} :
          v.reverse.head = v.last

          The last element of a vector is the head of the reverse vector.

          def List.Vector.scanl {α : Type u_1} {n : } {β : Type u_6} (f : βαβ) (b : β) (v : List.Vector α n) :
          List.Vector β (n + 1)

          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.

          Equations
          Instances For
            @[simp]
            theorem List.Vector.scanl_nil {α : Type u_1} {β : Type u_6} (f : βαβ) (b : β) :
            List.Vector.scanl f b List.Vector.nil = b ::ᵥ List.Vector.nil

            Providing an empty vector to scanl gives the starting value b : β.

            @[simp]
            theorem List.Vector.scanl_cons {α : Type u_1} {n : } {β : Type u_6} (f : βαβ) (b : β) (v : List.Vector α n) (x : α) :

            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 List.Vector.scanl_val {α : Type u_1} {n : } {β : Type u_6} (f : βαβ) (b : β) {v : List.Vector α n} :
            (List.Vector.scanl f b v) = List.scanl f b v

            The underlying List of a Vector after a scanl is the List.scanl of the underlying List of the original Vector.

            @[simp]
            theorem List.Vector.toList_scanl {α : Type u_1} {n : } {β : Type u_6} (f : βαβ) (b : β) (v : List.Vector α n) :
            (List.Vector.scanl f b v).toList = List.scanl f b v.toList

            The toList of a Vector after a scanl is the List.scanl of the toList of the original Vector.

            @[simp]
            theorem List.Vector.scanl_singleton {α : Type u_1} {β : Type u_6} (f : βαβ) (b : β) (v : List.Vector α 1) :
            List.Vector.scanl f b v = b ::ᵥ f b v.head ::ᵥ List.Vector.nil

            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 List.Vector.scanl_head {α : Type u_1} {n : } {β : Type u_6} (f : βαβ) (b : β) (v : List.Vector α n) :
            (List.Vector.scanl f b v).head = b

            The first element of scanl of a vector v : Vector α n, retrieved via head, is the starting value b : β.

            @[simp]
            theorem List.Vector.scanl_get {α : Type u_1} {n : } {β : Type u_6} (f : βαβ) (b : β) (v : List.Vector α n) (i : Fin n) :
            (List.Vector.scanl f b v).get i.succ = f ((List.Vector.scanl f b v).get i.castSucc) (v.get i)

            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.

            def List.Vector.mOfFn {m : Type u → Type u_6} [Monad m] {α : Type u} {n : } :
            (Fin nm α)m (List.Vector α n)

            Monadic analog of Vector.ofFn. Given a monadic function on Fin n, return a Vector α n inside the monad.

            Equations
            Instances For
              theorem List.Vector.mOfFn_pure {m : Type u_6 → Type u_7} [Monad m] [LawfulMonad m] {α : Type u_6} {n : } (f : Fin nα) :
              (List.Vector.mOfFn fun (i : Fin n) => pure (f i)) = pure (List.Vector.ofFn f)
              def List.Vector.mmap {m : Type u → Type u_6} [Monad m] {α : Type u_7} {β : Type u} (f : αm β) {n : } :
              List.Vector α nm (List.Vector β n)

              Apply a monadic function to each component of a vector, returning a vector inside the monad.

              Equations
              Instances For
                @[simp]
                theorem List.Vector.mmap_nil {m : Type u_6 → Type u_7} [Monad m] {α : Type u_8} {β : Type u_6} (f : αm β) :
                List.Vector.mmap f List.Vector.nil = pure List.Vector.nil
                @[simp]
                theorem List.Vector.mmap_cons {m : Type u_6 → Type u_7} [Monad m] {α : Type u_8} {β : Type u_6} (f : αm β) (a : α) {n : } (v : List.Vector α n) :
                List.Vector.mmap f (a ::ᵥ v) = do let h'f a let t'List.Vector.mmap f v pure (h' ::ᵥ t')
                def List.Vector.inductionOn {α : Type u_1} {C : {n : } → List.Vector α nSort u_6} {n : } (v : List.Vector α n) (nil : C List.Vector.nil) (cons : {n : } → {x : α} → {w : List.Vector α n} → C wC (x ::ᵥ w)) :
                C v

                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.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[simp]
                  theorem List.Vector.inductionOn_nil {α : Type u_1} {C : {n : } → List.Vector α nSort u_6} (nil : C List.Vector.nil) (cons : {n : } → {x : α} → {w : List.Vector α n} → C wC (x ::ᵥ w)) :
                  (List.Vector.nil.inductionOn nil fun {n : } {x : α} {w : List.Vector α n} => cons) = nil
                  @[simp]
                  theorem List.Vector.inductionOn_cons {α : Type u_1} {C : {n : } → List.Vector α nSort u_6} {n : } (x : α) (v : List.Vector α n) (nil : C List.Vector.nil) (cons : {n : } → {x : α} → {w : List.Vector α n} → C wC (x ::ᵥ w)) :
                  ((x ::ᵥ v).inductionOn nil fun {n : } {x : α} {w : List.Vector α n} => cons) = cons (v.inductionOn nil fun {n : } {x : α} {w : List.Vector α n} => cons)
                  def List.Vector.inductionOn₂ {α : Type u_1} {n : } {β : Type u_6} {C : {n : } → List.Vector α nList.Vector β nSort u_8} (v : List.Vector α n) (w : List.Vector β n) (nil : C List.Vector.nil List.Vector.nil) (cons : {n : } → {a : α} → {b : β} → {x : List.Vector α n} → {y : List.Vector β n} → C x yC (a ::ᵥ x) (b ::ᵥ y)) :
                  C v w

                  Define C v w by 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
                    def List.Vector.inductionOn₃ {α : Type u_1} {n : } {β : Type u_6} {γ : Type u_7} {C : {n : } → List.Vector α nList.Vector β nList.Vector γ nSort u_8} (u : List.Vector α n) (v : List.Vector β n) (w : List.Vector γ n) (nil : C List.Vector.nil List.Vector.nil List.Vector.nil) (cons : {n : } → {a : α} → {b : β} → {c : γ} → {x : List.Vector α n} → {y : List.Vector β n} → {z : List.Vector γ n} → C x y zC (a ::ᵥ x) (b ::ᵥ y) (c ::ᵥ z)) :
                    C u v w

                    Define C u v w by induction on a triplet of vectors u : Vector α n, v : Vector β n, and w : Vector γ b.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def List.Vector.casesOn {α : Type u_1} {m : } {motive : {n : } → List.Vector α nSort u_8} (v : List.Vector α m) (nil : motive List.Vector.nil) (cons : {n : } → (hd : α) → (tl : List.Vector α n) → motive (hd ::ᵥ tl)) :
                      motive v

                      Define motive v by case-analysis on v : Vector α n.

                      Equations
                      Instances For
                        def List.Vector.casesOn₂ {α : Type u_1} {m : } {β : Type u_6} {motive : {n : } → List.Vector α nList.Vector β nSort u_8} (v₁ : List.Vector α m) (v₂ : List.Vector β m) (nil : motive List.Vector.nil List.Vector.nil) (cons : {n : } → (x : α) → (y : β) → (xs : List.Vector α n) → (ys : List.Vector β n) → motive (x ::ᵥ xs) (y ::ᵥ ys)) :
                        motive v₁ v₂

                        Define motive v₁ v₂ by case-analysis on v₁ : Vector α n and v₂ : Vector β n.

                        Equations
                        Instances For
                          def List.Vector.casesOn₃ {α : Type u_1} {m : } {β : Type u_6} {γ : Type u_7} {motive : {n : } → List.Vector α nList.Vector β nList.Vector γ nSort u_8} (v₁ : List.Vector α m) (v₂ : List.Vector β m) (v₃ : List.Vector γ m) (nil : motive List.Vector.nil List.Vector.nil List.Vector.nil) (cons : {n : } → (x : α) → (y : β) → (z : γ) → (xs : List.Vector α n) → (ys : List.Vector β n) → (zs : List.Vector γ n) → motive (x ::ᵥ xs) (y ::ᵥ ys) (z ::ᵥ zs)) :
                          motive v₁ v₂ v₃

                          Define motive v₁ v₂ v₃ by case-analysis on v₁ : Vector α n, v₂ : Vector β n, and v₃ : Vector γ n.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            def List.Vector.toArray {α : Type u_1} {n : } :
                            List.Vector α nArray α

                            Cast a vector to an array.

                            Equations
                            Instances For
                              def List.Vector.insertIdx {α : Type u_1} {n : } (a : α) (i : Fin (n + 1)) (v : List.Vector α n) :
                              List.Vector α (n + 1)

                              v.insertIdx a i inserts a into the vector v at position i (and shifting later components to the right).

                              Equations
                              Instances For
                                @[deprecated List.Vector.insertIdx]
                                def List.Vector.insertNth {α : Type u_1} {n : } (a : α) (i : Fin (n + 1)) (v : List.Vector α n) :
                                List.Vector α (n + 1)

                                Alias of List.Vector.insertIdx.


                                v.insertIdx a i inserts a into the vector v at position i (and shifting later components to the right).

                                Equations
                                Instances For
                                  theorem List.Vector.insertIdx_val {α : Type u_1} {n : } {a : α} {i : Fin (n + 1)} {v : List.Vector α n} :
                                  (List.Vector.insertIdx a i v) = List.insertIdx (↑i) a v
                                  @[deprecated List.Vector.insertIdx_val]
                                  theorem List.Vector.insertNth_val {α : Type u_1} {n : } {a : α} {i : Fin (n + 1)} {v : List.Vector α n} :
                                  (List.Vector.insertIdx a i v) = List.insertIdx (↑i) a v

                                  Alias of List.Vector.insertIdx_val.

                                  @[simp]
                                  theorem List.Vector.eraseIdx_val {α : Type u_1} {n : } {i : Fin n} {v : List.Vector α n} :
                                  (List.Vector.eraseIdx i v) = (↑v).eraseIdx i
                                  @[deprecated List.Vector.eraseIdx_val]
                                  theorem List.Vector.eraseNth_val {α : Type u_1} {n : } {i : Fin n} {v : List.Vector α n} :
                                  (List.Vector.eraseIdx i v) = (↑v).eraseIdx i

                                  Alias of List.Vector.eraseIdx_val.

                                  @[deprecated List.Vector.eraseIdx_val]
                                  theorem List.Vector.removeNth_val {α : Type u_1} {n : } {i : Fin n} {v : List.Vector α n} :
                                  (List.Vector.eraseIdx i v) = (↑v).eraseIdx i

                                  Alias of List.Vector.eraseIdx_val.

                                  theorem List.Vector.eraseIdx_insertIdx {α : Type u_1} {n : } {a : α} {v : List.Vector α n} {i : Fin (n + 1)} :
                                  @[deprecated List.Vector.eraseIdx_insertIdx]
                                  theorem List.Vector.eraseIdx_insertNth {α : Type u_1} {n : } {a : α} {v : List.Vector α n} {i : Fin (n + 1)} :

                                  Alias of List.Vector.eraseIdx_insertIdx.

                                  @[deprecated List.Vector.eraseIdx_insertIdx]
                                  theorem List.Vector.removeNth_insertNth {α : Type u_1} {n : } {a : α} {v : List.Vector α n} {i : Fin (n + 1)} :

                                  Alias of List.Vector.eraseIdx_insertIdx.

                                  theorem List.Vector.eraseIdx_insertIdx' {α : Type u_1} {n : } {a : α} {v : List.Vector α (n + 1)} {i : Fin (n + 1)} {j : Fin (n + 2)} :

                                  Erasing an element after inserting an element, at different indices.

                                  @[deprecated List.Vector.eraseIdx_insertIdx']
                                  theorem List.Vector.eraseIdx_insertNth' {α : Type u_1} {n : } {a : α} {v : List.Vector α (n + 1)} {i : Fin (n + 1)} {j : Fin (n + 2)} :

                                  Alias of List.Vector.eraseIdx_insertIdx'.


                                  Erasing an element after inserting an element, at different indices.

                                  @[deprecated List.Vector.eraseIdx_insertIdx']
                                  theorem List.Vector.removeNth_insertNth' {α : Type u_1} {n : } {a : α} {v : List.Vector α (n + 1)} {i : Fin (n + 1)} {j : Fin (n + 2)} :

                                  Alias of List.Vector.eraseIdx_insertIdx'.


                                  Erasing an element after inserting an element, at different indices.

                                  theorem List.Vector.insertIdx_comm {α : Type u_1} {n : } (a b : α) (i j : Fin (n + 1)) (h : i j) (v : List.Vector α n) :
                                  @[deprecated List.Vector.insertIdx_comm]
                                  theorem List.Vector.insertNth_comm {α : Type u_1} {n : } (a b : α) (i j : Fin (n + 1)) (h : i j) (v : List.Vector α n) :

                                  Alias of List.Vector.insertIdx_comm.

                                  def List.Vector.set {α : Type u_1} {n : } (v : List.Vector α n) (i : Fin n) (a : α) :

                                  set v n a replaces the nth element of v with a.

                                  Equations
                                  • v.set i a = (↑v).set (↑i) a,
                                  Instances For
                                    @[simp]
                                    theorem List.Vector.toList_set {α : Type u_1} {n : } (v : List.Vector α n) (i : Fin n) (a : α) :
                                    (v.set i a).toList = v.toList.set (↑i) a
                                    @[simp]
                                    theorem List.Vector.get_set_same {α : Type u_1} {n : } (v : List.Vector α n) (i : Fin n) (a : α) :
                                    (v.set i a).get i = a
                                    theorem List.Vector.get_set_of_ne {α : Type u_1} {n : } {v : List.Vector α n} {i j : Fin n} (h : i j) (a : α) :
                                    (v.set i a).get j = v.get j
                                    theorem List.Vector.get_set_eq_if {α : Type u_1} {n : } {v : List.Vector α n} {i j : Fin n} (a : α) :
                                    (v.set i a).get j = if i = j then a else v.get j
                                    theorem List.Vector.prod_set {α : Type u_1} {n : } [Monoid α] (v : List.Vector α n) (i : Fin n) (a : α) :
                                    (v.set i a).toList.prod = (List.Vector.take (↑i) v).toList.prod * a * (List.Vector.drop (i + 1) v).toList.prod
                                    theorem List.Vector.sum_set {α : Type u_1} {n : } [AddMonoid α] (v : List.Vector α n) (i : Fin n) (a : α) :
                                    (v.set i a).toList.sum = (List.Vector.take (↑i) v).toList.sum + a + (List.Vector.drop (i + 1) v).toList.sum
                                    theorem List.Vector.prod_set' {α : Type u_1} {n : } [CommGroup α] (v : List.Vector α n) (i : Fin n) (a : α) :
                                    (v.set i a).toList.prod = v.toList.prod * (v.get i)⁻¹ * a

                                    Variant of List.Vector.prod_set that multiplies by the inverse of the replaced element.

                                    theorem List.Vector.sum_set' {α : Type u_1} {n : } [AddCommGroup α] (v : List.Vector α n) (i : Fin n) (a : α) :
                                    (v.set i a).toList.sum = v.toList.sum + -v.get i + a

                                    Variant of List.Vector.sum_set that subtracts the inverse of the replaced element.

                                    def List.Vector.traverse {n : } {F : Type u → Type u} [Applicative F] {α β : Type u} (f : αF β) :
                                    List.Vector α nF (List.Vector β n)

                                    Apply an applicative function to each component of a vector.

                                    Equations
                                    Instances For
                                      @[simp]
                                      theorem List.Vector.traverse_def {n : } {F : Type u → Type u} [Applicative F] {α β : Type u} (f : αF β) (x : α) (xs : List.Vector α n) :
                                      List.Vector.traverse f (x ::ᵥ xs) = List.Vector.cons <$> f x <*> List.Vector.traverse f xs
                                      theorem List.Vector.id_traverse {n : } {α : Type u} (x : List.Vector α n) :
                                      theorem List.Vector.comp_traverse {n : } {F G : Type u → Type u} [Applicative F] [Applicative G] [LawfulApplicative G] {α β γ : Type u} (f : βF γ) (g : αG β) (x : List.Vector α n) :
                                      theorem List.Vector.traverse_eq_map_id {n : } {α β : Type u_6} (f : αβ) (x : List.Vector α n) :
                                      theorem List.Vector.naturality {n : } {F G : Type u → Type u} [Applicative F] [Applicative G] [LawfulApplicative G] [LawfulApplicative F] (η : ApplicativeTransformation F G) {α β : Type u} (f : αF β) (x : List.Vector α n) :
                                      (fun {α : Type u} => η.app α) (List.Vector.traverse f x) = List.Vector.traverse ((fun {α : Type u} => η.app α) f) x
                                      Equations
                                      @[simp]
                                      theorem List.Vector.replicate_succ {α : Type u_1} {n : } (val : α) :
                                      @[simp]
                                      theorem List.Vector.get_append_cons_zero {α : Type u_1} {m n : } {x : α} (xs : List.Vector α n) (ys : List.Vector α m) :
                                      ((x ::ᵥ xs).append ys).get 0, = x
                                      @[simp]
                                      theorem List.Vector.get_append_cons_succ {α : Type u_1} {m n : } {x : α} (xs : List.Vector α n) (ys : List.Vector α m) {i : Fin (n + m)} {h : i + 1 < n.succ + m} :
                                      ((x ::ᵥ xs).append ys).get i + 1, h = (xs.append ys).get i
                                      @[simp]
                                      theorem List.Vector.append_nil {α : Type u_1} {n : } (xs : List.Vector α n) :
                                      xs.append List.Vector.nil = xs
                                      @[simp]
                                      theorem List.Vector.get_map₂ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {n : } (v₁ : List.Vector α n) (v₂ : List.Vector β n) (f : αβγ) (i : Fin n) :
                                      (List.Vector.map₂ f v₁ v₂).get i = f (v₁.get i) (v₂.get i)
                                      @[simp]
                                      theorem List.Vector.mapAccumr_cons {α : Type u_1} {β : Type u_2} {σ : Type u_4} {n : } {x : α} {s : σ} (xs : List.Vector α n) {f : ασσ × β} :
                                      List.Vector.mapAccumr f (x ::ᵥ xs) s = let r := List.Vector.mapAccumr f xs s; let q := f x r.1; (q.1, q.2 ::ᵥ r.2)
                                      @[simp]
                                      theorem List.Vector.mapAccumr₂_cons {α : Type u_1} {β : Type u_2} {σ : Type u_4} {φ : Type u_5} {n : } {x : α} {y : β} {s : σ} (xs : List.Vector α n) (ys : List.Vector β n) {f : αβσσ × φ} :
                                      List.Vector.mapAccumr₂ f (x ::ᵥ xs) (y ::ᵥ ys) s = let r := List.Vector.mapAccumr₂ f xs ys s; let q := f x y r.1; (q.1, q.2 ::ᵥ r.2)