1 / 43

Intro to AI Knowledge Representation & Reasoning

Intro to AI Knowledge Representation & Reasoning. Ruth Bergman Fall 2004. West Wessex Marathon Race. (by Martin Hollis)

temira
Download Presentation

Intro to AI Knowledge Representation & 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. Intro to AIKnowledge Representation &Reasoning Ruth Bergman Fall 2004

  2. West Wessex Marathon Race (by Martin Hollis) • With a field of five for the west wessex marathon race, there was little to interest the bettors. So, Peter Piper opened one of his ingenious books where he accepts multiple bets at high odds. To place a multiple bet, you must bet on two propositions, and you will win only if you are wholly successful. Peter Piper is now on an extended vacation because of the bettors who lost these bets: • A will not win the gold, nor B the silver. • C will win a medal, and D will not. • D and E will both win medals. • D will not win the silver, nor E the bronze. • A will win a medal, and C will not. Who won which of the medals?

  3. Logic & AI • One of the original problem areas in AI was mathematical theorem proving: logic theorist, GPS • first complete inference procedure was computational • Early on many researchers realized that it was essential to have a “formal” language for talking about knowledge • logic seems like the obvious language • These two facts have led logic and logical inference to be generally viewed as essential to symbolic AI • explicit language for expressing “knowledge” • formal inference procedures • nothing “hidden” in the code --- a fully declarative approach

  4. Knowledge-Based Agent Sensors Knowledge Environment Inference Agent Effectors

  5. Knowledge-Based Agent • Knowledge or epistemological level “What the agent can know about” The Golden Gate Bridge links San Francisco and Marin County • Logical level representation of facts as sentences in a formal language Links(GGBridge, SF, Marin) • Implementation level how inference is implemented on the agent architecture

  6. Building KB Agent • Initially input designer’s knowledge in the form of sentences - declarative approach • Design learning mechanism - autonomous agent

  7. Representation & Reasoning • Knowledge representation : express knowledge in computer-tractable form • Syntax : the written form of sentences • Semantics : facts in the world to which the sentences refer • Reasoning : a process of constructing new physical configurations from old ones

  8. Representation • Programming language • good for describing algorithms and concrete data structures • hard to represent “there is a blue flower” • Natural language • expressive • ambiguous, depend on context “small dog and cat” • Good KB representation language • expressive, concise, unambiguous, effective • first-order predicate calculus (first order logic)

  9. Syntax of First Order Logic • Term: • Constant p, q, AI • Variable x • Predicate of n arguments (PU : Un  {True,False}) brother, LeftLegOf • Function of n arguments (fU : Un  U) Before, HasColor, Raining • connective: ^ | v |  |  |  • quantifier:  | 

  10. Well-Formed Formulae • AtomicSentence: pred (term1, term2, .. termn) Brother(Joseph, Reuven) • Sentence: • AtomicSentence •  Sentence  Brother(Joseph,Jacob) • Sentence connective Sentence Brother(Joseph, Reuven) ^ Brother(Joseph, Judea) • quantifier Sentence x Brother(Joseph,x) -> Son(x, Jacob) • (Sentence)

  11. Semantics • Semantics is the link between what we write (syntax) and what it means (semantics) • We must define an interpretation for the sentences we write. The interpretation gives the sentence meaning in the world. • We will assume all of our languages of compositional: we can recursively define the meaning of sentences in terms of their components

  12. U P Q Models • A model of a sentence is any world in which a sentence is true under a particular interpretation Example: any world where {p=False, q = False} is a model for p -> q • The more claims, the fewer the models • Models of complex sentences are described by the models of their component, and can be viewed as sets Example: Let the set P be the set of all the models of p and Q the set of all models of q. Then the set Q v P is the set of all models of p -> q U is the set of all models

  13. Models for FOL • Universe U of objects • A interpretation function I that • maps constants to elements of U • maps function symbols f of n arguments to elements of U • maps predicates P of n arguments to relations, i.e. a subset PUof Un • Example: a model of integral arithmetic • Integers U = {1,2,3,…} • Functions symbols, f1= successor ={(0,1), (1,2), (2,3),…} f2= + ={(0,1,1), (0,2,2), (1,2,3), (0,3,3),…} • Predicate symbols, p=lessThan={(0,1), (0,2), (1,2), (0,3)…}

  14. Interpretation in FOL • meaning of constants 1, 2, jacob, … • meaning of functions I(f(t1, t2, ... tn)) = u U if f(I(t1),…I(tn))= u • meaning of predicates I(P(t1, t2, ... tn)) = true if <I(t1),…I(tn)> PU false otherwise • meaning of connectives ^ | v |  |  |  Connectives operate on truth values {True, False} Truth table gives true values for every possible input values imply connective: any implication is true whenever its antecedent is false • The meaning of a complex sentence is derived from its parts

  15. Variable Substitution • Consider a substitution s to be a list of pairs x/u where x is a variable in the language and u is an element of U • a [s] is the sentence a with all of the variable assignments given in s • Example: a = x,y childof(x,y)  parentof(y,x) a [x/jacob, y/issac] = childof(jacob, issac) parentof(issac, jacob)

  16. Interpretation of Quantifiers • meaning of variables x[x/u] = u • meaning of quantifiers x P(x) the predicate P holds for all objects x U x P(x) the predicate P holds for some object x  U • Order of quantification is very important • The term Well-Formed Formula (wff) is often used for sentences that have all their variables quantified • A term with no variables is called a ground term • x y Loves(x,y) • Everybody loves somebody • y x Loves(x,y) • There is someone who is loved by everyone

  17. An Example •  x male(x) v female(x) •  x (male(x) ^ female(x)) •  x y z parentof(x,y) ^ ancesterof(y,z)  ancesterof(x,z) •  x y parentof(x,y)  ancesterof(x,y) •  x parentof(fatherof(x),x) ^ parentof(motherof(x),x) ^ male(fatherof(x)) ^ female(motherof(x)) •  x  y1, y2 parentof(y1,x) ^ parentof(y2,x) ^ (y1 = y2) • x,y childof(y,x)  parentof(x,y) • male(jacob), female(rebecca), parentof(rebecca,jacob) ..... • E.g. show  x  y ancesterof(y,x)

  18. Logical Reasoning • We need a proof theory for our representation • Two notions of determining what follows from what we know • KB |=  KB entails a; if KB is true, then so is   Sentence  is entailed by KB if all models of KB are models of  • KB |-i   inference procedure i derives from the sentences in KB

  19. Representation & the “Real World” entailment sentences sentences representation Semantics Semantics world facts facts follows

  20. Inference • Sound reasoning = logical inference = deduction A sentence s is valid if it is true in all interpretations in all possible worlds necessarily true, tautologies, analytic sentence Valid A sentence s is satisfiable if it is true for some interpretation in some world Satisfiable A sentence s is unsatisfiable if there is no interpretation in all possible world for which it it true Unsatisfiable

  21. Inference Procedure • We can make up any way of creating new sentences from old • i is sound if KB |-ia implies that KB |= a • we only derive statements that are true given what we know • the record of the derivation is called a proof • i is complete if KB |= a implies that KB |-ia • if a fact is true, we can derive it • Soundness is essential (and usually easy) • Completeness is hard (and sometimes impossible!)

  22. Inference for Propositional Logic • [Reminder] Propositional Logic • Atomic sentence: True, False, p, jacob • connective: ^ | v |  |  |  • We could do inference for propositional logic just by checking models • 2n potential true values for a sentence with n atoms • Impractical even for propositional logic • Cannot extend this inference procedure for FOL with infinitely large universe U

  23. Rules of Inference for Propositional Logic

  24. Rules of Inference Involving Quantifiers • The connection between the universal and existential quantifiers •  x  P(x) ==   x P(x) •  x  P(x) ==   x P(x) Sentence a, variable n, ground term g Sentence a, variable n, constant k not in KB Sentence a, variable n not in a, ground term g in a

  25. Example • From our previous axiomitization •  x male(x) v female(x) ^ (male(x) ^ female(x)) •  x y z parentof(x,y) ^ ancesterof(y,z)  ancesterof(x,z) •  x y parentof(x,y)  ancesterof(x,y) •  x parentof(fatherof(x),x) ^ parentof(motherof(x),x) ^ male(fatherof(x)) ^ female(motherof(x)) •  x  y1, y2 parentof(y1,x) ^ parentof(y2,x) ^ (y1 = y2) • x,y childof(y,x)  parentof(x,y) • male(jacob), female(rebecca), parentof(rebecca,jacob) ... • show • childof(jacob, rebecca) •  x  y ancesterof(y,x) ^ female(y)

  26. Notes on Proofs by Inference • A proof may require many steps • The proof process requires matching, substitution and application of the inference rules

  27. An Inference Procedure for FOL? • This inference procedure will find a proof for any true sentence • For false sentences this procedure may not halt. This procedure is semi-decidable. • An inference procedure • If a is in KB return yes • Apply inferences rules on KB • Add new sentences to KB • Go to 1

  28. Building a Knowledge Base • The process of building a knowledge base is called knowledge engineering • The knowledge engineer must encode domain knowledge in logic sentences • Typically, the knowledge engineer is a logician, not a domain expert. • Thus, the knowledge engineer interviews domain expert(s) to learn about the domain. This process is called knowledge acquisition. • A realistic domain typically requires thousands of rules • The knowledge is not available in rule form • The domain expert’s time is precious ($$$) • This process may take years – the knowledge engineering bottleneck

  29. Knowledge Engineering • 5-step methodology • Decide what to talk about • Decide on a vocabulary of predicates, functions, and constants : ontology of the domain • Encode general knowledge about domain : writing logical sentences or axioms • Encode descriptions of the specific problem instances : writing simple atomic sentences • Pose queries to the inference procedure and get answers

  30. X1 X2 A2 O1 A1 Electronic Circuits Domain • What to talk about: circuits, terminals, signals, gates, gate types C1 1 1 2 3 2

  31. Electronic Circuits Ontology • Representation of constants • Gates X1,X2,… • Gate types XOR, OR, AND and NOT • Signal value constants : On, Off • Representation of objects • Output terminals Out(1, X1) , In(2, X1) • Representation of predicates on objects • Type (X1) = XOR v.s. Type(X1, XOR) v.s. XOR(X1) • Signal(X1) = On • Representation of relations between objects • Connected(Out(1, X1) , In(1, X2) )

  32. Electronic Circuits Representation • Encode general rules • If two terminals are connected, then they have the same signal  i1, i2 Connected (i1, i2)  Signal(i1) = Signal(i1) • An XOR gate’s output is on iff its inputs are different • g Type(g)=XOR  • Signal(Out(1,g)) = on  Signal(In(1,g)) != Signal(In(2,g)) • … Five more rules for this domain • Encode specific instances • Type(X1) = XOR, … • Connected(Out(1, X1) , In(1, X2)) … • Pose queries to the inference procedure • What are the inputs for Sum bit = Off and Carry bit = On ? i1, i2, i3 Signal(In(1, C1)) = i1  Signal(In(2, C1)) = i2  Signal(In(3, C1)) = i3  Signal(Out(1, C1)) = Off  Signal(Out(2, C1)) = On

  33. General Relations and Predicates • Representation of general predicates • If x is a parent of y then it is an ancestor of y • x y parentof(x,y)  ancesterof(x,y)  x y z parentof(x,y) ^ ancesterof(y,z)  ancesterof(x,z) • Representation of general relations on predicates • Ancestor is transitive  x y z ancestorof(x,y) ^ ancesterof(y,z)  ancesterof(x,z) • Ancestor is asymmetric  x y z ancestorof(x,y)   ancesterof(y,x)

  34. Higher Order Logics • General relations on predicates • Predicate p is transitive • p Transitive(p)  • x y p(x,y) ^ p(y,z)  ancesterof(x,z) • Predicate p is asymmetric • p Transitive(p)  • x y p(x,y)   p(y,x) • Higher-order logic have strictly greater expressive power than first-order logic. • Logicians have little understanding of how to reason effectively with sentences in higher-order logic.

  35. Representation limits of FOL • Inheritance • x bird(x)  flies(x) • x penguin(x)  bird(x) • Inheritance with exceptions • x penguin(x)   flies(x) penguin(opus) Can deduce both flies(opus) and  flies(opus) A contradiction. • The property of monotonicity FOL is a monotonic logic. If P follows from KB, then it still follows when KB is augmented with a new sentence s. There are nonmonotonic logics that explicitly deal with default values

  36. General Ontologies • Special-purpose ontologies • Are the most efficient representation to solve problems for the given domain • Lack re-usability. Portions of knowledge have to be duplicated from one ontology to another. • General purpose ontologies • more demanding to construct • once done, many advantages • General purpose ontologies should be applicable in any special-purpose domain • Add domain specific rules • General purpose ontologies enable reasoning in several areas simultaneously. • In sufficiently demanding domains, different areas of knowledge must be unified

  37. General Ontologies • Categories – define a taxonomic hierarchy where properties are inherited from more general categories Birds  Pigeons, x Bird(x)  fly(x) • Measures – a representation for mass, age, price, length, etc. • Composite objects – objects belong to categories based on their composition from subparts. E.g a chair has four legs and a flat seat • Time, Space and Change– represent a universe of continuous temporal and spatial dimensions. Times places and objects are part of this universe. • Events and processes – events are things that occur with space and time extent; processes are continuous events.

  38. General Ontologies • Physical objects – allow objects to have different properties at different times. E.g. PrimeMinister(Israel) • Substances – describe properties that are intrinsic to the substances, rather than properties of the object as a whole. E.g., x,y x Butter ^ part of(y,x) y Butter • Mental objects and Beliefs – in multi-agent domains, it is important for an agent to reason about the mental processes of the other agents.

  39. General purpose ontology • Categories : objects having certain common properties • Measures : quantities of particular type, age, mass... • Composite objects : car with wheels, engines, ... • Time, Space, and Change • Events and Processes : individual event and continuous events • Physical Objects • Substances : Tomato juice is category? Physical object? • Mental Objects and Beliefs : reason about belief of its own or others

  40. West Wessex Marathon Race (by Martin Hollis) • With a field of five for the west wessex marathon race, there was little to interest the bettors. So, Peter Piper opened one of his ingenious books where he accepts multiple bets at high odds. To place a multiple bet, you must bet on two propositions, and you will win only if you are wholly successful. Peter Piper is now on an extended vacation because of the bettors who lost these bets: • A will not win the gold, nor B the silver. • C will win a medal, and D will not. • D and E will both win medals. • D will not win the silver, nor E the bronze. • A will win a medal, and C will not. Who won which of the medals?

  41. West Wessex Marathon Race • A racer medals iff he receives a gold, silver or bronze medal x medal(x)  (gold(x) v silver(x) v bronze(x)) • A racer can only receive one medal • x gold(x)  medal(x) ^ (silver(x) v bronze(x)) • x silver(x)  medal(x) ^ (gold(x) v bronze(x)) • x bronze(x)  medal(x) ^ (silver(x) v gold(x)) • Only one racer can receive a gold (silver, bronze) medal • x,y gold(x) ^ x != y   gold(y) • x,y silver(x) ^ x != y   silver(y) • x,y bronze(x) ^ x != y   bronze(y) • Some participant must win a gold (silver, bronze) medal • x gold(x) • x silver(x) • x bronze(x)

  42. West Wessex Marathon Race • A will not win the gold, nor B the silver is false ( gold(A) ^  silver(B))  gold(A) v silver(B) • C will win a medal, and D will not is false  medal(C) v medal(D) • D and E will both win medals is false  medal(D) v  medal(E) • D will not win the silver, nor E the bronze is false silver(D) v bronze(E) • A will win a medal, and C will not is false  medal(A) v medal(C) • Who won which of the medals? Proof in class.

  43. Cyc • The Cyc Knowledge Server is a very large, multi-contextual knowledge base and inference engine developed by Cycorp. • Cycorp's goal is to break the "software brittleness bottleneck" once and for all by constructing a foundation of basic "common sense" knowledge--a semantic substratum of terms, rules, and relations--that will enable a variety of knowledge-intensive products and services. Cyc is intended to provide a "deep" layer of understanding that can be used by other programs to make them more flexible.

More Related