Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.DescribedLift

A described network over O #

The contraction recursion of [OAI26k] (§D.4, pp. 57–64) is proved correct over the valuation ring O = ℤ_(2)[U] / (f), while the native algorithm carries networks of descriptors (DescribedNetwork (VertexDesc T)) and computes with coefficient lists in A_p = (ℤ / 2 ^ p)[U] / (f). This file gives the network over O that a described network stands for.

Main definitions #

Main results #

References #

Lifts of coefficient lists #

ℤ_(2) lies in the valuation ring O of ℚ[U] / (f).

The class of U in the valuation ring O = ℤ_(2)[U] / (f), f = monicOf fl.

The lift of a coefficient list to O: ∑ i < e, c_i U ^ i, with e = fl.length.

theorem Cslib.GaloisRingArith.reduction_liftO {fl : List ℕ} (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (monicOf fl))) (p : ℕ) (c : List ℕ) :
(AdjoinRoot.reduction ⋯ hirr p) (liftO hirr c) = val p fl c

Reducing a lift modulo 2 ^ p gives the value in A_p.

The class of a lift modulo 2 ^ p is the image of the value in A_p.

Binary lists as interpolation points #

theorem Cslib.GaloisRingArith.isUnit_liftO_sub {fl : List ℕ} (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (monicOf fl))) {c c' : List ℕ} (hc : ∀ i < fl.length, c.getD i 0 < 2) (hc' : ∀ i < fl.length, c'.getD i 0 < 2) (hne : ∃ i < fl.length, c.getD i 0 ≠ c'.getD i 0) :
IsUnit (liftO hirr c - liftO hirr c')

Lifts of distinct binary lists differ by a unit. If two lists have binary coordinates below e = fl.length and differ at one of them, their lifts to O differ by a unit: they are digit lifts (AdjoinRoot.isUnit_integerDigitLift_sub).

theorem Cslib.GaloisRingArith.getD_map_testBit (e k i : ℕ) (hi : i < e) :
(List.map (fun (j : ℕ) => if k.testBit j = true then 1 else 0) (List.range e)).getD i 0 = if k.testBit i = true then 1 else 0

Coordinate i < e of the binary digits of k below e.

theorem Cslib.GaloisRingArith.pairwise_isUnit_liftO_sub_digits {fl : List ℕ} (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (monicOf fl))) {n : ℕ} (hn : n ≤ 2 ^ fl.length) :
Pairwise fun (i j : Fin (List.map (fun (k : ℕ) => List.map (fun (j : ℕ) => if k.testBit j = true then 1 else 0) (List.range fl.length)) (List.range n)).length) => IsUnit (liftO hirr ((List.map (fun (k : ℕ) => List.map (fun (j : ℕ) => if k.testBit j = true then 1 else 0) (List.range fl.length)) (List.range n)).getD ↑i []) - liftO hirr ((List.map (fun (k : ℕ) => List.map (fun (j : ℕ) => if k.testBit j = true then 1 else 0) (List.range fl.length)) (List.range n)).getD ↑j []))

Binary-digit points are interpolation points. The lists of the binary digits below e = fl.length of 0, …, n - 1, for n ≤ 2 ^ e, have lifts to O with unit differences.

Lists of lists with one occurrence #

theorem Cslib.Circuits.Frontier.exists_unique_of_sum_count_eq_one {Ls : List (List ℕ)} {j : ℕ} (h : (List.map (fun (l : List ℕ) => List.count j l) Ls).sum = 1) :
∃ (i : ℕ) (hi : i < Ls.length), List.count j Ls[i] = 1 ∧ ∀ (i' : ℕ) (hi' : i' < Ls.length), j ∈ Ls[i'] → i' = i

One occurrence among the lists. If an element occurs once in total among a list of lists, exactly one of the lists contains it, once.

Rows first #

theorem Cslib.Circuits.Frontier.DescribedNetwork.isRowsFirstBipartite_map {T : Type} (D : DescribedNetwork T) {T' : Type} (f : T → T') (r : ℕ) :
{ numEdges := D.numEdges, vertices := List.map (fun (v : List ℕ × T) => (v.1, f v.2)) D.vertices }.IsRowsFirstBipartite r ↔ D.IsRowsFirstBipartite r

Being rows-first depends only on the ports, not on the descriptors.

The vertices at the edge j: those having j among their ports, in increasing order.

The ends of the edges: for each edge, its first and its second vertex.

A rows-first network with an edge has at most as many rows as vertices.

theorem Cslib.Circuits.Frontier.DescribedNetwork.exists_ends {T : Type} {D : DescribedNetwork T} {r : ℕ} (hD : D.IsRowsFirstBipartite r) {j : ℕ} (hj : j < D.numEdges) :
∃ (s : ℕ) (t : ℕ) (hs : s < D.vertices.length) (ht : t < D.vertices.length), s < r ∧ r ≤ t ∧ List.count j D.vertices[s].1 = 1 ∧ List.count j D.vertices[t].1 = 1 ∧ ∀ (v : ℕ) (hv : v < D.vertices.length), j ∈ D.vertices[v].1 → v = s ∨ v = t

The two ends of an edge of a rows-first network: a row s < r and a column t ≥ r, which are the only vertices with the edge among their ports, each once.

theorem Cslib.Circuits.Frontier.DescribedNetwork.incident_eq {T : Type} {D : DescribedNetwork T} {r : ℕ} (hD : D.IsRowsFirstBipartite r) {j : ℕ} (hj : j < D.numEdges) :
∃ (s : ℕ) (t : ℕ) (hs : s < D.vertices.length) (ht : t < D.vertices.length), s < r ∧ r ≤ t ∧ List.count j D.vertices[s].1 = 1 ∧ List.count j D.vertices[t].1 = 1 ∧ D.incident j = [s, t]

The vertices at an edge of a rows-first network are its row and its column.

The first vertex at an edge of a rows-first network is a vertex.

The second vertex at an edge of a rows-first network is a vertex.

The network of a described network #

The row of an edge of a rows-first network.

The column of an edge of a rows-first network.

noncomputable def Cslib.Circuits.Frontier.DescribedNetwork.toNetwork {T : Type} {D : DescribedNetwork T} {r : ℕ} (hD : D.IsRowsFirstBipartite r) {R : Type u_1} (eval : T → List Bool → R) :

The network of a rows-first described network, on Fin k vertices and Fin m edges: the edge j runs from its row to its column, and the tensor of a vertex is the evaluator at its descriptor and the bits on its ports.

@[simp]
theorem Cslib.Circuits.Frontier.DescribedNetwork.toNetwork_src {T : Type} {D : DescribedNetwork T} {r : ℕ} (hD : D.IsRowsFirstBipartite r) {R : Type u_1} (eval : T → List Bool → R) :
(toNetwork hD eval).src = srcFin hD
@[simp]
theorem Cslib.Circuits.Frontier.DescribedNetwork.toNetwork_tgt {T : Type} {D : DescribedNetwork T} {r : ℕ} (hD : D.IsRowsFirstBipartite r) {R : Type u_1} (eval : T → List Bool → R) :
(toNetwork hD eval).tgt = tgtFin hD

The edges run from the rows.

The edges end at the columns.

A vertex has an edge among its ports exactly when it is an end of the edge.

The ends of the edges are the native edgeEnds.

The network has the contraction of the described network.

theorem Cslib.Circuits.Frontier.DescribedNetwork.toNetwork_map {T : Type} {D : DescribedNetwork T} {r : ℕ} (hD : D.IsRowsFirstBipartite r) {R : Type u_1} {S : Type u_2} [CommSemiring R] [CommSemiring S] (eval : T → List Bool → R) (ψ : R →+* S) :
TensorNetwork.map ψ (toNetwork hD eval) = toNetwork hD fun (t : T) (bs : List Bool) => ψ (eval t bs)

The network of a described network commutes with maps of the entries.

theorem Cslib.Circuits.Frontier.DescribedNetwork.reduction_contraction_toNetwork {T : Type} {D : DescribedNetwork T} {r : ℕ} (hD : D.IsRowsFirstBipartite r) {fl : List ℕ} (hirr : Irreducible (Polynomial.map (Int.castRingHom (ZMod 2)) (GaloisRingArith.monicOf fl))) (eval : T → List Bool → List ℕ) (p : ℕ) :
(AdjoinRoot.reduction ⋯ hirr p) (toNetwork hD fun (t : T) (bs : List Bool) => GaloisRingArith.liftO hirr (eval t bs)).contraction = contraction (fun (t : T) (bs : List Bool) => GaloisRingArith.val p fl (eval t bs)) D

Over O, the contraction reduces to the contraction in A_p. For the network with the lifts of the entries of the descriptors, reduction modulo 2 ^ p of its contraction is the contraction of the described network with the values of the entries in A_p.

Polynomial time #