Changeset 12763

Show
Ignore:
Timestamp:
30.10.2009 17:15:43 (3 weeks ago)
Author:
csliam
Message:

Changed how the trasitivity and identity axiom names are produced, CspCASLProver should now work better for isomorphic sorts

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/CspCASLProver/Utils.hs

    r12762 r12763  
    4141import qualified Common.Lib.Rel as Rel 
    4242 
    43 import Comorphisms.CASL2PCFOL (mkEmbInjName, mkTransAxiomName) 
     43import Comorphisms.CASL2PCFOL (mkEmbInjName, mkTransAxiomName, mkIdAxiomName) 
    4444import Comorphisms.CASL2SubCFOL (mkNotDefBotAxiomName, mkTotalityAxiomName) 
    4545 
     
    185185    in   addTransitivityTheorem sorts sortRel 
    186186       $ addAllInjectivityTheorems pfolSign sorts sortRel 
    187        $ addAllDecompositionTheorem pfolSign sorts sortRel 
     187       $ addAllDecompositionTheorem caslSign pfolSign sorts sortRel 
    188188       $ addSymmetryTheorem sorts 
    189189       $ addReflexivityTheorem 
     
    228228 
    229229-- | Add all the decoposition theorems and proofs 
    230 addAllDecompositionTheorem :: CASLSign.CASLSign -> [SORT] -> [(SORT,SORT)] -> 
    231                              IsaTheory -> IsaTheory 
    232 addAllDecompositionTheorem pfolSign sorts sortRel isaTh = 
     230addAllDecompositionTheorem :: CASLSign.CASLSign -> CASLSign.CASLSign 
     231                           -> [SORT] -> [(SORT,SORT)] 
     232                           -> IsaTheory -> IsaTheory 
     233addAllDecompositionTheorem caslSign pfolSign sorts sortRel isaTh = 
    233234    let tripples = [(s1,s2,s3) | 
    234235                    (s1,s2) <- sortRel, (s2',s3) <- sortRel, s2==s2'] 
    235     in foldl (addDecompositionTheorem pfolSign sorts sortRel) isaTh tripples 
     236    in foldl (addDecompositionTheorem caslSign pfolSign sorts) 
     237       isaTh tripples 
    236238 
    237239-- | Add the decomposition theorem and proof which should be deduced 
     
    241243--   inj_T_U(inj_S_T(x)) = inj_S_U(x). As a work around, we need to 
    242244--   know all sorts to pass them on. 
    243 addDecompositionTheorem :: CASLSign.CASLSign -> [SORT] -> [(SORT,SORT)] -> 
    244                          IsaTheory -> (SORT,SORT,SORT) -> IsaTheory 
    245 addDecompositionTheorem pfolSign sorts sortRel isaTh (s1,s2,s3) = 
     245addDecompositionTheorem :: CASLSign.CASLSign -> CASLSign.CASLSign -> [SORT] 
     246                        -> IsaTheory -> (SORT,SORT,SORT) 
     247                        -> IsaTheory 
     248addDecompositionTheorem caslSign pfolSign sorts isaTh (s1,s2,s3) = 
    246249    let x = mkFree "x" 
    247250        -- These 5 lines make use of currying 
     
    254257        definedOp_s1 = getDefinedOp sorts s1 
    255258        definedOp_s3 = getDefinedOp sorts s3 
    256         collectionTransAx = getCollectionTransAx sortRel 
     259        collectionIdentityAx = getCollectionIdentityAx caslSign 
     260        collectionTransAx = getCollectionTransAx caslSign 
    257261        collectionTotAx = getCollectionTotAx pfolSign 
    258262        collectionNotDefBotAx = getCollectionNotDefBotAx sorts 
     
    265269                           -- Case 1 
    266270                           Apply[SubgoalTac(definedOp_s1 x)] False, 
    267                            Apply[Insert collectionTransAx] False, 
     271                           Apply[Insert (collectionIdentityAx 
     272                                         ++ collectionTransAx)] False, 
    268273                           Apply[Simp] False, 
    269274                           Apply[SimpAdd Nothing collectionTotAx] False, 
     
    845850-- | Return the list of strings of all the transitivity axioms names produced by 
    846851--   the translation CASL2PCFOL; CASL2SubCFOL. 
    847 getCollectionTransAx :: [(SORT,SORT)] -> [String] 
    848 getCollectionTransAx sortRel = 
    849     [mkTransAxiomName s1 s2 s3 
    850          | (s1,s2) <- sortRel, (s2',s3) <- sortRel, s2==s2'] 
     852getCollectionTransAx :: CASLSign.CASLSign -> [String] 
     853getCollectionTransAx caslSign = 
     854    let sorts = Set.toList $ CASLSign.sortSet caslSign 
     855        allSupers s s' s'' = 
     856            (Set.member s' $ CASLSign.supersortsOf s caslSign) && 
     857            (Set.member s'' $ CASLSign.supersortsOf s' caslSign) && (s /= s'') 
     858    in [mkTransAxiomName s s' s'' 
     859            | s <- sorts, s' <- sorts, s'' <- sorts, allSupers s s' s''] 
     860 
     861-- | Return the list of strings of all the identity axioms names produced by 
     862--   the translation CASL2PCFOL; CASL2SubCFOL. 
     863getCollectionIdentityAx :: CASLSign.CASLSign -> [String] 
     864getCollectionIdentityAx caslSign = 
     865    let sorts = Set.toList $ CASLSign.sortSet caslSign 
     866        isomorphic s s' = (Set.member s $ CASLSign.supersortsOf s' caslSign) && 
     867                          (Set.member s' $ CASLSign.supersortsOf s caslSign) 
     868    in [mkIdAxiomName s s' | s <- sorts, s' <- sorts, isomorphic s s']