Addition of a fixed natural to a canonical binary tape — definitions #
A fixed constant is compiled into finitely many sequential applications of canonical binary successor. No work tape is needed for the hardwired value, so the construction preserves every tape except its destination.
Add a hardwired natural to one canonical binary work tape.
Equations
- Complexity.TM.binaryAddConstTM idx 0 = Complexity.TM.skipTM
- Complexity.TM.binaryAddConstTM idx fixedValue.succ = (Complexity.TM.binaryAddConstTM idx fixedValue).seqTM (Complexity.TM.binarySuccTM idx)
Instances For
Exact runtime of fixed-constant binary addition.
Equations
- Complexity.TM.binaryAddConstTime 0 dstValue = 1
- Complexity.TM.binaryAddConstTime fixedValue_1.succ dstValue = Complexity.TM.binaryAddConstTime fixedValue_1 dstValue + 1 + Complexity.TM.binarySuccTime (dstValue + fixedValue_1)