INF5390 Kunstig intelligens. First-Order Logic. Roar Fjellheim

Similar documents
COMP3411: Artificial Intelligence 8. First Order Logic

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

First Order Logic. Introduction to AI Bert Huang

E.g., Brother(KingJohn,RichardTheLionheart)

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

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

Logical reasoning systems

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

Knowledge Representation and Reasoning Logics for Artificial Intelligence

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

ITCS 6150 Intelligent Systems. Lecture 13 First-Order Logic Chapter 8

Question about Final Exam. CS 416 Artificial Intelligence. What do we like about propositional logic? First-order logic

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

COMP4418 Knowledge Representation and Reasoning

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

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

Vibhav Gogate University of Texas, Dallas Artificial Intelligence: CS 4365 First-order Logic

CS 561: Artificial Intelligence

Knowledge Representation

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

Resolution in FOPC. Deepak Kumar November Knowledge Engineering in FOPC

Inference in First-Order Logic

Inf2D 12: Resolution-Based Inference

First-Order Logic Syntax

Implementation Techniques

First-Order Predicate Logic. CSCI 5582, Fall 2007

Last time: Logic and Reasoning

What is the study of logic?

CS 8520: Artificial Intelligence

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

CS S-10 First Order Logic 1

First-Order Predicate Logic. Introduction to Intelligent Systems

ARTIFICIAL INTELLIGENCE (CS 370D)

THE PREDICATE CALCULUS

Lecture 4: January 12, 2015

First Order Logic and Resolution

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

Knowledge Representation and Reasoning Logics for Artificial Intelligence

Week 7 Prolog overview

6.034 Notes: Section 11.1

Logic and its Applications

Introduction to predicate calculus

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

Logik für Informatiker Logic for computer scientists

Logic Languages. Hwansoo Han

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27

Logic Programming Languages

Using first order logic (Ch. 8-9)

Logic Programming. Let us have airline flight information of the form: 1. Application Domains: 2. Definitions

Using first order logic (Ch. 8-9)

First-Order Logic (FOL)

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

Advanced Logic and Functional Programming

Knowledge representation Semantic networks and frames

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

An Evolution of Mathematical Tools

Logic as a Programming Language

INFERENCE IN FIRST-ORDER LOGIC

CS 416, Artificial Intelligence Midterm Examination Fall 2004

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

logic with quantifiers (informally)

First Order Logic Part 1

Introduction to dependent types in Coq

Chapter 16. Logic Programming Languages ISBN

Chapter 16. Logic Programming Languages ISBN

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

Predicate Calculus. Problems? Syntax. Atomic Sentences. Complex Sentences. Truth

Lecture 7: January 15, 2014

Logic: TD as search, Datalog (variables)

Chapter 16. Logic Programming Languages

6. Inference and resolution

Module 8. Other representation formalisms. Version 2 CSE IIT, Kharagpur

LOGIC AND DISCRETE MATHEMATICS

STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH

Logic Programming and Resolution Lecture notes for INF3170/4171

Declarative Programming. 2: theoretical backgrounds

CPS 506 Comparative Programming Languages. Programming Language Paradigm

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

Inference in First-Order Logic

Formal Verification. Lecture 10

Chapter 16. Logic Programming. Topics. Predicate Calculus and Proving Theorems. Resolution. Resolution: example. Unification and Instantiation

Topic A: Introduction to Prolog

Software Paradigms (Lesson 6) Logic Programming

Lecture 5 - Axiomatic semantics

Fundamentals of Prolog

Visually Interacting with a Knowledge Base

Introductory logic and sets for Computer scientists

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214

Warm-Up Problem. Let L be the language consisting of as constant symbols, as a function symbol and as a predicate symbol. Give an interpretation where

Part I Logic programming paradigm

l A family of logic based KR formalisms l Distinguished by: l Decidable fragments of FOL l Closely related to Propositional Modal & Dynamic Logics

Introduction to Prolog

Operational Semantics

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

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

Prolog. Intro to Logic Programming

AN INTRODUCTION TO FUZZY SETS Analysis and Design. Witold Pedrycz and Fernando Gomide

CSC 501 Semantics of Programming Languages

Chapter 16. Logic Programming. Topics. Unification. Resolution. Prolog s Search Strategy. Prolog s Search Strategy

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Transcription:

INF5390 Kunstig intelligens First-Order Logic Roar Fjellheim

Outline Logical commitments First-order logic First-order inference Resolution rule Reasoning systems Summary Extracts from AIMA Chapter 8: First-Order Logic Chapter 9: Inference in First-Order Logic 2

From propositonal to first-order logic Features of propositional logic: + Declarative + Compositional + Possible-world semantics - Lacks expressiveness First-order logic: Extends propositional logic Keeps good features Adds expressiveness 3

First-order logic First-order logic is based on common sense or linguistic concepts: Objects: people, houses, numbers,.. Properties: tall, red,.. Relations: brother, bigger than,.. Functions: father of, roof of,.. Variables: x, y,.. (takes objects as values) First-order logic is the most important and best understood logic in philosophy, mathematics, and AI 4

Logic commitments Ontological commitment Ontology - in philosophy, the study of what is What are the underlying assumptions of the logic with respect to the nature of reality Epistemological commitment Epistemology - in philosophy, the study of what can be known What are the underlying assumptions of the logic with respect to the nature of what the agent can know 5

Commitments of some logic languages Language Ontological Commitment Epistemological Commitment Propositional logic Facts True/false/unknown First-order logic Temporal logic Facts, objects, relations True/false/unknown Facts, objects, relations, times True/false/unknown Probability theory Facts Degree of belief 0.. 1 Fuzzy logic Facts w/degree of truth Known interval value 6

First-order logic - syntax Sentence AtomicSentence Sentence Connective Sentence Quantifier Variable, Sentence Sentence Sentence AtomicSentence Pr edicate( Term, ) Term Term Term Function( Term, ) Cons tant Variable Connective Quantifier 7

Constants, predicates, functions and terms Constant symbols Refer to specific objects in the world: John, 3,.. Predicate symbols Refer to particular relations in the model: Brother, LargerThan, i.e. sets of objects that satisfy the relation Function symbols Refer to many-to-one object mappings: FatherOf Term, a logical expression Refers to an object in the model Can be a Constant, a Variable, or a Function of other terms 8

Atomic and complex sentences Atomic sentences State basic facts Examples: Brother(Richard, John) Married(FatherOf(Richard),MotherOf(John)) Complex sentences Composed of atomic sentences by using logical connectives (same as for propositional logic) Examples: Brother(Richard, John)Brother(John, Richard) Older(John, 30) => Younger(John, 30) 9

Quantifiers are used to express properties of classes of objects Universal quantification For all.. quantification Example: x Cat( x) Mammal ( x) Existential quantification There exists.. quantification Example: Equality = Quantifiers and equality x Sister( x, Spot) Cat( x) Two terms refer to same object Example: Father(John) = Henry 10

Using first-order logic: Kinship domain The domain of family relationship Objects: Persons Unary predicates: Male, Female Binary predicates: Parent, Sibling, Brother, Sister, Functions: Mother, Father Example sentences m, c Mother( c) m Female( m) Parent( m, c) w, h Husband( h, w) Male( h) Spouse( h, w) g, c Grandparent( g, c) p Parent( g, p) Parent( p, c) x, y Sibling( x, y) x y p Parent( p, x) Parent( p, y) 11

TELLing and ASKing sentences TELL an agent about kinship using assertions TELL(KB, ( m, c Mother ( c) m Female( m) Parent ( m, c) )) TELL(KB, ( Female( Maxi) Parent ( Maxi, Spot) Parent ( Spot, Boots) )) ASK an agent by posing queries (or goals) ASK(KB,( )) Answer: Yes Grandparent ( Maxi, Boots) x Child ( x, Spot) ASK(KB, ( )) Answer: x = Boots 12

Wumpus world revisited Properties of locations x, t At(Agent,x,t) Breeze(t) Breezy(x) Diagnostic rules infer cause from effect y Breezy(y) x Pit(x) Adjacent(x,y) Causal rules infer effect from cause x,y Pit(x) Adjacent(x,y) Breezy(y) Definition of predicate y Breezy(y) (x Pit(x) Adjacent(x,y)) 13

Inference in first-order logic Reduce to propositional inference Generalized Modus Ponens Forward chaining Backward chaining Resolution Require substitution and/or unification of terms 14

Substitution and unification Substitution is the replacement of variable(s) in a sentence with expressions SUBST({x/Richard, y/john}, Brother(x,y)) = Brother(Richard, John) Unification is finding substitutions (a unifier) that make different sentences look identical UNIFY(p,q) = Θ where SUBST(Θ,p) = SUBST(Θ,p) E.g. UNIFY( Knows( John, x), Knows( John, Jane)) { x / Jane} UNIFY( Knows( John, x), Knows( y / Bill)) { x / Bill, y / John} UNIFY( Knows( John, x), Knows( y, Mother( y))) { y / John, x / Mother( John)} UNIFY( Knows( John, x), Knows( x, Elizabeth)) fail 15

Known facts Example knowledge base It is a crime for an American to sell weapons to hostile nations. The country Nono is an enemy of America and has some missiles, all sold to it by Colonel West, an America. Knowledge base: American( x) Weapon( y) Owns( Nono, M1), Missile( M1), Missile( x) Weapon( x) Missile( x) Owns( Nono, x) Sells( West, x, Nono) Enemy( x, America) Hostile( x) American( West), Enemy( Nono, America) Prove that West is a criminal Sells( x, y, z) Hostile( z) Cri min al( x) 16

Reduce to propositional inference Can reduce first-order sentence to propositional sentence by instantiation rules UI - Universal instantiation - Substitutes a constant in KB for a universally quantified variable EI - Existential instantiation - Substitutes a new constant for an existentially quantified variable Apply UI and EI systematically to replace all sentences with quantifiers with variable-free sentences Can the propositional inference rules to derive proofs, but it is an inefficient procedure 17

Generalized modus ponens - GMP Assumes knowledge base containing facts and rules like p1 p2 pn q The generalized modus ponens rule p1, p2,, pn, ( p1 p2 pn q) SUBST (, q) SUBST (, pi) SUBST (, pi) for all i Example Missile( M1) Owns( Nono, M1) SUBST x / M1 x Missile( x) Owns( Nono, x) Sells( West, Nono, x) Sells( West, Nono, M1) 18

Completeness of first-order logic First-order logic is complete If a sentence is entailed by KB, then this can be proved (Gödel s completeness theorem, 1930) But generalized modus ponens is not complete However, first-order logic is semi-decidable If the sentence is not entailed by the KB, this can not always be shown Extension of first-order logic with mathematical induction is incomplete There are true statements that cannot be proved (Gödel s incompleteness theorem, 1931) 19

Forward chaining - FC Start with sentences in KB, apply inference rules in forward direction, adding new sentences until goal found or no further inference can be made 20

Production systems using FC Main features Consists of rule base and working memory Uses rule matching and forward chaining to add facts to the working memory until a solution is found Rete networks are used to speed up matching Applications Used in many expert systems, especially early ones Design and configuration systems Real-time monitoring and alarming Cognitive architectures (SOAR) 21

Backward chaining - BC Start with goal sentence, search for rules that support goal, adding new sub-goals until match with KB facts or no further inference can be made 22

Logic programming using BC Main features Restricted form of first-order logic Mixes control information with declarative sentences Backward chaining search: Prove a goal Prolog is the dominant logic programming language, and has been used for Expert systems Natural language systems Compilers Many others 23

Resolution - A complete inference procedure Extends generalized modus ponens by allowing rules with disjunctive conclusions Resolution rule: p Assumes that all sentences are written in a normal form, for which there exists an efficient algorithm E.g. eliminate implications, replace with A complete resolution inference procedure p1 p2 pn q1 q2 q q,p r q r Works by refutation, i.e. include Goal in the KB Then apply resolution rule until a contradiction is found m 24

Example resolution proof 25

Theorem provers using resolution Main features Allows expression of problems in full first-order logic May permit additional control information Performs inference by resolution or other procedure Applications Assistants for mathematicians Synthesis and verification of hardware/software systems Diagnosis of technical systems 26

Summary Different logics make different commitments about the world and what can be known First-order logic commits to the existence of objects and relations between objects An agent can use first-order logic for reasoning about world states and for deciding on actions First-order sentences are made of terms, predicates, functions, quantifiers and connectives First-order logic is complete but semi-decidable, but extensions are incomplete 27

Summary (cont.) Reduce to propositional inference by replacing variables with constants - Inefficient Generalized Modus Ponens (GMP) relies on unification, i.e. partial instantiation of variables Forward chaining uses GMP to derive new facts from known facts Backward chaining uses GMP to prove goals from known facts Resolution is a complete and efficient proof system for first-order logic Reasoning systems include theorem provers, logic programming, and production systems 28