Decidability and the Undecidability of Predicate Logic IAIK Graz University of Technology georg.hofferek@iaik.tugraz.at 1
Fork of ways Brainteaser: Labyrinth Guards One to salvation One to perdition Two guards One always lies One always tells the truth Can t tell them apart One question What to ask? 2
But Beware! Image source: http://xkcd.com/246/ 3
Game: The Meta Game 1. Two players A, B 2. A starts, turns alternate 3. Always ends (Win or Draw) Examples: Tic-Tac-Toe, Connect-Four, but not Chess Meta-Game One Turn: Player picks a game Game is played (other player starts) Winner gets one point (both if Draw) Ends at 5 points Game? 4
Gödel s Incompleteness Theorem Kurt Gödel Jedes hinreichend mächtige formale System ist entweder widersprüchlich oder unvollständig. 5
Notions of Completeness Theory in Predicate Logic System of Axioms E.g. Theory of Arithmetic Proof System E.g. Natural Deduction 6
Completeness of a Proof System All True Sentences Provable and Nothing else provable Natural Deduction for Predicate Logic 7
Completeness of a Theory All Sentences Φ Provable (Φ is True ) or Negation provable (Φ is False ) (sufficiently complex) Theories in Predicate Logic 8
Enumerable set Σ Decision Problem Function f: Σ, Example: Σ = PPPPPPPPPPPPP FFFFFFFF, ii σ ii sssssssssss f σ = ooooooooo 9
Decidability Decision Problem Σ, f, Algorithm A: Decidable A always halts A computes f σ for all σ Σ Semi-Decidable Iff f σ = A halts A outputs For f σ = A may not halt 10
Example: Decidability Propositional SAT Problem Σ = PPPPPPPPPPPPP FFFFFFFF, ii σ ii sssssssssss f σ = ooooooooo Decidable e.g. A = DDDD Always halts Correct answer 11
Halting Problem Image source: http://xkcd.com/710/ Does program P halt? Decision problem Example programs: while(true){ }; print( Hello World ); while(n!=1) { if(n%2==0) n=n/2; else n=3*n+1; }? 12
Undecidability of HALT Proof by Contradiction Assume A A decides HALT P (A 0 (P) outputs iff P HALTs) Weird Program: weird() { if(a 0 (wwwww)) while(true){ } else exit(); } A 0 : wrong answer for weird() A A decides HALT 13
By Alan Turing (1936) Turing Machine Model of computation Formal notion of Algorithm Subsumes (modern) computers Infinite Memory ( Tape ) Universal Church-Turing Thesis 14
Formal Definition of a Turing Machine Set of States Q Input Alphabet Σ Tape Alphabet Γ Γ Σ Γ Transition Function δ: Q Γ Q Γ L, R Start State q o Q Accept State q aaa Q Reject State q rrr Q 15
Configuration of a Turing Machine State q Position of Head Tape Content uv u q v 16
Decision Problems Problem Reduction f: Σ, g: Δ, f redudes to g f g Use g to solve f h: Σ Γ h effectively computable f σ = g h σ 17
Problem Reduction & Decidability f g, g decidable f decidable Reduce it to g f g, f not decidable g not decidable Deciding f via g not possible 18
Decidability of Predicate Logic Claim: Halting Problem (for Turing Machines) (Validity of Formulas in) Predicate Logic Consequence: HALT not decidable Predicate Logic not decidable 19
Summary Predicate Logic is not decidable Predicate Logic is semi-decidable True statements can be proven Proofs can be checked Try all possible proofs 20