SAT: Semantic Layer #
This file contains the mathematical definition of Boolean satisfiability. No Turing machines are used here. Everything is pure recursion on inductive types; a reader can audit these definitions in a few minutes and check that they really capture "α satisfies φ".
All later claims about the SAT verifier are stated against the predicates defined here. If this file is wrong, nothing downstream rescues us.
Definitions #
Lit— a literal(sign, var)wherevar : Natis a variable index andsign : Boolsays whether the literal is positive.Clause— a list of literals (disjunction).CNF— a list of clauses (conjunction).Assignment— aList Boolgiving the value of each variable.Lit.eval—α[ℓ.var] = ℓ.sign(out-of-range reads asfalse).Clause.eval— disjunction over literals.CNF.eval— conjunction over clauses.CNF.Satisfiable— some assignment makesCNF.evaltrue.
Out-of-range convention #
A variable index i ≥ α.length is treated as assigned to false. This is
standard in SAT textbooks ("unassigned variables default to 0") and makes
the language closed under padding: a short satisfying assignment always
exists, equal to a prefix of any longer one. This is essential for
polynomial balance in the NP reduction.
A clause is a disjunction of literals. The empty clause is
unsatisfiable (an empty disjunction is false).
Equations
Instances For
A CNF formula is a conjunction of clauses. The empty CNF is
satisfiable (an empty conjunction is true).
Equations
Instances For
An assignment is a bit-string. Position i holds the value of
variable i. Indices past the end read as false.
Equations
Instances For
A clause is satisfied iff at least one literal is.
Equations
Instances For
A CNF is satisfied iff every clause is.
Equations
Instances For
φ is satisfiable if some assignment makes CNF.eval true.
Equations
- φ.Satisfiable = ∃ (α : Complexity.SAT.Assignment), Complexity.SAT.CNF.eval α φ = true
Instances For
The empty CNF evaluates to true (empty conjunction).
Evaluating c :: φ is the conjunction of evaluating c and evaluating φ.
The empty formula is trivially satisfiable.
The formula [[]] (one empty clause) is unsatisfiable.
Largest variable index in a clause (0 if empty).
Equations
Instances For
Largest variable index in a CNF (0 if empty).
Equations
- Complexity.SAT.CNF.maxVar [] = 0
- Complexity.SAT.CNF.maxVar (c :: cs) = max c.maxVar (Complexity.SAT.CNF.maxVar cs)
Instances For
Assignment.get on α ++ β agrees with α at in-range indices.
Appending to an assignment doesn't change Lit.eval for in-range literals.
α.get i is preserved by truncating to any length k > i.
Clause.eval is preserved by truncation of α to length above c.maxVar.
PolyBalanced witness lemma. A satisfiable formula has a satisfying
assignment of length at most φ.maxVar + 1.
If two assignments give the same value at every index (via Assignment.get),
they produce the same literal evaluation.
Pointwise agreement of Assignment.get implies equal Clause.eval.
Pointwise agreement of Assignment.get implies equal CNF.eval.
Appending falses doesn't change Assignment.get: out-of-range positions
default to false anyway.
Padding an assignment with falses doesn't change CNF.eval.
Brute-force decidability. Satisfiability is decidable by enumerating
all 2^(φ.maxVar + 1) assignments of length φ.maxVar + 1. Not
poly-time, but establishes that the semantic layer is concretely
computable and enables decide on small instances.
Equations
- φ.decidableSatisfiable = decidable_of_iff (∃ (f : Fin (φ.maxVar + 1) → Bool), Complexity.SAT.CNF.eval (List.ofFn f) φ = true) ⋯
Evaluating a concatenation of clauses is the disjunction of the evaluations.
Evaluating a concatenation of CNFs is the conjunction of the evaluations.