annotate final_main/src/AgdaTreeProof.agda.replaced @ 0:83f997abf3b5

first commit
author e155702
date Thu, 14 Feb 2019 16:51:50 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
83f997abf3b5 first commit
e155702
parents:
diff changeset
1 redBlackInSomeState : { m : Level } (a : Set Level.zero) (n : Maybe (Node a @$\mathbb{N}$@)) {t : Set m} @$\rightarrow$@ RedBlackTree {Level.zero} {m} {t} a @$\mathbb{N}$@
83f997abf3b5 first commit
e155702
parents:
diff changeset
2 redBlackInSomeState {m} a n {t} = record { root = n ; nodeStack = emptySingleLinkedStack ; compare = compare2 }
83f997abf3b5 first commit
e155702
parents:
diff changeset
3
83f997abf3b5 first commit
e155702
parents:
diff changeset
4 putTest1 :{ m : Level } (n : Maybe (Node @$\mathbb{N}$@ @$\mathbb{N}$@))
83f997abf3b5 first commit
e155702
parents:
diff changeset
5 @$\rightarrow$@ (k : @$\mathbb{N}$@) (x : @$\mathbb{N}$@)
83f997abf3b5 first commit
e155702
parents:
diff changeset
6 @$\rightarrow$@ putTree1 {_} {_} {@$\mathbb{N}$@} {@$\mathbb{N}$@} (redBlackInSomeState {_} @$\mathbb{N}$@ n {Set Level.zero}) k x
83f997abf3b5 first commit
e155702
parents:
diff changeset
7 (\ t @$\rightarrow$@ getRedBlackTree t k (\ t x1 @$\rightarrow$@ check2 x1 x @$\equiv$@ True))
83f997abf3b5 first commit
e155702
parents:
diff changeset
8 putTest1 n k x with n
83f997abf3b5 first commit
e155702
parents:
diff changeset
9 ... | Just n1 = lemma2 ( record { top = Nothing } )
83f997abf3b5 first commit
e155702
parents:
diff changeset
10 where
83f997abf3b5 first commit
e155702
parents:
diff changeset
11 lemma2 : (s : SingleLinkedStack (Node @$\mathbb{N}$@ @$\mathbb{N}$@) ) @$\rightarrow$@ putTree1 (record { root = Just n1 ; nodeStack = s ; compare = compare2 }) k x (λ t →
83f997abf3b5 first commit
e155702
parents:
diff changeset
12 GetRedBlackTree.checkNode t k (λ t@$\text{1}$@ x1 → check2 x1 x @$\equiv$@ True) (root t))
83f997abf3b5 first commit
e155702
parents:
diff changeset
13 lemma2 s with compare2 k (key n1)
83f997abf3b5 first commit
e155702
parents:
diff changeset
14 ... | EQ = lemma3 {!!}
83f997abf3b5 first commit
e155702
parents:
diff changeset
15 where
83f997abf3b5 first commit
e155702
parents:
diff changeset
16 lemma3 : compare2 k (key n1) @$\equiv$@ EQ @$\rightarrow$@ getRedBlackTree {_} {_} {@$\mathbb{N}$@} {@$\mathbb{N}$@} {Set Level.zero} ( record { root = Just ( record {
83f997abf3b5 first commit
e155702
parents:
diff changeset
17 key = key n1 ; value = x ; right = right n1 ; left = left n1 ; color = Black
83f997abf3b5 first commit
e155702
parents:
diff changeset
18 } ) ; nodeStack = s ; compare = λ x@$\text{1}$@ y → compare2 x@$\text{1}$@ y } ) k ( \ t x1 @$\rightarrow$@ check2 x1 x @$\equiv$@ True)
83f997abf3b5 first commit
e155702
parents:
diff changeset
19 lemma3 eq with compare2 x x | putTest1Lemma2 x
83f997abf3b5 first commit
e155702
parents:
diff changeset
20 ... | EQ | refl with compare2 k (key n1) | eq
83f997abf3b5 first commit
e155702
parents:
diff changeset
21 ... | EQ | refl with compare2 x x | putTest1Lemma2 x
83f997abf3b5 first commit
e155702
parents:
diff changeset
22 ... | EQ | refl = refl
83f997abf3b5 first commit
e155702
parents:
diff changeset
23 ... | GT = {!!}
83f997abf3b5 first commit
e155702
parents:
diff changeset
24 ... | LT = {!!}
83f997abf3b5 first commit
e155702
parents:
diff changeset
25
83f997abf3b5 first commit
e155702
parents:
diff changeset
26 ... | Nothing = lemma1
83f997abf3b5 first commit
e155702
parents:
diff changeset
27 where
83f997abf3b5 first commit
e155702
parents:
diff changeset
28 lemma1 : getRedBlackTree {_} {_} {@$\mathbb{N}$@} {@$\mathbb{N}$@} {Set Level.zero} ( record { root = Just ( record {
83f997abf3b5 first commit
e155702
parents:
diff changeset
29 key = k ; value = x ; right = Nothing ; left = Nothing ; color = Red
83f997abf3b5 first commit
e155702
parents:
diff changeset
30 } ) ; nodeStack = record { top = Nothing } ; compare = λ x@$\text{1}$@ y → compare2 x@$\text{1}$@ y } ) k
83f997abf3b5 first commit
e155702
parents:
diff changeset
31 ( \ t x1 @$\rightarrow$@ check2 x1 x @$\equiv$@ True)
83f997abf3b5 first commit
e155702
parents:
diff changeset
32 lemma1 with compare2 k k | putTest1Lemma2 k
83f997abf3b5 first commit
e155702
parents:
diff changeset
33 ... | EQ | refl with compare2 x x | putTest1Lemma2 x
83f997abf3b5 first commit
e155702
parents:
diff changeset
34 ... | EQ | refl = refl