Documentation

Complexity.Computability.Circuit.SumOfTerms.Basic

Circuits adding dictionary terms #

Nullary gates produce members of a prescribed dictionary, interpreted in any additive carrier. The standard dictionary cost charges those terms and makes binary addition and wiring free. Separate addition costs and arbitrary uniform weights are also provided.

Main definitions #

Main results #

References #

Free binary addition and a nullary gate for each dictionary term.

Instances For
    def Cslib.Circuits.SumOfTerms.instDecidableEqOp.decEq {T✝ : Type u_1} [DecidableEq T✝] (x✝ x✝¹ : Op T✝) :
    Decidable (x✝ = x✝¹)
    Instances For
      @[instance_reducible]
      @[reducible, inline]

      Addition reads two wires; dictionary terms read none.

      Instances For
        @[reducible, inline]

        The signature for sums of dictionary terms.

        Instances For
          def Cslib.Circuits.SumOfTerms.interpretation {T : Type u_1} {V : Type u_2} [Add V] (value : T → V) :

          Interpret dictionary terms by their values and addition by carrier addition.

          Instances For
            @[simp]
            theorem Cslib.Circuits.SumOfTerms.interpretation_add {T : Type u_1} {V : Type u_2} [Add V] (value : T → V) (args : Fin 2 → V) :
            interpretation value Op.add args = args 0 + args 1
            @[simp]
            theorem Cslib.Circuits.SumOfTerms.interpretation_term {T : Type u_1} {V : Type u_2} [Add V] (value : T → V) (t : T) (args : Fin 0 → V) :
            interpretation value (Op.term t) args = value t
            def Cslib.Circuits.SumOfTerms.dictionaryCost {T : Type u_1} (weight : T → ℕ) :
            Op T → ℕ

            Charge each dictionary term its weight; addition is free.

            Instances For
              @[simp]
              theorem Cslib.Circuits.SumOfTerms.dictionaryCost_add {T : Type u_1} (weight : T → ℕ) :
              @[simp]
              theorem Cslib.Circuits.SumOfTerms.dictionaryCost_term {T : Type u_1} (weight : T → ℕ) (t : T) :
              dictionaryCost weight (Op.term t) = weight t
              @[reducible, inline]

              Count dictionary gates, with free addition.

              Instances For

                Count additions; dictionary gates are free.

                Instances For
                  def Cslib.Circuits.SumOfTerms.weightedCost {T : Type u_1} (addition term : ℕ) :
                  Op T → ℕ

                  Assign one weight to additions and another to dictionary gates.

                  Instances For
                    theorem Cslib.Circuits.SumOfTerms.cost_weightedCost {T : Type u_1} {n g : ℕ} (p : Program (signature T) n g) (addition term : ℕ) :
                    p.cost (weightedCost addition term) = addition * p.cost addCost + term * p.cost termCost

                    Uniform weights separate into the addition and dictionary gate counts.