Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.Reindex

Renaming and lifting tensor networks #

Two operations that keep the contraction of a tensor network under control while its types or its coefficient ring change.

Main definitions #

Main results #

References #

Renaming the vertices and edges #

def Cslib.Circuits.Frontier.TensorNetwork.reindex {R : Type u_1} {U : Type u_3} {V : Type u_4} {E : Type u_5} {V' : Type u_6} {E' : Type u_7} (eV : V ≃ V') (eE : E ≃ E') (N : TensorNetwork R U V E) :
TensorNetwork R U V' E'

The network transported along bijections eV of the vertices and eE of the edges: edge eE e runs from eV (N.src e) to eV (N.tgt e), and vertex eV v carries the tensor of v.

@[simp]
theorem Cslib.Circuits.Frontier.TensorNetwork.reindex_src {R : Type u_1} {U : Type u_3} {V : Type u_4} {E : Type u_5} {V' : Type u_6} {E' : Type u_7} (eV : V ≃ V') (eE : E ≃ E') (N : TensorNetwork R U V E) (e : E') :
(reindex eV eE N).src e = eV (N.src (eE.symm e))
@[simp]
theorem Cslib.Circuits.Frontier.TensorNetwork.reindex_tgt {R : Type u_1} {U : Type u_3} {V : Type u_4} {E : Type u_5} {V' : Type u_6} {E' : Type u_7} (eV : V ≃ V') (eE : E ≃ E') (N : TensorNetwork R U V E) (e : E') :
(reindex eV eE N).tgt e = eV (N.tgt (eE.symm e))
@[simp]
theorem Cslib.Circuits.Frontier.TensorNetwork.reindex_tensor {R : Type u_1} {U : Type u_3} {V : Type u_4} {E : Type u_5} {V' : Type u_6} {E' : Type u_7} (eV : V ≃ V') (eE : E ≃ E') (N : TensorNetwork R U V E) (v : V') (x : E' → U) :
(reindex eV eE N).tensor v x = N.tensor (eV.symm v) (x ∘ ⇑eE)
theorem Cslib.Circuits.Frontier.TensorNetwork.card_reindex_src {R : Type u_1} {U : Type u_3} {V : Type u_4} {E : Type u_5} {V' : Type u_6} {E' : Type u_7} (eV : V ≃ V') (eE : E ≃ E') (N : TensorNetwork R U V E) [Fintype E] [Fintype E'] [DecidableEq V] [DecidableEq V'] (v : V') :
{e : E' | (reindex eV eE N).src e = v}.card = {e : E | N.src e = eV.symm v}.card

Renaming keeps the number of edges leaving each vertex.

theorem Cslib.Circuits.Frontier.TensorNetwork.card_reindex_tgt {R : Type u_1} {U : Type u_3} {V : Type u_4} {E : Type u_5} {V' : Type u_6} {E' : Type u_7} (eV : V ≃ V') (eE : E ≃ E') (N : TensorNetwork R U V E) [Fintype E] [Fintype E'] [DecidableEq V] [DecidableEq V'] (v : V') :
{e : E' | (reindex eV eE N).tgt e = v}.card = {e : E | N.tgt e = eV.symm v}.card

Renaming keeps the number of edges entering each vertex.

theorem Cslib.Circuits.Frontier.TensorNetwork.contraction_reindex {R : Type u_1} {U : Type u_3} {V : Type u_4} {E : Type u_5} {V' : Type u_6} {E' : Type u_7} (eV : V ≃ V') (eE : E ≃ E') (N : TensorNetwork R U V E) [CommSemiring R] [Fintype U] [Fintype V] [Fintype E] [DecidableEq E] [Fintype V'] [Fintype E'] [DecidableEq E'] :

Renaming preserves the contraction.

Lifting the entries #

def Cslib.Circuits.Frontier.TensorNetwork.mapFun {R : Type u_1} {S : Type u_2} {U : Type u_3} {V : Type u_4} {E : Type u_5} (f : R → S) (N : TensorNetwork R U V E) :

The tensor network with every tensor entry mapped by the function f. Unlike TensorNetwork.map, f need not be a ring homomorphism; a section of a reduction map lifts the entries.

@[simp]
theorem Cslib.Circuits.Frontier.TensorNetwork.mapFun_tensor {R : Type u_1} {S : Type u_2} {U : Type u_3} {V : Type u_4} {E : Type u_5} (f : R → S) (N : TensorNetwork R U V E) (v : V) (x : E → U) :
(mapFun f N).tensor v x = f (N.tensor v x)
@[simp]
theorem Cslib.Circuits.Frontier.TensorNetwork.toMultigraph_mapFun {R : Type u_1} {S : Type u_2} {U : Type u_3} {V : Type u_4} {E : Type u_5} (f : R → S) (N : TensorNetwork R U V E) :
theorem Cslib.Circuits.Frontier.TensorNetwork.map_mapFun {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) {σ : S → R} (hσ : ∀ (x : S), f (σ x) = x) (N : TensorNetwork S U V E) :
map f (mapFun σ N) = N

Reducing a lift recovers the network: for a section σ of f, mapping the entries by σ and then by f changes nothing.

theorem Cslib.Circuits.Frontier.TensorNetwork.contraction_map_mapFun {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) {σ : S → R} [Fintype U] [Fintype V] [Fintype E] [DecidableEq E] (hσ : ∀ (x : S), f (σ x) = x) (N : TensorNetwork S U V E) :

The contraction of a lift reduces to the contraction: for a section σ of f, f maps the contraction of the lifted network to the contraction of the network.