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

> This module implements an algorithm to decide whether a syntactic
> semigroup \(S\) is, on certain submonoids, Piecewise Testable (MePT).
> This is the case iff for each of its idempotents \(e\) it holds that
> \(eXe\) is \(\mathcal{J}\)-trivial, where X is the set generated by
> {ege : ugv=e for some u,v}.
>
> @since 1.0
> -}
> module LTK.Decide.GLPT (isGLPT, isGLPTM, isGLPTs) where

> import Data.Representation.FiniteSemigroup

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

> -- |True iff the syntactic monoid of the automaton is in
> -- \(\mathbf{M_e J}\).
> -- This is a generalization of LPT in the same way that
> -- GLT is a generalization of LT.
> isGLPT :: (Ord n, Ord e) => FSA n e -> Bool
> isGLPT :: forall n e. (Ord n, Ord e) => FSA n e -> Bool
isGLPT = GeneratedAction -> Bool
forall s. FiniteSemigroupRep s => s -> Bool
isGLPTs (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 given monoid is in \(\mathbf{M_e J}\).
> isGLPTM :: (Ord n, Ord e) => SynMon n e -> Bool
> isGLPTM :: forall n e. (Ord n, Ord e) => SynMon n e -> Bool
isGLPTM = FSA ([Maybe n], [Symbol e]) e -> Bool
forall n e. (Ord n, Ord e) => FSA n e -> Bool
isGLPT

> -- |True iff the given semigroup is in \(\mathbf{M_e J}\).
> --
> -- @since 1.2
> isGLPTs :: FiniteSemigroupRep s => s -> Bool
> isGLPTs :: forall s. FiniteSemigroupRep s => s -> Bool
isGLPTs = (FSMult -> Bool) -> [FSMult] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all FSMult -> Bool
forall s. FiniteSemigroupRep s => s -> Bool
isJTrivial ([FSMult] -> Bool) -> (s -> [FSMult]) -> s -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. s -> [FSMult]
forall s. FiniteSemigroupRep s => s -> [FSMult]
emee