Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5


If we are given two numerals in the succ-notation and want to find out whether the first one is bigger, we have to simultaneously strip succ-functors from both numbers. At some point one of the numbers will be 0 (all succ-functors have been stripped off). If the second one becomes 0 first, the first numeral must be bigger.

So, what we have to express in Prolog is: If both numbers are of the form succ(...), then strip the outermost succ-functor of both numbers and check whether what remains of the first number is bigger than what remains of the second number. If the first number is of the form succ(...) and the second number is 0, then succeed (the first number is greater). If the first number is 0, it is not greater than the second. In this case, Prolog should just fail, so you don't have to do anything.


Back to the exercise.