src/HOL/UNITY/Alloc.thy
author paulson
Wed, 15 Dec 1999 10:45:37 +0100
changeset 8065 658e0d4e4ed9
parent 8055 bb15396278fb
child 8069 19b9f92ca503
permissions -rw-r--r--
first working version to Alloc/System_Client_Progress; uses new "preserves" primitive instead of localTo
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Alloc
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
     2
    ID:         $Id$
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
     5
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
     6
Specification of Chandy and Charpentier's Allocator
7537
875754b599df working snapshot
paulson
parents: 7361
diff changeset
     7
875754b599df working snapshot
paulson
parents: 7361
diff changeset
     8
CONSIDER CHANGING "sum" to work on type "int", not "nat"
875754b599df working snapshot
paulson
parents: 7361
diff changeset
     9
  --then can use subtraction in spec (1),
875754b599df working snapshot
paulson
parents: 7361
diff changeset
    10
  --but need invariants that values are non-negative
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    11
*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    12
8041
e3237d8c18d6 working version with new theory ELT
paulson
parents: 7962
diff changeset
    13
Alloc = Follows + PPROD +
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    14
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    15
(*Duplicated from HOL/ex/NatSum.thy.
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    16
  Maybe type should be  [nat=>int, nat] => int**)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    17
consts sum     :: [nat=>nat, nat] => nat
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    18
primrec 
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    19
  "sum f 0 = 0"
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    20
  "sum f (Suc n) = f(n) + sum f n"
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    21
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    22
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    23
(*This function merely sums the elements of a list*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    24
consts tokens     :: nat list => nat
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    25
primrec 
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    26
  "tokens [] = 0"
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    27
  "tokens (x#xs) = x + tokens xs"
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    28
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    29
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    30
consts
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    31
  NbT      :: nat       (*Number of tokens in system*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    32
  Nclients :: nat       (*Number of clients*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    33
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    34
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    35
(** State definitions.  OUTPUT variables are locals **)
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    36
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    37
record clientState =
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    38
  giv :: nat list   (*client's INPUT history:  tokens GRANTED*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    39
  ask :: nat list   (*client's OUTPUT history: tokens REQUESTED*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    40
  rel :: nat list   (*client's OUTPUT history: tokens RELEASED*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    41
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    42
record allocState =
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    43
  allocGiv :: nat => nat list   (*OUTPUT history: source of "giv" for i*)
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    44
  allocAsk :: nat => nat list   (*INPUT: allocator's copy of "ask" for i*)
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    45
  allocRel :: nat => nat list   (*INPUT: allocator's copy of "rel" for i*)
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    46
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    47
record systemState = allocState +
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    48
  client :: nat => clientState  (*states of all clients*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    49
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    50
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    51
constdefs
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    52
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    53
(** Resource allocation system specification **)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    54
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    55
  (*spec (1)*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    56
  system_safety :: systemState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    57
    "system_safety ==
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    58
     Always {s. sum (%i. (tokens o giv o sub i o client) s) Nclients
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    59
	        <= NbT + sum (%i. (tokens o rel o sub i o client) s) Nclients}"
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    60
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    61
  (*spec (2)*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    62
  system_progress :: systemState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    63
    "system_progress == INT i : lessThan Nclients.
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    64
			INT h. 
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    65
			  {s. h <= (ask o sub i o client)s} LeadsTo
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
    66
			  {s. h pfixLe (giv o sub i o client) s}"
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
    67
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
    68
  system_spec :: systemState program set
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
    69
    "system_spec == system_safety Int system_progress"
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    70
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    71
(** Client specification (required) ***)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    72
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    73
  (*spec (3)*)
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    74
  client_increasing :: clientState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    75
    "client_increasing ==
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    76
         UNIV guarantees[funPair rel ask]
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    77
         Increasing ask Int Increasing rel"
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    78
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    79
  (*spec (4)*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    80
  client_bounded :: clientState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    81
    "client_bounded ==
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    82
         UNIV guarantees[ask]
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    83
         Always {s. ALL elt : set (ask s). elt <= NbT}"
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    84
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    85
  (*spec (5)*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    86
  client_progress :: clientState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    87
    "client_progress ==
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    88
	 Increasing giv
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
    89
	 guarantees[funPair rel ask]
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
    90
	 (INT h. {s. h <= giv s & h pfixGe ask s}
8041
e3237d8c18d6 working version with new theory ELT
paulson
parents: 7962
diff changeset
    91
		 LeadsTo[givenBy (funPair rel ask)]
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    92
		 {s. tokens h <= (tokens o rel) s})"
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
    93
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
    94
  (*spec: preserves part*)
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
    95
    client_preserves :: clientState program set
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
    96
    "client_preserves == preserves giv"
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
    97
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
    98
  client_spec :: clientState program set
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
    99
    "client_spec == client_increasing Int client_bounded Int client_progress
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   100
                    Int client_preserves"
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   101
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   102
(** Allocator specification (required) ***)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   103
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
   104
  (*spec (6)*)
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   105
  alloc_increasing :: allocState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   106
    "alloc_increasing ==
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   107
	 UNIV
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
   108
         guarantees[allocGiv]
7540
8af61a565a4a working Safety proof for the system at last
paulson
parents: 7537
diff changeset
   109
	 (INT i : lessThan Nclients. Increasing (sub i o allocGiv))"
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   110
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   111
  (*spec (7)*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   112
  alloc_safety :: allocState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   113
    "alloc_safety ==
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   114
	 (INT i : lessThan Nclients. Increasing (sub i o allocRel))
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
   115
         guarantees[allocGiv]
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   116
	 Always {s. sum (%i. (tokens o sub i o allocGiv) s) Nclients
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   117
	         <= NbT + sum (%i. (tokens o sub i o allocRel) s) Nclients}"
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   118
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   119
  (*spec (8)*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   120
  alloc_progress :: allocState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   121
    "alloc_progress ==
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   122
	 (INT i : lessThan Nclients. Increasing (sub i o allocAsk) Int
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   123
	                             Increasing (sub i o allocRel))
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   124
         Int
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   125
         Always {s. ALL i : lessThan Nclients.
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   126
		    ALL k : lessThan (length (allocAsk s i)).
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   127
		    allocAsk s i ! k <= NbT}
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   128
         Int
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   129
         (INT i : lessThan Nclients. 
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   130
	  INT h. {s. h <= (sub i o allocGiv)s & h pfixGe (sub i o allocAsk)s}
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   131
		  LeadsTo {s. tokens h <= (tokens o sub i o allocRel)s})
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
   132
         guarantees[allocGiv]
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   133
	     (INT i : lessThan Nclients.
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   134
	      INT h. {s. h <= (sub i o allocAsk) s} LeadsTo
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   135
	             {s. h pfixLe (sub i o allocGiv) s})"
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   136
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   137
  (*spec: preserves part*)
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   138
    alloc_preserves :: allocState program set
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   139
    "alloc_preserves == preserves (funPair allocRel allocAsk)"
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   140
  
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   141
  alloc_spec :: allocState program set
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   142
    "alloc_spec == alloc_increasing Int alloc_safety Int alloc_progress Int
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   143
                   alloc_preserves"
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   144
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   145
(** Network specification ***)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   146
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   147
  (*spec (9.1)*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   148
  network_ask :: systemState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   149
    "network_ask == INT i : lessThan Nclients.
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   150
                    Increasing (ask o sub i o client)
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
   151
                    guarantees[allocAsk]
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   152
                    ((sub i o allocAsk) Fols (ask o sub i o client))"
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   153
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   154
  (*spec (9.2)*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   155
  network_giv :: systemState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   156
    "network_giv == INT i : lessThan Nclients.
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   157
                    Increasing (sub i o allocGiv)
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
   158
                    guarantees[giv o sub i o client]
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   159
                    ((giv o sub i o client) Fols (sub i o allocGiv))"
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   160
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   161
  (*spec (9.3)*)
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   162
  network_rel :: systemState program set
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   163
    "network_rel == INT i : lessThan Nclients.
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   164
                    Increasing (rel o sub i o client)
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
   165
                    guarantees[allocRel]
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   166
                    ((sub i o allocRel) Fols (rel o sub i o client))"
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   167
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   168
  (*spec: preserves part*)
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   169
    network_preserves :: systemState program set
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   170
    "network_preserves == preserves allocGiv
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   171
                          Int
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   172
                          (INT i : lessThan Nclients.
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   173
                           preserves (funPair rel ask o sub i o client))"
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   174
  
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   175
  network_spec :: systemState program set
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   176
    "network_spec == network_ask Int network_giv Int
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   177
                     network_rel Int network_preserves"
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   178
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   179
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   180
(** State mappings **)
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   181
  sysOfAlloc :: "(allocState * (nat => clientState)) => systemState"
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   182
    "sysOfAlloc == %(s,y). (| allocGiv = allocGiv s,
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   183
			      allocAsk = allocAsk s,
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   184
			      allocRel = allocRel s,
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   185
			      client   = y |)"
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   186
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   187
  sysOfClient :: "((nat => clientState) * allocState ) => systemState"
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   188
    "sysOfClient == %(x,y). sysOfAlloc(y,x)"
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   189
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   190
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   191
locale System =
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   192
  fixes 
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   193
    Alloc   :: allocState program
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   194
    Client  :: clientState program
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   195
    Network :: systemState program
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   196
    System  :: systemState program
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   197
  
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   198
  assumes
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   199
    Alloc   "Alloc   : alloc_spec"
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   200
    Client  "Client  : client_spec"
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   201
    Network "Network : network_spec"
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   202
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   203
  defines
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   204
    System_def
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   205
      "System == (extend sysOfAlloc Alloc)
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   206
                 Join
6841
5a557122bb62 renamed PPI to plam
paulson
parents: 6837
diff changeset
   207
                 (extend sysOfClient (plam x: lessThan Nclients. Client))
6827
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   208
                 Join
b69a2585ec0f guar; locale for the spec
paulson
parents: 6815
diff changeset
   209
                 Network"
6815
de4d358bf01e The Allocator example: specifications
paulson
parents:
diff changeset
   210
end