src/HOL/UNITY/ProgressSets.thy
author paulson
Mon, 31 Mar 2003 12:29:54 +0200
changeset 13888 16f424af58a2
parent 13885 de6fac7d5351
child 14150 9a23e4eb5eb3
permissions -rw-r--r--
more comments and tweaks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/ProgressSets
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
     2
    ID:         $Id$
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
     4
    Copyright   2003  University of Cambridge
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
     5
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
     6
Progress Sets.  From 
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
     7
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
     8
    David Meier and Beverly Sanders,
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
     9
    Composing Leads-to Properties
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    10
    Theoretical Computer Science 243:1-2 (2000), 339-361.
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    11
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    12
    David Meier,
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    13
    Progress Properties in Program Refinement and Parallel Composition
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    14
    Swiss Federal Institute of Technology Zurich (1997)
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    15
*)
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    16
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    17
header{*Progress Sets*}
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    18
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    19
theory ProgressSets = Transformers:
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    20
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
    21
subsection {*Complete Lattices and the Operator @{term cl}*}
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
    22
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    23
constdefs
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    24
  lattice :: "'a set set => bool"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    25
   --{*Meier calls them closure sets, but they are just complete lattices*}
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    26
   "lattice L ==
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    27
	 (\<forall>M. M \<subseteq> L --> \<Inter>M \<in> L) & (\<forall>M. M \<subseteq> L --> \<Union>M \<in> L)"
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    28
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    29
  cl :: "['a set set, 'a set] => 'a set"
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    30
   --{*short for ``closure''*}
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    31
   "cl L r == \<Inter>{x. x\<in>L & r \<subseteq> x}"
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    32
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    33
lemma UNIV_in_lattice: "lattice L ==> UNIV \<in> L"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    34
by (force simp add: lattice_def)
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    35
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    36
lemma empty_in_lattice: "lattice L ==> {} \<in> L"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    37
by (force simp add: lattice_def)
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    38
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    39
lemma Union_in_lattice: "[|M \<subseteq> L; lattice L|] ==> \<Union>M \<in> L"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    40
by (simp add: lattice_def)
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    41
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    42
lemma Inter_in_lattice: "[|M \<subseteq> L; lattice L|] ==> \<Inter>M \<in> L"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    43
by (simp add: lattice_def)
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    44
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    45
lemma UN_in_lattice:
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    46
     "[|lattice L; !!i. i\<in>I ==> r i \<in> L|] ==> (\<Union>i\<in>I. r i) \<in> L"
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    47
apply (simp add: Set.UN_eq) 
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    48
apply (blast intro: Union_in_lattice) 
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    49
done
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    50
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    51
lemma INT_in_lattice:
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    52
     "[|lattice L; !!i. i\<in>I ==> r i \<in> L|] ==> (\<Inter>i\<in>I. r i)  \<in> L"
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    53
apply (simp add: INT_eq) 
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    54
apply (blast intro: Inter_in_lattice) 
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    55
done
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    56
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    57
lemma Un_in_lattice: "[|x\<in>L; y\<in>L; lattice L|] ==> x\<union>y \<in> L"
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    58
apply (simp only: Un_eq_Union) 
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    59
apply (blast intro: Union_in_lattice) 
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    60
done
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    61
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    62
lemma Int_in_lattice: "[|x\<in>L; y\<in>L; lattice L|] ==> x\<inter>y \<in> L"
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    63
apply (simp only: Int_eq_Inter) 
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    64
apply (blast intro: Inter_in_lattice) 
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    65
done
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    66
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    67
lemma lattice_stable: "lattice {X. F \<in> stable X}"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    68
by (simp add: lattice_def stable_def constrains_def, blast)
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    69
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    70
text{*The next three results state that @{term "cl L r"} is the minimal
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    71
 element of @{term L} that includes @{term r}.*}
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    72
lemma cl_in_lattice: "lattice L ==> cl L r \<in> L"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    73
apply (simp add: lattice_def cl_def)
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    74
apply (erule conjE)  
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    75
apply (drule spec, erule mp, blast) 
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    76
done
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    77
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    78
lemma cl_least: "[|c\<in>L; r\<subseteq>c|] ==> cl L r \<subseteq> c" 
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    79
by (force simp add: cl_def)
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    80
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    81
text{*The next three lemmas constitute assertion (4.61)*}
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    82
lemma cl_mono: "r \<subseteq> r' ==> cl L r \<subseteq> cl L r'"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    83
by (simp add: cl_def, blast)
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    84
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    85
lemma subset_cl: "r \<subseteq> cl L r"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    86
by (simp add: cl_def, blast)
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    87
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
    88
text{*A reformulation of @{thm subset_cl}*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
    89
lemma clI: "x \<in> r ==> x \<in> cl L r"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
    90
by (simp add: cl_def, blast)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
    91
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
    92
text{*A reformulation of @{thm cl_least}*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
    93
lemma clD: "[|c \<in> cl L r; B \<in> L; r \<subseteq> B|] ==> c \<in> B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
    94
by (force simp add: cl_def)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
    95
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    96
lemma cl_UN_subset: "(\<Union>i\<in>I. cl L (r i)) \<subseteq> cl L (\<Union>i\<in>I. r i)"
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    97
by (simp add: cl_def, blast)
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
    98
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
    99
lemma cl_Un: "lattice L ==> cl L (r\<union>s) = cl L r \<union> cl L s"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   100
apply (rule equalityI) 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   101
 prefer 2 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   102
  apply (simp add: cl_def, blast)
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   103
apply (rule cl_least)
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   104
 apply (blast intro: Un_in_lattice cl_in_lattice)
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   105
apply (blast intro: subset_cl [THEN subsetD])  
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   106
done
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   107
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   108
lemma cl_UN: "lattice L ==> cl L (\<Union>i\<in>I. r i) = (\<Union>i\<in>I. cl L (r i))"
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   109
apply (rule equalityI) 
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   110
 prefer 2 apply (simp add: cl_def, blast)
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   111
apply (rule cl_least)
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   112
 apply (blast intro: UN_in_lattice cl_in_lattice)
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   113
apply (blast intro: subset_cl [THEN subsetD])  
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   114
done
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   115
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   116
lemma cl_Int_subset: "cl L (r\<inter>s) \<subseteq> cl L r \<inter> cl L s"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   117
by (simp add: cl_def, blast)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   118
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   119
lemma cl_idem [simp]: "cl L (cl L r) = cl L r"
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   120
by (simp add: cl_def, blast)
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   121
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   122
lemma cl_ident: "r\<in>L ==> cl L r = r" 
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   123
by (force simp add: cl_def)
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   124
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   125
lemma cl_empty [simp]: "lattice L ==> cl L {} = {}"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   126
by (simp add: cl_ident empty_in_lattice)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   127
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   128
lemma cl_UNIV [simp]: "lattice L ==> cl L UNIV = UNIV"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   129
by (simp add: cl_ident UNIV_in_lattice)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   130
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   131
text{*Assertion (4.62)*}
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   132
lemma cl_ident_iff: "lattice L ==> (cl L r = r) = (r\<in>L)" 
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   133
apply (rule iffI) 
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   134
 apply (erule subst)
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   135
 apply (erule cl_in_lattice)  
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   136
apply (erule cl_ident) 
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   137
done
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   138
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   139
lemma cl_subset_in_lattice: "[|cl L r \<subseteq> r; lattice L|] ==> r\<in>L" 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   140
by (simp add: cl_ident_iff [symmetric] equalityI subset_cl)
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   141
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   142
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   143
subsection {*Progress Sets and the Main Lemma*}
13888
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   144
text{*A progress set satisfies certain closure conditions and is a 
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   145
simple way of including the set @{term "wens_set F B"}.*}
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   146
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   147
constdefs 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   148
  closed :: "['a program, 'a set, 'a set,  'a set set] => bool"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   149
   "closed F T B L == \<forall>M. \<forall>act \<in> Acts F. B\<subseteq>M & T\<inter>M \<in> L -->
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   150
                              T \<inter> (B \<union> wp act M) \<in> L"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   151
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   152
  progress_set :: "['a program, 'a set, 'a set] => 'a set set set"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   153
   "progress_set F T B ==
13870
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13866
diff changeset
   154
      {L. lattice L & B \<in> L & T \<in> L & closed F T B L}"
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   155
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   156
lemma closedD:
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   157
   "[|closed F T B L; act \<in> Acts F; B\<subseteq>M; T\<inter>M \<in> L|] 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   158
    ==> T \<inter> (B \<union> wp act M) \<in> L"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   159
by (simp add: closed_def) 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   160
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   161
text{*Note: the formalization below replaces Meier's @{term q} by @{term B}
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   162
and @{term m} by @{term X}. *}
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   163
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   164
text{*Part of the proof of the claim at the bottom of page 97.  It's
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   165
proved separately because the argument requires a generalization over
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   166
all @{term "act \<in> Acts F"}.*}
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   167
lemma lattice_awp_lemma:
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   168
  assumes TXC:  "T\<inter>X \<in> C" --{*induction hypothesis in theorem below*}
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   169
      and BsubX:  "B \<subseteq> X"   --{*holds in inductive step*}
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   170
      and latt: "lattice C"
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   171
      and TC:   "T \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   172
      and BC:   "B \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   173
      and clos: "closed F T B C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   174
    shows "T \<inter> (B \<union> awp F (X \<union> cl C (T\<inter>r))) \<in> C"
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   175
apply (simp del: INT_simps add: awp_def INT_extend_simps) 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   176
apply (rule INT_in_lattice [OF latt]) 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   177
apply (erule closedD [OF clos]) 
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   178
apply (simp add: subset_trans [OF BsubX Un_upper1]) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   179
apply (subgoal_tac "T \<inter> (X \<union> cl C (T\<inter>r)) = (T\<inter>X) \<union> cl C (T\<inter>r)")
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   180
 prefer 2 apply (blast intro: TC clD) 
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   181
apply (erule ssubst) 
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   182
apply (blast intro: Un_in_lattice latt cl_in_lattice TXC) 
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   183
done
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   184
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   185
text{*Remainder of the proof of the claim at the bottom of page 97.*}
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   186
lemma lattice_lemma:
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   187
  assumes TXC:  "T\<inter>X \<in> C" --{*induction hypothesis in theorem below*}
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   188
      and BsubX:  "B \<subseteq> X"   --{*holds in inductive step*}
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   189
      and act:  "act \<in> Acts F"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   190
      and latt: "lattice C"
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   191
      and TC:   "T \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   192
      and BC:   "B \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   193
      and clos: "closed F T B C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   194
    shows "T \<inter> (wp act X \<inter> awp F (X \<union> cl C (T\<inter>r)) \<union> X) \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   195
apply (subgoal_tac "T \<inter> (B \<union> wp act X) \<in> C")
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   196
 prefer 2 apply (simp add: closedD [OF clos] act BsubX TXC)
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   197
apply (drule Int_in_lattice
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   198
              [OF _ lattice_awp_lemma [OF TXC BsubX latt TC BC clos, of r]
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   199
                    latt])
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   200
apply (subgoal_tac
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   201
	 "T \<inter> (B \<union> wp act X) \<inter> (T \<inter> (B \<union> awp F (X \<union> cl C (T\<inter>r)))) = 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   202
	  T \<inter> (B \<union> wp act X \<inter> awp F (X \<union> cl C (T\<inter>r)))") 
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   203
 prefer 2 apply blast 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   204
apply simp  
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   205
apply (drule Un_in_lattice [OF _ TXC latt])  
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   206
apply (subgoal_tac
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   207
	 "T \<inter> (B \<union> wp act X \<inter> awp F (X \<union> cl C (T\<inter>r))) \<union> T\<inter>X = 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   208
	  T \<inter> (wp act X \<inter> awp F (X \<union> cl C (T\<inter>r)) \<union> X)")
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   209
 apply simp 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   210
apply (blast intro: BsubX [THEN subsetD]) 
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   211
done
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   212
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   213
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   214
text{*Induction step for the main lemma*}
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   215
lemma progress_induction_step:
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   216
  assumes TXC:  "T\<inter>X \<in> C" --{*induction hypothesis in theorem below*}
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   217
      and act:  "act \<in> Acts F"
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   218
      and Xwens: "X \<in> wens_set F B"
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   219
      and latt: "lattice C"
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   220
      and  TC:  "T \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   221
      and  BC:  "B \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   222
      and clos: "closed F T B C"
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   223
      and Fstable: "F \<in> stable T"
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   224
  shows "T \<inter> wens F act X \<in> C"
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   225
proof -
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   226
  from Xwens have BsubX: "B \<subseteq> X"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   227
    by (rule wens_set_imp_subset) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   228
  let ?r = "wens F act X"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   229
  have "?r \<subseteq> (wp act X \<inter> awp F (X\<union>?r)) \<union> X"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   230
    by (simp add: wens_unfold [symmetric])
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   231
  then have "T\<inter>?r \<subseteq> T \<inter> ((wp act X \<inter> awp F (X\<union>?r)) \<union> X)"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   232
    by blast
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   233
  then have "T\<inter>?r \<subseteq> T \<inter> ((wp act X \<inter> awp F (T \<inter> (X\<union>?r))) \<union> X)"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   234
    by (simp add: awp_Int_eq Fstable stable_imp_awp_ident, blast) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   235
  then have "T\<inter>?r \<subseteq> T \<inter> ((wp act X \<inter> awp F (X \<union> cl C (T\<inter>?r))) \<union> X)"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   236
    by (blast intro: awp_mono [THEN [2] rev_subsetD] subset_cl [THEN subsetD])
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   237
  then have "cl C (T\<inter>?r) \<subseteq> 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   238
             cl C (T \<inter> ((wp act X \<inter> awp F (X \<union> cl C (T\<inter>?r))) \<union> X))"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   239
    by (rule cl_mono) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   240
  then have "cl C (T\<inter>?r) \<subseteq> 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   241
             T \<inter> ((wp act X \<inter> awp F (X \<union> cl C (T\<inter>?r))) \<union> X)"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   242
    by (simp add: cl_ident lattice_lemma [OF TXC BsubX act latt TC BC clos])
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   243
  then have "cl C (T\<inter>?r) \<subseteq> (wp act X \<inter> awp F (X \<union> cl C (T\<inter>?r))) \<union> X"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   244
    by blast
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   245
  then have "cl C (T\<inter>?r) \<subseteq> ?r"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   246
    by (blast intro!: subset_wens) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   247
  then have cl_subset: "cl C (T\<inter>?r) \<subseteq> T\<inter>?r"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   248
    by (simp add: Int_subset_iff cl_ident TC
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   249
                  subset_trans [OF cl_mono [OF Int_lower1]]) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   250
  show ?thesis
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   251
    by (rule cl_subset_in_lattice [OF cl_subset latt]) 
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   252
qed
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   253
13888
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   254
text{*Proved on page 96 of Meier's thesis.  The special case when
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   255
   @{term "T=UNIV"} states that every progress set for the program @{term F}
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   256
   and set @{term B} includes the set @{term "wens_set F B"}.*}
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   257
lemma progress_set_lemma:
13870
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13866
diff changeset
   258
     "[|C \<in> progress_set F T B; r \<in> wens_set F B; F \<in> stable T|] ==> T\<inter>r \<in> C"
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   259
apply (simp add: progress_set_def, clarify) 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   260
apply (erule wens_set.induct) 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   261
  txt{*Base*}
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   262
  apply (simp add: Int_in_lattice) 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   263
 txt{*The difficult @{term wens} case*}
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   264
 apply (simp add: progress_induction_step) 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   265
txt{*Disjunctive case*}
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   266
apply (subgoal_tac "(\<Union>U\<in>W. T \<inter> U) \<in> C") 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   267
 apply (simp add: Int_Union) 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   268
apply (blast intro: UN_in_lattice) 
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   269
done
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13853
diff changeset
   270
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   271
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   272
subsection {*The Progress Set Union Theorem*}
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   273
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   274
lemma closed_mono:
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   275
  assumes BB':  "B \<subseteq> B'"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   276
      and TBwp: "T \<inter> (B \<union> wp act M) \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   277
      and B'C:  "B' \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   278
      and TC:   "T \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   279
      and latt: "lattice C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   280
  shows "T \<inter> (B' \<union> wp act M) \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   281
proof -
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   282
  from TBwp have "(T\<inter>B) \<union> (T \<inter> wp act M) \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   283
    by (simp add: Int_Un_distrib)
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   284
  then have TBBC: "(T\<inter>B') \<union> ((T\<inter>B) \<union> (T \<inter> wp act M)) \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   285
    by (blast intro: Int_in_lattice Un_in_lattice TC B'C latt) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   286
  show ?thesis
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   287
    by (rule eqelem_imp_iff [THEN iffD1, OF _ TBBC], 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   288
        blast intro: BB' [THEN subsetD]) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   289
qed
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   290
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   291
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   292
lemma progress_set_mono:
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   293
    assumes BB':  "B \<subseteq> B'"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   294
    shows
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   295
     "[| B' \<in> C;  C \<in> progress_set F T B|] 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   296
      ==> C \<in> progress_set F T B'"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   297
by (simp add: progress_set_def closed_def closed_mono [OF BB'] 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   298
                 subset_trans [OF BB']) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   299
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   300
theorem progress_set_Union:
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   301
  assumes leadsTo: "F \<in> A leadsTo B'"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   302
      and prog: "C \<in> progress_set F T B"
13870
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13866
diff changeset
   303
      and Fstable: "F \<in> stable T"
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   304
      and BB':  "B \<subseteq> B'"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   305
      and B'C:  "B' \<in> C"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   306
      and Gco: "!!X. X\<in>C ==> G \<in> X-B co X"
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   307
  shows "F\<squnion>G \<in> T\<inter>A leadsTo B'"
13870
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13866
diff changeset
   308
apply (insert prog Fstable) 
13866
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   309
apply (rule leadsTo_Join [OF leadsTo]) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   310
  apply (force simp add: progress_set_def awp_iff_stable [symmetric]) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   311
apply (simp add: awp_iff_constrains)
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   312
apply (drule progress_set_mono [OF BB' B'C]) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   313
apply (blast intro: progress_set_lemma Gco constrains_weaken_L 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   314
                    BB' [THEN subsetD]) 
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   315
done
b42d7983a822 More "progress set" material
paulson
parents: 13861
diff changeset
   316
13870
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13866
diff changeset
   317
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13866
diff changeset
   318
subsection {*Some Progress Sets*}
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13866
diff changeset
   319
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13866
diff changeset
   320
lemma UNIV_in_progress_set: "UNIV \<in> progress_set F T B"
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13866
diff changeset
   321
by (simp add: progress_set_def lattice_def closed_def)
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13866
diff changeset
   322
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   323
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   324
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   325
subsubsection {*Lattices and Relations*}
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   326
text{*From Meier's thesis, section 4.5.3*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   327
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   328
constdefs
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   329
  relcl :: "'a set set => ('a * 'a) set"
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   330
    -- {*Derived relation from a lattice*}
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   331
    "relcl L == {(x,y). y \<in> cl L {x}}"
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   332
  
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   333
  latticeof :: "('a * 'a) set => 'a set set"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   334
    -- {*Derived lattice from a relation: the set of upwards-closed sets*}
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   335
    "latticeof r == {X. \<forall>s t. s \<in> X & (s,t) \<in> r --> t \<in> X}"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   336
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   337
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   338
lemma relcl_refl: "(a,a) \<in> relcl L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   339
by (simp add: relcl_def subset_cl [THEN subsetD])
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   340
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   341
lemma relcl_trans:
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   342
     "[| (a,b) \<in> relcl L; (b,c) \<in> relcl L; lattice L |] ==> (a,c) \<in> relcl L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   343
apply (simp add: relcl_def)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   344
apply (blast intro: clD cl_in_lattice)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   345
done
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   346
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   347
lemma refl_relcl: "lattice L ==> refl UNIV (relcl L)"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   348
by (simp add: reflI relcl_def subset_cl [THEN subsetD])
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   349
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   350
lemma trans_relcl: "lattice L ==> trans (relcl L)"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   351
by (blast intro: relcl_trans transI)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   352
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   353
lemma lattice_latticeof: "lattice (latticeof r)"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   354
by (auto simp add: lattice_def latticeof_def)
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   355
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   356
lemma lattice_singletonI:
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   357
     "[|lattice L; !!s. s \<in> X ==> {s} \<in> L|] ==> X \<in> L"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   358
apply (cut_tac UN_singleton [of X]) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   359
apply (erule subst) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   360
apply (simp only: UN_in_lattice) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   361
done
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   362
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   363
text{*Equation (4.71) of Meier's thesis.  He gives no proof.*}
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   364
lemma cl_latticeof:
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   365
     "[|refl UNIV r; trans r|] 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   366
      ==> cl (latticeof r) X = {t. \<exists>s. s\<in>X & (s,t) \<in> r}" 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   367
apply (rule equalityI) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   368
 apply (rule cl_least) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   369
  apply (simp (no_asm_use) add: latticeof_def trans_def, blast)
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   370
 apply (simp add: latticeof_def refl_def, blast)
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   371
apply (simp add: latticeof_def, clarify)
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   372
apply (unfold cl_def, blast) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   373
done
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   374
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   375
text{*Related to (4.71).*}
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   376
lemma cl_eq_Collect_relcl:
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   377
     "lattice L ==> cl L X = {t. \<exists>s. s\<in>X & (s,t) \<in> relcl L}" 
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   378
apply (cut_tac UN_singleton [of X]) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   379
apply (erule subst) 
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   380
apply (force simp only: relcl_def cl_UN)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   381
done
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   382
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   383
text{*Meier's theorem of section 4.5.3*}
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   384
theorem latticeof_relcl_eq: "lattice L ==> latticeof (relcl L) = L"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   385
apply (rule equalityI) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   386
 prefer 2 apply (force simp add: latticeof_def relcl_def cl_def, clarify) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   387
apply (rename_tac X)
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   388
apply (rule cl_subset_in_lattice)   
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   389
 prefer 2 apply assumption
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   390
apply (drule cl_ident_iff [OF lattice_latticeof, THEN iffD2])
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   391
apply (drule equalityD1)   
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   392
apply (rule subset_trans) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   393
 prefer 2 apply assumption
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   394
apply (thin_tac "?U \<subseteq> X") 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   395
apply (cut_tac A=X in UN_singleton) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   396
apply (erule subst) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   397
apply (simp only: cl_UN lattice_latticeof 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   398
                  cl_latticeof [OF refl_relcl trans_relcl]) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   399
apply (simp add: relcl_def) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   400
done
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   401
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   402
theorem relcl_latticeof_eq:
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   403
     "[|refl UNIV r; trans r|] ==> relcl (latticeof r) = r"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   404
by (simp add: relcl_def cl_latticeof, blast)
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   405
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   406
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   407
subsubsection {*Decoupling Theorems*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   408
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   409
constdefs
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   410
  decoupled :: "['a program, 'a program] => bool"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   411
   "decoupled F G ==
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   412
	\<forall>act \<in> Acts F. \<forall>B. G \<in> stable B --> G \<in> stable (wp act B)"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   413
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   414
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   415
text{*Rao's Decoupling Theorem*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   416
lemma stableco: "F \<in> stable A ==> F \<in> A-B co A"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   417
by (simp add: stable_def constrains_def, blast) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   418
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   419
theorem decoupling:
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   420
  assumes leadsTo: "F \<in> A leadsTo B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   421
      and Gstable: "G \<in> stable B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   422
      and dec:     "decoupled F G"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   423
  shows "F\<squnion>G \<in> A leadsTo B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   424
proof -
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   425
  have prog: "{X. G \<in> stable X} \<in> progress_set F UNIV B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   426
    by (simp add: progress_set_def lattice_stable Gstable closed_def
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   427
                  stable_Un [OF Gstable] dec [unfolded decoupled_def]) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   428
  have "F\<squnion>G \<in> (UNIV\<inter>A) leadsTo B" 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   429
    by (rule progress_set_Union [OF leadsTo prog],
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   430
        simp_all add: Gstable stableco)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   431
  thus ?thesis by simp
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   432
qed
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   433
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   434
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   435
text{*Rao's Weak Decoupling Theorem*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   436
theorem weak_decoupling:
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   437
  assumes leadsTo: "F \<in> A leadsTo B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   438
      and stable: "F\<squnion>G \<in> stable B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   439
      and dec:     "decoupled F (F\<squnion>G)"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   440
  shows "F\<squnion>G \<in> A leadsTo B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   441
proof -
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   442
  have prog: "{X. F\<squnion>G \<in> stable X} \<in> progress_set F UNIV B" 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   443
    by (simp del: Join_stable
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   444
             add: progress_set_def lattice_stable stable closed_def
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   445
                  stable_Un [OF stable] dec [unfolded decoupled_def])
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   446
  have "F\<squnion>G \<in> (UNIV\<inter>A) leadsTo B" 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   447
    by (rule progress_set_Union [OF leadsTo prog],
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   448
        simp_all del: Join_stable add: stable,
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   449
        simp add: stableco) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   450
  thus ?thesis by simp
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   451
qed
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   452
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   453
text{*The ``Decoupling via @{term G'} Union Theorem''*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   454
theorem decoupling_via_aux:
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   455
  assumes leadsTo: "F \<in> A leadsTo B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   456
      and prog: "{X. G' \<in> stable X} \<in> progress_set F UNIV B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   457
      and GG':  "G \<le> G'"  
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   458
               --{*Beware!  This is the converse of the refinement relation!*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   459
  shows "F\<squnion>G \<in> A leadsTo B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   460
proof -
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   461
  from prog have stable: "G' \<in> stable B"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   462
    by (simp add: progress_set_def)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   463
  have "F\<squnion>G \<in> (UNIV\<inter>A) leadsTo B" 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   464
    by (rule progress_set_Union [OF leadsTo prog],
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   465
        simp_all add: stable stableco component_stable [OF GG'])
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   466
  thus ?thesis by simp
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   467
qed
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   468
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   469
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   470
subsection{*Composition Theorems Based on Monotonicity and Commutativity*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   471
13888
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   472
subsubsection{*Commutativity of @{term "cl L"} and assignment.*}
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   473
constdefs 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   474
  commutes :: "['a program, 'a set, 'a set,  'a set set] => bool"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   475
   "commutes F T B L ==
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   476
       \<forall>M. \<forall>act \<in> Acts F. B \<subseteq> M --> 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   477
           cl L (T \<inter> wp act M) \<subseteq> T \<inter> (B \<union> wp act (cl L (T\<inter>M)))"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   478
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   479
13888
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   480
text{*From Meier's thesis, section 4.5.6*}
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   481
lemma commutativity1_lemma:
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   482
  assumes commutes: "commutes F T B L" 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   483
      and lattice:  "lattice L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   484
      and BL: "B \<in> L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   485
      and TL: "T \<in> L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   486
  shows "closed F T B L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   487
apply (simp add: closed_def, clarify)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   488
apply (rule ProgressSets.cl_subset_in_lattice [OF _ lattice])  
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   489
apply (simp add: Int_Un_distrib cl_Un [OF lattice] Un_subset_iff
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   490
                 cl_ident Int_in_lattice [OF TL BL lattice] Un_upper1)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   491
apply (subgoal_tac "cl L (T \<inter> wp act M) \<subseteq> T \<inter> (B \<union> wp act (cl L (T \<inter> M)))") 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   492
 prefer 2 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   493
 apply (simp add: commutes [unfolded commutes_def]) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   494
apply (erule subset_trans) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   495
apply (simp add: cl_ident)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   496
apply (blast intro: rev_subsetD [OF _ wp_mono]) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   497
done
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   498
13888
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   499
text{*Version packaged with @{thm progress_set_Union}*}
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   500
lemma commutativity1:
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   501
  assumes leadsTo: "F \<in> A leadsTo B"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   502
      and lattice:  "lattice L"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   503
      and BL: "B \<in> L"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   504
      and TL: "T \<in> L"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   505
      and Fstable: "F \<in> stable T"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   506
      and Gco: "!!X. X\<in>L ==> G \<in> X-B co X"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   507
      and commutes: "commutes F T B L" 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   508
  shows "F\<squnion>G \<in> T\<inter>A leadsTo B"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   509
by (rule progress_set_Union [OF leadsTo _ Fstable subset_refl BL Gco],
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   510
    simp add: progress_set_def commutativity1_lemma commutes lattice BL TL) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   511
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   512
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   513
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   514
text{*Possibly move to Relation.thy, after @{term single_valued}*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   515
constdefs
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   516
  funof :: "[('a*'b)set, 'a] => 'b"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   517
   "funof r == (\<lambda>x. THE y. (x,y) \<in> r)"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   518
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   519
lemma funof_eq: "[|single_valued r; (x,y) \<in> r|] ==> funof r x = y"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   520
by (simp add: funof_def single_valued_def, blast)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   521
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   522
lemma funof_Pair_in:
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   523
     "[|single_valued r; x \<in> Domain r|] ==> (x, funof r x) \<in> r"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   524
by (force simp add: funof_eq) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   525
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   526
lemma funof_in:
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   527
     "[|r``{x} \<subseteq> A; single_valued r; x \<in> Domain r|] ==> funof r x \<in> A" 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   528
by (force simp add: funof_eq)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   529
 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   530
lemma funof_imp_wp: "[|funof act t \<in> A; single_valued act|] ==> t \<in> wp act A"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   531
by (force simp add: in_wp_iff funof_eq)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   532
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   533
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   534
subsubsection{*Commutativity of Functions and Relation*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   535
text{*Thesis, page 109*}
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   536
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   537
(*FIXME: this proof is an ungodly mess*)
13888
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   538
text{*From Meier's thesis, section 4.5.6*}
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   539
lemma commutativity2_lemma:
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   540
  assumes dcommutes: 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   541
        "\<forall>act \<in> Acts F. 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   542
         \<forall>s \<in> T. \<forall>t. (s,t) \<in> relcl L --> 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   543
                      s \<in> B | t \<in> B | (funof act s, funof act t) \<in> relcl L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   544
      and determ: "!!act. act \<in> Acts F ==> single_valued act"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   545
      and total: "!!act. act \<in> Acts F ==> Domain act = UNIV"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   546
      and lattice:  "lattice L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   547
      and BL: "B \<in> L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   548
      and TL: "T \<in> L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   549
      and Fstable: "F \<in> stable T"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   550
  shows  "commutes F T B L"
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   551
apply (simp add: commutes_def, clarify)  
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   552
apply (rename_tac t)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   553
apply (subgoal_tac "\<exists>s. (s,t) \<in> relcl L & s \<in> T \<inter> wp act M") 
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   554
 prefer 2 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   555
 apply (force simp add: cl_eq_Collect_relcl [OF lattice], simp, clarify) 
13874
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   556
apply (subgoal_tac "\<forall>u\<in>L. s \<in> u --> t \<in> u") 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   557
 prefer 2 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   558
 apply (intro ballI impI) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   559
 apply (subst cl_ident [symmetric], assumption)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   560
 apply (simp add: relcl_def)  
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   561
 apply (blast intro: cl_mono [THEN [2] rev_subsetD])  
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   562
apply (subgoal_tac "funof act s \<in> T\<inter>M") 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   563
 prefer 2 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   564
 apply (cut_tac Fstable) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   565
 apply (force intro!: funof_in 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   566
              simp add: wp_def stable_def constrains_def determ total) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   567
apply (subgoal_tac "s \<in> B | t \<in> B | (funof act s, funof act t) \<in> relcl L")
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   568
 prefer 2
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   569
 apply (rule dcommutes [rule_format], assumption+) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   570
apply (subgoal_tac "t \<in> B | funof act t \<in> cl L (T\<inter>M)")
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   571
 prefer 2 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   572
 apply (simp add: relcl_def)
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   573
 apply (blast intro: BL cl_mono [THEN [2] rev_subsetD])  
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   574
apply (subgoal_tac "t \<in> B | t \<in> wp act (cl L (T\<inter>M))")
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   575
 prefer 2
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   576
 apply (blast intro: funof_imp_wp determ) 
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   577
apply (blast intro: TL cl_mono [THEN [2] rev_subsetD])  
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   578
done
0da2141606c6 More on progress sets
paulson
parents: 13870
diff changeset
   579
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   580
13888
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   581
text{*Version packaged with @{thm progress_set_Union}*}
13885
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   582
lemma commutativity2:
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   583
  assumes leadsTo: "F \<in> A leadsTo B"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   584
      and dcommutes: 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   585
        "\<forall>act \<in> Acts F. 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   586
         \<forall>s \<in> T. \<forall>t. (s,t) \<in> relcl L --> 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   587
                      s \<in> B | t \<in> B | (funof act s, funof act t) \<in> relcl L"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   588
      and determ: "!!act. act \<in> Acts F ==> single_valued act"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   589
      and total: "!!act. act \<in> Acts F ==> Domain act = UNIV"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   590
      and lattice:  "lattice L"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   591
      and BL: "B \<in> L"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   592
      and TL: "T \<in> L"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   593
      and Fstable: "F \<in> stable T"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   594
      and Gco: "!!X. X\<in>L ==> G \<in> X-B co X"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   595
  shows "F\<squnion>G \<in> T\<inter>A leadsTo B"
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   596
apply (rule commutativity1 [OF leadsTo lattice]) 
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   597
apply (simp_all add: Gco commutativity2_lemma dcommutes determ total
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   598
                     lattice BL TL Fstable)
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   599
done
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   600
de6fac7d5351 Proofs for section 4.5.3
paulson
parents: 13874
diff changeset
   601
13888
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   602
subsection {*Monotonicity*}
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   603
(*to be continued?*)
16f424af58a2 more comments and tweaks
paulson
parents: 13885
diff changeset
   604
13853
89131afa9f01 New theory ProgressSets. Definition of closure sets
paulson
parents:
diff changeset
   605
end