Last active
May 16, 2020 16:51
-
-
Save littlebenlittle/963186085def7b507e3917f7f5f8a640 to your computer and use it in GitHub Desktop.
Peanos Axioms for the natural numbers in just a few lines of prolog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zero. | |
nat(zero). | |
nat(X) :- | |
nat(Y), | |
suc(Y,X). | |
one. | |
suc(zero,one). | |
two. | |
suc(one,two). | |
otherZero. | |
nat(otherZero). | |
eq(X,Y) :- X==Y. | |
eq(X,Y) :- | |
suc(X,A), | |
suc(Y,B), | |
eq(A,B). | |
otherOne. | |
suc(otherZero,otherOne). | |
suc(otherOne,two). | |
% try ?- eq(zero,otherZero) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment