Arithmetic should be done in the context of TFF logic, which supports the predefined type $int. Using TFF enforces types and semantics that separate $int from $i from $o. If arithmetic is not done in the context of TFF, then the domain of every interpretation is the integers.
The integers are unbounded (rather than some specific implementation such as 16 bit 2's complement). Systems that implement some limited arithmetic, e.g., 32 bit, must halt in an SZS error state if they hit overflow.
Interpreted predicates and interpreted functions are proposed for the TPTP syntax:
! [X,Y] : ( $lesseq_int(X,Y) <=> ( $less_int(X,Y) | X = Y ) )
! [X,Y] : ( $greater_int(X,Y) <=> $less_int(Y,X) )
! [X,Y] : ( $greatereq_int(X,Y) <=> $lesseq_int(Y,X) )
i.e, only $less_int and equality need to be implemented
to get all four relational operators.
! [X,Y] : $minus_int(X,Y) = $plus_int(X,$uminus_int(Y))
i.e, only $uminus_int and $plus_int need to
be implemented to get all three additive operators.
! [N,D] : $plus_int($times_int($divide_int(N,D),D),$remainder_int(N,D)) = N
$remainder_int has the properties that
! [N,D] :
( $greater_int(D,0)
=> ( $greater_int(D,$remainder_int(N,D))
& $greatereq_int($remainder_int(N,D),0) ) )
! [N,D] :
( $less_int(D,0)
=> ( $less_int(D,$remainder_int(N,D))
& $lesseq_int($remainder_int(N,D),0) ) )
i.e., the remainder lies between 0 and the divisor.
Examples:
$divide_int(13,5) = 2 $remainder(13,5) = 3
$divide_int(-13,5) = -3 $remainder(-13,5) = 2
$divide_int(13,-5) = -3 $remainder(13,-5) = -2
$divide_int(-13,-5) = 3 $remainder(-13,-5) = -2
! [X] :
( ( $less_int(0,X)
=> $abs_int(X) = X )
& ( X = 0
=> $abs_int(X) = 0 )
& ( $less_int(X,0)
=> $abs_int(X) = $uminus_int(X) ) )
i.e, $abs_int can be implemented in terms of other operators.
i.e, $min_int and $max_int can be implemented in terms of other operators.
<defined atom> ::= $true | $false |
<term> = <term> | <term> != <term> |
$equal(<term>,<term>) |
<int_atom>
<int atom> ::= $less_int(<term>,<term>) | $lesseq_int(<term>,<term>)
<term> ::= <function term> | <variable>
<function term> ::= <plain term> | <defined term> | <system term>
<plain term> ::= <constant> | <functions>(<arguments>)
<defined term> ::= <number> | <double quoted> | <int_term>
<int term> ::= $plus_int(<term>,<term>) | $minus_int(<term>,<term>) |
$times_int(<term>,<term>) | $divide_int(<term>,<term>) |
$remainder_int(<term>,<term>) | $uminus_int(<term>)
<variable> ::= <upper word>
The extent to which ATP systems are able to work with the interpreted predicates and functions may vary, from a simple ability to evaluate ground terms, e.g., $plus_int(2,3) may be evaluated to 5, through an ability to instantiate variables in equations involving such functions, e.g., $times_int(2,$uminus_int(X)) = $uminus_int($plus_int(X,2)) may instantiate X to 2, to extensive algebraic manipulation capability.
This proposal is minimal, in an effort to keep the entry barrier low. The choices made allow for conservative extensions in the future: