Documentation

CslibFrontier.Computability.Circuit.Frontier.Layouts.Compression

Compressions of multigraphs #

Laying out a multigraph of bounded degree reduces to laying out a smaller multigraph, its quotient by a compression. Fix a budget d, at least the maximum degree. Partition the vertices into blocks, each listing its vertices in order, starting from single vertices. Two distinct blocks joined by an edge may be merged when at most d edges leave their union; the merged block lists the longer block first. A Compression records the invariants of this process:

Each merge loses a block, so merging ends in a saturated compression, to which no merge applies (Compression.exists_saturated).

The quotient of a compression is the multigraph whose vertices are the blocks and whose edges are the edges of the original multigraph between distinct blocks. By the counting invariant its cycle rank is at most that of the original multigraph (Compression.card_add_card_external_le). A layout of the quotient expands to a layout of the original multigraph, block by block and each block in its own order; the frontiers of the expanded layout exceed those of the layout of the quotient by at most d log₂ |V| edges (Compression.exists_width_le).

Main definitions #

Main results #

structure Cslib.Circuits.Frontier.Multigraph.Compression {V : Type u_1} {E : Type u_2} (G : Multigraph V E) (d : ℕ) :
Type u_1

A compression of G with budget d: a partition of its vertices into blocks, each listing its vertices in order, with the invariants maintained by merging. A block B is identified with its vertex set {v | v ∈ B}.

Merging #

The compression into single vertices.

@[simp]
theorem Cslib.Circuits.Frontier.Multigraph.Compression.notMem_blocks_append {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) {B B' : List V} (hB : B ∈ c.blocks) (hB' : B' ∈ c.blocks) :
B ++ B' ∉ c.blocks

Concatenating two blocks in c.blocks never yields an existing block of c.

theorem Cslib.Circuits.Frontier.Multigraph.Compression.card_insert_append_erase_add_one {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) [DecidableEq V] {B B' : List V} (hB : B ∈ c.blocks) (hB' : B' ∈ c.blocks) (hne : B ≠ B') :
(insert (B ++ B') ((c.blocks.erase B).erase B')).card + 1 = c.blocks.card
theorem Cslib.Circuits.Frontier.Multigraph.Compression.ncard_internal_add_join_le {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) [DecidableEq V] [Finite E] {B B' : List V} (hB : B ∈ c.blocks) (hB' : B' ∈ c.blocks) (hne : B ≠ B') :
{e : E | ∃ D ∈ c.blocks, G.src e ∈ D ∧ G.tgt e ∈ D}.ncard + (G.edgeCut {v : V | v ∈ B} ∩ G.edgeCut {v : V | v ∈ B'}).ncard ≤ {e : E | ∃ D ∈ insert (B ++ B') ((c.blocks.erase B).erase B'), G.src e ∈ D ∧ G.tgt e ∈ D}.ncard
def Cslib.Circuits.Frontier.Multigraph.Compression.merge {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) [DecidableEq V] [Finite E] {B B' : List V} (hB : B ∈ c.blocks) (hB' : B' ∈ c.blocks) (hne : B ≠ B') (hlen : B'.length ≤ B.length) (hjoin : (G.edgeCut {v : V | v ∈ B} ∩ G.edgeCut {v : V | v ∈ B'}).Nonempty) (hcut : (G.edgeCut ({v : V | v ∈ B} ∪ {v : V | v ∈ B'})).ncard ≤ d) :

Ordered merge. Replace two distinct blocks B and B' joined by an edge (with B'.length ≤ B.length and at most d edges leaving their union) by B ++ B'.

@[simp]
theorem Cslib.Circuits.Frontier.Multigraph.Compression.blocks_merge {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) [DecidableEq V] [Finite E] {B B' : List V} (hB : B ∈ c.blocks) (hB' : B' ∈ c.blocks) (hne : B ≠ B') (hlen : B'.length ≤ B.length) (hjoin : (G.edgeCut {v : V | v ∈ B} ∩ G.edgeCut {v : V | v ∈ B'}).Nonempty) (hcut : (G.edgeCut ({v : V | v ∈ B} ∪ {v : V | v ∈ B'})).ncard ≤ d) :
(c.merge hB hB' hne hlen hjoin hcut).blocks = insert (B ++ B') ((c.blocks.erase B).erase B')

A compression is saturated when no merge applies: more than d edges leave the union of any two distinct blocks joined by an edge.

theorem Cslib.Circuits.Frontier.Multigraph.Compression.exists_saturated {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} [Finite V] [Finite E] (hG : G.MaxDegreeLE d) :
∃ (c : G.Compression d), c.Saturated

Merging terminates. Every finite multigraph of maximum degree d has a saturated compression with budget d: one with the fewest blocks.

The quotient #

noncomputable def Cslib.Circuits.Frontier.Multigraph.Compression.blockOf {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) (v : V) :
↥c.blocks

The block containing a vertex.

theorem Cslib.Circuits.Frontier.Multigraph.Compression.mem_blockOf {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) (v : V) :
v ∈ ↑(c.blockOf v)

Every vertex belongs to its assigned block.

theorem Cslib.Circuits.Frontier.Multigraph.Compression.mem_iff_blockOf_eq {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) {v : V} {B : ↥c.blocks} :
v ∈ ↑B ↔ c.blockOf v = B

A vertex belongs to a block B if and only if c.blockOf v = B.

theorem Cslib.Circuits.Frontier.Multigraph.Compression.disjoint_of_ne {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) {B B' : ↥c.blocks} (h : B ≠ B') :
Disjoint {v : V | v ∈ ↑B} {v : V | v ∈ ↑B'}

Distinct blocks are disjoint.

theorem Cslib.Circuits.Frontier.Multigraph.Compression.mem_edgeCut_block {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) {B : ↥c.blocks} {e : E} :
e ∈ G.edgeCut {v : V | v ∈ ↑B} ↔ ¬(c.blockOf (G.src e) = B ↔ c.blockOf (G.tgt e) = B)

An edge lies in the cut of a block B exactly when only one of its endpoints lies in B.

theorem Cslib.Circuits.Frontier.Multigraph.Compression.exists_ne_mem_edgeCut {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) {B : ↥c.blocks} {e : E} (he : e ∈ G.edgeCut {v : V | v ∈ ↑B}) :
∃ (B' : ↥c.blocks), B' ≠ B ∧ e ∈ G.edgeCut {v : V | v ∈ ↑B'}

An edge leaving a block leaves another block too.

theorem Cslib.Circuits.Frontier.Multigraph.Compression.edgeCut_nonempty {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) (hG : G.toSimpleGraph.Connected) (two : 1 < Nat.card ↥c.blocks) (B : ↥c.blocks) :
(G.edgeCut {v : V | v ∈ ↑B}).Nonempty

In a connected multigraph, some edge leaves each block, unless there is only one.

The external edges: those between distinct blocks.

theorem Cslib.Circuits.Frontier.Multigraph.Compression.compl_external {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) :
c.externalᶜ = {e : E | ∃ B ∈ c.blocks, G.src e ∈ B ∧ G.tgt e ∈ B}

The edges outside the external edges are those inside a block.

noncomputable def Cslib.Circuits.Frontier.Multigraph.Compression.quotient {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) :

The quotient of a compression: the multigraph whose vertices are the blocks and whose edges are the external edges, each joining the blocks of its endpoints.

@[simp]
theorem Cslib.Circuits.Frontier.Multigraph.Compression.quotient_src {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) (e : ↑c.external) :
c.quotient.src e = c.blockOf (G.src ↑e)

The source of an external edge in the quotient is the block of its source in G.

@[simp]
theorem Cslib.Circuits.Frontier.Multigraph.Compression.quotient_tgt {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) (e : ↑c.external) :
c.quotient.tgt e = c.blockOf (G.tgt ↑e)

The target of an external edge in the quotient is the block of its target in G.

The quotient multigraph is loopless.

Cuts of unions of whole blocks are cuts of the quotient.

The edges at a block of the quotient are the edges leaving the block.

Every block in the quotient multigraph has degree at most d.

theorem Cslib.Circuits.Frontier.Multigraph.Compression.sum_ncard_edgeCut {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) [Finite E] :
∑ B : ↥c.blocks, (G.edgeCut {v : V | v ∈ ↑B}).ncard = 2 * Nat.card ↑c.external

The cuts of the blocks count every external edge twice.

The quotient is no more cyclic than the multigraph: |V| - |B| ≤ |E| - |E_B|, where B is the set of blocks and E_B the set of external edges.

Expansion #

theorem Cslib.Circuits.Frontier.Multigraph.Compression.exists_width_le {V : Type u_1} {E : Type u_2} {G : Multigraph V E} {d : ℕ} (c : G.Compression d) [Finite V] [Finite E] (σ : Layout ↥c.blocks) :
∃ (π : Layout V), G.width π ≤ c.quotient.width σ + d * Nat.log 2 (Nat.card V)

Expansion. Lay out the vertices block by block, ordering the blocks by a layout σ of the quotient and each block by its list. Each frontier consists of whole blocks, which are cut by a frontier of σ, and a proper prefix of one more block. So the width exceeds that of σ by at most d log₂ |V|.

theorem Cslib.Circuits.Frontier.LayoutBound.of_saturated {d : ℕ} {A : ℝ} (hA : 0 ≤ A) (h : ∀ η > 0, ∃ (N₀ : ℕ), ∀ (V E : Type) [Finite V] [inst : Finite E] (G : Multigraph V E) (Q : G.Compression d), G.toSimpleGraph.Connected → Q.Saturated → 1 < Nat.card ↥Q.blocks → N₀ < Nat.card ↥Q.blocks → ∃ (σ : Layout ↥Q.blocks), ↑(Q.quotient.width σ) ≤ (A + η) * ↑G.cycleRank) :

Layout bounds from saturated quotients. For 0 ≤ A, the layout hypothesis LayoutBound d A follows once, for each η > 0 and some N₀, every saturated compression of a connected multigraph into more than max 1 N₀ blocks has a quotient layout of width at most (A + η) β₁. Smaller quotients have at most d (N₀ + 1) edges, and expanding a quotient layout costs d log₂ |V|.