Checking circuit gate codes #
The existing Program.IsCodeFrom predicate has one Boolean checker for arbitrary signatures.
Its native certificate charges the operator's supplied encoding and a certified binary arity
function. Only actual argument lists are traversed; neither arity nor wire numbers drive an
allocation. The input count is unary and wire numbers are binary. Output-wire validity and
output-count agreement are separate checks.
Main definitions #
Cslib.Circuits.codeCheck: arity and backward-reference validation.
Main results #
Cslib.Circuits.codeCheck_eq_true_iff: exact agreement withProgram.IsCodeFrom.Cslib.Circuits.computableInPolyTime_codeCheck: uniform validation given certified binary arity.
Checking codes #
theorem Cslib.Circuits.computableInPolyTime_codeCheck {σ : Signature} {eOp : σ.Op ↪ List Bool} (harity : Turing.MultiTapeTM.ComputableInPolyTime σ.Arity eOp Turing.MultiTapeTM.encNat) {γ : Type} {encIn : γ ↪ List Bool} {n : γ → ℕ} {gates : γ → List (σ.Op × List ℕ)} (hn : Turing.MultiTapeTM.ComputableInPolyTime n encIn Turing.MultiTapeTM.encUnary) (hgates : Turing.MultiTapeTM.ComputableInPolyTime gates encIn (Turing.MultiTapeTM.encList (Circuit.encGate eOp))) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : γ) => codeCheck σ (n a) (gates a)) encIn Turing.MultiTapeTM.encBool
Gate validation is polynomial-time in the full encoded input, for unary input count and binary wire indices, when computing an operation's binary arity is polynomial-time. No bound on the numeric arity is required: comparison uses the actual argument-list length.