Your Title Here |
Your Name Here
- profile not found -
|
title: Continuation based C での Hoare Logic を用いた記述と検証 author: 外間政尊 profile: - 琉球大学 : 並列信頼研究室 lang: Japanese
1 whileLoopPwP' : {t : Set} → (n : ℕ) → (env : Envc ) → (n ≡ varn env) → whileTestStateP s2 env 2 → (next : (env : Envc ) → (pred n ≡ varn env) → whileTestStateP s2 env → t) 3 → (exit : (env : Envc ) → whileTestStateP sf env → t) → t 4 whileLoopPwP' zero env refl refl next exit = exit env refl 5 whileLoopPwP' (suc n) env refl refl next exit = 6 next (record env {varn = pred (varn env) ; vari = suc (vari env) }) refl (+-suc n (vari env))
1 whileTest' : {l : Level} {t : Set l} {c10 : ℕ } 2 → (Code : (env : Env ) → ((vari env) ≡ 0) /\ ((varn env) ≡ c10) → t) → t 3 whileTest' {_} {_} {c10} next = next env proof2 4 where 5 env : Env 6 env = record {vari = 0 ; varn = c10 } 7 proof2 : ((vari env) ≡ 0) /\ ((varn env) ≡ c10) -- PostCondition 8 proof2 = record {pi1 = refl ; pi2 = refl}
1 whileLoopPwP' : {l : Level} {t : Set l} → (n : ℕ) → (env : Envc ) → (n ≡ varn env) → whileTestStateP s2 env 2 → (next : (env : Envc ) → (pred n ≡ varn env) → whileTestStateP s2 env → t) 3 → (exit : (env : Envc ) → whileTestStateP sf env → t) → t 4 whileLoopPwP' zero env refl refl next exit = exit env refl 5 whileLoopPwP' (suc n) env refl refl next exit = 6 next (record env {varn = pred (varn env) ; vari = suc (vari env) }) refl (+-suc n (vari env)) 7 8 loopPwP' zero env refl refl exit = exit env refl 9 loopPwP' (suc n) env refl refl exit = whileLoopPwP' (suc n) env refl refl 10 (λ env x y → loopPwP' n env x y exit) exit
1-- whileProofs c = whileTestPwP {_} {_} c 2-- ( λ env s → conv1 env s 3-- ( λ env s → loopPwP' (varn env) env refl s 4-- ( λ env s → vari env ≡ c10 env ))) 5 6 ProofGears : (c : ℕ) → whileProofs c 7 ProofGears c = whileTestPwP {_} {_} c 8 (λ env s → loopPwP' c (record { c10 = c ; varn = c ; vari = 0 }) refl +zero 9 (λ env₁ s₁ → {!!})) 10 11 Goal: loopPwP' c (record { c10 = c ; varn = c ; vari = 0 }) refl 12 +zero (λ env₂ s₂ → vari env₂ ≡ c10 env₂) 13 ------------------------------------------------------------ 14 s₁ : vari env₁ ≡ c10 env₁ 15 env₁ : Envc 16 s : (vari env ≡ 0) /\ (varn env ≡ c10 env) 17 env : Envc 18 c : ℕ
1 loopHelper : (n : ℕ) → (env : Envc ) → (eq : varn env ≡ n) → (seq : whileTestStateP s2 env) 2 → loopPwP' n env (sym eq) seq (λ env₁ x → (vari env₁ ≡ c10 env₁)) 3 loopHelper zero env eq refl rewrite eq = refl 4 loopHelper (suc n) env eq refl rewrite eq = loopHelper n 5 (record { c10 = suc (n + vari env) ; varn = n ; vari = suc (vari env) }) refl (+-suc n (vari env))
1 -- whileProofs c = whileTestPwP {_} {_} c 2 -- ( λ env s → conv1 env s 3 -- ( λ env s → loopPwP' (varn env) env refl s 4 -- ( λ env s → vari env ≡ c10 env ))) 5 ProofGears : (c : ℕ) → whileProofs c 6 ProofGears c = whileTestPwP {_} {_} c 7 (λ env s → loopHelper c (record { c10 = c ; varn = c ; vari = zero }) refl +zero)