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

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

First-Order Logic (FOL)

CS156: The Calculus of Computation

CS156: The Calculus of Computation Zohar Manna Winter 2010

First Order Logic (FOL)

CS156: The Calculus of Computation Zohar Manna Winter 2010

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

Learning Goals of CS245 Logic and Computation

Overview, cont. Overview, cont. Logistics. Optional Reference #1. Optional Reference #2. Workload and Grading

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

CS156: The Calculus of Computation

Satisfiability Modulo Theories (SMT)

AAA615: Formal Methods. Lecture 2 First-Order Logic

CSE507. Course Introduction. Computer-Aided Reasoning for Software. Emina Torlak

Informal Statement Calculus

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

03 Review of First-Order Logic

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

Propositional Logic Language

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

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

Predicate Logic: Sematics Part 1

Outline. Formale Methoden der Informatik First-Order Logic for Forgetters. Why PL1? Why PL1? Cont d. Motivation

Herbrand Theorem, Equality, and Compactness

CS156: The Calculus of Computation Zohar Manna Autumn 2008

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

Propositional and Predicate Logic. jean/gbooks/logic.html

Combining Decision Procedures

Classical First-Order Logic

CSE507. Introduction. Computer-Aided Reasoning for Software. Emina Torlak courses.cs.washington.edu/courses/cse507/17wi/

Classical Propositional Logic

First Order Logic (FOL) 1 znj/dm2017

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

Classical Propositional Logic

Topics in Model-Based Reasoning


Propositional Logic: Models and Proofs

A Little Logic. Propositional Logic. Satisfiability Problems. Solving Sudokus. First Order Logic. Logic Programming

Part 2: First-Order Logic

Notes. Corneliu Popeea. May 3, 2013

Classical First-Order Logic

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic

First-Order Logic. Chapter Overview Syntax

2.2 Lowenheim-Skolem-Tarski theorems

Propositional logic. First order logic. Alexander Clark. Autumn 2014

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

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

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

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

Tecniche di Verifica. Introduction to Propositional Logic

Marie Duží

Predicate Calculus. Formal Methods in Verification of Computer Systems Jeremy Johnson

02 Propositional Logic

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

Propositional Reasoning

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication

Exercises 1 - Solutions

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

Friendly Logics, Fall 2015, Lecture Notes 1

Halting and Equivalence of Program Schemes in Models of Arbitrary Theories

Propositional Logic: Deductive Proof & Natural Deduction Part 1

Symbolic Analysis. Xiangyu Zhang

The Calculus of Computation

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

Logic: Propositional Logic (Part I)

PROOFS IN PREDICATE LOGIC AND COMPLETENESS; WHAT DECIDABILITY MEANS HUTH AND RYAN 2.3, SUPPLEMENTARY NOTES 2

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Comp487/587 - Boolean Formulas

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

Chapter 11: Automated Proof Systems

Description Logics. Deduction in Propositional Logic. franconi. Enrico Franconi

CMPS 217 Logic in Computer Science. Lecture #17

Chapter 4: Classical Propositional Semantics

MAI0203 Lecture 7: Inference and Predicate Calculus

Chapter 11: Automated Proof Systems (1)

Logic for Computer Scientists

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit:

Logic for Computer Scientists

Advanced Topics in LP and FP

Satisfiability Modulo Theories

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example

Logic. Knowledge Representation & Reasoning Mechanisms. Logic. Propositional Logic Predicate Logic (predicate Calculus) Automated Reasoning

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

3 Propositional Logic

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

The Curry-Howard Isomorphism

Part 1: Propositional Logic

Logical Abstract Domains and Interpretations

Deductive Verification

185.A09 Advanced Mathematical Logic

Lecture 1: Logical Foundations

Propositional and Predicate Logic - XIII

Language of Propositional Logic

Predicate Logic - Undecidability

Propositional logic. Programming and Modal Logic

Quantifiers. Leonardo de Moura Microsoft Research

Logic for Computer Scientists

Theory Combination. Clark Barrett. New York University. CS357, Stanford University, Nov 2, p. 1/24

Transcription:

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

Roadmap Review: propositional logic Syntax and semantics of first-order logic (FOL) Semantic argument method for FOL validity Properties of FOL Overview of first-order theories

Propositional logic (PL) syntax Atom Literal truth symbols ( true ) and ( false ) propositional variables p, q, r, p!, q! atom α or its negation α Formula literal or application of a logical connective to F, F!, F! F not (negation) F! F! or (disjunction) F! F! and (conjunction) F! F! implies (implication) F! F! if and only if (iff)

PL semantics Interpretation I : mapping of each propositional variable to a truth value I: { p, q, } Satisfying interpretation : F evaluates to under I, written I F Falsifying interpretation : F evaluates to under I, written I F

PL semantics: inductive definition Base Cases: I I I p iff I p = I p iff I p = Inductive Cases: I F iff I F I F! F! iff I F! or I F! I F! F! iff I F! and I F! I F! F! iff I F! or I F! I F! F! iff I F! and I F!, or, I F! and I F!

Satisfiability and Validity F is satisfiable iff there exists I : I F F is valid iff for all I : I F Duality: F is valid iff F is unsatisfiable Procedure for deciding satisfiability or validity suffices!

Deciding satisfiability SAT solvers! Basic techniques Truth table method: search-based Semantic argument method: deductive technique SAT solvers combine search and deduction

Propositional Logic P Q P Q First-Order Logic (predicate logic/predicate calculus/ relational logic) x. p x, y y. q x, y Simple, not very expressive Decidable Automated reasoning about satisfiability/validity Very expressive Semi-decidable Not fully automated

Syntax of FOL constants: a, b, c variables: x, y, z n -ary functions: f, g, h n -ary predicates: p, q, r logical connectives:,,,, quantifiers:, Term constant, variable, or, n-ary function applied to n terms Atom,, or, n-ary predicate applied to n terms Literal atom or its negation FOL formula: Literal, or, application of logical connectives to an FOL formula, or, application of a quantifier to an FOL formula

Quantifiers existential quantifier: x. F x there exists an x such that F x universal quantifier: x. F x for all x, F x! Quantified variable Scope of quantified variable An occurrence of a variable is bound if it s in the scope of some quantifier An occurrence of a variable is free if it s not in the scope of any quantifier Closed formula: no free variables Open formula: some free variables Ground formula: no variables

Semantics of FOL: first-order structure U, I Universe of discourse/domain, U: Non-empty set of values or objects of interest May be finite (set of students at Purdue), countably infinite (integers) or uncountable infinite (positive reals) Interpretation, I: Mapping of variables, functions and predicates to values in U I maps each variable symbol x to some value I[x] U I maps each n-ary function symbol f to some function f! : U! U I maps each n-ary predicate symbol p to some predicate p! : U! {true, false}

Evaluation of formulas If F evaluates to under U, I, we write U, I F If F evaluates to under U, I, we write U, I F Evaluation of terms: I f t!,, t! = I f I t!,, I t! Evaluation of atoms: I p t!,, t! = I p I t!,, I t!

Evaluation of formulas: inductive definition Base Cases: U, I U, I U, I p t!,, t! iff I p t!,, t! = true Inductive Cases: U, I F iff U, I F U, I F! F! iff U, I F! or U, I F! U, I x. F U, I x. F iff for all v U, I x v F iff there exists v U, I x v F x-variant of U, I that agrees with U, I on everything except the variable x, with I x = v.

Satisfiability and Validity F is satisfiable iff there exists some structure U, I : U, I F F is valid iff for all structures U, I : U, I F Duality: F is valid iff F is unsatisfiable

Semantic argument method for validity Proof by contradiction: 1. Assume F is not valid 2. Apply proof rules 3. Contradiction (i.e, ) along every branch of proof tree F is valid 4. Otherwise, F is not valid

Semantic argument method for validity!,!!!,!!!,!!!,!! U, I x. F U, I[x c] F (for any c U)!,!!!!,!!!,!!!,!!!!,!!!,!! U, I x. F U, I[x c] F U, I x. F U, I[x c] F (for some fresh c U) (for some fresh c U)!,!!!!,!!!,!!!,!!!!,!!!,!! U, I x. F U, I[x c] F (for any c U)!,!!!!,,!!!,!!!!,,!!!!!!!!!!"#!""! [!,!]!,!!

Soundness and Completeness of Proof Rules Soundness: If every branch of semantic argument proof derives, then F is valid Completeness: If F is valid, there exists a finite-length semantic argument proof in which every branch derives.

Undecidability of FOL A problem is decidable if there exists a procedure that, for any input: 1. halts and says yes if answer is positive, and 2. halts and says no if answer is negative (Such a procedure is called an algorithm or a decision procedure) Undecidability of FOL [Church and Turing]: Deciding the validity of an FOL formula is undecidable Deciding the validity of a PL formula is decidable The truth table method is a decision procedure

Semi-decidability of FOL A problem is semi-decidable iff there exists a procedure that, for any input: 1. halts and says yes if answer is positive, and 2. may not terminate if answer is negative. Semi-decidability of FOL: For every valid FOL formula, there exists a procedure (semantic argument method) that always terminates and says yes. If an FOL formula is invalid, there exists no procedure that is guaranteed to terminate.

FOL is very expressive, powerful and undecidable in general Some application domains do not need the full power of FOL First-order theories are useful for reasoning about specific applications e.g., programs with arithmetic operations over integers Specialized, efficient decision procedures!

First-Order Theories Signature Σ! : set of constant, function, and predicate symbols Axioms A! : set of closed formulas over Σ! Axioms provide the meaning of symbols in Σ! Σ! -formula : constructed from symbols of Σ!, and variables, logical connectives, and quantifiers T-model : a first-order structure M = U, I such that M A for all A A!

Satisfiability and Validity Modulo T F is satisfiable modulo T iff there exists some T-model M : M F F is valid modulo T (written T F) iff for all T-models M : M F The theory T consists of all closed formulas that are valid modulo T How is validity modulo T different from FOL-validity? If a formula is valid in FOL, is it also valid modulo T for any T? If a formula is valid modulo T for some T, is it valid in FOL?

Decidability of a theory A theory T is decidable iff for every formula F, there is an algorithm that : 1. terminates and answers yes if F is valid modulo T, and 2. terminates and answers no, if F is not valid modulo T Next: decidable first-order theories, and theories with decidable fragments

Common first-order theories Theory of equality (with uninterpreted functions) Peano arithmetic (first-order arithmetic) Presburger arithmetic Theory of rationals Theory of arrays

Theory of equality T! Signature = binary predicate, interpreted by axioms all constant, function, and predicate symbols Σ! =, a, b, c,, f, g, h,, p, q, r

Theory of equality T! Axioms 1. x. x = x (reflexivity) 2. x, y. (x = y) y = x (symmetry) 3. x, y, z. (x = y y = z) x = z (transitivity) Equivalence relation 4. for n-ary function symbol f, (function congruence) x!,, x!, y!,. y!. ( i x! = y! ) f x!,, x! = f y!,., y! 5. for each n-ary predicate symbol p, (predicate congruence) x!,, x!, y!,. y!. ( i x! = y! ) ((p x!,, x! p y!,., y! )

Decidability results for T! T! is undecidable Quantifier-free fragment of T! is (efficiently) decidable

Theories with natural numbers and integers Natural numbers N = 0,1,2, Integers Z =, 2, 1, 0,1,2, Peano arithmetic T PA : natural numbers with addition and multiplication Presburger arithmetic T N : natural numbers with addition Theory of integers T Z : integers with +, -, > 28

Peano arithmetic T PA Signature 0, 1 constants +,. binary functions = binary predicate Σ!" = 0, 1, +,., =

Peano arithmetic T PA Axioms Includes equality axioms: reflexivity, symmetry, transitivity In addition: 1. x. x + 1 = 0 (zero) 2. x. x + 0 = x (plus zero) 3. x. x. 0 = 0 (times zero) 4. x, y. (x + 1 = y + 1) x = y (successor) 5. x, y. x + y + 1 = x + y + 1 (plus successor) 6. x, y. x. y + 1 = x. y + x (times successor) 7. (F 0 ( x. F x F[x + 1])) x. F x (induction) Can we express <,, >, in T!"?

Decidability and completeness results for T PA Validity in T!" is undecidable Validity in quantifier-free fragment of T!" is also undecidable [Matiyasevitch, 1970] T!" does not capture true arithmetic [Gödel] There are valid propositions of number theory that are not valid in T!" Drop multiplication to get decidability and completeness!

Presburger arithmetic T N Signature 0, 1 constants + binary function = binary predicate Σ N = 0, 1, +, =

Presburger arithmetic T N Axioms Includes equality axioms: reflexivity, symmetry, transitivity In addition: 1. x. x + 1 = 0 (zero) 2. x. x + 0 = x (plus zero) 3. x, y. (x + 1 = y + 1) x = y (successor) 4. x, y. x + y + 1 = x + y + 1 (plus successor) 5. (F 0 ( x. F x F[x + 1])) x. F x (induction)

Decidability and completeness results for T N Validity in quantifier-free fragment of T N is decidable (conp-complete) Validity in T N is also decidable [Presburger, 1929] T N is also complete: for every closed formula F, T N F or T N F T N admits quantifier elimination: for every formula F, there exists an equivalent quantifier-free formula F

Theory of integers T Z Signature, 2, 1, 0, 1, 2, constants, 3, 2, 2, 3, unary functions +, binary functions =, > binary predicates Σ Z =, 2, 1, 0, 1, 2,, 3, 2, 2, 3,, +,, =, > Also referred to as the theory of linear arithmetic over integers Equivalent in expressiveness to Presburger arithemetic More convenient notation

Theory of rationals T Q Signature 0, 1 constants + binary function =, binary predicates Σ Q = 0, 1, +, =, Can we express > in T Q?

Theory of rationals T Q Too many axioms, won t discuss. Every formula valid in T Z is valid in T Q, but not vice versa

Decidability results for T Q Validity in T Q is decidable Validity in conjunctive quantifier-free fragment of T N is (efficiently) decidable

Theory of arrays T A Signature a[i] binary function read(a,i) a i v ternary function write(a, i, v) Σ A =,, =

Theory of arrays T A Axioms Includes equality axioms: reflexivity, symmetry, transitivity In addition: 1. a, i, j. i = j a i = a j (array congruence) 2. a, v, i, j. i = j a i v j = v (read-over-write 1) 3. a, v, i, j. i j a i v j = a j (read-over-write 2)

Decidability results for T A Validity in T! is not decidable Quantifier-free fragment of T! is decidable

Combination of Theories Given theories T! and T! that have the = predicate, define combined theory T! T! : Signature Σ! Σ! Axioms A! A!

Decision procedures for combined theories If 1. quantifier-free fragment of T! is decidable 2. quantifier-free fragment of T! is decidable 3. and T! and T! meet certain technical requirements then quantifier-free fragment of of T! T! is also decidable. [Nelson and Oppen]

Summary Review: propositional logic Syntax and semantics of first-order logic (FOL) Semantic argument method for FOL validity Properties of FOL Overview of first-order theories