modelSparQCheck :: HetcatsOpts -> G_theory -> IO ()
modelSparQCheck opts gTh@(G_theory lid _ (ExtSign sign0 _) _ sens0 _) =
    case coerceBasicTheory lid CASL "" (sign0, toNamedList sens0) of
    Just th2 -> do
      table <- parseSparQTableFromFile $ modelSparQ opts
      case table of
        Left err -> putIfVerbose opts 0
          $ "could not parse SparQTable from file: " ++ modelSparQ opts
          ++ "\n" ++ show err
        Right y -> do
            putIfVerbose opts 4 $ unlines
               ["lisp file content:", show $ table2Doc y, "lisp file end."]
            let Result d _ = modelCheck (counterSparQ opts) th2 y
            if null d then
                putIfVerbose opts 0 "Modelcheck succeeded, no errors found"
             else showDiags
               (if verbose opts >= 2 then opts else opts {verbose = 2}) d
    _ ->
      putIfVerbose opts 0 $ "could not translate Theory to CASL:\n "
         ++ showDoc gTh ""
modelSparQCheck :: HetcatsOpts -> G_theory -> IO ()
modelSparQCheck opts gTh@(G_theory lid _ (ExtSign sign0 _) _ sens0 _) =
    case coerceBasicTheory lid CASL "" (sign0, toNamedList sens0) of
    Just th2 -> do
      table <- parseSparQTableFromFile $ modelSparQ opts
      case table of
        Left err -> putIfVerbose opts 0
          $ "could not parse SparQTable from file: " ++ modelSparQ opts
          ++ "\n" ++ show err
        Right y -> do
            putIfVerbose opts 4 $ unlines
               ["lisp file content:", show $ table2Doc y, "lisp file end."]
            let Result d _ = modelCheck (counterSparQ opts) th2 y
            if null d then
                putIfVerbose opts 0 "Modelcheck succeeded, no errors found"
             else showDiags
               (if verbose opts >= 2 then opts else opts {verbose = 2}) d
    _ ->
      putIfVerbose opts 0 $ "could not translate Theory to CASL:\n "
         ++ showDoc gTh ""
modelSparQCheck opts gTh@(G_theory lid _ (ExtSign sign0 _) _ sens0 _) =
    case coerceBasicTheory lid CASL "" (sign0, toNamedList sens0) of
    Just th2 -> do
      table <- parseSparQTableFromFile $ modelSparQ opts
      case table of
        Left err -> putIfVerbose opts 0
          $ "could not parse SparQTable from file: " ++ modelSparQ opts
          ++ "\n" ++ show err
        Right y -> do
            putIfVerbose opts 4 $ unlines
               ["lisp file content:", show $ table2Doc y, "lisp file end."]
            let Result d _ = modelCheck (counterSparQ opts) th2 y
            if null d then
                putIfVerbose opts 0 "Modelcheck succeeded, no errors found"
             else showDiags
               (if verbose opts >= 2 then opts else opts {verbose = 2}) d
    _ ->
      putIfVerbose opts 0 $ "could not translate Theory to CASL:\n "
         ++ showDoc gTh ""