src/HOL/UNITY/AllocImpl.thy
author paulson
Sat, 23 Sep 2000 16:02:01 +0200
changeset 10064 1a77667b21ef
parent 9403 aad13b59b8d9
permissions -rw-r--r--
added compatibility relation: AllowedActs, Allowed, ok, OK and changes to "guarantees", etc.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/AllocImpl
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
     2
    ID:         $Id$
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
     5
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
     6
Implementation of a multiple-client allocator from a single-client allocator
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
     7
*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
     8
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
     9
AllocImpl = AllocBase + Follows + PPROD + 
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    10
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    11
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    12
(** State definitions.  OUTPUT variables are locals **)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    13
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    14
(*Type variable 'b is the type of items being merged*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    15
record 'b merge =
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    16
  In   :: nat => 'b list   (*merge's INPUT histories: streams to merge*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    17
  Out  :: 'b list          (*merge's OUTPUT history: merged items*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    18
  iOut :: nat list         (*merge's OUTPUT history: origins of merged items*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    19
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    20
record ('a,'b) merge_d =
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    21
  'b merge +
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    22
  dummy :: 'a       (*dummy field for new variables*)
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    23
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    24
constdefs
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    25
  non_dummy :: ('a,'b) merge_d => 'b merge
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    26
    "non_dummy s == (|In = In s, Out = Out s, iOut = iOut s|)"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    27
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    28
record 'b distr =
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    29
  In  :: 'b list          (*items to distribute*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    30
  iIn :: nat list         (*destinations of items to distribute*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    31
  Out :: nat => 'b list   (*distributed items*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    32
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    33
record ('a,'b) distr_d =
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    34
  'b distr +
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    35
  dummy :: 'a       (*dummy field for new variables*)
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    36
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    37
record allocState =
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    38
  giv :: nat list   (*OUTPUT history: source of tokens*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    39
  ask :: nat list   (*INPUT: tokens requested from allocator*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    40
  rel :: nat list   (*INPUT: tokens released to allocator*)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    41
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    42
record 'a allocState_d =
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    43
  allocState +
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    44
  dummy    :: 'a                (*dummy field for new variables*)
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    45
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    46
record 'a systemState =
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    47
  allocState +
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    48
  mergeRel :: nat merge
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    49
  mergeAsk :: nat merge
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    50
  distr    :: nat distr
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    51
  dummy    :: 'a                  (*dummy field for new variables*)
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    52
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    53
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    54
constdefs
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    55
9105
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
    56
(** Merge specification (the number of inputs is Nclients) ***)
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    57
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    58
  (*spec (10)*)
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    59
  merge_increasing :: ('a,'b) merge_d program set
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    60
    "merge_increasing ==
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    61
         UNIV guarantees (Increasing merge.Out) Int (Increasing merge.iOut)"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    62
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    63
  (*spec (11)*)
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    64
  merge_eqOut :: ('a,'b) merge_d program set
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    65
    "merge_eqOut ==
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    66
         UNIV guarantees
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    67
         Always {s. length (merge.Out s) = length (merge.iOut s)}"
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    68
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    69
  (*spec (12)*)
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    70
  merge_bounded :: ('a,'b) merge_d program set
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    71
    "merge_bounded ==
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    72
         UNIV guarantees
9105
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
    73
         Always {s. ALL elt : set (merge.iOut s). elt < Nclients}"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    74
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    75
  (*spec (13)*)
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    76
  merge_follows :: ('a,'b) merge_d program set
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    77
    "merge_follows ==
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    78
	 (INT i : lessThan Nclients. Increasing (sub i o merge.In))
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    79
	 guarantees
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    80
	 (INT i : lessThan Nclients. 
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    81
	  (%s. sublist (merge.Out s) 
9105
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
    82
                       {k. k < size(merge.iOut s) & merge.iOut s! k = i})
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    83
	  Fols (sub i o merge.In))"
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    84
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    85
  (*spec: preserves part*)
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    86
  merge_preserves :: ('a,'b) merge_d program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    87
    "merge_preserves == preserves merge.In Int preserves merge_d.dummy"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    88
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    89
  (*environmental constraints*)
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    90
  merge_allowed_acts :: ('a,'b) merge_d program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    91
    "merge_allowed_acts ==
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    92
       {F. AllowedActs F =
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    93
	    insert Id (UNION (preserves (funPair merge.Out merge.iOut)) Acts)}"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    94
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
    95
  merge_spec :: ('a,'b) merge_d program set
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    96
    "merge_spec == merge_increasing Int merge_eqOut Int merge_bounded Int
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
    97
                   merge_follows Int merge_allowed_acts Int merge_preserves"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
    98
9105
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
    99
(** Distributor specification (the number of outputs is Nclients) ***)
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   100
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   101
  (*spec (14)*)
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
   102
  distr_follows :: ('a,'b) distr_d program set
9105
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   103
    "distr_follows ==
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   104
	 Increasing distr.In Int Increasing distr.iIn Int
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   105
	 Always {s. ALL elt : set (distr.iIn s). elt < Nclients}
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   106
	 guarantees
9105
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   107
	 (INT i : lessThan Nclients. 
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   108
	  (sub i o distr.Out) Fols
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   109
	  (%s. sublist (distr.In s) 
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   110
                       {k. k < size(distr.iIn s) & distr.iIn s ! k = i}))"
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   111
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   112
  distr_allowed_acts :: ('a,'b) distr_d program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   113
    "distr_allowed_acts ==
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   114
       {D. AllowedActs D = insert Id (UNION (preserves distr.Out) Acts)}"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   115
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   116
  distr_spec :: ('a,'b) distr_d program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   117
    "distr_spec == distr_follows Int distr_allowed_acts"
9105
d9257992b845 fixed the merge spec (NbT -> Nclients) and added the distributor spec
paulson
parents: 9027
diff changeset
   118
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   119
(** Single-client allocator specification (required) ***)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   120
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   121
  (*spec (18)*)
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
   122
  alloc_increasing :: 'a allocState_d program set
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   123
    "alloc_increasing == UNIV  guarantees  Increasing giv"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   124
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   125
  (*spec (19)*)
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
   126
  alloc_safety :: 'a allocState_d program set
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   127
    "alloc_safety ==
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   128
	 Increasing rel
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   129
         guarantees  Always {s. tokens (giv s) <= NbT + tokens (rel s)}"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   130
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   131
  (*spec (20)*)
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
   132
  alloc_progress :: 'a allocState_d program set
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   133
    "alloc_progress ==
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   134
	 Increasing ask Int Increasing rel Int
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   135
         Always {s. ALL elt : set (ask s). elt <= NbT}
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   136
         Int
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   137
         (INT h. {s. h <= giv s & h pfixGe (ask s)}
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   138
		 LeadsTo
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   139
	         {s. tokens h <= tokens (rel s)})
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   140
         guarantees  (INT h. {s. h <= ask s} LeadsTo {s. h pfixLe giv s})"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   141
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   142
  (*spec: preserves part*)
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   143
  alloc_preserves :: 'a allocState_d program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   144
    "alloc_preserves == preserves rel Int
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   145
                        preserves ask Int
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   146
                        preserves allocState_d.dummy"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   147
  
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   148
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   149
  (*environmental constraints*)
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   150
  alloc_allowed_acts :: 'a allocState_d program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   151
    "alloc_allowed_acts ==
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   152
       {F. AllowedActs F = insert Id (UNION (preserves giv) Acts)}"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   153
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 9105
diff changeset
   154
  alloc_spec :: 'a allocState_d program set
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   155
    "alloc_spec == alloc_increasing Int alloc_safety Int alloc_progress Int
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   156
                   alloc_allowed_acts Int alloc_preserves"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   157
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   158
locale Merge =
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   159
  fixes 
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   160
    M   :: ('a,'b::order) merge_d program
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   161
  assumes
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   162
    Merge_spec  "M  : merge_spec"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   163
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   164
locale Distrib =
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   165
  fixes 
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   166
    D   :: ('a,'b::order) distr_d program
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   167
  assumes
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   168
    Distrib_spec  "D : distr_spec"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   169
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   170
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   171
(****
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   172
#  (** Network specification ***)
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   173
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   174
#    (*spec (9.1)*)
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   175
#    network_ask :: 'a systemState program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   176
#	"network_ask == INT i : lessThan Nclients.
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   177
#			    Increasing (ask o sub i o client)
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   178
#			    guarantees[ask]
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   179
#			    (ask  Fols (ask o sub i o client))"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   180
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   181
#    (*spec (9.2)*)
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   182
#    network_giv :: 'a systemState program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   183
#	"network_giv == INT i : lessThan Nclients.
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   184
#			    Increasing giv 
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   185
#			    guarantees[giv o sub i o client]
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   186
#			    ((giv o sub i o client) Fols giv )"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   187
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   188
#    (*spec (9.3)*)
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   189
#    network_rel :: 'a systemState program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   190
#	"network_rel == INT i : lessThan Nclients.
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   191
#			    Increasing (rel o sub i o client)
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   192
#			    guarantees[rel]
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   193
#			    (rel  Fols (rel o sub i o client))"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   194
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   195
#    (*spec: preserves part*)
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   196
#	network_preserves :: 'a systemState program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   197
#	"network_preserves == preserves giv  Int
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   198
#			      (INT i : lessThan Nclients.
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   199
#			       preserves (funPair rel ask o sub i o client))"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   200
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   201
#    network_spec :: 'a systemState program set
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   202
#	"network_spec == network_ask Int network_giv Int
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   203
#			 network_rel Int network_preserves"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   204
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   205
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   206
#  (** State mappings **)
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   207
#    sysOfAlloc :: "((nat => merge) * 'a) allocState_d => 'a systemState"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   208
#	"sysOfAlloc == %s. let (cl,xtr) = allocState_d.dummy s
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   209
#			   in (| giv = giv s,
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   210
#				 ask = ask s,
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   211
#				 rel = rel s,
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   212
#				 client   = cl,
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   213
#				 dummy    = xtr|)"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   214
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   215
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   216
#    sysOfClient :: "(nat => merge) * 'a allocState_d => 'a systemState"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   217
#	"sysOfClient == %(cl,al). (| giv = giv al,
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   218
#				     ask = ask al,
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   219
#				     rel = rel al,
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   220
#				     client   = cl,
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9403
diff changeset
   221
#				     systemState.dummy = allocState_d.dummy al|)"
9027
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   222
****)
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   223
daeccd9f885f The Allocator Implementation (not yet working)
paulson
parents:
diff changeset
   224
end