1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is  satisfiable ? Example:  Let x 1,x 2 be propositional.

Slides:



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

SCL: A Logic Standard for Semantic Integration Christopher Menzel Philosophy Department Texas A&M University
Completeness and Expressiveness
1 First order theories (Chapter 1, Sections 1.4 – 1.5)
Logic.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
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.
The Theory of NP-Completeness
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Chapter 11: Limitations of Algorithmic Power
Review: forward E { P } { P && E } TF { P && ! E } { P 1 } { P 2 } { P 1 || P 2 } x = E { P } { \exists … }
Computability and Complexity 10-1 Computability and Complexity Andrei Bulatov Gödel’s Incompleteness Theorem.
1 A Combination Method for Generating Interpolants by G. Yorsh and M. Masuvathi Presentation by: Emilia Katz.
Monadic Predicate Logic is Decidable Boolos et al, Computability and Logic (textbook, 4 th Ed.)
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse.
Ofer Strichman, Technion Deciding Combined Theories.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
MATH 224 – Discrete Mathematics
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.
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)
Theory of Computation, Feodor F. Dragan, Kent State University 1 NP-Completeness P: is the set of decision problems (or languages) that are solvable in.
INTRODUCTION TO ARTIFICIAL INTELLIGENCE COS302 MICHAEL L. LITTMAN FALL 2001 Satisfiability.
NP Complexity By Mussie Araya. What is NP Complexity? Formal Definition: NP is the set of decision problems solvable in polynomial time by a non- deterministic.
Introduction to Satisfiability Modulo Theories
Pattern-directed inference systems
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
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.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
CS6133 Software Specification and Verification
0 Propositional logic versus first-order (predicate) logic The universe of discourse Constants, variables, terms and valuations Predicates as generalized.
LDK R Logics for Data and Knowledge Representation First Order Logics (FOL) Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Oct, 30, 2015 Slide credit: some slides adapted from Stuart.
Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson.
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.
ece 627 intelligent web: ontology and beyond
Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of.
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.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
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.
Lecture 041 Predicate Calculus Learning outcomes Students are able to: 1. Evaluate predicate 2. Translate predicate into human language and vice versa.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
6/11/2016 Linear Resolution and Introduction to First Order Logic Michael Leuschel Softwaretechnik und Programmiersprachen Lecture 5.
Satisfiability Modulo Theories and DPLL(T) Andrew Reynolds March 18, 2015.
Computing & Information Sciences Kansas State University Monday, 18 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 11 of 42 Monday, 18 September.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Propositional Logic (a.k.a. Sentential Logic)
The Propositional Calculus
NP-Completeness Proofs
1st-order Predicate Logic (FOL)
MA/CSSE 474 More Math Review Theory of Computation
Search techniques.
Formal Methods in software development
1st-order Predicate Logic (FOL)
Presentation transcript:

1 First order theories

2 Satisfiability The classic SAT problem: given a propositional formula , is  satisfiable ? Example:  Let x 1,x 2 be propositional variables  Let  := (x 1 → x 2 ) Æ (x 1 Æ :: x 2 )  Is  satisfiable ?

3 Satisfiability Modulo Theories Now let the predicates be equalities Example:  Let x 1,x 2,x 3 2 Z  Let  := ((x 1 = x 2 ) → (x 2 = x 3 )) Æ x 1  x 3  Is  satisfiable ?

4 Satisfiability Modulo Theories Now let the predicates be from linear arithmetic Example:  Let x 1,x 2,x 3 2 R  Let  := ((x 1 + 2x 3 < 5) Ç : (x 3 · 1) Æ (x 1 ¸ 3))  Is  satisfiable ?

5 Satisfiability Modulo Theories Now let the predicates represent arrays Example:  Let i,j,a[] 2 Z  Let  := (i = j Æ a[j] = 1) Æ a[i]  1  Is  satisfiable ?

6 Generalization Equalities, linear predicates, arrays,... Is there a general framework to define them ? Yes ! It is called first-order logic Each of the above examples is a first-order theory.

7 Some useful first-order theories The SMT web page:

8 What lies ahead... As in the case of propositional logic, we need to define  Syntax  Semantics But it is more difficult, because:  First-order logic is a template for defining theories  Semantics cannot be defined with truth-tables The domains can be infinite !

9 First-order logic: Terms & predicates Let  x,y be variables  f,g be function symbols (unary & binary, respectively)  a,b,c be propositional variables  p be a binary predicate symbol Example of terms: xx  f(f(x))  g(f(x),g(y,z))) Example of predicates:  a  p(f(x),g(x,y))

10 First-order logic – Grammar A FOL formula is a predicate, or An application of a propositional connective over FOL formula(s) An application of a quantifier ( 9, 8 ) over a FOL formula Examples:

11 First-order Logic / scopes Each quantifier has a scope If a variable is not quantified, it is called free A formula without free variables is called a sentence Here, b is free

12 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.

13 First order logic We distinguish between  Logical symbols: Æ Ç : 8 9 ( )  Non-logical Symbols  : function symbols (incl. constants) predicate symbols  is the ‘signature’ of the theory   restricts the syntax  The theory also restricts the semantics of the symbols in  We will see how...

14 Example 1  = {0,1,f,p}  ‘0’,’1’ are constant symbols  ‘f’ is a binary function symbol  ‘p’ is a binary predicate An example of a  -formula: 9 y 8 x. p(x, y) Is it true ?  depends on the interpretation we give to p.  Does there exists a satisfying interpretation?

15 Example 2  = {1,p 1,p 2, p 3 }  ‘1’ is a constant symbol  p 1, p 2 are binary predicates  p 3 is a unary predicate An example  -formula: 8 n 9 k. p 2 (n,1 ) ! p 3 ( k ) Æ p 1 (n,k ) Æ p 1 (k, 2n). is this formula satisfiable ?  i.e., is there an interpretation that makes it true ?

16 Example 2, interpreted set p 1 = ‘>’, p 2 = ‘<‘, p 3 = isPrime. So now the formula is: 8 n 9 k. n > 1 ! isprime(k) Æ n < k < 2n. This is Bertrand’s postulate  Proven separately by Chhebyshev, Ramanujan, Erdos.

17 Without interpretations... Technically, we should also assign interpretation to symbols that are already ‘taken’: ‘+’,’*’, ‘<‘,...  In practice no one in their right mind gives them non- standard interpretation. Example:  Let  = {0,1,+,=} where 0,1 are constants, + is a binary function and = a predicate.  Let  = 9 x. x + 0 = 1  Q: Is  true in N 0 ?

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

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

20 Satisfying structures Definition: A formula is satisfiable if there exists a structure that satisfies it Example:  = 9 x. f(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) ‘f’  + (addition)  is satisfied by S’. S’ is a model of .

21 Two ways to define a theory We can define a theory 1. The easy, “direct” way, Define the grammar, Assume standard interpretation of the symbols. 2. The hard, “formal” way. Define the signature Restrict possible interpretations with sentences/axioms Very useful for defining algorithms and proving general theorems

22 1. Defining a theory: the easy way Example: The quantifier-free theory of equalities Grammar: A Boolean combination of predicates of the form “x = y”, where x,y 2 R.  Example: x = y Ç : (y = z ! x = z) Note that here...  we implicitly say that ‘=‘ is the equality predicate, and  we predefine the domain of the variables

23 2. Defining a theory: the hard way Let  be a signature A theory defined over  is called a  -theory A  -theory restricts the interpretations that we can give the symbols in .  How ?

24 2. Definitions... For a signature  :  - formula: a formula over  symbols + logical symbols. A  -theory T is defined by a set of  -sentences.

25 2. 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 .

26 2. Theories through axioms The number of sentences that are necessary for defining a theory might 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.

27 2. Axioms for some ‘famous’ predicates Let ‘T’ be: (defining ‘=‘): Example :  = ((x = y) Æ : (y = z)) ! : (x = z) Is Á T-valid ? Every structure that satisfies these axioms, satisfies . Hence  is T-valid. 8 x. x = x(reflexivity) 8 x,y. x = y ! y = x (symmetry) 8 x,y,z. x = y Æ y = z ! x = z (transitivity)

28 2. Axioms for some ‘famous’ predicates Let ‘T’ be: (defining ‘<‘) Example: Á : 8 x. 9 y. y < x Is Á T-satisfiable? We will show a model for it.  Domain: Z  ‘< ‘  < 8 x,y,z. x < y Æ y < z → x < z(transitivity) 8 x,y. x < y → : (y < x)(anti-symmetry)

29 2. Axioms for some ‘famous’ predicates Let ‘T’ be: (defining ‘<‘) Example: Á : 8 x. 9 y. y < x Is Á T-valid? 8 x,y,z. x < y Æ y < z → x < z(transitivity) 8 x,y. x < y → : (y < x)(anti-symmetry) We will show a structure to the contrary  Domain: N 0  ‘<‘  <

30 2. Axioms for some ‘famous’ predicates Let  = {‘<‘} Consider the  -formula Á : 8 x. 9 y. y < x Consider the theory T: Is Á T-valid? We will show a structure to the contrary  Domain: N 0  ‘<‘  < 8 x,y,z. x < y Æ y < z → x < z(transitivity) 8 x,y. x < y → : (y < x)(anti-symmetry)

31 Fragments So far we only restricted the nonlogical symbols. Sometimes we want to  restrict the grammar  restrict the allowed logical symbols. These are called logic fragments. Examples:  The quantifier-free fragment over  = {=,+,0,1}  The conjunctive fragment over  = {=,+,0,1}

32 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.

33 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 )

34 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 …

35 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 )

36 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.

37 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

38 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.

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

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

41 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

42 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 expressive, or more natural for expressing some models in comparison to ‘leaner’ theories.

43 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?

44 Expressiveness and complexity 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 ?