annotate final_pre/src/AgdaTreeProof.agda.replaced @ 11:ef87093f92d4

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