Rational hitting lists: procedures #
Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a.
Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/RationalHitting/Procedures.lean
Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.
A concrete syntax for nonnegative polynomial bounds. This is only used to bound actual stack transitions, never as an additional machine instruction.
- const : ℕ → TimeBound
A fixed nonnegative bound.
- variable : TimeBound
The input-size parameter.
- add : TimeBound → TimeBound → TimeBound
Add two bounds.
- mul : TimeBound → TimeBound → TimeBound
Multiply two bounds.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq (Complexity.RationalHitting.TimeBound.const a) Complexity.RationalHitting.TimeBound.variable = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq (Complexity.RationalHitting.TimeBound.const a) (a_1.add a_2) = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq (Complexity.RationalHitting.TimeBound.const a) (a_1.mul a_2) = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq Complexity.RationalHitting.TimeBound.variable (Complexity.RationalHitting.TimeBound.const a) = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq Complexity.RationalHitting.TimeBound.variable Complexity.RationalHitting.TimeBound.variable = isTrue ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq Complexity.RationalHitting.TimeBound.variable (a.add a_1) = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq Complexity.RationalHitting.TimeBound.variable (a.mul a_1) = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq (a.add a_1) (Complexity.RationalHitting.TimeBound.const a_2) = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq (a.add a_1) Complexity.RationalHitting.TimeBound.variable = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq (a.add a_1) (a_2.mul a_3) = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq (a.mul a_1) (Complexity.RationalHitting.TimeBound.const a_2) = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq (a.mul a_1) Complexity.RationalHitting.TimeBound.variable = isFalse ⋯
- Complexity.RationalHitting.instDecidableEqTimeBound.decEq (a.mul a_1) (a_2.add a_3) = isFalse ⋯
Instances For
Equations
Evaluate a nonnegative polynomial time-bound expression at an input size.
Equations
Instances For
Substitution is again a polynomial with nonnegative coefficients.
Equations
Instances For
These certificates imply an ordinary fixed positive-coefficient, positive- degree power bound. This prevents any hidden superpolynomial time allowance.
A store with one specified register and all other registers empty.
Equations
- Complexity.RationalHitting.StackLanguage.single k w = Function.update (fun (x : K) => []) k w
Instances For
A quantitative implementation, with completely clean stack input and output. Both execution and result size are polynomially bounded.
- Registers : Type
Register labels for the procedure.
A finite register bank.
- decEq : DecidableEq self.Registers
Decidable register equality used by store updates.
- input : self.Registers
The register containing the encoded input.
- output : self.Registers
The register receiving the encoded output.
The finite program executed on the register bank.
- bound : TimeBound
A polynomial bound on time and output length.
- correct (a : A) : ∃ t ≤ self.bound.eval ((ca a).length + 1), Eval self.program (single self.input (ca a)) (single self.output (cb (f a))) t
Correct output and a clean final store within the bound.
The encoded result fits within the same polynomial bound.
Instances For
Order-preserving transfer, implemented using two stack reversals.
Equations
Instances For
Run in an embedded register bank, preserving every register outside it.
Composition uses disjoint scratch banks and an actual order-preserving stack transfer.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reinterpret equal input/output words, with no additional computation.
Equations
- One or more equations did not get rendered due to their size.