Document Sample

4.0 Knowledge Representation Outline 4.1 Introduction 4.2 Knowledge Representation schemes. 4.3 Propositional Calculus (PC) 4.3.1 PC Symbols and Sentences 4.3.2 Syntax of the propositional calculus 4.3.3 Semantics of PC 4.3.3.1 logic Laws and inference rules 4.3.3.2 Classification of Compound Propositions 4.3.4 Exercises 4.4 Predicate Calculus 4.4.1 Syntax of predicate calculus 4.4.2 Some predicate calculus equivalences 4.4.3 Inference rules 4.5 Semantic Networks 4.5.1 Representation of Some Relations 4.5.2 Inheritance in Semantic Networks 4.6 Conceptual Graphs 4.6.1 Types and individuals 1 4.7 Frame Structure 4.7.1 Examples 4.1 Introduction AI System Knowledge Base (KB) Inference Mechanism Facts about objects: Rules,Procedures, Set of procedures to properties and Theories examine the KB in an relations orderly manner to answer questions, solve problems, or make decisions within the KB domain 2 4.2 Knowledge Representation schemes Logic Network Structural Representation Representation Representation Propositional Predicate Semantic Conceptual Frame Calculus Calculus Networks Graphs Structures 3 4.3 Propositional Calculus • Proposition: is a statement about the world that is either true or false. It is a declarative sentence. Examples : P= “It is hot”& Q =“The earth orbits the sun” are propositions. R=“can you play tennis” is not a proposition. • Premise: is a proposition which is assigned a logical value( true or false). Example : P is true Interpretation of P = assertion of its truth value • Rules are used to draw new propositions from known premises • Example Q=“We are in summer”, P=“It is hot” • Rule: QèP conclusion or consequent Premise or antecedent 4 4.3.1 Propositional Calculus Symbols and Sentences 4.3.1.1 Symbols: P Q P^Q PvQ PàQ P↔Q • Propositional symbols: P,Q,R,S,….. T T T T T T • Truth symbols: true, false • Connective T F F T F F symbols: Not(┐,!,~), AND(^) OR(v), Imply(è) F T F T T F Equivalence (↔) The shown truth table gives their meaning F F F F T T A sentence in PC can be a symbol or a collection of symbols connected legally by the connective symbols (^,v,!,à, ↔). Symbols ( ) and ] [ 5 are used to group symbols into subexepressions. 4.3.1.2 Examples for using connectives • 1-Although Ali and Samy are not young, Ali has a better chance of winning the next tennis match, despite Samy’s considerable experience. • The above is a complex sentence that can be broken into the following propositions: • S =“Ali is young” • G =“Samy is young” • B =“Ali has a better chance of winning the next tennis match” • E =“Samy has a considerable experience in tennis” • Formalization is done using connectives as follows: • (~S) ^(~G) ^B^E • 2- If Ali is not in a hospital then Ali is well C =“Ali is in a hospital” W =“Ali is well” Formalization: (~C)èW 6 4.3.2 Syntax of the propositional calculus • The syntax provides us with a set of rules for generating complex formulae as follows: • 1- An identifier is a proposition (e.g. A,B, p, q). • 2-If p and q are propositions then so are ~P, (P), p^q, pvq, pèq, póq. • Example: if A, B and C are propositions then • Aè C is a grammatically correct formula and, therefore • AèC v B is also correct. • Terminology • Formula that contains only symbols of the agreed alphabet and obey grammatical rules given in the definition are called well-formed formulae (wffs). • Note that when mixing connectives, the rules of precedence should be taken into consideration. • Precedence from higher to lower :(),~,^,v, è ,ó • Hence A^BvC means (A^B)vC not A^(BvC). 7 4.3.3 Semantics of PC • Semantics deal with the meaning of compound propositions. • Meaning of a propositional sentence is The determination of its truth value ≡ Mapping it into T or F ≡Interpretation of it • This is done by using truth tables or by applying the laws and rules of propositional logic listed in the following section. 4.3.3.1 Logic laws and inference rules Cumulative laws: (P^Q) ≡(Q^P) and (PvQ) ≡(QvP) Associative Laws: ( (PvQ)vR) ≡(Pv(QvR)) and ( (P^Q)^R) ≡(P^(Q^R)) Distributive laws: Pv(Q^R) ≡(PvQ)^(PvR) and P^(QvR) ≡(PvQ)v(P^R) 8 ~(~P) ≡ P (PvQ) ≡(~PàQ) and (~PvQ) ≡ PàQ Contrapositive law: (PàQ) ≡(~Qà~P) de Morgan’s law: ~(PvQ) ≡~P^~Q and ~(P^Q) ≡~Pv~Q An example of an inference rule: Modus Ponens rule: if P is true and PàQ Prime Premises Conclusion propositions Then Q is true The validity (correctness or p q pèq p q soundness) of this rule can be proven using truth tables as T T T T T shown. T F F T F F T T F T 9 F F T F F List of inference rules: each introduces or eliminates a connective Note that : _I means introduction of a connective. _E means Elimination of a connective. • Conjunction: ^_I • Modus ponens: è_E p Pèq q p p^q q • Simplification: ^_E • Modus tollens: è_E p^q Pèq p ~q • Addition: v_I ~p p • Double negation: ~_E pvq ~~p • Disjunctive syllogism: v_E p pvq • Transivity of equivalence: ó_E ~p p óq p óq q pèq qèp 10 4.3.3.2 Classification of Compound Propositions • Compound propositions can be classified based on the truth value each proposition can take under all possible interpretations of its constituent prime proposition as follows: • Tautology: is true under all possible assignments of truth values to its prime propositions èalways true – Example p v ~p is a tautology. • Contradiction: èalways false – Example: p ^ ~p is a contradiction. • Contingent: sometimes true and sometimes false. – Example: pè~p 11 4.3.4 Exercises 1- Build the truth table for the following expression and deduce an expression equivalent to it: (PèQ)^(QèP) ≡ P….Q P Q PàQ QàP (PèQ)^(QèP) 2-Determine the type of the following expressions: a- p v qóp ^ q b- pèqóqèp c-~p v ~qó ~(p^q) d-~p ^ ~q v p ^ q 3-Demonestrate the validity of modes tollens’ rule: If pèq and ~q then ~p 12 4.4 Predicate Calculus • In Propositional Calculus, each symbol denotes a proposition. There is no way to access the components of an individual assertion. Predicate calculus provides this ability. • For Example in Propositional Calculus the symbol P may represent the proposition: P=“Ali is the father of Salem” • In Predicate calculus, the same proposition can be represented as father (ali , salem). By dividing the proposition into its internal components, predicate calculus allows inference of another information such as : Ali is a father, Salem is the son of Ali, And many other conclusions can be derived if combined with other predicates. • Predicate calculus also allows expressions to contain variables. Ex: "X 13 alive(X)àdrinks(X, water). 4.4.1 Syntax of predicate calculus • Constatnsà specific names of objects, properties, or relations. Must begin with small letters: Ex: ali, book, red, father, above. • Variables à unknown or general classes of objects. Represented by symbols beginning with capital letters. X, Y, Z, Man… • Functions:à maps its arguments from the domain into a unique object in the range (co-domain): Examples: 1-arity function fatherof(ali): maps ali to his father. plus(3,5): maps 3,5à8 2-arity function price (banans): maps banans to price value. 14 • Term: is a constant, variable, or function: Examples: cat, X, times(2,3), • Predicate: names a property of an object or a relationship between zero or more objects in the world: Examples: tall, likes, equal, on, near , part_of,….etc. • A predicate expression consists of a predicate symbol followed by n terms equal to its arity: predicate_symbol( term 1, term 2,… term n) Examples: likes (ali, football) friends (ali, father_of(ibrahim)) likes (X,Y) • Atomic sentence: includes truth symbols or predicate expression: true , false friends (ali, khaled) 15 • Sentences: § Every atomic sentence is a sentence. § A legal combination of sentences using logical operators ( connectives of propositional calculus). • Quantifiers: – constrains the meaning of a sentence containing a variableà to make it a proposition (can be T or F). – If X is a variable and S is a sentence then • "X S is a sentence, and $X S is a sentence. – The universal quantifier " , for all: the sentence is true for all values of its variable. – The existential quantifier $, there exist: the sentence is true for at least one value of its variable. – For complex expressions “()” are used to indicate the scope of quantification. 16 – Free variables are not allowed in quantified expressions. • Examples: – Ali is a teacher and a good man • goodman (ali) ^ isa (ali, teacher) – Nobody likes taxes: • Ø $X likes (X , taxes) – Every dog is an animal: • "X ( dog (X) è animal (X)) – Every student has a pen: • "X ($Y(student(X) è (pen (Y) ^ owns (X,Y)))) 17 More examples • Everybody is an adult or a child • "X ( adult(X) v child (X)) • Everybody is an adult or there are children • ("X adult(X)) v ($X child (X)) • Everybody is tall but there are children • ("X tall(X)) ^ ($X child (X)) • Although all adults are tall, they are not clever. • "X (( adult(X)ètall(X)) ^ (adult (X)è~clever (X))) • All first-year students are clever. • "X ( first_year(X)^student (X)èclever(X) ) • No one can be clever without being hardworking • ~$X (clever (X) ) ^ ~hardworking (X)) • Not being lazy is equivalent to being hardworking. • "X (~lazy(X)óhardworking (X)) 18 Examples for expressing predicate formulae in English • "X (child(X)^ clever(X)è$Y loves(Y,X) ): – Clever children are loved. • "X (child(X)^ clever(X)è$Y (adult (Y) ^loves(Y,X))): – Clever children are loved by adults. • "X (clever(X)è$Y cleverer(X,Y) ): – One can not be clever without being cleverer than someone. • Tall(samir) ^ ~$Y loves(Y,samir) ^ "X (respects( X, samir)) : – Samir is tall and nobody loves him although everybody respects him. • ~ $X ( person (X) ^ (X/=samir) ^ speaks_slowly(X): – Nobody, except Samir, speaks slowly. • 19 Important notes • Scope of the quantifier – the variable X may refer to different objects in the same argument as follows: – "X distant(X)^ planet (X)è$X moon(X) XàOne object Xàanother object • Bound and free variables: • "X .p(X,Y) bound variable free variable • Types of values • When a variable is quantified, we should associate it with a type or domain as follows: • "Y:person. mortal (Y) 20 Semantics of 4.4.2 of universal quantification predicate logic Interpretation • Assuming we deal with finite domain of individuals • "X.p(X)ó p(x1)^p(x2)^….^p(Xn) • Example: assume the human society H consist of the individuals samir, samy, ali, salma, amira, and let the following propositions hold true : • male(samir) greedy (samir) kind(ali) • male (samy) greedy (samy) kind (amira) • male (ali) Let these predicate be false for individuals not mentioned above. Is the following formula (Z) true in the given context? "X:H.male(X)è greedy(X) v kind (X) To validate this argument we build a truth table as follows: (1) (2) (3) (4) (5) (6) X male (X) greedy Kind (X) (3) v (4) (2)è(5) (X) samir T T F T T samy T T F T T ali T F T T T Z is T salma F F F F T amira F F T T T 21 From the same table we can deduce that "X:H. greedy(X) v kind (X) is false. Semantics of predicate logic Interpretation of Existential quantification • Assuming we deal with finite domain of individuals • $X.p(X)ó p(x1) v p(x2) v….v p(Xn) • Example: assume the human society H mensioned in the previous example and consider the truth value of the formula Z • $ X:H.male(X)^(~ greedy(X) è kind (X)) To validate this argument we build a truth table as follows: (1) (2) (3) (4) (5) (6) (7) X male (X) greedy Kind (X) ~(3) (5)è(4) (2) ^(6) (X) samir T T F F T T samy T T F F T T Z is T ali T F T T T T salma F F F T F F amira F F T T T F 22 4.4.2 Some predicate calculus equivalences Assume p and q are predicates and X,Y are variables: Ø Ø $X p(X) ó "X Ø p(X) Ø Ø "X p(X) ó $X Ø p(X) Ø $X p(X) ó $Y p(Y) Ø "X p(X) ó "Y p(Y) Ø "X ( p(X) ^ q(X) ) ó "X p(X) ^ "Y q(Y) Ø $X ( p(X) v q(X) ) ó $X p(X) v $Y q(Y) 23 4.4.3 Inference rules Predicate calculus equivalence: • Modus Ponens: Given :PèQ and P are true Given: Conclusion: Q is true "X p(X) èq(X) and Example: p(a) PèQ: “If I am in Jeddah then I’m in Saudi Arabia” P=“I am in Jeddah “ Conclusion: q(a) Q=“I’m in Saudi Arabia” added to PèQ and P Using substitution • Modus Tolens: X=a Given :PèQ and Q is false Predicate calculus Conclusion: P is false equivalence: Example: Given: PèQ: “If I am in Jeddah then I’m in Saudi Arabia” Ø Q=“I’m not in Saudi Arabia” "X p(X) èq(X) and Ø P=“I am not in Jeddah “ added to PèQ and Ø Q Ø q(a) Conclusion: Ø p(a) 24 Using substitution X=a 4.5 Semantic Networks • Network representation provides a means of structuring knowledge. • Semantic networks are : Directed graphs with labeled nodes and arcs ( arrows, or links). • Nodes corresponds to objects (physical as book or nonphysical such as concepts, events, or actions) • Links corresponds to relationships between objects. Examples: IS_A, MEMBER_OF, SUBSET_OF, AKO (a kind of), HAS_PARTS, INSTANCE_OF, SHAPED_LIKE, OWNS 25 4.5. 1 Representation of some Relations • In our course we will limit the use of these links to definite relations. • IS_A : to represent inheritance : subclass to superclass relationship: Example: a lion is an animal lion IS_A animal • Instance_of: To represent object to its class relationship: Example :Ali is a student Instance_of ali student 26 • HAS_PARTS: to represent composition or aggregation • Example: A computer is an electronic device consisting of CPU unit, screen, keyboard Electronic Device IS_A HAS_PARTS HAS_PARTS screen computer keyboard HAS_PARTS CPU UNIT 27 • HAS_ATTRIBUTE: to link an object to a property. Example : A person named Ahmad has a red car person instance_of owns ahmad car has_color Important Not : links in semantic networks red can represent binary relations only. 28 4.5.2 Inheritance in Semantic Networks Inheritance is represented with the IS_A And instance_of links. This allows unstated information to be inferred. Example: Has_parts drinks hair mammal milk IS_A From the shown net, using inheritance, we rodent can infer that a mouse has hair and IS_A drinks milk. mouse 29 4.6 Conceptual Graphs • It is a Network scheme in which both concepts and conceptual relations are represented by nodes in a directed graph. The links are not labelled. They indicate the direction of the relation only. • Concepts are represented with labelled rectangles. concepts • Relations are represented by labelled ellipsis. pen color red • Example: the pen is red 30 2-ary conceptual relation • A concept may represent concrete or abstract objects. • Concrete concepts are like cat, telephone , or anything that we can imagine its shape. • Abstract concepts include concepts such as love, beauty….that do not correspond to images in our minds. • A conceptual relation has 1 to n- ary. flies is a 1-ary relation bird flies parents is a 3-ary relation father child parents 31 mother 4.6.1 Types and individuals • A concept symbol may be individual (as instance objects) or generic) as classes). • Individual concepts have a type field followed by a referent field. • Example: the concept Person: ali has type ‘person’ and referent ‘ali’ • Each conceptual graph represents a single proposition. The shown graph represents the proposition “ali gave ahmad the book” Person: ali agent object give Person:ahmad recipient book 32 4.7 Frame Structure • Extends network by allowing each node to be a complex data structure. • The main advantage is that knowledge about an object or event is stored together in memory as a unit. • Each frame consists of named slots with attached values. • The slot values may be – Numeric data. – Symbolic data – Pointers to other frames – Procedures for performing a particular task. 33 • Frames are general record-like structures, consisting of a collection of slots. • The slots may be of any size and type • Slots also may have subfields called facets. • Facets may also have names and any number of values. • A general frame structure is as follows: • (<frame name> (<slot 1> (<facet 1> <value 1> ……<value k1>) (<facet 2> <value 1> ……<value k2>) -- ) (<slot 2> (<facet 1> <value 1> ……<value km>) -- -- ) 34 4.7.1 Examples • To define a frame which describes the shown screen: Frame name ) screen (object 1 (shape (value pyramid)) (color (value yellow)) slots (supported_by (value object2))) (object 2 (shape (value cube)) (color (value red)) (supported_by (value object3))) (object 3 (shape (value cube)) (color (value blue)) slots facets (supported_by (value nil)))). 35 • Another example: to describe a type (Cressida ( ako ( value car)) ( color ( value white, blue, black)) Pointer to ( speed (value 220 km/hr)) another frame to allow ( model ( value 4-doors)). inheritance (subclass- superclass relationship) ( Mycar ( instance_of (value Cressida )) Pointer to ( color ( value white))). another frame to allow object -class relationship 36 • Problem Set 2 Construct truth tables for the compound proposition: – p v (q ^ r) è (p ^q) v r • Test Validity of the following rule – (p v q) ^ ~pèq • Express the following in predicate logic – Although the tree is tall, it has no leaves. – If x is the father of y or mother of y then x is a parent of y – If y and x have same parent then they are sibling – If x and y are parents of z then they are married. – Every Muslim does prayer. – Nobody likes taxes – All students like AI • Evaluate the truth of the following, assuming the data is given in section 4.2 – $ X:H.male(X)^(~ greedy(X) v ~kind (X)) – ($ X:H.~male(X) ^ kind (X))è("X:H.male(X)è~kind (X)) 37

DOCUMENT INFO

Shared By:

Categories:

Tags:

Stats:

views: | 1 |

posted: | 7/18/2013 |

language: | Latin |

pages: | 37 |

OTHER DOCS BY yurtgc548

How are you planning on using Docstoc?
BUSINESS
PERSONAL

By registering with docstoc.com you agree to our
privacy policy and
terms of service, and to receive content and offer notifications.

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.