All proofs
Project-declaredLean 4.32.0 · mathlib@81a5d257

Rel Triple simulate Q run writer T of triples

OracleComp.ProgramLogic.Relational.relTriple_simulateQ_run_writerT_of_triples

Plain-language statement

WriterT analogue of relTriple_simulateQ_run_of_triples (monoid variant). Given matching unary Std.Do.Triple specs for two WriterT-based handlers, a monoid-congruent writer relation R_writer (via hR_one and hR_mul), and a synchronization condition on per-query postconditions, derive a whole-program RelTriple on the full (output, writer) o...

Exact Lean statement

theorem relTriple_simulateQ_run_writerT_of_triples
    {ι : Type} {spec : OracleSpec.{0, 0} ι} [IsUniformSpec spec]
    {ω₁ ω₂ : Type} [Monoid ω₁] [Monoid ω₂]
    (impl₁ : QueryImpl spec (WriterT ω₁ (OracleComp spec₁)))
    (impl₂ : QueryImpl spec (WriterT ω₂ (OracleComp spec₂)))
    (R_writer : ω₁ → ω₂ → Prop)
    (hR_one : R_writer 1 1)
    (hR_mul : ∀ w₁ w₁' w₂ w₂', R_writer w₁ w₂ → R_writer w₁' w₂' →
      R_writer (w₁ * w₁') (w₂ * w₂'))
    (oa : OracleComp spec α)
    (Q₁ : ∀ (t : spec.Domain), spec.Range t → ω₁ → Prop)
    (Q₂ : ∀ (t : spec.Domain), spec.Range t → ω₂ → Prop)
    (h₁ : ∀ (t : spec.Domain), Std.Do.Triple
      (impl₁ t : WriterT ω₁ (OracleComp spec₁) (spec.Range t))
      (spred(fun s => ⌜s = 1⌝))
      (⇓a s' => ⌜Q₁ t a s'⌝))
    (h₂ : ∀ (t : spec.Domain), Std.Do.Triple
      (impl₂ t : WriterT ω₂ (OracleComp spec₂) (spec.Range t))
      (spred(fun s => ⌜s = 1⌝))
      (⇓a s' => ⌜Q₂ t a s'⌝))
    (hsync : ∀ (t : spec.Domain) a₁ w₁ a₂ w₂,
      Q₁ t a₁ w₁ → Q₂ t a₂ w₂ → a₁ = a₂ ∧ R_writer w₁ w₂) :
    RelTriple
      (simulateQ impl₁ oa).run
      (simulateQ impl₂ oa).run
      (fun p₁ p₂ => p₁.1 = p₂.1 ∧ R_writer p₁.2 p₂.2)

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem relTriple_simulateQ_run_writerT_of_triples    {ι : Type} {spec : OracleSpec.{0, 0} ι} [IsUniformSpec spec]    {ω₁ ω₂ : Type} [Monoid ω₁] [Monoid ω₂]    (impl₁ : QueryImpl spec (WriterT ω₁ (OracleComp spec₁)))    (impl₂ : QueryImpl spec (WriterT ω₂ (OracleComp spec₂)))    (R_writer : ω₁  ω₂  Prop)    (hR_one : R_writer 1 1)    (hR_mul :  w₁ w₁' w₂ w₂', R_writer w₁ w₂  R_writer w₁' w₂'       R_writer (w₁ * w₁') (w₂ * w₂'))    (oa : OracleComp spec α)    (Q₁ :  (t : spec.Domain), spec.Range t  ω₁  Prop)    (Q₂ :  (t : spec.Domain), spec.Range t  ω₂  Prop)    (h₁ :  (t : spec.Domain), Std.Do.Triple      (impl₁ t : WriterT ω₁ (OracleComp spec₁) (spec.Range t))      (spred(fun s => ⌜s = 1⌝))      (⇓a s' => ⌜Q₁ t a s'⌝))    (h₂ :  (t : spec.Domain), Std.Do.Triple      (impl₂ t : WriterT ω₂ (OracleComp spec₂) (spec.Range t))      (spred(fun s => ⌜s = 1⌝))      (⇓a s' => ⌜Q₂ t a s'⌝))    (hsync :  (t : spec.Domain) a₁ w₁ a₂ w₂,      Q₁ t a₁ w₁  Q₂ t a₂ w₂  a₁ = a₂  R_writer w₁ w₂) :    RelTriple      (simulateQ impl₁ oa).run      (simulateQ impl₂ oa).run      (fun p₁ p₂ => p₁.1 = p₂.1  R_writer p₁.2 p₂.2) := by  refine relTriple_simulateQ_run_writerT    impl₁ impl₂ R_writer hR_one hR_mul oa ?_  intro t  refine relTriple_post_mono (relTriple_run_writerT_of_triple_monoid    (mx₁ := impl₁ t) (mx₂ := impl₂ t)    (s₁ := (1 : ω₁)) (s₂ := (1 : ω₂))    (P₁ := fun s => s = 1) (P₂ := fun s => s = 1)    (Q₁ := Q₁ t) (Q₂ := Q₂ t)    rfl rfl (h₁ t) (h₂ t)) ?_  rintro a₁, w₁ a₂, w₂ hQ₁, hQ₂  rw [one_mul] at hQ₁ hQ₂  exact hsync t a₁ w₁ a₂ w₂ hQ₁ hQ₂
Project
VCVio
License
Apache-2.0
Commit
2ceb2d825ee3
Source
VCVio/ProgramLogic/Relational/HandlerFromUnary.lean:219-256

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