Mercurial > hg > Papers > 2020 > ryokka-master
view paper/src/agda-hoare-whileprog.agda @ 19:046b2b20d6c7 default tip
fix
author | ryokka |
---|---|
date | Mon, 09 Mar 2020 11:25:49 +0900 |
parents | |
children |
line wrap: on
line source
whileTestP : {l : Level} {t : Set l} → (c10 : ℕ) → (Code : Envc → t) → t whileTestP c10 next = next (record {c10 = c10 ; varn = c10 ; vari = 0 }) whileLoopP' : {l : Level} {t : Set l} → Envc → (next : Envc → t) → (exit : Envc → t) → t whileLoopP' record { c10 = c10 ; varn = zero ; vari = vari } _ exit = exit record { c10 = c10 ; varn = zero ; vari = vari } whileLoopP' record { c10 = c10 ; varn = suc varn1 ; vari = vari } next _ = next (record {c10 = c10 ; varn = varn1 ; vari = suc vari }) {-# TERMINATING #-} loopP : {l : Level} {t : Set l} → Envc → (exit : Envc → t) → t loopP env exit = whileLoopP' env (λ env → loopP env exit ) exit whileTestPCall : (c10 : ℕ ) → Envc whileTestPCall c10 = whileTestP {_} {_} c10 (λ env → loopP env (λ env → env)) -- whileTestPCall 10 -- record { c10 = 10 ; varn = 0 ; vari = 10 }