TransProcesses.hs revision 98890889ffb2e8f6f722b00e265a211f13b5a861
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkModule : $Header$
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkDescription : Provides transformations from Csp Processes to Isabelle terms
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkCopyright : (c) Liam O'Reilly and Markus Roggenbach,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk Swansea University 2008
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkLicense : GPLv2 or higher, see LICENSE.txt
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkMaintainer : csliam@swansea.ac.uk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkStability : provisional
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkPortability : portable
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkProvides translations from Csp Processes to Isabelle terms
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ( transProcess
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk , VarSource (..)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport qualified CASL.AS_Basic_CASL as CASL_AS_Basic_CASL
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport CASL.Fold as CASL_Fold
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport qualified CASL.Sign as CASL_Sign
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport qualified CASL.Simplify as CASL_Simplify
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport Common.Id (tokStr)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport qualified Comorphisms.CASL2PCFOL as CASL2PCFOL
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport qualified Comorphisms.CASL2SubCFOL as CASL2SubCFOL
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport qualified Comorphisms.CFOL2IsabelleHOL as CFOL2IsabelleHOL
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport CspCASL.SignCSP (CspCASLSign, CspSign (..),
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ccSig2CASLSign, ccSig2CspSign, ProcProfile (..))
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport qualified Data.Set as Set
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport qualified Data.Map as Map
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk-- | The origin of a variable
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkdata VarSource
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk -- | indicates that the variable originated from a prefix choice operator.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk = PrefixChoice
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk -- | indicates that the variable originated from a channel nondeterministic
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk -- send or channel receive where the sort is the declared sort of the
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk -- | indicates that the variable originated from global parameter to the
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk | GlobalParameter
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk-- | The target of the sort translation
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkdata SortTarget
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk -- | Indicates the translated sort will be used as a normal communication
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk -- e.g., as a prefix choice or event set.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk = NormalComm
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk -- | Indicates that the sort will be used as a communication set with a
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk -- channel of certain declared sort.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk-- | The taraget of the term translation
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkdata TermTarget
| ChanSendOrParam CASL_AS_Basic_CASL.SORT
transProcess :: CspCASLSign -> CASL_Sign.Sign () () ->
CASL_Sign.Sign () () -> VSM -> PROCESS -> Term
paramSortList = case Map.lookup procName procMap of
Nothing -> error "CspCASLProver.TransProcesses.transProcess: Process name not found in process map."
-- Just forget the fully qualified data i.e. the constituent
error $ "CspCASLProver.TransProcesses.transEventSet: "
transEvent :: CspCASLSign -> CASL_Sign.Sign () () ->
CASL_Sign.Sign () () -> VSM ->
(Map.insert v PrefixChoice vsm) p)
(Map.insert v PrefixChoice vsm) p)
Nothing -> error "CspCASLProver.TransProcesses.transEvent: Missing fully qualified channel data"
Nothing -> error "CspCASLProver.TransProcesses.transEvent: Missing fully qualified channel data"
let declaredChanSort = case Map.lookup chanName chanMap of
Nothing -> error "CspCASLProver.TransProcesses.transEvent: Channel name not in channel map"
(transProcess' (Map.insert var
Nothing -> error "CspCASLProver.TransProcesses.transEvent: Missing fully qualified channel data"
let declaredChanSort = case Map.lookup chanName chanMap of
Nothing -> error "CspCASLProver.TransProcesses.transEvent: Channel name not in channel map"
(transProcess' (Map.insert var
error $ "CspCASLProver.TransProcesses.transEvent: "
_ -> error $ "CspCASLProver.TransProcesses.transEvent: "
transVar :: CASL_AS_Basic_CASL.VAR -> Term
transSort :: SortTarget -> CASL_AS_Basic_CASL.SORT -> Term
-- Isabelle Terms. This record is the same as the CFOL2IsabelleHOL.transRecord
-- of basic types i.e., can be used as parameters for function in the data
Set.Set String -> VSM -> Record f Term Term
(CFOL2IsabelleHOL.transRecord caslSign tyToks trForm strs)
let v' = mkFree $ CFOL2IsabelleHOL.transVar strs v
in case (Map.lookup v vsm) of
error $ "CspCASLProver.TransProcesses.cspCaslTransRecord: Variable not found in vsm:" ++ show v
CASL_Sign.Sign () () -> VSM -> TermTarget ->
CASL_AS_Basic_CASL.TERM () -> Term
let strs = CFOL2IsabelleHOL.getAssumpsToks caslSign
CASL_AS_Basic_CASL.Qual_var v s _ ->
let v' = mkFree $ CFOL2IsabelleHOL.transVar strs v
case (Map.lookup v vsm) of
Nothing -> error $ "CspCASLProver.TransProcesses.transTerm: Variable not found in vsm:" ++ show v
case Map.lookup v vsm of
Nothing -> error $ "CspCASLProver.TransProcesses.transTerm: Variable not found in vsm:" ++ show v
_ -> let sort = CASL_Sign.sortOfTerm caslTerm
VSM -> CASL_AS_Basic_CASL.TERM () -> Term
rmSub = CASL2PCFOL.t2Term
-- This needs to match the translation CASL2SubCFOL.defaultCASL2SubCFOL
fbsrts = CASL2SubCFOL.botTermSorts termNoSub
rmPartial = CASL_Simplify.simplifyTerm id .
CASL2SubCFOL.codeTerm b bsrts
tyToks = CFOL2IsabelleHOL.typeToks cfolSign
trForm = CFOL2IsabelleHOL.formTrCASL
strs = CFOL2IsabelleHOL.getAssumpsToks cfolSign
-- CFOL2IsabelleHOL.transFORMULA cfolSign tyToks trForm strs
CASL_AS_Basic_CASL.FORMULA () -> Term
rmSub = CASL2PCFOL.f2Formula
-- This needs to match the translation CASL2SubCFOL.defaultCASL2SubCFOL
fbsrts = CASL2SubCFOL.botFormulaSorts formulaNoSub
rmPartial = CASL_Simplify.simplifyFormula id .
CASL2SubCFOL.codeFormula b bsrts
tyToks = CFOL2IsabelleHOL.typeToks cfolSign
trForm = CFOL2IsabelleHOL.formTrCASL
strs = CFOL2IsabelleHOL.getAssumpsToks cfolSign
-- CFOL2IsabelleHOL.transFORMULA cfolSign tyToks trForm strs