Knowledge - PowerPoint PPT Presentation

1 / 65
About This Presentation
Title:

Knowledge

Description:

x Watermelons. A category as a whole has some properties. Tomatoes DomesticatedSpecies ... x,o,d e Go(x,o,d) e Journeys Traveler(x,e) Origin(o,e) Destination(d,e) ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 66
Provided by: aiKai
Category:
Tags: knowledge

less

Transcript and Presenter's Notes

Title: Knowledge


1
Knowledge Reasoning (II)
  • Information Communications University1999,
    SpringSun-Hwa Hahn

2
Building a Knowledge Base
  • Knowledge Engineer
  • investigate domain interview the domain expert
    (knowledge acquisition)
  • determine what concepts are important
  • create formal representation of objects and
    relations
  • Knowledge base should be
  • clear and correct
  • separated to inference procedure

3
Building KB Rule of Thumb
  • Facts in one situation should be used in new
    situation
  • Write rules at the most general level
  • As you go along
  • need fewer new facts
  • need fewer new predicates
  • BearOfVerySmallBrain(Pooh), Silly(Pooh)

4
Writing Sentences
  • Why is this true ?
  • How generally is it applicable ?
  • Do I need a new predicate to denote this class of
    objects ?
  • How does the class relate to other classes ?
  • Is it a part of larger class ?
  • Does it have subclasses ?

5
Knowledge Engineering
  • Knowledge Engineer must understand enough about
  • domain to represent important facts and relations
  • the representation language to encode correctly
  • implementation of the inference procedure to
    answer queries in reasonable amount of time

6
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

7
Electronic Circuits Domain
  • What to talk circuits, terminals, signals,
    gates, gate types
  • Decide ontology
  • Type (X1) XOR v.s. Type(X1, XOR) v.s. XOR(X1)
  • Out(1, X1) , In(2, X1)
  • Connected(Out(1, X1) , In(1, X2) )
  • Signal value constants On, Off
  • Signal(X1) On

8
Electronic Circuits Domain
  • Encode general rules
  • 7 general rules (p225)
  • 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

9
General Ontology
  • General ontology v.s. Specific ontology
  • more demanding to construct
  • once done, many advantages
  • 2 major characteristics of general ontology
  • should be applicable in any special-purpose
    domain
  • addition of domain specific axioms
  • Different areas of knowledge must be unified
  • reasoning and problem solving involve several
    areas simultaneously

10
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

11
Representing Categories
  • Much of reasoning takes place at the level of
    categories
  • goal to buy tomato not Tomato37
  • Two main choices for representing categories
  • unary predicate Tomato(x)
  • reify(???) the category x ? Tomatoes
  • Category organize and simplify KB through
    inheritance

12
Representing Categories
  • Facts about categories
  • All object is a member of a category
  • Tomato12 ? Tomatoes
  • A category is a subclass of another category
  • Tomatoes ? Fruit
  • All members of a category have some properties
  • ?x x?Tomatoes ? Red(x) ? Round(x)
  • Members of a category can be recognized by some
    properties
  • ?x Red(Interior(x)) ? Green(Exterior(x)) ? x ?
    Melons
  • ? x ? Watermelons
  • A category as a whole has some properties
  • Tomatoes ? DomesticatedSpecies

13
Relation btn. Categories
  • Subclass Apple, Fruit, Food
  • individual apples inherit the property of
    edibility from their membership in the Food
    category
  • Disjoint no members in common
  • Disjoint(Animals, Vegetables)
  • ?s Disjoint s ? (? c1, c2 c1 ? s ? c2 ? s ? c1 ?
    c2 ? Intersection(c1, c2) EmptySet)

14
Relation btn. Categories
  • Exhaustive decomposition not Male must be
    Female
  • ExhaustiveDecomposition(American, Canadeans,
    Mexicans, NorthAmericas)
  • ?s,c ExhaustiveDecomposition(s,c) ?
  • ?i i?c ??c2 c2?s ? i? c2
  • Partition disjoint exhaustive decomposition
  • Partition(Males, Females, Animal)
  • ?s,c Partitions(s,c) ? Disjoint(s) ?
    ExhaustiveDecomposition(s,c)

15
Measures quantative
  • Ordinary, quantitative measures
  • combine units function with a number
  • Length(L1) Inches(1.5) Centimeter(3.81)
  • ?l Centermeter(2.54 x l) Inches(l)
  • Mass (Tomato12) Kilogram(0.16)
  • Price (Tomato12) (0.32)
  • ?d d ? Days ? Duration(d) Hours(24)

16
Measures Qualitative
  • No agreed scale of values
  • exercises have difficulty
  • desserts have deliciousness
  • poems have beauty
  • not to be numbered but ordered
  • ?e1, e2 e1 ?Exercises ? e2 ? Exercises ?
    Wrote(Norvig,e1) ? Wrote(Russel,e2) ?
    Difficulty(e1) gt Difficulty(e2)
  • ?e1, e2 e1 ?Exercises ? e2 ? Exercises ?
    Difficulty(e1) gt Difficulty(e2) ?
    ExpectedScore(e1) lt ExpectedScore(e2)

17
Composite Objects
  • PartOf relation transitive and reflexive
  • PartOf(Bucharest, Romania), PartOf(Romania,
    EasternEurope), PartOf(EasternEurope, Europe)
  • Transitivity infers PartOf(Bucharest, Europe)
  • Composite object object that has parts
  • Categories of composite objects are characterized
    by the structure of objects
  • parts, how they are related

18
Composite Objects
  • Biped category
  • ?a Biped(a) ?
  • ?l1, l2, b leg(l1) ? leg(l2) ? Body(b) ?
  • PartOf(l1, a) ? PartOf(l2, a) ? PartOf(b,a) ?
    Attached(l1, b) ? Attached(l2, b) ?
  • l2 ? l1 ? ? l3 Leg(l3 ) ?
  • PartOf(l3, a) ? (l3 l1 ? l3 l2 )

19
Composite Objects
  • Composite events Schema or script
  • PartPartition relation
  • some properties can be derived from parts, such
    as mass
  • Composite objects with definite parts but no
    structure
  • BunchOf(Apple1, Apple2, Apple3)

20
Changes with Events
  • Situation calculus is perfect for single agent
    taking discrete action
  • instantaneous points in time ? cannot describe
    continuous change over time
  • only one action happens at a time ? cannot
    applicable for multi-agents
  • cannot describe actions with different duration,
    whose effects depend on duration
  • Different approach to represent change ? Event
    Calculus

21
Events
  • Events is a chunk of the universe with both
    temporal and spatial extent
  • In event calculus, a given event occurs during a
    particular interval
  • SubEvent (WorldWarII, TwentiethCentury)
  • Events can be categorized
  • ?w w ? Wars ? SubEvent(w, AD1967) ?
    PartOf(Location(w), MiddleEast)
  • ?j j ? Journeys ? Origin(NewYork, j) ?
  • Destination (NewDelhi, j) ? Traveler(Shankar, j)
    ? SubEvent(j, Yesterday)

22
Events
  • Complex term event category simplifies the
    sentence
  • ?e,x,o,d e ? Go(x,o,d) ? e ? Journeys ?
    Traveler(x,e) ? Origin(o,e) ? Destination(d,e)
  • Go(Shankar, NewYork, NewDelhi)
  • E(c,i) an event of category c is a subEvent of
    the event (or interval) i
  • ?c,i E(c,i) ? ?e e ? c ? SubEvent(e,i)
  • E(Go(Shankar, NewYork, NewDelhi), Yesterday)

23
Places
  • Predicate In, a special kind of subevent relation
  • In(NewYork, USA)
  • Location function maps an object to the smallest
    place Minimization
  • ?x,l Location(x) l ?
  • At(x,l) ? ?l2 At (x, l2) ? In(l, l2)

24
Processes
  • Flying(Shankar) process category or liquid
    event category
  • Any subinterval of a process is also a member of
    the same process category
  • Discrete subevent
  • E(Flying(Shankar), Yesterday)
  • Some process through out some interval
  • T(Working(Stuart), TodayLunchHour)

25
Processes
  • Processes of continuous non-change State
  • T(In (Mary, Supermarket1), ThisAfternoon)
  • Discontinuous sequences of times
  • T(Closed(Supermarket1), BunchOf(Sundays))

26
Combining Propositions
  • T((At(Agent, Loc1) ? At(Tomato1, Loc1)), I3)
  • All arguments to predicates must be terms
  • Solution introduce new function which takes two
    event categories as arguments and returns a
    category of composite events
  • T(And(At(Agent, Loc1), At(Tomato1, Loc1)), E)
  • ?p,q,e T(And(p,q),e) ? T(p,e) ? T(q,e)
  • And(p,q) category of composite p-q-events
  • Fig. 8.4

27
Times, Intervals, and Actions
  • Partition(Moments, ExtendedIntervals,
    Intervals)
  • ?i i?Intervals ? (i?Moments ? Duration(i)0)
  • ?i Interval(i) ?
  • Duration(i) Time(End(i) -
    Time(Start(i)))
  • Time(Start(AD1991)) Seconds(2871694800)
  • SecondDate(00,00,00,Jan,1,1991)
  • Date(12,34,56,Feb,14,1993)2938682096

28
Relations btn. Intervals
  • ?i,j Meet(i,j) ? Time(End(i)) Time(Start(j))
  • ?i,j Before(i,j) ?Time(End(i)) lt Time(Start(j))
  • ?i,j After(j,i) ? Before(i,j)
  • ?i,j During(i,j) ?
  • Time(Start(j)) ? Time(Start(i)) ?
  • Time(End (i)) ? Time(End(j))
  • ?i,j Overlap(i,j) ? ?k During(k,i) ? During(k,j)

29
Exapmles
  • ?x,y,i0 T(Engaged(x,y), i0) ?
  • ? i1 (Meet(i0, i1) ? After(i0, i1)) ?
  • T(Marry(x,y) ? Break(x,y), i1)
  • ?x,y, i0 T(Marry(x,y), i0) ?
  • ? i1 T(Spouse(x,y), i1) ? Meet(i0,i0)
  • ?x,a,b, i0,? i1 T(Go(x,a,b), i1) ?
  • T(In(x,b), i1) ? Meet(i0,i1)

30
Inferences in First-order Logic
31
Inference Rules Involving Quantifiers
  • Basic Inference Rules
  • Modus Ponens, And-Elimination, And-Introduction,
    Or-Introduction, Resolution
  • Three additional rules for substituting variables
  • SUBST(?,?) applying binding list ? to sentence
    ?
  • SUBST(x/Sam, y/Pam, Likes(x,y) Likes(Sam,
    Pam)

32
New Inference Rules
  • Universal Elimination
  • For any sentence ?, variable ?, ground term g,
  • ?x Likes(x, Icecream) to Likes(Ben, Icecream)
  • Existential Elimination
  • For any sentence ?, variable ?,constant symbol k
    that does not appear elsewhere in KB

33
New Inference Rules
  • Existential Introduction
  • For any sentence ?, variable ? that does not
    occur in ?, and ground term f that does not occur
    in ?
  • Likes (Jerry, Icecream) to ?x Likes(x, Icecream)

34
Example
  • The law says that it is a crime for an American
    to sell weapons to hostile nations. The country
    Nono, an enemy of America, has some missiles, and
    all of its missiles were soled to it by Colonel
    West, Who is American.
  • Is West a criminal?
  • 9 axioms Initial state of KB
  • Operators applicable inference rules
  • Goal test KB containing Criminal(West) ?

35
Proof process
  • Proof is 14 steps long
  • Branching factor increases as KB grows
  • Universal elimination has enormous branching
    factor
  • Proof process combining atomic sentences into
    conjunctions, instantiating universal rules, and
    apply Modus Ponens

36
Generalized Modus Ponens
  • For atomic sentences pi, pi, and q, where there
    is substitution ? such that SUBST(?, pi) Subst
    (?, pi), for all i

37
Generalized Modus Ponens
  • Efficient inference rule for three reasons
  • It takes bigger steps, combining several small
    inferences into one
  • It takes sensible steps use guaranteed
    substitution rather than random universal
    elimination ( Unification)
  • Use of precompilation step converts all
    sentences into canonical form

38
Canonical Form
  • All sentences in the KB should be in the form
    that matches one of the premises of the Modus
    Ponens rule
  • each sentence in the KB be either atomic sentence
    or an implication Horn Sentences
  • Converting to Horn Sentence
  • Existential elimination
  • And Elimination
  • ?x Owns(Nono,x) ? Missle(x) ? Owns(Nono, M1) ?
    Missle(M1) ? Owns (Nono, M1), Missle(M1)

39
Unification
  • UNIFY take two atomic sentences p, q and return
    a substitution that make p and q look the same
  • UNIFY (p,q) ?, where SUBST(?,p) SUBST(?,q)
  • ? Unifier of the two sentence
  • UNIFY (Knows(John,x), Knows(y, Leonid))
    x/Leonid, y/John
  • Standardize apart rename the variables to avoid
    name clashes
  • UNIFY (Knows(John,x), Knows(x, Elizabeth))
    UNIFY(Knows(John,x1), Knows(x2, Elizabeth))
  • x1/Elizabeth, x2/John
  • Most General Unifier (MSU) UNIFY returns the
    substitution that makes the least commitment
    about the binding of variables

40
Sample Proof
  • 4 Steps of proof
  • American(x) ? Weapon(y) ? Nation(z) ? Hostile(z)
    ? Sells(x,z,y) ? Criminal(x)
  • Owns(Nono,x) ? Missle(x) ? Sells(West, Nono, x)
  • Missle(x) ? Weapon(x)
  • Enemy(x, America) ? Hostile(x)
  • Owns(Nono,M1) , Missle(M1), American(West),
    Nation(Nono), Enemy(Nono, America),
    Nation(America)

Criminal (West)
Sells(West, Nono, M1)
Weapon(M1)
Hostile(Nono)
41
Forward Chaining
  • Start with the sentences in the KB
  • Generate new conclusions with Modus Ponens
  • More inference with the conclusion and the
    sentences
  • Generally used when new fact is TELLed

42
Forward Chaining
  • Triggered by the addition of new fact p
  • Find all implications that have p as primise
  • Procedure FORWARD-CHAIN use two ideas
  • renaming one sentence is renaming of others if
    they are identical except the name of the
    variable
  • Likes (x, IceCream) Likes(y, IceCream)
  • composition substutions in turn
  • SUBST(COMPOSE(?1, ?2)) SUBST(?2, SUBST(?2, p))

43
Procedure FORWARD-CHAIN
  • PROCEDURE FORWARD-CHAIN(KB,p)
  • if sentence renaming of p exists in KB then
    return
  • add p to KB
  • for each (p1?? pn) ? q) in KB s.t. ? i
    UNIFY(pi,p) ? succeeds do
  • FIND-AND-INFER(KB, p1,, pi-1, pi1,,
    pn,q, ?)
  • end
  • PROCEDURE FIND-AND-INFER(KB, premises,conclusion,?
    )
  • if premise then
  • FORWARD-CHAIN(KB, SUBST(?, conclusion))
  • else for each p in KB s.t. UNIFY(p,SUBST(?,
    FIRST(Premises))) ?2 do
  • FIND-ND-INFER(KB, REST(premise),conclusion,
    COMPOSE(?, ?2))
  • end

44
Forward Chaining
  • Not directly towards goals
  • Data-driven, data-directed procedure
  • Forward chaining generate many irrelevant
    conclusions

45
Backward Chaining
  • Start with something we want to prove
  • Find implication sentences that allows to
    conclude
  • Attempt to establish their premises in turn
  • Uses Modus Ponens backwards
  • Applied when there is goal to be proved

46
Backward Chaining
  • Designed to find all answers to a question posed
    to KB
  • Functionality required for the ASK procedure
  • BACK-CHAIN
  • Check if answers can be provided from the
    sentence in KB
  • Try to establish the premises of implications

47
Procedure BACK-CHAIN
  • Function BACK-CHAIN(KB,q) returns a set of
    substitution
  • BACK-CHAIN-LIST(KB,q,)
  • function BACK-CHAIN-LIST(KB, qlist, ?) returns a
    set of substitution
  • if qlist is empty then return?
  • q ? First(qlist)
  • for each qi in KB s.t. ?i ? UNIFY(q, qi)
    succeeds do
  • Add COMPOSE(?, ?i) to answers
  • end
  • for each sentence(p1?? pn) ? q in KB s.t. ?i ?
    UNIFY(q, qi) succeeds do
  • answers ? BACK-CHAIN-LIST(KB,SUBST(?i
    ,p1,,pn), COMPOSE(?, ?i)) ?answers
  • end
  • return the union of BACK-CHAIN-LIST(KB,REST(qlist
    ), ?) for each ? ? answers

48
Completeness
  • ?x P(x) ? Q(x), ?x?P(x) ? R(x)
  • ?x Q(x) ? S(x), ?x R(x) ? S(x)
  • Modus Ponens cannot conclude S(A) incomplete

49
Resolution A Complete inference Procedure
  • Simple resolution
  • Modus ponens derives only atomic conclusions, but
    resolution derives new implications

???, ???? ????, ??? ???
????
50
The Resolution Inference Rule
  • Generalized Resolution disjunctions
  • for literals pi and qi, where UNIFY(pj , ?qk) ?
  • Generalized Resolution implications
  • For atoms pi, qi , ri, si where UNIFY(pj , qk) ?

p1 ? pj ? pn1 ? r1 ? rn2, s1 ? ? sn3 ?
q1 ? qk ? qn4 SUBST(?, (p1 ? pj-1 ? pj1
pn1 ? s1 ? ? sn3 ? r1 ? rn2 ? q1 ? qk-1 ?
qk1 ? qn4
51
Canonical Forms for resolution
  • Conjunctive Normal Form (CNF) conjunctions of
    disjunctions
  • Implicative Normal Form (INF) conjunctions in
    the premise, disjunctions in the conclusion

CNF ?P(w) ? Q(w) P(x) ? R(x) ?Q(y) ?
S(y) ?R(z) ? S(z)
INF P(w) ? Q(w) True ? P(x) ? R(x)
Q(y) ? S(y) R(z) ? S(z)
52
Resolution v.s. Modus Ponens
  • Resolution is a generalization of modus ponens

53
Resolution Proofs
P(w) ? Q(w)
Q(y) ? S(y)
y/w
True ? P(w) ? Q(w)
P(w) ? S(w)
x/w
R(z) ? S(z)
True ? S(x) ? R(x)
Premise
x/A, z/A
True ? S(A)
Conclusion, resolvent
Not still complete
54
Resolution Proof with Refutation
  • Complete inference procedure
  • refutation, proof by contradiction, reductio ad
    absurdum
  • To proof P,
  • assume P is false (add ?P to KB)
  • prove a contradiction
  • (KB ? ?P ? False) ? (KB ? P)

55
Refutation
P(w) ? Q(w)
Q(y) ? S(y)
y/w
P(w) ? S(w)
True ? P(x) ? R(x)
w/x
R(z) ? S(z)
True ? S(x) ? R(x)
z/x
True ? S(x)
S(A) ? False
x/A
True ? False
Contradiction
56
Conversion to Normal Form
  • Any first-order logic can be INF (or CNF)
  • Converting procedure
  • Eliminate implication
  • Move ? inwards
  • Standardize variable
  • Move qualifier left
  • Skolemize remove existential quantifiers
  • Distribute ? over ?
  • Flatten nested conjunctions and disjunctions
  • Convert disjunctions to implications

57
Converting CNF
  • Eliminate implication
  • p ? q ? ?p ? q
  • Move ? inwards negations are only allowed on
    atoms
  • ?(p?q) , ??x p , ??x (q?p)
  • Standardize variable unique variable name
  • (?x P(x)) ? (?x P(x))
  • Move quantifier left without changing meaning
  • p ? ?x q

58
Converting CNF
  • Skolemize remove existential quantifier
  • ? x P(x)
  • ?x Person(x) ? ?y Heart(y) ? Has(x,y)
  • Skolem function
  • Distribute ? over ?
  • (a ? b) ? c
  • Flatten nested conjunctions and disjunctions
  • (a ? b) ? c

59
Example
  • Jack owns a dog.
  • Every dog owner is an animal lover
  • No animal lover kills an animal
  • Either Jack or Curiosity killed the cat, who is
    named Tuna
  • Did curiosity killed the cat?

60
Dealing with Equality
  • P(A) and P(B) fail to unify, even if the sentence
    AB is in DB
  • Unification does only the syntactic test
  • Two ways to deal with equality
  • axiomatize by writing down its properties
  • ?x xx, ?x,y xy ? yy, ?x,y,z xy ? yz ? xz
  • ?x,y xy ? (P1(x) ? P1 (y))
  • ?x,y,z,w wy ? xz ? (F1 (w,x) F1(y,z))

61
Dealing with Equality
  • Demodulation for any terms x,y,z where
    UNIFY(x,z) ?

xy, ( z ) ( SUBST(?,y) )
62
Resolution Strategies
  • Guide the search toward a proof
  • Unit preference
  • prefers to do resolution where one of the
    sentence is a single literal (unit clause)
  • prefer inference that produce shorter sentences
  • does not reduce the branching factor

63
Resolution Strategies
  • Set of support
  • Every resolution combines a sentence from set of
    support
  • add resolvent into set of support
  • if set of support is small relative to KB, reduce
    search space significantly
  • bad choice will make the algorithm incomplete
  • remainder of the sentences are jointly
    satisfiable
  • Use the negated query as the set of support
  • goal-directed easy to understand

64
Resolution Strategies
  • Input resolution
  • every resolution combines one of input sentences
    (either query or sentence in KB)
  • shape of a diagonal spine Fig. 9.5, 9.6
  • complete for Horn form but incomplete in general
    case
  • linear resolution
  • allow P and Q to be resolved wither P is input
    sentence or P is ancestor of Q in the proof tree

65
Resolution Strategies
  • Subsumption
  • eliminate all sentences that are subsumed by an
    existing sentence in KB
  • remove P(A), P(A) ? Q(B) if P(x) is in KB
  • subsumption always keep KB smaller
Write a Comment
User Comments (0)
About PowerShow.com