src/HOL/UNITY/UNITY.ML
author nipkow
Fri, 27 Nov 1998 17:00:30 +0100
changeset 5983 79e301a6a51b
parent 5804 8e0a4c4fd67b
child 6012 1894bfc4aee9
permissions -rw-r--r--
At last: linear arithmetic for nat!
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/UNITY
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     2
    ID:         $Id$
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     5
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     6
The basic UNITY theory (revised version, based upon the "co" operator)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     7
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     8
From Misra, "A Logic for Concurrent Programming", 1994
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     9
*)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    10
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    11
set proof_timing;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    12
HOL_quantifiers := false;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    13
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    14
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    15
(*** constrains ***)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    16
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    17
overload_1st_set "UNITY.constrains";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    18
overload_1st_set "UNITY.stable";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    19
overload_1st_set "UNITY.unless";
5340
d75c03cf77b5 Misc changes
paulson
parents: 5313
diff changeset
    20
5277
e4297d03e5d2 A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents: 5253
diff changeset
    21
val prems = Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    22
    "(!!act s s'. [| act: Acts F;  (s,s') : act;  s: A |] ==> s': A') \
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    23
\    ==> F : constrains A A'";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    24
by (blast_tac (claset() addIs prems) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    25
qed "constrainsI";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    26
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    27
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    28
    "[| F : constrains A A'; act: Acts F;  (s,s'): act;  s: A |] ==> s': A'";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    29
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    30
qed "constrainsD";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    31
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    32
Goalw [constrains_def] "F : constrains {} B";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    33
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    34
qed "constrains_empty";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    35
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    36
Goalw [constrains_def] "F : constrains A UNIV";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    37
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    38
qed "constrains_UNIV";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    39
AddIffs [constrains_empty, constrains_UNIV];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    40
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    41
(*monotonic in 2nd argument*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    42
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    43
    "[| F : constrains A A'; A'<=B' |] ==> F : constrains A B'";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    44
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    45
qed "constrains_weaken_R";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    46
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    47
(*anti-monotonic in 1st argument*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    48
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    49
    "[| F : constrains A A'; B<=A |] ==> F : constrains B A'";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    50
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    51
qed "constrains_weaken_L";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    52
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    53
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    54
   "[| F : constrains A A'; B<=A; A'<=B' |] ==> F : constrains B B'";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    55
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    56
qed "constrains_weaken";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    57
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    58
(** Union **)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    59
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    60
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    61
    "[| F : constrains A A'; F : constrains B B' |]   \
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    62
\    ==> F : constrains (A Un B) (A' Un B')";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    63
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    64
qed "constrains_Un";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    65
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    66
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    67
    "ALL i:I. F : constrains (A i) (A' i) \
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    68
\    ==> F : constrains (UN i:I. A i) (UN i:I. A' i)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    69
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    70
qed "ball_constrains_UN";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    71
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    72
(** Intersection **)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    73
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    74
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    75
    "[| F : constrains A A'; F : constrains B B' |]   \
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    76
\    ==> F : constrains (A Int B) (A' Int B')";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    77
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    78
qed "constrains_Int";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    79
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    80
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    81
    "ALL i:I. F : constrains (A i) (A' i) \
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    82
\    ==> F : constrains (INT i:I. A i) (INT i:I. A' i)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    83
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    84
qed "ball_constrains_INT";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    85
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    86
Goalw [constrains_def] "[| F : constrains A A' |] ==> A<=A'";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    87
by (Blast_tac 1);
5277
e4297d03e5d2 A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents: 5253
diff changeset
    88
qed "constrains_imp_subset";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    89
5277
e4297d03e5d2 A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents: 5253
diff changeset
    90
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    91
    "[| F : constrains A B; F : constrains B C |]   \
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    92
\    ==> F : constrains A C";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    93
by (Blast_tac 1);
5277
e4297d03e5d2 A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents: 5253
diff changeset
    94
qed "constrains_trans";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    95
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    96
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    97
(*** stable ***)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    98
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
    99
Goalw [stable_def] "F : constrains A A ==> F : stable A";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   100
by (assume_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   101
qed "stableI";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   102
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   103
Goalw [stable_def] "F : stable A ==> F : constrains A A";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   104
by (assume_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   105
qed "stableD";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   106
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   107
(** Union **)
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   108
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   109
Goalw [stable_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   110
    "[| F : stable A; F : stable A' |] ==> F : stable (A Un A')";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   111
by (blast_tac (claset() addIs [constrains_Un]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   112
qed "stable_Un";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   113
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   114
Goalw [stable_def]
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   115
    "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: 5669
diff changeset
   116
by (blast_tac (claset() addIs [ball_constrains_UN]) 1);
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   117
qed "ball_stable_UN";
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   118
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   119
(** Intersection **)
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   120
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   121
Goalw [stable_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   122
    "[| F : stable A; F : stable A' |] ==> F : stable (A Int A')";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   123
by (blast_tac (claset() addIs [constrains_Int]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   124
qed "stable_Int";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   125
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   126
Goalw [stable_def]
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   127
    "ALL i:I. F : stable (A i) ==> F : stable (INT i:I. A i)";
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   128
by (blast_tac (claset() addIs [ball_constrains_INT]) 1);
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   129
qed "ball_stable_INT";
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   130
5277
e4297d03e5d2 A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents: 5253
diff changeset
   131
Goalw [stable_def, constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   132
    "[| F : stable C; F : constrains A (C Un A') |]   \
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   133
\    ==> F : constrains (C Un A) (C Un A')";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   134
by (Blast_tac 1);
5277
e4297d03e5d2 A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents: 5253
diff changeset
   135
qed "stable_constrains_Un";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   136
5277
e4297d03e5d2 A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents: 5253
diff changeset
   137
Goalw [stable_def, constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   138
    "[| F : stable C; F : constrains (C Int A) A' |]   \
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   139
\    ==> F : constrains (C Int A) (C Int A')";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   140
by (Blast_tac 1);
5277
e4297d03e5d2 A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents: 5253
diff changeset
   141
qed "stable_constrains_Int";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   142
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   143
Goal "Init F <= reachable F";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   144
by (blast_tac (claset() addIs reachable.intrs) 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   145
qed "Init_subset_reachable";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   146
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   147
Goal "Acts G <= Acts F ==> G : stable (reachable F)";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   148
by (blast_tac (claset() addIs [stableI, constrainsI] @ reachable.intrs) 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   149
qed "stable_reachable";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   150
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   151
(*[| F : stable C; F : constrains (C Int A) A |] ==> F : stable (C Int A)*)
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   152
bind_thm ("stable_constrains_stable", stable_constrains_Int RS stableI);
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   153
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   154
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   155
(*** invariant ***)
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   156
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   157
Goal "[| Init F<=A;  F: stable A |] ==> F : invariant A";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   158
by (asm_simp_tac (simpset() addsimps [invariant_def]) 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   159
qed "invariantI";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   160
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   161
(*Could also say "invariant A Int invariant B <= invariant (A Int B)"*)
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   162
Goal "[| F : invariant A;  F : invariant B |] ==> F : invariant (A Int B)";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   163
by (auto_tac (claset(), simpset() addsimps [invariant_def, stable_Int]));
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   164
qed "invariant_Int";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   165
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   166
(*The set of all reachable states is an invariant...*)
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   167
Goal "F : invariant (reachable F)";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   168
by (simp_tac (simpset() addsimps [invariant_def]) 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   169
by (blast_tac (claset() addIs (stable_reachable::reachable.intrs)) 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   170
qed "invariant_reachable";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   171
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   172
(*...in fact the strongest invariant!*)
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   173
Goal "F : invariant A ==> reachable F <= A";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   174
by (full_simp_tac 
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   175
    (simpset() addsimps [stable_def, constrains_def, invariant_def]) 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   176
by (rtac subsetI 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   177
by (etac reachable.induct 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   178
by (REPEAT (blast_tac (claset() addIs reachable.intrs) 1));
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   179
qed "invariant_includes_reachable";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   180
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   181
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   182
(*** increasing ***)
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   183
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   184
Goalw [increasing_def, stable_def, constrains_def]
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   185
     "increasing f <= increasing (length o f)";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   186
by Auto_tac;
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   187
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: 5669
diff changeset
   188
qed "increasing_size";
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   189
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   190
Goalw [increasing_def]
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   191
     "increasing f <= {F. ALL z::nat. F: stable {s. z < f s}}";
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   192
by (simp_tac (simpset() addsimps [Suc_le_eq RS sym]) 1);
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   193
by (Blast_tac 1);
5804
8e0a4c4fd67b Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents: 5669
diff changeset
   194
qed "increasing_stable_less";
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   195
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   196
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   197
(** The Elimination Theorem.  The "free" m has become universally quantified!
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   198
    Should the premise be !!m instead of ALL m ?  Would make it harder to use
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   199
    in forward proof. **)
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   200
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   201
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   202
    "[| ALL m. F : constrains {s. s x = m} (B m) |] \
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   203
\    ==> F : constrains {s. s x : M} (UN m:M. B m)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   204
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   205
qed "elimination";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   206
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   207
(*As above, but for the trivial case of a one-variable state, in which the
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   208
  state is identified with its one variable.*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   209
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   210
    "(ALL m. F : constrains {m} (B m)) ==> F : constrains M (UN m:M. B m)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   211
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   212
qed "elimination_sing";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   213
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   214
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   215
Goalw [constrains_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   216
   "[| F : constrains A (A' Un B); F : constrains B B' |] \
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   217
\   ==> F : constrains A (A' Un B')";
5669
f5d9caafc3bd added Clarify_tac to speed up proofs
paulson
parents: 5648
diff changeset
   218
by (Clarify_tac 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   219
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   220
qed "constrains_cancel";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   221
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   222
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   223
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   224
(*** Theoretical Results from Section 6 ***)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   225
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   226
Goalw [constrains_def, strongest_rhs_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   227
    "F : constrains A (strongest_rhs F A )";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   228
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   229
qed "constrains_strongest_rhs";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   230
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   231
Goalw [constrains_def, strongest_rhs_def]
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5608
diff changeset
   232
    "F : constrains A B ==> strongest_rhs F A <= B";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   233
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   234
qed "strongest_rhs_is_strongest";