Compiler certificates for restoring quotient loops #
The logical restoring loop is convenient for proofs, while the primitive-word accumulator avoids
allocating a state at every generated quotient bit. This module proves the logical and accumulator
forms of the one- and two-limb loops equal and registers the accumulator direction with @[csimp].
The compiled scaled quotient also tries a floating-point candidate, checked in exact integer
arithmetic, before the loop. Its certificate uses the loop's arithmetic specification from
Quotient.Proof, imported here privately so executable clients get the rewrite without
re-exporting that development.
The unboxed one-word accumulators preserve every step of the restoring recurrence.
The one-word accumulator agrees with the logical loop for every state and iteration count.
Compile one-word restoring division through primitive accumulators.
Compile scaled quotient rounding through the same accumulator.
This equation also replaces calls whose original body was compiled before the loop certificate was imported.
The primitive-word accumulator implements the logical two-limb restoring recurrence.
Compile the logical two-limb quotient loop through its verified word accumulator.