NLAlib.Ops.PWrites.loop
Library · theorem
The counted loop (PL3f-loop): if round i from Inv i ends in Inv (i + 1), writing only F, with failure probability at most \varphi_i \ge 0, the loop of N rounds fails with probability at most \sum_{i < N} \varphi_i. With N = 0 the loop does nothing.
NLAlib.Ops.PWrites.loop {Op Tst K : Type} [Inhabited K] [MeasurableSpace K] {law : ℕ → Measure K}
{I : Ops.Interp Op Tst K} {ρ : Ops.Env} {F : Ops.Fp} {Pre Post : Ops.Mem K → Prop}
(hI : I.IsMeasurable) {win : Op → List ℕ → ℕ} (hloc : ∀ (o : Op), I.TapeLocal o (win o))
{n : Ops.IExp} {body : Ops.Stmt Op Tst} {N : ℕ} (hn : Ops.IExp.eval ρ.idx n = some N)
(Inv : ℕ → Ops.Mem K → Prop) (φ : ℕ → ℝ) (hφ : ∀ i < N, 0 ≤ φ i)
(h0 : ∀ (m : Ops.Mem K), Pre m → Inv 0 m)
(hbody : ∀ i < N, Ops.PWrites law I body (ρ.pushIdx i) F (Inv i) (Inv (i + 1)) (φ i))
(hpost : ∀ (m : Ops.Mem K), Inv N m → Post m) :
Ops.PWrites law I (Ops.Stmt.loop n body) ρ F Pre Post (∑ i ∈ Finset.range N, φ i)Import NLAlib.Ops.Logic.Probabilistic.