Hi everyone I'm new to Prolog and I'm trying to complete an exercise on Learn Prolog Now, this is the exercise:
Defineapredicategreater_than/2thattakestwonumeralsintheno- tation that we introduced in this lecture (i.e. 0, succ(0), succ(succ(0)) ...) as arguments and decides whether the first one is greater than the second one. E.g:
?- greater_than(succ(succ(succ(0))),succ(0)).
yes
?- greater_than(succ(succ(0)),succ(succ(succ(0)))).
no
I've tried so many times to resolve it and now I'm stuck. Can anyone help me with this?
Thanks!
Defineapredicategreater_than/2thattakestwonumeralsintheno- tation that we introduced in this lecture (i.e. 0, succ(0), succ(succ(0)) ...) as arguments and decides whether the first one is greater than the second one. E.g:
?- greater_than(succ(succ(succ(0))),succ(0)).
yes
?- greater_than(succ(succ(0)),succ(succ(succ(0)))).
no
I've tried so many times to resolve it and now I'm stuck. Can anyone help me with this?
Thanks!