include "sequence_aux.csp"
include "function_aux.csp"
include "auxiliar.csp"
include "rules.csp"
datatype Direction = req | ack
Value = {0..3}
CellId = {0..3}
channel rd : Direction.Value
channel wrt : Direction.Value
channel write : CellId.Direction.Value
channel read : CellId.Direction.Value
channel input : Value
channel output : Value
channel wrt_i : CellId.Direction.Value
channel rd_i : CellId.Direction.Value
Cell =
let CellState(val) =
rd.req?dumb -> rd.ack!val -> CellState(val) [] wrt.req?x -> wrt.ack.x -> CellState(x)
within
CellState(0)
RenameContract(i) = Cell [[rd <- rd_i.3,wrt <- wrt_i.3]]
Inst_Cell3 = <(rd,rd_i.3),(wrt,wrt_i.3)>
Cell3 = rename(Cell, Inst_Cell3)
GET_CHANNELS(P) =
let f =
<
(Cell3, {
rd_i.3,wrt_i.3 })
>
within apply(f,P )
inputs(P) =
let f =
<
( Cell3, {| rd_i.3.req, wrt_i.3.req |})
>
within apply(f, P )
outputs(P) =
let f =
<
( Cell3, {| rd_i.3.ack, wrt_i.3.ack |})
>
within apply(f,P)
--Condition A.1: Alphabets are disjont
--assert STOP [T= RUN(inter(events(Cell3),events(Cell3)))
--Condition A.2: I/O Process
--Condition A.2.1: Every channel in P is an I/O Channel
assert not Test(inter(inputs(Cell3),outputs(Cell3)) == {}) [T= ERROR
--Condition A.2.2: The contract has infinite set of traces
assert not HideAll(Cell3):[divergence free [FD]]
--Condition A.2.3: The contract is divergence-free
assert Cell3:[divergence free [FD]]
--Condition A.2.4: The contract is input deterministic
assert LHS_InputDet(Cell3) [F= RHS_InputDet(Cell3)
--Condition A.2.5: The contract is strong output decisive
assert LHS_OutputDec_A(Cell3) [F= RHS_OutputDec_A(Cell3)
assert LHS_OutputDec_B(Cell3,rd_i.3) [F= RHS_OutputDec_B(Cell3,rd_i.3)
assert LHS_OutputDec_B(Cell3,wrt_i.3) [F= RHS_OutputDec_B(Cell3,wrt_i.3)