Documentation

SSA.Core.HVector

inductive HVector {α : Type u_1} (f : αType u_2) :
List αType (max u_1 u_2)

An heterogeneous vector

Instances For
    instance HVector.decidableEq {α : Type u_3} {A : αType u_1} [(a : α) → DecidableEq (A a)] {l : List α} :
    Equations
    def HVector.head {α : Type u_3} {A : αType u_1} {as : List α} {a : α} :
    HVector A (a :: as)A a
    Equations
    Instances For
      def HVector.tail {α : Type u_3} {A : αType u_1} {as : List α} {a : α} :
      HVector A (a :: as)HVector A as
      Equations
      Instances For
        def HVector.map {α : Type u_3} {A : αType u_1} {B : αType u_2} (f : (a : α) → A aB a) {l : List α} :
        HVector A lHVector B l
        Equations
        Instances For
          def HVector.map' {α : Type u_5} {β : Type u_6} {A : αType u_3} {B : βType u_4} (f' : αβ) (f : (a : α) → A aB (f' a)) {l : List α} :
          HVector A lHVector B (List.map f' l)

          An alternative to map which also maps a function over the index list

          Equations
          Instances For
            def HVector.foldl {α : Type u_4} {A : αType u_1} {B : Type u_3} (f : (a : α) → BA aB) {l : List α} :
            BHVector A lB
            Equations
            Instances For
              def HVector.get {α : Type u_3} {A : αType u_1} {as : List α} :
              HVector A as(i : Fin as.length) → A (as.get i)
              Equations
              • HVector.nil.get i = i.elim0
              • (x_2::ₕa).get 0, isLt = x_2
              • (a::ₕxs).get i.succ, h = xs.get i,
              Instances For

                To be used as an auto-tactic to prove that the index of getN is within bounds

                Equations
                Instances For
                  @[reducible, inline]
                  abbrev HVector.getN {α : Type u_3} {A : αType u_1} {as : List α} (x : HVector A as) (i : Nat) (hi : autoParam (i < as.length) _auto✝) :
                  A (as.get i, hi)

                  x.getN i indexes into a HVector with a Nat.

                  Note that we cannot define a proper instance of GetElem for HVector, since GetElem requires us to specify a type elem such that xs[i] : elem, but elem is not allowed to depend on the concrete index i. Thus, GetElem does not properly support heterogeneous container types like HVector

                  Equations
                  • x.getN i hi = x.get i, hi
                  Instances For
                    def HVector.ToTupleType {α : Type u_4} (A : αType u_3) :
                    List αType u_3
                    Equations
                    Instances For
                      def HVector.toTuple {α : Type u_3} {A : αType u_1} {as : List α} :

                      Turns a HVector A [a₁, a₂, ..., aₙ] into a tuple (A a₁) × (A a₂) × ... × (A aₙ)

                      Equations
                      Instances For
                        @[reducible, inline]
                        abbrev HVector.toSingle {α : Type u_3} {A : αType u_1} {a₁ : α} :
                        HVector A [a₁]A a₁
                        Equations
                        • HVector.toSingle = HVector.toTuple
                        Instances For
                          @[reducible, inline]
                          abbrev HVector.toPair {α : Type u_3} {A : αType u_1} {a₁ : α} {a₂ : α} :
                          HVector A [a₁, a₂]A a₁ × A a₂
                          Equations
                          • HVector.toPair = HVector.toTuple
                          Instances For
                            @[reducible, inline]
                            abbrev HVector.toTriple {α : Type u_3} {A : αType u_1} {a₁ : α} {a₂ : α} {a₃ : α} :
                            HVector A [a₁, a₂, a₃]A a₁ × A a₂ × A a₃
                            Equations
                            • HVector.toTriple = HVector.toTuple
                            Instances For
                              instance HVector.instRepr {α : Type u_3} {as : List α} {f : αType u_4} [(a : α) → Repr (f a)] :
                              Repr (HVector f as)
                              Equations
                              • One or more equations did not get rendered due to their size.
                              theorem HVector.map_map {α : Type u_6} {A : αType u_3} {B : αType u_4} {C : αType u_5} {l : List α} (t : HVector A l) (f : (a : α) → A aB a) (g : (a : α) → B aC a) :
                              HVector.map g (HVector.map f t) = HVector.map (fun (a : α) (v : A a) => g a (f a v)) t
                              theorem HVector.eq_of_type_eq_nil {α : Type u_4} {A : αType u_3} {l : List α} {t₁ : HVector A l} {t₂ : HVector A l} (h : l = []) :
                              t₁ = t₂
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For