Lec 17 - Intro to Knowledge Representation I_080400.pdf

Full Transcript

Fundamentals of Artificial Intelligence (CPCS-335) Introduction to Knowledge Representation Imtiaz Hussain Khan, PhD [email protected] Recap  State-space search problems are formulated by identifying initial state, goal state, successor...

Fundamentals of Artificial Intelligence (CPCS-335) Introduction to Knowledge Representation Imtiaz Hussain Khan, PhD [email protected] Recap  State-space search problems are formulated by identifying initial state, goal state, successor functions (and heuristic function)  Informed search techniques use heuristic function to guide the search process  A* search finds an optimal solution if its heuristic function is admissible  In an adversarial search, the agent has to develop a strategy to explore the search space keeping in view the move of its opponent 2 Today’s Plan AFundamental concepts about knowledge Needs for Knowledge Representation Characteristics of Knowledge Representation  Overview of Propositional and Predicate Logic 3 Motivation We would like to build a system that:  we could TELL a set of facts This system we call a Knowledge Base (KB) – Ali is a Muslim. – All Muslims believe in one God.  we could ASK questions, and receive correct answers Is Ali a Muslim? Is Williams a Muslim?  can automatically ADD more facts in it Ali believes in one God. 4 Motivation AI can (also) be viewed as study of intelligent behavior achieved through computational means Knowledge representation and reasoning is the study of how to reason (compute) with knowledge in order to decide what to do But, before reasoning with knowledge, first we need to represent (encode) it 5 Fundamentals Knowledge generally emerges as follows: data  information  knowledge  Data: Collection of (disconnected) facts Temperature drops to 10C. It starts raining.  Information emerges when relationships among facts are established Temperature dropped to 10C AND then it started raining.  Knowledge emerges when relationships among patterns are identified and understood Rain pattern: If the humidity is very high and temperature drops substantially then atmosphere is unlikely to hold moisture, so it rains. 6 Fundamentals We understand through knowledge different kinds of facts about something (the world) Knowledge is necessary for intelligent behavior  If I get tired, I’d like to take rest. A knowledge representation (KR) is encoding of knowledge (in some appropriate way)  KR is substitute (aka surrogate for the thing itself 7 Types of Knowledge A priori knowledge  Comes before knowledge perceived through senses  Considered to be universally true (All bachelors are unmarried) A posteriori knowledge  Knowledge verifiable through senses  May not always be reliable (Some bachelors are very happy) Procedural knowledge  Knowing HOW to do something: to determine if A is taller than B, first determine heights of A & B Declarative knowledge  Knowing that something is true/false 8 Needs for Knowledge Representation Knowledge base, reasoning and language  To draw (rational) inference, we first need to be able to state the rules and the known facts about a problem  The internal representation of facts and rules is called a knowledge base (KB)  The KB is the starting point for all reasoning that we may want to perform  Therefore, we need a kind of language that allows us to express what we know 9 Knowledge Representation Languages Possibility 1: Natural languages  Very expressive, but notoriously ambiguous Inference would be very difficult  So, not a good choice Possibility 2: Programming languages  Very precise, but lack expressiveness Not all kind of required knowledge can be represented  So, again, not a good choice Possibility 3: Formalisms, e.g. logic, which balance the above trade-offs 10 Characteristics of Knowledge Representation Ideally, a KR language should have  Representational Adequacy/expressiveness  Clear syntax/semantics  Inferential adequacy  Inferential efficiency  Naturalness  Consistency In practice no one language is perfect, and different languages are suitable for different problems 11 Representational Adequacy Consider the following facts:  Sun is shining  Most people believe in Allah  Ahmed will finish his job before Asar prayer How do we represent all kind of facts  These can be represented as natural language strings But hard then to manipulate and draw conclusions Hard to understood by machines Some notations/languages only allow you to represent certain things  Time, beliefs, uncertainty, all hard to represent 12 Well-defined Syntax and Semantics Knowledge representation languages should have precise syntax and semantics You must know exactly what an expression means in terms of objects in the real world Real World Real World Map to KR language Map back to real world New Representation Inference conclusions of facts in World Computer Computer 13 Well-defined Syntax and Semantics Suppose we have decided that “red1” refers to a dark red color, “car1” is my car, car2 is another.. Syntax of a language will tell you which of the following is legal: red1(car1), red1 car1, car1(red1), red1(car1 & car2)? Semantics of a language tells you exactly what an expression means - e.g., Pred(Arg) means that the property referred to by Pred applies to the object referred to by Arg  E.g., property “dark red” applies to my car 14 Natural Representation It would be helpful if our representation scheme is quite intuitive and natural for human readers Could represent the fact that my car is red using the notation:  abc  xyz where abc refers to my car, xyz refers to redness and  used in some way to associate properties to objects But this wouldn’t be very helpful 15 Inferential Adequacy Representing knowledge would not be very interesting unless you can use it to make inferences:  Draw new conclusions from existing facts If its raining, Hassan never goes out It’s raining today so.. Inferential adequacy refers to how easy it is to draw inferences using represented knowledge  Representing everything as natural language strings has good representational adequacy and naturalness, but very poor inferential adequacy 16 Inferential Efficiency You may be able, in principle, to make complex deductions given knowledge represented in a sophisticated language But it may be just too inefficient Generally the more complex the possible deductions, the less efficient will be the reasoner Representation and inference system should be sufficient for the task, without being hopelessly inefficient 17 Consistency A consistent KR system would help avoid redundant information  Hassan is clever  Hassan is smart A consistent KR system would also help avoid conflicting information  Hassan is clever  Hassan is dull-minded 18 Propositions A proposition is a declarative sentence that is either true or false. Examples of propositions: a) The Moon is made of green cheese. b) Trenton is the capital of New Jersey. c) Toronto is the capital of Canada. d) 1 + 0 = 1 Atomic propositions Examples that are not propositions. a) Sit down! b) What time is it? c) x + 1 = 2 19 Propositional Logic Constructing Propositions  Propositional Variables: p, q, r, s, …  The proposition that is always true is denoted by T and the proposition that is always false is denoted by F.  Compound Propositions; constructed from logical connectives and other propositions Compound propositions using connectives  Negation ¬ ¬p: Ali is not tall.  Conjunction ∧ p ∧ q: Ali is tall and good football player.  Disjunction ∨ p ∨ q: Ali is tall or good football player.  Implication → p → q If Ali is tall, then he is good football player.  Biconditional ↔ p ↔ q, (p → q) ∧ (q → p) 20 Compound Propositions: Negation The negation of a proposition p is denoted by ¬p and has this truth table: p ¬p T F F T Example: If p denotes “The earth is round.”, then ¬p denotes “It is not the case that the earth is round,” or more simply “The earth is not round.” 21 Conjunction The conjunction of propositions p and q is denoted by p ∧ q and has this truth table: p q p∧q T T T T F F F T F F F F Example: If p denotes “I am at home.” and q denotes “It is raining.” then p ∧q denotes “I am at home and it is raining.” 22 Disjunction The disjunction of propositions p and q is denoted by p ∨q and has this truth table: p q p ∨q T T T T F T F T T F F F Example: If p denotes “I am at home.” and q denotes “It is raining.” then p ∨q denotes “I am at home or it is raining.” 23 Implication If p and q are propositions, then p →q is a conditional statement or implication which is read as “if p, then q ” and has this truth table: p q p →q T T T T F F F T T F F T p: You work hard. q: You will pass the course. P  q: If you work hard, then you will pass the course. In p →q , p is the hypothesis (antecedent or premise) and q is the conclusion (or consequence). 24 Biconditional If p and q are propositions, then we can form the biconditional proposition p ↔q , read as “p if and only if q.” The biconditional p ↔q denotes the proposition with this truth table: p q p ↔q T T T T F F F T F F F T  If p denotes “I am at home.” and q denotes “It is raining.” then p ↔q denotes “I am at home if and only if it is raining.” 25 How to express NL in Logic? Pick the smallest/atomic statements without and, or, etc. about which you could answer the question  is it true or false? Use propositional variables to stand for these statements, and connect them with the relevant logical connectives 26 How to express NL in Logic? If the sun is shining and we win the toss, we will bat first, or if the sun is not shining but we win the toss, then we will not bat first. s: Sun is shining w: We win the toss b: We will bat first ((s  w)  b)  (( s  w)   b)) 27 Practice Example If I put a hook in the water and I am patient then either I will catch a fish or if I am not patient then I will not catch a fish. a: I put a hook in the water b: I am patient c: I will catch a fish (a  b)  (c  ( b   c)) 28 Inference in Propositional Logic How do we draw new conclusions from existing supplied facts? We can define inference rules, which are guaranteed to give true conclusions given true premises  One such rule is modus ponens If A is true and A B is true, then conclude B is true 29 Propositional Logic Limitations All living things will eventually die Some mammals can fly The above facts cannot be expressed in propositional logic  Propositional logic does not deal with general statements, which include quantifiers  But, quantifications are very common in knowledge/reasoning processes Propositional logic lacks expressivity – we need some other logic to represent quantification  Predicate logic (also called First-order Logic) could serve this purpose 30 Predicate Logic Predicate  A sentence often has two parts: subject and predicate Subject is what/whom the sentence is about – Crow is black. Predicate tells something about the subject – Crow is black. Predicate logic (first-order logic) allows us to describe properties of objects and/or relations among the objects  Crow is black: black(crow)  Hassan is brother of Bilal: brother_of(hassan, bilal) 31 Predicate Logic In predicate logic, the basic unit is a predicate- argument structure, called an atomic sentence:  likes(hassan, chocolate)  tall(ali) Arguments can be:  constant symbol, such as ali  variable symbol, such as X  function expression, e.g., father_of(hassan) So we can have:  likes(X, chocolate)  friends(son_of(ali), son_of(omar)) Predicate returns truth value; function returns object 32 Predicate Logic Syntax The atomic sentences can be combined using logic connectives (like propositional logic)  likes(hassan, fatima)  cute(fatima)  eating(hassan)   fasting(hassan) Sentences can also be formed using quantifiers  (forall) and  (there exists) to indicate how to treat variables:   X lovely(X) Everything is lovely.   X lovely(X) Something is lovely. 33 Predicate Logic Semantics There is a precise meaning to expressions in predicate logic Like in propositional logic, it is all about determining whether something is true or false  X P(X) means that P(X) must be true for every object X in the domain of interest  X P(X) means that P(X) must be true for at least one object X in the domain of interest So if we have a domain of interest consisting of just two people, hassan and bilal, and we know that cute(hassan) and cute(bilal) are true, we can say that  X cute(X) is true 34 Predicate Logic Inference We can define inference rules allowing us to say that if certain things are true, certain other things are sure to be true, e.g.  X p(X) q(X) p(something) ----------------- (so we can conclude) q(something) This involves matching p(x) against p(something) and binding the variable x to the symbol something 35 Predicate Logic Inference What can we conclude from the following?  Rule 1:  X (pious(X)  prays(X))  Rule 2:  X (prays(X)  loves(allah, X))  Fact 1: pious(ali) pious(ali)  prays(ali)  loves(allah, ali)  We conclude that Allah loves Ali. 36 Self Review Questions  Which of the following is not a characteristic of propositional logic? 1. Conjunction 2. Disjunction 3. Implication 4. Quantification  Which of the following is a characteristic of predicate logic? 1. Conjunction 2. Implication 3. Quantification 4. All of the above 37

Use Quizgecko on...
Browser
Browser