Changeset 12794

Show
Ignore:
Timestamp:
06.11.2009 18:39:28 (2 weeks ago)
Author:
maeder
Message:

made CASL2TopSort more usable

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/Comorphisms/CASL2TopSort.hs

    r12793 r12794  
    1010Coding out subsorting into unary predicates. 
    1111   New concept for proving Ontologies. 
     12 
     13generatedness via non-injective datatype constructors 
     14(i.e. proper data constructors) is simply ignored 
    1215-} 
    1316 
     
    5659               Symbol RawSymbol ProofTree where 
    5760    sourceLogic CASL2TopSort = CASL 
    58     sourceSublogic CASL2TopSort = SL.top 
     61    sourceSublogic CASL2TopSort = SL.caslTop 
    5962        { sub_features = LocFilSub 
    60         , which_logic = FOL 
    61         , cons_features = SortGen 
    62             { emptyMapping = True 
    63             , onlyInjConstrs = True }} 
     63        , cons_features = emptyMapConsFeature } 
    6464    targetLogic CASL2TopSort = CASL 
    6565    mapSublogic CASL2TopSort sub = 
     
    145145 
    146146transSig :: Sign () e -> Result (Sign () e, [Named (FORMULA ())]) 
    147 transSig sig = if Rel.null sortRels then 
    148         hint (sig, []) 
    149         "CASL2TopSort.transSig: Signature is unchanged (no subsorting present)" 
    150         nullRange 
     147transSig sig = if Rel.null sortRels then return (sig, []) 
    151148    else do 
    152149    subSortMap <- generateSubSortMap sortRels (predMap sig) 
    153     let (dias2, newPredMap) = Map.mapAccum (\ ds (un, ds1) -> (ds ++ ds1, un)) 
    154           [] $ Map.unionWithKey repError (transPredMap subSortMap 
     150    let newPredMap = Map.unionWith Set.union (transPredMap subSortMap 
    155151                  $ predMap sig) $ newPreds subSortMap 
    156     Result dias2 $ Just () 
    157152    axs <- generateAxioms subSortMap (predMap sig) (opMap sig) 
    158153    return (sig 
     
    165160        }, axs ++ symmetryAxioms subSortMap sortRels) 
    166161    where sortRels = Rel.transClosure $ sortRel sig 
    167           repError k (v1, d1) (v2, d2) = 
    168               (Set.union v1 v2, 
    169                Diag Warning 
    170                      ("CASL2TopSort.transSig: generating " ++ 
    171                       "overloading: Predicate " ++ show k ++ 
    172                       " gets additional type(s): " ++ show v2) nullRange 
    173                : d1 ++ d2 ) 
    174162          newPreds = 
    175163              foldr (\ pI -> Map.insert (predicatePI pI) 
    176164                                           (Set.singleton 
    177                                             (PredType [topSortPI pI]),[])) 
     165                                            (PredType [topSortPI pI]))) 
    178166                    Map.empty . Map.elems 
    179167 
    180168transPredMap :: SubSortMap -> Map.Map PRED_NAME (Set.Set PredType) 
    181              -> Map.Map PRED_NAME (Set.Set PredType, [Diagnosis]) 
    182 transPredMap subSortMap = Map.map (\ s -> (Set.map transType s, [])) 
     169             -> Map.Map PRED_NAME (Set.Set PredType) 
     170transPredMap subSortMap = Map.map $ Set.map transType 
    183171    where transType t = t 
    184172            { predArgs = map (\ s -> maybe s topSortPI 
     
    217205symmetryAxioms ssMap sortRels = 
    218206    let symSets = Rel.sccOfClosure sortRels 
    219         toAxioms symSet = concatMap 
     207        toAxioms = concatMap 
    220208          (\ s -> 
    221209            let ts = lkupTop ssMap s 
     
    227215                   [makeNamed (show ts ++ "_symmetric_with_" ++ show symS) 
    228216                   $ mkForall [vd] (Predication psy [vt] nullRange) nullRange] 
    229           ) $ Set.toList symSet 
     217          ) . Set.toList 
    230218    in concatMap toAxioms symSets 
    231219 
     
    292280              where joinedList = opArgs ot ++ [opRes ot] 
    293281                    fKind = opKind ot 
    294                     dias' = [ Diag Warning 
    295                                         ("Please, check if operation \"" ++ 
    296                                          show opName ++ 
    297                                          "\" is still partial as intended,\ 
    298                                           \ since a joining of types could\ 
    299                                          \ have made it total!!") 
    300                                         nullRange 
     282                    dias' = [ mkDiag Hint "partial op" opName 
    301283                              | fKind == Partial ] 
    302284          pt2topSorts = map (lkupTop ssm) 
     
    385367transSen :: (Show f) => Sign f e -> FORMULA f -> Result (FORMULA f) 
    386368transSen sig f = let sortRels = Rel.transClosure $ sortRel sig in 
    387     if Rel.null sortRels then 
    388         Result [Diag Hint 
    389         "CASL2TopSort.transSen: Sentence is unchanged (no subsorting present)" 
    390         nullRange ] (Just f) 
     369    if Rel.null sortRels then return f 
    391370    else do 
    392371    ssm <- generateSubSortMap sortRels (predMap sig) 
     
    489468                        $ conjunct $ map genImpl groupedInjOps 
    490469                    _ -> error "CASL2TopSort.genEitherAxiom.groupedInjOps" 
    491                else Result [Diag Error 
    492                                   "CASL2TopSort: Cannot handle \ 
    493                                   \datatype constructors; only subsort \ 
    494                                   \embeddings are allowed with free and \ 
    495                                   \generated types!" nullRange] Nothing 
     470               else Result [mkDiag Warning 
     471                            "ignoring generating constructors" 
     472                            constrs] 
     473                    $ Just $ True_atom nullRange 
    496474          isInjOp ops = 
    497475              case ops of 
  • trunk/utils/nightly/cronjob.sh

    r12666 r12794  
    296296} 
    297297 
     298topSortCheck () 
     299{ 
     300cd $HETS_LIB 
     301date 
     302\rm Basic/*.th 
     303\rm Basic/*.thy 
     304for i in Basic/*.casl; 
     305    do ./hets -v2 -o th,thy -t CASL2PCFOLTopSort $i; done 
     306date 
     307for i in Basic/*.th; do ./hets -v2 -o th,pp.het $i; done 
     308date 
     309../Hets/utils/nightly/runisabelle.sh Basic/*.thy > ../isa3.log 2>&1 
     310fgrep \*\*\* ../isa3.log 
     311} 
     312 
    298313checkEnvs () 
    299314{