1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Predicate Logic Colin Campbell. A Formal Language Predicate Logic provides a way to formalize natural language so that ambiguity is removed. Mathematical.
Completeness and Expressiveness
1 First order theories (Chapter 1, Sections 1.4 – 1.5)
Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
Chapter 11: Limitations of Algorithmic Power
Computability and Complexity 10-1 Computability and Complexity Andrei Bulatov Gödel’s Incompleteness Theorem.
Monadic Predicate Logic is Decidable Boolos et al, Computability and Logic (textbook, 4 th Ed.)
Ofer Strichman, Technion 1 Decision Procedures in First Order Logic Part II – Equality Logic and Uninterpreted Functions.
Ofer Strichman, Technion Deciding Combined Theories.
1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is  satisfiable ? Example:  Let x 1,x 2 be propositional.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
MATH 224 – Discrete Mathematics
Quantified Formulas - Decision Procedure Daniel Kroening, Ofer Strichman Presented by Changki Hong 07 NOV 08.
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
1 Chapter 1 Automata: the Methods & the Madness Angkor Wat, Cambodia.
Atomic Sentences Chapter 1 Language, Proof and Logic.
LDK R Logics for Data and Knowledge Representation Modeling First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia.
1st-order Predicate Logic (FOL)
INTRODUCTION TO ARTIFICIAL INTELLIGENCE COS302 MICHAEL L. LITTMAN FALL 2001 Satisfiability.
Introduction to Satisfiability Modulo Theories
Pattern-directed inference systems
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
1 P P := the class of decision problems (languages) decided by a Turing machine so that for some polynomial p and all x, the machine terminates after at.
Key Concepts Representation Inference Semantics Discourse Pragmatics Computation.
Great Theoretical Ideas in Computer Science.
Bertram Ludäscher Department of Computer Science & Engineering University of California, San Diego CSE-291: Ontologies in Data Integration.
Great Theoretical Ideas in Computer Science.
CS6133 Software Specification and Verification
Mathematical Preliminaries
0 Propositional logic versus first-order (predicate) logic The universe of discourse Constants, variables, terms and valuations Predicates as generalized.
Automated reasoning with propositional and predicate logics Spring 2007, Juris Vīksna.
For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9.
INM175 Topic 8 1 Module INM175 Discrete Mathematics Topic 8 Algebraic Theories.
1 Finite Model Theory Lecture 1: Overview and Background.
Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson.
Knowledge Repn. & Reasoning Lec. #5: First-Order Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
1/20 Arrays Changki PSWLAB Arrays Daniel Kroening and Ofer Strichman Decision Procedure.
Complexity 24-1 Complexity Andrei Bulatov Interactive Proofs.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
1 Finite Model Theory Lecture 5 Turing Machines and Finite Models.
Prof. Busch - LSU1 Time Complexity. Prof. Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
Lecture 9: Query Complexity Tuesday, January 30, 2001.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Propositional Logic (a.k.a. Sentential Logic)
CSCE 355 Foundations of Computation
Introduction to Logic for Artificial Intelligence Lecture 2
Discrete Mathematics for Computer Science
The Propositional Calculus
Great Theoretical Ideas in Computer Science
CSCE 355 Foundations of Computation
Lecture 2 Propositional Logic
MA/CSSE 474 More Math Review Theory of Computation
Formal Methods in software development
Representations & Reasoning Systems (RRS) (2.2)
Presentation transcript:

1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman

Prelude: Syntax v.s. Semantic in Logic Framework An example of small language  Syntax F := 0 | 1 | F + 1 | 1 + F Ex. 0, 0+1+1, 1+0+1, but not 0+0  Possible semantics == ?  Yes (interpreting formula as a natural #),  [1 + 1] N1 = 2, [ ] N1 =2  = N  No (interpreting formula as string),  [1+1] S = “ 1+1 ”,[1+1+0] S = “ ”  1+1 != S  No (interpreting formula as a natural # of string length)  [1 + 1] N2 = 3, [ ] N2 =5  != N

Examples of Semantic Mapping Syntactic representation of systems Graph domain Term domain PetriNet domain Natural # domain sm1 sm2sm3sm4 sm5 sm6 Mathematical Domain Language Domain

4 First order logic A first order theory consists of  Variables  Logical symbols: Æ Ç : 8 9 `(’ `)’  Non-logical Symbols  : Constants, predicate and function symbols  Syntax

5 Examples  = {0,1, ‘+’, ‘>’}  ‘0’,’1’ are constant symbols  ‘+’ is a binary function symbol  ‘>’ is a binary predicate symbol An example of a  -formula: 9 y 8 x. x > y

6 Examples  = {1, ‘ > ’, ‘ < ’, ‘ isprime ’ }  ‘1’ is a constant symbol  ‘>’, ‘<‘ are binary predicates symbols  ‘isprime’ is a unary predicate symbol An example  -formula: 8 n 9 p. n > 1 ! isprime(p) Æ n < p < 2n. Are these formulas valid ? So far these are only symbols, strings. No meaning yet.

7 Interpretations Let  = {0,1, ‘+’, ‘=’} where 0,1 are constants, ‘+’ is a binary function symbol and ‘=’ a predicate symbol. Let  = 9 x. x + 0 = 1 Q: Is  true in N 0 ? A: Depends on the interpretation!

8 Structures A structure is given by: 1. A domain 2. An interpretation of the nonlogical symbols: i.e., Maps each predicate symbol to a predicate of the same arity Maps each function symbol to a function of the same arity Maps each constant symbol to a domain element 3. An assignment of a domain element to each free (unquantified) variable

9 Structures Remember  = 9 x. x + 0 = 1 Consider the structure S:  Domain: N 0  Interpretation: ‘0’ and ‘1’ are mapped to 0 and 1 in N 0 ‘=’  = (equality) ‘+’  * (multiplication) Now, is  true in S ?

10 Satisfying structures Definition: A formula is satisfiable if there exists a structure that satisfies it Example:  = 9 x. x + 0 = 1 is satisfiable Consider the structure S’:  Domain: N 0  Interpretation: ‘0’ and ‘1’ are mapped to 0 and 1 in N 0 ‘=‘  = (equality) ‘+’  + (addition) S’ satisfies . S’ is said to be a model of .

11 First-order theories First-order logic is a framework. It gives us a generic syntax and building blocks for constructing restrictions thereof. Each such restriction is called a first-order theory. A theory defines  the signature  (the set of nonlogical symbols) and  the interpretations that we can give them.

12 Definitions  – the signature. This is a set of nonlogical symbols.  - formula: a formula over  symbols + logical symbols. A variable is free if it is not bound by a quantifier. A sentence is a formula without free variables. A  -theory T is defined by a set of  -sentences.

13 Definitions… Let T be a  -theory A  -formula  is T-satisfiable if there exists a structure that satisfies both  and the sentences defining T. A  -formula  is T-valid if all structures that satisfy the sentences defining T also satisfy .

14 Example Let  = {0,1, ‘+’, ‘=’} Recall  = 9 x. x + 0 = 1  is a  -formula. We now define the following  -theory:  8 x. x = x// ‘=‘ must be reflexive  8 x,y. x + y = y + x// ‘+’ must be commutative Not enough to prove the validity of Á !

15 Theories through axioms The number of sentences that are necessary for defining a theory may be large or infinite. Instead, it is common to define a theory through a set of axioms. The theory is defined by these axioms and everything that can be inferred from them by a sound inference system.

16 Example 1 Let  = {‘=’}  An example  -formula is  = ((x = y) Æ : (y = z)) ! : (x = z) We would now like to define a  -theory T that will limit the interpretation of ‘=‘ to equality. We will do so with the equality axioms:  8 x. x = x(reflexivity)  8 x,y. x = y ! y = x (symmetry)  8 x,y,z. x = y Æ y = z ! x = z (transitivity) Every structure that satisfies these axioms also satisfies  above. Hence  is T-valid.

17 Example 2 Let  = {‘<’} Consider the  -formula Á : 8 x 9 y. y < x Consider the theory T:  8 x,y,z. x < y Æ y < z → x < z(transitivity)  8 x,y. x < y → : (y < x)(anti-symmetry)

18 Example 2 (cont’d) Recall: Á : 8 x 9 y. y < x Is Á T-satisfiable? We will show a model for it.  Domain: Z  ‘<’  < Is Á T-valid ? We will show a structure to the contrary  Domain: N 0  ‘<’  <

19 Fragments So far we only restricted the nonlogical symbols. Sometimes we want to restrict the grammar and the logical symbols that we can use as well. These are called logic fragments. Examples:  The quantifier-free fragment over  = {‘=’, ‘+’,0,1}  The conjunctive fragment over  = {‘=’, ‘+’,0,1}

20 Fragments Let  = {}  (T must be empty: no nonlogical symbols to interpret) Q: What is the quantifier-free fragment of T ? A: propositional logic Thus, propositional logic is also a first-order theory.  A very degenerate one.

21 Theories Let  = {}  (T must be empty: no nonlogical symbols to interpret) Q: What is T ? A: Quantified Boolean Formulas (QBF) Example:  8 x 1 9 x 2 8 x 3. x 1 → (x 2 Ç x 3 )

22 Some famous theories Presburger arithmetic:  = {0,1, ‘+’, ‘=’} Peano arithmetic:  = {0,1, ‘+’, ‘*’, ‘=’} Theory of reals Theory of integers Theory of arrays Theory of pointers Theory of sets Theory of recursive data structures …

23 The algorithmic point of view... It is also common to present theories NOT through the axioms that define them. The interpretation of symbols is fixed to their common use.  Thus ‘+’ is plus,... The fragment is defined via grammar rules rather than restrictions on the generic first-order grammar.

24 The algorithmic point of view... Example: equality logic (= “the theory of equality”) Grammar: formula : formula Ç formula | : formula | atom atom : term-variable = term-variable | term-variable = constant | Boolean-variable Interpretation: ‘=’ is equality.

25 The algorithmic point of view... This simpler way of presenting theories is all that is needed when our focus is on decision procedures specific for the given theory. The traditional way of presenting theories is useful when discussing generic methods (for any decidable theory T)  Example 1: algorithms for combining two or more theories  Example 2: generic SAT-based decision procedure given a decision procedure for the conjunctive fragment of T.

26 Expressiveness of a theory Each formula defines a language: the set of satisfying assignments (‘models’) are the words accepted by this language. Consider the fragment ‘2-CNF’ formula : ( literal Ç literal ) | formula Æ formula literal: Boolean-variable | : Boolean-variable ( x 1 Ç : x 2 ) Æ ( : x 3 Ç x 2 )

27 Expressiveness of a theory Now consider a Propositional Logic formula  ( x 1 Ç x 2 Ç x 3 ). Q: Can we express this language with 2-CNF? A: No. Proof:  The language accepted by  has 7 words: all assignments other than x 1 = x 2 = x 3 = F.  The first 2-CNF clause removes ¼ of the assignments, which leaves us with 6 accepted words. Additional clauses only remove more assignments.

28 Expressiveness of a theory Claim: 2-CNF Á Propositional Logic Generally there is only a partial order between theories. Languages defined by L 2 Languages defined by L 1 L 2 is more expressive than L 1. Denote: L 1 Á L 2

29 The tradeoff So we see that theories can have different expressive power. Q: why would we want to restrict ourselves to a theory or a fragment ? why not take some ‘maximal theory’… A: Adding axioms to the theory may make it harder to decide or even undecidable.

30 Example: Hilbert axiom system ( H ) Let H be (M.P) + the following axiom schemas: (H1) A ! (B ! A) (H2) ((A ! (B ! C)) ! ((A ! B) ! (A ! C)) (H3) ( : B ! : A) ! (A ! B) H is sound and complete This means that with H we can prove any valid propositional formula, and only such formulas. The proof is finite.

31 Example But there exists first order theories defined by axioms which are not sufficient for proving all T-valid formulas.

32 Example: First Order Peano Arithmetic  = {0,1,‘+’, ‘*’, ‘=’} Domain: Natural numbers Axioms (“semantics”): 1. 8 x : (0  x + 1) 2. 8 x : 8 y : (x  y) ! (x + 1  y + 1) 3. Induction 4. 8 x : x + 0 = x 5. 8 x : 8 y : (x + y) + 1 = x + (y + 1) 6. 8 x : x * 0 = x 8 y : x * (y + 1) = x * y + x + * Undecidable! These axioms define the semantics of ‘+’

33 Example: First Order Presburger Arithmetic  = {0,1,‘+’, ‘*’, ‘=’} Domain: Natural numbers Axioms (“semantics”): 1. 8 x : (0  x + 1) 2. 8 x : 8 y : (x  y) ! (x + 1  y + 1) 3. Induction 4. 8 x : x + 0 = x 5. 8 x : 8 y : (x + y) + 1 = x + (y + 1) 6. 8 x : x * 0 = x 8 y : x * (y + 1) = x * y + x + * decidable! These axioms define the semantics of ‘+’

34 Tradeoff: expressiveness/computational hardness. Assume we are given theories L 1 Á … Á L n More expressive Easier to decide UndecidableDecidable Intractable (exponential) Tractable (polynomial) Computational Challenge! LnLn L1L1 Our course

35 When is a specific theory useful? 1. Expressible enough to state something interesting. 2. Decidable (or semi-decidable) and more efficiently solvable than richer theories. 3. More expressible, or more natural for expressing some models in comparison to ‘leaner’ theories.

36

37 Expressiveness and complexity Q1: Let L 1 and L 2 be two theories whose satisfiability problem is decidable and in the same complexity class. Is the satisfiability problem of an L 1 formula reducible to a satisfiability problem of an L 2 formula? Q2: Let L 1 and L 2 be two theories whose satisfiability problems are reducible to one another. Are L 1 and L 2 in the same complexity class ?