Documentation

CslibFrontier.Computability.Circuit.Synthesis

Building circuits from available functions #

An existing circuit can be inserted into a synthesis construction by wiring its inputs to available functions. Its outputs then become available at a cost of its number of gates, while all previously computed functions remain available. Repeated inputs share their original wires.

Synthesis.Builder accumulates available wires and gate costs through Builder.start and Builder.add. Each appended construction is charged once; selecting and reusing wires is free. Builder.finish selects the outputs and checks the requested bound. These operations compose ordinary Synthesis certificates; they do not search for a cheaper construction.

Main definitions #

Main results #

References #

theorem Cslib.Circuits.Synthesis.circuit {σ : Signature} {U : Type u} {I : Interpretation σ U} {n : ℕ} {s : Set ((Fin n → U) → U)} {m p : ℕ} (c : Circuit σ m p) (g : Fin m → (Fin n → U) → U) (hg : ∀ (i : Fin m), g i ∈ s) :
Synthesis I s (Set.range fun (j : Fin p) (x : Fin n → U) => c.eval I (fun (i : Fin m) => g i x) j) c.size

A circuit whose inputs are fed by available functions computes its outputs with as many additional gates as it has. The functions feeding the inputs may repeat.

theorem Cslib.Circuits.Synthesis.extend {σ : Signature} {U : Type u} {I : Interpretation σ U} {n : ℕ} {s t : Set ((Fin n → U) → U)} {a b : ℕ} (h : Synthesis I s t a) (u : Set ((Fin n → U) → U)) (h' : Synthesis I t u b) :
Synthesis I s (t ∪ u) (a + b)

Append a construction whose inputs are among the targets built so far, keeping those targets available. This is the certificate behind Builder.add. The new family u is explicit, so a chain of extend steps accumulates the syntactic union s ∪ t₁ ∪ ⋯ ∪ tₖ, and membership in it can be checked without unfolding.

structure Cslib.Circuits.Synthesis.Builder {σ : Signature} {U : Type u} {n : ℕ} (I : Interpretation σ U) (s : Set ((Fin n → U) → U)) :

A sequence of certified constructions, including every wire available along the way.

  • wires : Set ((Fin n → U) → U)

    Original sources and all outputs built so far.

  • cost : ℕ

    Sum of the appended constructions' gate budgets.

  • bound : Synthesis I s self.wires self.cost

    The accumulated synthesis certificate.

def Cslib.Circuits.Synthesis.Builder.start {σ : Signature} {U : Type u} {n : ℕ} (I : Interpretation σ U) (s : Set ((Fin n → U) → U)) :

Begin with the source wires, without adding gates.

def Cslib.Circuits.Synthesis.Builder.add {σ : Signature} {U : Type u} {I : Interpretation σ U} {n : ℕ} {s : Set ((Fin n → U) → U)} (b : Builder I s) {t : Set ((Fin n → U) → U)} {k : ℕ} (h : Synthesis I b.wires t k) :

Append a construction whose inputs are available, retaining both old and new wires.

theorem Cslib.Circuits.Synthesis.Builder.finish {σ : Signature} {U : Type u} {I : Interpretation σ U} {n : ℕ} {s : Set ((Fin n → U) → U)} (b : Builder I s) {t : Set ((Fin n → U) → U)} {k : ℕ} (ht : t ⊆ b.wires) (hk : b.cost ≤ k) :
Synthesis I s t k

Select outputs from the final wires and enlarge the accumulated budget.