structure
definition
Gate
show as:
view math explainer →
open explainer
Generate a durable explainer page for this declaration.
open lean source
IndisputableMonolith.Complexity.CircuitLedger on GitHub at line 83.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
used by
-
CellState -
encodeClause -
localRule -
BooleanCircuit -
display_speed_eq_c -
CurvatureType -
interaction_implies_entangling -
separable_implies_not_entangling -
dAlembert_forces_Gcosh -
Fquad_not_dAlembert_structure -
polynomial_consistency_forces_rcl -
CostBranch -
Fquad_is_flat -
interaction_forces_entanglement -
P_forced_from_FJ -
gate_cost_uniqueness -
gate_discreteness -
gate_ledger -
gate_phi -
gate_selection_rule -
NecessityGate -
CoolingSignature -
superconductor_effective_source -
ledger_universal -
finite_quotient_necessity -
G_derived -
molecularGateSeconds
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). -/