Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.Constraint

Constraint networks as 0–1 tensor networks #

A constraint network (Cslib.Circuits.Frontier.Network) on a fixed input is a tensor network whose tensors take only the values zero and one: the tensor at v is the indicator of the constraint at v (Network.toTensorNetwork). The two share the multigraph, and the locality of the constraints is the locality of the tensors. The contraction of this tensor network is the number of satisfying assignments (Network.contraction_toTensorNetwork), so over ℕ it is nonzero exactly at the accepted inputs (Network.mem_accepted_iff_contraction_ne_zero).

A general tensor network is thus the weighted form of a constraint network, and the frontier constraint networks of circuits (Cslib.Circuits.Frontier.Compiler.network) are special cases.

Main definitions #

Main results #

noncomputable def Cslib.Circuits.Frontier.Network.toTensorNetwork {U : Type u_1} {ι : Type u_2} {V : Type u_3} {E : Type u_4} (R : Type u_5) (N : Network U ι V E) [Zero R] [One R] (x : ι → U) :

The 0–1 tensor network of a constraint network on the input x: the same multigraph, with the tensor at v equal to one where the constraint at v holds and to zero elsewhere.

@[simp]
theorem Cslib.Circuits.Frontier.Network.toMultigraph_toTensorNetwork {U : Type u_1} {ι : Type u_2} {V : Type u_3} {E : Type u_4} (R : Type u_5) (N : Network U ι V E) [Zero R] [One R] (x : ι → U) :

The tensor network of a constraint network has the same multigraph.

theorem Cslib.Circuits.Frontier.Network.contraction_toTensorNetwork {U : Type u_1} {ι : Type u_2} {V : Type u_3} {E : Type u_4} (R : Type u_5) (N : Network U ι V E) [CommSemiring R] [Fintype U] [Fintype V] [Fintype E] [DecidableEq E] (x : ι → U) :
(toTensorNetwork R N x).contraction = ↑{α : E → U | N.Satisfies x α}.ncard

The contraction counts satisfying assignments. The contraction of the 0–1 tensor network of a constraint network on the input x is the number of assignments of values to the edges that satisfy every constraint on x.

theorem Cslib.Circuits.Frontier.Network.mem_accepted_iff_contraction_ne_zero {U : Type u_1} {ι : Type u_2} {V : Type u_3} {E : Type u_4} (N : Network U ι V E) [Fintype U] [Fintype V] [Fintype E] [DecidableEq E] (x : ι → U) :

Over ℕ, the contraction is nonzero exactly at the accepted inputs.