[ Arithmetic | Reference Manual | Alphabetic Index ]
# succ(?X, ?Y)

Successor relation over natural numbers.
*X*
- an integer or a variable
*Y*
- an integer or a variable

## Description

Successor relation over natural numbers. Succeeds if X is an
integer greater or equal to zero, and Y is one greater than X.
If one of the arguments is uninstantiated, it gets computed from
the other by adding or subtracting 1, respectively.
If the system is in coroutining mode and both arguments are
uninstantiated, succ/2 delays until at least one argument is known.

### Modes and Determinism

- succ(+, -) is semidet
- succ(-, +) is semidet

### Fail Conditions

Fails if X or Y are negative integers, or if Y is 0
### Exceptions

*(5) type error *
- an argument is a non-integer number
*(4) instantiation fault *
- both arguments are uninstantiated (non-coroutining mode only)
*(24) number expected *
- X or Y is not a number

## Examples

Success:
succ(0, 1).
succ(7, 8).
succ(10000000000000000000, 10000000000000000001).
succ(0, Y). % gives Y=1
succ(X, 3). % gives X=2
Fail:
succ(X, 0).
succ(X, -5).
succ(-1, Y).
Error:
succ(X, Y). (error 4)
succ(0.0, Y). (error 5)
succ(a, Y). (error 24)

## See Also

plus / 3, + / 3, - / 3