{-# LANGUAGE CPP, TypeFamilies, DeriveDataTypeable #-} module PGIP.Output.Provers ( formatProvers , prepareFormatProver , Prover , mkProver ) where import PGIP.Output.Formatting import PGIP.Output.Mime import PGIP.Shared (ProverMode (..)) import Logic.Comorphism (AnyComorphism) import Proofs.AbstractState (ProverOrConsChecker) import Common.Json (ppJson, asJson) import Common.ToXml (asXml) import Text.XML.Light (ppTopElement) import Data.Data type ProversFormatter = ProverMode -> [(AnyComorphism, [ProverOrConsChecker])] -> (String, String) formatProvers :: Maybe String -> ProversFormatter formatProvers :: Maybe String -> ProversFormatter formatProvers format :: Maybe String format proverMode :: ProverMode proverMode availableProvers :: [(AnyComorphism, [ProverOrConsChecker])] availableProvers = case Maybe String format of Just "json" -> (String, String) formatAsJSON _ -> (String, String) formatAsXML where computedProvers :: Provers computedProvers :: Provers computedProvers = let proverNames :: [Prover] proverNames = (ProverOrConsChecker -> Prover) -> [ProverOrConsChecker] -> [Prover] forall a b. (a -> b) -> [a] -> [b] map ProverOrConsChecker -> Prover prepareFormatProver ([ProverOrConsChecker] -> [Prover]) -> [ProverOrConsChecker] -> [Prover] forall a b. (a -> b) -> a -> b $ [(AnyComorphism, [ProverOrConsChecker])] -> [ProverOrConsChecker] proversOnly [(AnyComorphism, [ProverOrConsChecker])] availableProvers in case ProverMode proverMode of GlProofs -> Provers emptyProvers { provers :: Maybe [Prover] provers = [Prover] -> Maybe [Prover] forall a. a -> Maybe a Just [Prover] proverNames } GlConsistency -> Provers emptyProvers { consistencyCheckers :: Maybe [Prover] consistencyCheckers = [Prover] -> Maybe [Prover] forall a. a -> Maybe a Just [Prover] proverNames } formatAsJSON :: (String, String) formatAsJSON :: (String, String) formatAsJSON = (String jsonC, Json -> String ppJson (Json -> String) -> Json -> String forall a b. (a -> b) -> a -> b $ Provers -> Json forall a. ToJson a => a -> Json asJson Provers computedProvers) formatAsXML :: (String, String) formatAsXML :: (String, String) formatAsXML = (String xmlC, Element -> String ppTopElement (Element -> String) -> Element -> String forall a b. (a -> b) -> a -> b $ Provers -> Element forall a. ToXml a => a -> Element asXml Provers computedProvers) prepareFormatProver :: ProverOrConsChecker -> Prover prepareFormatProver :: ProverOrConsChecker -> Prover prepareFormatProver = String -> Prover mkProver (String -> Prover) -> (ProverOrConsChecker -> String) -> ProverOrConsChecker -> Prover forall b c a. (b -> c) -> (a -> b) -> a -> c . ProverOrConsChecker -> String internalProverName data Provers = Provers { Provers -> Maybe [Prover] provers :: Maybe [Prover] , Provers -> Maybe [Prover] consistencyCheckers :: Maybe [Prover] } deriving (Int -> Provers -> ShowS [Provers] -> ShowS Provers -> String (Int -> Provers -> ShowS) -> (Provers -> String) -> ([Provers] -> ShowS) -> Show Provers forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Provers] -> ShowS $cshowList :: [Provers] -> ShowS show :: Provers -> String $cshow :: Provers -> String showsPrec :: Int -> Provers -> ShowS $cshowsPrec :: Int -> Provers -> ShowS Show, Typeable, Typeable Provers Constr DataType Typeable Provers => (forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Provers -> c Provers) -> (forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Provers) -> (Provers -> Constr) -> (Provers -> DataType) -> (forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Provers)) -> (forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Provers)) -> ((forall b. Data b => b -> b) -> Provers -> Provers) -> (forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Provers -> r) -> (forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Provers -> r) -> (forall u. (forall d. Data d => d -> u) -> Provers -> [u]) -> (forall u. Int -> (forall d. Data d => d -> u) -> Provers -> u) -> (forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Provers -> m Provers) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Provers -> m Provers) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Provers -> m Provers) -> Data Provers Provers -> Constr Provers -> DataType (forall b. Data b => b -> b) -> Provers -> Provers (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Provers -> c Provers (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Provers forall a. Typeable a => (forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> a -> c a) -> (forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c a) -> (a -> Constr) -> (a -> DataType) -> (forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c a)) -> (forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)) -> ((forall b. Data b => b -> b) -> a -> a) -> (forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r) -> (forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r) -> (forall u. (forall d. Data d => d -> u) -> a -> [u]) -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u) -> (forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> a -> m a) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a) -> Data a forall u. Int -> (forall d. Data d => d -> u) -> Provers -> u forall u. (forall d. Data d => d -> u) -> Provers -> [u] forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Provers -> r forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Provers -> r forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Provers -> m Provers forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Provers -> m Provers forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Provers forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Provers -> c Provers forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Provers) forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Provers) $cProvers :: Constr $tProvers :: DataType gmapMo :: (forall d. Data d => d -> m d) -> Provers -> m Provers $cgmapMo :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Provers -> m Provers gmapMp :: (forall d. Data d => d -> m d) -> Provers -> m Provers $cgmapMp :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Provers -> m Provers gmapM :: (forall d. Data d => d -> m d) -> Provers -> m Provers $cgmapM :: forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Provers -> m Provers gmapQi :: Int -> (forall d. Data d => d -> u) -> Provers -> u $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Provers -> u gmapQ :: (forall d. Data d => d -> u) -> Provers -> [u] $cgmapQ :: forall u. (forall d. Data d => d -> u) -> Provers -> [u] gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Provers -> r $cgmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Provers -> r gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Provers -> r $cgmapQl :: forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Provers -> r gmapT :: (forall b. Data b => b -> b) -> Provers -> Provers $cgmapT :: (forall b. Data b => b -> b) -> Provers -> Provers dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Provers) $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Provers) dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Provers) $cdataCast1 :: forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Provers) dataTypeOf :: Provers -> DataType $cdataTypeOf :: Provers -> DataType toConstr :: Provers -> Constr $ctoConstr :: Provers -> Constr gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Provers $cgunfold :: forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Provers gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Provers -> c Provers $cgfoldl :: forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Provers -> c Provers $cp1Data :: Typeable Provers Data) data Prover = Prover { Prover -> String identifier :: String , Prover -> String name :: String } deriving (Int -> Prover -> ShowS [Prover] -> ShowS Prover -> String (Int -> Prover -> ShowS) -> (Prover -> String) -> ([Prover] -> ShowS) -> Show Prover forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Prover] -> ShowS $cshowList :: [Prover] -> ShowS show :: Prover -> String $cshow :: Prover -> String showsPrec :: Int -> Prover -> ShowS $cshowsPrec :: Int -> Prover -> ShowS Show, Typeable, Typeable Prover Constr DataType Typeable Prover => (forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Prover -> c Prover) -> (forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Prover) -> (Prover -> Constr) -> (Prover -> DataType) -> (forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Prover)) -> (forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Prover)) -> ((forall b. Data b => b -> b) -> Prover -> Prover) -> (forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Prover -> r) -> (forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Prover -> r) -> (forall u. (forall d. Data d => d -> u) -> Prover -> [u]) -> (forall u. Int -> (forall d. Data d => d -> u) -> Prover -> u) -> (forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Prover -> m Prover) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Prover -> m Prover) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Prover -> m Prover) -> Data Prover Prover -> Constr Prover -> DataType (forall b. Data b => b -> b) -> Prover -> Prover (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Prover -> c Prover (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Prover forall a. Typeable a => (forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> a -> c a) -> (forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c a) -> (a -> Constr) -> (a -> DataType) -> (forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c a)) -> (forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)) -> ((forall b. Data b => b -> b) -> a -> a) -> (forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r) -> (forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r) -> (forall u. (forall d. Data d => d -> u) -> a -> [u]) -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u) -> (forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> a -> m a) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a) -> Data a forall u. Int -> (forall d. Data d => d -> u) -> Prover -> u forall u. (forall d. Data d => d -> u) -> Prover -> [u] forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Prover -> r forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Prover -> r forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Prover -> m Prover forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Prover -> m Prover forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Prover forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Prover -> c Prover forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Prover) forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Prover) $cProver :: Constr $tProver :: DataType gmapMo :: (forall d. Data d => d -> m d) -> Prover -> m Prover $cgmapMo :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Prover -> m Prover gmapMp :: (forall d. Data d => d -> m d) -> Prover -> m Prover $cgmapMp :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Prover -> m Prover gmapM :: (forall d. Data d => d -> m d) -> Prover -> m Prover $cgmapM :: forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Prover -> m Prover gmapQi :: Int -> (forall d. Data d => d -> u) -> Prover -> u $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Prover -> u gmapQ :: (forall d. Data d => d -> u) -> Prover -> [u] $cgmapQ :: forall u. (forall d. Data d => d -> u) -> Prover -> [u] gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Prover -> r $cgmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Prover -> r gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Prover -> r $cgmapQl :: forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Prover -> r gmapT :: (forall b. Data b => b -> b) -> Prover -> Prover $cgmapT :: (forall b. Data b => b -> b) -> Prover -> Prover dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Prover) $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Prover) dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Prover) $cdataCast1 :: forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Prover) dataTypeOf :: Prover -> DataType $cdataTypeOf :: Prover -> DataType toConstr :: Prover -> Constr $ctoConstr :: Prover -> Constr gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Prover $cgunfold :: forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Prover gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Prover -> c Prover $cgfoldl :: forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Prover -> c Prover $cp1Data :: Typeable Prover Data) emptyProvers :: Provers emptyProvers :: Provers emptyProvers = Provers :: Maybe [Prover] -> Maybe [Prover] -> Provers Provers { provers :: Maybe [Prover] provers = Maybe [Prover] forall a. Maybe a Nothing, consistencyCheckers :: Maybe [Prover] consistencyCheckers = Maybe [Prover] forall a. Maybe a Nothing } mkProver :: String -> Prover mkProver :: String -> Prover mkProver s :: String s = Prover :: String -> String -> Prover Prover { name :: String name = String s, identifier :: String identifier = ShowS mkNiceProverName String s }