1 Closed Domain Assumption
The only entities in the domain are those found in the assumptions or goal.
If the domain only contains "A" and "B", then the expression "exists x.P(x)" can
be replaced with "P(A) | P(B)" and an expression "all x.P(x)" can be replaced
with "P(A) & P(B)".
|
>>> p1 = lexpr(r'all x.(man(x) -> mortal(x))')
>>> p2 = lexpr(r'man(Socrates)')
>>> c = lexpr(r'mortal(Socrates)')
>>> prover = Prover9Command(c, [p1,p2])
>>> prover.prove()
True
>>> cdp = ClosedDomainProver(prover)
>>> for a in cdp.assumptions(): print(a)
(man(Socrates) -> mortal(Socrates))
man(Socrates)
>>> cdp.prove()
True
|
|
|
>>> p1 = lexpr(r'exists x.walk(x)')
>>> p2 = lexpr(r'man(Socrates)')
>>> c = lexpr(r'walk(Socrates)')
>>> prover = Prover9Command(c, [p1,p2])
>>> prover.prove()
False
>>> cdp = ClosedDomainProver(prover)
>>> for a in cdp.assumptions(): print(a)
walk(Socrates)
man(Socrates)
>>> cdp.prove()
True
|
|
|
>>> p1 = lexpr(r'exists x.walk(x)')
>>> p2 = lexpr(r'man(Socrates)')
>>> p3 = lexpr(r'-walk(Bill)')
>>> c = lexpr(r'walk(Socrates)')
>>> prover = Prover9Command(c, [p1,p2,p3])
>>> prover.prove()
False
>>> cdp = ClosedDomainProver(prover)
>>> for a in cdp.assumptions(): print(a)
(walk(Socrates) | walk(Bill))
man(Socrates)
-walk(Bill)
>>> cdp.prove()
True
|
|
|
>>> p1 = lexpr(r'walk(Socrates)')
>>> p2 = lexpr(r'walk(Bill)')
>>> c = lexpr(r'all x.walk(x)')
>>> prover = Prover9Command(c, [p1,p2])
>>> prover.prove()
False
>>> cdp = ClosedDomainProver(prover)
>>> for a in cdp.assumptions(): print(a)
walk(Socrates)
walk(Bill)
>>> print(cdp.goal())
(walk(Socrates) & walk(Bill))
>>> cdp.prove()
True
|
|
|
>>> p1 = lexpr(r'girl(mary)')
>>> p2 = lexpr(r'dog(rover)')
>>> p3 = lexpr(r'all x.(girl(x) -> -dog(x))')
>>> p4 = lexpr(r'all x.(dog(x) -> -girl(x))')
>>> p5 = lexpr(r'chase(mary, rover)')
>>> c = lexpr(r'exists y.(dog(y) & all x.(girl(x) -> chase(x,y)))')
>>> prover = Prover9Command(c, [p1,p2,p3,p4,p5])
>>> print(prover.prove())
False
>>> cdp = ClosedDomainProver(prover)
>>> for a in cdp.assumptions(): print(a)
girl(mary)
dog(rover)
((girl(rover) -> -dog(rover)) & (girl(mary) -> -dog(mary)))
((dog(rover) -> -girl(rover)) & (dog(mary) -> -girl(mary)))
chase(mary,rover)
>>> print(cdp.goal())
((dog(rover) & (girl(rover) -> chase(rover,rover)) & (girl(mary) -> chase(mary,rover))) | (dog(mary) & (girl(rover) -> chase(rover,mary)) & (girl(mary) -> chase(mary,mary))))
>>> print(cdp.prove())
True
|
|
2 Unique Names Assumption
No two entities in the domain represent the same entity unless it can be
explicitly proven that they do. Therefore, if the domain contains "A" and "B",
then add the assumption "-(A = B)" if it is not the case that
"<assumptions> |- (A = B)".
|
>>> p1 = lexpr(r'man(Socrates)')
>>> p2 = lexpr(r'man(Bill)')
>>> c = lexpr(r'exists x.exists y.-(x = y)')
>>> prover = Prover9Command(c, [p1,p2])
>>> prover.prove()
False
>>> unp = UniqueNamesProver(prover)
>>> for a in unp.assumptions(): print(a)
man(Socrates)
man(Bill)
-(Socrates = Bill)
>>> unp.prove()
True
|
|
|
>>> p1 = lexpr(r'all x.(walk(x) -> (x = Socrates))')
>>> p2 = lexpr(r'Bill = William')
>>> p3 = lexpr(r'Bill = Billy')
>>> c = lexpr(r'-walk(William)')
>>> prover = Prover9Command(c, [p1,p2,p3])
>>> prover.prove()
False
>>> unp = UniqueNamesProver(prover)
>>> for a in unp.assumptions(): print(a)
all x.(walk(x) -> (x = Socrates))
(Bill = William)
(Bill = Billy)
-(William = Socrates)
-(Billy = Socrates)
-(Socrates = Bill)
>>> unp.prove()
True
|
|
3 Closed World Assumption
The only entities that have certain properties are those that is it stated
have the properties. We accomplish this assumption by "completing" predicates.
If the assumptions contain "P(A)", then "all x.(P(x) -> (x=A))" is the completion
of "P". If the assumptions contain "all x.(ostrich(x) -> bird(x))", then
"all x.(bird(x) -> ostrich(x))" is the completion of "bird". If the
assumptions don't contain anything that are "P", then "all x.-P(x)" is the
completion of "P".
|
>>> p1 = lexpr(r'walk(Socrates)')
>>> p2 = lexpr(r'-(Socrates = Bill)')
>>> c = lexpr(r'-walk(Bill)')
>>> prover = Prover9Command(c, [p1,p2])
>>> prover.prove()
False
>>> cwp = ClosedWorldProver(prover)
>>> for a in cwp.assumptions(): print(a)
walk(Socrates)
-(Socrates = Bill)
all z1.(walk(z1) -> (z1 = Socrates))
>>> cwp.prove()
True
|
|
|
>>> p1 = lexpr(r'see(Socrates, John)')
>>> p2 = lexpr(r'see(John, Mary)')
>>> p3 = lexpr(r'-(Socrates = John)')
>>> p4 = lexpr(r'-(John = Mary)')
>>> c = lexpr(r'-see(Socrates, Mary)')
>>> prover = Prover9Command(c, [p1,p2,p3,p4])
>>> prover.prove()
False
>>> cwp = ClosedWorldProver(prover)
>>> for a in cwp.assumptions(): print(a)
see(Socrates,John)
see(John,Mary)
-(Socrates = John)
-(John = Mary)
all z3 z4.(see(z3,z4) -> (((z3 = Socrates) & (z4 = John)) | ((z3 = John) & (z4 = Mary))))
>>> cwp.prove()
True
|
|
|
>>> p1 = lexpr(r'all x.(ostrich(x) -> bird(x))')
>>> p2 = lexpr(r'bird(Tweety)')
>>> p3 = lexpr(r'-ostrich(Sam)')
>>> p4 = lexpr(r'Sam != Tweety')
>>> c = lexpr(r'-bird(Sam)')
>>> prover = Prover9Command(c, [p1,p2,p3,p4])
>>> prover.prove()
False
>>> cwp = ClosedWorldProver(prover)
>>> for a in cwp.assumptions(): print(a)
all x.(ostrich(x) -> bird(x))
bird(Tweety)
-ostrich(Sam)
-(Sam = Tweety)
all z7.-ostrich(z7)
all z8.(bird(z8) -> ((z8 = Tweety) | ostrich(z8)))
>>> print(cwp.prove())
True
|
|