src/HOL/TLA/Memory/MemoryImplementation.thy
author wenzelm
Sun, 02 Nov 2014 18:21:45 +0100
changeset 58889 5b7a9633cfa8
parent 58310 91ea607a34d8
child 58963 26bf09b95dda
permissions -rw-r--r--
modernized header uniformly as section;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41589
bbd861837ebc tuned headers;
wenzelm
parents: 39159
diff changeset
     1
(*  Title:      HOL/TLA/Memory/MemoryImplementation.thy
bbd861837ebc tuned headers;
wenzelm
parents: 39159
diff changeset
     2
    Author:     Stephan Merz, University of Munich
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
     3
*)
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
     4
58889
5b7a9633cfa8 modernized header uniformly as section;
wenzelm
parents: 58310
diff changeset
     5
section {* RPC-Memory example: Memory implementation *}
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
     6
17309
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
     7
theory MemoryImplementation
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
     8
imports Memory RPC MemClerk
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
     9
begin
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    10
58310
91ea607a34d8 updated news
blanchet
parents: 58249
diff changeset
    11
datatype histState = histA | histB
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    12
42018
878f33040280 modernized specifications;
wenzelm
parents: 41589
diff changeset
    13
type_synonym histType = "(PrIds => histState) stfun"  (* the type of the history variable *)
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    14
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    15
consts
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    16
  (* the specification *)
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    17
     (* channel (external) *)
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    18
  memCh         :: "memChType"
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    19
     (* internal variables *)
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    20
  mm            :: "memType"
17309
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
    21
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    22
  (* the state variables of the implementation *)
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    23
     (* channels *)
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    24
  (* same interface channel memCh *)
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    25
  crCh          :: "rpcSndChType"
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    26
  rmCh          :: "rpcRcvChType"
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    27
     (* internal variables *)
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    28
  (* identity refinement mapping for mm -- simply reused *)
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    29
  rst           :: "rpcStType"
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    30
  cst           :: "mClkStType"
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    31
  ires          :: "resType"
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    32
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    33
definition
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    34
  (* auxiliary predicates *)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    35
  MVOKBARF      :: "Vals => bool"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    36
  where "MVOKBARF v <-> (v : MemVal) | (v = OK) | (v = BadArg) | (v = RPCFailure)"
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    37
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    38
definition
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    39
  MVOKBA        :: "Vals => bool"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    40
  where "MVOKBA v <-> (v : MemVal) | (v = OK) | (v = BadArg)"
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    41
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    42
definition
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    43
  MVNROKBA      :: "Vals => bool"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    44
  where "MVNROKBA v <-> (v : MemVal) | (v = NotAResult) | (v = OK) | (v = BadArg)"
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    45
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    46
definition
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    47
  (* tuples of state functions changed by the various components *)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    48
  e             :: "PrIds => (bit * memOp) stfun"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    49
  where "e p = PRED (caller memCh!p)"
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    50
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    51
definition
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    52
  c             :: "PrIds => (mClkState * (bit * Vals) * (bit * rpcOp)) stfun"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    53
  where "c p = PRED (cst!p, rtrner memCh!p, caller crCh!p)"
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    54
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    55
definition
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    56
  r             :: "PrIds => (rpcState * (bit * Vals) * (bit * memOp)) stfun"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    57
  where "r p = PRED (rst!p, rtrner crCh!p, caller rmCh!p)"
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    58
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    59
definition
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    60
  m             :: "PrIds => ((bit * Vals) * Vals) stfun"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    61
  where "m p = PRED (rtrner rmCh!p, ires!p)"
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    62
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    63
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    64
  (* the environment action *)
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    65
  ENext         :: "PrIds => action"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    66
  where "ENext p = ACT (? l. #l : #MemLoc & Call memCh p #(read l))"
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    67
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    68
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    69
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    70
  (* specification of the history variable *)
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    71
  HInit         :: "histType => PrIds => stpred"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    72
  where "HInit rmhist p = PRED rmhist!p = #histA"
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    73
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    74
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    75
  HNext         :: "histType => PrIds => action"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    76
  where "HNext rmhist p = ACT (rmhist!p)$ =
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    77
                     (if (MemReturn rmCh ires p | RPCFail crCh rmCh rst p)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    78
                      then #histB
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    79
                      else if (MClkReply memCh crCh cst p)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    80
                           then #histA
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    81
                           else $(rmhist!p))"
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    82
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    83
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    84
  HistP         :: "histType => PrIds => temporal"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    85
  where "HistP rmhist p = (TEMP Init HInit rmhist p
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    86
                           & [][HNext rmhist p]_(c p,r p,m p, rmhist!p))"
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    87
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    88
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    89
  Hist          :: "histType => temporal"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    90
  where "Hist rmhist = TEMP (ALL p. HistP rmhist p)"
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    91
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    92
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
    93
  (* the implementation *)
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
    94
  IPImp          :: "PrIds => temporal"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    95
  where "IPImp p = (TEMP (  Init ~Calling memCh p & [][ENext p]_(e p)
17309
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
    96
                       & MClkIPSpec memCh crCh cst p
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
    97
                       & RPCIPSpec crCh rmCh rst p
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
    98
                       & RPSpec rmCh mm ires p
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
    99
                       & (ALL l. #l : #MemLoc --> MSpec rmCh mm ires l)))"
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   100
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   101
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   102
  ImpInit        :: "PrIds => stpred"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   103
  where "ImpInit p = PRED (  ~Calling memCh p
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   104
                          & MClkInit crCh cst p
17309
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   105
                          & RPCInit rmCh rst p
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   106
                          & PInit ires p)"
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   107
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   108
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   109
  ImpNext        :: "PrIds => action"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   110
  where "ImpNext p = (ACT  [ENext p]_(e p)
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   111
                       & [MClkNext memCh crCh cst p]_(c p)
17309
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   112
                       & [RPCNext crCh rmCh rst p]_(r p)
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   113
                       & [RNext rmCh mm ires p]_(m p))"
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   114
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   115
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   116
  ImpLive        :: "PrIds => temporal"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   117
  where "ImpLive p = (TEMP  WF(MClkFwd memCh crCh cst p)_(c p)
17309
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   118
                        & SF(MClkReply memCh crCh cst p)_(c p)
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   119
                        & WF(RPCNext crCh rmCh rst p)_(r p)
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   120
                        & WF(RNext rmCh mm ires p)_(m p)
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   121
                        & WF(MemReturn rmCh ires p)_(m p))"
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   122
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   123
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   124
  Implementation :: "temporal"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   125
  where "Implementation = (TEMP ( (ALL p. Init (~Calling memCh p) & [][ENext p]_(e p))
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   126
                               & MClkISpec memCh crCh cst
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   127
                               & RPCISpec crCh rmCh rst
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   128
                               & IRSpec rmCh mm ires))"
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   129
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   130
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   131
  (* the predicate S describes the states of the implementation.
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   132
     slight simplification: two "histState" parameters instead of a
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   133
     (one- or two-element) set.
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   134
     NB: The second conjunct of the definition in the paper is taken care of by
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   135
     the type definitions. The last conjunct is asserted separately as the memory
24180
9f818139951b tuned ML setup;
wenzelm
parents: 21624
diff changeset
   136
     invariant MemInv, proved in Memory.thy. *)
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   137
  S :: "histType => bool => bool => bool => mClkState => rpcState => histState => histState => PrIds => stpred"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   138
  where "S rmhist ecalling ccalling rcalling cs rs hs1 hs2 p = (PRED
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   139
                Calling memCh p = #ecalling
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   140
              & Calling crCh p  = #ccalling
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   141
              & (#ccalling --> arg<crCh!p> = MClkRelayArg<arg<memCh!p>>)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   142
              & (~ #ccalling & cst!p = #clkB --> MVOKBARF<res<crCh!p>>)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   143
              & Calling rmCh p  = #rcalling
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   144
              & (#rcalling --> arg<rmCh!p> = RPCRelayArg<arg<crCh!p>>)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   145
              & (~ #rcalling --> ires!p = #NotAResult)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   146
              & (~ #rcalling & rst!p = #rpcB --> MVOKBA<res<rmCh!p>>)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   147
              & cst!p = #cs
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   148
              & rst!p = #rs
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   149
              & (rmhist!p = #hs1 | rmhist!p = #hs2)
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   150
              & MVNROKBA<ires!p>)"
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   151
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   152
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   153
  (* predicates S1 -- S6 define special instances of S *)
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   154
  S1            :: "histType => PrIds => stpred"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   155
  where "S1 rmhist p = S rmhist False False False clkA rpcA histA histA p"
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   156
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   157
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   158
  S2            :: "histType => PrIds => stpred"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   159
  where "S2 rmhist p = S rmhist True False False clkA rpcA histA histA p"
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   160
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   161
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   162
  S3            :: "histType => PrIds => stpred"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   163
  where "S3 rmhist p = S rmhist True True False clkB rpcA histA histB p"
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   164
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   165
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   166
  S4            :: "histType => PrIds => stpred"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   167
  where "S4 rmhist p = S rmhist True True True clkB rpcB histA histB p"
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   168
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   169
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   170
  S5            :: "histType => PrIds => stpred"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   171
  where "S5 rmhist p = S rmhist True True False clkB rpcB histB histB p"
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   172
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   173
definition
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   174
  S6            :: "histType => PrIds => stpred"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   175
  where "S6 rmhist p = S rmhist True False False clkB rpcA histB histB p"
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   176
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   177
definition
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   178
  (* The invariant asserts that the system is always in one of S1 - S6, for every p *)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   179
  ImpInv         :: "histType => PrIds => stpred"
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   180
  where "ImpInv rmhist p = (PRED (S1 rmhist p | S2 rmhist p | S3 rmhist p
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   181
                                | S4 rmhist p | S5 rmhist p | S6 rmhist p))"
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   182
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   183
definition
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   184
  resbar        :: "histType => resType"        (* refinement mapping *)
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   185
  where"resbar rmhist s p =
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   186
                  (if (S1 rmhist p s | S2 rmhist p s)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   187
                   then ires s p
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   188
                   else if S3 rmhist p s
17309
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   189
                   then if rmhist s p = histA
6255
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   190
                        then ires s p else MemFailure
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   191
                   else if S4 rmhist p s
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   192
                   then if (rmhist s p = histB & ires s p = NotAResult)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   193
                        then MemFailure else ires s p
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   194
                   else if S5 rmhist p s
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   195
                   then res (rmCh s p)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   196
                   else if S6 rmhist p s
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   197
                   then if res (crCh s p) = RPCFailure
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   198
                        then MemFailure else res (crCh s p)
db63752140c7 updated (Stephan Merz);
wenzelm
parents: 3807
diff changeset
   199
                   else NotAResult)" (* dummy value *)
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   200
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 32149
diff changeset
   201
axiomatization where
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
   202
  (* the "base" variables: everything except resbar and hist (for any index) *)
17309
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   203
  MI_base:       "basevars (caller memCh!p,
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   204
                           (rtrner memCh!p, caller crCh!p, cst!p),
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   205
                           (rtrner crCh!p, caller rmCh!p, rst!p),
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   206
                           (mm!l, rtrner rmCh!p, ires!p))"
c43ed29bd197 converted to Isar theory format;
wenzelm
parents: 11703
diff changeset
   207
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   208
(*
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   209
    The main theorem is theorem "Implementation" at the end of this file,
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   210
    which shows that the composition of a reliable memory, an RPC component, and
24180
9f818139951b tuned ML setup;
wenzelm
parents: 21624
diff changeset
   211
    a memory clerk implements an unreliable memory. The files "MIsafe.thy" and
9f818139951b tuned ML setup;
wenzelm
parents: 21624
diff changeset
   212
    "MIlive.thy" contain lower-level lemmas for the safety and liveness parts.
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   213
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   214
    Steps are (roughly) numbered as in the hand proof.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   215
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   216
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   217
(* --------------------------- automatic prover --------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   218
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   219
declare if_weak_cong [cong del]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   220
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   221
(* A more aggressive variant that tries to solve subgoals by assumption
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   222
   or contradiction during the simplification.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   223
   THIS IS UNSAFE, BECAUSE IT DOESN'T RECORD THE CHOICES!!
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   224
   (but it can be a lot faster than the default setup)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   225
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   226
ML {*
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   227
  val config_fast_solver = Attrib.setup_config_bool @{binding fast_solver} (K false);
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   228
  val fast_solver = mk_solver "fast_solver" (fn ctxt =>
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   229
    if Config.get ctxt config_fast_solver
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   230
    then assume_tac ORELSE' (etac notE)
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   231
    else K no_tac);
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   232
*}
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   233
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   234
setup {* map_theory_simpset (fn ctxt => ctxt addSSolver fast_solver) *}
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   235
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   236
ML {* val temp_elim = make_elim oo temp_use *}
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   237
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   238
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   239
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   240
(****************************** The history variable ******************************)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   241
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   242
section "History variable"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   243
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   244
lemma HistoryLemma: "|- Init(ALL p. ImpInit p) & [](ALL p. ImpNext p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   245
         --> (EEX rmhist. Init(ALL p. HInit rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   246
                          & [](ALL p. [HNext rmhist p]_(c p, r p, m p, rmhist!p)))"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   247
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   248
  apply (rule historyI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   249
      apply assumption+
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   250
  apply (rule MI_base)
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   251
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm HInit_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   252
   apply (erule fun_cong)
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   253
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm HNext_def}])
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   254
    [@{thm busy_squareI}] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   255
  apply (erule fun_cong)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   256
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   257
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   258
lemma History: "|- Implementation --> (EEX rmhist. Hist rmhist)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   259
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   260
  apply (rule HistoryLemma [temp_use, THEN eex_mono])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   261
    prefer 3
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   262
    apply (force simp: Hist_def HistP_def Init_def all_box [try_rewrite]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   263
      split_box_conj [try_rewrite])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   264
   apply (auto simp: Implementation_def MClkISpec_def RPCISpec_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   265
     IRSpec_def MClkIPSpec_def RPCIPSpec_def RPSpec_def ImpInit_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   266
     Init_def ImpNext_def c_def r_def m_def all_box [temp_use] split_box_conj [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   267
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   268
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   269
(******************************** The safety part *********************************)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   270
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   271
section "The safety part"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   272
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   273
(* ------------------------- Include lower-level lemmas ------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   274
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   275
(* RPCFailure notin MemVals U {OK,BadArg} *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   276
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   277
lemma MVOKBAnotRF: "MVOKBA x ==> x ~= RPCFailure"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   278
  apply (unfold MVOKBA_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   279
  apply auto
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   280
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   281
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   282
(* NotAResult notin MemVals U {OK,BadArg,RPCFailure} *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   283
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   284
lemma MVOKBARFnotNR: "MVOKBARF x ==> x ~= NotAResult"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   285
  apply (unfold MVOKBARF_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   286
  apply auto
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   287
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   288
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   289
(* ================ Si's are mutually exclusive ================================ *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   290
(* Si and Sj are mutually exclusive for i # j. This helps to simplify the big
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   291
   conditional in the definition of resbar when doing the step-simulation proof.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   292
   We prove a weaker result, which suffices for our purposes:
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   293
   Si implies (not Sj), for j<i.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   294
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   295
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   296
(* --- not used ---
42772
2acb503fd857 modernized dead code;
wenzelm
parents: 42771
diff changeset
   297
lemma S1_excl: "|- S1 rmhist p --> S1 rmhist p & ~S2 rmhist p & ~S3 rmhist p &
2acb503fd857 modernized dead code;
wenzelm
parents: 42771
diff changeset
   298
    ~S4 rmhist p & ~S5 rmhist p & ~S6 rmhist p"
2acb503fd857 modernized dead code;
wenzelm
parents: 42771
diff changeset
   299
  by (auto simp: S_def S1_def S2_def S3_def S4_def S5_def S6_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   300
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   301
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   302
lemma S2_excl: "|- S2 rmhist p --> S2 rmhist p & ~S1 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   303
  by (auto simp: S_def S1_def S2_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   304
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   305
lemma S3_excl: "|- S3 rmhist p --> S3 rmhist p & ~S1 rmhist p & ~S2 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   306
  by (auto simp: S_def S1_def S2_def S3_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   307
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   308
lemma S4_excl: "|- S4 rmhist p --> S4 rmhist p & ~S1 rmhist p & ~S2 rmhist p & ~S3 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   309
  by (auto simp: S_def S1_def S2_def S3_def S4_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   310
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   311
lemma S5_excl: "|- S5 rmhist p --> S5 rmhist p & ~S1 rmhist p & ~S2 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   312
                         & ~S3 rmhist p & ~S4 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   313
  by (auto simp: S_def S1_def S2_def S3_def S4_def S5_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   314
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   315
lemma S6_excl: "|- S6 rmhist p --> S6 rmhist p & ~S1 rmhist p & ~S2 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   316
                         & ~S3 rmhist p & ~S4 rmhist p & ~S5 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   317
  by (auto simp: S_def S1_def S2_def S3_def S4_def S5_def S6_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   318
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   319
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   320
(* ==================== Lemmas about the environment ============================== *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   321
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   322
lemma Envbusy: "|- $(Calling memCh p) --> ~ENext p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   323
  by (auto simp: ENext_def Call_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   324
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   325
(* ==================== Lemmas about the implementation's states ==================== *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   326
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   327
(* The following series of lemmas are used in establishing the implementation's
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   328
   next-state relation (Step 1.2 of the proof in the paper). For each state Si, we
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   329
   determine which component actions are possible and what state they result in.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   330
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   331
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   332
(* ------------------------------ State S1 ---------------------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   333
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   334
lemma S1Env: "|- ENext p & $(S1 rmhist p) & unchanged (c p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   335
         --> (S2 rmhist p)$"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   336
  by (force simp: ENext_def Call_def c_def r_def m_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   337
    caller_def rtrner_def MVNROKBA_def S_def S1_def S2_def Calling_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   338
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   339
lemma S1ClerkUnch: "|- [MClkNext memCh crCh cst p]_(c p) & $(S1 rmhist p) --> unchanged (c p)"
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   340
  using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   341
  by (auto elim!: squareE [temp_use] dest!: MClkidle [temp_use] simp: S_def S1_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   342
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   343
lemma S1RPCUnch: "|- [RPCNext crCh rmCh rst p]_(r p) & $(S1 rmhist p) --> unchanged (r p)"
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   344
  using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   345
  by (auto elim!: squareE [temp_use] dest!: RPCidle [temp_use] simp: S_def S1_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   346
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   347
lemma S1MemUnch: "|- [RNext rmCh mm ires p]_(m p) & $(S1 rmhist p) --> unchanged (m p)"
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   348
  using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   349
  by (auto elim!: squareE [temp_use] dest!: Memoryidle [temp_use] simp: S_def S1_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   350
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   351
lemma S1Hist: "|- [HNext rmhist p]_(c p,r p,m p,rmhist!p) & $(S1 rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   352
         --> unchanged (rmhist!p)"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   353
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm HNext_def}, @{thm S_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   354
    @{thm S1_def}, @{thm MemReturn_def}, @{thm RPCFail_def}, @{thm MClkReply_def},
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   355
    @{thm Return_def}]) [] [temp_use @{context} @{thm squareE}] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   356
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   357
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   358
(* ------------------------------ State S2 ---------------------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   359
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   360
lemma S2EnvUnch: "|- [ENext p]_(e p) & $(S2 rmhist p) --> unchanged (e p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   361
  by (auto dest!: Envbusy [temp_use] simp: S_def S2_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   362
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   363
lemma S2Clerk: "|- MClkNext memCh crCh cst p & $(S2 rmhist p) --> MClkFwd memCh crCh cst p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   364
  by (auto simp: MClkNext_def MClkRetry_def MClkReply_def S_def S2_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   365
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   366
lemma S2Forward: "|- $(S2 rmhist p) & MClkFwd memCh crCh cst p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   367
         & unchanged (e p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   368
         --> (S3 rmhist p)$"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   369
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm MClkFwd_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   370
    @{thm Call_def}, @{thm e_def}, @{thm r_def}, @{thm m_def}, @{thm caller_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   371
    @{thm rtrner_def}, @{thm S_def}, @{thm S2_def}, @{thm S3_def}, @{thm Calling_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   372
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   373
lemma S2RPCUnch: "|- [RPCNext crCh rmCh rst p]_(r p) & $(S2 rmhist p) --> unchanged (r p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   374
  by (auto simp: S_def S2_def dest!: RPCidle [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   375
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   376
lemma S2MemUnch: "|- [RNext rmCh mm ires p]_(m p) & $(S2 rmhist p) --> unchanged (m p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   377
  by (auto simp: S_def S2_def dest!: Memoryidle [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   378
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   379
lemma S2Hist: "|- [HNext rmhist p]_(c p,r p,m p,rmhist!p) & $(S2 rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   380
         --> unchanged (rmhist!p)"
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   381
  using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   382
  by (auto elim!: squareE [temp_use] simp: HNext_def MemReturn_def RPCFail_def
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   383
    MClkReply_def Return_def S_def S2_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   384
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   385
(* ------------------------------ State S3 ---------------------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   386
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   387
lemma S3EnvUnch: "|- [ENext p]_(e p) & $(S3 rmhist p) --> unchanged (e p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   388
  by (auto dest!: Envbusy [temp_use] simp: S_def S3_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   389
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   390
lemma S3ClerkUnch: "|- [MClkNext memCh crCh cst p]_(c p) & $(S3 rmhist p) --> unchanged (c p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   391
  by (auto dest!: MClkbusy [temp_use] simp: square_def S_def S3_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   392
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   393
lemma S3LegalRcvArg: "|- S3 rmhist p --> IsLegalRcvArg<arg<crCh!p>>"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   394
  by (auto simp: IsLegalRcvArg_def MClkRelayArg_def S_def S3_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   395
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   396
lemma S3RPC: "|- RPCNext crCh rmCh rst p & $(S3 rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   397
         --> RPCFwd crCh rmCh rst p | RPCFail crCh rmCh rst p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   398
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   399
  apply (frule S3LegalRcvArg [action_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   400
  apply (auto simp: RPCNext_def RPCReject_def RPCReply_def S_def S3_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   401
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   402
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   403
lemma S3Forward: "|- RPCFwd crCh rmCh rst p & HNext rmhist p & $(S3 rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   404
         & unchanged (e p, c p, m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   405
         --> (S4 rmhist p)$ & unchanged (rmhist!p)"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   406
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm RPCFwd_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   407
    @{thm HNext_def}, @{thm MemReturn_def}, @{thm RPCFail_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   408
    @{thm MClkReply_def}, @{thm Return_def}, @{thm Call_def}, @{thm e_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   409
    @{thm c_def}, @{thm m_def}, @{thm caller_def}, @{thm rtrner_def}, @{thm S_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   410
    @{thm S3_def}, @{thm S4_def}, @{thm Calling_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   411
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   412
lemma S3Fail: "|- RPCFail crCh rmCh rst p & $(S3 rmhist p) & HNext rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   413
         & unchanged (e p, c p, m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   414
         --> (S6 rmhist p)$"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   415
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm HNext_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   416
    @{thm RPCFail_def}, @{thm Return_def}, @{thm e_def}, @{thm c_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   417
    @{thm m_def}, @{thm caller_def}, @{thm rtrner_def}, @{thm MVOKBARF_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   418
    @{thm S_def}, @{thm S3_def}, @{thm S6_def}, @{thm Calling_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   419
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   420
lemma S3MemUnch: "|- [RNext rmCh mm ires p]_(m p) & $(S3 rmhist p) --> unchanged (m p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   421
  by (auto simp: S_def S3_def dest!: Memoryidle [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   422
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   423
lemma S3Hist: "|- HNext rmhist p & $(S3 rmhist p) & unchanged (r p) --> unchanged (rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   424
  by (auto simp: HNext_def MemReturn_def RPCFail_def MClkReply_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   425
    Return_def r_def rtrner_def S_def S3_def Calling_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   426
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   427
(* ------------------------------ State S4 ---------------------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   428
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   429
lemma S4EnvUnch: "|- [ENext p]_(e p) & $(S4 rmhist p) --> unchanged (e p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   430
  by (auto simp: S_def S4_def dest!: Envbusy [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   431
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   432
lemma S4ClerkUnch: "|- [MClkNext memCh crCh cst p]_(c p) & $(S4 rmhist p) --> unchanged (c p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   433
  by (auto simp: S_def S4_def dest!: MClkbusy [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   434
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   435
lemma S4RPCUnch: "|- [RPCNext crCh rmCh rst p]_(r p) & $(S4 rmhist p) --> unchanged (r p)"
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   436
  using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   437
  by (auto elim!: squareE [temp_use] dest!: RPCbusy [temp_use] simp: S_def S4_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   438
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   439
lemma S4ReadInner: "|- ReadInner rmCh mm ires p l & $(S4 rmhist p) & unchanged (e p, c p, r p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   440
         & HNext rmhist p & $(MemInv mm l)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   441
         --> (S4 rmhist p)$ & unchanged (rmhist!p)"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   442
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm ReadInner_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   443
    @{thm GoodRead_def}, @{thm BadRead_def}, @{thm HNext_def}, @{thm MemReturn_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   444
    @{thm RPCFail_def}, @{thm MClkReply_def}, @{thm Return_def}, @{thm e_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   445
    @{thm c_def}, @{thm r_def}, @{thm rtrner_def}, @{thm caller_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   446
    @{thm MVNROKBA_def}, @{thm S_def}, @{thm S4_def}, @{thm RdRequest_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   447
    @{thm Calling_def}, @{thm MemInv_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   448
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   449
lemma S4Read: "|- Read rmCh mm ires p & $(S4 rmhist p) & unchanged (e p, c p, r p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   450
         & HNext rmhist p & (!l. $MemInv mm l)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   451
         --> (S4 rmhist p)$ & unchanged (rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   452
  by (auto simp: Read_def dest!: S4ReadInner [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   453
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   454
lemma S4WriteInner: "|- WriteInner rmCh mm ires p l v & $(S4 rmhist p) & unchanged (e p, c p, r p)           & HNext rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   455
         --> (S4 rmhist p)$ & unchanged (rmhist!p)"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   456
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm WriteInner_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   457
    @{thm GoodWrite_def}, @{thm BadWrite_def}, @{thm HNext_def}, @{thm MemReturn_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   458
    @{thm RPCFail_def}, @{thm MClkReply_def}, @{thm Return_def}, @{thm e_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   459
    @{thm c_def}, @{thm r_def}, @{thm rtrner_def}, @{thm caller_def}, @{thm MVNROKBA_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   460
    @{thm S_def}, @{thm S4_def}, @{thm WrRequest_def}, @{thm Calling_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   461
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   462
lemma S4Write: "|- Write rmCh mm ires p l & $(S4 rmhist p) & unchanged (e p, c p, r p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   463
         & (HNext rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   464
         --> (S4 rmhist p)$ & unchanged (rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   465
  by (auto simp: Write_def dest!: S4WriteInner [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   466
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   467
lemma WriteS4: "|- $ImpInv rmhist p & Write rmCh mm ires p l --> $S4 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   468
  by (auto simp: Write_def WriteInner_def ImpInv_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   469
    WrRequest_def S_def S1_def S2_def S3_def S4_def S5_def S6_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   470
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   471
lemma S4Return: "|- MemReturn rmCh ires p & $S4 rmhist p & unchanged (e p, c p, r p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   472
         & HNext rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   473
         --> (S5 rmhist p)$"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   474
  by (auto simp: HNext_def MemReturn_def Return_def e_def c_def r_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   475
    rtrner_def caller_def MVNROKBA_def MVOKBA_def S_def S4_def S5_def Calling_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   476
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   477
lemma S4Hist: "|- HNext rmhist p & $S4 rmhist p & (m p)$ = $(m p) --> (rmhist!p)$ = $(rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   478
  by (auto simp: HNext_def MemReturn_def RPCFail_def MClkReply_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   479
    Return_def m_def rtrner_def S_def S4_def Calling_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   480
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   481
(* ------------------------------ State S5 ---------------------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   482
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   483
lemma S5EnvUnch: "|- [ENext p]_(e p) & $(S5 rmhist p) --> unchanged (e p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   484
  by (auto simp: S_def S5_def dest!: Envbusy [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   485
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   486
lemma S5ClerkUnch: "|- [MClkNext memCh crCh cst p]_(c p) & $(S5 rmhist p) --> unchanged (c p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   487
  by (auto simp: S_def S5_def dest!: MClkbusy [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   488
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   489
lemma S5RPC: "|- RPCNext crCh rmCh rst p & $(S5 rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   490
         --> RPCReply crCh rmCh rst p | RPCFail crCh rmCh rst p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   491
  by (auto simp: RPCNext_def RPCReject_def RPCFwd_def S_def S5_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   492
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   493
lemma S5Reply: "|- RPCReply crCh rmCh rst p & $(S5 rmhist p) & unchanged (e p, c p, m p,rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   494
       --> (S6 rmhist p)$"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   495
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm RPCReply_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   496
    @{thm Return_def}, @{thm e_def}, @{thm c_def}, @{thm m_def}, @{thm MVOKBA_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   497
    @{thm MVOKBARF_def}, @{thm caller_def}, @{thm rtrner_def}, @{thm S_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   498
    @{thm S5_def}, @{thm S6_def}, @{thm Calling_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   499
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   500
lemma S5Fail: "|- RPCFail crCh rmCh rst p & $(S5 rmhist p) & unchanged (e p, c p, m p,rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   501
         --> (S6 rmhist p)$"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   502
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm RPCFail_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   503
    @{thm Return_def}, @{thm e_def}, @{thm c_def}, @{thm m_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   504
    @{thm MVOKBARF_def}, @{thm caller_def}, @{thm rtrner_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   505
    @{thm S_def}, @{thm S5_def}, @{thm S6_def}, @{thm Calling_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   506
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   507
lemma S5MemUnch: "|- [RNext rmCh mm ires p]_(m p) & $(S5 rmhist p) --> unchanged (m p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   508
  by (auto simp: S_def S5_def dest!: Memoryidle [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   509
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   510
lemma S5Hist: "|- [HNext rmhist p]_(c p, r p, m p, rmhist!p) & $(S5 rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   511
         --> (rmhist!p)$ = $(rmhist!p)"
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   512
  using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   513
  by (auto elim!: squareE [temp_use] simp: HNext_def MemReturn_def RPCFail_def
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   514
    MClkReply_def Return_def S_def S5_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   515
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   516
(* ------------------------------ State S6 ---------------------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   517
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   518
lemma S6EnvUnch: "|- [ENext p]_(e p) & $(S6 rmhist p) --> unchanged (e p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   519
  by (auto simp: S_def S6_def dest!: Envbusy [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   520
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   521
lemma S6Clerk: "|- MClkNext memCh crCh cst p & $(S6 rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   522
         --> MClkRetry memCh crCh cst p | MClkReply memCh crCh cst p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   523
  by (auto simp: MClkNext_def MClkFwd_def S_def S6_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   524
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   525
lemma S6Retry: "|- MClkRetry memCh crCh cst p & HNext rmhist p & $S6 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   526
         & unchanged (e p,r p,m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   527
         --> (S3 rmhist p)$ & unchanged (rmhist!p)"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   528
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm HNext_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   529
    @{thm MClkReply_def}, @{thm MClkRetry_def}, @{thm Call_def}, @{thm Return_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   530
    @{thm e_def}, @{thm r_def}, @{thm m_def}, @{thm caller_def}, @{thm rtrner_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   531
    @{thm S_def}, @{thm S6_def}, @{thm S3_def}, @{thm Calling_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   532
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   533
lemma S6Reply: "|- MClkReply memCh crCh cst p & HNext rmhist p & $S6 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   534
         & unchanged (e p,r p,m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   535
         --> (S1 rmhist p)$"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   536
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm HNext_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   537
    @{thm MemReturn_def}, @{thm RPCFail_def}, @{thm Return_def}, @{thm MClkReply_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   538
    @{thm e_def}, @{thm r_def}, @{thm m_def}, @{thm caller_def}, @{thm rtrner_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   539
    @{thm S_def}, @{thm S6_def}, @{thm S1_def}, @{thm Calling_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   540
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   541
lemma S6RPCUnch: "|- [RPCNext crCh rmCh rst p]_(r p) & $S6 rmhist p --> unchanged (r p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   542
  by (auto simp: S_def S6_def dest!: RPCidle [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   543
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   544
lemma S6MemUnch: "|- [RNext rmCh mm ires p]_(m p) & $(S6 rmhist p) --> unchanged (m p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   545
  by (auto simp: S_def S6_def dest!: Memoryidle [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   546
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   547
lemma S6Hist: "|- HNext rmhist p & $S6 rmhist p & (c p)$ = $(c p) --> (rmhist!p)$ = $(rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   548
  by (auto simp: HNext_def MClkReply_def Return_def c_def rtrner_def S_def S6_def Calling_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   549
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   550
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   551
section "Correctness of predicate-action diagram"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   552
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   553
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   554
(* ========== Step 1.1 ================================================= *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   555
(* The implementation's initial condition implies the state predicate S1 *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   556
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   557
lemma Step1_1: "|- ImpInit p & HInit rmhist p --> S1 rmhist p"
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   558
  using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   559
  by (auto elim!: squareE [temp_use] simp: MVNROKBA_def
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   560
    MClkInit_def RPCInit_def PInit_def HInit_def ImpInit_def S_def S1_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   561
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   562
(* ========== Step 1.2 ================================================== *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   563
(* Figure 16 is a predicate-action diagram for the implementation. *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   564
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   565
lemma Step1_2_1: "|- [HNext rmhist p]_(c p,r p,m p, rmhist!p) & ImpNext p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   566
         & ~unchanged (e p, c p, r p, m p, rmhist!p)  & $S1 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   567
         --> (S2 rmhist p)$ & ENext p & unchanged (c p, r p, m p)"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   568
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm ImpNext_def}]) []
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   569
      (map (temp_elim @{context})
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   570
        [@{thm S1ClerkUnch}, @{thm S1RPCUnch}, @{thm S1MemUnch}, @{thm S1Hist}]) 1 *})
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   571
   using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   572
   apply (auto elim!: squareE [temp_use] intro!: S1Env [temp_use])
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   573
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   574
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   575
lemma Step1_2_2: "|- [HNext rmhist p]_(c p,r p,m p, rmhist!p) & ImpNext p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   576
         & ~unchanged (e p, c p, r p, m p, rmhist!p) & $S2 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   577
         --> (S3 rmhist p)$ & MClkFwd memCh crCh cst p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   578
             & unchanged (e p, r p, m p, rmhist!p)"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   579
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm ImpNext_def}]) []
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   580
    (map (temp_elim @{context})
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   581
      [@{thm S2EnvUnch}, @{thm S2RPCUnch}, @{thm S2MemUnch}, @{thm S2Hist}]) 1 *})
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   582
   using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   583
   apply (auto elim!: squareE [temp_use] intro!: S2Clerk [temp_use] S2Forward [temp_use])
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   584
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   585
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   586
lemma Step1_2_3: "|- [HNext rmhist p]_(c p,r p,m p, rmhist!p) & ImpNext p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   587
         & ~unchanged (e p, c p, r p, m p, rmhist!p) & $S3 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   588
         --> ((S4 rmhist p)$ & RPCFwd crCh rmCh rst p & unchanged (e p, c p, m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   589
             | ((S6 rmhist p)$ & RPCFail crCh rmCh rst p & unchanged (e p, c p, m p))"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   590
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm ImpNext_def}]) []
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   591
    (map (temp_elim @{context}) [@{thm S3EnvUnch}, @{thm S3ClerkUnch}, @{thm S3MemUnch}]) 1 *})
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   592
  apply (tactic {* action_simp_tac @{context} []
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   593
    (@{thm squareE} ::
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   594
      map (temp_elim @{context}) [@{thm S3RPC}, @{thm S3Forward}, @{thm S3Fail}]) 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   595
   apply (auto dest!: S3Hist [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   596
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   597
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   598
lemma Step1_2_4: "|- [HNext rmhist p]_(c p,r p,m p, rmhist!p) & ImpNext p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   599
              & ~unchanged (e p, c p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   600
              & $S4 rmhist p & (!l. $(MemInv mm l))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   601
         --> ((S4 rmhist p)$ & Read rmCh mm ires p & unchanged (e p, c p, r p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   602
             | ((S4 rmhist p)$ & (? l. Write rmCh mm ires p l) & unchanged (e p, c p, r p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   603
             | ((S5 rmhist p)$ & MemReturn rmCh ires p & unchanged (e p, c p, r p))"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   604
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm ImpNext_def}]) []
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   605
    (map (temp_elim @{context}) [@{thm S4EnvUnch}, @{thm S4ClerkUnch}, @{thm S4RPCUnch}]) 1 *})
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   606
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm RNext_def}]) []
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   607
    (@{thm squareE} ::
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   608
      map (temp_elim @{context}) [@{thm S4Read}, @{thm S4Write}, @{thm S4Return}]) 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   609
  apply (auto dest!: S4Hist [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   610
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   611
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   612
lemma Step1_2_5: "|- [HNext rmhist p]_(c p,r p,m p, rmhist!p) & ImpNext p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   613
              & ~unchanged (e p, c p, r p, m p, rmhist!p) & $S5 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   614
         --> ((S6 rmhist p)$ & RPCReply crCh rmCh rst p & unchanged (e p, c p, m p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   615
             | ((S6 rmhist p)$ & RPCFail crCh rmCh rst p & unchanged (e p, c p, m p))"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   616
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm ImpNext_def}]) []
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   617
    (map (temp_elim @{context}) [@{thm S5EnvUnch}, @{thm S5ClerkUnch}, @{thm S5MemUnch}, @{thm S5Hist}]) 1 *})
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   618
  apply (tactic {* action_simp_tac @{context} [] [@{thm squareE}, temp_elim @{context} @{thm S5RPC}] 1 *})
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   619
   using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   620
   apply (auto elim!: squareE [temp_use] dest!: S5Reply [temp_use] S5Fail [temp_use])
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   621
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   622
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   623
lemma Step1_2_6: "|- [HNext rmhist p]_(c p,r p,m p, rmhist!p) & ImpNext p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   624
              & ~unchanged (e p, c p, r p, m p, rmhist!p) & $S6 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   625
         --> ((S1 rmhist p)$ & MClkReply memCh crCh cst p & unchanged (e p, r p, m p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   626
             | ((S3 rmhist p)$ & MClkRetry memCh crCh cst p & unchanged (e p,r p,m p,rmhist!p))"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   627
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm ImpNext_def}]) []
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   628
    (map (temp_elim @{context}) [@{thm S6EnvUnch}, @{thm S6RPCUnch}, @{thm S6MemUnch}]) 1 *})
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   629
  apply (tactic {* action_simp_tac @{context} []
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   630
    (@{thm squareE} :: map (temp_elim @{context}) [@{thm S6Clerk}, @{thm S6Retry}, @{thm S6Reply}]) 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   631
     apply (auto dest: S6Hist [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   632
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   633
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   634
(* --------------------------------------------------------------------------
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   635
   Step 1.3: S1 implies the barred initial condition.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   636
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   637
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   638
section "Initialization (Step 1.3)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   639
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   640
lemma Step1_3: "|- S1 rmhist p --> PInit (resbar rmhist) p"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   641
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm resbar_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   642
    @{thm PInit_def}, @{thm S_def}, @{thm S1_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   643
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   644
(* ----------------------------------------------------------------------
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   645
   Step 1.4: Implementation's next-state relation simulates specification's
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   646
             next-state relation (with appropriate substitutions)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   647
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   648
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   649
section "Step simulation (Step 1.4)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   650
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   651
lemma Step1_4_1: "|- ENext p & $S1 rmhist p & (S2 rmhist p)$ & unchanged (c p, r p, m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   652
         --> unchanged (rtrner memCh!p, resbar rmhist!p)"
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   653
  using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   654
  by (auto elim!: squareE [temp_use] simp: c_def r_def m_def resbar_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   655
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   656
lemma Step1_4_2: "|- MClkFwd memCh crCh cst p & $S2 rmhist p & (S3 rmhist p)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   657
         & unchanged (e p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   658
         --> unchanged (rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   659
  by (tactic {* action_simp_tac
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   660
    (@{context} addsimps [@{thm MClkFwd_def}, @{thm e_def}, @{thm r_def}, @{thm m_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   661
    @{thm resbar_def}, @{thm S_def}, @{thm S2_def}, @{thm S3_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   662
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   663
lemma Step1_4_3a: "|- RPCFwd crCh rmCh rst p & $S3 rmhist p & (S4 rmhist p)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   664
         & unchanged (e p, c p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   665
         --> unchanged (rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   666
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   667
  apply (drule S3_excl [temp_use] S4_excl [temp_use])+
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   668
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm e_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   669
    @{thm c_def}, @{thm m_def}, @{thm resbar_def}, @{thm S_def}, @{thm S3_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   670
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   671
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   672
lemma Step1_4_3b: "|- RPCFail crCh rmCh rst p & $S3 rmhist p & (S6 rmhist p)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   673
         & unchanged (e p, c p, m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   674
         --> MemFail memCh (resbar rmhist) p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   675
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   676
  apply (drule S6_excl [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   677
  apply (auto simp: RPCFail_def MemFail_def e_def c_def m_def resbar_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   678
    apply (force simp: S3_def S_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   679
   apply (auto simp: Return_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   680
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   681
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   682
lemma Step1_4_4a1: "|- $S4 rmhist p & (S4 rmhist p)$ & ReadInner rmCh mm ires p l
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   683
         & unchanged (e p, c p, r p, rmhist!p) & $MemInv mm l
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   684
         --> ReadInner memCh mm (resbar rmhist) p l"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   685
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   686
  apply (drule S4_excl [temp_use])+
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   687
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm ReadInner_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   688
    @{thm GoodRead_def}, @{thm BadRead_def}, @{thm e_def}, @{thm c_def}, @{thm m_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   689
     apply (auto simp: resbar_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   690
       apply (tactic {* ALLGOALS (action_simp_tac
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   691
                (@{context} addsimps [@{thm RPCRelayArg_def}, @{thm MClkRelayArg_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   692
                  @{thm S_def}, @{thm S4_def}, @{thm RdRequest_def}, @{thm MemInv_def}])
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   693
                [] [@{thm impE}, @{thm MemValNotAResultE}]) *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   694
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   695
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   696
lemma Step1_4_4a: "|- Read rmCh mm ires p & $S4 rmhist p & (S4 rmhist p)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   697
         & unchanged (e p, c p, r p, rmhist!p) & (!l. $(MemInv mm l))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   698
         --> Read memCh mm (resbar rmhist) p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   699
  by (force simp: Read_def elim!: Step1_4_4a1 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   700
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   701
lemma Step1_4_4b1: "|- $S4 rmhist p & (S4 rmhist p)$ & WriteInner rmCh mm ires p l v
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   702
         & unchanged (e p, c p, r p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   703
         --> WriteInner memCh mm (resbar rmhist) p l v"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   704
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   705
  apply (drule S4_excl [temp_use])+
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   706
  apply (tactic {* action_simp_tac (@{context} addsimps
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   707
    [@{thm WriteInner_def}, @{thm GoodWrite_def}, @{thm BadWrite_def}, @{thm e_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   708
    @{thm c_def}, @{thm m_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   709
     apply (auto simp: resbar_def)
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   710
    apply (tactic {* ALLGOALS (action_simp_tac (@{context} addsimps
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   711
      [@{thm RPCRelayArg_def}, @{thm MClkRelayArg_def}, @{thm S_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   712
      @{thm S4_def}, @{thm WrRequest_def}]) [] []) *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   713
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   714
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   715
lemma Step1_4_4b: "|- Write rmCh mm ires p l & $S4 rmhist p & (S4 rmhist p)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   716
         & unchanged (e p, c p, r p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   717
         --> Write memCh mm (resbar rmhist) p l"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   718
  by (force simp: Write_def elim!: Step1_4_4b1 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   719
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   720
lemma Step1_4_4c: "|- MemReturn rmCh ires p & $S4 rmhist p & (S5 rmhist p)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   721
         & unchanged (e p, c p, r p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   722
         --> unchanged (rtrner memCh!p, resbar rmhist!p)"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   723
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm e_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   724
    @{thm c_def}, @{thm r_def}, @{thm resbar_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   725
  apply (drule S4_excl [temp_use] S5_excl [temp_use])+
42771
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   726
  using [[fast_solver]]
b6037ae5027d eliminated old-style MI_fast_css -- replaced by fast_solver with config option;
wenzelm
parents: 42770
diff changeset
   727
  apply (auto elim!: squareE [temp_use] simp: MemReturn_def Return_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   728
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   729
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   730
lemma Step1_4_5a: "|- RPCReply crCh rmCh rst p & $S5 rmhist p & (S6 rmhist p)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   731
         & unchanged (e p, c p, m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   732
         --> unchanged (rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   733
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   734
  apply (drule S5_excl [temp_use] S6_excl [temp_use])+
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   735
  apply (auto simp: e_def c_def m_def resbar_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   736
   apply (auto simp: RPCReply_def Return_def S5_def S_def dest!: MVOKBAnotRF [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   737
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   738
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   739
lemma Step1_4_5b: "|- RPCFail crCh rmCh rst p & $S5 rmhist p & (S6 rmhist p)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   740
         & unchanged (e p, c p, m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   741
         --> MemFail memCh (resbar rmhist) p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   742
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   743
  apply (drule S6_excl [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   744
  apply (auto simp: e_def c_def m_def RPCFail_def Return_def MemFail_def resbar_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   745
   apply (auto simp: S5_def S_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   746
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   747
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   748
lemma Step1_4_6a: "|- MClkReply memCh crCh cst p & $S6 rmhist p & (S1 rmhist p)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   749
         & unchanged (e p, r p, m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   750
         --> MemReturn memCh (resbar rmhist) p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   751
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   752
  apply (drule S6_excl [temp_use])+
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   753
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm e_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   754
    @{thm r_def}, @{thm m_def}, @{thm MClkReply_def}, @{thm MemReturn_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   755
    @{thm Return_def}, @{thm resbar_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   756
    apply simp_all (* simplify if-then-else *)
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   757
    apply (tactic {* ALLGOALS (action_simp_tac (@{context} addsimps
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   758
      [@{thm MClkReplyVal_def}, @{thm S6_def}, @{thm S_def}]) [] [@{thm MVOKBARFnotNR}]) *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   759
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   760
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   761
lemma Step1_4_6b: "|- MClkRetry memCh crCh cst p & $S6 rmhist p & (S3 rmhist p)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   762
         & unchanged (e p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   763
         --> MemFail memCh (resbar rmhist) p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   764
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   765
  apply (drule S3_excl [temp_use])+
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   766
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm e_def}, @{thm r_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   767
    @{thm m_def}, @{thm MClkRetry_def}, @{thm MemFail_def}, @{thm resbar_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   768
   apply (auto simp: S6_def S_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   769
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   770
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   771
lemma S_lemma: "|- unchanged (e p, c p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   772
         --> unchanged (S rmhist ec cc rc cs rs hs1 hs2 p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   773
  by (auto simp: e_def c_def r_def m_def caller_def rtrner_def S_def Calling_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   774
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   775
lemma Step1_4_7H: "|- unchanged (e p, c p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   776
         --> unchanged (rtrner memCh!p, S1 rmhist p, S2 rmhist p, S3 rmhist p,
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   777
                        S4 rmhist p, S5 rmhist p, S6 rmhist p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   778
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   779
  apply (rule conjI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   780
   apply (force simp: c_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   781
  apply (force simp: S1_def S2_def S3_def S4_def S5_def S6_def intro!: S_lemma [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   782
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   783
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   784
lemma Step1_4_7: "|- unchanged (e p, c p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   785
         --> unchanged (rtrner memCh!p, resbar rmhist!p, S1 rmhist p, S2 rmhist p,
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   786
                        S3 rmhist p, S4 rmhist p, S5 rmhist p, S6 rmhist p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   787
  apply (rule actionI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   788
  apply (unfold action_rews)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   789
  apply (rule impI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   790
  apply (frule Step1_4_7H [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   791
  apply (auto simp: e_def c_def r_def m_def rtrner_def resbar_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   792
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   793
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   794
(* Frequently needed abbreviation: distinguish between idling and non-idling
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   795
   steps of the implementation, and try to solve the idling case by simplification
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   796
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   797
ML {*
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   798
fun split_idle_tac ctxt =
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   799
  SELECT_GOAL
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   800
   (TRY (rtac @{thm actionI} 1) THEN
45133
2214ba5bdfff modernized structure Induct_Tacs;
wenzelm
parents: 43596
diff changeset
   801
    Induct_Tacs.case_tac ctxt "(s,t) |= unchanged (e p, c p, r p, m p, rmhist!p)" 1 THEN
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   802
    rewrite_goals_tac ctxt @{thms action_rews} THEN
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   803
    forward_tac [temp_use ctxt @{thm Step1_4_7}] 1 THEN
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   804
    asm_full_simp_tac ctxt 1);
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   805
*}
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   806
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   807
method_setup split_idle = {*
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   808
  Method.sections (Simplifier.simp_modifiers @ Splitter.split_modifiers)
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   809
    >> (K (SIMPLE_METHOD' o split_idle_tac))
42814
5af15f1e2ef6 simplified/unified method_setup/attribute_setup;
wenzelm
parents: 42786
diff changeset
   810
*}
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   811
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   812
(* ----------------------------------------------------------------------
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   813
   Combine steps 1.2 and 1.4 to prove that the implementation satisfies
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   814
   the specification's next-state relation.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   815
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   816
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   817
(* Steps that leave all variables unchanged are safe, so I may assume
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   818
   that some variable changes in the proof that a step is safe. *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   819
lemma unchanged_safe: "|- (~unchanged (e p, c p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   820
             --> [UNext memCh mm (resbar rmhist) p]_(rtrner memCh!p, resbar rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   821
         --> [UNext memCh mm (resbar rmhist) p]_(rtrner memCh!p, resbar rmhist!p)"
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   822
  apply (split_idle simp: square_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   823
  apply force
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   824
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   825
(* turn into (unsafe, looping!) introduction rule *)
45605
a89b4bc311a5 eliminated obsolete "standard";
wenzelm
parents: 45133
diff changeset
   826
lemmas unchanged_safeI = impI [THEN unchanged_safe [action_use]]
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   827
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   828
lemma S1safe: "|- $S1 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   829
         --> [UNext memCh mm (resbar rmhist) p]_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   830
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   831
  apply (rule unchanged_safeI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   832
  apply (rule idle_squareI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   833
  apply (auto dest!: Step1_2_1 [temp_use] Step1_4_1 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   834
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   835
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   836
lemma S2safe: "|- $S2 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   837
         --> [UNext memCh mm (resbar rmhist) p]_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   838
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   839
  apply (rule unchanged_safeI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   840
  apply (rule idle_squareI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   841
  apply (auto dest!: Step1_2_2 [temp_use] Step1_4_2 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   842
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   843
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   844
lemma S3safe: "|- $S3 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   845
         --> [UNext memCh mm (resbar rmhist) p]_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   846
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   847
  apply (rule unchanged_safeI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   848
  apply (auto dest!: Step1_2_3 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   849
  apply (auto simp: square_def UNext_def dest!: Step1_4_3a [temp_use] Step1_4_3b [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   850
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   851
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   852
lemma S4safe: "|- $S4 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   853
         & (!l. $(MemInv mm l))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   854
         --> [UNext memCh mm (resbar rmhist) p]_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   855
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   856
  apply (rule unchanged_safeI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   857
  apply (auto dest!: Step1_2_4 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   858
     apply (auto simp: square_def UNext_def RNext_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   859
       dest!: Step1_4_4a [temp_use] Step1_4_4b [temp_use] Step1_4_4c [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   860
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   861
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   862
lemma S5safe: "|- $S5 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   863
         --> [UNext memCh mm (resbar rmhist) p]_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   864
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   865
  apply (rule unchanged_safeI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   866
  apply (auto dest!: Step1_2_5 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   867
  apply (auto simp: square_def UNext_def dest!: Step1_4_5a [temp_use] Step1_4_5b [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   868
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   869
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   870
lemma S6safe: "|- $S6 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   871
         --> [UNext memCh mm (resbar rmhist) p]_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   872
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   873
  apply (rule unchanged_safeI)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   874
  apply (auto dest!: Step1_2_6 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   875
    apply (auto simp: square_def UNext_def RNext_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   876
      dest!: Step1_4_6a [temp_use] Step1_4_6b [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   877
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   878
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   879
(* ----------------------------------------------------------------------
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   880
   Step 1.5: Temporal refinement proof, based on previous steps.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   881
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   882
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   883
section "The liveness part"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   884
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   885
(* Liveness assertions for the different implementation states, based on the
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   886
   fairness conditions. Prove subgoals of WF1 / SF1 rules as separate lemmas
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   887
   for readability. Reuse action proofs from safety part.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   888
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   889
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   890
(* ------------------------------ State S1 ------------------------------ *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   891
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   892
lemma S1_successors: "|- $S1 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   893
         --> (S1 rmhist p)$ | (S2 rmhist p)$"
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   894
  apply split_idle
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   895
  apply (auto dest!: Step1_2_1 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   896
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   897
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   898
(* Show that the implementation can satisfy the high-level fairness requirements
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   899
   by entering the state S1 infinitely often.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   900
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   901
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   902
lemma S1_RNextdisabled: "|- S1 rmhist p -->
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   903
         ~Enabled (<RNext memCh mm (resbar rmhist) p>_(rtrner memCh!p, resbar rmhist!p))"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   904
  apply (tactic {* action_simp_tac (@{context} addsimps [@{thm angle_def},
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
   905
    @{thm S_def}, @{thm S1_def}]) [notI] [@{thm enabledE}, temp_elim @{context} @{thm Memoryidle}] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   906
  apply force
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   907
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   908
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   909
lemma S1_Returndisabled: "|- S1 rmhist p -->
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   910
         ~Enabled (<MemReturn memCh (resbar rmhist) p>_(rtrner memCh!p, resbar rmhist!p))"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   911
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm angle_def}, @{thm MemReturn_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
   912
    @{thm Return_def}, @{thm S_def}, @{thm S1_def}]) [notI] [@{thm enabledE}] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   913
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   914
lemma RNext_fair: "|- []<>S1 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   915
         --> WF(RNext memCh mm (resbar rmhist) p)_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   916
  by (auto simp: WF_alt [try_rewrite] intro!: S1_RNextdisabled [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   917
    elim!: STL4E [temp_use] DmdImplE [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   918
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   919
lemma Return_fair: "|- []<>S1 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   920
         --> WF(MemReturn memCh (resbar rmhist) p)_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   921
  by (auto simp: WF_alt [try_rewrite]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   922
    intro!: S1_Returndisabled [temp_use] elim!: STL4E [temp_use] DmdImplE [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   923
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   924
(* ------------------------------ State S2 ------------------------------ *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   925
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   926
lemma S2_successors: "|- $S2 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   927
         --> (S2 rmhist p)$ | (S3 rmhist p)$"
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   928
  apply split_idle
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   929
  apply (auto dest!: Step1_2_2 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   930
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   931
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   932
lemma S2MClkFwd_successors: "|- ($S2 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   933
         & <MClkFwd memCh crCh cst p>_(c p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   934
         --> (S3 rmhist p)$"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   935
  by (auto simp: angle_def dest!: Step1_2_2 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   936
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   937
lemma S2MClkFwd_enabled: "|- $S2 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   938
         --> $Enabled (<MClkFwd memCh crCh cst p>_(c p))"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   939
  apply (auto simp: c_def intro!: MClkFwd_ch_enabled [temp_use] MClkFwd_enabled [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   940
     apply (cut_tac MI_base)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   941
     apply (blast dest: base_pair)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   942
    apply (simp_all add: S_def S2_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   943
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   944
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   945
lemma S2_live: "|- [](ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   946
         & WF(MClkFwd memCh crCh cst p)_(c p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   947
         --> (S2 rmhist p ~> S3 rmhist p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   948
  by (rule WF1 S2_successors S2MClkFwd_successors S2MClkFwd_enabled)+
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   949
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   950
(* ------------------------------ State S3 ------------------------------ *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   951
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   952
lemma S3_successors: "|- $S3 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   953
         --> (S3 rmhist p)$ | (S4 rmhist p | S6 rmhist p)$"
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   954
  apply split_idle
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   955
  apply (auto dest!: Step1_2_3 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   956
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   957
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   958
lemma S3RPC_successors: "|- ($S3 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   959
         & <RPCNext crCh rmCh rst p>_(r p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   960
         --> (S4 rmhist p | S6 rmhist p)$"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   961
  apply (auto simp: angle_def dest!: Step1_2_3 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   962
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   963
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   964
lemma S3RPC_enabled: "|- $S3 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   965
         --> $Enabled (<RPCNext crCh rmCh rst p>_(r p))"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   966
  apply (auto simp: r_def intro!: RPCFail_Next_enabled [temp_use] RPCFail_enabled [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   967
    apply (cut_tac MI_base)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   968
    apply (blast dest: base_pair)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   969
   apply (simp_all add: S_def S3_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   970
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   971
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   972
lemma S3_live: "|- [](ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   973
         & WF(RPCNext crCh rmCh rst p)_(r p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   974
         --> (S3 rmhist p ~> S4 rmhist p | S6 rmhist p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   975
  by (rule WF1 S3_successors S3RPC_successors S3RPC_enabled)+
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   976
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   977
(* ------------- State S4 -------------------------------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   978
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   979
lemma S4_successors: "|- $S4 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   980
        & (ALL l. $MemInv mm l)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   981
        --> (S4 rmhist p)$ | (S5 rmhist p)$"
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   982
  apply split_idle
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   983
  apply (auto dest!: Step1_2_4 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   984
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   985
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   986
(* --------- State S4a: S4 /\ (ires p = NotAResult) ------------------------ *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   987
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   988
lemma S4a_successors: "|- $(S4 rmhist p & ires!p = #NotAResult)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   989
         & ImpNext p & [HNext rmhist p]_(c p,r p,m p,rmhist!p) & (ALL l. $MemInv mm l)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   990
         --> (S4 rmhist p & ires!p = #NotAResult)$
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   991
             | ((S4 rmhist p & ires!p ~= #NotAResult) | S5 rmhist p)$"
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
   992
  apply split_idle
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   993
  apply (auto dest!: Step1_2_4 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   994
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   995
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   996
lemma S4aRNext_successors: "|- ($(S4 rmhist p & ires!p = #NotAResult)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   997
         & ImpNext p & [HNext rmhist p]_(c p,r p,m p,rmhist!p) & (ALL l. $MemInv mm l))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   998
         & <RNext rmCh mm ires p>_(m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
   999
         --> ((S4 rmhist p & ires!p ~= #NotAResult) | S5 rmhist p)$"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1000
  by (auto simp: angle_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1001
    dest!: Step1_2_4 [temp_use] ReadResult [temp_use] WriteResult [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1002
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1003
lemma S4aRNext_enabled: "|- $(S4 rmhist p & ires!p = #NotAResult)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1004
         & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p) & (ALL l. $MemInv mm l)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1005
         --> $Enabled (<RNext rmCh mm ires p>_(m p))"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1006
  apply (auto simp: m_def intro!: RNext_enabled [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1007
   apply (cut_tac MI_base)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1008
   apply (blast dest: base_pair)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1009
  apply (simp add: S_def S4_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1010
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1011
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1012
lemma S4a_live: "|- [](ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1013
         & (ALL l. $MemInv mm l)) & WF(RNext rmCh mm ires p)_(m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1014
         --> (S4 rmhist p & ires!p = #NotAResult
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1015
              ~> (S4 rmhist p & ires!p ~= #NotAResult) | S5 rmhist p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1016
  by (rule WF1 S4a_successors S4aRNext_successors S4aRNext_enabled)+
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1017
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1018
(* ---------- State S4b: S4 /\ (ires p # NotAResult) --------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1019
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1020
lemma S4b_successors: "|- $(S4 rmhist p & ires!p ~= #NotAResult)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1021
         & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p) & (ALL l. $MemInv mm l)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1022
         --> (S4 rmhist p & ires!p ~= #NotAResult)$ | (S5 rmhist p)$"
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
  1023
  apply (split_idle simp: m_def)
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1024
  apply (auto dest!: WriteResult [temp_use] Step1_2_4 [temp_use] ReadResult [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1025
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1026
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1027
lemma S4bReturn_successors: "|- ($(S4 rmhist p & ires!p ~= #NotAResult)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1028
         & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1029
         & (ALL l. $MemInv mm l)) & <MemReturn rmCh ires p>_(m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1030
         --> (S5 rmhist p)$"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1031
  by (force simp: angle_def dest!: Step1_2_4 [temp_use] dest: ReturnNotReadWrite [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1032
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1033
lemma S4bReturn_enabled: "|- $(S4 rmhist p & ires!p ~= #NotAResult)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1034
         & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1035
         & (ALL l. $MemInv mm l)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1036
         --> $Enabled (<MemReturn rmCh ires p>_(m p))"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1037
  apply (auto simp: m_def intro!: MemReturn_enabled [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1038
   apply (cut_tac MI_base)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1039
   apply (blast dest: base_pair)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1040
  apply (simp add: S_def S4_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1041
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1042
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1043
lemma S4b_live: "|- [](ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p) & (!l. $MemInv mm l))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1044
         & WF(MemReturn rmCh ires p)_(m p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1045
         --> (S4 rmhist p & ires!p ~= #NotAResult ~> S5 rmhist p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1046
  by (rule WF1 S4b_successors S4bReturn_successors S4bReturn_enabled)+
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1047
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1048
(* ------------------------------ State S5 ------------------------------ *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1049
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1050
lemma S5_successors: "|- $S5 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1051
         --> (S5 rmhist p)$ | (S6 rmhist p)$"
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
  1052
  apply split_idle
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1053
  apply (auto dest!: Step1_2_5 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1054
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1055
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1056
lemma S5RPC_successors: "|- ($S5 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1057
         & <RPCNext crCh rmCh rst p>_(r p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1058
         --> (S6 rmhist p)$"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1059
  by (auto simp: angle_def dest!: Step1_2_5 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1060
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1061
lemma S5RPC_enabled: "|- $S5 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1062
         --> $Enabled (<RPCNext crCh rmCh rst p>_(r p))"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1063
  apply (auto simp: r_def intro!: RPCFail_Next_enabled [temp_use] RPCFail_enabled [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1064
    apply (cut_tac MI_base)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1065
    apply (blast dest: base_pair)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1066
   apply (simp_all add: S_def S5_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1067
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1068
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1069
lemma S5_live: "|- [](ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1070
         & WF(RPCNext crCh rmCh rst p)_(r p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1071
         --> (S5 rmhist p ~> S6 rmhist p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1072
  by (rule WF1 S5_successors S5RPC_successors S5RPC_enabled)+
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1073
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1074
(* ------------------------------ State S6 ------------------------------ *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1075
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1076
lemma S6_successors: "|- $S6 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1077
         --> (S1 rmhist p)$ | (S3 rmhist p)$ | (S6 rmhist p)$"
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
  1078
  apply split_idle
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1079
  apply (auto dest!: Step1_2_6 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1080
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1081
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1082
lemma S6MClkReply_successors:
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1083
  "|- ($S6 rmhist p & ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1084
         & <MClkReply memCh crCh cst p>_(c p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1085
         --> (S1 rmhist p)$"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1086
  by (auto simp: angle_def dest!: Step1_2_6 [temp_use] MClkReplyNotRetry [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1087
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1088
lemma MClkReplyS6:
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1089
  "|- $ImpInv rmhist p & <MClkReply memCh crCh cst p>_(c p) --> $S6 rmhist p"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
  1090
  by (tactic {* action_simp_tac (@{context} addsimps [@{thm angle_def},
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
  1091
    @{thm MClkReply_def}, @{thm Return_def}, @{thm ImpInv_def}, @{thm S_def},
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
  1092
    @{thm S1_def}, @{thm S2_def}, @{thm S3_def}, @{thm S4_def}, @{thm S5_def}]) [] [] 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1093
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1094
lemma S6MClkReply_enabled: "|- S6 rmhist p --> Enabled (<MClkReply memCh crCh cst p>_(c p))"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1095
  apply (auto simp: c_def intro!: MClkReply_enabled [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1096
     apply (cut_tac MI_base)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1097
     apply (blast dest: base_pair)
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
  1098
    apply (tactic {* ALLGOALS (action_simp_tac (@{context}
39159
0dec18004e75 more antiquotations;
wenzelm
parents: 36866
diff changeset
  1099
      addsimps [@{thm S_def}, @{thm S6_def}]) [] []) *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1100
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1101
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1102
lemma S6_live: "|- [](ImpNext p & [HNext rmhist p]_(c p,r p,m p, rmhist!p) & $(ImpInv rmhist p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1103
         & SF(MClkReply memCh crCh cst p)_(c p) & []<>(S6 rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1104
         --> []<>(S1 rmhist p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1105
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1106
  apply (subgoal_tac "sigma |= []<> (<MClkReply memCh crCh cst p>_ (c p))")
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1107
   apply (erule InfiniteEnsures)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1108
    apply assumption
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
  1109
   apply (tactic {* action_simp_tac @{context} []
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
  1110
     (map (temp_elim @{context}) [@{thm MClkReplyS6}, @{thm S6MClkReply_successors}]) 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1111
  apply (auto simp: SF_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1112
  apply (erule contrapos_np)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1113
  apply (auto intro!: S6MClkReply_enabled [temp_use] elim!: STL4E [temp_use] DmdImplE [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1114
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1115
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1116
(* --------------- aggregate leadsto properties----------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1117
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1118
lemma S5S6LeadstoS6: "sigma |= S5 rmhist p ~> S6 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1119
      ==> sigma |= (S5 rmhist p | S6 rmhist p) ~> S6 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1120
  by (auto intro!: LatticeDisjunctionIntro [temp_use] LatticeReflexivity [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1121
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1122
lemma S4bS5S6LeadstoS6: "[| sigma |= S4 rmhist p & ires!p ~= #NotAResult ~> S5 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1123
         sigma |= S5 rmhist p ~> S6 rmhist p |]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1124
      ==> sigma |= (S4 rmhist p & ires!p ~= #NotAResult) | S5 rmhist p | S6 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1125
                    ~> S6 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1126
  by (auto intro!: LatticeDisjunctionIntro [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1127
    S5S6LeadstoS6 [temp_use] intro: LatticeTransitivity [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1128
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1129
lemma S4S5S6LeadstoS6: "[| sigma |= S4 rmhist p & ires!p = #NotAResult
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1130
                  ~> (S4 rmhist p & ires!p ~= #NotAResult) | S5 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1131
         sigma |= S4 rmhist p & ires!p ~= #NotAResult ~> S5 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1132
         sigma |= S5 rmhist p ~> S6 rmhist p |]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1133
      ==> sigma |= S4 rmhist p | S5 rmhist p | S6 rmhist p ~> S6 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1134
  apply (subgoal_tac "sigma |= (S4 rmhist p & ires!p = #NotAResult) |
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1135
    (S4 rmhist p & ires!p ~= #NotAResult) | S5 rmhist p | S6 rmhist p ~> S6 rmhist p")
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1136
   apply (erule_tac G = "PRED ((S4 rmhist p & ires!p = #NotAResult) |
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1137
     (S4 rmhist p & ires!p ~= #NotAResult) | S5 rmhist p | S6 rmhist p)" in
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1138
     LatticeTransitivity [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1139
   apply (force simp: Init_defs intro!: ImplLeadsto_gen [temp_use] necT [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1140
  apply (rule LatticeDisjunctionIntro [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1141
   apply (erule LatticeTransitivity [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1142
   apply (erule LatticeTriangle2 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1143
   apply assumption
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1144
  apply (auto intro!: S4bS5S6LeadstoS6 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1145
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1146
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1147
lemma S3S4S5S6LeadstoS6: "[| sigma |= S3 rmhist p ~> S4 rmhist p | S6 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1148
         sigma |= S4 rmhist p & ires!p = #NotAResult
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1149
                  ~> (S4 rmhist p & ires!p ~= #NotAResult) | S5 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1150
         sigma |= S4 rmhist p & ires!p ~= #NotAResult ~> S5 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1151
         sigma |= S5 rmhist p ~> S6 rmhist p |]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1152
      ==> sigma |= S3 rmhist p | S4 rmhist p | S5 rmhist p | S6 rmhist p ~> S6 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1153
  apply (rule LatticeDisjunctionIntro [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1154
   apply (erule LatticeTriangle2 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1155
   apply (rule S4S5S6LeadstoS6 [THEN LatticeTransitivity [temp_use]])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1156
      apply (auto intro!: S4S5S6LeadstoS6 [temp_use] necT [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1157
        intro: ImplLeadsto_gen [temp_use] simp: Init_defs)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1158
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1159
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1160
lemma S2S3S4S5S6LeadstoS6: "[| sigma |= S2 rmhist p ~> S3 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1161
         sigma |= S3 rmhist p ~> S4 rmhist p | S6 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1162
         sigma |= S4 rmhist p & ires!p = #NotAResult
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1163
                  ~> S4 rmhist p & ires!p ~= #NotAResult | S5 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1164
         sigma |= S4 rmhist p & ires!p ~= #NotAResult ~> S5 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1165
         sigma |= S5 rmhist p ~> S6 rmhist p |]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1166
      ==> sigma |= S2 rmhist p | S3 rmhist p | S4 rmhist p | S5 rmhist p | S6 rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1167
                   ~> S6 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1168
  apply (rule LatticeDisjunctionIntro [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1169
   apply (rule LatticeTransitivity [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1170
    prefer 2 apply assumption
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1171
   apply (rule S3S4S5S6LeadstoS6 [THEN LatticeTransitivity [temp_use]])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1172
       apply (auto intro!: S3S4S5S6LeadstoS6 [temp_use] necT [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1173
         intro: ImplLeadsto_gen [temp_use] simp: Init_defs)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1174
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1175
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1176
lemma NotS1LeadstoS6: "[| sigma |= []ImpInv rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1177
         sigma |= S2 rmhist p ~> S3 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1178
         sigma |= S3 rmhist p ~> S4 rmhist p | S6 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1179
         sigma |= S4 rmhist p & ires!p = #NotAResult
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1180
                  ~> S4 rmhist p & ires!p ~= #NotAResult | S5 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1181
         sigma |= S4 rmhist p & ires!p ~= #NotAResult ~> S5 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1182
         sigma |= S5 rmhist p ~> S6 rmhist p |]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1183
      ==> sigma |= ~S1 rmhist p ~> S6 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1184
  apply (rule S2S3S4S5S6LeadstoS6 [THEN LatticeTransitivity [temp_use]])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1185
       apply assumption+
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1186
  apply (erule INV_leadsto [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1187
  apply (rule ImplLeadsto_gen [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1188
  apply (rule necT [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1189
  apply (auto simp: ImpInv_def Init_defs intro!: necT [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1190
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1191
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1192
lemma S1Infinite: "[| sigma |= ~S1 rmhist p ~> S6 rmhist p;
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1193
         sigma |= []<>S6 rmhist p --> []<>S1 rmhist p |]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1194
      ==> sigma |= []<>S1 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1195
  apply (rule classical)
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
  1196
  apply (tactic {* asm_lr_simp_tac (@{context} addsimps
54742
7a86358a3c0b proper context for basic Simplifier operations: rewrite_rule, rewrite_goals_rule, rewrite_goals_tac etc.;
wenzelm
parents: 51717
diff changeset
  1197
    [temp_use @{context} @{thm NotBox}, temp_rewrite @{context} @{thm NotDmd}]) 1 *})
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1198
  apply (auto elim!: leadsto_infinite [temp_use] mp dest!: DBImplBD [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1199
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1200
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1201
section "Refinement proof (step 1.5)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1202
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1203
(* Prove invariants of the implementation:
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1204
   a. memory invariant
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1205
   b. "implementation invariant": always in states S1,...,S6
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1206
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1207
lemma Step1_5_1a: "|- IPImp p --> (ALL l. []$MemInv mm l)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1208
  by (auto simp: IPImp_def box_stp_act [temp_use] intro!: MemoryInvariantAll [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1209
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1210
lemma Step1_5_1b: "|- Init(ImpInit p & HInit rmhist p) & [](ImpNext p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1211
         & [][HNext rmhist p]_(c p, r p, m p, rmhist!p) & [](ALL l. $MemInv mm l)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1212
         --> []ImpInv rmhist p"
42770
3ebce8d71a05 eliminated obsolete MI_css -- use current context directly;
wenzelm
parents: 42018
diff changeset
  1213
  apply invariant
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1214
   apply (auto simp: Init_def ImpInv_def box_stp_act [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1215
     dest!: Step1_1 [temp_use] dest: S1_successors [temp_use] S2_successors [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1216
     S3_successors [temp_use] S4_successors [temp_use] S5_successors [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1217
     S6_successors [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1218
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1219
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1220
(*** Initialization ***)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1221
lemma Step1_5_2a: "|- Init(ImpInit p & HInit rmhist p) --> Init(PInit (resbar rmhist) p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1222
  by (auto simp: Init_def intro!: Step1_1 [temp_use] Step1_3  [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1223
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1224
(*** step simulation ***)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1225
lemma Step1_5_2b: "|- [](ImpNext p & [HNext rmhist p]_(c p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1226
         & $ImpInv rmhist p & (!l. $MemInv mm l))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1227
         --> [][UNext memCh mm (resbar rmhist) p]_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1228
  by (auto simp: ImpInv_def elim!: STL4E [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1229
    dest!: S1safe [temp_use] S2safe [temp_use] S3safe [temp_use] S4safe [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1230
    S5safe [temp_use] S6safe [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1231
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1232
(*** Liveness ***)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1233
lemma GoodImpl: "|- IPImp p & HistP rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1234
         -->   Init(ImpInit p & HInit rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1235
             & [](ImpNext p & [HNext rmhist p]_(c p, r p, m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1236
             & [](ALL l. $MemInv mm l) & []($ImpInv rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1237
             & ImpLive p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1238
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1239
    apply (subgoal_tac "sigma |= Init (ImpInit p & HInit rmhist p) & [] (ImpNext p) &
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1240
      [][HNext rmhist p]_ (c p, r p, m p, rmhist!p) & [] (ALL l. $MemInv mm l)")
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1241
   apply (auto simp: split_box_conj [try_rewrite] box_stp_act [try_rewrite]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1242
       dest!: Step1_5_1b [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1243
      apply (force simp: IPImp_def MClkIPSpec_def RPCIPSpec_def RPSpec_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1244
        ImpLive_def c_def r_def m_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1245
      apply (force simp: IPImp_def MClkIPSpec_def RPCIPSpec_def RPSpec_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1246
        HistP_def Init_def ImpInit_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1247
    apply (force simp: IPImp_def MClkIPSpec_def RPCIPSpec_def RPSpec_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1248
      ImpNext_def c_def r_def m_def split_box_conj [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1249
   apply (force simp: HistP_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1250
  apply (force simp: allT [temp_use] dest!: Step1_5_1a [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1251
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1252
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1253
(* The implementation is infinitely often in state S1... *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1254
lemma Step1_5_3a: "|- [](ImpNext p & [HNext rmhist p]_(c p, r p, m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1255
         & [](ALL l. $MemInv mm l)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1256
         & []($ImpInv rmhist p) & ImpLive p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1257
         --> []<>S1 rmhist p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1258
  apply (clarsimp simp: ImpLive_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1259
  apply (rule S1Infinite)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1260
   apply (force simp: split_box_conj [try_rewrite] box_stp_act [try_rewrite]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1261
     intro!: NotS1LeadstoS6 [temp_use] S2_live [temp_use] S3_live [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1262
     S4a_live [temp_use] S4b_live [temp_use] S5_live [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1263
  apply (auto simp: split_box_conj [temp_use] intro!: S6_live [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1264
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1265
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1266
(* ... and therefore satisfies the fairness requirements of the specification *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1267
lemma Step1_5_3b: "|- [](ImpNext p & [HNext rmhist p]_(c p, r p, m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1268
         & [](ALL l. $MemInv mm l) & []($ImpInv rmhist p) & ImpLive p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1269
         --> WF(RNext memCh mm (resbar rmhist) p)_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1270
  by (auto intro!: RNext_fair [temp_use] Step1_5_3a [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1271
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1272
lemma Step1_5_3c: "|- [](ImpNext p & [HNext rmhist p]_(c p, r p, m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1273
         & [](ALL l. $MemInv mm l) & []($ImpInv rmhist p) & ImpLive p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1274
         --> WF(MemReturn memCh (resbar rmhist) p)_(rtrner memCh!p, resbar rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1275
  by (auto intro!: Return_fair [temp_use] Step1_5_3a [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1276
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1277
(* QED step of step 1 *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1278
lemma Step1: "|- IPImp p & HistP rmhist p --> UPSpec memCh mm (resbar rmhist) p"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1279
  by (auto simp: UPSpec_def split_box_conj [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1280
    dest!: GoodImpl [temp_use] intro!: Step1_5_2a [temp_use] Step1_5_2b [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1281
    Step1_5_3b [temp_use] Step1_5_3c [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1282
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1283
(* ------------------------------ Step 2 ------------------------------ *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1284
section "Step 2"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1285
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1286
lemma Step2_2a: "|- Write rmCh mm ires p l & ImpNext p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1287
         & [HNext rmhist p]_(c p, r p, m p, rmhist!p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1288
         & $ImpInv rmhist p
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1289
         --> (S4 rmhist p)$ & unchanged (e p, c p, r p, rmhist!p)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1290
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1291
  apply (drule WriteS4 [action_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1292
   apply assumption
42786
06a38b936342 proper method_setup "split_idle";
wenzelm
parents: 42772
diff changeset
  1293
  apply split_idle
21624
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1294
  apply (auto simp: ImpNext_def dest!: S4EnvUnch [temp_use] S4ClerkUnch [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1295
    S4RPCUnch [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1296
     apply (auto simp: square_def dest: S4Write [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1297
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1298
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1299
lemma Step2_2: "|-   (ALL p. ImpNext p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1300
         & (ALL p. [HNext rmhist p]_(c p, r p, m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1301
         & (ALL p. $ImpInv rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1302
         & [EX q. Write rmCh mm ires q l]_(mm!l)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1303
         --> [EX q. Write memCh mm (resbar rmhist) q l]_(mm!l)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1304
  apply (auto intro!: squareCI elim!: squareE)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1305
  apply (assumption | rule exI Step1_4_4b [action_use])+
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1306
    apply (force intro!: WriteS4 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1307
   apply (auto dest!: Step2_2a [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1308
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1309
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1310
lemma Step2_lemma: "|- [](  (ALL p. ImpNext p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1311
            & (ALL p. [HNext rmhist p]_(c p, r p, m p, rmhist!p))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1312
            & (ALL p. $ImpInv rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1313
            & [EX q. Write rmCh mm ires q l]_(mm!l))
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1314
         --> [][EX q. Write memCh mm (resbar rmhist) q l]_(mm!l)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1315
  by (force elim!: STL4E [temp_use] dest!: Step2_2 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1316
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1317
lemma Step2: "|- #l : #MemLoc & (ALL p. IPImp p & HistP rmhist p)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1318
         --> MSpec memCh mm (resbar rmhist) l"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1319
  apply (auto simp: MSpec_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1320
   apply (force simp: IPImp_def MSpec_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1321
  apply (auto intro!: Step2_lemma [temp_use] simp: split_box_conj [temp_use] all_box [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1322
     prefer 4
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1323
     apply (force simp: IPImp_def MSpec_def)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1324
    apply (auto simp: split_box_conj [temp_use] elim!: allE dest!: GoodImpl [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1325
  done
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1326
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1327
(* ----------------------------- Main theorem --------------------------------- *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1328
section "Memory implementation"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1329
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1330
(* The combination of a legal caller, the memory clerk, the RPC component,
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1331
   and a reliable memory implement the unreliable memory.
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1332
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1333
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1334
(* Implementation of internal specification by combination of implementation
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1335
   and history variable with explicit refinement mapping
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1336
*)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1337
lemma Impl_IUSpec: "|- Implementation & Hist rmhist --> IUSpec memCh mm (resbar rmhist)"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1338
  by (auto simp: IUSpec_def Implementation_def IPImp_def MClkISpec_def
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1339
    RPCISpec_def IRSpec_def Hist_def intro!: Step1 [temp_use] Step2 [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1340
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1341
(* The main theorem: introduce hiding and eliminate history variable. *)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1342
lemma Implementation: "|- Implementation --> USpec memCh"
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1343
  apply clarsimp
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1344
  apply (frule History [temp_use])
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1345
  apply (auto simp: USpec_def intro: eexI [temp_use] Impl_IUSpec [temp_use]
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1346
    MI_base [temp_use] elim!: eexE)
6f79647cf536 TLA: converted legacy ML scripts;
wenzelm
parents: 17309
diff changeset
  1347
  done
3807
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
  1348
82a99b090d9d A formalization of TLA in HOL -- by Stephan Merz;
wenzelm
parents:
diff changeset
  1349
end