Prop2CNF.hs revision b87efd3db0d2dc41615ea28669faf80fc1b48d56
0N/APortability : non-portable (imports Logic.Logic)
0N/Amodule Propositional.Prop2CNF
0N/Aimport Common.UniUtils as CP
0N/Aimport qualified Comorphisms.SuleCFOL2SoftFOL as C2S
0N/Aimport qualified Logic.Coerce as LC
0N/Aimport qualified Logic.Comorphism as Com
0N/Aimport qualified Propositional.AS_BASIC_Propositional as PBasic
0N/Aimport qualified Propositional.Prop2CASLHelpers as P2C
0N/Aimport qualified Propositional.Sign as PSign
import qualified SoftFOL.Conversions as Conv
import qualified SoftFOL.DFGParser as SParse
import qualified SoftFOL.ProverState as PState
import qualified SoftFOL.Sign as Sig
import qualified SoftFOL.Translate as Translate
import qualified CASL.Logic_CASL as CLogic
import Common.DocUtils
import qualified Common.AS_Annotation as AS_Anno
import qualified Common.Id as Id
import qualified Common.Result as Result
import Control.Monad (when)
import qualified Control.Exception as Exception
import qualified Data.Set as Set
import Data.List
import Data.Maybe
ti2 <- P2C.mapTheory ti1
{ AS_Anno.isAxiom = True
, AS_Anno.isDef = False
, AS_Anno.wasTheorem = False }
createInitProverState :: PSign.Sign
case Result.maybeResult $ getTheory (sign, dementia nForms) of
PState.spassProverState osig oth []
runSpass :: PState.SoftFOLProverState -- Spass Prover state... Theory + Sig
spass <- newChildProcess "SPASS" [CP.arguments filteredOptions]
when saveDFG $ writeFile "FlotterIn.dfg" prob
when saveDFG $ writeFile "FlotterOut.dfg" flotterOut
Exception.catch runSpassReal $ \ excep -> do
++ show (excep :: Exception.SomeException)
-> PState.SoftFOLProverState {- ^ prover state containing
PState.parseSPASSCommands opts }
:: PState.SoftFOLProverState -- ^ Spass Prover state: Theory + Sig
-> IO Sig.SPProblem -- ^ Output AS
parseDFG :: String -> Sig.SPProblem
parseDFG input = case parse SParse.parseSPASS "" input of
trName = AS_Anno.senAttr yv
trNm = Translate.transSenName
f : _ = filter ((== trName) . trNm . AS_Anno.senAttr) xs
joinClause :: Sig.SPClauseType
joinClauseHelper :: Sig.SPClauseType
-> Set.Set String
if Set.null inSet then [] else let
(inName, newSet) = Set.deleteFindMin inSet
nakedForms = map AS_Anno.sentence clauses
Sig.SPClauseRelation cls -> cls
thisNames = map Sig.clauseSPR
$ filter ((== name) . Sig.formulaSPR) clrel
Sig.SPClauseRelation cls -> cls
translateSPClause :: Sig.SPClauseType -- Clause Type is needed
-> Sig.SPClause
cla' <- case AS_Anno.sentence nspc of
Sig.SimpleClause sc -> return sc
Sig.QuanClause _ sc -> return sc
s1 <- mapM Sig.toLiteral l1
s2 <- mapM Sig.toLiteral l2
return nspc { AS_Anno.sentence = transL }
translateLiteral (Sig.SPLiteral b l) =
Sig.NSPClauseBody ct2 lits | ct == ct2 ->
(map translateLiteral lits) Id.nullRange
clauseType = Sig.clauseType clist
clauses = Sig.clauses clist
nclauses = map Result.maybeResult tclauses
("Cannot translate clause list" ++ show clist) Id.nullRange
outForm = map Result.maybeResult outLists
map translateSymbol $ Sig.predicates inList
translateProblem spProb = case Sig.settings spProb of
Sig.SPSettings _ (sb : _) : _ ->
translateLogicalPart (Sig.logicalPart spProb) sb