annotate Paper/src/AgdaTree.agda.replaced @ 0:14a0e409d574

ADD fast commit
author soto <soto@cr.ie.u-ryukyu.ac.jp>
date Sun, 24 Apr 2022 23:13:44 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 record TreeMethods {n m : Level } {a : Set n } {t : Set m } (treeImpl : Set n ) : Set (m Level.!$\sqcup$! n) where
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 field
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 putImpl : treeImpl !$\rightarrow$! a !$\rightarrow$! (treeImpl !$\rightarrow$! t) !$\rightarrow$! t
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 getImpl : treeImpl !$\rightarrow$! (treeImpl !$\rightarrow$! Maybe a !$\rightarrow$! t) !$\rightarrow$! t
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 open TreeMethods
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 record Tree {n m : Level } {a : Set n } {t : Set m } (treeImpl : Set n ) : Set (m Level.!$\sqcup$! n) where
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 field
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 tree : treeImpl
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 treeMethods : TreeMethods {n} {m} {a} {t} treeImpl
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 putTree : a !$\rightarrow$! (Tree treeImpl !$\rightarrow$! t) !$\rightarrow$! t
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 putTree d next = putImpl (treeMethods ) tree d (\t1 !$\rightarrow$! next (record {tree = t1 ; treeMethods = treeMethods} ))
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 getTree : (Tree treeImpl !$\rightarrow$! Maybe a !$\rightarrow$! t) !$\rightarrow$! t
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 getTree next = getImpl (treeMethods ) tree (\t1 d !$\rightarrow$! next (record {tree = t1 ; treeMethods = treeMethods} ) d )
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 open Tree
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 record RedBlackTree {n m : Level } {t : Set m} (a k : Set n) : Set (m Level.!$\sqcup$! n) where
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 field
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 root : Maybe (Node a k)
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 nodeStack : SingleLinkedStack (Node a k)
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 compare : k !$\rightarrow$! k !$\rightarrow$! CompareResult {n}
14a0e409d574 ADD fast commit
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 open RedBlackTree