Satisfiability Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001.
Advertisements

UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
Disjunctive Normal Form CS 680: Formal Methods Jeremy Johnson.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
Logic Concepts Lecture Module 11.
Properties of SLUR Formulae Ondřej Čepek, Petr Kučera, Václav Vlček Charles University in Prague SOFSEM 2012 January 23, 2012.
ECE 667 Synthesis & Verification - SAT 1 ECE 667 ECE 667 Synthesis and Verification of Digital Systems Boolean SAT CNF Representation Slides adopted (with.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
Presented by Ed Clarke Slides borrowed from P. Chauhan and C. Bartzis
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
1 Quantified Formulas Acknowledgement: QBF slides borrowed from S. Malik.
Methods of Proof Chapter 7, second half.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
GRASP: A Search Algorithm for Propositional Satisfiability EE878C Homework #2 2002/11/1 KAIST, EECS ICS Lab Lee, Dongsoo.
SAT Solver Math Foundations of Computer Science. 2 Boolean Expressions  A Boolean expression is a Boolean function  Any Boolean function can be written.
Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
Boolean Satisfiability and SAT Solvers
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.
Lecture 22 More NPC problems
CHAPTERS 7, 8 Oliver Schulte Logical Inference: Through Proof to Truth.
Propositional Equivalences
INTRODUCTION TO ARTIFICIAL INTELLIGENCE COS302 MICHAEL L. LITTMAN FALL 2001 Satisfiability.
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
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.:
Propositional calculus
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Disjunctive Normal Form CS 270: Math Foundation of CS Jeremy Johnson.
First-Order Logic and Inductive Logic Programming.
© 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 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Satisfiability and SAT Solvers CS 270 Math Foundations of CS Jeremy Johnson.
NPC.
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.
1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 04 : Logic.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Inference in Propositional Logic (and Intro to SAT)
Inference and search for the propositional satisfiability problem
ARTIFICIAL INTELLIGENCE
Logics for Data and Knowledge Representation
Logical Inference: Through Proof to Truth
Lecture 2 Propositional Logic
Propositional Calculus: Boolean Algebra and Simplification
Elementary Metamathematics
NP-Completeness Proofs
Introduction to the Boolean Satisfiability Problem
ECE 667 Synthesis and Verification of Digital Circuits
Logics for Data and Knowledge Representation
Propositional Equivalences
Artificial Intelligence: Agents and Propositional Logic.
Introduction to the Boolean Satisfiability Problem
Disjunctive Normal Form
NP-Completeness Yin Tat Lee
Methods of Proof Chapter 7, second half.
Presentation transcript:

Satisfiability Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001

Administration Questions?

Types of Logics Logic historically a hot topic in AI. Propositional logic: Boolean variables (simple)Propositional logic: Boolean variables (simple) First-order logic: more advanced types, objects (expressive)First-order logic: more advanced types, objects (expressive) Book covers first-order logic. Focus here on propositional.

Propositional Syntax Formula: Constants: T, FConstants: T, F Variables: x 1,…,x n.Variables: x 1,…,x n. Negation: ~f (f formula)Negation: ~f (f formula) Literal: variable or its negationLiteral: variable or its negation Grouping: (f) (f formula)Grouping: (f) (f formula) Binary expressions nextBinary expressions next

Binary Expressions Given formulae f and g: Conjunction (“and”): fgConjunction (“and”): fg Disjunction (“or”): f+gDisjunction (“or”): f+g Implication: f  gImplication: f  g Equivalence: f  gEquivalence: f  g

Truth Tables xyxyx+y x  y x  y TT TF FT FF T F F F T T T F T F F T T F T T

Some Equivalences Write xy in terms of + and ~: ~(~x+~y)~(~x+~y) Write x  y in terms of the others xy+(~x)(~y)xy+(~x)(~y) Write x  y in terms of the others ~x+y~x+y ~(x(~y))~(x(~y))

CNF Propositional logic syntax is pretty simple, but can be even simpler. Conjunctive normal form (CNF) is a conjunction of disjunction of literals (clauses). (~x+w+v)(x+z+~y)(~w+~y+~v)(v+u+y)(x+~v+u)

Truth Table to CNF 1.Put negation of formula in DNF For each “F” row in table, make a term equivalent to the corresponding assignmentFor each “F” row in table, make a term equivalent to the corresponding assignment 2.Negate the negation By DeMorgan’s Law, ands and ors swap and literals negateBy DeMorgan’s Law, ands and ors swap and literals negate

CNF Example Express x  y in CNF 1.Two cases for “F”: x=T, y=F and x=F, y=T 2.Negation in DNF: x(~y)+(~x)y 3.Negate it: (~x+y)(x+~y) It works!

Assignments & Models Assignment: Mapping of n variables to truth values u=F, v=T, w=F, x=T, y=F, z=T Satisfying assignment (model): Makes the formula evaluate to T (~x+w+v)(x+z+~y)(~w+~y+~v)(v+u+y)(x+~v+u) 64 assignments, 31 models.

Categories of Formulae A Boolean formula can be: Valid (tautology): all assignments satisfying.Valid (tautology): all assignments satisfying. Satisfiable: at least one assignment true.Satisfiable: at least one assignment true. Unsatisfiable: none true.Unsatisfiable: none true.

Computational Problems Given a formula, determine if it is valid: reasoning, proof generation. Given a formula, determine if it is satisfiable (SAT): search. ~valid(f) = satisfiable(~f) Both hard!

SAT as CSP SAT is determining satisfiability of formula in CNF. Can be solved as a CSP! (x+y)(~x+~y) Variables are variables Domain is T, F Clauses are constraints

Generic CSP Algorithm If all values assigned and no constraints violated, doneIf all values assigned and no constraints violated, done Apply consistency checkingApply consistency checking If deadend, backtrackIf deadend, backtrack Select variable to be assignedSelect variable to be assigned Select value for the variableSelect value for the variable Assign variable and recurseAssign variable and recurse

Generic SAT Algorithm If all values assigned and no constraints violated, doneIf all values assigned and no constraints violated, done Apply consistency checkingApply consistency checking If deadend, backtrackIf deadend, backtrack Select variable to be assignedSelect variable to be assigned Select value for the variableSelect value for the variable Assign variable and recurseAssign variable and recurse

Generic SAT Algorithm If all values assigned and no clauses violated, doneIf all values assigned and no clauses violated, done Apply consistency checkingApply consistency checking If deadend, backtrackIf deadend, backtrack Select variable to be assignedSelect variable to be assigned Select value for the variableSelect value for the variable Assign variable and recurseAssign variable and recurse

Generic SAT Algorithm If all values assigned and no clauses violated, doneIf all values assigned and no clauses violated, done Apply unit propagationApply unit propagation If deadend, backtrackIf deadend, backtrack Select variable to be assignedSelect variable to be assigned Select value for the variableSelect value for the variable Assign variable and recurseAssign variable and recurse

Generic SAT Algorithm If all values assigned and no clauses violated, doneIf all values assigned and no clauses violated, done Apply unit propagationApply unit propagation If unsatisfied clause, backtrackIf unsatisfied clause, backtrack Select variable to be assignedSelect variable to be assigned Select value for the variableSelect value for the variable Assign variable and recurseAssign variable and recurse

Pure Variables (x+y+z)(x+~y+~w)(w+~z+y) If x is a pure literal (never appears negated), then if there is a satisfying assignment with x=F, there must also be one with x=T. So, we need only check one case (no branching).

Purification at Work (~x+w+v)(x+z+~y)(~w+~y+~v)(v+u+y)(x+~v+u)z=T(~x+w+v)(~w+~y+~v)(v+u+y)(x+~v+u)u=T(~x+w+v)(~w+~y+~v)x=F(~w+~y+~v)y=F Formula satisfied

DPLL Davis-Putnam-Logemann-Loveland (1962) basis of practical SAT algorithms Recursive: stop if SAT or UNSATRecursive: stop if SAT or UNSAT Unit propagation, recurseUnit propagation, recurse Purification, recursePurification, recurse Else, split and recurse on bothElse, split and recurse on both

Splitting Heuristics How choose a variable to split? Most occurrencesMost occurrences In short clausesIn short clauses Lots more of one kind of literal than anotherLots more of one kind of literal than another

DPLL Analysis n variables. Worst case? Split on a variable in a shortest clause. What if only k literals per clause (k-CNF)? Say, k=2?

Analysis of 2-CNF Can be made to run in polynomial time.

Analysis of 3-CNF (x+y+z)(~x+u+v)… x=T: (u+v)… u=T: … (2 vars eliminated) u=F, v=T: … (3 vars eliminated) x=F: (y+z)… (same idea) R(n)  2 R(n-2) + 2 R(n-3)  n

Analysis Improvements

PHP: Propositional Proof Pigeonhole Principle: If you have n+1 pigeons and n holes and each pigeon is assigned a hole, then some hole contains at least 2 pigeons.If you have n+1 pigeons and n holes and each pigeon is assigned a hole, then some hole contains at least 2 pigeons. DPLL takes exponential time to prove validity.

3-CNF Conversion Ex. ~(~(~x+y) z) Efficient procedure for creating an equivalent 3-CNF expression from an arbitrary propositional expression.

3-CNF Conversion 1.Add a variable for each binary operator in the expression. 2.Create a set of 3-CNF clauses for each of the derived variables. 3.Add a clause for the root node.

What to Learn Definition of SAT. How to make a CNF expression from a truth table. The DPLL algorithm. How to make a 3-CNF expression from an arbitrary expression.

Homework 3 1.Let f=~(x+ ~y(~x+z)). (a) Write out the truth table for f. (b) Convert the truth table to CNF. (c) Show the series of steps DPLL makes while solving the resulting formula. Assume variables chosen for splitting in the order x, y, z. 2.Using the same f from the first part, follow the 3-CNF conversion algorithm to create an equivalent 3-CNF formula.