Logic - Part 2 CSE 573. © Daniel S. Weld 2 Reading Already assigned R&N ch 5, 7, 8, 11 thru 11.2 For next time R&N 9.1, 9.2, 11.4 [optional 11.5]

Slides:



Advertisements
Similar presentations
Russell and Norvig Chapter 7
Advertisements

Propositional Satisfiability (SAT) Toby Walsh Cork Constraint Computation Centre University College Cork Ireland 4c.ucc.ie/~tw/sat/
Agents that reason logically Tuomas Sandholm Carnegie Mellon University Computer Science Department.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 20
Effective Propositional Reasoning CSE 473 – Autumn 2003.
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
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.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View SAT.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Presented by Ed Clarke Slides borrowed from P. Chauhan and C. Bartzis
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.
Knoweldge Representation & Reasoning
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Logic in AI CSE 573. © Daniel S. Weld 2 Logistics Monday? Reading Ch 8 Ch 9 thru p 278 Section 10.3 Projects Due 11/10 Teams and project plan due by this.
1 CS 4700: Foundations of Artificial Intelligence Carla P. Gomes Module: Satisfiability (Reading R&N: Chapter 7)
Knowledge Representation II (Inference in Propositional Logic) CSE 473.
Knowledge Representation II (Inference in Propositional Logic) CSE 473 Continued…
To do Check slides for next lecture and move some to this lecture. Consider eliminating resolution Simplify discussion of inference – just talk about SAT.
Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
Boolean Satisfiability and SAT Solvers
Constrainedness Including slides from Toby Walsh.
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.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 3 Logic Representations (Part 2)
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
Logical Agents Logic Propositional Logic Summary
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logic in AI CSE 573. © Daniel S. Weld 2 Logistics Monday? Reading Ch 8 Ch 9 thru p 278 Section 10.3 Projects Due 11/10 Teams and project plan due by this.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module Logic Representations.
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.
CSE 473 Propositional Logic SAT Algorithms Dan Weld (With some slides from Mausam, Stuart Russell, Dieter Fox, Henry Kautz, Min-Yen Kan…) Irrationally.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
/425 Declarative Methods - J. Eisner 1 Random 3-SAT  sample uniformly from space of all possible 3- clauses  n variables, l clauses Which are.
Review of Propositional Logic Syntax
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
© Daniel S. Weld 1 Logistics Problem Set 2 Due Wed A few KR problems Robocode 1.Form teams of 2 people 2.Write design document.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
SAT Solving As implemented in - DPLL solvers: GRASP, Chaff and
Inference in Propositional Logic (and Intro to SAT) CSE 473.
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.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
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
Logical Inference 1 introduction
EA C461 – Artificial Intelligence Logical Agent
Knowledge Representation II
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
ECE 667 Synthesis and Verification of Digital Circuits
Logics for Data and Knowledge Representation
Artificial Intelligence: Agents and Propositional Logic.
Knowledge Representation I (Propositional Logic)
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Presentation transcript:

Logic - Part 2 CSE 573

© Daniel S. Weld 2 Reading Already assigned R&N ch 5, 7, 8, 11 thru 11.2 For next time R&N 9.1, 9.2, 11.4 [optional 11.5]

© Daniel S. Weld Topics Agency Problem Spaces Search Knowledge Representation Reinforcement Learning InferencePlanning Supervised Learning Logic-Based Probabilistic

© Daniel S. Weld 4 Immediate Schedule Today Tues 10/14 Thurs 10/16 Logic 2 & Planning as Prop Logic CSP & Graphplan (Planning as CSP) Class  3:30pm “Intelligence in Wikipedia”

© Daniel S. Weld 5 Propositional Logic Syntax Atomic sentences: P, Q, … Connectives: , , ,  Semantics Truth Tables Inference Modus Ponens Resolution DPLL GSAT Complexity

© Daniel S. Weld 6 Propsitional Logic: Syntax Atoms P, Q, R, … Literals P,  P Sentences Any literal is a sentence If S is a sentence Then (S  S) is a sentence Then (S  S) is a sentence Conveniences P  Q same as  P  Q

© Daniel S. Weld 7 Special Syntactic Forms General Form: ((q  r)  s))   (s  t) Conjunction Normal Form (CNF) (  q  r  s )  (  s   t) Set notation: { (  q, r, s ), (  s,  t) } empty clause () = false Binary clauses: 1 or 2 literals per clause (  q  r) (  s   t) Horn clauses: 0 or 1 positive literal per clause (  q   r  s ) (  s   t) (q  r)  s (s  t)  false

© Daniel S. Weld 8 Semantics Syntax: which arrangements of symbols are legal (Def “sentences”) Semantics: what the symbols mean in the world (Mapping between symbols and worlds) Sentences Facts Sentences Representation World Semantics Inference

© Daniel S. Weld 9 Satisfiability, Validity, & Entailment S is satisfiable if it is … S is unsatisfiable if it is … S is valid if it is true in … S1 entails S2 if …

© Daniel S. Weld 10 Satisfiability, Validity, & Entailment S is satisfiable if it is true in some world S is unsatisfiable if it is false all worlds S is valid if it is true in all worlds S1 entails S2 if wherever S1 is true S2 is also true

© Daniel S. Weld 11 Forward Chaining, Backward Chaining & Resolution as Search States Logical Formulae Operators Apply a rule to create a new sentence (conjunct) Goal State Different

© Daniel S. Weld 12 Inference 3: Model Enumeration for (m in truth assignments){ if (m makes  true) then return “Sat!” } return “Unsat!” View as Search? Critique?

© Daniel S. Weld 13 Inference 4: DPLL (Enumeration of Partial Models) [Davis, Putnam, Loveland & Logemann 1962] Version 1 dpll_1(pa){ if (pa makes F false) return false; if (pa makes F true) return true; choose P in F; if (dpll_1(pa  {P=0})) return true; return dpll_1(pa  {P=1}); } Returns true if F is satisfiable, false otherwise

© Daniel S. Weld 14 (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 1

© Daniel S. Weld 15 a (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 1 F

© Daniel S. Weld 16 a (F  b  c) (F  ¬b) (F  ¬c) (T  c) DPLL Version 1 F

© Daniel S. Weld 17 a (F  F  c) (F  T) (F  ¬c) (T  c) DPLL Version 1 F b

© Daniel S. Weld 18 a (F  F  F) (F  T) (T  F) DPLL Version 1 F b c

© Daniel S. Weld 19 a F T T T DPLL Version 1 F b c

© Daniel S. Weld 20 a b c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 1

© Daniel S. Weld 21 a b c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 1

© Daniel S. Weld 22 a b c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 1

© Daniel S. Weld 23 a b b c c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 1

© Daniel S. Weld 24 DPLL as Search Search Space? Algorithm?

© Daniel S. Weld 25 Improving DPLL

© Daniel S. Weld 26 Improving DPLL (more)

© Daniel S. Weld 27 Observation!

© Daniel S. Weld 28 DPLL version 2 dpll_2(F, literal){ remove clauses containing literal if (F contains no clauses)return true; shorten clauses containing  literal if (F contains empty clause) return false; choose V in F; if (dpll_2(F,  V))return true; return dpll_2(F, V); } Partial assignment corresponding to a node is the set of chosen literals on the path from the root to the node

© Daniel S. Weld 29 a (F  b  c) (F  ¬b) (F  ¬c) (T  c) DPLL Version 2 F

© Daniel S. Weld 30 a (b  c)(b  c) (¬b) (¬c) DPLL Version 2

© Daniel S. Weld 31 a (F  c) (T) (¬c) DPLL Version 2 b

© Daniel S. Weld 32 a (c)(c) (¬c) DPLL Version 2 b

© Daniel S. Weld 33 a (F) (T) DPLL Version 2 b c

© Daniel S. Weld 34 a () DPLL Version 2 b c Empty clause!

© Daniel S. Weld 35 a (F  F  F) (F  T) (T  F) DPLL Version 2 F b c

© Daniel S. Weld 36 a F T T T DPLL Version 2 F b c

© Daniel S. Weld 37 a b c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 2

© Daniel S. Weld 38 a b c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 2

© Daniel S. Weld 39 a b c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 2

© Daniel S. Weld 40 Benefit Can backtrack before getting to leaf

© Daniel S. Weld 41 Structure in Clauses Pure Literals A symbol that always appears with same sign {{a  b c}{  c d  e}{  a  b e}{d b}{e a  c}} Unit Literals A literal that appears in a singleton clause {{  b c}{  c}{a  b e}{d b}{e a  c}} Might as well set it true! And simplify {{a  b c} {  a  b e} {e a  c}} Might as well set it true! And simplify {{  b} {a  b e}{d b}} {{d}}

© Daniel S. Weld 42 In Other Words May view this as adding constraint propagation techniques into play

© Daniel S. Weld 43 In Other Words May view this as adding constraint propagation techniques into play

© Daniel S. Weld 44 DPLL (previous version) Davis – Putnam – Loveland – Logemann dpll(F, literal){ remove clauses containing literal if (F contains no clauses) return true; shorten clauses containing  literal if (F contains empty clause) return false; if (F contains a unit or pure L) return dpll(F, L); choose V in F; if (dpll(F,  V))return true; return dpll(F, V); }

© Daniel S. Weld 45 DPLL (for real!) Davis – Putnam – Loveland – Logemann dpll(F, literal){ remove clauses containing literal if (F contains no clauses) return true; shorten clauses containing  literal if (F contains empty clause) return false; if (F contains a unit or pure L) return dpll(F, L); choose V in F; if (dpll(F,  V))return true; return dpll(F, V); }

© Daniel S. Weld 46 a b c c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL (for real)

© Daniel S. Weld 47 DPLL (for real!) Davis – Putnam – Loveland – Logemann dpll(F, literal){ remove clauses containing literal if (F contains no clauses) return true; shorten clauses containing  literal if (F contains empty clause) return false; if (F contains a unit or pure L) return dpll(F, L); choose V in F; if (dpll(F,  V))return true; return dpll(F, V); } Where could we use a heuristic to further improve performance? What is the search space anyway?

© Daniel S. Weld 48 Heuristic Search in DPLL Heuristics are used in DPLL to select a (non- unit, non-pure) proposition for branching Idea: identify a most constrained variable Likely to create many unit clauses MOM’s heuristic: Most occurrences in clauses of minimum length

© Daniel S. Weld 49 Success of DPLL 1962 – DPLL invented 1992 – 300 propositions 1997 – 600 propositions (satz) Additional techniques: Learning conflict clauses at backtrack points Randomized restarts 2002 (zChaff) 1,000,000 propositions – encodings of hardware verification problems

© Daniel S. Weld 50 Horn Theories Recall the special case of Horn clauses: { (  q   r  s ), (  s   t) } { ((q  r)  s ), ((s  t)  false) } Many problems naturally take the form of such if/then rules If (fever) AND (vomiting) then FLU Unit propagation is refutation complete for Horn theories Good implementation – linear time!

© Daniel S. Weld 51 WalkSat Local search over space of complete truth assignments With probability P: flip any variable in any unsatisfied clause With probability (1-P): flip best variable in any unsat clause Like fixed-temperature simulated annealing SAT encodings of N-Queens, scheduling Best algorithm for random K-SAT Best DPLL: 700 variables Walksat: 100,000 variables [Slide #s from 2001]

© Daniel S. Weld 52 Random 3-SAT sample uniformly from space of all possible 3- clauses n variables, l clauses Which are the hard instances? around l/n = 4.3

© Daniel S. Weld 53 Random 3-SAT Varying problem size, n Complexity peak appears to be largely invariant of algorithm backtracking algorithms like Davis-Putnam local search procedures like GSAT What’s so special about 4.3?

© Daniel S. Weld 54 Random 3-SAT Complexity peak coincides with solubility transition l/n < 4.3 problems under- constrained and SAT l/n > 4.3 problems over- constrained and UNSAT l/n=4.3, problems on “knife-edge” between SAT and UNSAT

© Daniel S. Weld 55 Real-World Phase Transition Phenomena Many NP-hard problem distributions show phase transitions - job shop scheduling problems TSP instances from TSPLib exam Edinburgh Boolean circuit synthesis Latin squares (alias sports scheduling) Hot research topic: predicting hardness of a given instance, & using hardness to control search strategy (Horvitz, Kautz, Ruan )

© Daniel S. Weld 56 Summary: Algorithms Forward Chaining Resolution Model Enumeration Enumeration of Partial Models (DPLL) Walksat

© Daniel S. Weld 57 Prop. Logic Themes Expressiveness NPC in general Completeness / speed tradeoff Horn clauses, binary clauses Tractability Expressive but awkward No notion of objects, properties, or relations Number of propositions is fixed