Skip to content

Instantly share code, notes, and snippets.

@DonaldKellett
Created December 22, 2018 05:42
Show Gist options
  • Save DonaldKellett/71e574370abeb9f5dac89a894240516a to your computer and use it in GitHub Desktop.
Save DonaldKellett/71e574370abeb9f5dac89a894240516a to your computer and use it in GitHub Desktop.
Learn Prolog Now! - Chapter 3 - Exercise 3.4 - X > Y?
% greater_than/2 - Given 2 natural numbers X, Y (as defined by Peano's axioms), is X > Y.
% Basis: The successor of any natural number must be greater than 0
greater_than(succ(_), 0).
% Inductive step: if X > Y, then succ(X) > succ(Y)
greater_than(succ(X), succ(Y)) :- greater_than(X, Y).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment