Uniform instantiation of fixed De Morgan formula templates #
Specializes Cslib.Circuits.Circuit.formulaCode and the typed formula (·.toCircuit.code) rules
from CslibFrontier.Computability.Circuit.Encoding.Combinators to De Morgan formulas.
Main definitions #
Cslib.Circuits.Boolean.formulaCode: the actual code of a fixed De Morgan formula at selected wires.
Main results #
Cslib.Circuits.Boolean.formulaCode_eq_code: exact agreement with typed instantiation.Cslib.Circuits.Boolean.computableInPolyTime_formulaCode: instantiate a fixed formula at efficiently computed input wires.Cslib.Circuits.Boolean.computableInPolyTime_code_input_toCircuit,computableInPolyTime_code_const_toCircuit,computableInPolyTime_code_not_toCircuit,computableInPolyTime_code_and_toCircuit,computableInPolyTime_code_or_toCircuit,computableInPolyTime_code_ite_toCircuit: typed polynomial-time code rules for De Morgan formulas.
theorem Cslib.Circuits.Boolean.computableInPolyTime_formulaCode {α : Type} {enc : α ↪ List Bool} {n : α → ℕ} {m : ℕ} (F : Formula signature m) {wires : α → Fin m → ℕ} (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encNat) (hwires :
∀ (i : Fin m), Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => wires a i) enc Turing.MultiTapeTM.encNat) :
A fixed formula's instantiated code is polynomial-time in the target input count and selected binary wire numbers.
theorem Cslib.Circuits.Boolean.computableInPolyTime_code_input_toCircuit {α : Type} {enc : α ↪ List Bool} {n : α → ℕ} {w : (a : α) → Fin (n a)} (hw : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => ↑(w a)) enc Turing.MultiTapeTM.encNat) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (Formula.input (w a)).toCircuit.code) enc encCode
Emit the circuit code of a De Morgan input leaf (Formula.input (w a)).toCircuit.
theorem Cslib.Circuits.Boolean.computableInPolyTime_code_const_toCircuit {α : Type} {enc : α ↪ List Bool} {n : α → ℕ} (b : Bool) (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encNat) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (Formula.const b).toCircuit.code) enc encCode
Emit the circuit code of a De Morgan constant leaf (Formula.const b).toCircuit.
theorem Cslib.Circuits.Boolean.computableInPolyTime_code_not_toCircuit {α : Type} {enc : α ↪ List Bool} {n : α → ℕ} {F : (a : α) → Formula signature (n a)} (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encNat) (hF : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (F a).toCircuit.code) enc encCode) :
Emit the circuit code of a negated De Morgan formula (F a).not.toCircuit.
theorem Cslib.Circuits.Boolean.computableInPolyTime_code_and_toCircuit {α : Type} {enc : α ↪ List Bool} {n : α → ℕ} {F G : (a : α) → Formula signature (n a)} (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encNat) (hF : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (F a).toCircuit.code) enc encCode) (hG : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (G a).toCircuit.code) enc encCode) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => ((F a).and (G a)).toCircuit.code) enc encCode
Emit the circuit code of a conjunction ((F a).and (G a)).toCircuit.
theorem Cslib.Circuits.Boolean.computableInPolyTime_code_or_toCircuit {α : Type} {enc : α ↪ List Bool} {n : α → ℕ} {F G : (a : α) → Formula signature (n a)} (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encNat) (hF : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (F a).toCircuit.code) enc encCode) (hG : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (G a).toCircuit.code) enc encCode) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => ((F a).or (G a)).toCircuit.code) enc encCode
Emit the circuit code of a disjunction ((F a).or (G a)).toCircuit.
theorem Cslib.Circuits.Boolean.computableInPolyTime_code_ite_toCircuit {α : Type} {enc : α ↪ List Bool} {n : α → ℕ} {p : α → Prop} [(a : α) → Decidable (p a)] {t e : (a : α) → Formula signature (n a)} (hp : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => decide (p a)) enc Turing.MultiTapeTM.encBool) (ht : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (t a).toCircuit.code) enc encCode) (he : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (e a).toCircuit.code) enc encCode) :
Emit the circuit code of a conditional choice of De Morgan formulas.