Описание тега successor-arithmetics
Successor arithmetics, in Prolog also known as s(X)-notation or
s(X)-numbers, is an encoding of the natural numbers based on Peano
Axioms. Zero is represented by 0, one is represented as the
successor of zero s(0), two as the successor of one s(s(0)) etc.
Successor arithmetics, in Prolog also known as s(X)-notation or
s(X)-numbers, is an encoding of the natural numbers based on Peano Axioms. Zero is represented by 0
, one is represented as the successor of zero s(0)
, two as the successor of one s(s(0))
etc.
Using this representation, the natural numbers are defined:
natural_number(0).
natural_number(s(X)) :-
natural_number(X).
And all natural numbers are enumerated:
?- natural_number(X).
X = 0 ;
X = s(0) ;
X = s(s(0)) ;
X = s(s(s(0))) ;
X = s(s(s(s(0)))) ;
X = s(s(s(s(s(0))))) ...
Also other representations are used, like n
or z
, and succ(X)
; in mathematics a small sigma σ
, or a postfix single quote '
. Originally, Giuseppe Peano used postfix plus +
and started with 1
.