Docsity

Logic Programming and Artifical Intelligence, Solution Sheets - Computer Science 9, Study notes of Computer Numerical Control

Toggle sidebar
bg1
Logic Programming and Artificial Intelligence
LPA Practical Solutions 9
1.
∀S: ¬ ∃X on(table,X, S)
If X is on Y, then from intra-situation axiom (1) it follows that X is a block. But we
know that the table is not a block from atemporal axiom (1), so the table cannot be on
anything.
a) ∀S ¬∃X on(table,X,S)
If X is on Y, then from intra-situation axiom (1) it follows that X is a block. But
we know that the table is not a block from atemporal axiom (1), so the table
cannot be on anything.
b) ∀X,S: ¬on(X,X,S)
Follows from intra-situation axiom (9). This can be seen by considering X and
Y to be the same object in that axiom.
c) ∀X,Y,Z,S ((on(X,Y,S) ˄ on(Y,Z,S)) → ¬on(X;Z; S))
If Y is on Z then Y and Z are different since (as we just established above
from intra-situation axiom (9)) Y is not on itself. If X is on Y then X is not on Z,
since, from intra-situation axiom (5), X is at most one thing.
d) ∀S (∃X,Y (block(X) ˄ block(Y) ˄ ¬equal(X,Y)) → (∃X,Y on(X,Y))
Assume that block X and block Y are different and that block X is not on
anything. Then by intra-situation axiom (3), block X must be held. And since
only one thing is held (intra-situation axiom (4)), block Y is not held. And since
block Y is not held, then from intra-situation axiom (3), we know it is on
something.
2.
∀X, Y,Z, S (held(X, S) ∧(equal(Y, table) ∨clear(Y, S)) ∧ ¬ equal(Z,X))
→ ¬ held(z, result(putdown(Y), S)))
The non-effects of putdown on held: If Y is held and the preconditions of putdown(X)
are met then all objects other than Y are still not held after putdown(X) is performed.
Consider an arbitrary object other than X and call it Z. If Z is not a block, then it is
never held (intra-situation axiom (2)). Now consider the case where Z is a block.
From atemporal axiom (4), at most one thing is held. Thus Z is not held before the
putdown. From intra-situation axiom (3), Z must be on something before the
putdown. Then from frame axiom (2), Z must be on the same thing after the putdown
is performed. Hence, from intra-situation axiom (3), Z is not held after the putdown.
There is another way of handling the frame axiom. Notice that if the above frame
axiom were used, there would also be a causal axiom saying that X (the block that is
held before the putdown) is clear after putdown(Y ) is performed. Hence the frame
axiom and causal axiom together imply that nothing is held after a putdown, so both
axioms could be replaced with the single axiom:
pf3
pf4
pf5

Partial preview of the text

Download Logic Programming and Artifical Intelligence, Solution Sheets - Computer Science 9 and more Study notes Computer Numerical Control in PDF only on Docsity!

Logic Programming and Artificial Intelligence

LPA Practical Solutions 9

∀S: ¬ ∃X on(table,X, S) If X is on Y, then from intra-situation axiom (1) it follows that X is a block. But we know that the table is not a block from atemporal axiom (1), so the table cannot be on anything. a) ∀S ¬∃X on(table,X,S) If X is on Y, then from intra-situation axiom (1) it follows that X is a block. But we know that the table is not a block from atemporal axiom (1), so the table cannot be on anything. b) ∀X,S: ¬on(X,X,S) Follows from intra-situation axiom (9). This can be seen by considering X and Y to be the same object in that axiom. c) ∀X,Y,Z,S ((on(X,Y,S) ˄ on(Y,Z,S)) → ¬on(X;Z; S)) If Y is on Z then Y and Z are different since (as we just established above from intra-situation axiom (9)) Y is not on itself. If X is on Y then X is not on Z, since, from intra-situation axiom (5), X is at most one thing. d) ∀S (∃X,Y (block(X) ˄ block(Y) ˄ ¬equal(X,Y)) → (∃X,Y on(X,Y)) Assume that block X and block Y are different and that block X is not on anything. Then by intra-situation axiom (3), block X must be held. And since only one thing is held (intra-situation axiom (4)), block Y is not held. And since block Y is not held, then from intra-situation axiom (3), we know it is on something. 2. ∀X, Y,Z, S (held(X, S) ∧ (equal(Y, table) ∨ clear(Y, S)) ∧ ¬ equal(Z,X)) → ¬ held(z, result(putdown(Y), S))) The non-effects of putdown on held: If Y is held and the preconditions of putdown(X) are met then all objects other than Y are still not held after putdown(X) is performed. Consider an arbitrary object other than X and call it Z. If Z is not a block, then it is never held (intra-situation axiom (2)). Now consider the case where Z is a block. From atemporal axiom (4), at most one thing is held. Thus Z is not held before the putdown. From intra-situation axiom (3), Z must be on something before the putdown. Then from frame axiom (2), Z must be on the same thing after the putdown is performed. Hence, from intra-situation axiom (3), Z is not held after the putdown. There is another way of handling the frame axiom. Notice that if the above frame axiom were used, there would also be a causal axiom saying that X (the block that is held before the putdown) is clear after putdown(Y ) is performed. Hence the frame axiom and causal axiom together imply that nothing is held after a putdown, so both axioms could be replaced with the single axiom:

∀X, Y,Z, S (held(X, S) ∧ (equal(Y, table) ∨ clear(Y, S))) → ¬ held(Z, result(putdown(Y ), S)) ∀X, Y, S ( held(Y ) ∧ clear(X) → (∀Z ¬ equals(Z,X) ∧ ¬equal(Z, Y ) → (clear(Z, S) ⇐⇒ clear(Z, result(putdown(X), S)))) The non-effects of putdown on clear: If Y is held and the preconditions of putdown(X) are met then any object other than X and Y is clear after the putdown iff it is clear before the putdown. Let Z be an object other than X and Y. By frame axiom (2), Z has the same objects on it before and after putdown(X) is executed. Hence, nothing is on Z before the putdown iff nothing is on Z after the putdown. Then, from intra-situation axiom (7), Z is clear before the putdown iff it is clear after the putdown. 3. (a) We will have six individual symbols — a, b, c, d, e, f — to denote each of the six nodes in the intended interpretation. Each node can have one of three statuses: it can have a 5p piece on it, it can have a 10p piece on it, or it can have nothing on it. We will use the individual symbols 5p, 10p, and 0p to denote the three statuses. We will also have an individual symbol, s 0 , to denote the initial situation. In addition we will use three predicate symbols: arc (arity 2): arc(x, y) denotes true in the intended interpretation if there is an arc between node x and node y. status (arity 3): status(n, t, s) denotes true if in situation s node n has status t. equal (arity 2): equal(x, y) denotes true in the intended interpretation if x and y are the same. and two function symbols: move (arity 2): move(x, y) denotes the action of moving a coin from location x to location y in situation s. result (arity 2): result(a, s) denotes the situation that results from performing action a in situation s. (b) status(a, 0p, s 0 )∧status(b, 10p, s 0 ) ∧ status(c, 5p, s 0 ) ∧status(d, 0p, s 0 ) ∧ status(e, 0p, s 0 ) In the initial situation the 5p piece is on node C, the 10p piece is on node B, and nothing is on the other nodes. (c) Atemporal axioms:

  • arc(a, b) ∧ arc(a, c) ∧ arc(b, d) ∧ arc(c, d) ∧ arc(d, e) ∧ arc(e, f) There is an arc between A and B, A and C, B and D, C and D, D and E, and E and F.
  • ∀X, Y arc(X, Y ) → arc(Y,X) arc is a symmetric relation. Intra-situational axioms:
  • ∀N, Y,Z, S status(N, Y, S) ∧ status(N,Z, S) → equal(Y,Z)

a)

We will use two STRIPS operators, move5 and move10 to represent the

actions of moving a 5p piece and moving a 10p piece from one node to

another. In particular, the operator move5(x, y) models the action of moving a

5p piece from node x to node y, and the operator move10(x, y) models the

action of moving a 10p piece from node x to node y.

Action(move5(X,Y), PRECOND: arc(X,Y ), on5(X), empty(Y) EFFECT: on5(Y), empty(X), on5(X), empty(Y) Action(move10(X,Y), PRECOND: arc(X,Y), on10(X), empty(Y) EFFECT: on10(Y), empty(X), on10(X), empty(Y) b) Goal: on5(e)  N (on10(N)  arc(e,N)) c) To abbreviate the solution, let A be equal to: {arc(a, b), arc(a, c), arc(b, d), arc(c, d), arc(d, e), arc(e, f), arc(b, a), arc(c, a), arc(d, b), arc(d, c), arc(e, d), ard(f, e)} {empty(a), on10(b), on5(c), empty(d), empty(e)} initial state {on10(a), empty(b), on5(c), empty(d), empty(e)}  A (from move10(b,a)) {on10(a), empty(b), empty(c), on5(d), empty(e)}  A (from move5(c,d)) {empty(a), empty(b), on5(c), on10(d), empty(e)}  A (from move10(b,d)) {empty(a), empty(b), on5(c), empty(d), on10(e)}  A (from move10(d,e)) {on5(a), empty(b), empty(c), on10(d), empty(e)}  A (from move5(c,a)) {on5(a), on10(b), empty(c), empty(d), empty(e)}  A (from move5(c,a)) {on5(a), empty(b), empty(c), on10(d), empty(e)}  A (from move10(b,d)) {empty(a), on10(b), empty(c), on5(d), empty(e)}  A (from move5(c,d)) {on10(a), empty(b), empty(c), on5(d), empty(e)}  A (from move10(b,a)) {empty(a), on10(b), empty(c), empty(d), on5(e)}  A (from move5(d,e)) The initial state is labeled and there are no goal states.

d)

Goal: {on(5,e), on(10,d)}

Initial state: {on(5,c), on (10,b)}  A.

Here is the shortest solution without backtracking:

1. Achieve on(5,e):

Action: move5(d,e)  Achieve on(5,d) (arc(d,e) holds in initial state)

Action: move5(c,d)  on (5,c) holds in initial state

2. Achieve on(10,d):

Action: move10(b,d)  on(10,b) holds in initial state.

a)

Action(lsock, EFFECT: lsockon) Action(rsock, EFFECT: rsockon) Action(lshoe, PRECOND: lsockon EFFECT: lshoeon) Action(rshoe, PRECOND: rsockon EFFECT: rshoeon) Action(hat, EFFECT: haton) Action(coaton, EFFECT: coaton)

b)

c) One possible answer: