All proofs
Project-declaredLean 4.32.0 · mathlib@81a5d257

Prob Output context Fork View Collision le collision

OracleComp.probOutput_contextForkViewCollision_le_collision

Plain-language statement

Requiring the colliding second completion to finish successfully can only decrease the path-first equal-answer collision probability.

Exact Lean statement

theorem probOutput_contextForkViewCollision_le_collision [IsUniformSpec spec]
    (main : OracleComp spec α) (qb : ι → ℕ) (i : ι)
    (cf : α → Option (Fin (qb i + 1))) (s : Fin (qb i + 1)) :
    Pr[= (some s : Option (Fin (qb i + 1))) |
        contextForkViewCollision main qb i cf s] ≤
      Pr[= (some s : Option (Fin (qb i + 1))) |
        contextForkCollision main qb i cf s]

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem probOutput_contextForkViewCollision_le_collision [IsUniformSpec spec]    (main : OracleComp spec α) (qb : ι  ) (i : ι)    (cf : α  Option (Fin (qb i + 1))) (s : Fin (qb i + 1)) :    Pr[= (some s : Option (Fin (qb i + 1))) |        contextForkViewCollision main qb i cf s]       Pr[= (some s : Option (Fin (qb i + 1))) |        contextForkCollision main qb i cf s] := by  let paths : OracleComp spec (PFunctor.FreeM.Path main) := PFunctor.FreeM.withPath main  let viewCollision : PFunctor.FreeM.Path main       OracleComp spec (Option (Fin (qb i + 1))) := fun path =>    match PFunctor.FreeM.Cursor.locateAt? (P := spec.toPFunctor) i main path s with    | none => pure none    | some located =>        PFunctor.FreeM.bind          (PFunctor.FreeM.lift (P := spec.toPFunctor) i) fun secondAnswer =>            (fun secondSuffix =>              collideForkView main qb i cf s (some {                occurrence := located.occurrence                first := located.completion                second := secondAnswer, secondSuffix })) <$>              PFunctor.FreeM.withPath (located.occurrence.resume secondAnswer)  let answerCollision : PFunctor.FreeM.Path main       OracleComp spec (Option (Fin (qb i + 1))) := fun path =>    match PFunctor.FreeM.Cursor.locateAt? (P := spec.toPFunctor) i main path s with    | none => pure none    | some located => do        let secondAnswer  spec.query i        if located.completion.answer = secondAnswer             cf (PFunctor.FreeM.output main path) = some s then          pure (some s)        else pure none  have hsource : contextForkViewCollision main qb i cf s =      paths >>= viewCollision := by    letI : spec.toPFunctor.DecidableEq :=      (inferInstance : spec.DecidableEq).toDecidableEq    unfold contextForkViewCollision contextForkView    rw [PFunctor.FreeM.Cursor.map_locateAndForkAt]    apply congrArg (fun k => paths >>= k)    funext path    simp only [viewCollision]    rcases PFunctor.FreeM.Cursor.locateAt?        (P := spec.toPFunctor) i main path s with _ | located    · rfl    · simp [PFunctor.FreeM.Cursor.Located.fork]  have hinner :  path : PFunctor.FreeM.Path main,      Pr[= (some s : Option (Fin (qb i + 1))) | viewCollision path]         Pr[= (some s : Option (Fin (qb i + 1))) | answerCollision path] := by    intro path    simp only [viewCollision, answerCollision]    rcases hlocated : PFunctor.FreeM.Cursor.locateAt?        (P := spec.toPFunctor) i main path s with _ | located    · simp    · let continuation : spec.Range i           OracleComp spec (Option (Fin (qb i + 1))) := fun secondAnswer =>        (fun secondSuffix =>          collideForkView main qb i cf s (some {            occurrence := located.occurrence            first := located.completion            second := secondAnswer, secondSuffix })) <$>          PFunctor.FreeM.withPath (located.occurrence.resume secondAnswer)      change Pr[= (some s : Option (Fin (qb i + 1))) |          OracleComp.lift (spec.query i) >>= continuation]  _      rw [probOutput_bind_eq_tsum, probOutput_bind_eq_tsum]      refine ENNReal.tsum_le_tsum fun secondAnswer => ?_      let firstAnswer : spec.Range i := located.completion.answer      by_cases heq : firstAnswer = secondAnswer      · by_cases hcf : cf (PFunctor.FreeM.output main path) = some s        · simp [continuation, firstAnswer, heq, hcf, collideForkView,            probOutput_query]        · have hfirst : cf (PFunctor.FreeM.output main located.completion.path)               some s := by rw [located.path_eq]; exact hcf          simp [continuation, firstAnswer, heq, hcf, hfirst, collideForkView,            PFunctor.FreeM.Cursor.ForkView.firstPath, probOutput_query]      · simp [continuation, firstAnswer, heq, collideForkView,          PFunctor.FreeM.Cursor.ForkView.firstAnswer,          PFunctor.FreeM.Cursor.ForkView.secondAnswer, probOutput_query]  calc    Pr[= (some s : Option (Fin (qb i + 1))) |        contextForkViewCollision main qb i cf s]        = ∑' path, Pr[= path | paths] *            Pr[= (some s : Option (Fin (qb i + 1))) | viewCollision path] := by          rw [hsource, probOutput_bind_eq_tsum]    _  ∑' path, Pr[= path | paths] *          Pr[= (some s : Option (Fin (qb i + 1))) | answerCollision path] :=      ENNReal.tsum_le_tsum fun path => mul_le_mul' le_rfl (hinner path)    _ = Pr[= (some s : Option (Fin (qb i + 1))) |          contextForkCollision main qb i cf s] := by        simp only [contextForkCollision, paths, answerCollision]        rw [probOutput_bind_eq_tsum]        rfl
Project
VCVio
License
Apache-2.0
Commit
2ceb2d825ee3
Source
VCVio/CryptoFoundations/ReplayFork.lean:607-696

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