Raw threshold-fragment internals #
This module proves the structural and semantic invariants of the unary dynamic
program defined in Complexitylib.Circuits.Encoding.Threshold.Defs. Public
statements are re-exported by Complexitylib.Circuits.Encoding.Threshold.
Exact structural accounting #
theorem
Complexity.CircuitCode.Threshold.length_cellGates_internal
(available threshold inputRow thresholdColumn input : ℕ)
:
Internal exact size of a two-gate table cell.
theorem
Complexity.CircuitCode.Threshold.length_rowPrefix_internal
(available threshold inputRow input columnCount : ℕ)
:
Internal exact size of a row prefix.
theorem
Complexity.CircuitCode.Threshold.length_rows_internal
(available threshold inputRow inputCount : ℕ)
(refs : Fin inputCount → ℕ)
:
Internal exact size of a sequence of table rows.
theorem
Complexity.CircuitCode.Threshold.length_compileRaw_internal
(available threshold : ℕ)
{inputCount : ℕ}
(refs : Fin inputCount → ℕ)
:
Internal exact gate count for threshold compilation.
theorem
Complexity.CircuitCode.Threshold.outputWire_eq_internal
(available threshold : ℕ)
{inputCount : ℕ}
(refs : Fin inputCount → ℕ)
:
outputWire available inputCount threshold = available + List.length (compileRaw available threshold refs) - 1
Internal equation identifying the final emitted wire.
Boolean recurrence #
Iterative evaluation #
theorem
Complexity.CircuitCode.Threshold.evalAux?_compileRaw_internal
(available threshold : ℕ)
[NeZero available]
{inputCount : ℕ}
(refs : Fin inputCount → ℕ)
(bits : Fin inputCount → Bool)
(wires : Array Bool)
(hsize : wires.size = available)
(hrefs : ∀ (i : Fin inputCount), refs i < available)
(hinputs : ∀ (i : Fin inputCount), wires[refs i]? = some (bits i))
:
Internal semantic correctness theorem for raw threshold fragments.
theorem
Complexity.CircuitCode.Threshold.topologicallyWellFormed_compileRaw_internal
(available threshold : ℕ)
[NeZero available]
{inputCount : ℕ}
(refs : Fin inputCount → ℕ)
(hrefs : ∀ (i : Fin inputCount), refs i < available)
:
RawCircuit.TopologicallyWellFormed available (compileRaw available threshold refs)
Internal topological correctness theorem for raw threshold fragments.