File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -179,21 +179,28 @@ groupEquivStates DFA { dfa_states = statemap }
179
179
]
180
180
#endif
181
181
182
+ refineWith
183
+ :: IntSet -- preimage set that bisects the input equivalence class
184
+ -> IntSet -- initial equivalence class
185
+ -> Maybe (IntSet , IntSet )
186
+ refineWith x y =
187
+ if IS. null y1 || IS. null y2
188
+ then Nothing
189
+ else Just (y1, y2)
190
+ where
191
+ y1 = IS. intersection y x
192
+ y2 = IS. difference y x
193
+
182
194
go0 (r,q) x = go1 r [] []
183
195
where
184
196
go1 [] r' q' = (r', go2 q q')
185
- go1 (y: r) r' q'
186
- | IS. null y1 || IS. null y2 = go1 r (y: r') q'
187
- | IS. size y1 <= IS. size y2 = go1 r (y2: r') (y1: q')
188
- | otherwise = go1 r (y1: r') (y2: q')
189
- where
190
- y1 = IS. intersection x y
191
- y2 = IS. difference y x
197
+ go1 (y: r) r' q' = case refineWith x y of
198
+ Nothing -> go1 r (y: r') q'
199
+ Just (y1, y2)
200
+ | IS. size y1 <= IS. size y2 -> go1 r (y2: r') (y1: q')
201
+ | otherwise -> go1 r (y1: r') (y2: q')
192
202
193
203
go2 [] q' = q'
194
- go2 (y: q) q'
195
- | IS. null y1 || IS. null y2 = go2 q (y: q')
196
- | otherwise = go2 q (y1: y2: q')
197
- where
198
- y1 = IS. intersection x y
199
- y2 = IS. difference y x
204
+ go2 (y: q) q' = case refineWith x y of
205
+ Nothing -> go2 q (y: q')
206
+ Just (y1, y2) -> go2 q (y1: y2: q')
You can’t perform that action at this time.
0 commit comments