atMost2As – matches all strings over the alphabet {A,B,C}containing at most
two A’s
data DFA state symbol = DFA
{ alphabet :: [symbol]
, states :: [state]
, initial :: state
, transit :: state -> symbol ->state
, accept :: state -> Bool
}
data ABC = A | B | C deriving (Show, Read, Eq, Ord)
— a DFA that accepts all strings over the alphabet {A,B,C}containing at most
— two A’s
atMost2As :: DFA Int ABC
atMost2As = undefined
This is in Haskell and relates to BFAs.
Answer