ModalCaslToCtl.hs revision b87efd3db0d2dc41615ea28669faf80fc1b48d56
{- |
Module : $EmptyHeader$
Description : <optional short description entry>
Copyright : (c) <Authors or Affiliations>
License : GPLv2 or higher
Maintainer : <email>
Stability : unstable | experimental | provisional | stable | frozen
Portability : portable | non-portable (<reason>)
<optional description>
-}
{-# OPTIONS -fglasgow-exts #-}
module ModalCaslToCtl where
import Control.Monad as Monad
import Data.Maybe as Maybe
import ModalCasl as Casl
import Ctl as Ctl
{------------------------------------------------------------------------------}
{- -}
{- Convert Modal CASL formulas to CTL formulas -}
{- -}
{------------------------------------------------------------------------------}
convert :: Casl.StateFormula a -> Maybe (Ctl.Formula a)
convert (Casl.A (Casl.W phi psi)) = convert (Casl.A ((phi `Casl.Pand` psi) `Casl.B` ((Casl.Pnot phi) `Casl.Pand` psi)))
convert (Casl.E (Casl.W phi psi)) = convert (Casl.E ((phi `Casl.Pand` psi) `Casl.B` ((Casl.Pnot phi) `Casl.Pand` psi)))
convert (Casl.A (Casl.U phi psi)) = convert (Casl.A (psi `Casl.Pand` ((Casl.Pnot phi) `Casl.Pand` (Casl.Pnot psi))))
convert (Casl.E (Casl.U phi psi)) = convert (Casl.E (psi `Casl.Pand` ((Casl.Pnot phi) `Casl.Pand` (Casl.Pnot psi))))
convert (Casl.A (Casl.W' phi psi)) = convert (Casl.A ((Casl.Pnot phi) `Casl.U'` (Casl.Pand phi psi)))
convert (Casl.E (Casl.W' phi psi)) = convert (Casl.E ((Casl.Pnot phi) `Casl.U'` (Casl.Pand phi psi)))
convert (Casl.A (Casl.B' phi psi)) = convert (Casl.A ((Casl.Pnot phi) `Casl.U'` (Casl.Pand phi (Casl.Pnot psi))))
convert (Casl.E (Casl.B' phi psi)) = convert (Casl.E ((Casl.Pnot phi) `Casl.U'` (Casl.Pand phi (Casl.Pnot psi))))
convert _ = Nothing
convert' :: Casl.PathFormula a -> Maybe (Ctl.Formula a)
convert' (State phi) = convert phi
convert' _ = Nothing
{------------------------------------------------------------------------------}