pith. machine review for the scientific record. sign in
structure

Gate

definition
show as:
view math explainer →
module
IndisputableMonolith.Complexity.CircuitLedger
domain
Complexity
line
83 · github
papers citing
none yet

open explainer

Read the cached plain-language explainer.

open lean source

IndisputableMonolith.Complexity.CircuitLedger on GitHub at line 83.

browse module

All declarations in this module, on Recognition.

explainer page

A cached Ask Recognition explainer exists for this declaration.

open explainer

depends on

used by

formal source

  80/-- A single gate with its type and parent wire indices.
  81    Wires are numbered 0..(gate_count-1) in topological order,
  82    so parents always have strictly smaller index → DAG guarantee. -/
  83structure Gate (S : ℕ) where
  84  /-- Gate type -/
  85  gtype    : GateType
  86  /-- Parent gate indices (at most 2 for binary gates) -/
  87  parents  : List (Fin S)
  88  /-- Locality: at most 2 parents (no gate sees more than 2 predecessors) -/
  89  arity_le : parents.length ≤ 2
  90  /-- Feed-forward: all parent indices are strictly less than this gate's index -/
  91  ff_bound : ∀ p ∈ parents, (p : ℕ) < S
  92
  93/-- A Boolean circuit of size S over n input variables.
  94    This is a *restricted sub-ledger*: feed-forward, locally deterministic,
  95    no global coupling across the Z³ lattice. -/
  96structure BooleanCircuit (n : ℕ) where
  97  /-- Total number of gates (inputs + internal + output) -/
  98  gate_count : ℕ
  99  /-- The gates in topological order -/
 100  gates : Fin gate_count → Gate gate_count
 101  /-- Input gates each reference one variable in {0,..,n-1} -/
 102  input_var : ∀ i : Fin gate_count,
 103    (gates i).gtype = GateType.Input → ∃ _v : Fin n, True
 104  /-- At least one output gate exists -/
 105  has_output : ∃ i : Fin gate_count, (gates i).gtype = GateType.Output
 106
 107/-- The size of a circuit is its gate count. -/
 108def BooleanCircuit.size {n : ℕ} (c : BooleanCircuit n) : ℕ := c.gate_count
 109
 110/-- A Boolean circuit computes a specific Boolean function determined by its
 111    gate structure and input wiring. We model this as a bundled function field
 112    rather than implementing gate-by-gate evaluation (which would require
 113    enriching BooleanCircuit with explicit input wiring). -/