annotate Paper/src/AgdaTree.agda.replaced @ 5:339fb67b4375

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