src/HOL/UNITY/Follows.ML
author wenzelm
Fri, 09 Nov 2001 00:09:47 +0100
changeset 12114 a8e860c86252
parent 11786 51ce34ef5113
permissions -rw-r--r--
eliminated old "symbols" syntax, use "xsymbols" instead;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Follows
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     2
    ID:         $Id$
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     5
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     6
The Follows relation of Charpentier and Sivilotte
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     7
*)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     8
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     9
(*Does this hold for "invariant"?*)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    10
Goal "mono h ==> Always {s. f s <= g s} <= Always {s. h (f s) <= h (g s)}";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    11
by (asm_simp_tac (simpset() addsimps [Always_eq_includes_reachable]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    12
by (blast_tac (claset() addIs [monoD]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    13
qed "mono_Always_o";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    14
7363
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    15
Goal "mono (h::'a::order => 'b::order) \
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    16
\     ==> (INT j. {s. j <= g s} LeadsTo {s. j <= f s}) <= \
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    17
\         (INT k. {s. k <= h (g s)} LeadsTo {s. k <= h (f s)})";
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    18
by Auto_tac;
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    19
by (rtac single_LeadsTo_I 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    20
by (dres_inst_tac [("x", "g s")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    21
by (etac LeadsTo_weaken 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    22
by (ALLGOALS (blast_tac (claset() addIs [monoD, order_trans])));
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    23
qed "mono_LeadsTo_o";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    24
9019
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    25
Goalw [Follows_def] "F : (%s. c) Fols (%s. c)";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    26
by Auto_tac; 
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    27
qed "Follows_constant";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    28
AddIffs [Follows_constant];
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    29
6809
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
    30
Goalw [Follows_def] "mono h ==> f Fols g <= (h o f) Fols (h o g)";
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    31
by (Clarify_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    32
by (asm_full_simp_tac
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    33
    (simpset() addsimps [impOfSubs mono_Increasing_o,
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    34
			 impOfSubs mono_Always_o,
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    35
			 impOfSubs mono_LeadsTo_o RS INT_D]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    36
qed "mono_Follows_o";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    37
7542
b6599e292011 new theorem mono_Follows_apply
paulson
parents: 7363
diff changeset
    38
Goal "mono h ==> f Fols g <= (%x. h (f x)) Fols (%x. h (g x))";
b6599e292011 new theorem mono_Follows_apply
paulson
parents: 7363
diff changeset
    39
by (dtac mono_Follows_o 1);
b6599e292011 new theorem mono_Follows_apply
paulson
parents: 7363
diff changeset
    40
by (force_tac (claset(), simpset() addsimps [o_def]) 1);
b6599e292011 new theorem mono_Follows_apply
paulson
parents: 7363
diff changeset
    41
qed "mono_Follows_apply";
b6599e292011 new theorem mono_Follows_apply
paulson
parents: 7363
diff changeset
    42
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    43
Goalw [Follows_def]
6809
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
    44
     "[| F : f Fols g;  F: g Fols h |] ==> F : f Fols h";
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    45
by (asm_full_simp_tac (simpset() addsimps [Always_eq_includes_reachable]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    46
by (blast_tac (claset() addIs [order_trans, LeadsTo_Trans]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    47
qed "Follows_trans";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    48
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    49
7363
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    50
(** Destructiom rules **)
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    51
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    52
Goalw [Follows_def]
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    53
     "F : f Fols g ==> F : Increasing f";
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    54
by (Blast_tac 1);
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    55
qed "Follows_Increasing1";
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    56
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    57
Goalw [Follows_def]
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    58
     "F : f Fols g ==> F : Increasing g";
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    59
by (Blast_tac 1);
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    60
qed "Follows_Increasing2";
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    61
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    62
Goalw [Follows_def]
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    63
     "F : f Fols g ==> F : Always {s. f s <= g s}";
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    64
by (Blast_tac 1);
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    65
qed "Follows_Bounded";
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    66
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    67
Goalw [Follows_def]
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    68
     "F : f Fols g ==> F : {s. k <= g s} LeadsTo {s. k <= f s}";
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    69
by (Blast_tac 1);
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    70
qed "Follows_LeadsTo";
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    71
8128
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    72
Goal "F : f Fols g ==> F : {s. k pfixLe g s} LeadsTo {s. k pfixLe f s}";
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    73
by (rtac single_LeadsTo_I 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    74
by (Clarify_tac 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    75
by (dtac Follows_LeadsTo 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    76
by (etac LeadsTo_weaken 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    77
by (blast_tac set_cs 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    78
by (blast_tac (claset() addIs [pfixLe_trans, prefix_imp_pfixLe]) 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    79
qed "Follows_LeadsTo_pfixLe";
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    80
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    81
Goal "F : f Fols g ==> F : {s. k pfixGe g s} LeadsTo {s. k pfixGe f s}";
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    82
by (rtac single_LeadsTo_I 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    83
by (Clarify_tac 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    84
by (dtac Follows_LeadsTo 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    85
by (etac LeadsTo_weaken 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    86
by (blast_tac set_cs 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    87
by (blast_tac (claset() addIs [pfixGe_trans, prefix_imp_pfixGe]) 1);
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    88
qed "Follows_LeadsTo_pfixGe";
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8113
diff changeset
    89
7363
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    90
9019
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    91
Goalw [Follows_def, Increasing_def, Stable_def]
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    92
     "[| F : Always {s. f s = f' s}; F : f Fols g |] ==> F : f' Fols g"; 
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    93
by Auto_tac;
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    94
by (etac Always_LeadsTo_weaken 3);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    95
by (eres_inst_tac [("A", "{s. z <= f s}"), ("A'", "{s. z <= f s}")] 
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    96
                  Always_Constrains_weaken 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    97
by Auto_tac;
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    98
by (dtac Always_Int_I 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
    99
by (assume_tac 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   100
by (force_tac (claset() addIs [Always_weaken], simpset()) 1);
9104
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   101
qed "Always_Follows1";
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   102
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   103
Goalw [Follows_def, Increasing_def, Stable_def]
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   104
     "[| F : Always {s. g s = g' s}; F : f Fols g |] ==> F : f Fols g'"; 
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   105
by Auto_tac;
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   106
by (etac Always_LeadsTo_weaken 3);
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   107
by (eres_inst_tac [("A", "{s. z <= g s}"), ("A'", "{s. z <= g s}")] 
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   108
                  Always_Constrains_weaken 1);
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   109
by Auto_tac;
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   110
by (dtac Always_Int_I 1);
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   111
by (assume_tac 1);
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   112
by (force_tac (claset() addIs [Always_weaken], simpset()) 1);
89ca2a172f84 new thoerem Always_Follows2; renamed Always_Follows -> Always_Follows1
paulson
parents: 9019
diff changeset
   113
qed "Always_Follows2";
9019
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   114
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   115
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   116
(** Union properties (with the subset ordering) **)
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   117
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   118
(*Can replace "Un" by any sup.  But existing max only works for linorders.*)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   119
Goalw [increasing_def, stable_def, constrains_def]
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   120
    "[| F : increasing f;  F: increasing g |] \
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   121
\    ==> F : increasing (%s. (f s) Un (g s))";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   122
by Auto_tac;
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   123
by (dres_inst_tac [("x","f xa")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   124
by (dres_inst_tac [("x","g xa")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   125
by (blast_tac (claset() addSDs [bspec]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   126
qed "increasing_Un";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   127
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   128
Goalw [Increasing_def, Stable_def, Constrains_def, stable_def, constrains_def]
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   129
    "[| F : Increasing f;  F: Increasing g |] \
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   130
\    ==> F : Increasing (%s. (f s) Un (g s))";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   131
by Auto_tac;
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   132
by (dres_inst_tac [("x","f xa")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   133
by (dres_inst_tac [("x","g xa")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   134
by (blast_tac (claset() addSDs [bspec]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   135
qed "Increasing_Un";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   136
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   137
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   138
Goal "[| F : Always {s. f' s <= f s}; F : Always {s. g' s <= g s} |] \
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   139
\     ==> F : Always {s. f' s Un g' s <= f s Un g s}";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   140
by (asm_full_simp_tac (simpset() addsimps [Always_eq_includes_reachable]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   141
by (Blast_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   142
qed "Always_Un";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   143
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   144
(*Lemma to re-use the argument that one variable increases (progress)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   145
  while the other variable doesn't decrease (safety)*)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   146
Goal "[| F : Increasing f; F : Increasing g; \
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   147
\        F : Increasing g'; F : Always {s. f' s <= f s};\
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   148
\        ALL k. F : {s. k <= f s} LeadsTo {s. k <= f' s} |]\
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   149
\     ==> F : {s. k <= f s Un g s} LeadsTo {s. k <= f' s Un g s}";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   150
by (rtac single_LeadsTo_I 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   151
by (dres_inst_tac [("x", "f s")] IncreasingD 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   152
by (dres_inst_tac [("x", "g s")] IncreasingD 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   153
by (rtac LeadsTo_weaken 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   154
by (rtac PSP_Stable 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   155
by (eres_inst_tac [("x", "f s")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   156
by (etac Stable_Int 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   157
by (assume_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   158
by (Blast_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   159
by (Blast_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   160
qed "Follows_Un_lemma";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   161
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   162
Goalw [Follows_def]
6809
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
   163
    "[| F : f' Fols f;  F: g' Fols g |] \
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
   164
\    ==> F : (%s. (f' s) Un (g' s)) Fols (%s. (f s) Un (g s))";
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   165
by (asm_full_simp_tac (simpset() addsimps [Increasing_Un, Always_Un]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   166
by Auto_tac;
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   167
by (rtac LeadsTo_Trans 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   168
by (blast_tac (claset() addIs [Follows_Un_lemma]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   169
(*Weakening is used to exchange Un's arguments*)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   170
by (blast_tac (claset() addIs [Follows_Un_lemma RS LeadsTo_weaken]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   171
qed "Follows_Un";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   172
8314
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   173
9019
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   174
(** Multiset union properties (with the multiset ordering) **)
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   175
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   176
Goalw [increasing_def, stable_def, constrains_def]
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   177
    "[| F : increasing f;  F: increasing g |] \
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   178
\    ==> F : increasing (%s. (f s) + (g s :: ('a::order) multiset))";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   179
by Auto_tac;
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   180
by (dres_inst_tac [("x","f xa")] spec 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   181
by (dres_inst_tac [("x","g xa")] spec 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   182
by (ball_tac 1);
10265
4e004b548049 use Multiset from HOL/Library;
wenzelm
parents: 9104
diff changeset
   183
by (blast_tac (claset() addIs [thm "union_le_mono", order_trans]) 1); 
9019
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   184
qed "increasing_union";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   185
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   186
Goalw [Increasing_def, Stable_def, Constrains_def, stable_def, constrains_def]
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   187
    "[| F : Increasing f;  F: Increasing g |] \
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   188
\    ==> F : Increasing (%s. (f s) + (g s :: ('a::order) multiset))";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   189
by Auto_tac;
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   190
by (dres_inst_tac [("x","f xa")] spec 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   191
by (dres_inst_tac [("x","g xa")] spec 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   192
by (ball_tac 1);
10265
4e004b548049 use Multiset from HOL/Library;
wenzelm
parents: 9104
diff changeset
   193
by (blast_tac (claset()  addIs [thm "union_le_mono", order_trans]) 1);
9019
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   194
qed "Increasing_union";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   195
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   196
Goal "[| F : Always {s. f' s <= f s}; F : Always {s. g' s <= g s} |] \
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   197
\     ==> F : Always {s. f' s + g' s <= f s + (g s :: ('a::order) multiset)}";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   198
by (asm_full_simp_tac (simpset() addsimps [Always_eq_includes_reachable]) 1);
10265
4e004b548049 use Multiset from HOL/Library;
wenzelm
parents: 9104
diff changeset
   199
by (blast_tac (claset()  addIs [thm "union_le_mono"]) 1);
9019
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   200
qed "Always_union";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   201
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   202
(*Except the last line, IDENTICAL to the proof script for Follows_Un_lemma*)
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   203
Goal "[| F : Increasing f; F : Increasing g; \
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   204
\        F : Increasing g'; F : Always {s. f' s <= f s};\
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   205
\        ALL k::('a::order) multiset. \
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   206
\          F : {s. k <= f s} LeadsTo {s. k <= f' s} |]\
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   207
\     ==> F : {s. k <= f s + g s} LeadsTo {s. k <= f' s + g s}";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   208
by (rtac single_LeadsTo_I 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   209
by (dres_inst_tac [("x", "f s")] IncreasingD 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   210
by (dres_inst_tac [("x", "g s")] IncreasingD 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   211
by (rtac LeadsTo_weaken 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   212
by (rtac PSP_Stable 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   213
by (eres_inst_tac [("x", "f s")] spec 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   214
by (etac Stable_Int 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   215
by (assume_tac 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   216
by (Blast_tac 1);
10265
4e004b548049 use Multiset from HOL/Library;
wenzelm
parents: 9104
diff changeset
   217
by (blast_tac (claset() addIs [thm "union_le_mono", order_trans]) 1); 
9019
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   218
qed "Follows_union_lemma";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   219
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   220
(*The !! is there to influence to effect of permutative rewriting at the end*)
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   221
Goalw [Follows_def]
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   222
     "!!g g' ::'b => ('a::order) multiset. \
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   223
\       [| F : f' Fols f;  F: g' Fols g |] \
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   224
\       ==> F : (%s. (f' s) + (g' s)) Fols (%s. (f s) + (g s))";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   225
by (asm_full_simp_tac (simpset() addsimps [Increasing_union, Always_union]) 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   226
by Auto_tac;
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   227
by (rtac LeadsTo_Trans 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   228
by (blast_tac (claset() addIs [Follows_union_lemma]) 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   229
(*now exchange union's arguments*)
10265
4e004b548049 use Multiset from HOL/Library;
wenzelm
parents: 9104
diff changeset
   230
by (simp_tac (simpset() addsimps [thm "union_commute"]) 1); 
9019
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   231
by (blast_tac (claset() addIs [Follows_union_lemma]) 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   232
qed "Follows_union";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   233
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   234
Goal "!!f ::['c,'b] => ('a::order) multiset. \
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   235
\       [| ALL i: I. F : f' i Fols f i;  finite I |] \
11786
51ce34ef5113 setsum syntax;
wenzelm
parents: 10265
diff changeset
   236
\       ==> F : (%s. \\<Sum>i:I. f' i s) Fols (%s. \\<Sum>i:I. f i s)";
9019
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   237
by (etac rev_mp 1); 
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   238
by (etac finite_induct 1);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   239
by (asm_simp_tac (simpset() addsimps [Follows_union]) 2);
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   240
by (Simp_tac 1); 
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   241
qed "Follows_setsum";
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   242
9c1118619d6c new parent MultisetOrder and new results about multiset unions
paulson
parents: 8314
diff changeset
   243
8314
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   244
(*Currently UNUSED, but possibly of interest*)
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   245
Goal "F : Increasing func ==> F : Stable {s. h pfixGe (func s)}";
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   246
by (asm_full_simp_tac
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   247
    (simpset() addsimps [Increasing_def, Stable_def, Constrains_def, 
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   248
			 constrains_def]) 1); 
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   249
by (blast_tac (claset() addIs [trans_Ge RS trans_genPrefix RS transD,
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   250
			       prefix_imp_pfixGe]) 1);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   251
qed "Increasing_imp_Stable_pfixGe";
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   252
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   253
(*Currently UNUSED, but possibly of interest*)
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   254
Goal "ALL z. F : {s. z <= f s} LeadsTo {s. z <= g s} \
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   255
\     ==> F : {s. z pfixGe f s} LeadsTo {s. z pfixGe g s}";
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   256
by (rtac single_LeadsTo_I 1);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   257
by (dres_inst_tac [("x", "f s")] spec 1);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   258
by (etac LeadsTo_weaken 1);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   259
by (blast_tac (claset() addIs [trans_Ge RS trans_genPrefix RS transD,
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   260
			       prefix_imp_pfixGe]) 2);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   261
by (Blast_tac 1);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8216
diff changeset
   262
qed "LeadsTo_le_imp_pfixGe";