toLDBA :: (Ord q, Ord a) =>  NBA q a l           -- ^ The NBA to be converted
          -> NBA (Int, PowerPair q) a ([l], [l]) -- ^ The equivalent LDBA
toLDBA a = let ts = pairTransClosure a [([f],[f]) | f <- S.toList (accept a)]
               ps = concat [[p1, p2] | (p1, _, p2) <- ts]
               ls = [(labels q1 a, labels q2 a) | (q1, q2) <- ps]
               as = [(qs1, qs2) | (qs1, qs2) <- ps, qs1 == qs2]
               part1 = (liftStateToPair a){accept = S.fromList []}
               part2 = makeNBA (zip ps ls) ts [] as
               trans12 = [((1, (qs, [])), l, (2, ([f], [f]))) | f <- S.toList (accept a)
                                                   , (qs, l) <- combine (pres a f)]
               in
                insertTrans trans12 $ buchiUnion part1 part2
toLDBA :: (Ord q, Ord a) =>  NBA q a l           -- ^ The NBA to be converted
          -> NBA (Int, PowerPair q) a ([l], [l])
toLDBA a = let ts = pairTransClosure a [([f],[f]) | f <- S.toList (accept a)]
               ps = concat [[p1, p2] | (p1, _, p2) <- ts]
               ls = [(labels q1 a, labels q2 a) | (q1, q2) <- ps]
               as = [(qs1, qs2) | (qs1, qs2) <- ps, qs1 == qs2]
               part1 = (liftStateToPair a){accept = S.fromList []}
               part2 = makeNBA (zip ps ls) ts [] as
               trans12 = [((1, (qs, [])), l, (2, ([f], [f]))) | f <- S.toList (accept a)
                                                   , (qs, l) <- combine (pres a f)]
               in
                insertTrans trans12 $ buchiUnion part1 part2
toLDBA a = let ts = pairTransClosure a [([f],[f]) | f <- S.toList (accept a)]
               ps = concat [[p1, p2] | (p1, _, p2) <- ts]
               ls = [(labels q1 a, labels q2 a) | (q1, q2) <- ps]
               as = [(qs1, qs2) | (qs1, qs2) <- ps, qs1 == qs2]
               part1 = (liftStateToPair a){accept = S.fromList []}
               part2 = makeNBA (zip ps ls) ts [] as
               trans12 = [((1, (qs, [])), l, (2, ([f], [f]))) | f <- S.toList (accept a)
                                                   , (qs, l) <- combine (pres a f)]
               in
                insertTrans trans12 $ buchiUnion part1 part2