Native arithmetic on fixed-length radix words #
The radix is a source element, but a word may represent a value much larger than the source universe. Native PLUS and TIMES check only individual digit equations. Bounded digits and zero initial and final carries make these equations exact rather than modular.
Main definitions #
Cslib.Logic.FO.Ordered.mulEq: apply native TIMES to arbitrary terms.Cslib.Logic.FO.Ordered.Radix.digits: bound every digit by the radix.Cslib.Logic.FO.Ordered.Radix.cell,Cslib.Logic.FO.Ordered.Radix.affine: one affine digit equation, and multiplying one word by a digit and adding another word.
Main results #
Cslib.Logic.FO.Ordered.Radix.realize_affine: exact ordinary arithmetic, provided the radix is at least two and its cube fits in the source universe.
References #
- N. Immerman, Descriptive Complexity, Exercise 1.33(3) and Theorem 1.17(1): the digit construction implements the suggested arithmetic with the native arithmetic of the theorem.
Apply native TIMES to three arbitrary terms.
Instances For
mulEq L x y z holds iff the product of x and y equals z.
One exact affine digit equation, with all its scalar intermediate values checked.
Instances For
Multiply a word by a coefficient at most the radix and add another word, rejecting final overflow. Allowing the radix itself as coefficient also provides exact word shifts.
Instances For
digits L B x holds iff every digit x i is strictly less than B.
cell L B a b y c z c' holds iff a * b + y + c = z + B * c' and a * b + y + c < n.
When the radix B is at least two and B ^ 3 fits in the universe, affine L B b x y z
holds exactly when b ≤ B, the words x, y and z have digits below B, and their values
satisfy b x + y = z.