Rational hitting lists: grid computation #
Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a.
Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/RationalHitting/GridComputation.lean
Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.
theorem
Complexity.RationalHitting.StackLanguage.range_flatMap_to_finRange
{A : Type}
(n : ℕ)
(f : ℕ → List A)
:
@[reducible, inline]
Two integer matrices and a denominator for rational output encoding.
Equations
Instances For
Encode all entries of a normalized rational matrix in row order.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.RationalHitting.StackLanguage.Runtime.matrixWord_poly :
Poly fun (a : MatrixWordArgs) => matrixWord a.1.1 a.1.2 a.2
theorem
Complexity.RationalHitting.StackLanguage.Runtime.matrixWord_of
{d : ℕ}
(A B : Matrix (Fin d) (Fin d) ℤ)
(den : ℤ)
:
(matrixWord (DenseSquare.of A) (DenseSquare.of B) den).val = List.flatMap
(fun (i : Fin d) =>
List.flatMap (fun (j : Fin d) => encodeRat (Rat.divInt (A.updateCol i fun (r : Fin d) => B r j).det den))
(List.finRange d))
(List.finRange d)
@[reducible, inline]
Generator parameters, grid point, normalization matrix, and denominator.
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Complexity.RationalHitting.StackLanguage.Runtime.tupleWord
(p : Params)
(x : GridPoint)
(A : DenseSquare)
(den : ℤ)
:
Encode every variable matrix of one normalized tuple.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.RationalHitting.StackLanguage.Runtime.tupleWord_poly :
Poly fun (a : TupleWordArgs) => tupleWord a.1.1 a.1.2 a.2.1 a.2.2
theorem
Complexity.RationalHitting.StackLanguage.Runtime.tupleWord_eq
(n s : ℕ)
(x : GridPoint)
(den : ℤ)
:
(tupleWord (Params.of n s) x (matrix (Params.of n s) x 0) den).val = encodeTuple
(ExecutableGenerator.tuple
(ExecutableGenerator.normalized
(ExecutableGenerator.inputTables n (Parameters.truncation n s) (Parameters.exponent n s) (gridFn x)) den))
theorem
Complexity.RationalHitting.StackLanguage.Runtime.matrix_det_eq
(n s : ℕ)
(x : GridPoint)
(a : Fin (n + 1))
:
(matrix (Params.of n s) x { val := ↑a }).val.det = (Generator.integralLift n (Parameters.truncation n s) (Parameters.exponent n s) (gridFn x) a).det
theorem
Complexity.RationalHitting.StackLanguage.Runtime.point_eq
(n s : ℕ)
(x : GridPoint)
:
point (Params.of n s) x = List.map (fun (X : Tuple n (Generator.matrixDimension (Parameters.exponent n s))) => { val := encodeTuple X })
(ExecutableGenerator.atPoint n (Parameters.truncation n s) (Parameters.exponent n s) (gridFn x)).toList
theorem
Complexity.RationalHitting.StackLanguage.map_filterMap_toList
{A B C : Type}
(l : List A)
(f : A → Option B)
(g : B → C)
:
Concatenate the tuple encodings emitted throughout the three-dimensional grid.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.RationalHitting.StackLanguage.Runtime.words_eq
(n s : ℕ)
:
words (Params.of n s) = List.map (fun (X : Tuple n (ExecutableGenerator.list n s).dimension) => { val := encodeTuple X })
(ExecutableGenerator.list n s).tuples