Expand the logic programming language to include arithmetic comparisons, =, . Hint: as in Exercise 20, modify
Question:
Expand the logic programming language to include arithmetic comparisons, =, <, and >.
Hint: as in Exercise 20, modify solve to detect these comparisons before calling infer. If an expression is a comparison, replace any variables with their values and evaluate it. If it returns nil, solve should return the empty stream; if it returns non-nil, solve should return a stream containing the initial substitution set. Assume that the expressions do not contain unbound variables. For a more challenging exercise, define = so that it will function like the PROLOG is operator and assign a value to an unbound variable and simply do an equality test if all elements are bound.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Artificial Intelligence Structures And Strategies For Complex Problem Solving
ISBN: 9780321263186
5th Edition
Authors: George F. Luger
Question Posted: