370 likes | 390 Views
Explore formal modeling examples in CPSC 433 Artificial Intelligence course, focusing on propositional logic and modeling techniques involving clauses.
E N D
And-Tree Search ModelingExample – Model Elimination CPSC 433 T01 & T02 Andrew Kuipers CPSC 433 Artificial Intelligence
The Formal Model C – the set of all clauses (our formal language) Prob,me 2C Solution Definition Erw,me((pr, ?), (pr, yes)) if P,P’pr, where = mgu(P,P’) Branching Definition Erw,me((pr0,?),(pr0,?,pr1,…,prn)) where pr0 = Q {L1…Ln} and pri = Q {L1…Ln, Li}, 1 i n and for some j s.t 1 j n : Erw,me((prj, ?), (prj, yes)) CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 6 {p,p},? {p,r},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 6 {p,p},? {p,r},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 6 {p,p},y {p,r},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 6 {p,p},y {p,r},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 4 6 {p,p},y {p,r},? {s,s},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 4 6 {p,p},y {p,r},? {s,s},y CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 4 6 {p,p},y {p,r},? {s,s},y CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 4 6 {p,p},y {p,r},? {s,s},y 1 {p,r,s},? {p,r,r},? {p,r,p},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 4 6 {p,p},y {p,r},? {s,s},y 1 {p,r,s},? {p,r,r},y {p,r,p},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 4 6 {p,p},y {p,r},? {s,s},y 1 {p,r,s},? {p,r,r},y {p,r,p},y CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 4 6 {p,p},y {p,r},? {s,s},y 1 {p,r,s},? {p,r,r},y {p,r,p},y CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 4 6 {p,p},y {p,r},? {s,s},y 1 {p,r,s},? {p,r,r},y {p,r,p},y 4 {p,r,s,s},? CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 4 6 {p,p},y {p,r},? {s,s},y 1 {p,r,s},? {p,r,r},y {p,r,p},y 4 {p,r,s,s},y CPSC 433 Artificial Intelligence
A Propositional Example 1) r p s 2) s q 3) p s 4) s 5) s p 6) p r { },? 3 {p},? {s},? 4 6 {p,p},y {p,r},? {s,s},y 1 {p,r,s},? {p,r,r},y {p,r,p},y 4 search complete! {p,r,s,s},y CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? • = { } CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? • = { } CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 {P(z),P(x)},? {P(z),R(x)},? {P(z),Q(y)},? • = { } CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 {P(z),P(x)},y {P(z),R(x)},? {P(z),Q(y)},? • = { z x } CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 {P(z),P(x)},y {P(z),R(x)},? {P(z),Q(y)},? 5 • = { z x } {P(z),Q(y),Q(b)},? CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 {P(z),P(x)},y {P(z),R(x)},? {P(z),Q(y)},? 5 • = { z x, y b } {P(z),Q(y),Q(b)},y CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 {P(z),P(x)},y {P(z),R(x)},? {P(z),Q(y)},? 6 5 • = { z x, y b } {P(z),Q(y),Q(b)},y {P(z),R(x),R(b)},? CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 {P(z),P(x)},y {P(z),R(x)},? {P(z),Q(y)},? 6 5 • = { z x, y b, x b } {P(z),Q(y),Q(b)},y {P(z),R(x),R(b)},y CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 {P(z),P(x)},y {P(z),R(x)},? {P(z),Q(y)},? 6 5 • = { z b, y b, x b } {P(z),Q(y),Q(b)},y {P(z),R(x),R(b)},y substitute! CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 4 {P(z),P(x)},y {P(z),R(x)},? {Q(z),Q(a)},? {P(z),Q(y)},? 6 5 • = { z b, y b, x b } {P(z),Q(y),Q(b)},y {P(z),R(x),R(b)},y CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 4 {P(z),P(x)},y {P(z),R(x)},? {Q(z),Q(a)},? {P(z),Q(y)},? 6 can’t add z a! 5 • = { z b, y b, x b } {P(z),Q(y),Q(b)},y {P(z),R(x),R(b)},y CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 backtrack! {P(z),P(x)},y {P(z),R(x)},? {P(z),Q(y)},? 6 5 • = { z b, y b, x b } {P(z),Q(y),Q(b)},y {P(z),R(x),R(b)},y CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 5 {P(z),P(x)},y {P(z),R(x)},? {Q(z),Q(b)},? {P(z),Q(y)},? 6 5 • = { z b, y b, x b } {P(z),Q(y),Q(b)},y {P(z),R(x),R(b)},y CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 5 {P(z),P(x)},y {P(z),R(x)},? {Q(z),Q(b)},y {P(z),Q(y)},? 6 5 • = { z b, y b, x b } {P(z),Q(y),Q(b)},y {P(z),R(x),R(b)},y CPSC 433 Artificial Intelligence
A First-Order Example 1) P(x) Q(y) R(x) 2) P(a) 3) P(z) Q(z) 4) Q(a) 5) Q(b) 6) R(b) { }, ? 3 {P(z)},? {Q(z)},? 1 5 {P(z),P(x)},y {P(z),R(x)},? {Q(z),Q(b)},y {P(z),Q(y)},? 6 5 • = { z b, y b, x b } {P(z),Q(y),Q(b)},y {P(z),R(x),R(b)},y search complete! CPSC 433 Artificial Intelligence