src/HOL/UNITY/Lift_prog.ML
author paulson
Thu, 26 Aug 1999 11:33:24 +0200
changeset 7359 98a2afab3f86
parent 7343 4fa705cedbdb
child 7361 477e1bdf230f
permissions -rw-r--r--
extra syntax for JN, making it more like UN
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Lift_prog.ML
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     2
    ID:         $Id$
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     5
*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     6
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     7
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     8
(*** Basic properties ***)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     9
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    10
(** lift_set and drop_set **)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    11
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    12
Goalw [lift_set_def] "(f : lift_set i A) = (f i : A)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    13
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    14
qed "lift_set_iff";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    15
AddIffs [lift_set_iff];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    16
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    17
Goalw [lift_set_def] "lift_set i (A Int B) = lift_set i A Int lift_set i B";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    18
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    19
qed "lift_set_Int";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    20
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    21
(*Converse fails*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    22
Goalw [drop_set_def] "f : A ==> f i : drop_set i A";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    23
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    24
qed "drop_set_I";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    25
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    26
(** lift_act and drop_act **)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    27
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    28
Goalw [lift_act_def] "lift_act i Id = Id";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    29
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    30
by (etac rev_mp 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    31
by (dtac sym 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    32
by (asm_simp_tac (simpset() addsimps [fun_upd_idem_iff]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    33
qed "lift_act_Id";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    34
Addsimps [lift_act_Id];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    35
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    36
Goalw [drop_act_def] "(s, s') : act ==> (s i, s' i) : drop_act i act";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    37
by (auto_tac (claset() addSIs [image_eqI], simpset()));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    38
qed "drop_act_I";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    39
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    40
Goalw [drop_act_def] "drop_act i Id = Id";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    41
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    42
by (res_inst_tac [("x", "((%u. x), (%u. x))")] image_eqI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    43
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    44
qed "drop_act_Id";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    45
Addsimps [drop_act_Id];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    46
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    47
(** lift_prog and drop_prog **)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    48
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    49
Goalw [lift_prog_def] "Init (lift_prog i F) = lift_set i (Init F)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    50
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    51
qed "Init_lift_prog";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    52
Addsimps [Init_lift_prog];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    53
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    54
Goalw [lift_prog_def] "Acts (lift_prog i F) = lift_act i `` Acts F";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    55
by (auto_tac (claset() addIs [Id_in_Acts RSN (2,image_eqI)], simpset()));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    56
qed "Acts_lift_prog";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    57
Addsimps [Acts_lift_prog];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    58
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    59
Goalw [drop_prog_def] "Init (drop_prog i F) = drop_set i (Init F)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    60
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    61
qed "Init_drop_prog";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    62
Addsimps [Init_drop_prog];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    63
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    64
Goalw [drop_prog_def] "Acts (drop_prog i F) = drop_act i `` Acts F";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    65
by (auto_tac (claset() addIs [Id_in_Acts RSN (2,image_eqI)], simpset()));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    66
qed "Acts_drop_prog";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    67
Addsimps [Acts_drop_prog];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    68
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
    69
(** These monotonicity results look natural but are UNUSED **)
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
    70
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    71
Goal "F component G ==> lift_prog i F component lift_prog i G";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    72
by (full_simp_tac (simpset() addsimps [component_eq_subset]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    73
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    74
qed "lift_prog_mono";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    75
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    76
Goal "F component G ==> drop_prog i F component drop_prog i G";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    77
by (full_simp_tac (simpset() addsimps [component_eq_subset, drop_set_def]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    78
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    79
qed "drop_prog_mono";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    80
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    81
Goal "lift_prog i SKIP = SKIP";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    82
by (auto_tac (claset() addSIs [program_equalityI],
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    83
	      simpset() addsimps [SKIP_def, lift_prog_def]));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    84
qed "lift_prog_SKIP";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    85
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    86
Goal "lift_prog i (F Join G) = (lift_prog i F) Join (lift_prog i G)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    87
by (rtac program_equalityI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    88
by (auto_tac (claset(), simpset() addsimps [Acts_Join]));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    89
qed "lift_prog_Join";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    90
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    91
Goal "lift_prog i (JOIN I F) = (JN j:I. lift_prog i (F j))";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    92
by (rtac program_equalityI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    93
by (auto_tac (claset(), simpset() addsimps [Acts_JN]));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    94
qed "lift_prog_JN";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    95
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    96
Goal "drop_prog i SKIP = SKIP";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    97
by (auto_tac (claset() addSIs [program_equalityI],
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    98
	      simpset() addsimps [SKIP_def, drop_set_def, drop_prog_def]));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    99
qed "drop_prog_SKIP";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   100
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   101
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   102
(** Injectivity of lift_set, lift_act, lift_prog **)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   103
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   104
Goalw [lift_set_def, drop_set_def] "drop_set i (lift_set i F) = F";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   105
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   106
qed "lift_set_inverse";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   107
Addsimps [lift_set_inverse];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   108
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   109
Goal "inj (lift_set i)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   110
by (rtac inj_on_inverseI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   111
by (rtac lift_set_inverse 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   112
qed "inj_lift_set";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   113
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   114
(*Because A and B could differ outside i, cannot generalize result to 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   115
   drop_set i (A Int B) = drop_set i A Int drop_set i B
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   116
*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   117
Goalw [lift_set_def, drop_set_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   118
     "drop_set i ((lift_set i A) Int B) = A Int (drop_set i B)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   119
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   120
qed "drop_set_lift_set_Int";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   121
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   122
Goalw [lift_set_def, drop_set_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   123
     "drop_set i (B Int (lift_set i A)) = (drop_set i B) Int A";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   124
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   125
qed "drop_set_lift_set_Int2";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   126
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   127
Goalw [drop_set_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   128
     "i : I ==> drop_set i (INT j:I. lift_set j A) = A";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   129
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   130
qed "drop_set_INT";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   131
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   132
Goalw [lift_act_def, drop_act_def] "drop_act i (lift_act i act) = act";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   133
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   134
by (res_inst_tac [("x", "f(i:=a)")] exI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   135
by (Asm_simp_tac 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   136
by (res_inst_tac [("x", "f(i:=b)")] exI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   137
by (Asm_simp_tac 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   138
by (rtac ext 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   139
by (Asm_simp_tac 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   140
qed "lift_act_inverse";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   141
Addsimps [lift_act_inverse];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   142
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   143
Goal "inj (lift_act i)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   144
by (rtac inj_on_inverseI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   145
by (rtac lift_act_inverse 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   146
qed "inj_lift_act";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   147
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   148
Goal "drop_prog i (lift_prog i F) = F";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   149
by (simp_tac (simpset() addsimps [lift_prog_def, drop_prog_def]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   150
by (rtac program_equalityI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   151
by (simp_tac (simpset() addsimps [image_compose RS sym, o_def]) 2);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   152
by (Simp_tac 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   153
qed "lift_prog_inverse";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   154
Addsimps [lift_prog_inverse];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   155
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   156
Goal "inj (lift_prog i)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   157
by (rtac inj_on_inverseI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   158
by (rtac lift_prog_inverse 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   159
qed "inj_lift_prog";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   160
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   161
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   162
(*For compatibility with the original definition and perhaps simpler proofs*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   163
Goalw [lift_act_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   164
    "((f,f') : lift_act i act) = (EX s'. f' = f(i := s') & (f i, s') : act)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   165
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   166
by (rtac exI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   167
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   168
qed "lift_act_eq";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   169
AddIffs [lift_act_eq];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   170
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   171
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   172
(*** Safety: co, stable, invariant ***)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   173
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   174
(** Safety and lift_prog **)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   175
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   176
Goal "(lift_prog i F : (lift_set i A) co (lift_set i B))  =  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   177
\     (F : A co B)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   178
by (auto_tac (claset(), 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   179
	      simpset() addsimps [constrains_def]));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   180
by (Blast_tac 2);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   181
by (Force_tac 1);
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   182
qed "lift_prog_constrains";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   183
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   184
Goal "(lift_prog i F : stable (lift_set i A)) = (F : stable A)";
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   185
by (simp_tac (simpset() addsimps [stable_def, lift_prog_constrains]) 1);
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   186
qed "lift_prog_stable";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   187
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   188
Goal "(lift_prog i F : invariant (lift_set i A)) = (F : invariant A)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   189
by (auto_tac (claset(),
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   190
	      simpset() addsimps [invariant_def, lift_prog_stable]));
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   191
qed "lift_prog_invariant";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   192
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   193
(*This one looks strange!  Proof probably is by case analysis on i=j.
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   194
  If i~=j then lift_prog j (F j) does nothing to lift_set i, and the 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   195
  premise ensures A<=B.*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   196
Goal "F i : A co B  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   197
\     ==> lift_prog j (F j) : (lift_set i A) co (lift_set i B)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   198
by (auto_tac (claset(), 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   199
	      simpset() addsimps [constrains_def]));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   200
by (REPEAT (Blast_tac 1));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   201
qed "constrains_imp_lift_prog_constrains";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   202
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   203
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   204
(** Safety and drop_prog **)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   205
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   206
Goalw [constrains_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   207
     "(drop_prog i F : A co B)  =  (F : (lift_set i A) co (lift_set i B))";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   208
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   209
by (force_tac (claset(), 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   210
	       simpset() addsimps [drop_act_def]) 2);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   211
by (blast_tac (claset() addIs [drop_act_I]) 1);
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   212
qed "drop_prog_constrains";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   213
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   214
Goal "(drop_prog i F : stable A)  =  (F : stable (lift_set i A))";
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   215
by (simp_tac (simpset() addsimps [stable_def, drop_prog_constrains]) 1);
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   216
qed "drop_prog_stable";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   217
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   218
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   219
(*** Diff, needed for localTo ***)
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   220
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   221
Goal "Diff G (lift_act i `` Acts F) : (lift_set i A) co (lift_set i B)  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   222
\     ==> Diff (drop_prog i G) (Acts F) : A co B";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   223
by (auto_tac (claset(), 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   224
	      simpset() addsimps [constrains_def, Diff_def]));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   225
by (dtac bspec 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   226
by (Force_tac 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   227
by (auto_tac (claset(), simpset() addsimps [drop_act_def]));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   228
by (auto_tac (claset(), simpset() addsimps [lift_set_def]));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   229
qed "Diff_drop_prog_co";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   230
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   231
Goalw [stable_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   232
     "Diff G (lift_act i `` Acts F) : stable (lift_set i A)  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   233
\     ==> Diff (drop_prog i G) (Acts F) : stable A";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   234
by (etac Diff_drop_prog_co 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   235
qed "Diff_drop_prog_stable";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   236
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   237
Goalw [constrains_def, Diff_def]
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   238
     "Diff G (Acts F) : A co B  \
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   239
\     ==> Diff (lift_prog i G) (lift_act i `` Acts F) \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   240
\         : (lift_set i A) co (lift_set i B)";
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   241
by Auto_tac;
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   242
by (Blast_tac 1);
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   243
qed "Diff_lift_prog_co";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   244
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   245
Goalw [stable_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   246
     "Diff G (Acts F) : stable A  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   247
\     ==> Diff (lift_prog i G) (lift_act i `` Acts F) : stable (lift_set i A)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   248
by (etac Diff_lift_prog_co 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   249
qed "Diff_lift_prog_stable";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   250
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   251
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   252
(*** Weak safety primitives: Co, Stable ***)
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   253
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   254
(** Reachability **)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   255
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   256
Goal "s : reachable F ==> f(i:=s) : reachable (lift_prog i F)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   257
by (etac reachable.induct 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   258
by (force_tac (claset() addIs [reachable.Acts, ext], 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   259
	       simpset()) 2);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   260
by (force_tac (claset() addIs [reachable.Init], simpset()) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   261
qed "reachable_lift_progI";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   262
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   263
Goal "f : reachable (lift_prog i F) ==> f i : reachable F";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   264
by (etac reachable.induct 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   265
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   266
by (ALLGOALS (blast_tac (claset() addIs reachable.intrs)));
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   267
qed "reachable_lift_progD";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   268
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   269
Goal "reachable (lift_prog i F) = lift_set i (reachable F)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   270
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   271
by (etac reachable_lift_progD 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   272
ren "f" 1;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   273
by (dres_inst_tac [("f","f"),("i","i")] reachable_lift_progI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   274
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   275
qed "reachable_lift_prog";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   276
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   277
Goal "(lift_prog i F : (lift_set i A) Co (lift_set i B))  =  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   278
\     (F : A Co B)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   279
by (simp_tac (simpset() addsimps [Constrains_def, reachable_lift_prog,
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   280
				  lift_set_Int RS sym,
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   281
				  lift_prog_constrains]) 1);
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   282
qed "lift_prog_Constrains";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   283
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   284
Goal "(lift_prog i F : Stable (lift_set i A)) = (F : Stable A)";
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   285
by (simp_tac (simpset() addsimps [Stable_def, lift_prog_Constrains]) 1);
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   286
qed "lift_prog_Stable";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   287
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   288
(** Reachability and drop_prog **)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   289
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   290
Goal "f : reachable F ==> f i : reachable (drop_prog i F)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   291
by (etac reachable.induct 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   292
by (force_tac (claset() addIs [reachable.Acts, drop_act_I],
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   293
	       simpset()) 2);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   294
by (force_tac (claset() addIs [reachable.Init, drop_set_I],
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   295
	       simpset()) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   296
qed "reachable_imp_reachable_drop_prog";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   297
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   298
(*Converse fails because it would require
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   299
  [| s i : reachable (drop_prog i F); s i : A |] ==> s : reachable F
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   300
*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   301
Goalw [Constrains_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   302
     "drop_prog i F : A Co B ==> F : (lift_set i A) Co (lift_set i B)";
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   303
by (full_simp_tac (simpset() addsimps [drop_prog_constrains]) 1);
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   304
by (etac constrains_weaken_L 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   305
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   306
by (etac reachable_imp_reachable_drop_prog 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   307
qed "drop_prog_Constrains_D";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   308
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   309
Goalw [Stable_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   310
     "drop_prog i F : Stable A ==> F : Stable (lift_set i A)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   311
by (asm_simp_tac (simpset() addsimps [drop_prog_Constrains_D]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   312
qed "drop_prog_Stable_D";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   313
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   314
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   315
(*** Programs of the form lift_prog i F Join G
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   316
     in other words programs containing a replicated component ***)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   317
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   318
Goal "drop_prog i ((lift_prog i F) Join G) = F Join (drop_prog i G)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   319
by (rtac program_equalityI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   320
by (simp_tac (simpset() addsimps [Acts_Join, image_Un,
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   321
				  image_compose RS sym, o_def]) 2);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   322
by (simp_tac (simpset() addsimps [drop_set_lift_set_Int]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   323
qed "drop_prog_lift_prog_Join";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   324
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   325
Goal "(lift_prog i F) Join G = lift_prog i H \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   326
\     ==> H = F Join (drop_prog i G)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   327
by (dres_inst_tac [("f", "drop_prog i")] arg_cong 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   328
by (full_simp_tac (simpset() addsimps [drop_prog_lift_prog_Join]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   329
by (etac sym 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   330
qed "lift_prog_Join_eq_lift_prog_D";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   331
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   332
Goal "f : reachable (lift_prog i F Join G)  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   333
\     ==> f i : reachable (F Join drop_prog i G)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   334
by (etac reachable.induct 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   335
by (force_tac (claset() addIs [reachable.Init, drop_set_I], simpset()) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   336
(*By case analysis on whether the action is of lift_prog i F  or  G*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   337
by (force_tac (claset() addIs [reachable.Acts, drop_act_I], 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   338
	       simpset() addsimps [Acts_Join, image_iff]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   339
qed "reachable_lift_prog_Join_D";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   340
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   341
(*Opposite inclusion fails, even for the initial state: lift_set i includes
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   342
  ALL functions determined only by their value at i.*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   343
Goal "reachable (lift_prog i F Join G) <= \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   344
\     lift_set i (reachable (F Join drop_prog i G))";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   345
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   346
by (etac reachable_lift_prog_Join_D 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   347
qed "reachable_lift_prog_Join_subset";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   348
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   349
Goal "F Join drop_prog i G : Stable A    \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   350
\     ==> lift_prog i F Join G : Stable (lift_set i A)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   351
by (full_simp_tac (simpset() addsimps [Stable_def, Constrains_def]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   352
by (subgoal_tac 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   353
    "lift_prog i F Join G : lift_set i (reachable (F Join drop_prog i G)) Int \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   354
\                           lift_set i A \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   355
\    co lift_set i A" 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   356
by (asm_full_simp_tac 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   357
    (simpset() addsimps [lift_set_Int RS sym,
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   358
			 lift_prog_constrains,
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   359
			 drop_prog_constrains RS sym,
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   360
			 drop_prog_lift_prog_Join]) 2);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   361
by (blast_tac (claset() addIs [constrains_weaken, 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   362
			       reachable_lift_prog_Join_D]) 1);
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   363
qed "lift_prog_Join_Stable";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   364
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   365
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   366
(*** guarantees properties ***)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   367
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   368
(** It seems that neither of these can be proved from the other. **)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   369
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   370
(*Strong precondition and postcondition; doesn't seem very useful.
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   371
  Probably can be strengthened to an equivalance.*)
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   372
Goal "F : X guar Y \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   373
\     ==> lift_prog i F : (lift_prog i `` X) guar (lift_prog i `` Y)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   374
by (rtac guaranteesI 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   375
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   376
by (blast_tac (claset() addDs [lift_prog_Join_eq_lift_prog_D, guaranteesD]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   377
qed "lift_prog_guarantees";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   378
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   379
(*Weak precondition and postcondition; this is the good one!*)
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   380
val [xguary,drop_prog,lift_prog] =
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   381
Goal "[| F : X guar Y;  \
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   382
\        !!H. H : XX ==> drop_prog i H : X;  \
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   383
\        !!G. F Join drop_prog i G : Y ==> lift_prog i F Join G : YY |] \
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   384
\     ==> lift_prog i F : XX guar YY";
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   385
by (rtac (xguary RS guaranteesD RS lift_prog RS guaranteesI) 1);
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   386
by (dtac drop_prog 1);
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   387
by (full_simp_tac (simpset() addsimps [drop_prog_lift_prog_Join]) 1);
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   388
qed "drop_prog_guarantees";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   389
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   390
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   391
(*** sub ***)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   392
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   393
Addsimps [sub_def];
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   394
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   395
Goal "lift_set i {s. P s} = {s. P (sub i s)}";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   396
by (asm_simp_tac (simpset() addsimps [lift_set_def]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   397
qed "lift_set_sub";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   398
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   399
Goal "{s. P (s i)} = lift_set i {s. P s}";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   400
by (asm_simp_tac (simpset() addsimps [lift_set_def]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   401
qed "Collect_eq_lift_set";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   402
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   403
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   404
(** Are these two useful?? **)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   405
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   406
(*The other direction fails: having FF : Stable {s. z <= f (s i)} does not
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   407
  ensure that F has the form lift_prog i F for some F.*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   408
Goal "lift_prog i `` Stable {s. P (f s)} <= Stable {s. P (f (s i))}";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   409
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   410
by (stac Collect_eq_lift_set 1); 
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   411
by (asm_simp_tac (simpset() addsimps [lift_prog_Stable]) 1);
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   412
qed "image_lift_prog_Stable";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   413
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   414
Goal "lift_prog i `` Increasing f <= Increasing (f o sub i)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   415
by (simp_tac (simpset() addsimps [Increasing_def,
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   416
				  inj_lift_prog RS image_INT]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   417
by (blast_tac (claset() addIs [impOfSubs image_lift_prog_Stable]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   418
qed "image_lift_prog_Increasing";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   419
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   420
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   421
(*** guarantees corollaries ***)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   422
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   423
Goalw [increasing_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   424
     "F : UNIV guar increasing f \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   425
\     ==> lift_prog i F : UNIV guar increasing (f o sub i)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   426
by (etac drop_prog_guarantees 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   427
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   428
by (stac Collect_eq_lift_set 1); 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   429
by (asm_full_simp_tac
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   430
    (simpset() addsimps [lift_prog_stable, drop_prog_stable, 
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   431
			 stable_Join]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   432
qed "lift_prog_guar_increasing";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   433
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   434
Goalw [Increasing_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   435
     "F : UNIV guar Increasing f \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   436
\     ==> lift_prog i F : UNIV guar Increasing (f o sub i)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   437
by (etac drop_prog_guarantees 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   438
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   439
by (stac Collect_eq_lift_set 1); 
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   440
by (asm_simp_tac (simpset() addsimps [lift_prog_Join_Stable]) 1);
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   441
qed "lift_prog_guar_Increasing";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   442
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   443
Goalw [localTo_def, increasing_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   444
     "F : (f localTo F) guar increasing f  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   445
\     ==> lift_prog i F : (f o sub i) localTo (lift_prog i F)  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   446
\                         guar increasing (f o sub i)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   447
by (etac drop_prog_guarantees 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   448
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   449
by (stac Collect_eq_lift_set 2); 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   450
(*the "increasing" guarantee*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   451
by (asm_full_simp_tac
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   452
    (simpset() addsimps [lift_prog_stable, drop_prog_stable, 
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   453
			 stable_Join]) 2);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   454
(*the "localTo" requirement*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   455
by (asm_simp_tac
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   456
    (simpset() addsimps [Diff_drop_prog_stable, 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   457
			 Collect_eq_lift_set RS sym]) 1); 
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   458
qed "lift_prog_localTo_guar_increasing";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   459
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   460
Goalw [localTo_def, Increasing_def]
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   461
     "F : (f localTo F) guar Increasing f  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   462
\     ==> lift_prog i F : (f o sub i) localTo (lift_prog i F)  \
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   463
\                         guar Increasing (f o sub i)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   464
by (etac drop_prog_guarantees 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   465
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   466
by (stac Collect_eq_lift_set 2); 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   467
(*the "Increasing" guarantee*)
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   468
by (asm_simp_tac (simpset() addsimps [lift_prog_Join_Stable]) 2);
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   469
(*the "localTo" requirement*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   470
by (asm_simp_tac
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   471
    (simpset() addsimps [Diff_drop_prog_stable, 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   472
			 Collect_eq_lift_set RS sym]) 1); 
7343
4fa705cedbdb renamed some theorems; also better natural deduction style for old ones
paulson
parents: 7186
diff changeset
   473
qed "lift_prog_localTo_guar_Increasing";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   474
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   475
(*Converse fails.  Useful?*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   476
Goal "lift_prog i `` (f localTo F) <= (f o sub i) localTo (lift_prog i F)";
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   477
by (simp_tac (simpset() addsimps [localTo_def]) 1);
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   478
by Auto_tac;
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   479
by (stac Collect_eq_lift_set 1); 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   480
by (asm_simp_tac (simpset() addsimps [Diff_lift_prog_stable]) 1); 
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   481
qed "localTo_lift_prog_I";