src/HOL/UNITY/Follows.thy
author paulson
Thu, 30 Jan 2003 10:35:56 +0100
changeset 13796 19f50fa807ae
parent 10265 4e004b548049
child 13798 4c1a53627500
permissions -rw-r--r--
converting more UNITY theories to new-style
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
8128
3a5864b465e2 still working; a bit of polishing
paulson
parents: 8122
diff changeset
     6
The "Follows" relation of Charpentier and Sivilotte
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     7
*)
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     8
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
     9
theory Follows = SubstAx + ListOrder + Multiset:
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    10
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    11
constdefs
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    12
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    13
  Follows :: "['a => 'b::{order}, 'a => 'b::{order}] => 'a program set"
6809
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
    14
                 (infixl "Fols" 65)
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
    15
   "f Fols g == Increasing g Int Increasing f Int
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
    16
                Always {s. f s <= g s} Int
5b8912f7bb69 shortened Follows to Fols
paulson
parents: 6706
diff changeset
    17
                (INT k. {s. k <= g s} LeadsTo {s. k <= f s})"
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    18
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    19
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    20
(*Does this hold for "invariant"?*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    21
lemma mono_Always_o:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    22
     "mono h ==> Always {s. f s <= g s} <= Always {s. h (f s) <= h (g s)}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    23
apply (simp add: Always_eq_includes_reachable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    24
apply (blast intro: monoD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    25
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    26
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    27
lemma mono_LeadsTo_o:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    28
     "mono (h::'a::order => 'b::order)  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    29
      ==> (INT j. {s. j <= g s} LeadsTo {s. j <= f s}) <=  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    30
          (INT k. {s. k <= h (g s)} LeadsTo {s. k <= h (f s)})"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    31
apply auto
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    32
apply (rule single_LeadsTo_I)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    33
apply (drule_tac x = "g s" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    34
apply (erule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    35
apply (blast intro: monoD order_trans)+
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    36
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    37
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    38
lemma Follows_constant: "F : (%s. c) Fols (%s. c)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    39
by (unfold Follows_def, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    40
declare Follows_constant [iff]
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    41
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    42
lemma mono_Follows_o: "mono h ==> f Fols g <= (h o f) Fols (h o g)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    43
apply (unfold Follows_def, clarify)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    44
apply (simp add: mono_Increasing_o [THEN [2] rev_subsetD]
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    45
                 mono_Always_o [THEN [2] rev_subsetD]
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    46
                 mono_LeadsTo_o [THEN [2] rev_subsetD, THEN INT_D])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    47
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    48
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    49
lemma mono_Follows_apply:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    50
     "mono h ==> f Fols g <= (%x. h (f x)) Fols (%x. h (g x))"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    51
apply (drule mono_Follows_o)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    52
apply (force simp add: o_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    53
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    54
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    55
lemma Follows_trans: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    56
     "[| F : f Fols g;  F: g Fols h |] ==> F : f Fols h"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    57
apply (unfold Follows_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    58
apply (simp add: Always_eq_includes_reachable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    59
apply (blast intro: order_trans LeadsTo_Trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    60
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    61
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    62
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    63
(** Destructiom rules **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    64
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    65
lemma Follows_Increasing1: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    66
     "F : f Fols g ==> F : Increasing f"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    67
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    68
apply (unfold Follows_def, blast)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    69
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    70
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    71
lemma Follows_Increasing2: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    72
     "F : f Fols g ==> F : Increasing g"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    73
apply (unfold Follows_def, blast)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    74
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    75
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    76
lemma Follows_Bounded: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    77
     "F : f Fols g ==> F : Always {s. f s <= g s}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    78
apply (unfold Follows_def, blast)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    79
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    80
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    81
lemma Follows_LeadsTo: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    82
     "F : f Fols g ==> F : {s. k <= g s} LeadsTo {s. k <= f s}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    83
apply (unfold Follows_def, blast)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    84
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    85
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    86
lemma Follows_LeadsTo_pfixLe:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    87
     "F : f Fols g ==> F : {s. k pfixLe g s} LeadsTo {s. k pfixLe f s}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    88
apply (rule single_LeadsTo_I, clarify)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    89
apply (drule_tac k="g s" in Follows_LeadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    90
apply (erule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    91
 apply blast 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    92
apply (blast intro: pfixLe_trans prefix_imp_pfixLe)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    93
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    94
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    95
lemma Follows_LeadsTo_pfixGe:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    96
     "F : f Fols g ==> F : {s. k pfixGe g s} LeadsTo {s. k pfixGe f s}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    97
apply (rule single_LeadsTo_I, clarify)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    98
apply (drule_tac k="g s" in Follows_LeadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    99
apply (erule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   100
 apply blast 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   101
apply (blast intro: pfixGe_trans prefix_imp_pfixGe)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   102
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   103
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   104
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   105
lemma Always_Follows1: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   106
     "[| F : Always {s. f s = f' s}; F : f Fols g |] ==> F : f' Fols g"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   107
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   108
apply (unfold Follows_def Increasing_def Stable_def, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   109
apply (erule_tac [3] Always_LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   110
apply (erule_tac A = "{s. z <= f s}" and A' = "{s. z <= f s}" in Always_Constrains_weaken, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   111
apply (drule Always_Int_I, assumption)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   112
apply (force intro: Always_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   113
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   114
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   115
lemma Always_Follows2: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   116
     "[| F : Always {s. g s = g' s}; F : f Fols g |] ==> F : f Fols g'"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   117
apply (unfold Follows_def Increasing_def Stable_def, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   118
apply (erule_tac [3] Always_LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   119
apply (erule_tac A = "{s. z <= g s}" and A' = "{s. z <= g s}" in Always_Constrains_weaken, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   120
apply (drule Always_Int_I, assumption)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   121
apply (force intro: Always_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   122
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   123
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   124
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   125
(** Union properties (with the subset ordering) **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   126
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   127
(*Can replace "Un" by any sup.  But existing max only works for linorders.*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   128
lemma increasing_Un: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   129
    "[| F : increasing f;  F: increasing g |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   130
     ==> F : increasing (%s. (f s) Un (g s))"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   131
apply (unfold increasing_def stable_def constrains_def, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   132
apply (drule_tac x = "f xa" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   133
apply (drule_tac x = "g xa" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   134
apply (blast dest!: bspec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   135
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   136
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   137
lemma Increasing_Un: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   138
    "[| F : Increasing f;  F: Increasing g |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   139
     ==> F : Increasing (%s. (f s) Un (g s))"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   140
apply (unfold Increasing_def Stable_def Constrains_def stable_def constrains_def, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   141
apply (drule_tac x = "f xa" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   142
apply (drule_tac x = "g xa" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   143
apply (blast dest!: bspec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   144
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   145
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   146
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   147
lemma Always_Un:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   148
     "[| F : Always {s. f' s <= f s}; F : Always {s. g' s <= g s} |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   149
      ==> F : Always {s. f' s Un g' s <= f s Un g s}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   150
apply (simp add: Always_eq_includes_reachable, blast)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   151
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   152
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   153
(*Lemma to re-use the argument that one variable increases (progress)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   154
  while the other variable doesn't decrease (safety)*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   155
lemma Follows_Un_lemma:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   156
     "[| F : Increasing f; F : Increasing g;  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   157
         F : Increasing g'; F : Always {s. f' s <= f s}; 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   158
         ALL k. F : {s. k <= f s} LeadsTo {s. k <= f' s} |] 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   159
      ==> F : {s. k <= f s Un g s} LeadsTo {s. k <= f' s Un g s}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   160
apply (rule single_LeadsTo_I)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   161
apply (drule_tac x = "f s" in IncreasingD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   162
apply (drule_tac x = "g s" in IncreasingD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   163
apply (rule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   164
apply (rule PSP_Stable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   165
apply (erule_tac x = "f s" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   166
apply (erule Stable_Int, assumption)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   167
apply blast
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   168
apply blast
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   169
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   170
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   171
lemma Follows_Un: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   172
    "[| F : f' Fols f;  F: g' Fols g |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   173
     ==> F : (%s. (f' s) Un (g' s)) Fols (%s. (f s) Un (g s))"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   174
apply (unfold Follows_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   175
apply (simp add: Increasing_Un Always_Un, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   176
apply (rule LeadsTo_Trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   177
apply (blast intro: Follows_Un_lemma)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   178
(*Weakening is used to exchange Un's arguments*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   179
apply (blast intro: Follows_Un_lemma [THEN LeadsTo_weaken])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   180
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   181
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   182
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   183
(** Multiset union properties (with the multiset ordering) **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   184
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   185
lemma increasing_union: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   186
    "[| F : increasing f;  F: increasing g |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   187
     ==> F : increasing (%s. (f s) + (g s :: ('a::order) multiset))"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   188
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   189
apply (unfold increasing_def stable_def constrains_def, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   190
apply (drule_tac x = "f xa" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   191
apply (drule_tac x = "g xa" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   192
apply (drule bspec, assumption) 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   193
apply (blast intro: union_le_mono order_trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   194
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   195
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   196
lemma Increasing_union: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   197
    "[| F : Increasing f;  F: Increasing g |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   198
     ==> F : Increasing (%s. (f s) + (g s :: ('a::order) multiset))"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   199
apply (unfold Increasing_def Stable_def Constrains_def stable_def constrains_def, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   200
apply (drule_tac x = "f xa" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   201
apply (drule_tac x = "g xa" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   202
apply (drule bspec, assumption) 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   203
apply (blast intro: union_le_mono order_trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   204
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   205
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   206
lemma Always_union:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   207
     "[| F : Always {s. f' s <= f s}; F : Always {s. g' s <= g s} |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   208
      ==> F : Always {s. f' s + g' s <= f s + (g s :: ('a::order) multiset)}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   209
apply (simp add: Always_eq_includes_reachable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   210
apply (blast intro: union_le_mono)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   211
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   212
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   213
(*Except the last line, IDENTICAL to the proof script for Follows_Un_lemma*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   214
lemma Follows_union_lemma:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   215
     "[| F : Increasing f; F : Increasing g;  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   216
         F : Increasing g'; F : Always {s. f' s <= f s}; 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   217
         ALL k::('a::order) multiset.  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   218
           F : {s. k <= f s} LeadsTo {s. k <= f' s} |] 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   219
      ==> F : {s. k <= f s + g s} LeadsTo {s. k <= f' s + g s}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   220
apply (rule single_LeadsTo_I)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   221
apply (drule_tac x = "f s" in IncreasingD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   222
apply (drule_tac x = "g s" in IncreasingD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   223
apply (rule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   224
apply (rule PSP_Stable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   225
apply (erule_tac x = "f s" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   226
apply (erule Stable_Int, assumption)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   227
apply blast
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   228
apply (blast intro: union_le_mono order_trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   229
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   230
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   231
(*The !! is there to influence to effect of permutative rewriting at the end*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   232
lemma Follows_union: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   233
     "!!g g' ::'b => ('a::order) multiset.  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   234
        [| F : f' Fols f;  F: g' Fols g |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   235
        ==> F : (%s. (f' s) + (g' s)) Fols (%s. (f s) + (g s))"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   236
apply (unfold Follows_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   237
apply (simp add: Increasing_union Always_union, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   238
apply (rule LeadsTo_Trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   239
apply (blast intro: Follows_union_lemma)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   240
(*now exchange union's arguments*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   241
apply (simp add: union_commute)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   242
apply (blast intro: Follows_union_lemma)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   243
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   244
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   245
lemma Follows_setsum:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   246
     "!!f ::['c,'b] => ('a::order) multiset.  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   247
        [| ALL i: I. F : f' i Fols f i;  finite I |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   248
        ==> F : (%s. \<Sum>i:I. f' i s) Fols (%s. \<Sum>i:I. f i s)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   249
apply (erule rev_mp)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   250
apply (erule finite_induct, simp) 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   251
apply (simp add: Follows_union)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   252
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   253
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   254
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   255
(*Currently UNUSED, but possibly of interest*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   256
lemma Increasing_imp_Stable_pfixGe:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   257
     "F : Increasing func ==> F : Stable {s. h pfixGe (func s)}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   258
apply (simp add: Increasing_def Stable_def Constrains_def constrains_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   259
apply (blast intro: trans_Ge [THEN trans_genPrefix, THEN transD] 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   260
                    prefix_imp_pfixGe)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   261
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   262
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   263
(*Currently UNUSED, but possibly of interest*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   264
lemma LeadsTo_le_imp_pfixGe:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   265
     "ALL z. F : {s. z <= f s} LeadsTo {s. z <= g s}  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   266
      ==> F : {s. z pfixGe f s} LeadsTo {s. z pfixGe g s}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   267
apply (rule single_LeadsTo_I)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   268
apply (drule_tac x = "f s" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   269
apply (erule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   270
 prefer 2
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   271
 apply (blast intro: trans_Ge [THEN trans_genPrefix, THEN transD] 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   272
                     prefix_imp_pfixGe, blast)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   273
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   274
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   275
end