Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.Deformation

Deformed contractions and the Cauchy kernel #

This file starts the proof of the Boolean tensor contraction theorem of [OAI26k] (Theorem D.1, §D.1, p. 53) with the deformation of §D.4.3 (p. 59).

Deformed contraction (TensorNetwork.deformedContraction). Split the vertices of a Boolean tensor network into rows (side v = true) and columns. Give each edge e a row bit Y e, read by the row tensors, and a column bit X e, read by the column tensors. For a matrix W indexed by the edges, the deformed contraction is

F(W) = ∑ X Y, A(Y) B(X) ∏ e, l_{Y e}((W X) e),

where A and B are the products of the row and column tensors, l_false z = 1 - z and l_true z = z (the manuscript's (D.8), with l₀, l₁). At the identity matrix the product of the affine factors is the indicator of X = Y, so F(1) is the contraction (TensorNetwork.deformedContraction_one). Deforming W away from the identity lets the interactions between groups of ports be expanded separately; that expansion is later work.

The Cauchy kernel (cauchyKernel). On the grid S = {-L, …, L - 1}, with C(T) = ∏_{t ∈ S} (T - t), the kernel at d ∈ S is the polynomial C(T) / (C'(0) (T - d)) of (D.7). It is one at T = 0 when d = 0 and vanishes at every other grid point (eval_zero_cauchyKernel, eval_cauchyKernel_of_ne). The Cauchy matrix of a packing of the edges (cauchyMatrix), with entry cauchyKernel L (slot e' - slot e) between edges of the same packet and zero between packets, is therefore the identity at T = 0 when every edge has its own slot in its packet (cauchyMatrix_eval_zero), and the deformed contraction along it evaluates to the contraction at zero (eval_zero_deformedContraction_cauchyMatrix).

Main definitions #

Main results #

References #

Mapping the tensors #

def Cslib.Circuits.Frontier.TensorNetwork.map {R : Type u_1} {S : Type u_2} {U : Type u_3} {V : Type u_4} {E : Type u_5} [CommSemiring R] [CommSemiring S] (f : R →+* S) (N : TensorNetwork R U V E) :

The tensor network with every tensor entry mapped by the ring homomorphism f.

@[simp]
theorem Cslib.Circuits.Frontier.TensorNetwork.map_tensor {R : Type u_1} {S : Type u_2} {U : Type u_3} {V : Type u_4} {E : Type u_5} [CommSemiring R] [CommSemiring S] (f : R →+* S) (N : TensorNetwork R U V E) (v : V) (x : E → U) :
(map f N).tensor v x = f (N.tensor v x)
@[simp]
theorem Cslib.Circuits.Frontier.TensorNetwork.toMultigraph_map {R : Type u_1} {S : Type u_2} {U : Type u_3} {V : Type u_4} {E : Type u_5} [CommSemiring R] [CommSemiring S] (f : R →+* S) (N : TensorNetwork R U V E) :
theorem Cslib.Circuits.Frontier.TensorNetwork.contraction_map {R : Type u_1} {S : Type u_2} {U : Type u_3} {V : Type u_4} {E : Type u_5} [CommSemiring R] [CommSemiring S] (f : R →+* S) [Fintype U] [Fintype V] [Fintype E] [DecidableEq E] (N : TensorNetwork R U V E) :

Contraction commutes with ring homomorphisms. For instance, contracting integer tensors and reducing modulo 2 ^ P is contracting the reduced tensors.

Deformed contraction #

The affine factor l_b: l_b z = z for b = true and l_b z = 1 - z for b = false. At a bit z, it is the indicator of z = b.

At a bit, the affine factor is the indicator of equality.

def Cslib.Circuits.Frontier.TensorNetwork.deformedContraction {R : Type u_1} {V : Type u_4} {E : Type u_5} [CommRing R] [Fintype V] [Fintype E] [DecidableEq E] (N : TensorNetwork R Bool V E) (side : V → Bool) (W : Matrix E E R) :
R

The deformed contraction of a Boolean tensor network whose vertices are split into rows (side v = true) and columns, along a matrix W indexed by the edges: every edge carries a row bit, read by the row tensors, and a column bit, read by the column tensors, joined through the affine factors of W.

theorem Cslib.Circuits.Frontier.TensorNetwork.deformedContraction_one {R : Type u_1} {V : Type u_4} {E : Type u_5} [CommRing R] [Fintype V] [Fintype E] [DecidableEq E] (N : TensorNetwork R Bool V E) (side : V → Bool) :

The deformed contraction at the identity is the contraction. The affine factors of the identity matrix force the row bits to equal the column bits.

theorem Cslib.Circuits.Frontier.TensorNetwork.deformedContraction_map {R : Type u_1} {V : Type u_4} {E : Type u_5} [CommRing R] [Fintype V] [Fintype E] [DecidableEq E] {S : Type u_6} [CommRing S] (f : R →+* S) (N : TensorNetwork R Bool V E) (side : V → Bool) (W : Matrix E E R) :
(map f N).deformedContraction side (W.map ⇑f) = f (N.deformedContraction side W)

Deformed contraction commutes with ring homomorphisms.

The Cauchy kernel #

The interpolation grid S = {-L, …, L - 1} of a packet with L slots.

theorem Cslib.Circuits.Frontier.sub_mem_cauchyGrid {L x y : ℕ} (hx : x < L) (hy : y < L) :
↑y - ↑x ∈ cauchyGrid L

The difference of two slots of a packet lies on the grid.

The Cauchy kernel at d on the grid of L slots: C(T) / (C'(0) (T - d)), where C(T) = ∏_{t ∈ S} (T - t). For d ∈ S it is the polynomial C'(0)⁻¹ ∏_{t ∈ S, t ≠ d} (T - t) of degree 2 L - 1; here C'(0) = ∏_{t ∈ S, t ≠ 0} (0 - t).

The normalization is C'(0), the derivative of C(T) = ∏_{t ∈ S} (T - t) at zero.

C'(0) is nonzero: the grid has distinct points.

On the grid, the kernel has degree 2 L - 1, so a deformed contraction along a Cauchy matrix has degree at most M (2 L - 1) in T for M edges.

The kernel at zero. The kernel at d = 0 is one at T = 0.

theorem Cslib.Circuits.Frontier.eval_cauchyKernel_of_ne {L : ℕ} {d t : ℤ} (ht : t ∈ cauchyGrid L) (htd : t ≠ d) :

The kernel vanishes at the other grid points. The kernel at d vanishes at every grid point t ≠ d.

The values of the kernel at T = 0: one at d = 0, and zero at every d ≠ 0, because then T = 0 is a root of one of its factors.

noncomputable def Cslib.Circuits.Frontier.cauchyMatrix {E : Type u_1} {P : Type u_2} [DecidableEq P] (L : ℕ) (packet : E → P) (slot : E → ℕ) :

The Cauchy matrix of a packing of the edges into packets of L slots: between edges e and e' of the same packet, the Cauchy kernel at the difference slot e' - slot e of their slots; zero between different packets (the manuscript's (D.7)).

theorem Cslib.Circuits.Frontier.cauchyMatrix_eval_zero {E : Type u_1} {P : Type u_2} [DecidableEq E] [DecidableEq P] {L : ℕ} {packet : E → P} {slot : E → ℕ} (hslot : ∀ (e : E), slot e < L) (hinj : ∀ (e e' : E), packet e = packet e' → slot e = slot e' → e = e') :
(cauchyMatrix L packet slot).map (Polynomial.eval 0) = 1

The Cauchy matrix is the identity at zero when every edge has its own slot in its packet, below L.

theorem Cslib.Circuits.Frontier.TensorNetwork.eval_zero_deformedContraction_cauchyMatrix {R : Type u_1} {V : Type u_2} {E : Type u_3} {P : Type u_4} [CommRing R] [Algebra ℚ R] [Fintype V] [Fintype E] [DecidableEq E] [DecidableEq P] (N : TensorNetwork R Bool V E) (side : V → Bool) {L : ℕ} {packet : E → P} {slot : E → ℕ} (hslot : ∀ (e : E), slot e < L) (hinj : ∀ (e e' : E), packet e = packet e' → slot e = slot e' → e = e') :

The deformation along the Cauchy matrix starts at the contraction. Over a ℚ-algebra, the deformed contraction along the Cauchy matrix of a packing is a polynomial F(T) whose value at T = 0 is the contraction, when every edge has its own slot in its packet.