annotate Paper/src/bt_impl/replace.agda.replaced @ 32:4915eaa51ee0 default tip

Add front
author soto <soto@cr.ie.u-ryukyu.ac.jp>
date Thu, 23 Feb 2023 18:39:56 +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 replace : {n m : Level} {A : Set n} {t : Set m} !$\rightarrow$! (env : Env A )
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 !$\rightarrow$! (next : Env A !$\rightarrow$! t )
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 !$\rightarrow$! (exit : Env A !$\rightarrow$! t) !$\rightarrow$! t
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 replace env next exit = replace-c (varl env) env next exit where
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 replace-c : {n m : Level} {A : Set n} {t : Set m} !$\rightarrow$! List (bt A) !$\rightarrow$! (env : Env A )
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 !$\rightarrow$! (next : Env A !$\rightarrow$! t )
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 !$\rightarrow$! (exit : Env A !$\rightarrow$! t) !$\rightarrow$! t
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 replace-c st env next exit with st
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ... | [] = exit env
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 ... | leaf !$\text{::}$! st1 = replace-c st1 env next exit
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 ... | n@(node key-t value ltree rtree) !$\text{::}$! st1 with <-cmp (varn env) (key-t)
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 ... | tri< a !$\neg$!b !$\neg$!c = replace-c st1 record env{vart = (node key-t value (vart env) rtree); varl = st1} next exit
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 ... | tri≈ !$\neg$!a b !$\neg$!c = replace-c st1 record env{vart = (node key-t (varv env) ltree rtree); varl = st1} next exit
a72446879486 Init paper
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 ... | tri> !$\neg$!a !$\neg$!b c = replace-c st1 record env{vart = (node key-t value ltree (vart env)); varl = st1} next exit