Sublogic.hs revision 8394b397aadaf0c2bfc19c0628f17f83f031a759
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke{-# LANGUAGE MultiParamTypeClasses #-}
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian MaederModule : $Header$
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeDescription : Sublogics for THF
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu ProdescuCopyright : (c) Jonathan von Schroeder, DFKI Bremen 2012
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeLicense : GPLv2 or higher, see LICENSE.txt
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeMaintainer : Jonathan von Schroeder <j.von_schroeder@dfki.de>
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeStability : experimental
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkePortability : non-portable (via Logic.Logic)
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian MaederSublogics for THF
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeimport Logic.Logic hiding (join)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkedata THFCoreSl = THF | THFP | THF0 deriving (Ord,Show,Eq)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkedata THFSl = THFSl {
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke core :: THFCoreSl,
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder ext_ShortTypes :: Bool } deriving (Ord,Eq)
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian MaederThe ShortTypes extension allows for unnamed unique types:
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder %With ShortTypes
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder thf(a_type,type,a : ($tType,$tType))
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder thf(b_type,type,b : $tType > a)
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder thf(test_const_type,type, test : b)
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder %Without ShortTypes
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder thf(a1_type,type,a1 : $tType)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke thf(a2_type,type,a2 : $tType)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke thf(b1_type,type,b1 : $tType)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke thf(test_const_type,type, test : b1 > (a1,a2))
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeNote: Types made of other, non-atomic types are not allowed i.e. the following
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeis still not a legal type-definition:
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke thf(a_type,type, a: $tType > $tType)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke thf(b_type,type, b: a > $tType)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeWithout this extension $tType may only be used to declare
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke thf(a_type,type, a : $tType)
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederinstance Show THFSl where
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke show sl = (show $ core sl) ++
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke (if ext_ShortTypes sl
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke then "_ST" else "")
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian MaederjoinCoreSl :: THFCoreSl -> THFCoreSl -> THFCoreSl
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkejoinCoreSl THF _ = THF
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian MaederjoinCoreSl _ THF = THF
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkejoinCoreSl THFP _ = THFP
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkejoinCoreSl _ THFP = THFP
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkejoinCoreSl _ _ = THF0
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederjoin :: THFSl -> THFSl -> THFSl
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkejoin sl1 sl2 = THFSl {
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke core = joinCoreSl (core sl1) (core sl2),
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke ext_ShortTypes = (ext_ShortTypes sl1) ||
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder (ext_ShortTypes sl2) }
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartketHF0,tHFP,tHF :: THFSl
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartketHF0 = THFSl { core = THF0, ext_ShortTypes = False }
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartketHFP = THFSl { core = THFP, ext_ShortTypes = False }
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartketHF = THFSl { core = THF , ext_ShortTypes = False }
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartketHF0_ST,tHFP_ST,tHF_ST :: THFSl
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartketHF0_ST = tHF0 { ext_ShortTypes = True }
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartketHFP_ST = tHFP { ext_ShortTypes = True }
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartketHF_ST = tHF { ext_ShortTypes = True }
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkesublogics_all :: [THFSl]
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maedersublogics_all = [tHF0, tHF0_ST,
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder tHFP, tHFP_ST,
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke tHF, tHF_ST]
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeinstance MinSublogic THFSl THFFormula where
a23e572c8f957cc051a1b0831abd6fe9380d45c7Christian Maeder minSublogic f = case f of
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder TF_THF_Logic_Formula f' -> join tHF0 $ minSublogic f'
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder TF_THF_Sequent s -> join tHF $ minSublogic s
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder T0F_THF_Typed_Const tc -> join tHF0 $ minSublogic tc -- fixme: Not in THF?
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederinstance MinSublogic THFSl THFLogicFormula where
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder minSublogic f = case f of
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke TLF_THF_Binary_Formula b -> join tHF0 $ minSublogic b
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke TLF_THF_Unitary_Formula u -> join tHF0 $ minSublogic u
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke TLF_THF_Type_Formula tf -> join tHF $ minSublogic tf
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke TLF_THF_Sub_Type st -> join tHF $ minSublogic st
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeinstance MinSublogic THFSl THFSequent where
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke minSublogic _ = tHF
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederinstance MinSublogic THFSl THFTypedConst where
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder minSublogic c = case c of
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder T0TC_Typed_Const _ tp -> minSublogic tp
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder T0TC_THF_TypedConst_Par tp -> minSublogic tp
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeinstance MinSublogic THFSl THFBinaryFormula where
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke minSublogic b = case b of
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke TBF_THF_Binary_Pair f1 c f2 -> join tHF0 (join (minSublogic f1)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke (join (minSublogic c) (minSublogic f2)))
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder TBF_THF_Binary_Tuple bt -> join tHF0 $ minSublogic bt
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke TBF_THF_Binary_Type bt -> join tHF $ minSublogic bt
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeinstance MinSublogic THFSl THFUnitaryFormula where
-- TQF_THF_Quantified_Formula in THF (cf. As.hs 190 ff.)