1 module FAkeepcons 2 3 ( keepconsBDFA 4 , keepconsTNFA 5 ) 6 7 8 where 9 10 import Set 11 import FiniteMap 12 13 import Stuff 14 import Options 15 16 import TA 17 import FAtypes 18 import Ids 19 20 import FAuseful 21 22 ---------------------------------------------------------------------------- 23 24 keepconsBDFA :: (Ord a, Show a) => Opts -> BDFA a -> TCons -> BDFA a 25 keepconsBDFA opts (BDFA cons all starts moves) cons0 = 26 let cons1 = cons `intersectSet` cons0 27 moves1 = filterFM (\ t _ -> stcon t `elementOf` cons1) moves 28 b = BDFA cons1 all starts moves1 29 c = usefulBDFA opts b -- todo: really useful doing this? 30 in c 31 32 --------------------------------------------------------------------------- 33 34 keepconsTNFA :: (Ord a, Show a) => Opts -> TNFA a -> TCons -> TNFA a 35 keepconsTNFA opts (TNFA cons all starts moves) cons0 = 36 let cons1 = cons `intersectSet` cons0 37 moves1 = filterFM ( \ _ ts -> not (isEmptySet ts) ) $ 38 mapFM ( \ _ ts -> 39 filterSet ( \ t -> stcon t `elementOf` cons1) ts ) 40 moves 41 b = TNFA cons1 all starts moves1 42 c = usefulTNFA opts b -- todo: really useful doing this? 43 in c 44 45 --------------------------------------------------------------------------- 46