view paper/src/cbc-hoare-loop.agda @ 19:046b2b20d6c7 default tip

fix
author ryokka
date Mon, 09 Mar 2020 11:25:49 +0900
parents
children
line wrap: on
line source

whileLoopPwP' : {l : Level} {t : Set l} → (n : ℕ) → (env : Envc )
    → (n ≡ varn env) → whileTestStateP s2 env
    → (next : (env : Envc ) → (pred n ≡ varn env) → whileTestStateP s2 env  → t)
    → (exit : (env : Envc ) → whileTestStateP sf env  → t) → t
whileLoopPwP' zero env refl refl _ exit = exit env refl
whileLoopPwP' (suc n) env refl refl next _ =
    next (record env {varn = pred (varn env) ; vari = suc (vari env) }) refl (+-suc n (vari env))


loopPwP' : {l : Level} {t : Set l} → (n : ℕ) → (env : Envc )
    → (n ≡ varn env) → whileTestStateP s2 env
    → (exit : (env : Envc ) → whileTestStateP sf env → t) → t
loopPwP' zero env refl refl exit = exit env refl
loopPwP' (suc n) env refl refl exit
    = whileLoopPwP' (suc n) env refl refl (λ env x y → loopPwP' n env x y exit) exit