Documentation

CslibFrontier.Computability.PolyTime.GaloisRingSeries

Coordinates, precision changes and truncated products over (ℤ / 2 ^ p)[U] / (f) #

Supporting operations on the coefficient lists of CslibFrontier/Computability/PolyTime/GaloisRingArithmetic.lean, for the native recovery step of the contraction algorithm of [OAI26k] (Appendix D.4.4, pp. 60–61).

Truncated products and GaloisRingArith.shiftDown are polynomial-time, with the precision, the length and the shift in unary (GaloisRingArith.computableInPolyTime_tmul, GaloisRingArith.computableInPolyTime_shiftDown).

Main definitions #

Main results #

References #

Coordinates #

theorem Cslib.GaloisRingArith.val_eq_mk {p : ℕ} {fl : List ℕ} (c : List ℕ) :

A coefficient list is the class of the polynomial with those coefficients.

@[simp]
theorem Cslib.GaloisRingArith.val_singleton {p : ℕ} {fl : List ℕ} (c : ℕ) :
val p fl [c] = ↑c

The single coordinate list [c] has value c.

theorem Cslib.GaloisRingArith.coeff_modByMonicHom_val {p : ℕ} {fl : List ℕ} (c : List ℕ) (i : ℕ) :
((AdjoinRoot.modByMonicHom ⋯) (val p fl c)).coeff i = if i < fl.length then ↑(c.getD i 0) else 0

The coordinates of the value of a coefficient list, read off by division by the monic polynomial.

theorem Cslib.GaloisRingArith.mod_eq_of_val_eq {p : ℕ} {fl c d : List ℕ} (h : val p fl c = val p fl d) {i : ℕ} (hi : i < fl.length) :
c.getD i 0 % 2 ^ p = d.getD i 0 % 2 ^ p

Coordinates are determined modulo 2 ^ p.

theorem Cslib.GaloisRingArith.exists_val_eq {p : ℕ} {fl : List ℕ} (y : Ring p fl) :
∃ (r : List ℕ), r.length = fl.length ∧ (∀ x ∈ r, x < 2 ^ p) ∧ val p fl r = y

Every element is the value of a reduced coefficient list.

theorem Cslib.GaloisRingArith.getD_map_of_map_zero {f : ℕ → ℕ} (hf : f 0 = 0) (c : List ℕ) (i : ℕ) :
(List.map f c).getD i 0 = f (c.getD i 0)

Mapping a function that fixes 0 commutes with reading a coordinate.

theorem Cslib.GaloisRingArith.val_map_mul {p : ℕ} {fl : List ℕ} (k : ℕ) (c : List ℕ) :
val p fl (List.map (fun (x : ℕ) => k * x) c) = ↑k * val p fl c

Scaling every coordinate by k multiplies the value by k.

Changing the precision #

noncomputable def Cslib.GaloisRingArith.reduce {n N : ℕ} (h : n ≤ N) (fl : List ℕ) :
Ring N fl →+* Ring n fl

Reduction A_N → A_n from a higher precision to a lower one.

theorem Cslib.GaloisRingArith.reduce_val {fl : List ℕ} {n N : ℕ} (h : n ≤ N) (c : List ℕ) :
(reduce h fl) (val N fl c) = val n fl c

Reduction keeps the coordinates.

theorem Cslib.GaloisRingArith.exists_eq_add_of_reduce_eq {fl : List ℕ} {n N : ℕ} (h : n ≤ N) {x y : Ring N fl} (hxy : (reduce h fl) x = (reduce h fl) y) :
∃ (c : Ring N fl), x = y + 2 ^ n * c

Equal reductions differ by a multiple of 2 ^ n: the kernel of reduction A_N → A_n is 2 ^ n A_N.

theorem Cslib.GaloisRingArith.exists_val_eq_add_of_val_eq {fl : List ℕ} {n N : ℕ} (h : n ≤ N) {w : List ℕ} {y : Ring N fl} (hw : val n fl w = (reduce h fl) y) :
∃ (c : Ring N fl), val N fl w = y + 2 ^ n * c

A value at a lower precision lifts with an error divisible by 2 ^ n: a coefficient list whose value in A_n is the reduction of y ∈ A_N has value y + 2 ^ n c in A_N.

Division of each coordinate by 2 ^ Δ.

theorem Cslib.GaloisRingArith.val_shiftDown {fl : List ℕ} {n Δ : ℕ} {s : List ℕ} {y : Ring (n + Δ) fl} (h : val (n + Δ) fl s = 2 ^ Δ * y) :
val n fl (shiftDown Δ s) = (reduce ⋯ fl) y

Cancelling a common power of two. If a coefficient list has value 2 ^ Δ y at precision n + Δ, dividing its coordinates by 2 ^ Δ gives the reduction of y to precision n.

Truncated products #

def Cslib.GaloisRingArith.cauchyCoeff (p : ℕ) (fl : List ℕ) (P R : List (List ℕ)) (j : ℕ) :

The coefficient of z ^ j in the product of two polynomials over A_p, by the Cauchy formula ∑ i ≤ j, P_i R_(j - i).

def Cslib.GaloisRingArith.tmul (p : ℕ) (fl : List ℕ) (J : ℕ) (P R : List (List ℕ)) :

The truncated product: the first J coefficients of the product of two polynomials over A_p.

theorem Cslib.GaloisRingArith.val_cauchyCoeff {p : ℕ} {fl : List ℕ} (P R : List (List ℕ)) (j : ℕ) :
val p fl (cauchyCoeff p fl P R j) = ∑ i ∈ Finset.range (j + 1), val p fl (P.getD i []) * val p fl (R.getD (j - i) [])
@[simp]
theorem Cslib.GaloisRingArith.length_tmul {p : ℕ} {fl : List ℕ} (J : ℕ) (P R : List (List ℕ)) :
(tmul p fl J P R).length = J
theorem Cslib.GaloisRingArith.val_tmul {p : ℕ} {fl : List ℕ} {J : ℕ} (P R : List (List ℕ)) {j : ℕ} (hj : j < J) :
val p fl ((tmul p fl J P R).getD j []) = ∑ i ∈ Finset.range (j + 1), val p fl (P.getD i []) * val p fl (R.getD (j - i) [])

Truncated products are correct: below z ^ J the coefficients are those of the product.

Odd scalars are units #

theorem Cslib.GaloisRingArith.isUnit_natCast_of_odd {p : ℕ} {fl : List ℕ} {o : ℕ} (ho : Odd o) :
IsUnit ↑o

An odd natural number is a unit of A_p.

Polynomial time #

theorem Cslib.GaloisRingArith.lt_of_mem_cauchyCoeff {p : ℕ} {fl : List ℕ} {P R : List (List ℕ)} {j x : ℕ} (hx : x ∈ cauchyCoeff p fl P R j) :
x < 2 ^ p
theorem Cslib.GaloisRingArith.length_cauchyCoeff {p : ℕ} {fl : List ℕ} (P R : List (List ℕ)) (j : ℕ) :
(cauchyCoeff p fl P R j).length = fl.length
theorem Cslib.GaloisRingArith.small_of_mem_tmul {p : ℕ} {fl : List ℕ} {J : ℕ} {P R : List (List ℕ)} {c : List ℕ} (hc : c ∈ tmul p fl J P R) :
Small p fl c

Every coefficient of a truncated product is small.