Inf2D 12: Resolution-Based Inference

Similar documents
Outline. Forward chaining Backward chaining Resolution. West Knowledge Base. Forward chaining algorithm. Resolution-Based Inference.

Resolution in FOPC. Deepak Kumar November Knowledge Engineering in FOPC

First Order Logic. Introduction to AI Bert Huang

CS S-10 First Order Logic 1

Implementation Techniques

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

CSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi

Knowledge Representation. CS 486/686: Introduction to Artificial Intelligence

CS 416, Artificial Intelligence Midterm Examination Fall 2004

Automatic Reasoning (Section 8.3)

Lecture 17 of 41. Clausal (Conjunctive Normal) Form and Resolution Techniques

Automated Reasoning PROLOG and Automated Reasoning 13.4 Further Issues in Automated Reasoning 13.5 Epilogue and References 13.

CS221 / Autumn 2017 / Liang & Ermon. Lecture 17: Logic II

Knowledge Representation and Reasoning Logics for Artificial Intelligence

COMP4418 Knowledge Representation and Reasoning

Resolution (14A) Young W. Lim 6/14/14

CS 8520: Artificial Intelligence

Inference in First-Order Logic

Resolution in FO logic (Ch. 9)

Artificial Intelligence. Chapters Reviews. Readings: Chapters 3-8 of Russell & Norvig.

INF5390 Kunstig intelligens. First-Order Logic. Roar Fjellheim

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

Propositional logic (Ch. 7)

INFERENCE IN FIRST-ORDER LOGIC

CSE 473 Lecture 12 Chapter 8. First-Order Logic. CSE AI faculty

First Order Logic and Resolution

Logic: TD as search, Datalog (variables)

PROPOSITIONAL LOGIC (2)

Constraint Satisfaction Problems Part 2

Conjunctive queries. Many computational problems are much easier for conjunctive queries than for general first-order queries.

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 37 Resolution Rules

Constraint Solving. Systems and Internet Infrastructure Security

Inference in First-Order Logic

STABILITY AND PARADOX IN ALGORITHMIC LOGIC

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

Integrity Constraints (Chapter 7.3) Overview. Bottom-Up. Top-Down. Integrity Constraint. Disjunctive & Negative Knowledge. Proof by Refutation

Introduction to Spring 2007 Artificial Intelligence Midterm Solutions

Announcements. CS 188: Artificial Intelligence Fall Reminder: CSPs. Today. Example: 3-SAT. Example: Boolean Satisfiability.

CS 188: Artificial Intelligence Fall 2008

DM841 DISCRETE OPTIMIZATION. Part 2 Heuristics. Satisfiability. Marco Chiarandini

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

System Description: iprover An Instantiation-Based Theorem Prover for First-Order Logic

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction Problems

Knowledge Representation and Reasoning Logics for Artificial Intelligence

Using first order logic (Ch. 8-9)

Constraint Satisfaction Problems

Using first order logic (Ch. 8-9)

CS 4100 // artificial intelligence

Constraint Satisfaction Problems

6.034 Notes: Section 10.1

Chapter 24. Active Database Concepts and Triggers. Outline. Trigger Example. Event-Condition-Action (ECA) Model

Where Can We Draw The Line?

Set 9: Planning Classical Planning Systems. ICS 271 Fall 2013

Australia Western Australia Western Territory Northern Territory Northern Australia South Australia South Tasmania Queensland Tasmania Victoria

Constraint Satisfaction Problems

Constraint Satisfaction Problems

Lecture 4: January 12, 2015

Logic Programming and Resolution Lecture notes for INF3170/4171

1 Inference for Boolean theories

A Pearl on SAT Solving in Prolog (extended abstract)

Normal Forms for Boolean Expressions

Deduction Rule System vs Production Rule System. Prof. Bob Berwick. Rules Rule

Boolean Functions (Formulas) and Propositional Logic

Constraint Satisfaction Problems. A Quick Overview (based on AIMA book slides)

Logic Languages. Hwansoo Han

Constraint Satisfaction

(QiuXin Hui) 7.2 Given the following, can you prove that the unicorn is mythical? How about magical? Horned? Decide what you think the right answer

Symbolic and Concolic Execution of Programs

Lecture 6: Constraint Satisfaction Problems (CSPs)

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

SAT solver of Howe & King as a logic program

Constraint Satisfaction Problems

Logical reasoning systems

DATABASE THEORY. Lecture 11: Introduction to Datalog. TU Dresden, 12th June Markus Krötzsch Knowledge-Based Systems

Notes. Notes. Introduction. Notes. Propositional Functions. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry.

Range Restriction for General Formulas

Question 1: 25% of students lost more than 2 points Question 2: 50% of students lost 2-4 points; 50% got it entirely correct Question 3: 95% of

Linear Clause Generation by Tableaux and DAGs

Programming Systems in Artificial Intelligence Introduction

Constraint Satisfaction Problems

15-780: Graduate AI Lecture 2. Proofs & FOL. Geoff Gordon (this lecture) Tuomas Sandholm TAs Byron Boots, Sam Ganzfried

Mixed Integer Linear Programming

CS W4701 Artificial Intelligence

2SAT Andreas Klappenecker

Full Clausal Logic - Syntax: clauses

Dipartimento di Elettronica Informazione e Bioingegneria. Cognitive Robotics. SATplan. Act1. Pre1. Fact. G. Gini Act2

Artificial Intelligence

Basic Foundations of Isabelle/HOL

(More) Propositional Logic and an Intro to Predicate Logic. CSCI 3202, Fall 2010

Lecture 7: January 15, 2014

On the implementation of a multiple output algorithm for defeasible argumentation

CS 188: Artificial Intelligence Fall 2011

Assignment 3: Logical Agents: Solutions

Example: Map coloring

Back to the knights and knaves island

Set 5: Constraint Satisfaction Problems

OWL 2 Profiles. An Introduction to Lightweight Ontology Languages. Markus Krötzsch University of Oxford. Reasoning Web 2012

Automated Reasoning. Natural Deduction in First-Order Logic

6.034 Notes: Section 11.1

Transcription:

School of Informatics, University of Edinburgh 09/02/18 Slide Credits: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann

Last time Unification: Given α and β, find θ such that αθ = βθ Most general unifier (MGU) Generalised Modus Ponens p 1, p 2,..., p n (p 1 p 2 p n q) qθ when p i θ p iθ i

Outline Forward chaining Backward chaining Resolution

Forward chaining algorithm

West Knowledge Base American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Forward chaining proof American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Forward chaining proof American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Forward chaining proof American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Properties of forward chaining II Sound and complete for first-order definite clauses Definite clause = exactly one positive literal. Datalog = first-order definite clauses + no functions FC terminates for Datalog in finite number of iterations May not terminate in general if α is not entailed This is unavoidable: entailment with definite clauses is semi-decidable

Efficiency of forward chaining I Incremental forward chaining: no need to match a rule on iteration k if a premise wasn t added on iteration k 1 match each rule whose premise contains a newly added positive literal Matching itself can be expensive: Database indexing allows O(1) retrieval of known facts e.g., query Missile(x) retrieves Missile(M1) Forward chaining is widely used in deductive databases

Efficiency of forward chaining II Pattern Matching For each θ such that SUBST (θ, p 1 p n ) = SUBST (θ, p 1 p n) for some p 1,..., p n in KB Finding all possible unifiers can be very expensive Example Missile(x) Owns(Nono, x) Sells(West, x, Nono) Can find each object owned by Nono in constant time and then check if it is admissible But what if Nono owns many objects but very few missiles? Conjunct Ordering: Better (cost-wise) to find all missiles first and then check whether they are owned by Nono Optimal ordering is NP-hard. Heuristics available: e.g. MRV from CSP if each conjunct is viewed as a constraint on its vars

Hard matching example Diff (wa, nt) Diff (wa, sa) Diff (nt, q) Diff (nt, sa) Diff (q, nsw) Diff (q, sa) Diff (nsw, v) Diff (nsw, sa) Diff (v, sa) Colourable Diff (Red, Blue) Diff (Red, Green) Diff (Green, Red) Diff (Green, Blue) Diff (Blue, Red) Diff (Blue, Green) Every finite domain CSP can be expressed as a single definite clause + ground facts Colourable is inferred iff the CSP has a solution CSPs include 3SAT as a special case, hence matching is NP-hard

Backward chaining algorithm SUBST (COMPOSE(θ 1, θ 2 ), p) = SUBST (θ 2, SUBST (θ 1, p))

Backward chaining example American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Backward chaining example American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Backward chaining example American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Backward chaining example American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Backward chaining example American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Backward chaining example American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Backward chaining example American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Properties of backward chaining Depth-first recursive proof search: space is linear in size of proof Incomplete due to infinite loops partial fix by checking current goal against every goal on stack Inefficient due to repeated subgoals (both success and failure) fix using caching of previous results (extra space) Widely used for logic programming

Resolution A method for telling whether a propositional formula is satisfiable and for proving that a first-order formula is unsatisfiable. Yields a complete inference algorithm If a set of clauses if unsatisfiable, then the resolution closure of those clauses contains the empty clause (propositional logic)

Ground Binary Resolution Soundness: C P iff C P D P iff P D Therefore, C D, C P D P C D which is equivalent to C D Note: if both C and D are empty then resolution deduces the empty clause, i.e. false.

Non-Ground Binary Resolution C P D P (C D) θ where θ is the MGU of P and P The two clauses are assumed to be standardized apart so that they share no variables. Soundness: apply θ to premises then appeal to ground binary resolution. Cθ Pθ Dθ Pθ Cθ Dθ

Example with θ = {x/ken} Rich (x) Unhappy (x) Unhappy(Ken) Rich (Ken)

Factoring More generally A B A B A A C P 1... P m (C P 1 ) θ where θ is the MGU of the P i Soundness: by universal instantiation and deletion of duplicates.

Full Resolution C P 1... P m D P 1... P n (C D) θ where θ is MGU of all P i and P j Soundness: by combination of factoring and binary resolution. To prove α: apply resolution steps to CNF (KB α) complete for FOL, if full resolution or binary resolution + factoring is used

Conversion to CNF Example: Everyone who loves all animals is loved by someone: x.[ y.animal(y) Loves(x, y)] [ y.loves(y, x)] 1 Eliminate all biconditionals and implications x. [ y. Animal(y) Loves(x, y)] [ y.loves(y, x)] 2 Move inwards, use: x.p x. p, x.p x. p, etc. x.[ y. ( Animal(y) Loves(x, y))] [ y.loves(y, x)] x.[ y. Animal(y) Loves(x, y)] [ y.loves(y, x)] x.[ y.animal(y) Loves(x, y)] [ y.loves(y, x)]

Conversion to CNF contd. 1 Standardize variables apart: each quantifier should use a different one x.[ y.animal(y) Loves(x, y)] [ z.loves(z, x)] 2 Skolemize: a more general form of existential instantiation Each existential variable is replaced by a Skolem function of the enclosing universally quantified variables 1) : x.[animal(f (x)) Loves(x, F (x))] Loves(G(x), x) 3 Drop universal quantifiers: [Animal(F (x)) Loves(x, F (x))] Loves(G(x), x) 4 Distribute over : [Animal(F (x)) Loves(G(x), x)] [ Loves(x, F (x)) Loves(G(x), x)] 1) No enclosing universal quantifier? Just replace with Skolem constant, i.e. a function with no argument.

West Clauses American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x) Owns(Nono, M 1 ) and Missile(M 1 ) Missile(x) Owns(Nono, x) Sells(West, x, Nono) Missile(x) Weapon(x) Enemy(x, America) Hostile(x) American(West) and Enemy(Nono, America)

Resolution proof: definite clauses

Summary Forward chaining Backward chaining Resolution