19
Examples

Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody. x. y.loves( x, y) u. v. w.(loves(v,

  • View
    221

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

Examples

Page 2: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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

Page 3: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

1. {loves(x, f(x))} Premise2. loves(v, w), loves(u, v)} Premise3. loves(jack, jill)} Goal4. {loves(u, x)} 1,25. {} 4,3

Page 4: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

Horses, dogs, and rabbitsEvery 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

Page 5: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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

Page 6: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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

Page 7: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

Let’s try to infer the {} using resolution:

1. Horse(x), Dog(y), Faster(x, y)}2. {Greyhound(Greg)}3. Rabbit(z), Faster(Greg, z)}4. Greyhound(y), Dog(y)}5. Faster(x, y), Faster(y, z), Faster(x, z)}6. {Horse(Jack)}7. {Rabbit(Smith)}8. {Faster(Jack, Smith)}9. Dog(y), Faster(Jack, y)} 1,610. Faster(Jack, y), Greyhound(y)} 4,911. Faster(Jack, Greg)} 2,1012. {Faster(Greg, Smith)} 3,713. Faster(Greg, z), Faster(x, z)} 5,1114. Faster(x, Smith)} 12,1315. {} 8,14

Page 8: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

Resolution Strategies

Page 9: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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,26. {q} 3,57. {p} 4,68. {} 5,7

Linear Resolution is refutation complete!!

Page 10: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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.

Page 11: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

Clausal Curiosity (Theo format)1. {animal(f(x1)),

loves(g(x1),x1)}

2. {loves(x2,f(x2)), loves(g(x2),x2)}

3. {animal(y1), kills(x3,y1), loves(z,x3)}

4. {animal(y2), loves(jack,y2)}

5. {kills(jack,tuna), kills(curiosity,tuna)}

6. {cat(x4), animal(x4)}

7. {cat(tuna)}

8. 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())

negated_conclusion

~kills(curiosity(),tuna())

Page 12: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

Theo outputProof 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) killsjacktuna10S>(9a*3b) ~animaltuna ~lovesxjack11#>(10a*6b) ~lovesxjack ~cattuna12S>(11b*7a) ~lovesxjack15 >(4a*1a) lovesxfy lovesgyy16 >(15a*2a) lovesgxx

Phases 1 and 2 clauses used in proof:17S>(16a,12a) []

Page 13: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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

Page 14: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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

Page 15: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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

Page 16: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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

Page 17: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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

Page 18: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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

Page 19: Examples. Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.  x.  y.loves( x, y)  u.  v.  w.(loves(v,

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