Documentation

CslibFrontier.Computability.Circuit.Encoding.EvaluationTime

Polynomial-time evaluation of circuit codes over finite signatures and carriers #

For any Signature with finitely many operation symbols [Finite σ.Op] and any finite carrier [Finite U], the total gate-list evaluator Cslib.Circuits.evalCode runs in polynomial time on framed input lists (encList eU) and binary-indexed gate lists (encList (Circuit.encGate eOp)). Each step dispatches on the finite operation tag (ComputableInPolyTime.finite_cases), reads its arguments by capped binary lookup (listGetD_binary), applies the finite gate table, and appends one carrier value whose encoded length is bounded by a constant depending only on (U, eU).

Both CslibFrontier.Computability.Circuit.Boolean.EvaluationTime and CslibFrontier.Computability.Circuit.Arithmetic.EvaluationTime specialize these certificates.

Main definitions #

Main results #

def Cslib.Circuits.evalOutputs {σ : Signature} {U : Type u} (I : Interpretation σ U) (d : U) (code : List (σ.Op × List ℕ) × List ℕ) (x : List U) :

Evaluate all output wires listed in code.2 after running the gate list code.1 on x.

theorem Cslib.Circuits.Circuit.evalOutputs_code {σ : Signature} {U : Type u} {n m : ℕ} (c : Circuit σ n m) (I : Interpretation σ U) (d : U) (x : Fin n → U) :

On the code of a typed circuit, evalOutputs computes the list of output values.

theorem Cslib.Circuits.computableInPolyTime_evalCode {σ : Signature} {U α : Type} [Finite σ.Op] [Finite U] {eOp : σ.Op ↪ List Bool} {eU : U ↪ List Bool} {encIn : α ↪ List Bool} (I : Interpretation σ U) (d : U) {x : α → List U} {gates : α → List (σ.Op × List ℕ)} (hx : Turing.MultiTapeTM.ComputableInPolyTime x encIn (Turing.MultiTapeTM.encList eU)) (hgates : Turing.MultiTapeTM.ComputableInPolyTime gates encIn (Turing.MultiTapeTM.encList (Circuit.encGate eOp))) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => evalCode I d (x a) (gates a)) encIn (Turing.MultiTapeTM.encList eU)

Polynomial-time evaluation of gate lists over a finite operation set and finite carrier, charging the framed input list and binary-indexed gate list.

theorem Cslib.Circuits.computableInPolyTime_evalOutput {σ : Signature} {U α : Type} [Finite σ.Op] [Finite U] {eOp : σ.Op ↪ List Bool} {eU : U ↪ List Bool} {encIn : α ↪ List Bool} (I : Interpretation σ U) (d : U) {x : α → List U} {gates : α → List (σ.Op × List ℕ)} {output : α → ℕ} (hx : Turing.MultiTapeTM.ComputableInPolyTime x encIn (Turing.MultiTapeTM.encList eU)) (hgates : Turing.MultiTapeTM.ComputableInPolyTime gates encIn (Turing.MultiTapeTM.encList (Circuit.encGate eOp))) (houtput : Turing.MultiTapeTM.ComputableInPolyTime output encIn Turing.MultiTapeTM.encNat) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (evalCode I d (x a) (gates a)).getD (output a) d) encIn eU

Read a binary-indexed output wire from the computed gate trace in polynomial time.

theorem Cslib.Circuits.computableInPolyTime_evalOutputs {σ : Signature} {U α : Type} [Finite σ.Op] [Finite U] {eOp : σ.Op ↪ List Bool} {eU : U ↪ List Bool} {encIn : α ↪ List Bool} (I : Interpretation σ U) (d : U) {code : α → List (σ.Op × List ℕ) × List ℕ} {x : α → List U} (hcode : Turing.MultiTapeTM.ComputableInPolyTime code encIn (Circuit.encCode eOp)) (hx : Turing.MultiTapeTM.ComputableInPolyTime x encIn (Turing.MultiTapeTM.encList eU)) :

Evaluate every output wire listed by a runtime circuit code in polynomial time.