Documentation

MIPRE.Foundations.SAT.FmlProg

The formula builders as programs #

Every builder of FmlLib.lean as a polynomial-time function of the ambient model, with its toFun the builder itself. Nothing here reasons about post-order lists: the encoding of a formula is the encoding of its post-order list (SizedEncoding Fml), so the constructors are appends (andF, orF, notF of Formula.lean) and each builder is a foldl over a list, whose Cobham condition is the additivity of esize under the constructors (esize_and_fml and friends) (planning/succinct-cook-levin.md, S3).

The size of a constructed formula #

Folding with a constructor #

Fml.andList.

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

    Fml.orList.

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

      Equality and comparison with a constant #

      Fml.eqStep.

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

        The step of eqConst grows the accumulator by at most the size of the pair plus 20.

        Fml.eqConst.

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

          Sizes of the derived builders #

          The derived combinators #

          Fml.xnor.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            @[simp]
            theorem MIPRE.SAT.xnorP_apply (p : Fml × Fml) :
            xnorP.toFun p = p.1.xnor p.2

            Fml.xor.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[simp]
              theorem MIPRE.SAT.xorP_apply (p : Fml × Fml) :
              xorP.toFun p = p.1.xor p.2

              Fml.mux.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                @[simp]
                theorem MIPRE.SAT.muxP_apply (p : Fml × Fml × Fml) :
                muxP.toFun p = p.1.mux p.2.1 p.2.2

                Fml.sum3.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[simp]
                  theorem MIPRE.SAT.sum3P_apply (p : Fml × Fml × Fml) :
                  sum3P.toFun p = p.1.sum3 p.2.1 p.2.2

                  Fml.maj3.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[simp]
                    theorem MIPRE.SAT.maj3P_apply (p : Fml × Fml × Fml) :
                    maj3P.toFun p = p.1.maj3 p.2.1 p.2.2

                    Comparison with a constant #

                    Fml.ltStep.

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

                      Fml.ltConst.

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

                        Comparison of two fields #

                        Fml.eqFields.

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

                          Fml.ltFStep.

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

                            Fml.ltFields.

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

                              Constant and input vectors #

                              The vector of input formulas #

                              theorem MIPRE.SAT.esize_list_le_of_forall {α : Type u_1} [Cost.SizedEncoding α] (k : ℕ) (l : List α) :
                              (∀ a ∈ l, Cost.esize a ≤ k) → Cost.esize l ≤ l.length * (k + 1) + 1
                              theorem MIPRE.SAT.esize_mem_range'_le {a n x : ℕ} (h : x ∈ List.range' a n) :

                              The step building a range of indices, from the top down.

                              Equations
                              Instances For

                                The step of the range, as a program.

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

                                  List.range', the length in unary.

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

                                    The adder #

                                    theorem MIPRE.SAT.esize_sum3_fml (f g h : Fml) :
                                    Cost.esize (f.sum3 g h) = 4 * Cost.esize f + 4 * Cost.esize g + 2 * Cost.esize h + 141
                                    theorem MIPRE.SAT.addBits_carry_le (E : ℕ) (fs : List Fml) (c : Cost.BitStr) (cin : Fml) :
                                    (∀ f ∈ fs, Cost.esize f ≤ E) → Cost.esize (Fml.addBits fs c cin).2 ≤ Cost.esize cin + fs.length * (2 * E + 50)

                                    The carry out of the adder grows linearly in the width.

                                    theorem MIPRE.SAT.addBits_mem_le (E : ℕ) (fs : List Fml) (c : Cost.BitStr) (cin : Fml) :
                                    (∀ f ∈ fs, Cost.esize f ≤ E) → ∀ s ∈ (Fml.addBits fs c cin).1, Cost.esize s ≤ 4 * E + 2 * (Cost.esize cin + fs.length * (2 * E + 50)) + 200

                                    Every sum bit of the adder is bounded by the carry bound.

                                    The step of the adder: the carry and the reversed sum bits.

                                    Equations
                                    Instances For
                                      theorem MIPRE.SAT.foldl_addStep (fs : List Fml) (c : Cost.BitStr) (cin : Fml) (acc : List Fml) :
                                      List.foldl addStep (cin, acc) (fs.zip c) = ((Fml.addBits fs c cin).2, (Fml.addBits fs c cin).1.reverse ++ acc)

                                      The step of the adder, as a program.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        theorem MIPRE.SAT.zip_map_fst_snd {α : Type u_1} {β : Type u_2} (l : List (α × β)) :
                                        theorem MIPRE.SAT.length_addBits_le (fs : List Fml) (c : Cost.BitStr) (cin : Fml) :
                                        (Fml.addBits fs c cin).1.length ≤ fs.length

                                        Fml.addBits.

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

                                          Fml.addConstBits.

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

                                            Fml.addConstCarry.

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

                                              Fml.addConstRel.

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

                                                Padding #

                                                padBits, the width in unary.

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

                                                  The two's complement #

                                                  The successor on bit strings.

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

                                                    twosComp.

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

                                                      Fml.subConstBits.

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