src/HOL/UNITY/Follows.ML
author paulson
Thu, 11 Nov 1999 10:25:17 +0100
changeset 8005 b64d86018785
parent 7542 b6599e292011
child 8074 36a6c38e0eca
permissions -rw-r--r--
new-style infix declaration for "image"
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
6809
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
    25
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
    26
by (Clarify_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    27
by (asm_full_simp_tac
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    28
    (simpset() addsimps [impOfSubs mono_Increasing_o,
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    29
			 impOfSubs mono_Always_o,
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    30
			 impOfSubs mono_LeadsTo_o RS INT_D]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    31
qed "mono_Follows_o";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    32
7542
b6599e292011 new theorem mono_Follows_apply
paulson
parents: 7363
diff changeset
    33
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
    34
by (dtac mono_Follows_o 1);
b6599e292011 new theorem mono_Follows_apply
paulson
parents: 7363
diff changeset
    35
by (force_tac (claset(), simpset() addsimps [o_def]) 1);
b6599e292011 new theorem mono_Follows_apply
paulson
parents: 7363
diff changeset
    36
qed "mono_Follows_apply";
b6599e292011 new theorem mono_Follows_apply
paulson
parents: 7363
diff changeset
    37
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    38
Goalw [Follows_def]
6809
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
    39
     "[| F : f Fols g;  F: g Fols h |] ==> F : f Fols h";
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    40
by (asm_full_simp_tac (simpset() addsimps [Always_eq_includes_reachable]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    41
by (blast_tac (claset() addIs [order_trans, LeadsTo_Trans]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    42
qed "Follows_trans";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    43
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    44
7363
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    45
(** Destructiom rules **)
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    46
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    47
Goalw [Follows_def]
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    48
     "F : f Fols g ==> F : Increasing f";
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    49
by (Blast_tac 1);
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    50
qed "Follows_Increasing1";
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 g";
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_Increasing2";
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 : Always {s. f s <= g s}";
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_Bounded";
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 : {s. k <= g s} LeadsTo {s. k <= f 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_LeadsTo";
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    66
eddb3d77a363 new destruction rules
paulson
parents: 6809
diff changeset
    67
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    68
(*Can replace "Un" by any sup.  But existing max only works for linorders.*)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    69
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    70
Goalw [increasing_def, stable_def, constrains_def]
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    71
    "[| F : increasing f;  F: increasing g |] \
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    72
\    ==> F : increasing (%s. (f s) Un (g s))";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    73
by Auto_tac;
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    74
by (dres_inst_tac [("x","f xa")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    75
by (dres_inst_tac [("x","g xa")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    76
by (blast_tac (claset() addSDs [bspec]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    77
qed "increasing_Un";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    78
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    79
Goalw [Increasing_def, Stable_def, Constrains_def, stable_def, constrains_def]
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    80
    "[| F : Increasing f;  F: Increasing g |] \
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    81
\    ==> F : Increasing (%s. (f s) Un (g s))";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    82
by Auto_tac;
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    83
by (dres_inst_tac [("x","f xa")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    84
by (dres_inst_tac [("x","g xa")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    85
by (blast_tac (claset() addSDs [bspec]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    86
qed "Increasing_Un";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    87
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    88
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    89
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
    90
\     ==> F : Always {s. f' s Un g' s <= f s Un g s}";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    91
by (asm_full_simp_tac (simpset() addsimps [Always_eq_includes_reachable]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    92
by (Blast_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    93
qed "Always_Un";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    94
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    95
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    96
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    97
Goalw [Increasing_def]
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    98
     "F : Increasing f ==> F : Stable {s. x <= f s}";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    99
by (Blast_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   100
qed "IncreasingD";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   101
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   102
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   103
(*Lemma to re-use the argument that one variable increases (progress)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   104
  while the other variable doesn't decrease (safety)*)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   105
Goal "[| F : Increasing f; F : Increasing g; \
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   106
\        F : Increasing g'; F : Always {s. f' s <= f s};\
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   107
\        ALL k. F : {s. k <= f s} LeadsTo {s. k <= f' s} |]\
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   108
\     ==> 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
   109
by (rtac single_LeadsTo_I 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   110
by (dres_inst_tac [("x", "f s")] IncreasingD 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   111
by (dres_inst_tac [("x", "g s")] IncreasingD 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   112
by (rtac LeadsTo_weaken 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   113
by (rtac PSP_Stable 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   114
by (eres_inst_tac [("x", "f s")] spec 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   115
by (etac Stable_Int 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   116
by (assume_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   117
by (Blast_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   118
by (Blast_tac 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   119
qed "Follows_Un_lemma";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   120
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   121
Goalw [Follows_def]
6809
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
   122
    "[| F : f' Fols f;  F: g' Fols g |] \
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
   123
\    ==> 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
   124
by (asm_full_simp_tac (simpset() addsimps [Increasing_Un, Always_Un]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   125
by Auto_tac;
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   126
by (rtac LeadsTo_Trans 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   127
by (blast_tac (claset() addIs [Follows_Un_lemma]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   128
(*Weakening is used to exchange Un's arguments*)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   129
by (blast_tac (claset() addIs [Follows_Un_lemma RS LeadsTo_weaken]) 1);
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   130
qed "Follows_Un";
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   131