src/HOL/UNITY/Follows.thy
author paulson <lp15@cam.ac.uk>
Wed, 25 May 2016 16:39:07 +0100
changeset 63152 1aa23fe79b97
parent 63146 f1ecba0272f9
child 63388 a095acd4cfbf
permissions -rw-r--r--
moved two theorems
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32689
diff changeset
     1
(*  Title:      HOL/UNITY/Follows.thy
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     3
    Copyright   1998  University of Cambridge
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13796
diff changeset
     4
*)
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     5
63146
f1ecba0272f9 isabelle update_cartouches -c -t;
wenzelm
parents: 62430
diff changeset
     6
section\<open>The Follows Relation of Charpentier and Sivilotte\<close>
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
     7
41413
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 35416
diff changeset
     8
theory Follows
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 35416
diff changeset
     9
imports SubstAx ListOrder "~~/src/HOL/Library/Multiset"
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 35416
diff changeset
    10
begin
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    11
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 35274
diff changeset
    12
definition Follows :: "['a => 'b::{order}, 'a => 'b::{order}] => 'a program set" (infixl "Fols" 65) where
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    13
   "f Fols g == Increasing g \<inter> Increasing f Int
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    14
                Always {s. f s \<le> g s} Int
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    15
                (\<Inter>k. {s. k \<le> g s} LeadsTo {s. k \<le> f s})"
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    16
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
    17
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    18
(*Does this hold for "invariant"?*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    19
lemma mono_Always_o:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    20
     "mono h ==> Always {s. f s \<le> g s} \<subseteq> Always {s. h (f s) \<le> h (g s)}"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    21
apply (simp add: Always_eq_includes_reachable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    22
apply (blast intro: monoD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    23
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    24
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    25
lemma mono_LeadsTo_o:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    26
     "mono (h::'a::order => 'b::order)  
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    27
      ==> (\<Inter>j. {s. j \<le> g s} LeadsTo {s. j \<le> f s}) \<subseteq>  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    28
          (\<Inter>k. {s. k \<le> h (g s)} LeadsTo {s. k \<le> h (f s)})"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    29
apply auto
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    30
apply (rule single_LeadsTo_I)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    31
apply (drule_tac x = "g s" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    32
apply (erule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    33
apply (blast intro: monoD order_trans)+
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    34
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    35
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    36
lemma Follows_constant [iff]: "F \<in> (%s. c) Fols (%s. c)"
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
    37
by (simp add: Follows_def)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    38
62430
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    39
lemma mono_Follows_o:
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    40
  assumes "mono h"
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    41
  shows "f Fols g \<subseteq> (h o f) Fols (h o g)"
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    42
proof
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    43
  fix x
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    44
  assume "x \<in> f Fols g"
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    45
  with assms show "x \<in> (h \<circ> f) Fols (h \<circ> g)"
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    46
  by (auto simp add: Follows_def mono_Increasing_o [THEN [2] rev_subsetD]
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    47
    mono_Always_o [THEN [2] rev_subsetD]
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    48
    mono_LeadsTo_o [THEN [2] rev_subsetD, THEN INT_D])
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
    49
qed
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    50
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    51
lemma mono_Follows_apply:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    52
     "mono h ==> f Fols g \<subseteq> (%x. h (f x)) Fols (%x. h (g x))"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    53
apply (drule mono_Follows_o)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    54
apply (force simp add: o_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    55
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    56
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    57
lemma Follows_trans: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    58
     "[| F \<in> f Fols g;  F \<in> g Fols h |] ==> F \<in> f Fols h"
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
    59
apply (simp add: Follows_def)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    60
apply (simp add: Always_eq_includes_reachable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    61
apply (blast intro: order_trans LeadsTo_Trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    62
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    63
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    64
63146
f1ecba0272f9 isabelle update_cartouches -c -t;
wenzelm
parents: 62430
diff changeset
    65
subsection\<open>Destruction rules\<close>
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    66
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    67
lemma Follows_Increasing1: "F \<in> f Fols g ==> F \<in> Increasing f"
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
    68
by (simp add: Follows_def)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    69
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    70
lemma Follows_Increasing2: "F \<in> f Fols g ==> F \<in> Increasing g"
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
    71
by (simp add: Follows_def)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    72
21710
4e4b7c801142 patched up the proofs agsin
paulson
parents: 16417
diff changeset
    73
lemma Follows_Bounded: "F \<in> f Fols g ==> F \<in> Always {s. f s \<le> g s}"
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
    74
by (simp add: Follows_def)
13796
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_LeadsTo: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    77
     "F \<in> f Fols g ==> F \<in> {s. k \<le> g s} LeadsTo {s. k \<le> f s}"
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
    78
by (simp add: Follows_def)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    79
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    80
lemma Follows_LeadsTo_pfixLe:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    81
     "F \<in> f Fols g ==> F \<in> {s. k pfixLe g s} LeadsTo {s. k pfixLe f s}"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    82
apply (rule single_LeadsTo_I, clarify)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    83
apply (drule_tac k="g s" in Follows_LeadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    84
apply (erule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    85
 apply blast 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    86
apply (blast intro: pfixLe_trans prefix_imp_pfixLe)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    87
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    88
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    89
lemma Follows_LeadsTo_pfixGe:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    90
     "F \<in> f Fols g ==> F \<in> {s. k pfixGe g s} LeadsTo {s. k pfixGe f s}"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    91
apply (rule single_LeadsTo_I, clarify)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    92
apply (drule_tac k="g s" in Follows_LeadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    93
apply (erule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    94
 apply blast 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    95
apply (blast intro: pfixGe_trans prefix_imp_pfixGe)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    96
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    97
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    98
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
    99
lemma Always_Follows1: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   100
     "[| F \<in> Always {s. f s = f' s}; F \<in> f Fols g |] ==> F \<in> f' Fols g"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   101
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
   102
apply (simp add: Follows_def Increasing_def Stable_def, auto)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   103
apply (erule_tac [3] Always_LeadsTo_weaken)
56248
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   104
apply (erule_tac A = "{s. x \<le> f s}" and A' = "{s. x \<le> f s}" 
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13796
diff changeset
   105
       in Always_Constrains_weaken, auto)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   106
apply (drule Always_Int_I, assumption)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   107
apply (force intro: Always_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   108
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   109
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   110
lemma Always_Follows2: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   111
     "[| F \<in> Always {s. g s = g' s}; F \<in> f Fols g |] ==> F \<in> f Fols g'"
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
   112
apply (simp add: Follows_def Increasing_def Stable_def, auto)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   113
apply (erule_tac [3] Always_LeadsTo_weaken)
56248
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   114
apply (erule_tac A = "{s. x \<le> g s}" and A' = "{s. x \<le> g s}"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13796
diff changeset
   115
       in Always_Constrains_weaken, auto)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   116
apply (drule Always_Int_I, assumption)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   117
apply (force intro: Always_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   118
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   119
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   120
63146
f1ecba0272f9 isabelle update_cartouches -c -t;
wenzelm
parents: 62430
diff changeset
   121
subsection\<open>Union properties (with the subset ordering)\<close>
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   122
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   123
(*Can replace "Un" by any sup.  But existing max only works for linorders.*)
56248
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   124
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   125
lemma increasing_Un: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   126
    "[| F \<in> increasing f;  F \<in> increasing g |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   127
     ==> F \<in> increasing (%s. (f s) \<union> (g s))"
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
   128
apply (simp add: increasing_def stable_def constrains_def, auto)
56248
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   129
apply (drule_tac x = "f xb" in spec)
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   130
apply (drule_tac x = "g xb" in spec)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   131
apply (blast dest!: bspec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   132
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   133
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   134
lemma Increasing_Un: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   135
    "[| F \<in> Increasing f;  F \<in> Increasing g |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   136
     ==> F \<in> Increasing (%s. (f s) \<union> (g s))"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13796
diff changeset
   137
apply (auto simp add: Increasing_def Stable_def Constrains_def
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13796
diff changeset
   138
                      stable_def constrains_def)
56248
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   139
apply (drule_tac x = "f xb" in spec)
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   140
apply (drule_tac x = "g xb" in spec)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   141
apply (blast dest!: bspec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   142
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   143
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   144
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   145
lemma Always_Un:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   146
     "[| F \<in> Always {s. f' s \<le> f s}; F \<in> Always {s. g' s \<le> g s} |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   147
      ==> F \<in> Always {s. f' s \<union> g' s \<le> f s \<union> g s}"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13796
diff changeset
   148
by (simp add: Always_eq_includes_reachable, blast)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   149
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   150
(*Lemma to re-use the argument that one variable increases (progress)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   151
  while the other variable doesn't decrease (safety)*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   152
lemma Follows_Un_lemma:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   153
     "[| F \<in> Increasing f; F \<in> Increasing g;  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   154
         F \<in> Increasing g'; F \<in> Always {s. f' s \<le> f s}; 
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   155
         \<forall>k. F \<in> {s. k \<le> f s} LeadsTo {s. k \<le> f' s} |] 
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   156
      ==> F \<in> {s. k \<le> f s \<union> g s} LeadsTo {s. k \<le> f' s \<union> g s}"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   157
apply (rule single_LeadsTo_I)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   158
apply (drule_tac x = "f s" in IncreasingD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   159
apply (drule_tac x = "g s" in IncreasingD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   160
apply (rule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   161
apply (rule PSP_Stable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   162
apply (erule_tac x = "f s" in spec)
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   163
apply (erule Stable_Int, assumption, blast+)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   164
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   165
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   166
lemma Follows_Un: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   167
    "[| F \<in> f' Fols f;  F \<in> g' Fols g |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   168
     ==> F \<in> (%s. (f' s) \<union> (g' s)) Fols (%s. (f s) \<union> (g s))"
54859
64ff7f16d5b7 prefer abstract simp rule
haftmann
parents: 41413
diff changeset
   169
apply (simp add: Follows_def Increasing_Un Always_Un del: Un_subset_iff sup.bounded_iff, auto)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   170
apply (rule LeadsTo_Trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   171
apply (blast intro: Follows_Un_lemma)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   172
(*Weakening is used to exchange Un's arguments*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   173
apply (blast intro: Follows_Un_lemma [THEN LeadsTo_weaken])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   174
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   175
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   176
63146
f1ecba0272f9 isabelle update_cartouches -c -t;
wenzelm
parents: 62430
diff changeset
   177
subsection\<open>Multiset union properties (with the multiset ordering)\<close>
60397
f8a513fedb31 Renaming multiset operators < ~> <#,...
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 58889
diff changeset
   178
(*TODO: remove when multiset is of sort ord again*)
f8a513fedb31 Renaming multiset operators < ~> <#,...
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 58889
diff changeset
   179
instantiation multiset :: (order) ordered_ab_semigroup_add
f8a513fedb31 Renaming multiset operators < ~> <#,...
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 58889
diff changeset
   180
begin
f8a513fedb31 Renaming multiset operators < ~> <#,...
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 58889
diff changeset
   181
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60397
diff changeset
   182
definition less_multiset :: "'a::order multiset \<Rightarrow> 'a multiset \<Rightarrow> bool" where
62430
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
   183
  "M' < M \<longleftrightarrow> M' #\<subset># M"
60397
f8a513fedb31 Renaming multiset operators < ~> <#,...
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 58889
diff changeset
   184
f8a513fedb31 Renaming multiset operators < ~> <#,...
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 58889
diff changeset
   185
definition less_eq_multiset :: "'a multiset \<Rightarrow> 'a multiset \<Rightarrow> bool" where
62430
9527ff088c15 more succint formulation of membership for multisets, similar to lists;
haftmann
parents: 61169
diff changeset
   186
   "(M'::'a multiset) \<le> M \<longleftrightarrow> M' #\<subseteq># M"
60397
f8a513fedb31 Renaming multiset operators < ~> <#,...
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 58889
diff changeset
   187
f8a513fedb31 Renaming multiset operators < ~> <#,...
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 58889
diff changeset
   188
instance
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 61076
diff changeset
   189
  by standard (auto simp add: less_eq_multiset_def less_multiset_def multiset_order.less_le_not_le add.commute multiset_order.add_right_mono)
60397
f8a513fedb31 Renaming multiset operators < ~> <#,...
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 58889
diff changeset
   190
end
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   191
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   192
lemma increasing_union: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   193
    "[| F \<in> increasing f;  F \<in> increasing g |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   194
     ==> F \<in> increasing (%s. (f s) + (g s :: ('a::order) multiset))"
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
   195
apply (simp add: increasing_def stable_def constrains_def, auto)
56248
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   196
apply (drule_tac x = "f xb" in spec)
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   197
apply (drule_tac x = "g xb" in spec)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   198
apply (drule bspec, assumption) 
35274
1cb90bbbf45e tuned proofs
haftmann
parents: 32960
diff changeset
   199
apply (blast intro: add_mono order_trans)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   200
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   201
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   202
lemma Increasing_union: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   203
    "[| F \<in> Increasing f;  F \<in> Increasing g |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   204
     ==> F \<in> Increasing (%s. (f s) + (g s :: ('a::order) multiset))"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13796
diff changeset
   205
apply (auto simp add: Increasing_def Stable_def Constrains_def
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13796
diff changeset
   206
                      stable_def constrains_def)
56248
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   207
apply (drule_tac x = "f xb" in spec)
67dc9549fa15 generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
haftmann
parents: 54859
diff changeset
   208
apply (drule_tac x = "g xb" in spec)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   209
apply (drule bspec, assumption) 
35274
1cb90bbbf45e tuned proofs
haftmann
parents: 32960
diff changeset
   210
apply (blast intro: add_mono order_trans)
13796
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
lemma Always_union:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   214
     "[| F \<in> Always {s. f' s \<le> f s}; F \<in> Always {s. g' s \<le> g s} |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   215
      ==> F \<in> Always {s. f' s + g' s \<le> f s + (g s :: ('a::order) multiset)}"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   216
apply (simp add: Always_eq_includes_reachable)
35274
1cb90bbbf45e tuned proofs
haftmann
parents: 32960
diff changeset
   217
apply (blast intro: add_mono)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   218
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   219
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   220
(*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
   221
lemma Follows_union_lemma:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   222
     "[| F \<in> Increasing f; F \<in> Increasing g;  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   223
         F \<in> Increasing g'; F \<in> Always {s. f' s \<le> f s}; 
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   224
         \<forall>k::('a::order) multiset.  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   225
           F \<in> {s. k \<le> f s} LeadsTo {s. k \<le> f' s} |] 
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   226
      ==> F \<in> {s. k \<le> f s + g s} LeadsTo {s. k \<le> f' s + g s}"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   227
apply (rule single_LeadsTo_I)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   228
apply (drule_tac x = "f s" in IncreasingD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   229
apply (drule_tac x = "g s" in IncreasingD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   230
apply (rule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   231
apply (rule PSP_Stable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   232
apply (erule_tac x = "f s" in spec)
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   233
apply (erule Stable_Int, assumption, blast)
35274
1cb90bbbf45e tuned proofs
haftmann
parents: 32960
diff changeset
   234
apply (blast intro: add_mono order_trans)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   235
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   236
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   237
(*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
   238
lemma Follows_union: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   239
     "!!g g' ::'b => ('a::order) multiset.  
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   240
        [| F \<in> f' Fols f;  F \<in> g' Fols g |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   241
        ==> F \<in> (%s. (f' s) + (g' s)) Fols (%s. (f s) + (g s))"
15102
04b0e943fcc9 new simprules Int_subset_iff and Un_subset_iff
paulson
parents: 13812
diff changeset
   242
apply (simp add: Follows_def)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   243
apply (simp add: Increasing_union Always_union, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   244
apply (rule LeadsTo_Trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   245
apply (blast intro: Follows_union_lemma)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   246
(*now exchange union's arguments*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   247
apply (simp add: union_commute)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   248
apply (blast intro: Follows_union_lemma)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   249
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   250
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   251
lemma Follows_setsum:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   252
     "!!f ::['c,'b] => ('a::order) multiset.  
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   253
        [| \<forall>i \<in> I. F \<in> f' i Fols f i;  finite I |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   254
        ==> F \<in> (%s. \<Sum>i \<in> I. f' i s) Fols (%s. \<Sum>i \<in> I. f i s)"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   255
apply (erule rev_mp)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   256
apply (erule finite_induct, simp) 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   257
apply (simp add: Follows_union)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   258
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   259
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   260
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   261
(*Currently UNUSED, but possibly of interest*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   262
lemma Increasing_imp_Stable_pfixGe:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   263
     "F \<in> Increasing func ==> F \<in> Stable {s. h pfixGe (func s)}"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   264
apply (simp add: Increasing_def Stable_def Constrains_def constrains_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   265
apply (blast intro: trans_Ge [THEN trans_genPrefix, THEN transD] 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   266
                    prefix_imp_pfixGe)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   267
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   268
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   269
(*Currently UNUSED, but possibly of interest*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   270
lemma LeadsTo_le_imp_pfixGe:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   271
     "\<forall>z. F \<in> {s. z \<le> f s} LeadsTo {s. z \<le> g s}  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   272
      ==> F \<in> {s. z pfixGe f s} LeadsTo {s. z pfixGe g s}"
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   273
apply (rule single_LeadsTo_I)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   274
apply (drule_tac x = "f s" in spec)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   275
apply (erule LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   276
 prefer 2
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   277
 apply (blast intro: trans_Ge [THEN trans_genPrefix, THEN transD] 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   278
                     prefix_imp_pfixGe, blast)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   279
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 10265
diff changeset
   280
6706
d8067e272d4f Theory of the "Follows" relation
paulson
parents:
diff changeset
   281
end