Next: Exchanging NOT with CUT
Up: No Title
Previous: Lists and Cuts
- As mentioned previously, the reservations against cut -
lose correspondence between declarative and procedural meaning of
programs
- If no cut, and since program is declarative - possible to change
order of clauses and goals
- This re-ordering may affect program efficiency or
termination - BUT - has no influence on program correctness or
declarative meaning (as the solution to a query is obtained by
searching the program in a top-down manner, and answering the
goals from left to right
- However, in programs with cut, a change in the order of the
clauses may affect the meaning (declarative)
- We can get different results (depending on the query)
p :- a,b.
p :- c.
means p = (a and b) or c
p :- a, !, b.
p :- c.
means p = (a and b) or (~a and c)
swapping clauses
p :- c.
p :- a, !, b.
means p = c or (a and b)
Omer F Rana
Sun Feb 16 21:01:24 GMT 1997