library Basic/MachineNumbers
version 0.3
%% authors: M.Roggenbach, T.Mossakowski
%% date: 1.11.99
| maxCardinal: | Nat; |
| 0,1, | |
| maxCardinal: | CARDINAL; |
| +__, | |
| abs: | CARDINAL -> CARDINAL; |
| __ + __, | |
| __ - __, | |
| __ * __, | |
| __ div __, | |
| __ mod __: | CARDINAL × CARDINAL ->? CARDINAL; |
| %[maxCardinal_Nat] | maxCardinal= (2 ^ Wordlength) - 1; |
| %[maxCardinal_CARDINAL] | maxCardinal= natToCard(maxCardinal) |
| __ + __: | CARDINAL × CARDINAL ->? CARDINAL, |
| assoc, comm, unit 0; | |
| __ * __: | CARDINAL × CARDINAL ->? CARDINAL, |
| assoc, comm, unit 1; |
| - (2 ^ (Wordlength-1)) < x /\ |
| x < (2 ^ (Wordlength-1)) -1 |
| maxInteger, | |
| minInteger: | Int; |
| 0,1, | |
| maxInteger, | |
| minInteger: | INTEGER; |
| +__: | INTEGER -> INTEGER; |
| -__, | |
| abs: | INTEGER ->? INTEGER; |
| __ + __, | |
| __ - __, | |
| __ * __, | |
| __ / __, | |
| __ div __, | |
| __ mod __, | |
| __ quot __, | |
| __ rem__: | INTEGER × INTEGER ->? INTEGER |
| %[maxInteger_Int] | maxInteger= (2 ^ (Wordlength-1))-1; |
| %[minInteger_Int] | minInteger= -(2 ^ (Wordlength-1)); |
| %[maxInteger_INTEGER] | maxInteger=intToInteger(maxInteger); |
| %[minInteger_INTEGER] | minInteger=intToInteger(minInteger) |
| __ + __: | INTEGER × INTEGER ->? INTEGER, |
| assoc, comm, unit 0; | |
| __ * __: | INTEGER × INTEGER ->? INTEGER, |
| assoc, comm, unit 1; |
| def x + y <=> | minInteger < integerToInt(x) + integerToInt(y) /\ |
| integerToInt(x) + integerToInt(y) < maxInteger |
| def x - y <=> | minInteger < integerToInt(x) - integerToInt(y) /\ |
| integerToInt(x) - integerToInt(y) < maxInteger |
| def x * y <=> | minInteger < integerToInt(x) * integerToInt(y) /\ |
| integerToInt(x) * integerToInt(y) < maxInteger |
| def x div y <=> ¬ y=0 |
| def x mod y <=> ¬ y=0 |
| def x quot y <=> ¬ y=0 |
| def x rem y <=> ¬ y=0 |