All proofs
Project-declaredLean 4.32.0 · mathlib@81a5d257

Simulate Q option T for In yield pure none

simulateQ_optionT_forIn_yield_pure_none

Plain-language statement

Failing companion to simulateQ_optionT_forIn_yield_pure_some: if each loop body, under simulateQ, resolves to pure (some (ForInStep.yield init)) when its per-element condition cond a holds and to pure none otherwise, and some element of the list fails its condition, then the whole OptionT-monadic forIn resolves to pure none (the failure...

Exact Lean statement

lemma simulateQ_optionT_forIn_yield_pure_none (xs : List α) (init : β)
    (body : α → β → OptionT (OracleComp spec) (ForInStep β))
    (cond : α → Prop) [DecidablePred cond]
    (hbody : ∀ a, simulateQ impl ((body a init : OptionT (OracleComp spec) (ForInStep β)) :
        OracleComp spec (Option (ForInStep β)))
      = (pure (if cond a then some (ForInStep.yield init) else none) :
          n (Option (ForInStep β))))
    (hfail : ¬ ∀ a ∈ xs, cond a) :
    simulateQ impl ((forIn xs init body : OptionT (OracleComp spec) β) :
        OracleComp spec (Option β))
      = (pure none : n (Option β))

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
lemma simulateQ_optionT_forIn_yield_pure_none (xs : List α) (init : β)    (body : α  β  OptionT (OracleComp spec) (ForInStep β))    (cond : α  Prop) [DecidablePred cond]    (hbody :  a, simulateQ impl ((body a init : OptionT (OracleComp spec) (ForInStep β)) :        OracleComp spec (Option (ForInStep β)))      = (pure (if cond a then some (ForInStep.yield init) else none) :          n (Option (ForInStep β))))    (hfail : ¬  a  xs, cond a) :    simulateQ impl ((forIn xs init body : OptionT (OracleComp spec) β) :        OracleComp spec (Option β))      = (pure none : n (Option β)) := by  rw [simulateQ_optionT_list_forIn]  induction xs with  | nil => exact absurd (List.forall_mem_nil _) hfail  | cons x rest ih =>      rw [List.forIn_cons]      by_cases hx : cond x      · change ((simulateQ impl ((body x init : OptionT (OracleComp spec) (ForInStep β)) :            OracleComp spec (Option (ForInStep β))) : OptionT n (ForInStep β)) >>= _ :            OptionT n β) = _        rw [show (simulateQ impl ((body x init : OptionT (OracleComp spec) (ForInStep β)) :            OracleComp spec (Option (ForInStep β))) : OptionT n (ForInStep β))            = (pure (ForInStep.yield init) : OptionT n (ForInStep β)) by          rw [hbody x, if_pos hx]          rfl, pure_bind]        exact ih (fun hall  hfail (List.forall_mem_cons.mpr hx, hall))      · change ((simulateQ impl ((body x init : OptionT (OracleComp spec) (ForInStep β)) :            OracleComp spec (Option (ForInStep β))) : OptionT n (ForInStep β)) >>= _ :            OptionT n β) = _        rw [show (simulateQ impl ((body x init : OptionT (OracleComp spec) (ForInStep β)) :            OracleComp spec (Option (ForInStep β))) : OptionT n (ForInStep β))            = (failure : OptionT n (ForInStep β)) by          rw [hbody x, if_neg hx]          rfl, failure_bind]        rfl
Project
VCVio
License
Apache-2.0
Commit
2ceb2d825ee3
Source
VCVio/OracleComp/SimSemantics/OptionT/Basic.lean:222-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