# Examples Example Everybody loves somebody Everybody loves a

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))} { loves(v, w), loves(u, v)} { loves(jack, jill)}

1. 2. 3. 4. 5. {loves(x, f(x))} { loves(v, w), loves(u, v)} { loves(jack, jill)} {loves(u, x)} {} Premise Goal 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)) S x. 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: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. { 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)} {Faster(Jack, y), Greyhound(y)} {Faster(Jack, Greg)} {Faster(Greg, Smith)} { Faster(Greg, z), Faster(x, z)} {Faster(x, Smith)} {} 1, 6 4, 9 2, 10 3, 7 5, 11 12, 13 8, 14

Resolution Strategies

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) 1. {animal(f(x 1)), loves(g(x 1), x 1)} 2. { loves(x 2, f(x 2)), loves(g(x 2), x 2)} 3. { animal(y 1), kills(x 3, y 1), loves(z, x 3)} 4. { animal(y 2), loves(jack, y 2)} 5. {kills(jack, tuna), kills(curiosity, tuna)} 6. { cat(x 4), animal(x 4)} 7. {cat(tuna)} 8. kills(curiosity, tuna) animal(f(x 1)) | loves(g(x 1), x 1) ~loves(x 2, f(x 2)) | loves(g(x 2), x 2) ~animal(y 1) | ~kills(x 3, y 1) | ~loves(z, x 3) ~animal(y 2) | loves(jack, y 2) kills(jack(), tuna()) | kills(curiosity(), tuna()) ~cat(x 4) | animal(x 4) cat(tuna()) negated_conclusion ~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: 8 S>~killscuriositytuna Phase 0 clauses used in proof: 9 S>(8 a*5 b) killsjacktuna 10 S>(9 a*3 b) ~animaltuna ~lovesxjack 11#>(10 a*6 b) ~lovesxjack ~cattuna 12 S>(11 b*7 a) ~lovesxjack 15 >(4 a*1 a) lovesxfy lovesgyy 16 >(15 a*2 a) lovesgxx Phases 1 and 2 clauses used in proof: 17 S>(16 a, 12 a) []

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: sold. In. Street(x) => ~of. Great. Value(x). @x@y: exchange(y, x) & song(x) => rubbish(y). @x: great. Auk. Egg(x) => of. Great. Value(x). @x: rubbish(x) => sold. In. Street(x). @x: sold. In. Street(x) => rubbish(x). ; theorem (negated) ~{ ~{!x!y: great. Auk. Egg(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, Mince. Pies). @x: bird(x) & belongs(x, Me) => height(x, Nine). ; theorem (negated) ~{ @x: bird(x) => ~lives(x, Mince. Pies) }.

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, Our. Debating. Club) & {noisy(x) => checked(x)} & rouse(x, British. Lion) }. @x: discussion(x) & checked(x) => ~rouse(x, British. Lion). ; background @x@y: discussion(x) & ~wisely. Conducted(x) & in(x, y) => endanger(x, Peacefulness, y). @x@y: discussion(x) & in(x, y) & chair(Tomkins, y) => rouse(x, British. Lion). @x: discussion(x) & in(x, Our. Debating. Club) & wisely. Conducted(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, Our. Debating. Club) & chair(Tomkins, Our. Debating. Club) => endanger(x, Peacefulness, Our. Debating. Club) }.

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)}.

- Slides: 19