Documentation

CslibFrontier.Foundations.LinearAlgebra.Tensor.Party.Network

Networks of tensors #

A tensor that is the value of a network is a restriction of the product of the wires on the edges of the network and of the tensors at its vertices, wherever the vertices are placed (PartyTensor.push_le_of_network, and PartyTensor.push_le_of_edges without tensors at the vertices). The statements are about functions, not graphs: the edge e has the ends a e and b e and labels in Λ e, the vertex v is placed at the party ξ v and has a table T v, a function of all labels that is local: it depends only on the labels of the edges at v, on the legs of the tensors at v and on the indices held by the party of v. This is the contraction of a tensor network (Cslib.Circuits.Frontier.TensorNetwork.contraction) with open legs at the parties, and with an index set of its own on each edge.

Special cases are that the wire ⟨q⟩_uw is a restriction of ⟨q⟩_uv ⟨q⟩_vw (PartyTensor.wire_le_mul_wire, from the proof of Lemma A.2 of [Ant26]), the same for trees, and moving legs along wires (PartyTensor.push_le_mul_push).

Main definitions #

Main results #

References #

def Cslib.PartyTensor.outer {K : Type} [CommSemiring K] {κ : Type} [Fintype κ] {M : κ → Type} (t : (k : κ) → PartyTensor K (M k)) :
PartyTensor K ((k : κ) × M k)

The product of tensors with separate legs.

theorem Cslib.PartyTensor.antisymmRel_push_outer {K : Type} [CommSemiring K] {I : Type} [Fintype I] [DecidableEq I] {κ : Type} [Fintype κ] {M : κ → Type} [DecidableEq κ] [(k : κ) → Fintype (M k)] [(k : κ) → DecidableEq (M k)] (π : (k : κ) × M k → I) (t : (k : κ) → PartyTensor K (M k)) :
AntisymmRel (fun (x1 x2 : PartyTensor K I) => x1 ≤ x2) (push π (outer t)) (prod fun (k : κ) => push (fun (m : M k) => π ⟨k, m⟩) (t k))

Giving the legs of a product with separate legs to parties.

def Cslib.PartyTensor.outerPair {K : Type} [CommSemiring K] {L L' : Type} (s : PartyTensor K L) (t : PartyTensor K L') :
PartyTensor K (L ⊕ L')

The product of two tensors with separate legs.

theorem Cslib.PartyTensor.antisymmRel_push_outerPair {K : Type} [CommSemiring K] {I : Type} [Fintype I] [DecidableEq I] {L L' : Type} [Fintype L] [DecidableEq L] [Fintype L'] [DecidableEq L'] (π : L ⊕ L' → I) (s : PartyTensor K L) (t : PartyTensor K L') :
AntisymmRel (fun (x1 x2 : PartyTensor K I) => x1 ≤ x2) (push π (s.outerPair t)) (push (fun (l : L) => π (Sum.inl l)) s * push (fun (l : L') => π (Sum.inr l)) t)

Giving the legs of a product of two tensors with separate legs to parties.

theorem Cslib.PartyTensor.sum_mul_prod_unit {K : Type} [CommSemiring K] {E : Type} [Fintype E] [DecidableEq E] (n : E → ℕ) (g : ((e : E) → Fin 2 → Fin (n e)) → K) :
∑ z : (e : E) → Fin 2 → Fin (n e), g z * ∏ e : E, (unit K (Fin 2) (n e)).entry (z e) = ∑ l : (e : E) → Fin (n e), g fun (e : E) (x : Fin 2) => l e

A sum over pairs of labels that must be equal.

theorem Cslib.PartyTensor.push_le_of_network {K : Type} [CommSemiring K] {I J : Type} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] {V : Type} [Fintype V] {E κ : Type} [Fintype E] [DecidableEq E] [Fintype κ] [DecidableEq κ] {M : κ → Type} [(k : κ) → Fintype (M k)] [(k : κ) → DecidableEq (M k)] (π : J → I) (ξ : V → I) (s : PartyTensor K J) (Λ : E → Type) [(e : E) → Fintype (Λ e)] (a b : E → V) (t : (k : κ) → PartyTensor K (M k)) (ρ : (k : κ) → M k → V) (T : V → ((j : J) → s.Index j) → ((e : E) → Λ e) → ((k : κ) → (m : M k) → (t k).Index m) → K) (hT : ∀ (v : V) (x x' : (j : J) → s.Index j) (l l' : (e : E) → Λ e) (y y' : (k : κ) → (m : M k) → (t k).Index m), (∀ (j : J), π j = ξ v → x j = x' j) → (∀ (e : E), a e = v ∨ b e = v → l e = l' e) → (∀ (k : κ) (m : M k), ρ k m = v → y k m = y' k m) → T v x l y = T v x' l' y') (h : ∀ (x : (p : J) → s.Index p), s.entry x = ∑ l : (e : E) → Λ e, ∑ y : (k : κ) → (m : M k) → (t k).Index m, (∏ v : V, T v x l y) * ∏ k : κ, (t k).entry (y k)) :
push π s ≤ (prod fun (e : E) => wire K (Fintype.card (Λ e)) (ξ (a e)) (ξ (b e))) * prod fun (k : κ) => push (fun (m : M k) => ξ (ρ k m)) (t k)

Networks. The vertices v are placed at the parties ξ v, the legs j of s are held by the parties π j. There are edges e with labels in Λ e and ends a e, b e, and tensors t k with their legs m at the vertices ρ k m. Each vertex has a local table T v: it depends only on the legs of s held by the party ξ v, on the labels of the edges at v, and on the legs of the t k at v. If s is the sum over all labels of the product of the tables and of the t k, then s is a restriction of the product of the wires on the edges and of the t k, all at their places.

theorem Cslib.PartyTensor.push_le_of_edges {K : Type} [CommSemiring K] {I J : Type} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] {V : Type} [Fintype V] {E : Type} [Fintype E] [DecidableEq E] (π : J → I) (ξ : V → I) (s : PartyTensor K J) (Λ : E → Type) [(e : E) → Fintype (Λ e)] (a b : E → V) (T : V → ((j : J) → s.Index j) → ((e : E) → Λ e) → K) (hT : ∀ (v : V) (x x' : (j : J) → s.Index j) (l l' : (e : E) → Λ e), (∀ (j : J), π j = ξ v → x j = x' j) → (∀ (e : E), a e = v ∨ b e = v → l e = l' e) → T v x l = T v x' l') (h : ∀ (x : (p : J) → s.Index p), s.entry x = ∑ l : (e : E) → Λ e, ∏ v : V, T v x l) :
push π s ≤ prod fun (e : E) => wire K (Fintype.card (Λ e)) (ξ (a e)) (ξ (b e))

Networks without other tensors: if s is the sum over all labels of the edges of the product of local tables, then s is a restriction of the product of the wires on the edges, at their places.