Numbers
Successor
|
|
| succ _ : ( ) |
|
 |
 |
 |
|
| (succ _) = n : n+1 |
The successor of a natural number n is equal to n+1.
Integers
is the set of integers,
that is, positive and negative whole numbers and zero.
The set
is characterised by axioms for its additive structure given
in the prelude together with
the next formal paragraph below.
Number systems that extend the integers
may be specified as supersets of
.
Addition of integers, arithmetic negation
|
|
| - _ : ( ) |
|
 |
 |
 |
|
| x, y : 1 z : ((x,y),z) (_ + _) |
|  |
| x : 1 y : (x,y) (- _) |
|  |
| i , j , k :  |
| ( i + j ) + k = i + ( j + k ) |
| i + j = j + i |
| i + - i = 0 |
| i + 0 = i |
|  |
| = { z : | x : z = x z = - x } |
The binary addition operator (_ + _) is defined in the prelude.
The definition here introduces additional properties for integers.
The addition and negation operations on integers are total functions that
take integer values.
The integers form a commutative group under (_ + _) with - as
the inverse operation and 0 as the identity element.
NOTE
If function_toolkit notation were exploited,
the negation operator could be defined as follows.
|
|
| - _ :  |
|
 |
 |
 |
|
| ( ) ( _ + _ )  |
|  |
| -  |
|  |
| i , j , k :  |
| ( i + j ) + k = i + ( j + k ) |
| i + j = j + i |
| i + - i = 0 |
| i + 0 = i |
|  |
| h :  |
| 1 h |
| ( i , j : h i + j h - i h ) |
| h =  |
Subtraction
function 30 leftassoc (_ - _) |
|
|
| _ - _ : (( ) ) |
|
 |
 |
 |
|
| x, y : 1 z : ((x,y),z) (_ - _) |
|  |
| i , j : i - j = i + - j |
Subtraction is a function whose domain includes all pairs of integers.
For all integers i and j,
i - j is equal to i + - j.
NOTE
If function_toolkit notation were exploited,
the subtraction operator could be defined as follows.
|
|
| _ - _ :  |
|
 |
 |
 |
|
| ( ) ( _ - _ )  |
|  |
| i , j : i - j = i + - j |
Less-than-or-equal
relation (_ _) |
|
|
| _ _ : ( ) |
|
 |
 |
 |
|
| i , j : i j j - i  |
For all integers i and j, i
j if and only if
their difference j - i is a natural number.
Less-than
|
|
| _ < _ : ( ) |
|
 |
 |
 |
|
| i , j : i < j i + 1 j |
For all integers i and j,
i < j if and only if i + 1
j.
Greater-than-or-equal
relation (_ _) |
|
|
| _ _ : ( ) |
|
 |
 |
 |
|
| i , j : i j j i |
For all integers i and j,
i
j if and only if j
i.
Greater-than
|
|
| _ > _ : ( ) |
|
 |
 |
 |
|
| i , j : i > j j < i |
For all integers i and j,
i > j if and only if j < i.
Strictly positive natural numbers
The strictly positive natural numbers
1
are the natural numbers except zero.
Non-zero integers
The non-zero integers
1 are the integers except zero.
Multiplication of integers
function 40 leftassoc (_ * _) |
|
|
| _ * _ : (( ) ) |
|
 |
 |
 |
|
| x, y : 1 z : ((x,y),z) (_ * _) |
|  |
| i , j , k :  |
| ( i * j ) * k = i * ( j * k ) |
| i * j = j * i |
| i * ( j + k ) = i * j + i * k |
| 0 * i = 0 |
| 1 * i = i |
The binary multiplication operator (_ * _) is defined for integers.
The multiplication operation on integers
is a total function and has integer values.
Multiplication on integers is characterised by the unique operation under
which the integers become a commutative ring with identity element 1.
NOTE
If function_toolkit notation were exploited,
the multiplication operator could be defined as follows.
|
|
| _ * _ : ( )  |
|
 |
 |
 |
|
| ( ) ( _ * _ )  |
|  |
| i , j , k :  |
| ( i * j ) * k = i * ( j * k ) |
| i * j = j * i |
| i * ( j + k ) = i * j + i * k |
| 0 * i = 0 |
| 1 * i = i |
Division, modulus
function 40 leftassoc (_ div _) |
function 40 leftassoc (_ mod _) |
|
|
| _ div _ , _ mod _ : (( ) ) |
|
 |
 |
 |
|
| x : ; y : 1 1 z : ((x,y),z) (_ div _) |
|  |
| x : ; y : 1 1 z : ((x,y),z) (_ mod _) |
|  |
| i : ; j : 1  |
| i = ( i div j ) * j + i mod j |
| ( 0 i mod j < j j < i mod j 0 ) |
For all integers i and non-zero integers j,
the pair (i, j) is in the domain of _ div _ and of _ mod _,
and i div j and i mod j have integer values.
When not zero, i mod j has the same sign as j.
This means that i div j is the largest integer no greater
than the rational number i/j.
NOTE
If function_toolkit notation were exploited,
the division and modulus operators could be defined as follows.
|
|
| _ div _ , _ mod _ :  |
|
 |
 |
 |
|
| ( 1 ) ( _ div _ ) 1  |
|  |
| ( 1 ) ( _ mod _ ) 1  |
|  |
| i : ; j : 1  |
| i = ( i div j ) * j + i mod j |
| ( 0 i mod j < j j < i mod j 0 ) |
IT 22-Jan-2002