annotate paper/src/agda-hoare-write.agda @ 4:bf1f62556b81

add while_test_init_imple
author soto
date Thu, 11 Feb 2021 17:03:31 +0900
parents 959f4b34d6f4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
1 -- Nomal CodeGear
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
2 whileLoop' : {l : Level} {t : Set l} → (n : ℕ) → (env : Envc)
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
3 → (n ≡ varn env)
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
4 → (next : Envc → t)
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
5 → (exit : Envc → t) → t
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
6 whileLoop' zero env refl _ exit = exit env
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
7 whileLoop' (suc n) env refl next _ = next (record env {varn = pred (varn env) ; vari = suc (vari env) })
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
8
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
9 -- Hoare Logic base CodeGear
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
10 whileLoopPwP' : {l : Level} {t : Set l} → (n : ℕ) → (env : Envc )
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
11 → (n ≡ varn env) → (pre : varn env + vari env ≡ c10 env)
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
12 → (next : (env : Envc ) → (pred n ≡ varn env) → (post : varn env + vari env ≡ c10 env) → t)
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
13 → (exit : (env : Envc ) → (fin : vari env ≡ c10 env) → t) → t
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
14 whileLoopPwP' zero env refl refl next exit = exit env refl
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
15 whileLoopPwP' (suc n) env refl refl next exit = next (record env {varn = pred (varn env) ; vari = suc (vari env) }) refl (+-suc n (vari env))