60 likes | 170 Views
Notes for Yuliya Spring 2011 Presentation, page 5. Input: Output: p :- q. Answer: 1 Answer set: p :- q. Answer: 1 q :- not r. Answer set: q p
E N D
Notes for Yuliya Spring 2011 Presentation, page 5 Input: Output: p :- q. Answer: 1 Answer set: p :- q. Answer: 1 q :- not r. Answer set: q p % Since r is not in a head, it can never be in an answer set. But, what about the sets {p}, {q}, % and {p, q}? p :- not q. Answer: 1 q :- not p. Answer set: p Answer: 2 Answer set: q % Can the set {p} be an answer? Can the set {q} be an answer? Can the set {p, q} be an % answer?
Notes for Yuliya Spring 2011 Presentation, page 6 Input: Output: p :- q. Answer: 1 q :- not r. Answer set: t s p q {s,t} :- p. Answer: 2 % s and t can be true but they don’t need to be true. :- s, not t. Answer set: p q % s and not t gives false. Answer: 3 Answer set: t p q % Since r is not in a head, it can never be in an answer set. % p and q are obvious but by the third rule, if p and q are true, then the following are possible: s, p, q % but this is not allowed because of rule 4. t, p, q s, t, p, q Excluded Middle would be {p} :- i.e., p can be true or not true.
Notes for Yuliya Spring 2011 Presentation, page 10 male(mrAstor;mrBlake;mrCrane;mrDavis). % is shorthand for male(mrAstor). male(mrBlake). male(mrCrane). male(mrDavis). % In married(P,P1) :- married(P1,P), person(P;P1). % person(P;P1) is only necessary for some grounders, e.g., lparse
Notes for Yuliya Spring 2011 Presentation, page 11 %every person is assigned a spot 1{place(P,S): spot(S)}1:-person(P). % the first “1” means for there is at least 1 and the second “1” means no more than 1.
Notes for Yuliya Spring 2011 Presentation, page 12 % two people cannot occupy the same spot :-place(P1,S), place(P2,S), P1!=P2, spot(S), person(P1;P2). Notice the head is blank which means it’s false, so, for different persons P1 and P2 it is impossible to be located at the same spot S. % Mr Blake sat next to Mrs Astor on her left. :- place(mrsAstor,S), not place(mrBlake,S+1), spot(S). % It’s not possible for mrsAstor to be at a place that is not one spot away from mrBlake. :- place(mrBlake,S1), not place(mrsCrane,S2), opposite(S1,S2), spot(S1;S2). % It’s not possible for mrBlake to be at a place that is not opposite of mrsCrane.
Lewis Carroll Logical Paradox % Excluded Middle, someone is in or out but not both at the same time. 1. {out(A)} :- % If someone is not out then they are in. 2. in(A) :- not out(A). % It is not possible for a, b, and c to be out. 3. :- out(a), out(b), out(c). % a cannot be in without b being in, i.e., a cannot go out without b. 4. in(b) :- in(a). % Assume 5. out(c). out(a), out(b), out(c). X because of 3 out(a), out(b), in(c). X because of 1 and 5 out(a), in(b), out(c). out(a), in(b), in(c). X because of 1 and 5 in(a), out(b), out(c). X because of 4 in(a), out(b), in(c). X because of 4 and (1 and 5) in(a), in(b), out(c). in(a), in(b), in(c). X because of 1 and 5