annotate FL.agda @ 136:5689c06be30d

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Sep 2020 13:51:10 +0900
parents 4e2d272b4bcc
children 1722fd0f1fcf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
134
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 module FL where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 open import Level hiding ( suc ; zero )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 open import Data.Fin hiding ( _<_ ; _≤_ ; _-_ ; _+_ ; _≟_)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 open import Data.Fin.Properties hiding ( <-trans ; ≤-trans ; ≤-irrelevant ; _≟_ ) renaming ( <-cmp to <-fcmp )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 open import Data.Fin.Permutation
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 open import Data.Nat -- using (ℕ; suc; zero; s≤s ; z≤n )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 open import Relation.Binary.PropositionalEquality
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 open import Data.List using (List; []; _∷_ ; length ; _++_ ; head ; tail ) renaming (reverse to rev )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 open import Data.Product
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 open import Relation.Nullary
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 open import Data.Empty
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 open import Relation.Binary.Core
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 open import Relation.Binary.Definitions
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 infixr 100 _::_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 data FL : (n : ℕ )→ Set where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 f0 : FL 0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 _::_ : { n : ℕ } → Fin (suc n ) → FL n → FL (suc n)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 data _f<_ : {n : ℕ } (x : FL n ) (y : FL n) → Set where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 f<n : {m : ℕ } {xn yn : Fin (suc m) } {xt yt : FL m} → xn Data.Fin.< yn → (xn :: xt) f< ( yn :: yt )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 f<t : {m : ℕ } {xn : Fin (suc m) } {xt yt : FL m} → xt f< yt → (xn :: xt) f< ( xn :: yt )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 FLeq : {n : ℕ } {xn yn : Fin (suc n)} {x : FL n } {y : FL n} → xn :: x ≡ yn :: y → ( xn ≡ yn ) × (x ≡ y )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 FLeq refl = refl , refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 nat-<> : { x y : ℕ } → x < y → y < x → ⊥
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 nat-<> (s≤s x<y) (s≤s y<x) = nat-<> x<y y<x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 nat-<≡ : { x : ℕ } → x < x → ⊥
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 nat-<≡ (s≤s lt) = nat-<≡ lt
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 nat-≡< : { x y : ℕ } → x ≡ y → x < y → ⊥
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 nat-≡< refl lt = nat-<≡ lt
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 f-<> : {n : ℕ } {x : FL n } {y : FL n} → x f< y → y f< x → ⊥
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 f-<> (f<n x) (f<n x₁) = nat-<> x x₁
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 f-<> (f<n x) (f<t lt2) = nat-≡< refl x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 f-<> (f<t lt) (f<n x) = nat-≡< refl x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 f-<> (f<t lt) (f<t lt2) = f-<> lt lt2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 f-≡< : {n : ℕ } {x : FL n } {y : FL n} → x ≡ y → y f< x → ⊥
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 f-≡< refl (f<n x) = nat-≡< refl x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 f-≡< refl (f<t lt) = f-≡< refl lt
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 FLcmp : {n : ℕ } → Trichotomous {Level.zero} {FL n} _≡_ _f<_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 FLcmp f0 f0 = tri≈ (λ ()) refl (λ ())
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 FLcmp (xn :: xt) (yn :: yt) with <-fcmp xn yn
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 ... | tri< a ¬b ¬c = tri< (f<n a) (λ eq → nat-≡< (cong toℕ (proj₁ (FLeq eq)) ) a) (λ lt → f-<> lt (f<n a) )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 ... | tri> ¬a ¬b c = tri> (λ lt → f-<> lt (f<n c) ) (λ eq → nat-≡< (cong toℕ (sym (proj₁ (FLeq eq)) )) c) (f<n c)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 ... | tri≈ ¬a refl ¬c with FLcmp xt yt
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 ... | tri< a ¬b ¬c₁ = tri< (f<t a) (λ eq → ¬b (proj₂ (FLeq eq) )) (λ lt → f-<> lt (f<t a) )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 ... | tri≈ ¬a₁ refl ¬c₁ = tri≈ (λ lt → f-≡< refl lt ) refl (λ lt → f-≡< refl lt )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 ... | tri> ¬a₁ ¬b c = tri> (λ lt → f-<> lt (f<t c) ) (λ eq → ¬b (proj₂ (FLeq eq) )) (f<t c)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 infixr 250 _f<?_
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 _f<?_ : {n : ℕ} → (x y : FL n ) → Dec (x f< y )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 x f<? y with FLcmp x y
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 ... | tri< a ¬b ¬c = yes a
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 ... | tri≈ ¬a refl ¬c = no ( ¬a )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 ... | tri> ¬a ¬b c = no ( ¬a )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 open import logic
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 _f≤_ : {n : ℕ } (x : FL n ) (y : FL n) → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 _f≤_ x y = (x ≡ y ) ∨ (x f< y )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 FL0 : {n : ℕ } → FL n
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 FL0 {zero} = f0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 FL0 {suc n} = zero :: FL0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 open import logic
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 open import nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 fmax : { n : ℕ } → FL n
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 fmax {zero} = f0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 fmax {suc n} = fromℕ< a<sa :: fmax {n}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 fmax< : { n : ℕ } → {x : FL n } → ¬ (fmax f< x )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 fmax< {suc n} {x :: y} (f<n lt) = nat-≤> (fmax1 x) lt where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 fmax1 : {n : ℕ } → (x : Fin (suc n)) → toℕ x ≤ toℕ (fromℕ< {n} a<sa)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 fmax1 {zero} zero = z≤n
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 fmax1 {suc n} zero = z≤n
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 fmax1 {suc n} (suc x) = s≤s (fmax1 x)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 fmax< {suc n} {x :: y} (f<t lt) = fmax< {n} {y} lt
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 fmax¬ : { n : ℕ } → {x : FL n } → ¬ ( x ≡ fmax ) → x f< fmax
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 fmax¬ {zero} {f0} ne = ⊥-elim ( ne refl )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 fmax¬ {suc n} {x} ne with FLcmp x fmax
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 ... | tri< a ¬b ¬c = a
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 ... | tri≈ ¬a b ¬c = ⊥-elim ( ne b)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 ... | tri> ¬a ¬b c = ⊥-elim (fmax< c)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 FL0≤ : {n : ℕ } → FL0 {n} f≤ fmax
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 FL0≤ {zero} = case1 refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 FL0≤ {suc zero} = case1 refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 FL0≤ {suc n} with <-fcmp zero (fromℕ< {n} a<sa)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 ... | tri< a ¬b ¬c = case2 (f<n a)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 ... | tri≈ ¬a b ¬c with FL0≤ {n}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 ... | case1 x = case1 (subst₂ (λ j k → (zero :: FL0) ≡ (j :: k ) ) b x refl )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 ... | case2 x = case2 (subst (λ k → (zero :: FL0) f< (k :: fmax)) b (f<t x) )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 open import Relation.Binary as B hiding (Decidable; _⇔_)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 -- f≤-isDecTotalOrder : ∀ {n} → IsDecTotalOrder _≡_ (_f≤_ {n})
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 -- f≤-isDecTotalOrder = record { isTotalOrder = record { isPartialOrder = record { isPreorder = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 -- ; antisym = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 -- }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 -- ; total = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 -- }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 -- ; _≟_ = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 -- ; _≤?_ = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 -- }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 open import Data.Sum.Base as Sum -- inj₁
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
117
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 total : {n : ℕ } → Total (_f≤_ {n})
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 total f0 f0 = inj₁ (case1 refl)
135
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
120 total (x :: xt) (y :: yt) with <-fcmp x y
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
121 ... | tri< a ¬b ¬c = inj₁ (case2 (f<n a))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
122 ... | tri> ¬a ¬b c = inj₂ (case2 (f<n c))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
123 ... | tri≈ ¬a b ¬c with FLcmp xt yt
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
124 ... | tri< a ¬b ¬c₁ = inj₁ (case2 (subst (λ k → (x :: xt ) f< (k :: yt) ) b (f<t a)))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
125 ... | tri≈ ¬a₁ b₁ ¬c₁ = inj₁ (case1 (subst₂ (λ j k → j :: k ≡ y :: yt ) (sym b) (sym b₁ ) refl ))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
126 ... | tri> ¬a₁ ¬b c = inj₂ (case2 (subst (λ k → (y :: yt ) f< (k :: xt) ) (sym b) (f<t c)))
134
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 open import Relation.Nary using (⌊_⌋; fromWitness)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 open import Data.List.Fresh
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 open import Data.List.Fresh.Relation.Unary.All
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 open import Data.List.Fresh.Relation.Unary.Any as Any using (Any; here; there)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 FList : {n : ℕ } → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 FList {n} = List# (FL n) ⌊ _f<?_ ⌋
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 fr1 : FList
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 fr1 =
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 ((# 0) :: ((# 0) :: ((# 0 ) :: f0))) ∷#
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 ((# 0) :: ((# 1) :: ((# 0 ) :: f0))) ∷#
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 ((# 1) :: ((# 0) :: ((# 0 ) :: f0))) ∷#
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 ((# 2) :: ((# 0) :: ((# 0 ) :: f0))) ∷#
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 ((# 2) :: ((# 1) :: ((# 0 ) :: f0))) ∷#
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 []
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
144
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 open import Data.Product
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 -- open import Data.Maybe
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 -- open TotalOrder
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
148
135
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
149 open import Relation.Nullary.Decidable hiding (⌊_⌋)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
150 open import Data.Bool -- hiding (T)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
151 open import Data.Unit.Base using (⊤ ; tt)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
152
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
153 -- T : Data.Bool.Bool → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
154 -- T true = ⊤
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
155 -- T false = ⊥
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
156
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
157
134
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 FLcons : {n : ℕ } → FL n → FList {n} → FList {n}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 FLcons {zero} f0 y = f0 ∷# []
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 FLcons {suc n} x [] = x ∷# []
135
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
161 FLcons {suc n} x (cons a y x₁) with total x a
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
162 ... | inj₁ (case1 eq) = cons a y x₁
136
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 135
diff changeset
163 FLcons {suc n} x (cons a y x₁) | inj₁ (case2 lt) = cons x ( cons a y x₁) ( {!!} , ttf a y x₁) where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 135
diff changeset
164 ttf : (a : FL (suc n)) → (y : FList {suc n}) → fresh (FL (suc n)) ⌊ _f<?_ ⌋ a y → fresh (FL (suc n)) ⌊ _f<?_ ⌋ x y
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 135
diff changeset
165 ttf a [] fr = Level.lift tt
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 135
diff changeset
166 ttf a (cons a₁ y x) fr = {!!} , ttf a₁ y x
135
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
167 ... | inj₂ (case1 eq) = cons a y x₁
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 134
diff changeset
168 ... | inj₂ (case2 lt) = cons a (cons x y {!!}) {!!}
134
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
169
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 fr6 = FLcons ((# 1) :: ((# 1) :: ((# 0 ) :: f0))) fr1