src/HOL/UNITY/Alloc.ML
author paulson
Fri, 06 Aug 1999 17:29:18 +0200
changeset 7188 2bc63a44721b
parent 6867 7cb9d3250db7
child 7347 ad0ce67e4eb6
permissions -rw-r--r--
re-organization of theorems from Alloc and PPROD, partly into new theory Lift_prog
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6828
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
     1
(*  Title:      HOL/UNITY/Alloc
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
     2
    ID:         $Id$
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
     4
    Copyright   1998  University of Cambridge
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
     5
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
     6
Specification of Chandy and Charpentier's Allocator
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
     7
*)
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
     8
6837
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
     9
6840
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    10
(*Generalized version allowing different clients*)
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    11
Goal "[| Alloc : alloc_spec;  \
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    12
\        Client : (lessThan Nclients) funcset client_spec;  \
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    13
\        Network : network_spec |] \
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    14
\     ==> (extend sysOfAlloc Alloc) \
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    15
\         Join (extend sysOfClient (PLam (lessThan Nclients) Client)) \
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    16
\         Join Network : system_spec";
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    17
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    18
Goal "System : system_spec";
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    19
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    20
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    21
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    22
6828
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    23
Goalw [sysOfAlloc_def] "inj sysOfAlloc";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    24
by (rtac injI 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    25
by Auto_tac;
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    26
qed "inj_sysOfAlloc";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    27
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    28
Goalw [sysOfAlloc_def] "surj sysOfAlloc";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    29
by (res_inst_tac [("f", "%s. ((| allocGiv = allocGiv s,    \
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    30
\                                allocAsk = allocAsk s,    \
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    31
\                                allocRel = allocRel s |), \
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    32
\                             client s)")] surjI 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    33
by Auto_tac;
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    34
qed "surj_sysOfAlloc";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    35
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    36
AddIffs [inj_sysOfAlloc, surj_sysOfAlloc];
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    37
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    38
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    39
Open_locale "System";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    40
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    41
val Alloc = thm "Alloc";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    42
val Client = thm "Client";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    43
val Network = thm "Network";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    44
val System_def = thm "System_def";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    45
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    46
AddIffs [finite_lessThan];
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    47
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    48
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    49
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    50
Goal "i < Nclients ==> \
6837
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    51
\     lift_prog i Client : UNIV guar Increasing (rel o sub i)";
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    52
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    53
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    54
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    55
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    56
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    57
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    58
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    59
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    60
by (stac Acts_eq 1);
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    61
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    62
fr conjI;
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    63
by (Clarify_tac 1);
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    64
by (stac Init_eq 1);
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    65
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    66
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    67
{GX. EX G:X. lift_prog i G component GX}
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    68
{GY. EX G:Y. lift_prog i G component GY}
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    69
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    70
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    71
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    72
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu;
1bd850260747 another snapshot, still not working
paulson
parents: 6828
diff changeset
    73
6828
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    74
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    75
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    76
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    77
Goal "i < Nclients ==> System : Increasing (sub i o allocRel)";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    78
by (cut_facts_tac [Client] 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    79
by (full_simp_tac
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    80
    (simpset() addsimps [System_def,
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    81
			 client_spec_def, client_increasing_def,
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    82
			 guarantees_Int_right]) 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    83
by Auto_tac;
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    84
by (dtac lift_prog_guarantees 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    85
by (dtac (UNIV_I RSN (2, guaranteesD)) 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    86
back();
6840
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    87
by (dtac (lessThan_iff RS iffD2 RS const_PLam_Increasing RS iffD2) 1);
6828
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    88
by Auto_tac;
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    89
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    90
6840
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    91
by (full_simp_tac (simpset() addsimps [read_instantiate [("f1","rel"),("I1","lessThan Nclients")] (const_PLam_Increasing RS sym)]) 1);
6828
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    92
6840
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
    93
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy;
6828
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    94
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    95
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    96
(*partial system...*)
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    97
Goal "[| Alloc : alloc_spec;  Network : network_spec |] \
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    98
\     ==> (extend sysOfAlloc Alloc) Join Network : system_spec";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
    99
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   100
(*partial system...*)
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   101
Goal "[| Client : client_spec;  Network : network_spec |] \
6840
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
   102
\     ==> (extend sysOfClient (plam x: lessThan Nclients. Client)) \
6828
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   103
\         Join Network : system_spec";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   104
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   105
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   106
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   107
Goal "[| Alloc : alloc_spec;  Client : client_spec;  \
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   108
\        Network : network_spec |] \
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   109
\     ==> (extend sysOfAlloc Alloc) \
6840
0e5c82abfc71 another non-working snapshot
paulson
parents: 6837
diff changeset
   110
\         Join (extend sysOfClient (plam x: lessThan Nclients. Client)) \
6828
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   111
\         Join Network : system_spec";
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   112
by (full_simp_tac
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   113
    (simpset() addsimps [system_spec_def, system_safety_def]) 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   114
by Auto_tac;
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   115
by (full_simp_tac
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   116
    (simpset() addsimps [client_spec_def, client_increasing_def,
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   117
			 guarantees_Int_right]) 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   118
by Auto_tac;
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   119
by (dtac (UNIV_I RSN (2, guaranteesD)) 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   120
back();
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   121
by (full_simp_tac
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   122
    (simpset() addsimps [network_spec_def, network_rel_def]) 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   123
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   124
by (subgoal_tac "" 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   125
by (full_simp_tac
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   126
    (simpset() addsimps [alloc_spec_def, alloc_safety_def]) 1);
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   127
by Auto_tac;
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   128
ea6832d74353 not working but taking shape
paulson
parents: 6815
diff changeset
   129
by (Simp_tac 1);