Title: Examples
1Examples
2Example
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)
3- loves(x, f(x)) Premise
- Øloves(v, w), loves(u, v) Premise
- Øloves(jack, jill) Goal
- loves(u, x) 1,2
- 4,3
4Horses, 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.(H
orse(x) Ù Rabbit(y) Þ Faster(x, y)) negated
conclusion
5"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
6Lets 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)
7- Lets 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
8Resolution Strategies
9Linear 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!!
10Theo
- Theo is theorem prover based on linear resolution
(as well as other resolution strategies besides
linearity) - Accepts input in clausal form.
- Uses
- for ?
- for ? (doesnt 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.
11Clausal 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)
- ?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 ki
lls(curiosity(),tuna())
12Theo output
- Proof Found!
- Axioms
- 1 gtanimalfx lovesgxx
- 2gtlovesxfx lovesgxx
- 3 gtanimalx killsyx loveszy
- 4 gtanimalx lovesyx
- 5gtkillsjacktuna killscuriositytuna
- 6 gtcatx animalx
- 7 gtcattuna
- Negated conclusion
- 8Sgtkillscuriositytuna
Phase 0 clauses used in proof 9Sgt(8a5b)
killsjacktuna 10Sgt(9a3b) animaltuna
lovesxjack 11gt(10a6b) lovesxjack
cattuna 12Sgt(11b7a) lovesxjack 15 gt(4a1a)
lovesxfy lovesgyy 16 gt(15a2a) lovesgxx Phases
1 and 2 clauses used in proof 17Sgt(16a,12a)
13Compile
- You can create well formed formulas (WFF) i.e.
FOL sentences and then convert into clausal form
using compile - _at_ is forall
- ! is exists
- Variables and constants distinguished by
quantification. Variables are quantified,
constants arent. - Use ( and ) for functions and relations.
- Use and for grouping sentences.
- is AND, is OR, gt is IMPLIES
- Example
- _at_x met_with_at_sea(x) noticed_thing(x) gt
entered_in_log(x).
14Books
- 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. - _at_x book(x) recommend(x) gt healthy(x).
- _at_x book(x) healthy(x) gt recommend(x).
- _at_x book(x) bound(x) gt wellwritten(x).
- _at_x romance(x) gt healthy(x).
- _at_x romance(x) gt book(x).
- _at_x book(x) bound(x) gt recommend(x).
- theorem (negated)
- _at_x romance(x) gt wellwritten(x) .
15Songs
- 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. - _at_x soldInStreet(x) gt ofGreatValue(x).
- _at_x_at_y exchange(y,x) song(x) gt rubbish(y).
- _at_x greatAukEgg(x) gt ofGreatValue(x).
- _at_x rubbish(x) gt soldInStreet(x).
- _at_x soldInStreet(x) gt rubbish(x).
- theorem (negated)
- !x!y greatAukEgg(y) exchange(y,x)
song(x) .
16Birds
- 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. - _at_x bird(x) height(x,Nine) gt ostrich(x).
- _at_x ostrich(x) gt bird(x).
- _at_x bird(x) gt belongs(x,Me).
- _at_x ostrich(x) gt lives(x,MincePies).
- _at_x bird(x) belongs(x,Me) gt height(x,Nine).
- theorem (negated)
- _at_x bird(x) gt lives(x,MincePies) .
17British 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) gt checked(x) rouse(x,
BritishLion) . - _at_x discussion(x) checked(x) gt rouse(x,
BritishLion). background - _at_x_at_y discussion(x) wiselyConducted(x)
in(x,y) gt endanger(x, Peacefulness, y). - _at_x_at_y discussion(x) in(x,y) chair(Tomkins, y)
gt rouse(x, BritishLion). - _at_x discussion(x) in(x, OurDebatingClub)
wiselyConducted(x) gt noisy(x) gt checked(x).
18- Conclusion Discussions, that go on while
Tomkins is in the chair, endanger the
peacefulness of our Debating-Club.. - theorem (negated)
- _at_x discussion(x) in(x,OurDebatingClub)
chair(Tomkins, OurDebatingClub) gt endanger(x,
Peacefulness, OurDebatingClub) .
19Algebra
- In an associative system with left and right
solutions, - there is a right identity element.
- P(x,y,z) means xy z
- (xy)z x(yz)
- xy u yz v
- _at_x_at_y_at_z_at_u_at_v_at_w p(x,y,u) p(y,z,v) p(u,z,w) gt
p(x,v,w). - _at_x_at_y_at_z_at_u_at_v_at_w p(x,y,u) p(y,z,v) p(x,v,w) gt
p(u,z,w). - _at_x_at_y!s p(x,s,y).
- _at_x_at_y!s p(s,x,y).
- theorem (negated)
- !e_at_x p(x,e,x).