CS156: The Calculus of Computation

Similar documents
CS156: The Calculus of Computation Zohar Manna Winter 2010

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory

9. Quantifier-free Equality and Data Structures

Decision Procedures. Jochen Hoenicke. Software Engineering Albert-Ludwigs-University Freiburg. Winter Term 2015/16

Satisfiability Modulo Theories (SMT)

Decision Procedures for Verification

03 Review of First-Order Logic

First Order Logic (FOL)

CS156: The Calculus of Computation

CS156: The Calculus of Computation

CS156: The Calculus of Computation Zohar Manna Winter 2010

The Calculus of Computation: Decision Procedures with Applications to Verification. by Aaron Bradley Zohar Manna. Springer 2007

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

Syntax and Semantics. The integer arithmetic (IA) is the first order theory of integer numbers. The alphabet of the integer arithmetic consists of:

2.2 Lowenheim-Skolem-Tarski theorems

Predicate Logic - Undecidability

Decision Procedures for Term Algebras with Integer Constraints

Lecture 11: Gödel s Second Incompleteness Theorem, and Tarski s Theorem

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

First-Order Logic (FOL)

Informal Statement Calculus

A Reduction Approach to Decision Procedures

Rewrite-Based Satisfiability Procedures for Recursive Data Structures

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

Part 2: First-Order Logic

Deductive Verification

CS156: The Calculus of Computation Zohar Manna Autumn 2008

Chapter 3. Formal Number Theory

Notation for Logical Operators:

Herbrand Theorem, Equality, and Compactness

Friendly Logics, Fall 2015, Lecture Notes 1

From Constructibility and Absoluteness to Computability and Domain Independence

Final Exam (100 points)

Predicate Logic: Sematics Part 1

07 Equational Logic and Algebraic Reasoning

Arithmetic Integration of Decision Procedures (Special University Ph.D. Oral Examination)

COLORS MAKE THEORIES HARD

CSE507. Satisfiability Modulo Theories. Computer-Aided Reasoning for Software. Emina Torlak

PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2

Propositional and Predicate Logic - XIII

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 7: Procedures for First-Order Theories, Part 1

Handbook of Logic and Proof Techniques for Computer Science

Theory of Computation

23.1 Gödel Numberings and Diagonalization

Decision Procedures for Recursive Data Structures with Integer Constraints

Part I: Foundations. The Calculus of Computation: Decision Procedures with Applications to Verification. by Aaron Bradley Zohar Manna.

Part II Logic and Set Theory

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 8: Procedures for First-Order Theories, Part 2

Learning Goals of CS245 Logic and Computation

WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008

Overview. CS389L: Automated Logical Reasoning. Lecture 7: Validity Proofs and Properties of FOL. Motivation for semantic argument method

Dipartimento di Scienze dell Informazione

An Abstract Decision Procedure for a Theory of Inductive Data Types

185.A09 Advanced Mathematical Logic

5. Peano arithmetic and Gödel s incompleteness theorem

What s Decidable About Arrays?

Cogito ergo sum non machina!

The Church-Turing Thesis and Relative Recursion

Combining Decision Procedures

Transformation of Equational Theories and the Separation Problem of Bounded Arithmetic

Seminar Decision Procedures and Applications

Some Applications of MATH 1090 Techniques

Every formula evaluates to either \true" or \false." To say that the value of (x = y) is true is to say that the value of the term x is the same as th

Chapter 2 Axiomatic Set Theory

258 Handbook of Discrete and Combinatorial Mathematics

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

Classical Propositional Logic

A1 Logic (25 points) Using resolution or another proof technique of your stated choice, establish each of the following.

Marie Duží

The Calculus of Computation

06 Recursive Definition and Inductive Proof

TR : Binding Modalities

the logic of provability

Constructions of Models in Fuzzy Logic with Evaluated Syntax

First Order Logic (FOL) 1 znj/dm2017

CMPS 217 Logic in Computer Science. Lecture #17

Abstract model theory for extensions of modal logic

Part II. Logic and Set Theory. Year

Decision Procedures 1: Survey of decision procedures

Symbolic Analysis. Xiangyu Zhang

Representing Scott Sets in Algebraic Settings

Chapter 1. Sets and Mappings

About the relationship between formal logic and complexity classes

Introduction to Logic and Axiomatic Set Theory

First Order Logic: Syntax and Semantics

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes)

What are the recursion theoretic properties of a set of axioms? Understanding a paper by William Craig Armando B. Matos

EXP. LOGIC: M.Ziegler PSPACE. NPcomplete. School of Computing PSPACE CH #P PH. Martin Ziegler 박세원신승우조준희 ( 박찬수 ) complete. co- P NP. Re a ) Computation

1.5 Non-linear Real Arithmetic

Tutorial on Axiomatic Set Theory. Javier R. Movellan

Propositional Logic: Syntax

Propositional and Predicate Logic - VII

Lloyd-Topor Completion and General Stable Models

There are problems that cannot be solved by computer programs (i.e. algorithms) even assuming unlimited time and space.

Gödel s Incompleteness Theorem. Overview. Computability and Logic

MAGIC Set theory. lecture 2

An Introduction to Gödel s Theorems

Victoria Gitman and Thomas Johnstone. New York City College of Technology, CUNY

The Mother of All Paradoxes

Transcription:

Page 1 of 31 CS156: The Calculus of Computation Zohar Manna Winter 2010 Chapter 3: First-Order Theories

Page 2 of 31 First-Order Theories I First-order theory T consists of Signature Σ T - set of constant, function, and predicate symbols Set of axioms A T - set of closed (no free variables) Σ T -formulae A Σ T -formula is a formula constructed of constants, functions, and predicate symbols from Σ T, and variables, logical connectives, and quantifiers. The symbols of Σ T are just symbols without prior meaning the axioms of T provide their meaning.

Page 3 of 31 First-Order Theories II A Σ T -formula F is valid in theory T (T-valid, also T = F), iff every interpretation I that satisfies the axioms of T, i.e. I = A for every A A T (T-interpretation) also satisfies F, i.e. I = F A Σ T -formula F is satisfiable in T (T-satisfiable), if there is a T-interpretation (i.e. satisfies all the axioms of T) that satisfies F Two formulae F 1 and F 2 are equivalent in T (T-equivalent), iff T = F 1 F 2, i.e. if for every T-interpretation I, I = F 1 iff I = F 2 Note: I = F stands for F true under interpretation I T = F stands for F is valid in theory T

Page 4 of 31 Fragments of Theories A fragment of theory T is a syntactically-restricted subset of formulae of the theory. Example: a quantifier-free fragment of theory T is the set of quantifier-free formulae in T. A theory T is decidable if T = F (T-validity) is decidable for every Σ T -formula F; i.e., there is an algorithm that always terminate with yes, if F is T-valid, and no, if F is T-invalid. A fragment of T is decidable if T = F is decidable for every Σ T -formula F obeying the syntactic restriction.

Page 5 of 31 Theory of Equality T E I Signature: consists of Σ = : {=, a, b, c,, f, g, h,, p, q, r, } =, a binary predicate, interpreted with meaning provided by axioms all constant, function, and predicate symbols Axioms of T E 1. x. x = x (reflexivity) 2. x, y. x = y y = x (symmetry) 3. x, y, z. x = y y = z x = z (transitivity) 4. for each positive integer n and n-ary function symbol f, x 1,...,x n, y 1,...,y n. i x i = y i f (x 1,...,x n ) = f (y 1,...,y n ) (function congruence)

Page 6 of 31 Theory of Equality T E II 5. for each positive integer n and n-ary predicate symbol p, x 1,...,x n, y 1,...,y n. i x i = y i (p(x 1,...,x n ) p(y 1,...,y n )) (predicate congruence) (function) and (predicate) are axiom schemata. Example: (function) for binary function f for n = 2: x 1, x 2, y 1, y 2. x 1 = y 1 x 2 = y 2 f (x 1, x 2 ) = f (y 1, y 2 ) (predicate) for unary predicate p for n = 1: x, y. x = y (p(x) p(y)) Note: we omit congruence for brevity.

Page 7 of 31 Decidability of T E I T E is undecidable. The quantifier-free fragment of T E is decidable. Very efficient algorithm. Semantic argument method can be used for T E Example: Prove F : a = b b = c g(f (a), b) = g(f (c), a) is T E -valid.

Page 8 of 31 Decidability of T E II Suppose not; then there exists a T E -interpretation I such that I = F. Then, 1. I = F assumption 2. I = a = b b = c 1, 3. I = g(f (a), b) = g(f (c), a) 1, 4. I = a = b 2, 5. I = b = c 2, 6. I = a = c 4, 5, (transitivity) 7. I = f (a) = f (c) 6, (function) 8. I = b = a 4, (symmetry) 9. I = g(f (a), b) = g(f (c), a) 7, 8, (function) 10. I = 3, 9 contradictory F is T E -valid.

Page 9 of 31 Natural Numbers and Integers Natural numbers N = {0, 1, 2, } Integers Z = {, 2, 1, 0, 1, 2, } Three variations: Peano arithmetic T PA : natural numbers with addition, multiplication, = Presburger arithmetic T N : natural numbers with addition, = Theory of integers T Z : integers with +,, >,=, multiplication by constants

Page 10 of 31 1. Peano Arithmetic T PA (first-order arithmetic) Σ PA : {0, 1, +,, =} Equality Axioms: (reflexivity), (symmetry), (transitivity), (function) for +, (function) for. And the axioms: 1. x. (x + 1 = 0) (zero) 2. x, y. x + 1 = y + 1 x = y (successor) 3. F[0] ( x. F[x] F[x + 1]) x. F[x] (induction) 4. x. x + 0 = x (plus zero) 5. x, y. x + (y + 1) = (x + y) + 1 (plus successor) 6. x. x 0 = 0 (times zero) 7. x, y. x (y + 1) = x y + x (times successor) Line 3 is an axiom schema.

Page 11 of 31 Example: 3x + 5 = 2y can be written using Σ PA as x + x + x + 1 + 1 + 1 + 1 + 1 = y + y Note: we have > and since 3x + 5 > 2y write as z. z 0 3x + 5 = 2y + z 3x + 5 2y write as z. 3x + 5 = 2y + z Example: Existence of pythagorean triples (F is T PA -valid): F : x, y, z. x 0 y 0 z 0 x x + y y = z z

Page 12 of 31 Decidability of Peano Arithmetic T PA is undecidable. (Gödel, Turing, Post, Church) The quantifier-free fragment of T PA is undecidable. (Matiyasevich, 1970) Remark: Gödel s first incompleteness theorem Peano arithmetic T PA does not capture true arithmetic: There exist closed Σ PA -formulae representing valid propositions of number theory that are not T PA -valid. The reason: T PA actually admits nonstandard interpretations. For decidability: no multiplication

Page 13 of 31 2. Presburger Arithmetic T N Signature Σ N : {0, 1, +, =} no multiplication! Axioms of T N (equality axioms, with 1-5): 1. x. (x + 1 = 0) (zero) 2. x, y. x + 1 = y + 1 x = y (successor) 3. F[0] ( x. F[x] F[x + 1]) x. F[x] (induction) 4. x. x + 0 = x (plus zero) 5. x, y. x + (y + 1) = (x + y) + 1 (plus successor) Line 3 is an axiom schema. T N -satisfiability (and thus T N -validity) is decidable (Presburger, 1929)

Page 14 of 31 3. Theory of Integers T Z Signature: Σ Z : {..., 2, 1, 0, 1, 2,..., 3, 2, 2, 3,..., +,, >, =} where..., 2, 1, 0, 1, 2,... are constants..., 3, 2, 2, 3,... are unary functions (intended meaning: 2 x is x + x, 3 x is x x x) +,, >,= have the usual meanings. Relation between T Z and T N : T Z and T N have the same expressiveness: For every ΣZ -formula there is an equisatisfiable Σ N -formula. For every ΣN -formula there is an equisatisfiable Σ Z -formula. Σ Z -formula F and Σ N -formula G are equisatisfiable iff: F is T Z -satisfiable iff G is T N -satisfiable

Page 15 of 31 Σ Z -formula to Σ N -formula I Example: consider the Σ Z -formula F 0 : w, x. y, z. x + 2y z 7 > 3w + 4. Introduce two variables, v p and v n (range over the nonnegative integers) for each variable v (range over the integers) of F 0 : F 1 : w p, w n, x p, x n. y p, y n, z p, z n. (x p x n ) + 2(y p y n ) (z p z n ) 7 > 3(w p w n ) + 4 Eliminate by moving to the other side of >: F 2 : w p, w n, x p, x n. y p, y n, z p, z n. x p + 2y p + z n + 3w p > x n + 2y n + z p + 7 + 3w n + 4

Page 16 of 31 Σ Z -formula to Σ N -formula II Eliminate > and numbers: w p, w n, x p, x n. y p, y n, z p, z n. u. F 3 : (u = 0) x p + y p + y p + z n + w p + w p + w p = x n + y n + y n + z p + w n + w n + w n + u + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 which is a Σ N -formula equisatisfiable to F 0. To decide T Z -validity for a Σ Z -formula F: transform F to an equisatisfiable Σ N -formula G, decide T N -validity of G.

Page 17 of 31 Σ Z -formula to Σ N -formula III Example: The Σ N -formula x. y. x = y + 1 is equisatisfiable to the Σ Z -formula: x. x > 1 y. y > 1 x = y + 1.

Rationals and Reals Signatures: Σ Q = {0, 1, +,, =, } Σ R = Σ Q { } Theory of Reals T R (with multiplication) x x = 2 x = ± 2 Theory of Rationals T Q (no multiplication) }{{} 2x = 7 x = 7 2 x+x Note: strict inequality okay; simply rewrite as follows: x + y > z (x + y = z) x + y z Page 18 of 31

Page 19 of 31 1. Theory of Reals T R Signature: Σ R : {0, 1, +,,, =, } with multiplication. Axioms in text. Example: is T R -valid. a, b, c. b 2 4ac 0 x. ax 2 + bx + c = 0 T R is decidable (Tarski, 1930) High time complexity

Page 20 of 31 2. Theory of Rationals T Q Signature: Σ Q : {0, 1, +,, =, } without multiplication. Axioms in text. Rational coefficients are simple to express in T Q. Example: Rewrite as the Σ Q -formula 1 2 x + 2 3 y 4 3x + 4y 24 T Q is decidable Quantifier-free fragment of T Q is efficiently decidable

Page 21 of 31 Recursive Data Structures (RDS) I Tuples of variables where the elements can be instances of the same structure: e.g., linked lists or trees. 1. Theory T cons (LISP-like lists) Signature: where Σ cons : {cons, car, cdr, atom, =} cons(a, b) list constructed by concatenating a and b car(x) left projector of x: car(cons(a, b)) = a cdr(x) right projector of x: cdr(cons(a, b)) = b atom(x) true iff x is a single-element list Note: an atom is simply something that is not a cons. In this formulation, there is no NIL value.

Page 22 of 31 Recursive Data Structures (RDS) II Axioms: 1. The axioms of reflexivity, symmetry, and transitivity of = 2. Function Congruence axioms x 1, x 2, y 1, y 2. x 1 = x 2 y 1 = y 2 cons(x 1, y 1 ) = cons(x 2, y 2 ) x, y. x = y car(x) = car(y) x, y. x = y cdr(x) = cdr(y)

Page 23 of 31 3. Predicate Congruence axiom x, y. x = y (atom(x) atom(y)) 4. x, y. car(cons(x, y)) = x (left projection) 5. x, y. cdr(cons(x, y)) = y (right projection) 6. x. atom(x) cons(car(x), cdr(x)) = x (construction) 7. x, y. atom(cons(x, y)) (atom) Note: the behavior of car and cons on atoms is not specified. T cons is undecidable Quantifier-free fragment of T cons is efficiently decidable

Lists with equality 2. Theory T E cons (lists with equality theory) Signature: T E cons = T E T cons Σ E Σ cons (this includes uninterpreted constants, functions, and predicates) Axioms: union of the axioms of T E and T cons T E cons is undecidable Quantifier-free fragment of T E cons is efficiently decidable Example: The Σ E cons-formula F : car(x) = car(y) cdr(x) = cdr(y) atom(x) atom(y) f (x) = f (y) is T E cons-valid. Page 24 of 31

Suppose not; then there exists a T E cons-interpretation I such that I = F. Then, 1. I = F assumption 2. I = car(x) = car(y) 1,, 3. I = cdr(x) = cdr(y) 1,, 4. I = atom(x) 1,, 5. I = atom(y) 1,, 6. I = f (x) = f (y) 1, 7. I = cons(car(x), cdr(x)) = cons(car(y), cdr(y)) 2, 3, (function) 8. I = cons(car(x), cdr(x)) = x 4, (construction) 9. I = cons(car(y), cdr(y)) = y 5, (construction) 10. I = x = y 7, 8, 9, (transitivity) 11. I = f (x) = f (y) 10, (function) Lines 6 and 11 are contradictory, so our assumption that I = F must be wrong. Therefore, F is T E cons-valid. Page 25 of 31

Page 26 of 31 Theory of Arrays T A Signature: Σ A : { [ ],, =} where a[i] binary function read array a at index i ( read(a,i) ) a i v ternary function write value v to index i of array a ( write(a,i,v) ) Axioms 1. the axioms of (reflexivity), (symmetry), and (transitivity) of T E 2. a, i, j. i = j a[i] = a[j] (array congruence) 3. a, v, i, j. i = j a i v [j] = v (read-over-write 1) 4. a, v, i, j. i j a i v [j] = a[j] (read-over-write 2)

Page 27 of 31 Note: = is only defined for array elements not T A -valid, but is T A -valid. Also F : a[i] = e a i e = a F : a[i] = e j. a i e [j] = a[j], a = b a[i] = b[i] is not T A -valid: We have only axiomatized a restricted congruence. T A is undecidable Quantifier-free fragment of T A is decidable

Page 28 of 31 2. Theory of Arrays T = A (with extensionality) Signature and axioms of T = A are the same as T A, with one additional axiom a, b. ( i. a[i] = b[i]) a = b (extensionality) Example: is T = A -valid. F : a[i] = e a i e = a T A = is undecidable Quantifier-free fragment of T A = is decidable

Page 29 of 31 First-Order Theories Quantifiers QFF Theory Decidable Decidable T E Equality T PA Peano Arithmetic T N Presburger Arithmetic T Z Linear Integer Arithmetic T R Real Arithmetic T Q Linear Rationals T cons Lists Tcons E Lists with Equality

Page 30 of 31 Combination of Theories How do we show that 1 x x 2 f (x) f (1) f (x) f (2) is (T E T Z )-satisfiable? Or how do we prove properties about an array of integers, or a list of reals...? Given theories T 1 and T 2 such that Σ 1 Σ 2 = {=} The combined theory T 1 T 2 has signature Σ 1 Σ 2 axioms A 1 A 2

Page 31 of 31 Nelson & Oppen showed that, if satisfiability of the quantifier-free fragment (qff) of T 1 is decidable, satisfiability of qff of T 2 is decidable, and certain technical simple requirements are met, then satisfiability of qff of T 1 T 2 is decidable.