-- | Compute power-set construction for pairs of sets of states, as described in the article
--   by Courcoubetis and Yannakakis
genPowerSet ::  (Ord q, Ord a) =>
                NBA q a l ->
                M.Map (PowerPair q) [(PowerPair q, a)] ->
                [PowerPair q] -> M.Map (PowerPair q) [(PowerPair q, a)]
genPowerSet a m (p:ps) = let psl' = (pairTrans a p)
                             ps' = [p' | (p', _) <- psl', not (M.member p' m)] in
                              if M.member p m then
                                genPowerSet a m ps
                              else
                                genPowerSet a (M.insert p psl' m) (ps' ++ ps)
genPowerSet ::  (Ord q, Ord a) =>
                NBA q a l ->
                M.Map (PowerPair q) [(PowerPair q, a)] ->
                [PowerPair q] -> M.Map (PowerPair q) [(PowerPair q, a)]
genPowerSet a m (p:ps) = let psl' = (pairTrans a p)
                             ps' = [p' | (p', _) <- psl', not (M.member p' m)] in
                              if M.member p m then
                                genPowerSet a m ps
                              else
                                genPowerSet a (M.insert p psl' m) (ps' ++ ps)
genPowerSet a m (p:ps) = let psl' = (pairTrans a p)
                             ps' = [p' | (p', _) <- psl', not (M.member p' m)] in
                              if M.member p m then
                                genPowerSet a m ps
                              else
                                genPowerSet a (M.insert p psl' m) (ps' ++ ps)