All proofs
Project-declaredLean 4.32.0 · mathlib@81a5d257

Fs Abort Sign Loop cache invariant

FiatShamirWithAbort.fsAbortSignLoop_cache_invariant

Plain-language statement

When the simulated signing loop produces some (w, z), the random-oracle cache contains a challenge c at (msg, w) satisfying ids.verify pk w c z = true. This is proved by induction on the loop counter: each abort iteration preserves the invariant (the cache only grows), and a successful iteration writes exactly the challenge used in verification.

Exact Lean statement

lemma fsAbortSignLoop_cache_invariant
    (ro : QueryImpl (M × Commit →ₒ Chal)
      (StateT ((M × Commit →ₒ Chal).QueryCache) ProbComp))
    (hro : ro = randomOracle)
    (hc : ids.Complete) {pk : Stmt} {sk : Wit} (hrel : rel pk sk = true)
    (msg : M) (n : ℕ) (s₀ : (M × Commit →ₒ Chal).QueryCache)
    (w : Commit) (z : Resp) (s : (M × Commit →ₒ Chal).QueryCache)
    (hsup : (some (w, z), s) ∈ support
      ((simulateQ (unifFwdImpl (M × Commit →ₒ Chal) + ro)
        (fsAbortSignLoop ids M pk sk msg n)).run s₀)) :
    ∃ c : Chal, s (msg, w) = some c ∧ ids.verify pk w c z = true

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
lemma fsAbortSignLoop_cache_invariant    (ro : QueryImpl (M × Commit Chal)      (StateT ((M × Commit Chal).QueryCache) ProbComp))    (hro : ro = randomOracle)    (hc : ids.Complete) {pk : Stmt} {sk : Wit} (hrel : rel pk sk = true)    (msg : M) (n : ) (s₀ : (M × Commit Chal).QueryCache)    (w : Commit) (z : Resp) (s : (M × Commit Chal).QueryCache)    (hsup : (some (w, z), s)  support      ((simulateQ (unifFwdImpl (M × Commit Chal) + ro)        (fsAbortSignLoop ids M pk sk msg n)).run s₀)) :     c : Chal, s (msg, w) = some c  ids.verify pk w c z = true := by  subst hro  set impl := unifFwdImpl (M × Commit Chal) +    (randomOracle : QueryImpl (M × Commit Chal) _)  have hSimQuery :  (q : M × Commit),      simulateQ impl (HasQuery.query q) =        (randomOracle : QueryImpl (M × Commit Chal) _) q :=    roSim.simulateQ_HasQuery_query _  induction n generalizing s₀ with  | zero =>    simp [fsAbortSignLoop, simulateQ_pure, StateT.run_pure, support_pure] at hsup  | succ n ih =>    simp only [fsAbortSignLoop, simulateQ_bind] at hsup    rw [StateT.run_bind] at hsup    obtain ⟨⟨⟨w_a, oz, s₁, h_attempt, h_rest :=      (mem_support_bind_iff _ _ _).mp hsup    cases oz with    | none => exact ih s₁ (by simpa using h_rest)    | some z_a =>      obtain ⟨⟨rfl, rfl, rfl : (some (w, z), s) = (some (w_a, z_a), s₁) := by simpa using h_rest      simp only [fsAbortSignAttempt, simulateQ_bind, hSimQuery, simulateQ_pure,        StateT.run_bind, mem_support_bind_iff, StateT.run_pure, support_pure,        Set.mem_singleton_iff, Prod.mk.injEq] at h_attempt      obtain ⟨⟨⟨w_cm, st, s_cm, h_commit, c_q, s_ro, h_query,        oz_r, s_resp, h_respond, rfl, rfl, rfl := h_attempt      change _  support ((simulateQ impl (liftM (ids.commit pk sk))).run s₀) at h_commit      rw [roSim.run_liftM, support_map] at h_commit      obtain ⟨⟨w_c, st_c, h_cm_mem, h_cm_eq := h_commit      simp only [Prod.mk.injEq] at h_cm_eq      obtain ⟨⟨rfl, rfl, rfl := h_cm_eq      change _  support ((simulateQ impl        (liftM (ids.respond pk sk st_c c_q))).run s_ro) at h_respond      rw [roSim.run_liftM, support_map] at h_respond      obtain _, h_rsp_mem, rfl, rfl := h_respond      refine c_q, ?_, ?_      · simp only [randomOracle, QueryImpl.withCaching_apply,          StateT.run_bind, StateT.run_get, pure_bind] at h_query        cases hs : s₀ (msg, w_c) with        | some c_cached =>          simp only [hs, StateT.run_pure, support_pure,            Set.mem_singleton_iff, Prod.mk.injEq] at h_query          rw [h_query.2, hs, h_query.1]        | none =>          simp only [hs, StateT.run_bind, mem_support_bind_iff, StateT.run_modifyGet,            support_pure, Set.mem_singleton_iff, Prod.mk.injEq] at h_query          obtain x, -, rfl, rfl := h_query          exact QueryCache.cacheQuery_self _ (msg, w_c) x.1      · apply ids.verify_of_complete hc hrel        rw [IdenSchemeWithAbort.honestExecution, support_bind]        refine Set.mem_iUnion₂.mpr (w_c, st_c), h_cm_mem, ?_        rw [support_bind]        refine Set.mem_iUnion₂.mpr c_q, mem_support_uniformSample _, ?_        simp only [support_bind, Set.mem_iUnion₂,          support_pure, Set.mem_singleton_iff]        exact some z, h_rsp_mem, by simp [Option.map]
Project
VCVio
License
Apache-2.0
Commit
2ceb2d825ee3
Source
VCVio/CryptoFoundations/FiatShamir/WithAbort.lean:136-200

Reuse this declaration

Bring the exact result into your workflow

The import identifies the source module. Your project still needs the pinned package dependency shown on this page.

What this badge means

This completion status comes from the project or community source. It has not yet been represented here as an independent rebuild and axiom audit.

Continue in this project

Related declarations

Project-declaredLean 4.32.0

Expected Cost Nat eq sum tail probs of pathwise Cost At Most

AddWriterT.expectedCostNat_eq_sum_tail_probs_of_pathwiseCostAtMost

Plain-language statement

Finite tail-sum formula for natural-valued writer cost under a pathwise upper bound. If every execution path of oa incurs cost at most n, then the tail probabilities vanish above n, so the infinite tail sum truncates to Finset.range n.

program verificationseparation logiccryptography

Source project: VCVio

Person-level attribution pending.

View proof record
Project-declaredLean 4.32.0

IND CPA advantage to Real le sum step signed Advantage Real abs

AsymmEncAlg.IND_CPA_advantage_toReal_le_sum_step_signedAdvantageReal_abs

Plain-language statement

Planned generic one-time-to-many-time lift: bounded multi-query IND-CPA advantage is at most the sum of the extracted one-time signed advantages over the first q fresh LR queries.

program verificationseparation logiccryptography

Source project: VCVio

Person-level attribution pending.

View proof record