8. As noted in section 9.3.2, the reachable predicate defined in figure 9.3 allows for loops, where...

Question:

8. As noted in section 9.3.2, the reachable predicate defined in figure 9.3 allows for loops, where a sequence of moves passes through a state and later returns to exactly the same state. For example, in the monkey and bananas problem where the monkey starts at location 2, a sequence of go moves that ends with go(loc2)

returns the monkey to the initial state. The presence of such loops can only slow down the process of searching for a reachable goal state.

Write clauses to define a new predicate reachable_uniq(s, l, s) that is just like reachable except that the moves in l do not pass through the same state twice.

Hint: Define an auxiliary predicate reachable_list(s, l, x, s) that holds when l is a list [m1, . . . ,mn] of n moves (as before), and x is a list of n+1 states in reverse order [sn, . . . , s0] with no repetitions, such that s = s0, s = sn, and for every i from 1 to n, there is a legal move mi from state si−1 to state si.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: