Derived register arithmetic #
Addition, copying, and multiply-accumulate over unary registers, composed from
forRegTM, incRegTM, and clearRegTM — no new hand-rolled machines. Each
spec is one application of forRegTM_hoareTime with an iteration-indexed
ghost family, plus Function.update bookkeeping.
Time bounds are deliberately loose (rounded up via HoareTime.mono_bound);
only their polynomial shape matters downstream.
dst += src (repeat-increment, fueled by src).
Equations
- Complexity.TM.addIntoTM src dst = (Complexity.TM.incRegTM dst).forRegTM src
Instances For
addIntoTM Hoare specification. From regTape a in src and regTape b in
dst, reach regTape (b + a) in dst; src and everything else untouched.
dst := src (clear then add).
Equations
- Complexity.TM.copyIntoTM src dst = (Complexity.TM.clearRegTM dst).seqTM (Complexity.TM.addIntoTM src dst)
Instances For
copyIntoTM Hoare specification.
dst += src₁ * src₂ (repeat-add, fueled by src₁).
Equations
- Complexity.TM.mulAddIntoTM src₁ src₂ dst = (Complexity.TM.addIntoTM src₂ dst).forRegTM src₁
Instances For
mulAddIntoTM Hoare specification. From regTape a, regTape b, regTape d
in src₁, src₂, dst, reach regTape (d + a·b) in dst.