Drop links or images here to add them to the editor.

Write a predicate modulo/3 that calculates the modulo of two Peano numbers.

In the system of the Peano numbers, \(0\) is presented by 0, \(1\) by s(1), \(2\) by s(s(0)), and so on. To be precise, \(n\) is represented by taking 0 and wrapping it \(n\) times with s/1.

The following predicates are assumed to be defined.

This exercise can be solved with and without using recursion. Try them both.