-
Notifications
You must be signed in to change notification settings - Fork 24
/
Imp.hs
36 lines (28 loc) · 1023 Bytes
/
Imp.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{-@ LIQUID "--reflection" @-}
{-@ LIQUID "--diff" @-}
{-@ LIQUID "--ple" @-}
{-@ LIQUID "--short-names" @-}
{-@ infixr ++ @-} -- TODO: Silly to have to rewrite this annotation!
{-@ infixr <~ @-} -- TODO: Silly to have to rewrite this annotation!
{-# LANGUAGE GADTs #-}
module Imp where
import Prelude hiding ((++))
import ProofCombinators
import qualified State as S
import Expressions -- hiding (And)
--------------------------------------------------------------------------------
-- | IMP Commands
--------------------------------------------------------------------------------
data Com
= Skip -- skip
| Assign Vname AExp -- x := a
| Seq Com Com -- c1; c2
| If BExp Com Com -- if b then c1 else c2
| While BExp Com -- while b c
deriving (Show)
{-@ reflect <~ @-}
(<~) :: Vname -> AExp -> Com
x <~ a = Assign x a
{-@ reflect @@ @-}
(@@) :: Com -> Com -> Com
s1 @@ s2 = Seq s1 s2