Rational hitting lists: rational arithmetic #
Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a.
Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/RationalHitting/RationalArithmetic.lean
Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.
Compute a binomial coefficient and clear its input registers.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Separate the sign from an encoded integer magnitude.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.RationalHitting.StackLanguage.eval_unpackInt
{K : Type}
[DecidableEq K]
{a sg : K}
(has : a ≠ sg)
(s : Store K)
(z : ℤ)
(hz : s a = intCode z)
:
Eval (unpackInt a sg) s (Function.update (Function.update s a z.natAbs.bits) sg (decide (z < 0) :: s sg)) 5
Encode a rational quotient and clean its temporary sign registers.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A polynomially bounded procedure producing the canonical rational encoding.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[instance_reducible]
Equations
- Complexity.RationalHitting.StackLanguage.Unary.instAdd = { add := fun (a b : Complexity.RationalHitting.StackLanguage.Unary) => { val := a.val + b.val } }
@[instance_reducible]
Equations
- Complexity.RationalHitting.StackLanguage.Unary.instSub = { sub := fun (a b : Complexity.RationalHitting.StackLanguage.Unary) => { val := a.val - b.val } }
@[instance_reducible]
Equations
- Complexity.RationalHitting.StackLanguage.Unary.instMul = { mul := fun (a b : Complexity.RationalHitting.StackLanguage.Unary) => { val := a.val * b.val } }
@[instance_reducible]
Equations
- Complexity.RationalHitting.StackLanguage.Unary.instDiv = { div := fun (a b : Complexity.RationalHitting.StackLanguage.Unary) => { val := a.val / b.val } }
@[instance_reducible]
Equations
- Complexity.RationalHitting.StackLanguage.Unary.instMod = { mod := fun (a b : Complexity.RationalHitting.StackLanguage.Unary) => { val := a.val % b.val } }
@[instance_reducible]
Equations
- Complexity.RationalHitting.StackLanguage.Unary.instPowNat = { pow := fun (a : Complexity.RationalHitting.StackLanguage.Unary) (b : ℕ) => { val := a.val ^ b } }
Raise an integer to a unary exponent.
Equations
Instances For
theorem
Complexity.RationalHitting.StackLanguage.Poly.uPowInt :
Poly fun (a : ℤ × Unary) => Unary.powInt a.1 a.2