Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.NativeRecovery

Native tapered recovery (Lemma D.5) on coefficient lists #

This file gives the native procedure behind the recovery step of the contraction algorithm of [OAI26k] (§D.4.4, Lemma D.5, pp. 60–61), and proves that it computes the mathematical recovery Cslib.Circuits.Frontier.recoverFromValues of CslibFrontier/Computability/Circuit/Frontier/TensorNetwork/ActiveCall.lean modulo 2 ^ p.

Input. A precision p, a shift Δ, the monic polynomial fl of CslibFrontier/Computability/PolyTime/GaloisRingArithmetic.lean, the parameters a, u, h, the interpolation points ζ and, for each node index k < 2 ^ (a + 1), k ≠ 2 ^ a (the node t = k - 2 ^ a, NativeRecovery.node), the values at the points. All arithmetic is in A_N = (ℤ / 2 ^ N)[U] / (f) with N = p + Δ.

Procedure (NativeRecovery.recover). For each node t of multiplicity J = q_t:

  1. interpolate the values (GaloisRingArith.interp);
  2. multiply by the reciprocal of E_t(t + α z) below z ^ J (NativeRecovery.recip). Each factor of E_t(t + α z) is a power of 1 + c_q z with c_q = α / (t - q), a 2-adic integer (NativeRecovery.slopeConst), whose reciprocal is the geometric series of -c_q;
  3. combine the J coefficients with the multipliers 2 ^ Δ E_t(0) (-t / α) ^ j (NativeRecovery.coeffMult). Since E_t(0) = ∏_q (-q c_q / α) ^ (q_q), the multiplier is 2 ^ (Δ - (a + 1)(M_t + j)) ∏_q (-q c_q) ^ (q_q) (-t) ^ j with M_t = ∑_q q_q, a 2-adic integer once Δ ≥ (a + 1)(M_t + j).

The sum over the nodes is 2 ^ Δ times the recovered value. Dividing its coordinates by 2 ^ Δ (GaloisRingArith.shiftDown) gives the recovered value modulo 2 ^ p.

Precision. The values at node t need only be known modulo 2 ^ p_t: the multipliers have 2-adic valuation at least Δ + p - p_t when p + 6 h D_t + q_t (a + 1) ≤ p_t ((D.10) and the evaluation loss), so the error is killed in A_N. This is the precision estimate of Lemma D.5 (Cslib.Circuits.Frontier.exists_taperedRecovery_eq_add), carried out natively.

Correctness. Let π : B → A_N be a ring homomorphism from a subring B ⊇ ℤ_(2) of a ℚ-algebra K (in the manuscript, B = O). The native interpolant is the image of the interpolant over B modulo 2 ^ p_t (NativeRecovery.exists_pval_interp_eq_add), the Hermite quotient over K of a polynomial over B is the image of its product with the reciprocal series (NativeRecovery.hermiteQuotient_map_subtype), and 2 ^ Δ times the recovered value is the sum of the node contributions over B (NativeRecovery.two_pow_mul_recoverFromValues). So when the recovered value recoverFromValues B a u h ζ v lies in B, native recovery computes its image modulo 2 ^ p (NativeRecovery.val_recover).

Polynomial time. Every loop is a fold over a range or over the other node indices, so native recovery is polynomial-time with the precision, the shift, the parameters and 2 ^ a in unary (NativeRecovery.computableInPolyTime_recover).

Main definitions #

Main results #

References #

Nodes #

The node t = k - 2 ^ a of index k.

The 2-adic valuation of d, capped at b: the number of i < b with 2 ^ (i + 1) ∣ d, and 0 for d = 0. It is v₂ d when d < 2 ^ b (NativeRecovery.twoVal_eq).

The multiplicity q_t = h (u - v₂ t) of the node of index k.

theorem Cslib.Circuits.Frontier.NativeRecovery.mult_eq {a k : ℕ} (u h : ℕ) (hk : k < 2 ^ (a + 1)) :
mult a u h k = taperMult u h (node a k)

The indices of the nodes other than the node of index k.

The total multiplicity M_t = ∑_{q ≠ t} q_q of the other nodes.

Constants #

The integer x - y as a constant of A_N.

The 2-adic integer 2 ^ (a + 1) / (x - y) as a constant of A_N, for 0 < |x - y| ≤ 2 ^ (a + 1): with |x - y| = 2 ^ v o, o odd, it is ± 2 ^ (a + 1 - v) o⁻¹.

The reciprocal of E_t(t + α z) #

The geometric series ∑_{i < J} (-c) ^ i z ^ i, the reciprocal of 1 + c z below z ^ J.

Multiply by the reciprocal of (1 + c z) ^ m below z ^ J.

The reciprocal of E_t(t + α z) below z ^ J, for the node of index k: the product of the reciprocals of (1 + c_q z) ^ (q_q) over the other nodes q, c_q = α / (t - q).

The multipliers #

∏_{q ≠ t} (-q c_q) ^ (q_q) for the node of index k.

The multiplier 2 ^ Δ E_t(0) (-t / α) ^ j of the coefficient of z ^ j at the node of index k, as 2 ^ (Δ - (a + 1)(M_t + j)) ∏_{q ≠ t} (-q c_q) ^ (q_q) (-t) ^ j.

Recovery #

def Cslib.Circuits.Frontier.NativeRecovery.nodeTerm (N : ℕ) (fl : List ℕ) (a u h Δ : ℕ) (ζ : List (List ℕ)) (k : ℕ) (w : List (List ℕ)) :

The contribution of the node of index k, from its values w at the points ζ: interpolate, divide by E_t(t + α z) below z ^ q_t, and combine the coefficients with the multipliers.

def Cslib.Circuits.Frontier.NativeRecovery.recover (p Δ : ℕ) (fl : List ℕ) (a u h : ℕ) (ζ : List (List ℕ)) (W : List (List (List ℕ))) :

Native tapered recovery. From the values W.getD k [] at the points ζ for each node index k, the value recovered modulo 2 ^ p, computing in A_(p + Δ) and dividing by 2 ^ Δ at the end.

Storing the values #

Store the value y at node index k, after the values already stored there. This is the accumulator update of a recursive call once the value at an interpolation point is complete; NativeRecovery.recover reads the table.

theorem Cslib.Circuits.Frontier.NativeRecovery.getD_foldl_storeValue (W : List (List (List ℕ))) (l : List (ℕ × List ℕ)) (k : ℕ) :
(List.foldl (fun (W : List (List (List ℕ))) (e : ℕ × List ℕ) => storeValue W e.1 e.2) W l).getD k [] = W.getD k [] ++ List.map Prod.snd (List.filter (fun (e : ℕ × List ℕ) => decide (e.1 = k)) l)

Storing a sequence of values: each node index receives its values in order.

Correctness of the constants #

theorem Cslib.Circuits.Frontier.NativeRecovery.val_diffConst {N : ℕ} {fl : List ℕ} (x y : ℕ) :
GaloisRingArith.val N fl (diffConst N fl x y) = ↑(↑x - ↑y)
noncomputable def Cslib.Circuits.Frontier.NativeRecovery.slope (a : ℕ) {t q : ℤ} (ht : t ∈ cauchyGrid (2 ^ a)) (hq : q ∈ cauchyGrid (2 ^ a)) (hne : q ≠ t) :

The 2-adic integer 2 ^ (a + 1) / (t - q) for distinct grid points.

theorem Cslib.Circuits.Frontier.NativeRecovery.val_slopeConst {N : ℕ} {fl : List ℕ} (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (GaloisRingArith.monicOf fl))) (ρ : ↥(Rat.padicValuation 2).integer →+* GaloisRingArith.Ring N fl) {a k k' : ℕ} (hk : k < 2 ^ (a + 1)) (hk' : k' < 2 ^ (a + 1)) (hne : k' ≠ k) :
GaloisRingArith.val N fl (slopeConst N fl a k k') = ρ (slope a ⋯ ⋯ ⋯)

The slope constant is correct: for every ring homomorphism ρ from ℤ_(2), it is the image of 2 ^ (a + 1) / (t - q).

The slope 2 ^ (a + 1) / (t - q) for node indices k, k', and 0 off the grid.

theorem Cslib.Circuits.Frontier.NativeRecovery.val_slopeConst' {N : ℕ} {fl : List ℕ} (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (GaloisRingArith.monicOf fl))) (ρ : ↥(Rat.padicValuation 2).integer →+* GaloisRingArith.Ring N fl) {a k k' : ℕ} (hk : k < 2 ^ (a + 1)) (hk' : k' < 2 ^ (a + 1)) (hne : k' ≠ k) :
GaloisRingArith.val N fl (slopeConst N fl a k k') = ρ (slope' a k k')
theorem Cslib.Circuits.Frontier.NativeRecovery.coe_slope' {a k k' : ℕ} (hk : k < 2 ^ (a + 1)) (hk' : k' < 2 ^ (a + 1)) (hne : k' ≠ k) :
↑(slope' a k k') = 2 ^ (a + 1) / (↑(node a k) - ↑(node a k'))

Correctness of the reciprocal #

The geometric series ∑ (-c) ^ i z ^ i, the inverse of 1 + c z.

The reciprocal of E_t(t + α z) over ℤ_(2) for the node of index k, in the order of NativeRecovery.recip.

theorem Cslib.Circuits.Frontier.NativeRecovery.mem_others {a k k' : ℕ} :
k' ∈ others a k ↔ k' < 2 ^ (a + 1) ∧ k' ≠ 2 ^ a ∧ k' ≠ k
theorem Cslib.Circuits.Frontier.NativeRecovery.val_tmul_eq {N : ℕ} {fl : List ℕ} {ρ : ↥(Rat.padicValuation 2).integer →+* GaloisRingArith.Ring N fl} {J : ℕ} {P G : List (List ℕ)} {φ χ : PowerSeries ↥(Rat.padicValuation 2).integer} (hP : ∀ i < J, GaloisRingArith.val N fl (P.getD i []) = ρ ((PowerSeries.coeff i) φ)) (hG : ∀ i < J, GaloisRingArith.val N fl (G.getD i []) = ρ ((PowerSeries.coeff i) χ)) {i : ℕ} (hi : i < J) :
GaloisRingArith.val N fl ((GaloisRingArith.tmul N fl J P G).getD i []) = ρ ((PowerSeries.coeff i) (φ * χ))

A truncated product computes the coefficients of the product of power series.

theorem Cslib.Circuits.Frontier.NativeRecovery.val_geom {N : ℕ} {fl : List ℕ} {ρ : ↥(Rat.padicValuation 2).integer →+* GaloisRingArith.Ring N fl} {J : ℕ} {c : List ℕ} {γ : ↥(Rat.padicValuation 2).integer} (hc : GaloisRingArith.val N fl c = ρ γ) {i : ℕ} (hi : i < J) :
GaloisRingArith.val N fl ((geom N fl J c).getD i []) = ρ ((PowerSeries.coeff i) (geomSeries γ))
theorem Cslib.Circuits.Frontier.NativeRecovery.val_recip {N : ℕ} {fl : List ℕ} (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (GaloisRingArith.monicOf fl))) (ρ : ↥(Rat.padicValuation 2).integer →+* GaloisRingArith.Ring N fl) {a u h k J : ℕ} (hk : k < 2 ^ (a + 1)) {i : ℕ} (hi : i < J) :
GaloisRingArith.val N fl ((recip N fl a u h k J).getD i []) = ρ ((PowerSeries.coeff i) (recipSeries a u h k))

The native reciprocal is correct: its coefficients below z ^ J are the images of those of NativeRecovery.recipSeries.

Products over the nodes #

The nodes are the images of the indices k < 2 ^ (a + 1), k ≠ 2 ^ a.

theorem Cslib.Circuits.Frontier.NativeRecovery.prod_others {M : Type u_1} [CommMonoid M] (f : ℤ → M) {a k : ℕ} :
(List.map (fun (k' : ℕ) => f (node a k')) (others a k)).prod = ∏ q ∈ (recoveryNodes a).erase (node a k), f q

The other nodes, as integers, are the nonzero grid points other than t.

theorem Cslib.Circuits.Frontier.NativeRecovery.sum_others {M : Type u_1} [AddCommMonoid M] (f : ℤ → M) {a k : ℕ} :
(List.map (fun (k' : ℕ) => f (node a k')) (others a k)).sum = ∑ q ∈ (recoveryNodes a).erase (node a k), f q

The other nodes, as integers, are the nonzero grid points other than t.

theorem Cslib.Circuits.Frontier.NativeRecovery.sum_recoveryNodes {M : Type u_1} [AddCommMonoid M] (f : ℤ → M) (a : ℕ) :
∑ t ∈ recoveryNodes a, f t = ∑ k ∈ Finset.range (2 ^ (a + 1)), if k = 2 ^ a then 0 else f (node a k)

A sum over the nodes is a sum over the node indices.

Correctness of the multipliers #

theorem Cslib.Circuits.Frontier.NativeRecovery.val_foldl_mul {N : ℕ} {fl : List ℕ} {ι : Type u_1} (g : ι → List ℕ) (l : List ι) (c : List ℕ) :
GaloisRingArith.val N fl (List.foldl (fun (acc : List ℕ) (x : ι) => GaloisRingArith.mul N fl acc (g x)) c l) = GaloisRingArith.val N fl c * (List.map (fun (x : ι) => GaloisRingArith.val N fl (g x)) l).prod

A fold of multiplications is a product.

The multiplier 2 ^ Δ E_t(0) (-t / α) ^ j as a 2-adic integer: 2 ^ (Δ - (a + 1)(M_t + j)) ∏_{q ≠ t} (-q c_q) ^ (q_q) (-t) ^ j.

theorem Cslib.Circuits.Frontier.NativeRecovery.val_coeffMult {N : ℕ} {fl : List ℕ} (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (GaloisRingArith.monicOf fl))) (ρ : ↥(Rat.padicValuation 2).integer →+* GaloisRingArith.Ring N fl) {a u h Δ k : ℕ} (hk : k < 2 ^ (a + 1)) (j : ℕ) :
GaloisRingArith.val N fl (coeffMult N fl a u h Δ k j) = ρ (gamma a u h Δ k j)

The native multiplier is correct.

theorem Cslib.Circuits.Frontier.NativeRecovery.eval_zero_hermiteBasis_eq_prod (a u h k : ℕ) :
Polynomial.eval 0 (Polynomial.hermiteBasis (recoveryNodes a) (fun (q : ℤ) => ↑q) (taperMult u h) (node a k)) = (List.map (fun (k' : ℕ) => (Ring.inverse (↑(node a k) - ↑(node a k')) * (0 - ↑(node a k'))) ^ mult a u h k') (others a k)).prod

The value E_t(0) over ℚ as a product over the other node indices.

theorem Cslib.Circuits.Frontier.NativeRecovery.coe_gamma {a u h Δ k j : ℕ} (hk : k < 2 ^ (a + 1)) (hΔ : (a + 1) * (multSum a u h k + j) ≤ Δ) :
↑(gamma a u h Δ k j) = 2 ^ Δ * Polynomial.eval 0 (Polynomial.hermiteBasis (recoveryNodes a) (fun (q : ℤ) => ↑q) (taperMult u h) (node a k)) * (-↑(node a k) / 2 ^ (a + 1)) ^ j

The multiplier is 2 ^ Δ E_t(0) (-t / α) ^ j.

Precision #

theorem Cslib.Circuits.Frontier.NativeRecovery.gamma_mul_two_pow_eq_zero {N : ℕ} {fl : List ℕ} (ρ : ↥(Rat.padicValuation 2).integer →+* GaloisRingArith.Ring N fl) {a u h Δ p pt k j : ℕ} (hk : k < 2 ^ (a + 1)) (hkL : k ≠ 2 ^ a) (hj : j < mult a u h k) (hΔ : (a + 1) * (multSum a u h k + j) ≤ Δ) (hpt : p + 6 * h * 2 ^ (a - padicValInt 2 (node a k)) + mult a u h k * (a + 1) ≤ pt) (hN : N = p + Δ) :
ρ (gamma a u h Δ k j) * 2 ^ pt = 0

The multipliers kill the input error. If p + 6 h D_t + q_t (a + 1) ≤ p_t, the multiplier of every coefficient below z ^ q_t is divisible by 2 ^ (N - p_t) in ℤ_(2), N = p + Δ, so it annihilates 2 ^ p_t in A_N.

The interpolation bridge #

The coefficients of a polynomial over A_N given by a list of coefficient lists.

Interpolation at n nodes has degree below n.

theorem Cslib.Circuits.Frontier.NativeRecovery.exists_pval_interp_eq_add {N : ℕ} {fl : List ℕ} (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (GaloisRingArith.monicOf fl))) {B : Type u_1} [CommRing B] (π : B →+* GaloisRingArith.Ring N fl) {n : ℕ} (ζ : Fin n → B) (hζ : Pairwise fun (k l : Fin n) => IsUnit (ζ k - ζ l)) (ζl : List (List ℕ)) (hlen : ζl.length = n) (hζl : ∀ (i : Fin n), GaloisRingArith.val N fl (ζl.getD ↑i []) = π (ζ i)) (r : Fin n → B) (w : List (List ℕ)) (e : ℕ) (hw : ∀ (i : Fin n), ∃ (c : GaloisRingArith.Ring N fl), GaloisRingArith.val N fl (w.getD ↑i []) = π (r i) + 2 ^ e * c) :

The interpolation bridge. Let π : B → A_N be a ring homomorphism, and let the native nodes ζl represent the images of nodes ζ i ∈ B with unit differences. If the native values w agree with the images of r i ∈ B modulo 2 ^ e, then the native interpolant agrees with the image of the interpolant of r over B modulo 2 ^ e.

The Hermite quotient over B #

theorem Cslib.Circuits.Frontier.NativeRecovery.foldl_mul_eq {M : Type u_1} {ι : Type u_2} [CommMonoid M] (g : ι → M) (l : List ι) (c : M) :
List.foldl (fun (x : M) (y : ι) => x * g y) c l = c * (List.map g l).prod

A fold of multiplications is a list product.

theorem Cslib.Circuits.Frontier.NativeRecovery.foldl_add_eq {M : Type u_1} {ι : Type u_2} [AddCommMonoid M] (g : ι → M) (l : List ι) (c : M) :
List.foldl (fun (x : M) (y : ι) => x + g y) c l = c + (List.map g l).sum

A fold of additions is a list sum.

Over ℚ, E_t(t + α z) times the reciprocal series is one.

theorem Cslib.Circuits.Frontier.NativeRecovery.invOfUnit_hermiteBasis_comp {K : Type u_1} [CommRing K] [Algebra ℚ K] {a k : ℕ} (u h : ℕ) (hk : k < 2 ^ (a + 1)) (hkL : k ≠ 2 ^ a) :

The reciprocal series is the inverse of E_t(t + α z) over every ℚ-algebra.

theorem Cslib.Circuits.Frontier.NativeRecovery.hermiteQuotient_map_subtype {K : Type u_1} [CommRing K] [Algebra ℚ K] (B : Subring K) (hB : ∀ c ∈ (Rat.padicValuation 2).integer, (algebraMap ℚ K) c ∈ B) {a k : ℕ} (u h : ℕ) (hk : k < 2 ^ (a + 1)) (hkL : k ≠ 2 ^ a) (P : Polynomial ↥B) :
Polynomial.hermiteQuotient (recoveryNodes a) (fun (q : ℤ) => ↑q) (taperMult u h) (2 ^ (a + 1)) (node a k) ↑(Polynomial.map B.subtype P) = Polynomial.map B.subtype ((PowerSeries.trunc (mult a u h k)) (↑P * (PowerSeries.map (integerHom B hB)) (recipSeries a u h k)))

The Hermite quotient over B. For a polynomial P over B, the Hermite quotient over K at the node of index k is the image of the truncation below z ^ q_t of the product of P with the reciprocal series.

Assembly #

noncomputable def Cslib.Circuits.Frontier.NativeRecovery.nodeSum {K : Type u_1} [CommRing K] [Algebra ℚ K] (B : Subring K) (hB : ∀ c ∈ (Rat.padicValuation 2).integer, (algebraMap ℚ K) c ∈ B) (a u h Δ k : ℕ) (P : Polynomial ↥B) :
↥B

The contribution of the node of index k to 2 ^ Δ times the recovered value, over B: ∑_{j < q_t} γ_{t,j} c_j, where c_j is the coefficient of z ^ j in the product of P with the reciprocal series and γ_{t,j} = 2 ^ Δ E_t(0) (-t / α) ^ j (NativeRecovery.gamma).

theorem Cslib.Circuits.Frontier.NativeRecovery.multSum_add_mult {a k : ℕ} (u h : ℕ) (hk : k < 2 ^ (a + 1)) (hkL : k ≠ 2 ^ a) :
multSum a u h k + mult a u h k = ∑ t ∈ recoveryNodes a, taperMult u h t
theorem Cslib.Circuits.Frontier.NativeRecovery.le_of_lt_mult {a u h Δ k j : ℕ} (hk : k < 2 ^ (a + 1)) (hkL : k ≠ 2 ^ a) (hj : j < mult a u h k) (hΔ : (a + 1) * ∑ t ∈ recoveryNodes a, taperMult u h t ≤ Δ) :
(a + 1) * (multSum a u h k + j) ≤ Δ
theorem Cslib.Circuits.Frontier.NativeRecovery.two_pow_mul_recoverFromValues {K : Type u_1} [CommRing K] [Algebra ℚ K] (B : Subring K) (hB : ∀ c ∈ (Rat.padicValuation 2).integer, (algebraMap ℚ K) c ∈ B) {a u h Δ : ℕ} (hΔ : (a + 1) * ∑ t ∈ recoveryNodes a, taperMult u h t ≤ Δ) {n : ℕ} (ζ : Fin n → ↥B) (v : ℤ → Fin n → ↥B) :
2 ^ Δ * recoverFromValues B a u h ζ v = ↑(∑ k ∈ Finset.range (2 ^ (a + 1)), if k = 2 ^ a then 0 else nodeSum B hB a u h Δ k ((Lagrange.ringInterpolate Finset.univ ζ) (v (node a k))))

2 ^ Δ times the recovered value lies in B, as the sum of the node contributions NativeRecovery.nodeSum, once Δ ≥ (a + 1) ∑_t q_t.

theorem Cslib.Circuits.Frontier.NativeRecovery.val_foldl_range {N : ℕ} {fl : List ℕ} (F : List ℕ → ℕ → List ℕ) (g : ℕ → GaloisRingArith.Ring N fl) (hF : ∀ (S : List ℕ) (k : ℕ), GaloisRingArith.val N fl (F S k) = GaloisRingArith.val N fl S + g k) (c : List ℕ) (m : ℕ) :

A fold that adds a term at each index of a range sums the terms.

theorem Cslib.Circuits.Frontier.NativeRecovery.val_nodeTerm {N : ℕ} {fl : List ℕ} {K : Type u_1} [CommRing K] [Algebra ℚ K] (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (GaloisRingArith.monicOf fl))) (B : Subring K) (hB : ∀ c ∈ (Rat.padicValuation 2).integer, (algebraMap ℚ K) c ∈ B) (π : ↥B →+* GaloisRingArith.Ring N fl) {p a u h Δ pt k : ℕ} (hk : k < 2 ^ (a + 1)) (hkL : k ≠ 2 ^ a) (hΔ : (a + 1) * ∑ t ∈ recoveryNodes a, taperMult u h t ≤ Δ) (hN : N = p + Δ) (hpt : 0 < mult a u h k → p + 6 * h * 2 ^ (a - padicValInt 2 (node a k)) + mult a u h k * (a + 1) ≤ pt) {n : ℕ} (ζ : Fin n → ↥B) (hζ : Pairwise fun (k l : Fin n) => IsUnit (ζ k - ζ l)) (ζl : List (List ℕ)) (hlen : ζl.length = n) (hζl : ∀ (i : Fin n), GaloisRingArith.val N fl (ζl.getD ↑i []) = π (ζ i)) (r : Fin n → ↥B) (w : List (List ℕ)) (hw : 0 < mult a u h k → ∀ (i : Fin n), ∃ (c : GaloisRingArith.Ring N fl), GaloisRingArith.val N fl (w.getD ↑i []) = π (r i) + 2 ^ pt * c) :
GaloisRingArith.val N fl (nodeTerm N fl a u h Δ ζl k w) = π (nodeSum B hB a u h Δ k ((Lagrange.ringInterpolate Finset.univ ζ) r))

The native contribution of a node is correct: if the native values agree with the images of r i modulo 2 ^ p_t, where p + 6 h D_t + q_t (a + 1) ≤ p_t, then the native contribution of the node of index k is the image of NativeRecovery.nodeSum.

theorem Cslib.Circuits.Frontier.NativeRecovery.val_recover {fl : List ℕ} {K : Type u_1} [CommRing K] [Algebra ℚ K] (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (GaloisRingArith.monicOf fl))) (B : Subring K) (hB : ∀ c ∈ (Rat.padicValuation 2).integer, (algebraMap ℚ K) c ∈ B) {p Δ : ℕ} (π : ↥B →+* GaloisRingArith.Ring (p + Δ) fl) {a u h : ℕ} (hΔ : (a + 1) * ∑ t ∈ recoveryNodes a, taperMult u h t ≤ Δ) (pt : ℤ → ℕ) (hpt : ∀ t ∈ recoveryNodes a, 0 < taperMult u h t → p + 6 * h * 2 ^ (a - padicValInt 2 t) + taperMult u h t * (a + 1) ≤ pt t) {n : ℕ} (ζ : Fin n → ↥B) (hζ : Pairwise fun (k l : Fin n) => IsUnit (ζ k - ζ l)) (ζl : List (List ℕ)) (hlen : ζl.length = n) (hζl : ∀ (i : Fin n), GaloisRingArith.val (p + Δ) fl (ζl.getD ↑i []) = π (ζ i)) (v : ℤ → Fin n → ↥B) (W : List (List (List ℕ))) (hW : ∀ k < 2 ^ (a + 1), k ≠ 2 ^ a → 0 < mult a u h k → ∀ (i : Fin n), ∃ (c : GaloisRingArith.Ring (p + Δ) fl), GaloisRingArith.val (p + Δ) fl ((W.getD k []).getD ↑i []) = π (v (node a k) i) + 2 ^ pt (node a k) * c) {R : ↥B} (hR : recoverFromValues B a u h ζ v = ↑R) :
GaloisRingArith.val p fl (recover p Δ fl a u h ζl W) = (GaloisRingArith.reduce ⋯ fl) (π R)

Native recovery computes the mathematical recovery modulo 2 ^ p. Let π : B → A_N, N = p + Δ, be a ring homomorphism, with Δ ≥ (a + 1) ∑_t q_t. Let the native points ζl represent the images of points ζ i ∈ B with unit differences, and at every node index k of positive multiplicity let the native values W.getD k [] agree with the images of the values v t i at t = node a k modulo 2 ^ p_t, where p + 6 h D_t + q_t (a + 1) ≤ p_t. If the recovered value recoverFromValues B a u h ζ v is an element R of B, then native recovery computes the reduction of π R modulo 2 ^ p.

theorem Cslib.Circuits.Frontier.NativeRecovery.val_recover_of_eq_add {fl : List ℕ} {K : Type u_1} [CommRing K] [Algebra ℚ K] (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (GaloisRingArith.monicOf fl))) (B : Subring K) (hB : ∀ c ∈ (Rat.padicValuation 2).integer, (algebraMap ℚ K) c ∈ B) {p Δ : ℕ} (π : ↥B →+* GaloisRingArith.Ring (p + Δ) fl) {a u h : ℕ} (hΔ : (a + 1) * ∑ t ∈ recoveryNodes a, taperMult u h t ≤ Δ) (pt : ℤ → ℕ) (hpt : ∀ t ∈ recoveryNodes a, 0 < taperMult u h t → p + 6 * h * 2 ^ (a - padicValInt 2 t) + taperMult u h t * (a + 1) ≤ pt t) {n : ℕ} (ζ : Fin n → ↥B) (hζ : Pairwise fun (k l : Fin n) => IsUnit (ζ k - ζ l)) (ζl : List (List ℕ)) (hlen : ζl.length = n) (hζl : ∀ (i : Fin n), GaloisRingArith.val (p + Δ) fl (ζl.getD ↑i []) = π (ζ i)) (v : ℤ → Fin n → ↥B) (W : List (List (List ℕ))) (hW : ∀ k < 2 ^ (a + 1), k ≠ 2 ^ a → 0 < mult a u h k → ∀ (i : Fin n), ∃ (c : GaloisRingArith.Ring (p + Δ) fl), GaloisRingArith.val (p + Δ) fl ((W.getD k []).getD ↑i []) = π (v (node a k) i) + 2 ^ pt (node a k) * c) (x : ↥B) {b : K} (hb : b ∈ B) (hx : recoverFromValues B a u h ζ v = ↑x + 2 ^ p * b) :
GaloisRingArith.val p fl (recover p Δ fl a u h ζl W) = (GaloisRingArith.reduce ⋯ fl) (π x)

Native recovery is correct modulo 2 ^ p. Under the hypotheses of NativeRecovery.val_recover, if the recovered value agrees with an element x of B modulo 2 ^ p (as TensorNetwork.exists_recoverFromValues_eq_add_of_children gives for the contraction), then native recovery computes the reduction of π x modulo 2 ^ p.

Polynomial time #

theorem Cslib.Circuits.Frontier.NativeRecovery.mulGeomPow_succ (N : ℕ) (fl : List ℕ) (J : ℕ) (c : List ℕ) (m : ℕ) (R : List (List ℕ)) :
mulGeomPow N fl J c (m + 1) R = GaloisRingArith.tmul N fl J (mulGeomPow N fl J c m R) (geom N fl J c)
theorem Cslib.Circuits.Frontier.NativeRecovery.mulGeomPow_eq_or (N : ℕ) (fl : List ℕ) (J : ℕ) (c : List ℕ) (m : ℕ) (R : List (List ℕ)) :
mulGeomPow N fl J c m R = R ∨ ∃ (R' : List (List ℕ)), mulGeomPow N fl J c m R = GaloisRingArith.tmul N fl J R' (geom N fl J c)

A multiplication by a power of a geometric series is the input or a truncated product.