| 162 | | -- | Given a node it returns the information that needs to |
| 163 | | -- be printed as a string |
| 164 | | showNodeInfo::CmdlState -> LNode DGNodeLab -> String |
| 165 | | showNodeInfo state (nb,nd) = |
| 166 | | let |
| 167 | | -- node name |
| 168 | | name'= "dgn_name : " ++ showName (dgn_name nd) ++ "\n" |
| 169 | | -- origin of the node |
| 170 | | orig'= if isDGRef nd then "dgn_orig : no origin (ref node)" |
| 171 | | else "dgn_orig : " ++ dgOriginHeader (dgn_origin nd) ++ "\n" |
| 172 | | -- conservativity annotations |
| 173 | | th = getTh Do_translate nb state |
| 174 | | in |
| 175 | | case th of |
| 176 | | Nothing ->name' ++ orig'++"Theory could not be evaluated\n" |
| 177 | | Just t@(G_theory x (ExtSign y _) _ thSens _) -> |
| 178 | | let |
| 179 | | -- find out the sublogic of the theory if we found |
| 180 | | -- a theory |
| 181 | | sublog = " sublogic: "++ show |
| 182 | | (sublogicOfTh t) ++ "\n" |
| 183 | | -- compute the number of axioms by counting the |
| 184 | | -- number of symbols of the signature !? |
| 185 | | nbAxm = " number of axioms: "++ show (OMap.size $ |
| 186 | | OMap.filter isAxiom thSens) ++"\n" |
| 187 | | -- compute the number of symbols as the number of |
| 188 | | -- sentences that are axioms in the senstatus of the |
| 189 | | -- theory |
| 190 | | nbSym = " number of symbols: "++ show (Set.size $ sym_of x y) ++ "\n" |
| 191 | | -- compute the number of proven theorems as the |
| 192 | | -- number of sentences that have no theorem status |
| 193 | | -- left |
| 194 | | nbThm = let n'=OMap.size $ OMap.filter (\s -> not (isAxiom s) |
| 195 | | && isProvenSenStatus s) thSens |
| 196 | | in " number of proven theorems: " ++ show n' ++ "\n" |
| 197 | | -- compute the number of unproven theorems as the |
| 198 | | -- sentences that have something in their theorem |
| 199 | | -- status |
| 200 | | nbUThm = let n'= OMap.size $ OMap.filter(\s -> not (isAxiom s) |
| 201 | | && not (isProvenSenStatus s)) thSens |
| 202 | | in " number of unproven theorems: " ++ show n' ++ "\n" |
| 203 | | -- compute the final theory (i.e.just add partial |
| 204 | | -- results obtained before (sublogic, nbAxm..) |
| 205 | | th' = "dgl_theory:\n"++ sublog ++ nbAxm ++ nbSym ++ nbThm ++ nbUThm |
| 206 | | in name' ++ orig' ++ th' |
| 207 | | |
| 208 | | |
| 209 | | -- | Given an edge it returns the information that needs to |
| 210 | | -- be printed as a string |
| 211 | | showEdgeInfo::CmdlState -> LEdge DGLinkLab -> String |
| 212 | | showEdgeInfo state (x, y, dglab) |
| 213 | | = case i_state $ intState state of |
| 214 | | Nothing -> "" |
| 215 | | Just dgS -> |
| 216 | | let |
| 217 | | ls = getAllNodes dgS |
| 218 | | nameOf x' l = case find ((== x') . fst) l of |
| 219 | | Nothing -> "Unknown node" |
| 220 | | Just (_, n) -> showName $ dgn_name n |
| 221 | | nm = "dgl_name: "++ nameOf x ls ++ " -> " ++ |
| 222 | | nameOf y ls |
| 223 | | orig = "dgl_origin: " ++ dgLinkOriginHeader (dgl_origin dglab) |
| 224 | | defS = "definition" |
| 225 | | mkDefS = (++ ' ':defS) |
| 226 | | ltype= "dgl_type: " ++ |
| 227 | | case edgeTypeModInc $ getRealDGLinkType dglab of |
| 228 | | GlobalDef -> mkDefS "global" |
| 229 | | HetDef -> mkDefS "het" |
| 230 | | HidingDef -> mkDefS "hiding" |
| 231 | | LocalDef -> mkDefS "local" |
| 232 | | FreeOrCofreeDef -> defS |
| 233 | | ThmType thm isPrvn _ _ -> |
| 234 | | let prvn = (if isPrvn then "" else "un") ++ "proven" |
| 235 | | thmS = "theorem" |
| 236 | | in case thm of |
| 237 | | HidingThm -> unwords [prvn, "hiding", thmS] |
| 238 | | FreeOrCofreeThm -> unwords [prvn, thmS] |
| 239 | | GlobalOrLocalThm scope isHom -> |
| 240 | | let het = if isHom then [] else ["het"] |
| 241 | | sc = case scope of |
| 242 | | Local -> "local" |
| 243 | | Global -> "global" |
| 244 | | in unwords $ het ++ [sc, prvn, thmS] |
| 245 | | in unlines [nm, orig, ltype] |
| | 159 | showNodeInfo :: LNode DGNodeLab -> String |
| | 160 | showNodeInfo (i, l) = |
| | 161 | (if isDGRef l |
| | 162 | then ("reference " ++) |
| | 163 | else if isInternalNode l then ("internal " ++) else id) |
| | 164 | "node " ++ getDGNodeName l ++ " " ++ show i ++ "\n" ++ showDoc l "" |
| | 165 | |
| | 166 | showEdgeInfo :: LEdge DGLinkLab -> String |
| | 167 | showEdgeInfo e@(_, _, l) = showLEdge e ++ "\n" ++ showDoc l "" |