HomeContents: |
## 13.3 Recursive predicates (Ad)## IntroductionWe have seen what a recursive definition is. Predicates, however, can also be recursive. On this page, we take a brief look at what a recursive predicate is. On the next page, we give an example of a recursive predicate. ## What is a recursive predicate?A recursive predicate is a predicate which satisfies these two conditions: - It must have at least one rule whose body
*does not call*the*same*predicate. Alternatively, this can be a fact. This is the*base case*. - It must have at least one rule whose body
*does call*the same predicate. This is the*recursive part*.
## NextOn the next page, we will see a recursive predicate in action. Prev: 13.2 Recursive definitions (Ad)Up: 13 Recursivity and lists (Ad)Next: 13.4 Example of a recursive predicate (Ad) |