Inference in first-order logic

Similar documents
Inference in first-order logic

Inference in first-order logic

Propositional logic II.

Propositional Reasoning

CS 2740 Knowledge Representation. Lecture 4. Propositional logic. CS 2740 Knowledge Representation. Administration

Inference in Propositional Logic

Knowledge Representation. Propositional logic

Knowledge Representation. Propositional logic.

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

7.5.2 Proof by Resolution

Inf2D 13: Resolution-Based Inference

Proof Methods for Propositional Logic

Learning Goals of CS245 Logic and Computation

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Propositional Logic Part 1

CS 730/730W/830: Intro AI

[1] Describe with examples, the three inference rules involving quantifiers

Knowledge based Agents

Logic. Knowledge Representation & Reasoning Mechanisms. Logic. Propositional Logic Predicate Logic (predicate Calculus) Automated Reasoning

Resolution: Motivation

Propositional Logic: Review

CS 1571 Introduction to AI Lecture 14. First-order logic. CS 1571 Intro to AI. Midterm

Inference in First Order Logic

Inference in first-order logic. Production systems.

Advanced Topics in LP and FP

Artificial Intelligence Chapter 7: Logical Agents

Convert to clause form:

First-Order Logic (FOL)

CS 730/830: Intro AI. 3 handouts: slides, asst 6, asst 7. Wheeler Ruml (UNH) Lecture 12, CS / 16. Reasoning.

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

Inference Methods In Propositional Logic

Lecture 10: Even more on predicate logic" Prerequisites for lifted inference: Skolemization and Unification" Inference in predicate logic"

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

First Order Logic: Syntax and Semantics

Inference in First-Order Logic

CS 2710 Foundations of AI Lecture 12. Propositional logic. Logical inference problem

AI Programming CS S-09 Knowledge Representation

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

7 LOGICAL AGENTS. OHJ-2556 Artificial Intelligence, Spring OHJ-2556 Artificial Intelligence, Spring

INF3170 / INF4171 Notes on Resolution

CSC242: Intro to AI. Lecture 11. Tuesday, February 26, 13

6. Logical Inference

Propositional Resolution

Inference Methods In Propositional Logic

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT

CSC242: Intro to AI. Lecture 13. Thursday, February 28, 13

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

CS 771 Artificial Intelligence. First Order Logic Inference

Propositional Logic: Bottom-Up Proofs

Logic and Inferences

Outline. Logical Agents. Logical Reasoning. Knowledge Representation. Logical reasoning Propositional Logic Wumpus World Inference

Description Logics. Deduction in Propositional Logic. franconi. Enrico Franconi

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit:

Logic and Computation

CS 771 Artificial Intelligence. Propositional Logic

CS 7180: Behavioral Modeling and Decision- making in AI

Guest Speaker. CS 416 Artificial Intelligence. First-order logic. Diagnostic Rules. Causal Rules. Causal Rules. Page 1

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

Overview. CS389L: Automated Logical Reasoning. Lecture 7: Validity Proofs and Properties of FOL. Motivation for semantic argument method

CS 380: ARTIFICIAL INTELLIGENCE

Artificial Intelligence Chapter 9: Inference in First-Order Logic

Logic in AI Chapter 7. Mausam (Based on slides of Dan Weld, Stuart Russell, Subbarao Kambhampati, Dieter Fox, Henry Kautz )

Logic and Reasoning. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

Introduction to Artificial Intelligence 2 nd semester 2016/2017. Chapter 9: Inference in First-Order Logic

03 Propositional Logic II

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

What is the decimal (base 10) representation of the binary number ? Show your work and place your final answer in the box.

Artificial Intelligence. Propositional Logic. Copyright 2011 Dieter Fensel and Florian Fischer

Logical Agents. September 14, 2004

Outline. Logical Agents. Logical Reasoning. Knowledge Representation. Logical reasoning Propositional Logic Wumpus World Inference

Intelligent Systems. Propositional Logic. Dieter Fensel and Dumitru Roman. Copyright 2008 STI INNSBRUCK

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón

CS:4420 Artificial Intelligence

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

Deductive Systems. Lecture - 3

Artificial Intelligence. Propositional logic


Warm-Up Problem. Is the following true or false? 1/35

Introduction Logic Inference. Discrete Mathematics Andrei Bulatov

Agenda. Artificial Intelligence. Reasoning in the Wumpus World. The Wumpus World

Objectives. Logical Reasoning Systems. Proofs. Outline. Example proof. Example proof. You should

Propositional Logic: Methods of Proof (Part II)

Logic. Introduction to Artificial Intelligence CS/ECE 348 Lecture 11 September 27, 2001

CS 520: Introduction to Artificial Intelligence. Review

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 15 Propositional Calculus (PC)

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

CS156: The Calculus of Computation Zohar Manna Winter 2010

Artificial Intelligence

CS 730/830: Intro AI. 1 handout: slides. Wheeler Ruml (UNH) Lecture 11, CS / 15. Propositional Logic. First-Order Logic

CS 4700: Artificial Intelligence

Propositional Logic: Models and Proofs

Marie Duží

22c:145 Artificial Intelligence

Lecture 11: Measuring the Complexity of Proofs

Logic: Propositional Logic Truth Tables

Logical Agent & Propositional Logic

COMP3702/7702 Artificial Intelligence Week 5: Search in Continuous Space with an Application in Motion Planning " Hanna Kurniawati"

KE/Tableaux. What is it for?

Language of Propositional Logic

Transcription:

CS 57 Introduction to AI Lecture 5 Inference in first-order logic Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square Logical inference in FOL Logical inference problem: Given a knowledge base KB (a set of sentences) and a sentence α, does the KB semantically entail α? KB = α? In other words: In all interpretations in which sentences in the KB are true, is also α true? Logical inference problem in the first-order logic is undecidable!!!. No procedure that can decide the entailment for all possible input sentences in a finite number of steps.

Logical inference problem in the Propositional logic Computational procedures that answer: Three approaches: KB = α? Truth-table approach Inference rules Conversion to the inverse SAT problem Resolution-refutation Inference in FOL: Truth table approach Is the Truth-table approach a viable approach for the FOL?? NO! Why? It would require us to enumerate and list all possible interpretations I I = (assignments of symbols to objects, predicates to relations and functions to relational mappings) Simply there are too many interpretations 2

Inference in FOL: Inference rules Is the Inference rule approach a viable approach for the FOL? Yes. The inference rules represent sound inference patterns one can apply to sentences in the KB What is derived by inference rules follows from the KB Caveat: we need to add rules for handling quantifiers Inference rules Inference rules from the propositional logic: Modus ponens A B, A B Resolution A B, B C A C and others: And-introduction, And-elimination, Orintroduction, Negation elimination Additional inference rules are needed for sentences with quantifiers and variables Rules must involve variable substitutions 3

Sentences with variables First-order logic sentences can include variables. Variable is: Bound if it is in the scope of some quantifier x Free if it is not bound. x Q( Examples: x y Likes ( x, Bound or free? y is free Sentences with variables First-order logic sentences can include variables. Variable is: Bound if it is in the scope of some quantifier x Free if it is not bound. x Q( y is free Examples: x y Likes ( x, Bound x Likes( x, y Likes( y, Raymond) Bound or free? ( ) 4

Sentences with variables First-order logic sentences can include variables. Variable is: Bound if it is in the scope of some quantifier x Free if it is not bound. x Q( y is free Examples: x y Likes ( x, Bound x Likes( x, y Likes( y, Raymond) x is Bound, first y is Free ( ) Sentences with variables First-order logic sentences can include variables. Sentence (formula) is: Closed if it has no free variables y x Q( Open if it is not closed x Q( y is free Ground if it does not have any variables Likes ( John, Jane) 5

Variable substitutions Variables in the sentences can be substituted with terms. (terms = constants, variables, functions) Substitution: Is represented by a mapping from variables to terms { 2 x / t, x2 / t, } Application of the substitution to sentences SUBST ({ x / Sam, y / Pam}, Likes ( x, ) = Likes ( Sam, Pam) SUBST ({ x / z, y / fatherof ( John)}, Likes ( x, ) =? Variable substitutions Variables in the sentences can be substituted with terms. (terms = constants, variables, functions) Substitution: Is represented by a mapping from variables to terms { 2 x / t, x2 / t, } Application of the substitution to sentences SUBST ({ x / Sam, y / Pam}, Likes ( x, ) = Likes ( Sam, Pam) SUBST ({ x / z, y / fatherof ( John)}, Likes( x, ) = Likes( z, fatherof ( John)) 6

Inference rules for quantifiers Universal elimination x φ( a - is a constant symbol φ( a) substitutes a variable with a constant symbol x Likes ( x, IceCream ) Likes ( Ben, IceCream ) Existential elimination. x φ( φ( a) Substitutes a variable with a constant symbol that does not appear elsewhere in the KB x Kill ( x, Victim) Kill ( Murderer, Victim) Inference rules for quantifiers Universal instantiation (introduction) φ x is not free in φ x φ Introduces a universal variable which does not affect φ or its assumptions Sister ( Amy, Jane) x Sister ( Amy, Jane) Existential instantiation (introduction) φ( a) a is a ground term in φ xφ( x is not free in φ Substitutes a ground term in the sentence with a variable and an existential statement Likes ( Ben, IceCream ) x Likes ( x, IceCream ) 7

Unification Problem in inference: Universal elimination gives us many opportunities for substituting variables with ground terms x φ( a - is a constant symbol φ( a) Solution: avoid making blind substitutions of ground terms Make substitutions that help to advance inferences Use substitutions matching similar sentences in KB Make inferences on the variable level Do not substitute ground terms if not neccessary Unification takes two similar sentences and computes the substitution that makes them look the same, if it exists UNIFY ( p, q) = σ s.t. SUBST(σ, p) = SUBST ( σ, q) Unification. Examples. Unification: UNIFY ( p, q) = σ s.t. SUBST(σ, p) = SUBST ( σ, q) Examples: UNIFY ( Knows( John,, Knows( John, Jane)) = { x / Jane} UNIFY ( Knows( John,, Knows( y, Ann)) = { x / Ann, y / John} UNIFY ( Knows( John,, Knows( y, MotherOf ( )) = { x / MotherOf ( John), y / John} UNIFY ( Knows( John,, Knows( x, Elizabeth )) = fail 8

Generalized inference rules Use substitutions that let us make inferences!!!! Example: Generalized Modus Ponens If there exists a substitution σ such that SUBST σ, A ) = SUBST( σ, A ') ( i i A A2 An B, A ', A2 ', An ' SUBST( σ, B) for all i=,2, n Substitution that satisfies the generalized inference rule can be build via unification process Advantage of the generalized rules: they are focused only substitutions that allow the inferences to proceed are tried Resolution inference rule Recall: Resolution inference rule is sound and complete (refutation-complete) for the propositional logic and CNF A B, A C B C Generalized resolution rule is sound and refutation complete for the first-order logic and CNF w/o equalities (if unsatisfiable the resolution will find the contradiction) φ φ2 φk, ψ 2 ψ n SUBST ( σ, φ φ φ φ Example: σ = UNIFY ( φ, ψ ) i i+ i k j fail, Q( John)? j j+ ψ ) n 9

Resolution inference rule Recall: Resolution inference rule is sound and complete (refutation-complete) for the propositional logic and CNF A B, A C B C Generalized resolution rule is sound and refutation complete for the first-order logic and CNF w/o equalities (if unsatisfiable the resolution will find the contradiction) φ φ2 φk, ψ 2 ψ n SUBST ( σ, φ φ φ φ Example: σ = UNIFY ( φ, ψ ) i i+ i k j fail, Q( John) John) j j+ ψ ) n Inference with the resolution rule Proof by refutation: Prove that KB, α is unsatisfiable resolution is refutation-complete Main procedure (steps):. Convert KB, α to CNF with ground terms and universal variables only 2. Apply repeatedly the resolution rule while keeping track and consistency of substitutions 3. Stop when empty set (contradiction) is derived or no more new resolvents (conclusions) follow 0

Conversion to CNF. Eliminate implications, equivalences ( p q) ( p q) 2. Move negations inside (DeMorgan s Laws, double negation) ( p q) p q x p x p ( p q) p q x p x p p p 3. Standardize variables (rename duplicate variables) ( x ) ( x Q( ) ( x ) ( y Q( ) 4. Move all quantifiers left (no invalid capture possible ) ( x ) ( y Q( ) x y Conversion to CNF 5. Skolemization (removal of existential quantifiers through elimination) If no universal quantifier occurs before the existential quantifier, replace the variable with a new constant symbol also called Skolem constant y A) A) B) If a universal quantifier precedes the existential quantifier replace the variable with a function of the universal variable x y x F( ) F( - a special function - called Skolem function

Conversion to CNF 6. Drop universal quantifiers (all variables are universally quantified) x F( ) F( ) 7. Convert to CNF using the distributive laws p ( q r) ( p q) ( p r) The result is a CNF with variables, constants, functions Resolution example KB α, Q(,, R( z) z), S(A) 2

Resolution example KB, Q(,, R( z) z), α S(A) { y / w} Resolution example KB α, Q(,, R( z) z), S(A) { y / w} { x / w} S( 3

Resolution example KB, Q(,, R( z) z), α S(A) { y / w} { x / w} S( { z / w} S( Resolution example KB α, Q(,, R( z) z), S(A) { y / w} { x / w} S( { z / w} S( { w/ A} Empty resolution 4

Resolution example KB, Q(,, R( z) z), α S(A) { y / w} { x / w} S( { z / w} KB = α S( { w/ A} Empty resolution à Contradiction Dealing with equality Resolution works for the first-order logic without equalities To incorporate equalities we need an additional inference rule Demodulation rule σ = UNIFY z i, t ) ( φ φ2 φk, t = t2 SUB( SUBST ( σ, t ), SUBST ( σ, t ), φ φ φ ) fail where occurs in i φ z i Example: P ( f ( a)), f ( = x a) Paramodulation rule: more powerful Resolution+paramodulation give a refutation-complete proof theory for FOL 2 2 k 5