Logic, Satisfiability, and Reasoning
Module 1: Propositional Logic (SAT)
1.1 Syntax and Semantics
Propositional logic evaluates the truth of basic statements. The syntactic building blocks include truth constants ( ⊤, ⊥ ), propositional variables (atoms) P, and literals (variables or their negations). The language of propositional logic, L, is defined recursively:
F::=p∣⊤∣⊥∣(¬F)∣(F1∧F2)∣(F1∨F2)∣(F1→F2)∣(F1↔F2)
where p∈P. The standard precedence of operations is ¬≫∧≫∨≫→≫↔.
An assignment ν:P→{0,1} maps variables to boolean values. The semantic interpretation function [[⋅]]ν computes the truth value of a formula under assignment ν:
- [[¬ϕ]]ν=1 iff [[ϕ]]ν=0
- [[ϕ∨ψ]]ν=1 iff [[ϕ]]ν=1 or [[ψ]]ν=1
- [[ϕ∧ψ]]ν=1 iff [[ϕ]]ν=1 and [[ψ]]ν=1
- [[ϕ→ψ]]ν=1 iff [[ϕ]]ν=0 or [[ψ]]ν=1
A formula is satisfiable if there exists at least one model (assignment ν ) where [[ϕ]]ν=1. It is valid (a tautology) if [[ϕ]]ν=1 for all assignments, and unsatisfiable if [[ϕ]]ν=0 for all assignments.
1.2 Normal Forms and Tseitin Encoding
A Conjunctive Normal Form (CNF) is a conjunction of clauses, where each clause is a disjunction of literals:
i=1⋀n(j=1⋁milij)
Any formula can be converted to CNF via logical equivalences (e.g., De Morgan's laws: ¬(ϕ∧ψ)⇔¬ϕ∨¬ψ ), but naive conversion can cause exponential blow-up. Instead, practical SAT solving introduces new labels for subformulas (Tseitin Encoding) to maintain polynomial size. For a subformula a↔b, a label v1 is introduced, yielding the clauses:
(¬v1∨¬a∨b)∧(¬v1∨a∨¬b)∧(v1∨¬a∨¬b)∧(v1∨a∨b)
which are added to a master conjunction ensuring equi-satisfiability.
1.3 SAT Solving and Calculi
Solving SAT relies on the Davis-Putnam-Logemann-Loveland (DPLL) algorithm utilizing Binary Constraint Propagation (BCP). BCP simplifies CNF formulas when a unit clause (l) is present by removing all clauses containing l and all occurrences of the literal ¬l.
The Resolution Calculus proves unsatisfiability using a single rule on CNF clauses:
C∨Dx∨C¬x∨D
where x is the pivot and C∨D is the resolvent. Deriving the empty clause ⊥ proves unsatisfiability.
Sequent Calculus is used to reason about formulas using sequents ϕ1,…,ϕn⊢ψ, meaning the assumptions ϕ1,…,ϕn entail the goal ψ.
Module 2: Satisfiability Modulo Theories (SMT)
2.1 Eager vs. Lazy SMT Solving
SMT enhances SAT by integrating domain-specific reasoning (theories).
- Eager Approach: Translates the entire SMT problem into an equi-satisfiable propositional formula (e.g., bit-blasting) and runs an off-the-shelf SAT solver.
- Lazy Approach (Lemmas on Demand): Abstracts the formula into a propositional skeleton by replacing theory constraints with boolean variables. A SAT solver finds a model, which is then checked by a theory solver. If theory-inconsistent, a Minimal Unsatisfiable Core (MUS) is returned as a lemma, constraining the SAT solver further.
2.2 Background Theories
Equality with Uninterpreted Functions (EUF): Functions lack concrete definitions but must obey the congruence axiom:
∀x,y:x=y→f(x)=f(y)
Satisfiability is resolved via the Congruence Closure Algorithm, which builds equivalence classes of terms and merges them upon discovering equalities. Alternatively, Ackermann's Reduction flattens terms and replaces function instances f(u) with new variables fu, enforcing (u=v→fu=fv).
Linear Real Arithmetic (LRA): Predicates include =,<,≤, and functions are restricted to +, −, and multiplication by a constant. Conjunctions of inequalities are solved using the Fourier-Motzkin Elimination Procedure, which isolates variables and creates new inequalities.
z+y≤x∧x≤5−2y⟹z+y≤5−2y
Bit-Vectors (BV): Models RTL hardware or finite-precision integer semantics. Resolved eagerly via bit-blasting. For an equality u=v between width- w bit-vectors, we introduce bits ui,vi and the constraint:
eu=v↔i=1⋀w(ui↔vi)
Arrays: Modelled by read and write functions fulfilling array congruence and read-over-write axioms:
∀a,v,i,j:i=j→read(write(a,i,v),j)=v
∀a,v,i,j:i=j→read(write(a,i,v),j)=read(a,j)
Module 3: First-Order Logic (FOL) Syntax and Semantics
3.1 Abstract Syntax
First-Order Logic (Predicate Logic) introduces objects and properties.
Terms t evaluate to objects in a domain, while formulas F evaluate to truth values. The grammar is:
t::=v∣c∣f(t1,…,tn)
F::=p(t1,…,tn)∣⊤∣⊥∣(¬F)∣(F1∧F2)∣(F1∨F2)∣(F1→F2)∣(F1↔F2)∣(∀v:F)∣(∃v:F)
where v is a variable, c is a constant, f is an n -ary function symbol, and p is an n -ary predicate symbol.
The set of free variables fv(F) computes variables not bound by quantifiers. For quantifiers:
fv(∀v:F)=fv(F)∖{v},fv(∃v:F)=fv(F)∖{v}
3.2 Formal Semantics
The meaning of FOL depends on a structure M=(D,I) and an assignment a. The domain D is a non-empty set. The interpretation I maps constants to domain elements, functions to n -ary domain functions I(f):Dn→D, and predicates to relations I(p)⊆Dn. An assignment a(v) maps variables to objects in D.
Term semantics [[t]]aD,I∈D are recursively defined:
[[v]]aD,I:=a(v)
[[c]]aD,I:=I(c)
[[f(t1,…,tn)]]aD,I:=I(f)([[t1]]aD,I,…,[[tn]]aD,I)
Formula semantics [[F]]aD,I∈{true,false} for quantifiers evaluate via assignment updates a[x↦d]:
[[∀x:F]]aD,I:=true if [[F]]a[x↦d]D,I=true for all d∈D, false else
[[∃x:F]]aD,I:=true if [[F]]a[x↦d]D,I=true for some d∈D, false else
A structure M is a model of F ( M⊨F ) if [[F]]aM=true for all a. F is valid ( ⊨F ) if every structure is a model.
Module 4: First-Order Logic (FOL) Reasoning
4.1 Proof Calculus and Inference Rules
Formal proofs use schematic inference rules mapping premises to a conclusion:
SS1…Sn
Sequents follow the format K⋯⊢G, implying assumptions K entail goal G. Critical quantificational rules include:
Universal Quantifier:
- Prove as a goal ( P- ∀ ): Skolemization. Introduce an arbitrary but fixed constant xˉ:
K⋯⊢(∀x:F)K⋯⊢F[xˉ/x]where xˉ does not occur in K…,F
- Use as assumption ( A-∀ ): Instantiation. Choose a suitable witness term t:
K…,(∀x:F)⊢GK…,(∀x:F),F[t/x]⊢G
Existential Quantifier:
- Prove as a goal ( P- ∃ ): Instantiation. Provide a witness term t:
K⋯⊢(∃x:F)K⋯⊢F[t/x]
- Use as assumption ( A- ∃ ): Skolemization. Introduce an arbitrary but fixed constant xˉ:
K…,(∃x:F)⊢GK…,F[xˉ/x]⊢Gwhere xˉ does not occur in K…,F,G
4.2 Mathematical Induction
To reason comprehensively over N≥m, FOL inference rules are augmented with the induction principle:
K⋯⊢∀n∈N≥m:FK⋯⊢F[m/n]K…,nˉ∈N≥m,F[nˉ/n]⊢F[(nˉ+1)/n]
This consists of the Induction Base ( F[m/n] ), the Induction Hypothesis ( F[nˉ/n] for a new constant nˉ≥m ), and the Induction Step (proving F[(nˉ+1)/n] ).
4.3 Expressiveness and Limitations
First-order logic variables range strictly over domain objects, preventing direct quantification over functions or predicates (which requires second-order logic). We circumvent this via set theory, mapping functions to sets of tuples.
- Completeness (Gödel, 1929): FOL possesses a calculus that is both sound ( Γ⊢F⟹Γ⊨F ) and complete ( Γ⊨F⟹Γ⊢F ).
- Undecidability (Church/Turing, 1936/1937): There is no algorithm that can always terminate and decide whether Γ⊨F. It is only semi-decidable.
- Incompleteness (Gödel, 1931): No sound formal system sufficiently rich to describe arithmetic can prove or disprove all true statements within itself (e.g., the infinite induction schema cannot be captured by a single FOL formula).