Rational hitting lists: matrix computation #
Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a.
Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/RationalHitting/MatrixComputation.lean
Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.
Consume one word and append it to a concatenation accumulator.
Equations
Instances For
Return the raw self-delimiting encoding of a binary natural word.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.RationalHitting.StackLanguage.Poly.wordConcat :
Poly fun (l : List BitWord) => { val := List.flatMap BitWord.val l }
theorem
Complexity.RationalHitting.StackLanguage.Poly.encodeNat :
Poly fun (a : ℕ) => { val := RationalHitting.encodeNat a }
@[reducible, inline]
Three unary coordinates of an integer specialization point.
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Complexity.RationalHitting.StackLanguage.Runtime.matrix
(p : Params)
(x : GridPoint)
(a : Unary)
:
Compute the dense integral matrix at the given grid point and variable index.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.RationalHitting.StackLanguage.Runtime.matrix_eq
(n s : ℕ)
(x : GridPoint)
(a : Fin (n + 1))
:
matrix (Params.of n s) x { val := ↑a } = DenseSquare.of (Generator.integralLift n (Parameters.truncation n s) (Parameters.exponent n s) (gridFn x) a)
Compute a Cramer numerator by replacing one matrix column.
Equations
Instances For
theorem
Complexity.RationalHitting.StackLanguage.Runtime.cramer_of
{d : ℕ}
(A B : Matrix (Fin d) (Fin d) ℤ)
(i j : Fin d)
:
cramer (DenseSquare.of A) (DenseSquare.of B) ↑i ↑j = DenseSquare.of (A.updateCol i fun (r : Fin d) => B r j)
theorem
Complexity.RationalHitting.StackLanguage.Runtime.cramer_encode_of
{d : ℕ}
(A B : Matrix (Fin d) (Fin d) ℤ)
(den : ℤ)
(i j : Fin d)
:
encodeRat (Rat.divInt (cramer (DenseSquare.of A) (DenseSquare.of B) ↑i ↑j).val.det den) = encodeRat (Rat.divInt (A.updateCol i fun (r : Fin d) => B r j).det den)