Documentation

MIPRE.Foundations.SAT.ArrayProg

Equality and binary-indexed array access as ambient programs #

Formula variables and circuit wires are binary indices. Looking them up must not first expand the index to unary: a malformed index can be exponentially larger than its encoding. The programs here scan the supplied array and compare binary indices, so their bounds apply to malformed inputs as well.

Equations
Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Exact equality of bit strings, including their lengths.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Equality of binary natural numbers, without unary expansion.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[simp]
          def MIPRE.SAT.ArrayProg.lookupStep {α : Type u_1} (s a : ℕ × α) :
          ℕ × α
          Equations
          Instances For
            noncomputable def MIPRE.SAT.ArrayProg.lookupStepP {α : Type u_1} [Cost.SizedEncoding α] :
            Cost.PolyTimeFun ((ℕ × α) × ℕ × α) (ℕ × α)
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem MIPRE.SAT.ArrayProg.fold_lookupStep {α : Type u_1} (l : List (ℕ × α)) (k : ℕ) (d : α) :
              List.foldl lookupStep (k, d) l.reverse = (k, List.foldr (fun (a : ℕ × α) (acc : α) => if a.1 = k then a.2 else acc) d l)
              theorem MIPRE.SAT.ArrayProg.indexed_lookup {α : Type u_1} (l : List α) (base t : ℕ) (d : α) :
              List.foldr (fun (a : ℕ × α) (acc : α) => if a.1 = base + t then a.2 else acc) d ((List.range' base l.length).zip l) = l.getD t d
              noncomputable def MIPRE.SAT.ArrayProg.getD {α : Type u_1} [Cost.SizedEncoding α] (d : α) :

              Read a binary-indexed array, returning the fixed default outside its bounds. The scan is bounded by the array length, independently of the magnitude of the index.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                @[simp]
                theorem MIPRE.SAT.ArrayProg.getD_apply {α : Type u_1} [Cost.SizedEncoding α] (d : α) (p : ℕ × List α) :
                (getD d).toFun p = p.2.getD p.1 d