Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving
Advertisements

Completeness and Expressiveness
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
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 Use mathematical deduction to derive new knowledge.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
1/30 SAT Solver Changki PSWLAB SAT Solver Daniel Kroening, Ofer Strichman.
Logic Concepts Lecture Module 11.
SAT and Model Checking. Bounded Model Checking (BMC) A.I. Planning problems: can we reach a desired state in k steps? Verification of safety properties:
ECE 667 Synthesis & Verification - SAT 1 ECE 667 ECE 667 Synthesis and Verification of Digital Systems Boolean SAT CNF Representation Slides adopted (with.
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.
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.
Knowledge Representation I (Propositional Logic) CSE 473.
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.
ECI 2007: Specification and Verification of Object- Oriented Programs Lecture 4.
GRASP: A Search Algorithm for Propositional Satisfiability EE878C Homework #2 2002/11/1 KAIST, EECS ICS Lab Lee, Dongsoo.
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.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
Satisfiability Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001.
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.
CHAPTERS 7, 8 Oliver Schulte Logical Inference: Through Proof to Truth.
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.
Introduction to Satisfiability Modulo Theories
Leonardo de Moura Microsoft Research. Is formula F satisfiable modulo theory T ? SMT solvers have specialized algorithms for T.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
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.
Decision methods for arithmetic Third summer school on formal methods Leonardo de Moura Microsoft Research.
CS6133 Software Specification and Verification
First-Order Logic and Inductive Logic Programming.
Automated reasoning with propositional and predicate logics Spring 2007, Juris Vīksna.
Leonardo de Moura and Nikolaj Bjørner Microsoft Research.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
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.
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.
LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
Propositional Logic Rather than jumping right into FOL, we begin with propositional logic A logic involves: §Language (with a syntax) §Semantics §Proof.
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.
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.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Satisfiability Modulo Theories and DPLL(T) Andrew Reynolds March 18, 2015.
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.
Inference in Propositional Logic (and Intro to SAT)
Knowledge Representation and Reasoning
EA C461 – Artificial Intelligence Logical Agent
The Propositional Calculus
ARTIFICIAL INTELLIGENCE
Lazy Proofs for DPLL(T)-Based SMT Solvers
Lecture 2 Propositional Logic
Logics for Data and Knowledge Representation
Artificial Intelligence: Agents and Propositional Logic.
Logics for Data and Knowledge Representation
Presentation transcript:

Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson

General overview of propositional and predicate logic Refresher on SAT and modern DPLL

The syntax and semantics of propositional and predicate logic. Algorithmic principles of modern SAT solvers: DPLL (actually DLL) algorithm Conflict Directed Clause Learning (CDCL) Two-watch literal indexing

Logic is the art and science of effective reasoning. How can we draw general and reliable conclusions from a collection of facts? Formal logic: Precise, syntactic characterizations of well-formed expressions and valid deductions. Formal logic makes it possible to calculate consequences at the symbolic level. Computers can be used to automate such symbolic calculations.

Logic studies the relationship between language, meaning, and (proof) method. A logic consists of a language in which (well-formed) sentences are expressed. A semantic that distinguishes the valid sentences from the refutable ones. A proof system for constructing arguments justifying valid sentences. Examples of logics include propositional logic, equational logic, first-order logic, higher-order logic, and modal logics.

A language consists of logical symbols whose interpretations are fixed, and non-logical ones whose interpretations vary. These symbols are combined together to form well- formed formulas. In propositional logic PL, the connectives , , and  have a fixed interpretation, whereas the constants p, q, r may be interpreted at will.

SAT Theory Solvers SMT Equality + UF Arithmetic Bit-vectors … Case Analysis

Formulas:  := p |  1  2 |  1  2 |  1 |  1   2 Examples: p  q  q  p p   q  (  p  q) We say p and q are propositional variables.

An interpretation M assigns values {true, false} to propositional variables. Let F and G range over PL formulas.

A formula is satisfiable if it has an interpretation that makes it logically true. In this case, we say the interpretation is a model. A formula is unsatisfiable if it does not have any model. A formula is valid if it is logically true in any interpretation. A propositional formula is valid if and only if its negation is unsatisfiable.

p  q  q  p p  q  q p   q  (  p  q)

p  q  q  p VALID p  q  q SATISFIABLE p   q  (  p  q) UNSATISFIABLE

We say two formulas F and G are equivalent if and only if they evaluate to the same value (true or false) in every interpretation

We say formulas A and B are equisatisfiable if and only if A is satisfiable if and only if B is. During this tutorial, we will describe transformations that preserve equivalence and equisatisfiability.

NNF? (p   q)  (q   (r   p))

NNF? NO (p   q)  (q   (r   p))

NNF? NO (p   q)  (q   (r   p))

NNF? NO (p   q)  (q   (r   p))  (p   q)  (q  (  r   p))

NNF? NO (p   q)  (q   (r   p))  (p   q)  (q  (  r   p))  (p   q)  (q  (  r  p))

CNF? ((p  s)  (  q  r))  (q   p  s)  (  r  s)

CNF? NO ((p  s)  (  q  r))  (q   p  s)  (  r  s)

CNF? NO ((p  s)  (  q  r))  (q   p  s)  (  r  s) Distributivity 1. A  (B  C)  (A  B)  (A  C) 2. A  (B  C)  (A  B)  (A  C)

CNF? NO ((p  s)  (  q  r))  (q   p  s)  (  r  s)  ((p  s)   q))  ((p  s)  r))  (q   p  s)  (  r  s) Distributivity 1. A  (B  C)  (A  B)  (A  C) 2. A  (B  C)  (A  B)  (A  C)

CNF? NO ((p  s)  (  q  r))  (q   p  s)  (  r  s)  ((p  s)   q))  ((p  s)  r))  (q   p  s)  (  r  s)  (p   q)  (s   q)  ((p  s)  r))  (q   p  s)  (  r  s) Distributivity 1. A  (B  C)  (A  B)  (A  C) 2. A  (B  C)  (A  B)  (A  C)

CNF? NO ((p  s)  (  q  r))  (q   p  s)  (  r  s)  ((p  s)   q))  ((p  s)  r))  (q   p  s)  (  r  s)  (p   q)  (s   q)  ((p  s)  r))  (q   p  s)  (  r  s)  (p   q)  (s   q)  (p  r)  (s  r)  (q   p  s)  (  r  s)

DNF? p  (  p  q)  (  q  r)

DNF? NO, actually this formula is in CNF p  (  p  q)  (  q  r)

DNF? NO, actually this formula is in CNF p  (  p  q)  (  q  r) Distributivity 1. A  (B  C)  (A  B)  (A  C) 2. A  (B  C)  (A  B)  (A  C)

DNF? NO, actually this formula is in CNF p  (  p  q)  (  q  r)  ((p   p)  (p  q))  (  q  r) Distributivity 1. A  (B  C)  (A  B)  (A  C) 2. A  (B  C)  (A  B)  (A  C)

DNF? NO, actually this formula is in CNF p  (  p  q)  (  q  r)  ((p   p)  (p  q))  (  q  r)  (p  q)  (  q  r) Distributivity 1. A  (B  C)  (A  B)  (A  C) 2. A  (B  C)  (A  B)  (A  C) Other Rules 1.A  A   2.A   A

DNF? NO, actually this formula is in CNF p  (  p  q)  (  q  r)  ((p   p)  (p  q))  (  q  r)  (p  q)  (  q  r)  ((p  q)   q)  ((p  q)  r) Distributivity 1. A  (B  C)  (A  B)  (A  C) 2. A  (B  C)  (A  B)  (A  C) Other Rules 1.A  A   2.A   A

DPLL

A literal is pure if only occurs positively or negatively.

M | F Partial model Set of clauses

Guessing p,  q | p  q,  q  r p | p  q,  q  r

Deducing p, s| p  q,  p  s p | p  q,  p  s

Backtracking p, s| p  q, s  q,  p   q p,  s, q | p  q, s  q,  p   q

Efficient indexing (two-watch literal) Non-chronological backtracking (backjumping) Lemma learning

Initialize Decide Propagate Conflict Resolve Learn Backjump Unsat Sat Restart Adapted and modified from [Nieuwenhuis, Oliveras, Tinelli J.ACM 06]

Lemma learning  t, p, q, s | t   p  q,  q  s,  p   s |  p   s  t, p, q, s | t   p  q,  q  s,  p   s  t, p, q, s | t   p  q,  q  s,  p   s |  p   q  t, p, q, s | t   p  q,  q  s,  p   s |  p  t

Indexing is key to efficient theorem proving. An index is a dictionary that is tuned to search. The literal two-watch scheme is the main index in modern SAT solvers. Track two literals per clause, such that: Track literals that are unassigned or assigned to true. If one of the tracked literals is assigned to false, search for non-tracked literal that is either unassigned or true. If there is no other unassigned or true literal to select, then the other watched literal can be assigned to true. Unit propagation or conflict detection.

Watch literals for Propagate and Conflict Naïve: For every literal l maintain map: Watch(l) = {C 1 … C m } where  l  C i If l is assigned to true, check each C j  Watch(l) for Conflict or Propagate But most of the time, some other literal in C j is either: Unassigned (not yet assigned) Assigned to true.

Insight: No need to include clause C in every set Watch(l) where  l  C. It suffices to include C in at most 2 such sets. Maintain invariant: If some literal l in C unassigned, or assigned to true, then C belongs to the Watch(l’) of some literal that is unassigned or true.

Maintain 2-watch invariant: Set l to true (  l to false). For each C  Watch(l) If all literals in C are assigned to false, then Backjump Else, if all but one literal in C is assigned to false, then Propagate Else, if the other literal in l’  C where C  Watch(l’) is assigned to true, then do nothing. Else, some other literal l’ is true or unassigned, and not watched. Set Watch(l’)  Watch(l’)  { C }, set Watch(l)  Watch(l) \ { C }.

Heuristic: Phase caching Remember the last truth value assigned to propositional atom. If using rule Decide, then re-use the old assignment. Why should this be good (in practice)? Dependencies follow clusters. Truth values in a cluster are dependent. Truth values between clusters are independent. Decide is mainly used when jumping between clusters.

Tune between different heuristics: Restart frequency Why is restarting good? Phase to assign to decision variable Which variable to split on Use simulated annealing based on activity in conflicts Feedback factor from phase changes Which lemmas to learn Not necessarily unique Minimize lemmas Sub-sumption Blocked clause elimination Cache binary propagations