plik


SUBST(, )   SUBST({x/Sam, y/P am}, Likes(x, y)) = Likes(Sam, P am) "   g "  SUBST({/g}, ) "x Likes(x, IceCream) {x/Ben} Likes(Ben, IceCream) "   k "  SUBST({/k}, ) "x Kill(x, V ictim) Kill(Murderer, V ictim) Murderer "x F ather(x, John) {x/John} F ather(John, John) "    g   " SUBST({g/}, ) Likes(Ian, IceCream) "x Likes(x, IceCream) " pi, p , i = 1, . . . , n q  i "i SUBST(, p ) = SUBST(, pi) i p , p , . . . , p , (p1 '" p2 '" . . . '" pn ! q) n 1 2 SUBST(, q) " " " " " " " " UNIFY p, q  p, q UNIFY(p, q) =  SUBST(, p) = SUBST(, q)  " UNIFY fail " Knows(John, x) ! Hates(John, x) " Knows(John, Jane) Knows(y, Leon) Knows(y, Mother(y)) Knows(x, Ellen) " UNIFY(Knows(John, x), Knows(John, Jane)) = {x/Jane} UNIFY(Knows(John, x), Knows(y, Leon)) = {x/Leon, y/John} UNIFY(Knows(John, x), Knows(y, Mother(y))) = {y/John, x/Mother(John)} UNIFY(Knows(John, x), Knows(x, Ellen)) = fail x John Ellen " p " p " p '" r '" . . . '" s ! q r, s, . . . q Likes(x, IceCream), Likes(y, IceCream) Likes(x, x), Likes(x, y) COMPOSE(1, 2) SUBST(COMPOSE(1, 2), p) = SUBST(2, SUBST(1, p)) procedure (KB, p) if KB p then return p KB for each(p1 '" . . . '" pn ! q) in KB i, UNIFY(pi, p) =  do (KB, [p1, . . . , pi-1, pi+1, . . . , pn], q, ) end procedure (KB, premises, conclusion, ) if premises = [ ] then (KB, SUBST(, conclusion)) else for each p in KB UNIFY(p , SUBST(, FIRST(premises))) = 2 do KB, REST(premises), conclusion, COMPOSE(, 2)) end " " " function (KB, q) returns (KB, [q], { }) function (KB, qlist, ) returns inputs KB qlist   local variables answers if qlist then return {} q ! FIRST(qlist) for each qi in KB i ! UNIFY(q, qi) do COMPOSE(, i) answers end for each (p1 '" . . . '" pn ! qi) in KB i ! UNIFY(q, qi) do answers ! ( KB, SUBST(i, [p1 . . . pn]), COMPOSE(, i)) *" answers end return (KB, REST(qlist), ) "answers "x P (x) ! Q(x) "x P (x) ! R(x) "x Q(x) ! S(x) "x R(x) ! S(x) S(A) {x/A} "x P (x) ! R(x) R if KB |=  then KB R  pi, qi UNIFY(pj, qk) =  p1 (" . . . pj . . . (" pm, q1 (" . . . qk . . . (" qn SUBST(, (p1 (" . . . pj-1 (" pj+1 . . . (" pm (" q1 (" . . . qk-1 (" qk+1 . . . (" qn)) pi, qi, ri, si UNIFY(pj, qk) =  p1'"...pj...'"pn1!r1("...("rn2, s1'"...'"sn3!q1("...qk...("qn4 SUBST(,(p1'"...pj-1'"pj+1...'"pn1'"s1'"...'"sn3!r1("...("rn2("q1("...qk-1("qk+1...("qn4)) P (w) (" Q(w) P (w) ! Q(w) P (x) (" R(x) T rue ! P (x) (" R(x) Q(y) (" S(y) Q(y) ! S(y) R(z) (" S(z) R(z) ! S(z) ,  !  T rue ! ,  !   T rue !  S(A) KB P (w) ! Q(w) Q(y) ! S(y) {y/w} P (w) ! S(w) T rue ! P (x) (" R(x) {w/x} T rue ! S(x) (" R(x) R(z) ! S(z) {x/A, z/A} T rue ! S(A) (" S(A) S(A) (" S(A) = S(A) T rue ! S(A) S(A) KB P (w) ! Q(w) Q(y) ! S(y) {y/w} P (w) ! S(w) T rue ! P (x) (" R(x) {w/x} T rue ! S(x) (" R(x) R(z) ! S(z) {z/x} T rue ! S(x) S(A) ! F alse (KB '" P ! F alse) ! (KB ! P ) T rue ! F alse p ! q a" p (" q ("x P (x)) (" ("x Q(x)) p (p (" q) a" p '" q x p (" "x q (p '" q) a" p (" q "x p (" q "x p a" "x p "x p a" "x p p a" p " "x P (x) P (A) A (a (" b) (" c (a (" b (" c) (a '" b) '" c (a '" b '" c) "x P erson(x) ! "y Heart(y) '" Has(x, y) "x P erson(x) ! Heart(F (x)) '" Has(x, F (x)) '" (" (a '" b) (" c (a (" c) '" (b (" c) (a (" b("c("d) (a'"b ! c("d) "x Dog(x) '" Owns(Jack, x) Dog(D) Owns(Jack, D) "x ("y Dog(y) '" Owns(x, y)) ! Dog(y) '" Owns(x, y) ! AnimalLover(x) AnimalLover(x) "x AnimalLover(x) ! AnimalLover(x) '" Animal(y) '" ("y Animal(y) ! Kills(x, y)) Kills(x, y) ! F alse Kills(Jack, T una) (" Kills(Jack, T una) (" Kills(Curiosity, T una) Kills(Curiosity, T una) Cat(T una) Cat(T una) "x Cat(x) ! Animal(x) Cat(x) ! Animal(x) Dog(D) Dog(y) '" Owns(x, y) ! AnimalLower(x) AnimalLower(x) '" Animal(y) '" Kills(x, y) ! F alse {y/D} Owns(x, D) ! AnimalLower(x) Owns(Jack, D) Cat(T una) Cat(x) ! Animal(x) {x/Jack} {x/T una} AnimalLower(Jack) Animal(T una) {y/T una} Kills(Jack, T una) (" Kills(Curiosity, T una) AnimalLower(x) '" Kills(x, T una) ! F alse {x/Jack} Kills(Curiosity, T una) ! F alse Kills(Jack, T una) ! F alse { } Kills(Jack, T una) "w Kills(w, T una) { } Kills(w, T una) ! F alse F alse " " " " " " " " " " " " " " "pSymptom(p, T oothache) ! Disease(p, Cavity) "pSymptom(p, T oothache) ! Disease(p, GumDisease) (" Disease(p, ImpactedW isdom) "pDisease(p, Cavity) ! Symptom(p, T oothache) " " " " " " " " " " P (A) A P (Cavity) = 0.1 " P (A) " P (W eather = sunny) = 0.7 P (W eather = rain) = 0.2 P (W eather = cloudy) = 0.08 P (W eather = snow) = 0.02 P (Cavity|T oothache) = 0.8 P (A|B) B C P (A|B '" C) P (A '" B) P (A|B) = P (B) P (A '" B) = P (A|B)P (B) P (A '" B) = P (B|A)P (A) < 0, 1 > 0 d" P (A) d" 1 P (T rue) = 1 P (F alse) = 0 P (A (" B) = P (A) + P (B) - P (A '" B) X1, . . . , Xn P(X1, . . . , Xn) T oothache T oothache Cavity Cavity P(Cavity) = 0.06 + 0.04 = 0.10 P(Cavity (" T oothache) = 0.04 + 0.01 + 0.06 = 0.11 P(Cavity '" T oothache) 0.04 P(Cavity|T oothache) = = = 0.80 P(T oothache) 0.04 + 0.01 P(A '" B) = P(A|B)P(B) P(A '" B) = P(B|A)P(A) P(A|B)P(B) P(B|A) = P(A) P(S|M) = 0.5 P(M) = 1/50000 P(S) = 1/20 P(S|M)P(M) 0.51/50000 P(M|S) = = = 0.0002 P(S) 1/20 P(S|M)P(M) P(S|W )P(W ) P(M|S) = P(W |S) = P(S) P(S) P(S|W ) = 0.8 P(W ) = 1/1000 P(S|M) = 0.5 P(M) = 1/50000 P(M|S) P(S|M)P(M) 0.51/50000 1 = = = 80 P(W |S) P(S|W )P(W ) 0.81/1000 P(Z|X) , P(Z|Y ) P(Z|X '" Y ) P(X '" Y |Z)P(Z) P(Z|X '" Y ) = P(X '" Y ) Z X, Y P(Y |Z '" X) = P(Y |Z); P(X|Z '" Y ) = P (X|Z) X, Y Z n2 P(Y |X '" Z) P(Z|X '" Y ) = P(Z|Y ) P(Y |X) P(X|Z) P(Y |Z) = P(Z) P(X) P(Y |X) = P(X|Z)P(Y |Z) " " " " " " " " " " " " " Earthquake Earthquake Earthquake Burglary Burglary Burglary Alarm Alarm " " MaryCalls MaryCalls MaryCalls JohnCalls JohnCalls JohnCalls " " " Burglary Earthquake P (Alarm|Burglary, Earthquake) Alarm P(E) P(E) P(E) P(E) 0.002 0.002 0.002 0.002 Earthquake Earthquake Earthquake Earthquake Burglary Burglary Burglary Burglary P(B) P(B) P(B) P(B) B E P(A) B E P(A) B E P(A) B E P(A) B E P(A) 0.001 0.001 0.001 0.001 T T 0.95 T T 0.95 T T 0.95 T T 0.95 T T 0.95 Alarm Alarm Alarm T F 0.94 T F 0.94 T F 0.94 T F 0.94 T F 0.94 F T 0.29 F T 0.29 F T 0.29 F T 0.29 F T 0.29 F F 0.001 F F 0.001 F F 0.001 F F 0.001 F F 0.001 A A P(J) A P(J) A P(J) A P(J) MaryCalls MaryCalls MaryCalls MaryCalls JohnCalls JohnCalls JohnCalls JohnCalls A A P(M) A P(M) A P(M) A P(M) T T 0.90 T 0.90 T 0.90 T 0.90 T T 0.70 T 0.70 T 0.70 T 0.70 F F 0.05 F 0.05 F 0.05 F 0.05 F F 0.01 F 0.01 F 0.01 F 0.01

Wyszukiwarka

Podobne podstrony:
MSI 2006 w2
MSI 2006 w4
MSI 2006 w7
MSI 2006 w1
2006 04 Karty produktów
pca w3
W3, Wiazania atomowe
Egzamin zawodowy 2006
us intelligence exploitation of enemy material 2006
2006  mnozenie
Dz U 2006 Nr49 poz356

więcej podobnych podstron