src/HOL/UNITY/Project.ML
author paulson
Mon, 11 Oct 1999 10:53:39 +0200
changeset 7826 c6a8b73b6c2a
parent 7689 affe0c2fdfbf
child 7841 65d91d13fc13
permissions -rw-r--r--
working shapshot with "projecting" and "extending"
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]));
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
    21
by (dtac 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";
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
    68
by (dtac (project_stable RS iffD2) 1);
7660
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
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   109
(*For using project_guarantees in particular cases*)
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   110
Goal "extend h F Join G : extend_set h A co extend_set h B \
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   111
\     ==> F Join project C h G : A co B";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   112
by (asm_full_simp_tac
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   113
    (simpset() addsimps [project_constrains, Join_constrains, 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   114
			 extend_constrains]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   115
by (blast_tac (claset() addIs [constrains_weaken]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   116
			addDs [constrains_imp_subset]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   117
qed "project_constrains_I";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   118
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   119
(*The UNIV argument is essential*)
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   120
Goal "F Join project UNIV h G : A co B \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   121
\     ==> extend h F Join G : extend_set h A co extend_set h B";
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   122
by (asm_full_simp_tac
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   123
    (simpset() addsimps [project_constrains, Join_constrains, 
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   124
			 extend_constrains]) 1);
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   125
qed "project_constrains_D";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   126
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   127
Goalw [projecting_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   128
     "[| ALL i:I. projecting C h F (X' i) (X i) |] \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   129
\     ==> projecting C h F (INT i:I. X' i) (INT i:I. X i)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   130
by Auto_tac;
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   131
qed "projecting_INT";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   132
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   133
Goalw [projecting_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   134
     "[| ALL i:I. projecting C h F (X' i) (X i) |] \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   135
\     ==> projecting C h F (UN i:I. X' i) (UN i:I. X i)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   136
by Auto_tac;
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   137
qed "projecting_UN";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   138
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   139
Goalw [projecting_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   140
     "[| projecting C h F X' X;  U'<=X';  X<=U |] ==> projecting C h F U' U";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   141
by Auto_tac;
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   142
qed "projecting_weaken";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   143
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   144
(*Is this the right way to handle the X' argument?*)
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   145
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   146
     "[| ALL i:I. extending C h F (X' i) (Y' i) (Y i) |] \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   147
\     ==> extending C h F (INT i:I. X' i) (INT i:I. Y' i) (INT i:I. Y i)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   148
by Auto_tac;
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   149
qed "extending_INT";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   150
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   151
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   152
     "[| ALL i:I. extending C h F X' (Y' i) (Y i) |] \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   153
\     ==> extending C h F X' (UN i:I. Y' i) (UN i:I. Y i)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   154
by Auto_tac;
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   155
qed "extending_UN";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   156
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   157
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   158
     "[| extending C h F X' Y' Y;  U'<= X';  Y'<=V';  V<=Y |] \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   159
\     ==> extending C h F U' V' V";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   160
by Auto_tac;
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   161
qed "extending_weaken";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   162
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   163
Goal "projecting C h F X' UNIV";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   164
by (simp_tac (simpset() addsimps [projecting_def]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   165
qed "projecting_UNIV";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   166
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   167
Goalw [projecting_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   168
     "projecting C h F (extend_set h A co extend_set h B) (A co B)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   169
by (blast_tac (claset() addIs [project_constrains_I]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   170
qed "projecting_constrains";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   171
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   172
Goalw [stable_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   173
     "projecting C h F (stable (extend_set h A)) (stable A)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   174
by (rtac projecting_constrains 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   175
qed "projecting_stable";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   176
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   177
Goalw [projecting_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   178
     "projecting (%G. UNIV) h F (increasing (func o f)) (increasing func)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   179
by (simp_tac (simpset() addsimps [Join_project_increasing]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   180
qed "projecting_increasing";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   181
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   182
Goal "extending C h F X' UNIV Y";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   183
by (simp_tac (simpset() addsimps [extending_def]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   184
qed "extending_UNIV";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   185
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   186
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   187
     "extending (%G. UNIV) h F X' (extend_set h A co extend_set h B) (A co B)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   188
by (blast_tac (claset() addIs [project_constrains_D]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   189
qed "extending_constrains";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   190
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   191
Goalw [stable_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   192
     "extending (%G. UNIV) h F X' (stable (extend_set h A)) (stable A)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   193
by (rtac extending_constrains 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   194
qed "extending_stable";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   195
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   196
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   197
     "extending (%G. UNIV) h F X' (increasing (func o f)) (increasing func)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   198
by (simp_tac (simpset() addsimps [Join_project_increasing]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   199
qed "extending_increasing";
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   200
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   201
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   202
(*** Diff, needed for localTo ***)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   203
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   204
(*Opposite direction fails because Diff in the extended state may remove
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   205
  fewer actions, i.e. those that affect other state variables.*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   206
Goal "(UN act:acts. Domain act) <= project_set h C \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   207
\     ==> Diff (project C h G) acts <= \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   208
\         project C h (Diff G (extend_act h `` acts))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   209
by (asm_full_simp_tac (simpset() addsimps [component_eq_subset, Diff_def,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   210
					   UN_subset_iff]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   211
by (force_tac (claset() addSIs [image_diff_subset RS subsetD], 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   212
	       simpset() addsimps [image_image_eq_UN]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   213
qed "Diff_project_component_project_Diff";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   214
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   215
Goal
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   216
   "[| (UN act:acts. Domain act) <= project_set h C; \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   217
\      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
   218
\   ==> Diff (project C h G) acts : A co B";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   219
by (etac (Diff_project_component_project_Diff RS component_constrains) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   220
by (rtac (project_constrains RS iffD2) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   221
by (ftac constrains_imp_subset 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   222
by (Asm_full_simp_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   223
by (blast_tac (claset() addIs [constrains_weaken]) 1);
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   224
qed "Diff_project_constrains";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   225
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   226
Goalw [stable_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   227
     "[| (UN act:acts. Domain act) <= project_set h C; \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   228
\        Diff G (extend_act h `` acts) : stable (extend_set h A) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   229
\     ==> Diff (project C h G) acts : stable A";
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   230
by (etac Diff_project_constrains 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   231
by (assume_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   232
qed "Diff_project_stable";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   233
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   234
(*Converse fails: even if the conclusion holds, H could modify (v o f) 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   235
  simultaneously with other variables, and this action would not be 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   236
  superseded by anything in (extend h G) *)
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   237
Goal "[| UNIV <= project_set h C;  H : (func o f) localTo extend h G |] \
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   238
\     ==> project C h H : func localTo G";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   239
by (asm_full_simp_tac 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   240
    (simpset() addsimps [localTo_def, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   241
			 project_extend_Join RS sym,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   242
			 subset_UNIV RS subset_trans RS Diff_project_stable,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   243
			 Collect_eq_extend_set RS sym]) 1);
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   244
qed "project_localTo_lemma";
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   245
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   246
Goal "extend h F Join G : (v o f) localTo extend h H \
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   247
\     ==> F Join project UNIV h G : v localTo H";
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   248
by (stac (project_set_UNIV RS project_extend_Join RS sym) 1);
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   249
by (asm_simp_tac 
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   250
    (simpset() addsimps [project_set_UNIV RS project_localTo_lemma]) 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   251
qed "project_localTo_I";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   252
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   253
Goalw [projecting_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   254
     "projecting (%G. UNIV) h F ((v o f) localTo extend h H) (v localTo H)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   255
by (blast_tac (claset() addIs [project_localTo_I]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   256
qed "projecting_localTo";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   257
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   258
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   259
(** Reachability and project **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   260
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   261
Goal "[| reachable (extend h F Join G) <= C;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   262
\        z : reachable (extend h F Join G) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   263
\     ==> f z : reachable (F Join project C h G)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   264
by (etac reachable.induct 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   265
by (force_tac (claset() addIs [reachable.Init, project_set_I],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   266
	       simpset()) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   267
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   268
by (force_tac (claset() addIs [project_act_I RSN (3,reachable.Acts)],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   269
	       simpset()) 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   270
by (res_inst_tac [("act","x")] reachable.Acts 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   271
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   272
by (etac extend_act_D 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   273
qed "reachable_imp_reachable_project";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   274
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   275
(*The extra generality in the first premise allows guarantees with STRONG
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   276
  preconditions (localTo) and WEAK postconditions.*)
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   277
Goalw [Constrains_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   278
     "[| reachable (extend h F Join G) <= C;    \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   279
\        F Join project C h G : A Co B |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   280
\     ==> 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
   281
by (full_simp_tac (simpset() addsimps [Join_project_constrains]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   282
by (Clarify_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   283
by (etac constrains_weaken 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   284
by (auto_tac (claset() addDs [reachable_imp_reachable_project], simpset()));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   285
qed "project_Constrains_D";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   286
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   287
Goalw [Stable_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   288
     "[| reachable (extend h F Join G) <= C;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   289
\        F Join project C h G : Stable A |]   \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   290
\     ==> extend h F Join G : Stable (extend_set h A)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   291
by (asm_simp_tac (simpset() addsimps [project_Constrains_D]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   292
qed "project_Stable_D";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   293
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   294
Goalw [Always_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   295
     "[| reachable (extend h F Join G) <= C;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   296
\        F Join project C h G : Always A |]   \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   297
\     ==> extend h F Join G : Always (extend_set h A)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   298
by (force_tac (claset() addIs [reachable.Init, project_set_I],
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   299
               simpset() addsimps [project_Stable_D]) 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   300
qed "project_Always_D";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   301
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   302
Goalw [Increasing_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   303
     "[| reachable (extend h F Join G) <= C;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   304
\        F Join project C h G : Increasing func |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   305
\     ==> extend h F Join G : Increasing (func o f)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   306
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   307
by (stac Collect_eq_extend_set 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   308
by (asm_simp_tac (simpset() addsimps [project_Stable_D]) 1); 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   309
qed "project_Increasing_D";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   310
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   311
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   312
(** Converse results for weak safety: benefits of the argument C *)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   313
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   314
Goal "[| C <= reachable(extend h F Join G);   \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   315
\        x : reachable (F Join project C h G) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   316
\     ==> EX y. h(x,y) : reachable (extend h F Join G)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   317
by (etac reachable.induct 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   318
by (ALLGOALS Asm_full_simp_tac);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   319
(*SLOW: 6.7s*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   320
by (force_tac (claset() delrules [Id_in_Acts]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   321
		        addIs [reachable.Acts, extend_act_D],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   322
	       simpset() addsimps [project_act_def]) 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   323
by (force_tac (claset() addIs [reachable.Init],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   324
	       simpset() addsimps [project_set_def]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   325
qed "reachable_project_imp_reachable";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   326
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   327
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   328
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
   329
\     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
   330
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
   331
			      subset_refl RS reachable_project_imp_reachable], 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   332
	      simpset() addsimps [project_set_def]));
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   333
qed "project_set_reachable_extend_eq";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   334
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   335
(*Perhaps should replace C by reachable...*)
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   336
Goalw [Constrains_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   337
     "[| C <= reachable (extend h F Join G);  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   338
\        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
   339
\     ==> F Join project C h G : A Co B";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   340
by (full_simp_tac (simpset() addsimps [Join_project_constrains, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   341
				       extend_set_Int_distrib]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   342
by (rtac conjI 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   343
by (etac constrains_weaken 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   344
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   345
by (asm_full_simp_tac (simpset() addsimps [Join_constrains]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   346
(*Some generalization of constrains_weaken_L would be better, but what is it?*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   347
by (rewtac constrains_def);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   348
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   349
by (thin_tac "ALL act : Acts G. ?P act" 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   350
by (force_tac (claset() addSDs [reachable_project_imp_reachable], 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   351
	       simpset()) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   352
qed "project_Constrains_I";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   353
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   354
Goalw [Stable_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   355
     "[| C <= reachable (extend h F Join G);  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   356
\        extend h F Join G : Stable (extend_set h A) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   357
\     ==> F Join project C h G : Stable A";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   358
by (asm_simp_tac (simpset() addsimps [project_Constrains_I]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   359
qed "project_Stable_I";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   360
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   361
Goalw [Always_def]
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   362
     "[| C <= reachable (extend h F Join G);  \
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   363
\        extend h F Join G : Always (extend_set h A) |]   \
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   364
\     ==> F Join project C h G : Always A";
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   365
by (auto_tac (claset(), simpset() addsimps [project_Stable_I]));
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   366
by (rewrite_goals_tac [project_set_def, extend_set_def]);
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   367
by (Blast_tac 1);
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   368
qed "project_Always_I";
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   369
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   370
Goalw [Increasing_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   371
     "[| C <= reachable (extend h F Join G);  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   372
\        extend h F Join G : Increasing (func o f) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   373
\     ==> F Join project C h G : Increasing func";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   374
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   375
by (asm_simp_tac (simpset() addsimps [Collect_eq_extend_set RS sym,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   376
				      project_Stable_I]) 1); 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   377
qed "project_Increasing_I";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   378
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   379
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
   380
\     (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
   381
by (blast_tac (claset() addIs [project_Constrains_I, project_Constrains_D]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   382
qed "project_Constrains";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   383
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   384
Goalw [Stable_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   385
     "(F Join project (reachable (extend h F Join G)) h G : Stable A)  =  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   386
\     (extend h F Join G : Stable (extend_set h A))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   387
by (rtac project_Constrains 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   388
qed "project_Stable";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   389
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   390
Goal
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   391
   "(F Join project (reachable (extend h F Join G)) h G : Increasing func)  = \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   392
\   (extend h F Join G : Increasing (func o f))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   393
by (asm_simp_tac (simpset() addsimps [Increasing_def, project_Stable,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   394
				      Collect_eq_extend_set RS sym]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   395
qed "project_Increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   396
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   397
(** A lot of redundant theorems: all are proved to facilitate reasoning
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   398
    about guarantees. **)
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   399
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   400
Goalw [projecting_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   401
     "projecting (%G. reachable (extend h F Join G)) h F \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   402
\                (extend_set h A Co extend_set h B) (A Co B)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   403
by (blast_tac (claset() addIs [project_Constrains_I]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   404
qed "projecting_Constrains";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   405
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   406
Goalw [Stable_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   407
     "projecting (%G. reachable (extend h F Join G)) h F \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   408
\                (Stable (extend_set h A)) (Stable A)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   409
by (rtac projecting_Constrains 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   410
qed "projecting_Stable";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   411
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   412
Goalw [projecting_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   413
     "projecting (%G. reachable (extend h F Join G)) h F \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   414
\                (Always (extend_set h A)) (Always A)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   415
by (blast_tac (claset() addIs [project_Always_I]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   416
qed "projecting_Always";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   417
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   418
Goalw [projecting_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   419
     "projecting (%G. reachable (extend h F Join G)) h F \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   420
\                (Increasing (func o f)) (Increasing func)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   421
by (blast_tac (claset() addIs [project_Increasing_I]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   422
qed "projecting_Increasing";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   423
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   424
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   425
     "extending (%G. reachable (extend h F Join G)) h F X' \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   426
\               (extend_set h A Co extend_set h B) (A Co B)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   427
by (blast_tac (claset() addIs [project_Constrains_D]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   428
qed "extending_Constrains";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   429
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   430
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   431
     "extending (%G. reachable (extend h F Join G)) h F X' \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   432
\               (Stable (extend_set h A)) (Stable A)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   433
by (blast_tac (claset() addIs [project_Stable_D]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   434
qed "extending_Stable";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   435
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   436
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   437
     "extending (%G. reachable (extend h F Join G)) h F X' \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   438
\               (Always (extend_set h A)) (Always A)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   439
by (blast_tac (claset() addIs [project_Always_D]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   440
qed "extending_Always";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   441
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   442
val [prem] = 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   443
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   444
     "(!!G. reachable (extend h F Join G) <= C G)  \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   445
\     ==> extending C h F X' \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   446
\                   (Increasing (func o f)) (Increasing func)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   447
by (blast_tac (claset() addIs [prem RS project_Increasing_D]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   448
qed "extending_Increasing";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   449
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   450
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   451
(** Progress includes safety in the definition of ensures **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   452
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   453
(*** Progress for (project C h F) ***)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   454
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   455
(** transient **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   456
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   457
(*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
   458
  transient one.  Could have C=UNIV of course*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   459
Goalw [transient_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   460
     "[| ALL act: Acts F. act ^^ extend_set h A <= - extend_set h A --> \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   461
\                      Domain act <= C;    \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   462
\        F : transient (extend_set h A) |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   463
\     ==> project C h F : transient A";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   464
by (auto_tac (claset() delrules [ballE],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   465
              simpset() addsimps [Domain_project_act, Int_absorb2]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   466
by (REPEAT (ball_tac 1));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   467
by (auto_tac (claset(),
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   468
              simpset() addsimps [extend_set_def, project_set_def, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   469
				  project_act_def]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   470
by (ALLGOALS Blast_tac);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   471
qed "transient_extend_set_imp_project_transient";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   472
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   473
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   474
(*UNUSED.  WHY??
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   475
  Converse of the above...it requires a strong assumption about actions
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   476
  being enabled for all possible values of the new variables.*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   477
Goalw [transient_def]
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   478
     "[| project C h F : transient A;  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   479
\        ALL act: Acts F. project_act C h act ^^ A <= - A --> \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   480
\                         Domain act <= C \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   481
\             & extend_set h (project_set h (Domain act)) <= Domain act |]  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   482
\     ==> F : transient (extend_set h A)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   483
by (auto_tac (claset() delrules [ballE],
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   484
	      simpset() addsimps [Domain_project_act]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   485
by (ball_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   486
by (rtac bexI 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   487
by (assume_tac 2);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   488
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   489
by (eres_inst_tac [("P", "A <= ?B")] rev_mp 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   490
by (force_tac (claset(), simpset() addsimps [Int_absorb2]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   491
(*The Domain requirement's proved; must prove the Image requirement*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   492
by (res_inst_tac [("y1", "x")] (surj_h RS surjD RS exE) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   493
by (res_inst_tac [("y1", "xa")] (surj_h RS surjD RS exE) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   494
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   495
by (thin_tac "A <= ?B" 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   496
by (force_tac (claset() addSIs [ImageI, project_act_I], simpset()) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   497
qed "project_transient_imp_transient_extend_set";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   498
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   499
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   500
(** ensures **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   501
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   502
(*For simplicity, the complicated condition on C is eliminated
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   503
  NOT SURE THIS IS GOOD FOR ANYTHING: CAN'T PROVE LEADSTO THEOREM*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   504
Goal "F : (extend_set h A) ensures (extend_set h B) \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   505
\     ==> project UNIV h F : A ensures B";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   506
by (asm_full_simp_tac
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   507
    (simpset() addsimps [ensures_def, project_constrains, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   508
			 transient_extend_set_imp_project_transient,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   509
			 extend_set_Un_distrib RS sym, 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   510
			 extend_set_Diff_distrib RS sym]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   511
by (Blast_tac 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   512
qed "ensures_extend_set_imp_project_ensures";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   513
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   514
(*A strong condition: F can do anything that project G can.*)
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   515
Goal "[| ALL D. project C h G : transient D --> F : transient D;  \
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   516
\        extend h F Join G : stable C;  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   517
\        F Join project C h G : A ensures B |] \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   518
\     ==> 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
   519
by (case_tac "A <= B" 1);
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   520
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
   521
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
   522
				       Join_stable, Join_transient]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   523
by (REPEAT_FIRST (rtac conjI));
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   524
by (blast_tac (claset() addDs [extend_transient RS iffD2] 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   525
                        addIs [transient_strengthen]) 3);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   526
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
   527
				       project_extend_constrains_I], 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   528
		       simpset()) 1));
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   529
qed_spec_mp "Join_project_ensures";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   530
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   531
Goal "[| ALL D. project C h G : transient D --> F : transient D;  \
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   532
\        extend h F Join G : stable C;  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   533
\        F Join project C h G : A leadsTo B |] \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   534
\     ==> 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
   535
by (etac leadsTo_induct 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   536
by (asm_simp_tac (simpset() delsimps UN_simps
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   537
		  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
   538
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
   539
			       leadsTo_Trans]) 2);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   540
by (blast_tac (claset() addIs [leadsTo_Basis, Join_project_ensures]) 1);
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   541
qed "project_leadsTo_lemma";
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   542
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   543
(*Instance of the previous theorem for STRONG progress*)
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   544
Goal "[| ALL D. project UNIV h G : transient D --> F : transient D;  \
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   545
\        F Join project UNIV h G : A leadsTo B |] \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   546
\     ==> extend h F Join G : (extend_set h A) leadsTo (extend_set h B)";
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   547
by (dtac project_leadsTo_lemma 1);
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   548
by Auto_tac;
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   549
qed "project_UNIV_leadsTo_lemma";
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   550
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   551
(** Towards the analogous theorem for WEAK progress*)
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   552
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   553
Goal "[| ALL D. project C h G : transient D --> F : transient D;  \
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   554
\        extend h F Join G : stable C;  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   555
\        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
   556
\     ==> 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
   557
by (etac leadsTo_induct 1);
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   558
by (asm_simp_tac (simpset() delsimps UN_simps
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   559
		  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
   560
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
   561
			       leadsTo_Trans]) 2);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   562
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
   563
val lemma = result();
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   564
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   565
Goal "[| ALL D. project C h G : transient D --> F : transient D;  \
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   566
\        extend h F Join G : stable C;  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   567
\        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
   568
\     ==> extend h F Join G : (C Int extend_set h A) leadsTo (extend_set h B)";
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   569
by (rtac (lemma RS leadsTo_weaken) 1);
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   570
by (auto_tac (claset() addIs [project_set_I], simpset()));
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   571
val lemma2 = result();
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   572
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   573
Goal "[| C = (reachable (extend h F Join G)); \
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   574
\        ALL D. project C h G : transient D --> F : transient D;  \
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   575
\        F Join project C h G : A LeadsTo B |] \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   576
\     ==> 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
   577
by (asm_full_simp_tac 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   578
    (simpset() addsimps [LeadsTo_def, lemma2, stable_reachable, 
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   579
			 project_set_reachable_extend_eq]) 1);
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   580
qed "Join_project_LeadsTo";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   581
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   582
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   583
(*** GUARANTEES and EXTEND ***)
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   584
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   585
(** Strong precondition and postcondition; doesn't seem very useful. **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   586
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   587
Goal "F : X guarantees Y ==> \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   588
\     extend h F : (extend h `` X) guarantees (extend h `` Y)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   589
by (rtac guaranteesI 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   590
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   591
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
   592
			       guaranteesD]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   593
qed "guarantees_imp_extend_guarantees";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   594
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   595
Goal "extend h F : (extend h `` X) guarantees (extend h `` Y) \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   596
\    ==> F : X guarantees Y";
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   597
by (auto_tac (claset(), simpset() addsimps [guarantees_eq]));
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   598
by (dres_inst_tac [("x", "extend h G")] spec 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   599
by (asm_full_simp_tac 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   600
    (simpset() delsimps [extend_Join] 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   601
           addsimps [extend_Join RS sym, inj_extend RS inj_image_mem_iff]) 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   602
qed "extend_guarantees_imp_guarantees";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   603
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   604
Goal "(extend h F : (extend h `` X) guarantees (extend h `` Y)) = \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   605
\    (F : X guarantees Y)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   606
by (blast_tac (claset() addIs [guarantees_imp_extend_guarantees,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   607
			       extend_guarantees_imp_guarantees]) 1);
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   608
qed "extend_guarantees_eq";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   609
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   610
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   611
(*Weak precondition and postcondition; this is the good one!
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   612
  Not clear that it has a converse [or that we want one!]*)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   613
Goal "[| F : X guarantees Y;  \
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   614
\        projecting C h F X' X;  extending C h F X' Y' Y |] \
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   615
\     ==> extend h F : X' guarantees Y'";
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   616
by (rtac guaranteesI 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   617
by (auto_tac (claset(), 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   618
        simpset() addsimps [guaranteesD, projecting_def, extending_def]));
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   619
qed "project_guarantees";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   620
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   621
(** It seems that neither "guarantees" law can be proved from the other. **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   622
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   623
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   624
(*** guarantees corollaries ***)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   625
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   626
(** Most could be deleted: the required versions are easy to prove **)
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   627
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   628
Goal "F : UNIV guarantees increasing func \
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   629
\     ==> extend h F : X' guarantees increasing (func o f)";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   630
by (etac project_guarantees 1);
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   631
by (rtac extending_increasing 2);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   632
by (rtac projecting_UNIV 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   633
qed "extend_guar_increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   634
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   635
Goal "F : UNIV guarantees Increasing func \
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   636
\     ==> extend h F : X' guarantees Increasing (func o f)";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   637
by (etac project_guarantees 1);
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   638
by (rtac extending_Increasing 2);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   639
by (rtac projecting_UNIV 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   640
by Auto_tac;
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   641
qed "extend_guar_Increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   642
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   643
Goal "F : (v localTo G) guarantees increasing func  \
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   644
\     ==> extend h F : (v o f) localTo (extend h G)  \
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   645
\                      guarantees increasing (func o f)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   646
by (etac project_guarantees 1);
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   647
by (rtac extending_increasing 2);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   648
by (rtac projecting_localTo 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   649
qed "extend_localTo_guar_increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   650
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   651
Goal "F : (v localTo G) guarantees Increasing func  \
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   652
\     ==> extend h F : (v o f) localTo (extend h G)  \
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   653
\                      guarantees Increasing (func o f)";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   654
by (etac project_guarantees 1);
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   655
by (rtac extending_Increasing 2);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   656
by (rtac projecting_localTo 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   657
by Auto_tac;
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   658
qed "extend_localTo_guar_Increasing";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   659
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   660
Goal "F : Always A guarantees Always B \
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   661
\ ==> extend h F : Always(extend_set h A) guarantees Always(extend_set h B)";
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   662
by (etac project_guarantees 1);
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   663
by (rtac extending_Always 2);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   664
by (rtac projecting_Always 1);
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   665
qed "extend_guar_Always";
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   666
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   667
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   668
(** Guarantees with a leadsTo postcondition **)
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   669
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   670
(*Bridges the gap between the "old" and "new" condition of the leadsTo rules*)
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   671
Goal "[| ALL x. project C h G ~: transient {x}; project C h G: transient D |] \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   672
\     ==> F : transient D";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   673
by (case_tac "D={}" 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   674
by (auto_tac (claset() addIs [transient_strengthen], simpset()));
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   675
qed "transient_lemma";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   676
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   677
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   678
(*Previously tried to prove
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   679
[| G : f localTo extend h F; project C h G : transient D |] ==> F : transient D
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   680
but it can fail if C removes some parts of an action of G.*)
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   681
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   682
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   683
Goal "[| G : f localTo extend h F; \
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   684
\        Disjoint (extend h F) G |] ==> project C h G : stable {x}";
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   685
by (asm_full_simp_tac
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   686
    (simpset() addsimps [localTo_imp_stable,
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   687
			 extend_set_sing, project_stable_I]) 1);
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   688
qed "localTo_imp_project_stable";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   689
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   690
Goal "F : stable{s} ==> F ~: transient {s}";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   691
by (auto_tac (claset(), 
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   692
	      simpset() addsimps [FP_def, transient_def,
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   693
				  stable_def, constrains_def]));
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   694
qed "stable_sing_imp_not_transient";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   695
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   696
by (auto_tac (claset(), 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   697
	      simpset() addsimps [FP_def, transient_def,
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   698
				  stable_def, constrains_def]));
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   699
qed "stable_sing_imp_not_transient";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   700
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   701
Goal "[| F Join project UNIV h G : A leadsTo B;    \
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   702
\        G : f localTo extend h F; \
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   703
\        Disjoint (extend h F) G |]  \
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   704
\     ==> extend h F Join G : (extend_set h A) leadsTo (extend_set h B)";
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   705
by (rtac project_UNIV_leadsTo_lemma 1);
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   706
by (Clarify_tac 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   707
by (rtac transient_lemma 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   708
by (auto_tac (claset(), 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   709
	      simpset() addsimps [localTo_imp_project_stable, 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   710
				  stable_sing_imp_not_transient]));
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   711
qed "project_leadsTo_D";
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   712
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   713
Goal "[| F Join project (reachable (extend h F Join G)) h G : A LeadsTo B; \
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   714
\         G : f localTo extend h F; \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   715
\         Disjoint (extend h F) G |]  \
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   716
\      ==> extend h F Join G : (extend_set h A) LeadsTo (extend_set h B)";
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   717
by (rtac (refl RS Join_project_LeadsTo) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   718
by (Clarify_tac 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   719
by (rtac transient_lemma 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   720
by (auto_tac (claset(), 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   721
	      simpset() addsimps [localTo_imp_project_stable, 
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   722
				  stable_sing_imp_not_transient]));
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   723
qed "project_LeadsTo_D";
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   724
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   725
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   726
     "extending (%G. UNIV) h F \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   727
\                (f localTo extend h F) \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   728
\                (extend_set h A leadsTo extend_set h B) (A leadsTo B)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   729
by (blast_tac (claset() addSDs [Join_localTo RS iffD1]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   730
			addIs [project_leadsTo_D]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   731
qed "extending_leadsTo";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   732
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   733
Goalw [extending_def]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   734
     "extending (%G. reachable (extend h F Join G)) h F \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   735
\                (f localTo extend h F) \
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   736
\                (extend_set h A LeadsTo extend_set h B) (A LeadsTo B)";
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   737
by (blast_tac (claset() addSDs [Join_localTo RS iffD1]
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   738
			addIs [project_LeadsTo_D]) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   739
qed "extending_LeadsTo";
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7660
diff changeset
   740
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   741
(*STRONG precondition and postcondition*)
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   742
Goal "F : (A co A') guarantees (B leadsTo B')  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   743
\ ==> extend h F : ((extend_set h A) co (extend_set h A'))  \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   744
\                   Int (f localTo (extend h F)) \
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   745
\                  guarantees ((extend_set h B) leadsTo (extend_set h B'))";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   746
by (etac project_guarantees 1);
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   747
by (rtac (extending_leadsTo RS extending_weaken) 2);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   748
by (rtac (projecting_constrains RS projecting_weaken) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   749
by Auto_tac;
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   750
qed "extend_co_guar_leadsTo";
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   751
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   752
(*WEAK precondition and postcondition*)
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   753
Goal "F : (A Co A') guarantees (B LeadsTo B')  \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   754
\ ==> 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
   755
\                   Int (f localTo (extend h F)) \
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   756
\                  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
   757
by (etac project_guarantees 1);
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   758
by (rtac (extending_LeadsTo RS extending_weaken) 2);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   759
by (rtac (projecting_Constrains RS projecting_weaken) 1);
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
   760
by Auto_tac;
7660
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   761
qed "extend_Co_guar_LeadsTo";
7e38237edfcb now with (weak safety) guarantees (weak progress) with Extend
paulson
parents: 7630
diff changeset
   762
7630
d0e4a6f1f05c working snapshot with new theory "Project"
paulson
parents:
diff changeset
   763
Close_locale "Extend";