Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.ChildNumbering

Numbering the vertices and edges of a child network #

A child network of the contraction recursion (TensorNetwork.ModeSplitting.child, §D.4.6 of [OAI26k], p. 63) has as vertices the vertices of a group g, then one vertex per packet, and as edges the row ports of group g, then the column ports of group g. A row port e joins the row src e to the packet of e; a column port joins the column tgt e to it. A machine numbers them (childVertexEquiv, childEdgeEquiv):

childEdgeList computes the ends of the numbered child edges from the list of groups of the vertices and the edges with their packets, and childEdgeList_eq proves that it lists the numbered ends of childSrc and childTgt. childPorts computes the ports of each numbered child vertex, and childPorts_eq proves that they are the ports TensorNetwork.explicitPorts of the written-out child. For a mode splitting S on Fin vertices, edges and packets, the ends of the edges of S.child β g are by definition childSrc and childTgt for S.group and S.packet. So a native child carries exactly the edge structure of the child network, and its contraction transports along the numberings by reindexing.

The groups and packets come from the native packing (Cslib.PacketPacking.nativePacking); the tensors of the child vertices are not treated here.

Main definitions #

Main results #

References #

Positions #

The elements with the property p, in increasing order.

The position of v among the elements with the property p: the number of earlier ones.

theorem Cslib.Circuits.Frontier.ChildNumbering.rank_lt {n : ℕ} (p : Fin n → Prop) [DecidablePred p] (v : Fin n) (hv : p v) :

The position of an element with the property is below the number of such elements.

theorem Cslib.Circuits.Frontier.ChildNumbering.getElem_rank {n : ℕ} (p : Fin n → Prop) [DecidablePred p] (v : Fin n) (hv : p v) :
(members p)[rank p v] = v

The element at the position of v is v.

theorem Cslib.Circuits.Frontier.ChildNumbering.rank_getElem {n : ℕ} (p : Fin n → Prop) [DecidablePred p] (j : ℕ) (hj : j < (members p).length) :
rank p (members p)[j] = j

The member at position j has position j.

The numbering of the elements with a property by their positions.

@[simp]
theorem Cslib.Circuits.Frontier.ChildNumbering.rankEquiv_apply_val {n : ℕ} (p : Fin n → Prop) [DecidablePred p] (v : { v : Fin n // p v }) :
↑((rankEquiv p) v) = rank p ↑v

The child's numbering #

@[reducible, inline]
abbrev Cslib.Circuits.Frontier.ChildNumbering.ChildVertex {n r : ℕ} (group : Fin n → Fin r) (g : Fin r) (P : ℕ) :

The vertices of a child: the vertices of group g, then the packets.

@[reducible, inline]
abbrev Cslib.Circuits.Frontier.ChildNumbering.ChildEdge {m n r : ℕ} (src tgt : Fin m → Fin n) (group : Fin n → Fin r) (g : Fin r) :

The edges of a child: the row ports of group g, then its column ports.

def Cslib.Circuits.Frontier.ChildNumbering.childSrc {m n P r : ℕ} (src tgt : Fin m → Fin n) (group : Fin n → Fin r) (g : Fin r) :
ChildEdge src tgt group g → ChildVertex group g P

The child end of a child edge: the row of a row port, or the column of a column port.

def Cslib.Circuits.Frontier.ChildNumbering.childTgt {m n P r : ℕ} (src tgt : Fin m → Fin n) (group : Fin n → Fin r) (packet : Fin m → Fin P) (g : Fin r) :
ChildEdge src tgt group g → ChildVertex group g P

The packet end of a child edge.

def Cslib.Circuits.Frontier.ChildNumbering.childVertexEquiv {n P r : ℕ} (group : Fin n → Fin r) (g : Fin r) :
ChildVertex group g P ≃ Fin ((members fun (v : Fin n) => group v = g).length + P)

The numbering of the child vertices: the vertices of group g by position, then the packets.

def Cslib.Circuits.Frontier.ChildNumbering.childEdgeEquiv {m n r : ℕ} (src tgt : Fin m → Fin n) (group : Fin n → Fin r) (g : Fin r) :
ChildEdge src tgt group g ≃ Fin ((members fun (e : Fin m) => group (src e) = g).length + (members fun (e : Fin m) => group (tgt e) = g).length)

The numbering of the child edges: the row ports of group g in edge order, then its column ports in edge order.

The native child #

The ends of the numbered child edges, from the groups of the vertices, the group g, the (row, column) edges and their packets: the row ports of group g, then its column ports, each from the position of its vertex among the vertices of group g to the number of such vertices plus its packet.

The ports of the numbered child vertex i: the numbered child edges at it, in increasing order.

theorem Cslib.Circuits.Frontier.ChildNumbering.count_ofFn_group {n r : ℕ} (group : Fin n → Fin r) (g : Fin r) :
List.count (↑g) (List.ofFn fun (u : Fin n) => ↑(group u)) = (members fun (u : Fin n) => group u = g).length

Counting a group among the groups of all vertices gives the number of its vertices.

theorem Cslib.Circuits.Frontier.ChildNumbering.childEdgeList_eq {m n P r : ℕ} (src tgt : Fin m → Fin n) (group : Fin n → Fin r) (packet : Fin m → Fin P) (g : Fin r) :
childEdgeList (List.ofFn fun (v : Fin n) => ↑(group v)) (↑g) (List.ofFn fun (e : Fin m) => (↑(src e), ↑(tgt e))) (List.ofFn fun (e : Fin m) => ↑(packet e)) = List.ofFn fun (j : Fin ((members fun (e : Fin m) => group (src e) = g).length + (members fun (e : Fin m) => group (tgt e) = g).length)) => (↑((childVertexEquiv group g) (childSrc src tgt group g ((childEdgeEquiv src tgt group g).symm j))), ↑((childVertexEquiv group g) (childTgt src tgt group packet g ((childEdgeEquiv src tgt group g).symm j))))

The native child edges are the numbered ends of the child edges.

theorem Cslib.Circuits.Frontier.ChildNumbering.childPorts_eq {R : Type u_1} {V : Type u_2} {E : Type u_3} [DecidableEq V] {k l : ℕ} (N : TensorNetwork R Bool V E) (ev : V ≃ Fin k) (ee : E ≃ Fin l) (v : V) :
childPorts (List.ofFn fun (j : Fin l) => (↑(ev (N.src (ee.symm j))), ↑(ev (N.tgt (ee.symm j))))) ↑(ev v) = List.map Fin.val (N.explicitPorts ee v)

The native ports are the ports of the written-out network: for the list of the numbered ends of the edges, the native ports of the vertex numbered ev v are the ports TensorNetwork.explicitPorts of v.

Polynomial time #

@[reducible, inline]

The inputs ((groups, g), (edges, packets)) of childEdgeList, in binary.