Knowledge Representation and Reasoning University "Politehnica" of Bucharest Department of Computer Science Fall 2011 Adina Magda Florea

Slides:



Advertisements
Similar presentations
Resolution Proof System for First Order Logic
Advertisements

The Model Evolution Calculus with Built-in Theories Peter Baumgartner MPI Informatik, Saarbrücken
Biointelligence Lab School of Computer Sci. & Eng.
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 
Knowledge Representation and Reasoning University "Politehnica" of Bucharest Department of Computer Science Fall 2010 Adina Magda Florea
First Order Logic Resolution
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Effective Propositional Reasoning CSE 473 – Autumn 2003.
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.
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:
1 Applied Computer Science II Resolution in FOL Luc De Raedt.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
Inference and Resolution for Problem Solving
1 Quantified Formulas Acknowledgement: QBF slides borrowed from S. Malik.
Existential Graphs and Davis-Putnam April 3, 2002 Bram van Heuveln Department of Cognitive Science.
Knowledge Representation I (Propositional Logic) CSE 473.
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.
Artificial Intelligence
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
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.
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
INTRODUCTION TO ARTIFICIAL INTELLIGENCE COS302 MICHAEL L. LITTMAN FALL 2001 Satisfiability.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
CS344: Introduction to Artificial Intelligence Lecture: Herbrand’s Theorem Proving satisfiability of logic formulae using semantic trees (from Symbolic.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 28– Interpretation; Herbrand Interpertation 30 th Sept, 2010.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
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.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 23 Friday, 17 October.
CS6133 Software Specification and Verification
First-Order Logic and Inductive Logic Programming.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 18 of 41 Friday, 01 October.
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.
Knowledge Repn. & Reasoning Lec. #5: First-Order Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
Computing & Information Sciences Kansas State University Lecture 12 of 42 CIS 530 / 730 Artificial Intelligence Lecture 12 of 42 William H. Hsu Department.
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,
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.
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. 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
Lecture 2 Propositional Logic
ECE 667 Synthesis and Verification of Digital Circuits
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Artificial Intelligence: Agents and Propositional Logic.
Back to “Serious” Topics…
Computer Security: Art and Science, 2nd Edition
Logics for Data and Knowledge Representation
Presentation transcript:

Knowledge Representation and Reasoning University "Politehnica" of Bucharest Department of Computer Science Fall 2011 Adina Magda Florea curs.cs.pub.ro Master of Science in Artificial Intelligence,

Lecture 2 Lecture outline  Predicate logic  Herbrand theorem  Powerful inference rules

1. Predicate logic

PrL, FOPL Extend PrL, PL Sentential logic of beliefs Uses beliefs atoms B A (  ) Index PL with agents Modal logic Modal operators Logics of knowledge and belief Modal operators B and K Dynamic logic Modal operators for actions Temporal logic Modal operators for time Linear time Branching time CTL logic Branching time and action BDI logic Adds agents, B, D, I Linear model Structured models Situation calculus Adds states, actions Symbol level Knowledge level Description Logics Subsumption relationships

1. Predicate logic - Syntax  variables  function symbols  terms  predicate symbols  atoms  Boolean connectives  quantifiers  The function symbols and predicate symbols, each of given arity, comprise a signature .  A ground term is a term without any variables 13

Predicate logic - Semantics  Universe (aka Domain) : Set U  Variables – values in U  Function symbols – (total) functions over U  Predicate symbols – relations over U  Terms – values in U  Formulas – Boolean truth values  Interpretation of a formula 14

Algorithmic problems  F – a well formed formula, A – an interpretation  Validity(F): |= F ? (is F true in every interpretation?)  Satisfiability (F): F satisfiable?  Entailment (F, G): F |= G? (does F entail G?)  Model(A,F): A |=F ?  Solve (A,F): find an assignment  such that A,  |=F  Solve (F): find a substitution  such that |=F   Abduce(F): find G with certain properties: such that G |= F 15

How can we do it? Suppose we want to prove H |= G (entailment).  Equivalently, we can prove that F := H → G is valid.  Equivalently, we can prove that ~F, i.e., H  ~G is unsatisfiable.  This principle of “refutation theorem proving” is the basis of almost all automated theorem proving methods. 16

How can we do it?  Use normal forms  Find a way to prove refutation – Herbrand model and theorems 16

Normal forms  Study of normal forms is motivated by: reduction of logical concepts efficient data structures for theorem proving.  The main problem in first-order logic is the treatment of quantifiers. The normal form transformations are intended to eliminate many of them. 17

Normal forms  Prenex normal form  CNF  Eliminate existential quantifiers and conjunctions => Normal form matrix prefix 18

Herbrand universe  Herbrand universe  Herbrand base  Ground instances of a clause (set of clauses) S belongs to H = 19

Examples 20

Herbrand interpretation  H-interpretation 21

Herbrand interpretation  H-interpretation I* correspinding to an interpretation I for a set of clauses S 22

Herbrand theorem  Lemma. If an interpretation I over a domain D satisfies the set of clauses S (i.e., the set S is satisfiable under that interpretation), then any H-interpretation I* corresponding to I also satisfies S  Theorem. A set of clauses S is inconsistent iff S is false for any H- interpretation of S 23

Semantic Trees  Semantic trees  Complete semantic trees Herbrand base of S is 24

Semantic Trees Herbrand base of S is  Complete semantic tree 25

Closed semantic trees 26

Closed semantic trees Failure nodes Inference nodes 27

Review of definitions  Basic instance of a clause C in S = an instance C' of a clause C from S obtained by replacing the variables it contains with elements of the Herbrand universe  Complete semantic tree (CST) = for any leaf of the tree, I(N) contains either Ai or ~Ai (i.e., any path from the root to a leaf contains all elements of the Herbrand base either in positive or negative form)  Failure node in a ST = I(N) falsifies a basic instance of a clause in S and I(N') does not falsify any instance of a clause in S, with N' the immediate predecesor of N  Closed semantic tree = any branch has (ends in) a failure nod  Inference node in a ST = all the node's successors are failure nodes 28

Herbrand's theorem  Idea: to test if a set S of clauses is unsatisfiable we have to test if S is unsatisfiable only for H-interpretations (interpretations over the Herbrand universe) First version of HT  A set of clauses S is unsatisfiable iff for any semantic tree of S there exists a finite closed semantic tree  (any complete semantic tree of S is a closed semantic tree) 29

Herbrand's theorem Second version of HT  A set of clauses S is unsatisfiable iff there exists a finite set S' of ground instances of S which is unsatisfiable  (the Herbrand base of S is unsatisfiable) 30

Powerful inference rules - Resolution Resolution  Binary resolution  Factorization  General resolution  Paramodulation 31

Resolution  Theorem. Resolution is sound. That is, all derived formulas are entailed by the given ones  Theorem: Resolution is refutationally complete.  That is, if a clause set is unsatisfiable, then Resolution will derive the empty clause eventually.  If a clause set is unsatisfiable and closed under the application of resolution inference rule then it contains the empty clause. 35

Completeness of Resolution complete semantic tree closed semantic tree inference node failure node 36

Completeness of Resolution closed semantic tree inference node failure node inference node 37

Completeness of Resolution  Lifting lemma If C1' si C2' are basic instances of C1 and C2 and then there is a clause C such that C' is an instance of C  Theorem: Resolution is refutationally complete.  A set of clauses S is unsatisfiable iff there is a deduction of the empty clause from S. 38

Factorization  Resolution si not complete without factorization 32

Factorization – Russell's antinomy A barber shaves men if and only if they do not shave themselves. Should the barber shave himself or not? (A1) ~Shaves(x,x)  Shaves(barber,x) (A2) Shaves(barber,y)  ~Shaves (y,y) (C1) Shaves(x,x)  Shaves (barber,x) (C2) ~Shaves (barber,y)  ~Shaves (y,y) (Res1) ~Shaves (barber,x)  Shaves (barber,x) (Res2) Shaves(barber,barber)  ~Shaves (barber,barber) (FC1): Shaves (barber,barber) (FC2): ~Shaves (barber,barber) See also 32

Prover9 and Mace4  Prover9 is an automated theorem prover for first-order and equational logic  Mace4 searches for finite models and counterexamples  Prover9 is the successor of the Otter prover. 

Factorization – Russell's antinomy Prover 9 -Shaves(x,x) -> Shaves(barber,x). Shaves(barber,y) -> - Shaves (y,y). 1 -Shaves(x,x) -> Shaves(barber,x) # label(non_clause). [assumption]. 2 Shaves(barber,x) -> -Shaves(x,x) # label(non_clause). [assumption]. 3 Shaves(x,x) | Shaves(barber,x). [clausify(1)]. 4 -Shaves(barber,x) | -Shaves(x,x). [clausify(2)]. 5 Shaves(barber,barber). [factor(3,a,b)]. 6 $F. [factor(4,a,b),unit_del(a,5)]. 34

Resolution strategies  Level resolution  Unit resolution  Set of support  Linear resolution  Linear input resolution  Hiper-resolution  Ordered resolution  Framed literal resolution 39

The Boolean Satisfiability Problem  Given: A Boolean formula  Can F evaluate to 1 (true)?  – Is F satisfiable?  – If yes, return values to xi’s (satisfying  assignment) that make F true  3-SAT – S.A. Cook 1971  NP-complete problem  2-SAT – polynomial time  Horn-SAT 39

The Boolean Satisfiability Problem  Why is SAT important? Theoretical importance:  – First NP-complete problem (Cook, 1971) Many practical applications:  – Model Checking  – Automatic Test Pattern Generation  – Combinational Equivalence Checking  – Planning in AI  – Automated Theorem Proving  – Software Verification  – … 39

Powerful inference rule: Paramodulation  C1: P(a)  C2: a=b  If C1 contains a term t and there is a unity clause C2: t=s then we can infer a new clause from C1 by the substitution of a single occurrence of t in C1 with s.  Paramodulation is a generalisation of that rule 39

Paramodulation  Be C1 and C2 two clauses, which have no variables in common. If C1: L[t]  C1' C2: r = s  C2'  where L[t] is a literal containing t, C1' and C2' are clauses, and  = mgu(t,r), then we can infer by paramodulation L  [s  ]  C1'   C2'   where L  [s  ] is obtained by replacing only one single occurrence of t  in L  with s .  Binary paramodulant 40

Paramodulation  Paramodulation with factorization – general paramodulation  Paramodulation with resolution is sound and refutationally complete 41

Example Group axioms % Associativity (x * (y * z)) = ((x * y) * z). % Identity element ((x * e) = x) & ((e * x) = x). % Inverse element ((x * i(x)) = e) & ((i(x) * x)=e). Prove % Right regular element ((f1 * f2) = (f0 * f2)) -> (f1 = f0). 42

 1 x * e = x & e * x = x [assumption].  2 x * i(x) = e & i(x) * x = e [assumption].  3 f1 * f2 = f0 * f2 -> f1 = f0 [goal].  4 x * (y * z) = (x * y) * z. [assumption].  5 (x * y) * z = x * (y * z). [copy(4),flip(a)].  6 x * e = x. [clausify(1)].  7 e * x = x. [clausify(1)].  8 x * i(x) = e. [clausify(2)].  9 i(x) * x = e. [clausify(2)].  10 f0 * f2 = f1 * f2. [deny(3)].  11 f1 * f2 = f0 * f2. [copy(10),flip(a)].  12 f0 != f1. [deny(3)].  13 f1 != f0. [copy(12),flip(a)].  14 x * (i(x) * y) = y. [para(8(a,1),5(a,1,1)),rewrite([7(2)]),flip(a)].  e * z = x * (i(x) * z) [8,5]  z = x * (i(x) * z) [7]y = x * (i(x) * y)  x * (i(x) * y) = y [flip]

 15 x * (y * i(x * y)) = e. [para(8(a,1),5(a,1)),flip(a)].  17 i(x) * (x * y) = y. [para(9(a,1),5(a,1,1)),rewrite([7(2)]),flip(a)].  22 i(f1) * (f0 * f2) = f2. [para(11(a,1),17(a,1,2))].  27 i(f1) * f0 = e. [para(22(a,1),15(a,1,2,2,1)),rewrite([5(8),8(7),6(5)])].  29 f1 = f0. [para(27(a,1),14(a,1,2)),rewrite([6(3)])].  30 $F. [resolve(29,a,13,a)].

SAT Solvers  Davis-Putnam-Logemann-Loveland (DPLL) algorithm was one of the first SAT search algorithms (Davis and Putnam 1960; Davis, Logemman and Loveland 1962)  P & ~Q & (~P  Q  R) & (P  ~S)  ~Q & (Q  R)  R  (P ← true, Q ← false, R ← true, S ← false) proving that the original formula is satisfiable. 39

SAT Solvers  A formula may cause the algorithm to branch  the search through a branch reaches a dead end the moment a clause is deemed false—a conflicting clause—and all variations of the assignment that has been partially constructed up to this point can be discarded. 39

SAT Solvers 39 1 R & (P  Q) & (~P  Q) & (~P  ~Q) Given 2 (P  Q) & (~P  Q) & (~P  ~Q) By letting R ← true 3Q & ~QBy letting P ← true 4?Conflict: Q and ~Q cannot both be true 5 (P  Q) & (~P  Q) & (~P  ~Q) Backtrack to (2): R ← true still holds 6~P~PBy letting Q ← true 7trueBy letting ~P be true, i.e., P ← false The formula is satisfiable by the existence of (P ← false, Q ← true, R ← true).