author | wenzelm |
Sat, 03 Sep 2005 16:50:22 +0200 | |
changeset 17244 | 0b2ff9541727 |
parent 14981 | e73f8140af78 |
child 19739 | c58ef2aa5430 |
permissions | -rw-r--r-- |
3073
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
1 |
(* Title: HOL/IOA/NTP/Receiver.thy |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
2 |
ID: $Id$ |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
3 |
Author: Tobias Nipkow & Konrad Slind |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
4 |
*) |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
5 |
|
17244 | 6 |
header {* The implementation: receiver *} |
3073
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
7 |
|
17244 | 8 |
theory Receiver |
9 |
imports IOA Action |
|
10 |
begin |
|
11 |
||
12 |
types |
|
3073
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
13 |
|
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
14 |
'm receiver_state |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
15 |
= "'m list * bool multiset * 'm packet multiset * bool * bool" |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
16 |
(* messages #replies #received header mode *) |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
17 |
|
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
18 |
consts |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
19 |
|
6468 | 20 |
receiver_asig :: "'m action signature" |
17244 | 21 |
receiver_trans:: "('m action, 'm receiver_state)transition set" |
22 |
receiver_ioa :: "('m action, 'm receiver_state)ioa" |
|
23 |
rq :: "'m receiver_state => 'm list" |
|
24 |
rsent :: "'m receiver_state => bool multiset" |
|
25 |
rrcvd :: "'m receiver_state => 'm packet multiset" |
|
26 |
rbit :: "'m receiver_state => bool" |
|
27 |
rsending :: "'m receiver_state => bool" |
|
3073
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
28 |
|
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
29 |
defs |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
30 |
|
17244 | 31 |
rq_def: "rq == fst" |
32 |
rsent_def: "rsent == fst o snd" |
|
33 |
rrcvd_def: "rrcvd == fst o snd o snd" |
|
34 |
rbit_def: "rbit == fst o snd o snd o snd" |
|
35 |
rsending_def: "rsending == snd o snd o snd o snd" |
|
3073
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
36 |
|
17244 | 37 |
receiver_asig_def: "receiver_asig == |
38 |
(UN pkt. {R_pkt(pkt)}, |
|
39 |
(UN m. {R_msg(m)}) Un (UN b. {S_ack(b)}), |
|
3073
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
40 |
insert C_m_r (UN m. {C_r_r(m)}))" |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
41 |
|
17244 | 42 |
receiver_trans_def: "receiver_trans == |
43 |
{tr. let s = fst(tr); |
|
44 |
t = snd(snd(tr)) |
|
45 |
in |
|
46 |
case fst(snd(tr)) |
|
47 |
of |
|
48 |
S_msg(m) => False | |
|
49 |
R_msg(m) => rq(s) = (m # rq(t)) & |
|
50 |
rsent(t)=rsent(s) & |
|
51 |
rrcvd(t)=rrcvd(s) & |
|
52 |
rbit(t)=rbit(s) & |
|
53 |
rsending(t)=rsending(s) | |
|
54 |
S_pkt(pkt) => False | |
|
55 |
R_pkt(pkt) => rq(t) = rq(s) & |
|
56 |
rsent(t) = rsent(s) & |
|
57 |
rrcvd(t) = addm (rrcvd s) pkt & |
|
58 |
rbit(t) = rbit(s) & |
|
59 |
rsending(t) = rsending(s) | |
|
60 |
S_ack(b) => b = rbit(s) & |
|
61 |
rq(t) = rq(s) & |
|
62 |
rsent(t) = addm (rsent s) (rbit s) & |
|
63 |
rrcvd(t) = rrcvd(s) & |
|
64 |
rbit(t)=rbit(s) & |
|
65 |
rsending(s) & |
|
66 |
rsending(t) | |
|
67 |
R_ack(b) => False | |
|
68 |
C_m_s => False | |
|
69 |
C_m_r => count (rsent s) (~rbit s) < countm (rrcvd s) (%y. hdr(y)=rbit(s)) & |
|
70 |
rq(t) = rq(s) & |
|
71 |
rsent(t)=rsent(s) & |
|
72 |
rrcvd(t)=rrcvd(s) & |
|
73 |
rbit(t)=rbit(s) & |
|
74 |
rsending(s) & |
|
75 |
~rsending(t) | |
|
76 |
C_r_s => False | |
|
77 |
C_r_r(m) => count (rsent s) (rbit s) <= countm (rrcvd s) (%y. hdr(y)=rbit(s)) & |
|
78 |
count (rsent s) (~rbit s) < count (rrcvd s) (rbit(s),m) & |
|
79 |
rq(t) = rq(s)@[m] & |
|
80 |
rsent(t)=rsent(s) & |
|
81 |
rrcvd(t)=rrcvd(s) & |
|
82 |
rbit(t) = (~rbit(s)) & |
|
83 |
~rsending(s) & |
|
3073
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
84 |
rsending(t)}" |
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
85 |
|
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
86 |
|
17244 | 87 |
receiver_ioa_def: "receiver_ioa == |
3523 | 88 |
(receiver_asig, {([],{|},{|},False,False)}, receiver_trans,{},{})" |
3073
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
89 |
|
17244 | 90 |
ML {* use_legacy_bindings (the_context ()) *} |
91 |
||
3073
88366253a09a
Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff
changeset
|
92 |
end |