Documentation

Complexitylib.Circuits.Dependency

Circuit dependency graphs #

This module exposes the circuit DAG as a finite directed graph. Vertices are primary inputs, internal gates, and output gates. Edges point from each referenced wire to the gate that reads it.

Main results #

@[simp]
theorem Complexity.Circuit.dependencyGraph_adj_iff {B : Basis} {N M G : } [NeZero N] [NeZero M] (c : Circuit B N M G) {source target : Fin (N + G + M)} :
c.dependencyGraph.Adj source target (source, target) c.dependencyEdges

Dependency-graph adjacency is membership in the finite edge set.

theorem Complexity.Circuit.dependencyGraph_adj_val_lt {B : Basis} {N M G : } [NeZero N] [NeZero M] (c : Circuit B N M G) {source target : Fin (N + G + M)} (edge : c.dependencyGraph.Adj source target) :
source < target

Every dependency edge points from a smaller to a larger vertex index.

The dependency graph of every well-formed circuit is acyclic.

@[simp]

The generic graph edge enumeration recovers the circuit edge set.

The number of distinct dependency edges is at most total fan-in.

The inequality can be strict because multiple inputs of one gate may read the same wire, while a digraph stores only one copy of an edge.