Mercurial > hg > Papers > 2023 > soto-master
comparison Paper/src/while_loop_verif/while_loop.agda.replaced @ 3:c28e8156a37b
Add paper init~agda
author | soto <soto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 20 Jan 2023 13:40:03 +0900 |
parents | a72446879486 |
children |
comparison
equal
deleted
inserted
replaced
2:0425278b683b | 3:c28e8156a37b |
---|---|
1 {-# TERMINATING #-} | 1 {-# TERMINATING #-} |
2 whileLoop' : {l : Level} {t : Set l} !$\rightarrow$! (env : Env) !$\rightarrow$! {c10 : !$\mathbb{N}$! } !$\rightarrow$! ((varn env) + (vari env) !$\equiv$! c10) | 2 whileLoop!$\prime$! : {l : Level} {t : Set l} !$\rightarrow$! (env : Env) !$\rightarrow$! {c10 : !$\mathbb{N}$! } !$\rightarrow$! ((varn env) + (vari env) !$\equiv$! c10) |
3 !$\rightarrow$! (Code : (e1 : Env )!$\rightarrow$! vari e1 !$\equiv$! c10 !$\rightarrow$! t) !$\rightarrow$! t | 3 !$\rightarrow$! (Code : (e1 : Env )!$\rightarrow$! vari e1 !$\equiv$! c10 !$\rightarrow$! t) !$\rightarrow$! t |
4 whileLoop' env proof next with ( suc zero !$\leq$!? (varn env) ) | 4 whileLoop!$\prime$! env proof next with ( suc zero !$\leq$!? (varn env) ) |
5 whileLoop' env {c10} proof next | no p = next env ( begin | 5 whileLoop!$\prime$! env {c10} proof next | no p = next env ( begin |
6 vari env !$\equiv$!!$\langle$! refl !$\rangle$! | 6 vari env !$\equiv$!!$\langle$! refl !$\rangle$! |
7 0 + vari env !$\equiv$!!$\langle$! cong (!$\lambda$! k !$\rightarrow$! k + vari env) (sym (lemma1 p )) !$\rangle$! | 7 0 + vari env !$\equiv$!!$\langle$! cong (!$\lambda$! k !$\rightarrow$! k + vari env) (sym (lemma1 p )) !$\rangle$! |
8 varn env + vari env !$\equiv$!!$\langle$! proof !$\rangle$! | 8 varn env + vari env !$\equiv$!!$\langle$! proof !$\rangle$! |
9 c10 !$\blacksquare$! ) where open !$\equiv$!-Reasoning | 9 c10 !$\blacksquare$! ) where open !$\equiv$!-Reasoning |
10 whileLoop' env {c10} proof next | yes p = whileLoop' env1 (proof3 p ) next where | 10 whileLoop!$\prime$! env {c10} proof next | yes p = whileLoop!$\prime$! env1 (proof3 p ) next where |
11 env1 = record {varn = (varn env) - 1 ; vari = (vari env) + 1} | 11 env1 = record {varn = (varn env) - 1 ; vari = (vari env) + 1} |
12 1<0 : 1 !$\leq$! zero !$\rightarrow$! !$\bot$! | 12 1<0 : 1 !$\leq$! zero !$\rightarrow$! !$\bot$! |
13 1<0 () | 13 1<0 () |
14 proof3 : (suc zero !$\leq$! (varn env)) !$\rightarrow$! varn env1 + vari env1 !$\equiv$! c10 | 14 proof3 : (suc zero !$\leq$! (varn env)) !$\rightarrow$! varn env1 + vari env1 !$\equiv$! c10 |
15 proof3 (s!$\leq$!s lt) with varn env | 15 proof3 (s!$\leq$!s lt) with varn env |
16 proof3 (s!$\leq$!s z!$\leq$!n) | zero = !$\bot$!-elim (1<0 p) | 16 proof3 (s!$\leq$!s z!$\leq$!n) | zero = !$\bot$!-elim (1<0 p) |
17 proof3 (s!$\leq$!s (z!$\leq$!n {n'}) ) | suc n = let open !$\equiv$!-Reasoning in begin | 17 proof3 (s!$\leq$!s (z!$\leq$!n {n!$\prime$!}) ) | suc n = let open !$\equiv$!-Reasoning in begin |
18 n' + (vari env + 1) !$\equiv$!!$\langle$! cong ( !$\lambda$! z !$\rightarrow$! n' + z ) ( +-sym {vari env} {1} ) !$\rangle$! | 18 n!$\prime$! + (vari env + 1) !$\equiv$!!$\langle$! cong ( !$\lambda$! z !$\rightarrow$! n!$\prime$! + z ) ( +-sym {vari env} {1} ) !$\rangle$! |
19 n' + (1 + vari env ) !$\equiv$!!$\langle$! sym ( +-assoc (n') 1 (vari env) ) !$\rangle$! | 19 n!$\prime$! + (1 + vari env ) !$\equiv$!!$\langle$! sym ( +-assoc (n!$\prime$!) 1 (vari env) ) !$\rangle$! |
20 (n' + 1) + vari env !$\equiv$!!$\langle$! cong ( !$\lambda$! z !$\rightarrow$! z + vari env ) +1!$\equiv$!suc !$\rangle$! | 20 (n!$\prime$! + 1) + vari env !$\equiv$!!$\langle$! cong ( !$\lambda$! z !$\rightarrow$! z + vari env ) +1!$\equiv$!suc !$\rangle$! |
21 (suc n' ) + vari env !$\equiv$!!$\langle$!!$\rangle$! | 21 (suc n!$\prime$! ) + vari env !$\equiv$!!$\langle$!!$\rangle$! |
22 varn env + vari env !$\equiv$!!$\langle$! proof !$\rangle$! | 22 varn env + vari env !$\equiv$!!$\langle$! proof !$\rangle$! |
23 c10 | 23 c10 |
24 !$\blacksquare$! | 24 !$\blacksquare$! |