mirror of
https://github.com/Jaxan/ons-hs.git
synced 2025-04-27 14:47:45 +02:00
Small things
This commit is contained in:
parent
7a8591f002
commit
38ddfa5f48
3 changed files with 6 additions and 4 deletions
|
@ -124,12 +124,11 @@ learn mq eq = do
|
|||
learn mq eq
|
||||
True -> do
|
||||
-- Also consistent! Let's build a minimal automaton!
|
||||
let equiv = Set.fromOrbitList . filter (\(s, t) -> equalRows s t suffs table) $ product prefs prefs
|
||||
(f, s) = quotient equiv prefs
|
||||
let (f, st, _) = quotientf 0 (\s t -> s == t || equalRows s t suffs table) prefs
|
||||
trans = Map.fromList . toList . map (\(s, t) -> (s, f ! t)) . filter (\(s, t) -> equalRows s t suffs table) $ product prefsExt prefs
|
||||
trans2 pa = if pa `elem` prefsExt then trans ! pa else f ! pa
|
||||
hypothesis = Automaton
|
||||
{ states = s
|
||||
{ states = map fst st
|
||||
, initialState = f ! []
|
||||
, acceptance = Map.fromList . toList . map (\p -> (f ! p, table ! p)) $ prefs
|
||||
, transition = Map.fromList . toList . map (\(p, a) -> ((f ! p, a), trans2 (ext p a))) $ product prefs alph
|
||||
|
|
|
@ -76,8 +76,8 @@ minimiseB Automaton{..} alph = Automaton
|
|||
|
||||
main :: IO ()
|
||||
main = do
|
||||
-- putStrLn . toStr $ (doubleWordAut 4)
|
||||
putStrLn . toStr $ (minimiseB (doubleWordAut 4) rationals)
|
||||
-- putStrLn . toStr $ (minimiseB (fifoAut 4) fifoAlph)
|
||||
|
||||
|
||||
-- All example automata follow below
|
||||
|
|
|
@ -59,6 +59,9 @@ lookup x (EqMap m) = mapelInv x <$> Map.lookup (toOrbit x) m
|
|||
(!) :: (Nominal k, Ord (Orbit k), Nominal v) => EquivariantMap k v -> k -> v
|
||||
(!) m k = fromMaybe undefined (EquivariantMap.lookup k m)
|
||||
|
||||
(?) :: (Nominal k, Ord (Orbit k), Nominal v) => EquivariantMap k v -> k -> Maybe v
|
||||
(?) m k = EquivariantMap.lookup k m
|
||||
|
||||
-- Construction
|
||||
|
||||
empty :: EquivariantMap k v
|
||||
|
|
Loading…
Add table
Reference in a new issue