Documentation

CslibFrontier.Logics.Propositional.CNF.Johnson.PolyTime

Johnson's algorithm runs in polynomial time #

Johnson's algorithm (Cslib.Logic.PL.johnson) is polynomial-time for any encoding of the variables, with literals encoded by encPair and clauses and formulas by encList (Cslib.Logic.PL.computableInPolyTime_johnson). Removing repeated literals, setting a variable and computing the weight are polynomial-time, the weight in binary from the bound L in unary. The algorithm is a fold over the distinct variables whose step reads the input formula; setting a variable does not lengthen the encoded formula (Cslib.Logic.PL.CNF.length_encList_restrict_le) and each round adds one variable to the output, so the state stays polynomially bounded. The weights have O(L) bits, and comparing them is polynomial-time.

Main results #

References #

Removing repeated literals from a clause is polynomial-time.

Removing repeated literals from every clause is polynomial-time.

Johnson's weight, in binary, is polynomial-time in a unary bound L and the formula.

theorem Cslib.Logic.PL.CNF.length_encList_restrict_le {V : Type} [DecidableEq V] (enc : V ↪ List Bool) (v : V) (b : Bool) (ψ : CNF V) :
((encCNFOver enc) (ψ.restrict v b)).length ≤ ((encCNFOver enc) ψ).length

Setting a variable does not lengthen the encoding of a formula.

theorem Cslib.Logic.PL.CNF.computableInPolyTime_restrict' {V : Type} [DecidableEq V] (enc : V ↪ List Bool) {α : Type} {input : α ↪ List Bool} {v : α → V} {b : α → Bool} {ψ : α → CNF V} (hv : Turing.MultiTapeTM.ComputableInPolyTime v input enc) (hb : Turing.MultiTapeTM.ComputableInPolyTime b input Turing.MultiTapeTM.encBool) (hψ : Turing.MultiTapeTM.ComputableInPolyTime ψ input (encCNFOver enc)) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (ψ a).restrict (v a) (b a)) input (encCNFOver enc)

Setting a computed variable to a computed value in a computed formula is polynomial-time.

Johnson's weight of a computed formula with a computed unary bound is polynomial-time.

Johnson's algorithm is polynomial-time, for any encoding of the variables.