src/HOL/UNITY/Mutex.ML
author paulson
Wed, 18 Nov 1998 15:10:46 +0100
changeset 5931 325300576da7
parent 5706 21706a735c8d
child 5983 79e301a6a51b
permissions -rw-r--r--
Finally removing "Compl" from HOL
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5111
8f4b72f0c15d Uncurried functions LeadsTo and reach
paulson
parents: 5069
diff changeset
     1
(*  Title:      HOL/UNITY/Mutex
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     2
    ID:         $Id$
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     5
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     6
Based on "A Family of 2-Process Mutual Exclusion Algorithms" by J Misra
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     7
*)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     8
5232
e5a7cdd07ea5 Tidied; uses records
paulson
parents: 5111
diff changeset
     9
(*split_all_tac causes a big blow-up*)
5706
21706a735c8d record_split_name;
wenzelm
parents: 5701
diff changeset
    10
claset_ref() := claset() delSWrapper record_split_name;
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    11
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    12
Addsimps [Mprg_def RS def_prg_Init];
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    13
program_defs_ref := [Mprg_def];
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    14
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    15
Addsimps (map simp_of_act
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    16
	  [cmd0U_def, cmd1U_def, cmd2U_def, cmd3U_def, cmd4U_def, 
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    17
	   cmd0V_def, cmd1V_def, cmd2V_def, cmd3V_def, cmd4V_def]);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    18
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    19
Addsimps (map simp_of_set
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    20
	  [invariantU_def, invariantV_def, bad_invariantU_def]);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    21
5232
e5a7cdd07ea5 Tidied; uses records
paulson
parents: 5111
diff changeset
    22
(*Simplification for records*)
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    23
Addsimps (thms"state.update_defs");
5232
e5a7cdd07ea5 Tidied; uses records
paulson
parents: 5111
diff changeset
    24
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    25
Goal "Mprg : Invariant invariantU";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
    26
by (rtac InvariantI 1);
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    27
by (constrains_tac 2);
5232
e5a7cdd07ea5 Tidied; uses records
paulson
parents: 5111
diff changeset
    28
by Auto_tac;
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
    29
qed "invariantU";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    30
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    31
Goal "Mprg : Invariant invariantV";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
    32
by (rtac InvariantI 1);
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    33
by (constrains_tac 2);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    34
by Auto_tac;
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
    35
qed "invariantV";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    36
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
    37
val invariantUV = Invariant_Int_rule [invariantU, invariantV];
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    38
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    39
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
    40
(*The safety property: mutual exclusion*)
5596
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    41
Goal "(reachable Mprg) Int {s. MM s = #3 & NN s = #3} = {}";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
    42
by (cut_facts_tac [invariantUV RS Invariant_includes_reachable] 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    43
by Auto_tac;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    44
qed "mutual_exclusion";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    45
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    46
5232
e5a7cdd07ea5 Tidied; uses records
paulson
parents: 5111
diff changeset
    47
(*The bad invariant FAILS in cmd1V*)
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    48
Goal "Mprg : Invariant bad_invariantU";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
    49
by (rtac InvariantI 1);
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    50
by (constrains_tac 2);
5596
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    51
by (Force_tac 1);
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    52
(*Needs a decision procedure to simplify the resulting state*)
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    53
by (auto_tac (claset(), 
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    54
	      simpset_of Int.thy addsimps
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    55
	        [zadd_int, integ_of_Pls, integ_of_Min, 
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    56
		 integ_of_BIT, le_int_Suc_eq]));
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    57
by (dtac zle_trans 1 THEN assume_tac 1);
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    58
by (full_simp_tac (simpset_of Int.thy) 1);
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    59
by (asm_full_simp_tac (simpset() addsimps int_simps) 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    60
(*Resulting state: n=1, p=false, m=4, u=false.  
5232
e5a7cdd07ea5 Tidied; uses records
paulson
parents: 5111
diff changeset
    61
  Execution of cmd1V (the command of process v guarded by n=1) sets p:=true,
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    62
  violating the invariant!*)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    63
(*Check that subgoals remain: proof failed.*)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    64
getgoal 1;  
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    65
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    66
5596
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    67
Goal "(#1 <= m & m <= #3) = (m = #1 | m = #2 | m = #3)";
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    68
by (auto_tac (claset(),
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    69
	      simpset_of Int.thy addsimps
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    70
	        [zle_iff_zadd, zadd_int, integ_of_Pls, integ_of_Min, 
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    71
		 integ_of_BIT]));
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    72
by (exhaust_tac "na" 1);
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    73
by (exhaust_tac "nat" 2);
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    74
by (exhaust_tac "n" 3);
5620
3ac11c4af76a tidying and renaming
paulson
parents: 5596
diff changeset
    75
by Auto_tac;
5596
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    76
qed "eq_123";
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    77
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    78
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    79
(*** Progress for U ***)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    80
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    81
Goalw [Unless_def] "Mprg : Unless {s. MM s=#2} {s. MM s=#3}";
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    82
by (constrains_tac 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    83
qed "U_F0";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    84
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    85
Goal "Mprg : LeadsTo {s. MM s=#1} {s. PP s = VV s & MM s = #2}";
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    86
by (ensures_tac "cmd1U" 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    87
qed "U_F1";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    88
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    89
Goal "Mprg : LeadsTo {s. ~ PP s & MM s = #2} {s. MM s = #3}";
5340
d75c03cf77b5 Misc changes
paulson
parents: 5320
diff changeset
    90
by (cut_facts_tac [invariantU] 1);
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    91
by (ensures_tac "cmd2U" 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    92
qed "U_F2";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    93
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    94
Goal "Mprg : LeadsTo {s. MM s = #3} {s. PP s}";
5596
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
    95
by (res_inst_tac [("B", "{s. MM s = #4}")] LeadsTo_Trans 1);
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    96
by (ensures_tac "cmd4U" 2);
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
    97
by (ensures_tac "cmd3U" 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    98
qed "U_F3";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    99
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   100
Goal "Mprg : LeadsTo {s. MM s = #2} {s. PP s}";
5340
d75c03cf77b5 Misc changes
paulson
parents: 5320
diff changeset
   101
by (rtac ([LeadsTo_weaken_L, Int_lower2 RS subset_imp_LeadsTo] 
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   102
	  MRS LeadsTo_Diff) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   103
by (rtac ([U_F2, U_F3] MRS LeadsTo_Trans) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   104
by (auto_tac (claset() addSEs [less_SucE], simpset()));
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
   105
val U_lemma2 = result();
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   106
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   107
Goal "Mprg : LeadsTo {s. MM s = #1} {s. PP s}";
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
   108
by (rtac ([U_F1 RS LeadsTo_weaken_R, U_lemma2] MRS LeadsTo_Trans) 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   109
by (Blast_tac 1);
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
   110
val U_lemma1 = result();
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   111
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   112
Goal "Mprg : LeadsTo {s. #1 <= MM s & MM s <= #3} {s. PP s}";
5596
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
   113
by (simp_tac (simpset() addsimps [eq_123, Collect_disj_eq, LeadsTo_Un_distrib,
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
   114
				  U_lemma1, U_lemma2, U_F3] ) 1);
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
   115
val U_lemma123 = result();
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   116
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   117
(*Misra's F4*)
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   118
Goal "Mprg : LeadsTo {s. UU s} {s. PP s}";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
   119
by (rtac ([invariantU, U_lemma123] MRS Invariant_LeadsTo_weaken) 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   120
by Auto_tac;
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
   121
qed "u_Leadsto_p";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   122
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   123
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   124
(*** Progress for V ***)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   125
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   126
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   127
Goalw [Unless_def] "Mprg : Unless {s. NN s=#2} {s. NN s=#3}";
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
   128
by (constrains_tac 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   129
qed "V_F0";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   130
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   131
Goal "Mprg : LeadsTo {s. NN s=#1} {s. PP s = (~ UU s) & NN s = #2}";
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
   132
by (ensures_tac "cmd1V" 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   133
qed "V_F1";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   134
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   135
Goal "Mprg : LeadsTo {s. PP s & NN s = #2} {s. NN s = #3}";
5340
d75c03cf77b5 Misc changes
paulson
parents: 5320
diff changeset
   136
by (cut_facts_tac [invariantV] 1);
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
   137
by (ensures_tac "cmd2V" 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   138
qed "V_F2";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   139
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   140
Goal "Mprg : LeadsTo {s. NN s = #3} {s. ~ PP s}";
5596
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
   141
by (res_inst_tac [("B", "{s. NN s = #4}")] LeadsTo_Trans 1);
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
   142
by (ensures_tac "cmd4V" 2);
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5424
diff changeset
   143
by (ensures_tac "cmd3V" 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   144
qed "V_F3";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   145
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   146
Goal "Mprg : LeadsTo {s. NN s = #2} {s. ~ PP s}";
5340
d75c03cf77b5 Misc changes
paulson
parents: 5320
diff changeset
   147
by (rtac ([LeadsTo_weaken_L, Int_lower2 RS subset_imp_LeadsTo] 
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   148
	  MRS LeadsTo_Diff) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   149
by (rtac ([V_F2, V_F3] MRS LeadsTo_Trans) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   150
by (auto_tac (claset() addSEs [less_SucE], simpset()));
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
   151
val V_lemma2 = result();
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   152
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   153
Goal "Mprg : LeadsTo {s. NN s = #1} {s. ~ PP s}";
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
   154
by (rtac ([V_F1 RS LeadsTo_weaken_R, V_lemma2] MRS LeadsTo_Trans) 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   155
by (Blast_tac 1);
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
   156
val V_lemma1 = result();
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   157
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   158
Goal "Mprg : LeadsTo {s. #1 <= NN s & NN s <= #3} {s. ~ PP s}";
5596
b29d18d8c4d2 abstype of programs
paulson
parents: 5426
diff changeset
   159
by (simp_tac (simpset() addsimps [eq_123, Collect_disj_eq, LeadsTo_Un_distrib,
5240
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
   160
				  V_lemma1, V_lemma2, V_F3] ) 1);
bbcd79ef7cf2 Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents: 5232
diff changeset
   161
val V_lemma123 = result();
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   162
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   163
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   164
(*Misra's F4*)
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   165
Goal "Mprg : LeadsTo {s. VV s} {s. ~ PP s}";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
   166
by (rtac ([invariantV, V_lemma123] MRS Invariant_LeadsTo_weaken) 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   167
by Auto_tac;
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
   168
qed "v_Leadsto_not_p";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   169
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   170
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   171
(** Absence of starvation **)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   172
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   173
(*Misra's F6*)
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   174
Goal "Mprg : LeadsTo {s. MM s = #1} {s. MM s = #3}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   175
by (rtac LeadsTo_Un_duplicate 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   176
by (rtac LeadsTo_cancel2 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   177
by (rtac U_F2 2);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   178
by (simp_tac (simpset() addsimps [Collect_conj_eq] ) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   179
by (stac Un_commute 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   180
by (rtac LeadsTo_Un_duplicate 1);
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
   181
by (rtac ([v_Leadsto_not_p, U_F0] MRS PSP_Unless RSN(2, LeadsTo_cancel2)) 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   182
by (rtac (U_F1 RS LeadsTo_weaken_R) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   183
by (auto_tac (claset() addSEs [less_SucE], simpset()));
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
   184
qed "m1_Leadsto_3";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   185
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   186
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   187
(*The same for V*)
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
   188
Goal "Mprg : LeadsTo {s. NN s = #1} {s. NN s = #3}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   189
by (rtac LeadsTo_Un_duplicate 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   190
by (rtac LeadsTo_cancel2 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   191
by (rtac V_F2 2);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   192
by (simp_tac (simpset() addsimps [Collect_conj_eq] ) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   193
by (stac Un_commute 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   194
by (rtac LeadsTo_Un_duplicate 1);
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
   195
by (rtac ([u_Leadsto_p, V_F0] MRS PSP_Unless  RSN(2, LeadsTo_cancel2)) 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   196
by (rtac (V_F1 RS LeadsTo_weaken_R) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   197
by (auto_tac (claset() addSEs [less_SucE], simpset()));
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents: 5277
diff changeset
   198
qed "n1_Leadsto_3";