First Order Logic. Introduction to AI Bert Huang

Similar documents
Resolution in FOPC. Deepak Kumar November Knowledge Engineering in FOPC

Inf2D 12: Resolution-Based Inference

CS S-10 First Order Logic 1

Implementation Techniques

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

INF5390 Kunstig intelligens. First-Order Logic. Roar Fjellheim

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

INFERENCE IN FIRST-ORDER LOGIC

CS 8520: Artificial Intelligence

Inference in First-Order Logic

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

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

Notes for Chapter 12 Logic Programming. The AI War Basic Concepts of Logic Programming Prolog Review questions

Inference in First-Order Logic

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

COMP4418 Knowledge Representation and Reasoning

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

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

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

Lecture 4: January 12, 2015

Lecture 7: January 15, 2014

Chapter 16. Logic Programming Languages

Logic Programming Languages

Constraint Solving. Systems and Internet Infrastructure Security

Logic (or Declarative) Programming Foundations: Prolog. Overview [1]

Chapter 2 & 3: Representations & Reasoning Systems (2.2)

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

What is the study of logic?

Chapter 16. Logic Programming Languages ISBN

Markov Logic: Representation

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

CSC 501 Semantics of Programming Languages

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

CS 380/480 Foundations of Artificial Intelligence Winter 2007 Assignment 2 Solutions to Selected Problems

Knowledge Representation

CS 416, Artificial Intelligence Midterm Examination Fall 2004

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

SECTION 1.5: LOGIC PROGRAMMING

ECE Spring 2018 Problem Set #2 Due: 3/14/18

Logic and its Applications

First-Order Predicate Logic. CSCI 5582, Fall 2007

Logical reasoning systems

logic with quantifiers (informally)

Propositional Logic. Part I

CSE 311: Foundations of Computing. Lecture 8: Predicate Logic Proofs

Introduction to Logic Programming

Propositional Logic Formal Syntax and Semantics. Computability and Logic

Formal Predicate Calculus. Michael Meyling

Practice Problems: All Computer Science majors are people. Some computer science majors are logical thinkers. Some people are logical thinkers.

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

Diagnosis through constrain propagation and dependency recording. 2 ATMS for dependency recording

Logic as a Programming Language

Logic: TD as search, Datalog (variables)

PdOd Kev Events I Re-world war I1 rwa

Constraint Processing Offers Improved Expressiveness and Inference for Interactive Expert Systems

Chapter 16. Logic Programming Languages ISBN

logic importance logic importance (2) logic importance (3) specializations of logic Horn logic specializations of logic RDF and OWL

CPSC 121: Models of Computation. Module 6: Rewriting predicate logic statements

CPS 506 Comparative Programming Languages. Programming Language Paradigm

CS 4700: Artificial Intelligence

Introduction to Artificial Intelligence 2 nd semester 2016/2017. Chapter 8: First-Order Logic (FOL)

Logic Languages. Hwansoo Han

Programming Systems in Artificial Intelligence Introduction

CSCI 4150: Intro. to Artificial Intelligence Midterm Examination

Logic Programming and Resolution Lecture notes for INF3170/4171

Derived from PROgramming in LOGic (1972) Prolog and LISP - two most popular AI languages. Prolog programs based on predicate logic using Horn clauses

For next Tuesday. Read chapter 8 No written homework Initial posts due Thursday 1pm and responses due by class time Tuesday

Introductory logic and sets for Computer scientists

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

THE PREDICATE CALCULUS

CS 561: Artificial Intelligence

Introduction to predicate calculus

6.034 Notes: Section 11.1

Towards a Logical Reconstruction of Relational Database Theory

First Order Logic and Resolution

CSI30. Chapter 1. The Foundations: Logic and Proofs Rules of inference with quantifiers Logic and bit operations Specification consistency

Knowledge Representation and Reasoning Logics for Artificial Intelligence

Computation Club: Gödel s theorem

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

Introduction & Review

First-Order Logic (FOL)

Set 7: Predicate logic Chapter 8 R&N. ICS 271 Fall 2015

Using first order logic (Ch. 8-9)

Deductive Methods, Bounded Model Checking

Automated Reasoning. Natural Deduction in First-Order Logic

Recap Datalog Datalog Syntax Datalog Semantics. Logic: Datalog. CPSC 322 Logic 6. Textbook Logic: Datalog CPSC 322 Logic 6, Slide 1

Th(N, +) is decidable

Using first order logic (Ch. 8-9)

T H E S I S. Rule-based query answering method for a knowledge base of economic crimes

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

Propositional logic (Ch. 7)

Answers. The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 3 MODULE, AUTUMN SEMESTER KNOWLEDGE REPRESENTATION AND REASONING

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

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

2SAT Andreas Klappenecker

Introduction to Logic Programming

For Wednesday. No reading Chapter 9, exercise 9. Must be proper Horn clauses

What is a Logic Program. Introduction to Logic Programming. Introductory Examples. Introductory Examples. Foundations, First-Order Language

Transcription:

First Order Logic Introduction to AI Bert Huang

Review Propositional logic syntax and semantics Inference in propositional logic: table, inference rules, resolution Horn clauses, forward/backward chaining

First Order Logic Terminology: predicates, arity, terms, functions, atoms Quantifiers: universal, existential Inference: differences from propositional logic

Terminology Predicates: functions that map variables to truth values is_woman(marge), is_mother_of(lisa, Marge) is_woman is a predicate, Marge is a term/constant, and is_woman(marge) is a formula Can have any arity: binary, 3-ary, 4-ary n-ary Functions map from terms to terms: e.g., motherof(bart) Marge

Simple Propositionalization Define propositional logic variables for every atomic formula M1 = is_mother_of(bart, Homer), M2 = is_mother_of(lisa, Snowball), W1 = is_woman(marge), W2 = is_woman(lisa), W3 = is_woman(homer), Perform inference as in propositional logic Child Mother is_mother_of Bart Homer F Lisa Snowball F Bart Marge T Homer Mona T Name Lisa Marge Homer Bart is_woman T T F F

Quantifiers More general knowledge: e.g., all mothers are people x, y, is_mother_of(x, y) is_person(y) For all x and y, if y is x s mother, then y is a person. Universal quantifier: Existential quantifier: (there exists) x, y, is_mother_of(x, y)

Propositionalizing is Expensive Lisa Lisa is_mother_of(lisa, Lisa) Maggie Maggie is_mother_of(lisa, Maggie) Marge is_mother_of Marge is_mother_of(lisa, Marge) Bart Bart is_mother_of(lisa, Bart) Homer Homer is_mother_of(lisa, Homer) is_mother_of(maggie, Lisa) is_mother_of(maggie, Maggie) is_mother_of(maggie, Marge) is_mother_of(maggie, Bart) is_mother_of(maggie, Homer) is_mother_of(marge, Lisa) is_mother_of(marge, Maggie)

Horn Clauses pred1(v11, ) pred2(v21, ) predn(vn1, ) predr(vr1, ) antecedent consequent

Inference: Forward Chaining Input: set of known atoms Input: set of Horn clauses Input: target formula to prove (or disprove) Implication where all antecedents (i.e., conditions) and consequent (i.e., result) are positive E.g., x, y, is_mother_of(x, y) is_person(y) Generate new knowledge using generalized modus ponens

Generalized Modus Ponens E.g., A, B, C, is_mother_of(a, B) is_mother_of(a, C) sibling(b, C) pred1(v11, ) pred2(v21, ) predn(vn1, ) predr(vr1, ) KB pred1(a, ) pred2(b, ) pred1(c, ) Substitution v11 = A v21 = C v22 = A v31 = B

Generalized Modus Ponens E.g., A, B, C, is_mother_of(a, B) is_mother_of(a, C) sibling(b, C) KB Substitution is_mother_of(marge, Maggie) is_mother_of(marge, Bart) A = Marge B = Maggie C = Bart

Handling Quantifiers Universal ( ): replace with any constant during substitution Existential ( ): replace existential variable with new constant

(Skolem) Constants Replace existentially quantified variables with arbitrary constant x, is_mother_of(x, Bart) is_mother_of(c, Bart)

Forward Chaining, High Level For each sentence r in KB, For each substitution s that satisfies the conditions of r Add the consequent of r with substitution s to KB Check if target sentence is in KB or if contradiction

Backward Chaining High-Level For target sentence Look for substitution s that would imply target Add unsatisfied clauses in antecedent of substituted sentence to frontier Search for clauses that imply unsatisfied classes from frontier

Book Example The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. Is West a criminal? x, y, z, American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x), x, Owns(Nono, x) Missile(x) x, Missile(x) Weapon(x) Owns(Nono, M1) x, Enemy(x, America) Hostile(x) Missile(M1) American(West) x, Missile(x) Owns(Nono, x) Sells(West, x, Nono) Enemy(Nono, America)

Book Example: Forward Chaining Is West a criminal? x, y, z, American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x), x, Owns(Nono, x) Missile(x) x, Missile(x) Weapon(x) Owns(Nono, M1) x, Enemy(x, America) Hostile(x) Missile(M1) American(West) x, Missile(x) Owns(Nono, x) Sells(West, x, Nono) Enemy(Nono, America) Sells(West, M1, Nono)

Book Example: Forward Chaining Is West a criminal? x, y, z, American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x), x, Owns(Nono, x) Missile(x) x, Missile(x) Weapon(x) Owns(Nono, M1) x, Enemy(x, America) Hostile(x) Missile(M1) American(West) x, Missile(x) Owns(Nono, x) Sells(West, x, Nono) Enemy(Nono, America) Sells(West, M1, Nono) Weapon(M1) Hostile(Nono)

Book Example: Forward Chaining Is West a criminal? x, y, z, American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x), x, Owns(Nono, x) Missile(x) x, Missile(x) Weapon(x) Owns(Nono, M1) x, Enemy(x, America) Hostile(x) Missile(M1) American(West) x, Missile(x) Owns(Nono, x) Sells(West, x, Nono) Enemy(Nono, America) Sells(West, M1, Nono) Weapon(M1) Hostile(Nono)

Book Example: Backward Chaining

Book Example: Backward Chaining Is West a criminal? x, y, z, American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x), x, Owns(Nono, x) Missile(x) x, Missile(x) Weapon(x) Owns(Nono, M1) x, Enemy(x, America) Hostile(x) Missile(M1) American(West) x, Missile(x) Owns(Nono, x) Sells(West, x, Nono) Enemy(Nono, America) Weapon(y) Sells(West, y, z) Hostile(z)

Book Example: Backward Chaining Is West a criminal? x, y, z, American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x), x, Owns(Nono, x) Missile(x) x, Missile(x) Weapon(x) Owns(Nono, M1) x, Enemy(x, America) Hostile(x) Missile(M1) American(West) x, Missile(x) Owns(Nono, x) Sells(West, x, Nono) Enemy(Nono, America) Weapon(y) Sells(West, y, z) Hostile(z)

Book Example: Backward Chaining Is West a criminal? x, y, z, American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x), x, Owns(Nono, x) Missile(x) x, Missile(x) Weapon(x) Owns(Nono, M1) x, Enemy(x, America) Hostile(x) Missile(M1) American(West) x, Missile(x) Owns(Nono, x) Sells(West, x, Nono) Enemy(Nono, America) Weapon(M1) Sells(West, M1, z) Hostile(z)

Book Example: Backward Chaining Is West a criminal? x, y, z, American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x), x, Owns(Nono, x) Missile(x) x, Missile(x) Weapon(x) Owns(Nono, M1) x, Enemy(x, America) Hostile(x) Missile(M1) American(West) x, Missile(x) Owns(Nono, x) Sells(West, x, Nono) Enemy(Nono, America) Weapon(M1) Sells(West, M1, Nono) Hostile(Nono)

Book Example: Backward Chaining Is West a criminal? x, y, z, American(x) Weapon(y) Sells(x, y, z) Hostile(z) Criminal(x), x, Owns(Nono, x) Missile(x) x, Missile(x) Weapon(x) Owns(Nono, M1) x, Enemy(x, America) Hostile(x) Missile(M1) American(West) x, Missile(x) Owns(Nono, x) Sells(West, x, Nono) Enemy(Nono, America) Weapon(M1) Sells(West, M1, Nono) Hostile(Nono) Enemy(Nono, America)

First Order Logic Terminology: predicates, arity, terms, functions, atoms Quantifiers: universal, existential Inference: differences from propositional logic Requires handling quantifiers, finding substitutions Forward and Backward chaining