190 likes | 429 Views
Examples. Example. Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody. " x. $ y.loves( x, y) " u. " v. " w.(loves(v, w) Þ loves(u, v)) Ø" x. " y.loves( x, y) negated conclusion In clausal form they become: {loves(x, f( x))}
E N D
Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody. "x.$y.loves( x, y) "u."v."w.(loves(v, w) Þ loves(u, v)) Ø"x."y.loves( x, y) negated conclusion In clausal form they become: {loves(x, f( x))} {Øloves(v, w), loves(u, v)} {Øloves(jack, jill)}
{loves(x, f(x))} Premise • {Øloves(v, w), loves(u, v)} Premise • {Øloves(jack, jill)} Goal • {loves(u, x)} 1,2 • {} 4,3
Horses, dogs, and rabbits Every horse can outrun every dog. Some greyhounds can outrun every rabbit. Show that every horse can outrun every rabbit. "x."y.(Horse( x) Ù Dog( y) Þ Faster( x, y)) $y.(Greyhound(y) Ù "z.(Rabbit( z) Þ Faster( y, z))) "y.(Greyhound( y) Þ Dog( y)) (background knowledge) "x."y."z.(Faster(x, y) Ù Faster( y, z) Þ Faster( x, z)) (background knowledge) Ø"x."y.(Horse(x) Ù Rabbit(y) Þ Faster(x, y)) negated conclusion
"x."y.(Horse( x) Ù Dog( y) Þ Faster( x, y)) $y.(Greyhound(y) Ù "z.(Rabbit( z) Þ Faster( y, z))) "y.(Greyhound( y) Þ Dog( y)) "x."y."z.(Faster(x, y) Ù Faster( y, z) Þ Faster( x, z)) Ø"x."y.(Horse(x) Ù Rabbit(y) Þ Faster(x, y)) In clausal form they become: {ØHorse( x), ØDog(y), Faster( x, y)} {Greyhound(Greg)} {ØRabbit(z), Faster(Greg, z)} {ØGreyhound(y), Dog(y)} {ØFaster(x, y), ØFaster(y, z), Faster(x, z)} …continued
Let’s transform the goal into clausal form: Ø"x."y.(Horse(x) Ù Rabbit(y) Þ Faster(x, y)) IØ"x."y.(Ø(Horse(x) Ù Rabbit(y)) ÚFaster(x, y)) NØ"x."y.(ØHorse(x) Ú ØRabbit(y) ÚFaster(x, y)) x. y.(Horse(x) Ù Rabbit(y) Ù ØFaster(x, y)) Sx. y.(Horse(x) Ù Rabbit(y) Ù ØFaster(x, y)) E Horse(Jack) Ù Rabbit(Smith) Ù ØFaster(Jack, Smith)) A Horse(Jack) Ù Rabbit(Smith) Ù ØFaster(Jack, Smith)) D Horse(Jack) Ù Rabbit(Smith) Ù ØFaster(Jack, Smith)) O {Horse(Jack)} {Rabbit(Smith)} {ØFaster(Jack, Smith)}
Let’s try to infer the {} using resolution: • {ØHorse(x), ØDog(y), Faster(x, y)} • {Greyhound(Greg)} • {ØRabbit(z), Faster(Greg, z)} • {ØGreyhound(y), Dog(y)} • {ØFaster(x, y), ØFaster(y, z), Faster(x, z)} • {Horse(Jack)} • {Rabbit(Smith)} • {ØFaster(Jack, Smith)} • {ØDog(y), Faster(Jack, y)} 1,6 • {Faster(Jack, y), ØGreyhound(y)} 4,9 • {Faster(Jack, Greg)} 2,10 • {Faster(Greg, Smith)} 3,7 • {ØFaster(Greg, z), Faster(x, z)} 5,11 • {Faster(x, Smith)} 12,13 • {} 8,14
Linear Restriction Strategy • A linear resolution is one in which one of the parents is in the initial database or an ancestor of the other parent. • Example. 1. {p, q} 2. {p,Øq} 3. {Øp, q} 4. {Øp,Øq} 5. {p} 1,2 6. {q} 3,5 7. {Øp} 4,6 8. {} 5,7 Linear Resolution is refutation complete!!
Theo • Theo is theorem prover based on linear resolution (as well as other resolution strategies besides linearity) • Accepts input in clausal form. • Uses: ~ for | for (doesn’t use the set notation for clauses, but the OR, i.e. | notation, e.g. p(x) | q(y) instead of {p(x), q(y)}) • Distinguish variables from constants, by adding parenthesis. E.g. tuna(). • If you omit parenthesis and write instead just tuna, it will be considered a variable.
Clausal Curiosity (Theo format) animal(f(x1)) | loves(g(x1),x1) ~loves(x2,f(x2)) | loves(g(x2),x2) ~animal(y1) | ~kills(x3,y1) | ~loves(z,x3) ~animal(y2) | loves(jack,y2) kills(jack(),tuna()) | kills(curiosity(),tuna()) ~cat(x4) | animal(x4) cat(tuna()) negated_conclusion ~kills(curiosity(),tuna()) • {animal(f(x1)), loves(g(x1),x1)} • {loves(x2,f(x2)), loves(g(x2),x2)} • {animal(y1), kills(x3,y1), loves(z,x3)} • {animal(y2), loves(jack,y2)} • {kills(jack,tuna), kills(curiosity,tuna)} • {cat(x4), animal(x4)} • {cat(tuna)} • kills(curiosity,tuna)
Theo output Proof Found! Axioms: 1 >animalfx lovesgxx 2#>~lovesxfx lovesgxx 3 >~animalx ~killsyx ~loveszy 4 >~animalx lovesyx 5#>killsjacktuna killscuriositytuna 6 >~catx animalx 7 >cattuna Negated conclusion: 8S>~killscuriositytuna Phase 0 clauses used in proof: 9S>(8a*5b) killsjacktuna 10S>(9a*3b) ~animaltuna ~lovesxjack 11#>(10a*6b) ~lovesxjack ~cattuna 12S>(11b*7a) ~lovesxjack 15 >(4a*1a) lovesxfy lovesgyy 16 >(15a*2a) lovesgxx Phases 1 and 2 clauses used in proof: 17S>(16a,12a) []
Compile • You can create well formed formulas (WFF) i.e. FOL sentences and then convert into clausal form using “compile” • @ is forall • ! is exists • Variables and constants distinguished by quantification. Variables are quantified, constants aren’t. • Use ( and ) for functions and relations. • Use { and } for grouping sentences. • & is AND, | is OR, => is IMPLIES Example: @x: met_with_at_sea(x) & noticed_thing(x) => entered_in_log(x).
Books… ; The only books in this library, that I do not recommend for reading, are unhealthy in tone; ; The bound books are all well-written; ; All the romances are healthy in tone; ; I do not recommend that you read any of the unbound books. ; ; All the romances in this library are well-written. @x: book(x) & ~recommend(x) => ~healthy(x). @x: book(x) & ~healthy(x) => ~recommend(x). @x: book(x) & bound(x) => wellwritten(x). @x: romance(x) => healthy(x). @x: romance(x) => book(x). @x: book(x) & ~bound(x) => ~recommend(x). ; theorem (negated) ~{ @x: romance(x) => wellwritten(x) }.
Songs ; Things sold in the street are of no great value; ; Nothing but rubbish can be sold for a song; ; Eggs of the Great Auk are very valuable; ; It is only what is sold in the streets which is really rubbish. ; ; Conclusion: An egg of the Great Auk is not to be had for a song. @x: soldInStreet(x) => ~ofGreatValue(x). @x@y: exchange(y,x) & song(x) => rubbish(y). @x: greatAukEgg(x) => ofGreatValue(x). @x: rubbish(x) => soldInStreet(x). @x: soldInStreet(x) => rubbish(x). ; theorem (negated) ~{ ~{!x!y: greatAukEgg(y) & exchange(y,x) & song(x)} }.
Birds ; No birds, except ostriches, are 9 feet high; ; There are no birds in this aviary that belong to anyone but me; ; No ostrich lives on mince-pies; ; I have no birds less than nine-feet high. ; ; Conclusion: No bird in this aviary lives on mince-pies. @x: bird(x) & height(x,Nine) => ostrich(x). @x: ostrich(x) => bird(x). @x: bird(x) => belongs(x,Me). @x: ostrich(x) => ~lives(x,MincePies). @x: bird(x) & belongs(x,Me) => height(x,Nine). ;theorem (negated) ~{ @x: bird(x) => ~lives(x,MincePies) }.
British Lion ; No discussions in our Debating-Club can rouse the British Lion, so long as they are checked when they become too noisy; ; Discussions, unwisely conducted, endanger the peacefulness of our Debating-Club; ; Discussions, that go on while Tomkins is in the Chair, rouse the British Lion; ; Discussions in our Debating-Club, when wisely conducted, are always checked when they become too noisy. ~{ !x: discussion(x) & in(x, OurDebatingClub) & {noisy(x) => checked(x)} & rouse(x, BritishLion) }. @x: discussion(x) & checked(x) => ~rouse(x, BritishLion). ;background @x@y: discussion(x) & ~wiselyConducted(x) & in(x,y) => endanger(x, Peacefulness, y). @x@y: discussion(x) & in(x,y) & chair(Tomkins, y) => rouse(x, BritishLion). @x: discussion(x) & in(x, OurDebatingClub) & wiselyConducted(x) => {noisy(x) => checked(x)}.
; Conclusion: Discussions, that go on while Tomkins is in the chair, endanger the peacefulness of our Debating-Club.. ; theorem (negated) ~{@x: discussion(x) & in(x,OurDebatingClub) & chair(Tomkins, OurDebatingClub) => endanger(x, Peacefulness, OurDebatingClub) }.
Algebra ; In an associative system with left and right solutions, ; there is a right identity element. ; P(x,y,z) means x*y = z ; (x*y)*z = x*(y*z) ; x*y = u y*z = v @x@y@z@u@v@w: p(x,y,u) & p(y,z,v) & p(u,z,w) => p(x,v,w). @x@y@z@u@v@w: p(x,y,u) & p(y,z,v) & p(x,v,w) => p(u,z,w). @x@y!s: p(x,s,y). @x@y!s: p(s,x,y). ; theorem (negated) ~{!e@x: p(x,e,x)}.