annotate automaton-in-agda/src/derive.agda @ 365:c46f04f7c99a

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 21 Jul 2023 12:01:16 +0900
parents 00f5076ef2de
children 19410aadd636
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
1 {-# OPTIONS --allow-unsolved-metas #-}
36
9558d870e8ae add cfg and derive
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
44
aa15eff1aeb3 seprate finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
3 open import Relation.Binary.PropositionalEquality hiding ( [_] )
aa15eff1aeb3 seprate finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
4 open import Relation.Nullary using (¬_; Dec; yes; no)
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
5 open import Data.List hiding ( [_] )
271
5e066b730d73 regex cmp
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 270
diff changeset
6 open import finiteSet
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
7
271
5e066b730d73 regex cmp
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 270
diff changeset
8 module derive ( Σ : Set) ( fin : FiniteSet Σ ) ( eq? : (x y : Σ) → Dec (x ≡ y)) where
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
9
138
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
10 open import automaton
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
11 open import logic
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
12 open import regex
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
13
274
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 272
diff changeset
14 -- whether a regex accepts empty input
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 272
diff changeset
15 --
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
16 empty? : Regex Σ → Bool
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
17 empty? ε = true
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
18 empty? φ = false
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
19 empty? (x *) = true
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
20 empty? (x & y) = empty? x /\ empty? y
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
21 empty? (x || y) = empty? x \/ empty? y
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
22 empty? < x > = false
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
23
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
24 derivative : Regex Σ → Σ → Regex Σ
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
25 derivative ε s = φ
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
26 derivative φ s = φ
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
27 derivative (x *) s with derivative x s
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
28 ... | ε = x *
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
29 ... | φ = φ
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
30 ... | t = t & (x *)
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
31 derivative (x & y) s with empty? x
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
32 ... | true with derivative x s | derivative y s
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
33 ... | ε | φ = φ
335
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
34 ... | ε | t = t || y
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
35 ... | φ | t = t
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
36 ... | x1 | φ = x1 & y
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
37 ... | x1 | y1 = (x1 & y) || y1
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
38 derivative (x & y) s | false with derivative x s
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
39 ... | ε = y
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
40 ... | φ = φ
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
41 ... | t = t & y
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
42 derivative (x || y) s with derivative x s | derivative y s
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
43 ... | φ | y1 = y1
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
44 ... | x1 | φ = x1
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
45 ... | x1 | y1 = x1 || y1
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
46 derivative < x > s with eq? x s
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
47 ... | yes _ = ε
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
48 ... | no _ = φ
138
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
49
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
50 data regex-states (x : Regex Σ ) : Regex Σ → Set where
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
51 unit : regex-states x x
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
52 derive : { y : Regex Σ } → regex-states x y → (s : Σ) → regex-states x ( derivative y s )
44
aa15eff1aeb3 seprate finite
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 36
diff changeset
53
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
54 record Derivative (x : Regex Σ ) : Set where
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
55 field
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
56 state : Regex Σ
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
57 is-derived : regex-states x state
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
58
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
59 open Derivative
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
60
335
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
61 derive-step : (r : Regex Σ) (d0 : Derivative r) → (s : Σ) → regex-states r (derivative (state d0) s)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
62 derive-step r d0 s = derive (is-derived d0) s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
63
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
64 regex→automaton : (r : Regex Σ) → Automaton (Derivative r) Σ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
65 regex→automaton r = record { δ = λ d s → record { state = derivative (state d) s ; is-derived = derive-step r d s}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
66 ; aend = λ d → empty? (state d) }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
67
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
68 regex-match : (r : Regex Σ) → (List Σ) → Bool
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
69 regex-match ex is = accept ( regex→automaton ex ) record { state = ex ; is-derived = unit } is
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
70
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
71 -- open import nfa
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
72 open import Data.Nat
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
73 -- open import Data.Nat hiding ( _<_ ; _>_ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
74 -- open import Data.Fin hiding ( _<_ )
336
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
75 open import nat
335
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
76 open import finiteSetUtil
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
77 open FiniteSet
270
dd98e7e5d4a5 derive worked but finiteness is difficult
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
78 open import Data.Fin hiding (_<_)
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
79
336
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
80 -- finiteness of derivative
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
81 -- term generate x & y for each * and & only once
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
82 -- rank : Regex → ℕ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
83 -- r₀ & r₁ ... r
337
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 336
diff changeset
84 -- generated state is a subset of the term set
141
b3f05cd08d24 clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
85
271
5e066b730d73 regex cmp
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 270
diff changeset
86 open import Relation.Binary.Definitions
5e066b730d73 regex cmp
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 270
diff changeset
87
336
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
88 rank : (r : Regex Σ) → ℕ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
89 rank ε = 0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
90 rank φ = 0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
91 rank (r *) = suc (rank r)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
92 rank (r & r₁) = suc (max (rank r) (rank r₁))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
93 rank (r || r₁) = max (rank r) (rank r₁)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
94 rank < x > = 0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
95
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
96 data SB : (r : Regex Σ) → (rn : ℕ) → Set where
341
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
97 sbε : SB ε 0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
98 sbφ : SB φ 0
339
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 338
diff changeset
99 sb<> : (s : Σ) → SB < s > 0
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 338
diff changeset
100 sb| : (x y : Regex Σ) → (xn yn xy : ℕ) → SB x xn → SB y yn → xy ≡ max xn yn → SB (x || y) xy
341
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
101 sb* : (x : Regex Σ) → (xn : ℕ) → SB x xn → SB (x *) (suc xn)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
102 sb& : (x y : Regex Σ) → (xn yn : ℕ) → xn < yn → ( sx : SB x xn ) (sy : SB y yn ) → SB (x & y) (suc yn)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
103
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
104 sb-id : (r : Regex Σ) → SB r (rank r) → Bool
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
105 sb-id r sb with rank r | inspect rank r
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
106 sb-id ε sbε | zero | _ = true
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
107 sb-id φ sbφ | zero | _ = true
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
108 sb-id < t > (sb<> s) | zero | _ with eq? t s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
109 ... | yes _ = true
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
110 ... | no _ = false
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
111 sb-id (x0 || y0) (sb| x y xn yn .zero sb sb₁ x₁) | zero | record { eq = eq1 } = sb-id x0 ? /\ sb-id y0 ?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
112 sb-id _ (sb| x y xn yn .(suc k) sb sb₁ x₁) | suc k | record { eq = eq1 } = sb-id x ? /\ sb-id y ?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
113 sb-id (y *) (sb* x t u) | suc k | record{ eq = eq1 } = sb-id y ?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 340
diff changeset
114 sb-id (x0 & y0) (sb& .x0 .y0 xn .k x z z₁) | suc k | record { eq = eq1 } = sb-id x0 ? /\ sb-id y0 ?
271
5e066b730d73 regex cmp
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 270
diff changeset
115
338
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 337
diff changeset
116 open import bijection using ( InjectiveF ; Is )
336
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 335
diff changeset
117
338
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 337
diff changeset
118 finSBTA : (r : Regex Σ) → FiniteSet (SB r (rank r) → Bool)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 337
diff changeset
119 finSBTA r = fin→ ( fb00 (rank r) r refl ) where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 337
diff changeset
120 fb00 : (n : ℕ ) → (r : Regex Σ) → rank r ≡ n → FiniteSet (SB r (rank r))
364
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
121 fb00 zero ε eq = record { finite = 1 ; Q←F = λ _ → sbε ; F←Q = λ _ → # 0 ; finiso→ = ? ; finiso← = ? }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
122 fb00 zero φ eq = record { finite = 1 ; Q←F = λ _ → sbφ ; F←Q = λ _ → # 0 ; finiso→ = ? ; finiso← = ? }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
123 fb00 zero (r || r₁) eq = iso-fin (fin-∨ (fb00 zero r ?) (fb00 zero r₁ ?)) ?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
124 fb00 zero < x > eq = iso-fin fin ?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
125 fb00 (suc n) (r *) eq = iso-fin (fb00 n r ?) ?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
126 fb00 (suc n) (r & r₁) eq = iso-fin (fin-∧ (fb00 n r ?) (fb00 n r₁ ?)) ?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
127 fb00 (suc n) (r || r₁) eq = iso-fin (fin-∧ (fb00 (suc n) r ?) (fb00 (suc n) r₁ ?)) ?
338
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 337
diff changeset
128
364
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
129 record SBf (r : Regex Σ) (n : ℕ) : Set where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
130 field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
131 rank=n : rank r ≡ n
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
132 f : Derivative r → SB r n → Bool
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
133 sb-inject : {x y : Derivative r} → f x ≡ f y → x ≡ y
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
134 dec : (a : SB r n → Bool ) → Dec (Is (Derivative r) (SB r n → Bool) f a )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
135
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
136 SBN : (r : Regex Σ) → SBf r (rank r)
365
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
137 SBN ε = record { rank=n = refl ; f = fb02 ; sb-inject = fl05 ; dec = fl03 } where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
138 fb02 : Derivative ε → SB ε 0 → Bool
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
139 fb02 d sbε = true
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
140 fl03 : (a : SB ε 0 → Bool) → Dec (Is (Derivative ε) (SB ε 0 → Bool) fb02 a)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
141 fl03 a with a sbε | inspect a sbε
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
142 ... | true | record { eq = eq1 } = yes record { a = record { state = ε ; is-derived = unit }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
143 ; fa=c = f-extensionality fl04 } where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
144 fl04 : (x : SB ε 0) → fb02 (record { state = ε ; is-derived = unit }) x ≡ a x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
145 fl04 sbε = sym eq1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
146 ... | false | record { eq = eq1} = no (λ n → ¬-bool {a sbε} eq1 (fl04 n)) where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
147 fl04 : Is (Derivative ε) (SB ε 0 → Bool) fb02 a → a sbε ≡ true
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
148 fl04 n = sym (cong (λ k → k sbε) (Is.fa=c n))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
149 fl05 : {x y : Derivative ε} → fb02 x ≡ fb02 y → x ≡ y
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
150 fl05 {x} {y} eq = ?
364
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
151 SBN φ = ?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
152 SBN (r *) = ?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
153 SBN (r & r₁) = record { rank=n = ? ; f = ? ; sb-inject = ? ; dec = ? }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
154 SBN (r || r₁) = ?
365
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 364
diff changeset
155 SBN < x > = record { rank=n = refl ; f = ? ; sb-inject = ? ; dec = ? }
364
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
156
338
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 337
diff changeset
157 finite-derivative : (r : Regex Σ) → FiniteSet (Derivative r)
364
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 341
diff changeset
158 finite-derivative r = inject-fin (finSBTA r) record { f = SBf.f (SBN r) ; inject = SBf.sb-inject (SBN r) } (SBf.dec (SBN r))
335
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
159
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
160
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 330
diff changeset
161
338
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 337
diff changeset
162