Rational hitting lists: binary subtract #
Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a.
Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/RationalHitting/BinarySubtract.lean
Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.
Shift-and-add on explicit little-endian words.
Equations
- One or more equations did not get rendered due to their size.
- Complexity.RationalHitting.StackLanguage.mulAccWord x✝¹ [] x✝ = x✝
- Complexity.RationalHitting.StackLanguage.mulAccWord x✝¹ (false :: b) x✝ = Complexity.RationalHitting.StackLanguage.mulAccWord (false :: x✝¹) b x✝
Instances For
Registers: 0 multiplicand, 1 multiplier, 2 accumulator, 3 copied addend, 4/5/6 addition scratch, 7 copy scratch.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Repeat the multiplication body over the multiplier bits.
Equations
Instances For
The normalized multiplication instruction; the accumulator starts at zero. After execution register 2 is the canonical binary product.
Equations
Instances For
Boolean full-subtractor gate.
Equations
- Complexity.RationalHitting.StackLanguage.differenceBit x y c = (x ^^ y ^^ c)
Instances For
Fixed-width subtraction, returning the overflow borrow. Registers may have leading zeros. Width is exactly the larger input word length.
Equations
Instances For
Branch on the head bit, treating an empty stack as false.
Equations
Instances For
Registers 0,1 input, 2 reverse output, 3 singleton borrow, 4 loop flag.
Equations
- One or more equations did not get rendered due to their size.