A two-by-two polynomial transformation, kept local to fast gcd rather than introducing a dependency on the matrix library.
- a00 : DensePoly F
Upper-left matrix entry.
- a01 : DensePoly F
Upper-right matrix entry.
- a10 : DensePoly F
Lower-left matrix entry.
- a11 : DensePoly F
Lower-right matrix entry.
Instances For
Identity transformation.
Equations
- Hex.DensePoly.GcdStep.one = { a00 := 1, a01 := 0, a10 := 0, a11 := 1 }
Instances For
One Euclidean transformation (a,b) ↦ (b,a-q*b).
Equations
- Hex.DensePoly.GcdStep.euclid q = { a00 := 0, a01 := 1, a10 := 1, a11 := -q }
Instances For
Matrix composition; compose m n applies n first and then m.
Equations
Instances For
The identity transformation has determinant one.
A Euclidean row update has determinant negative one.
Determinants multiply under transformation composition.
Plan-driven matrix composition. Half-gcd builds transformations at half the active degree and composes them before touching the full operands.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Compose one Euclidean row update with an existing transformation. The
elementary matrix contains only zero, one, and -q, so this specialization
uses two planned products instead of the eight used by generic composition.
Equations
Instances For
Matrix composition clipped to the coefficient range that can survive in the caller's degree-bounded transformation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
First row of a polynomial transformation application.
Second row of a polynomial transformation application.
Apply a transformation using the selected multiplication plan.
Equations
- Hex.DensePoly.GcdStep.applyWith plan m a b = (Hex.DensePoly.mulWith plan m.a00 a + Hex.DensePoly.mulWith plan m.a01 b, Hex.DensePoly.mulWith plan m.a10 a + Hex.DensePoly.mulWith plan m.a11 b)
Instances For
Reconstruct a full application from its already-computed high-half application and one application to the low halves. Half-gcd uses this to avoid applying the same recursive matrix to the full operands again.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Planned composition has the ordinary matrix semantics.
Specialized Euclidean composition has the generic planned matrix semantics.
Planned application has the ordinary matrix semantics.
Clipped matrix composition is ordinary composition once the bound covers all four resulting entries.
Identity leaves a pair unchanged.
The elementary matrix performs exactly one Euclidean update.
Matrix composition agrees with sequential application.
Polynomial-pair action is faithful for two-by-two transformations.
Identity is a right identity for transformation composition.
Identity is a left identity for transformation composition.
Compose the Euclidean matrices represented by a quotient sequence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute a quotient sequence as ordinary Euclidean pair updates.
Equations
- Hex.DensePoly.runQuotients [] x✝¹ x✝ = (x✝¹, x✝)
- Hex.DensePoly.runQuotients (q :: qs) x✝¹ x✝ = Hex.DensePoly.runQuotients qs x✝ (x✝¹ - q * x✝)
Instances For
The executable quotient matrix performs exactly the corresponding Euclidean update sequence.
Running concatenated quotient blocks is sequential execution.
Quotient matrices turn list concatenation into matrix composition.
A quotient transformation is unimodular.
A singleton quotient list is its elementary Euclidean matrix.
A quotient sequence is an exact prefix of the established Euclidean sequence, ending at the displayed pair.
- nil {F : Type u} [DecidableEq F] [Lean.Grind.Field F] (a b : DensePoly F) : ExactQuotients [] a b a b
- cons {F : Type u} [DecidableEq F] [Lean.Grind.Field F] {q r a b c d : DensePoly F} {qs : List (DensePoly F)} (hdiv : a.divMod b = (q, r)) (tail : ExactQuotients qs b r c d) : ExactQuotients (q :: qs) a b c d
Instances For
An exact Euclidean prefix containing only steps at which the divisor is
nonzero. This is the executable trace relation: xgcdAux takes precisely
these steps and stops before any attempted division by zero.
- nil {F : Type u} [DecidableEq F] [Lean.Grind.Field F] (a b : DensePoly F) : ActiveQuotients [] a b a b
- cons {F : Type u} [DecidableEq F] [Lean.Grind.Field F] {q r a b c d : DensePoly F} {qs : List (DensePoly F)} (hb : 0 < b.size) (hdiv : a.divMod b = (q, r)) (tail : ActiveQuotients qs b r c d) : ActiveQuotients (q :: qs) a b c d
Instances For
An exact Euclidean prefix whose divisors have positive degree and whose quotients are nonzero. These are precisely the steps a half-gcd block may lift from high halves; constant-divisor finishing remains an exact boundary division.
- nil {F : Type u} [DecidableEq F] [Lean.Grind.Field F] (a b : DensePoly F) : ProperQuotients [] a b a b
- cons {F : Type u} [DecidableEq F] [Lean.Grind.Field F] {q r a b c d : DensePoly F} {qs : List (DensePoly F)} (hq : 0 < q.size) (hb : 1 < b.size) (hdiv : a.divMod b = (q, r)) (tail : ProperQuotients qs b r c d) : ProperQuotients (q :: qs) a b c d
Instances For
Forgetting the half-gcd degree guards leaves an ordinary exact Euclidean prefix.
Proper half-gcd steps are active executable Euclidean steps.
Every active trace is an exact Euclidean prefix.
Concatenating adjacent proper blocks preserves their Euclidean certificate.
Concatenating adjacent exact Euclidean blocks preserves exactness.
Concatenating adjacent active traces preserves executability.
Reusing the exact high-half application preserves ordinary matrix application semantics.
Executing an exact prefix reaches its certified terminal pair.
Consequently the composed quotient matrix reaches the same certified terminal pair.
A half-gcd transformation stopped at a requested remainder-size boundary. The displayed pair is cached so callers do not reapply the completed matrix to the full inputs.
- matrix : GcdStep F
Transformation applied to the input polynomial pair.
- first : DensePoly F
First polynomial in the transformed pair.
- second : DensePoly F
Second polynomial in the transformed pair.
Instances For
Reduce an ordered Euclidean pair until its second component reaches
bound. The shifted high-half call is chosen so that its half-size boundary
lifts to bound; when the pair is still much larger, ordinary half-gcd blocks
halve it first. Size checks make every high-half prediction untrusted, just
as in halfGcdMatrix.
Equations
- One or more equations did not get rendered due to their size.
- Hex.DensePoly.reduceToMatrixResult plan bound 0 x✝¹ x✝ = { matrix := Hex.DensePoly.GcdStep.one, first := x✝¹, second := x✝ }
Instances For
A complete active Euclidean trace has at most one quotient per stored coefficient of its initial divisor.
Proper Euclidean blocks preserve strict ordering of consecutive remainders.
The second remainder of a proper block never exceeds its second input.
A proper quotient block computed on high halves lifts to the full inputs once its terminal pair has the shifted high-half sizes. The proof runs the Euclidean recurrence backward: terminal sizes determine the preceding two sizes, making every proposed remainder strictly smaller than its divisor and therefore every quotient exact.
The boundary reducer is an exact Euclidean prefix, straddles the requested size, and exposes the complementary continuant size used by rational reconstruction and Padé approximation.
Every boundary transformation is unimodular.
Kernel-visible extended gcd; native code uses the proved half-gcd engine.
Equations
- Hex.DensePoly.xgcdWith plan p q = p.xgcd q
Instances For
Kernel-visible gcd with exact reference scaling.
Equations
- Hex.DensePoly.gcdWith plan p q = p.gcd q
Instances For
Kernel-visible one-sided extended gcd.
Equations
- Hex.DensePoly.xgcdLeftWith plan p q = p.xgcdLeft q
Instances For
Plan-driven half-gcd extended gcd.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Gcd projection of the half-gcd engine.
Equations
- Hex.DensePoly.gcdWithImpl plan p q = (Hex.DensePoly.xgcdWithImpl plan p q).gcd
Instances For
One-sided result projection of the half-gcd engine. It shares the full
matrix computation with xgcdWithImpl; this API omits the unused result field but
does not promise a cheaper algorithm.
Equations
- Hex.DensePoly.xgcdLeftWithImpl plan p q = { gcd := (Hex.DensePoly.xgcdWithImpl plan p q).gcd, left := (Hex.DensePoly.xgcdWithImpl plan p q).left }
Instances For
Half-gcd returns exactly the established extended-gcd result, including the raw gcd scaling and both Bezout coefficients.
Half-gcd returns exactly the established gcd.
The one-sided half-gcd projection agrees exactly with the established one-sided extended gcd.
Planned extended gcd has the exact reference result.
Planned gcd retains the exact reference scaling.
Planned one-sided extended gcd retains the exact reference result.
Compile the extended-gcd reference through the existing half-gcd engine.
Compile the gcd reference through the existing half-gcd projection.
Compile the one-sided reference through the existing half-gcd projection.