NLA-lib Explorer

NLAlib.Ops.whileIter_congr_of_invariant

Library · theorem

Agreement of tests and bodies on reachable states preserves every early-exit result.

NLAlib.Ops.whileIter_congr_of_invariant {α : Type} (P : α → Prop)
  (test test' : ℕ → α → Option (Bool × α)) (body body' : ℕ → α → Option α)
  (htest : ∀ (i : ℕ) (a : α), P a → test i a = test' i a)
  (hbody : ∀ (i : ℕ) (a : α), P a → body i a = body' i a)
  (hkeepTest : ∀ (i : ℕ) (a : α) (b : Bool × α), P a → test' i a = some b → P b.2)
  (hkeepBody : ∀ (i : ℕ) (a b : α), P a → body' i a = some b → P b) (fuel i : ℕ) (a : α)
  (ha : P a) : Ops.whileIter test body fuel i a = Ops.whileIter test' body' fuel i a

Full source on GitHub

Import NLAlib.Ops.ContextIteration.