annotate redBlackTreeTest.agda @ 548:c304869ac439

compareN x x = EQ
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 14 Jan 2018 17:57:38 +0900
parents d6a2b812b056
children bc3208d510cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
537
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
1 module redBlackTreeTest where
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
2
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
3 open import RedBlackTree
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
4 open import stack
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
5 open import Level hiding (zero)
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
6
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
7 open import Data.Nat
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
8
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
9 open Tree
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
10 open Node
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
11 open RedBlackTree.RedBlackTree
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
12 open Stack
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
13
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
14 -- tests
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
15
543
1595dd84fc3e fix use SingleLinkedStack
ryokka
parents: 542
diff changeset
16 putTree1 : {n m : Level } {a k : Set n} {t : Set m} -> RedBlackTree {n} {m} {t} a k -> k -> a -> (RedBlackTree {n} {m} {t} a k -> t) -> t
1595dd84fc3e fix use SingleLinkedStack
ryokka
parents: 542
diff changeset
17 putTree1 {n} {m} {a} {k} {t} tree k1 value next with (root tree)
537
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
18 ... | Nothing = next (record tree {root = Just (leafNode k1 value) })
543
1595dd84fc3e fix use SingleLinkedStack
ryokka
parents: 542
diff changeset
19 ... | Just n2 = clearSingleLinkedStack (nodeStack tree) (\ s -> findNode tree s (leafNode k1 value) n2 (\ tree1 s n1 -> replaceNode tree1 s n1 next))
537
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
20
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
21 open import Relation.Binary.PropositionalEquality
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
22 open import Relation.Binary.Core
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
23 open import Function
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
24
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
25
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
26 check1 : {m : Level } (n : Maybe (Node ℕ ℕ)) -> ℕ -> Bool {m}
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
27 check1 Nothing _ = False
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
28 check1 (Just n) x with Data.Nat.compare (value n) x
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
29 ... | equal _ = True
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
30 ... | _ = False
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
31
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
32 test1 : putTree1 {_} {_} {ℕ} {ℕ} (createEmptyRedBlackTreeℕ ℕ {Set Level.zero} ) 1 1 ( \t -> getRedBlackTree t 1 ( \t x -> check1 x 1 ≡ True ))
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
33 test1 = refl
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
34
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
35 test2 : putTree1 {_} {_} {ℕ} {ℕ} (createEmptyRedBlackTreeℕ ℕ {Set Level.zero} ) 1 1 (
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
36 \t -> putTree1 t 2 2 (
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
37 \t -> getRedBlackTree t 1 (
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
38 \t x -> check1 x 1 ≡ True )))
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
39 test2 = refl
fffeaf0b0024 add stackTest redBlackTreeTest
ryokka
parents:
diff changeset
40
545
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
41 open ≡-Reasoning
542
ee65e69c9b62 puttree1 act
ryokka
parents: 541
diff changeset
42 test3 : putTree1 {_} {_} {ℕ} {ℕ} (createEmptyRedBlackTreeℕ ℕ {Set Level.zero}) 1 1
ee65e69c9b62 puttree1 act
ryokka
parents: 541
diff changeset
43 $ \t -> putTree1 t 2 2
ee65e69c9b62 puttree1 act
ryokka
parents: 541
diff changeset
44 $ \t -> putTree1 t 3 3
544
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
45 $ \t -> putTree1 t 4 4
545
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
46 $ \t -> getRedBlackTree t 1
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
47 $ \t x -> check1 x 1 ≡ True
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
48 test3 = begin
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
49 check1 (Just (record {key = 1 ; value = 1 ; color = Black ; left = Nothing ; right = Just (leafNode 2 2)})) 1
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
50 ≡⟨ refl ⟩
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
51 True
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
52
542
ee65e69c9b62 puttree1 act
ryokka
parents: 541
diff changeset
53
ee65e69c9b62 puttree1 act
ryokka
parents: 541
diff changeset
54 test31 = putTree1 {_} {_} {ℕ} {ℕ} (createEmptyRedBlackTreeℕ ℕ ) 1 1
ee65e69c9b62 puttree1 act
ryokka
parents: 541
diff changeset
55 $ \t -> putTree1 t 2 2
ee65e69c9b62 puttree1 act
ryokka
parents: 541
diff changeset
56 $ \t -> putTree1 t 3 3
ee65e69c9b62 puttree1 act
ryokka
parents: 541
diff changeset
57 $ \t -> putTree1 t 4 4
544
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
58 $ \t -> getRedBlackTree t 4
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
59 $ \t x -> x
538
5c001e8ba0d5 add redBlackTreeTest.agda test5,test51. but not work
ryokka
parents: 537
diff changeset
60
540
6a4830c5a514 testing
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
61 -- test5 : Maybe (Node ℕ ℕ)
541
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
62 test5 = putTree1 {_} {_} {ℕ} {ℕ} (createEmptyRedBlackTreeℕ ℕ ) 4 4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
63 $ \t -> putTree1 t 6 6
543
1595dd84fc3e fix use SingleLinkedStack
ryokka
parents: 542
diff changeset
64 $ \t0 -> clearSingleLinkedStack (nodeStack t0)
541
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
65 $ \s -> findNode1 t0 s (leafNode 3 3) ( root t0 )
540
6a4830c5a514 testing
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
66 $ \t1 s n1 -> replaceNode t1 s n1
539
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
67 $ \t -> getRedBlackTree t 3
541
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
68 -- $ \t x -> SingleLinkedStack.top (stack s)
540
6a4830c5a514 testing
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
69 -- $ \t x -> n1
541
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
70 $ \t x -> root t
540
6a4830c5a514 testing
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
71 where
543
1595dd84fc3e fix use SingleLinkedStack
ryokka
parents: 542
diff changeset
72 findNode1 : {n m : Level } {a k : Set n} {t : Set m} -> RedBlackTree {n} {m} {t} a k -> SingleLinkedStack (Node a k) -> (Node a k) -> (Maybe (Node a k)) -> (RedBlackTree {n} {m} {t} a k -> SingleLinkedStack (Node a k) -> Node a k -> t) -> t
540
6a4830c5a514 testing
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
73 findNode1 t s n1 Nothing next = next t s n1
6a4830c5a514 testing
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
74 findNode1 t s n1 ( Just n2 ) next = findNode t s n1 n2 next
538
5c001e8ba0d5 add redBlackTreeTest.agda test5,test51. but not work
ryokka
parents: 537
diff changeset
75
5c001e8ba0d5 add redBlackTreeTest.agda test5,test51. but not work
ryokka
parents: 537
diff changeset
76 -- test51 : putTree1 {_} {_} {ℕ} {ℕ} {_} {Maybe (Node ℕ ℕ)} (createEmptyRedBlackTreeℕ ℕ {Set Level.zero} ) 1 1 $ \t ->
5c001e8ba0d5 add redBlackTreeTest.agda test5,test51. but not work
ryokka
parents: 537
diff changeset
77 -- putTree1 t 2 2 $ \t -> putTree1 t 3 3 $ \t -> root t ≡ Just (record { key = 1; value = 1; left = Just (record { key = 2 ; value = 2 } ); right = Nothing} )
5c001e8ba0d5 add redBlackTreeTest.agda test5,test51. but not work
ryokka
parents: 537
diff changeset
78 -- test51 = refl
539
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
79
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
80 test6 : Maybe (Node ℕ ℕ)
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
81 test6 = root (createEmptyRedBlackTreeℕ {_} ℕ {Maybe (Node ℕ ℕ)})
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
82
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
83
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
84 test7 : Maybe (Node ℕ ℕ)
543
1595dd84fc3e fix use SingleLinkedStack
ryokka
parents: 542
diff changeset
85 test7 = clearSingleLinkedStack (nodeStack tree2) (\ s -> replaceNode tree2 s n2 (\ t -> root t))
539
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
86 where
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
87 tree2 = createEmptyRedBlackTreeℕ {_} ℕ {Maybe (Node ℕ ℕ)}
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
88 k1 = 1
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
89 n2 = leafNode 0 0
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
90 value1 = 1
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
91
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
92 test8 : Maybe (Node ℕ ℕ)
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
93 test8 = putTree1 {_} {_} {ℕ} {ℕ} (createEmptyRedBlackTreeℕ ℕ) 1 1
39d465c20e5a print contant tree. C-c C-n test.
ryokka
parents: 538
diff changeset
94 $ \t -> putTree1 t 2 2 (\ t -> root t)
544
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
95
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
96
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
97 test9 : putRedBlackTree {_} {_} {ℕ} {ℕ} (createEmptyRedBlackTreeℕ ℕ {Set Level.zero} ) 1 1 ( \t -> getRedBlackTree t 1 ( \t x -> check1 x 1 ≡ True ))
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
98 test9 = refl
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
99
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
100 test10 : putRedBlackTree {_} {_} {ℕ} {ℕ} (createEmptyRedBlackTreeℕ ℕ {Set Level.zero} ) 1 1 (
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
101 \t -> putRedBlackTree t 2 2 (
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
102 \t -> getRedBlackTree t 1 (
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
103 \t x -> check1 x 1 ≡ True )))
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
104 test10 = refl
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
105
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
106 test11 = putRedBlackTree {_} {_} {ℕ} {ℕ} (createEmptyRedBlackTreeℕ ℕ) 1 1
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
107 $ \t -> putRedBlackTree t 2 2
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
108 $ \t -> putRedBlackTree t 3 3
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
109 $ \t -> getRedBlackTree t 2
4f692df9b3db add reference
ryokka
parents: 543
diff changeset
110 $ \t x -> root t
545
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
111
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
112
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
113 redBlackInSomeState :{ m : Level } (a : Set Level.zero) (n : Maybe (Node a ℕ)) {t : Set m} -> RedBlackTree {Level.zero} {m} {t} a ℕ
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
114 redBlackInSomeState {m} a n {t} = record { root = n ; nodeStack = emptySingleLinkedStack ; compare = compareℕ }
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
115
547
d6a2b812b056 compare2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
116 compare2 : (x y : ℕ ) -> CompareResult {Level.zero}
d6a2b812b056 compare2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
117 compare2 zero zero = EQ
d6a2b812b056 compare2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
118 compare2 (suc _) zero = GT
d6a2b812b056 compare2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
119 compare2 zero (suc _) = LT
d6a2b812b056 compare2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
120 compare2 (suc x) (suc y) = compare2 x y
546
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
121
548
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
122 putTest1Lemma2 : (k : ℕ) -> compare2 k k ≡ EQ
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
123 putTest1Lemma2 zero = refl
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
124 putTest1Lemma2 (suc k) = putTest1Lemma2 k
546
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
125
548
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
126 putTest1Lemma1 : (x y : ℕ) -> compareℕ x y ≡ compare2 x y
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
127 putTest1Lemma1 zero zero = refl
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
128 putTest1Lemma1 (suc m) zero = refl
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
129 putTest1Lemma1 zero (suc n) = refl
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
130 putTest1Lemma1 (suc m) (suc n) with Data.Nat.compare m n
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
131 putTest1Lemma1 (suc .m) (suc .(Data.Nat.suc m + k)) | less m k = lemma1 m
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
132 where
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
133 lemma1 : (m : ℕ) -> LT ≡ compare2 m (ℕ.suc (m + k))
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
134 lemma1 zero = refl
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
135 lemma1 (suc y) = lemma1 y
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
136 putTest1Lemma1 (suc .m) (suc .m) | equal m = lemma1 m
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
137 where
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
138 lemma1 : (m : ℕ) -> EQ ≡ compare2 m m
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
139 lemma1 zero = refl
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
140 lemma1 (suc y) = lemma1 y
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
141 putTest1Lemma1 (suc .(Data.Nat.suc m + k)) (suc .m) | greater m k = lemma1 m
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
142 where
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
143 lemma1 : (m : ℕ) -> GT ≡ compare2 (ℕ.suc (m + k)) m
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
144 lemma1 zero = refl
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
145 lemma1 (suc y) = lemma1 y
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
146
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
147 putTest1Lemma3 : (k : ℕ) -> compareℕ k k ≡ EQ
c304869ac439 compareN x x = EQ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 547
diff changeset
148 putTest1Lemma3 k = trans (putTest1Lemma1 k k) ( putTest1Lemma2 k )
546
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
149
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
150
545
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
151 putTest1 :{ m : Level } (n : Maybe (Node ℕ ℕ))
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
152 -> (k : ℕ) (x : ℕ)
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
153 -> putTree1 {_} {_} {ℕ} {ℕ} (redBlackInSomeState {_} ℕ n {Set Level.zero}) k x
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
154 (\ t -> getRedBlackTree t k (\ t x1 -> check1 x1 x ≡ True))
546
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
155 putTest1 n k x with n
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
156 ... | Just n1 = {!!}
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
157 ... | Nothing = {!!}
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
158
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
159
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
160 -- with Data.Nat.compare k (key (leafNode k x))
b654ce34c894 add putTest1Lemma1, putTest1
ryokka
parents: 545
diff changeset
161 -- ... | Data.Nat.equal _ = ?
545
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
162
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
163 -- begin
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
164 -- ?
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
165 -- ≡⟨ ? ⟩
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
166 -- True
b180dc78abcf add someTest
ryokka
parents: 544
diff changeset
167 -- ∎