src/HOL/UNITY/Constrains.ML
author paulson
Thu, 29 Apr 1999 10:51:58 +0200
changeset 6536 281d44905cab
parent 6535 880f31a62784
child 6570 a7d7985050a9
permissions -rw-r--r--
made many specification operators infix
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Constrains
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     2
    ID:         $Id$
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     5
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     6
Safety relations: restricted to the set of reachable states.
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     7
*)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     8
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     9
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    10
(*** traces and reachable ***)
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    11
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    12
Goal "reachable F = {s. EX evs. (s,evs): traces (Init F) (Acts F)}";
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    13
by Safe_tac;
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    14
by (etac traces.induct 2);
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    15
by (etac reachable.induct 1);
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    16
by (ALLGOALS (blast_tac (claset() addIs reachable.intrs @ traces.intrs)));
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    17
qed "reachable_equiv_traces";
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    18
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    19
Goal "Init F <= reachable F";
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    20
by (blast_tac (claset() addIs reachable.intrs) 1);
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    21
qed "Init_subset_reachable";
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    22
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    23
Goal "Acts G <= Acts F ==> G : stable (reachable F)";
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    24
by (blast_tac (claset() addIs [stableI, constrainsI] @ reachable.intrs) 1);
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    25
qed "stable_reachable";
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    26
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    27
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    28
(*The set of all reachable states is an invariant...*)
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    29
Goal "F : invariant (reachable F)";
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    30
by (simp_tac (simpset() addsimps [invariant_def]) 1);
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    31
by (blast_tac (claset() addIs (stable_reachable::reachable.intrs)) 1);
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    32
qed "invariant_reachable";
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    33
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    34
(*...in fact the strongest invariant!*)
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    35
Goal "F : invariant A ==> reachable F <= A";
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    36
by (full_simp_tac 
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    37
    (simpset() addsimps [stable_def, constrains_def, invariant_def]) 1);
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    38
by (rtac subsetI 1);
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    39
by (etac reachable.induct 1);
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    40
by (REPEAT (blast_tac (claset() addIs reachable.intrs) 1));
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    41
qed "invariant_includes_reachable";
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    42
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 6295
diff changeset
    43
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    44
(*** Co ***)
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    45
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    46
overload_1st_set "Constrains.op Co";
5340
d75c03cf77b5 Misc changes
paulson
parents: 5319
diff changeset
    47
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    48
(*F : B co B' ==> F : (reachable F Int B) co (reachable F Int B')*)
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    49
bind_thm ("constrains_reachable_Int",
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    50
	  subset_refl RS
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    51
	  rewrite_rule [stable_def] stable_reachable RS 
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    52
	  constrains_Int);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    53
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    54
Goalw [Constrains_def] "F : A co A' ==> F : A Co A'";
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
    55
by (blast_tac (claset() addIs [constrains_reachable_Int]) 1);
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    56
qed "constrains_imp_Constrains";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    57
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
    58
Goalw [stable_def, Stable_def] "F : stable A ==> F : Stable A";
5631
707f30bc7fe7 new theorems
paulson
parents: 5620
diff changeset
    59
by (etac constrains_imp_Constrains 1);
707f30bc7fe7 new theorems
paulson
parents: 5620
diff changeset
    60
qed "stable_imp_Stable";
707f30bc7fe7 new theorems
paulson
parents: 5620
diff changeset
    61
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    62
val prems = Goal
5620
3ac11c4af76a tidying and renaming
paulson
parents: 5584
diff changeset
    63
    "(!!act s s'. [| act: Acts F;  (s,s') : act;  s: A |] ==> s': A') \
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    64
\    ==> F : A Co A'";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    65
by (rtac constrains_imp_Constrains 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    66
by (blast_tac (claset() addIs (constrainsI::prems)) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    67
qed "ConstrainsI";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    68
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    69
Goalw [Constrains_def, constrains_def] "F : {} Co B";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    70
by (Blast_tac 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    71
qed "Constrains_empty";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    72
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    73
Goal "F : A Co UNIV";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    74
by (blast_tac (claset() addIs [ConstrainsI]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    75
qed "Constrains_UNIV";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    76
AddIffs [Constrains_empty, Constrains_UNIV];
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    77
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    78
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    79
Goalw [Constrains_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    80
    "[| F : A Co A'; A'<=B' |] ==> F : A Co B'";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    81
by (blast_tac (claset() addIs [constrains_weaken_R]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    82
qed "Constrains_weaken_R";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    83
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    84
Goalw [Constrains_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    85
    "[| F : A Co A'; B<=A |] ==> F : B Co A'";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    86
by (blast_tac (claset() addIs [constrains_weaken_L]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    87
qed "Constrains_weaken_L";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    88
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    89
Goalw [Constrains_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    90
   "[| F : A Co A'; B<=A; A'<=B' |] ==> F : B Co B'";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    91
by (blast_tac (claset() addIs [constrains_weaken]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    92
qed "Constrains_weaken";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    93
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    94
(** Union **)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    95
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    96
Goalw [Constrains_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    97
    "[| F : A Co A'; F : B Co B' |]   \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    98
\    ==> F : (A Un B) Co (A' Un B')";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    99
by (blast_tac (claset() addIs [constrains_Un RS constrains_weaken]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   100
qed "Constrains_Un";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   101
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   102
Goal "ALL i:I. F : (A i) Co (A' i) \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   103
\     ==> F : (UN i:I. A i) Co (UN i:I. A' i)";
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   104
by (asm_full_simp_tac (simpset() addsimps [Constrains_def]) 1);
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   105
by (dtac ball_constrains_UN 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   106
by (blast_tac (claset() addIs [constrains_weaken]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   107
qed "ball_Constrains_UN";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   108
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   109
(** Intersection **)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   110
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   111
Goalw [Constrains_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   112
    "[| F : A Co A'; F : B Co B' |]   \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   113
\    ==> F : (A Int B) Co (A' Int B')";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   114
by (blast_tac (claset() addIs [constrains_Int RS constrains_weaken]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   115
qed "Constrains_Int";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   116
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   117
Goal "ALL i:I. F : (A i) Co (A' i)   \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   118
\     ==> F : (INT i:I. A i) Co (INT i:I. A' i)";
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   119
by (asm_full_simp_tac (simpset() addsimps [Constrains_def]) 1);
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   120
by (dtac ball_constrains_INT 1);
5340
d75c03cf77b5 Misc changes
paulson
parents: 5319
diff changeset
   121
by (dtac constrains_reachable_Int 1);
d75c03cf77b5 Misc changes
paulson
parents: 5319
diff changeset
   122
by (blast_tac (claset() addIs [constrains_weaken]) 1);
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   123
qed "ball_Constrains_INT";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   124
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   125
Goal "F : A Co A' ==> reachable F Int A <= A'";
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   126
by (asm_full_simp_tac (simpset() addsimps [Constrains_def]) 1);
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   127
by (dtac constrains_imp_subset 1);
6295
351b3c2b0d83 removed the infernal States, eqStates, compatible, etc.
paulson
parents: 6012
diff changeset
   128
by (ALLGOALS
351b3c2b0d83 removed the infernal States, eqStates, compatible, etc.
paulson
parents: 6012
diff changeset
   129
    (full_simp_tac (simpset() addsimps [Int_subset_iff, Int_lower1])));
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   130
qed "Constrains_imp_subset";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   131
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   132
Goalw [Constrains_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   133
    "[| F : A Co B; F : B Co C |]   \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   134
\    ==> F : A Co C";
6295
351b3c2b0d83 removed the infernal States, eqStates, compatible, etc.
paulson
parents: 6012
diff changeset
   135
by (blast_tac (claset() addIs [constrains_trans, constrains_weaken]) 1);
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   136
qed "Constrains_trans";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   137
6295
351b3c2b0d83 removed the infernal States, eqStates, compatible, etc.
paulson
parents: 6012
diff changeset
   138
Goalw [Constrains_def, constrains_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   139
   "[| F : A Co (A' Un B); F : B Co B' |] \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   140
\   ==> F : A Co (A' Un B')";
6295
351b3c2b0d83 removed the infernal States, eqStates, compatible, etc.
paulson
parents: 6012
diff changeset
   141
by (Clarify_tac 1);
351b3c2b0d83 removed the infernal States, eqStates, compatible, etc.
paulson
parents: 6012
diff changeset
   142
by (Blast_tac 1);
6012
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5804
diff changeset
   143
qed "Constrains_cancel";
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5804
diff changeset
   144
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   145
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   146
(*** Stable ***)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   147
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   148
Goal "(F : Stable A) = (F : stable (reachable F Int A))";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   149
by (simp_tac (simpset() addsimps [Stable_def, Constrains_def, stable_def]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   150
qed "Stable_eq_stable";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   151
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   152
Goalw [Stable_def] "F : A Co A ==> F : Stable A";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   153
by (assume_tac 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   154
qed "StableI";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   155
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   156
Goalw [Stable_def] "F : Stable A ==> F : A Co A";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   157
by (assume_tac 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   158
qed "StableD";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   159
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   160
Goalw [Stable_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   161
    "[| F : Stable A; F : Stable A' |] ==> F : Stable (A Un A')";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   162
by (blast_tac (claset() addIs [Constrains_Un]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   163
qed "Stable_Un";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   164
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   165
Goalw [Stable_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   166
    "[| F : Stable A; F : Stable A' |] ==> F : Stable (A Int A')";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   167
by (blast_tac (claset() addIs [Constrains_Int]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   168
qed "Stable_Int";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   169
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   170
Goalw [Stable_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   171
    "[| F : Stable C; F : A Co (C Un A') |]   \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   172
\    ==> F : (C Un A) Co (C Un A')";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   173
by (blast_tac (claset() addIs [Constrains_Un RS Constrains_weaken]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   174
qed "Stable_Constrains_Un";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   175
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   176
Goalw [Stable_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   177
    "[| F : Stable C; F : (C Int A) Co A' |]   \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   178
\    ==> F : (C Int A) Co (C Int A')";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   179
by (blast_tac (claset() addIs [Constrains_Int RS Constrains_weaken]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   180
qed "Stable_Constrains_Int";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   181
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   182
Goalw [Stable_def]
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   183
    "(ALL i:I. F : Stable (A i)) ==> F : Stable (UN i:I. A i)";
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   184
by (etac ball_Constrains_UN 1);
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   185
qed "ball_Stable_UN";
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   186
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   187
Goalw [Stable_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   188
    "(ALL i:I. F : Stable (A i)) ==> F : Stable (INT i:I. A i)";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   189
by (etac ball_Constrains_INT 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   190
qed "ball_Stable_INT";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   191
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   192
Goal "F : Stable (reachable F)";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   193
by (simp_tac (simpset() addsimps [Stable_eq_stable, stable_reachable]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   194
qed "Stable_reachable";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   195
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   196
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   197
5784
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   198
(*** Increasing ***)
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   199
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   200
Goalw [Increasing_def, Stable_def, Constrains_def, stable_def, constrains_def]
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   201
     "Increasing f <= Increasing (length o f)";
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   202
by Auto_tac;
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   203
by (blast_tac (claset() addIs [prefix_length_le, le_trans]) 1);
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   204
qed "Increasing_size";
5784
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   205
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   206
Goalw [Increasing_def]
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   207
     "Increasing f <= {F. ALL z::nat. F: Stable {s. z < f s}}";
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   208
by (simp_tac (simpset() addsimps [Suc_le_eq RS sym]) 1);
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   209
by (Blast_tac 1);
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   210
qed "Increasing_Stable_less";
5784
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   211
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   212
Goalw [increasing_def, Increasing_def]
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   213
     "F : increasing f ==> F : Increasing f";
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   214
by (blast_tac (claset() addIs [stable_imp_Stable]) 1);
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   215
qed "increasing_imp_Increasing";
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   216
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   217
54276fba8420 the Increasing operator
paulson
parents: 5669
diff changeset
   218
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   219
(*** The Elimination Theorem.  The "free" m has become universally quantified!
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   220
     Should the premise be !!m instead of ALL m ?  Would make it harder to use
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   221
     in forward proof. ***)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   222
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   223
Goalw [Constrains_def, constrains_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   224
    "[| ALL m. F : {s. s x = m} Co (B m) |] \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   225
\    ==> F : {s. s x : M} Co (UN m:M. B m)";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   226
by (Blast_tac 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   227
qed "Elimination";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   228
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   229
(*As above, but for the trivial case of a one-variable state, in which the
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   230
  state is identified with its one variable.*)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   231
Goalw [Constrains_def, constrains_def]
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   232
    "(ALL m. F : {m} Co (B m)) ==> F : M Co (UN m:M. B m)";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   233
by (Blast_tac 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   234
qed "Elimination_sing";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   235
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   236
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   237
(*** Specialized laws for handling Invariants ***)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   238
5620
3ac11c4af76a tidying and renaming
paulson
parents: 5584
diff changeset
   239
(** Natural deduction rules for "Invariant F A" **)
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   240
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   241
Goal "[| Init F<=A;  F : Stable A |] ==> F : Invariant A";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   242
by (asm_simp_tac (simpset() addsimps [Invariant_def]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   243
qed "InvariantI";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   244
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   245
Goal "F : Invariant A ==> Init F<=A & F : Stable A";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   246
by (asm_full_simp_tac (simpset() addsimps [Invariant_def]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   247
qed "InvariantD";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   248
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   249
bind_thm ("InvariantE", InvariantD RS conjE);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   250
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   251
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   252
(*The set of all reachable states is the strongest Invariant*)
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   253
Goal "F : Invariant A ==> reachable F <= A";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   254
by (full_simp_tac 
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   255
    (simpset() addsimps [Stable_def, Constrains_def, constrains_def, 
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   256
			 Invariant_def]) 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   257
by (rtac subsetI 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   258
by (etac reachable.induct 1);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   259
by (REPEAT (blast_tac (claset() addIs reachable.intrs) 1));
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   260
qed "Invariant_includes_reachable";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   261
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   262
Goalw [Invariant_def, invariant_def, Stable_def, Constrains_def, stable_def]
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   263
     "F : invariant A ==> F : Invariant A";
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   264
by (blast_tac (claset() addIs [constrains_reachable_Int]) 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   265
qed "invariant_imp_Invariant";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   266
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   267
Goalw [Invariant_def, invariant_def, Stable_def, Constrains_def, stable_def]
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   268
     "Invariant A = {F. F : invariant (reachable F Int A)}";
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   269
by (blast_tac (claset() addIs reachable.intrs) 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   270
qed "Invariant_eq_invariant_reachable";
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   271
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   272
(*Invariant is the "always" notion*)
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   273
Goal "Invariant A = {F. reachable F <= A}";
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   274
by (auto_tac (claset() addDs [invariant_includes_reachable],
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   275
	      simpset() addsimps [Int_absorb2, invariant_reachable,
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   276
				  Invariant_eq_invariant_reachable]));
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   277
qed "Invariant_eq_always";
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   278
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   279
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   280
Goal "Invariant A = (UN I: Pow A. invariant I)";
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   281
by (simp_tac (simpset() addsimps [Invariant_eq_always]) 1);
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   282
by (blast_tac (claset() addIs [invariantI, impOfSubs Init_subset_reachable, 
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   283
                               stable_reachable,
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   284
			       impOfSubs invariant_includes_reachable]) 1);
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   285
qed "Invariant_eq_UN_invariant";
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   286
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   287
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   288
(*** "Co" rules involving Invariant ***)
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   289
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   290
Goal "[| F : Invariant INV;  F : (INV Int A) Co A' |]   \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   291
\     ==> F : A Co A'";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   292
by (asm_full_simp_tac
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   293
    (simpset() addsimps [Invariant_includes_reachable RS Int_absorb2,
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   294
			 Constrains_def, Int_assoc RS sym]) 1);
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   295
qed "Invariant_ConstrainsI";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   296
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   297
(* [| F : Invariant INV; F : (INV Int A) Co A |]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   298
   ==> F : Stable A *)
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   299
bind_thm ("Invariant_StableI", Invariant_ConstrainsI RS StableI);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   300
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   301
Goal "[| F : Invariant INV;  F : A Co A' |]   \
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   302
\     ==> F : A Co (INV Int A')";
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   303
by (asm_full_simp_tac
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   304
    (simpset() addsimps [Invariant_includes_reachable RS Int_absorb2,
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   305
			 Constrains_def, Int_assoc RS sym]) 1);
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   306
qed "Invariant_ConstrainsD";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   307
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   308
bind_thm ("Invariant_StableD", StableD RSN (2,Invariant_ConstrainsD));
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   309
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   310
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   311
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   312
(** Conjoining Invariants **)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   313
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   314
Goal "[| F : Invariant A;  F : Invariant B |] ==> F : Invariant (A Int B)";
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5784
diff changeset
   315
by (auto_tac (claset(), simpset() addsimps [Invariant_eq_always]));
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   316
qed "Invariant_Int";
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   317
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   318
(*Delete the nearest invariance assumption (which will be the second one
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   319
  used by Invariant_Int) *)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   320
val Invariant_thin =
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   321
    read_instantiate_sg (sign_of thy)
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   322
                [("V", "?F : Invariant ?A")] thin_rl;
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   323
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   324
(*Combines two invariance ASSUMPTIONS into one.  USEFUL??*)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   325
val Invariant_Int_tac = dtac Invariant_Int THEN' 
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   326
                        assume_tac THEN'
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   327
			etac Invariant_thin;
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   328
5319
7356d0c88b1b Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents: 5313
diff changeset
   329
(*Combines a list of invariance THEOREMS into one.*)
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   330
val Invariant_Int_rule = foldr1 (fn (th1,th2) => [th1,th2] MRS Invariant_Int);
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   331
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   332
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   333
(*To allow expansion of the program's definition when appropriate*)
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   334
val program_defs_ref = ref ([] : thm list);
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   335
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   336
(*proves "co" properties when the program is specified*)
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   337
fun constrains_tac i = 
5422
578dc167453f Moved constrains_tac from SubstAx to Constrains.
paulson
parents: 5340
diff changeset
   338
   SELECT_GOAL
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   339
      (EVERY [simp_tac (simpset() addsimps !program_defs_ref) 1,
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   340
	      REPEAT (resolve_tac [StableI, stableI,
5422
578dc167453f Moved constrains_tac from SubstAx to Constrains.
paulson
parents: 5340
diff changeset
   341
				   constrains_imp_Constrains] 1),
578dc167453f Moved constrains_tac from SubstAx to Constrains.
paulson
parents: 5340
diff changeset
   342
	      rtac constrainsI 1,
5426
566f47250bd0 A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents: 5422
diff changeset
   343
	      Full_simp_tac 1,
5620
3ac11c4af76a tidying and renaming
paulson
parents: 5584
diff changeset
   344
	      REPEAT (FIRSTGOAL (etac disjE)),
5422
578dc167453f Moved constrains_tac from SubstAx to Constrains.
paulson
parents: 5340
diff changeset
   345
	      ALLGOALS Clarify_tac,
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5631
diff changeset
   346
	      ALLGOALS Asm_full_simp_tac]) i;
5422
578dc167453f Moved constrains_tac from SubstAx to Constrains.
paulson
parents: 5340
diff changeset
   347
578dc167453f Moved constrains_tac from SubstAx to Constrains.
paulson
parents: 5340
diff changeset
   348