1 / 29

Knowledge Representation and Reasoning

Knowledge Representation and Reasoning. Knowledge Representation & Reasoning. How knowledge about the world can be represented What kinds of reasoning can be done with that knowledge. Two different systems that are commonly used to represent knowledge: Propositional calculus

Faraday
Download Presentation

Knowledge Representation and Reasoning

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Knowledge Representation • and Reasoning

  2. Knowledge Representation & Reasoning • How knowledge about the world can be represented • What kinds of reasoning can be done with that knowledge. • Two different systems that are commonly used to represent knowledge: • Propositional calculus • Predicate calculus

  3. Propositional Calculus • In propositional calculus, • features of the world are represented by propositions, • relationships between features (constraints) are represented by connectives. • Example: • LECTURE_BORING  TIME_LATE ! SLEEP

  4. Propositional Calculus • You see that the language of propositional calculus can be used to represent aspects of the world. • When there are • a language, as defined by a syntax, • inference rules for manipulating sentences in that language, and • semantics for associating elements of the language with elements of the world, • then we have a system called logic.

  5. Logic • When we have too many states, we want a convenient way of dealing with sets of states. • The sentence “It’s raining” stands for all the states of the world in which it is raining. • Logic provides a way of manipulating big collections of sets by manipulating short descriptions instead.

  6. What is a logic? • A formal language: • Syntax – what expressions are legal • Semantics – what legal expressions mean • Proof system – a way of manipulating syntactic expressions to get other syntactic expressions (which will tell us something new)

  7. Propositional Logic • Atoms: • The atoms T and F and all strings that begin with a capital letter, for instance, P, Q, LECTURE_BORING, and so on. • Connectives: •  “or” •  “and” • ! “implies” or “if-then” • $ “equivalence” •  “not”

  8. Propositional Logic • Syntax of well-formed formulas (wffs): • Any atom is a wff. • If 1 and 2 are wffs, so are • 1  2 (conjunction) • 1  2 (disjunction) • 1! 2 (implication) • 1$ 2 (double implication) • 1 (negation) • There are no other wffs.

  9. Propositional Logic • Atoms and negated atoms are called literals. • In 1 ! 2 , 1 is called the antecedent, and 2 is called the consequent of the implication. • Examples of wffs (sentences): • (P  Q) ! P • P ! P • P  P ! P • (P ! Q) ! (Q ! P) P

  10. Precedence highest lowest • Precedence rules enable “shorthand” form of sentences, but formally only the fully parenthesized form is legal. • Syntactically ambiguous forms allowed in shorthand only when semantically equivalent: A Æ B Æ C is equivalent to (A Æ B) Æ C and A Æ (B Æ C)

  11. Rules of Inference • We use rules of inference to generate new wffs from existing ones. • One important rule is called modus ponens or the law of detachment. It is based on the tautology (P  (P ! Q)) ! Q. We write it in the following way: • P • P ! Q • _____ •  Q The two hypotheses P and P ! Q are written in a column, and the conclusionbelow a bar, where  means “therefore”.

  12. Rules of Inference Q P ! Q _____  P Modus tollens Addition • P • ______ •  PQ P ! Q Q ! R _______  P ! R PQ _____  P Hypothetical syllogism Simplification P Q ______  PQ PQ P _____  Q Conjunction Disjunctive syllogism

  13. Predicate Calculus • Proposition’s are simple but weak, so it is a better idea to use predicates instead of propositions. • This leads us to predicate calculus. • Predicate calculus has symbols called • object constants, • relation constants, and • function constants • These symbols will be used to refer to objects in the world and to propositions about the world.

  14. Syntax of First-Order Logic in BNF Sentence  AtomicSentence | Sentence Connective Sentence | Quantifier Variable,… Sentence |  Sentence | (Sentence) AtomicSentence  Predicate(Term,…) | Term= Term Term  Function(Term,…) | Constant | Variable

  15. Syntax of First-Order Logic in BNF Connective   |  |  |  | $ Quantifier   |  Constant  A | X1 | John | … Variable  a | v | x | … Predicate  Before | HasColor | Raining | … Function  MotherOf | LegOf | …

  16. Components • Object constants: • Strings of alphanumeric characters beginning with either a capital letter or a numeral. • Examples: XY, George, 154, H1B • Function constants: • Strings of alphanumeric characters beginning with a lowercase letter and (sometimes) superscripted by their “arity”: • Examples: fatherOf1, distanceBetween2

  17. Components • Relation constants: • Strings of alphanumeric characters beginning with a capital letter and (sometimes) superscripted by their “arity”: • Examples: BeatsUp2, Tired1 • Other symbols: • Propositional connectives , , !, $ , and , delimiters (, ), [, ].

  18. Terms • An object constant is a term. • A function constant of arity n, followed by n terms in parentheses and separated by commas, is a term. • Examples: fatherOf(George), times(3, minus(5, 2))

  19. Wffs • Atoms: • A relation constant of arity n followed by n terms in parentheses and separated by commas is an atom.An atom is a wff. • Examples: Tired(John), OlderThan(Hans, Peter) • Propositional wffs: • Any expression formed out of predicate-calculus wffs in the same way that the propositional calculus forms wffs out of other wffs is a propositional wff. • Example: OlderThan(John, Peter)  OlderThan(Peter, Jennifer)

  20. Quantification • Introducing the universal quantifier  and the existential quantifier  facilitates the translation of world knowledge into predicate calculus. • Examples: • Paul hates all professors who fail him. • x(Professor(x)  Fails(x, Paul) ! Hates(Paul, x)) • There is at least one intelligent Sharif professor. • x(SharifProf(x)  Intelligent(x))

  21. Rules of Inference Universal instantiation • x P(x) • __________ •  P(c) if cU P(c) for an arbitrary cU ___________________  x P(x) Universal generalization x P(x) ______________________  P(c) for some element cU Existential instantiation P(c) for some element cU ____________________  x P(x) Existential generalization

  22. Quantifiers • Properties of quantifiers: • "x "y is the same as"y "x • $x $y is the same as$y $x • note: $x $y can be written as $x,y likewise with " Example? • "x "y Likes(x,y) is active voice: Everyone likes everyone. • "y "x Likes(x,y) is passive voice: Everyone is liked by everyone.

  23. Quantifiers • Properties of quantifiers: • "x $y is not the same as$y "x • $x "y is not the same as"y $x Example? • "x $y Likes(x,y) is active voice: Everyone likes someone. • $y "x Likes(x,y) is passive voice: Someone is liked by everyone.

  24. Quantifiers • Properties of quantifiers: • "x P(x) is the same asØ$x ØP(x) • $x P(x) is the same asØ"x ØP(x) Example? • "x Likes(x,IceCream) Everyone likes ice cream. • Ø$x ØLikes(x,IceCream) No one doesn't like ice cream. It's a double negative!

  25. Quantifiers • Properties of quantifiers: • "x P(x)when negated is$x ØP(x) • $x P(x)when negated is"x ØP(x) Example? • "x Likes(x,IceCream) Everyone likes ice cream. • $x ØLikes(x,IceCream) Someone doesn't like ice cream. • This is from the application of de Morgan's lawto the fully instantiated sentence.

  26. Basics • A free variable is a variable thatisn't bound by a quantifier. • $y Likes(x,y) x is free, y is bound • A well-formed formula is a sentence whereall variables are quantified.

  27. Summary • Term: Constant, variable, or Function(term1, …, termn) • denotes an object in the world • Ground Term has no variables • Atom: Predicate(term1, …, termn), term1 = term2 • is smallest expression assigned a truth value • Sentence: atom, quantified sentence with variables or complex sentence using connectives • is assigned a truth value • Well-Formed Formula (wff): • sentence where all variables are quantified

  28. An example of E.I. b1 b2 b3 • x(Bottle(x,T1)  Upturned(x, T2)) • xy(Upturned(x, y)  Empty(x, y)) • x(Full(x, T1) & Empty(x, T2)  Wet(Floor)) • x (Bottle(x, T1) & Full(x, T1)) b1 b2 b3 T1 T2

  29. An example of E.I. • Bottle(b1, T1) & Full(b1, T1)) - EI assumption • Bottle(b1, T1) - & , 5 • Full(b1, T1) - & , 5 • Upturned (b1, T2) -  , 1 , -  , 6 • Empty(b1, T2) -  , 2 , -  , 7 • Full(b1, T1) & Empty (b1, T2) + & , 7, 9 • Wet(Floor) -  , 3, -  , 10 • Wet(Floor) - EI conclusion

More Related