Documentation

Trestle.Encode.VEncCNF

Verified Encodings #

This file defines VEncCNF, the main type for building verified encodings to CNF. This augments the regular EncCNF with the ability to specify and verify what a particular EncCNF value actually encodes.

def Trestle.Encode.EncCNF.encodesProp {ν α : Type u_1} (e : EncCNF ν α) (P : Model.PropPred ν) :

e encodes proposition P

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

      If e encodes P, then P is satisfiable iff e.toICnf is satisfiable

      theorem Trestle.Encode.EncCNF.bind_encodesProp {ν α β : Type u_1} {P Q : Model.PropPred ν} (e1 : EncCNF ν α) (f : αEncCNF ν β) :
      e1.encodesProp P(∀ (s : LawfulState ν), (f (e1 s).1).encodesProp Q)(e1 >>= f).encodesProp (PQ)
      @[simp]
      theorem Trestle.Encode.EncCNF.encodesProp_pure {α ν : Type u_1} (a : α) :
      theorem Trestle.Encode.EncCNF.encodesProp_map {ν α β : Type u_1} {P : Model.PropPred ν} (e1 : EncCNF ν α) (f : αβ) :
      def Trestle.Encode.VEncCNF (ν α : Type u) (P : Model.PropPred ν) :

      The verified encoding monad.

      Equations
      Instances For
        instance Trestle.Encode.VEncCNF.instCoeHeadEncCNF {ν α : Type u_1} {P : Model.PropPred ν} :
        CoeHead (VEncCNF ν α P) (EncCNF ν α)
        Equations
        def Trestle.Encode.VEncCNF.mapProp {ν α : Type u_1} {P P' : Model.PropPred ν} (h : P = P') :
        VEncCNF ν α PVEncCNF ν α P'
        Equations
        Instances For
          def Trestle.Encode.VEncCNF.newCtx {ν α : Type} {P : Model.PropPred ν} (name : String) (inner : VEncCNF ν α P) :
          VEncCNF ν α P
          Equations
          Instances For
            def Trestle.Encode.VEncCNF.pure {α ν : Type u_1} (a : α) :
            VEncCNF ν α
            Equations
            Instances For
              @[inline]
              def Trestle.Encode.VEncCNF.withTemps {ν α : Type (max u_1 u_2)} (ι : Type u_2) [IndexType ι] [LawfulIndexType ι] {P : Model.PropAssignment (ν ι)Prop} (ve : VEncCNF (ν ι) α P) (names : Option (ιString) := none) :
              VEncCNF ν α fun (τ : Model.PropAssignment ν) => ∃ (σ : Model.PropAssignment (ν ι)), τ = Model.PropAssignment.map Sum.inl σ P σ
              Equations
              Instances For
                def Trestle.Encode.VEncCNF.bind {ν α : Type u_1} {P : Model.PropPred ν} {β : Type u_1} {Q : Model.PropPred ν} (e1 : VEncCNF ν α P) (e2 : αVEncCNF ν β Q) :
                VEncCNF ν β (PQ)
                Equations
                Instances For
                  def Trestle.Encode.VEncCNF.seq {ν : Type} {P : Model.PropPred ν} {β : Type} {Q : Model.PropPred ν} (e1 : VEncCNF ν Unit P) (e2 : VEncCNF ν β Q) :
                  VEncCNF ν β fun (τ : Model.PropAssignment ν) => P τ Q τ

                  Sequences two encodings together, i.e. a conjunction of the encodings.

                  For sequencing many encodings together, see seq[ ... ] syntax

                  Equations
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      @[inline]
                      def Trestle.Encode.VEncCNF.for_all {α : Type u_1} {ν : Type} (arr : Array α) {P : αModel.PropPred ν} (f : (a : α) → VEncCNF ν Unit (P a)) :
                      VEncCNF ν Unit fun (τ : Model.PropAssignment ν) => aarr, P a τ
                      Equations
                      Instances For
                        def Trestle.Encode.VEncCNF.guard {ν : Type} (p : Prop) [Decidable p] {P : pModel.PropPred ν} (f : (h : p) → VEncCNF ν Unit (P h)) :
                        VEncCNF ν Unit fun (τ : Model.PropAssignment ν) => ∀ (h : p), P h τ
                        Equations
                        Instances For
                          def Trestle.Encode.VEncCNF.ite {ν : Type} (p : Prop) [Decidable p] {P : pModel.PropPred ν} {Q : ¬pModel.PropPred ν} (f : (h : p) → VEncCNF ν Unit (P h)) (g : (h : ¬p) → VEncCNF ν Unit (Q h)) :
                          VEncCNF ν Unit (if h : p then P h else Q h)
                          Equations
                          Instances For
                            def Trestle.Encode.VEncCNF.andImply {ν : Type} (hyps : Array (Literal ν)) (conc : Literal ν) :
                            VEncCNF ν Unit fun (τ : Model.PropAssignment ν) => (∀ hhyps, τ LitVar.toPropFun h)τ LitVar.toPropFun conc
                            Equations
                            Instances For
                              def Trestle.Encode.VEncCNF.orImplyOr {ν : Type} (hyps conc : Array (Literal ν)) :
                              VEncCNF ν Unit fun (τ : Model.PropAssignment ν) => (∃ hhyps, τ LitVar.toPropFun h)cconc, τ LitVar.toPropFun c
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                def Trestle.Encode.VEncCNF.orImply {ν : Type} (hyps : Array (Literal ν)) (conc : Literal ν) :
                                VEncCNF ν Unit fun (τ : Model.PropAssignment ν) => (∃ hhyps, τ LitVar.toPropFun h)τ LitVar.toPropFun conc
                                Equations
                                Instances For
                                  def Trestle.Encode.VEncCNF.andImplyAnd {ν : Type} (hyps concs : Array (Literal ν)) :
                                  VEncCNF ν Unit fun (τ : Model.PropAssignment ν) => (∀ hhyps, τ LitVar.toPropFun h)cconcs, τ LitVar.toPropFun c
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    def Trestle.Encode.VEncCNF.implyAnd {ν : Type} (hyp : Literal ν) (concs : Array (Literal ν)) :
                                    VEncCNF ν Unit fun (τ : Model.PropAssignment ν) => τ LitVar.toPropFun hypcconcs, τ LitVar.toPropFun c
                                    Equations
                                    Instances For
                                      def Trestle.Encode.VEncCNF.orImplyAnd {ν : Type} (hyps concs : Array (Literal ν)) :
                                      VEncCNF ν Unit fun (τ : Model.PropAssignment ν) => (∃ hhyps, τ LitVar.toPropFun h)cconcs, τ LitVar.toPropFun c
                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        def Trestle.Encode.VEncCNF.castVar {ν₁ ν₂ α : Type u_1} {P : Model.PropPred ν₁} (h : ν₁ = ν₂) (ve : VEncCNF ν₁ α P) :
                                        VEncCNF ν₂ α (h P)
                                        Equations
                                        Instances For