NLA-lib Explorer

NLAlib.Ops.whileIter_rel

Library · theorem

A relation that every test and every body keeps holds between the start and the end of a loop with early exit, which does at most the rounds it is given.

NLAlib.Ops.whileIter_rel {σ : Type} {R : σ → σ → Prop} (hrefl : ∀ (a : σ), R a a)
  (htrans : ∀ (a b c : σ), R a b → R b c → R a c) {test : ℕ → σ → Option (Bool × σ)}
  {body : ℕ → σ → Option σ} (ht : ∀ (i : ℕ) (a : σ) (bs : Bool × σ), test i a = some bs → R a bs.2)
  (h : ∀ (i : ℕ) (a b : σ), body i a = some b → R a b) {r i : ℕ} {s : σ} {js : ℕ × σ}
  (hk : Ops.whileIter test body r i s = some js) : R s js.2 ∧ i ≤ js.1 ∧ js.1 ≤ i + r

Full source on GitHub

Import NLAlib.Ops.Exec.