Fi Fini nish sh Lo Logi gics cs St Star art t St Stoc ochas hastic tic En Envi viro ronment nments Computer ter Sc Science ce cpsc3 c322 22, , Lectur ture e 8 Te Textbo tbook ok Chpt 5.2 & & Chpt 12 12 Chpt 6.1 May, y, 31, 2012 CPSC 322, Lecture 8 Slide 1
Lecture cture Ov Overview view • Finish Logics • Recap Top Down + TD as Search • Datalog Start Stochastic Environments • Intro to Probability • Semantics of Probability • Marginalization • Conditional Probability and Chain Rule • Bayes' Rule and Independence CPSC 322, Lecture 8 Slide 2
To Top-down down Gr Ground und Proof of Procedure cedure Ke Key Idea: a: search backward from a query G to determine if it can be derived from KB . CPSC 322, Lecture 8 Slide 3
To Top-down down Proof of Procedure: cedure: Basic ic elements ments Not otat ation ion : An answer clause is of the form: yes ← a 1 ∧ a 2 ∧ … ∧ a m Expres Ex ess s query as an answer clause (e.g., query a 1 ∧ a 2 ∧ … ∧ a m ) yes ← Rule of infere renc nce (called SLD Resolution) Given an answer clause of the form: yes ← a 1 ∧ a 2 ∧ … ∧ a m and the clause: a i ← b 1 ∧ b 2 ∧ … ∧ b p You can generate the answer clause yes ← a 1 ∧ … ∧ a i-1 ∧ b 1 ∧ b 2 ∧ … ∧ b p ∧ a i+1 ∧ … ∧ a m CPSC 322, Lecture 8 Slide 4
• Su Succes essful sful De Derivati ation on : When by applying the inference rule you obtain the answer clause yes ← . a ← e ∧ f. a ← b ∧ c. b ← k ∧ f. c ← e. d ← k. e . f ← j ∧ e. f ← c. j ← c. Query: a (two ways) yes ← a. yes ← a. CPSC 322, Lecture 8 Slide 5
Lecture cture Ov Overview view • Finish Logics • Recap Top Down + TD as as Sea earch • Datalog Start Stochastic Environments • Intro to Probability • Semantics of Probability • Marginalization • Conditional Probability and Chain Rule • Bayes' Rule and Independence CPSC 322, Lecture 8 Slide 6
Syste stematic matic Sea earch h in in di diff ffer eren ent t R&R syste stems ms Constrai aint nt Satisfac facti tion on (Problems ems): • State: assignments of values to a subset of the variables • Successor function: assign values to a “free” variable • Goal test: set of constraints • Solution: possible world that satisfies the constraints • Heuristic function: none (all solutions at the same distance from start) Planni nning ng (forward) : • State possible world • Successor function states resulting from valid actions • Goal test assignment to subset of vars • Solution sequence of actions • Heuristic function empty-delete-list (solve simplified problem) Logical l Infe feren rence ce (top Do Down wn) • State answer clause • Successor function states resulting from substituting one atom with all the clauses of which it is the head • Goal test empty answer clause • Solution start state • Heuristic function ……………….. CPSC 322, Lecture 8 Slide 7
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. He Heurist istics? ics?
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. Possible Heuristic? Number of atoms in the answer clause Admissible? Yes No
Sta tandard ndard Search rch vs. . Specific cific R&R system tems Constraint Satisfaction (Problems): • State: assignments of values to a subset of the variables • Successor function: assign values to a “free” variable • Goal test: set of constraints • Solution: possible world that satisfies the constraints • Heuristic function: none (all solutions at the same distance from start) Planning : • State possible world • Successor function states resulting from valid actions • Goal test assignment to subset of vars • Solution sequence of actions • Heuristic function empty-delete-list (solve simplified problem) Logical Inference • State answer clause • Successor function states resulting from substituting one atom with all the clauses of which it is the head • Goal test empty answer clause • Solution start state • Heuristic function number of atoms in given state CPSC 322, Lecture 7 Slide 10
Lecture cture Ov Overview view • Finish Logics • Recap Top Down + TD as Search • Dat atal alog og Start Stochastic Environments • Intro to Probability • Semantics of Probability • Marginalization • Conditional Probability and Chain Rule • Bayes' Rule and Independence CPSC 322, Lecture 8 Slide 11
Representation presentation and Reasoning soning in Complex mplex domains ains • It is often natural to • In complex domains consider indivi vidua uals ls and expressing knowledge their properti rties es with proposit sition ions can be 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 ) There is no notion that up_s 2 live_w 1 up_s 3 connected_w 1 _w 2 CPSC 322, Lecture 8 Slide 12
What do we gain…. By breaking propositions into relations applied to individuals? • Express knowled edge ge that holds s for set of indivi vidu duals ls (by introducing ) live(W) <- connected_to(W,W1) ∧ live(W1) ∧ wire(W) ∧ wire(W1). • We can ask generic ic queries es (i.e., containing ) ? connected_to(W, w 1 ) CPSC 322, Lecture 8 Slide 13
Datalog talog vs PDCL L (bett tter er wi with colors) s) CPSC 322, Lecture 8 Slide 14
Datalog: Da og: a r relati tional nal rule language Datalog expands the syntax of PDCL …. A variable is a symbol starting with an upper case letter Examples: X, Y A constant is a symbol starting with lower-case letter or a sequence of digits. Examples: alan, w1 A term is either a variable or a constant. Examples: X, Y, alan, w1 A predicate symbol is a symbol starting with a lower-case letter. Examples: live, connected, part-of, in
Datalog talog Syntax tax (cont nt ’ d) An atom is a symbol of the form p or p ( t 1 …. t n ) where p is a predicate symbol and t i are terms Examples: sunny, in(alan,X) A definite clause is either an atom (a fact) or of the form: h ← b 1 ∧ … ∧ b m where h and the b i are atoms (Read this as `` h if b .'') Example: in(X,Z) ← in(X,Y) ∧ part-of(Y,Z) A knowledge base is a set of definite clauses
Datalog talog: : To Top Down n Proof of Procedure cedure in(alan, r123). part_of(r123,cs_building). in(X,Y) part_of(Z,Y) & in(X,Z). • Extension of Top-Down procedure for PDCL. How do we deal with variables? • Idea: - Find a clause with head that matches the query - Substitute variables in the clause with their matching constants • Example: Query: yes in(alan, cs_building). in(X,Y) part_of(Z,Y) & in(X,Z). with Y = cs_building X = alan yes part_of(Z,cs_building), in(alan, Z). • We will not cover the formal details of this process, called unification . See P&M Section 12.4.2, p. 511 for the details.
Example mple proof of of f a Datal talog og query ry in(alan, r123). part_of(r123,cs_building). in(X,Y) part_of(Z,Y) & in(X,Z). Query: yes in(alan, cs_building). Using clause: in(X,Y) part_of(Z,Y) & in(X,Z), with Y = cs_building X = alan yes part_of(Z,cs_building), in(alan, Z). Using clause: part_of(r123,cs_building) with Z = r123 yes in(alan, r123). Using clause: in(X,Y) Using clause: part_of(Z,Y) & in(X,Z). in(alan, r123). With X = alan Y = r123 yes . yes part_of(Z, r123), in(alan, Z). No clause with matching head: fail part_of(Z,r123).
Tr Tracing cing Datal talog og proofs ofs in AIs Ispace ace • You can trace the example from the last slide in the AIspace Deduction Applet at http://aispace.org/deduction/ using file ex-Datalog available in course schedule • Question 4 of assignment 3 asks you to use this applet
Datalog: talog: queries ries with th variabl iables es in(alan, r123). part_of(r123,cs_building). in(X,Y) part_of(Z,Y) & in(X,Z). Query: in(alan, X1). yes(X1) in(alan, X1). What would the answer(s) be?
Datalog: talog: queries ries with th variabl iables es in(alan, r123). part_of(r123,cs_building). in(X,Y) part_of(Z,Y) & in(X,Z). Query: in(alan, X1). yes(X1) in(alan, X1). What would the answer(s) be? Again, you can trace the SLD derivation for this query yes(r123). in the AIspace Deduction Applet yes(cs_building).
Lo Logi gics s in in AI: I: Sim imil ilar ar sli lide de to to th the e on one f e for or pl plan anni ning ng Propositional Definite Semantics and Proof Clause Logics Theory Satisfiability Testing Propositional First-Order (SAT) Logics Logics Description Hardware Verification Production Systems Logics Product Configuration Ontologies Cognitive Architectures Semantic Web Video Games Summarization Tutoring Systems Information CPSC 322, Lecture 8 Slide 22 Extraction
Learning Goals for today’s class Yo You u can an: • Define/read/write/trace/debug the Top opDow own proof procedure (as a sea earch ch problem) • Represent simple domains in Dat atal alog og • Apply Top opDow own proof procedure in Dat atal alog og CPSC 322, Lecture 8 Slide 23
Recommend
More recommend