annotate agda/regex.agda @ 9:e7bb980408fb

separate epsiron
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 22 Aug 2018 21:59:24 +0900
parents cdf75ae6f0c1
children 8e66865fd9af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 module regex where
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 open import Level renaming ( suc to succ ; zero to Zero )
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
4 -- open import Data.Fin
1
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
5 open import Data.Nat
8
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
6 open import Data.Product
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
7 -- open import Data.List
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
8 open import Data.Maybe
0
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 open import Data.Bool using ( Bool ; true ; false )
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
10 open import Relation.Binary.PropositionalEquality hiding ( [_] )
1
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
11 open import Relation.Nullary using (¬_; Dec; yes; no)
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
12
0
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 data Regex ( Σ : Set ) : Set where
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 _* : Regex Σ → Regex Σ
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 _&_ : Regex Σ → Regex Σ → Regex Σ
1
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
17 _||_ : Regex Σ → Regex Σ → Regex Σ
6
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
18 <_> : Σ → Regex Σ
0
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 -- data In2 : Set where
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 -- a : In2
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 -- b : In2
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 open import automaton
9
e7bb980408fb separate epsiron
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
26 open import epautomaton
0
e5aa1cf746cb automaton lecture
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
1
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
28
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
29 record RST ( Σ : Set )
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
30 : Set where
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
31 inductive
1
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
32 field
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
33 state : ℕ
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
34 move : Maybe Σ → Tree (RST Σ)
8
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
35 cond : Maybe Σ
1
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
36 RSTend : Bool
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
37
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
38 open RST
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
39
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
40 record RNFA ( Σ : Set )
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
41 : Set where
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
42 field
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
43 Rstates : Tree ( RST Σ )
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
44 Rstart : RST Σ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
45 Rend : RST Σ
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
46 Rnum : ℕ
5
f3de819eb3d0 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
47
1
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
48 open RNFA
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
49
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
50 [_] : { Σ : Set} → RST Σ → Tree (RST Σ )
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
51 [ x ] = leaf ( state x ) x
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
52
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
53 [] : { Σ : Set} → Tree (RST Σ )
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
54 [] = empty
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
55
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
56
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
57 infixr 5 _++_
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
58
8
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
59 _++_ : { Q : Set} → Tree Q → Tree Q → Tree Q
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
60 empty ++ t = t
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
61 leaf n e ++ t = insertT n e t
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
62 node n e left right ++ t =
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
63 left ++ ( insertT n e (right ++ t ) )
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
64
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
65 generateRNFA : { Σ : Set } → ( Regex Σ ) → (_≟_ : ( q q' : Σ ) → Dec ( q ≡ q' ) ) → RNFA Σ
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
66 generateRNFA {Σ} regex _≟_ = generate regex (
8
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
67 record { Rstates = [] ; Rstart = record { state = 0 ; move = λ q → [] ; cond = nothing ; RSTend = true } ;
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
68 Rend = record { state = 0 ; move = λ q → [] ; cond = nothing ; RSTend = true } ; Rnum = 1 } )
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
69 where
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
70 literal : Maybe Σ → Σ → ℕ → Tree (RST Σ)
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
71 literal nothing q' n = []
6
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
72 literal (just q) q' n with q ≟ q'
8
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
73 ... | yes _ = [ record { state = n ; move = λ i → empty ; cond = nothing ; RSTend = true } ]
6
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
74 ... | no _ = []
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
75 generate : ( Regex Σ ) → RNFA Σ → RNFA Σ
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
76 generate (x *) R = record R' { Rstart = record (Rstart R') { move = move0 } ;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
77 Rend = record (Rend R') { move = move1 } }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
78 where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
79 R' : RNFA Σ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
80 R' = generate x R
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
81 move0 : Maybe Σ → Tree (RST Σ)
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
82 move0 (just x) = move (Rstart R') (just x )
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
83 move0 nothing = move (Rstart R') nothing ++ [ Rend R' ]
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
84 move1 : Maybe Σ → Tree (RST Σ)
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
85 move1 (just x) = move (Rstart R') (just x )
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
86 move1 nothing = move (Rstart R') nothing ++ [ Rstart R' ] ++ [ Rend R' ]
5
f3de819eb3d0 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
87 generate (x & y) R = record R1 { Rend = Rend R2 ;
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
88 Rstates = Rstates R1 ++ [ Rend R1 ] ++ [ Rstart R2 ] ++ Rstates R2 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
89 where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
90 R2 : RNFA Σ
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
91 R2 = generate y R
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
92 R1 : RNFA Σ
6
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
93 R1 = generate x ( record R2 { Rstart = Rstart R2 ; Rend = Rstart R2 } )
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
94 generate (x || y) R = record R1 { Rstart = Rstart R1 ; Rend = Rend R2 ;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
95 Rstates = [ Rstart R1 ] ++ Rstates R1 ++ [ Rend R1 ] ++ [ Rstart R2 ] ++ Rstates R2 ++ [ Rend R2 ] }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
96 where
6
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
97 R1 : RNFA Σ
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
98 R1 = generate x ( record R { Rnum = Rnum R + 1 } )
5
f3de819eb3d0 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
99 S1 : RST Σ
8
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
100 S1 = record { state = Rnum R ; RSTend = RSTend (Rend R) ; move = λ q → [] ; cond = nothing }
6
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
101 R2 : RNFA Σ
5
f3de819eb3d0 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
102 R2 = generate y ( record R1 { Rstart = S1 ; Rend = S1 } )
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
103 move0 : Maybe Σ → Tree (RST Σ)
5
f3de819eb3d0 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
104 move0 (just x) = move (Rstart R1) (just x )
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
105 move0 nothing = move (Rstart R1) nothing ++ [ Rstart R2 ]
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
106 move1 : Maybe Σ → Tree (RST Σ)
5
f3de819eb3d0 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
107 move1 (just x) = move (Rend R1) (just x )
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
108 move1 nothing = move (Rend R1) nothing ++ [ Rend R2 ]
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
109 generate < x > R = record R {
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
110 Rnum = Rnum R + 1 ;
5
f3de819eb3d0 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
111 Rstart = record {
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
112 state = Rnum R
6
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
113 ; move = λ q → literal q x ( state (Rstart R) )
8
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
114 ; cond = just x
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
115 ; RSTend = false
6
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
116 } ;
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
117 Rstates = [ Rstart R ] ++ Rstates R
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
118 }
1
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
119
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
120 regex2nfa : (regex : Regex In2 ) → εAutomaton (RST In2) In2
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1
diff changeset
121 regex2nfa regex = record {
7
f1fbe6603066 εAutomaton using Tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
122 εδ = move
8
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
123 ; all-εδ = cond1
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
124 ; εid = λ s → state s
6
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
125 ; allState = Rstates G
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
126 ; εstart = Rstart G
3
3ac6311293ec εAutomaton
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
127 ; εend = λ s → RSTend s }
6
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
128 where
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
129 G : RNFA In2
8e8bca295494 regex wrote
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
130 G = generateRNFA regex ieq
8
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
131 GTree : Tree ( Tree (RST In2) )
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
132 GTree = εclosure (Rstates G) move
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
133 cond2 : Maybe (Tree (RST In2) ) → Tree (Maybe In2 × Tree (RST In2))
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
134 cond2 nothing = empty
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
135 cond2 (just empty) = empty
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
136 cond2 (just (leaf n r)) = leaf n ( cond r , move r ( cond r ) )
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
137 cond2 (just (node n r left right )) = cond2 (just left ) ++ leaf n ( cond r , move r ( cond r ) ) ++ cond2 (just right )
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
138 cond1 : RST In2 → Tree (Maybe In2 × Tree (RST In2))
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
139 cond1 s = cond2 ( memberT ( state s ) GTree )
1
3c6de7cf2a95 nfa worked
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
140
8
cdf75ae6f0c1 add subset construction
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
141