Rational hitting lists: binary multiply #
Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a.
Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/RationalHitting/BinaryMultiply.lean
Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.
Removes the high zero bits of a most-significant-first word.
Equations
Instances For
Remove redundant high zero bits from a binary word.
Equations
Instances For
@[simp]
One step removing high zero bits from a reversed word.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Trim high zeros until the leading one or the empty word is reached.
Equations
Instances For
theorem
Complexity.RationalHitting.StackLanguage.eval_trimLoop
{K : Type}
[DecidableEq K]
{a flag : K}
(haf : a ≠ flag)
(s : Store K)
(hf : s flag = [true])
:
∃ t ≤ 3 * (s a).length + 6, Eval (trimLoop a flag) s (Function.update (Function.update s a (trimMSD (s a))) flag []) t
Normalize a binary stack word using a reversed temporary copy.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.RationalHitting.StackLanguage.eval_normalize
{K : Type}
[DecidableEq K]
{a tmp flag : K}
(hat : a ≠ tmp)
(haf : a ≠ flag)
(htf : tmp ≠ flag)
(s : Store K)
:
∃ t ≤ 7 * (s a).length + 2 * (s tmp).length + 2 * (s flag).length + 16,
Eval (normalize a tmp flag) s
(Function.update (Function.update (Function.update s a (normalizeWord (s a))) tmp []) flag []) t