Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.

Slides:



Advertisements
Similar presentations
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Advertisements

Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Logic.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View SAT.
Ofer Strichman, Technion 1 Decision Procedures in First Order Logic Part I - Introduction.
1 Chapter 7 Propositional and Predicate Logic. 2 Chapter 7 Contents (1) l What is Logic? l Logical Operators l Translating between English and Logic l.
The Theory of NP-Completeness
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
NP-Complete Problems Problems in Computer Science are classified into
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Knoweldge Representation & Reasoning
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Chapter 11: Limitations of Algorithmic Power
Ofer Strichman, Technion 1 Decision Procedures in First Order Logic Part II – Equality Logic and Uninterpreted Functions.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is  satisfiable ? Example:  Let x 1,x 2 be propositional.
SAT Solver Math Foundations of Computer Science. 2 Boolean Expressions  A Boolean expression is a Boolean function  Any Boolean function can be written.
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
Quantified Formulas - Decision Procedure Daniel Kroening, Ofer Strichman Presented by Changki Hong 07 NOV 08.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
LDK R Logics for Data and Knowledge Representation Modeling First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
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.
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
Of 33 lecture 12: propositional logic – part I. of 33 propositions and connectives … two-valued logic – every sentence is either true or false some sentences.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
Course Overview and Road Map Computability and Logic.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
Great Theoretical Ideas in Computer Science.
CS6133 Software Specification and Verification
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
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.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Chapter 7. Propositional and Predicate Logic Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Inference in Propositional Logic (and Intro to SAT) CSE 473.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 04 : Logic.
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
CENG 424-Logic for CS Introduction Based on the Lecture Notes of Konstantin Korovin, Valentin Goranko, Russel and Norvig, and Michael Genesereth.
Decision Procedures in First Order Logic
Chapter 7. Propositional and Predicate Logic
Inference in Propositional Logic (and Intro to SAT)
Knowledge Representation and Reasoning
The Propositional Calculus
ARTIFICIAL INTELLIGENCE
Great Theoretical Ideas in Computer Science
Lecture 2 Propositional Logic
Elementary Metamathematics
Logics for Data and Knowledge Representation
PROPOSITIONAL LOGIC - SYNTAX-
Chapter 7. Propositional and Predicate Logic
ece 720 intelligent web: ontology and beyond
Presentation transcript:

Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background

Decision Procedures An algorithmic point of view2 Outline What is Logic Proofs by deduction Proofs by enumeration Decidability, soundness and completeness Some notes on Propositional Logic

Decision Procedures An algorithmic point of view3 What is Logic? Some useful definitions on the web:  “science dealing with the principles of valid reasoning and argument”  “A formal and powerful method of explaining why the program doesn't work”  “The art of being wrong with confidence”

Decision Procedures An algorithmic point of view4 So what is Logic? Defined by  Syntax (including the Signature of the logic  : variables and their domain, function and predicate symbols, quantifiers, etc)  Axioms and Inference rules. A logic allows us to infer theorems.

Decision Procedures An algorithmic point of view5 Example: Propositional Logic Syntax formula: Boolean-var | : formula | formula Ç formula | ( formula ) | T | F (Can also use: formula Æ formula | formula ! formula…) Axioms: 1. ` (A ! (B ! A)) 2. ` ((A ! (B ! C)) ! ((A ! B) ! (A ! C))) 3. ` ( : B ! : A) ! (A ! B) Inference Rule: Modus Ponens (MP) ` A ` A ! B ` B A specific (one of many possible) Deductive System for Propositional Logic. It is known as the Hilbert System H.

Decision Procedures An algorithmic point of view6 A proof by deduction: example Notation: ` H  ‘there exists a proof of  in H ’ Theorem: ` H (A ! B) ! ((B ! C) ! (A ! C)) 1. {A ! B, B ! C, A} ` H APremise 2. {A ! B, B ! C, A} ` H A ! BPremise 3. {A ! B, B ! C, A} ` H BM.P. 1,2 4. {A ! B, B ! C, A} ` H B ! CPremise 5. {A ! B, B ! C, A} ` H CM.P. 3,4 6. {A ! B, B ! C} ` H (A ! C)Deduction 5 7. {A ! B} ` H ((B ! C) ! (A ! C))Deduction 6 8. ` H (A ! B) ! ((B ! C) ! (A ! C))Deduction 7

Decision Procedures An algorithmic point of view7 Semantics Can be given via axioms and inference rules, or Can be given via truth tables x1x1 x2x2 x1 Æ x2x1 Æ x2 x1 Ç x2x1 Ç x2... TTTT TFFT FTFT FFFF

Decision Procedures An algorithmic point of view8 Satisfying interpretations If an assignment  satisfies (according to the truth tables) a formula , we write:  ² . Example:  : : ( x 1 Æ : ( x 2 Ç : x 3 ))    : ( x 1 = T, x 2 = F, x 3 = F)   ²     : ( x 1 = T, x 2 = F, x 3 = T)  2 2 

Decision Procedures An algorithmic point of view9 Satisfiability, Validity, etc. Definition (Satisfiability): A formula  is satisfiable if 9  ²  Definition (Validity): A formula  is valid if 8   ² . If  is valid, we write ² . Observation:  is valid if and only if :  is unsatisfiable.

Decision Procedures An algorithmic point of view10 A proof by enumeration: same example ABC(A ! B) ! ((B ! C) ! (A ! C)) TTTT TTFT TFTT TFFT FTTT FTFT FFTT FFFT ²

Decision Procedures An algorithmic point of view11 Soundness and completeness of a deductive system Given a deductive system D,  D is sound for a logic L, if for every formula f in L, ` D f ! ² f  D is complete if for every formula f in L, ² f ! ` D f

Decision Procedures An algorithmic point of view12 The decision problem Definition (the decision problem): The decision problem for a formula: given , is  valid? Definition (decision Procedure for a logic): A decision procedure for a logic is an algorithm that solves the decision problem for any formula in this logic. We are naturally interested in a sound and complete decision procedure.

Decision Procedures An algorithmic point of view13 Soundness and Completeness What does it mean that a decision procedure is sound and complete?  Soundness: the answer returned by the decision procedure is always correct (Question: ‘correct’ according to what?)  Completeness: returns with a yes/no answer in finite time. (Question: How does this definition relate to the definition of completeness of a deduction system?)

Decision Procedures An algorithmic point of view14 Soundness and Completeness Soundness: “when I say that it rains, it rains, and when I say it doesn’t rain, it doesn’t rain” Completeness: “If asked, I always reply (in a finite time…) whether it rains” A logic is decidable  there is a sound and complete algorithm that decides if a well-formed expression in this logic is valid.

Decision Procedures An algorithmic point of view15 Soundness and Completeness (cont’d) Algorithm #1: for checking if it rains outside: “stand right outside the door and say ‘it rains’” It is not sound because you might say it rains when it doesn’t. But it is complete: you always get an answer in a finite time.

Decision Procedures An algorithmic point of view16 Soundness and Completeness (cont’d) Algorithm #2 for checking if it rains outside: “stand right outside the door and say ‘it rains’ if and only if you feel the rain” It is sound because you say it rains only if it actually rains. It is incomplete because you do not say anything if it doesn’t rain (we do not know whether it doesn’t rain, or it takes the person too long to answer…).

Decision Procedures An algorithmic point of view17 Decidability Propositional logic is decidable  there is a sound and complete algorithm (e.g., truth tables) to decide whether a propositional formula is valid. Arithmetic over integers is undecidable (this is Gödel's incompleteness result)

Decision Procedures An algorithmic point of view18 Inference engines We saw that in Propositional Logic we can infer with both a deductive system (“deduction”) and truth tables (“enumeration”). Which, in the general case, is the better method? All logics have a deductive definition. NOT all logics can be decided with an enumerative method.

Decision Procedures An algorithmic point of view19 Deductive methods Axioms and Inference rules Enumerative methods “Truths tables” Or Requires thinking… Requires pressing ‘Enter’… Whenever we can: build an engine to think for us

Decision Procedures An algorithmic point of view20 Expressiveness of a logic Each formula defines a language: the set of satisfying assignments (‘models’) are the words accepted by this language. Consider the logic ‘2-CNF’ formula : ( literal Ç literal ) | formula Æ formula literal: Boolean-variable | : Boolean-variable ( x 1 Ç : x 2 ) Æ ( : x 3 Ç x 2 )

Decision Procedures An algorithmic point of view21 Expressiveness of a logic 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.

Decision Procedures An algorithmic point of view22 Expressiveness of a logic Claim: 2-CNF Á Propositional Logic Generally there is only a partial order between logics. Languages defined by L 2 Languages defined by L 1 L 2 is more expressive than L 1. Denote: L 1 Á L 2

Decision Procedures An algorithmic point of view23 Tradeoff: expressiveness/computational hardness. Assume we are given logics L 1 Á … Á L n More expressive Easier to decide UndecidableDecidable Intractable (exponential) Tractable (polynomial) Computational Challenge! LnLn L1L1 Our course

Decision Procedures An algorithmic point of view24 When is a specific logic useful? 1. Expressible enough to state something interesting. 2. Decidable (or semi-decidable) and more efficiently solvable than richer logics. 3. More expressible, or more natural for expressing some models in comparison to ‘leaner’ logics.

Decision Procedures An algorithmic point of view25 Example: First Order Peano Arithmetic constants: 0,1 Function symbols: ‘+’, ‘*’, Predicate symbol: ‘=’ 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 ‘+’

Decision Procedures An algorithmic point of view26 Example: Presburger Arithmetic constants: 0,1 Function symbols: ‘+’, ‘*’, Predicate symbol: ‘=’ 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!

Decision Procedures An algorithmic point of view27 Logic in Computer Science Reasoning in AI Proofs in verification Queries in Databases … many more

Decision Procedures An algorithmic point of view28 Some notes on Propositional Logic The simplest of them all NP-complete Exceptionally efficient solvers (SAT engines, BDDs) Formulas with 10 5 variables are being solved regularly All the logics that we will consider can be reduced directly to this logic

Decision Procedures An algorithmic point of view29 Some notes on Propositional Logic A literal: v : v positive literal negative literal Also known as ‘the phase’, or ‘the polarity’ of the literal. The “logical phase” of a literal can be computed by counting the number of negations that nest it:  v is logically negative in: : v, : ( : ( : v )), v ! u, : ( u ! v )  v is logically positive in: v, : ( v ! u )

Decision Procedures An algorithmic point of view30 Some notes on Propositional Logic Normal forms:  Conjunctive Normal Form (CNF)  Disjunctive Normal Form (DNF) (for which satisfiability is in P)  Negation Normal Form (NNF) (all negations are over literals, not sub formulas) CNF and DNF are special cases of NNF

Decision Procedures An algorithmic point of view31 Some notes on Propositional Logic Checking Satisfiability of a Boolean formula  :  Convert  to a CNF: with additional variables, in P time.  Convert  to DNF: Exp time and space  Convert  to NNF: P time

Decision Procedures An algorithmic point of view32 The ‘Pure literal rule’  : ( x Ç y ) Æ ( : x Ç z ) Æ ( x Ç y Ç : z ) y is ‘pure’: it only appears in one phase Idea: when trying to satisfy , first assign y = true. Why? If there is a satisfying assignment to , there is a satisfying assignment in which y = true. Generalization: assign all pure literals according to their phase.

Decision Procedures An algorithmic point of view33 Pure literals in NNF CNF is a special case of NNF A pure literal is defined in the same way: a literal that only appears in one phase. We can always start satisfiability checking by assigning these pure literals true or false according to their phase. We will rely on a similar principle also when considering other Logics.

Decision Procedures An algorithmic point of view34 Monotonicity of NNF Thm: NNF formulas are monotonically satisfied (in CNF this is simply the pure literal rule)  ’’ Satisfied literals  ²  !  ’ ²   :  ’: 1 1  : ( x 1 Æ : x 2 ) Ç ( x 2 Ç ( x 3 Æ x 1 ))

Decision Procedures An algorithmic point of view35 Monotonicity of NNF (example)  : ( : x Æ y ) Ç z  : ( x, y, z ) = (0,1,0)  ²  S ={ : x, y }  ’: ( x, y, z ) = (0,1,1)  ’ ²  S ’={ : x, y, z }

Decision Procedures An algorithmic point of view36 Some notes… Why is monotonicity relevant to our decision procedures ? We will use the fact that if we make unsatisfied predicates satisfied, we do not make the formula unsatisfied. We will rely heavily on this fact later: it simplifies decision procedures.