lec ecture 17 da datal alog og int ntro o to o prob obabi
play

Lec ecture 17 Da Datal alog og Int ntro o to o Prob obabi - PowerPoint PPT Presentation

Computer Science CPSC 322 Lec ecture 17 Da Datal alog og Int ntro o to o Prob obabi bility 1 Lect cture re O Overvi rview Recap of Lecture 16 TD: soundness and completeness SLD Resolution in Datalog Intro to


  1. Computer Science CPSC 322 Lec ecture 17 Da Datal alog og Int ntro o to o Prob obabi bility 1

  2. Lect cture re O Overvi rview • Recap of Lecture 16 • TD: soundness and completeness • SLD Resolution in Datalog • Intro to Reasoning Under Uncertainty • Introduction to Probability  Random Variables and Possible World Semantics  Probability Distributions (time permitting) 2

  3. Botto tom-up up proof oof p proc ocedu edure C :={}; repeat epeat sel elect ect clause “ h ← b 1 ∧ … ∧ b m ” in KB such that b i ∈ C for all i , and h ∉ C ; C := C ∪ { h } unt until no more clauses can be selected. KB ⊦ BU BU G if G ⊆ C at the end of this procedure The C at the end of BU procedure is a fixed point: • Further applications of our rule of derivation will not change C! Slide 3

  4. Proved t oved that hat bot bottom om-up pr up proof oof pr procedur ocedure e is sound ound and and compl omplet ete • BU is sound: it derives only atoms that logically follow from KB • BU is complete: it derives all atoms that logically follow from KB • Together: it derives exactly the atoms that logically follow from KB • And, it is efficient! • Linear in the number of clauses in KB  Each clause is used maximally once by BU 4

  5. Botto tom-up vs. vs. T Top-down own Top-down To wn Botto ttom-up up Query G C KB answer Query g is proven if g ∈ C KB • BU derives the same C Key ey Idea dea of of top op-do down: n: regardless of the query • Derivation process not guided by search backward from a query g to the query determine if it can be derived from KB . 5

  6. SLD R D Resol olut ution on • Rul ule e of of der derivat ation on: the SLD LD R Res esol olut ution on of clause s ← a 1 ∧ ... . ∧ a i-1 ∧ a i ∧ a i+1 1 … ∧ a m yes ye m on atom a i with the clause: a i ← b 1 ∧ ... .. ∧ b p is the answer clause s ← a 1 ∧ ... .. ∧ a i-1 ∧ b 1 ∧ ... . ∧ b p ∧ a i+ .. ∧ a m yes ye i+1 ... yes ← b ∧ c. yes ← e ∧ f. e . b ← k ∧ f. SLD resolution yes ← f yes← k ∧ f ∧ c 6

  7. Top-down own Proof oof P Proced edur ure f e for P PDCL CL To solve the query ? q 1 ∧ ... ∧ q k : ac:= yes ← body, where body is q 1 ∧ ... ∧ q k repea epeat select q i ∈ body; choose clause Cl ∈ KB, Cl is q i ← b c ; replace q i in body by b c until ac is an answer (fail if no clause with q i as head) unt select: any choice will work choose: have to pick the right one We showed soundness and completeness 8

  8. Top-down own/SLD r D resol olut ution on as as S Sear earch State: answer clause of the form yes ← a 1 ∧ ... ∧ a k Successor function: state resulting from substituting first atom a 1 with b 1 ∧ … ∧ b m if there is a clause a 1 ← b 1 ∧ … ∧ b m Goal test: is the answer clause empty (i.e. yes ← ) ? Prove: ? ← a ∧ d. Solution: the proof, i.e. the sequence of SLD resolutions a ← b ∧ c. a ← g. a ← h. b ← j. b ← k. d ← m. d ← p. f ← m. f ← p. g ← m. g ← f. k ← m. h ←m. p. 9

  9. Top-down own/SLD r D resol olut ution on as as S Sear earch State: answer clause of the form yes ← a 1 ∧ ... ∧ a k Successor function: state resulting from substituting first atom a 1 with b 1 ∧ … ∧ b m if there is a clause a 1 ← b 1 ∧ … ∧ b m Goal test: is the answer clause empty (i.e. yes ← ) ? Prove: ? ← a ∧ d. Solution: the proof, i.e. the sequence of SLD resolutions a ← b ∧ c. a ← g. a ← h. b ← j. b ← k. d ← m. d ← p. f ← m. f ← p. g ← m. g ← f. k ← m. h ←m. p. can trace the example in the Deduction Applet at http://aispace.org/deduction/ using file kb-for-top- down-search available in course schedule 10

  10. Deduc duction on Appl plet et Button to initiate the creation a new query Query creation panel Knowledge Base, which can be edited by switching to “create” mode” 11

  11. query By right clicking on a node and selecting “view proof deduction” the applet shows the tree with the resolution steps that led to that node 12

  12. Top-down own/SLD r D resol olut ution on as as S Sear earch State: answer clause of the form yes ← a 1 ∧ ... ∧ a k Successor function: state resulting from substituting first atom a 1 with b 1 ∧ … ∧ b m if there is a clause a 1 ← b 1 ∧ … ∧ b m Goal test: is the answer clause empty (i.e. yes ← ) ? Prove: ? ← a ∧ d. Solution: the proof, i.e. the sequence of SLD resolutions a ← b ∧ c. a ← g. a ← h. b ← j. b ← k. d ← m. d ← p. f ← m. f ← p. g ← m. g ← f. k ← m. h ←m. p. Pos ossibl ble H e Heur euristic? 13

  13. Search Graph KB a ← b ∧ c. a ← g. a ← h. b ← j. b ← k. d ← m. d ← p. f ← m. f ← p. g ← m. g ← f. k ← m. h ←m. p. Prove: ? ← a ∧ d. Pos ossibl ble H e Heur euristic? Number of atoms in the answer clause Admis issib ible le? A. Yes It takes at least that many steps to reduce all Atoms in the body of the answer clause 14

  14. Lect cture re O Overvi rview • Recap of Lecture 16 • TD: soundness and completeness • SLD Resolution in Datalog • Intro to Reasoning Under Uncertainty • Introduction to Probability  Random Variables and Possible World Semantics  Probability Distributions 15

  15. Is Top D p Down S wn Sound und and C d Compl plet ete? e? • When you have derived an answer with TD, you can find a corresponding BU a proof in the opposite direction. • try this one γ 0 : yes ← a γ 1 : yes ← e ∧ f γ 2 : yes ← e ∧ c γ 3 : yes ← c γ 4 : yes ← e γ 5 : yes ← 16

  16. Is Top D p Down S wn Sound und and C d Compl plet ete? e? • When you have derived an answer with TD, you can find a corresponding BU a proof in the opposite direction. • try this one a ← e ∧ f γ 0 : yes ← a γ 1 : yes ← e ∧ f f ← c c ← e γ 2 : yes ← e ∧ c γ 3 : yes ← c e γ 4 : yes ← e Definite clauses that generated γ 5 : yes ← this derivation BU applied to these clauses give the BU derivation for a

  17. Is Top D p Down S wn Sound und and C d Compl plet ete? e? • When you have derived an answer, you can find a corresponding BU proof in the opposite direction. • Every top-down derivation corresponds to a bottom up proof and every bottom up proof has a top-down derivation • try with example in next slide 18

  18. Botto tom-up up v vs T TD p proof oof KB C := {}; z ← f ∧ e repe peat at q ← r ∧ g ∧ e select clause h ← b 1 ∧ … ∧ b m in KB such that b i ∈ C for all i, and h ∉ C; e ← a ∧ b C := C ∪ {h} a unt until no more clauses can be selected. b Is q a logical consequence? Find a corresponding TD r proof g {a} {a,b} {a, b, r} {a, b, r, g} {a, b, r, g, e} {a, b, r, g, e, q} 19

  19. Botto tom-up up v vs T TD p proof oof KB C := {}; repe peat at z ← f ∧ e select clause h ← b 1 ∧ … ∧ b m in KB q ← r ∧ g ∧ e such that b i ∈ C for all i, and h ∉ C; C := C ∪ {h} e ← a ∧ b unt until no more clauses can be selected. a Is q a logical consequence? Find a corresponding TD proof b γ 0 : yes ← q {a} r γ 1 : yes ← r ∧ g ∧ e {a,b} g γ 2 : yes ← g ∧ e {a, b, r} {a, b, r, g} γ 3 : yes ← e {a, b, r, g, e} γ 4 : yes ← a ∧ b {a, b, r, g, e, q} γ 5 : yes ← b γ 6 : yes ← 20

  20. Is Top D p Down S wn Sound und and C d Compl plet ete? e? • Every top-down derivation corresponds to a bottom up proof and every bottom up proof has a top-down derivation • This equivalence can be used to prove the soundness and completeness of the derivation procedure. 21

  21. Try t y to Sh Show If KB ⊦ TD G then KB |=G • That TD is sounds • That TD is complete If KB |=G then KB ⊦ TD G Using the fact that every top-down derivation corresponds to a bottom up proof and every bottom up proof has a top-down derivation 22

  22. Sound und If KB ⊦ TD G then KB |=G • If KB ⊦ TD G there is a top down derivation for G • Therefore there is a bottom up derivation of G. • Therefore G is in C and KB |=G (because BU is sound) 23

  23. Comple lete te If KB |=G then KB ⊦ TD G • If KB |=G then we can find a bottom-up derivation for G (because BU is complete) • Therefore there is a top-down derivation as well, which we can find because the search space is finite. • Therefore KB ⊦ TD G 24

  24. Repre epresentation n and and Reaso easoning in n com compl plex dom domai ains • What we need is a more • Expressing knowledge natural way to consider with propositions can be individuals and their properties quite limiting up( s 2 ) up_s 2 up( s 3 ) up_s 3 ok( cb 1 ) ok_cb 1 ok( cb 2 ) ok_cb 2 live( w 1 ) live_w 1 connected( w 1 , w 2 ) connected_w 1 _w 2 E.g. there is no notion that Now there is a notion that w 1 is the same in live_w 1 w 1 is the same in live(w 1 ) and in connected_w 1 _w 2 and in connected(w 1 , w 2 ) up_s 1 and up_s 3 are about the up is the same in up(s 1 ) same property and up (s 3 ) 25

  25. Lect cture re O Overvi rview • Recap of Lecture 16 • TD: soundness and completeness • SLD Resolution in Datalog • Intro to Reasoning Under Uncertainty • Introduction to Probability  Random Variables and Possible World Semantics  Probability Distributions 26

Recommend


More recommend