annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 {-# TERMINATING #-}
3
c28e8156a37b Add paper init~agda
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
2 whileLoop!$\prime$! : {l : Level} {t : Set l} !$\rightarrow$! (env : Env) !$\rightarrow$! {c10 : !$\mathbb{N}$! } !$\rightarrow$! ((varn env) + (vari env) !$\equiv$! c10)
1
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 !$\rightarrow$! (Code : (e1 : Env )!$\rightarrow$! vari e1 !$\equiv$! c10 !$\rightarrow$! t) !$\rightarrow$! t
3
c28e8156a37b Add paper init~agda
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
4 whileLoop!$\prime$! env proof next with ( suc zero !$\leq$!? (varn env) )
c28e8156a37b Add paper init~agda
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
5 whileLoop!$\prime$! env {c10} proof next | no p = next env ( begin
1
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 vari env !$\equiv$!!$\langle$! refl !$\rangle$!
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 0 + vari env !$\equiv$!!$\langle$! cong (!$\lambda$! k !$\rightarrow$! k + vari env) (sym (lemma1 p )) !$\rangle$!
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 varn env + vari env !$\equiv$!!$\langle$! proof !$\rangle$!
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 c10 !$\blacksquare$! ) where open !$\equiv$!-Reasoning
3
c28e8156a37b Add paper init~agda
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
10 whileLoop!$\prime$! env {c10} proof next | yes p = whileLoop!$\prime$! env1 (proof3 p ) next where
1
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 env1 = record {varn = (varn env) - 1 ; vari = (vari env) + 1}
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 1<0 : 1 !$\leq$! zero !$\rightarrow$! !$\bot$!
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 1<0 ()
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 proof3 : (suc zero !$\leq$! (varn env)) !$\rightarrow$! varn env1 + vari env1 !$\equiv$! c10
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 proof3 (s!$\leq$!s lt) with varn env
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 proof3 (s!$\leq$!s z!$\leq$!n) | zero = !$\bot$!-elim (1<0 p)
3
c28e8156a37b Add paper init~agda
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
17 proof3 (s!$\leq$!s (z!$\leq$!n {n!$\prime$!}) ) | suc n = let open !$\equiv$!-Reasoning in begin
c28e8156a37b Add paper init~agda
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
18 n!$\prime$! + (vari env + 1) !$\equiv$!!$\langle$! cong ( !$\lambda$! z !$\rightarrow$! n!$\prime$! + z ) ( +-sym {vari env} {1} ) !$\rangle$!
c28e8156a37b Add paper init~agda
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
19 n!$\prime$! + (1 + vari env ) !$\equiv$!!$\langle$! sym ( +-assoc (n!$\prime$!) 1 (vari env) ) !$\rangle$!
c28e8156a37b Add paper init~agda
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
20 (n!$\prime$! + 1) + vari env !$\equiv$!!$\langle$! cong ( !$\lambda$! z !$\rightarrow$! z + vari env ) +1!$\equiv$!suc !$\rangle$!
c28e8156a37b Add paper init~agda
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
21 (suc n!$\prime$! ) + vari env !$\equiv$!!$\langle$!!$\rangle$!
1
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 varn env + vari env !$\equiv$!!$\langle$! proof !$\rangle$!
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 c10
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 !$\blacksquare$!