> {-# OPTIONS_HADDOCK show-extensions #-}
> {-|
> Module    : LTK.Decide.CB
> Copyright : (c) 2021-2024 Dakotah Lambert
> License   : MIT

> This module implements an algorithm to decide whether a given FSA
> is in CB, the subclass of PT where additionally all elements of
> the syntactic monoid are idempotent. This is additionally a subclass
> of LT, because every submonoid of a semilattice remains a semilattice.
>
> @since 1.0
> -}
> module LTK.Decide.CB (isCB, isCBM, isCBs) where

> import Data.Representation.FiniteSemigroup

> import LTK.FSA
> import LTK.Algebra(SynMon)

> -- |True iff the automaton recognizes a semilattice stringset.
> isCB :: (Ord n, Ord e) => FSA n e -> Bool
> isCB :: forall n e. (Ord n, Ord e) => FSA n e -> Bool
isCB = GeneratedAction -> Bool
forall s. FiniteSemigroupRep s => s -> Bool
isCBs (GeneratedAction -> Bool)
-> (FSA n e -> GeneratedAction) -> FSA n e -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FSA n e -> GeneratedAction
forall n e. (Ord n, Ord e) => FSA n e -> GeneratedAction
syntacticSemigroup

> -- |True iff the monoid is a semilattice.
> isCBM :: (Ord n, Ord e) => SynMon n e -> Bool
> isCBM :: forall n e. (Ord n, Ord e) => SynMon n e -> Bool
isCBM = FSA ([Maybe n], [Symbol e]) e -> Bool
forall n e. (Ord n, Ord e) => FSA n e -> Bool
isCB

> -- |True iff the semigroup is a semilattice.
> --
> -- @since 1.2
> isCBs :: FiniteSemigroupRep s => s -> Bool
> isCBs :: forall s. FiniteSemigroupRep s => s -> Bool
isCBs = (s -> Bool) -> (s -> Bool) -> s -> Bool
forall a. (a -> Bool) -> (a -> Bool) -> a -> Bool
both s -> Bool
forall s. FiniteSemigroupRep s => s -> Bool
isJTrivial s -> Bool
forall s. FiniteSemigroupRep s => s -> Bool
isBand