Artificial Intelligence Knowledge Representation I

Similar documents
Propositional Logic: Review

Propositional and First-Order Logic

Propositional and First-Order Logic

Logic. (Propositional Logic)

Artificial Intelligence. Propositional logic

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

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

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

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

Artificial Intelligence Knowledge Representation I

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

INF5390 Kunstig intelligens. Logical Agents. Roar Fjellheim

Logical Agents (I) Instructor: Tsung-Che Chiang

Agents that reason logically

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

CS 7180: Behavioral Modeling and Decision- making in AI

Logical Agents. Outline

Propositional Logic Part 1

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

Advanced Topics in LP and FP

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Logical Agents. September 14, 2004

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

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

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

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

Inference in Propositional Logic

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

Logical Agent & Propositional Logic

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

Introduction to Artificial Intelligence. Logical Agents

15414/614 Optional Lecture 1: Propositional Logic

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

Intelligent Agents. Pınar Yolum Utrecht University

Knowledge based Agents

CS 380: ARTIFICIAL INTELLIGENCE

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

Kecerdasan Buatan M. Ali Fauzi

Logical Agents. Chapter 7

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

Propositional Logic: Logical Agents (Part I)

Proof Methods for Propositional Logic

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

CSC Discrete Math I, Spring Propositional Logic

Logic: Propositional Logic (Part I)

CS 331: Artificial Intelligence Propositional Logic I. Knowledge-based Agents

Knowledge-based Agents. CS 331: Artificial Intelligence Propositional Logic I. Knowledge-based Agents. Outline. Knowledge-based Agents

Artificial Intelligence Chapter 7: Logical Agents

CS 771 Artificial Intelligence. Propositional Logic

Logical Agents. Administrative. Thursday: Midterm 1, 7p-9p. Next Tuesday: DOW1013: Last name A-M DOW1017: Last name N-Z

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Logical Agent & Propositional Logic

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence

Logical Agents. Chapter 7

Artificial Intelligence

Knowledge Based Systems: Logic and Deduction

Logical agents. Chapter 7. Chapter 7 1

AI Programming CS S-09 Knowledge Representation

CS 4700: Artificial Intelligence

Artificial Intelligence

Learning Goals of CS245 Logic and Computation

02 Propositional Logic

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

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

CSCI 5582 Artificial Intelligence. Today 9/28. Knowledge Representation. Lecture 9

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

Class Assignment Strategies

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

Logic and Inferences

CSCI-495 Artificial Intelligence. Lecture 17

First Order Logic: Syntax and Semantics

Lecture 7: Logical Agents and Propositional Logic

Revised by Hankui Zhuo, March 21, Logical agents. Chapter 7. Chapter 7 1

PHI Propositional Logic Lecture 2. Truth Tables

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

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

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

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Definition 2. Conjunction of p and q

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

Propositional Logic: Logical Agents (Part I)

Language of Propositional Logic

22c:145 Artificial Intelligence

TDT4136 Logic and Reasoning Systems

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

Foundations of Artificial Intelligence

Formal Logic 2. This lecture: Standard Procedure of Inferencing Normal forms Standard Deductive Proofs in Logic using Inference Rules

Natural Deduction. Formal Methods in Verification of Computer Systems Jeremy Johnson

PROPOSITIONAL CALCULUS

13.3 Truth Tables for the Conditional and the Biconditional

Logical Agents: Propositional Logic. Chapter 7

Propositional Logic: Methods of Proof (Part II)

Logical Agents. Santa Clara University

Logic, Human Logic, and Propositional Logic. Human Logic. Fragments of Information. Conclusions. Foundations of Semantics LING 130 James Pustejovsky

Deliberative Agents Knowledge Representation I. Deliberative Agents

7. Logical Agents. COMP9414/ 9814/ 3411: Artificial Intelligence. Outline. Knowledge base. Models and Planning. Russell & Norvig, Chapter 7.

Chapter 3: Propositional Calculus: Deductive Systems. September 19, 2008

Inference Methods In Propositional Logic

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

Transcription:

Artificial Intelligence Knowledge Representation I Agents that reason logically knowledge-based approach implement agents that know about their world and reason about possible courses of action needs to know the current state of the world; how to infer unseen properties; how the world evolves; goals; result of own actions. 2 Issues in Knowledge Representation Why logic in knowledge representation? 1. How to represent knowledge 2. How to manipulate/process knowledge (2) Can be rephrased as: how to make decisions based on some knowledge. 3 Logical notation can be used to express info/knowledge. Logical notation is useful in reasoning about Sentences knowledge. are physical configurations; reasoning is constructing new physical configurations. Proper reasoning must ensure that new configurations express facts that actually follow from the old facts. Entailment generating new sentences that are true given the old sentences are true mirrors relation of one fact followinf from another. 4 General framework for reasoning How to represent a world about which we have only partial information? Propositional logic General problem: ell the computer how the world works ell the computer some facts about the world Ask a yes/no question about other facts being true Why propositions Explore boolean nature for efficient reasoning Need a language for asking questions Easy to incrementally add formulae Logic can be extended to infinitely many variables 5 6 1

Representation and reasoning systems Using RSS 7 8 Propositional logic Logical constants: true, false Propositional symbols: P, Q, S,... (atomic sentences) Wrapping parentheses: ( ) Sentences are combined by connectives:...and [conjunction]...or [disjunction]...implies [implication / conditional]..is equivalent [biconditional]...not [negation] Literal: atomic sentence or negated atomic sentence Examples of PL sentences (P Q) R If it is hot and humid, then it is raining Q P If it is humid, then it is hot Q It is humid. A better way: Ho = It is hot Hu = It is humid R = It is raining 9 10 Propositional Calculus Sentences (Syntax) Propositional logic Every propositional symbol and truth symbol is a sentence. e. g., true, P, R. he negation of a sentence is a sentence. e. g., ~P, ~false he conjunction of two sentences is a sentence. e. g., P Q, P Q he disjunction of two sentences is a sentence. e. g., Q R he implication of one sentence for another is a sentence. e. g., P Q he equivalence of two sentences is a sentence e. g., P Q = R 11 A simple language useful for showing key ideas and definitions User defines a set of propositional symbols, like P and Q. User defines the semantics of each propositional symbol: P means It is hot Q means It is humid R means It is raining A sentence (well formed formula) is defined as follows: A symbol is a sentence If S is a sentence, then S is a sentence If S is a sentence, then (S) is a sentence If S and are sentences, then (S ), (S ), (S ), and (S ) are sentences A sentence results from a finite number of applications of the above rules 12 2

A BN grammar of sentences in PL S := <Sentence> ; <Sentence> := <AtomicSentence> <ComplexSentence> ; <AtomicSentence> := "RUE" "ALSE" "P" "Q" "S" ; <ComplexSentence> := "(" <Sentence> ")" <Sentence> <Connective> <Sentence> "NO" <Sentence> ; <Connective> := "NO" "AND" "OR" "IMPLIES" "EQUIVALEN" ; Logic Logic consists of: a) syntax (how to make sentences) and semantics (how sentences relate to states of affairs) of a language; b) proof theory set of rules for deducing the reasoning of a set of sentences. 13 14 Some terms More terms he meaning or semantics of a sentence determines its interpretation. Given the truth values of all symbols in a sentence, it can be evaluated to determine its truth value (rue or alse). A model for a KB is a possible world (assignment of truth values to propositional symbols) in which each sentence in the KB is rue. A valid sentence or tautology is a sentence that is rue under all interpretations, no matter what the world is actually like or what the semantics is. Example: It s raining or it s not raining. An inconsistent sentence or contradiction is a sentence that is alse under all interpretations. he world is never like what it describes, as in It s raining and it s not raining. P entails Q, written P = Q, means that whenever P is rue, so is Q. In other words, all models of P are also models of Q. 15 16 autology and inconsistency A formula is tautology if and only if it is true under all its interpretations. A formula is inconsistency if and only if it is false under all its interpretations. A formula is consistent if and only if it is not inconsistent - true under at least one interpretation. ruth tables he five logical connectives: A complex sentence: autology is known as a valid formula; inconsistency as unsatisfiable formula; consistency as satisfiable formula. 17 18 3

Well-formed ormulae Legal sentences are also called well- formed formulae or Ws P Q, P Q, P Q Conjuncts Disjuncts premise, conclusion, antecedent consequent (, ), [, ] can be used to group symbols into subexpressions (P Q) = R is not the same as P (Q = R) A W : (P (Q R)) = ~P ~Q R 19 20 Propositional Calculus Semantics Given the truth values of propositions, what are the truth values of compound expressions formed from them? Q P Q P Q P Q ~P P = Q he above table is also known as the truth table. 21 W Equivalence ~(~P) = P (P Q) = (~P Q) [or (~ P Q) = (P Q)] P Q ~P De Morgan s laws: ~(P Q) = (~P ~Q) ~(P Q) = (~P ~Q) Distributive laws: P (Q R) = (P Q) (P R) P (Q R) = (P Q) (P R) ~P V Q P->Q 22 W Equivalence W Example Commutative laws: (P Q) = (Q P) (P Q) = (Q P) Associative Laws: ((P Q) R) = (P (Q R)) ((P Q) R) = (P (Q R)) Contrapositive laws: (P Q) = (~Q ~P) hese identities can be used to change an expression into a syntactically different but logically equivalent form. Can be used to prove the equivalence of two expressions (instead of using truth table). 23 (P (Q R)) = (( P Q) (P R)) is a tautology always true no matter what propositions are substituted for P, Q, and R. It states: Saying P implies Q and R is the same as saying P implies Q and P implies R. Proof: LHS = (P (Q R)) = ~P (Q R) = (~P Q) (~P R) (distributive law) = (( P Q) (P R)) = RHS 24 4

ormulae interpretation 25 26 Rules of inference Inference rules Logical inference is used to create new sentences that logically follow from a given set of predicate calculus sentences (KB). An inference rule is sound if every sentence X produced by an inference rule operating on a KB logically follows from the KB. (hat is, the inference rule does not create any contradictions) An inference rule is complete if it is able to produce every expression that logically follows from (is entailed by) the KB. (Note the analogy to complete search algorithms.) 27 28 Sound rules of inference Here are some examples of sound rules of inference A rule is sound if its conclusion is true whenever the premise is true Each can be shown to be sound using a truth table RULE PREMISE CONCLUSION Modus Ponens A, A B B And Introduction A, B A B And Elimination A B A Double Negation A A Unit Resolution A B, B A Resolution A B, B C A C Soundness of modus ponens rue rue alse alse A rue alse rue alse B A B rue alse rue rue OK? 29 30 5

Soundness of the resolution inference rule Proving things A proof is a sequence of sentences, where each sentence is either a premise or a sentence derived from earlier sentences in the proof by one of the rules of inference. he last sentence is the theorem (also called goal or query) that we want to prove. Example for the weather problem given above. 1 Hu Premise It is humid 2 Hu Ho Premise If it is humid, it is hot 3 Ho Modus Ponens(1,2) It is hot 4 (Ho Hu) R Premise If it s hot & humid, it s raining 5 Ho Hu And Introduction(1,2) It is hot and humid 6 R Modus Ponens(4,5) It is raining 31 32 Entailment and derivation wo important properties for inference Entailment: KB = Q Q is entailed by KB (a set of premises or assumptions) if and only if there is no logically possible world in which Q is false while all the premises in KB are true. Or, stated positively, Q is entailed by KB if and only if the conclusion is true in every logically possible world in which all the premises in KB are true. Derivation: KB - Q We can derive Q from KB if there is a proof consisting of a sequence of valid inference steps starting from Soundness: If KB - Q then KB = Q If Q is derived from a set of sentences KB using a given set of rules of inference, then Q is entailed by KB. Hence, inference produces only real entailments, or any sentence that follows deductively from the premises is valid. Completeness: If KB = Q then KB - Q If Q is entailed by a set of sentences KB, then Q can be derived from KB using the rules of inference. Hence, inference produces all entailments, or all valid sentences can be proved from the premises. the premises in KB and resulting in Q 33 34 Ways of reasoning 1. Natural deduction 2. Resolution deduction 3. ruth table (model theory) 35 36 6

Example of resolution deduction 37 38 Ways of reasoning in L PC (3) ruth ables A sentence A is valid means: 1 occurs in all the rows of A s ruth able equivalently means All possible interpretation of the sentence A gives out 1. Given an interpretation I and a sentence S, how do we interpret S with respect to I? Ans: An interpretation: A function from undeterminate variables to {0, 1} eg. { p 0, q 0, r 1} 39 40 Example - prove that ~(A V B) eqv. (~A & ~B) 41 42 7

Propositional logic is a weak language Hard to identify individuals (e.g., Mary, 3) Can t directly talk about properties of individuals or relations between individuals (e.g., Bill is tall ) Generalizations, patterns, regularities can t easily be represented (e.g., all triangles have 3 sides ) irst-order Logic (abbreviated OL or OPC) is expressive enough to concisely represent this kind of information OL adds relations, variables, and quantifiers, e.g., Every elephant is gray : x (elephant(x) gray(x)) here is a white alligator : x (alligator(x) ^ white(x)) Example Consider the problem of representing the following information: Every person is mortal. Confucius is a person. Confucius is mortal. How can these sentences be represented so that we can infer the third sentence from the first two? 43 44 Example 2 he hunt of the wumpus In PL we have to create propositional symbols to stand for all or part of each sentence. or example, we might have: P = person ; Q = mortal ; R = Confucius so the above 3 sentences are represented as: P Q; R P; R Q Although the third sentence is entailed by the first two, we needed an explicit symbol, R, to represent an individual, Confucius, who is a member of the classes person and mortal o represent other individuals we must introduce separate symbols for each one, with some way to represent the fact that all individuals who are people are also mortal Some atomic propositions: S12 = here is a stench in cell (1,2) B34 = here is a breeze in cell (3,4) W22 = he Wumpus is in cell (2,2) V11 = We have visited cell (1,1) OK11 = Cell (1,1) is safe. etc Some rules: (R1) S11 W11 W12 W21 (R2) S21 W11 W21 W22 W31 (R3) S12 W11 W12 W22 W13 (R4) S12 W13 W12 W22 W11 etc 45 Note that the lack of variables requires us to give similar rules for each cell 46 Proving the wumpus Apply MP with S11 and R1: W11 W12 W21 Apply And-Elimination to this, yielding 3 sentences: W11, W12, W21 Apply MP to ~S21 and R2, then apply And-elimination: W22, W21, W31 Apply MP to S12 and R4 to obtain: W13 W12 W22 W11 Apply Unit resolution on (W13 W12 W22 W11) and W11: W13 W12 W22 Apply Unit Resolution with (W13 W12 W22) and W22: W13 W12 Apply UR with (W13 W12) and W12: W13 Problems with the propositional wumpus hunter Lack of variables prevents stating more general rules We need a set of similar rules for each cell Change of the KB over time is difficult to represent Standard technique is to index facts with the time when they re true his means we have a separate KB for every time point QED 47 48 8

Summary he process of deriving new sentences from old one is called inference. Sound inference processes derives true conclusions given true premises Complete inference processes derive all true conclusions from a set of premises A valid sentence is true in all worlds under all interpretations If an implication sentence can be shown to be valid, then given its premise its consequent can be derived Different logics make different commitments about what the world is made of and what kind of beliefs we can have regarding the facts Logics are useful for the commitments they do not make because lack of commitment gives the knowledge base engineer more freedom Propositional logic commits only to the existence of facts that may or may not be the case in the world being represented It has a simple syntax and simple semantics. It suffices to illustrate the process of inference Propositional logic quickly becomes impractical, even for very small worlds 49 9