Elementary Metamathematics CS 270: Math Foundation of CS Jeremy Johnson
Objective To reason about natural deduction itself (metamathematics). In particular, we show that every sequent (argument) that can be proven is true in the truth table sense (soundness) and every sequent that is true can be proven (completeness).
Outline Application of derived rules Reduce logical consequence to tautology Normal forms (NNF, DNF and CNF) Soundness (validity of rules) Completeness (any logical consequence can be proved)
Normal Forms A Boolean expression in DNF can be derived from the truth table for a Boolean function An algorithm to convert any Boolean expression into an equivalent one in DNF Equivalence of any particular Boolean expression and the one returned by this algorithm can be proven with natural deduction, but the correctness for all possible inputs requires (induction)
Disjunctive Normal Form September 4, 1997 Disjunctive Normal Form Any Boolean function can be written as a Boolean expression in DNF Disjunction of conjunction of literals Conjunction of literals defining each row. Disjunction of rows that are true E.G. (multiplexor function) s x0 x1 f 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 (s x0 x1 ) (s x0 x1 ) (s x0 x1 ) (s x0 x1 ) 5 5
Disjunctive Normal Form Theorem. Any boolean expression can be converted to an equivalent boolean exprssion in DNF. Proof. Any boolean expression defines a boolean function. Construct the truth table for the boolean expression and use the procedure on the previous slide to construct a boolean expression in DNF for the function defined by the truth table.
Alternative Proof A recursive conversion algorithm with corresponding inductive proof of correctness. Assume that implications and equivalences have been removed Assume that constants have been eliminated First convert to Negative Normal Form (NNF) (not expr) only occurs when expr is a variable Use DeMorgan’s Law and Double Negation Law Then convert to DNF Distribute and over or
DeMorgan’s Law (E F) E F E F E F
Double Negation E E E E
NNF Example 𝑎 ⋀(𝑏∨𝑐) a b c
NNF Example 𝑎 ⋀(𝑏∨𝑐) ≡ 𝑎 ∨ 𝑏∨𝑐 [DeMorgan’s Law] a b c
NNF Example 𝑎 ⋀(𝑏∨𝑐) ≡ 𝑎 ∨ 𝑏∨𝑐 [DeMorgan’s Law] Recursively convert operands a b c
NNF Example 𝑎 ⋀(𝑏∨𝑐) ≡ 𝑎 ∨ 𝑏∨𝑐 [DeMorgan’s Law] ≡𝑎 ∨ 𝑏∨𝑐 [Double Negation Law] a b c
NNF Example 𝑎 ⋀(𝑏∨𝑐) ≡ 𝑎 ∨ 𝑏∨𝑐 [DeMorgan’s Law] ≡𝑎 ∨ 𝑏∨𝑐 [Double Negation Law] ≡𝑎 ∨( 𝑏 ∧ 𝑐 ) [DeMorgan’s Law] a b c
Conversion to NNF Define NNF(expr) Input: expr is a Boolean Expression, Output: an equivalent Boolean Expression in NNF if isConstant(expr) return expr if isVariable(expr) return expr if isNegation(expr) return NNF_Not(expr) if isDisjunction(expr) return NNF(op1(expr)) NNF(op2(expr)) if isConjunction(expr) return NNF(op1(expr)) NNF(op2(expr))
NNF_Not Define NNF_Not(expr) Input: is a Boolean Expression with expr = expr1 Output: an equivalent Boolean Expression in NNF expr1 = op(expr) if isConstant(expr1) return expr if isVariable(expr1) return expr if isNegation(expr1) return NNF(op(expr1)) [remove double negation] if isDisjunction(expr1) return NNF( op1(expr1) NNF( op2(expr1)) [DeMorgan’s Law] if isConjunction(expr1) return NNF( op1(expr1)) NNF( op2(expr1)) [DeMorgan’s Law]
Distribute And over Or E (F1 F2) (E1 E2) F (E F1) (E F2)
DNF Example (𝑎∨𝑏)∧( 𝑐 ∨ 𝑑 ) 𝑑 a b 𝑐
DNF Example (𝑎∨𝑏)∧( 𝑐 ∨ 𝑑 ) ≡ ((𝑎∨𝑏)∧ 𝑐 )∨((𝑎∨𝑏)∧ 𝑑 ) 𝑑 𝑐 a b
DNF Example (𝑎∨𝑏)∧( 𝑐 ∨ 𝑑 ) ≡ ((𝑎∨𝑏)∧ 𝑐 )∨((𝑎∨𝑏)∧ 𝑑 ) ≡ ((𝑎∧ 𝑐 ) ∨(𝑏∧ 𝑐 ))∨((𝑎∨𝑏)∧ 𝑑 ) 𝑑 a 𝑐 b
DNF Example (𝑎∨𝑏)∧( 𝑐 ∨ 𝑑 ) ≡ ((𝑎∨𝑏)∧ 𝑐 )∨((𝑎∨𝑏)∧ 𝑑 ) ≡ ((𝑎∧ 𝑐 ) ∨(𝑏∧ 𝑐 ))∨((𝑎∨𝑏)∧ 𝑑 ) ≡ ((𝑎∧ 𝑐 ) ∨(𝑏∧ 𝑐 ))∨((𝑎∧ 𝑑 ) ∨(𝑏∧ 𝑑 )) a 𝑐 b 𝑑
Conversion to DNF Define DNF(expr) Input: expr is a Boolean Expression in NNF Output: an equivalent Boolean Expression in DNF if isConstant(expr) return expr if isVariable(expr) return expr if isNegation(expr) return expr if isDisjunction(expr) return DNF(op1(expr)) DNF(op2(expr)) if isConjunction(expr) return DistributeAndOverOr (DNF(op1(expr)) DNF(op2(expr)))
Conjunctive Normal Form September 4, 1997 Conjunctive Normal Form Conjunctive normal form (products of sums) Conjunction of clauses (disjunction of literals) Clause to preclude a false row Conjunction over all false rows Alternatively use DeMorgan’s law for the negation of dnf for f (zero rows) E.G. (multiplexor function) 𝑠 𝑥 0 𝑥 1 𝑠 𝑥 0 𝑥 1 (𝑠 𝑥 0 𝑥 1 ) (𝑠 𝑥 0 𝑥 1 ) s x0 x1 f 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 23 23
Conversion to CNF Define CNF(expr) Input: expr is a Boolean Expression in NNF Output: an equivalent Boolean Expression in CNF Algorithm is analogous (dual) to DNF.
DNF vs CNF It is easy to determine if a boolean expression in DNF is satisfiable but difficult to determine if it is valid It is easy to determine if a boolean expression in CNF is valid but difficult to determine if it is satisfiable It is possible to convert any boolean expression to DNF or CNF; however, there can be exponential blowup
Exponential Blowup Converting the following expression shows that an exponential increase in the size of the DNF form of a boolean expression is possible (x1 y1) (xn yn) (x1 xn) (y1 yn)
Soundness and Completeness 1,…,n ⊨ holds iff 1,…,n ⊢ is valid In particular, ⊨ , a tautology, ⊢ is valid. I.E. is a tautology iff is provable Soundness – you can not prove things that are not true in the truth table sense Completeness – you can prove anything that is true in the truth table sense
Proof Outline For soundness show, using a truth table, that each rule of inference implies the conclusion is true when the assumptions are true and use induction on the length of the proof to chain together inferences For completeness Reduce to proving tautologies Reduce to CNF Construct proof for each clause
Correctness of Rules of Inference … … e F T
Correctness of Rules of Inference … i F T
Correctness of Rules of Inference … ⊥ i e F F T F T
Proof of Completeness Reduce to tautologies 1,…,n ⊨ is equivalent to ⊨ where = (1 n ) Convert to * in CNF (conversion algorithm provides proof) Prove each clause in * using LEM (p1 p1) must contain pj = pi otherwise we could find an assignment that makes it false. Use assoc. and comm. to get i=1 and j=2 Combine proofs in (2) and (3)