NLA-lib Explorer

NLAlib.Ops.holds_whileIter

Library · theorem

NLAlib.Ops.holds_whileIter {K : Type} {md : Ops.Mode} {test : ℕ → Ops.Mem K → Option Bool}
  {body : ℕ → Ops.Mem K → Option (Ops.Mem K)} (Inv : ℕ → Ops.Mem K → Prop)
  {P : ℕ × Ops.Mem K → Prop} {n : ℕ}
  (hstep :
    ∀ i < n,
      ∀ (m : Ops.Mem K),
        Inv i m →
          md.Holds (test i m) fun c ↦
            if c = true then md.Holds (body i m) (Inv (i + 1)) else P (i, m))
  (hcap : ∀ (m : Ops.Mem K), Inv n m → P (n, m)) (r i : ℕ) (m : Ops.Mem K) :
  i + r = n →
    Inv i m →
      md.Holds (Ops.whileIter (fun i m ↦ Option.map (fun b ↦ (b, m)) (test i m)) body r i m) P

Full source on GitHub

Import NLAlib.Ops.Logic.