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 #
Cslib.Circuits.Frontier.Network.toTensorNetwork: the indicator tensor network of a constraint network on an input.
Main results #
Cslib.Circuits.Frontier.Network.contraction_toTensorNetwork: its contraction counts the satisfying assignments.Cslib.Circuits.Frontier.Network.mem_accepted_iff_contraction_ne_zero: an input is accepted iff the contraction overℕis nonzero.
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.
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.
Over ℕ, the contraction is nonzero exactly at the accepted inputs.