Documentation

CslibFrontier.Crypto.Computational.Kilian.MicaliRaw

Bounded-prefix raw Micali verification, native ROM verifier runtime, and raw ROM soundness #

CslibFrontier.Crypto.Computational.Kilian.MicaliSoundness verifies structured MicaliProof values under MicaliSpec α without charging message decoding, truncating oversized proof strings, or certifying native oracle-machine verification runtime (locator not re-verified against primary PDF for [Mic00] and [CY24]).

This module completes that verification-complexity and raw-proof layer cleanly on top of CslibFrontier.Crypto.Computational.Kilian.RawVerifier and CslibFrontier.Computability.Machines.Turing.MultiTape.Combinators.BoundedPrefix:

Locators in [Mic00] and [CY24] are carried from Kilian.MicaliSoundness (locator not re-verified against primary PDF).

Main definitions #

Main results #

References #

Public verifier header (σ, reps, stmt) for bounded-prefix raw Micali verification: digest width σ, repetition count reps, and statement stmt.

  • sigma : ℕ

    Merkle digest bit length σ.

  • reps : ℕ

    Number reps of Fiat–Shamir PCP repetitions.

  • stmt : α

    Public statement stmt.

Instances For
    theorem Cslib.Crypto.MicaliRawInput.ext {α : Type} {x y : MicaliRawInput α} (sigma : x.sigma = y.sigma) (reps : x.reps = y.reps) (stmt : x.stmt = y.stmt) :
    x = y
    def Cslib.Crypto.instDecidableEqMicaliRawInput.decEq {α✝ : Type} [DecidableEq α✝] (x✝ x✝¹ : MicaliRawInput α✝) :
    Decidable (x✝ = x✝¹)
    @[instance_reducible]
    @[instance_reducible]
    @[instance_reducible]
    theorem Cslib.Crypto.encMicaliRawInput_reps_polyTime {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → MicaliRawInput α} :
    theorem Cslib.Crypto.encMicaliRawInput_sigma_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → MicaliRawInput α} :
    theorem Cslib.Crypto.encMicaliRawInput_mk_deg {α : Type} (enc : α ↪ List Bool) :
    Turing.MultiTapeTM.ComputableInDegree (fun (p : ℕ × ℕ × α) => { sigma := p.1, reps := p.2.1, stmt := p.2.2 }) (encMicaliRawInputFields enc) (encMicaliRawInput enc) 1 1
    theorem Cslib.Crypto.encMicaliRawInput_mk_inO {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 x1 T1 S1 : γ → ℕ} {x2 : γ → α} {T2 S2 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encUnary T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn enc T2 S2) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { sigma := x0 x, reps := x1 x, stmt := x2 x }) encIn (encMicaliRawInput enc) (fun (x : γ) => T0 x + (T1 x + T2 x)) fun (x : γ) => S0 x + (S1 x + S2 x)
    theorem Cslib.Crypto.encMicaliRawInput_mk_polyTime {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 x1 : γ → ℕ} {x2 : γ → α} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn Turing.MultiTapeTM.encUnary) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn Turing.MultiTapeTM.encUnary) (h2 : Turing.MultiTapeTM.ComputableInPolyTime x2 encIn enc) :
    Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { sigma := x0 x, reps := x1 x, stmt := x2 x }) encIn (encMicaliRawInput enc)
    theorem Cslib.Crypto.encMicaliRawInput_sigma_polyTime {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → MicaliRawInput α} :
    @[reducible, inline]

    The tuple of the fields of encMicaliRawInput.

    Framed encoding of MicaliRawInput α using unary (sigma, reps) and enc for stmt.

    theorem Cslib.Crypto.encMicaliRawInput_reps_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → MicaliRawInput α} :
    theorem Cslib.Crypto.encMicaliRawInput_stmt_polyTime {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → MicaliRawInput α} :
    Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encMicaliRawInput enc) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).stmt) encIn✝ enc
    theorem Cslib.Crypto.encMicaliRawInput_mk_budget {α : Type} (enc : α ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget x0 x1 : γ → ℕ} {x2 : γ → α} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encUnary budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn enc budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { sigma := x0 x, reps := x1 x, stmt := x2 x }) encIn (encMicaliRawInput enc) budget
    theorem Cslib.Crypto.encMicaliRawInput_stmt_budget {α : Type} (enc : α ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → MicaliRawInput α} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encMicaliRawInput enc) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).stmt) encIn✝ enc S✝
    @[reducible, inline]

    Public verifier header and proof encoding for pure bounded-prefix raw Micali verification at a fixed Merkle digest width σ.

    theorem Cslib.Crypto.encMicaliProof_response_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → MicaliProof} :

    Framed encoding of MicaliProof: the framed Merkle root, then the Kilian opening response.

    theorem Cslib.Crypto.encMicaliProof_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → List Bool} {x1 : γ → KilianResponse} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBits budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn encKilianResponse budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { root := x0 x, response := x1 x }) encIn encMicaliProof budget
    @[reducible, inline]

    The tuple of the fields of encMicaliProof.

    theorem Cslib.Crypto.encMicaliProof_root_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → MicaliProof} :
    theorem Cslib.Crypto.encMicaliProof_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {T0 S0 : γ → ℕ} {x1 : γ → KilianResponse} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBits T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn encKilianResponse T1 S1) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { root := x0 x, response := x1 x }) encIn encMicaliProof (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x

    Total polynomial-time decoder for MicaliProof, reusing kilianProverMsgDecoder.

    Predicate checking that rawProof begins with a complete framed bit string of at most σ bits within its first 2 * σ + 1 bits.

    theorem Cslib.Crypto.unframe_take_of_micaliHasRootPrefix {σ : ℕ} {rawProof : List Bool} (h : micaliHasRootPrefix σ rawProof = true) :
    have root := Turing.MultiTapeTM.unframe (List.take (2 * σ + 1) rawProof); root.length ≤ σ ∧ Turing.MultiTapeTM.frame root <+: rawProof ∧ Turing.MultiTapeTM.unframe rawProof = root
    def Cslib.Crypto.micaliFSReplyCap {α : Type} (enc : α ↪ List Bool) (c m : ℕ) (x : α) :

    Polynomial upper bound on (encList encBits ρs).length when ρs has length m and each challenge has at most c * (Nat.log 2 (enc x).length + 1) bits.

    theorem Cslib.Crypto.length_encList_le_micaliFSReplyCap {α : Type} (enc : α ↪ List Bool) {c m : ℕ} {V : Complexity.PCPVerifier α} (hcoins : ∀ (a : α), V.coins a ≤ c * (Nat.log 2 (enc a).length + 1)) {x : α} {ρs : List (List Bool)} (hm : ρs.length = m) (hρs : ∀ ρ ∈ ρs, ρ.length = V.coins x) :
    def Cslib.Crypto.micaliMaxProofCap {α : Type} (V : Complexity.PCPVerifier α) (σ m d : ℕ) (x : α) :

    Deterministic upper bound on kilianRawProverCap V (List.replicate σ false) x ρs uniform over all challenge lists ρs of length m for a d-query PCP verifier V.

    theorem Cslib.Crypto.kilianRawProverCap_le_micaliMaxProofCap {α : Type} (V : Complexity.PCPVerifier α) {σ m d : ℕ} {x : α} {ρs : List (List Bool)} (hm : ρs.length = m) (hq : ∀ ρ ∈ ρs, (V.queries (x, ρ)).length ≤ d) :
    def Cslib.Crypto.kilianStructValid {α : Type} (V : Complexity.PCPVerifier α) (x : α) (root : List Bool) (ρs : List (List Bool)) (resp : KilianResponse) :

    Structural validity check on resp ensuring path lengths and digest lengths match V and root before issuing any Merkle oracle queries.

    theorem Cslib.Crypto.kilianStructValid_of_kilianVerify {α : Type} {H : List Bool → List Bool → List Bool} {V : Complexity.PCPVerifier α} {k : List Bool} {x : α} {root : List Bool} {ρs : List (List Bool)} {resp : KilianResponse} (h : kilianVerify H V k x root ρs resp = true) :
    kilianStructValid V x root ρs resp = true
    def Cslib.Crypto.micaliVerifyRawBoundedPure {α : Type} (hTree : List Bool → List Bool) (hFS : α × List Bool → List (List Bool)) (V : Complexity.PCPVerifier α) (σ m : ℕ) (x : α) (rawProof : List Bool) :

    Pure bounded-prefix Micali verifier: decodes root from the leading 2 * σ + 1 bits of rawProof, queries hFS (x, root), validates challenge and proof caps, and runs kilianVerifyRawBounded.

    theorem Cslib.Crypto.micaliVerifyRawBoundedPure_eq_false_of_maxCap_lt {α : Type} (hTree : List Bool → List Bool) (hFS : α × List Bool → List (List Bool)) (V : Complexity.PCPVerifier α) {σ m d : ℕ} (hq : ∀ (x : α) (ρ : List Bool), ρ.length = V.coins x → (V.queries (x, ρ)).length ≤ d) {x : α} {rawProof : List Bool} (hlt : micaliMaxProofCap V σ m d x < rawProof.length) :
    micaliVerifyRawBoundedPure hTree hFS V σ m x rawProof = false
    theorem Cslib.Crypto.micaliVerifyRawBoundedPure_take_eq {α : Type} (hTree : List Bool → List Bool) (hFS : α × List Bool → List (List Bool)) (V : Complexity.PCPVerifier α) {σ m d : ℕ} (hq : ∀ (x : α) (ρ : List Bool), ρ.length = V.coins x → (V.queries (x, ρ)).length ≤ d) (x : α) (rawProof : List Bool) :
    micaliVerifyRawBoundedPure hTree hFS V σ m x rawProof = micaliVerifyRawBoundedPure hTree hFS V σ m x (List.take (micaliMaxProofCap V σ m d x + 1) rawProof)

    Prefix truncation invariance for micaliVerifyRawBoundedPure: verification depends only on the first micaliMaxProofCap V σ m d x + 1 bits of rawProof.

    theorem Cslib.Crypto.micaliVerifyRawBoundedPure_enc_eq_of_root_le {α : Type} (hTree : List Bool → List Bool) (hFS : α × List Bool → List (List Bool)) (V : Complexity.PCPVerifier α) {σ m : ℕ} {x : α} (prf : MicaliProof) (hroot : prf.root.length ≤ σ) (hm : (hFS (x, prf.root)).length = m) (hρs : ∀ ρ ∈ hFS (x, prf.root), ρ.length = V.coins x) :
    micaliVerifyRawBoundedPure hTree hFS V σ m x (encMicaliProof prf) = micaliVerifyPure hTree hFS V x prf

    On any encoded prf : MicaliProof with prf.root.length ≤ σ, whenever hFS (x, prf.root) returns m valid V.coins x-bit challenges, micaliVerifyRawBoundedPure agrees unconditionally with micaliVerifyPure.

    theorem Cslib.Crypto.micaliVerifyRawBoundedPure_micaliProvePure_eq_true {α : Type} {hTree : List Bool → List Bool} {hFS : α × List Bool → List (List Bool)} {V : Complexity.PCPVerifier α} {σ m : ℕ} (hlen : ∀ (y : List Bool), (hTree y).length = σ) {x : α} {table : List Bool} (htable : V.tableVerifier (x, table) = true) (hm : (hFS (x, kilianCommit (fun (x : List Bool) => hTree) V [] x table)).length = m) (hρs : ∀ ρ ∈ hFS (x, kilianCommit (fun (x : List Bool) => hTree) V [] x table), ρ.length = V.coins x) :
    micaliVerifyRawBoundedPure hTree hFS V σ m x (encMicaliProof (micaliProvePure hTree hFS V x table)) = true

    Honest completeness for micaliVerifyRawBoundedPure.

    theorem Cslib.Crypto.computableInTimeAndSpace_micaliVerifyRawBoundedPure_of_params {α : Type} {enc : α ↪ List Bool} {hTree : List Bool → List Bool} {hFS : α × List Bool → List (List Bool)} {V : Complexity.PCPVerifier α} {σ c d : ℕ} (hlen : ∀ (y : List Bool), (hTree y).length = σ) (hTreePoly : Turing.MultiTapeTM.ComputableInPolyTime hTree Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) (hFSPoly : Turing.MultiTapeTM.ComputableInPolyTime hFS (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits)) (hV : Complexity.PCPVerifier.PolyTime enc V) (hcoins : ∀ (a : α), V.coins a ≤ c * (Nat.log 2 (enc a).length + 1)) (hq : ∀ (x : α) (ρ : List Bool), ρ.length = V.coins x → (V.queries (x, ρ)).length ≤ d) :
    ∃ (k : ℕ) (State : Type) (_ : Finite State) (tm : Turing.MultiTapeTM k Bool State) (t : ℕ → ℕ) (s : ℕ → ℕ) (tBound : ℕ → ℕ) (sBound : ℕ → ℕ), PolynomiallyBounded t ∧ PolynomiallyBounded s ∧ PolynomiallyBounded tBound ∧ PolynomiallyBounded sBound ∧ (tm.ComputesFunInTimeAndSpace (encMicaliPureVerifierInput enc) Turing.MultiTapeTM.encBool (fun (p : (ℕ × α) × List Bool) => match p with | (pars, rawProof) => match pars with | (m, x) => micaliVerifyRawBoundedPure hTree hFS V σ m x rawProof) (fun (p : (ℕ × α) × List Bool) => t ((Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary enc) p.1).length) fun (p : (ℕ × α) × List Bool) => s ((Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary enc) p.1).length) ∧ ∀ (m : ℕ) (x : α) (rawProof : List Bool), tm.ComputesInTimeAndSpace ((encMicaliPureVerifierInput enc) ((m, x), rawProof)) (Turing.MultiTapeTM.encBool (micaliVerifyRawBoundedPure hTree hFS V σ m x rawProof)) (tBound (m + (enc x).length)) (sBound (m + (enc x).length))

    Worst-case pure Micali verifier runtime and space on ALL unbounded raw proofs: for any polynomial-time fixed-digest hash hTree (σ-bit outputs), Fiat–Shamir oracle hFS, and PCP verifier V, there is one fixed binary MultiTapeTM computing micaliVerifyRawBoundedPure whose runtime and space are bounded polynomially in m + |enc x| uniformly over every rawProof (including exponentially oversized or arbitrarily malformed proof strings).

    def Cslib.Crypto.micaliVerifyRawBounded {α : Type} (V : Complexity.PCPVerifier α) (σ m : ℕ) (x : α) (rawProof : List Bool) :

    Native two-channel Micali bounded-prefix verifier program over MicaliSpec α. Checks micaliHasRootPrefix before issuing the single Fiat–Shamir query (x, root), validates the received challenge lengths, raw proof cap, and opening lengths before issuing any Merkle queries, and delegates to kilianVerifyProg.

    theorem Cslib.Crypto.evalPure_micaliVerifyRawBounded {α : Type} (hTree : List Bool → List Bool) (hFS : α × List Bool → List (List Bool)) (V : Complexity.PCPVerifier α) (σ m : ℕ) (x : α) (rawProof : List Bool) :
    OracleComp.evalPure (micaliOracle hTree hFS) (micaliVerifyRawBounded V σ m x rawProof) = micaliVerifyRawBoundedPure hTree hFS V σ m x rawProof

    micaliVerifyRawBounded issues at most 1 Fiat–Shamir oracle query on every rawProof.

    theorem Cslib.Crypto.isCostBounded_micaliMTCost_micaliVerifyRawBounded {α : Type} {V : Complexity.PCPVerifier α} {σ m d : ℕ} (hq : ∀ (x : α) (ρ : List Bool), ρ.length = V.coins x → (V.queries (x, ρ)).length ≤ d) (x : α) (rawProof : List Bool) :

    micaliVerifyRawBounded issues at most m * d * (kilianDepth V x + 1) Merkle hash queries on every raw input rawProof (even arbitrarily oversized or malformed inputs).

    Finite operation tag for the native two-channel word-oracle Micali verifier.

    Instances For

      Word-oracle step matching merkleInputsStepProg: maintains (remainingPath, curIn, pos) so every intermediate state fits within polynomial space and IsOraclePPTOn.iterateWith_spec applies.

      Word-oracle Merkle verification matching merkleVerifyProg with digest length cap σ.

      Word-oracle Kilian single-repetition verification.

      Word-oracle Kilian multi-repetition verification.

      Core native word-oracle Micali verifier taking explicit ((σ, m, x), rawProof) and capping both the .fs challenge reply at micaliFSReplyCap enc c m x + 1 and every .merkle digest reply at σ. Rejecting whenever fsWord.length > micaliFSReplyCap enc c m x guarantees no malformed Fiat–Shamir reply is silently corrupted by prefix truncation.

      Bounded-prefix wrapper around micaliVerifyRawWordCore that truncates rawProof to micaliMaxProofCap V inp.sigma inp.reps d inp.stmt + 1 bits first, achieving worst-case halting oracle runtime polynomial in σ + m + |enc x| uniformly over all arbitrary unbounded rawProof.

      Classical OracleCodec embedding MicaliSpec α into MicaliWordOp × List Bool using encPair enc encBits for Fiat–Shamir queries (x, root).

      theorem Cslib.Crypto.runWith_wordOracle_micaliVerifyRawWordCore {α State : Type} (oracle : (q : List Bool ⊕ α × List Bool) → StateT State PMF (MicaliSpec α q)) {V : Complexity.PCPVerifier α} {enc : α ↪ List Bool} {c σ m : ℕ} (hcoins : ∀ (a : α), V.coins a ≤ c * (Nat.log 2 (enc a).length + 1)) (hMT : ∀ (w : List Bool) (s : State) (d : MicaliSpec α (Sum.inl w)) (s' : State), (d, s') ∈ (oracle (Sum.inl w) s).support → List.length d ≤ σ) (x : α) (rawProof : List Bool) (s : State) :
      ProbOracleComp.runWith ((micaliWordCodec enc).wordOracle oracle) (micaliVerifyRawWordCore V enc c ({ sigma := σ, reps := m, stmt := x }, rawProof)) s = OracleComp.runWith oracle (micaliVerifyRawBounded V σ m x rawProof) s

      Stateful ROM bisimulation for the native word-oracle Micali verifier: under the word oracle ((micaliWordCodec enc).wordOracle oracle) of ANY stateful (MicaliSpec α) handler whose .inl Merkle digests have length at most σ (with NO condition on its .inr Fiat–Shamir handler), both micaliVerifyRawWordCore and micaliVerifyRawWord produce the exact same joint output and final oracle state distribution as micaliVerifyRawBounded.

      theorem Cslib.Crypto.runWith_wordOracle_micaliVerifyRawWord {α State : Type} (oracle : (q : List Bool ⊕ α × List Bool) → StateT State PMF (MicaliSpec α q)) {V : Complexity.PCPVerifier α} {enc : α ↪ List Bool} {c d σ m : ℕ} (hcoins : ∀ (a : α), V.coins a ≤ c * (Nat.log 2 (enc a).length + 1)) (hq : ∀ (x : α) (ρ : List Bool), ρ.length = V.coins x → (V.queries (x, ρ)).length ≤ d) (hMT : ∀ (w : List Bool) (s : State) (d' : MicaliSpec α (Sum.inl w)) (s' : State), (d', s') ∈ (oracle (Sum.inl w) s).support → List.length d' ≤ σ) (x : α) (rawProof : List Bool) (s : State) :
      ProbOracleComp.runWith ((micaliWordCodec enc).wordOracle oracle) (micaliVerifyRawWord V enc c d ({ sigma := σ, reps := m, stmt := x }, rawProof)) s = OracleComp.runWith oracle (micaliVerifyRawBounded V σ m x rawProof) s
      theorem Cslib.Crypto.isQueryBounded_micaliVerifyRawWordCore {α : Type} {V : Complexity.PCPVerifier α} {enc : α ↪ List Bool} {c d : ℕ} (hq : ∀ (x : α) (ρ : List Bool), ρ.length = V.coins x → (V.queries (x, ρ)).length ≤ d) (inp : MicaliRawInput α) (rawProof : List Bool) :

      micaliVerifyRawWord and micaliVerifyRawWordCore issue at most 1 + m * d * (kilianDepth V x + 1) word-oracle queries on every raw input rawProof.

      theorem Cslib.Crypto.isQueryBounded_micaliVerifyRawWord {α : Type} {V : Complexity.PCPVerifier α} {enc : α ↪ List Bool} {c d : ℕ} (hq : ∀ (x : α) (ρ : List Bool), ρ.length = V.coins x → (V.queries (x, ρ)).length ≤ d) (inp : MicaliRawInput α) (rawProof : List Bool) :
      ProbOracleComp.IsQueryBounded (micaliVerifyRawWord V enc c d (inp, rawProof)) (1 + inp.reps * d * (kilianDepth V inp.stmt + 1))
      theorem Cslib.Crypto.computesOracleInTimeAndQueriesOn_micaliVerifyRawWord {α : Type} {enc : α ↪ List Bool} {V : Complexity.PCPVerifier α} (hV : Complexity.PCPVerifier.PolyTime enc V) {c d : ℕ} (hcoins : ∀ (a : α), V.coins a ≤ c * (Nat.log 2 (enc a).length + 1)) (hq : ∀ (x : α) (ρ : List Bool), ρ.length = V.coins x → (V.queries (x, ρ)).length ≤ d) :

      Uniform worst-case native ROM verifier halting time and query complexity: there is one fixed halting oracle machine MultiTapePTM computing micaliVerifyRawWord (hence matching micaliVerifyRawBounded under (micaliWordCodec enc).wordOracle on every stateful handler) whose halting step count is bounded polynomially in inp.sigma + inp.reps + |enc inp.stmt| uniformly over all (inp, rawProof) and all stateful word handlers (independent of rawProof.length), and whose query count is at most 1 + inp.reps * d * (kilianDepth V inp.stmt + 1).

      noncomputable def Cslib.Crypto.micaliHonestRawGame {α : Type} [DecidableEq α] (V : Complexity.PCPVerifier α) (x : α) (table : List Bool) (σ m : ℕ) :

      Honest Micali ROM experiment evaluating the raw bounded-prefix verifier micaliVerifyRawBounded on the framed encoding encMicaliProof proof produced by micaliProve.

      theorem Cslib.Crypto.micaliHonestRawGame_eq_pure_true {α : Type} [DecidableEq α] (V : Complexity.PCPVerifier α) {x : α} {table : List Bool} (htable : V.tableVerifier (x, table) = true) (σ m : ℕ) :

      Perfect raw completeness of Micali's construction in the random oracle model: if V.tableVerifier (x, table) = true, then for every digest width σ and repetition count m, the honest raw bounded verifier micaliVerifyRawBounded accepts encMicaliProof proof with probability 1.

      noncomputable def Cslib.Crypto.micaliRawSoundnessProg {α : Type} (V : Complexity.PCPVerifier α) (L : Set α) (σ m : ℕ) (P : OracleComp (MicaliSpec α) (α × List Bool)) :

      Native raw-byte Micali soundness program: runs a raw cheating prover P : OracleComp (MicaliSpec α) (α × List Bool) returning (x, rawProof), checks micaliVerifyRawBounded V σ m x rawProof, and returns true when x ∉ L and the verifier accepts.

      noncomputable def Cslib.Crypto.micaliRawSoundnessGame {α : Type} [DecidableEq α] (V : Complexity.PCPVerifier α) (L : Set α) (P : OracleComp (MicaliSpec α) (α × List Bool)) (σ m : ℕ) :

      Native raw-byte Micali ROM soundness experiment against the shared lazy random oracle RandomOracle.answer (micaliOracleDist V σ m) starting from an empty cache.

      theorem Cslib.Crypto.micaliRawSoundness_bound {α : Type} [DecidableEq α] (V : Complexity.PCPVerifier α) (L : Set α) (σ m d : ℕ) (hsound : ∀ x ∉ L, ∀ (π : List Bool), 2 * Complexity.acceptCount (fun (y : α × List Bool) => V.accepts y.1 π y.2) x (V.coins x) ≤ 2 ^ V.coins x) (hq : ∀ (x : α) (ρ : List Bool), ρ.length = V.coins x → (V.queries (x, ρ)).length ≤ d) {P : OracleComp (MicaliSpec α) (α × List Bool)} {t_MT t_FS q_V : ℕ} (hMT : OracleComp.IsCostBounded micaliMTCost P t_MT) (hFS : OracleComp.IsCostBounded micaliFSCost P t_FS) (hdepth : ∀ (x : α) (rawProof : List Bool), (x, rawProof) ∈ P.support → m * d * (kilianDepth V x + 1) ≤ q_V) :
      (micaliRawSoundnessGame V L P σ m) true ≤ ↑(t_FS + 1) * (1 / 2) ^ m + ↑(t_MT + q_V) * (↑(3 * (t_MT + q_V) + (t_FS + 1)) * (1 / 2 ^ σ))

      Adaptive two-channel ROM soundness for bounded-prefix raw Micali proofs: for any PCP verifier V with per-repetition soundness error ≤ 1 / 2 outside L and query complexity ≤ d, and any raw-byte cheating prover P : OracleComp (MicaliSpec α) (α × List Bool) making at most t_MT Merkle hash queries and t_FS Fiat–Shamir queries such that every candidate output statement satisfies m * d * (kilianDepth V x + 1) ≤ q_V, micaliRawSoundnessGame accepts a false statement with probability at most (t_FS + 1) * (1 / 2) ^ m + (t_MT + q_V) * ((3 * (t_MT + q_V) + (t_FS + 1)) * (1 / 2 ^ σ)).

      theorem Cslib.Crypto.exists_micaliRawCSProof_of_npRelation {α : Type} [DecidableEq α] {enc : α ↪ List Bool} (R : Complexity.NPRelation enc) :
      ∃ (V : Complexity.PCPVerifier α) (compile : α × List Bool → List Bool) (c : ℕ) (d : ℕ) (tWordBound : ℕ → ℕ), Complexity.PCPVerifier.PolyTime enc V ∧ (∀ (x : α), V.coins x ≤ c * (Nat.log 2 (enc x).length + 1)) ∧ (∀ (x : α) (ρ : List Bool), ρ.length = V.coins x → (V.queries (x, ρ)).length ≤ d) ∧ Turing.MultiTapeTM.ComputableInPolyTime compile (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits ∧ (∀ (x : α), x ∈ R.language ↔ ∃ (table : List Bool), V.tableVerifier (x, table) = true) ∧ (∀ (x : α) (w : List Bool), R.IsWitness x w → V.tableVerifier (x, compile (x, w)) = true) ∧ (∀ (x : α) (w : List Bool), R.IsWitness x w → ∀ (σ m : ℕ), micaliHonestRawGame V x (compile (x, w)) σ m = PMF.pure true) ∧ PolynomiallyBounded tWordBound ∧ Probability.ComputesOracleInTimeAndQueriesOn (Turing.MultiTapeTM.encPair (encMicaliRawInput enc) Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool (fun (p : MicaliRawInput α × List Bool) => tWordBound (p.1.sigma + p.1.reps + (enc p.1.stmt).length)) (fun (p : MicaliRawInput α × List Bool) => 1 + p.1.reps * d * (kilianDepth V p.1.stmt + 1)) (micaliVerifyRawWord V enc c d) ∧ (∀ (P : OracleComp (MicaliSpec α) (α × List Bool)) (t_MT t_FS q_V σ m : ℕ), OracleComp.IsCostBounded micaliMTCost P t_MT → OracleComp.IsCostBounded micaliFSCost P t_FS → (∀ (x : α) (rawProof : List Bool), (x, rawProof) ∈ P.support → m * d * (kilianDepth V x + 1) ≤ q_V) → (micaliRawSoundnessGame V R.language P σ m) true ≤ ↑(t_FS + 1) * (1 / 2) ^ m + ↑(t_MT + q_V) * (↑(3 * (t_MT + q_V) + (t_FS + 1)) * (1 / 2 ^ σ))) ∧ ∃ (C : ℕ), ∀ (σ m : ℕ) (hTree : List Bool → List Bool) (hFS : α × List Bool → List (List Bool)) (x : α) (table : List Bool), (∀ (y : List Bool), (hTree y).length = σ) → (hFS (x, kilianCommit (fun (x : List Bool) => hTree) V [] x table)).length = m → (∀ ρ ∈ hFS (x, kilianCommit (fun (x : List Bool) => hTree) V [] x table), ρ.length = V.coins x) → micaliProofBits (micaliProvePure hTree hFS V x table) ≤ C * (σ + m + 1) ^ 2 * (Nat.log 2 (enc x).length + 1)

      Native raw-byte Micali CS Proofs for arbitrary NP relations (compare [Mic00]; [CY24], Construction 21.1.1 and Theorem 21.2.1; locator not re-verified against primary PDF): every NP relation R : NPRelation enc admits a PCP verifier V (≤ c * (log₂ |enc x| + 1) random coins, ≤ d queries) and a polynomial-time witness compiler compile : α × List Bool → List Bool such that:

      1. compile compiles every R-witness into a compact table accepted by V.tableVerifier, and the raw bounded verifier micaliVerifyRawBounded accepts honest framed proofs with probability 1 (micaliHonestRawGame_eq_pure_true),
      2. there is one fixed halting oracle machine (MultiTapePTM) implementing micaliVerifyRawWord whose worst-case runtime is bounded by a single polynomial tWordBound (σ + m + |enc x|) uniformly over all arbitrary unbounded rawProof : List Bool and all stateful word handlers, using at most 1 + m * d * (kilianDepth V x + 1) queries,
      3. micaliRawSoundnessGame satisfies the micaliRawSoundness_bound inequality against arbitrary adaptive two-channel raw cheating provers, and
      4. honest proof payload bits micaliProofBits (micaliProvePure hTree hFS V x table) fit within C * (σ + m + 1)^2 * (Nat.log 2 |enc x| + 1).

      As immediate corollaries of applying runWith_wordOracle_micaliVerifyRawWord and computableInTimeAndSpace_micaliVerifyRawBoundedPure_of_params to the returned V, coins_le, and queries_le, micaliVerifyRawWord bisimulates micaliVerifyRawBounded on every stateful handler via (micaliWordCodec enc).wordOracle, and any fixed digest-width polynomial-time hTree and hFS yield one fixed halting binary MultiTapeTM for micaliVerifyRawBoundedPure running in time and space polynomial in m + |enc x| for all rawProof : List Bool.