Native numeral and shift formulas #
Exact binary shifts are definable from BIT and the native addition formula. A separate no-lost-bit condition rejects overflow; matching only the visible output bits would instead define a truncated shift. Numeral formulas work even when their numeral is outside the universe: they then have no satisfying value.
Main definitions #
Cslib.Logic.FO.Ordered.addEq: native addition applied to arbitrary terms.Cslib.Logic.FO.Ordered.natEq: equality to a fixed natural numeral.Cslib.Logic.FO.Ordered.scaleEq: multiplication by a fixed syntactic literal.Cslib.Logic.FO.Ordered.powerOfTwo: a numeral containing exactly the specified bit.Cslib.Logic.FO.Ordered.highestBit: the largest set-bit position of a nonzero numeral.Cslib.Logic.FO.Ordered.shiftLeft: exact multiplication by a power of two.
Main results #
Cslib.Logic.FO.Ordered.realize_natEq: exact numeral semantics.Cslib.Logic.FO.Ordered.realize_powerOfTwo: exact power-of-two semantics.Cslib.Logic.FO.Ordered.realize_shiftLeft: exact, nonmodular shift semantics.
References #
- N. Immerman, Descriptive Complexity, Section 1.2.1.
Apply the native PLUS formula to three terms.
Instances For
Equality to a fixed natural numeral, without requiring that numeral to exist.
Instances For
Exactly one set bit, at the specified exponent.
Instances For
The highest set bit of a nonzero numeral.
Instances For
Exact left shift, with every source set bit required to remain representable.
Instances For
addEq L x y z holds under v if and only if
(x.realize v).val + (y.realize v).val = (z.realize v).val.
scaleEq L k x z holds under v iff k * (x.realize v).val = (z.realize v).val.
highestBit L x h holds under v iff 2 ^ (h.realize v).val ≤ (x.realize v).val and
(x.realize v).val < 2 ^ ((h.realize v).val + 1).
powerOfTwo L p e holds exactly when p = 2 ^ e.
shiftLeft L x e z holds exactly when x * 2 ^ e = z; the product is not reduced modulo
the universe size.