Reasoning. Inference. Knowledge Representation 4/6/2018. User

Similar documents
Propositional Logic: Review

Propositional and First-Order Logic

Artificial Intelligence Knowledge Representation I

Chapter 8 First Order Logic

First-Order Logic. Michael Rovatsos. University of Edinburgh R&N: February Informatics 2D

Logic. (Propositional Logic)

J Propositional logic is declarative J Propositional logic is compositional: q meaning of B 1,1 P 1,2 is derived from meaning of B 1,1 and of P 1,2

First-Order Logic. Propositional logic. First Order logic. First Order Logic. Logics in General. Syntax of FOL. Examples of things we can say:

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

First-Order Logic. Chapter 8

Propositional and First-Order Logic

First-Order Logic. Chapter 8

CS 188: Artificial Intelligence Spring 2007

Overview. Knowledge-Based Agents. Introduction. COMP219: Artificial Intelligence. Lecture 19: Logic for KR

CSCI-495 Artificial Intelligence. Lecture 17

First-Order Logic. Chapter 8

First order logic (FOL) Chapters 8 & 9

Description Logics. Foundations of Propositional Logic. franconi. Enrico Franconi

Logic: Propositional Logic (Part I)

Logic III. Introduction to Artificial Intelligence CSE 150

Propositional Logic: Logical Agents (Part I)

CS560 Knowledge Discovery and Management. CS560 - Lecture 3 1

First Order Logic: Syntax and Semantics

First-order logic. Chapter 8. Chapter 8 1

Logical Agents. Outline

How to determine if a statement is true or false. Fuzzy logic deal with statements that are somewhat vague, such as: this paint is grey.

Logic. Propositional Logic: Syntax. Wffs

Logic. Propositional Logic: Syntax

First Order Logic Semantics (3A) Young W. Lim 8/9/17

First Order Logic Semantics (3A) Young W. Lim 9/17/17

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

Knowledge Based Systems: Logic and Deduction

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

Propositional Logic: Syntax

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

Propositional Logic: Logical Agents (Part I)

Knowledge Representation and Reasoning

Artificial Intelligence Knowledge Representation I

Knowledge based Agents

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom.

First-order logic. First-order logic. Logics in general. Outline. Syntax of FOL: Basic elements. Pros and cons of propositional logic

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

Inference in Propositional Logic

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

Logical Agent & Propositional Logic

ITS336 Lecture 6 First-Order Logic

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

cis32-ai lecture # 18 mon-3-apr-2006

First-order logic. Chapter 8. Chapter 8 1

Intelligent Agents. First Order Logic. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University. last change: 19.

Propositional Logic: Part II - Syntax & Proofs 0-0

First Order Logic (FOL)

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

MAI0203 Lecture 7: Inference and Predicate Calculus

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

Learning Goals of CS245 Logic and Computation

Outline. First-order logic. Atomic sentences. Intelligent Systems and HCI D7023E. Syntax of FOL: Basic elements. Pros and cons of propositional logic

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

Logic & Logic Agents Chapter 7 (& background)

WUCT121. Discrete Mathematics. Logic. Tutorial Exercises

THE LANGUAGE OF FIRST-ORDER LOGIC (FOL) Sec2 Sec1(1-16)

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

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

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

Logical Agent & Propositional Logic

Propositional Logic. Jason Filippou UMCP. ason Filippou UMCP) Propositional Logic / 38

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

INF5390 Kunstig intelligens. Logical Agents. Roar Fjellheim

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

First Order Logic (1A) Young W. Lim 11/18/13

Propositional Logic Part 1

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Propositional Logic Not Enough

CS 771 Artificial Intelligence. Propositional Logic

CS 380: ARTIFICIAL INTELLIGENCE FIRST ORDER LOGIC. Santiago Ontañón

First order Logic ( Predicate Logic) and Methods of Proof

Logical Agents. Knowledge based agents. Knowledge based agents. Knowledge based agents. The Wumpus World. Knowledge Bases 10/20/14

Predicate Logic & Quantification

Discrete Mathematics and Its Applications

AI Programming CS S-09 Knowledge Representation

First-Order Logic. CS367 ARTIFICIAL INTELLIGENCE Chapter 8

Intelligent Agents. Pınar Yolum Utrecht University

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

Lecture 8: (Predicate) First Order Logic

Propositional logic (revision) & semantic entailment. p. 1/34

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

Inference in first-order logic

CS 7180: Behavioral Modeling and Decision- making in AI

First-Order Logic. Peter Antal

Introduction to Sets and Logic (MATH 1190)

Foundations of Artificial Intelligence

Logical Agents. Chapter 7

Logic & Logic Agents Chapter 7 (& Some background)

15414/614 Optional Lecture 1: Propositional Logic

Outline First-order logic. First-order Logic. Introduction. Recall: 4-Queens problem. First-order Logic. First-order Logic Syntax.

Logic Background (1A) Young W. Lim 12/14/15

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

Logic Overview, I. and T T T T F F F T F F F F

Agents that reason logically

Transcription:

Reasoning Robotics First-order logic Chapter 8-Russel Representation and Reasoning In order to determine appropriate actions to take, an intelligent system needs to represent information about the world and draw conclusions based on general world knowledge and specific facts. Expert Systems Search, Reasoning, Learning NLP Knowledge is represented by sentences in some language stored in a knowledge base (KB). A system draws conclusions from the KB to answer questions, take actions using Inference Engine (IF). User KB Computer Vision IF Conclusion Knowledge Representation Logics are formal languages for representing information such that conclusions can be drawn Syntax: defines the sentences in the language Semantics: define the meaning of sentences: i.e., define truth of a sentence in a world E.g., the language of arithmetic x+2 y is a sentence; x2+y > {} is not a sentence syntax x+2 y is true in a world where x = 7, y = 1 x+2 y is false in a world where x = 0, y = 6 semantics Inference Logical Inference (deduction) derives new sentences in the language from existing ones,. Socrates is a man. All men are mortal. Socrates is mortal. Proper inference should only derive sound conclusions 1

Examples of Types of Logics Language What exist Degree of belief of an Agent Propositional Logic Facts {o,1} T or F First Order Logic Temporal Logic Facts, Objects, Relations Facts, Objects, Relations, Time {o,1} T or F {o,1} T or F Probability Theory Facts Chances of belief [0,1] Fuzzy Logic Degree of truth about Facts Degree of belief [0,1] Propositional calculus & First-order logic Propositional logic assumes world contains facts. First-order logic (like natural language) assumes the world contains Objects: people, houses, numbers, Relations: red, round, prime, Functions: fatherof, friend, in, Propositional calculus A B C First-order predicate calculus ( x)( y) Mother(y,x) Syntax of PC Chapter 7-Russel Connectives:,,, Propositional symbols, e.g., P, Q, R, True, False Syntax of PC sentence atomic sentence complex sentence atomic sentence Propositional symbol, True, False Complex sentence sentence (sentence sentence) (sentence sentence) (sentence sentence) Rules of Inference: Ex: Modus ponens Sentence in PC A sentence (also called a formula or wellformed formula or wff) is defined as: A symbol (S, P, etc) If S is a sentence, then S is a sentence, where " " is the "not" logical operator If S and T are sentences, then (S v T), (S ^ T), (S => T), and (S <=> T) are sentences, where the four logical connectives correspond to "or," "and," "implies," and "if and only if," respectively 2

P means "It is hot" Q means "It is humid" R means "It is raining Example Examples of PL sentences: (P ^ Q) => R (here meaning "If it is hot and humid, then it is raining") Q => P (here meaning "If it is humid, then it is hot") Q (here meaning "It is not humid.") Semantics of PC A B A A B A B A B True True False True True True True False False False True False False False True False False True False True True False True True Truth Tables Truth tables can be used to compute the truth value of any wff. Can be used to find the truth of (( P R) Q) S Given n features there are 2 n different worlds, different interpretations. Interpretation: any assignment of true and false to atoms An interpretation satisfies a wff if the wff is assigned true under the interpretation A model: An interpretation is a model of a wff if the wff is satisfied in that interpretation. Satisfiability of a wff can be determined by the truth-table P ( P) ( P Q) ( P Q) ( P Q) ( P Q) Wff is unsatisfiable or inconsistent it has no models Semantics of PC Validity and Inference interpretation of the sentence: Given the truth values of all of the constituent symbols in a sentence, that sentence can be "evaluated" to determine its truth value (True or False). A model is an interpretation (i.e., an assignment of truth values to symbols) of a set of sentences such that each sentence is True. A model is just a formal mathematical structure for the world. A valid sentence (also called a tautology) is a sentence that is True under all interpretations. Hence, no matter what the world is actually like or what the semantics is, the sentence is True. For example "It's raining or it's not raining. Remark: Validity can be checked by the truth table 3

Semantics of PC Validity and Inference An inconsistent sentence (also called unsatisfiable or a contradiction) is a sentence that is False under all interpretations. For example, "It's raining and it's not raining." Sentence P entails sentence Q, written P = Q, means that whenever P is True, so is Q. In other words, all models of P are also models of Q Satisfiability A sentence is satisfiable if it is true under some interpretation (i.e. it has a model), otherwise the sentence is unsatisfiable. A sentence is valid if and only if its negation is unsatisfiable. Therefore, algorithms for either validity or satisfiability checking are useful for logical inference. If there are n propositional symbols in a sentence, then we must check 2 n rows for validity Satisfiability is NP-complete, i.e. there is no polynomial-time algorithm to solve. Yet, many problems can be solved very quickly. Rules of Inference A sequence of inference rule applications that leads to a desired conclusion is called a logical proof. A - B, denotes that B can be derived by some inference procedure from the set of sentences A. Inference rules can be verified by the truth-table The truth table method of inference is complete for PL Then used to construct sound proofs. Finding a proof is simply a search problem with the inference rules as operators and the conclusion as the goal Rules of Inference Modus Ponens: And Elimination: Double negation Elimination: Implication Elimination: Unit resolution: Resolution: 4

Famous logical equivalences (a b) (b a) commutatitvity (a b) (b a) commutatitvity ((a b) c) (a (b c)) associativity ((a b) c) (a (b c)) associativity ( (a)) a double-negation elimination (a => b) ( (b) => (a)) contraposition (a => b) ( (a) b) implication elimination (a b) ( (a) (b)) De Morgan (a b) ( (a) (b)) De Morgan (a (b c)) ((a b) (a c)) distributitivity (a (b c)) ((a b) (a c)) distributitivity Producing an additional wffs from a set of wffs From alpha infer beta α β w w 1 2 w2 Sound inference rule: The conclusion is true whenever the premises are true. Examples Rules of Inference Modus ponens: { A and A B -- B} is sound, resolution is sound. Pros and cons of propositional logic Propositional logic is declarative: pieces of syntax correspond to facts Propositional logic is compositional: meaning of A ^ B is derived from meaning of A and B Meaning in propositional logic is context-independent (unlike natural language, where meaning depends on context) Propositional logic has very limited expressive power (unlike natural language) Propositional logic is a weak language Hard to identify individuals. Ex. Mary, 3 Can t directly talk about properties of individuals or relations between individuals. Ex. Bill is tall Generalizations, patterns, regularities can t easily be represented. Ex. all triangles have 3 sides First-Order Logic (abbreviated FOL or FOPC) is expressive enough to concisely represent this kind of situation. FOL adds relations, variables, and quantifiers, e.g., Every elephant is gray : x (elephant(x) gray(x)) There is a white elephant : x (elephant(x) ^ white(x)) 5

First-order logic First-order logic (FOL) models the world in terms of Objects, which are things with individual identities Properties of objects that distinguish them from other objects Relations that hold among sets of objects Functions, which are a subset of relations where there is only one value for any given input Ex:Objects: Students, lectures, companies, cars... Relations: Brother-of, bigger-than, outside, part-of, has-color, occurs-after, owns, visits, precedes,... Properties: blue, oval, even, large,... FOL Syntax Variable symbols E.g., x, y, John Connectives:,,, Quantifiers Universal x Existential x Functions: father-of, best-friend, second-half, one-more-than... Syntax of First-order logic Sentence Atomicsentence ( Sentence Connective Sentence ) Quantifier Variable,... Sentence >Sentence AtomicSentence Predicate(Term,...) ( Term = Term Term Function(Term,...) I Constant Variable Connective,,, Quantifier, Constant A ( XI ( John 1... Variable a x s... Predicate Before Function Mother Atomic Sentences Propositions are represented by a predicate applied to a tuple of terms. A predicate represents a property or relation between terms that can be true or false: Brother(John, Fred), Left-of(Square1, Square2), GreaterThan(plus(1,1), plus(0,1)) Sentences in logic state facts that are true or false. In FOL properties and n-ary relations do express that: LargerThan(2,3) is false. Brother(Mary,Pete) is false. Note: Functions do not state facts and form no sentence: Brother(Pete) refers to the object John (his brother) and is neither true nor false. Brother(Pete,Brother(Pete)) is True. Binary relation Function 6

Truth in first-order logic Sentences are true with respect to a model and an interpretation Model contains objects (domain elements) and relations among them Interpretation specifies: constant symbols objects predicate symbols relations function symbols functional relations An atomic sentence predicate(term 1,...,term n ) is true iff the objects referred to by term 1,...,term n are in the relation referred to by predicate Entailment Entailment means that one thing follows from another: KB α Knowledge base KB entails sentence α if and only if α is true in all worlds where KB is true E.g., the KB containing the Greens won and the Reds won entails Either the Greens or the reds won E.g., x+y = 4 entails 4 = x+y Entailment is a relationship between sentences (i.e., syntax) that is based on semantics entailment: necessary truth of one sentence given another Models Logicians typically think in terms of models, which are formally structured worlds with respect to which truth can be evaluated We say m is a model of a sentence α if α is true in m M(α) is the set of all models of α Then KB α iff M(KB) M(α) E.g. KB = Greens won and Reds won α = Greens won Think of KB and α as collections of constraints and of models m as possible states. M(KB) are the solutions to KB and M(α) the solutions to α. Then, KB α when all solutions to KB are also solutions to α. Nested Quantifiers Combinations of universal and existential quantification are possible: x yfather( x, y) y x Father( x, y) x yfather( x, y) y x Father( x, y) x y Father( x, y) y x Father( x, y) x yfather( x, y) y x Father( x, y) x, y { All people} Binary relation: x is a father of y. 7

A common mistake to avoid Typically, is the main connective with Common mistake: using as the main connective with : Ex: x At(x,CU) Smart(x) means Everyone is at CU and everyone is smart Yet to say Everyone at CU is smart x At(x,CU) Smart(x) Another common mistake to avoid Typically, is the main connective with Common mistake: using as the main connective with : x At(x,CU) Smart(x) is true if there is anyone who is smart not at CU. Yet to say: there exists someone in CU that is smart x At(x,CU) Smart(x) Properties of quantifiers x y is the same as y x x y is the same as y x x y is not the same as y x x y Loves(x,y) There is a person who loves everyone in the world y x Loves(x,y) Everyone in the world is loved by at least one person Quantifier duality: each can be expressed using the other Exp. Negation x Likes(x,IceCream) x Likes(x,IceCream) x Likes(x,Broccoli) x Likes(x,Broccoli) Equality: Equality term 1 = term 2 is true under a given interpretation if and only if term 1 and term 2 refer to the same object FOPC can include equality as a primitive predicate or require it to be as identity relation Equal(x,y) or x=y Examples: to say that Mary is taking two courses, you need to insure that x,y are different x y ( takes(mary,x) ^ takes (Mary,y) ^ ~ (x=y)) To say Everyone has exactly one father x y father(y,x) ^ z father(z,x) y=z 8

Higher Order Logic FOPC is called first order because it allows quantifiers to rang only over objects (terms). x, y [x=y or x>y or y>x] Second-Order Logic allows quantifiers to range over predicates and functions as well f, g [f=g <=> ( x f(x)=g(x))] Third-Order Logic allows quantifiers to range over predicates of predicates,.. etc Examples of FOPC Brothers are siblings x, y Brother(x,y) => Sibling(x,y) One's mother is one's female parent m, c Mother(c) = m (Female(m) Parent(m,c)) Sibling is symmetric x, y Sibling(x,y) Sibling(y,x) Some may be considered axioms, others as theorems which can be derived from the axioms. 9