{- |
Module      :  ./TPTP/Parse.hs
Description :  A Parser for the TPTP Syntax v6.4.0.11
Copyright   :  (c) Eugen Kuksa University of Magdeburg 2017
License     :  GPLv2 or higher, see LICENSE.txt

Maintainer  :  Eugen Kuksa <kuksa@iks.cs.ovgu.de>
Stability   :  provisional
Portability :  portable

A Parser for the TPTP Input Syntax v6.4.0.11 taken from
<http://www.cs.miami.edu/~tptp/TPTP/SyntaxBNF.html>

References

[1] G. Sutcliffe et al.: The TPTP language grammar in BNF.
    <http://www.cs.miami.edu/~tptp/TPTP/SyntaxBNF.html>

    Note: The implemented version is saved at TPTP/Documents/SyntaxBNF.html

    Note: The names of the data types are aligned with the names of the
    grammar rules at this reference page (modulo case).
-}

module TPTP.Parser ( parseBasicSpec
                   , annotated_formula
                   ) where

import TPTP.AS hiding (name, formulaRole, annotations)
import TPTP.Common

import qualified Common.AnnoState as AnnoState
import qualified Common.AS_Annotation as Annotation
import Common.DebugParser
import Common.GlobalAnnotations (PrefixMap)
import Common.Id (Token (..))
import Common.IRI (IRI (..), iriCurie)
import qualified Common.Lexer as Lexer (pToken)
import Common.Parsec

import Control.Monad (liftM)
import qualified Control.Monad.Fail as Fail
import Data.Char (isAlphaNum, isSpace, ord)
import Prelude hiding (exp, exponent)
import Text.ParserCombinators.Parsec

{- -----------------------------------------------------------------------------
Debug
----------------------------------------------------------------------------- -}

parserTrace :: String -> CharParser st a -> CharParser st a
parserTrace :: String -> CharParser st a -> CharParser st a
parserTrace = String -> CharParser st a -> CharParser st a
forall st a. String -> CharParser st a -> CharParser st a
parserTraceId

{- -----------------------------------------------------------------------------
Logic components
----------------------------------------------------------------------------- -}

parseBasicSpec :: PrefixMap -> AnnoState.AParser st BASIC_SPEC
parseBasicSpec :: PrefixMap -> AParser st BASIC_SPEC
parseBasicSpec _ = String -> AParser st BASIC_SPEC -> AParser st BASIC_SPEC
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "parseBasicSpec" (([Annoted TPTP] -> BASIC_SPEC)
-> ParsecT String (AnnoState st) Identity [Annoted TPTP]
-> AParser st BASIC_SPEC
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM [Annoted TPTP] -> BASIC_SPEC
Basic_spec (ParsecT String (AnnoState st) Identity (Annoted TPTP)
-> ParsecT String (AnnoState st) Identity [Annoted TPTP]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 (ParsecT String (AnnoState st) Identity (Annoted TPTP)
 -> ParsecT String (AnnoState st) Identity [Annoted TPTP])
-> ParsecT String (AnnoState st) Identity (Annoted TPTP)
-> ParsecT String (AnnoState st) Identity [Annoted TPTP]
forall a b. (a -> b) -> a -> b
$ AParser st TPTP
-> ParsecT String (AnnoState st) Identity (Annoted TPTP)
forall st a. AParser st a -> AParser st (Annoted a)
AnnoState.allAnnoParser AParser st TPTP
forall st. CharParser st TPTP
tptp_file)
  AParser st BASIC_SPEC
-> AParser st BASIC_SPEC -> AParser st BASIC_SPEC
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> do
    TPTP
file <- AParser st TPTP
forall st. CharParser st TPTP
tptp_file
    BASIC_SPEC -> AParser st BASIC_SPEC
forall (m :: * -> *) a. Monad m => a -> m a
return (BASIC_SPEC -> AParser st BASIC_SPEC)
-> BASIC_SPEC -> AParser st BASIC_SPEC
forall a b. (a -> b) -> a -> b
$ [Annoted TPTP] -> BASIC_SPEC
Basic_spec [TPTP -> Annoted TPTP
forall a. a -> Annoted a
Annotation.emptyAnno TPTP
file]
  )

{- -----------------------------------------------------------------------------
Files. Empty file is OK
----------------------------------------------------------------------------- -}

-- <TPTP_file>            ::= <TPTP_input>*
tptp_file :: CharParser st TPTP
tptp_file :: CharParser st TPTP
tptp_file = String -> CharParser st TPTP -> CharParser st TPTP
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tptp_file" (do
    CharParser st ()
forall st. CharParser st ()
skip
    [TPTP_input]
inputs <- ParsecT String st Identity TPTP_input
-> ParsecT String st Identity [TPTP_input]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 ParsecT String st Identity TPTP_input
forall st. CharParser st TPTP_input
tptp_input
    TPTP -> CharParser st TPTP
forall (m :: * -> *) a. Monad m => a -> m a
return (TPTP -> CharParser st TPTP) -> TPTP -> CharParser st TPTP
forall a b. (a -> b) -> a -> b
$ [TPTP_input] -> TPTP
TPTP [TPTP_input]
inputs
  CharParser st TPTP -> String -> CharParser st TPTP
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "TPTP_file"
  )

-- <TPTP_input>           ::= <annotated_formula> | <include>
tptp_input :: CharParser st TPTP_input
tptp_input :: CharParser st TPTP_input
tptp_input = String -> CharParser st TPTP_input -> CharParser st TPTP_input
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tptp_input" (
  CharParser st ()
forall st. CharParser st ()
skip CharParser st ()
-> CharParser st TPTP_input -> CharParser st TPTP_input
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ((Annotated_formula -> TPTP_input)
-> ParsecT String st Identity Annotated_formula
-> CharParser st TPTP_input
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Annotated_formula -> TPTP_input
Annotated_formula ParsecT String st Identity Annotated_formula
forall st. CharParser st Annotated_formula
annotated_formula
    CharParser st TPTP_input
-> CharParser st TPTP_input -> CharParser st TPTP_input
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Include -> TPTP_input)
-> ParsecT String st Identity Include -> CharParser st TPTP_input
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Include -> TPTP_input
TPTP_include ParsecT String st Identity Include
forall st. CharParser st Include
include
    CharParser st TPTP_input
-> CharParser st TPTP_input -> CharParser st TPTP_input
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (SystemComment -> TPTP_input)
-> ParsecT String st Identity SystemComment
-> CharParser st TPTP_input
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM SystemComment -> TPTP_input
TPTP_system_comment ParsecT String st Identity SystemComment
forall st. CharParser st SystemComment
system_comment
    CharParser st TPTP_input
-> CharParser st TPTP_input -> CharParser st TPTP_input
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (DefinedComment -> TPTP_input)
-> ParsecT String st Identity DefinedComment
-> CharParser st TPTP_input
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM DefinedComment -> TPTP_input
TPTP_defined_comment ParsecT String st Identity DefinedComment
forall st. CharParser st DefinedComment
defined_comment
    CharParser st TPTP_input
-> CharParser st TPTP_input -> CharParser st TPTP_input
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Comment -> TPTP_input)
-> ParsecT String st Identity Comment -> CharParser st TPTP_input
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Comment -> TPTP_input
TPTP_comment ParsecT String st Identity Comment
forall st. CharParser st Comment
comment
    CharParser st TPTP_input -> String -> CharParser st TPTP_input
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "TPTP_input")
  )

{- -----------------------------------------------------------------------------
Formula records
----------------------------------------------------------------------------- -}

-- <annotated_formula>    ::= <thf_annotated> | <tfx_annotated> | <tff_annotated> |
--                            <tcf_annotated> | <fof_annotated> | <cnf_annotated> |
--                            <tpi_annotated>
annotated_formula :: CharParser st Annotated_formula
annotated_formula :: CharParser st Annotated_formula
annotated_formula = String
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "annotated_formula" (
  CharParser st ()
forall st. CharParser st ()
skip CharParser st ()
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> (CharParser st Annotated_formula
forall st. CharParser st Annotated_formula
thf_annotated
    CharParser st Annotated_formula
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st Annotated_formula
forall st. CharParser st Annotated_formula
tfx_annotated
    CharParser st Annotated_formula
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st Annotated_formula
forall st. CharParser st Annotated_formula
tff_annotated
    CharParser st Annotated_formula
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st Annotated_formula
forall st. CharParser st Annotated_formula
tcf_annotated
    CharParser st Annotated_formula
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st Annotated_formula
forall st. CharParser st Annotated_formula
fof_annotated
    CharParser st Annotated_formula
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st Annotated_formula
forall st. CharParser st Annotated_formula
cnf_annotated
    CharParser st Annotated_formula
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st Annotated_formula
forall st. CharParser st Annotated_formula
tpi_annotated
    CharParser st Annotated_formula
-> String -> CharParser st Annotated_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "annotated_formula")
  )

-- <tpi_annotated>        ::= tpi(<name>,<formula_role>,<tpi_formula><annotations>).
tpi_annotated :: CharParser st Annotated_formula
tpi_annotated :: CharParser st Annotated_formula
tpi_annotated = String
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tpi_annotated" (String
-> CharParser st TPI_formula
-> (Name
    -> Formula_role -> TPI_formula -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
forall st a.
String
-> CharParser st a
-> (Name -> Formula_role -> a -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
formulaAnnotated "tpi" CharParser st TPI_formula
forall st. CharParser st TPI_formula
tpi_formula
  (\ n :: Name
n r :: Formula_role
r f :: TPI_formula
f a :: Annotations
a -> TPI_annotated -> Annotated_formula
AF_TPI_Annotated (TPI_annotated -> Annotated_formula)
-> TPI_annotated -> Annotated_formula
forall a b. (a -> b) -> a -> b
$ Name -> Formula_role -> TPI_formula -> Annotations -> TPI_annotated
TPI_annotated Name
n Formula_role
r TPI_formula
f Annotations
a)
  )

-- <tpi_formula>          ::= <fof_formula>
tpi_formula :: CharParser st TPI_formula
tpi_formula :: CharParser st TPI_formula
tpi_formula = String -> CharParser st TPI_formula -> CharParser st TPI_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tpi_formula" (CharParser st TPI_formula
forall st. CharParser st TPI_formula
fof_formula CharParser st TPI_formula -> String -> CharParser st TPI_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tpi_formula"
  )

-- <thf_annotated>        ::= thf(<name>,<formula_role>,<thf_formula>
--                            <annotations>).
thf_annotated :: CharParser st Annotated_formula
thf_annotated :: CharParser st Annotated_formula
thf_annotated = String
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_annotated" (String
-> CharParser st THF_formula
-> (Name
    -> Formula_role -> THF_formula -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
forall st a.
String
-> CharParser st a
-> (Name -> Formula_role -> a -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
formulaAnnotated "thf" CharParser st THF_formula
forall st. CharParser st THF_formula
thf_formula
  (\ n :: Name
n r :: Formula_role
r f :: THF_formula
f a :: Annotations
a -> THF_annotated -> Annotated_formula
AF_THF_Annotated (THF_annotated -> Annotated_formula)
-> THF_annotated -> Annotated_formula
forall a b. (a -> b) -> a -> b
$ Name -> Formula_role -> THF_formula -> Annotations -> THF_annotated
THF_annotated Name
n Formula_role
r THF_formula
f Annotations
a)
  )

-- <tfx_annotated>        ::= tfx(<name>,<formula_role>,<tfx_formula>
--                            <annotations>).
tfx_annotated :: CharParser st Annotated_formula
tfx_annotated :: CharParser st Annotated_formula
tfx_annotated = String
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tfx_annotated" (String
-> CharParser st TFX_formula
-> (Name
    -> Formula_role -> TFX_formula -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
forall st a.
String
-> CharParser st a
-> (Name -> Formula_role -> a -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
formulaAnnotated "tfx" CharParser st TFX_formula
forall st. CharParser st TFX_formula
tfx_formula
  (\ n :: Name
n r :: Formula_role
r f :: TFX_formula
f a :: Annotations
a -> TFX_annotated -> Annotated_formula
AF_TFX_Annotated (TFX_annotated -> Annotated_formula)
-> TFX_annotated -> Annotated_formula
forall a b. (a -> b) -> a -> b
$ Name -> Formula_role -> TFX_formula -> Annotations -> TFX_annotated
TFX_annotated Name
n Formula_role
r TFX_formula
f Annotations
a)
  )

-- <tff_annotated>        ::= tff(<name>,<formula_role>,<tff_formula>
--                            <annotations>).
tff_annotated :: CharParser st Annotated_formula
tff_annotated :: CharParser st Annotated_formula
tff_annotated = String
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_annotated" (String
-> CharParser st TFF_formula
-> (Name
    -> Formula_role -> TFF_formula -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
forall st a.
String
-> CharParser st a
-> (Name -> Formula_role -> a -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
formulaAnnotated "tff" CharParser st TFF_formula
forall st. CharParser st TFF_formula
tff_formula
  (\ n :: Name
n r :: Formula_role
r f :: TFF_formula
f a :: Annotations
a -> TFF_annotated -> Annotated_formula
AF_TFF_Annotated (TFF_annotated -> Annotated_formula)
-> TFF_annotated -> Annotated_formula
forall a b. (a -> b) -> a -> b
$ Name -> Formula_role -> TFF_formula -> Annotations -> TFF_annotated
TFF_annotated Name
n Formula_role
r TFF_formula
f Annotations
a)
  )

-- <tcf_annotated>        ::= tcf(<name>,<formula_role>,<tcf_formula>
--                            <annotations>).
tcf_annotated :: CharParser st Annotated_formula
tcf_annotated :: CharParser st Annotated_formula
tcf_annotated = String
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tcf_annotated" (String
-> CharParser st TCF_formula
-> (Name
    -> Formula_role -> TCF_formula -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
forall st a.
String
-> CharParser st a
-> (Name -> Formula_role -> a -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
formulaAnnotated "tcf" CharParser st TCF_formula
forall st. CharParser st TCF_formula
tcf_formula
  (\ n :: Name
n r :: Formula_role
r f :: TCF_formula
f a :: Annotations
a -> TCF_annotated -> Annotated_formula
AF_TCF_Annotated (TCF_annotated -> Annotated_formula)
-> TCF_annotated -> Annotated_formula
forall a b. (a -> b) -> a -> b
$ Name -> Formula_role -> TCF_formula -> Annotations -> TCF_annotated
TCF_annotated Name
n Formula_role
r TCF_formula
f Annotations
a)
  )

-- <fof_annotated>        ::= fof(<name>,<formula_role>,<fof_formula>
--                            <annotations>).
fof_annotated :: CharParser st Annotated_formula
fof_annotated :: CharParser st Annotated_formula
fof_annotated = String
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_annotated" (String
-> CharParser st TPI_formula
-> (Name
    -> Formula_role -> TPI_formula -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
forall st a.
String
-> CharParser st a
-> (Name -> Formula_role -> a -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
formulaAnnotated "fof" CharParser st TPI_formula
forall st. CharParser st TPI_formula
fof_formula
  (\ n :: Name
n r :: Formula_role
r f :: TPI_formula
f a :: Annotations
a -> FOF_annotated -> Annotated_formula
AF_FOF_Annotated (FOF_annotated -> Annotated_formula)
-> FOF_annotated -> Annotated_formula
forall a b. (a -> b) -> a -> b
$ Name -> Formula_role -> TPI_formula -> Annotations -> FOF_annotated
FOF_annotated Name
n Formula_role
r TPI_formula
f Annotations
a)
  )

-- <cnf_annotated>        ::= cnf(<name>,<formula_role>,<cnf_formula>
--                            <annotations>).
cnf_annotated :: CharParser st Annotated_formula
cnf_annotated :: CharParser st Annotated_formula
cnf_annotated = String
-> CharParser st Annotated_formula
-> CharParser st Annotated_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "cnf_annotated" (String
-> CharParser st CNF_formula
-> (Name
    -> Formula_role -> CNF_formula -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
forall st a.
String
-> CharParser st a
-> (Name -> Formula_role -> a -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
formulaAnnotated "cnf" CharParser st CNF_formula
forall st. CharParser st CNF_formula
cnf_formula
  (\ n :: Name
n r :: Formula_role
r f :: CNF_formula
f a :: Annotations
a -> CNF_annotated -> Annotated_formula
AF_CNF_Annotated (CNF_annotated -> Annotated_formula)
-> CNF_annotated -> Annotated_formula
forall a b. (a -> b) -> a -> b
$ Name -> Formula_role -> CNF_formula -> Annotations -> CNF_annotated
CNF_annotated Name
n Formula_role
r CNF_formula
f Annotations
a)
  )

formulaAnnotated :: String
                 -> CharParser st a
                 -> (Name -> Formula_role -> a -> Annotations -> Annotated_formula)
                 -> CharParser st Annotated_formula
formulaAnnotated :: String
-> CharParser st a
-> (Name -> Formula_role -> a -> Annotations -> Annotated_formula)
-> CharParser st Annotated_formula
formulaAnnotated keyword :: String
keyword formula :: CharParser st a
formula constructor :: Name -> Formula_role -> a -> Annotations -> Annotated_formula
constructor = do
  String -> CharParser st Token
forall st. String -> CharParser st Token
strTok String
keyword
  (n :: Name
n, r :: Formula_role
r, f :: a
f, a :: Annotations
a) <- CharParser st (Name, Formula_role, a, Annotations)
-> CharParser st (Name, Formula_role, a, Annotations)
forall st a. CharParser st a -> CharParser st a
parens (do
    Name
n <- CharParser st Name
forall st. CharParser st Name
name
    CharParser st Token
forall st. CharParser st Token
commaT
    Formula_role
r <- CharParser st Formula_role
forall st. CharParser st Formula_role
formula_role
    CharParser st Token
forall st. CharParser st Token
commaT
    a
f <- CharParser st a
formula
    Annotations
a <- CharParser st Annotations
forall st. CharParser st Annotations
annotations
    (Name, Formula_role, a, Annotations)
-> CharParser st (Name, Formula_role, a, Annotations)
forall (m :: * -> *) a. Monad m => a -> m a
return (Name
n, Formula_role
r, a
f, Annotations
a))
  CharParser st Token
forall st. CharParser st Token
dotT
  Annotated_formula -> CharParser st Annotated_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (Annotated_formula -> CharParser st Annotated_formula)
-> Annotated_formula -> CharParser st Annotated_formula
forall a b. (a -> b) -> a -> b
$ Name -> Formula_role -> a -> Annotations -> Annotated_formula
constructor Name
n Formula_role
r a
f Annotations
a

-- <annotations>          ::= ,<source><optional_info> | <null>
annotations :: CharParser st Annotations
annotations :: CharParser st Annotations
annotations = String -> CharParser st Annotations -> CharParser st Annotations
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "annotations" ((Maybe (Source, Optional_info) -> Annotations)
-> ParsecT String st Identity (Maybe (Source, Optional_info))
-> CharParser st Annotations
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Maybe (Source, Optional_info) -> Annotations
Annotations ParsecT String st Identity (Maybe (Source, Optional_info))
forall u. ParsecT String u Identity (Maybe (Source, Optional_info))
annotations' CharParser st Annotations -> String -> CharParser st Annotations
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "annotations"
  )
  where
    annotations' :: ParsecT String u Identity (Maybe (Source, Optional_info))
annotations' = ParsecT String u Identity (Source, Optional_info)
-> ParsecT String u Identity (Maybe (Source, Optional_info))
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m (Maybe a)
optionMaybe (ParsecT String u Identity (Source, Optional_info)
 -> ParsecT String u Identity (Maybe (Source, Optional_info)))
-> ParsecT String u Identity (Source, Optional_info)
-> ParsecT String u Identity (Maybe (Source, Optional_info))
forall a b. (a -> b) -> a -> b
$ do
      CharParser u Token
forall st. CharParser st Token
commaT
      Source
s <- CharParser u Source
forall st. CharParser st Source
source
      Optional_info
oi <- CharParser u Optional_info
forall st. CharParser st Optional_info
optional_info
      (Source, Optional_info)
-> ParsecT String u Identity (Source, Optional_info)
forall (m :: * -> *) a. Monad m => a -> m a
return (Source
s, Optional_info
oi)

{- -----------------------------------------------------------------------------
Types for problems.
----------------------------------------------------------------------------- -}

-- %----Types for problems.
-- %----Note: The previous <source_type> from ...
-- %----   <formula_role> ::= <user_role>-<source>
-- %----... is now gone. Parsers may choose to be tolerant of it for backwards
-- %----compatibility.
-- <formula_role>         ::= <lower_word>
-- <formula_role>         :== axiom | hypothesis | definition | assumption |
--                            lemma | theorem | corollary | conjecture |
--                            negated_conjecture | plain | type |
--                            fi_domain | fi_functors | fi_predicates | unknown
formula_role :: CharParser st Formula_role
formula_role :: CharParser st Formula_role
formula_role = String -> CharParser st Formula_role -> CharParser st Formula_role
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "formula_role" ([(String, Formula_role)] -> CharParser st Formula_role
forall a st. [(String, a)] -> CharParser st a
constantsChoice
   [("axiom", Formula_role
Axiom),
    ("hypothesis", Formula_role
Hypothesis),
    ("definition", Formula_role
Definition),
    ("assumption", Formula_role
Assumption),
    ("lemma", Formula_role
Lemma),
    ("theorem", Formula_role
Theorem),
    ("corollary", Formula_role
Corollary),
    ("conjecture", Formula_role
Conjecture),
    ("negated_conjecture", Formula_role
Negated_conjecture),
    ("plain", Formula_role
Plain),
    ("type", Formula_role
Type),
    ("fi_domain", Formula_role
Fi_domain),
    ("fi_functors", Formula_role
Fi_functors),
    ("fi_predicates", Formula_role
Fi_predicates),
    ("unknown", Formula_role
Unknown)]
   CharParser st Formula_role -> String -> CharParser st Formula_role
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "formula_role"
  )



{- -----------------------------------------------------------------------------
THF formulae
----------------------------------------------------------------------------- -}
-- <thf_formula>          ::= <thf_logic_formula> | <thf_sequent>
thf_formula :: CharParser st THF_formula
thf_formula :: CharParser st THF_formula
thf_formula = String -> CharParser st THF_formula -> CharParser st THF_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_formula" ((THF_logic_formula -> THF_formula)
-> ParsecT String st Identity THF_logic_formula
-> CharParser st THF_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_logic_formula -> THF_formula
THFF_logic ParsecT String st Identity THF_logic_formula
forall st. CharParser st THF_logic_formula
thf_logic_formula
  CharParser st THF_formula
-> CharParser st THF_formula -> CharParser st THF_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_sequent -> THF_formula)
-> ParsecT String st Identity THF_sequent
-> CharParser st THF_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_sequent -> THF_formula
THFF_sequent ParsecT String st Identity THF_sequent
forall st. CharParser st THF_sequent
thf_sequent
  CharParser st THF_formula -> String -> CharParser st THF_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_formula"
  )

-- <thf_logic_formula>    ::= <thf_binary_formula> | <thf_unitary_formula> |
--                            <thf_type_formula> | <thf_subtype>
thf_logic_formula :: CharParser st THF_logic_formula
thf_logic_formula :: CharParser st THF_logic_formula
thf_logic_formula = String
-> CharParser st THF_logic_formula
-> CharParser st THF_logic_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_logic_formula" (
  (THF_type_formula -> THF_logic_formula)
-> ParsecT String st Identity THF_type_formula
-> CharParser st THF_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_type_formula -> THF_logic_formula
THFLF_type ParsecT String st Identity THF_type_formula
forall st. CharParser st THF_type_formula
thf_type_formula
  CharParser st THF_logic_formula
-> CharParser st THF_logic_formula
-> CharParser st THF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> do
    THF_unitary_formula
f <- CharParser st THF_unitary_formula
forall st. CharParser st THF_unitary_formula
thf_unitary_formula
    ((THF_binary_formula -> THF_logic_formula)
-> ParsecT String st Identity THF_binary_formula
-> CharParser st THF_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_binary_formula -> THF_logic_formula
THFLF_binary (THF_unitary_formula
-> ParsecT String st Identity THF_binary_formula
forall st. THF_unitary_formula -> CharParser st THF_binary_formula
thf_binary_formula THF_unitary_formula
f)
      CharParser st THF_logic_formula
-> CharParser st THF_logic_formula
-> CharParser st THF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> THF_logic_formula -> CharParser st THF_logic_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_unitary_formula -> THF_logic_formula
THFLF_unitary THF_unitary_formula
f))
  CharParser st THF_logic_formula
-> CharParser st THF_logic_formula
-> CharParser st THF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_subtype -> THF_logic_formula)
-> ParsecT String st Identity THF_subtype
-> CharParser st THF_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_subtype -> THF_logic_formula
THFLF_subtype ParsecT String st Identity THF_subtype
forall st. CharParser st THF_subtype
thf_subtype
  CharParser st THF_logic_formula
-> String -> CharParser st THF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_logic_formula"
  )

-- <thf_binary_formula>   ::= <thf_binary_pair> | <thf_binary_tuple>
thf_binary_formula :: THF_unitary_formula -> CharParser st THF_binary_formula
thf_binary_formula :: THF_unitary_formula -> CharParser st THF_binary_formula
thf_binary_formula f :: THF_unitary_formula
f = String
-> CharParser st THF_binary_formula
-> CharParser st THF_binary_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_binary_formula" (
  (THF_binary_pair -> THF_binary_formula)
-> ParsecT String st Identity THF_binary_pair
-> CharParser st THF_binary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_binary_pair -> THF_binary_formula
THFBF_pair (THF_unitary_formula -> ParsecT String st Identity THF_binary_pair
forall st. THF_unitary_formula -> CharParser st THF_binary_pair
thf_binary_pair THF_unitary_formula
f)
  CharParser st THF_binary_formula
-> CharParser st THF_binary_formula
-> CharParser st THF_binary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_binary_tuple -> THF_binary_formula)
-> ParsecT String st Identity THF_binary_tuple
-> CharParser st THF_binary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_binary_tuple -> THF_binary_formula
THFBF_tuple (THF_unitary_formula -> ParsecT String st Identity THF_binary_tuple
forall st. THF_unitary_formula -> CharParser st THF_binary_tuple
thf_binary_tuple THF_unitary_formula
f)
  CharParser st THF_binary_formula
-> String -> CharParser st THF_binary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_binary_formula"
  )

-- <thf_binary_pair>      ::= <thf_unitary_formula> <thf_pair_connective>
--                            <thf_unitary_formula>
thf_binary_pair :: THF_unitary_formula -> CharParser st THF_binary_pair
thf_binary_pair :: THF_unitary_formula -> CharParser st THF_binary_pair
thf_binary_pair f1 :: THF_unitary_formula
f1 = String
-> CharParser st THF_binary_pair -> CharParser st THF_binary_pair
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_binary_pair" (do
    THF_pair_connective
pc <- GenParser Char st THF_pair_connective
-> GenParser Char st THF_pair_connective
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st THF_pair_connective
forall st. CharParser st THF_pair_connective
thf_pair_connective
    THF_unitary_formula
f2 <- CharParser st THF_unitary_formula
forall st. CharParser st THF_unitary_formula
thf_unitary_formula
    THF_binary_pair -> CharParser st THF_binary_pair
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_binary_pair -> CharParser st THF_binary_pair)
-> THF_binary_pair -> CharParser st THF_binary_pair
forall a b. (a -> b) -> a -> b
$ THF_pair_connective
-> THF_unitary_formula -> THF_unitary_formula -> THF_binary_pair
THF_binary_pair THF_pair_connective
pc THF_unitary_formula
f1 THF_unitary_formula
f2
  CharParser st THF_binary_pair
-> String -> CharParser st THF_binary_pair
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_binary_pair"
  )

-- <thf_binary_tuple>     ::= <thf_or_formula> | <thf_and_formula> |
--                            <thf_apply_formula>
thf_binary_tuple :: THF_unitary_formula -> CharParser st THF_binary_tuple
thf_binary_tuple :: THF_unitary_formula -> CharParser st THF_binary_tuple
thf_binary_tuple f :: THF_unitary_formula
f = String
-> CharParser st THF_binary_tuple -> CharParser st THF_binary_tuple
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_binary_tuple" (
  ((THF_or_formula -> THF_binary_tuple)
-> ParsecT String st Identity THF_or_formula
-> CharParser st THF_binary_tuple
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_or_formula -> THF_binary_tuple
THFBT_or (THF_unitary_formula -> ParsecT String st Identity THF_or_formula
forall st. THF_unitary_formula -> CharParser st THF_or_formula
thf_or_formula THF_unitary_formula
f)
   CharParser st THF_binary_tuple
-> CharParser st THF_binary_tuple -> CharParser st THF_binary_tuple
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_or_formula -> THF_binary_tuple)
-> ParsecT String st Identity THF_or_formula
-> CharParser st THF_binary_tuple
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_or_formula -> THF_binary_tuple
THFBT_and (THF_unitary_formula -> ParsecT String st Identity THF_or_formula
forall st. THF_unitary_formula -> CharParser st THF_or_formula
thf_and_formula THF_unitary_formula
f)
   CharParser st THF_binary_tuple
-> CharParser st THF_binary_tuple -> CharParser st THF_binary_tuple
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_or_formula -> THF_binary_tuple)
-> ParsecT String st Identity THF_or_formula
-> CharParser st THF_binary_tuple
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_or_formula -> THF_binary_tuple
THFBT_apply (THF_unitary_formula -> ParsecT String st Identity THF_or_formula
forall st. THF_unitary_formula -> CharParser st THF_or_formula
thf_apply_formula THF_unitary_formula
f))
  CharParser st THF_binary_tuple
-> String -> CharParser st THF_binary_tuple
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_binary_tuple"
  )

-- <thf_or_formula>       ::= <thf_unitary_formula> <vline> <thf_unitary_formula> |
--                            <thf_or_formula> <vline> <thf_unitary_formula>
thf_or_formula :: THF_unitary_formula -> CharParser st THF_or_formula
thf_or_formula :: THF_unitary_formula -> CharParser st THF_or_formula
thf_or_formula f :: THF_unitary_formula
f = String
-> CharParser st THF_or_formula -> CharParser st THF_or_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_or_formula" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st Token
forall st. CharParser st Token
vline
    THF_or_formula
fs <- CharParser st THF_unitary_formula
forall st. CharParser st THF_unitary_formula
thf_unitary_formula CharParser st THF_unitary_formula
-> GenParser Char st Token -> CharParser st THF_or_formula
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` GenParser Char st Token
forall st. CharParser st Token
vline
    THF_or_formula -> CharParser st THF_or_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_or_formula -> CharParser st THF_or_formula)
-> THF_or_formula -> CharParser st THF_or_formula
forall a b. (a -> b) -> a -> b
$ THF_unitary_formula
f THF_unitary_formula -> THF_or_formula -> THF_or_formula
forall a. a -> [a] -> [a]
: THF_or_formula
fs
  CharParser st THF_or_formula
-> String -> CharParser st THF_or_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_or_formula"
  )

-- <thf_and_formula>      ::= <thf_unitary_formula> & <thf_unitary_formula> |
--                            <thf_and_formula> & <thf_unitary_formula>
thf_and_formula :: THF_unitary_formula -> CharParser st THF_and_formula
thf_and_formula :: THF_unitary_formula -> CharParser st THF_or_formula
thf_and_formula f :: THF_unitary_formula
f = String
-> CharParser st THF_or_formula -> CharParser st THF_or_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_and_formula" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st Token
forall st. CharParser st Token
andT
    THF_or_formula
fs <- CharParser st THF_unitary_formula
forall st. CharParser st THF_unitary_formula
thf_unitary_formula CharParser st THF_unitary_formula
-> GenParser Char st Token -> CharParser st THF_or_formula
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` GenParser Char st Token
forall st. CharParser st Token
andT
    THF_or_formula -> CharParser st THF_or_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_or_formula -> CharParser st THF_or_formula)
-> THF_or_formula -> CharParser st THF_or_formula
forall a b. (a -> b) -> a -> b
$ THF_unitary_formula
f THF_unitary_formula -> THF_or_formula -> THF_or_formula
forall a. a -> [a] -> [a]
: THF_or_formula
fs
  CharParser st THF_or_formula
-> String -> CharParser st THF_or_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_and_formula"
  )

-- <thf_apply_formula>    ::= <thf_unitary_formula> @ <thf_unitary_formula> |
--                            <thf_apply_formula> @ <thf_unitary_formula>
thf_apply_formula :: THF_unitary_formula -> CharParser st THF_apply_formula
thf_apply_formula :: THF_unitary_formula -> CharParser st THF_or_formula
thf_apply_formula f :: THF_unitary_formula
f = String
-> CharParser st THF_or_formula -> CharParser st THF_or_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_apply_formula" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token -> GenParser Char st Token)
-> GenParser Char st Token -> GenParser Char st Token
forall a b. (a -> b) -> a -> b
$ Char -> GenParser Char st Token
forall st. Char -> CharParser st Token
charTok '@'
    THF_or_formula
fs <- CharParser st THF_unitary_formula
forall st. CharParser st THF_unitary_formula
thf_unitary_formula CharParser st THF_unitary_formula
-> GenParser Char st Token -> CharParser st THF_or_formula
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` Char -> GenParser Char st Token
forall st. Char -> CharParser st Token
charTok '@'
    THF_or_formula -> CharParser st THF_or_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_or_formula -> CharParser st THF_or_formula)
-> THF_or_formula -> CharParser st THF_or_formula
forall a b. (a -> b) -> a -> b
$ THF_unitary_formula
f THF_unitary_formula -> THF_or_formula -> THF_or_formula
forall a. a -> [a] -> [a]
: THF_or_formula
fs
  CharParser st THF_or_formula
-> String -> CharParser st THF_or_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_apply_formula"
  )

-- <thf_unitary_formula>  ::= <thf_quantified_formula> | <thf_unary_formula> |
--                            <thf_atom> | <thf_conditional> | <thf_let> |
--                            <thf_tuple> | (<thf_logic_formula>)
thf_unitary_formula :: CharParser st THF_unitary_formula
thf_unitary_formula :: CharParser st THF_unitary_formula
thf_unitary_formula = String
-> CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_unitary_formula" (
  (THF_logic_formula -> THF_unitary_formula)
-> ParsecT String st Identity THF_logic_formula
-> CharParser st THF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_logic_formula -> THF_unitary_formula
THFUF_logic (ParsecT String st Identity THF_logic_formula
-> ParsecT String st Identity THF_logic_formula
forall st a. CharParser st a -> CharParser st a
parens ParsecT String st Identity THF_logic_formula
forall st. CharParser st THF_logic_formula
thf_logic_formula)
  CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_quantified_formula -> THF_unitary_formula)
-> ParsecT String st Identity THF_quantified_formula
-> CharParser st THF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_quantified_formula -> THF_unitary_formula
THFUF_quantified ParsecT String st Identity THF_quantified_formula
forall st. CharParser st THF_quantified_formula
thf_quantified_formula
  CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_unary_formula -> THF_unitary_formula)
-> ParsecT String st Identity THF_unary_formula
-> CharParser st THF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_unary_formula -> THF_unitary_formula
THFUF_unary ParsecT String st Identity THF_unary_formula
forall st. CharParser st THF_unary_formula
thf_unary_formula
  CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_conditional -> THF_unitary_formula)
-> ParsecT String st Identity THF_conditional
-> CharParser st THF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_conditional -> THF_unitary_formula
THFUF_conditional ParsecT String st Identity THF_conditional
forall st. CharParser st THF_conditional
thf_conditional
  CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_let -> THF_unitary_formula)
-> ParsecT String st Identity THF_let
-> CharParser st THF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_let -> THF_unitary_formula
THFUF_let ParsecT String st Identity THF_let
forall st. CharParser st THF_let
thf_let
  CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_atom -> THF_unitary_formula)
-> ParsecT String st Identity THF_atom
-> CharParser st THF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_atom -> THF_unitary_formula
THFUF_atom ParsecT String st Identity THF_atom
forall st. CharParser st THF_atom
thf_atom
  CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
-> CharParser st THF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_tuple -> THF_unitary_formula)
-> ParsecT String st Identity THF_tuple
-> CharParser st THF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_tuple -> THF_unitary_formula
THFUF_tuple ParsecT String st Identity THF_tuple
forall st. CharParser st THF_tuple
thf_tuple
  CharParser st THF_unitary_formula
-> String -> CharParser st THF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_unitary_formula"
  )

-- <thf_quantified_formula> ::= <thf_quantification> <thf_unitary_formula>
thf_quantified_formula :: CharParser st THF_quantified_formula
thf_quantified_formula :: CharParser st THF_quantified_formula
thf_quantified_formula = String
-> CharParser st THF_quantified_formula
-> CharParser st THF_quantified_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_quantified_formula" (do
    THF_quantification
q <- CharParser st THF_quantification
forall st. CharParser st THF_quantification
thf_quantification
    THF_unitary_formula
f <- CharParser st THF_unitary_formula
forall st. CharParser st THF_unitary_formula
thf_unitary_formula
    THF_quantified_formula -> CharParser st THF_quantified_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_quantified_formula -> CharParser st THF_quantified_formula)
-> THF_quantified_formula -> CharParser st THF_quantified_formula
forall a b. (a -> b) -> a -> b
$ THF_quantification -> THF_unitary_formula -> THF_quantified_formula
THF_quantified_formula THF_quantification
q THF_unitary_formula
f
  CharParser st THF_quantified_formula
-> String -> CharParser st THF_quantified_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_quantified_formula"
  )

-- <thf_quantification>   ::= <thf_quantifier> [<thf_variable_list>] :
-- %----@ (denoting apply) is left-associative and lambda is right-associative.
-- %----^ [X] : ^ [Y] : f @ g (where f is a <thf_apply_formula> and g is a
-- %----<thf_unitary_formula>) should be parsed as: (^ [X] : (^ [Y] : f)) @ g.
-- %----That is, g is not in the scope of either lambda.
thf_quantification :: CharParser st THF_quantification
thf_quantification :: CharParser st THF_quantification
thf_quantification = String
-> CharParser st THF_quantification
-> CharParser st THF_quantification
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_quantification" (do
    THF_quantifier
q <- GenParser Char st THF_quantifier
-> GenParser Char st THF_quantifier
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st THF_quantifier
forall st. CharParser st THF_quantifier
thf_quantifier
    THF_variable_list
vars <- CharParser st THF_variable_list -> CharParser st THF_variable_list
forall st a. CharParser st a -> CharParser st a
brackets CharParser st THF_variable_list
forall st. CharParser st THF_variable_list
thf_variable_list
    CharParser st Token
forall st. CharParser st Token
colonT
    THF_quantification -> CharParser st THF_quantification
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_quantification -> CharParser st THF_quantification)
-> THF_quantification -> CharParser st THF_quantification
forall a b. (a -> b) -> a -> b
$ THF_quantifier -> THF_variable_list -> THF_quantification
THF_quantification THF_quantifier
q THF_variable_list
vars
  CharParser st THF_quantification
-> String -> CharParser st THF_quantification
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_quantification"
  )

-- <thf_variable_list>    ::= <thf_variable> | <thf_variable>,<thf_variable_list>
thf_variable_list :: CharParser st THF_variable_list
thf_variable_list :: CharParser st THF_variable_list
thf_variable_list = String
-> CharParser st THF_variable_list
-> CharParser st THF_variable_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_variable_list" (CharParser st THF_variable -> CharParser st THF_variable_list
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st THF_variable
forall st. CharParser st THF_variable
thf_variable CharParser st THF_variable_list
-> String -> CharParser st THF_variable_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_variable_list"
  )

-- <thf_variable>         ::= <thf_typed_variable> | <variable>
thf_variable :: CharParser st THF_variable
thf_variable :: CharParser st THF_variable
thf_variable = String -> CharParser st THF_variable -> CharParser st THF_variable
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_variable" ((THF_typed_variable -> THF_variable)
-> ParsecT String st Identity THF_typed_variable
-> CharParser st THF_variable
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_typed_variable -> THF_variable
THFV_typed ParsecT String st Identity THF_typed_variable
forall st. CharParser st THF_typed_variable
thf_typed_variable CharParser st THF_variable
-> CharParser st THF_variable -> CharParser st THF_variable
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> THF_variable)
-> ParsecT String st Identity Token -> CharParser st THF_variable
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> THF_variable
THFV_variable ParsecT String st Identity Token
forall st. CharParser st Token
variable
  CharParser st THF_variable -> String -> CharParser st THF_variable
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_variable"
  )

-- <thf_typed_variable>   ::= <variable> : <thf_top_level_type>
thf_typed_variable :: CharParser st THF_typed_variable
thf_typed_variable :: CharParser st THF_typed_variable
thf_typed_variable = String
-> CharParser st THF_typed_variable
-> CharParser st THF_typed_variable
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_typed_variable" (do
    Token
v <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
variable GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
colonT)
    THF_top_level_type
tlt <- CharParser st THF_top_level_type
forall st. CharParser st THF_top_level_type
thf_top_level_type
    THF_typed_variable -> CharParser st THF_typed_variable
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_typed_variable -> CharParser st THF_typed_variable)
-> THF_typed_variable -> CharParser st THF_typed_variable
forall a b. (a -> b) -> a -> b
$ Token -> THF_top_level_type -> THF_typed_variable
THF_typed_variable Token
v THF_top_level_type
tlt
  CharParser st THF_typed_variable
-> String -> CharParser st THF_typed_variable
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_typed_variable"
  )

-- %----Unary connectives bind more tightly than binary. The negated formula
-- %----must be ()ed because a ~ is also a term.
-- <thf_unary_formula>    ::= <thf_unary_connective> (<thf_logic_formula>)
thf_unary_formula :: CharParser st THF_unary_formula
thf_unary_formula :: CharParser st THF_unary_formula
thf_unary_formula = String
-> CharParser st THF_unary_formula
-> CharParser st THF_unary_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_unary_formula" (do
    THF_unary_connective
uc <- GenParser Char st THF_unary_connective
-> GenParser Char st THF_unary_connective
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st THF_unary_connective
forall st. CharParser st THF_unary_connective
thf_unary_connective GenParser Char st THF_unary_connective
-> ParsecT String st Identity Token
-> GenParser Char st THF_unary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
oParenT)
    THF_logic_formula
arg <- CharParser st THF_logic_formula
forall st. CharParser st THF_logic_formula
thf_logic_formula CharParser st THF_logic_formula
-> ParsecT String st Identity Token
-> CharParser st THF_logic_formula
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
cParenT
    THF_unary_formula -> CharParser st THF_unary_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_unary_formula -> CharParser st THF_unary_formula)
-> THF_unary_formula -> CharParser st THF_unary_formula
forall a b. (a -> b) -> a -> b
$ THF_unary_connective -> THF_logic_formula -> THF_unary_formula
THF_unary_formula THF_unary_connective
uc THF_logic_formula
arg
  CharParser st THF_unary_formula
-> String -> CharParser st THF_unary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_unary_formula"
  )

-- <thf_atom>             ::= <thf_function> | <variable> | <defined_term> |
--                            <thf_conn_term>
thf_atom :: CharParser st THF_atom
thf_atom :: CharParser st THF_atom
thf_atom = String -> CharParser st THF_atom -> CharParser st THF_atom
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_atom" (
  (THF_function -> THF_atom)
-> ParsecT String st Identity THF_function
-> CharParser st THF_atom
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_function -> THF_atom
THF_atom_function ParsecT String st Identity THF_function
forall st. CharParser st THF_function
thf_function
  CharParser st THF_atom
-> CharParser st THF_atom -> CharParser st THF_atom
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> THF_atom)
-> ParsecT String st Identity Token -> CharParser st THF_atom
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> THF_atom
THF_atom_variable ParsecT String st Identity Token
forall st. CharParser st Token
variable
  CharParser st THF_atom
-> CharParser st THF_atom -> CharParser st THF_atom
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Defined_term -> THF_atom)
-> ParsecT String st Identity Defined_term
-> CharParser st THF_atom
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Defined_term -> THF_atom
THF_atom_defined ParsecT String st Identity Defined_term
forall st. CharParser st Defined_term
defined_term
  CharParser st THF_atom
-> CharParser st THF_atom -> CharParser st THF_atom
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_conn_term -> THF_atom)
-> ParsecT String st Identity THF_conn_term
-> CharParser st THF_atom
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_conn_term -> THF_atom
THF_atom_conn ParsecT String st Identity THF_conn_term
forall st. CharParser st THF_conn_term
thf_conn_term
  CharParser st THF_atom -> String -> CharParser st THF_atom
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_atom"
  )

-- <thf_function>         ::= <thf_plain_term> | <thf_defined_term> |
--                            <thf_system_term>
-- <thf_function>         ::= <atom> | <functor>(<thf_arguments>) |
--                            <defined_functor>(<thf_arguments>) |
--                            <system_functor>(<thf_arguments>)
thf_function :: CharParser st THF_function
thf_function :: CharParser st THF_function
thf_function = String -> CharParser st THF_function -> CharParser st THF_function
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_function" (do
    Token
f <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
functor GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    THF_arguments
args <- CharParser st THF_arguments
forall st. CharParser st THF_arguments
thf_arguments
    THF_function -> CharParser st THF_function
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_function -> CharParser st THF_function)
-> THF_function -> CharParser st THF_function
forall a b. (a -> b) -> a -> b
$ Token -> THF_arguments -> THF_function
THFF_functor Token
f THF_arguments
args
  CharParser st THF_function
-> CharParser st THF_function -> CharParser st THF_function
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Atom -> THF_function)
-> ParsecT String st Identity Atom -> CharParser st THF_function
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Atom -> THF_function
THFF_atom ParsecT String st Identity Atom
forall st. CharParser st Atom
atom
  CharParser st THF_function
-> CharParser st THF_function -> CharParser st THF_function
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> do
    Defined_functor
f <- GenParser Char st Defined_functor
-> GenParser Char st Defined_functor
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Defined_functor
forall st. CharParser st Defined_functor
defined_functor GenParser Char st Defined_functor
-> GenParser Char st Token -> GenParser Char st Defined_functor
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    THF_arguments
args <- CharParser st THF_arguments
forall st. CharParser st THF_arguments
thf_arguments
    THF_function -> CharParser st THF_function
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_function -> CharParser st THF_function)
-> THF_function -> CharParser st THF_function
forall a b. (a -> b) -> a -> b
$ Defined_functor -> THF_arguments -> THF_function
THFF_defined Defined_functor
f THF_arguments
args
  CharParser st THF_function
-> CharParser st THF_function -> CharParser st THF_function
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> do
    Token
f <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
system_functor GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    THF_arguments
args <- CharParser st THF_arguments
forall st. CharParser st THF_arguments
thf_arguments
    THF_function -> CharParser st THF_function
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_function -> CharParser st THF_function)
-> THF_function -> CharParser st THF_function
forall a b. (a -> b) -> a -> b
$ Token -> THF_arguments -> THF_function
THFF_system Token
f THF_arguments
args
  CharParser st THF_function -> String -> CharParser st THF_function
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_function"
  )

-- <thf_conn_term>        ::= <thf_pair_connective> | <assoc_connective> |
--                            <thf_unary_connective>
thf_conn_term :: CharParser st THF_conn_term
thf_conn_term :: CharParser st THF_conn_term
thf_conn_term = String
-> CharParser st THF_conn_term -> CharParser st THF_conn_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_conn_term" (
  (THF_pair_connective -> THF_conn_term)
-> ParsecT String st Identity THF_pair_connective
-> CharParser st THF_conn_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_pair_connective -> THF_conn_term
THFC_pair ParsecT String st Identity THF_pair_connective
forall st. CharParser st THF_pair_connective
thf_pair_connective
  CharParser st THF_conn_term
-> CharParser st THF_conn_term -> CharParser st THF_conn_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Assoc_connective -> THF_conn_term)
-> ParsecT String st Identity Assoc_connective
-> CharParser st THF_conn_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Assoc_connective -> THF_conn_term
THFC_assoc ParsecT String st Identity Assoc_connective
forall st. CharParser st Assoc_connective
assoc_connective
  CharParser st THF_conn_term
-> CharParser st THF_conn_term -> CharParser st THF_conn_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_unary_connective -> THF_conn_term)
-> ParsecT String st Identity THF_unary_connective
-> CharParser st THF_conn_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_unary_connective -> THF_conn_term
THFC_unary ParsecT String st Identity THF_unary_connective
forall st. CharParser st THF_unary_connective
thf_unary_connective
  CharParser st THF_conn_term
-> String -> CharParser st THF_conn_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_conn_term"
  )

-- <thf_conditional>      ::= $ite(<thf_logic_formula>,<thf_logic_formula>,
--                             <thf_logic_formula>)
thf_conditional :: CharParser st THF_conditional
thf_conditional :: CharParser st THF_conditional
thf_conditional = String
-> CharParser st THF_conditional -> CharParser st THF_conditional
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_conditional" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "$ite" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    THF_logic_formula
lf_if <- CharParser st THF_logic_formula
forall st. CharParser st THF_logic_formula
thf_logic_formula
    GenParser Char st Token
forall st. CharParser st Token
commaT
    THF_logic_formula
lf_then <- CharParser st THF_logic_formula
forall st. CharParser st THF_logic_formula
thf_logic_formula
    GenParser Char st Token
forall st. CharParser st Token
commaT
    THF_logic_formula
lf_else <- CharParser st THF_logic_formula
forall st. CharParser st THF_logic_formula
thf_logic_formula
    GenParser Char st Token
forall st. CharParser st Token
cParenT
    THF_conditional -> CharParser st THF_conditional
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_conditional -> CharParser st THF_conditional)
-> THF_conditional -> CharParser st THF_conditional
forall a b. (a -> b) -> a -> b
$ THF_logic_formula
-> THF_logic_formula -> THF_logic_formula -> THF_conditional
THF_conditional THF_logic_formula
lf_if THF_logic_formula
lf_then THF_logic_formula
lf_else
  CharParser st THF_conditional
-> String -> CharParser st THF_conditional
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_conditional"
  )

-- <thf_let>              ::= $let(<thf_unitary_formula>,<thf_formula>)
-- <thf_let>              :== $let(<thf_let_defns>,<thf_formula>)
thf_let :: CharParser st THF_let
thf_let :: CharParser st THF_let
thf_let = String -> CharParser st THF_let -> CharParser st THF_let
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_let" (do
  GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "$let" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
  THF_let_defns
lds <- CharParser st THF_let_defns
forall st. CharParser st THF_let_defns
thf_let_defns
  GenParser Char st Token
forall st. CharParser st Token
commaT
  THF_formula
f <- CharParser st THF_formula
forall st. CharParser st THF_formula
thf_formula
  THF_let -> CharParser st THF_let
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_let -> CharParser st THF_let)
-> THF_let -> CharParser st THF_let
forall a b. (a -> b) -> a -> b
$ THF_let_defns -> THF_formula -> THF_let
THF_let THF_let_defns
lds THF_formula
f
  CharParser st THF_let -> String -> CharParser st THF_let
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_let"
  )

-- <thf_let_defns>        :== <thf_let_defn> | [<thf_let_defn_list>]
thf_let_defns :: CharParser st THF_let_defns
thf_let_defns :: CharParser st THF_let_defns
thf_let_defns = String
-> CharParser st THF_let_defns -> CharParser st THF_let_defns
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_let_defns" (
  (THF_let_defn_list -> THF_let_defns)
-> ParsecT String st Identity THF_let_defn_list
-> CharParser st THF_let_defns
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_let_defn_list -> THF_let_defns
THFLD_many (ParsecT String st Identity THF_let_defn_list
-> ParsecT String st Identity THF_let_defn_list
forall st a. CharParser st a -> CharParser st a
brackets ParsecT String st Identity THF_let_defn_list
forall st. CharParser st THF_let_defn_list
thf_let_defn_list)
  CharParser st THF_let_defns
-> CharParser st THF_let_defns -> CharParser st THF_let_defns
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_let_defn -> THF_let_defns)
-> ParsecT String st Identity THF_let_defn
-> CharParser st THF_let_defns
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_let_defn -> THF_let_defns
THFLD_single ParsecT String st Identity THF_let_defn
forall st. CharParser st THF_let_defn
thf_let_defn
  CharParser st THF_let_defns
-> String -> CharParser st THF_let_defns
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_let_defns"
  )

-- <thf_let_defn_list>    :== <thf_let_defn> | <thf_let_defn>,<thf_let_defn_list>
thf_let_defn_list :: CharParser st THF_let_defn_list
thf_let_defn_list :: CharParser st THF_let_defn_list
thf_let_defn_list = String
-> CharParser st THF_let_defn_list
-> CharParser st THF_let_defn_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_let_defn_list" (
  CharParser st THF_let_defn -> CharParser st THF_let_defn_list
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st THF_let_defn
forall st. CharParser st THF_let_defn
thf_let_defn
  CharParser st THF_let_defn_list
-> String -> CharParser st THF_let_defn_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_let_defn_list"
  )

-- <thf_let_defn>         :== <thf_let_quantified_defn> | <thf_let_plain_defn>
thf_let_defn :: CharParser st THF_let_defn
thf_let_defn :: CharParser st THF_let_defn
thf_let_defn = String -> CharParser st THF_let_defn -> CharParser st THF_let_defn
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_let_defn" (
  (THF_let_quantified_defn -> THF_let_defn)
-> ParsecT String st Identity THF_let_quantified_defn
-> CharParser st THF_let_defn
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_let_quantified_defn -> THF_let_defn
THFLD_quantified ParsecT String st Identity THF_let_quantified_defn
forall st. CharParser st THF_let_quantified_defn
thf_let_quantified_defn
  CharParser st THF_let_defn
-> CharParser st THF_let_defn -> CharParser st THF_let_defn
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_let_plain_defn -> THF_let_defn)
-> ParsecT String st Identity THF_let_plain_defn
-> CharParser st THF_let_defn
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_let_plain_defn -> THF_let_defn
THFLD_plain ParsecT String st Identity THF_let_plain_defn
forall st. CharParser st THF_let_plain_defn
thf_let_plain_defn
  CharParser st THF_let_defn -> String -> CharParser st THF_let_defn
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_let_defn"
  )

-- <thf_let_quantified_defn> :== <thf_quantification> (<thf_let_plain_defn>)
thf_let_quantified_defn :: CharParser st THF_let_quantified_defn
thf_let_quantified_defn :: CharParser st THF_let_quantified_defn
thf_let_quantified_defn = String
-> CharParser st THF_let_quantified_defn
-> CharParser st THF_let_quantified_defn
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_let_quantified_defn" (do
    THF_quantification
q <- CharParser st THF_quantification
forall st. CharParser st THF_quantification
thf_quantification
    THF_let_plain_defn
lpd <- CharParser st THF_let_plain_defn
-> CharParser st THF_let_plain_defn
forall st a. CharParser st a -> CharParser st a
parens CharParser st THF_let_plain_defn
forall st. CharParser st THF_let_plain_defn
thf_let_plain_defn
    THF_let_quantified_defn -> CharParser st THF_let_quantified_defn
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_let_quantified_defn -> CharParser st THF_let_quantified_defn)
-> THF_let_quantified_defn -> CharParser st THF_let_quantified_defn
forall a b. (a -> b) -> a -> b
$ THF_quantification -> THF_let_plain_defn -> THF_let_quantified_defn
THF_let_quantified_defn THF_quantification
q THF_let_plain_defn
lpd
  CharParser st THF_let_quantified_defn
-> String -> CharParser st THF_let_quantified_defn
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_let_quantified_defn"
  )

-- <thf_let_plain_defn>   :== <thf_let_defn_LHS> <assignment> <thf_formula>
thf_let_plain_defn :: CharParser st THF_let_plain_defn
thf_let_plain_defn :: CharParser st THF_let_plain_defn
thf_let_plain_defn = String
-> CharParser st THF_let_plain_defn
-> CharParser st THF_let_plain_defn
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_let_plain_defn" (do
    THF_let_defn_LHS
lhs <- CharParser st THF_let_defn_LHS
forall st. CharParser st THF_let_defn_LHS
thf_let_defn_LHS
    CharParser st Token
forall st. CharParser st Token
assignment
    THF_formula
f <- CharParser st THF_formula
forall st. CharParser st THF_formula
thf_formula
    THF_let_plain_defn -> CharParser st THF_let_plain_defn
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_let_plain_defn -> CharParser st THF_let_plain_defn)
-> THF_let_plain_defn -> CharParser st THF_let_plain_defn
forall a b. (a -> b) -> a -> b
$ THF_let_defn_LHS -> THF_formula -> THF_let_plain_defn
THF_let_plain_defn THF_let_defn_LHS
lhs THF_formula
f
  CharParser st THF_let_plain_defn
-> String -> CharParser st THF_let_plain_defn
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_let_plain_defn"
  )

-- <thf_let_defn_LHS>     :== <thf_plain_term> | <thf_tuple>
-- <thf_let_defn_LHS>     :== <constant> | <functor>(<fof_arguments>) |
--                            <thf_tuple>
-- %----The <fof_arguments> must all be <variable>s, and the <thf_tuple> may
-- %----contain only <constant>s and <functor>(<fof_arguments>)s
thf_let_defn_LHS :: CharParser st THF_let_defn_LHS
thf_let_defn_LHS :: CharParser st THF_let_defn_LHS
thf_let_defn_LHS = String
-> CharParser st THF_let_defn_LHS -> CharParser st THF_let_defn_LHS
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_let_defn_LHS" ((THF_tuple -> THF_let_defn_LHS)
-> ParsecT String st Identity THF_tuple
-> CharParser st THF_let_defn_LHS
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_tuple -> THF_let_defn_LHS
THFLDL_tuple ParsecT String st Identity THF_tuple
forall st. CharParser st THF_tuple
thf_tuple
  CharParser st THF_let_defn_LHS
-> CharParser st THF_let_defn_LHS -> CharParser st THF_let_defn_LHS
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> do
    Token
f <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
functor GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    FOF_arguments
args <- CharParser st FOF_arguments
forall st. CharParser st FOF_arguments
fof_arguments
    if FOF_arguments -> Bool
onlyVariables FOF_arguments
args
    then THF_let_defn_LHS -> CharParser st THF_let_defn_LHS
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_let_defn_LHS -> CharParser st THF_let_defn_LHS)
-> THF_let_defn_LHS -> CharParser st THF_let_defn_LHS
forall a b. (a -> b) -> a -> b
$ Token -> FOF_arguments -> THF_let_defn_LHS
THFLDL_functor Token
f FOF_arguments
args
    else String -> CharParser st THF_let_defn_LHS
forall (m :: * -> *) a. MonadFail m => String -> m a
Fail.fail "thf_let_defn_LHS: The <fof_arguments> must all be <variable>s."
  CharParser st THF_let_defn_LHS
-> CharParser st THF_let_defn_LHS -> CharParser st THF_let_defn_LHS
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> THF_let_defn_LHS)
-> GenParser Char st Token -> CharParser st THF_let_defn_LHS
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> THF_let_defn_LHS
THFLDL_constant GenParser Char st Token
forall st. CharParser st Token
constant
  CharParser st THF_let_defn_LHS
-> String -> CharParser st THF_let_defn_LHS
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_let_defn_LHS"
  )
  where
    onlyVariables :: FOF_arguments -> Bool
    onlyVariables :: FOF_arguments -> Bool
onlyVariables = (FOF_term -> Bool) -> FOF_arguments -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all FOF_term -> Bool
isVariable

    isVariable :: FOF_term -> Bool
    isVariable :: FOF_term -> Bool
isVariable t :: FOF_term
t = case FOF_term
t of
      FOFT_variable _ -> Bool
True
      _ -> Bool
False

-- <thf_arguments>        ::= <thf_formula_list>
thf_arguments :: CharParser st THF_arguments
thf_arguments :: CharParser st THF_arguments
thf_arguments = String
-> CharParser st THF_arguments -> CharParser st THF_arguments
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_arguments" (CharParser st THF_arguments
forall st. CharParser st THF_arguments
thf_formula_list CharParser st THF_arguments
-> String -> CharParser st THF_arguments
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_arguments"
  )

-- The thf_type_formula rule is ambiguous in the following.
-- Here, it is split into
-- thf_type_formula_typeable and
-- thf_type_formula_constant
-- <thf_type_formula>     ::= <thf_typeable_formula> : <thf_top_level_type>
-- <thf_type_formula>     :== <constant> : <thf_top_level_type>
thf_type_formula :: CharParser st THF_type_formula
thf_type_formula :: CharParser st THF_type_formula
thf_type_formula = String
-> CharParser st THF_type_formula -> CharParser st THF_type_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_type_formula" (CharParser st THF_type_formula
forall st. CharParser st THF_type_formula
thf_type_formula_constant CharParser st THF_type_formula
-> CharParser st THF_type_formula -> CharParser st THF_type_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st THF_type_formula
forall st. CharParser st THF_type_formula
thf_type_formula_typeable
  CharParser st THF_type_formula
-> String -> CharParser st THF_type_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_type_formula"
  )
  where
    -- <thf_type_formula>     ::= <thf_typeable_formula> : <thf_top_level_type>
    thf_type_formula_typeable :: CharParser st THF_type_formula
    thf_type_formula_typeable :: CharParser st THF_type_formula
thf_type_formula_typeable = String
-> CharParser st THF_type_formula -> CharParser st THF_type_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_type_formula_typeable" (do
        THF_typeable_formula
tf <- GenParser Char st THF_typeable_formula
-> GenParser Char st THF_typeable_formula
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st THF_typeable_formula
forall st. CharParser st THF_typeable_formula
thf_typeable_formula GenParser Char st THF_typeable_formula
-> ParsecT String st Identity Token
-> GenParser Char st THF_typeable_formula
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
colonT)
        THF_top_level_type
tlt <- CharParser st THF_top_level_type
forall st. CharParser st THF_top_level_type
thf_top_level_type
        THF_type_formula -> CharParser st THF_type_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_type_formula -> CharParser st THF_type_formula)
-> THF_type_formula -> CharParser st THF_type_formula
forall a b. (a -> b) -> a -> b
$ THF_typeable_formula -> THF_top_level_type -> THF_type_formula
THFTF_typeable THF_typeable_formula
tf THF_top_level_type
tlt
      CharParser st THF_type_formula
-> String -> CharParser st THF_type_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_type_formula"
      )

    -- <thf_type_formula>     :== <constant> : <thf_top_level_type>
    thf_type_formula_constant :: CharParser st THF_type_formula
    thf_type_formula_constant :: CharParser st THF_type_formula
thf_type_formula_constant = String
-> CharParser st THF_type_formula -> CharParser st THF_type_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_type_formula_constant" (do
        Token
c <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
constant GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
colonT)
        THF_top_level_type
tlt <- CharParser st THF_top_level_type
forall st. CharParser st THF_top_level_type
thf_top_level_type
        THF_type_formula -> CharParser st THF_type_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_type_formula -> CharParser st THF_type_formula)
-> THF_type_formula -> CharParser st THF_type_formula
forall a b. (a -> b) -> a -> b
$ Token -> THF_top_level_type -> THF_type_formula
THFTF_constant Token
c THF_top_level_type
tlt
      CharParser st THF_type_formula
-> String -> CharParser st THF_type_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_type_formula"
      )

-- <thf_typeable_formula> ::= <thf_atom> | (<thf_logic_formula>)
thf_typeable_formula :: CharParser st THF_typeable_formula
thf_typeable_formula :: CharParser st THF_typeable_formula
thf_typeable_formula = String
-> CharParser st THF_typeable_formula
-> CharParser st THF_typeable_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_typeable_formula" (
  (THF_logic_formula -> THF_typeable_formula)
-> ParsecT String st Identity THF_logic_formula
-> CharParser st THF_typeable_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_logic_formula -> THF_typeable_formula
THFTF_logic (ParsecT String st Identity THF_logic_formula
-> ParsecT String st Identity THF_logic_formula
forall st a. CharParser st a -> CharParser st a
parens ParsecT String st Identity THF_logic_formula
forall st. CharParser st THF_logic_formula
thf_logic_formula) CharParser st THF_typeable_formula
-> CharParser st THF_typeable_formula
-> CharParser st THF_typeable_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_atom -> THF_typeable_formula)
-> ParsecT String st Identity THF_atom
-> CharParser st THF_typeable_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_atom -> THF_typeable_formula
THFTF_atom (ParsecT String st Identity THF_atom
forall st. CharParser st THF_atom
thf_atom)
  CharParser st THF_typeable_formula
-> String -> CharParser st THF_typeable_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_typeable_formula"
  )

-- <thf_subtype>          ::= <thf_atom> <subtype_sign> <thf_atom>
thf_subtype :: CharParser st THF_subtype
thf_subtype :: CharParser st THF_subtype
thf_subtype = String -> CharParser st THF_subtype -> CharParser st THF_subtype
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_subtype" ((do
  THF_atom
c1 <- GenParser Char st THF_atom -> GenParser Char st THF_atom
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st THF_atom
forall st. CharParser st THF_atom
thf_atom GenParser Char st THF_atom
-> ParsecT String st Identity Token -> GenParser Char st THF_atom
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
subtype_sign)
  THF_atom
c2 <- GenParser Char st THF_atom
forall st. CharParser st THF_atom
thf_atom
  THF_subtype -> CharParser st THF_subtype
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_subtype -> CharParser st THF_subtype)
-> THF_subtype -> CharParser st THF_subtype
forall a b. (a -> b) -> a -> b
$ THF_atom -> THF_atom -> THF_subtype
THF_subtype THF_atom
c1 THF_atom
c2)
  CharParser st THF_subtype -> String -> CharParser st THF_subtype
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_subtype"
  )


-- %----<thf_top_level_type> appears after ":", where a type is being specified
-- %----for a term or variable. <thf_unitary_type> includes <thf_unitary_formula>,
-- %----so the syntax allows just about any lambda expression with "enough"
-- %----parentheses to serve as a type. The expected use of this flexibility is
-- %----parametric polymorphism in types, expressed with lambda abstraction.
-- %----Mapping is right-associative: o > o > o means o > (o > o).
-- %----Xproduct is left-associative: o * o * o means (o * o) * o.
-- %----Union is left-associative: o + o + o means (o + o) + o.
-- <thf_top_level_type>   ::= <thf_unitary_type> | <thf_mapping_type>
thf_top_level_type :: CharParser st THF_top_level_type
thf_top_level_type :: CharParser st THF_top_level_type
thf_top_level_type = String
-> CharParser st THF_top_level_type
-> CharParser st THF_top_level_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_top_level_type" (
  (THF_mapping_type -> THF_top_level_type)
-> ParsecT String st Identity THF_mapping_type
-> CharParser st THF_top_level_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_mapping_type -> THF_top_level_type
THFTLT_mapping ParsecT String st Identity THF_mapping_type
forall st. CharParser st THF_mapping_type
thf_mapping_type
  CharParser st THF_top_level_type
-> CharParser st THF_top_level_type
-> CharParser st THF_top_level_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_unitary_type -> THF_top_level_type)
-> ParsecT String st Identity THF_unitary_type
-> CharParser st THF_top_level_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_unitary_type -> THF_top_level_type
THFTLT_unitary ParsecT String st Identity THF_unitary_type
forall st. CharParser st THF_unitary_type
thf_unitary_type
  CharParser st THF_top_level_type
-> String -> CharParser st THF_top_level_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_top_level_type"
  )

-- <thf_unitary_type>     ::= <thf_unitary_formula> | (<thf_binary_type>)
thf_unitary_type :: CharParser st THF_unitary_type
thf_unitary_type :: CharParser st THF_unitary_type
thf_unitary_type = String
-> CharParser st THF_unitary_type -> CharParser st THF_unitary_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_unitary_type" (
  (THF_binary_type -> THF_unitary_type)
-> ParsecT String st Identity THF_binary_type
-> CharParser st THF_unitary_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_binary_type -> THF_unitary_type
THFUT_binary (ParsecT String st Identity THF_binary_type
-> ParsecT String st Identity THF_binary_type
forall st a. CharParser st a -> CharParser st a
parens ParsecT String st Identity THF_binary_type
forall st. CharParser st THF_binary_type
thf_binary_type)
  CharParser st THF_unitary_type
-> CharParser st THF_unitary_type -> CharParser st THF_unitary_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_unitary_formula -> THF_unitary_type)
-> ParsecT String st Identity THF_unitary_formula
-> CharParser st THF_unitary_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_unitary_formula -> THF_unitary_type
THFUT_unitary ParsecT String st Identity THF_unitary_formula
forall st. CharParser st THF_unitary_formula
thf_unitary_formula
  CharParser st THF_unitary_type
-> String -> CharParser st THF_unitary_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_unitary_type"
  )

-- <thf_binary_type>      ::= <thf_mapping_type> | <thf_xprod_type> |
--                            <thf_union_type>
thf_binary_type :: CharParser st THF_binary_type
thf_binary_type :: CharParser st THF_binary_type
thf_binary_type = String
-> CharParser st THF_binary_type -> CharParser st THF_binary_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_binary_type" (
  (THF_mapping_type -> THF_binary_type)
-> ParsecT String st Identity THF_mapping_type
-> CharParser st THF_binary_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_mapping_type -> THF_binary_type
THFBT_mapping ParsecT String st Identity THF_mapping_type
forall st. CharParser st THF_mapping_type
thf_mapping_type
  CharParser st THF_binary_type
-> CharParser st THF_binary_type -> CharParser st THF_binary_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_mapping_type -> THF_binary_type)
-> ParsecT String st Identity THF_mapping_type
-> CharParser st THF_binary_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_mapping_type -> THF_binary_type
THFBT_xprod ParsecT String st Identity THF_mapping_type
forall st. CharParser st THF_mapping_type
thf_xprod_type
  CharParser st THF_binary_type
-> CharParser st THF_binary_type -> CharParser st THF_binary_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_mapping_type -> THF_binary_type)
-> ParsecT String st Identity THF_mapping_type
-> CharParser st THF_binary_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_mapping_type -> THF_binary_type
THFBT_union ParsecT String st Identity THF_mapping_type
forall st. CharParser st THF_mapping_type
thf_union_type
  CharParser st THF_binary_type
-> String -> CharParser st THF_binary_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_binary_type"
  )

-- <thf_mapping_type>     ::= <thf_unitary_type> <arrow> <thf_unitary_type> |
--                            <thf_unitary_type> <arrow> <thf_mapping_type>
thf_mapping_type :: CharParser st THF_mapping_type
thf_mapping_type :: CharParser st THF_mapping_type
thf_mapping_type = String
-> CharParser st THF_mapping_type -> CharParser st THF_mapping_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_mapping_type" (do
    THF_unitary_type
t <- GenParser Char st THF_unitary_type
-> GenParser Char st THF_unitary_type
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st THF_unitary_type
forall st. CharParser st THF_unitary_type
thf_unitary_type GenParser Char st THF_unitary_type
-> ParsecT String st Identity Token
-> GenParser Char st THF_unitary_type
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
arrowT)
    THF_mapping_type
ts <- GenParser Char st THF_unitary_type
forall st. CharParser st THF_unitary_type
thf_unitary_type GenParser Char st THF_unitary_type
-> ParsecT String st Identity Token
-> CharParser st THF_mapping_type
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` ParsecT String st Identity Token
forall st. CharParser st Token
arrowT
    THF_mapping_type -> CharParser st THF_mapping_type
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_mapping_type -> CharParser st THF_mapping_type)
-> THF_mapping_type -> CharParser st THF_mapping_type
forall a b. (a -> b) -> a -> b
$ THF_unitary_type
t THF_unitary_type -> THF_mapping_type -> THF_mapping_type
forall a. a -> [a] -> [a]
: THF_mapping_type
ts
  CharParser st THF_mapping_type
-> String -> CharParser st THF_mapping_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_mapping_type"
  )

-- <thf_xprod_type>       ::= <thf_unitary_type> <star> <thf_unitary_type> |
--                            <thf_xprod_type> <star> <thf_unitary_type>
thf_xprod_type :: CharParser st THF_xprod_type
thf_xprod_type :: CharParser st THF_mapping_type
thf_xprod_type = String
-> CharParser st THF_mapping_type -> CharParser st THF_mapping_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_xprod_type" (do
    THF_unitary_type
t <- GenParser Char st THF_unitary_type
-> GenParser Char st THF_unitary_type
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st THF_unitary_type
forall st. CharParser st THF_unitary_type
thf_unitary_type GenParser Char st THF_unitary_type
-> ParsecT String st Identity Token
-> GenParser Char st THF_unitary_type
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
starT)
    THF_mapping_type
ts <- GenParser Char st THF_unitary_type
forall st. CharParser st THF_unitary_type
thf_unitary_type GenParser Char st THF_unitary_type
-> ParsecT String st Identity Token
-> CharParser st THF_mapping_type
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` ParsecT String st Identity Token
forall st. CharParser st Token
starT
    THF_mapping_type -> CharParser st THF_mapping_type
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_mapping_type -> CharParser st THF_mapping_type)
-> THF_mapping_type -> CharParser st THF_mapping_type
forall a b. (a -> b) -> a -> b
$ THF_unitary_type
t THF_unitary_type -> THF_mapping_type -> THF_mapping_type
forall a. a -> [a] -> [a]
: THF_mapping_type
ts
  CharParser st THF_mapping_type
-> String -> CharParser st THF_mapping_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_xprod_type"
  )

-- <thf_union_type>       ::= <thf_unitary_type> <plus> <thf_unitary_type> |
--                            <thf_union_type> <plus> <thf_unitary_type>
thf_union_type :: CharParser st THF_union_type
thf_union_type :: CharParser st THF_mapping_type
thf_union_type = String
-> CharParser st THF_mapping_type -> CharParser st THF_mapping_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_union_type" (do
    THF_unitary_type
t <- GenParser Char st THF_unitary_type
-> GenParser Char st THF_unitary_type
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st THF_unitary_type
forall st. CharParser st THF_unitary_type
thf_unitary_type GenParser Char st THF_unitary_type
-> ParsecT String st Identity Token
-> GenParser Char st THF_unitary_type
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
plusT)
    THF_mapping_type
ts <- GenParser Char st THF_unitary_type
forall st. CharParser st THF_unitary_type
thf_unitary_type GenParser Char st THF_unitary_type
-> ParsecT String st Identity Token
-> CharParser st THF_mapping_type
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` ParsecT String st Identity Token
forall st. CharParser st Token
plusT
    THF_mapping_type -> CharParser st THF_mapping_type
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_mapping_type -> CharParser st THF_mapping_type)
-> THF_mapping_type -> CharParser st THF_mapping_type
forall a b. (a -> b) -> a -> b
$ THF_unitary_type
t THF_unitary_type -> THF_mapping_type -> THF_mapping_type
forall a. a -> [a] -> [a]
: THF_mapping_type
ts
  CharParser st THF_mapping_type
-> String -> CharParser st THF_mapping_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_union_type"
  )

-- <thf_sequent>          ::= <thf_tuple> <gentzen_arrow> <thf_tuple> |
--                            (<thf_sequent>)
thf_sequent :: CharParser st THF_sequent
thf_sequent :: CharParser st THF_sequent
thf_sequent = String -> CharParser st THF_sequent -> CharParser st THF_sequent
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_sequent" (do
    THF_tuple
t1 <- GenParser Char st THF_tuple -> GenParser Char st THF_tuple
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st THF_tuple
forall st. CharParser st THF_tuple
thf_tuple GenParser Char st THF_tuple
-> ParsecT String st Identity Token -> GenParser Char st THF_tuple
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
gentzen_arrow)
    THF_tuple
t2 <- GenParser Char st THF_tuple
forall st. CharParser st THF_tuple
thf_tuple
    THF_sequent -> CharParser st THF_sequent
forall (m :: * -> *) a. Monad m => a -> m a
return (THF_sequent -> CharParser st THF_sequent)
-> THF_sequent -> CharParser st THF_sequent
forall a b. (a -> b) -> a -> b
$ THF_tuple -> THF_tuple -> THF_sequent
THFS_plain THF_tuple
t1 THF_tuple
t2
  CharParser st THF_sequent
-> CharParser st THF_sequent -> CharParser st THF_sequent
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_sequent -> THF_sequent)
-> CharParser st THF_sequent -> CharParser st THF_sequent
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_sequent -> THF_sequent
THFS_parens (CharParser st THF_sequent -> CharParser st THF_sequent
forall st a. CharParser st a -> CharParser st a
parens CharParser st THF_sequent
forall st. CharParser st THF_sequent
thf_sequent)
  CharParser st THF_sequent -> String -> CharParser st THF_sequent
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_sequent"
  )

-- <thf_tuple>            ::= [] | [<thf_formula_list>]
thf_tuple :: CharParser st THF_tuple
thf_tuple :: CharParser st THF_tuple
thf_tuple = String -> CharParser st THF_tuple -> CharParser st THF_tuple
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_tuple" (
  (THF_arguments -> THF_tuple)
-> ParsecT String st Identity THF_arguments
-> CharParser st THF_tuple
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_arguments -> THF_tuple
THF_tuple (ParsecT String st Identity THF_arguments
forall st a. CharParser st [a]
emptyBrackets ParsecT String st Identity THF_arguments
-> ParsecT String st Identity THF_arguments
-> ParsecT String st Identity THF_arguments
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ParsecT String st Identity THF_arguments
-> ParsecT String st Identity THF_arguments
forall st a. CharParser st a -> CharParser st a
brackets ParsecT String st Identity THF_arguments
forall st. CharParser st THF_arguments
thf_formula_list)
  CharParser st THF_tuple -> String -> CharParser st THF_tuple
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_tuple"
  )

-- <thf_formula_list>     ::= <thf_logic_formula> |
--                            <thf_logic_formula>,<thf_formula_list>
thf_formula_list :: CharParser st THF_formula_list
thf_formula_list :: CharParser st THF_arguments
thf_formula_list = String
-> CharParser st THF_arguments -> CharParser st THF_arguments
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_formula_list" (CharParser st THF_logic_formula -> CharParser st THF_arguments
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st THF_logic_formula
forall st. CharParser st THF_logic_formula
thf_logic_formula CharParser st THF_arguments
-> String -> CharParser st THF_arguments
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_formula_list"
  )


-- NOTE: not used
-- %----New material for modal logic semantics, not integrated yet
-- -- <logic_defn_rule>      :== <logic_defn_LHS> <assignment> <logic_defn_RHS>
-- logic_defn_rule :: CharParser st Logic_defn_rule
-- logic_defn_rule = (do
--   lhs <- logic_defn_LHS
--   assignment
--   rhs <- logic_defn_RHS
--   return $ Logic_defn_rule lhs rhs)
--   <?> "logic_defn_rule"
--
-- NOTE: not used
-- -- <logic_defn_LHS>       :== <logic_defn_value> | <thf_top_level_type>  | <name>
-- -- <logic_defn_LHS>       :== $constants | $quantification | $consequence |
-- --                            $modalities
-- logic_defn_LHS :: CharParser st Logic_defn_LHS
-- logic_defn_LHS = (constantsChoice
--   [("$constants", LDLC_constants),
--    ("$quantification", LDLC_quantification),
--    ("$consequence", LDLC_consequence),
--    ("$modalities", LDLC_modalities)])
--   <|> liftM Logic_defn_LHS_value logic_defn_value
--   <|> liftM Logic_defn_LHS_THF_Top_level_type thf_top_level_type
--   <|> liftM Logic_defn_LHS_name name
--   <?> "logic_defn_LHS"
--
-- NOTE: not used
-- -- <logic_defn_RHS>       :== <logic_defn_value> | <thf_unitary_formula>
-- logic_defn_RHS :: CharParser st Logic_defn_RHS
-- logic_defn_RHS = logic_defn_value' <|> thf_unitary_formula'
--   <?> "logic_defn_RHS"
--   where
--     logic_defn_value' = liftM Logic_defn_RHS_value logic_defn_value
--     thf_unitary_formula' =
--       liftM Logic_defn_RNG_THF_Unitary_forumla thf_unitary_formula
--
-- NOTE: not used
-- -- <logic_defn_value>     :== <defined_constant>
-- -- <logic_defn_value>     :== $rigid | $flexible |
--                            -- $constant | $varying | $cumulative | $decreasing |
--                            -- $local | $global |
--                            -- $modal_system_K | $modal_system_T | $modal_system_D |
--                            -- $modal_system_S4 | $modal_system_S5 |
--                            -- $modal_axiom_K | $modal_axiom_T | $modal_axiom_B |
--                            -- $modal_axiom_D | $modal_axiom_4 | $modal_axiom_5
-- logic_defn_value :: CharParser st Logic_defn_value
-- logic_defn_value = constantsChoice
--   [("$rigid", Rigid),
--    ("$flexible", Flexible),
--    ("$constant", Constant),
--    ("$varying", Varying),
--    ("$cumulative", Cumulative),
--    ("$decreasing", Decreasing),
--    ("$local", Local),
--    ("$global", Global),
--    ("$modal_system_K", Modal_system_K),
--    ("$modal_system_T", Modal_system_T),
--    ("$modal_system_D", Modal_system_D),
--    ("$modal_system_S4", Modal_system_S4),
--    ("$modal_system_S5", Modal_system_S5),
--    ("$modal_axiom_K", Modal_axiom_K),
--    ("$modal_axiom_T", Modal_axiom_T),
--    ("$modal_axiom_B", Modal_axiom_B),
--    ("$modal_axiom_D", Modal_axiom_D),
--    ("$modal_axiom_4", Modal_axiom_4),
--    ("$modal_axiom_5", Modal_axiom_5)]
--   <?> "logic_defn_value"
--

{- -----------------------------------------------------------------------------
TFX formulae
----------------------------------------------------------------------------- -}
-- <tfx_formula>          ::= <tfx_logic_formula> | <thf_sequent>
tfx_formula :: CharParser st TFX_formula
tfx_formula :: CharParser st TFX_formula
tfx_formula = String -> CharParser st TFX_formula -> CharParser st TFX_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tfx_formula" (
  (TFX_logic_formula -> TFX_formula)
-> ParsecT String st Identity TFX_logic_formula
-> CharParser st TFX_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFX_logic_formula -> TFX_formula
TFXF_logic ParsecT String st Identity TFX_logic_formula
forall st. CharParser st TFX_logic_formula
tfx_logic_formula
  CharParser st TFX_formula
-> CharParser st TFX_formula -> CharParser st TFX_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (THF_sequent -> TFX_formula)
-> ParsecT String st Identity THF_sequent
-> CharParser st TFX_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_sequent -> TFX_formula
TFXF_sequent ParsecT String st Identity THF_sequent
forall st. CharParser st THF_sequent
thf_sequent
  CharParser st TFX_formula -> String -> CharParser st TFX_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tfx_formula"
  )

-- <tfx_logic_formula>    ::= <thf_logic_formula>
-- % <tfx_logic_formula>    ::= <thf_binary_formula> | <thf_unitary_formula> |
-- %                            <tff_typed_atom> | <tff_subtype>
tfx_logic_formula :: CharParser st TFX_logic_formula
tfx_logic_formula :: CharParser st TFX_logic_formula
tfx_logic_formula = String
-> CharParser st TFX_logic_formula
-> CharParser st TFX_logic_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tfx_logic_formula" (
  (THF_unitary_formula -> TFX_logic_formula)
-> ParsecT String st Identity THF_unitary_formula
-> CharParser st TFX_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_unitary_formula -> TFX_logic_formula
TFXLF_unitary ParsecT String st Identity THF_unitary_formula
forall st. CharParser st THF_unitary_formula
thf_unitary_formula
  CharParser st TFX_logic_formula
-> CharParser st TFX_logic_formula
-> CharParser st TFX_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_typed_atom -> TFX_logic_formula)
-> ParsecT String st Identity TFF_typed_atom
-> CharParser st TFX_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_typed_atom -> TFX_logic_formula
TFXLF_typed ParsecT String st Identity TFF_typed_atom
forall st. CharParser st TFF_typed_atom
tff_typed_atom
  CharParser st TFX_logic_formula
-> CharParser st TFX_logic_formula
-> CharParser st TFX_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_subtype -> TFX_logic_formula)
-> ParsecT String st Identity TFF_subtype
-> CharParser st TFX_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_subtype -> TFX_logic_formula
TFXLF_subtype ParsecT String st Identity TFF_subtype
forall st. CharParser st TFF_subtype
tff_subtype
  CharParser st TFX_logic_formula
-> CharParser st TFX_logic_formula
-> CharParser st TFX_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> do
    THF_unitary_formula
f <- ParsecT String st Identity THF_unitary_formula
forall st. CharParser st THF_unitary_formula
thf_unitary_formula
    (THF_binary_formula -> TFX_logic_formula)
-> ParsecT String st Identity THF_binary_formula
-> CharParser st TFX_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM THF_binary_formula -> TFX_logic_formula
TFXLF_binary (THF_unitary_formula
-> ParsecT String st Identity THF_binary_formula
forall st. THF_unitary_formula -> CharParser st THF_binary_formula
thf_binary_formula THF_unitary_formula
f)
  CharParser st TFX_logic_formula
-> String -> CharParser st TFX_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tfx_logic_formula"
  )

{- -----------------------------------------------------------------------------
TFF formulae
----------------------------------------------------------------------------- -}
-- <tff_formula>          ::= <tff_logic_formula> | <tff_typed_atom> |
--                            <tff_sequent>
tff_formula :: CharParser st TFF_formula
tff_formula :: CharParser st TFF_formula
tff_formula = String -> CharParser st TFF_formula -> CharParser st TFF_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_formula" (
  (TFF_typed_atom -> TFF_formula)
-> ParsecT String st Identity TFF_typed_atom
-> CharParser st TFF_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_typed_atom -> TFF_formula
TFFF_atom ParsecT String st Identity TFF_typed_atom
forall st. CharParser st TFF_typed_atom
tff_typed_atom
  CharParser st TFF_formula
-> CharParser st TFF_formula -> CharParser st TFF_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_logic_formula -> TFF_formula)
-> ParsecT String st Identity TFF_logic_formula
-> CharParser st TFF_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_logic_formula -> TFF_formula
TFFF_logic ParsecT String st Identity TFF_logic_formula
forall st. CharParser st TFF_logic_formula
tff_logic_formula
  CharParser st TFF_formula
-> CharParser st TFF_formula -> CharParser st TFF_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_sequent -> TFF_formula)
-> ParsecT String st Identity TFF_sequent
-> CharParser st TFF_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_sequent -> TFF_formula
TFFF_sequent ParsecT String st Identity TFF_sequent
forall st. CharParser st TFF_sequent
tff_sequent
  CharParser st TFF_formula -> String -> CharParser st TFF_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_formula"
  )

-- <tff_logic_formula>    ::= <tff_binary_formula> | <tff_unitary_formula>
-- <tff_logic_formula>    ::= <tff_binary_formula> | <tff_unitary_formula> |
--                            <tff_subtype>
tff_logic_formula :: CharParser st TFF_logic_formula
tff_logic_formula :: CharParser st TFF_logic_formula
tff_logic_formula = String
-> CharParser st TFF_logic_formula
-> CharParser st TFF_logic_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_logic_formula" (
  (TFF_subtype -> TFF_logic_formula)
-> ParsecT String st Identity TFF_subtype
-> CharParser st TFF_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_subtype -> TFF_logic_formula
TFFLF_subtype ParsecT String st Identity TFF_subtype
forall st. CharParser st TFF_subtype
tff_subtype
  CharParser st TFF_logic_formula
-> CharParser st TFF_logic_formula
-> CharParser st TFF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> do
    TFF_unitary_formula
f <- CharParser st TFF_unitary_formula
forall st. CharParser st TFF_unitary_formula
tff_unitary_formula
    ((TFF_binary_formula -> TFF_logic_formula)
-> ParsecT String st Identity TFF_binary_formula
-> CharParser st TFF_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_binary_formula -> TFF_logic_formula
TFFLF_binary (TFF_unitary_formula
-> ParsecT String st Identity TFF_binary_formula
forall st. TFF_unitary_formula -> CharParser st TFF_binary_formula
tff_binary_formula TFF_unitary_formula
f)
      CharParser st TFF_logic_formula
-> CharParser st TFF_logic_formula
-> CharParser st TFF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> TFF_logic_formula -> CharParser st TFF_logic_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_unitary_formula -> TFF_logic_formula
TFFLF_unitary TFF_unitary_formula
f))
  CharParser st TFF_logic_formula
-> String -> CharParser st TFF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_logic_formula"
  )

-- <tff_binary_formula>   ::= <tff_binary_nonassoc> | <tff_binary_assoc>
tff_binary_formula :: TFF_unitary_formula -> CharParser st TFF_binary_formula
tff_binary_formula :: TFF_unitary_formula -> CharParser st TFF_binary_formula
tff_binary_formula f :: TFF_unitary_formula
f = String
-> CharParser st TFF_binary_formula
-> CharParser st TFF_binary_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_binary_formula" (
  (TFF_binary_nonassoc -> TFF_binary_formula)
-> ParsecT String st Identity TFF_binary_nonassoc
-> CharParser st TFF_binary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_binary_nonassoc -> TFF_binary_formula
TFFBF_nonassoc (TFF_unitary_formula
-> ParsecT String st Identity TFF_binary_nonassoc
forall st. TFF_unitary_formula -> CharParser st TFF_binary_nonassoc
tff_binary_nonassoc TFF_unitary_formula
f)
  CharParser st TFF_binary_formula
-> CharParser st TFF_binary_formula
-> CharParser st TFF_binary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_binary_assoc -> TFF_binary_formula)
-> ParsecT String st Identity TFF_binary_assoc
-> CharParser st TFF_binary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_binary_assoc -> TFF_binary_formula
TFFBF_assoc (TFF_unitary_formula -> ParsecT String st Identity TFF_binary_assoc
forall st. TFF_unitary_formula -> CharParser st TFF_binary_assoc
tff_binary_assoc TFF_unitary_formula
f)
  CharParser st TFF_binary_formula
-> String -> CharParser st TFF_binary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_binary_formula"
  )

-- <tff_binary_nonassoc>  ::= <tff_unitary_formula> <binary_connective>
--                            <tff_unitary_formula>
tff_binary_nonassoc :: TFF_unitary_formula -> CharParser st TFF_binary_nonassoc
tff_binary_nonassoc :: TFF_unitary_formula -> CharParser st TFF_binary_nonassoc
tff_binary_nonassoc f1 :: TFF_unitary_formula
f1 = String
-> CharParser st TFF_binary_nonassoc
-> CharParser st TFF_binary_nonassoc
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_binary_nonassoc" (do
    Binary_connective
bc <- GenParser Char st Binary_connective
-> GenParser Char st Binary_connective
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st Binary_connective
forall st. CharParser st Binary_connective
binary_connective
    TFF_unitary_formula
f2 <- CharParser st TFF_unitary_formula
forall st. CharParser st TFF_unitary_formula
tff_unitary_formula
    TFF_binary_nonassoc -> CharParser st TFF_binary_nonassoc
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_binary_nonassoc -> CharParser st TFF_binary_nonassoc)
-> TFF_binary_nonassoc -> CharParser st TFF_binary_nonassoc
forall a b. (a -> b) -> a -> b
$ Binary_connective
-> TFF_unitary_formula
-> TFF_unitary_formula
-> TFF_binary_nonassoc
TFF_binary_nonassoc Binary_connective
bc TFF_unitary_formula
f1 TFF_unitary_formula
f2
  CharParser st TFF_binary_nonassoc
-> String -> CharParser st TFF_binary_nonassoc
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_binary_nonassoc"
  )

-- <tff_binary_assoc>     ::= <tff_or_formula> | <tff_and_formula>
tff_binary_assoc :: TFF_unitary_formula -> CharParser st TFF_binary_assoc
tff_binary_assoc :: TFF_unitary_formula -> CharParser st TFF_binary_assoc
tff_binary_assoc f :: TFF_unitary_formula
f = String
-> CharParser st TFF_binary_assoc -> CharParser st TFF_binary_assoc
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_binary_assoc" (
  (TFF_or_formula -> TFF_binary_assoc)
-> ParsecT String st Identity TFF_or_formula
-> CharParser st TFF_binary_assoc
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_or_formula -> TFF_binary_assoc
TFFBA_or (TFF_unitary_formula -> ParsecT String st Identity TFF_or_formula
forall st. TFF_unitary_formula -> CharParser st TFF_or_formula
tff_or_formula TFF_unitary_formula
f)
  CharParser st TFF_binary_assoc
-> CharParser st TFF_binary_assoc -> CharParser st TFF_binary_assoc
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_or_formula -> TFF_binary_assoc)
-> ParsecT String st Identity TFF_or_formula
-> CharParser st TFF_binary_assoc
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_or_formula -> TFF_binary_assoc
TFFBA_and (TFF_unitary_formula -> ParsecT String st Identity TFF_or_formula
forall st. TFF_unitary_formula -> CharParser st TFF_or_formula
tff_and_formula TFF_unitary_formula
f)
  CharParser st TFF_binary_assoc
-> String -> CharParser st TFF_binary_assoc
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_binary_assoc"
  )

-- <tff_or_formula>       ::= <tff_unitary_formula> <vline> <tff_unitary_formula> |
--                            <tff_or_formula> <vline> <tff_unitary_formula>
tff_or_formula :: TFF_unitary_formula -> CharParser st TFF_or_formula
tff_or_formula :: TFF_unitary_formula -> CharParser st TFF_or_formula
tff_or_formula f :: TFF_unitary_formula
f = String
-> CharParser st TFF_or_formula -> CharParser st TFF_or_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_or_formula" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st Token
forall st. CharParser st Token
vline
    TFF_or_formula
fs <- CharParser st TFF_unitary_formula
forall st. CharParser st TFF_unitary_formula
tff_unitary_formula CharParser st TFF_unitary_formula
-> GenParser Char st Token -> CharParser st TFF_or_formula
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` GenParser Char st Token
forall st. CharParser st Token
vline
    TFF_or_formula -> CharParser st TFF_or_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_or_formula -> CharParser st TFF_or_formula)
-> TFF_or_formula -> CharParser st TFF_or_formula
forall a b. (a -> b) -> a -> b
$ TFF_unitary_formula
f TFF_unitary_formula -> TFF_or_formula -> TFF_or_formula
forall a. a -> [a] -> [a]
: TFF_or_formula
fs
  CharParser st TFF_or_formula
-> String -> CharParser st TFF_or_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_or_formula"
  )

-- <tff_and_formula>      ::= <tff_unitary_formula> & <tff_unitary_formula> |
--                            <tff_and_formula> & <tff_unitary_formula>
tff_and_formula :: TFF_unitary_formula -> CharParser st TFF_and_formula
tff_and_formula :: TFF_unitary_formula -> CharParser st TFF_or_formula
tff_and_formula f :: TFF_unitary_formula
f = String
-> CharParser st TFF_or_formula -> CharParser st TFF_or_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_and_formula" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st Token
forall st. CharParser st Token
andT
    TFF_or_formula
fs <- CharParser st TFF_unitary_formula
forall st. CharParser st TFF_unitary_formula
tff_unitary_formula CharParser st TFF_unitary_formula
-> GenParser Char st Token -> CharParser st TFF_or_formula
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` GenParser Char st Token
forall st. CharParser st Token
andT
    TFF_or_formula -> CharParser st TFF_or_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_or_formula -> CharParser st TFF_or_formula)
-> TFF_or_formula -> CharParser st TFF_or_formula
forall a b. (a -> b) -> a -> b
$ TFF_unitary_formula
f TFF_unitary_formula -> TFF_or_formula -> TFF_or_formula
forall a. a -> [a] -> [a]
: TFF_or_formula
fs
  CharParser st TFF_or_formula
-> String -> CharParser st TFF_or_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_and_formula"
  )

--- <tff_unitary_formula>  ::= <tff_quantified_formula> | <tff_unary_formula> |
---                            <atomic_formula> | <tff_conditional> | <tff_let> |
---                            (<tff_logic_formula>)
-- <tff_unitary_formula>  ::= <tff_quantified_formula> | <tff_unary_formula> |
--                            <tff_atomic_formula> | <tff_conditional> |
--                            <tff_let> | (<tff_logic_formula>)
tff_unitary_formula :: CharParser st TFF_unitary_formula
tff_unitary_formula :: CharParser st TFF_unitary_formula
tff_unitary_formula = String
-> CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_unitary_formula" (
  (TFF_quantified_formula -> TFF_unitary_formula)
-> ParsecT String st Identity TFF_quantified_formula
-> CharParser st TFF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_quantified_formula -> TFF_unitary_formula
TFFUF_quantified ParsecT String st Identity TFF_quantified_formula
forall st. CharParser st TFF_quantified_formula
tff_quantified_formula
  CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_unary_formula -> TFF_unitary_formula)
-> ParsecT String st Identity TFF_unary_formula
-> CharParser st TFF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_unary_formula -> TFF_unitary_formula
TFFUF_unary ParsecT String st Identity TFF_unary_formula
forall st. CharParser st TFF_unary_formula
tff_unary_formula
  CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_atomic_formula -> TFF_unitary_formula)
-> ParsecT String st Identity TFF_atomic_formula
-> CharParser st TFF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_atomic_formula -> TFF_unitary_formula
TFFUF_atomic ParsecT String st Identity TFF_atomic_formula
forall st. CharParser st TFF_atomic_formula
tff_atomic_formula
  CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_conditional -> TFF_unitary_formula)
-> ParsecT String st Identity TFF_conditional
-> CharParser st TFF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_conditional -> TFF_unitary_formula
TFFUF_conditional ParsecT String st Identity TFF_conditional
forall st. CharParser st TFF_conditional
tff_conditional
  CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_let -> TFF_unitary_formula)
-> ParsecT String st Identity TFF_let
-> CharParser st TFF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_let -> TFF_unitary_formula
TFFUF_let ParsecT String st Identity TFF_let
forall st. CharParser st TFF_let
tff_let
  -- <|> liftM TFFUF_logic (try $ parens tff_logic_formula) -- TODO: remove
  CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
-> CharParser st TFF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_logic_formula -> TFF_unitary_formula)
-> ParsecT String st Identity TFF_logic_formula
-> CharParser st TFF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_logic_formula -> TFF_unitary_formula
TFFUF_logic (ParsecT String st Identity TFF_logic_formula
-> ParsecT String st Identity TFF_logic_formula
forall st a. CharParser st a -> CharParser st a
parens ParsecT String st Identity TFF_logic_formula
forall st. CharParser st TFF_logic_formula
tff_logic_formula) -- TODO: add try (above line)
  CharParser st TFF_unitary_formula
-> String -> CharParser st TFF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_unitary_formula"
  )

-- <tff_quantified_formula> ::= <fof_quantifier> [<tff_variable_list>] :
--                            <tff_unitary_formula>
tff_quantified_formula :: CharParser st TFF_quantified_formula
tff_quantified_formula :: CharParser st TFF_quantified_formula
tff_quantified_formula = String
-> CharParser st TFF_quantified_formula
-> CharParser st TFF_quantified_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_quantified_formula" (do
    FOF_quantifier
q <- GenParser Char st FOF_quantifier
-> GenParser Char st FOF_quantifier
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st FOF_quantifier
forall st. CharParser st FOF_quantifier
fof_quantifier
    TFF_variable_list
vars <- CharParser st TFF_variable_list -> CharParser st TFF_variable_list
forall st a. CharParser st a -> CharParser st a
brackets CharParser st TFF_variable_list
forall st. CharParser st TFF_variable_list
tff_variable_list
    CharParser st Token
forall st. CharParser st Token
colonT
    TFF_unitary_formula
f <- CharParser st TFF_unitary_formula
forall st. CharParser st TFF_unitary_formula
tff_unitary_formula
    TFF_quantified_formula -> CharParser st TFF_quantified_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_quantified_formula -> CharParser st TFF_quantified_formula)
-> TFF_quantified_formula -> CharParser st TFF_quantified_formula
forall a b. (a -> b) -> a -> b
$ FOF_quantifier
-> TFF_variable_list
-> TFF_unitary_formula
-> TFF_quantified_formula
TFF_quantified_formula FOF_quantifier
q TFF_variable_list
vars TFF_unitary_formula
f
  CharParser st TFF_quantified_formula
-> String -> CharParser st TFF_quantified_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_quantified_formula"
  )

-- <tff_variable_list>    ::= <tff_variable> | <tff_variable>,<tff_variable_list>
tff_variable_list :: CharParser st TFF_variable_list
tff_variable_list :: CharParser st TFF_variable_list
tff_variable_list = String
-> CharParser st TFF_variable_list
-> CharParser st TFF_variable_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_variable_list" (CharParser st TFF_variable -> CharParser st TFF_variable_list
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st TFF_variable
forall st. CharParser st TFF_variable
tff_variable CharParser st TFF_variable_list
-> String -> CharParser st TFF_variable_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_variable_list"
  )

-- <tff_variable>         ::= <tff_typed_variable> | <variable>
tff_variable :: CharParser st TFF_variable
tff_variable :: CharParser st TFF_variable
tff_variable = String -> CharParser st TFF_variable -> CharParser st TFF_variable
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_variable" (
  (TFF_typed_variable -> TFF_variable)
-> ParsecT String st Identity TFF_typed_variable
-> CharParser st TFF_variable
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_typed_variable -> TFF_variable
TFFV_typed ParsecT String st Identity TFF_typed_variable
forall st. CharParser st TFF_typed_variable
tff_typed_variable
  CharParser st TFF_variable
-> CharParser st TFF_variable -> CharParser st TFF_variable
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> TFF_variable)
-> ParsecT String st Identity Token -> CharParser st TFF_variable
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> TFF_variable
TFFV_variable ParsecT String st Identity Token
forall st. CharParser st Token
variable
  CharParser st TFF_variable -> String -> CharParser st TFF_variable
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_variable"
  )

-- <tff_typed_variable>   ::= <variable> : <tff_atomic_type>
tff_typed_variable :: CharParser st TFF_typed_variable
tff_typed_variable :: CharParser st TFF_typed_variable
tff_typed_variable = String
-> CharParser st TFF_typed_variable
-> CharParser st TFF_typed_variable
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_typed_variable" (do
    Token
v <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
variable GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
colonT)
    TFF_atomic_type
at <- CharParser st TFF_atomic_type
forall st. CharParser st TFF_atomic_type
tff_atomic_type
    TFF_typed_variable -> CharParser st TFF_typed_variable
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_typed_variable -> CharParser st TFF_typed_variable)
-> TFF_typed_variable -> CharParser st TFF_typed_variable
forall a b. (a -> b) -> a -> b
$ Token -> TFF_atomic_type -> TFF_typed_variable
TFF_typed_variable Token
v TFF_atomic_type
at
  CharParser st TFF_typed_variable
-> String -> CharParser st TFF_typed_variable
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_typed_variable"
  )

-- <tff_unary_formula>    ::= <unary_connective> <tff_unitary_formula> |
--                            <fof_infix_unary>
tff_unary_formula :: CharParser st TFF_unary_formula
tff_unary_formula :: CharParser st TFF_unary_formula
tff_unary_formula = String
-> CharParser st TFF_unary_formula
-> CharParser st TFF_unary_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_unary_formula" (do
    Unary_connective
uc <- GenParser Char st Unary_connective
-> GenParser Char st Unary_connective
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st Unary_connective
forall st. CharParser st Unary_connective
unary_connective
    TFF_unitary_formula
uf <- CharParser st TFF_unitary_formula
forall st. CharParser st TFF_unitary_formula
tff_unitary_formula
    TFF_unary_formula -> CharParser st TFF_unary_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_unary_formula -> CharParser st TFF_unary_formula)
-> TFF_unary_formula -> CharParser st TFF_unary_formula
forall a b. (a -> b) -> a -> b
$ Unary_connective -> TFF_unitary_formula -> TFF_unary_formula
TFFUF_connective Unary_connective
uc TFF_unitary_formula
uf
  CharParser st TFF_unary_formula
-> CharParser st TFF_unary_formula
-> CharParser st TFF_unary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_infix_unary -> TFF_unary_formula)
-> ParsecT String st Identity FOF_infix_unary
-> CharParser st TFF_unary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_infix_unary -> TFF_unary_formula
TFFUF_infix ParsecT String st Identity FOF_infix_unary
forall st. CharParser st FOF_infix_unary
fof_infix_unary
  CharParser st TFF_unary_formula
-> String -> CharParser st TFF_unary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_unary_formula"
  )

-- <tff_atomic_formula>   ::= <fof_atomic_formula>
tff_atomic_formula :: CharParser st TFF_atomic_formula
tff_atomic_formula :: CharParser st TFF_atomic_formula
tff_atomic_formula = String
-> CharParser st TFF_atomic_formula
-> CharParser st TFF_atomic_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_atomic_formula" (CharParser st TFF_atomic_formula
forall st. CharParser st TFF_atomic_formula
fof_atomic_formula
  CharParser st TFF_atomic_formula
-> String -> CharParser st TFF_atomic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_atomic_formula"
  )

-- <tff_conditional>      ::= $ite_f(<tff_logic_formula>,<tff_logic_formula>,
--                            <tff_logic_formula>)
tff_conditional :: CharParser st TFF_conditional
tff_conditional :: CharParser st TFF_conditional
tff_conditional = String
-> CharParser st TFF_conditional -> CharParser st TFF_conditional
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_conditional" ((do
  String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "$ite_f"
  CharParser st TFF_conditional -> CharParser st TFF_conditional
forall st a. CharParser st a -> CharParser st a
parens (CharParser st TFF_conditional -> CharParser st TFF_conditional)
-> CharParser st TFF_conditional -> CharParser st TFF_conditional
forall a b. (a -> b) -> a -> b
$ do
    TFF_logic_formula
lf_if <- CharParser st TFF_logic_formula
forall st. CharParser st TFF_logic_formula
tff_logic_formula
    CharParser st Token
forall st. CharParser st Token
commaT
    TFF_logic_formula
lf_then <- CharParser st TFF_logic_formula
forall st. CharParser st TFF_logic_formula
tff_logic_formula
    CharParser st Token
forall st. CharParser st Token
commaT
    TFF_logic_formula
lf_else <- CharParser st TFF_logic_formula
forall st. CharParser st TFF_logic_formula
tff_logic_formula
    TFF_conditional -> CharParser st TFF_conditional
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_conditional -> CharParser st TFF_conditional)
-> TFF_conditional -> CharParser st TFF_conditional
forall a b. (a -> b) -> a -> b
$ TFF_logic_formula
-> TFF_logic_formula -> TFF_logic_formula -> TFF_conditional
TFF_conditional TFF_logic_formula
lf_if TFF_logic_formula
lf_then TFF_logic_formula
lf_else)
  CharParser st TFF_conditional
-> String -> CharParser st TFF_conditional
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_conditional"
  )

-- <tff_let>              ::= $let_tf(<tff_let_term_defns>,<tff_formula>) |
--                            $let_ff(<tff_let_formula_defns>,<tff_formula>)
tff_let :: CharParser st TFF_let
tff_let :: CharParser st TFF_let
tff_let = String -> CharParser st TFF_let -> CharParser st TFF_let
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_let" (do
    String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "$let_tf"
    CharParser st TFF_let -> CharParser st TFF_let
forall st a. CharParser st a -> CharParser st a
parens (CharParser st TFF_let -> CharParser st TFF_let)
-> CharParser st TFF_let -> CharParser st TFF_let
forall a b. (a -> b) -> a -> b
$ do
      TFF_let_term_defns
ltds <- CharParser st TFF_let_term_defns
forall st. CharParser st TFF_let_term_defns
tff_let_term_defns
      CharParser st Token
forall st. CharParser st Token
commaT
      TFF_formula
f <- CharParser st TFF_formula
forall st. CharParser st TFF_formula
tff_formula
      TFF_let -> CharParser st TFF_let
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_let -> CharParser st TFF_let)
-> TFF_let -> CharParser st TFF_let
forall a b. (a -> b) -> a -> b
$ TFF_let_term_defns -> TFF_formula -> TFF_let
TFF_let_term_defns TFF_let_term_defns
ltds TFF_formula
f
  CharParser st TFF_let
-> CharParser st TFF_let -> CharParser st TFF_let
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> do
    String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "$let_ff"
    CharParser st TFF_let -> CharParser st TFF_let
forall st a. CharParser st a -> CharParser st a
parens (CharParser st TFF_let -> CharParser st TFF_let)
-> CharParser st TFF_let -> CharParser st TFF_let
forall a b. (a -> b) -> a -> b
$ do
      TFF_let_formula_defns
lfds <- CharParser st TFF_let_formula_defns
forall st. CharParser st TFF_let_formula_defns
tff_let_formula_defns
      CharParser st Token
forall st. CharParser st Token
commaT
      TFF_formula
f <- CharParser st TFF_formula
forall st. CharParser st TFF_formula
tff_formula
      TFF_let -> CharParser st TFF_let
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_let -> CharParser st TFF_let)
-> TFF_let -> CharParser st TFF_let
forall a b. (a -> b) -> a -> b
$ TFF_let_formula_defns -> TFF_formula -> TFF_let
TFF_let_formula_defns TFF_let_formula_defns
lfds TFF_formula
f
  CharParser st TFF_let -> String -> CharParser st TFF_let
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_let"
  )

-- <tff_let_term_defns>   ::= <tff_let_term_defn> | [<tff_let_term_list>]
tff_let_term_defns :: CharParser st TFF_let_term_defns
tff_let_term_defns :: CharParser st TFF_let_term_defns
tff_let_term_defns = String
-> CharParser st TFF_let_term_defns
-> CharParser st TFF_let_term_defns
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_let_term_defns" (
  (TFF_let_term_defn -> TFF_let_term_defns)
-> ParsecT String st Identity TFF_let_term_defn
-> CharParser st TFF_let_term_defns
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_let_term_defn -> TFF_let_term_defns
TFFLTD_single ParsecT String st Identity TFF_let_term_defn
forall st. CharParser st TFF_let_term_defn
tff_let_term_defn
  CharParser st TFF_let_term_defns
-> CharParser st TFF_let_term_defns
-> CharParser st TFF_let_term_defns
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_let_term_list -> TFF_let_term_defns)
-> ParsecT String st Identity TFF_let_term_list
-> CharParser st TFF_let_term_defns
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_let_term_list -> TFF_let_term_defns
TFFLTD_many (ParsecT String st Identity TFF_let_term_list
-> ParsecT String st Identity TFF_let_term_list
forall st a. CharParser st a -> CharParser st a
brackets ParsecT String st Identity TFF_let_term_list
forall st. CharParser st TFF_let_term_list
tff_let_term_list)
  CharParser st TFF_let_term_defns
-> String -> CharParser st TFF_let_term_defns
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_let_term_defns"
  )

-- <tff_let_term_list>    ::= <tff_let_term_defn> |
--                            <tff_let_term_defn>,<tff_let_term_list>
tff_let_term_list :: CharParser st TFF_let_term_list
tff_let_term_list :: CharParser st TFF_let_term_list
tff_let_term_list = String
-> CharParser st TFF_let_term_list
-> CharParser st TFF_let_term_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_let_term_list" (CharParser st TFF_let_term_defn -> CharParser st TFF_let_term_list
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st TFF_let_term_defn
forall st. CharParser st TFF_let_term_defn
tff_let_term_defn
  CharParser st TFF_let_term_list
-> String -> CharParser st TFF_let_term_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_let_term_list"
  )

-- <tff_let_term_defn>    ::= ! [<tff_variable_list>] : <tff_let_term_defn> |
--                            <tff_let_term_binding>
tff_let_term_defn :: CharParser st TFF_let_term_defn
tff_let_term_defn :: CharParser st TFF_let_term_defn
tff_let_term_defn = String
-> CharParser st TFF_let_term_defn
-> CharParser st TFF_let_term_defn
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_let_term_defn" (do
    Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '!' CharParser st Token
-> ParsecT String st Identity () -> ParsecT String st Identity ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT String st Identity Char -> ParsecT String st Identity ()
forall s (m :: * -> *) t a u.
(Stream s m t, Show a) =>
ParsecT s u m a -> ParsecT s u m ()
notFollowedBy (String -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
oneOf "!=>")
    TFF_variable_list
vars <- CharParser st TFF_variable_list -> CharParser st TFF_variable_list
forall st a. CharParser st a -> CharParser st a
brackets CharParser st TFF_variable_list
forall st. CharParser st TFF_variable_list
tff_variable_list
    CharParser st Token
forall st. CharParser st Token
colonT
    TFF_let_term_defn
ltd <- CharParser st TFF_let_term_defn
forall st. CharParser st TFF_let_term_defn
tff_let_term_defn
    TFF_let_term_defn -> CharParser st TFF_let_term_defn
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_let_term_defn -> CharParser st TFF_let_term_defn)
-> TFF_let_term_defn -> CharParser st TFF_let_term_defn
forall a b. (a -> b) -> a -> b
$ TFF_variable_list -> TFF_let_term_defn -> TFF_let_term_defn
TFFLTD_variable TFF_variable_list
vars TFF_let_term_defn
ltd
  CharParser st TFF_let_term_defn
-> CharParser st TFF_let_term_defn
-> CharParser st TFF_let_term_defn
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_let_term_binding -> TFF_let_term_defn)
-> ParsecT String st Identity TFF_let_term_binding
-> CharParser st TFF_let_term_defn
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_let_term_binding -> TFF_let_term_defn
TFFLTD_binding ParsecT String st Identity TFF_let_term_binding
forall st. CharParser st TFF_let_term_binding
tff_let_term_binding
  CharParser st TFF_let_term_defn
-> String -> CharParser st TFF_let_term_defn
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_let_term_defn"
  )

-- <tff_let_term_binding> ::= <fof_plain_term> = <fof_term> |
--                            (<tff_let_term_binding>)
tff_let_term_binding :: CharParser st TFF_let_term_binding
tff_let_term_binding :: CharParser st TFF_let_term_binding
tff_let_term_binding = String
-> CharParser st TFF_let_term_binding
-> CharParser st TFF_let_term_binding
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_let_term_binding" (do
    FOF_plain_term
pt <- GenParser Char st FOF_plain_term
-> GenParser Char st FOF_plain_term
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st FOF_plain_term
forall st. CharParser st FOF_plain_term
fof_plain_term GenParser Char st FOF_plain_term
-> ParsecT String st Identity Token
-> GenParser Char st FOF_plain_term
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< Char -> ParsecT String st Identity Token
forall st. Char -> CharParser st Token
charTok '=')
    FOF_term
t <- CharParser st FOF_term
forall st. CharParser st FOF_term
fof_term
    TFF_let_term_binding -> CharParser st TFF_let_term_binding
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_let_term_binding -> CharParser st TFF_let_term_binding)
-> TFF_let_term_binding -> CharParser st TFF_let_term_binding
forall a b. (a -> b) -> a -> b
$ FOF_plain_term -> FOF_term -> TFF_let_term_binding
TFFLTB_plain FOF_plain_term
pt FOF_term
t
  CharParser st TFF_let_term_binding
-> CharParser st TFF_let_term_binding
-> CharParser st TFF_let_term_binding
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_let_term_binding -> TFF_let_term_binding)
-> CharParser st TFF_let_term_binding
-> CharParser st TFF_let_term_binding
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_let_term_binding -> TFF_let_term_binding
TFFLTB_binding (CharParser st TFF_let_term_binding
-> CharParser st TFF_let_term_binding
forall st a. CharParser st a -> CharParser st a
parens CharParser st TFF_let_term_binding
forall st. CharParser st TFF_let_term_binding
tff_let_term_binding)
  CharParser st TFF_let_term_binding
-> String -> CharParser st TFF_let_term_binding
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_let_term_binding"
  )
-- <tff_let_formula_defns> ::= <tff_let_formula_defn> | [<tff_let_formula_list>]
-- <tff_let_formula_defns> ::= <tff_let_formula_defn> | [<tff_let_formula_list>]
tff_let_formula_defns :: CharParser st TFF_let_formula_defns
tff_let_formula_defns :: CharParser st TFF_let_formula_defns
tff_let_formula_defns = String
-> CharParser st TFF_let_formula_defns
-> CharParser st TFF_let_formula_defns
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_let_formula_defns" (
  (TFF_let_formula_defn -> TFF_let_formula_defns)
-> ParsecT String st Identity TFF_let_formula_defn
-> CharParser st TFF_let_formula_defns
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_let_formula_defn -> TFF_let_formula_defns
TFFLFD_single ParsecT String st Identity TFF_let_formula_defn
forall st. CharParser st TFF_let_formula_defn
tff_let_formula_defn
  CharParser st TFF_let_formula_defns
-> CharParser st TFF_let_formula_defns
-> CharParser st TFF_let_formula_defns
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_let_formula_list -> TFF_let_formula_defns)
-> ParsecT String st Identity TFF_let_formula_list
-> CharParser st TFF_let_formula_defns
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_let_formula_list -> TFF_let_formula_defns
TFFLFD_many (ParsecT String st Identity TFF_let_formula_list
-> ParsecT String st Identity TFF_let_formula_list
forall st a. CharParser st a -> CharParser st a
brackets ParsecT String st Identity TFF_let_formula_list
forall st. CharParser st TFF_let_formula_list
tff_let_formula_list)
  CharParser st TFF_let_formula_defns
-> String -> CharParser st TFF_let_formula_defns
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_let_formula_defns"
  )

-- <tff_let_formula_list> ::= <tff_let_formula_defn> |
--                            <tff_let_formula_defn>,<tff_let_formula_list>
tff_let_formula_list :: CharParser st TFF_let_formula_list
tff_let_formula_list :: CharParser st TFF_let_formula_list
tff_let_formula_list = String
-> CharParser st TFF_let_formula_list
-> CharParser st TFF_let_formula_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_let_formula_list" (CharParser st TFF_let_formula_defn
-> CharParser st TFF_let_formula_list
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st TFF_let_formula_defn
forall st. CharParser st TFF_let_formula_defn
tff_let_formula_defn CharParser st TFF_let_formula_list
-> String -> CharParser st TFF_let_formula_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_let_formula_list"
  )

-- <tff_let_formula_defn> ::= ! [<tff_variable_list>] : <tff_let_formula_defn> |
--                            <tff_let_formula_binding>
tff_let_formula_defn :: CharParser st TFF_let_formula_defn
tff_let_formula_defn :: CharParser st TFF_let_formula_defn
tff_let_formula_defn = String
-> CharParser st TFF_let_formula_defn
-> CharParser st TFF_let_formula_defn
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_let_formula_defn" (do
    Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '!' CharParser st Token
-> ParsecT String st Identity () -> ParsecT String st Identity ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT String st Identity Char -> ParsecT String st Identity ()
forall s (m :: * -> *) t a u.
(Stream s m t, Show a) =>
ParsecT s u m a -> ParsecT s u m ()
notFollowedBy (String -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
oneOf "!=>")
    TFF_variable_list
vars <- CharParser st TFF_variable_list -> CharParser st TFF_variable_list
forall st a. CharParser st a -> CharParser st a
brackets CharParser st TFF_variable_list
forall st. CharParser st TFF_variable_list
tff_variable_list
    CharParser st Token
forall st. CharParser st Token
colonT
    TFF_let_formula_defn
lfd <- CharParser st TFF_let_formula_defn
forall st. CharParser st TFF_let_formula_defn
tff_let_formula_defn
    TFF_let_formula_defn -> CharParser st TFF_let_formula_defn
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_let_formula_defn -> CharParser st TFF_let_formula_defn)
-> TFF_let_formula_defn -> CharParser st TFF_let_formula_defn
forall a b. (a -> b) -> a -> b
$ TFF_variable_list -> TFF_let_formula_defn -> TFF_let_formula_defn
TFFLFD_variable TFF_variable_list
vars TFF_let_formula_defn
lfd
  CharParser st TFF_let_formula_defn
-> CharParser st TFF_let_formula_defn
-> CharParser st TFF_let_formula_defn
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_let_formula_binding -> TFF_let_formula_defn)
-> ParsecT String st Identity TFF_let_formula_binding
-> CharParser st TFF_let_formula_defn
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_let_formula_binding -> TFF_let_formula_defn
TFFLFD_binding ParsecT String st Identity TFF_let_formula_binding
forall st. CharParser st TFF_let_formula_binding
tff_let_formula_binding
  CharParser st TFF_let_formula_defn
-> String -> CharParser st TFF_let_formula_defn
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_let_formula_defn"
  )

-- <tff_let_formula_binding> ::= <plain_atomic_formula> <=> <tff_unitary_formula> |
--                            (<tff_let_formula_binding>)
-- <tff_let_formula_binding> ::= <fof_plain_atomic_formula> <=>
--                            <tff_unitary_formula> | (<tff_let_formula_binding>)
tff_let_formula_binding :: CharParser st TFF_let_formula_binding
tff_let_formula_binding :: CharParser st TFF_let_formula_binding
tff_let_formula_binding = String
-> CharParser st TFF_let_formula_binding
-> CharParser st TFF_let_formula_binding
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_let_formula_binding" (do
    FOF_plain_atomic_formula
paf <- GenParser Char st FOF_plain_atomic_formula
-> GenParser Char st FOF_plain_atomic_formula
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st FOF_plain_atomic_formula
forall st. CharParser st FOF_plain_atomic_formula
fof_plain_atomic_formula GenParser Char st FOF_plain_atomic_formula
-> ParsecT String st Identity Token
-> GenParser Char st FOF_plain_atomic_formula
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< String -> ParsecT String st Identity Token
forall st. String -> CharParser st Token
strTok "<=>")
    TFF_unitary_formula
uf <- CharParser st TFF_unitary_formula
forall st. CharParser st TFF_unitary_formula
tff_unitary_formula
    TFF_let_formula_binding -> CharParser st TFF_let_formula_binding
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_let_formula_binding -> CharParser st TFF_let_formula_binding)
-> TFF_let_formula_binding -> CharParser st TFF_let_formula_binding
forall a b. (a -> b) -> a -> b
$ FOF_plain_atomic_formula
-> TFF_unitary_formula -> TFF_let_formula_binding
TFFLFB_plain FOF_plain_atomic_formula
paf TFF_unitary_formula
uf
  CharParser st TFF_let_formula_binding
-> CharParser st TFF_let_formula_binding
-> CharParser st TFF_let_formula_binding
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_let_formula_binding -> TFF_let_formula_binding)
-> CharParser st TFF_let_formula_binding
-> CharParser st TFF_let_formula_binding
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_let_formula_binding -> TFF_let_formula_binding
TFFLFB_binding (CharParser st TFF_let_formula_binding
-> CharParser st TFF_let_formula_binding
forall st a. CharParser st a -> CharParser st a
parens CharParser st TFF_let_formula_binding
forall st. CharParser st TFF_let_formula_binding
tff_let_formula_binding)
  CharParser st TFF_let_formula_binding
-> String -> CharParser st TFF_let_formula_binding
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_let_formula_binding"
  )

-- <tff_sequent>          ::= <tff_formula_tuple> <gentzen_arrow>
--                            <tff_formula_tuple> | (<tff_sequent>)
tff_sequent :: CharParser st TFF_sequent
tff_sequent :: CharParser st TFF_sequent
tff_sequent = String -> CharParser st TFF_sequent -> CharParser st TFF_sequent
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_sequent" (do
    TFF_formula_tuple
t1 <- GenParser Char st TFF_formula_tuple
-> GenParser Char st TFF_formula_tuple
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st TFF_formula_tuple
forall st. CharParser st TFF_formula_tuple
tff_formula_tuple GenParser Char st TFF_formula_tuple
-> ParsecT String st Identity Token
-> GenParser Char st TFF_formula_tuple
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
gentzen_arrow)
    TFF_formula_tuple
t2 <- GenParser Char st TFF_formula_tuple
forall st. CharParser st TFF_formula_tuple
tff_formula_tuple
    TFF_sequent -> CharParser st TFF_sequent
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_sequent -> CharParser st TFF_sequent)
-> TFF_sequent -> CharParser st TFF_sequent
forall a b. (a -> b) -> a -> b
$ TFF_formula_tuple -> TFF_formula_tuple -> TFF_sequent
TFFS_plain TFF_formula_tuple
t1 TFF_formula_tuple
t2
  CharParser st TFF_sequent
-> CharParser st TFF_sequent -> CharParser st TFF_sequent
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_sequent -> TFF_sequent)
-> CharParser st TFF_sequent -> CharParser st TFF_sequent
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_sequent -> TFF_sequent
TFFS_parens (CharParser st TFF_sequent -> CharParser st TFF_sequent
forall st a. CharParser st a -> CharParser st a
parens CharParser st TFF_sequent
forall st. CharParser st TFF_sequent
tff_sequent)
  CharParser st TFF_sequent -> String -> CharParser st TFF_sequent
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_sequent"
  )

-- <tff_formula_tuple>    ::= [] | [<tff_formula_tuple_list>]
tff_formula_tuple :: CharParser st TFF_formula_tuple
tff_formula_tuple :: CharParser st TFF_formula_tuple
tff_formula_tuple = String
-> CharParser st TFF_formula_tuple
-> CharParser st TFF_formula_tuple
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_formula_tuple" (
  (TFF_formula_tuple_list -> TFF_formula_tuple)
-> ParsecT String st Identity TFF_formula_tuple_list
-> CharParser st TFF_formula_tuple
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_formula_tuple_list -> TFF_formula_tuple
TFF_formula_tuple (ParsecT String st Identity TFF_formula_tuple_list
forall st a. CharParser st [a]
emptyBrackets ParsecT String st Identity TFF_formula_tuple_list
-> ParsecT String st Identity TFF_formula_tuple_list
-> ParsecT String st Identity TFF_formula_tuple_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ParsecT String st Identity TFF_formula_tuple_list
-> ParsecT String st Identity TFF_formula_tuple_list
forall st a. CharParser st a -> CharParser st a
brackets ParsecT String st Identity TFF_formula_tuple_list
forall st. CharParser st TFF_formula_tuple_list
tff_formula_tuple_list)
  CharParser st TFF_formula_tuple
-> String -> CharParser st TFF_formula_tuple
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_formula_tuple"
  )

-- <tff_formula_tuple_list> ::= <tff_logic_formula> |
--                            <tff_logic_formula>,<tff_formula_tuple_list>
tff_formula_tuple_list :: CharParser st TFF_formula_tuple_list
tff_formula_tuple_list :: CharParser st TFF_formula_tuple_list
tff_formula_tuple_list = String
-> CharParser st TFF_formula_tuple_list
-> CharParser st TFF_formula_tuple_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_formula_tuple_list" (
  CharParser st TFF_logic_formula
-> CharParser st TFF_formula_tuple_list
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st TFF_logic_formula
forall st. CharParser st TFF_logic_formula
tff_logic_formula
  CharParser st TFF_formula_tuple_list
-> String -> CharParser st TFF_formula_tuple_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_formula_tuple_list"
  )

-- <tff_typed_atom>       ::= <untyped_atom> : <tff_top_level_type> |
--                            (<tff_typed_atom>)
tff_typed_atom :: CharParser st TFF_typed_atom
tff_typed_atom :: CharParser st TFF_typed_atom
tff_typed_atom = String
-> CharParser st TFF_typed_atom -> CharParser st TFF_typed_atom
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_typed_atom" (do
    Untyped_atom
ua <- GenParser Char st Untyped_atom -> GenParser Char st Untyped_atom
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Untyped_atom
forall st. CharParser st Untyped_atom
untyped_atom GenParser Char st Untyped_atom
-> ParsecT String st Identity Token
-> GenParser Char st Untyped_atom
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
colonT)
    TFF_top_level_type
tlt <- CharParser st TFF_top_level_type
forall st. CharParser st TFF_top_level_type
tff_top_level_type
    TFF_typed_atom -> CharParser st TFF_typed_atom
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_typed_atom -> CharParser st TFF_typed_atom)
-> TFF_typed_atom -> CharParser st TFF_typed_atom
forall a b. (a -> b) -> a -> b
$ Untyped_atom -> TFF_top_level_type -> TFF_typed_atom
TFFTA_plain Untyped_atom
ua TFF_top_level_type
tlt
  CharParser st TFF_typed_atom
-> CharParser st TFF_typed_atom -> CharParser st TFF_typed_atom
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_typed_atom -> TFF_typed_atom)
-> CharParser st TFF_typed_atom -> CharParser st TFF_typed_atom
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_typed_atom -> TFF_typed_atom
TFFTA_parens (CharParser st TFF_typed_atom -> CharParser st TFF_typed_atom
forall tok st a. GenParser tok st a -> GenParser tok st a
try (CharParser st TFF_typed_atom -> CharParser st TFF_typed_atom
forall st a. CharParser st a -> CharParser st a
parens CharParser st TFF_typed_atom
forall st. CharParser st TFF_typed_atom
tff_typed_atom)) -- TODO: remove
  -- <|> liftM TFFTA_parens (parens tff_typed_atom) -- TODO: add try (above line)
  CharParser st TFF_typed_atom
-> String -> CharParser st TFF_typed_atom
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_typed_atom"
  )

-- <tff_subtype>          ::= <untyped_atom> <subtype_sign> <atom>
tff_subtype :: CharParser st TFF_subtype
tff_subtype :: CharParser st TFF_subtype
tff_subtype = String -> CharParser st TFF_subtype -> CharParser st TFF_subtype
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_subtype" (do
    Untyped_atom
ua <- GenParser Char st Untyped_atom -> GenParser Char st Untyped_atom
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Untyped_atom
forall st. CharParser st Untyped_atom
untyped_atom GenParser Char st Untyped_atom
-> ParsecT String st Identity Token
-> GenParser Char st Untyped_atom
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
subtype_sign)
    Atom
a <- CharParser st Atom
forall st. CharParser st Atom
atom
    TFF_subtype -> CharParser st TFF_subtype
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_subtype -> CharParser st TFF_subtype)
-> TFF_subtype -> CharParser st TFF_subtype
forall a b. (a -> b) -> a -> b
$ Untyped_atom -> Atom -> TFF_subtype
TFF_subtype Untyped_atom
ua Atom
a
  CharParser st TFF_subtype -> String -> CharParser st TFF_subtype
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_subtype"
  )

-- <tff_top_level_type>   ::= <tff_atomic_type> | <tff_mapping_type> |
--                            <tf1_quantified_type> | (<tff_top_level_type>)
tff_top_level_type :: CharParser st TFF_top_level_type
tff_top_level_type :: CharParser st TFF_top_level_type
tff_top_level_type = String
-> CharParser st TFF_top_level_type
-> CharParser st TFF_top_level_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_top_level_type" (
  (TFF_mapping_type -> TFF_top_level_type)
-> ParsecT String st Identity TFF_mapping_type
-> CharParser st TFF_top_level_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_mapping_type -> TFF_top_level_type
TFFTLT_mapping ParsecT String st Identity TFF_mapping_type
forall st. CharParser st TFF_mapping_type
tff_mapping_type
  CharParser st TFF_top_level_type
-> CharParser st TFF_top_level_type
-> CharParser st TFF_top_level_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TF1_quantified_type -> TFF_top_level_type)
-> ParsecT String st Identity TF1_quantified_type
-> CharParser st TFF_top_level_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TF1_quantified_type -> TFF_top_level_type
TFFTLT_quantified ParsecT String st Identity TF1_quantified_type
forall st. CharParser st TF1_quantified_type
tf1_quantified_type
  CharParser st TFF_top_level_type
-> CharParser st TFF_top_level_type
-> CharParser st TFF_top_level_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_atomic_type -> TFF_top_level_type)
-> ParsecT String st Identity TFF_atomic_type
-> CharParser st TFF_top_level_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_atomic_type -> TFF_top_level_type
TFFTLT_atomic ParsecT String st Identity TFF_atomic_type
forall st. CharParser st TFF_atomic_type
tff_atomic_type
  -- <|> liftM TFFTLT_parens (try (parens tff_top_level_type)) -- TODO: remove
  CharParser st TFF_top_level_type
-> CharParser st TFF_top_level_type
-> CharParser st TFF_top_level_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_top_level_type -> TFF_top_level_type)
-> CharParser st TFF_top_level_type
-> CharParser st TFF_top_level_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_top_level_type -> TFF_top_level_type
TFFTLT_parens (CharParser st TFF_top_level_type
-> CharParser st TFF_top_level_type
forall st a. CharParser st a -> CharParser st a
parens CharParser st TFF_top_level_type
forall st. CharParser st TFF_top_level_type
tff_top_level_type) -- TODO: add try (above line)
  CharParser st TFF_top_level_type
-> String -> CharParser st TFF_top_level_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_top_level_type"
  )

-- <tf1_quantified_type>  ::= !> [<tff_variable_list>] : <tff_monotype>
tf1_quantified_type :: CharParser st TF1_quantified_type
tf1_quantified_type :: CharParser st TF1_quantified_type
tf1_quantified_type = String
-> CharParser st TF1_quantified_type
-> CharParser st TF1_quantified_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tf1_quantified_type" (do
    String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "!>"
    TFF_variable_list
vars <- CharParser st TFF_variable_list -> CharParser st TFF_variable_list
forall st a. CharParser st a -> CharParser st a
brackets CharParser st TFF_variable_list
forall st. CharParser st TFF_variable_list
tff_variable_list
    CharParser st Token
forall st. CharParser st Token
colonT
    TFF_monotype
mt <- CharParser st TFF_monotype
forall st. CharParser st TFF_monotype
tff_monotype
    TF1_quantified_type -> CharParser st TF1_quantified_type
forall (m :: * -> *) a. Monad m => a -> m a
return (TF1_quantified_type -> CharParser st TF1_quantified_type)
-> TF1_quantified_type -> CharParser st TF1_quantified_type
forall a b. (a -> b) -> a -> b
$ TFF_variable_list -> TFF_monotype -> TF1_quantified_type
TF1_quantified_type TFF_variable_list
vars TFF_monotype
mt
  CharParser st TF1_quantified_type
-> String -> CharParser st TF1_quantified_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tf1_quantified_type"
  )

-- <tff_monotype>         ::= <tff_atomic_type> | (<tff_mapping_type>)
tff_monotype :: CharParser st TFF_monotype
tff_monotype :: CharParser st TFF_monotype
tff_monotype = String -> CharParser st TFF_monotype -> CharParser st TFF_monotype
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_monotype" (
  (TFF_atomic_type -> TFF_monotype)
-> ParsecT String st Identity TFF_atomic_type
-> CharParser st TFF_monotype
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_atomic_type -> TFF_monotype
TFFMT_atomic ParsecT String st Identity TFF_atomic_type
forall st. CharParser st TFF_atomic_type
tff_atomic_type
  CharParser st TFF_monotype
-> CharParser st TFF_monotype -> CharParser st TFF_monotype
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_mapping_type -> TFF_monotype)
-> ParsecT String st Identity TFF_mapping_type
-> CharParser st TFF_monotype
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_mapping_type -> TFF_monotype
TFFMT_mapping (ParsecT String st Identity TFF_mapping_type
-> ParsecT String st Identity TFF_mapping_type
forall st a. CharParser st a -> CharParser st a
parens ParsecT String st Identity TFF_mapping_type
forall st. CharParser st TFF_mapping_type
tff_mapping_type)
  CharParser st TFF_monotype -> String -> CharParser st TFF_monotype
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_monotype"
  )

-- <tff_unitary_type>     ::= <tff_atomic_type> | (<tff_xprod_type>)
tff_unitary_type :: CharParser st TFF_unitary_type
tff_unitary_type :: CharParser st TFF_unitary_type
tff_unitary_type = String
-> CharParser st TFF_unitary_type -> CharParser st TFF_unitary_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_unitary_type" (
  (TFF_xprod_type -> TFF_unitary_type)
-> ParsecT String st Identity TFF_xprod_type
-> CharParser st TFF_unitary_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_xprod_type -> TFF_unitary_type
TFFUT_xprod (ParsecT String st Identity TFF_xprod_type
-> ParsecT String st Identity TFF_xprod_type
forall st a. CharParser st a -> CharParser st a
parens ParsecT String st Identity TFF_xprod_type
forall st. CharParser st TFF_xprod_type
tff_xprod_type)
  CharParser st TFF_unitary_type
-> CharParser st TFF_unitary_type -> CharParser st TFF_unitary_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_atomic_type -> TFF_unitary_type)
-> ParsecT String st Identity TFF_atomic_type
-> CharParser st TFF_unitary_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_atomic_type -> TFF_unitary_type
TFFUT_atomic ParsecT String st Identity TFF_atomic_type
forall st. CharParser st TFF_atomic_type
tff_atomic_type
  CharParser st TFF_unitary_type
-> String -> CharParser st TFF_unitary_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_unitary_type"
  )

-- <tff_atomic_type>      ::= <atomic_word> | <defined_type> |
--                            <atomic_word>(<tff_type_arguments>) | <variable>
-- <tff_atomic_type>      ::= <type_constant> | <defined_type> |
--                            <type_functor>(<tff_type_arguments>) | <variable>
tff_atomic_type :: CharParser st TFF_atomic_type
tff_atomic_type :: CharParser st TFF_atomic_type
tff_atomic_type = String
-> CharParser st TFF_atomic_type -> CharParser st TFF_atomic_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_atomic_type" (
  CharParser st TFF_atomic_type
forall st. CharParser st TFF_atomic_type
functor_args
  CharParser st TFF_atomic_type
-> CharParser st TFF_atomic_type -> CharParser st TFF_atomic_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> TFF_atomic_type)
-> ParsecT String st Identity Token
-> CharParser st TFF_atomic_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> TFF_atomic_type
TFFAT_constant ParsecT String st Identity Token
forall st. CharParser st Token
type_constant
  CharParser st TFF_atomic_type
-> CharParser st TFF_atomic_type -> CharParser st TFF_atomic_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Defined_type -> TFF_atomic_type)
-> ParsecT String st Identity Defined_type
-> CharParser st TFF_atomic_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Defined_type -> TFF_atomic_type
TFFAT_defined ParsecT String st Identity Defined_type
forall st. CharParser st Defined_type
defined_type
  CharParser st TFF_atomic_type
-> CharParser st TFF_atomic_type -> CharParser st TFF_atomic_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> TFF_atomic_type)
-> ParsecT String st Identity Token
-> CharParser st TFF_atomic_type
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> TFF_atomic_type
TFFAT_variable ParsecT String st Identity Token
forall st. CharParser st Token
variable
  CharParser st TFF_atomic_type
-> String -> CharParser st TFF_atomic_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_atomic_type"
  )
  where
    functor_args :: ParsecT String st Identity TFF_atomic_type
functor_args = do
      Token
aw <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
type_functor GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
      TFF_type_arguments
args <- CharParser st TFF_type_arguments
forall st. CharParser st TFF_type_arguments
tff_type_arguments CharParser st TFF_type_arguments
-> GenParser Char st Token -> CharParser st TFF_type_arguments
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
cParenT
      TFF_atomic_type -> ParsecT String st Identity TFF_atomic_type
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_atomic_type -> ParsecT String st Identity TFF_atomic_type)
-> TFF_atomic_type -> ParsecT String st Identity TFF_atomic_type
forall a b. (a -> b) -> a -> b
$ Token -> TFF_type_arguments -> TFF_atomic_type
TFFAT_functor Token
aw TFF_type_arguments
args

-- <tff_type_arguments>   ::= <tff_atomic_type> |
--                            <tff_atomic_type>,<tff_type_arguments>
tff_type_arguments :: CharParser st TFF_type_arguments
tff_type_arguments :: CharParser st TFF_type_arguments
tff_type_arguments = String
-> CharParser st TFF_type_arguments
-> CharParser st TFF_type_arguments
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_type_arguments" (
  CharParser st TFF_atomic_type -> CharParser st TFF_type_arguments
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st TFF_atomic_type
forall st. CharParser st TFF_atomic_type
tff_atomic_type
  CharParser st TFF_type_arguments
-> String -> CharParser st TFF_type_arguments
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_type_arguments"
  )

-- <tff_mapping_type>     ::= <tff_unitary_type> <arrow> <tff_atomic_type>
tff_mapping_type :: CharParser st TFF_mapping_type
tff_mapping_type :: CharParser st TFF_mapping_type
tff_mapping_type = String
-> CharParser st TFF_mapping_type -> CharParser st TFF_mapping_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_mapping_type" (do
    TFF_unitary_type
t1 <- GenParser Char st TFF_unitary_type
-> GenParser Char st TFF_unitary_type
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st TFF_unitary_type
forall st. CharParser st TFF_unitary_type
tff_unitary_type GenParser Char st TFF_unitary_type
-> ParsecT String st Identity Token
-> GenParser Char st TFF_unitary_type
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
arrowT)
    TFF_atomic_type
t2 <- CharParser st TFF_atomic_type
forall st. CharParser st TFF_atomic_type
tff_atomic_type
    TFF_mapping_type -> CharParser st TFF_mapping_type
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_mapping_type -> CharParser st TFF_mapping_type)
-> TFF_mapping_type -> CharParser st TFF_mapping_type
forall a b. (a -> b) -> a -> b
$ TFF_unitary_type -> TFF_atomic_type -> TFF_mapping_type
TFF_mapping_type TFF_unitary_type
t1 TFF_atomic_type
t2
  CharParser st TFF_mapping_type
-> String -> CharParser st TFF_mapping_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_mapping_type"
  )

-- <tff_xprod_type>       ::= <tff_unitary_type> <star> <tff_atomic_type> |
--                            <tff_xprod_type> <star> <tff_atomic_type>
tff_xprod_type :: CharParser st TFF_xprod_type
tff_xprod_type :: CharParser st TFF_xprod_type
tff_xprod_type = String
-> CharParser st TFF_xprod_type -> CharParser st TFF_xprod_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_xprod_type" (do
    TFF_unitary_type
ut <- GenParser Char st TFF_unitary_type
-> GenParser Char st TFF_unitary_type
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st TFF_unitary_type
forall st. CharParser st TFF_unitary_type
tff_unitary_type GenParser Char st TFF_unitary_type
-> ParsecT String st Identity Token
-> GenParser Char st TFF_unitary_type
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
starT)
    TFF_type_arguments
ats <- CharParser st TFF_atomic_type
forall st. CharParser st TFF_atomic_type
tff_atomic_type CharParser st TFF_atomic_type
-> ParsecT String st Identity Token
-> ParsecT String st Identity TFF_type_arguments
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` ParsecT String st Identity Token
forall st. CharParser st Token
starT
    TFF_xprod_type -> CharParser st TFF_xprod_type
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_xprod_type -> CharParser st TFF_xprod_type)
-> TFF_xprod_type -> CharParser st TFF_xprod_type
forall a b. (a -> b) -> a -> b
$ TFF_unitary_type -> TFF_type_arguments -> TFF_xprod_type
TFF_xprod_type TFF_unitary_type
ut TFF_type_arguments
ats
  CharParser st TFF_xprod_type
-> String -> CharParser st TFF_xprod_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_xprod_type"
  )


{- -----------------------------------------------------------------------------
TCF formulae
----------------------------------------------------------------------------- -}

-- <tcf_formula>          ::= <tcf_logic_formula> | <tff_typed_atom>
tcf_formula :: CharParser st TCF_formula
tcf_formula :: CharParser st TCF_formula
tcf_formula = String -> CharParser st TCF_formula -> CharParser st TCF_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tcf_formula" (
  (TCF_logic_formula -> TCF_formula)
-> ParsecT String st Identity TCF_logic_formula
-> CharParser st TCF_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TCF_logic_formula -> TCF_formula
TCFF_logic ParsecT String st Identity TCF_logic_formula
forall st. CharParser st TCF_logic_formula
tcf_logic_formula
  CharParser st TCF_formula
-> CharParser st TCF_formula -> CharParser st TCF_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_typed_atom -> TCF_formula)
-> ParsecT String st Identity TFF_typed_atom
-> CharParser st TCF_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_typed_atom -> TCF_formula
TCFF_atom ParsecT String st Identity TFF_typed_atom
forall st. CharParser st TFF_typed_atom
tff_typed_atom
  CharParser st TCF_formula -> String -> CharParser st TCF_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tcf_formula"
  )

-- <tcf_logic_formula>    ::= <tcf_quantified_formula> | <cnf_formula>
tcf_logic_formula :: CharParser st TCF_logic_formula
tcf_logic_formula :: CharParser st TCF_logic_formula
tcf_logic_formula = String
-> CharParser st TCF_logic_formula
-> CharParser st TCF_logic_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tcf_logic_formula" (
  (TCF_quantified_formula -> TCF_logic_formula)
-> ParsecT String st Identity TCF_quantified_formula
-> CharParser st TCF_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TCF_quantified_formula -> TCF_logic_formula
TCFLF_quantified ParsecT String st Identity TCF_quantified_formula
forall st. CharParser st TCF_quantified_formula
tcf_quantified_formula
  CharParser st TCF_logic_formula
-> CharParser st TCF_logic_formula
-> CharParser st TCF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (CNF_formula -> TCF_logic_formula)
-> ParsecT String st Identity CNF_formula
-> CharParser st TCF_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CNF_formula -> TCF_logic_formula
TCFLF_cnf ParsecT String st Identity CNF_formula
forall st. CharParser st CNF_formula
cnf_formula
  CharParser st TCF_logic_formula
-> String -> CharParser st TCF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tcf_logic_formula"
  )

-- <tcf_quantified_formula> ::= ! [<tff_variable_list>] : <cnf_formula>
tcf_quantified_formula :: CharParser st TCF_quantified_formula
tcf_quantified_formula :: CharParser st TCF_quantified_formula
tcf_quantified_formula = String
-> CharParser st TCF_quantified_formula
-> CharParser st TCF_quantified_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tcf_quantified_formula" (do
    Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '!' CharParser st Token
-> ParsecT String st Identity () -> ParsecT String st Identity ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT String st Identity Char -> ParsecT String st Identity ()
forall s (m :: * -> *) t a u.
(Stream s m t, Show a) =>
ParsecT s u m a -> ParsecT s u m ()
notFollowedBy (String -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
oneOf "!=>")
    TFF_variable_list
vars <- CharParser st TFF_variable_list -> CharParser st TFF_variable_list
forall st a. CharParser st a -> CharParser st a
brackets CharParser st TFF_variable_list
forall st. CharParser st TFF_variable_list
tff_variable_list
    CharParser st Token
forall st. CharParser st Token
colonT
    CNF_formula
f <- CharParser st CNF_formula
forall st. CharParser st CNF_formula
cnf_formula
    TCF_quantified_formula -> CharParser st TCF_quantified_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (TCF_quantified_formula -> CharParser st TCF_quantified_formula)
-> TCF_quantified_formula -> CharParser st TCF_quantified_formula
forall a b. (a -> b) -> a -> b
$ TFF_variable_list -> CNF_formula -> TCF_quantified_formula
TCF_quantified TFF_variable_list
vars CNF_formula
f
  CharParser st TCF_quantified_formula
-> String -> CharParser st TCF_quantified_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tcf_quantified_formula"
  )

{- -----------------------------------------------------------------------------
FOF formulae
----------------------------------------------------------------------------- -}
-- <fof_formula>          ::= <fof_logic_formula> | <fof_sequent>
fof_formula :: CharParser st FOF_formula
fof_formula :: CharParser st TPI_formula
fof_formula = String -> CharParser st TPI_formula -> CharParser st TPI_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_formula" (
  (FOF_logic_formula -> TPI_formula)
-> ParsecT String st Identity FOF_logic_formula
-> CharParser st TPI_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_logic_formula -> TPI_formula
FOFF_logic ParsecT String st Identity FOF_logic_formula
forall st. CharParser st FOF_logic_formula
fof_logic_formula
  CharParser st TPI_formula
-> CharParser st TPI_formula -> CharParser st TPI_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_sequent -> TPI_formula)
-> ParsecT String st Identity FOF_sequent
-> CharParser st TPI_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_sequent -> TPI_formula
FOFF_sequent ParsecT String st Identity FOF_sequent
forall st. CharParser st FOF_sequent
fof_sequent
  CharParser st TPI_formula -> String -> CharParser st TPI_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_formula"
  )

-- <fof_logic_formula>    ::= <fof_binary_formula> | <fof_unitary_formula>
fof_logic_formula :: CharParser st FOF_logic_formula
fof_logic_formula :: CharParser st FOF_logic_formula
fof_logic_formula = String
-> CharParser st FOF_logic_formula
-> CharParser st FOF_logic_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_logic_formula" (do
    FOF_unitary_formula
f <- CharParser st FOF_unitary_formula
forall st. CharParser st FOF_unitary_formula
fof_unitary_formula
    ((FOF_binary_formula -> FOF_logic_formula)
-> ParsecT String st Identity FOF_binary_formula
-> CharParser st FOF_logic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_binary_formula -> FOF_logic_formula
FOFLF_binary (FOF_unitary_formula
-> ParsecT String st Identity FOF_binary_formula
forall st. FOF_unitary_formula -> CharParser st FOF_binary_formula
fof_binary_formula FOF_unitary_formula
f)
      CharParser st FOF_logic_formula
-> CharParser st FOF_logic_formula
-> CharParser st FOF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> FOF_logic_formula -> CharParser st FOF_logic_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_unitary_formula -> FOF_logic_formula
FOFLF_unitary FOF_unitary_formula
f))
  CharParser st FOF_logic_formula
-> String -> CharParser st FOF_logic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_logic_formula"
  )

-- %----Future answer variable ideas | <answer_formula>
-- <fof_binary_formula>   ::= <fof_binary_nonassoc> | <fof_binary_assoc>
fof_binary_formula :: FOF_unitary_formula -> CharParser st FOF_binary_formula
fof_binary_formula :: FOF_unitary_formula -> CharParser st FOF_binary_formula
fof_binary_formula f :: FOF_unitary_formula
f = String
-> CharParser st FOF_binary_formula
-> CharParser st FOF_binary_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_binary_formula" (
  (FOF_binary_nonassoc -> FOF_binary_formula)
-> ParsecT String st Identity FOF_binary_nonassoc
-> CharParser st FOF_binary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_binary_nonassoc -> FOF_binary_formula
FOFBF_nonassoc (FOF_unitary_formula
-> ParsecT String st Identity FOF_binary_nonassoc
forall st. FOF_unitary_formula -> CharParser st FOF_binary_nonassoc
fof_binary_nonassoc FOF_unitary_formula
f)
  CharParser st FOF_binary_formula
-> CharParser st FOF_binary_formula
-> CharParser st FOF_binary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_binary_assoc -> FOF_binary_formula)
-> ParsecT String st Identity FOF_binary_assoc
-> CharParser st FOF_binary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_binary_assoc -> FOF_binary_formula
FOFBF_assoc (FOF_unitary_formula -> ParsecT String st Identity FOF_binary_assoc
forall st. FOF_unitary_formula -> CharParser st FOF_binary_assoc
fof_binary_assoc FOF_unitary_formula
f)
  CharParser st FOF_binary_formula
-> String -> CharParser st FOF_binary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_binary_formula"
  )

-- %----Only some binary connectives are associative
-- %----There's no precedence among binary connectives
-- <fof_binary_nonassoc>  ::= <fof_unitary_formula> <binary_connective>
--                            <fof_unitary_formula>
fof_binary_nonassoc :: FOF_unitary_formula -> CharParser st FOF_binary_nonassoc
fof_binary_nonassoc :: FOF_unitary_formula -> CharParser st FOF_binary_nonassoc
fof_binary_nonassoc f1 :: FOF_unitary_formula
f1 = String
-> CharParser st FOF_binary_nonassoc
-> CharParser st FOF_binary_nonassoc
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_binary_nonassoc" (do
    Binary_connective
bc <- GenParser Char st Binary_connective
-> GenParser Char st Binary_connective
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st Binary_connective
forall st. CharParser st Binary_connective
binary_connective
    FOF_unitary_formula
f2 <- CharParser st FOF_unitary_formula
forall st. CharParser st FOF_unitary_formula
fof_unitary_formula
    FOF_binary_nonassoc -> CharParser st FOF_binary_nonassoc
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_binary_nonassoc -> CharParser st FOF_binary_nonassoc)
-> FOF_binary_nonassoc -> CharParser st FOF_binary_nonassoc
forall a b. (a -> b) -> a -> b
$ Binary_connective
-> FOF_unitary_formula
-> FOF_unitary_formula
-> FOF_binary_nonassoc
FOF_binary_nonassoc Binary_connective
bc FOF_unitary_formula
f1 FOF_unitary_formula
f2
  CharParser st FOF_binary_nonassoc
-> String -> CharParser st FOF_binary_nonassoc
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_binary_nonassoc"
  )

-- <fof_binary_assoc>     ::= <fof_or_formula> | <fof_and_formula>
fof_binary_assoc :: FOF_unitary_formula -> CharParser st FOF_binary_assoc
fof_binary_assoc :: FOF_unitary_formula -> CharParser st FOF_binary_assoc
fof_binary_assoc f :: FOF_unitary_formula
f = String
-> CharParser st FOF_binary_assoc -> CharParser st FOF_binary_assoc
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_binary_assoc" (
  (FOF_or_formula -> FOF_binary_assoc)
-> ParsecT String st Identity FOF_or_formula
-> CharParser st FOF_binary_assoc
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_or_formula -> FOF_binary_assoc
FOFBA_or (FOF_unitary_formula -> ParsecT String st Identity FOF_or_formula
forall st. FOF_unitary_formula -> CharParser st FOF_or_formula
fof_or_formula FOF_unitary_formula
f)
  CharParser st FOF_binary_assoc
-> CharParser st FOF_binary_assoc -> CharParser st FOF_binary_assoc
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_or_formula -> FOF_binary_assoc)
-> ParsecT String st Identity FOF_or_formula
-> CharParser st FOF_binary_assoc
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_or_formula -> FOF_binary_assoc
FOFBA_and (FOF_unitary_formula -> ParsecT String st Identity FOF_or_formula
forall st. FOF_unitary_formula -> CharParser st FOF_or_formula
fof_and_formula FOF_unitary_formula
f)
  CharParser st FOF_binary_assoc
-> String -> CharParser st FOF_binary_assoc
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_binary_assoc"
  )

-- <fof_or_formula>       ::= <fof_unitary_formula> <vline> <fof_unitary_formula> |
--                            <fof_or_formula> <vline> <fof_unitary_formula>
fof_or_formula :: FOF_unitary_formula -> CharParser st FOF_or_formula
fof_or_formula :: FOF_unitary_formula -> CharParser st FOF_or_formula
fof_or_formula f :: FOF_unitary_formula
f = String
-> CharParser st FOF_or_formula -> CharParser st FOF_or_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_or_formula" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st Token
forall st. CharParser st Token
vline
    FOF_or_formula
fs <- CharParser st FOF_unitary_formula
forall st. CharParser st FOF_unitary_formula
fof_unitary_formula CharParser st FOF_unitary_formula
-> GenParser Char st Token -> CharParser st FOF_or_formula
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` GenParser Char st Token
forall st. CharParser st Token
vline
    FOF_or_formula -> CharParser st FOF_or_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_or_formula -> CharParser st FOF_or_formula)
-> FOF_or_formula -> CharParser st FOF_or_formula
forall a b. (a -> b) -> a -> b
$ FOF_unitary_formula
f FOF_unitary_formula -> FOF_or_formula -> FOF_or_formula
forall a. a -> [a] -> [a]
: FOF_or_formula
fs
  CharParser st FOF_or_formula
-> String -> CharParser st FOF_or_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_or_formula"
  )

-- <fof_and_formula>      ::= <fof_unitary_formula> & <fof_unitary_formula> |
--                            <fof_and_formula> & <fof_unitary_formula>
fof_and_formula :: FOF_unitary_formula -> CharParser st FOF_and_formula
fof_and_formula :: FOF_unitary_formula -> CharParser st FOF_or_formula
fof_and_formula f :: FOF_unitary_formula
f = String
-> CharParser st FOF_or_formula -> CharParser st FOF_or_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_and_formula" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st Token
forall st. CharParser st Token
andT
    FOF_or_formula
fs <- CharParser st FOF_unitary_formula
forall st. CharParser st FOF_unitary_formula
fof_unitary_formula CharParser st FOF_unitary_formula
-> GenParser Char st Token -> CharParser st FOF_or_formula
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` GenParser Char st Token
forall st. CharParser st Token
andT
    FOF_or_formula -> CharParser st FOF_or_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_or_formula -> CharParser st FOF_or_formula)
-> FOF_or_formula -> CharParser st FOF_or_formula
forall a b. (a -> b) -> a -> b
$ FOF_unitary_formula
f FOF_unitary_formula -> FOF_or_formula -> FOF_or_formula
forall a. a -> [a] -> [a]
: FOF_or_formula
fs
  CharParser st FOF_or_formula
-> String -> CharParser st FOF_or_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_and_formula"
  )

-- %----<fof_unitary_formula> are in ()s or do not have a <binary_connective> at
-- %----the top level.
-- <fof_unitary_formula>  ::= <fof_quantified_formula> | <fof_unary_formula> |
--                            <fof_atomic_formula> | (<fof_logic_formula>)
fof_unitary_formula :: CharParser st FOF_unitary_formula
fof_unitary_formula :: CharParser st FOF_unitary_formula
fof_unitary_formula = String
-> CharParser st FOF_unitary_formula
-> CharParser st FOF_unitary_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_unitary_formula" (
  (FOF_logic_formula -> FOF_unitary_formula)
-> ParsecT String st Identity FOF_logic_formula
-> CharParser st FOF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_logic_formula -> FOF_unitary_formula
FOFUF_logic (ParsecT String st Identity FOF_logic_formula
-> ParsecT String st Identity FOF_logic_formula
forall st a. CharParser st a -> CharParser st a
parens ParsecT String st Identity FOF_logic_formula
forall st. CharParser st FOF_logic_formula
fof_logic_formula)
  CharParser st FOF_unitary_formula
-> CharParser st FOF_unitary_formula
-> CharParser st FOF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_unary_formula -> FOF_unitary_formula)
-> ParsecT String st Identity FOF_unary_formula
-> CharParser st FOF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_unary_formula -> FOF_unitary_formula
FOFUF_unary ParsecT String st Identity FOF_unary_formula
forall st. CharParser st FOF_unary_formula
fof_unary_formula
  CharParser st FOF_unitary_formula
-> CharParser st FOF_unitary_formula
-> CharParser st FOF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_quantified_formula -> FOF_unitary_formula)
-> ParsecT String st Identity FOF_quantified_formula
-> CharParser st FOF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_quantified_formula -> FOF_unitary_formula
FOFUF_quantified ParsecT String st Identity FOF_quantified_formula
forall st. CharParser st FOF_quantified_formula
fof_quantified_formula
  CharParser st FOF_unitary_formula
-> CharParser st FOF_unitary_formula
-> CharParser st FOF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_atomic_formula -> FOF_unitary_formula)
-> ParsecT String st Identity TFF_atomic_formula
-> CharParser st FOF_unitary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_atomic_formula -> FOF_unitary_formula
FOFUF_atomic ParsecT String st Identity TFF_atomic_formula
forall st. CharParser st TFF_atomic_formula
fof_atomic_formula
  CharParser st FOF_unitary_formula
-> String -> CharParser st FOF_unitary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_unitary_formula"
  )

-- <fof_quantified_formula> ::= <fof_quantifier> [<fof_variable_list>] :
--                            <fof_unitary_formula>
fof_quantified_formula :: CharParser st FOF_quantified_formula
fof_quantified_formula :: CharParser st FOF_quantified_formula
fof_quantified_formula = String
-> CharParser st FOF_quantified_formula
-> CharParser st FOF_quantified_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_quantified_formula" (do
  FOF_quantifier
q <- GenParser Char st FOF_quantifier
-> GenParser Char st FOF_quantifier
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st FOF_quantifier
forall st. CharParser st FOF_quantifier
fof_quantifier
  FOF_variable_list
vars <- CharParser st FOF_variable_list -> CharParser st FOF_variable_list
forall st a. CharParser st a -> CharParser st a
brackets CharParser st FOF_variable_list
forall st. CharParser st FOF_variable_list
fof_variable_list
  CharParser st Token
forall st. CharParser st Token
colonT
  FOF_unitary_formula
f <- CharParser st FOF_unitary_formula
forall st. CharParser st FOF_unitary_formula
fof_unitary_formula
  FOF_quantified_formula -> CharParser st FOF_quantified_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_quantified_formula -> CharParser st FOF_quantified_formula)
-> FOF_quantified_formula -> CharParser st FOF_quantified_formula
forall a b. (a -> b) -> a -> b
$ FOF_quantifier
-> FOF_variable_list
-> FOF_unitary_formula
-> FOF_quantified_formula
FOF_quantified_formula FOF_quantifier
q FOF_variable_list
vars FOF_unitary_formula
f
  )


-- <fof_variable_list>    ::= <variable> | <variable>,<fof_variable_list>
fof_variable_list :: CharParser st FOF_variable_list
fof_variable_list :: CharParser st FOF_variable_list
fof_variable_list = String
-> CharParser st FOF_variable_list
-> CharParser st FOF_variable_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_variable_list" (CharParser st Token -> CharParser st FOF_variable_list
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st Token
forall st. CharParser st Token
variable CharParser st FOF_variable_list
-> String -> CharParser st FOF_variable_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_variable_list"
  )

-- <fof_unary_formula>    ::= <unary_connective> <fof_unitary_formula> |
--                            <fof_infix_unary>
fof_unary_formula :: CharParser st FOF_unary_formula
fof_unary_formula :: CharParser st FOF_unary_formula
fof_unary_formula = String
-> CharParser st FOF_unary_formula
-> CharParser st FOF_unary_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_unary_formula" (do
    Unary_connective
uc <- GenParser Char st Unary_connective
-> GenParser Char st Unary_connective
forall tok st a. GenParser tok st a -> GenParser tok st a
try GenParser Char st Unary_connective
forall st. CharParser st Unary_connective
unary_connective
    FOF_unitary_formula
uf <- CharParser st FOF_unitary_formula
forall st. CharParser st FOF_unitary_formula
fof_unitary_formula
    FOF_unary_formula -> CharParser st FOF_unary_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_unary_formula -> CharParser st FOF_unary_formula)
-> FOF_unary_formula -> CharParser st FOF_unary_formula
forall a b. (a -> b) -> a -> b
$ Unary_connective -> FOF_unitary_formula -> FOF_unary_formula
FOFUF_connective Unary_connective
uc FOF_unitary_formula
uf
  CharParser st FOF_unary_formula
-> CharParser st FOF_unary_formula
-> CharParser st FOF_unary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_infix_unary -> FOF_unary_formula)
-> ParsecT String st Identity FOF_infix_unary
-> CharParser st FOF_unary_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_infix_unary -> FOF_unary_formula
FOFUF_infix ParsecT String st Identity FOF_infix_unary
forall st. CharParser st FOF_infix_unary
fof_infix_unary
  CharParser st FOF_unary_formula
-> String -> CharParser st FOF_unary_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_unary_formula"
  )

-- <fof_infix_unary>      ::= <fof_term> <infix_inequality> <fof_term>
fof_infix_unary :: CharParser st FOF_infix_unary
fof_infix_unary :: CharParser st FOF_infix_unary
fof_infix_unary = String
-> CharParser st FOF_infix_unary -> CharParser st FOF_infix_unary
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_infix_unary" (do
    FOF_term
t1 <- GenParser Char st FOF_term -> GenParser Char st FOF_term
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st FOF_term
forall st. CharParser st FOF_term
fof_term GenParser Char st FOF_term
-> ParsecT String st Identity Token -> GenParser Char st FOF_term
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
infix_inequality)
    FOF_term
t2 <- GenParser Char st FOF_term
forall st. CharParser st FOF_term
fof_term
    FOF_infix_unary -> CharParser st FOF_infix_unary
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_infix_unary -> CharParser st FOF_infix_unary)
-> FOF_infix_unary -> CharParser st FOF_infix_unary
forall a b. (a -> b) -> a -> b
$ FOF_term -> FOF_term -> FOF_infix_unary
FOF_infix_unary FOF_term
t1 FOF_term
t2
  CharParser st FOF_infix_unary
-> String -> CharParser st FOF_infix_unary
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_infix_unary"
  )

-- <fof_atomic_formula>   ::= <fof_plain_atomic_formula> |
--                            <fof_defined_atomic_formula> |
--                            <fof_system_atomic_formula>
fof_atomic_formula :: CharParser st FOF_atomic_formula
fof_atomic_formula :: CharParser st TFF_atomic_formula
fof_atomic_formula = String
-> CharParser st TFF_atomic_formula
-> CharParser st TFF_atomic_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_atomic_formula" (
  (FOF_defined_atomic_formula -> TFF_atomic_formula)
-> ParsecT String st Identity FOF_defined_atomic_formula
-> CharParser st TFF_atomic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_defined_atomic_formula -> TFF_atomic_formula
FOFAT_defined ParsecT String st Identity FOF_defined_atomic_formula
forall st. CharParser st FOF_defined_atomic_formula
fof_defined_atomic_formula
  CharParser st TFF_atomic_formula
-> CharParser st TFF_atomic_formula
-> CharParser st TFF_atomic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_system_atomic_formula -> TFF_atomic_formula)
-> ParsecT String st Identity FOF_system_atomic_formula
-> CharParser st TFF_atomic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_system_atomic_formula -> TFF_atomic_formula
FOFAT_system ParsecT String st Identity FOF_system_atomic_formula
forall st. CharParser st FOF_system_atomic_formula
fof_system_atomic_formula
  CharParser st TFF_atomic_formula
-> CharParser st TFF_atomic_formula
-> CharParser st TFF_atomic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_plain_atomic_formula -> TFF_atomic_formula)
-> ParsecT String st Identity FOF_plain_atomic_formula
-> CharParser st TFF_atomic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_plain_atomic_formula -> TFF_atomic_formula
FOFAT_plain ParsecT String st Identity FOF_plain_atomic_formula
forall st. CharParser st FOF_plain_atomic_formula
fof_plain_atomic_formula
  CharParser st TFF_atomic_formula
-> String -> CharParser st TFF_atomic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_atomic_formula"
  )

-- <fof_plain_atomic_formula> ::= <fof_plain_term>
-- <fof_plain_atomic_formula> :== <proposition> | <predicate>(<fof_arguments>)
fof_plain_atomic_formula :: CharParser st FOF_plain_atomic_formula
fof_plain_atomic_formula :: CharParser st FOF_plain_atomic_formula
fof_plain_atomic_formula = String
-> CharParser st FOF_plain_atomic_formula
-> CharParser st FOF_plain_atomic_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_plain_atomic_formula" (do
    Token
p <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
predicate GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    FOF_arguments
args <- CharParser st FOF_arguments
forall st. CharParser st FOF_arguments
fof_arguments CharParser st FOF_arguments
-> GenParser Char st Token -> CharParser st FOF_arguments
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
cParenT
    FOF_plain_atomic_formula -> CharParser st FOF_plain_atomic_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_plain_atomic_formula
 -> CharParser st FOF_plain_atomic_formula)
-> FOF_plain_atomic_formula
-> CharParser st FOF_plain_atomic_formula
forall a b. (a -> b) -> a -> b
$ Token -> FOF_arguments -> FOF_plain_atomic_formula
FOFPAF_predicate Token
p FOF_arguments
args
  CharParser st FOF_plain_atomic_formula
-> CharParser st FOF_plain_atomic_formula
-> CharParser st FOF_plain_atomic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> FOF_plain_atomic_formula)
-> GenParser Char st Token
-> CharParser st FOF_plain_atomic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> FOF_plain_atomic_formula
FOFPAF_proposition GenParser Char st Token
forall st. CharParser st Token
proposition
  CharParser st FOF_plain_atomic_formula
-> String -> CharParser st FOF_plain_atomic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_plain_atomic_formula"
  )

-- <fof_defined_atomic_formula> ::= <fof_defined_plain_formula> |
--                            <fof_defined_infix_formula>
fof_defined_atomic_formula :: CharParser st FOF_defined_atomic_formula
fof_defined_atomic_formula :: CharParser st FOF_defined_atomic_formula
fof_defined_atomic_formula = String
-> CharParser st FOF_defined_atomic_formula
-> CharParser st FOF_defined_atomic_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_defined_atomic_formula" (
  (FOF_defined_plain_formula -> FOF_defined_atomic_formula)
-> ParsecT String st Identity FOF_defined_plain_formula
-> CharParser st FOF_defined_atomic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_defined_plain_formula -> FOF_defined_atomic_formula
FOFDAF_plain ParsecT String st Identity FOF_defined_plain_formula
forall st. CharParser st FOF_defined_plain_formula
fof_defined_plain_formula
  CharParser st FOF_defined_atomic_formula
-> CharParser st FOF_defined_atomic_formula
-> CharParser st FOF_defined_atomic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_defined_infix_formula -> FOF_defined_atomic_formula)
-> ParsecT String st Identity FOF_defined_infix_formula
-> CharParser st FOF_defined_atomic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_defined_infix_formula -> FOF_defined_atomic_formula
FOFDAF_infix ParsecT String st Identity FOF_defined_infix_formula
forall st. CharParser st FOF_defined_infix_formula
fof_defined_infix_formula
  CharParser st FOF_defined_atomic_formula
-> String -> CharParser st FOF_defined_atomic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_defined_atomic_formula"
  )

-- <fof_defined_plain_formula> ::= <fof_defined_plain_term>
-- <fof_defined_plain_formula> :== <defined_proposition> |
--                            <defined_predicate>(<fof_arguments>)
fof_defined_plain_formula :: CharParser st FOF_defined_plain_formula
fof_defined_plain_formula :: CharParser st FOF_defined_plain_formula
fof_defined_plain_formula = String
-> CharParser st FOF_defined_plain_formula
-> CharParser st FOF_defined_plain_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_defined_plain_formula" (do
    Defined_predicate
p <- GenParser Char st Defined_predicate
-> GenParser Char st Defined_predicate
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Defined_predicate
forall st. CharParser st Defined_predicate
defined_predicate GenParser Char st Defined_predicate
-> ParsecT String st Identity Token
-> GenParser Char st Defined_predicate
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
oParenT)
    FOF_arguments
args <- CharParser st FOF_arguments
forall st. CharParser st FOF_arguments
fof_arguments CharParser st FOF_arguments
-> ParsecT String st Identity Token -> CharParser st FOF_arguments
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
cParenT
    FOF_defined_plain_formula
-> CharParser st FOF_defined_plain_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_defined_plain_formula
 -> CharParser st FOF_defined_plain_formula)
-> FOF_defined_plain_formula
-> CharParser st FOF_defined_plain_formula
forall a b. (a -> b) -> a -> b
$ Defined_predicate -> FOF_arguments -> FOF_defined_plain_formula
FOFDPF_predicate Defined_predicate
p FOF_arguments
args
  CharParser st FOF_defined_plain_formula
-> CharParser st FOF_defined_plain_formula
-> CharParser st FOF_defined_plain_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Defined_proposition -> FOF_defined_plain_formula)
-> ParsecT String st Identity Defined_proposition
-> CharParser st FOF_defined_plain_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Defined_proposition -> FOF_defined_plain_formula
FOFDPF_proposition ParsecT String st Identity Defined_proposition
forall st. CharParser st Defined_proposition
defined_proposition
  CharParser st FOF_defined_plain_formula
-> String -> CharParser st FOF_defined_plain_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_defined_plain_formula"
  )

-- <fof_defined_infix_formula> ::= <fof_term> <defined_infix_pred> <fof_term>
fof_defined_infix_formula :: CharParser st FOF_defined_infix_formula
fof_defined_infix_formula :: CharParser st FOF_defined_infix_formula
fof_defined_infix_formula = String
-> CharParser st FOF_defined_infix_formula
-> CharParser st FOF_defined_infix_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_defined_infix_formula" (do
    (t1 :: FOF_term
t1, i :: Defined_infix_pred
i) <- GenParser Char st (FOF_term, Defined_infix_pred)
-> GenParser Char st (FOF_term, Defined_infix_pred)
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st (FOF_term, Defined_infix_pred)
 -> GenParser Char st (FOF_term, Defined_infix_pred))
-> GenParser Char st (FOF_term, Defined_infix_pred)
-> GenParser Char st (FOF_term, Defined_infix_pred)
forall a b. (a -> b) -> a -> b
$ do
      FOF_term
t1 <- CharParser st FOF_term
forall st. CharParser st FOF_term
fof_term
      Defined_infix_pred
i <- CharParser st Defined_infix_pred
forall st. CharParser st Defined_infix_pred
defined_infix_pred
      (FOF_term, Defined_infix_pred)
-> GenParser Char st (FOF_term, Defined_infix_pred)
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_term
t1, Defined_infix_pred
i)
    FOF_term
t2 <- CharParser st FOF_term
forall st. CharParser st FOF_term
fof_term
    FOF_defined_infix_formula
-> CharParser st FOF_defined_infix_formula
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_defined_infix_formula
 -> CharParser st FOF_defined_infix_formula)
-> FOF_defined_infix_formula
-> CharParser st FOF_defined_infix_formula
forall a b. (a -> b) -> a -> b
$ Defined_infix_pred
-> FOF_term -> FOF_term -> FOF_defined_infix_formula
FOF_defined_infix_formula Defined_infix_pred
i FOF_term
t1 FOF_term
t2
  CharParser st FOF_defined_infix_formula
-> String -> CharParser st FOF_defined_infix_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_defined_infix_formula"
  )

-- %----System terms have system specific interpretations
-- <fof_system_atomic_formula> ::= <fof_system_term>
fof_system_atomic_formula :: CharParser st FOF_system_atomic_formula
fof_system_atomic_formula :: CharParser st FOF_system_atomic_formula
fof_system_atomic_formula = String
-> CharParser st FOF_system_atomic_formula
-> CharParser st FOF_system_atomic_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_system_atomic_formula" (
  (FOF_system_term -> FOF_system_atomic_formula)
-> ParsecT String st Identity FOF_system_term
-> CharParser st FOF_system_atomic_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_system_term -> FOF_system_atomic_formula
FOF_system_atomic_formula ParsecT String st Identity FOF_system_term
forall st. CharParser st FOF_system_term
fof_system_term
  CharParser st FOF_system_atomic_formula
-> String -> CharParser st FOF_system_atomic_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_system_atomic_formula"
  )

-- <fof_plain_term>       ::= <constant> | <functor>(<fof_arguments>)
fof_plain_term :: CharParser st FOF_plain_term
fof_plain_term :: CharParser st FOF_plain_term
fof_plain_term = String
-> CharParser st FOF_plain_term -> CharParser st FOF_plain_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_plain_term" (do
    Token
f <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
functor GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    FOF_arguments
args <- CharParser st FOF_arguments
forall st. CharParser st FOF_arguments
fof_arguments CharParser st FOF_arguments
-> GenParser Char st Token -> CharParser st FOF_arguments
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
cParenT
    FOF_plain_term -> CharParser st FOF_plain_term
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_plain_term -> CharParser st FOF_plain_term)
-> FOF_plain_term -> CharParser st FOF_plain_term
forall a b. (a -> b) -> a -> b
$ Token -> FOF_arguments -> FOF_plain_term
FOFPT_functor Token
f FOF_arguments
args
  CharParser st FOF_plain_term
-> CharParser st FOF_plain_term -> CharParser st FOF_plain_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> FOF_plain_term)
-> GenParser Char st Token -> CharParser st FOF_plain_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> FOF_plain_term
FOFPT_constant GenParser Char st Token
forall st. CharParser st Token
constant
  CharParser st FOF_plain_term
-> String -> CharParser st FOF_plain_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_plain_term"
  )

-- %----Defined terms have TPTP specific interpretations
-- <fof_defined_term>     ::= <defined_term> | <fof_defined_atomic_term>
fof_defined_term :: CharParser st FOF_defined_term
fof_defined_term :: CharParser st FOF_defined_term
fof_defined_term = String
-> CharParser st FOF_defined_term -> CharParser st FOF_defined_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_defined_term" (
  (Defined_term -> FOF_defined_term)
-> ParsecT String st Identity Defined_term
-> CharParser st FOF_defined_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Defined_term -> FOF_defined_term
FOFDT_term ParsecT String st Identity Defined_term
forall st. CharParser st Defined_term
defined_term
  CharParser st FOF_defined_term
-> CharParser st FOF_defined_term -> CharParser st FOF_defined_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_defined_atomic_term -> FOF_defined_term)
-> ParsecT String st Identity FOF_defined_atomic_term
-> CharParser st FOF_defined_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_defined_atomic_term -> FOF_defined_term
FOFDT_atomic ParsecT String st Identity FOF_defined_atomic_term
forall st. CharParser st FOF_defined_atomic_term
fof_defined_atomic_term
  CharParser st FOF_defined_term
-> String -> CharParser st FOF_defined_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_defined_term"
  )

-- <fof_defined_atomic_term>  ::= <fof_defined_plain_term>
-- %----None yet             | <defined_infix_term>
fof_defined_atomic_term :: CharParser st FOF_defined_atomic_term
fof_defined_atomic_term :: CharParser st FOF_defined_atomic_term
fof_defined_atomic_term = String
-> CharParser st FOF_defined_atomic_term
-> CharParser st FOF_defined_atomic_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_defined_atomic_term" (
  (FOF_defined_plain_term -> FOF_defined_atomic_term)
-> ParsecT String st Identity FOF_defined_plain_term
-> CharParser st FOF_defined_atomic_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_defined_plain_term -> FOF_defined_atomic_term
FOFDAT_plain ParsecT String st Identity FOF_defined_plain_term
forall st. CharParser st FOF_defined_plain_term
fof_defined_plain_term
  CharParser st FOF_defined_atomic_term
-> String -> CharParser st FOF_defined_atomic_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_defined_atomic_term"
  )

-- %----None yet <defined_infix_term> ::= <fof_term> <defined_infix_func> <fof_term>
-- data Defined_infix_term = Defined_infix_term Defined_infix_func FOF_term FOF_term
--                           deriving (Show, Ord, Eq, Data, Typeable)

-- %----None yet <defined_infix_func> ::=
-- data Defined_infix_func =

-- <fof_defined_plain_term>   ::= <defined_constant> |
--                            <defined_functor>(<fof_arguments>)
-- %----Add $tuple for tuples, because [<fof_arguments>] doesn't work.
fof_defined_plain_term :: CharParser st FOF_defined_plain_term
fof_defined_plain_term :: CharParser st FOF_defined_plain_term
fof_defined_plain_term = String
-> CharParser st FOF_defined_plain_term
-> CharParser st FOF_defined_plain_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_defined_plain_term" (do
    Defined_functor
f <- GenParser Char st Defined_functor
-> GenParser Char st Defined_functor
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Defined_functor
forall st. CharParser st Defined_functor
defined_functor GenParser Char st Defined_functor
-> ParsecT String st Identity Token
-> GenParser Char st Defined_functor
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
oParenT)
    FOF_arguments
args <- CharParser st FOF_arguments
forall st. CharParser st FOF_arguments
fof_arguments CharParser st FOF_arguments
-> ParsecT String st Identity Token -> CharParser st FOF_arguments
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
cParenT
    FOF_defined_plain_term -> CharParser st FOF_defined_plain_term
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_defined_plain_term -> CharParser st FOF_defined_plain_term)
-> FOF_defined_plain_term -> CharParser st FOF_defined_plain_term
forall a b. (a -> b) -> a -> b
$ Defined_functor -> FOF_arguments -> FOF_defined_plain_term
FOFDPT_functor Defined_functor
f FOF_arguments
args
  CharParser st FOF_defined_plain_term
-> CharParser st FOF_defined_plain_term
-> CharParser st FOF_defined_plain_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Defined_functor -> FOF_defined_plain_term)
-> GenParser Char st Defined_functor
-> CharParser st FOF_defined_plain_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Defined_functor -> FOF_defined_plain_term
FOFDPT_constant GenParser Char st Defined_functor
forall st. CharParser st Defined_functor
defined_constant
  CharParser st FOF_defined_plain_term
-> String -> CharParser st FOF_defined_plain_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_defined_plain_term"
  )

-- %----System terms have system specific interpretations
-- <fof_system_term>      ::= <system_constant> | <system_functor>(<fof_arguments>)
fof_system_term :: CharParser st FOF_system_term
fof_system_term :: CharParser st FOF_system_term
fof_system_term = String
-> CharParser st FOF_system_term -> CharParser st FOF_system_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_system_term" (do
    Token
f <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
system_functor GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    FOF_arguments
args <- CharParser st FOF_arguments
forall st. CharParser st FOF_arguments
fof_arguments CharParser st FOF_arguments
-> GenParser Char st Token -> CharParser st FOF_arguments
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
cParenT
    FOF_system_term -> CharParser st FOF_system_term
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_system_term -> CharParser st FOF_system_term)
-> FOF_system_term -> CharParser st FOF_system_term
forall a b. (a -> b) -> a -> b
$ Token -> FOF_arguments -> FOF_system_term
FOFST_functor Token
f FOF_arguments
args
  CharParser st FOF_system_term
-> CharParser st FOF_system_term -> CharParser st FOF_system_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> FOF_system_term)
-> GenParser Char st Token -> CharParser st FOF_system_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> FOF_system_term
FOFST_constant GenParser Char st Token
forall st. CharParser st Token
system_constant
  CharParser st FOF_system_term
-> String -> CharParser st FOF_system_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_system_term"
  )

-- %----Arguments recurse back up to terms (this is the FOF world here)
-- <fof_arguments>        ::= <fof_term> | <fof_term>,<fof_arguments>
fof_arguments :: CharParser st FOF_arguments
fof_arguments :: CharParser st FOF_arguments
fof_arguments = String
-> CharParser st FOF_arguments -> CharParser st FOF_arguments
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_arguments" (
  CharParser st FOF_term -> CharParser st FOF_arguments
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st FOF_term
forall st. CharParser st FOF_term
fof_term
  CharParser st FOF_arguments
-> String -> CharParser st FOF_arguments
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_arguments"
  )

-- %----These are terms used as arguments. Not the entry point for terms because
-- %----<fof_plain_term> is also used as <fof_plain_atomic_formula>
-- <fof_term>             ::= <fof_function_term> | <variable> |
--                            <tff_conditional_term> | <tff_let_term>
fof_term :: CharParser st FOF_term
fof_term :: CharParser st FOF_term
fof_term = String -> CharParser st FOF_term -> CharParser st FOF_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_term" (
  (TFF_let_term -> FOF_term)
-> ParsecT String st Identity TFF_let_term
-> CharParser st FOF_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_let_term -> FOF_term
FOFT_let ParsecT String st Identity TFF_let_term
forall st. CharParser st TFF_let_term
tff_let_term
  CharParser st FOF_term
-> CharParser st FOF_term -> CharParser st FOF_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_conditional_term -> FOF_term)
-> ParsecT String st Identity TFF_conditional_term
-> CharParser st FOF_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_conditional_term -> FOF_term
FOFT_conditional ParsecT String st Identity TFF_conditional_term
forall st. CharParser st TFF_conditional_term
tff_conditional_term
  CharParser st FOF_term
-> CharParser st FOF_term -> CharParser st FOF_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> FOF_term)
-> ParsecT String st Identity Token -> CharParser st FOF_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> FOF_term
FOFT_variable ParsecT String st Identity Token
forall st. CharParser st Token
variable
  CharParser st FOF_term
-> CharParser st FOF_term -> CharParser st FOF_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_function_term -> FOF_term)
-> ParsecT String st Identity FOF_function_term
-> CharParser st FOF_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_function_term -> FOF_term
FOFT_function ParsecT String st Identity FOF_function_term
forall st. CharParser st FOF_function_term
fof_function_term
  CharParser st FOF_term -> String -> CharParser st FOF_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_term"
  )

-- %% DAMN THIS JUST WON'T WORK | <tuple_term>
-- %----<tuple_term> is for TFF only, but it's here because it's used in
-- %----<fof_atomic_formula>, which is also used as <tff_atomic_formula>.
-- % <tuple_term>           ::= [] | [<fof_arguments>]
-- <fof_function_term>    ::= <fof_plain_term> | <fof_defined_term> |
--                            <fof_system_term>
fof_function_term :: CharParser st FOF_function_term
fof_function_term :: CharParser st FOF_function_term
fof_function_term = String
-> CharParser st FOF_function_term
-> CharParser st FOF_function_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_function_term" (
  (FOF_system_term -> FOF_function_term)
-> ParsecT String st Identity FOF_system_term
-> CharParser st FOF_function_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_system_term -> FOF_function_term
FOFFT_system ParsecT String st Identity FOF_system_term
forall st. CharParser st FOF_system_term
fof_system_term
  CharParser st FOF_function_term
-> CharParser st FOF_function_term
-> CharParser st FOF_function_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_defined_term -> FOF_function_term)
-> ParsecT String st Identity FOF_defined_term
-> CharParser st FOF_function_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_defined_term -> FOF_function_term
FOFFT_defined ParsecT String st Identity FOF_defined_term
forall st. CharParser st FOF_defined_term
fof_defined_term
  CharParser st FOF_function_term
-> CharParser st FOF_function_term
-> CharParser st FOF_function_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_plain_term -> FOF_function_term)
-> ParsecT String st Identity FOF_plain_term
-> CharParser st FOF_function_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_plain_term -> FOF_function_term
FOFFT_plain ParsecT String st Identity FOF_plain_term
forall st. CharParser st FOF_plain_term
fof_plain_term
  CharParser st FOF_function_term
-> String -> CharParser st FOF_function_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_function_term"
  )

-- %----Conditional terms should be used by only TFF.
-- <tff_conditional_term> ::= $ite_t(<tff_logic_formula>,<fof_term>,<fof_term>)
tff_conditional_term :: CharParser st TFF_conditional_term
tff_conditional_term :: CharParser st TFF_conditional_term
tff_conditional_term = String
-> CharParser st TFF_conditional_term
-> CharParser st TFF_conditional_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_conditional_term" (do
    String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "$ite_t"
    CharParser st Token
forall st. CharParser st Token
oParenT
    TFF_logic_formula
f_if <- CharParser st TFF_logic_formula
forall st. CharParser st TFF_logic_formula
tff_logic_formula
    CharParser st Token
forall st. CharParser st Token
commaT
    FOF_term
t_then <- CharParser st FOF_term
forall st. CharParser st FOF_term
fof_term
    CharParser st Token
forall st. CharParser st Token
commaT
    FOF_term
t_else <- CharParser st FOF_term
forall st. CharParser st FOF_term
fof_term
    CharParser st Token
forall st. CharParser st Token
cParenT
    TFF_conditional_term -> CharParser st TFF_conditional_term
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_conditional_term -> CharParser st TFF_conditional_term)
-> TFF_conditional_term -> CharParser st TFF_conditional_term
forall a b. (a -> b) -> a -> b
$ TFF_logic_formula -> FOF_term -> FOF_term -> TFF_conditional_term
TFF_conditional_term TFF_logic_formula
f_if FOF_term
t_then FOF_term
t_else
  CharParser st TFF_conditional_term
-> String -> CharParser st TFF_conditional_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_conditional_term"
  )

-- %----Let terms should be used by only TFF. $let_ft is for use when there is
-- %----a $ite_t in the <fof_term>. See the commentary for $let_tf and $let_ff.
-- <tff_let_term>         ::= $let_ft(<tff_let_formula_defns>,<fof_term>) |
--                            $let_tt(<tff_let_term_defns>,<fof_term>)
tff_let_term :: CharParser st TFF_let_term
tff_let_term :: CharParser st TFF_let_term
tff_let_term = String -> CharParser st TFF_let_term -> CharParser st TFF_let_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "tff_let_term" (do
    String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "$let_ft"
    CharParser st Token
forall st. CharParser st Token
oParenT
    TFF_let_formula_defns
defns <- CharParser st TFF_let_formula_defns
forall st. CharParser st TFF_let_formula_defns
tff_let_formula_defns
    CharParser st Token
forall st. CharParser st Token
commaT
    FOF_term
t <- CharParser st FOF_term
forall st. CharParser st FOF_term
fof_term
    CharParser st Token
forall st. CharParser st Token
cParenT
    TFF_let_term -> CharParser st TFF_let_term
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_let_term -> CharParser st TFF_let_term)
-> TFF_let_term -> CharParser st TFF_let_term
forall a b. (a -> b) -> a -> b
$ TFF_let_formula_defns -> FOF_term -> TFF_let_term
TFFLT_formula TFF_let_formula_defns
defns FOF_term
t
  CharParser st TFF_let_term
-> CharParser st TFF_let_term -> CharParser st TFF_let_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> do
    String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "$let_tt"
    CharParser st Token
forall st. CharParser st Token
oParenT
    TFF_let_term_defns
defns <- CharParser st TFF_let_term_defns
forall st. CharParser st TFF_let_term_defns
tff_let_term_defns
    CharParser st Token
forall st. CharParser st Token
commaT
    FOF_term
t <- CharParser st FOF_term
forall st. CharParser st FOF_term
fof_term
    CharParser st Token
forall st. CharParser st Token
cParenT
    TFF_let_term -> CharParser st TFF_let_term
forall (m :: * -> *) a. Monad m => a -> m a
return (TFF_let_term -> CharParser st TFF_let_term)
-> TFF_let_term -> CharParser st TFF_let_term
forall a b. (a -> b) -> a -> b
$ TFF_let_term_defns -> FOF_term -> TFF_let_term
TFFLT_term TFF_let_term_defns
defns FOF_term
t
  CharParser st TFF_let_term -> String -> CharParser st TFF_let_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "tff_let_term"
  )


-- %----This section is the FOFX syntax. Not yet in use.
-- % <fof_let>            ::= := [<fof_let_list>] : <fof_unitary_formula>
-- % <fof_let_list>       ::= <fof_defined_var> |
-- %                          <fof_defined_var>,<fof_let_list>
-- % <fof_defined_var>    ::= <variable> := <fof_logic_formula> |
-- %                          <variable> :- <fof_term> | (<fof_defined_var>)
-- %
-- % <fof_conditional>    ::= $ite_f(<fof_logic_formula>,<fof_logic_formula>,
-- %                          <fof_logic_formula>)
-- %
-- % <fof_conditional_term> ::= $ite_t(<fof_logic_formula>,<fof_term>,<fof_term>)

-- <fof_sequent>          ::= <fof_formula_tuple> <gentzen_arrow>
--                            <fof_formula_tuple> | (<fof_sequent>)
fof_sequent :: CharParser st FOF_sequent
fof_sequent :: CharParser st FOF_sequent
fof_sequent = String -> CharParser st FOF_sequent -> CharParser st FOF_sequent
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_sequent" (do
    FOF_formula_tuple
ft1 <- GenParser Char st FOF_formula_tuple
-> GenParser Char st FOF_formula_tuple
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st FOF_formula_tuple
forall st. CharParser st FOF_formula_tuple
fof_formula_tuple GenParser Char st FOF_formula_tuple
-> ParsecT String st Identity Token
-> GenParser Char st FOF_formula_tuple
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
gentzen_arrow)
    FOF_formula_tuple
ft2 <- GenParser Char st FOF_formula_tuple
forall st. CharParser st FOF_formula_tuple
fof_formula_tuple
    FOF_sequent -> CharParser st FOF_sequent
forall (m :: * -> *) a. Monad m => a -> m a
return (FOF_sequent -> CharParser st FOF_sequent)
-> FOF_sequent -> CharParser st FOF_sequent
forall a b. (a -> b) -> a -> b
$ FOF_formula_tuple -> FOF_formula_tuple -> FOF_sequent
FOFS_plain FOF_formula_tuple
ft1 FOF_formula_tuple
ft2
  CharParser st FOF_sequent
-> CharParser st FOF_sequent -> CharParser st FOF_sequent
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (FOF_sequent -> FOF_sequent)
-> CharParser st FOF_sequent -> CharParser st FOF_sequent
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_sequent -> FOF_sequent
FOFS_parens (CharParser st FOF_sequent -> CharParser st FOF_sequent
forall st a. CharParser st a -> CharParser st a
parens CharParser st FOF_sequent
forall st. CharParser st FOF_sequent
fof_sequent)
  CharParser st FOF_sequent -> String -> CharParser st FOF_sequent
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_sequent"
  )

-- <fof_formula_tuple>    ::= [] | [<fof_formula_tuple_list>]
fof_formula_tuple :: CharParser st FOF_formula_tuple
fof_formula_tuple :: CharParser st FOF_formula_tuple
fof_formula_tuple = String
-> CharParser st FOF_formula_tuple
-> CharParser st FOF_formula_tuple
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_formula_tuple" (
  (FOF_formula_tuple_list -> FOF_formula_tuple)
-> ParsecT String st Identity FOF_formula_tuple_list
-> CharParser st FOF_formula_tuple
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_formula_tuple_list -> FOF_formula_tuple
FOF_formula_tuple (ParsecT String st Identity FOF_formula_tuple_list
forall st a. CharParser st [a]
emptyBrackets ParsecT String st Identity FOF_formula_tuple_list
-> ParsecT String st Identity FOF_formula_tuple_list
-> ParsecT String st Identity FOF_formula_tuple_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ParsecT String st Identity FOF_formula_tuple_list
-> ParsecT String st Identity FOF_formula_tuple_list
forall st a. CharParser st a -> CharParser st a
brackets ParsecT String st Identity FOF_formula_tuple_list
forall st. CharParser st FOF_formula_tuple_list
fof_formula_tuple_list)
  CharParser st FOF_formula_tuple
-> String -> CharParser st FOF_formula_tuple
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_formula_tuple"
  )

-- <fof_formula_tuple_list> ::= <fof_logic_formula> |
--                            <fof_logic_formula>,<fof_formula_tuple_list>
fof_formula_tuple_list :: CharParser st FOF_formula_tuple_list
fof_formula_tuple_list :: CharParser st FOF_formula_tuple_list
fof_formula_tuple_list = String
-> CharParser st FOF_formula_tuple_list
-> CharParser st FOF_formula_tuple_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_formula_tuple_list" (
  CharParser st FOF_logic_formula
-> CharParser st FOF_formula_tuple_list
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st FOF_logic_formula
forall st. CharParser st FOF_logic_formula
fof_logic_formula
  CharParser st FOF_formula_tuple_list
-> String -> CharParser st FOF_formula_tuple_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_formula_tuple_list"
  )

{- -----------------------------------------------------------------------------
CNF formulae (variables implicitly universally quantified)
----------------------------------------------------------------------------- -}
-- <cnf_formula>          ::= <disjunction> | (<disjunction>)
cnf_formula :: CharParser st CNF_formula
cnf_formula :: CharParser st CNF_formula
cnf_formula = String -> CharParser st CNF_formula -> CharParser st CNF_formula
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "cnf_formula" (
  (Disjunction -> CNF_formula)
-> ParsecT String st Identity Disjunction
-> CharParser st CNF_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Disjunction -> CNF_formula
CNFF_parens (ParsecT String st Identity Disjunction
-> ParsecT String st Identity Disjunction
forall st a. CharParser st a -> CharParser st a
parens ParsecT String st Identity Disjunction
forall st. CharParser st Disjunction
disjunction)
  CharParser st CNF_formula
-> CharParser st CNF_formula -> CharParser st CNF_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Disjunction -> CNF_formula)
-> ParsecT String st Identity Disjunction
-> CharParser st CNF_formula
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Disjunction -> CNF_formula
CNFF_plain ParsecT String st Identity Disjunction
forall st. CharParser st Disjunction
disjunction
  CharParser st CNF_formula -> String -> CharParser st CNF_formula
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "cnf_formula"
  )

-- <disjunction>          ::= <literal> | <disjunction> <vline> <literal>
disjunction :: CharParser st Disjunction
disjunction :: CharParser st Disjunction
disjunction = String -> CharParser st Disjunction -> CharParser st Disjunction
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "disjunction" (
  ([Literal] -> Disjunction)
-> ParsecT String st Identity [Literal]
-> CharParser st Disjunction
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM [Literal] -> Disjunction
Disjunction (CharParser st Literal
forall st. CharParser st Literal
literal CharParser st Literal
-> ParsecT String st Identity Token
-> ParsecT String st Identity [Literal]
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` ParsecT String st Identity Token
forall st. CharParser st Token
vline)
  CharParser st Disjunction -> String -> CharParser st Disjunction
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "disjunction"
  )

-- <literal>              ::= <fof_atomic_formula> | ~ <fof_atomic_formula> |
--                            <fof_infix_unary>
literal :: CharParser st Literal
literal :: CharParser st Literal
literal = String -> CharParser st Literal -> CharParser st Literal
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "literal" (
  (FOF_infix_unary -> Literal)
-> ParsecT String st Identity FOF_infix_unary
-> CharParser st Literal
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_infix_unary -> Literal
Lit_fof_infix ParsecT String st Identity FOF_infix_unary
forall st. CharParser st FOF_infix_unary
fof_infix_unary
  CharParser st Literal
-> CharParser st Literal -> CharParser st Literal
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st Literal
forall st. CharParser st Literal
not_fof_atomic_formula
  CharParser st Literal
-> CharParser st Literal -> CharParser st Literal
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TFF_atomic_formula -> Literal)
-> ParsecT String st Identity TFF_atomic_formula
-> CharParser st Literal
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_atomic_formula -> Literal
Lit_atomic ParsecT String st Identity TFF_atomic_formula
forall st. CharParser st TFF_atomic_formula
fof_atomic_formula
  CharParser st Literal -> String -> CharParser st Literal
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "literal"
  )
  where
    not_fof_atomic_formula :: ParsecT String st Identity Literal
not_fof_atomic_formula = do
      Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '~'
      (TFF_atomic_formula -> Literal)
-> ParsecT String st Identity TFF_atomic_formula
-> ParsecT String st Identity Literal
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TFF_atomic_formula -> Literal
Lit_negative ParsecT String st Identity TFF_atomic_formula
forall st. CharParser st TFF_atomic_formula
fof_atomic_formula

-- %----Connectives - THF
-- <thf_quantifier>       ::= <fof_quantifier> | <th0_quantifier> |
--                            <th1_quantifier>
thf_quantifier :: CharParser st THF_quantifier
thf_quantifier :: CharParser st THF_quantifier
thf_quantifier = String
-> CharParser st THF_quantifier -> CharParser st THF_quantifier
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_quantifier" (
  (FOF_quantifier -> THF_quantifier)
-> ParsecT String st Identity FOF_quantifier
-> CharParser st THF_quantifier
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM FOF_quantifier -> THF_quantifier
THFQ_fof ParsecT String st Identity FOF_quantifier
forall st. CharParser st FOF_quantifier
fof_quantifier
  CharParser st THF_quantifier
-> CharParser st THF_quantifier -> CharParser st THF_quantifier
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TH0_quantifier -> THF_quantifier)
-> ParsecT String st Identity TH0_quantifier
-> CharParser st THF_quantifier
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TH0_quantifier -> THF_quantifier
THFQ_th0 ParsecT String st Identity TH0_quantifier
forall st. CharParser st TH0_quantifier
th0_quantifier
  CharParser st THF_quantifier
-> CharParser st THF_quantifier -> CharParser st THF_quantifier
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (TH1_quantifier -> THF_quantifier)
-> ParsecT String st Identity TH1_quantifier
-> CharParser st THF_quantifier
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TH1_quantifier -> THF_quantifier
THFQ_th1 ParsecT String st Identity TH1_quantifier
forall st. CharParser st TH1_quantifier
th1_quantifier
  CharParser st THF_quantifier
-> String -> CharParser st THF_quantifier
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_quantifier"
  )

-- %----TH0 quantifiers are also available in TH1
-- <th1_quantifier>       ::= !> | ?*
th1_quantifier :: CharParser st TH1_quantifier
th1_quantifier :: CharParser st TH1_quantifier
th1_quantifier = String
-> CharParser st TH1_quantifier -> CharParser st TH1_quantifier
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "th1_quantifier" (
  (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "!>" CharParser st Token
-> CharParser st TH1_quantifier -> CharParser st TH1_quantifier
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TH1_quantifier -> CharParser st TH1_quantifier
forall (m :: * -> *) a. Monad m => a -> m a
return TH1_quantifier
TH1_DependentProduct)
  CharParser st TH1_quantifier
-> CharParser st TH1_quantifier -> CharParser st TH1_quantifier
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "?*" CharParser st Token
-> CharParser st TH1_quantifier -> CharParser st TH1_quantifier
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TH1_quantifier -> CharParser st TH1_quantifier
forall (m :: * -> *) a. Monad m => a -> m a
return TH1_quantifier
TH1_DependentSum)
  CharParser st TH1_quantifier
-> String -> CharParser st TH1_quantifier
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "th1_quantifier"
  )

-- <th0_quantifier>       ::= ^ | @+ | @-
th0_quantifier :: CharParser st TH0_quantifier
th0_quantifier :: CharParser st TH0_quantifier
th0_quantifier = String
-> CharParser st TH0_quantifier -> CharParser st TH0_quantifier
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "th0_quantifier" (
  (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "^" CharParser st Token
-> CharParser st TH0_quantifier -> CharParser st TH0_quantifier
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TH0_quantifier -> CharParser st TH0_quantifier
forall (m :: * -> *) a. Monad m => a -> m a
return TH0_quantifier
TH0_LambdaBinder)
  CharParser st TH0_quantifier
-> CharParser st TH0_quantifier -> CharParser st TH0_quantifier
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "@+" CharParser st Token
-> CharParser st TH0_quantifier -> CharParser st TH0_quantifier
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TH0_quantifier -> CharParser st TH0_quantifier
forall (m :: * -> *) a. Monad m => a -> m a
return TH0_quantifier
TH0_IndefiniteDescription)
  CharParser st TH0_quantifier
-> CharParser st TH0_quantifier -> CharParser st TH0_quantifier
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "@-" CharParser st Token
-> CharParser st TH0_quantifier -> CharParser st TH0_quantifier
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TH0_quantifier -> CharParser st TH0_quantifier
forall (m :: * -> *) a. Monad m => a -> m a
return TH0_quantifier
TH0_DefiniteDescription)
  CharParser st TH0_quantifier
-> String -> CharParser st TH0_quantifier
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "th0_quantifier"
  )


-- <thf_pair_connective>  ::= <infix_equality> | <infix_inequality> |
--                            <binary_connective> | <assignment>
thf_pair_connective :: CharParser st THF_pair_connective
thf_pair_connective :: CharParser st THF_pair_connective
thf_pair_connective = String
-> CharParser st THF_pair_connective
-> CharParser st THF_pair_connective
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_pair_connective" (
  (CharParser st Token
forall st. CharParser st Token
infix_equality CharParser st Token
-> CharParser st THF_pair_connective
-> CharParser st THF_pair_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> THF_pair_connective -> CharParser st THF_pair_connective
forall (m :: * -> *) a. Monad m => a -> m a
return THF_pair_connective
THF_infix_equality)
  CharParser st THF_pair_connective
-> CharParser st THF_pair_connective
-> CharParser st THF_pair_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Binary_connective -> THF_pair_connective)
-> ParsecT String st Identity Binary_connective
-> CharParser st THF_pair_connective
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Binary_connective -> THF_pair_connective
THFPC_binary ParsecT String st Identity Binary_connective
forall st. CharParser st Binary_connective
binary_connective
  CharParser st THF_pair_connective
-> CharParser st THF_pair_connective
-> CharParser st THF_pair_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (CharParser st Token
forall st. CharParser st Token
infix_inequality CharParser st Token
-> CharParser st THF_pair_connective
-> CharParser st THF_pair_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> THF_pair_connective -> CharParser st THF_pair_connective
forall (m :: * -> *) a. Monad m => a -> m a
return THF_pair_connective
Infix_inequality)
  CharParser st THF_pair_connective
-> CharParser st THF_pair_connective
-> CharParser st THF_pair_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (CharParser st Token
forall st. CharParser st Token
assignment CharParser st Token
-> CharParser st THF_pair_connective
-> CharParser st THF_pair_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> THF_pair_connective -> CharParser st THF_pair_connective
forall (m :: * -> *) a. Monad m => a -> m a
return THF_pair_connective
THF_assignment)
  CharParser st THF_pair_connective
-> String -> CharParser st THF_pair_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_pair_connective"
  )

-- <thf_unary_connective> ::= <unary_connective> | <th1_unary_connective>
thf_unary_connective :: CharParser st THF_unary_connective
thf_unary_connective :: CharParser st THF_unary_connective
thf_unary_connective = String
-> CharParser st THF_unary_connective
-> CharParser st THF_unary_connective
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "thf_unary_connective" (
  (TH1_unary_connective -> THF_unary_connective)
-> ParsecT String st Identity TH1_unary_connective
-> CharParser st THF_unary_connective
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TH1_unary_connective -> THF_unary_connective
THFUC_th1 ParsecT String st Identity TH1_unary_connective
forall st. CharParser st TH1_unary_connective
th1_unary_connective
  CharParser st THF_unary_connective
-> CharParser st THF_unary_connective
-> CharParser st THF_unary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Unary_connective -> THF_unary_connective)
-> ParsecT String st Identity Unary_connective
-> CharParser st THF_unary_connective
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Unary_connective -> THF_unary_connective
THFUC_unary ParsecT String st Identity Unary_connective
forall st. CharParser st Unary_connective
unary_connective
  CharParser st THF_unary_connective
-> String -> CharParser st THF_unary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "thf_unary_connective"
  )

-- <th1_unary_connective> ::= !! | ?? | @@+ | @@- | @=
th1_unary_connective :: CharParser st TH1_unary_connective
th1_unary_connective :: CharParser st TH1_unary_connective
th1_unary_connective = String
-> CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "th1_unary_connective" (
  (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "!!" CharParser st Token
-> CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TH1_unary_connective -> CharParser st TH1_unary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return TH1_unary_connective
TH1_PiForAll)
  CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "??" CharParser st Token
-> CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TH1_unary_connective -> CharParser st TH1_unary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return TH1_unary_connective
TH1_PiSigmaExists)
  CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "@@+" CharParser st Token
-> CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TH1_unary_connective -> CharParser st TH1_unary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return TH1_unary_connective
TH1_PiIndefiniteDescription)
  CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "@@-" CharParser st Token
-> CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TH1_unary_connective -> CharParser st TH1_unary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return TH1_unary_connective
TH1_PiDefiniteDescription)
  CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "@=" CharParser st Token
-> CharParser st TH1_unary_connective
-> CharParser st TH1_unary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TH1_unary_connective -> CharParser st TH1_unary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return TH1_unary_connective
TH1_PiEquality)
  CharParser st TH1_unary_connective
-> String -> CharParser st TH1_unary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "th1_unary_connective"
  )

-- %----Connectives - THF and TFF
-- <subtype_sign>         ::= <<
subtype_sign :: CharParser st Token
subtype_sign :: CharParser st Token
subtype_sign = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "subtype_sign" (
  String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "<<" CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "subtype_sign"
  )

-- %----Connectives - TFF
-- % <tff_pair_connective>  ::= <binary_connective> | <assignment>
-- Note: not used
-- tff_pair_connective :: CharParser st TFF_pair_connective
-- tff_pair_connective = parserTrace "tff_pair_connective" (
--   liftM TFFPC_binary binary_connective
--   <|> liftM TFFPC_assignment tff_assignment
--   <?> "tff_pair_connective"
--   )

-- %----Connectives - FOF
-- <fof_quantifier>       ::= ! | ?
fof_quantifier :: CharParser st FOF_quantifier
fof_quantifier :: CharParser st FOF_quantifier
fof_quantifier = String
-> CharParser st FOF_quantifier -> CharParser st FOF_quantifier
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "fof_quantifier" (
  (Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '!' CharParser st Token
-> ParsecT String st Identity () -> ParsecT String st Identity ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT String st Identity Char -> ParsecT String st Identity ()
forall s (m :: * -> *) t a u.
(Stream s m t, Show a) =>
ParsecT s u m a -> ParsecT s u m ()
notFollowedBy (String -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
oneOf "!=>") ParsecT String st Identity ()
-> CharParser st FOF_quantifier -> CharParser st FOF_quantifier
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> FOF_quantifier -> CharParser st FOF_quantifier
forall (m :: * -> *) a. Monad m => a -> m a
return FOF_quantifier
ForAll)
  CharParser st FOF_quantifier
-> CharParser st FOF_quantifier -> CharParser st FOF_quantifier
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '?' CharParser st Token
-> ParsecT String st Identity () -> ParsecT String st Identity ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT String st Identity Char -> ParsecT String st Identity ()
forall s (m :: * -> *) t a u.
(Stream s m t, Show a) =>
ParsecT s u m a -> ParsecT s u m ()
notFollowedBy (String -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
oneOf "?*") ParsecT String st Identity ()
-> CharParser st FOF_quantifier -> CharParser st FOF_quantifier
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> FOF_quantifier -> CharParser st FOF_quantifier
forall (m :: * -> *) a. Monad m => a -> m a
return FOF_quantifier
Exists)
  CharParser st FOF_quantifier
-> String -> CharParser st FOF_quantifier
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "fof_quantifier"
  )

-- <binary_connective>    ::= <=> | => | <= | <~> | ~<vline> | ~&
binary_connective :: CharParser st Binary_connective
binary_connective :: CharParser st Binary_connective
binary_connective = String
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "binary_connective" ((String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "<=>" CharParser st Token
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Binary_connective -> CharParser st Binary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return Binary_connective
Equivalence)
  CharParser st Binary_connective
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "=>" CharParser st Token
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Binary_connective -> CharParser st Binary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return Binary_connective
Implication)
  CharParser st Binary_connective
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "<=" CharParser st Token
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Binary_connective -> CharParser st Binary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return Binary_connective
ReverseImplication)
  CharParser st Binary_connective
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "<~>" CharParser st Token
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Binary_connective -> CharParser st Binary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return Binary_connective
XOR)
  CharParser st Binary_connective
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "~|" CharParser st Token
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Binary_connective -> CharParser st Binary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return Binary_connective
NOR)
  CharParser st Binary_connective
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "~&" CharParser st Token
-> CharParser st Binary_connective
-> CharParser st Binary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Binary_connective -> CharParser st Binary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return Binary_connective
NAND)
  CharParser st Binary_connective
-> String -> CharParser st Binary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "binary_connective"
  )

-- <assoc_connective>     ::= <vline> | &
assoc_connective :: CharParser st Assoc_connective
assoc_connective :: CharParser st Assoc_connective
assoc_connective = String
-> CharParser st Assoc_connective -> CharParser st Assoc_connective
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "assoc_connective" (
  (CharParser st Token
forall st. CharParser st Token
vline CharParser st Token
-> CharParser st Assoc_connective -> CharParser st Assoc_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Assoc_connective -> CharParser st Assoc_connective
forall (m :: * -> *) a. Monad m => a -> m a
return Assoc_connective
OR)
  CharParser st Assoc_connective
-> CharParser st Assoc_connective -> CharParser st Assoc_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (CharParser st Token
forall st. CharParser st Token
andT CharParser st Token
-> CharParser st Assoc_connective -> CharParser st Assoc_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Assoc_connective -> CharParser st Assoc_connective
forall (m :: * -> *) a. Monad m => a -> m a
return Assoc_connective
AND)
  CharParser st Assoc_connective
-> String -> CharParser st Assoc_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "assoc_connective"
  )

-- <unary_connective>     ::= ~
unary_connective :: CharParser st Unary_connective
unary_connective :: CharParser st Unary_connective
unary_connective = String
-> CharParser st Unary_connective -> CharParser st Unary_connective
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "unary_connective" (
  (Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '~' CharParser st Token
-> CharParser st Unary_connective -> CharParser st Unary_connective
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Unary_connective -> CharParser st Unary_connective
forall (m :: * -> *) a. Monad m => a -> m a
return Unary_connective
NOT)
  CharParser st Unary_connective
-> String -> CharParser st Unary_connective
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "unary_connective"
  )

-- %----The seqent arrow
-- <gentzen_arrow>        ::= -->
gentzen_arrow :: CharParser st Token
gentzen_arrow :: CharParser st Token
gentzen_arrow = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "gentzen_arrow" (
  String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "-->"
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "gentzen_arrow"
  )

-- <assignment>           ::= :=
assignment :: CharParser st Token
assignment :: CharParser st Token
assignment = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "assignment" (
  String -> CharParser st Token
forall st. String -> CharParser st Token
strTok ":="
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "assignment"
  )

{- -----------------------------------------------------------------------------
Types for THF and TFF
----------------------------------------------------------------------------- -}
-- -<type_constant>        ::= <type_functor>
type_constant :: CharParser st Type_constant
type_constant :: CharParser st Token
type_constant = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "type_constant" (
  CharParser st Token
forall st. CharParser st Token
type_functor
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "type_constant"
  )

-- <type_functor>         ::= <atomic_word>
type_functor :: CharParser st Type_functor
type_functor :: CharParser st Token
type_functor = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "type_functor" (
  CharParser st Token
forall st. CharParser st Token
atomic_word
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "type_functor"
  )

-- <defined_type>         ::= <atomic_defined_word>
-- <defined_type>         :== $oType | $o | $iType | $i | $tType |
--                            $real | $rat | $int
defined_type :: CharParser st Defined_type
defined_type :: CharParser st Defined_type
defined_type = String -> CharParser st Defined_type -> CharParser st Defined_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "defined_type" ([(String, Defined_type)] -> CharParser st Defined_type
forall a st. [(String, a)] -> CharParser st a
constantsChoice
  [("$oType", Defined_type
OType),
   ("$o", Defined_type
O),
   ("$iType", Defined_type
IType),
   ("$int", Defined_type
Int),
   ("$i", Defined_type
I),
   ("$tType", Defined_type
TType),
   ("$real", Defined_type
Real),
   ("$rat", Defined_type
Rat)]
  CharParser st Defined_type -> String -> CharParser st Defined_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "defined_type"
  )

-- NOTE: unused
-- <system_type>          :== <atomic_system_word>
-- system_type :: CharParser st Token
-- system_type = pToken atomic_system_word <?> "system_type"
--


{- -----------------------------------------------------------------------------
For all language types
----------------------------------------------------------------------------- -}
-- <atom_>                 ::= <untyped_atom> | <defined_constant>
atom :: CharParser st Atom
atom :: CharParser st Atom
atom = String -> CharParser st Atom -> CharParser st Atom
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "atom" (
  (Defined_functor -> Atom)
-> ParsecT String st Identity Defined_functor -> CharParser st Atom
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Defined_functor -> Atom
Atom_constant ParsecT String st Identity Defined_functor
forall st. CharParser st Defined_functor
defined_constant
  CharParser st Atom -> CharParser st Atom -> CharParser st Atom
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Untyped_atom -> Atom)
-> ParsecT String st Identity Untyped_atom -> CharParser st Atom
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Untyped_atom -> Atom
Atom_untyped ParsecT String st Identity Untyped_atom
forall st. CharParser st Untyped_atom
untyped_atom
  CharParser st Atom -> String -> CharParser st Atom
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "atom"
  )

-- <untyped_atom>         ::= <constant> | <system_constant>
untyped_atom :: CharParser st Untyped_atom
untyped_atom :: CharParser st Untyped_atom
untyped_atom = String -> CharParser st Untyped_atom -> CharParser st Untyped_atom
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "untyped_atom" (
  (Token -> Untyped_atom)
-> ParsecT String st Identity Token -> CharParser st Untyped_atom
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Untyped_atom
UA_system ParsecT String st Identity Token
forall st. CharParser st Token
system_constant
  CharParser st Untyped_atom
-> CharParser st Untyped_atom -> CharParser st Untyped_atom
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> Untyped_atom)
-> ParsecT String st Identity Token -> CharParser st Untyped_atom
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Untyped_atom
UA_constant ParsecT String st Identity Token
forall st. CharParser st Token
constant
  CharParser st Untyped_atom -> String -> CharParser st Untyped_atom
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "untyped_atom"
  )

-- <proposition>          :== <predicate>
proposition :: CharParser st Proposition
proposition :: CharParser st Token
proposition = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "proposition" (CharParser st Token
forall st. CharParser st Token
predicate CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "proposition"
  )

-- <predicate>            :== <atomic_word>
predicate :: CharParser st Predicate
predicate :: CharParser st Token
predicate = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "predicate" (CharParser st Token
forall st. CharParser st Token
atomic_word CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "predicate"
  )

-- <defined_proposition>  :== <atomic_defined_word>
-- <defined_proposition>  :== $true | $false
defined_proposition :: CharParser st Defined_proposition
defined_proposition :: CharParser st Defined_proposition
defined_proposition = String
-> CharParser st Defined_proposition
-> CharParser st Defined_proposition
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "defined_prop" (
  [(String, Defined_proposition)]
-> CharParser st Defined_proposition
forall a st. [(String, a)] -> CharParser st a
constantsChoice [("$true", Defined_proposition
TPTP_true), ("$false", Defined_proposition
TPTP_false)]
  CharParser st Defined_proposition
-> String -> CharParser st Defined_proposition
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "defined_prop"
  )

-- <defined_predicate>    :== <atomic_defined_word>
-- <defined_predicate>    :== $distinct |
--                            $less | $lesseq | $greater | $greatereq |
--                            $is_int | $is_rat |
--                            $box_P | $box_i | $box_int | $box |
--                            $dia_P | $dia_i | $dia_int | $dia
defined_predicate :: CharParser st Defined_predicate
defined_predicate :: CharParser st Defined_predicate
defined_predicate = String
-> CharParser st Defined_predicate
-> CharParser st Defined_predicate
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "defined_pred" ([(String, Defined_predicate)] -> CharParser st Defined_predicate
forall a st. [(String, a)] -> CharParser st a
constantsChoice
  [("$distinct", Defined_predicate
Distinct),
   ("$lesseq", Defined_predicate
Lesseq),
   ("$less", Defined_predicate
Less),
   ("$greatereq", Defined_predicate
Greatereq),
   ("$greater", Defined_predicate
Greater),
   ("$is_int", Defined_predicate
Is_int),
   ("$is_rat", Defined_predicate
Is_rat),
   ("$box_P", Defined_predicate
Box_P),
   ("$box_int", Defined_predicate
Box_int),
   ("$box_i", Defined_predicate
Box_i),
   ("$box", Defined_predicate
Box),
   ("$dia_P", Defined_predicate
Dia_P),
   ("$dia_int", Defined_predicate
Dia_int),
   ("$dia_i", Defined_predicate
Dia_i),
   ("$dia", Defined_predicate
Dia)]
  CharParser st Defined_predicate
-> String -> CharParser st Defined_predicate
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "defined_pred"
  )

-- <defined_infix_pred>   ::= <infix_equality> | <assignment>
defined_infix_pred :: CharParser st Defined_infix_pred
defined_infix_pred :: CharParser st Defined_infix_pred
defined_infix_pred = String
-> CharParser st Defined_infix_pred
-> CharParser st Defined_infix_pred
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "defined_infix_pred" (
  (CharParser st Token
forall st. CharParser st Token
infix_equality CharParser st Token
-> CharParser st Defined_infix_pred
-> CharParser st Defined_infix_pred
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Defined_infix_pred -> CharParser st Defined_infix_pred
forall (m :: * -> *) a. Monad m => a -> m a
return Defined_infix_pred
Defined_infix_equality)
  CharParser st Defined_infix_pred
-> CharParser st Defined_infix_pred
-> CharParser st Defined_infix_pred
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (CharParser st Token
forall st. CharParser st Token
assignment CharParser st Token
-> CharParser st Defined_infix_pred
-> CharParser st Defined_infix_pred
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Defined_infix_pred -> CharParser st Defined_infix_pred
forall (m :: * -> *) a. Monad m => a -> m a
return Defined_infix_pred
Defined_assignment)
  CharParser st Defined_infix_pred
-> String -> CharParser st Defined_infix_pred
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "defined_infix_pred"
  )

-- <infix_equality>       ::= =
infix_equality :: CharParser st Token
infix_equality :: CharParser st Token
infix_equality = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "infix_equality" (
  CharParser st Token -> CharParser st Token -> CharParser st Token
forall a st b.
Show a =>
CharParser st a -> CharParser st b -> CharParser st b
parseIfNot (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "=>") (Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '=')
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "infix_equality"
  )

-- <infix_inequality>     ::= !=
infix_inequality :: CharParser st Token
infix_inequality :: CharParser st Token
infix_inequality = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "infix_inequality" (
  String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "!="
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "infix_inequality"
  )

-- <constant>             ::= <functor>
constant :: CharParser st Constant
constant :: CharParser st Token
constant = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "constant" (
  CharParser st Token
forall st. CharParser st Token
functor
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "constant"
  )

-- <functor>              ::= <atomic_word>
functor :: CharParser st TPTP_functor
functor :: CharParser st Token
functor = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "functor" (
  CharParser st Token
forall st. CharParser st Token
atomic_word
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "functor"
  )

-- <system_constant>      ::= <system_functor>
system_constant :: CharParser st System_constant
system_constant :: CharParser st Token
system_constant = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "system_constant" (
  CharParser st Token
forall st. CharParser st Token
system_functor
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "system_constant"
  )

-- <system_functor>       ::= <atomic_system_word>
system_functor :: CharParser st System_functor
system_functor :: CharParser st Token
system_functor = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "system_functor" (
  CharParser st Token
forall st. CharParser st Token
atomic_system_word
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "system_functor"
  )

-- <defined_constant>     ::= <defined_functor>
defined_constant :: CharParser st Defined_constant
defined_constant :: CharParser st Defined_functor
defined_constant = String
-> CharParser st Defined_functor -> CharParser st Defined_functor
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "defined_constant" (
  CharParser st Defined_functor
forall st. CharParser st Defined_functor
defined_functor
  CharParser st Defined_functor
-> String -> CharParser st Defined_functor
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "defined_constant"
  )

-- <defined_functor>      ::= <atomic_defined_word>
-- <defined_functor>      :== $uminus | $sum | $difference | $product |
--                            $quotient | $quotient_e | $quotient_t | $quotient_f |
--                            $remainder_e | $remainder_t | $remainder_f |
--                            $floor | $ceiling | $truncate | $round |
--                            $to_int | $to_rat | $to_real
defined_functor :: CharParser st Defined_functor
defined_functor :: CharParser st Defined_functor
defined_functor = String
-> CharParser st Defined_functor -> CharParser st Defined_functor
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "defined_functor" ([(String, Defined_functor)] -> CharParser st Defined_functor
forall a st. [(String, a)] -> CharParser st a
constantsChoice
  [("$uminus", Defined_functor
Uminus),
   ("$sum", Defined_functor
Sum),
   ("$difference", Defined_functor
Difference),
   ("$product", Defined_functor
Product),
   ("$quotient_e", Defined_functor
Quotient_e),
   ("$quotient_t", Defined_functor
Quotient_t),
   ("$quotient_f", Defined_functor
Quotient_f),
   ("$quotient", Defined_functor
Quotient),
   ("$remainder_e", Defined_functor
Remainder_e),
   ("$remainder_t", Defined_functor
Remainder_t),
   ("$remainder_f", Defined_functor
Remainder_f),
   ("$floor", Defined_functor
Floor),
   ("$ceiling", Defined_functor
Ceiling),
   ("$truncate", Defined_functor
Truncate),
   ("$round", Defined_functor
Round),
   ("$to_int", Defined_functor
To_int),
   ("$to_rat", Defined_functor
To_rat),
   ("$to_real", Defined_functor
To_real)]
  CharParser st Defined_functor
-> CharParser st Defined_functor -> CharParser st Defined_functor
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> Defined_functor)
-> ParsecT String st Identity Token
-> CharParser st Defined_functor
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Defined_functor
DF_atomic_defined_word ParsecT String st Identity Token
forall st. CharParser st Token
atomic_defined_word
  CharParser st Defined_functor
-> String -> CharParser st Defined_functor
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "defined_functor"
  )

-- <defined_term>         ::= <defined_atom> | <defined_atomic_term>
-- <defined_term>         ::= <number> | <distinct_object>
defined_term :: CharParser st Defined_term
defined_term :: CharParser st Defined_term
defined_term = String -> CharParser st Defined_term -> CharParser st Defined_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "defined_term" (
  (Number -> Defined_term)
-> ParsecT String st Identity Number -> CharParser st Defined_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Number -> Defined_term
DT_number ParsecT String st Identity Number
forall st. CharParser st Number
number
  CharParser st Defined_term
-> CharParser st Defined_term -> CharParser st Defined_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> Defined_term)
-> ParsecT String st Identity Token -> CharParser st Defined_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Defined_term
DT_object ParsecT String st Identity Token
forall st. CharParser st Token
distinct_object
  CharParser st Defined_term -> String -> CharParser st Defined_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "defined_term"
  )

-- <variable>             ::= <upper_word>
variable :: CharParser st Variable
variable :: CharParser st Token
variable = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "variable" (
  CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
pToken CharParser st String
forall st. CharParser st String
upper_word
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "variable"
  )

{- -----------------------------------------------------------------------------
Formula sources
----------------------------------------------------------------------------- -}
-- <source>               ::= <general_term>
-- <source>               :== <dag_source> | <internal_source> |
--                            <external_source> | unknown | [<sources>]
source :: CharParser st Source
source :: CharParser st Source
source = String -> CharParser st Source -> CharParser st Source
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "source" (
  (External_source -> Source)
-> ParsecT String st Identity External_source
-> CharParser st Source
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM External_source -> Source
Source_external ParsecT String st Identity External_source
forall st. CharParser st External_source
external_source
  CharParser st Source
-> CharParser st Source -> CharParser st Source
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Internal_source -> Source)
-> ParsecT String st Identity Internal_source
-> CharParser st Source
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Internal_source -> Source
Source_internal ParsecT String st Identity Internal_source
forall st. CharParser st Internal_source
internal_source
  CharParser st Source
-> CharParser st Source -> CharParser st Source
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (DAG_source -> Source)
-> ParsecT String st Identity DAG_source -> CharParser st Source
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM DAG_source -> Source
Source_DAG ParsecT String st Identity DAG_source
forall st. CharParser st DAG_source
dag_source
  CharParser st Source
-> CharParser st Source -> CharParser st Source
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "unknown" CharParser st Token -> CharParser st Source -> CharParser st Source
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Source -> CharParser st Source
forall (m :: * -> *) a. Monad m => a -> m a
return Source
Unknown_source)
  CharParser st Source
-> CharParser st Source -> CharParser st Source
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Sources -> Source)
-> ParsecT String st Identity Sources -> CharParser st Source
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Sources -> Source
Source_many (ParsecT String st Identity Sources
-> ParsecT String st Identity Sources
forall st a. CharParser st a -> CharParser st a
brackets ParsecT String st Identity Sources
forall st. CharParser st Sources
sources)
  CharParser st Source -> String -> CharParser st Source
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "source"
  )

-- %----Alternative sources are recorded like this, thus allowing representation
-- %----of alternative derivations with shared parts.
-- <sources>              :== <source> | <source>,<sources>
sources :: CharParser st Sources
sources :: CharParser st Sources
sources = String -> CharParser st Sources -> CharParser st Sources
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "sources" (
  CharParser st Source -> CharParser st Sources
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st Source
forall st. CharParser st Source
source
  CharParser st Sources -> String -> CharParser st Sources
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "sources"
  )

-- %----Only a <dag_source> can be a <name>, i.e., derived formulae can be
-- %----identified by a <name> or an <inference_record>
-- <dag_source>           :== <name> | <inference_record>
dag_source :: CharParser st DAG_source
dag_source :: CharParser st DAG_source
dag_source = String -> CharParser st DAG_source -> CharParser st DAG_source
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "dag_source" (
  (Inference_record -> DAG_source)
-> ParsecT String st Identity Inference_record
-> CharParser st DAG_source
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Inference_record -> DAG_source
DAGS_record ParsecT String st Identity Inference_record
forall st. CharParser st Inference_record
inference_record
  CharParser st DAG_source
-> CharParser st DAG_source -> CharParser st DAG_source
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Name -> DAG_source)
-> ParsecT String st Identity Name -> CharParser st DAG_source
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Name -> DAG_source
DAGS_name ParsecT String st Identity Name
forall st. CharParser st Name
name
  CharParser st DAG_source -> String -> CharParser st DAG_source
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "dag_source"
  )

-- <inference_record>     :== inference(<inference_rule>,<useful_info>,
--                            <inference_parents>)
inference_record :: CharParser st Inference_record
inference_record :: CharParser st Inference_record
inference_record = String
-> CharParser st Inference_record -> CharParser st Inference_record
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "inference_record" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "inference" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    Token
ir <- GenParser Char st Token
forall st. CharParser st Token
inference_rule
    GenParser Char st Token
forall st. CharParser st Token
commaT
    Useful_info
ui <- CharParser st Useful_info
forall st. CharParser st Useful_info
useful_info
    GenParser Char st Token
forall st. CharParser st Token
commaT
    Inference_parents
ip <- CharParser st Inference_parents
forall st. CharParser st Inference_parents
inference_parents
    GenParser Char st Token
forall st. CharParser st Token
cParenT
    Inference_record -> CharParser st Inference_record
forall (m :: * -> *) a. Monad m => a -> m a
return (Inference_record -> CharParser st Inference_record)
-> Inference_record -> CharParser st Inference_record
forall a b. (a -> b) -> a -> b
$ Token -> Useful_info -> Inference_parents -> Inference_record
Inference_record Token
ir Useful_info
ui Inference_parents
ip
  CharParser st Inference_record
-> String -> CharParser st Inference_record
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "inference_record"
  )

-- <inference_rule>       :== <atomic_word>
-- %----Examples are          deduction | modus_tollens | modus_ponens | rewrite |
-- %                          resolution | paramodulation | factorization |
-- %                          cnf_conversion | cnf_refutation | ...
inference_rule :: CharParser st Token
inference_rule :: CharParser st Token
inference_rule = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "inference_rule" (
  CharParser st Token
forall st. CharParser st Token
atomic_word
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "inference_rule"
  )

-- %----<inference_parents> can be empty in cases when there is a justification
-- %----for a tautologous theorem. In case when a tautology is introduced as
-- %----a leaf, e.g., for splitting, then use an <internal_source>.
-- <inference_parents>    :== [] | [<parent_list>]
inference_parents :: CharParser st Inference_parents
inference_parents :: CharParser st Inference_parents
inference_parents = String
-> CharParser st Inference_parents
-> CharParser st Inference_parents
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "inference_parents" (
  CharParser st Inference_parents
forall st a. CharParser st [a]
emptyBrackets
  CharParser st Inference_parents
-> CharParser st Inference_parents
-> CharParser st Inference_parents
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st Inference_parents -> CharParser st Inference_parents
forall st a. CharParser st a -> CharParser st a
brackets CharParser st Inference_parents
forall st. CharParser st Inference_parents
parent_list
  CharParser st Inference_parents
-> String -> CharParser st Inference_parents
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "inference_parents"
  )

-- <parent_list>          :== <parent_info> | <parent_info>,<parent_list>
parent_list :: CharParser st Parent_list
parent_list :: CharParser st Inference_parents
parent_list = String
-> CharParser st Inference_parents
-> CharParser st Inference_parents
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "parent_list" (
  CharParser st Parent_info -> CharParser st Inference_parents
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st Parent_info
forall st. CharParser st Parent_info
parent_info
  CharParser st Inference_parents
-> String -> CharParser st Inference_parents
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "parent_list"
  )

-- <parent_info>          :== <source><parent_details>
parent_info :: CharParser st Parent_info
parent_info :: CharParser st Parent_info
parent_info = String -> CharParser st Parent_info -> CharParser st Parent_info
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "parent_info" (do
    Source
s <- CharParser st Source
forall st. CharParser st Source
source
    Parent_details
pd <- CharParser st Parent_details
forall st. CharParser st Parent_details
parent_details
    Parent_info -> CharParser st Parent_info
forall (m :: * -> *) a. Monad m => a -> m a
return (Parent_info -> CharParser st Parent_info)
-> Parent_info -> CharParser st Parent_info
forall a b. (a -> b) -> a -> b
$ Source -> Parent_details -> Parent_info
Parent_info Source
s Parent_details
pd
  CharParser st Parent_info -> String -> CharParser st Parent_info
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "parent_info"
  )

-- <parent_details>       :== :<general_list> | <null>
parent_details :: CharParser st Parent_details
parent_details :: CharParser st Parent_details
parent_details = String
-> CharParser st Parent_details -> CharParser st Parent_details
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "parent_details" (do
    CharParser st Token
forall st. CharParser st Token
colonT
    (General_list -> Parent_details)
-> ParsecT String st Identity General_list
-> CharParser st Parent_details
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM General_list -> Parent_details
forall a. a -> Maybe a
Just ParsecT String st Identity General_list
forall st. CharParser st General_list
general_list
  CharParser st Parent_details
-> CharParser st Parent_details -> CharParser st Parent_details
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> Parent_details -> CharParser st Parent_details
forall (m :: * -> *) a. Monad m => a -> m a
return Parent_details
forall a. Maybe a
Nothing
  CharParser st Parent_details
-> String -> CharParser st Parent_details
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "parent_details"
  )

-- <internal_source>      :== introduced(<intro_type><optional_info>)
internal_source :: CharParser st Internal_source
internal_source :: CharParser st Internal_source
internal_source = String
-> CharParser st Internal_source -> CharParser st Internal_source
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "internal_source" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "introduced" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    Intro_type
it <- CharParser st Intro_type
forall st. CharParser st Intro_type
intro_type
    Optional_info
oi <- CharParser st Optional_info
forall st. CharParser st Optional_info
optional_info
    GenParser Char st Token
forall st. CharParser st Token
cParenT
    Internal_source -> CharParser st Internal_source
forall (m :: * -> *) a. Monad m => a -> m a
return (Internal_source -> CharParser st Internal_source)
-> Internal_source -> CharParser st Internal_source
forall a b. (a -> b) -> a -> b
$ Intro_type -> Optional_info -> Internal_source
Internal_source Intro_type
it Optional_info
oi
  CharParser st Internal_source
-> String -> CharParser st Internal_source
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "internal_source"
  )

-- <intro_type>           :== definition | axiom_of_choice | tautology | assumption
intro_type :: CharParser st Intro_type
intro_type :: CharParser st Intro_type
intro_type = String -> CharParser st Intro_type -> CharParser st Intro_type
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "intro_type" (
  [(String, Intro_type)] -> CharParser st Intro_type
forall a st. [(String, a)] -> CharParser st a
constantsChoice
    [("definition", Intro_type
IntroTypeDefinition),
     ("axiom_of_choice", Intro_type
AxiomOfChoice),
     ("tautology", Intro_type
Tautology),
     ("assumption", Intro_type
IntroTypeAssumption)]
  CharParser st Intro_type -> String -> CharParser st Intro_type
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "intro_type"
  )

-- <external_source>      :== <file_source> | <theory> | <creator_source>
external_source :: CharParser st External_source
external_source :: CharParser st External_source
external_source = String
-> CharParser st External_source -> CharParser st External_source
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "external_source" (
  (File_source -> External_source)
-> ParsecT String st Identity File_source
-> CharParser st External_source
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM File_source -> External_source
ExtSrc_file ParsecT String st Identity File_source
forall st. CharParser st File_source
file_source
  CharParser st External_source
-> CharParser st External_source -> CharParser st External_source
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Theory -> External_source)
-> ParsecT String st Identity Theory
-> CharParser st External_source
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Theory -> External_source
ExtSrc_theory ParsecT String st Identity Theory
forall st. CharParser st Theory
theory
  CharParser st External_source
-> CharParser st External_source -> CharParser st External_source
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Creator_source -> External_source)
-> ParsecT String st Identity Creator_source
-> CharParser st External_source
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Creator_source -> External_source
ExtSrc_creator ParsecT String st Identity Creator_source
forall st. CharParser st Creator_source
creator_source
  CharParser st External_source
-> String -> CharParser st External_source
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "external_source"
  )

-- <file_source>          :== file(<file_name><file_info>)
file_source :: CharParser st File_source
file_source :: CharParser st File_source
file_source = String -> CharParser st File_source -> CharParser st File_source
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "file_source" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "file" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    File_name
fn <- CharParser st File_name
forall st. CharParser st File_name
file_name
    File_info
fi <- CharParser st File_info
forall st. CharParser st File_info
file_info
    GenParser Char st Token
forall st. CharParser st Token
cParenT
    File_source -> CharParser st File_source
forall (m :: * -> *) a. Monad m => a -> m a
return (File_source -> CharParser st File_source)
-> File_source -> CharParser st File_source
forall a b. (a -> b) -> a -> b
$ File_name -> File_info -> File_source
File_source File_name
fn File_info
fi
  CharParser st File_source -> String -> CharParser st File_source
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "file_source"
  )

-- <file_info>            :== ,<name> | <null>
file_info :: CharParser st File_info
file_info :: CharParser st File_info
file_info = String -> CharParser st File_info -> CharParser st File_info
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "file_info" (do
    CharParser st Token
forall st. CharParser st Token
commaT
    Name
n <- CharParser st Name
forall st. CharParser st Name
name
    File_info -> CharParser st File_info
forall (m :: * -> *) a. Monad m => a -> m a
return (File_info -> CharParser st File_info)
-> File_info -> CharParser st File_info
forall a b. (a -> b) -> a -> b
$ Name -> File_info
forall a. a -> Maybe a
Just Name
n
  CharParser st File_info
-> CharParser st File_info -> CharParser st File_info
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> File_info -> CharParser st File_info
forall (m :: * -> *) a. Monad m => a -> m a
return File_info
forall a. Maybe a
Nothing
  CharParser st File_info -> String -> CharParser st File_info
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "file_info"
  )

-- <theory>               :== theory(<theory_name><optional_info>)
theory :: CharParser st Theory
theory :: CharParser st Theory
theory = String -> CharParser st Theory -> CharParser st Theory
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "theory" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "theory" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    Theory_name
tn <- CharParser st Theory_name
forall st. CharParser st Theory_name
theory_name
    Optional_info
oi <- CharParser st Optional_info
forall st. CharParser st Optional_info
optional_info
    GenParser Char st Token
forall st. CharParser st Token
cParenT
    Theory -> CharParser st Theory
forall (m :: * -> *) a. Monad m => a -> m a
return (Theory -> CharParser st Theory) -> Theory -> CharParser st Theory
forall a b. (a -> b) -> a -> b
$ Theory_name -> Optional_info -> Theory
Theory Theory_name
tn Optional_info
oi
  CharParser st Theory -> String -> CharParser st Theory
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "theory"
  )

-- <theory_name>          :== equality | ac
theory_name :: CharParser st Theory_name
theory_name :: CharParser st Theory_name
theory_name = String -> CharParser st Theory_name -> CharParser st Theory_name
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "theory_name" (
  (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "equality" CharParser st Token
-> CharParser st Theory_name -> CharParser st Theory_name
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Theory_name -> CharParser st Theory_name
forall (m :: * -> *) a. Monad m => a -> m a
return Theory_name
TN_equality)
  CharParser st Theory_name
-> CharParser st Theory_name -> CharParser st Theory_name
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "ac" CharParser st Token
-> CharParser st Theory_name -> CharParser st Theory_name
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Theory_name -> CharParser st Theory_name
forall (m :: * -> *) a. Monad m => a -> m a
return Theory_name
TN_ac)
  CharParser st Theory_name -> String -> CharParser st Theory_name
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "theory_name"
  )

-- <creator_source>       :== creator(<creator_name><optional_info>)
creator_source :: CharParser st Creator_source
creator_source :: CharParser st Creator_source
creator_source = String
-> CharParser st Creator_source -> CharParser st Creator_source
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "creator_source" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "creator" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    Token
cn <- GenParser Char st Token
forall st. CharParser st Token
creator_name
    Optional_info
oi <- CharParser st Optional_info
forall st. CharParser st Optional_info
optional_info
    GenParser Char st Token
forall st. CharParser st Token
cParenT
    Creator_source -> CharParser st Creator_source
forall (m :: * -> *) a. Monad m => a -> m a
return (Creator_source -> CharParser st Creator_source)
-> Creator_source -> CharParser st Creator_source
forall a b. (a -> b) -> a -> b
$ Token -> Optional_info -> Creator_source
Creator_source Token
cn Optional_info
oi
  CharParser st Creator_source
-> String -> CharParser st Creator_source
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "creator_source"
  )

-- <creator_name>         :== <atomic_word>
creator_name :: CharParser st Token
creator_name :: CharParser st Token
creator_name = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "creator_name" (
  CharParser st Token
forall st. CharParser st Token
atomic_word
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "creator_name"
  )


{- -----------------------------------------------------------------------------
Useful info fields
----------------------------------------------------------------------------- -}
-- <optional_info>        ::= ,<useful_info> | <null>
optional_info :: CharParser st (Maybe Useful_info)
optional_info :: CharParser st Optional_info
optional_info = String
-> CharParser st Optional_info -> CharParser st Optional_info
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "optional_info" (
  ParsecT String st Identity Useful_info
-> CharParser st Optional_info
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m (Maybe a)
optionMaybe (Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok ',' CharParser st Token
-> ParsecT String st Identity Useful_info
-> ParsecT String st Identity Useful_info
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT String st Identity Useful_info
forall st. CharParser st Useful_info
useful_info)
  CharParser st Optional_info
-> String -> CharParser st Optional_info
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "optional_info"
  )

-- <useful_info>          ::= <general_list>
-- <useful_info>          :== [] | [<info_items>]
useful_info :: CharParser st Useful_info
useful_info :: CharParser st Useful_info
useful_info = String -> CharParser st Useful_info -> CharParser st Useful_info
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "useful_info" (
  (Info_items -> Useful_info)
-> ParsecT String st Identity Info_items
-> CharParser st Useful_info
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Info_items -> Useful_info
UI_items (ParsecT String st Identity Info_items
forall st a. CharParser st [a]
emptyBrackets ParsecT String st Identity Info_items
-> ParsecT String st Identity Info_items
-> ParsecT String st Identity Info_items
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ParsecT String st Identity Info_items
-> ParsecT String st Identity Info_items
forall tok st a. GenParser tok st a -> GenParser tok st a
try (ParsecT String st Identity Info_items
-> ParsecT String st Identity Info_items
forall st a. CharParser st a -> CharParser st a
brackets ParsecT String st Identity Info_items
forall st. CharParser st Info_items
info_items))
  CharParser st Useful_info
-> CharParser st Useful_info -> CharParser st Useful_info
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (General_list -> Useful_info)
-> ParsecT String st Identity General_list
-> CharParser st Useful_info
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM General_list -> Useful_info
UI_general_list ParsecT String st Identity General_list
forall st. CharParser st General_list
general_list
  CharParser st Useful_info -> String -> CharParser st Useful_info
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "useful_info"
  )

-- <info_items>           :== <info_item> | <info_item>,<info_items>
info_items :: CharParser st Info_items
info_items :: CharParser st Info_items
info_items = String -> CharParser st Info_items -> CharParser st Info_items
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "info_items" (
  CharParser st Info_item -> CharParser st Info_items
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st Info_item
forall st. CharParser st Info_item
info_item
  CharParser st Info_items -> String -> CharParser st Info_items
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "info_items"
  )

-- <info_item>            :== <formula_item> | <inference_item> |
--                            <general_function>
info_item :: CharParser st Info_item
info_item :: CharParser st Info_item
info_item = String -> CharParser st Info_item -> CharParser st Info_item
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "info_item" (
  (Formula_item -> Info_item)
-> ParsecT String st Identity Formula_item
-> CharParser st Info_item
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Formula_item -> Info_item
Info_formula ParsecT String st Identity Formula_item
forall st. CharParser st Formula_item
formula_item
  CharParser st Info_item
-> CharParser st Info_item -> CharParser st Info_item
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Inference_item -> Info_item)
-> ParsecT String st Identity Inference_item
-> CharParser st Info_item
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Inference_item -> Info_item
Info_inference ParsecT String st Identity Inference_item
forall st. CharParser st Inference_item
inference_item
  CharParser st Info_item
-> CharParser st Info_item -> CharParser st Info_item
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (General_function -> Info_item)
-> ParsecT String st Identity General_function
-> CharParser st Info_item
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM General_function -> Info_item
Info_general ParsecT String st Identity General_function
forall st. CharParser st General_function
general_function
  CharParser st Info_item -> String -> CharParser st Info_item
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "info_item"
  )


{- -----------------------------------------------------------------------------
Useful info for formula records
----------------------------------------------------------------------------- -}
-- <formula_item>         :== <description_item> | <iquote_item>
formula_item :: CharParser st Formula_item
formula_item :: CharParser st Formula_item
formula_item = String -> CharParser st Formula_item -> CharParser st Formula_item
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "formula_item" (
  (Token -> Formula_item)
-> ParsecT String st Identity Token -> CharParser st Formula_item
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Formula_item
FI_description ParsecT String st Identity Token
forall st. CharParser st Token
description_item
  CharParser st Formula_item
-> CharParser st Formula_item -> CharParser st Formula_item
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> Formula_item)
-> ParsecT String st Identity Token -> CharParser st Formula_item
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Formula_item
FI_iquote ParsecT String st Identity Token
forall st. CharParser st Token
iquote_item
  CharParser st Formula_item -> String -> CharParser st Formula_item
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "formula_item"
  )

-- <description_item>     :== description(<atomic_word>)
description_item :: CharParser st Description_item
description_item :: CharParser st Token
description_item = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "description_item" (do
    CharParser st Token -> CharParser st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "description" CharParser st Token -> CharParser st Token -> CharParser st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< CharParser st Token
forall st. CharParser st Token
oParenT)
    CharParser st Token
forall st. CharParser st Token
atomic_word CharParser st Token -> CharParser st Token -> CharParser st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< CharParser st Token
forall st. CharParser st Token
cParenT
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "description_item"
  )

-- <iquote_item>          :== iquote(<atomic_word>)
iquote_item :: CharParser st Iquote_item
iquote_item :: CharParser st Token
iquote_item = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "iquote_item" (do
    CharParser st Token -> CharParser st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "iquote" CharParser st Token -> CharParser st Token -> CharParser st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< CharParser st Token
forall st. CharParser st Token
oParenT)
    CharParser st Token
forall st. CharParser st Token
atomic_word CharParser st Token -> CharParser st Token -> CharParser st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< CharParser st Token
forall st. CharParser st Token
cParenT
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "iquote_item"
  )

-- <inference_item>       :== <inference_status> | <assumptions_record> |
--                            <new_symbol_record> | <refutation>
inference_item :: CharParser st Inference_item
inference_item :: CharParser st Inference_item
inference_item = String
-> CharParser st Inference_item -> CharParser st Inference_item
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "inference_item" (
  (Inference_status -> Inference_item)
-> ParsecT String st Identity Inference_status
-> CharParser st Inference_item
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Inference_status -> Inference_item
Inf_status ParsecT String st Identity Inference_status
forall st. CharParser st Inference_status
inference_status
  CharParser st Inference_item
-> CharParser st Inference_item -> CharParser st Inference_item
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Assumptions_record -> Inference_item)
-> ParsecT String st Identity Assumptions_record
-> CharParser st Inference_item
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Assumptions_record -> Inference_item
Inf_assumption ParsecT String st Identity Assumptions_record
forall st. CharParser st Assumptions_record
assumptions_record
  CharParser st Inference_item
-> CharParser st Inference_item -> CharParser st Inference_item
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (New_symbol_record -> Inference_item)
-> ParsecT String st Identity New_symbol_record
-> CharParser st Inference_item
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM New_symbol_record -> Inference_item
Inf_symbol ParsecT String st Identity New_symbol_record
forall st. CharParser st New_symbol_record
new_symbol_record
  CharParser st Inference_item
-> CharParser st Inference_item -> CharParser st Inference_item
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (File_source -> Inference_item)
-> ParsecT String st Identity File_source
-> CharParser st Inference_item
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM File_source -> Inference_item
Inf_refutation ParsecT String st Identity File_source
forall st. CharParser st File_source
refutation
  CharParser st Inference_item
-> String -> CharParser st Inference_item
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "inference_item"
  )

-- <inference_status>     :== status(<status_value>) | <inference_info>
inference_status :: CharParser st Inference_status
inference_status :: CharParser st Inference_status
inference_status = String
-> CharParser st Inference_status -> CharParser st Inference_status
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "inference_status" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "status" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    (Status_value -> Inference_status)
-> ParsecT String st Identity Status_value
-> CharParser st Inference_status
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Status_value -> Inference_status
Inf_value (ParsecT String st Identity Status_value
forall st. CharParser st Status_value
status_value ParsecT String st Identity Status_value
-> GenParser Char st Token
-> ParsecT String st Identity Status_value
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
cParenT)
  CharParser st Inference_status
-> CharParser st Inference_status -> CharParser st Inference_status
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Inference_info -> Inference_status)
-> ParsecT String st Identity Inference_info
-> CharParser st Inference_status
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Inference_info -> Inference_status
Inf_info ParsecT String st Identity Inference_info
forall st. CharParser st Inference_info
inference_info
  CharParser st Inference_status
-> String -> CharParser st Inference_status
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "inference_status"
  )

-- %----These are the success status values from the SZS ontology. The most
-- %----commonly used values are:
-- %----  thm - Every model of the parent formulae is a model of the inferred
-- %----        formula. Regular logical consequences.
-- %----  cth - Every model of the parent formulae is a model of the negation of
-- %----        the inferred formula. Used for negation of conjectures in FOF to
-- %----        CNF conversion.
-- %----  esa - There exists a model of the parent formulae iff there exists a
-- %----        model of the inferred formula. Used for Skolemization steps.
-- %----For the full hierarchy see the SZSOntology file distributed with the TPTP.
-- <status_value>         :== suc | unp | sap | esa | sat | fsa | thm | eqv | tac |
--                            wec | eth | tau | wtc | wth | cax | sca | tca | wca |
--                            cup | csp | ecs | csa | cth | ceq | unc | wcc | ect |
--                            fun | uns | wuc | wct | scc | uca | noc
status_value :: CharParser st Status_value
status_value :: CharParser st Status_value
status_value = String -> CharParser st Status_value -> CharParser st Status_value
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "status_value" (
  [(String, Status_value)] -> CharParser st Status_value
forall a st. [(String, a)] -> CharParser st a
constantsChoice
    [("suc", Status_value
SUC), ("unp", Status_value
UNP), ("sap", Status_value
SAP), ("esa", Status_value
ESA), ("sat", Status_value
SAT),
     ("fsa", Status_value
FSA), ("thm", Status_value
THM), ("eqv", Status_value
EQV), ("tac", Status_value
TAC),
     ("wec", Status_value
WEC), ("eth", Status_value
ETH), ("tau", Status_value
TAU), ("wtc", Status_value
WTC), ("wth", Status_value
WTH),
     ("cax", Status_value
CAX), ("sca", Status_value
SCA), ("tca", Status_value
TCA), ("wca", Status_value
WCA),
     ("cup", Status_value
CUP), ("csp", Status_value
CSP), ("ecs", Status_value
ECS), ("csa", Status_value
CSA), ("cth", Status_value
CTH),
     ("ceq", Status_value
CEQ), ("unc", Status_value
UNC), ("wcc", Status_value
WCC), ("ect", Status_value
ECT),
     ("fun", Status_value
FUN), ("uns", Status_value
UNS), ("wuc", Status_value
WUC), ("wct", Status_value
WCT), ("scc", Status_value
SCC),
     ("uca", Status_value
UCA), ("noc", Status_value
NOC)]
  CharParser st Status_value -> String -> CharParser st Status_value
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "status_value"
  )

-- %----<inference_info> is used to record standard information associated with an
-- %----arbitrary inference rule. The <inference_rule> is the same as the
-- %----<inference_rule> of the <inference_record>. The <atomic_word> indicates
-- %----the information being recorded in the <general_list>. The <atomic_word>
-- %----are (loosely) set by TPTP conventions, and include esplit, sr_split, and
-- %----discharge.
-- <inference_info>       :== <inference_rule>(<atomic_word>,<general_list>)
inference_info :: CharParser st Inference_info
inference_info :: CharParser st Inference_info
inference_info = String
-> CharParser st Inference_info -> CharParser st Inference_info
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "inference_info" (do
    Token
ir <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
inference_rule GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    Token
aw <- GenParser Char st Token
forall st. CharParser st Token
atomic_word
    GenParser Char st Token
forall st. CharParser st Token
commaT
    General_list
gl <- CharParser st General_list
forall st. CharParser st General_list
general_list
    GenParser Char st Token
forall st. CharParser st Token
cParenT
    Inference_info -> CharParser st Inference_info
forall (m :: * -> *) a. Monad m => a -> m a
return (Inference_info -> CharParser st Inference_info)
-> Inference_info -> CharParser st Inference_info
forall a b. (a -> b) -> a -> b
$ Token -> Token -> General_list -> Inference_info
Inference_info Token
ir Token
aw General_list
gl
  CharParser st Inference_info
-> String -> CharParser st Inference_info
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "inference_info"
  )

-- %----An <assumptions_record> lists the names of assumptions upon which this
-- %----inferred formula depends. These must be discharged in a completed proof.
-- <assumptions_record>   :== assumptions([<name_list>])
assumptions_record :: CharParser st Assumptions_record
assumptions_record :: CharParser st Assumptions_record
assumptions_record = String
-> CharParser st Assumptions_record
-> CharParser st Assumptions_record
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "assumptions_record" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "assumptions" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    CharParser st Assumptions_record
-> CharParser st Assumptions_record
forall st a. CharParser st a -> CharParser st a
brackets CharParser st Assumptions_record
forall st. CharParser st Assumptions_record
name_list CharParser st Assumptions_record
-> GenParser Char st Token -> CharParser st Assumptions_record
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
cParenT
  CharParser st Assumptions_record
-> String -> CharParser st Assumptions_record
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "assumptions_record"
  )

-- %----A <refutation> record names a file in which the inference recorded here
-- %----is recorded as a proof by refutation.
-- <refutation>           :== refutation(<file_source>)
refutation :: CharParser st Refutation
refutation :: CharParser st File_source
refutation = String -> CharParser st File_source -> CharParser st File_source
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "refutation" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "refutation" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    CharParser st File_source
forall st. CharParser st File_source
file_source CharParser st File_source
-> GenParser Char st Token -> CharParser st File_source
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
cParenT
  CharParser st File_source -> String -> CharParser st File_source
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "refutation"
  )

-- %----A <new_symbol_record> provides information about a newly introduced symbol.
-- <new_symbol_record>    :== new_symbols(<atomic_word>,[<new_symbol_list>])
new_symbol_record :: CharParser st New_symbol_record
new_symbol_record :: CharParser st New_symbol_record
new_symbol_record = String
-> CharParser st New_symbol_record
-> CharParser st New_symbol_record
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "new_symbol_record" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "new_symbols" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    Token
aw <- GenParser Char st Token
forall st. CharParser st Token
atomic_word
    New_symbol_list
nsl <- CharParser st New_symbol_list
forall st. CharParser st New_symbol_list
new_symbol_list
    GenParser Char st Token
forall st. CharParser st Token
cParenT
    New_symbol_record -> CharParser st New_symbol_record
forall (m :: * -> *) a. Monad m => a -> m a
return (New_symbol_record -> CharParser st New_symbol_record)
-> New_symbol_record -> CharParser st New_symbol_record
forall a b. (a -> b) -> a -> b
$ Token -> New_symbol_list -> New_symbol_record
New_symbol_record Token
aw New_symbol_list
nsl
  CharParser st New_symbol_record
-> String -> CharParser st New_symbol_record
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "new_symbol_record"
  )

-- <new_symbol_list>      :== <principal_symbol> |
--                            <principal_symbol>,<new_symbol_list>
new_symbol_list :: CharParser st New_symbol_list
new_symbol_list :: CharParser st New_symbol_list
new_symbol_list = String
-> CharParser st New_symbol_list -> CharParser st New_symbol_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "new_symbol_list" (
  CharParser st Principal_symbol -> CharParser st New_symbol_list
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st Principal_symbol
forall st. CharParser st Principal_symbol
principal_symbol
  CharParser st New_symbol_list
-> String -> CharParser st New_symbol_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "new_symbol_list"
  )

-- %----Principal symbols are predicates, functions, variables
-- <principal_symbol>   :== <functor> | <variable>
principal_symbol :: CharParser st Principal_symbol
principal_symbol :: CharParser st Principal_symbol
principal_symbol = String
-> CharParser st Principal_symbol -> CharParser st Principal_symbol
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "principal_symbol" (
  (Token -> Principal_symbol)
-> ParsecT String st Identity Token
-> CharParser st Principal_symbol
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Principal_symbol
PS_functor ParsecT String st Identity Token
forall st. CharParser st Token
functor
  CharParser st Principal_symbol
-> CharParser st Principal_symbol -> CharParser st Principal_symbol
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> Principal_symbol)
-> ParsecT String st Identity Token
-> CharParser st Principal_symbol
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Principal_symbol
PS_variable ParsecT String st Identity Token
forall st. CharParser st Token
variable
  CharParser st Principal_symbol
-> String -> CharParser st Principal_symbol
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "principal_symbol"
  )

{- -----------------------------------------------------------------------------
Include directives
----------------------------------------------------------------------------- -}
-- <include>              ::= include(<file_name><formula_selection>).
include :: CharParser st Include
include :: CharParser st Include
include = String -> CharParser st Include -> CharParser st Include
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "include" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "include" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    File_name
fn <- CharParser st File_name
forall st. CharParser st File_name
file_name
    Formula_selection
fs <- CharParser st Formula_selection
forall st. CharParser st Formula_selection
formula_selection
    GenParser Char st Token
forall st. CharParser st Token
cParenT
    GenParser Char st Token
forall st. CharParser st Token
dotT
    Include -> CharParser st Include
forall (m :: * -> *) a. Monad m => a -> m a
return (Include -> CharParser st Include)
-> Include -> CharParser st Include
forall a b. (a -> b) -> a -> b
$ File_name -> Formula_selection -> Include
Include File_name
fn Formula_selection
fs
  CharParser st Include -> String -> CharParser st Include
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "include"
  )

-- <formula_selection>    ::= ,[<name_list>] | <null>
formula_selection :: CharParser st Formula_selection
formula_selection :: CharParser st Formula_selection
formula_selection = String
-> CharParser st Formula_selection
-> CharParser st Formula_selection
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "formula_selection" (
  ParsecT String st Identity Assumptions_record
-> CharParser st Formula_selection
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m (Maybe a)
optionMaybe (CharParser st Token
forall st. CharParser st Token
commaT CharParser st Token
-> ParsecT String st Identity Assumptions_record
-> ParsecT String st Identity Assumptions_record
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT String st Identity Assumptions_record
-> ParsecT String st Identity Assumptions_record
forall st a. CharParser st a -> CharParser st a
brackets ParsecT String st Identity Assumptions_record
forall st. CharParser st Assumptions_record
name_list)
  CharParser st Formula_selection
-> String -> CharParser st Formula_selection
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "formula_selection"
  )

-- <name_list>            ::= <name> | <name>,<name_list>
name_list :: CharParser st Name_list
name_list :: CharParser st Assumptions_record
name_list = String
-> CharParser st Assumptions_record
-> CharParser st Assumptions_record
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "name_list" (
  CharParser st Name -> CharParser st Assumptions_record
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st Name
forall st. CharParser st Name
name
  CharParser st Assumptions_record
-> String -> CharParser st Assumptions_record
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "name_list"
  )


{- -----------------------------------------------------------------------------
Non-logical data
----------------------------------------------------------------------------- -}
-- <general_term>         ::= <general_data> | <general_data>:<general_term> |
--                            <general_list>
general_term :: CharParser st General_term
general_term :: CharParser st General_term
general_term = String -> CharParser st General_term -> CharParser st General_term
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "general_term" (do
    General_data
gd <- GenParser Char st General_data -> GenParser Char st General_data
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st General_data
forall st. CharParser st General_data
general_data GenParser Char st General_data
-> ParsecT String st Identity Token
-> GenParser Char st General_data
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Token
forall st. CharParser st Token
colonT)
    General_term
gt <- CharParser st General_term
forall st. CharParser st General_term
general_term
    General_term -> CharParser st General_term
forall (m :: * -> *) a. Monad m => a -> m a
return (General_term -> CharParser st General_term)
-> General_term -> CharParser st General_term
forall a b. (a -> b) -> a -> b
$ General_data -> General_term -> General_term
GT_DataTerm General_data
gd General_term
gt
  CharParser st General_term
-> CharParser st General_term -> CharParser st General_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (General_data -> General_term)
-> GenParser Char st General_data -> CharParser st General_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM General_data -> General_term
GT_data GenParser Char st General_data
forall st. CharParser st General_data
general_data
  CharParser st General_term
-> CharParser st General_term -> CharParser st General_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (General_list -> General_term)
-> ParsecT String st Identity General_list
-> CharParser st General_term
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM General_list -> General_term
GT_list ParsecT String st Identity General_list
forall st. CharParser st General_list
general_list
  CharParser st General_term -> String -> CharParser st General_term
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "general_term"
  )

-- <general_data>         ::= <atomic_word> | <general_function> |
--                            <variable> | <number> | <distinct_object> |
--                            <formula_data>
-- <general_data>         :== bind(<variable>,<formula_data>)
general_data :: CharParser st General_data
general_data :: CharParser st General_data
general_data = String -> CharParser st General_data -> CharParser st General_data
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "general_data" (do
    GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok "bind" GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
    Token
v <- GenParser Char st Token
forall st. CharParser st Token
variable
    GenParser Char st Token
forall st. CharParser st Token
commaT
    Formula_data
fd <- CharParser st Formula_data
forall st. CharParser st Formula_data
formula_data
    GenParser Char st Token
forall st. CharParser st Token
cParenT
    General_data -> CharParser st General_data
forall (m :: * -> *) a. Monad m => a -> m a
return (General_data -> CharParser st General_data)
-> General_data -> CharParser st General_data
forall a b. (a -> b) -> a -> b
$ Token -> Formula_data -> General_data
GD_bind Token
v Formula_data
fd
  CharParser st General_data
-> CharParser st General_data -> CharParser st General_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (General_function -> General_data)
-> ParsecT String st Identity General_function
-> CharParser st General_data
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM General_function -> General_data
GD_general_function ParsecT String st Identity General_function
forall st. CharParser st General_function
general_function
  CharParser st General_data
-> CharParser st General_data -> CharParser st General_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> General_data)
-> GenParser Char st Token -> CharParser st General_data
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> General_data
GD_atomic_word GenParser Char st Token
forall st. CharParser st Token
atomic_word
  CharParser st General_data
-> CharParser st General_data -> CharParser st General_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> General_data)
-> GenParser Char st Token -> CharParser st General_data
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> General_data
GD_variable GenParser Char st Token
forall st. CharParser st Token
variable
  CharParser st General_data
-> CharParser st General_data -> CharParser st General_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Number -> General_data)
-> ParsecT String st Identity Number -> CharParser st General_data
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Number -> General_data
GD_number ParsecT String st Identity Number
forall st. CharParser st Number
number
  CharParser st General_data
-> CharParser st General_data -> CharParser st General_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Token -> General_data)
-> GenParser Char st Token -> CharParser st General_data
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> General_data
GD_distinct_object GenParser Char st Token
forall st. CharParser st Token
distinct_object
  CharParser st General_data
-> CharParser st General_data -> CharParser st General_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> (Formula_data -> General_data)
-> CharParser st Formula_data -> CharParser st General_data
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Formula_data -> General_data
GD_formula_data CharParser st Formula_data
forall st. CharParser st Formula_data
formula_data
  CharParser st General_data -> String -> CharParser st General_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "general_data"
  )

-- <general_function>     ::= <atomic_word>(<general_terms>)
general_function :: CharParser st General_function
general_function :: CharParser st General_function
general_function = String
-> CharParser st General_function -> CharParser st General_function
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "general_function" (do
  Token
aw <- GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (GenParser Char st Token
forall st. CharParser st Token
atomic_word GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
  General_list
fd <- CharParser st General_list
forall st. CharParser st General_list
general_terms
  GenParser Char st Token
forall st. CharParser st Token
cParenT
  General_function -> CharParser st General_function
forall (m :: * -> *) a. Monad m => a -> m a
return (General_function -> CharParser st General_function)
-> General_function -> CharParser st General_function
forall a b. (a -> b) -> a -> b
$ Token -> General_list -> General_function
General_function Token
aw General_list
fd
  )

-- <formula_data>         ::= $thf(<thf_formula>) | $tff(<tff_formula>) |
--                            $fof(<fof_formula>) | $cnf(<cnf_formula>) |
--                            $fot(<fof_term>)
formula_data :: CharParser st Formula_data
formula_data :: CharParser st Formula_data
formula_data = String -> CharParser st Formula_data -> CharParser st Formula_data
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "formula_data" (
  String
-> (THF_formula -> Formula_data)
-> ParsecT String st Identity THF_formula
-> CharParser st Formula_data
forall t b st.
String
-> (t -> b)
-> ParsecT String st Identity t
-> ParsecT String st Identity b
xxx_data "$thf" THF_formula -> Formula_data
FD_THF ParsecT String st Identity THF_formula
forall st. CharParser st THF_formula
thf_formula
  CharParser st Formula_data
-> CharParser st Formula_data -> CharParser st Formula_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> String
-> (TFF_formula -> Formula_data)
-> ParsecT String st Identity TFF_formula
-> CharParser st Formula_data
forall t b st.
String
-> (t -> b)
-> ParsecT String st Identity t
-> ParsecT String st Identity b
xxx_data "$tff" TFF_formula -> Formula_data
FD_TFF ParsecT String st Identity TFF_formula
forall st. CharParser st TFF_formula
tff_formula
  CharParser st Formula_data
-> CharParser st Formula_data -> CharParser st Formula_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> String
-> (TPI_formula -> Formula_data)
-> ParsecT String st Identity TPI_formula
-> CharParser st Formula_data
forall t b st.
String
-> (t -> b)
-> ParsecT String st Identity t
-> ParsecT String st Identity b
xxx_data "$fof" TPI_formula -> Formula_data
FD_FOF ParsecT String st Identity TPI_formula
forall st. CharParser st TPI_formula
fof_formula
  CharParser st Formula_data
-> CharParser st Formula_data -> CharParser st Formula_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> String
-> (CNF_formula -> Formula_data)
-> ParsecT String st Identity CNF_formula
-> CharParser st Formula_data
forall t b st.
String
-> (t -> b)
-> ParsecT String st Identity t
-> ParsecT String st Identity b
xxx_data "$cnf" CNF_formula -> Formula_data
FD_CNF ParsecT String st Identity CNF_formula
forall st. CharParser st CNF_formula
cnf_formula
  CharParser st Formula_data
-> CharParser st Formula_data -> CharParser st Formula_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> String
-> (FOF_term -> Formula_data)
-> ParsecT String st Identity FOF_term
-> CharParser st Formula_data
forall t b st.
String
-> (t -> b)
-> ParsecT String st Identity t
-> ParsecT String st Identity b
xxx_data "$fot" FOF_term -> Formula_data
FD_FOT ParsecT String st Identity FOF_term
forall st. CharParser st FOF_term
fof_term
  CharParser st Formula_data -> String -> CharParser st Formula_data
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "formula_data"
  )
  where
    xxx_data :: String
-> (t -> b)
-> ParsecT String st Identity t
-> ParsecT String st Identity b
xxx_data str :: String
str constructor :: t -> b
constructor parser :: ParsecT String st Identity t
parser = do
      GenParser Char st Token -> GenParser Char st Token
forall tok st a. GenParser tok st a -> GenParser tok st a
try (String -> GenParser Char st Token
forall st. String -> CharParser st Token
strTok String
str GenParser Char st Token
-> GenParser Char st Token -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< GenParser Char st Token
forall st. CharParser st Token
oParenT)
      t
d <- ParsecT String st Identity t
parser
      GenParser Char st Token
forall st. CharParser st Token
cParenT
      b -> ParsecT String st Identity b
forall (m :: * -> *) a. Monad m => a -> m a
return (b -> ParsecT String st Identity b)
-> b -> ParsecT String st Identity b
forall a b. (a -> b) -> a -> b
$ t -> b
constructor t
d

-- <general_list>         ::= [] | [<general_terms>]
general_list :: CharParser st General_list
general_list :: CharParser st General_list
general_list = String -> CharParser st General_list -> CharParser st General_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "general_list" (
  CharParser st General_list
forall st a. CharParser st [a]
emptyBrackets
  CharParser st General_list
-> CharParser st General_list -> CharParser st General_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st General_list -> CharParser st General_list
forall st a. CharParser st a -> CharParser st a
brackets CharParser st General_list
forall st. CharParser st General_list
general_terms
  CharParser st General_list -> String -> CharParser st General_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "general_list"
  )

-- <general_terms>        ::= <general_term> | <general_term>,<general_terms>
general_terms :: CharParser st General_terms
general_terms :: CharParser st General_list
general_terms = String -> CharParser st General_list -> CharParser st General_list
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "general_terms" (
  CharParser st General_term -> CharParser st General_list
forall st a. CharParser st a -> CharParser st [a]
sepByComma1 CharParser st General_term
forall st. CharParser st General_term
general_term
  CharParser st General_list -> String -> CharParser st General_list
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "general_terms"
  )


{- -----------------------------------------------------------------------------
General purpose
----------------------------------------------------------------------------- -}
-- <name>                 ::= <atomic_word> | <integer>
name :: CharParser st Name
name :: CharParser st Name
name = String -> CharParser st Name -> CharParser st Name
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "name" (
  (Token -> Name)
-> ParsecT String st Identity Token -> CharParser st Name
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Name
NameString ParsecT String st Identity Token
forall st. CharParser st Token
atomic_word
  CharParser st Name -> CharParser st Name -> CharParser st Name
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ((Integer -> Name)
-> ParsecT String st Identity Integer -> CharParser st Name
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Integer -> Name
NameInteger (ParsecT String st Identity Integer -> CharParser st Name)
-> ParsecT String st Identity Integer -> CharParser st Name
forall a b. (a -> b) -> a -> b
$ (String -> Integer)
-> ParsecT String st Identity String
-> ParsecT String st Identity Integer
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM String -> Integer
forall a. Read a => String -> a
read ParsecT String st Identity String
forall st. CharParser st String
integer)
  CharParser st Name -> String -> CharParser st Name
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "name"
  )

-- <atomic_word>          ::= <lower_word> | <single_quoted>
-- %----<single_quoted> tokens do not include their outer quotes, therefore the
-- %----<lower_word> <atomic_word> cat and the <single_quoted> <atomic_word> 'cat'
-- %----are the same. Quotes must be removed from a <single_quoted> <atomic_word>
-- %----if doing so produces a <lower_word> <atomic_word>. Note that <numbers>s
-- %----and <variable>s are not <lower_word>s, so '123' and 123, and 'X' and X,
-- %----are different.
atomic_word :: CharParser st Token
atomic_word :: CharParser st Token
atomic_word = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "atomic_word" (
  CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
pToken CharParser st String
forall st. CharParser st String
lower_word
  CharParser st Token -> CharParser st Token -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> do
    Token
s <- CharParser st Token
forall st. CharParser st Token
single_quoted
    let sNoQuotes :: String
sNoQuotes = String -> String
removeQuotes (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ Token -> String
tokStr Token
s
    case GenParser Char () String
-> () -> String -> String -> Either ParseError String
forall tok st a.
GenParser tok st a -> st -> String -> [tok] -> Either ParseError a
runParser GenParser Char () String
forall st. CharParser st String
lower_word () "" String
sNoQuotes of
      Right _ -> Token -> CharParser st Token
forall (m :: * -> *) a. Monad m => a -> m a
return (Token -> CharParser st Token) -> Token -> CharParser st Token
forall a b. (a -> b) -> a -> b
$ Token
s { tokStr :: String
tokStr = String
sNoQuotes }
      Left _ -> Token -> CharParser st Token
forall (m :: * -> *) a. Monad m => a -> m a
return Token
s
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "atomic_word"
  )
  where
    removeQuotes :: String -> String
    removeQuotes :: String -> String
removeQuotes = String -> String
forall a. [a] -> [a]
init (String -> String) -> (String -> String) -> String -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String
forall a. [a] -> [a]
tail

-- <atomic_defined_word>  ::= <dollar_word>
atomic_defined_word :: CharParser st Token
atomic_defined_word :: CharParser st Token
atomic_defined_word = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "atomic_defined_word" (CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
pToken CharParser st String
forall st. CharParser st String
dollar_word
  )


-- <atomic_system_word>   ::= <dollar_dollar_word>
atomic_system_word :: CharParser st Token
atomic_system_word :: CharParser st Token
atomic_system_word = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "atomic_system_word" (CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
pToken CharParser st String
forall st. CharParser st String
dollar_dollar_word
  )

-- <number>               ::= <integer> | <rational> | <real>
number :: CharParser st Number
number :: CharParser st Number
number = String -> CharParser st Number -> CharParser st Number
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "number" (
  ((Rational -> Number)
-> ParsecT String st Identity Rational -> CharParser st Number
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Rational -> Number
NumRational ((String -> Rational)
-> ParsecT String st Identity String
-> ParsecT String st Identity Rational
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM String -> Rational
forall a. Read a => String -> a
read ParsecT String st Identity String
forall st. CharParser st String
rational) CharParser st Number
-> ParsecT String st Identity () -> CharParser st Number
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity ()
forall st. CharParser st ()
skip)
  CharParser st Number
-> CharParser st Number -> CharParser st Number
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ((Double -> Number)
-> ParsecT String st Identity Double -> CharParser st Number
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Double -> Number
NumReal ((String -> Double)
-> ParsecT String st Identity String
-> ParsecT String st Identity Double
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM String -> Double
forall a. Read a => String -> a
read ParsecT String st Identity String
forall st. CharParser st String
real) CharParser st Number
-> ParsecT String st Identity () -> CharParser st Number
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity ()
forall st. CharParser st ()
skip)
  CharParser st Number
-> CharParser st Number -> CharParser st Number
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ((Integer -> Number)
-> ParsecT String st Identity Integer -> CharParser st Number
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Integer -> Number
NumInteger ((String -> Integer)
-> ParsecT String st Identity String
-> ParsecT String st Identity Integer
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM String -> Integer
forall a. Read a => String -> a
read ParsecT String st Identity String
forall st. CharParser st String
integer) CharParser st Number
-> ParsecT String st Identity () -> CharParser st Number
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity ()
forall st. CharParser st ()
skip)
  CharParser st Number -> String -> CharParser st Number
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "number"
  )

-- <file_name>            ::= <single_quoted>
file_name :: CharParser st File_name
file_name :: CharParser st File_name
file_name = String -> CharParser st File_name -> CharParser st File_name
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "file_name" (
  CharParser st File_name
forall st. CharParser st File_name
single_quoted_file_name
  CharParser st File_name
-> CharParser st File_name -> CharParser st File_name
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st File_name
forall st. CharParser st File_name
unquoted_file_name
  CharParser st File_name -> String -> CharParser st File_name
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "file_name"
  )

-- <null>                 ::=


{- -----------------------------------------------------------------------------
Comments
----------------------------------------------------------------------------- -}

-- <comment>              ::- <comment_line>|<comment_block>
comment :: CharParser st Comment
comment :: CharParser st Comment
comment = String -> CharParser st Comment -> CharParser st Comment
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "comment" (CharParser st Comment
forall st. CharParser st Comment
comment_line CharParser st Comment
-> CharParser st Comment -> CharParser st Comment
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st Comment
forall st. CharParser st Comment
comment_block CharParser st Comment -> String -> CharParser st Comment
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "comment"
  )

-- <comment_line>         ::- [%]<printable_char>*
comment_line :: CharParser st Comment
comment_line :: CharParser st Comment
comment_line = String -> CharParser st Comment -> CharParser st Comment
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "comment_line" ((Token -> Comment)
-> ParsecT String st Identity Token -> CharParser st Comment
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Comment
Comment_line (String -> Bool -> ParsecT String st Identity Token
forall st. String -> Bool -> CharParser st Token
commentLineWith "%" Bool
True) CharParser st Comment -> String -> CharParser st Comment
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "comment_line"
  )

-- <comment_block>        ::: [/][*]<not_star_slash>[*][*]*[/]
comment_block :: CharParser st Comment
comment_block :: CharParser st Comment
comment_block = String -> CharParser st Comment -> CharParser st Comment
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "comment_block" ((Token -> Comment)
-> ParsecT String st Identity Token -> CharParser st Comment
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> Comment
Comment_block (String -> Bool -> ParsecT String st Identity Token
forall st. String -> Bool -> CharParser st Token
commentBlockWith "/*" Bool
True) CharParser st Comment -> String -> CharParser st Comment
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "comment_block"
  )

-- %----  <defined_comment>    ::- <def_comment_line>|<def_comment_block>
defined_comment :: CharParser st DefinedComment
defined_comment :: CharParser st DefinedComment
defined_comment = String
-> CharParser st DefinedComment -> CharParser st DefinedComment
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "defined_comment" (CharParser st DefinedComment
forall st. CharParser st DefinedComment
def_comment_line CharParser st DefinedComment
-> CharParser st DefinedComment -> CharParser st DefinedComment
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st DefinedComment
forall st. CharParser st DefinedComment
def_comment_block CharParser st DefinedComment
-> String -> CharParser st DefinedComment
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "defined_comment"
  )

-- %----  <def_comment_line>   ::: [%]<dollar><printable_char>*
def_comment_line :: CharParser st DefinedComment
def_comment_line :: CharParser st DefinedComment
def_comment_line = String
-> CharParser st DefinedComment -> CharParser st DefinedComment
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "def_comment_line" ((Token -> DefinedComment)
-> ParsecT String st Identity Token -> CharParser st DefinedComment
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> DefinedComment
Defined_comment_line (String -> Bool -> ParsecT String st Identity Token
forall st. String -> Bool -> CharParser st Token
commentLineWith "%$" Bool
True)
  CharParser st DefinedComment
-> String -> CharParser st DefinedComment
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "def_comment_line"
  )

-- %----  <def_comment_block>  ::: [/][*]<dollar><not_star_slash>[*][*]*[/]
def_comment_block :: CharParser st DefinedComment
def_comment_block :: CharParser st DefinedComment
def_comment_block = String
-> CharParser st DefinedComment -> CharParser st DefinedComment
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "def_comment_block" ((Token -> DefinedComment)
-> ParsecT String st Identity Token -> CharParser st DefinedComment
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> DefinedComment
Defined_comment_block (String -> Bool -> ParsecT String st Identity Token
forall st. String -> Bool -> CharParser st Token
commentBlockWith "/*$" Bool
True)
  CharParser st DefinedComment
-> String -> CharParser st DefinedComment
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "def_comment_block"
  )

-- %----  <system_comment>     ::- <sys_comment_line>|<sys_comment_block>
system_comment :: CharParser st SystemComment
system_comment :: CharParser st SystemComment
system_comment = String
-> CharParser st SystemComment -> CharParser st SystemComment
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "system_comment" (CharParser st SystemComment
forall st. CharParser st SystemComment
sys_comment_line CharParser st SystemComment
-> CharParser st SystemComment -> CharParser st SystemComment
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st SystemComment
forall st. CharParser st SystemComment
sys_comment_block CharParser st SystemComment
-> String -> CharParser st SystemComment
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "system_comment"
  )

-- %----  <sys_comment_line>   ::: [%]<dollar><dollar><printable_char>*
sys_comment_line :: CharParser st SystemComment
sys_comment_line :: CharParser st SystemComment
sys_comment_line = String
-> CharParser st SystemComment -> CharParser st SystemComment
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "sys_comment_line" ((Token -> SystemComment)
-> ParsecT String st Identity Token -> CharParser st SystemComment
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> SystemComment
System_comment_line (String -> Bool -> ParsecT String st Identity Token
forall st. String -> Bool -> CharParser st Token
commentLineWith "%$$" Bool
False)
  CharParser st SystemComment
-> String -> CharParser st SystemComment
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "sys_comment_line"
  )

-- %----  <sys_comment_block>  ::: [/][*]<dollar><dollar><not_star_slash>[*][*]*[/]
sys_comment_block :: CharParser st SystemComment
sys_comment_block :: CharParser st SystemComment
sys_comment_block = String
-> CharParser st SystemComment -> CharParser st SystemComment
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "sys_comment_block" ((Token -> SystemComment)
-> ParsecT String st Identity Token -> CharParser st SystemComment
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Token -> SystemComment
System_comment_block (String -> Bool -> ParsecT String st Identity Token
forall st. String -> Bool -> CharParser st Token
commentBlockWith "/*$$" Bool
False)
  CharParser st SystemComment
-> String -> CharParser st SystemComment
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "sys_comment_block"
  )

commentLineWith :: String -> Bool -> CharParser st Token
commentLineWith :: String -> Bool -> CharParser st Token
commentLineWith beginning :: String
beginning restrict :: Bool
restrict = (do
  String -> CharParser st String
forall st. String -> CharParser st String
tryString String
beginning
  if Bool
restrict then ParsecT String st Identity Char -> ParsecT String st Identity ()
forall s (m :: * -> *) t a u.
(Stream s m t, Show a) =>
ParsecT s u m a -> ParsecT s u m ()
notFollowedBy (Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '$') else () -> ParsecT String st Identity ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
  -- we use anyChar instead of printable_char for the comments to parse the whole tptp library
  CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
pToken (CharParser st String -> CharParser st Token)
-> CharParser st String -> CharParser st Token
forall a b. (a -> b) -> a -> b
$ ParsecT String st Identity Char
-> ParsecT String st Identity Char -> CharParser st String
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
manyTill ParsecT String st Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
anyChar (Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '\n'))
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "commentLineWith"

commentBlockWith :: String -> Bool -> CharParser st Token
commentBlockWith :: String -> Bool -> CharParser st Token
commentBlockWith beginning :: String
beginning restrict :: Bool
restrict = (do
  String -> CharParser st String
forall st. String -> CharParser st String
tryString String
beginning
  if Bool
restrict then ParsecT String st Identity Char -> ParsecT String st Identity ()
forall s (m :: * -> *) t a u.
(Stream s m t, Show a) =>
ParsecT s u m a -> ParsecT s u m ()
notFollowedBy (Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '$') ParsecT String st Identity ()
-> ParsecT String st Identity () -> ParsecT String st Identity ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> () -> ParsecT String st Identity ()
forall (m :: * -> *) a. Monad m => a -> m a
return () else () -> ParsecT String st Identity ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
  -- we use anyChar instead of printable_char for the comments to parse the whole tptp library
  CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
pToken (CharParser st String -> CharParser st Token)
-> CharParser st String -> CharParser st Token
forall a b. (a -> b) -> a -> b
$ ParsecT String st Identity Char
-> CharParser st Token -> CharParser st String
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
manyTill ParsecT String st Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
anyChar (String -> CharParser st Token
forall st. String -> CharParser st Token
strTok "*/"))
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "commentBlockWith"

{- -----------------------------------------------------------------------------
Word classes
----------------------------------------------------------------------------- -}

-- <sq_char>            ::: ([\40-\46\50-\133\135-\176]|[\\]['\\])
-- <single_quoted>      ::- <single_quote><sq_char><sq_char>*<single_quote>
-- %---Space and visible characters upto ~, except ' and \
single_quoted :: CharParser st Token
single_quoted :: CharParser st Token
single_quoted = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "single_quoted" (CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
pToken (do
    Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '\''
    String
s <- ([String] -> String)
-> ParsecT String st Identity [String] -> CharParser st String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat (ParsecT String st Identity [String] -> CharParser st String)
-> ParsecT String st Identity [String] -> CharParser st String
forall a b. (a -> b) -> a -> b
$ CharParser st String -> ParsecT String st Identity [String]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 (String -> CharParser st String
forall st. String -> CharParser st String
tryString "\\\\" CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> String -> CharParser st String
forall st. String -> CharParser st String
tryString "\\'"
        CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ParsecT String st Identity Char -> CharParser st String
forall (m :: * -> *) a. Monad m => m a -> m [a]
single ((Char -> Bool) -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
(Char -> Bool) -> ParsecT s u m Char
satisfy (\ c :: Char
c -> Char -> Bool
printable Char
c Bool -> Bool -> Bool
&& Char -> String -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
notElem Char
c "'\\")))
    Char -> CharParser st ()
forall st. Char -> CharParser st ()
keyChar '\''
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return ( "'" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
s String -> String -> String
forall a. [a] -> [a] -> [a]
++ "'"))
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "single_quoted"
  )

-- For the include, we need the single quoted to be an IRI
single_quoted_file_name :: CharParser st IRI
single_quoted_file_name :: CharParser st File_name
single_quoted_file_name = String -> CharParser st File_name -> CharParser st File_name
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "single_quoted" (do
    Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '\''
    String
s <- ([String] -> String)
-> ParsecT String st Identity [String]
-> ParsecT String st Identity String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat (ParsecT String st Identity [String]
 -> ParsecT String st Identity String)
-> ParsecT String st Identity [String]
-> ParsecT String st Identity String
forall a b. (a -> b) -> a -> b
$ ParsecT String st Identity String
-> ParsecT String st Identity [String]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 (String -> ParsecT String st Identity String
forall st. String -> CharParser st String
tryString "\\\\" ParsecT String st Identity String
-> ParsecT String st Identity String
-> ParsecT String st Identity String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> String -> ParsecT String st Identity String
forall st. String -> CharParser st String
tryString "\\'"
        ParsecT String st Identity String
-> ParsecT String st Identity String
-> ParsecT String st Identity String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ParsecT String st Identity Char
-> ParsecT String st Identity String
forall (m :: * -> *) a. Monad m => m a -> m [a]
single ((Char -> Bool) -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
(Char -> Bool) -> ParsecT s u m Char
satisfy (\ c :: Char
c -> Char -> Bool
printable Char
c Bool -> Bool -> Bool
&& Char -> String -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
notElem Char
c "'\\")))
    let s' :: String
s' = String -> String
escapeTPTPFilePath String
s
    File_name
i <- case Parsec String () File_name
-> String -> String -> Either ParseError File_name
forall s t a.
Stream s Identity t =>
Parsec s () a -> String -> s -> Either ParseError a
parse (Parsec String () File_name
forall st. CharParser st File_name
iriCurie Parsec String () File_name
-> ParsecT String () Identity () -> Parsec String () File_name
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String () Identity ()
forall s (m :: * -> *) t u.
(Stream s m t, Show t) =>
ParsecT s u m ()
eof) "" String
s' of
      Left err :: ParseError
err -> String -> CharParser st File_name
forall (m :: * -> *) a. MonadFail m => String -> m a
Fail.fail (String -> CharParser st File_name)
-> String -> CharParser st File_name
forall a b. (a -> b) -> a -> b
$ ParseError -> String
forall a. Show a => a -> String
show ParseError
err
      Right i :: File_name
i -> File_name -> CharParser st File_name
forall (m :: * -> *) a. Monad m => a -> m a
return (File_name -> CharParser st File_name)
-> File_name -> CharParser st File_name
forall a b. (a -> b) -> a -> b
$ File_name -> File_name
unescapeTPTPFileIRI File_name
i
    Char -> CharParser st ()
forall st. Char -> CharParser st ()
keyChar '\''
    CharParser st ()
forall st. CharParser st ()
skip
    File_name -> CharParser st File_name
forall (m :: * -> *) a. Monad m => a -> m a
return File_name
i
  CharParser st File_name -> String -> CharParser st File_name
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "single_quoted"
  )

unquoted_file_name :: CharParser st IRI
unquoted_file_name :: CharParser st File_name
unquoted_file_name = String -> CharParser st File_name -> CharParser st File_name
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "single_quoted" (CharParser st File_name -> CharParser st File_name
forall tok st a. GenParser tok st a -> GenParser tok st a
try (do
    -- a file name is always terminated by a comma or a closing parenthesis
    String
s <- ParsecT String st Identity String
-> ParsecT String st Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m a
lookAhead (ParsecT String st Identity String
 -> ParsecT String st Identity String)
-> ParsecT String st Identity String
-> ParsecT String st Identity String
forall a b. (a -> b) -> a -> b
$ ParsecT String st Identity String
-> ParsecT String st Identity String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (ParsecT String st Identity String
 -> ParsecT String st Identity String)
-> ParsecT String st Identity String
-> ParsecT String st Identity String
forall a b. (a -> b) -> a -> b
$ ParsecT String st Identity Char
-> ParsecT String st Identity Char
-> ParsecT String st Identity String
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
manyTill ParsecT String st Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
anyChar (ParsecT String st Identity Char
 -> ParsecT String st Identity String)
-> ParsecT String st Identity Char
-> ParsecT String st Identity String
forall a b. (a -> b) -> a -> b
$ ParsecT String st Identity Char -> ParsecT String st Identity Char
forall tok st a. GenParser tok st a -> GenParser tok st a
try (ParsecT String st Identity Char
 -> ParsecT String st Identity Char)
-> ParsecT String st Identity Char
-> ParsecT String st Identity Char
forall a b. (a -> b) -> a -> b
$ String -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
oneOf ",)"
    let s' :: String
s' = String -> String
escapeTPTPFilePath String
s
    File_name
i <- case Parsec String () File_name
-> String -> String -> Either ParseError File_name
forall s t a.
Stream s Identity t =>
Parsec s () a -> String -> s -> Either ParseError a
parse (Parsec String () File_name
forall st. CharParser st File_name
iriCurie Parsec String () File_name
-> ParsecT String () Identity () -> Parsec String () File_name
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String () Identity ()
forall s (m :: * -> *) t u.
(Stream s m t, Show t) =>
ParsecT s u m ()
eof) "" String
s' of
      Left err :: ParseError
err -> String -> CharParser st File_name
forall (m :: * -> *) a. MonadFail m => String -> m a
Fail.fail (String -> CharParser st File_name)
-> String -> CharParser st File_name
forall a b. (a -> b) -> a -> b
$ ParseError -> String
forall a. Show a => a -> String
show ParseError
err
      Right i :: File_name
i -> File_name -> CharParser st File_name
forall (m :: * -> *) a. Monad m => a -> m a
return (File_name -> CharParser st File_name)
-> File_name -> CharParser st File_name
forall a b. (a -> b) -> a -> b
$ File_name -> File_name
unescapeTPTPFileIRI File_name
i
    String -> CharParser st Token
forall st. String -> CharParser st Token
strTok String
s
    CharParser st ()
forall st. CharParser st ()
skip
    File_name -> CharParser st File_name
forall (m :: * -> *) a. Monad m => a -> m a
return File_name
i)
  CharParser st File_name -> String -> CharParser st File_name
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "single_quoted"
  )

-- <do_char>              ::: ([\40-\41\43-\133\135-\176]|[\\]["\\])
-- <distinct_object>      ::- <double_quote><do_char>*<double_quote>
-- %---Space and visible characters upto ~, except " and \
-- %----<distinct_object>s contain visible characters. \ is the escape character
-- %----for " and \, i.e., \" is not the end of the <distinct_object>.
-- %----<distinct_object>s are different from (but may be equal to) other tokens,
-- %----e.g., "cat" is different from 'cat' and cat. Distinct objects are always
-- %----interpreted as themselves, so if they are different they are unequal,
-- %----e.g., "Apple" != "Microsoft" is implicit.
distinct_object :: CharParser st Token
distinct_object :: CharParser st Token
distinct_object = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace "distinct_object" (CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
pToken (do
    Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '"'
    String
s <- ([String] -> String)
-> ParsecT String st Identity [String] -> CharParser st String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat (ParsecT String st Identity [String] -> CharParser st String)
-> ParsecT String st Identity [String] -> CharParser st String
forall a b. (a -> b) -> a -> b
$ CharParser st String -> ParsecT String st Identity [String]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many (String -> CharParser st String
forall st. String -> CharParser st String
tryString "\\\\" CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> String -> CharParser st String
forall st. String -> CharParser st String
tryString "\\\""
        CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ParsecT String st Identity Char -> CharParser st String
forall (m :: * -> *) a. Monad m => m a -> m [a]
single ((Char -> Bool) -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
(Char -> Bool) -> ParsecT s u m Char
satisfy (\ c :: Char
c -> Char -> Bool
printable Char
c Bool -> Bool -> Bool
&& Char -> String -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
notElem Char
c "\"\\")))
    Char -> CharParser st ()
forall st. Char -> CharParser st ()
keyChar '"'
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return ("\"" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
s String -> String -> String
forall a. [a] -> [a] -> [a]
++ "\""))
  CharParser st Token -> String -> CharParser st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "distinct_object"
  )


-- -- <dollar_word>          ::- <dollar><lower_word>
dollar_word :: CharParser st String
dollar_word :: CharParser st String
dollar_word = do
  Char
prefix <- Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '$' ParsecT String st Identity Char
-> ParsecT String st Identity () -> ParsecT String st Identity Char
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Char -> ParsecT String st Identity ()
forall s (m :: * -> *) t a u.
(Stream s m t, Show a) =>
ParsecT s u m a -> ParsecT s u m ()
notFollowedBy (Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '$')
  String
word <- CharParser st String
forall st. CharParser st String
lower_word
  String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (Char
prefix Char -> String -> String
forall a. a -> [a] -> [a]
: String
word)

-- <dollar_dollar_word>   ::- <dollar><dollar><lower_word>
dollar_dollar_word :: CharParser st String
dollar_dollar_word :: CharParser st String
dollar_dollar_word = do
    String
prefix <- String -> CharParser st String
forall st. String -> CharParser st String
tryString "$$"
    String
word <- CharParser st String
forall st. CharParser st String
lower_word
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (String
prefix String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
word)
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "dollar_dollar_word"

-- <upper_word>           ::- <upper_alpha><alpha_numeric>*
upper_word :: CharParser st String
upper_word :: CharParser st String
upper_word = do
    Char
u <- ParsecT String st Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
upper
    String
w <- ParsecT String st Identity Char -> CharParser st String
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many ParsecT String st Identity Char
forall st. CharParser st Char
alpha_numeric
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (Char
u Char -> String -> String
forall a. a -> [a] -> [a]
: String
w)
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "upper_word"

-- <lower_word>           ::- <lower_alpha><alpha_numeric>*
lower_word :: CharParser st String
lower_word :: CharParser st String
lower_word = do
    Char
l <- ParsecT String st Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
lower
    String
w <- ParsecT String st Identity Char -> CharParser st String
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many ParsecT String st Identity Char
forall st. CharParser st Char
alpha_numeric
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (Char
l Char -> String -> String
forall a. a -> [a] -> [a]
: String
w)
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "lower_word"

{- -----------------------------------------------------------------------------
Numbers. Signs are made part of the same token here.
----------------------------------------------------------------------------- -}
-- <real>                 ::- (<signed_real>|<unsigned_real>)
real :: CharParser st String
real :: CharParser st String
real = CharParser st String
forall st. CharParser st String
signed_real CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st String
forall st. CharParser st String
unsigned_real CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "real"

-- <signed_real>          ::- <sign><unsigned_real>
signed_real :: CharParser st String
signed_real :: CharParser st String
signed_real = CharParser st String -> CharParser st String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (do
    Char
s <- CharParser st Char
forall st. CharParser st Char
sign
    String
r <- CharParser st String
forall st. CharParser st String
unsigned_real
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (Char
s Char -> String -> String
forall a. a -> [a] -> [a]
: String
r))
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "signed_real"

-- <unsigned_real>        ::- (<decimal_fraction>|<decimal_exponent>)
unsigned_real :: CharParser st String
unsigned_real :: CharParser st String
unsigned_real = CharParser st String
forall st. CharParser st String
decimal_exponent CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st String
forall st. CharParser st String
decimal_fraction CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "unsigned_real"

-- <rational>             ::- (<signed_rational>|<unsigned_rational>)
rational :: CharParser st String
rational :: CharParser st String
rational = CharParser st String
forall st. CharParser st String
signed_rational CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st String
forall st. CharParser st String
unsigned_rational CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "rational"

-- <signed_rational>      ::- <sign><unsigned_rational>
signed_rational :: CharParser st String
signed_rational :: CharParser st String
signed_rational = CharParser st String -> CharParser st String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (do
    Char
s <- CharParser st Char
forall st. CharParser st Char
sign
    String
r <- CharParser st String
forall st. CharParser st String
unsigned_rational
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (Char
s Char -> String -> String
forall a. a -> [a] -> [a]
: String
r))
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "signed_rational"

-- <unsigned_rational>    ::- <decimal><slash><positive_decimal>
unsigned_rational :: CharParser st String
unsigned_rational :: CharParser st String
unsigned_rational = do
    String
d <- CharParser st String -> CharParser st String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (CharParser st String
forall st. CharParser st String
decimal CharParser st String
-> ParsecT String st Identity Char -> CharParser st String
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '/')
    String
p <- CharParser st String
forall st. CharParser st String
positive_decimal
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (String
d String -> String -> String
forall a. [a] -> [a] -> [a]
++ "/" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
p)
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "unsigned_rational"

-- <integer>              ::- (<signed_integer>|<unsigned_integer>)
integer  :: CharParser st String
integer :: CharParser st String
integer = CharParser st String
forall st. CharParser st String
signed_integer CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st String
forall st. CharParser st String
unsigned_integer CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "integer"

-- <signed_integer>       ::- <sign><unsigned_integer>
signed_integer :: CharParser st String
signed_integer :: CharParser st String
signed_integer = CharParser st String -> CharParser st String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (do
    Char
s <- CharParser st Char
forall st. CharParser st Char
sign
    String
i <- CharParser st String
forall st. CharParser st String
unsigned_integer
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (Char
s Char -> String -> String
forall a. a -> [a] -> [a]
: String
i))
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "signed_integer"

-- <unsigned_integer>     ::- <decimal>
unsigned_integer :: CharParser st String
unsigned_integer :: CharParser st String
unsigned_integer = CharParser st String
forall st. CharParser st String
decimal CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "unsigned_integer"

-- <decimal>              ::- (<zero_numeric>|<positive_decimal>)
decimal :: CharParser st String
decimal :: CharParser st String
decimal = ParsecT String st Identity Char -> CharParser st String
forall (m :: * -> *) a. Monad m => m a -> m [a]
single (Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '0') CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st String
forall st. CharParser st String
positive_decimal CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "decimal"

-- <positive_decimal>     ::- <non_zero_numeric><numeric>*
positive_decimal :: CharParser st String
positive_decimal :: CharParser st String
positive_decimal = CharParser st String -> CharParser st String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (do
    Char
nzn <- CharParser st Char
forall st. CharParser st Char
non_zero_numeric
    String
ns <- CharParser st Char -> CharParser st String
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many CharParser st Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
digit
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (Char
nzn Char -> String -> String
forall a. a -> [a] -> [a]
: String
ns))
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "positive_decimal"

-- <decimal_exponent>     ::- (<decimal>|<decimal_fraction>)<exponent><exp_integer>
decimal_exponent :: CharParser st String
decimal_exponent :: CharParser st String
decimal_exponent = CharParser st String -> CharParser st String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (do
    String
df <- CharParser st String -> CharParser st String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (CharParser st String
forall st. CharParser st String
decimal_fraction CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st String
forall st. CharParser st String
decimal)
    String
exp <- ParsecT String st Identity Char -> CharParser st String
forall (m :: * -> *) a. Monad m => m a -> m [a]
single ParsecT String st Identity Char
forall st. CharParser st Char
exponent
    String
exp_int <- CharParser st String
forall st. CharParser st String
exp_integer
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (String
df String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
exp String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
exp_int))
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "decimal_exponent"

-- <decimal_fraction>     ::- <decimal><dot_decimal>
decimal_fraction :: CharParser st String
decimal_fraction :: CharParser st String
decimal_fraction = CharParser st String -> CharParser st String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (do
    String
dec <- CharParser st String
forall st. CharParser st String
decimal
    String
dd <- CharParser st String
forall st. CharParser st String
dot_decimal
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (String
dec String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
dd))
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "decimal_fraction"

-- <dot_decimal>          ::- <dot><numeric><numeric>*
dot_decimal :: CharParser st String
dot_decimal :: CharParser st String
dot_decimal = do
    Char
dot <- Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char '.'
    String
num <- ParsecT String st Identity Char -> CharParser st String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 ParsecT String st Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
digit
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (Char
dot Char -> String -> String
forall a. a -> [a] -> [a]
: String
num)
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "dot_decimal"

-- <exp_integer>          ::- (<signed_exp_integer>|<unsigned_exp_integer>)
exp_integer :: CharParser st String
exp_integer :: CharParser st String
exp_integer = CharParser st String
forall st. CharParser st String
signed_exp_integer CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st String
forall st. CharParser st String
unsigned_exp_integer CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "exp_integer"

-- <signed_exp_integer>   ::- <sign><unsigned_exp_integer>
signed_exp_integer :: CharParser st String
signed_exp_integer :: CharParser st String
signed_exp_integer = CharParser st String -> CharParser st String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (do
    Char
s <- CharParser st Char
forall st. CharParser st Char
sign
    String
d <- CharParser st String
forall st. CharParser st String
unsigned_exp_integer
    String -> CharParser st String
forall (m :: * -> *) a. Monad m => a -> m a
return (Char
s Char -> String -> String
forall a. a -> [a] -> [a]
: String
d))
  CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "signed_exp_integer"

-- <unsigned_exp_integer> ::- <numeric><numeric>*
unsigned_exp_integer :: CharParser st String
unsigned_exp_integer :: CharParser st String
unsigned_exp_integer = ParsecT String st Identity Char -> CharParser st String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 ParsecT String st Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
digit CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "unsigned_exp_integer"


{- -----------------------------------------------------------------------------
Character classes
----------------------------------------------------------------------------- -}

-- <sign>                 ::: [+-]
sign :: CharParser st Char
sign :: CharParser st Char
sign = String -> CharParser st Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
oneOf "+-" CharParser st Char -> String -> CharParser st Char
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "sign"

-- <exponent>             ::: [Ee]
exponent :: CharParser st Char
exponent :: CharParser st Char
exponent = String -> CharParser st Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
oneOf "Ee" CharParser st Char -> String -> CharParser st Char
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "exponent"

-- <non_zero_numeric>     ::: [1-9]
non_zero_numeric :: CharParser st Char
non_zero_numeric :: CharParser st Char
non_zero_numeric = (Char -> Bool) -> CharParser st Char
forall s (m :: * -> *) u.
Stream s m Char =>
(Char -> Bool) -> ParsecT s u m Char
satisfy (\ c :: Char
c -> '1' Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
<= Char
c Bool -> Bool -> Bool
&& Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
<= '9') CharParser st Char -> String -> CharParser st Char
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "non_zero_numeric"

-- <alpha_numeric>        ::: (<lower_alpha>|<upper_alpha>|<numeric>|[_])
alpha_numeric :: CharParser st Char
alpha_numeric :: CharParser st Char
alpha_numeric = (Char -> Bool) -> CharParser st Char
forall s (m :: * -> *) u.
Stream s m Char =>
(Char -> Bool) -> ParsecT s u m Char
satisfy (\ c :: Char
c -> Char -> Bool
isAlphaNum Char
c Bool -> Bool -> Bool
|| Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== '_') CharParser st Char -> String -> CharParser st Char
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "alpha_numeric"

-- <printable_char>       ::: .
-- %----<printable_char> is any printable ASCII character, codes 32 (space) to 126
-- %----(tilde). <printable_char> does not include tabs, newlines, bells, etc. The
-- %----use of . does not not exclude tab, so this is a bit loose.
-- printable_char :: CharParser st Char
-- printable_char = satisfy printable <?> "printable_char"

printable :: Char -> Bool
-- the tab character is an unofficial extension
printable :: Char -> Bool
printable c :: Char
c = (32 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Char -> Int
ord Char
c Bool -> Bool -> Bool
&& Char -> Int
ord Char
c Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= 126) Bool -> Bool -> Bool
|| Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== '\t'

-- NOTE: not used
-- -- <viewable_char>        ::: [.\n]
-- viewable_char :: CharParser st Char
-- viewable_char = satisfy (\ c -> printable c || c == '\n')


vline :: CharParser st Token
vline :: CharParser st Token
vline = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '|'

andT :: CharParser st Token
andT :: CharParser st Token
andT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '&'

starT :: CharParser st Token
starT :: CharParser st Token
starT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '*'

plusT :: CharParser st Token
plusT :: CharParser st Token
plusT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '+'

arrowT :: CharParser st Token
arrowT :: CharParser st Token
arrowT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '>'


commaT :: CharParser st Token
commaT :: CharParser st Token
commaT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok ','

dotT :: CharParser st Token
dotT :: CharParser st Token
dotT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '.'

colonT :: CharParser st Token
colonT :: CharParser st Token
colonT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok ':'

{- -----------------------------------------------------------------------------
Some lexer functions
----------------------------------------------------------------------------- -}
skip :: CharParser st ()
skip :: CharParser st ()
skip = CharParser st () -> CharParser st ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m ()
skipMany (CharParser st () -> CharParser st ())
-> CharParser st () -> CharParser st ()
forall a b. (a -> b) -> a -> b
$ ParsecT String st Identity Char -> CharParser st ()
forall (m :: * -> *) a. Monad m => m a -> m ()
forget ((Char -> Bool) -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
(Char -> Bool) -> ParsecT s u m Char
satisfy Char -> Bool
isSpace)

pToken :: CharParser st String -> CharParser st Token
pToken :: CharParser st String -> CharParser st Token
pToken p :: CharParser st String
p = CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
Lexer.pToken CharParser st String
p CharParser st Token
-> ParsecT String st Identity () -> CharParser st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity ()
forall st. CharParser st ()
skip

oBracketT :: CharParser st Token
oBracketT :: CharParser st Token
oBracketT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '['

cBracketT :: CharParser st Token
cBracketT :: CharParser st Token
cBracketT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok ']'

brackets :: CharParser st a -> CharParser st a
brackets :: CharParser st a -> CharParser st a
brackets p :: CharParser st a
p = CharParser st Token
forall st. CharParser st Token
oBracketT CharParser st Token -> CharParser st a -> CharParser st a
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> CharParser st a
p CharParser st a -> CharParser st Token -> CharParser st a
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< CharParser st Token
forall st. CharParser st Token
cBracketT

oParenT :: CharParser st Token
oParenT :: CharParser st Token
oParenT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok '('

cParenT :: CharParser st Token
cParenT :: CharParser st Token
cParenT = Char -> CharParser st Token
forall st. Char -> CharParser st Token
charTok ')'

parens :: CharParser st a -> CharParser st a
parens :: CharParser st a -> CharParser st a
parens p :: CharParser st a
p = CharParser st Token
forall st. CharParser st Token
oParenT CharParser st Token -> CharParser st a -> CharParser st a
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> CharParser st a
p CharParser st a -> CharParser st Token -> CharParser st a
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< CharParser st Token
forall st. CharParser st Token
cParenT

{- -----------------------------------------------------------------------------
Some helper functions
----------------------------------------------------------------------------- -}

strTok :: String -> CharParser st Token
strTok :: String -> CharParser st Token
strTok s :: String
s = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace ("strTok " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
forall a. Show a => a -> String
show String
s) (CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
pToken (CharParser st String -> CharParser st Token)
-> CharParser st String -> CharParser st Token
forall a b. (a -> b) -> a -> b
$ String -> CharParser st String
forall st. String -> CharParser st String
tryString String
s
  )

charTok :: Char -> CharParser st Token
charTok :: Char -> CharParser st Token
charTok c :: Char
c = String -> CharParser st Token -> CharParser st Token
forall st a. String -> CharParser st a -> CharParser st a
parserTrace ("charTok " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Char -> String
forall a. Show a => a -> String
show Char
c) (CharParser st String -> CharParser st Token
forall st. CharParser st String -> CharParser st Token
pToken (CharParser st String -> CharParser st Token)
-> CharParser st String -> CharParser st Token
forall a b. (a -> b) -> a -> b
$ ParsecT String st Identity Char -> CharParser st String
forall (m :: * -> *) a. Monad m => m a -> m [a]
single (ParsecT String st Identity Char -> CharParser st String)
-> ParsecT String st Identity Char -> CharParser st String
forall a b. (a -> b) -> a -> b
$ Char -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char Char
c
  )

constantsChoice :: [(String, a)] -> CharParser st a
constantsChoice :: [(String, a)] -> CharParser st a
constantsChoice choices :: [(String, a)]
choices = [CharParser st a] -> CharParser st a
forall s (m :: * -> *) t u a.
Stream s m t =>
[ParsecT s u m a] -> ParsecT s u m a
choice ([CharParser st a] -> CharParser st a)
-> [CharParser st a] -> CharParser st a
forall a b. (a -> b) -> a -> b
$ ((String, a) -> CharParser st a)
-> [(String, a)] -> [CharParser st a]
forall a b. (a -> b) -> [a] -> [b]
map (String, a) -> CharParser st a
forall a st. (String, a) -> CharParser st a
constantMapping [(String, a)]
choices

constantMapping :: (String, a) -> CharParser st a
constantMapping :: (String, a) -> CharParser st a
constantMapping (s :: String
s, c :: a
c) = String -> CharParser st Token
forall st. String -> CharParser st Token
strTok String
s CharParser st Token -> CharParser st a -> CharParser st a
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> a -> CharParser st a
forall (m :: * -> *) a. Monad m => a -> m a
return a
c

emptyBrackets :: CharParser st [a]
emptyBrackets :: CharParser st [a]
emptyBrackets = CharParser st [a] -> CharParser st [a]
forall tok st a. GenParser tok st a -> GenParser tok st a
try (CharParser st Token
forall st. CharParser st Token
oBracketT CharParser st Token -> CharParser st [a] -> CharParser st [a]
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [a] -> CharParser st [a]
forall (m :: * -> *) a. Monad m => a -> m a
return [] CharParser st [a] -> CharParser st Token -> CharParser st [a]
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< CharParser st Token
forall st. CharParser st Token
cBracketT)

sepByComma1 :: CharParser st a -> CharParser st [a]
sepByComma1 :: CharParser st a -> CharParser st [a]
sepByComma1 p :: CharParser st a
p = CharParser st a
p CharParser st a
-> ParsecT String st Identity Token -> CharParser st [a]
forall s (m :: * -> *) t u a sep.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
`sepBy1` String -> ParsecT String st Identity Token
forall st. String -> CharParser st Token
strTok ","

-- Looks ahead without consuming input. Fails if @notToFind@ follows.
-- Is only used to optimize performance.
-- Apply it only to very short @notToFind@.
parseIfNot :: Show a => CharParser st a -> CharParser st b -> CharParser st b
parseIfNot :: CharParser st a -> CharParser st b -> CharParser st b
parseIfNot notToFind :: CharParser st a
notToFind p :: CharParser st b
p = ParsecT String st Identity () -> ParsecT String st Identity ()
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m a
lookAhead (CharParser st a -> ParsecT String st Identity ()
forall s (m :: * -> *) t a u.
(Stream s m t, Show a) =>
ParsecT s u m a -> ParsecT s u m ()
notFollowedBy (CharParser st a -> ParsecT String st Identity ())
-> CharParser st a -> ParsecT String st Identity ()
forall a b. (a -> b) -> a -> b
$ CharParser st a -> CharParser st a
forall tok st a. GenParser tok st a -> GenParser tok st a
try CharParser st a
notToFind) ParsecT String st Identity () -> CharParser st b -> CharParser st b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> CharParser st b
p

skipAll :: CharParser st ()
skipAll :: CharParser st ()
skipAll = CharParser st () -> CharParser st ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m ()
skipMany (ParsecT String st Identity Char -> CharParser st ()
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m ()
skipMany1 ParsecT String st Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
space CharParser st () -> CharParser st () -> CharParser st ()
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
                    CharParser st () -> CharParser st ()
forall (m :: * -> *) a. Monad m => m a -> m ()
forget ((CharParser st Comment
forall st. CharParser st Comment
comment CharParser st Comment -> CharParser st () -> CharParser st ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> () -> CharParser st ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()) CharParser st () -> CharParser st () -> CharParser st ()
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
                            (CharParser st DefinedComment
forall st. CharParser st DefinedComment
defined_comment CharParser st DefinedComment
-> CharParser st () -> CharParser st ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> () -> CharParser st ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()) CharParser st () -> CharParser st () -> CharParser st ()
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
                            (CharParser st SystemComment
forall st. CharParser st SystemComment
system_comment CharParser st SystemComment -> CharParser st () -> CharParser st ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> () -> CharParser st ()
forall (m :: * -> *) a. Monad m => a -> m a
return ())))

key :: CharParser st a -> CharParser st ()
key :: CharParser st a -> CharParser st ()
key = (CharParser st a -> CharParser st () -> CharParser st ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> CharParser st ()
forall st. CharParser st ()
skipAll)

keyChar :: Char -> CharParser st ()
keyChar :: Char -> CharParser st ()
keyChar = CharParser st Char -> CharParser st ()
forall st a. CharParser st a -> CharParser st ()
key (CharParser st Char -> CharParser st ())
-> (Char -> CharParser st Char) -> Char -> CharParser st ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> CharParser st Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
char