Tseitin Transform #
This file implements a lightly optimized Tseitin encoding
of arbitrary PropForm formulas into CNF.
The formula is put into negation normal form first, and top-level ∧ / top-level ∨ are collected into one formula/clause respectively.
- all {ν : Type u} (as : Array (NegNormForm ν)) : NegNormForm ν
- any {ν : Type u} (as : Array (NegNormForm ν)) : NegNormForm ν
- lit {ν : Type u} (l : Literal ν) : NegNormForm ν
Instances For
instance
Trestle.Encode.Tseitin.instReprNegNormForm
{ν✝ : Type u_1}
[Repr ν✝]
:
Repr (NegNormForm ν✝)
Equations
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- (Trestle.Encode.Tseitin.NegNormForm.lit a).toPropForm = Trestle.LitVar.toPropForm a
Instances For
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- (Trestle.Encode.Tseitin.NegNormForm.lit a).toPropFun = Trestle.LitVar.toPropFun a
Instances For
def
Trestle.Encode.Tseitin.NegNormForm.ofPropForm
{ν : Type u_1}
(neg : Bool)
:
Model.PropForm ν → NegNormForm ν
Equations
- One or more equations did not get rendered due to their size.
- Trestle.Encode.Tseitin.NegNormForm.ofPropForm neg Trestle.Model.PropForm.tr = Trestle.Encode.Tseitin.NegNormForm.const !neg
- Trestle.Encode.Tseitin.NegNormForm.ofPropForm neg Trestle.Model.PropForm.fls = Trestle.Encode.Tseitin.NegNormForm.const neg
- Trestle.Encode.Tseitin.NegNormForm.ofPropForm neg (Trestle.Model.PropForm.var v) = Trestle.Encode.Tseitin.NegNormForm.lit (Trestle.LitVar.mkLit (Trestle.Literal ν) v !neg)
- Trestle.Encode.Tseitin.NegNormForm.ofPropForm neg f.neg = Trestle.Encode.Tseitin.NegNormForm.ofPropForm (!neg) f
Instances For
@[irreducible]
def
Trestle.Encode.Tseitin.NegNormForm.conjuncts
{ν : Type u_1}
:
NegNormForm ν → Array (NegNormForm ν)
Equations
- One or more equations did not get rendered due to their size.
- (Trestle.Encode.Tseitin.NegNormForm.lit l).conjuncts = #[Trestle.Encode.Tseitin.NegNormForm.lit l]
Instances For
@[irreducible]
def
Trestle.Encode.Tseitin.NegNormForm.disjuncts
{ν : Type u_1}
:
NegNormForm ν → Array (NegNormForm ν)
Equations
- One or more equations did not get rendered due to their size.
- (Trestle.Encode.Tseitin.NegNormForm.lit l).disjuncts = #[Trestle.Encode.Tseitin.NegNormForm.lit l]
Instances For
@[irreducible]
Equations
- ⋯ = ⋯
Instances For
@[irreducible]
Equations
- ⋯ = ⋯
Instances For
Take a formula f into
def
Trestle.Encode.Tseitin.NegNormForm.normalize
{ν : Type u_1}
(f : NegNormForm ν)
:
Array (Array (NegNormForm ν))
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Trestle.Encode.Tseitin.NegNormForm.satisfies_normalize
{ν : Type u_1}
(τ : Model.PropAssignment ν)
(f : NegNormForm ν)
:
@[irreducible]
def
Trestle.Encode.Tseitin.encodeNNF_mkDefs
{ν' : Type u_1}
{ν : Type}
(fs : Array (NegNormForm ν'))
(emb : ν' ↪ ν)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[irreducible]
def
Trestle.Encode.Tseitin.encodeNNF
{ν : Type}
{ν' : Type u_1}
(t : ν)
(emb : ν' ↪ ν)
(f : NegNormForm ν')
:
VEncCNF ν Unit fun (τ : Model.PropAssignment ν) => τ t = true → τ ⊨ Model.PropFun.map (⇑emb) f.toPropFun
Tseitin encoding in the general case creates temporaries for each clause
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Trestle.Encode.Tseitin.encodeNNF_top_clause
{ν : Type}
(clause : Array (NegNormForm ν))
:
VEncCNF ν Unit fun (τ : Model.PropAssignment ν) => ∃ f ∈ clause, τ ⊨ f.toPropFun
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Trestle.Encode.Tseitin.encodeNNF_top
{ν : Type}
(f : NegNormForm ν)
:
VEncCNF ν Unit fun (x : Model.PropAssignment ν) => x ⊨ f.toPropFun
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[noinline]
def
Trestle.Encode.Tseitin.encode
{V : Type}
[DecidableEq V]
(f : Model.PropForm V)
:
VEncCNF V Unit fun (x : Model.PropAssignment V) => x ⊨ f
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Trestle.Encode.Example.instReprV = { reprPrec := Trestle.Encode.Example.reprV✝ }
Equations
- One or more equations did not get rendered due to their size.