src/HOL/UNITY/Project.ML
author paulson
Thu, 30 Sep 1999 10:06:56 +0200
changeset 7660 7e38237edfcb
parent 7630 d0e4a6f1f05c
child 7689 affe0c2fdfbf
permissions -rw-r--r--
now with (weak safety) guarantees (weak progress) with Extend
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Project.ML
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
     2
    ID:         $Id$
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
     4
    Copyright   1999  University of Cambridge
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
     5
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
     6
Projections of state sets (also of actions and programs)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
     7
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
     8
Inheritance of GUARANTEES properties under extension
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
     9
*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    10
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    11
Open_locale "Extend";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    12
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    13
(** projection: monotonicity for safety **)
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    14
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    15
Goal "D <= C ==> project_act D h act <= project_act C h act";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    16
by (auto_tac (claset(), simpset() addsimps [project_act_def]));
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    17
qed "project_act_mono";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    18
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    19
Goal "[| D <= C; project C h F : A co B |] ==> project D h F : A co B";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    20
by (auto_tac (claset(), simpset() addsimps [constrains_def]));
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    21
bd project_act_mono 1;
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    22
by (Blast_tac 1);
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    23
qed "project_constrains_mono";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    24
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    25
Goal "[| D <= C;  project C h F : stable A |] ==> project D h F : stable A";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    26
by (asm_full_simp_tac
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    27
    (simpset() addsimps [stable_def, project_constrains_mono]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    28
qed "project_stable_mono";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    29
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    30
Goal "F : A co B ==> project C h (extend h F) : A co B";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    31
by (auto_tac (claset(), 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    32
      simpset() addsimps [extend_act_def, project_act_def, constrains_def]));
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    33
qed "project_extend_constrains_I";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    34
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    35
Goal "UNIV <= project_set h C \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    36
\     ==> project C h ((extend h F) Join G) = F Join (project C h G)";
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    37
by (rtac program_equalityI 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    38
by (asm_simp_tac (simpset() addsimps [image_Un, image_image,
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    39
			subset_UNIV RS subset_trans RS extend_act_inverse]) 2);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    40
by (simp_tac (simpset() addsimps [project_set_extend_set_Int]) 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    41
qed "project_extend_Join";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    42
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    43
Goal "UNIV <= project_set h C \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    44
\     ==> (extend h F) Join G = extend h H ==> H = F Join (project C h G)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    45
by (dres_inst_tac [("f", "project C h")] arg_cong 1);
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    46
by (asm_full_simp_tac (simpset() addsimps [project_extend_Join]) 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    47
qed "extend_Join_eq_extend_D";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    48
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    49
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    50
(** Safety **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    51
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    52
Goalw [constrains_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    53
     "(project C h F : A co B)  =  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    54
\     (F : (C Int extend_set h A) co (extend_set h B) & A <= B)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    55
by (auto_tac (claset() addSIs [project_act_I], simpset() addsimps [ball_Un]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    56
by (force_tac (claset() addSIs [project_act_I] addSDs [subsetD], simpset()) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    57
(*the <== direction*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    58
by (rewtac project_act_def);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    59
by (force_tac (claset() addSDs [subsetD], simpset()) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    60
qed "project_constrains";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    61
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    62
Goalw [stable_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    63
     "(project UNIV h F : stable A) = (F : stable (extend_set h A))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    64
by (simp_tac (simpset() addsimps [project_constrains]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    65
qed "project_stable";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    66
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    67
Goal "F : stable (extend_set h A) ==> project C h F : stable A";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    68
bd (project_stable RS iffD2) 1;
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    69
by (blast_tac (claset() addIs [project_stable_mono]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    70
qed "project_stable_I";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    71
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    72
(*used below to prove Join_project_ensures*)
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    73
Goal "[| G : stable C;  project C h G : A unless B |] \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    74
\     ==> G : (C Int extend_set h A) unless (extend_set h B)";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    75
by (asm_full_simp_tac
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    76
    (simpset() addsimps [unless_def, project_constrains]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    77
by (blast_tac (claset() addDs [stable_constrains_Int]
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    78
			addIs [constrains_weaken]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    79
qed_spec_mp "project_unless";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
    80
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    81
(*This form's useful with guarantees reasoning*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    82
Goal "(F Join project C h G : A co B)  =  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    83
\       (extend h F Join G : (C Int extend_set h A) co (extend_set h B) &  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    84
\        F : A co B)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    85
by (simp_tac (simpset() addsimps [Join_constrains, project_constrains]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    86
by (blast_tac (claset() addIs [extend_constrains RS iffD2 RS constrains_weaken]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    87
                        addDs [constrains_imp_subset]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    88
qed "Join_project_constrains";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    89
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    90
(*The condition is required to prove the left-to-right direction;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    91
  could weaken it to G : (C Int extend_set h A) co C*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    92
Goalw [stable_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    93
     "extend h F Join G : stable C \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    94
\     ==> (F Join project C h G : stable A)  =  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    95
\         (extend h F Join G : stable (C Int extend_set h A) &  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    96
\          F : stable A)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    97
by (simp_tac (simpset() addsimps [Join_project_constrains]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    98
by (blast_tac (claset() addIs [constrains_weaken] addDs [constrains_Int]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
    99
qed "Join_project_stable";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   100
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   101
Goal "(F Join project UNIV h G : increasing func)  =  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   102
\     (extend h F Join G : increasing (func o f))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   103
by (simp_tac (simpset() addsimps [increasing_def, Join_project_stable]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   104
by (auto_tac (claset(),
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   105
	      simpset() addsimps [Join_stable, Collect_eq_extend_set RS sym,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   106
				  extend_stable RS iffD1]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   107
qed "Join_project_increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   108
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   109
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   110
(*** Diff, needed for localTo ***)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   111
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   112
(*Opposite direction fails because Diff in the extended state may remove
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   113
  fewer actions, i.e. those that affect other state variables.*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   114
Goal "(UN act:acts. Domain act) <= project_set h C \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   115
\     ==> Diff (project C h G) acts <= \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   116
\         project C h (Diff G (extend_act h `` acts))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   117
by (asm_full_simp_tac (simpset() addsimps [component_eq_subset, Diff_def,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   118
					   UN_subset_iff]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   119
by (force_tac (claset() addSIs [image_diff_subset RS subsetD], 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   120
	       simpset() addsimps [image_image_eq_UN]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   121
qed "Diff_project_component_project_Diff";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   122
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   123
Goal
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   124
   "[| (UN act:acts. Domain act) <= project_set h C; \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   125
\      Diff G (extend_act h `` acts) : (extend_set h A) co (extend_set h B) |]\
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   126
\   ==> Diff (project C h G) acts : A co B";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   127
by (etac (Diff_project_component_project_Diff RS component_constrains) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   128
by (rtac (project_constrains RS iffD2) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   129
by (ftac constrains_imp_subset 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   130
by (Asm_full_simp_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   131
by (blast_tac (claset() addIs [constrains_weaken]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   132
qed "Diff_project_co";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   133
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   134
Goalw [stable_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   135
     "[| (UN act:acts. Domain act) <= project_set h C; \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   136
\        Diff G (extend_act h `` acts) : stable (extend_set h A) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   137
\     ==> Diff (project C h G) acts : stable A";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   138
by (etac Diff_project_co 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   139
by (assume_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   140
qed "Diff_project_stable";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   141
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   142
(*Converse appears to fail*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   143
Goal "[| UNIV <= project_set h C;  (H : (func o f) localTo extend h G) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   144
\     ==> (project C h H : func localTo G)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   145
by (asm_full_simp_tac 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   146
    (simpset() addsimps [localTo_def, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   147
			 project_extend_Join RS sym,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   148
			 subset_UNIV RS subset_trans RS Diff_project_stable,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   149
			 Collect_eq_extend_set RS sym]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   150
qed "project_localTo_I";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   151
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   152
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   153
(** Reachability and project **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   154
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   155
Goal "[| reachable (extend h F Join G) <= C;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   156
\        z : reachable (extend h F Join G) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   157
\     ==> f z : reachable (F Join project C h G)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   158
by (etac reachable.induct 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   159
by (force_tac (claset() addIs [reachable.Init, project_set_I],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   160
	       simpset()) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   161
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   162
by (force_tac (claset() addIs [project_act_I RSN (3,reachable.Acts)],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   163
	       simpset()) 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   164
by (res_inst_tac [("act","x")] reachable.Acts 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   165
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   166
by (etac extend_act_D 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   167
qed "reachable_imp_reachable_project";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   168
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   169
Goalw [Constrains_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   170
     "[| reachable (extend h F Join G) <= C;    \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   171
\        F Join project C h G : A Co B |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   172
\     ==> extend h F Join G : (extend_set h A) Co (extend_set h B)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   173
by (full_simp_tac (simpset() addsimps [Join_project_constrains]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   174
by (Clarify_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   175
by (etac constrains_weaken 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   176
by (auto_tac (claset() addDs [reachable_imp_reachable_project], simpset()));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   177
qed "project_Constrains_D";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   178
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   179
Goalw [Stable_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   180
     "[| reachable (extend h F Join G) <= C;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   181
\        F Join project C h G : Stable A |]   \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   182
\     ==> extend h F Join G : Stable (extend_set h A)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   183
by (asm_simp_tac (simpset() addsimps [project_Constrains_D]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   184
qed "project_Stable_D";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   185
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   186
Goalw [Always_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   187
     "[| reachable (extend h F Join G) <= C;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   188
\        F Join project C h G : Always A |]   \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   189
\     ==> extend h F Join G : Always (extend_set h A)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   190
by (force_tac (claset() addIs [reachable.Init, project_set_I],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   191
	       simpset() addsimps [project_Stable_D]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   192
qed "project_Always_D";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   193
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   194
Goalw [Increasing_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   195
     "[| reachable (extend h F Join G) <= C;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   196
\        F Join project C h G : Increasing func |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   197
\     ==> extend h F Join G : Increasing (func o f)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   198
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   199
by (stac Collect_eq_extend_set 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   200
by (asm_simp_tac (simpset() addsimps [project_Stable_D]) 1); 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   201
qed "project_Increasing_D";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   202
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   203
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   204
(** Converse results for weak safety: benefits of the argument C *)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   205
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   206
Goal "[| C <= reachable(extend h F Join G);   \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   207
\        x : reachable (F Join project C h G) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   208
\     ==> EX y. h(x,y) : reachable (extend h F Join G)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   209
by (etac reachable.induct 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   210
by (ALLGOALS Asm_full_simp_tac);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   211
(*SLOW: 6.7s*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   212
by (force_tac (claset() delrules [Id_in_Acts]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   213
		        addIs [reachable.Acts, extend_act_D],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   214
	       simpset() addsimps [project_act_def]) 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   215
by (force_tac (claset() addIs [reachable.Init],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   216
	       simpset() addsimps [project_set_def]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   217
qed "reachable_project_imp_reachable";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   218
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   219
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   220
Goal "project_set h (reachable (extend h F Join G)) = \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   221
\     reachable (F Join project (reachable (extend h F Join G)) h G)";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   222
by (auto_tac (claset() addDs [subset_refl RS reachable_imp_reachable_project,
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   223
			      subset_refl RS reachable_project_imp_reachable], 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   224
	      simpset() addsimps [project_set_def]));
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   225
qed "project_set_reachable_extend_eq";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   226
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   227
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   228
Goalw [Constrains_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   229
     "[| C <= reachable (extend h F Join G);  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   230
\        extend h F Join G : (extend_set h A) Co (extend_set h B) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   231
\     ==> F Join project C h G : A Co B";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   232
by (full_simp_tac (simpset() addsimps [Join_project_constrains, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   233
				       extend_set_Int_distrib]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   234
by (rtac conjI 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   235
by (etac constrains_weaken 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   236
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   237
by (asm_full_simp_tac (simpset() addsimps [Join_constrains]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   238
(*Some generalization of constrains_weaken_L would be better, but what is it?*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   239
by (rewtac constrains_def);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   240
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   241
by (thin_tac "ALL act : Acts G. ?P act" 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   242
by (force_tac (claset() addSDs [reachable_project_imp_reachable], 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   243
	       simpset()) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   244
qed "project_Constrains_I";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   245
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   246
Goalw [Stable_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   247
     "[| C <= reachable (extend h F Join G);  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   248
\        extend h F Join G : Stable (extend_set h A) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   249
\     ==> F Join project C h G : Stable A";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   250
by (asm_simp_tac (simpset() addsimps [project_Constrains_I]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   251
qed "project_Stable_I";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   252
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   253
Goalw [Increasing_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   254
     "[| C <= reachable (extend h F Join G);  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   255
\        extend h F Join G : Increasing (func o f) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   256
\     ==> F Join project C h G : Increasing func";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   257
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   258
by (asm_simp_tac (simpset() addsimps [Collect_eq_extend_set RS sym,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   259
				      project_Stable_I]) 1); 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   260
qed "project_Increasing_I";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   261
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   262
Goal "(F Join project (reachable (extend h F Join G)) h G : A Co B)  =  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   263
\     (extend h F Join G : (extend_set h A) Co (extend_set h B))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   264
by (blast_tac (claset() addIs [project_Constrains_I, project_Constrains_D]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   265
qed "project_Constrains";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   266
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   267
Goalw [Stable_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   268
     "(F Join project (reachable (extend h F Join G)) h G : Stable A)  =  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   269
\     (extend h F Join G : Stable (extend_set h A))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   270
by (rtac project_Constrains 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   271
qed "project_Stable";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   272
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   273
Goal
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   274
   "(F Join project (reachable (extend h F Join G)) h G : Increasing func)  = \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   275
\   (extend h F Join G : Increasing (func o f))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   276
by (asm_simp_tac (simpset() addsimps [Increasing_def, project_Stable,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   277
				      Collect_eq_extend_set RS sym]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   278
qed "project_Increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   279
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   280
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   281
(** Progress includes safety in the definition of ensures **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   282
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   283
(*** Progress for (project C h F) ***)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   284
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   285
(** transient **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   286
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   287
(*Premise is that C includes the domains of all actions that could be the
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   288
  transient one.  Could have C=UNIV of course*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   289
Goalw [transient_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   290
     "[| ALL act: Acts F. act ^^ extend_set h A <= - extend_set h A --> \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   291
\                      Domain act <= C;    \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   292
\        F : transient (extend_set h A) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   293
\     ==> project C h F : transient A";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   294
by (auto_tac (claset() delrules [ballE],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   295
              simpset() addsimps [Domain_project_act, Int_absorb2]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   296
by (REPEAT (ball_tac 1));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   297
by (auto_tac (claset(),
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   298
              simpset() addsimps [extend_set_def, project_set_def, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   299
				  project_act_def]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   300
by (ALLGOALS Blast_tac);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   301
qed "transient_extend_set_imp_project_transient";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   302
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   303
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   304
(*UNUSED.  WHY??
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   305
  Converse of the above...it requires a strong assumption about actions
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   306
  being enabled for all possible values of the new variables.*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   307
Goalw [transient_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   308
     "[| project C h F : transient A;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   309
\        ALL act: Acts F. project_act C h act ^^ A <= - A --> \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   310
\                         Domain act <= C \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   311
\             & extend_set h (project_set h (Domain act)) <= Domain act |]  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   312
\     ==> F : transient (extend_set h A)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   313
by (auto_tac (claset() delrules [ballE],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   314
	      simpset() addsimps [Domain_project_act]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   315
by (ball_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   316
by (rtac bexI 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   317
by (assume_tac 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   318
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   319
by (eres_inst_tac [("P", "A <= ?B")] rev_mp 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   320
by (force_tac (claset(), simpset() addsimps [Int_absorb2]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   321
(*The Domain requirement's proved; must prove the Image requirement*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   322
by (res_inst_tac [("y1", "x")] (surj_h RS surjD RS exE) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   323
by (res_inst_tac [("y1", "xa")] (surj_h RS surjD RS exE) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   324
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   325
by (thin_tac "A <= ?B" 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   326
by (force_tac (claset() addSIs [ImageI, project_act_I], simpset()) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   327
qed "project_transient_imp_transient_extend_set";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   328
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   329
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   330
(** ensures **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   331
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   332
(*For simplicity, the complicated condition on C is eliminated
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   333
  NOT SURE THIS IS GOOD FOR ANYTHING: CAN'T PROVE LEADSTO THEOREM*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   334
Goal "F : (extend_set h A) ensures (extend_set h B) \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   335
\     ==> project UNIV h F : A ensures B";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   336
by (asm_full_simp_tac
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   337
    (simpset() addsimps [ensures_def, project_constrains, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   338
			 transient_extend_set_imp_project_transient,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   339
			 extend_set_Un_distrib RS sym, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   340
			 extend_set_Diff_distrib RS sym]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   341
by (Blast_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   342
qed "ensures_extend_set_imp_project_ensures";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   343
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   344
(*A super-strong condition: G is not allowed to affect the
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   345
  shared variables at all.*)
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   346
Goal "[| ALL x. project C h G ~: transient {x};  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   347
\        extend h F Join G : stable C;  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   348
\        F Join project C h G : A ensures B |] \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   349
\     ==> extend h F Join G : (C Int extend_set h A) ensures (extend_set h B)";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   350
by (case_tac "A <= B" 1);
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   351
by (blast_tac (claset() addIs [subset_imp_ensures] addDs [extend_set_mono]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   352
by (full_simp_tac (simpset() addsimps [ensures_def, Join_constrains,
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   353
				       Join_stable, Join_transient]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   354
by (REPEAT_FIRST (rtac conjI));
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   355
by (blast_tac (claset() addDs [extend_transient RS iffD2] 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   356
                        addIs [transient_strengthen]) 3);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   357
by (REPEAT (force_tac (claset() addIs [project_unless RS unlessD, unlessI, 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   358
				       project_extend_constrains_I], 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   359
		       simpset()) 1));
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   360
qed_spec_mp "Join_project_ensures";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   361
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   362
Goal "[| ALL x. project C h G ~: transient {x};  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   363
\        extend h F Join G : stable C;  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   364
\        F Join project C h G : A leadsTo B |] \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   365
\     ==> extend h F Join G : (C Int extend_set h A) leadsTo (extend_set h B)";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   366
by (etac leadsTo_induct 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   367
by (asm_simp_tac (simpset() delsimps UN_simps
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   368
		  addsimps [Int_UN_distrib, leadsTo_UN, extend_set_Union]) 3);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   369
by (blast_tac (claset() addIs [psp_stable RS leadsTo_weaken, 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   370
			       leadsTo_Trans]) 2);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   371
by (blast_tac (claset() addIs [leadsTo_Basis, Join_project_ensures]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   372
qed "Join_project_leadsTo_I";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   373
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   374
(*Instance of the previous theorem for STRONG progress*)
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   375
Goal "[| ALL x. project UNIV h G ~: transient {x};  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   376
\        F Join project UNIV h G : A leadsTo B |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   377
\     ==> extend h F Join G : (extend_set h A) leadsTo (extend_set h B)";
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   378
by (dtac Join_project_leadsTo_I 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   379
by Auto_tac;
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   380
qed "Join_project_UNIV_leadsTo_I";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   381
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   382
(** Towards the analogous theorem for WEAK progress*)
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   383
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   384
Goal "[| ALL x. project C h G ~: transient {x};  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   385
\        extend h F Join G : stable C;  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   386
\        F Join project C h G : (project_set h C Int A) leadsTo B |] \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   387
\     ==> extend h F Join G : C Int extend_set h (project_set h C Int A) leadsTo (extend_set h B)";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   388
by (etac leadsTo_induct 1);
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   389
by (asm_simp_tac (simpset() delsimps UN_simps
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   390
		  addsimps [Int_UN_distrib, leadsTo_UN, extend_set_Union]) 3);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   391
by (blast_tac (claset() addIs [psp_stable RS leadsTo_weaken, 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   392
			       leadsTo_Trans]) 2);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   393
by (blast_tac (claset() addIs [leadsTo_Basis, Join_project_ensures]) 1);
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   394
val lemma = result();
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   395
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   396
Goal "[| ALL x. project C h G ~: transient {x};  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   397
\        extend h F Join G : stable C;  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   398
\        F Join project C h G : (project_set h C Int A) leadsTo B |] \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   399
\     ==> extend h F Join G : (C Int extend_set h A) leadsTo (extend_set h B)";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   400
br (lemma RS leadsTo_weaken) 1;
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   401
by (auto_tac (claset() addIs [project_set_I], simpset()));
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   402
val lemma2 = result();
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   403
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   404
Goal "[| C = (reachable (extend h F Join G)); \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   405
\        ALL x. project C h G ~: transient {x};  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   406
\        F Join project C h G : A LeadsTo B |] \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   407
\     ==> extend h F Join G : (extend_set h A) LeadsTo (extend_set h B)";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   408
by (asm_full_simp_tac 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   409
    (simpset() addsimps [LeadsTo_def, lemma2, stable_reachable, 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   410
			 project_set_reachable_extend_eq]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   411
qed "Join_project_LeadsTo";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   412
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   413
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   414
(*** GUARANTEES and EXTEND ***)
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   415
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   416
(** Strong precondition and postcondition; doesn't seem very useful. **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   417
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   418
Goal "F : X guarantees Y ==> \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   419
\     extend h F : (extend h `` X) guarantees (extend h `` Y)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   420
by (rtac guaranteesI 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   421
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   422
by (blast_tac (claset() addDs [project_set_UNIV RS extend_Join_eq_extend_D, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   423
			       guaranteesD]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   424
qed "guarantees_imp_extend_guarantees";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   425
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   426
Goal "extend h F : (extend h `` X) guarantees (extend h `` Y) \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   427
\    ==> F : X guarantees Y";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   428
by (rtac guaranteesI 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   429
by (auto_tac (claset(), simpset() addsimps [guar_def, component_def]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   430
by (dtac spec 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   431
by (dtac (mp RS mp) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   432
by (Blast_tac 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   433
by (blast_tac (claset() addSDs [inj_extend RS inj_image_mem_iff RS iffD1]) 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   434
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   435
qed "extend_guarantees_imp_guarantees";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   436
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   437
Goal "(extend h F : (extend h `` X) guarantees (extend h `` Y)) = \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   438
\    (F : X guarantees Y)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   439
by (blast_tac (claset() addIs [guarantees_imp_extend_guarantees,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   440
			       extend_guarantees_imp_guarantees]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   441
qed "extend_guarantees_eq";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   442
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   443
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   444
(*Weak precondition and postcondition; this is the good one!
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   445
  Not clear that it has a converse [or that we want one!]*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   446
val [xguary,project,extend] =
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   447
Goal "[| F : X guarantees Y;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   448
\        !!G. extend h F Join G : X' ==> F Join proj G h G : X;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   449
\        !!G. [| F Join proj G h G : Y; extend h F Join G : X'; \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   450
\                Disjoint (extend h F) G |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   451
\             ==> extend h F Join G : Y' |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   452
\     ==> extend h F : X' guarantees Y'";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   453
by (rtac (xguary RS guaranteesD RS extend RS guaranteesI) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   454
by (etac project 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   455
by (assume_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   456
by (assume_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   457
qed "project_guarantees";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   458
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   459
(** It seems that neither "guarantees" law can be proved from the other. **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   460
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   461
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   462
(*** guarantees corollaries ***)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   463
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   464
Goal "F : UNIV guarantees increasing func \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   465
\     ==> extend h F : UNIV guarantees increasing (func o f)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   466
by (etac project_guarantees 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   467
by (ALLGOALS
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   468
    (asm_simp_tac (simpset() addsimps [Join_project_increasing RS sym])));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   469
qed "extend_guar_increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   470
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   471
Goal "F : UNIV guarantees Increasing func \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   472
\     ==> extend h F : UNIV guarantees Increasing (func o f)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   473
by (etac project_guarantees 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   474
by (rtac (subset_UNIV RS project_Increasing_D) 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   475
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   476
qed "extend_guar_Increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   477
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   478
Goal "F : (func localTo G) guarantees increasing func  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   479
\     ==> extend h F : (func o f) localTo (extend h G)  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   480
\                      guarantees increasing (func o f)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   481
by (etac project_guarantees 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   482
(*the "increasing" guarantee*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   483
by (asm_simp_tac
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   484
    (simpset() addsimps [Join_project_increasing RS sym]) 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   485
(*the "localTo" requirement*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   486
by (stac (project_set_UNIV RS project_extend_Join RS sym) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   487
by (asm_simp_tac 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   488
    (simpset() addsimps [project_set_UNIV RS project_localTo_I]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   489
qed "extend_localTo_guar_increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   490
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   491
Goal "F : (func localTo G) guarantees Increasing func  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   492
\     ==> extend h F : (func o f) localTo (extend h G)  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   493
\                      guarantees Increasing (func o f)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   494
by (etac project_guarantees 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   495
(*the "Increasing" guarantee*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   496
by (etac (subset_UNIV RS project_Increasing_D) 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   497
(*the "localTo" requirement*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   498
by (stac (project_set_UNIV RS project_extend_Join RS sym) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   499
by (asm_simp_tac 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   500
    (simpset() addsimps [project_set_UNIV RS project_localTo_I]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   501
qed "extend_localTo_guar_Increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   502
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   503
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   504
(** Guarantees with a leadsTo postcondition **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   505
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   506
Goal "[| G : f localTo extend h F; \
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   507
\        Disjoint (extend h F) G |] ==> project C h G : stable {x}";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   508
by (asm_full_simp_tac
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   509
    (simpset() addsimps [localTo_imp_stable,
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   510
			 extend_set_sing, project_stable_I]) 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   511
qed "localTo_imp_project_stable";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   512
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   513
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   514
Goal "F : stable{s} ==> F ~: transient {s}";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   515
by (auto_tac (claset(), 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   516
	      simpset() addsimps [FP_def, transient_def,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   517
				  stable_def, constrains_def]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   518
qed "stable_sing_imp_not_transient";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   519
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   520
(*STRONG precondition and postcondition*)
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   521
Goal "F : (A co A') guarantees (B leadsTo B')  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   522
\ ==> extend h F : ((extend_set h A) co (extend_set h A'))  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   523
\                   Int (f localTo (extend h F)) \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   524
\                  guarantees ((extend_set h B) leadsTo (extend_set h B'))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   525
by (etac project_guarantees 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   526
(*the safety precondition*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   527
by (stac (project_set_UNIV RS project_extend_Join RS sym) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   528
by (asm_full_simp_tac
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   529
    (simpset() addsimps [project_constrains, Join_constrains, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   530
			 extend_constrains]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   531
by (fast_tac (claset() addDs [constrains_imp_subset]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   532
(*the liveness postcondition*)
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   533
by (rtac Join_project_UNIV_leadsTo_I 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   534
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   535
by (asm_full_simp_tac
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   536
    (simpset() addsimps [Join_localTo, self_localTo,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   537
			 localTo_imp_project_stable, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   538
			 stable_sing_imp_not_transient]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   539
qed "extend_co_guar_leadsTo";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   540
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   541
(*WEAK precondition and postcondition*)
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   542
Goal "F : (A Co A') guarantees (B LeadsTo B')  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   543
\ ==> extend h F : ((extend_set h A) Co (extend_set h A'))  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   544
\                   Int (f localTo (extend h F)) \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   545
\                  guarantees ((extend_set h B) LeadsTo (extend_set h B'))";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   546
by (etac project_guarantees 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   547
(*the safety precondition*)
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   548
by (fast_tac (claset() addIs [project_Constrains_I]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   549
(*the liveness postcondition*)
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   550
by (rtac Join_project_LeadsTo 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   551
by Auto_tac;
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   552
by (asm_full_simp_tac
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   553
    (simpset() addsimps [Join_localTo, self_localTo,
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   554
			 localTo_imp_project_stable, 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   555
			 stable_sing_imp_not_transient]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   556
qed "extend_Co_guar_LeadsTo";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   557
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   558
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   559
Close_locale "Extend";