# HG changeset patch # User paulson # Date 1047919068 -3600 # Node ID b42d7983a8222f544e7978ed0ab51987fcf06369 # Parent 0a6bf71955b008fd250b8c32b3cba6ca16cba597 More "progress set" material diff -r 0a6bf71955b0 -r b42d7983a822 src/HOL/UNITY/Comp/Progress.thy --- a/src/HOL/UNITY/Comp/Progress.thy Mon Mar 17 17:37:20 2003 +0100 +++ b/src/HOL/UNITY/Comp/Progress.thy Mon Mar 17 17:37:48 2003 +0100 @@ -88,11 +88,11 @@ apply (rule leadsTo_UN [OF atLeast_leadsTo]) done -text{*Result (4.39): Applying the Union Theorem*} +text{*Result (4.39): Applying the leadsTo-Join Theorem*} theorem "FF\GG \ atLeast 0 leadsTo atLeast (k::int)" apply (subgoal_tac "FF\GG \ (atLeast 0 \ atLeast 0) leadsTo atLeast k") apply simp -apply (rule_tac T = "atLeast 0" in leadsTo_Union) +apply (rule_tac T = "atLeast 0" in leadsTo_Join) apply (simp add: awp_iff FF_def, constrains) apply (simp add: awp_iff GG_def wens_set_FF, constrains) apply (rule leadsTo_weaken_L [OF FF_leadsTo], simp) diff -r 0a6bf71955b0 -r b42d7983a822 src/HOL/UNITY/ProgressSets.thy --- a/src/HOL/UNITY/ProgressSets.thy Mon Mar 17 17:37:20 2003 +0100 +++ b/src/HOL/UNITY/ProgressSets.thy Mon Mar 17 17:37:48 2003 +0100 @@ -18,6 +18,8 @@ theory ProgressSets = Transformers: +subsection {*Complete Lattices and the Operator @{term cl}*} + constdefs lattice :: "'a set set => bool" --{*Meier calls them closure sets, but they are just complete lattices*} @@ -97,8 +99,7 @@ lemma cl_UN: "lattice L ==> cl L (\i\I. r i) = (\i\I. cl L (r i))" apply (rule equalityI) - prefer 2 - apply (simp add: cl_def, blast) + prefer 2 apply (simp add: cl_def, blast) apply (rule cl_least) apply (blast intro: UN_in_lattice cl_in_lattice) apply (blast intro: subset_cl [THEN subsetD]) @@ -122,6 +123,8 @@ by (simp add: cl_ident_iff [symmetric] equalityI subset_cl) +subsection {*Progress Sets and the Main Lemma*} + constdefs closed :: "['a program, 'a set, 'a set, 'a set set] => bool" "closed F T B L == \M. \act \ Acts F. B\M & T\M \ L --> @@ -136,93 +139,102 @@ ==> 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{*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"}.*} lemma lattice_awp_lemma: - assumes tmc: "T\m \ C" --{*induction hypothesis in theorem below*} - and qsm: "q \ m" --{*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 qc: "q \ C" - and clos: "closed F T q C" - shows "T \ (q \ awp F (m \ cl C (T\r))) \ C" + and TC: "T \ C" + and BC: "B \ C" + and clos: "closed F T B C" + shows "T \ (B \ awp F (X \ cl C (T\r))) \ C" apply (simp del: INT_simps add: awp_def INT_extend_simps) apply (rule INT_in_lattice [OF latt]) apply (erule closedD [OF clos]) -apply (simp add: subset_trans [OF qsm Un_upper1]) -apply (subgoal_tac "T \ (m \ cl C (T\r)) = (T\m) \ cl C (T\r)") - prefer 2 apply (blast intro: tc rev_subsetD [OF _ cl_least]) +apply (simp add: subset_trans [OF BsubX Un_upper1]) +apply (subgoal_tac "T \ (X \ cl C (T\r)) = (T\X) \ cl C (T\r)") + prefer 2 apply (blast intro: TC rev_subsetD [OF _ cl_least]) apply (erule ssubst) -apply (blast intro: Un_in_lattice latt cl_in_lattice tmc) +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.*} lemma lattice_lemma: - assumes tmc: "T\m \ C" --{*induction hypothesis in theorem below*} - and qsm: "q \ m" --{*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" - and qc: "q \ C" - and clos: "closed F T q C" - shows "T \ (wp act m \ awp F (m \ cl C (T\r)) \ m) \ C" -apply (subgoal_tac "T \ (q \ wp act m) \ C") - prefer 2 apply (simp add: closedD [OF clos] act qsm tmc) + and TC: "T \ C" + and BC: "B \ C" + and clos: "closed F T B C" + shows "T \ (wp act X \ awp F (X \ cl C (T\r)) \ X) \ C" +apply (subgoal_tac "T \ (B \ wp act X) \ C") + prefer 2 apply (simp add: closedD [OF clos] act BsubX TXC) apply (drule Int_in_lattice - [OF _ lattice_awp_lemma [OF tmc qsm latt tc qc clos, of r] + [OF _ lattice_awp_lemma [OF TXC BsubX latt TC BC clos, of r] latt]) apply (subgoal_tac - "T \ (q \ wp act m) \ (T \ (q \ awp F (m \ cl C (T\r)))) = - T \ (q \ wp act m \ awp F (m \ cl C (T\r)))") + "T \ (B \ wp act X) \ (T \ (B \ awp F (X \ cl C (T\r)))) = + T \ (B \ wp act X \ awp F (X \ cl C (T\r)))") prefer 2 apply blast apply simp -apply (drule Un_in_lattice [OF _ tmc latt]) +apply (drule Un_in_lattice [OF _ TXC latt]) apply (subgoal_tac - "T \ (q \ wp act m \ awp F (m \ cl C (T\r))) \ T\m = - T \ (wp act m \ awp F (m \ cl C (T\r)) \ m)") - prefer 2 apply (blast intro: qsm [THEN subsetD], simp) + "T \ (B \ wp act X \ awp F (X \ cl C (T\r))) \ T\X = + T \ (wp act X \ awp F (X \ cl C (T\r)) \ X)") + apply simp +apply (blast intro: BsubX [THEN subsetD]) done +text{*Induction step for the main lemma*} lemma progress_induction_step: - assumes tmc: "T\m \ C" --{*induction hypothesis in theorem below*} + assumes TXC: "T\X \ C" --{*induction hypothesis in theorem below*} and act: "act \ Acts F" - and mwens: "m \ wens_set F q" + and Xwens: "X \ wens_set F B" and latt: "lattice C" - and tc: "T \ C" - and qc: "q \ C" - and clos: "closed F T q C" + and TC: "T \ C" + and BC: "B \ C" + and clos: "closed F T B C" and Fstable: "F \ stable T" - shows "T \ wens F act m \ C" + shows "T \ wens F act X \ C" proof - -from mwens have qsm: "q \ m" - by (rule wens_set_imp_subset) -let ?r = "wens F act m" -have "?r \ (wp act m \ awp F (m\?r)) \ m" - by (simp add: wens_unfold [symmetric]) -then have "T\?r \ T \ ((wp act m \ awp F (m\?r)) \ m)" - by blast -then have "T\?r \ T \ ((wp act m \ awp F (T \ (m\?r))) \ m)" - by (simp add: awp_Int_eq Fstable stable_imp_awp_ident, blast) -then have "T\?r \ T \ ((wp act m \ awp F (m \ cl C (T\?r))) \ m)" - by (blast intro: awp_mono [THEN [2] rev_subsetD] subset_cl [THEN subsetD]) -then have "cl C (T\?r) \ - cl C (T \ ((wp act m \ awp F (m \ cl C (T\?r))) \ m))" - by (rule cl_mono) -then have "cl C (T\?r) \ - T \ ((wp act m \ awp F (m \ cl C (T\?r))) \ m)" - by (simp add: cl_ident lattice_lemma [OF tmc qsm act latt tc qc clos]) -then have "cl C (T\?r) \ (wp act m \ awp F (m \ cl C (T\?r))) \ m" - by blast -then have "cl C (T\?r) \ ?r" - by (blast intro!: subset_wens) -then have cl_subset: "cl C (T\?r) \ T\?r" - by (simp add: Int_subset_iff cl_ident tc - subset_trans [OF cl_mono [OF Int_lower1]]) -show ?thesis - by (rule cl_subset_in_lattice [OF cl_subset latt]) + from Xwens have BsubX: "B \ X" + by (rule wens_set_imp_subset) + let ?r = "wens F act X" + have "?r \ (wp act X \ awp F (X\?r)) \ X" + by (simp add: wens_unfold [symmetric]) + then have "T\?r \ T \ ((wp act X \ awp F (X\?r)) \ X)" + by blast + then have "T\?r \ T \ ((wp act X \ awp F (T \ (X\?r))) \ X)" + by (simp add: awp_Int_eq Fstable stable_imp_awp_ident, blast) + then have "T\?r \ T \ ((wp act X \ awp F (X \ cl C (T\?r))) \ X)" + by (blast intro: awp_mono [THEN [2] rev_subsetD] subset_cl [THEN subsetD]) + then have "cl C (T\?r) \ + cl C (T \ ((wp act X \ awp F (X \ cl C (T\?r))) \ X))" + by (rule cl_mono) + then have "cl C (T\?r) \ + T \ ((wp act X \ awp F (X \ cl C (T\?r))) \ X)" + by (simp add: cl_ident lattice_lemma [OF TXC BsubX act latt TC BC clos]) + then have "cl C (T\?r) \ (wp act X \ awp F (X \ cl C (T\?r))) \ X" + by blast + then have "cl C (T\?r) \ ?r" + by (blast intro!: subset_wens) + then have cl_subset: "cl C (T\?r) \ T\?r" + by (simp add: Int_subset_iff cl_ident TC + subset_trans [OF cl_mono [OF Int_lower1]]) + show ?thesis + by (rule cl_subset_in_lattice [OF cl_subset latt]) qed - +text{*The Lemma proved on page 96*} lemma progress_set_lemma: - "[|C \ progress_set F T B; r \ wens_set F B|] ==> T\r \ C" + "[|C \ progress_set F T B; r \ wens_set F B|] ==> T\r \ C" apply (simp add: progress_set_def, clarify) apply (erule wens_set.induct) txt{*Base*} @@ -235,4 +247,49 @@ apply (blast intro: UN_in_lattice) done + +subsection {*The Progress Set Union Theorem*} + +lemma closed_mono: + assumes BB': "B \ B'" + and TBwp: "T \ (B \ wp act M) \ C" + and B'C: "B' \ C" + and TC: "T \ C" + and latt: "lattice C" + shows "T \ (B' \ wp act M) \ C" +proof - + from TBwp have "(T\B) \ (T \ wp act M) \ C" + by (simp add: Int_Un_distrib) + then have TBBC: "(T\B') \ ((T\B) \ (T \ wp act M)) \ C" + by (blast intro: Int_in_lattice Un_in_lattice TC B'C latt) + show ?thesis + by (rule eqelem_imp_iff [THEN iffD1, OF _ TBBC], + blast intro: BB' [THEN subsetD]) +qed + + +lemma progress_set_mono: + assumes BB': "B \ B'" + shows + "[| B' \ C; C \ progress_set F T B|] + ==> C \ progress_set F T B'" +by (simp add: progress_set_def closed_def closed_mono [OF BB'] + subset_trans [OF BB']) + +theorem progress_set_Union: + assumes prog: "C \ progress_set F T B" + and BB': "B \ B'" + and B'C: "B' \ C" + and Gco: "!!X. X\C ==> G \ X-B co X" + and leadsTo: "F \ A leadsTo B'" + shows "F\G \ T\A leadsTo B'" +apply (insert prog) +apply (rule leadsTo_Join [OF leadsTo]) + apply (force simp add: progress_set_def awp_iff_stable [symmetric]) +apply (simp add: awp_iff_constrains) +apply (drule progress_set_mono [OF BB' B'C]) +apply (blast intro: progress_set_lemma Gco constrains_weaken_L + BB' [THEN subsetD]) +done + end diff -r 0a6bf71955b0 -r b42d7983a822 src/HOL/UNITY/Transformers.thy --- a/src/HOL/UNITY/Transformers.thy Mon Mar 17 17:37:20 2003 +0100 +++ b/src/HOL/UNITY/Transformers.thy Mon Mar 17 17:37:48 2003 +0100 @@ -3,11 +3,15 @@ Author: Lawrence C Paulson, Cambridge University Computer Laboratory Copyright 2003 University of Cambridge -Predicate Transformers from +Predicate Transformers. From David Meier and Beverly Sanders, Composing Leads-to Properties Theoretical Computer Science 243:1-2 (2000), 339-361. + + David Meier, + Progress Properties in Program Refinement and Parallel Composition + Swiss Federal Institute of Technology Zurich (1997) *) header{*Predicate Transformers*} @@ -274,10 +278,10 @@ apply (blast intro: wens_set.Union) done -theorem leadsTo_Union: - assumes awpF: "T-B \ awp F T" +theorem leadsTo_Join: + assumes leadsTo: "F \ A leadsTo B" + and awpF: "T-B \ awp F T" and awpG: "!!X. X \ wens_set F B ==> (T\X) - B \ awp G (T\X)" - and leadsTo: "F \ A leadsTo B" shows "F\G \ T\A leadsTo B" apply (rule leadsTo [THEN leadsTo_imp_wens_set, THEN bexE]) apply (rule wens_Union [THEN bexE]) @@ -472,10 +476,10 @@ text{*Generalizing Misra's Fixed Point Union Theorem (4.41)*} -lemma fp_leadsTo_Union: +lemma fp_leadsTo_Join: "[|T-B \ awp F T; T-B \ FP G; F \ A leadsTo B|] ==> F\G \ T\A leadsTo B" -apply (rule leadsTo_Union, assumption) - apply (simp add: FP_def awp_iff_constrains stable_def constrains_def, blast, assumption) +apply (rule leadsTo_Join, assumption, blast) +apply (simp add: FP_def awp_iff_constrains stable_def constrains_def, blast) done end