Conjunctive normal form #
Propositional formulas in conjunctive normal form over an arbitrary type of variables V, with
their Boolean semantics. A literal (Std.Sat.Literal) is a variable together with the polarity
under which it is read, a clause is a list of literals read disjunctively, and a formula is a list
of clauses read conjunctively.
Formulas are plain lists so that reductions can build them with list operations and their sizes
can be read off directly. This is why Std.Sat.CNF, an array-based structure built for efficient
SAT solving in bv_decide, is not reused; neither is Cslib.Logic.PL.Proposition, whose
connectives are binary and whose formulas are not in normal form. The names follow Std.Sat.CNF
where they overlap (relabel, eval).
Reductions to satisfiability usually build formulas over structured variables (indexed by time
steps, tape cells, and so on) and relabel them injectively at the end; CNF.satisfiable_relabel
says that this preserves satisfiability.
Main definitions #
Cslib.Logic.PL.Literal,Clause,CNF.Cslib.Logic.PL.CNF.eval,Cslib.Logic.PL.CNF.Satisfiable.Cslib.Logic.PL.CNF.vars: the variables of a formula, in order of occurrence.Cslib.Logic.PL.CNF.relabel: rename the variables of a formula.Cslib.Logic.PL.CNF.countUnsat: the number of clauses an assignment falsifies.Cslib.Logic.PL.Clause.imp,Cslib.Logic.PL.Clause.impLits: the clauseh₁ ∧ ⋯ ∧ hₙ → c, for variables or literalshᵢ.
Main results #
Cslib.Logic.PL.CNF.eval_eq_true_iff,Cslib.Logic.PL.Clause.eval_eq_true_iff: the semantics as quantifiers over clauses and literals.Cslib.Logic.PL.CNF.eval_congr: a formula only depends on its variables.Cslib.Logic.PL.CNF.mem_vars,Cslib.Logic.PL.CNF.vars_relabel,Cslib.Logic.PL.Clause.fst_mem_of_mem_imp: the variables of formulas and implications.Cslib.Logic.PL.CNF.satisfiable_relabel: injective relabelling preserves satisfiability.
References #
A literal: a variable and the polarity under which it is read.
Instances For
A clause is a disjunction of literals.
Instances For
A formula in conjunctive normal form is a conjunction of clauses.
Instances For
A formula is satisfiable when some assignment makes it true.
Instances For
Semantics #
Negating a literal negates its value.
Variables #
The variables of a formula, in order of occurrence and with repetitions.
Instances For
A formula with m clauses of at most k literals has at most k m occurrences of
variables.
The number of clauses of a formula, counted with repetition, mentioning the variable v.
Instances For
Implications #
The clause h₁ ∧ ⋯ ∧ hₙ → c, that is ¬h₁ ∨ ⋯ ∨ ¬hₙ ∨ c.
Instances For
Relabelling #
Relabelling along an injective map preserves satisfiability. An assignment of the new
variables restricts to the old ones, and an assignment of the old variables extends along f.
An assignment falsifies at most all the clauses.