Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.Binarize

Binarizing a tensor network #

A tensor network whose edges carry letters of a finite alphabet U becomes a Boolean tensor network once every letter is written in m bits. Fix an injective code code : U → (Fin m → Bool). The binarization TensorNetwork.binarize replaces every edge e by the m parallel Boolean edges (e, 0), …, (e, m - 1) between the same two vertices. A vertex decodes the m bits on each of its edges and evaluates its old tensor on the decoded letters; if the bits on one of its edges are not the code of any letter, its tensor is zero.

The contraction is unchanged (TensorNetwork.contraction_binarize): assignments of bits in which every edge carries a code word correspond exactly to assignments of letters, and every other assignment of bits has an edge with an invalid code word, whose source tensor vanishes. Every edge becomes m edges, so vertex degrees are multiplied by m (TensorNetwork.maxDegreeLE_binarize). Every tensor entry of the binarization is zero or an entry of the original network (TensorNetwork.tensor_binarize_eq_zero_or). Loops and bipartiteness are preserved.

This lets a construction use a structured alphabet, such as words over a machine's tape alphabet, and then pass to the Boolean networks of [OAI26k], Appendix D.

Main definitions #

Main results #

References #

def Cslib.Circuits.Frontier.TensorNetwork.bitsOn {E : Type u_4} {m : ℕ} (y : E × Fin m → Bool) (e : E) :
Fin m → Bool

The bits on the m copies of the edge e.

@[simp]
theorem Cslib.Circuits.Frontier.TensorNetwork.bitsOn_apply {E : Type u_4} {m : ℕ} (y : E × Fin m → Bool) (e : E) (j : Fin m) :
bitsOn y e j = y (e, j)
noncomputable def Cslib.Circuits.Frontier.TensorNetwork.binarize {R : Type u_1} {U : Type u_2} {V : Type u_3} {E : Type u_4} {m : ℕ} [Zero R] [Nonempty U] (N : TensorNetwork R U V E) (code : U → Fin m → Bool) :

The binarization of a tensor network by a code code : U → (Fin m → Bool). Every edge e becomes the m Boolean edges (e, j) between the same two vertices. A vertex whose edges all carry code words evaluates its old tensor on the decoded letters (Function.invFun code); a vertex with an edge carrying a word that is not a code word has tensor zero.

@[simp]
theorem Cslib.Circuits.Frontier.TensorNetwork.binarize_src {R : Type u_1} {U : Type u_2} {V : Type u_3} {E : Type u_4} {m : ℕ} [Zero R] [Nonempty U] (N : TensorNetwork R U V E) (code : U → Fin m → Bool) (p : E × Fin m) :
(N.binarize code).src p = N.src p.1
@[simp]
theorem Cslib.Circuits.Frontier.TensorNetwork.binarize_tgt {R : Type u_1} {U : Type u_2} {V : Type u_3} {E : Type u_4} {m : ℕ} [Zero R] [Nonempty U] (N : TensorNetwork R U V E) (code : U → Fin m → Bool) (p : E × Fin m) :
(N.binarize code).tgt p = N.tgt p.1
theorem Cslib.Circuits.Frontier.TensorNetwork.tensor_binarize_eq_zero_or {R : Type u_1} {U : Type u_2} {V : Type u_3} {E : Type u_4} {m : ℕ} [Zero R] [Nonempty U] (N : TensorNetwork R U V E) (code : U → Fin m → Bool) (v : V) (y : E × Fin m → Bool) :
(N.binarize code).tensor v y = 0 ∨ ∃ (x : E → U), (N.binarize code).tensor v y = N.tensor v x

Every tensor entry of the binarization is zero or an entry of the original network at some assignment of letters.

theorem Cslib.Circuits.Frontier.TensorNetwork.loopless_binarize {R : Type u_1} {U : Type u_2} {V : Type u_3} {E : Type u_4} {m : ℕ} [Zero R] [Nonempty U] (N : TensorNetwork R U V E) (code : U → Fin m → Bool) (h : N.Loopless) :

Binarization keeps a network without loops loopless.

theorem Cslib.Circuits.Frontier.TensorNetwork.isBipartite_binarize {R : Type u_1} {U : Type u_2} {V : Type u_3} {E : Type u_4} {m : ℕ} [Zero R] [Nonempty U] (N : TensorNetwork R U V E) (code : U → Fin m → Bool) (h : N.IsBipartite) :

Binarization keeps a network bipartite, with the same sides.

theorem Cslib.Circuits.Frontier.TensorNetwork.incidenceSet_binarize {R : Type u_1} {U : Type u_2} {V : Type u_3} {E : Type u_4} {m : ℕ} [Zero R] [Nonempty U] (N : TensorNetwork R U V E) (code : U → Fin m → Bool) (v : V) :

The edges at a vertex of the binarization are the copies of its old edges.

theorem Cslib.Circuits.Frontier.TensorNetwork.maxDegreeLE_binarize {R : Type u_1} {U : Type u_2} {V : Type u_3} {E : Type u_4} {m : ℕ} [Zero R] [Nonempty U] (N : TensorNetwork R U V E) (code : U → Fin m → Bool) [Finite E] {d : ℕ} (hd : N.MaxDegreeLE d) :
(N.binarize code).MaxDegreeLE (d * m)

Binarization multiplies degrees by the code length.

theorem Cslib.Circuits.Frontier.TensorNetwork.contraction_binarize {U : Type u_2} {V : Type u_3} {E : Type u_4} {m : ℕ} [Nonempty U] {R : Type u_5} [CommSemiring R] [Fintype U] [Fintype V] [Fintype E] [DecidableEq E] (N : TensorNetwork R U V E) {code : U → Fin m → Bool} (hcode : Function.Injective code) :

Binarization preserves the contraction. Assignments of bits in which every edge carries a code word are the codes of the assignments of letters, and every other assignment of bits has an edge with an invalid word, at whose source the tensor vanishes.