author | wenzelm |
Wed, 11 Nov 2009 14:15:11 +0100 | |
changeset 33615 | 261abc2e3155 |
parent 25131 | 2c8caac48ade |
child 35174 | e15040ae75d7 |
permissions | -rw-r--r-- |
3072
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
1 |
(* Title: HOLCF/IOA/ABP/Sender.thy |
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
2 |
ID: $Id$ |
12218 | 3 |
Author: Olaf Müller |
3072
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
4 |
*) |
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
5 |
|
17244 | 6 |
header {* The implementation: sender *} |
7 |
||
8 |
theory Sender |
|
9 |
imports IOA Action Lemmas |
|
10 |
begin |
|
3072
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
11 |
|
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
12 |
types |
17244 | 13 |
'm sender_state = "'m list * bool" -- {* messages, Alternating Bit *} |
3072
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
14 |
|
25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
15 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
16 |
sq :: "'m sender_state => 'm list" where |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
17 |
"sq = fst" |
3072
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
18 |
|
25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
19 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
20 |
sbit :: "'m sender_state => bool" where |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
21 |
"sbit = snd" |
3072
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
22 |
|
25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
23 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
24 |
sender_asig :: "'m action signature" where |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
25 |
"sender_asig = ((UN m. {S_msg(m)}) Un (UN b. {R_ack(b)}), |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
26 |
UN pkt. {S_pkt(pkt)}, |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
27 |
{})" |
3072
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
28 |
|
25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
29 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
30 |
sender_trans :: "('m action, 'm sender_state)transition set" where |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
31 |
"sender_trans = |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
32 |
{tr. let s = fst(tr); |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
33 |
t = snd(snd(tr)) |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
34 |
in case fst(snd(tr)) |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
35 |
of |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
36 |
Next => if sq(s)=[] then t=s else False | |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
37 |
S_msg(m) => sq(t)=sq(s)@[m] & |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
38 |
sbit(t)=sbit(s) | |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
39 |
R_msg(m) => False | |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
40 |
S_pkt(pkt) => sq(s) ~= [] & |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
41 |
hdr(pkt) = sbit(s) & |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
42 |
msg(pkt) = hd(sq(s)) & |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
43 |
sq(t) = sq(s) & |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
44 |
sbit(t) = sbit(s) | |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
45 |
R_pkt(pkt) => False | |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
46 |
S_ack(b) => False | |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
47 |
R_ack(b) => if b = sbit(s) then |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
48 |
sq(t)=tl(sq(s)) & sbit(t)=(~sbit(s)) else |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
49 |
sq(t)=sq(s) & sbit(t)=sbit(s)}" |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
50 |
|
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
51 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
52 |
sender_ioa :: "('m action, 'm sender_state)ioa" where |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
53 |
"sender_ioa = |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19738
diff
changeset
|
54 |
(sender_asig, {([],True)}, sender_trans,{},{})" |
3072
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
55 |
|
a31419014be5
Old ABP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
56 |
end |