Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python logic Tell me what you do with witches? Burn And what do you burn apart from witches? More witches! Shh! Wood! So, why do witches burn? [pause]

Similar presentations


Presentation on theme: "Python logic Tell me what you do with witches? Burn And what do you burn apart from witches? More witches! Shh! Wood! So, why do witches burn? [pause]"— Presentation transcript:

1 Python logic Tell me what you do with witches? Burn And what do you burn apart from witches? More witches! Shh! Wood! So, why do witches burn? [pause] B--... 'cause they're made of... wood? Good! Heh heh. Oh, yeah. Oh. So, how do we tell whether she is made of wood? []. Does wood sink in water? No. No, it floats! It floats! Throw her into the pond! The pond! Throw her into the pond! What also floats in water? Bread! Apples! Uh, very small rocks! ARTHUR: A duck! CROWD: Oooh. BEDEVERE: Exactly. So, logically... VILLAGER #1: If... she... weighs... the same as a duck,... she's made of wood. BEDEVERE: And therefore? VILLAGER #2: A witch! VILLAGER #1: A witch! 10/14

2 Progression Regression A PG based heuristic can give two things: 1. Goal-directedness 2. Consistency. Progression needs 1 more --So can get by without mutex propagation Regression needs 2 more. --So may need even higher consistency information than is provided by normal PG.

3 Use of PG in Progression vs Regression Progression –Need to compute a PG for each child state As many PGs as there are leaf nodes! Lot higher cost for heuristic computation –Can try exploiting overlap between different PGs –However, the states in progression are consistent.. So, handling negative interactions is not that important Overall, the PG gives a better guidance even without mutexes Regression –Need to compute PG only once for the given initial state. Much lower cost in computing the heuristic –However states in regression are “partial states” and can thus be inconsistent So, taking negative interactions into account using mutex is important –Costlier PG construction Overall, PG’s guidance is not as good unless higher order mutexes are also taken into account Historically, the heuristic was first used with progression planners. Then they used it with regression planners. Then they found progression planners do better. Then they found that combining them is even better. Remember the Altimeter metaphor..

4

5 Representation Reasoning

6

7

8

9

10

11 Assertions; t/f

12 Prop logic First order predicate logic (FOPC) Prob. Prop. logic Objects, relations Degree of belief First order Prob. logic Objects, relations Degree of belief Degree of truth Fuzzy Logic Time First order Temporal logic (FOPC)

13

14

15

16

17

18

19

20  is true in all worlds (rows) Where KB is true…so it is entailed

21 KB&~  False So, to check if KB entails , negate , add it to the KB, try to show that the resultant (propositional) theory has no solutions (must have to use systematic methods) Proof by model checking

22 Inference rules Sound (but incomplete) –Modus Ponens A=>B, A |= B –Modus tollens A=>B,~B |= ~A –Abduction (??) A => B,~A |= ~B –Chaining A=>B,B=>C |= A=>C Complete (but unsound) –“Python” logic How about SOUND & COMPLETE? --Resolution (needs normal forms)

23 If WMDs are found, the war is justified W=>J If WMDs are not found, the war is still justified ~W=>J Is the war justified anyway? |= J? Can Modus Ponens derive it? Need something that does case analysis

24 If WMDs are found, the war is justified W=>J If WMDs are not found, the war is still justified ~W=>J Is the war justified anyway? |= J? Can Modus Ponens derive it? Need something that does case analysis

25 Forward apply resolution steps until the fact f you want to prove appears as a resolvent Backward (Resolution Refutation) Add negation of the fact f you want to derive to KB apply resolution steps until you derive an empty clause

26 Don’t need to use other equivalences if we use resolution in refutation style ~J ~W ~ W V J W V J J If WMDs are found, the war is justified ~W V J If WMDs are not found, the war is still justified W V J Is the war justified anyway? |= J? J V J =J

27 10/16 Midterm next class Review session (by Minh) Friday 6pm (GWC 308) Also 5-6pm GWC110 on Monday Rao will be generally available on Monday (can hold review session too—in the morning—if there is need) Homework 3 solutions posted

28 Forward apply resolution steps until the fact f you want to prove appears as a resolvent Backward (Resolution Refutation) Add negation of the fact f you want to derive to KB apply resolution steps until you derive an empty clause Review

29 Don’t need to use other equivalences if we use resolution in refutation style ~J ~W ~ W V J W V J J If WMDs are found, the war is justified ~W V J If WMDs are not found, the war is still justified W V J Is the war justified anyway? |= J? J V J =J Review

30 Don’t need to use other equivalences if we use resolution in refutation style ~J ~W ~ W V J W V J W V ~W ~W J If WMDs are found, the war is justified ~W V J If WMDs are not found, the war is still justified W V J Either WMDs are found or they are not found W V ~W Is the war justified anyway? |= J? W V J J V J =J Resolution does case analysis

31 Prolog without variables and without the cut operator Is doing horn-clause theorem proving For any KB in horn form, modus ponens is a sound and complete inference Aka the product of sums form From CSE/EEE 120 Aka the sum of products form

32 Conversion to CNF form CNF clause= Disjunction of literals –Literal = a proposition or a negated proposition –Conversion: Remove implication Pull negation in Use demorgans laws to distribute disjunction over conjunction Separate conjunctions into clauses ANY propositional logic sentence can be converted into CNF form Try: ~(P&Q)=>~(R V W)

33 Need for resolution Yankees win, it is Destiny ~YVD Dbacks win, it is Destiny ~Db V D Yankees or Dbacks win Y V Db Is it Destiny either way? |= D? Can Modus Ponens derive it? Not until Sunday, when Db won DVY DVD == D Resolution does case analysis Don’t need to use other equivalences if we use resolution in refutation style ~D ~Y ~Y V D ~Db V D Y V Db Db D

34 Mad chase for empty clause… You must have everything in CNF clauses before you can resolve –Goal must be negated first before it is converted into CNF form Goal (the fact to be proved) may become converted to multiple clauses (e.g. if we want to prove P V Q, then we get two clauses ~P ; ~Q to add to the database Resolution works by resolving away a single literal and its negation –PVQ resolved with ~P V ~Q is not empty! –In fact, these clauses are not inconsistent (P true and Q false will make sure that both clauses are satisfied)

35 Steps in Resolution Refutation Consider the following problem –If the grass is wet, then it is either raining or the sprinkler is on GW => R V SP ~GW V R V SP –If it is raining, then Timmy is happy R => TH ~R V TH –If the sprinklers are on, Timmy is happy SP => TH ~SP V TH –If timmy is happy, then he sings TH => SG ~TH V SG –Timmy is not singing ~SG –Prove that the grass is not wet |= ~GW? GW R V SP TH V SP SG V SP SP TH SG Is there search in inference? Yes!! Many possible inferences can be done Only few are actually relevant --Idea: Set of Support At least one of the resolved clauses is a goal clause, or a descendant of a clause derived from a goal clause -- Used in the example here!!

36 Search in Resolution Convert the database into clausal form D c Negate the goal first, and then convert it into clausal form D G Let D = D c + D G Loop –Select a pair of Clauses C1 and C2 from D Different control strategies can be used to select C1 and C2 (e.g. set-of-support) –Resolve C1 and C2 to get C12 –If C12 is empty clause, QED!! Return Success (We proved the theorem; ) –D = D + C12 –End loop If we come here, we couldn’t get empty clause. Return “Failure” –Finiteness is guaranteed if we make sure that: we never resolve the same pair of clauses more than once; AND we use factoring, which removes multiple copies of literals from a clause (e.g. QVPVP => QVP)

37 Complexity of Inference Any sound and complete inference procedure has to be Co-NP- Complete (since model-theoretic entailment computation is Co-NP- Complete (since model-theoretic satisfiability is NP-complete)) Given a propositional database of size d –Any sentence S that follows from the database by modus ponens can be derived in linear time If the database has only HORN sentences (sentences whose CNF form has at most one +ve clause; e.g. A & B => C), then MP is complete for that database. –PROLOG uses (first order) horn sentences –Deriving all sentences that follow by resolution is Co-NP- Complete (exponential) Anything that follows by unit-resolution can be derived in linear time. –Unit resolution: At least one of the clauses should be a clause of length 1

38 Entailment by model checking We said entailment can be checked by truth table enumeration. Can we do the check without full enumeration? –SAT problem Given a set of propositions And a set of (CNF) clauses Find a model (an assignment of t/f values to propositions) that satisfies all clauses –k-SAT is a SAT problem where all clauses are length less than or equal to k »SAT is NP-complete; »1-SAT and 2-SAT are polynomial »k-SAT for k> 2 is NP-complete (so 3-SAT is the smallest k-SAT that is NP-Complete) –If we have a procedure for solving SAT problems, we can use it to compute entailment The sentence S is entailed, if negation of S, when added to the KB, gives a SAT theory that is unsatisfiable (NO MODEL) –CO-NP-Complete –SAT is useful for modeling many other “assignment” problems We will see use of SAT for planning; it can also be used for Graph coloring, n-queens, Scheduling and Circuit verification etc (the last thing makes SAT VERY interesting for Electrical Engineering folks)

39 Compiling Planning into SAT Init: At-R-E-0 & At-A-E-0 & At-B-E-0 Goal: In-A-1 & In-B-1 Graph: “cond at k => one of the supporting actions at k-1” In-A-1 => Load-A-1 In-B-1 => Load-B-1 At-R-M-1 => Fly-R-1 At-R-E-1 => P-At-R-E-1 Load-A-1 => At-R-E-0 & At-A-E-0 “Actions => preconds” Load-B-1 => At-R-E-0 & At-B-E-0 P-At-R-E-1 => At-R-E-0h ~In-A-1 V ~ At-R-M-1 ~In-B-1 V ~At-R-M-1 “Mutexes” Goals: In(A),In(B) One way of finding a k-length plan is to grow a k-length planning graph (with mutexes) and looking for a valid subgraph of this graph. If it is not found, extend the graph and try again

40 Lots of work in SAT solvers DPLL was the first (late 60’s) Circa 1994 came GSAT (hill climbing search for SAT) Circa 1997 came SATZ Circa 1998-99 came RelSAT ~2000 came CHAFF Current best can be found at –http://www.satlive.org/SATCompetition/2003/results.html


Download ppt "Python logic Tell me what you do with witches? Burn And what do you burn apart from witches? More witches! Shh! Wood! So, why do witches burn? [pause]"

Similar presentations


Ads by Google