Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.

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 
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
Logic Use mathematical deduction to derive new knowledge.
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.
Resolution Theorem Proving
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
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.
Resolution in Propositional and First-Order Logic.
Knowledge Repn. & Reasoning Lec. #3: Consequence Finding & Prime Implicates/Implicants UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
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.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
Existential Graphs and Davis-Putnam April 3, 2002 Bram van Heuveln Department of Cognitive Science.
Knowledge Representation I (Propositional Logic) CSE 473.
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Knowledge Representation II (Inference in Propositional Logic) CSE 473 Continued…
CS1502 Formal Methods in Computer Science Lecture Notes 10 Resolution and Horn Sentences.
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.
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.
UIUC CS 497: Section EA Lecture #3 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
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
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
Unification Algorithm Input: a finite set Σ of simple expressions Output: a mgu for Σ (if Σ is unifiable) 1. Set k = 0 and  0 = . 2. If Σ  k is a singleton,
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.:
1 Logical Agents Chapter 7. 2 A simple knowledge-based agent The agent must be able to: –Represent states, actions, etc. –Incorporate new percepts –Update.
LECTURE LECTURE Propositional Logic Syntax 1 Source: MIT OpenCourseWare.
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.
1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Knowledge Representation & Reasoning Lecture #1 UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
CS6133 Software Specification and Verification
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Oct, 30, 2015 Slide credit: some slides adapted from Stuart.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Knowledge Repn. & Reasoning Lec. #5: First-Order Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
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.
UBC Department of Computer Science Undergraduate Events More
Knowledge Representation & Reasoning Lecture #1 UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
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.
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)
EA C461 – Artificial Intelligence Logical Agent
Resolution in the Propositional Calculus
EA C461 – Artificial Intelligence Logical Agent
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21
Logical Inference: Through Proof to Truth
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Artificial Intelligence: Agents and Propositional Logic.
CS 416 Artificial Intelligence
Back to “Serious” Topics…
Methods of Proof Chapter 7, second half.
Presentation transcript:

Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005

Today Representation in Propositional Logic Semantics & Deduction Reasoning procedures for propositional logic –Proving entailment using Resolution –Checking Satisfiability (SAT) using DPLL

Representing Knowledge Propositional symbols represent facts under consideration: –there_is_rain, there_are_clouds, door1_open, robot_in_pos_56_210 Not propositions: –is_there_rain? –location_of_robot –Dan_Roth

Representing Knowledge Knowledge bases are sets of formulae –There_is_rain  there_are_clouds –Robot_in_pos_3_1   Position_3_1_empty –Has_drink  coffee  tea

Knowledge Engineering Select a language: set of features Examine cases Decide on dependencies between features Write dependencies formally Test

Propositional Logic Semantics: –Truth assignments that satisfy KB/formula -a-b a -a b a b Interpretations: I 1 [a]=FALSE I 1 [b]=FALSE assign truth values to propositional symbols I1I1 I2I2 I3I3 I4I4

Propositional Logic Semantics: –Truth assignments that satisfy KB/formula b a b -a -b a -a ╨ Models of f: Interpretations that satisfy f I1I1 I2I2 M 1 = I 3 M 2 = I 4 M1M1

Propositional Logic Semantics: –Truth assignments that satisfy KB/formula ╨ M1M1 Logical Entailment ╨╨╨╨

Propositional Logic Semantics: –Truth assignments that satisfy KB/formula Logical Entailment ╨ ┴ Deduction (inference)

More Notations Interpretations ~ Models Axioms – formulae that are “assumed” Signature – the symbols used by a KB Theory ~ KB (a set of axioms), or Theory ~ the complete set of sentences entailed by the axioms Sentence = formula (in prop. logic)

More Notations The value that symbol p takes in model M: –[[ M ]] p –p M –M[p] -- we will primarily use this Clauses: {lit1, lit2, lit3,…} or lit1  lit2  lit3...

SAT via Generate and Test If we have a truth table of KB, then we can check that KB satisfiable by looking at it. Problem: n propositional symbols  2 n rows in truth table –Checking interpretation I takes time O(|KB|) –Generating table is expensive: O(2 n |KB|) time Observation: SAT requires us to look only for one model

Clausal Form Every formula can be reformulated into an equivalent CNF formula (conjunction of clauses). Examples (using De Morgan Laws): )(bb  )(ab  )(ba  )(aa 

Clausal Form Every formula can be reformulated into an equivalent CNF formula (conjunction of clauses). Examples:

Clausal Form Every formula can be reformulated into an equivalent CNF formula (conjunction of clauses). Examples:

Propagating a Truth-Value KB in CNF, and we observe p=TRUE Then, removing clauses with p positive from KB gives an equivalent theory. Example: KB Observe

Propagating a Truth-Value KB in CNF, and we observe p=TRUE Then, removing negative instances of p from KB gives an equivalent theory. Example: KB Observe

DPLL Search Procedure for CNF 1.If no clauses in KB, return T 2.If a clause in KB is empty (FALSE), return F 3.If KB has a unit clause C with prop. p, then return DPLL(KB,p←polarity(p,C)) 4.Choose an uninstantiated variable p 5.If DPLL(KB, p←TRUE) returns T, return T 6.If DPLL(KB, p←FALSE) returns T, return T 7.Return F

DPLL in Action On board

DPLL in Action On board Note: we could know without thorough checking that this KB is satisfiable

DPLL in Action On board

Related: SAT Solving Order of selection of variables (lecture #27) Stochastic local search (readings on website) Binary Decision Diagrams (readings on website) Strategies other than unit propagation (-||-) 2-SAT is solvable in linear time 3-XOR-SAT is solvable in O(n 3 ) time Smart backtracking (zchaff; readings on website) Clauses/Vars in Random SAT (read on website) SAT via probabilistic models (read on website)

Take a Breath Until now: SAT solving –Search in the space of models From now: Resolution theorem proving –Search in the space of proofs Later: Formal Verification

Resolution Theorem Proving Given: –KB – a set of propositional sentences –Query Q – a logical sentence Calling procedure: 1.Add  Q to KB 2.Convert KB into clausal form 3.Run theorem prover. If we prove contradiction, return T. Otherwise, return F.

Resolution Theorem Proving 1.Add  Q to KB 2.Convert KB into clausal form 3.Run theorem prover. If we prove contradiction, return T. Otherwise, return F. Deduction theorem: KB Q iff KB   Q FALSE ╨╨

Resolution Theorem Proving 1.Add  Q to KB 2.Convert KB into clausal form 3.Run theorem prover. If we prove contradiction, return T. Otherwise, return F. Deduction theorem: KB Q iff KB   Q FALSE ╨╨

Propositional Resolution Resolution inference rule: C1: p1  C1’ C2:  p1  C2’ C3: C1’  C2’ C1   p1  C1’ C2  p1  C2’

Propositional Resolution Resolution algorithm (saturation): 1.While there are unresolved C1,C2: (1)Select C1, C2 in KB (2)If C1, C2 are resolvable, resolve them into a new clause C3 (3)Add C3 to KB (4)If C3={ } (empty clause), we got a contradiction. 2.STOP C1: p1  C1’ C2:  p1  C2’ C3: C1’  C2’

Resolution in Action On board Negated Query KB C1: p1  C1’ C2:  p1  C2’ C3: C1’  C2’

Resolution in Action On board C1: p1  C1’ C2:  p1  C2’ C3: C1’  C2’ Negated Query KB

Properties of Resolution Running time for n variables, m clauses: –Resolving two clauses: O(n) –Finding two resolvable clauses: O(1) –Overall algorithm: O(3 n n)

Properties of Resolution Theorem: Resolution is sound –Resolving clauses in KB generates valid consequences of KB Theorem: Resolution is refutation complete –Resolution of KB with  Q yields the empty clause iff KB Q ╨

Properties of Resolution Resolution does not always generate Q KB = { {a,b}, {  a,b}, {b,c} } Q = b   c = {b,  c} Theorem: Resolution always generates a clause that subsumes Q iff KB Q Example: Resolving KB generates b ╨

Simple Enhancements Remove subsumed clauses –{ p } subsumes { p, q } –{ p, q } subsumes { p, q, r } –{  p } does not subsume { p, q } Contract same literals –{ p, p, q } becomes { p, q } Unit resolution: resolve unit clauses first

Related to Prop. Resolution Clause selection for resolution (lecture 26) Consequence finding (if have time) Prime implicates/implicants (if have time)

Take a Breath SAT solving –Search in the space of models Until now: Resolution theorem proving –Search in the space of proofs Soundness & Completeness If we have time: Formal Verification

Soundness Prove soundness of resolution

Completeness Prove completeness of resolution

Resolution vs SAT SAT solvers can find models Resolution sometimes better at finding contradictions With resolution it is easier to explain and provide a proof

Summary So Far Finding models using DPLL Resolution theorem proving allows us to find contradictions and explanation. –The deduction theorem tells us how to ask queries from either SAT solvers or Resolution

Summary So Far Finding models using DPLL Resolution theorem proving allows us to find contradictions and explanation. –The deduction theorem tells us how to ask queries from either SAT solvers or Resolution

Application: Hardware Verification AND not AND f1f1 f2f2 f3f3 f4f4 f5f5 OR x1x1 x2x2 x3x3 f 5 (x 1,x 2,x 3 ) = a function of the input signal Question: Can we set this boolean cirtuit to TRUE?

Application: Hardware Verification AND not AND f1f1 f2f2 f3f3 f4f4 f5f5 OR x1x1 x2x2 x3x3 f 5 (x 1,x 2,x 3 ) = f 3  f 4 =  f 1  (f 2  x 3 ) =  (x 1  x 2 )  (  x 2  x 3 ) Question: Can we set this boolean cirtuit to TRUE? SAT(f 5 ) ? M[x 1 ]=FALSE M[x 2 ]=FALSE M[x 3 ]=FALSE

Hardware Verification Questions in logical circuit verification –Equivalence of circuits –Arrival of the circuit to a state (required a temporal model, which gets propositionalized) –Achieving an output from the circuit

Summary SAT checking using DPLL (instantiate, propagate, backtrack) Entailment/SAT checking using Resolution (create more and more clauses until KB is saturated) Formal verification uses mainly SAT checking such as DPLL, but also sometimes resolution