\documentclass[10pt,a4paper]{report}
\usepackage[top=3cm, bottom=2.5cm, left=3cm, right=2.5cm] {geometry}
\usepackage {bsymb,b2latex}
\usepackage{fancyhdr,lastpage,color}
\lhead{\rm An Event-B Specification of mATM\_D}
\rhead {\rm Page \thepage~of \pageref{LastPage}}
\lfoot{}\cfoot{}\rfoot{}
\pagestyle{fancy}
%---------------------------------------------------------
\begin{document}
\thispagestyle{empty}
\begin{description}
\BTitle{mATM\_D}{4 Sep 2012}{02:39:59 PM}
\MACHINE{mATM\_D}
\SEES{Context\_mATM\_D}
\VARIABLES
	\begin{description}
		\Item{ validCard }
		\Item{ cardInAtm }
		\Item{ accBalOnAtm }
		\Item{ trans }
		\Item{ atmCashA }
		\Item{ atmDepAm }
		\Item{ recvRespDep }
	\end{description}
\INVARIANTS
	\begin{description}
		\nItemX{ typing\_atmDepAm }{ atmDepAm \in  \pow(ATM \cprod  \intg ) }
		\nItemX{ typing\_atmCashA }{ atmCashA \in  \pow(ATM \cprod  \intg ) }
		\nItemX{ typing\_cardInAtm }{ cardInAtm \in  \pow(ATM \cprod  CARD) }
		\nItemX{ typing\_trans }{ trans \in  \pow(ATM) }
		\nItemX{ typing\_accBalOnAtm }{ accBalOnAtm \in  \pow(ACCOUNT \cprod  \intg ) }
		\nItemX{ typing\_validCard }{ validCard \in  \pow(CARD) }
		\nItemX{ typing\_recvRespDep }{ recvRespDep \in  \pow(ATM) }
		\nItemX{ Deposit\_0\_IntegralATM\_0\_inv4 }{ validCard \subseteq   CARD }
		\nItemX{ Deposit\_1\_inv3 }{ cardInAtm \in  ATM \pfun  CARD }
		\nItemX{ Deposit\_2\_inv8 }{ atmDepAm \in  ATM \pfun  \nat }
		\nItemX{ Deposit\_2\_inv10 }{ atmCashA \in  ATM \tfun  \nat }
		\nItemX{ Deposit\_2\_inv11 }{ accBalOnAtm \in  ACCOUNT \pfun  \nat }
		\nItemX{ Deposit\_2\_inv12 }{ \forall c\qdot  c \in  ran(cardInAtm) \limp  c \in  validCard  }
	\end{description}
\EVENTS
	\INITIALISATION
		\begin{description}
		\BeginAct
			\begin{description}
			\nItemX{ act6 }{ validCard :=  \emptyset  }
			\nItemX{ act7 }{ cardInAtm :=  \emptyset  }
			\nItemX{ act11 }{ accBalOnAtm :=  \emptyset  }
			\nItemX{ act12 }{ trans :=   \emptyset  }
			\nItemX{ act14 }{ atmDepAm :=  \emptyset  }
			\nItemX{ act20 }{ recvRespDep :=  \emptyset  }
			\nItemX{ act21 }{ atmCashA :=  ATM \cprod  \{ 0\}  }
			\end{description}
		\EndAct
		\end{description}
	\EVT {sendReqDeposit}
		\begin{description}
		\AnyPrm
			\begin{description}
			\ItemX{ c }
			\ItemX{ am }
			\ItemX{ a }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItemX{ typing\_c }{ c \in  CARD }
			\nItemX{ typing\_am }{ am \in  \intg  }
			\nItemX{ typing\_a }{ a \in  ATM }
			\nItemX{ grd2 }{ am \in  \nat_1 }
			\nItemX{ grd3 }{ c \in  ran(cardInAtm) }
			\nItemX{ grd4 }{ a \in  dom(cardInAtm) }
			\nItemX{ grd5 }{ cardInAtm(a) = c }
			\nItemX{ grd6 }{ c \in  validCard }
			\nItemX{ grd9 }{ a \notin  trans }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ act2 }{ trans :=  trans \bunion  \{ a\}  }
			\nItemX{ act3 }{ atmDepAm(a) :=  am }
			\end{description}
		\EndAct
		\end{description}
	\EVT {recvRespDeposit}
		\begin{description}
		\AnyPrm
			\begin{description}
			\ItemX{ a }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItemX{ typing\_a }{ a \in  ATM }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ act4 }{ recvRespDep :=  recvRespDep \bunion  \{ a\}  }
			\end{description}
		\EndAct
		\end{description}
	\EVT {depositATM}
		\begin{description}
		\AnyPrm
			\begin{description}
			\ItemX{ am }
			\ItemX{ a }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItemX{ typing\_am }{ am \in  \intg  }
			\nItemX{ typing\_a }{ a \in  ATM }
			\nItemX{ grd9 }{ a \in  dom (atmDepAm) }
			\nItemX{ grd10 }{ atmDepAm(a) = am }
			\nItemX{ grd12 }{ a \in  recvRespDep }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ act2 }{ atmCashA(a) :=  atmCashA(a) + am }
			\nItemX{ act5 }{ trans :=  trans \setminus  \{ a\}  }
			\nItemX{ act6 }{ recvRespDep :=  recvRespDep \setminus  \{ a\}  }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Transfer}
		\begin{description}
		\AnyPrm
			\begin{description}
			\ItemX{ src\_ac }
			\ItemX{ dest\_ac }
			\ItemX{ am }
			\ItemX{ c }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItemX{ typing\_c }{ c \in  CARD }
			\nItemX{ typing\_am }{ am \in  \intg  }
			\nItemX{ grd1 }{ src\_ac \in  ACCOUNT }
			\nItemX{ grd2 }{ dest\_ac \in  ACCOUNT }
			\nItemX{ grd3 }{ c \in  validCard }
			\nItemX{ grd5 }{ am \in  \nat_1 }
			\nItemX{ grd8 }{ src\_ac \neq  dest\_ac }
			\end{description}
		\ThenAct
			\begin{description}
			\Item{ skip }
			\end{description}
		\EndAct
		\end{description}
\END
\end{description}
\end{document}
