1 / 31

Inferensi pada Kalkulus Predikat Orde 1

Inferensi pada Kalkulus Predikat Orde 1. Instansiasi Universal (IU). Instansiasi untuk quantifier universal:  v α Subst({v/g}, α ) dimana v variabel dan g mensubstitusi v . Contoh:  x King ( x )  Greedy ( x )  Evil ( x ) menghasilkan:

gomer
Télécharger la présentation

Inferensi pada Kalkulus Predikat Orde 1

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. Inferensi pada Kalkulus Predikat Orde 1

  2. Instansiasi Universal (IU) • Instansiasi untuk quantifier universal: vαSubst({v/g}, α) dimana v variabel dan g mensubstitusi v. • Contoh: x King(x) Greedy(x)  Evil(x) menghasilkan: King(John) Greedy(John) Evil(John) King(Richard) Greedy(Richard) Evil(Richard) King(Father(John)) Greedy(Father(John)) Evil(Father(John)) . . .

  3. Instansiasi Eksistensial (IE) • Untuk kalimat α, variabel v, dan simbol konstanta k yang tidak muncul dimana pun pada basis pengetahuan: vα Subst({v/k}, α) • Contoh: xCrown(x) OnHead(x,John) menghasilkan: Crown(C1) OnHead(C1,John) C1 adalah simbol konstanta baru, disebut Skolem constant

  4. Reduksi ke Inferensi Proposional Misalkan BP berisi: x King(x)  Greedy(x)  Evil(x) King(John) Greedy(John) Brother(Richard,John) • Instansiasi kalimat universal, didapatkan: King(John)  Greedy(John)  Evil(John) King(Richard)  Greedy(Richard)  Evil(Richard) King(John) Greedy(John) Brother(Richard,John) • Setelah mengalami proposionalisasi, KB berisi simbol proposisi: King(John), Greedy(John), Evil(John), King(Richard), dll • Problem proposionalisasi: menciptakan kalimat2 yang tidak relevan.

  5. Unifikasi • Inferensi dilakukan dengan mencari substitusi θ, misalnya King(x) dan Greedy(x) cocok dengan King(John) and Greedy(y) θ = {x/John,y/John} • Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) {x/Jane} Knows(John,x) Knows(y,OJ) {y/John,x/OJ} Knows(John,x) Knows(y,Mother(y)) {y/John,x/Mother(y)} Knows(John,x) Knows(x,OJ) fail • Problem: lebih dari 1 kalimat menggunakan variabel yang sama • Solusi: mengganti nama variabel contohnya Knows(z17,OJ)

  6. Unifikasi • Unifikasi Knows(John,x) dan Knows(y,z) menghasilkan substitusi θ = {y/John, x/z } atau θ= {y/John, x/John, z/John} • Unifier pertama lebih general dari unifier kedua • Ada 1 most general unifier (MGU), pada contoh di atas: MGU = { y/John, x/z }

  7. Algoritma Unifikasi

  8. Algoritma Unifikasi

  9. Generalized Modus Ponens (GMP) p1', p2', … , pn', ( p1 p2 …  pnq) qθ p1' = King(John) p1 = King(x) p2' = Greedy(y) p2 = Greedy(x) θ = {x/John,y/John} q = Evil(x) q θ = Evil(John) • GMP digunakan pada BP yang berisi definite clauses (hanya 1 literal positif) • Asumsi: quantifier universal untuk semua variabel dimana pi'θ = piθ untuk semua i

  10. Contoh Basis Pengetahuan • 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 sold to it by Colonel West, who is American • Buktikan bahwa Colonel West adalah seorang kriminal

  11. Contoh BP ... it is a crime for an American to sell weapons to hostile nations: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Nono … has some missiles, i.e., x Owns(Nono,x)  Missile(x): Owns(Nono,M1) and Missile(M1) … all of its missiles were sold to it by Colonel West Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missiles are weapons: Missile(x)  Weapon(x) An enemy of America counts as "hostile“: Enemy(x,America)  Hostile(x) West, who is American … American(West) The country Nono, an enemy of America … Enemy(Nono,America)

  12. Algoritma Forward chaining

  13. Pembuktian Forward Chaining

  14. Pembuktian Forward Chaining

  15. Pembuktian Forward Chaining

  16. Algoritma Backward Chaining Algoritma ini menerapkan prinsip DFS

  17. Contoh Backward chaining State awal:goals = Criminal (West)θ = { }

  18. Contoh Backward chaining First(goals) = Criminal(West) {First(goals) : literal yang akan diproses}Subst(θ, First(goals))menghasilkanCriminal(West)Rule American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z) Criminal(x)firedUnify(Criminal(x), Criminal(West))menghasilkan θ’={x/West}shg θ = { x/West }New goals = [American(x), Weapon(y), Sells(x,y,z), Hostile(z)]

  19. Contoh Backward chaining First(goals) = American(x) Subst(θ, First(goals))menghasilkanAmerican(West)Rule American(West)firedUnify(American(West), American(West))menghasilkan θ’={}shg θ = { x/West }New goals = [Weapon(y), Sells(x,y,z), Hostile(z)]

  20. Contoh Backward chaining First(goals) = Weapon(y)Subst(θ, First(goals))menghasilkanWeapon(y)Rule Missile(y) Weapon(y)firedUnify(Weapon(y), Weapon(y))menghasilkan θ’={ }shg θ = { x/West }New goals = [Missile(y), Sells(x,y,z), Hostile(z)]

  21. Contoh Backward chaining First(goals) = Missile(y)Subst(θ, First(goals))menghasilkanMissile(y)Rule Missile(M1)firedUnify(Missile(M1), Missile(y))menghasilkan θ’={y/M1}shg θ={ x/West, y/M1}New goals = [Sells(x,y,z), Hostile(z)]

  22. Contoh Backward chaining First(goals) = Sells(x,y,z)Subst(θ, First(goals))menghasilkanSells(West,M1,z)Rule Missile(M1)  Owns(Nono,M1) Sells(West,M1,Nono)firedUnify(Sells(West,M1,Nono), Sells(West,M1,z))mhasilkan θ’={z/Nono}shg θ={ x/West, y/M1, z/Nono}New goals = [Missile(M1), Owns(Nono,M1),Hostile(z)]

  23. Contoh Backward chaining Proses seterusnya, dicoba sendiri yah…

  24. Resolusi • Versi first-order: l 1···l k, m 1···m n (l 1···l i-1l i+1 ···l km1···m j-1m j+1···m n)θ dimana Unify(l i, mj) = θ. • Dua klausa yang diasumsikan standardized apart maka mereka tidak menggunakan variabel yang sama • Contoh: Rich(x) Unhappy(x) Rich(Ken) Unhappy(Ken) dimana θ = {x/Ken} • Lakukan langkah-langkah resolusi pada CNF (BP α), α adalah pernyataan yang harus dibuktikan

  25. Konversi ke CNF(CNF=conjunctive normal form) • Everyone who loves all animals is loved by someone: x [y Animal(y) Loves(x,y)]  [y Loves(y,x)] • 1. Eliminasi bikondisional dan implikasi x [y Animal(y) Loves(x,y)]  [yLoves(y,x)] • 2. Hapus  di depan quantifier: x p ≡x p,  x p ≡x p x [y (Animal(y) Loves(x,y))]  [y Loves(y,x)] x [y Animal(y) Loves(x,y)]  [y Loves(y,x)] x [y Animal(y) Loves(x,y)]  [y Loves(y,x)]

  26. Konversi ke CNF(CNF=conjunctive normal form) • Standarkan variabel: setiap quantifier harus menggunakan variabel yang berbeda x [y Animal(y) Loves(x,y)]  [z Loves(z,x)] • Skolemisasi: bentuk yang lebih general dari instansiasi eksistensial Setiap variabel eksistensial diganti dengan fungsi Skolem dari variabel dengan quantifier universal: x [Animal(F(x)) Loves(x,F(x))] Loves(G(x),x) • Hapus quantifier universal : [Animal(F(x)) Loves(x,F(x))] Loves(G(x),x) • Distribusi : [Animal(F(x)) Loves(G(x),x)]  [Loves(x,F(x)) Loves(G(x),x)]

  27. Resolusi - Refutasi • Resolusi adalah teknik untuk membuktikan sebuah pernyataan pada logika proposional atau kalkulus predikat • Refutasi=resolusi, membuktikan teorema dengan menegasikan pernyataan yang harus dibuktikan dan menambahkannya ke kumpulan aksioma yang diketahui benar • Semua aksioma dalam bentuk normal yaitu sebuah kalimat atau disjungsi beberapa kalimat • Pernyataan terbukti benar jika refutasi menghasilkan kalimat kosong

  28. Contoh Refutasi (1)

  29. Contoh Refutasi (2) All people who are not poor and are smart are happy. Those people who read are not stupid. John can read and is wealthy. Happy people have exciting lives. Can anyone be found with an exciting life? x (Poor(x)  Smart(x)  Happy(x)) y (Read(y)  Smart(y)) Read(John)  Wealthy(John) z (Happy(z)  Exciting(z)) Goal: Exciting(w)

  30. Refutasi - Kasus Transformasi kalkulus predikat ke disjungsi kalimat: Poor(x)   Smart(x)  Happy(x)  Read(y)  Smart(y) Read(John)  Poor(John) Happy(z)  Exciting(z))  Exciting(w) {z/w} pada contoh ini berarti z mensubstitusi w

  31. Contoh Refutasi (3) Anyone passing his history exam and winning the lottery is happy. But anyone who studies or is lucky can pass all his exams. John did not study but he is lucky. Anyone who is lucky wins the lottery. Is John happy? x (Pass(x, History)  Win(x, Lottery)  Happy(x)) 1 x y (Study(x)  Lucky(x)  Pass(x,y)) 2 3  Study(John)  Lucky(John) 4 5 x (Lucky(x)  Win(x, Lottery)) 6 Goal: Happy(John) 7

More Related