Polynomial-time writers for shared real circuit guards #
Each gate equation is supplied by its canonical term word. The guard writer adds the conjunction and equality tokens and their framing, in circuit order. It copies each supplied equation word once. Both sentence bridges reuse this guard writer and copy the encoded matrix once.
theorem Cslib.Circuits.Program.realGateGuard_word_polyTime {α : Type} {input : α ↪ List Bool} {n g : α → ℕ} (program : (a : α) → Program (arithSignature ℤ) (n a) (g a)) (hgate :
Turing.MultiTapeTM.ComputableInPolyTime
(fun (a : α) =>
List.map (fun (i : Fin (g a)) => (Logic.RealArithmetic.encTerm (n a + g a)) ((program a).realGateEquation i))
(List.finRange (g a)))
input (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits)) :
Turing.MultiTapeTM.ComputableInPolyTime
(fun (a : α) => (Logic.RealArithmetic.encFormula (n a + g a)) (program a).realGateGuard) input
Turing.MultiTapeTM.encBits
Write the gate guard in polynomial time given the framed list of shallow equation words.
theorem Cslib.Circuits.Program.realExistentialMatrix_word_polyTime {α : Type} {input : α ↪ List Bool} {n g : α → ℕ} (program : (a : α) → Program (arithSignature ℤ) (n a) (g a)) (matrix : (a : α) → Logic.RealArithmetic.Formula (n a + g a)) (hguard :
Turing.MultiTapeTM.ComputableInPolyTime
(fun (a : α) => (Logic.RealArithmetic.encFormula (n a + g a)) (program a).realGateGuard) input
Turing.MultiTapeTM.encBits) (hmatrix :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (Logic.RealArithmetic.encFormula (n a + g a)) (matrix a))
input Turing.MultiTapeTM.encBits) :
Turing.MultiTapeTM.ComputableInPolyTime
(fun (a : α) => (Logic.RealArithmetic.encFormula (n a + g a)) ((program a).realGateGuard.and (matrix a))) input
Turing.MultiTapeTM.encBits
Conjoining the gate guard with the output matrix has a polynomial-time writer.
theorem Cslib.Circuits.Program.realUniversalMatrix_word_polyTime {α : Type} {input : α ↪ List Bool} {g r s : α → ℕ} (program : (a : α) → Program (arithSignature ℤ) (r a + s a) (g a)) (matrix : (a : α) → Logic.RealArithmetic.Formula (r a + s a + g a)) (hguard :
Turing.MultiTapeTM.ComputableInPolyTime
(fun (a : α) => (Logic.RealArithmetic.encFormula (r a + s a + g a)) (program a).realGateGuard) input
Turing.MultiTapeTM.encBits) (hmatrix :
Turing.MultiTapeTM.ComputableInPolyTime
(fun (a : α) => (Logic.RealArithmetic.encFormula (r a + s a + g a)) (matrix a)) input Turing.MultiTapeTM.encBits) :
Turing.MultiTapeTM.ComputableInPolyTime
(fun (a : α) => (Logic.RealArithmetic.encFormula (r a + (s a + g a))) ((program a).realUniversalMatrix (matrix a)))
input Turing.MultiTapeTM.encBits
Guarding the universally quantified wires has a polynomial-time matrix writer.