diff -r 703edebd1d92 -r f1ecba0272f9 src/HOL/UNITY/ProgressSets.thy --- a/src/HOL/UNITY/ProgressSets.thy Wed May 25 11:49:40 2016 +0200 +++ b/src/HOL/UNITY/ProgressSets.thy Wed May 25 11:50:58 2016 +0200 @@ -13,19 +13,19 @@ Swiss Federal Institute of Technology Zurich (1997) *) -section{*Progress Sets*} +section\Progress Sets\ theory ProgressSets imports Transformers begin -subsection {*Complete Lattices and the Operator @{term cl}*} +subsection \Complete Lattices and the Operator @{term cl}\ definition lattice :: "'a set set => bool" where - --{*Meier calls them closure sets, but they are just complete lattices*} + \\Meier calls them closure sets, but they are just complete lattices\ "lattice L == (\M. M \ L --> \M \ L) & (\M. M \ L --> \M \ L)" definition cl :: "['a set set, 'a set] => 'a set" where - --{*short for ``closure''*} + \\short for ``closure''\ "cl L r == \{x. x\L & r \ x}" lemma UNIV_in_lattice: "lattice L ==> UNIV \ L" @@ -59,8 +59,8 @@ lemma lattice_stable: "lattice {X. F \ stable X}" by (simp add: lattice_def stable_def constrains_def, blast) -text{*The next three results state that @{term "cl L r"} is the minimal - element of @{term L} that includes @{term r}.*} +text\The next three results state that @{term "cl L r"} is the minimal + element of @{term L} that includes @{term r}.\ lemma cl_in_lattice: "lattice L ==> cl L r \ L" apply (simp add: lattice_def cl_def) apply (erule conjE) @@ -70,18 +70,18 @@ lemma cl_least: "[|c\L; r\c|] ==> cl L r \ c" by (force simp add: cl_def) -text{*The next three lemmas constitute assertion (4.61)*} +text\The next three lemmas constitute assertion (4.61)\ lemma cl_mono: "r \ r' ==> cl L r \ cl L r'" by (simp add: cl_def, blast) lemma subset_cl: "r \ cl L r" by (simp add: cl_def le_Inf_iff) -text{*A reformulation of @{thm subset_cl}*} +text\A reformulation of @{thm subset_cl}\ lemma clI: "x \ r ==> x \ cl L r" by (simp add: cl_def, blast) -text{*A reformulation of @{thm cl_least}*} +text\A reformulation of @{thm cl_least}\ lemma clD: "[|c \ cl L r; B \ L; r \ B|] ==> c \ B" by (force simp add: cl_def) @@ -120,7 +120,7 @@ lemma cl_UNIV [simp]: "lattice L ==> cl L UNIV = UNIV" by (simp add: cl_ident UNIV_in_lattice) -text{*Assertion (4.62)*} +text\Assertion (4.62)\ lemma cl_ident_iff: "lattice L ==> (cl L r = r) = (r\L)" apply (rule iffI) apply (erule subst) @@ -132,9 +132,9 @@ by (simp add: cl_ident_iff [symmetric] equalityI subset_cl) -subsection {*Progress Sets and the Main Lemma*} -text{*A progress set satisfies certain closure conditions and is a -simple way of including the set @{term "wens_set F B"}.*} +subsection \Progress Sets and the Main Lemma\ +text\A progress set satisfies certain closure conditions and is a +simple way of including the set @{term "wens_set F B"}.\ definition closed :: "['a program, 'a set, 'a set, 'a set set] => bool" where "closed F T B L == \M. \act \ Acts F. B\M & T\M \ L --> @@ -149,15 +149,15 @@ ==> T \ (B \ wp act M) \ L" by (simp add: closed_def) -text{*Note: the formalization below replaces Meier's @{term q} by @{term B} -and @{term m} by @{term X}. *} +text\Note: the formalization below replaces Meier's @{term q} by @{term B} +and @{term m} by @{term X}.\ -text{*Part of the proof of the claim at the bottom of page 97. It's +text\Part of the proof of the claim at the bottom of page 97. It's proved separately because the argument requires a generalization over -all @{term "act \ Acts F"}.*} +all @{term "act \ Acts F"}.\ lemma lattice_awp_lemma: - assumes TXC: "T\X \ C" --{*induction hypothesis in theorem below*} - and BsubX: "B \ X" --{*holds in inductive step*} + assumes TXC: "T\X \ C" \\induction hypothesis in theorem below\ + and BsubX: "B \ X" \\holds in inductive step\ and latt: "lattice C" and TC: "T \ C" and BC: "B \ C" @@ -173,10 +173,10 @@ apply (blast intro: Un_in_lattice latt cl_in_lattice TXC) done -text{*Remainder of the proof of the claim at the bottom of page 97.*} +text\Remainder of the proof of the claim at the bottom of page 97.\ lemma lattice_lemma: - assumes TXC: "T\X \ C" --{*induction hypothesis in theorem below*} - and BsubX: "B \ X" --{*holds in inductive step*} + assumes TXC: "T\X \ C" \\induction hypothesis in theorem below\ + and BsubX: "B \ X" \\holds in inductive step\ and act: "act \ Acts F" and latt: "lattice C" and TC: "T \ C" @@ -202,9 +202,9 @@ done -text{*Induction step for the main lemma*} +text\Induction step for the main lemma\ lemma progress_induction_step: - assumes TXC: "T\X \ C" --{*induction hypothesis in theorem below*} + assumes TXC: "T\X \ C" \\induction hypothesis in theorem below\ and act: "act \ Acts F" and Xwens: "X \ wens_set F B" and latt: "lattice C" @@ -242,25 +242,25 @@ by (rule cl_subset_in_lattice [OF cl_subset latt]) qed -text{*Proved on page 96 of Meier's thesis. The special case when +text\Proved on page 96 of Meier's thesis. The special case when @{term "T=UNIV"} states that every progress set for the program @{term F} - and set @{term B} includes the set @{term "wens_set F B"}.*} + and set @{term B} includes the set @{term "wens_set F B"}.\ lemma progress_set_lemma: "[|C \ progress_set F T B; r \ wens_set F B; F \ stable T|] ==> T\r \ C" apply (simp add: progress_set_def, clarify) apply (erule wens_set.induct) - txt{*Base*} + txt\Base\ apply (simp add: Int_in_lattice) - txt{*The difficult @{term wens} case*} + txt\The difficult @{term wens} case\ apply (simp add: progress_induction_step) -txt{*Disjunctive case*} +txt\Disjunctive case\ apply (subgoal_tac "(\U\W. T \ U) \ C") apply simp apply (blast intro: UN_in_lattice) done -subsection {*The Progress Set Union Theorem*} +subsection \The Progress Set Union Theorem\ lemma closed_mono: assumes BB': "B \ B'" @@ -306,22 +306,22 @@ done -subsection {*Some Progress Sets*} +subsection \Some Progress Sets\ lemma UNIV_in_progress_set: "UNIV \ progress_set F T B" by (simp add: progress_set_def lattice_def closed_def) -subsubsection {*Lattices and Relations*} -text{*From Meier's thesis, section 4.5.3*} +subsubsection \Lattices and Relations\ +text\From Meier's thesis, section 4.5.3\ definition relcl :: "'a set set => ('a * 'a) set" where - -- {*Derived relation from a lattice*} + \ \Derived relation from a lattice\ "relcl L == {(x,y). y \ cl L {x}}" definition latticeof :: "('a * 'a) set => 'a set set" where - -- {*Derived lattice from a relation: the set of upwards-closed sets*} + \ \Derived lattice from a relation: the set of upwards-closed sets\ "latticeof r == {X. \s t. s \ X & (s,t) \ r --> t \ X}" @@ -350,7 +350,7 @@ apply (simp only: UN_in_lattice) done -text{*Equation (4.71) of Meier's thesis. He gives no proof.*} +text\Equation (4.71) of Meier's thesis. He gives no proof.\ lemma cl_latticeof: "[|refl r; trans r|] ==> cl (latticeof r) X = {t. \s. s\X & (s,t) \ r}" @@ -362,7 +362,7 @@ apply (unfold cl_def, blast) done -text{*Related to (4.71).*} +text\Related to (4.71).\ lemma cl_eq_Collect_relcl: "lattice L ==> cl L X = {t. \s. s\X & (s,t) \ relcl L}" apply (cut_tac UN_singleton [of X]) @@ -370,7 +370,7 @@ apply (force simp only: relcl_def cl_UN) done -text{*Meier's theorem of section 4.5.3*} +text\Meier's theorem of section 4.5.3\ theorem latticeof_relcl_eq: "lattice L ==> latticeof (relcl L) = L" apply (rule equalityI) prefer 2 apply (force simp add: latticeof_def relcl_def cl_def, clarify) @@ -394,14 +394,14 @@ by (simp add: relcl_def cl_latticeof) -subsubsection {*Decoupling Theorems*} +subsubsection \Decoupling Theorems\ definition decoupled :: "['a program, 'a program] => bool" where "decoupled F G == \act \ Acts F. \B. G \ stable B --> G \ stable (wp act B)" -text{*Rao's Decoupling Theorem*} +text\Rao's Decoupling Theorem\ lemma stableco: "F \ stable A ==> F \ A-B co A" by (simp add: stable_def constrains_def, blast) @@ -421,7 +421,7 @@ qed -text{*Rao's Weak Decoupling Theorem*} +text\Rao's Weak Decoupling Theorem\ theorem weak_decoupling: assumes leadsTo: "F \ A leadsTo B" and stable: "F\G \ stable B" @@ -439,12 +439,12 @@ thus ?thesis by simp qed -text{*The ``Decoupling via @{term G'} Union Theorem''*} +text\The ``Decoupling via @{term G'} Union Theorem''\ theorem decoupling_via_aux: assumes leadsTo: "F \ A leadsTo B" and prog: "{X. G' \ stable X} \ progress_set F UNIV B" and GG': "G \ G'" - --{*Beware! This is the converse of the refinement relation!*} + \\Beware! This is the converse of the refinement relation!\ shows "F\G \ A leadsTo B" proof - from prog have stable: "G' \ stable B" @@ -456,16 +456,16 @@ qed -subsection{*Composition Theorems Based on Monotonicity and Commutativity*} +subsection\Composition Theorems Based on Monotonicity and Commutativity\ -subsubsection{*Commutativity of @{term "cl L"} and assignment.*} +subsubsection\Commutativity of @{term "cl L"} and assignment.\ definition commutes :: "['a program, 'a set, 'a set, 'a set set] => bool" where "commutes F T B L == \M. \act \ Acts F. B \ M --> cl L (T \ wp act M) \ T \ (B \ wp act (cl L (T\M)))" -text{*From Meier's thesis, section 4.5.6*} +text\From Meier's thesis, section 4.5.6\ lemma commutativity1_lemma: assumes commutes: "commutes F T B L" and lattice: "lattice L" @@ -484,7 +484,7 @@ apply (blast intro: rev_subsetD [OF _ wp_mono]) done -text{*Version packaged with @{thm progress_set_Union}*} +text\Version packaged with @{thm progress_set_Union}\ lemma commutativity1: assumes leadsTo: "F \ A leadsTo B" and lattice: "lattice L" @@ -499,7 +499,7 @@ -text{*Possibly move to Relation.thy, after @{term single_valued}*} +text\Possibly move to Relation.thy, after @{term single_valued}\ definition funof :: "[('a*'b)set, 'a] => 'b" where "funof r == (\x. THE y. (x,y) \ r)" @@ -518,11 +518,11 @@ by (force simp add: in_wp_iff funof_eq) -subsubsection{*Commutativity of Functions and Relation*} -text{*Thesis, page 109*} +subsubsection\Commutativity of Functions and Relation\ +text\Thesis, page 109\ (*FIXME: this proof is still an ungodly mess*) -text{*From Meier's thesis, section 4.5.6*} +text\From Meier's thesis, section 4.5.6\ lemma commutativity2_lemma: assumes dcommutes: "\act s t. act \ Acts F \ s \ T \ (s, t) \ relcl L \ @@ -564,7 +564,7 @@ then show "commutes F T B L" unfolding commutes_def by clarify qed -text{*Version packaged with @{thm progress_set_Union}*} +text\Version packaged with @{thm progress_set_Union}\ lemma commutativity2: assumes leadsTo: "F \ A leadsTo B" and dcommutes: @@ -585,8 +585,8 @@ done -subsection {*Monotonicity*} -text{*From Meier's thesis, section 4.5.7, page 110*} +subsection \Monotonicity\ +text\From Meier's thesis, section 4.5.7, page 110\ (*to be continued?*) end