Documentation

Trestle.Encode.EncCNF

structure Trestle.Encode.EncCNF.State (ν : Type u) :

State for an encoding.

We need to parameterize by literal type L (and variable ν), because otherwise we need to prove everywhere that clauses are "within range"

Instances For
    theorem Trestle.Encode.EncCNF.State.ext {ν : Type u} {x y : State ν} (nextVar : x.nextVar = y.nextVar) (cnf : x.cnf = y.cnf) (vMap : x.vMap = y.vMap) (vNames : x.vNames = y.vNames) :
    x = y
    def Trestle.Encode.EncCNF.State.new {ν : Type u_1} (nextVar : IVar) (f : νIVar) (vNames : List (ν × String)) :
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def Trestle.Encode.EncCNF.State.addClause {ν : Type u_1} (C : Clause (Literal ν)) (s : State ν) :
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Trestle.Encode.EncCNF.State.addComment {ν : Type u_1} (comment : String) (s : State ν) :
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[simp]
          theorem Trestle.Encode.EncCNF.State.toPropFun_addComment {ν : Type u_1} (comment : String) (s : State ν) :

          Lawfulness conditions on encoding state.

          Instances For
            theorem Trestle.Encode.EncCNF.LawfulState.ext {ν : Type u_1} {x y : LawfulState ν} (nextVar : x.nextVar = y.nextVar) (cnf : x.cnf = y.cnf) (vMap : x.vMap = y.vMap) (vNames : x.vNames = y.vNames) :
            x = y

            The interpretation of an EncCNF state is the formula's interpretation, but with all temporaries existentially quantified away.

            Equations
            Instances For
              def Trestle.Encode.EncCNF.LawfulState.new {ν : Type u_1} (nextVar : IVar) (f : ν IVar) (h : ∀ (v : ν), f v < nextVar) (names : List (ν × String)) :
              Equations
              Instances For
                @[simp]
                theorem Trestle.Encode.EncCNF.LawfulState.interp_new {ν : Type u_1} (vars : IVar) (f : ν IVar) (h : ∀ (v : ν), f v < vars) (names : List (ν × String)) :
                (new vars f h names).interp = fun (x : Model.PropAssignment ν) => True
                @[simp]
                theorem Trestle.Encode.EncCNF.LawfulState.toState_new {ν : Type u_1} (vars : IVar) (f : ν IVar) (h : ∀ (v : ν), f v < vars) (names : List (ν × String)) :
                (new vars f h names).toState = State.new vars (⇑f) names
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[simp]
                    def Trestle.Encode.EncCNF (ν α : Type u_1) :
                    Type u_1

                    Encoding monad.

                    This requires quite a few invariants to be held. It receives and produces lawful states, and nextVar is nondecreasing.

                    Equations
                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.
                      def Trestle.Encode.EncCNF.run {ν α : Type u_1} [IndexType ν] [LawfulIndexType ν] (e : EncCNF ν α) (names : List (ν × String) := []) :
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def Trestle.Encode.EncCNF.runUnit {ν : Type} [IndexType ν] [LawfulIndexType ν] (e : EncCNF ν Unit) (names : List (ν × String) := []) :
                        Equations
                        Instances For
                          Equations
                          Instances For
                            def Trestle.Encode.EncCNF.toICnf {ν α : Type u_1} [IndexType ν] [LawfulIndexType ν] (e : EncCNF ν α) :
                            Equations
                            Instances For
                              def Trestle.Encode.EncCNF.newCtx {ν α : Type} (name : String) (inner : EncCNF ν α) :
                              EncCNF ν α
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  Temporaries #

                                  def Trestle.Encode.EncCNF.State.withTemps {ν : Type u_1} {ι : Type u_2} [IndexType ι] (s : State ν) (names : Option (ιString)) :
                                  State (ν ι)
                                  Equations
                                  Instances For
                                    def Trestle.Encode.EncCNF.State.withTemps.vMap {ν : Type u_1} {ι : Type u_2} [IndexType ι] (vMap : νIVar) (nextVar : IVar) (x : ν ι) :
                                    Equations
                                    Instances For
                                      @[simp]
                                      theorem Trestle.Encode.EncCNF.State.cnf_withTemps {ν : Type u_2} {ι : Type u_1} {names : Option (ιString)} [IndexType ι] (s : State ν) :
                                      (s.withTemps names).cnf = s.cnf
                                      def Trestle.Encode.EncCNF.LawfulState.withTemps {ν : Type u_1} {ι : Type u_2} [IndexType ι] [LawfulIndexType ι] (s : LawfulState ν) (names : Option (ιString)) :
                                      Equations
                                      Instances For
                                        @[simp]
                                        @[simp]
                                        theorem Trestle.Encode.EncCNF.LawfulState.interp_withTemps {ν : Type u_2} {ι : Type u_1} {names : Option (ιString)} [IndexType ι] [LawfulIndexType ι] (s : LawfulState ν) :
                                        def Trestle.Encode.EncCNF.State.withoutTemps {ν : Type u_1} {ι : Type u_2} (vMap : νIVar) (s : State (ν ι)) :
                                        Equations
                                        Instances For
                                          @[simp]
                                          theorem Trestle.Encode.EncCNF.State.vMap_withoutTemps {ν : Type u_2} {ι : Type u_1} {vm : νIVar} (s : State (ν ι)) :
                                          (withoutTemps vm s).vMap = vm
                                          def Trestle.Encode.EncCNF.LawfulState.withoutTemps {ν : Type u_1} {ι : Type u_2} (s : LawfulState (ν ι)) (vMap : νIVar) (vMapLt : ∀ (v : ν), vMap v < s.nextVar) (vMapInj : Function.Injective vMap) :
                                          Equations
                                          Instances For
                                            @[simp]
                                            theorem Trestle.Encode.EncCNF.LawfulState.vMap_withoutTemps {ν : Type u_2} {ι : Type u_1} (s : LawfulState (ν ι)) {vMap : νIVar} {vMapLt : ∀ (v : ν), vMap v < s.nextVar} {vMapInj : Function.Injective vMap} :
                                            (s.withoutTemps vMap vMapLt vMapInj).vMap = vMap
                                            theorem Trestle.Encode.EncCNF.LawfulState.interp_withoutTemps {ν : Type u_2} {ι : Type u_1} (s : LawfulState (ν ι)) {vMap : νIVar} {vMapLt : ∀ (v : ν), vMap v < s.nextVar} {vMapInj : Function.Injective vMap} (h : vMap = s.vMap Sum.inl) :
                                            (s.withoutTemps vMap vMapLt vMapInj).interp = fun (τ : Model.PropAssignment ν) => ∃ (σ : Model.PropAssignment (ν ι)), τ = Model.PropAssignment.map Sum.inl σ s.interp σ
                                            def Trestle.Encode.EncCNF.nextVar_mono_of_eq {ν α : Type u_1} {s : LawfulState ν} {a : α} {s' : LawfulState ν} {e : EncCNF ν α} (h : e s = (a, s')) :
                                            Equations
                                            • =
                                            Instances For
                                              def Trestle.Encode.EncCNF.withTemps {ν α : Type (max u_1 u_2)} (ι : Type u_2) [IndexType ι] [LawfulIndexType ι] (e : EncCNF (ν ι) α) (names : Option (ιString) := none) :
                                              EncCNF ν α
                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For