Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.PacketEvaluator

Evaluating packet entries on coefficient lists #

The packet tensors of the child networks of the contraction algorithm of [OAI26k] are implicit: an entry is computed from the data of its packet (§D.4.6, p. 63). This file gives that computation on the coefficient lists of A_p = (ℤ / 2 ^ p)[U] / (f), with the arithmetic of Cslib.GaloisRingArith, and proves that it is TensorNetwork.packetEntry in A_p, so in every ring that A_p maps to.

The main result (NativePacket.val_packetEntryList) is that the value of NativePacket.packetEntryList in A_p is TensorNetwork.packetEntry at the reduction of ℤ_(2) and the value of ζ. Transported along a ring map ψ : A_p → S with 2 nilpotent in S (NativePacket.map_val_packetEntryList), it is the packet entry over S at any ring map ℤ_(2) → S; with TensorNetwork.child_tensor_inr_cauchyModeSplitting, it is the entry of a packet vertex of a child network, for instance over B ⧸ (2 ^ p).

These are functions on lists of natural numbers with explicit recursion; their certificates of time exp(O(L log s)) and polynomial space are separate.

Main definitions #

Main results #

References #

theorem Cslib.Circuits.Frontier.padicInteger_ringHom_ext {S : Type u_1} [CommRing S] {n : ℕ} (hn : 2 ^ n = 0) (φ ψ : ↥(Rat.padicValuation 2).integer →+* S) :
φ = ψ

Ring maps from ℤ_(2) are unique into a ring in which 2 is nilpotent: an element times its odd denominator is its numerator.

Scalars #

The reduction ℤ_(2) → A_p, through ℤ / 2 ^ p.

2 ^ p = 0 in A_p.

With no coordinates, A_p is the zero ring.

The value of a tabulated list.

An integer as a constant coefficient list: its residue modulo 2 ^ p in the first of the e coordinates.

@[simp]

The value of a constant list is the integer.

The product of a list of coefficient lists.

The sum of a list of coefficient lists.

Inverting elements that are one modulo two #

Inversion of an element that is one modulo two: Newton's inversion needs no further hypothesis.

Odd parts #

An integer not divisible by 2 ^ (i + 1) has valuation at most i.

The 2-adic valuation, computably #

The 2-adic valuation of m, halving at most k times.

The 2-adic valuation of an integer, by repeated halving: padicValInt 2 (twoVal_eq).

@[simp]

The valuation by halving is padicValInt 2.

Kernel values #

The linear factor u + 2 ^ k ζ.

@[simp]
theorem Cslib.Circuits.Frontier.NativePacket.val_linFactor {p : ℕ} {fl : List ℕ} (u : ℤ) (k : ℕ) (ζ : List ℕ) :
GaloisRingArith.val p fl (linFactor p fl u k ζ) = ↑u + 2 ^ k * GaloisRingArith.val p fl ζ
theorem Cslib.Circuits.Frontier.NativePacket.exists_val_linFactor_eq {p : ℕ} {fl : List ℕ} {u : ℤ} (hu : Odd u) {k : ℕ} (hk : 1 ≤ k) (ζ : List ℕ) :
∃ (w : GaloisRingArith.Ring p fl), GaloisRingArith.val p fl (linFactor p fl u k ζ) = 1 + 2 * w

A linear factor with an odd constant and k ≥ 1 is one modulo two.

The grid [-L, L) of L slots, in increasing order. The number of slots is a parameter, in place of 2 ^ a, so that it can be read in unary.

The odd part of C'(0) = ∏_{q ≠ 0} (0 - q), as a coefficient list.

κ (kernelUnit a), the inverse of the odd part of C'(0).

The kernel unit: kernelUnitList is the reduction of kernelUnit a.

Kernel values on coefficient lists (Lemma D.4's evaluation, p. 60): the kernel unit, times 2 ^ (a + 1 - v_d) ζ when d ≠ t, times the linear factors u_q + 2 ^ (a + 1 - v_q) ζ over the grid points q ≠ d, t.

theorem Cslib.Circuits.Frontier.NativePacket.val_kernelValueList {p : ℕ} {fl : List ℕ} {a L : ℕ} (hL : L = 2 ^ a) {t d : ℤ} (ht : t ∈ cauchyGrid (2 ^ a)) (hd : d ∈ cauchyGrid (2 ^ a)) (ζ : List ℕ) :
GaloisRingArith.val p fl (kernelValueList p fl a L t d ζ) = kernelValue (scalarHom p fl) (GaloisRingArith.val p fl ζ) a t d

Kernel values are correct: for grid points t and d, the value is kernelValue at the reduction of ℤ_(2) and the value of ζ.

Cross ratios #

Cross ratios on coefficient lists: 2 ^ (i + 1 - v) times the inverse of u₀ + 2 ^ (a + 1 - v) ζ, where t - d₀ = 2 ^ v u₀.

theorem Cslib.Circuits.Frontier.NativePacket.val_crossRatioList {p : ℕ} {fl : List ℕ} {a i : ℕ} (hia : i ≤ a) {t d₀ : ℤ} (hcross : ¬2 ^ (i + 1) ∣ t - d₀) (ζ : List ℕ) :
GaloisRingArith.val p fl (crossRatioList p fl a i t d₀ ζ) = crossRatio a i t d₀ (GaloisRingArith.val p fl ζ)

Cross ratios are correct when 2 ^ (i + 1) ∤ t - d₀ and i ≤ a: the inverted factor is one modulo two.

The terms of a packet entry #

def Cslib.Circuits.Frontier.NativePacket.localFormList (p : ℕ) (fl : List ℕ) (a L : ℕ) (t : ℤ) (cols : List (ℕ × Bool)) (x : ℕ) (ζ : List ℕ) :

The local form of a row port in slot x: the sum of the kernel values at the column ports set to one.

theorem Cslib.Circuits.Frontier.NativePacket.val_localFormList {p : ℕ} {fl : List ℕ} {a L : ℕ} (hL : L = 2 ^ a) {t : ℤ} (ht : t ∈ cauchyGrid (2 ^ a)) {cols : List (ℕ × Bool)} (hcols : ∀ c ∈ cols, c.1 < 2 ^ a) {x : ℕ} (hx : x < 2 ^ a) (ζ : List ℕ) :
GaloisRingArith.val p fl (localFormList p fl a L t cols x ζ) = TensorNetwork.packetLocalForm (scalarHom p fl) (GaloisRingArith.val p fl ζ) a t cols x
def Cslib.Circuits.Frontier.NativePacket.modeCoeffList (p : ℕ) (fl : List ℕ) (a L i : ℕ) (t : ℤ) (differ : Bool) (x y₀ b : ℕ) (ζ : List ℕ) :

The coefficient of the mode (y₀, b) in the form of a row port in slot x.

theorem Cslib.Circuits.Frontier.NativePacket.val_modeCoeffList {p : ℕ} {fl : List ℕ} {a L i : ℕ} (hL : L = 2 ^ a) (hia : i < a) {t : ℤ} (ht : t ∈ cauchyGrid (2 ^ a)) (hti : 2 ^ i ∣ t) (hti' : ¬2 ^ (i + 1) ∣ t) (differ : Bool) {x : ℕ} (hx : x < 2 ^ a) {nb : ℕ} (Z : Fin (2 ^ (i + 1)) × Fin nb) (ζ : List ℕ) :
GaloisRingArith.val p fl (modeCoeffList p fl a L i t differ x (↑Z.1) (↑Z.2) ζ) = TensorNetwork.packetModeCoeff (scalarHom p fl) (GaloisRingArith.val p fl ζ) a i t differ x Z
def Cslib.Circuits.Frontier.NativePacket.modeValueList (p : ℕ) (fl : List ℕ) (i : ℕ) (differ : Bool) (cols : List (ℕ × Bool)) (y₀ b : ℕ) :

The value of the mode (y₀, b) on the column ports: the sum of j ^ b over the column ports in slots y₀ + 2 ^ (i + 1) j set to one, when the symbols of the packet differ.

theorem Cslib.Circuits.Frontier.NativePacket.val_modeValueList {p : ℕ} {fl : List ℕ} (i : ℕ) (differ : Bool) (cols : List (ℕ × Bool)) {nb : ℕ} (Z : Fin (2 ^ (i + 1)) × Fin nb) :
GaloisRingArith.val p fl (modeValueList p fl i differ cols ↑Z.1 ↑Z.2) = TensorNetwork.packetModeValue (GaloisRingArith.Ring p fl) i differ cols Z
def Cslib.Circuits.Frontier.NativePacket.rowTermList (p : ℕ) (fl : List ℕ) (a L i : ℕ) (t : ℤ) (nb : ℕ) (differ : Bool) (cols : List (ℕ × Bool)) (ζ : List ℕ) (r : ℕ × Bool) :

The terms of the affine factor of a row port r = (x, Y_x): its local term at none, and the coefficient of the mode (k / nb, k % nb) at some k (zero when there are no exponents, nb = 0, so that the exponent k % nb stays below nb).

theorem Cslib.Circuits.Frontier.NativePacket.val_rowTermList {p : ℕ} {fl : List ℕ} {a L i : ℕ} (hL : L = 2 ^ a) (hia : i < a) {t : ℤ} (ht : t ∈ cauchyGrid (2 ^ a)) (hti : 2 ^ i ∣ t) (hti' : ¬2 ^ (i + 1) ∣ t) (nb : ℕ) (differ : Bool) {cols : List (ℕ × Bool)} (hcols : ∀ c ∈ cols, c.1 < 2 ^ a) {r : ℕ × Bool} (hr : r.1 < 2 ^ a) (ζ : List ℕ) :
(fun (o : Option ℕ) => GaloisRingArith.val p fl (rowTermList p fl a L i t nb differ cols ζ r o)) ∘ Option.map ⇑(finProdFinEquiv.toEmbedding.trans Fin.valEmbedding) = TensorNetwork.packetRowTerm (scalarHom p fl) (GaloisRingArith.val p fl ζ) a i t differ cols r

Row terms are correct, at the dense indices of the modes of the packet.

Coefficient extraction #

def Cslib.Circuits.Frontier.NativePacket.listCoeffList (p : ℕ) (fl : List ℕ) {M : Type} [DecidableEq M] (modes : List M) :
List (Option M → List ℕ) → (M → ℕ) → List ℕ

Coefficient extraction on coefficient lists, TensorNetwork.listCoeff along a list of modes: the first factor contributes its local term, or one of the modes still needed.

theorem Cslib.Circuits.Frontier.NativePacket.val_listCoeffList {p : ℕ} {fl : List ℕ} {M : Type} [DecidableEq M] {modes : List M} (hm : modes.Nodup) (ts : List (Option M → List ℕ)) (γ : M → ℕ) :
GaloisRingArith.val p fl (listCoeffList p fl modes ts γ) = TensorNetwork.listCoeff modes.toFinset (List.map (fun (T : Option M → List ℕ) (o : Option M) => GaloisRingArith.val p fl (T o)) ts) γ

Coefficient extraction is correct, along a duplicate-free list of modes.

Packet entries #

def Cslib.Circuits.Frontier.NativePacket.packetEntryList (p : ℕ) (fl : List ℕ) (a L i : ℕ) (t : ℤ) (nb : ℕ) (e₁ e₂ differ : Bool) (β : ℕ → ℕ) (rows cols : List (ℕ × Bool)) (ζ : List ℕ) :

The entry of a packet vertex on coefficient lists (§D.4.6, p. 63): coefficient extraction along the row terms, at the exponents β of the modes targeting the group, times the powers of the values of the modes with the group as source. A mode (y₀, b) is its dense index b + nb y₀ (finProdFinEquiv), so β is read at dense indices, as from a dense list of exponents.

theorem Cslib.Circuits.Frontier.NativePacket.val_packetEntryList {p : ℕ} {fl : List ℕ} {a L i : ℕ} (hL : L = 2 ^ a) (hia : i < a) {t : ℤ} (ht : t ∈ cauchyGrid (2 ^ a)) (hti : 2 ^ i ∣ t) (hti' : ¬2 ^ (i + 1) ∣ t) (nb : ℕ) (e₁ e₂ differ : Bool) (β : ℕ → ℕ) {rows cols : List (ℕ × Bool)} (hrows : ∀ r ∈ rows, r.1 < 2 ^ a) (hcols : ∀ c ∈ cols, c.1 < 2 ^ a) (ζ : List ℕ) :
GaloisRingArith.val p fl (packetEntryList p fl a L i t nb e₁ e₂ differ β rows cols ζ) = TensorNetwork.packetEntry (scalarHom p fl) (GaloisRingArith.val p fl ζ) a i t e₁ e₂ differ (fun (Z : Fin (2 ^ (i + 1)) × Fin nb) => β ↑(finProdFinEquiv Z)) rows cols

Packet entries are correct. For a grid point t of valuation i < a and ports in slots below 2 ^ a, the value of packetEntryList in A_p is packetEntry at the reduction of ℤ_(2), the value of ζ and the exponents β at the dense indices of the modes.

theorem Cslib.Circuits.Frontier.NativePacket.map_val_packetEntryList {p : ℕ} {fl : List ℕ} {S : Type u_1} [CommRing S] (ψ : GaloisRingArith.Ring p fl →+* S) {n : ℕ} (hn : 2 ^ n = 0) (κ : ↥(Rat.padicValuation 2).integer →+* S) {a L i : ℕ} (hL : L = 2 ^ a) (hia : i < a) {t : ℤ} (ht : t ∈ cauchyGrid (2 ^ a)) (hti : 2 ^ i ∣ t) (hti' : ¬2 ^ (i + 1) ∣ t) (nb : ℕ) (e₁ e₂ differ : Bool) (β : ℕ → ℕ) {rows cols : List (ℕ × Bool)} (hrows : ∀ r ∈ rows, r.1 < 2 ^ a) (hcols : ∀ c ∈ cols, c.1 < 2 ^ a) (ζ : List ℕ) :
ψ (GaloisRingArith.val p fl (packetEntryList p fl a L i t nb e₁ e₂ differ β rows cols ζ)) = TensorNetwork.packetEntry κ (ψ (GaloisRingArith.val p fl ζ)) a i t e₁ e₂ differ (fun (Z : Fin (2 ^ (i + 1)) × Fin nb) => β ↑(finProdFinEquiv Z)) rows cols

Packet entries in every ring receiving A_p. Along a ring map ψ : A_p → S with 2 nilpotent in S, the value of packetEntryList is packetEntry over S at any ring map κ : ℤ_(2) → S and at the image of ζ.