author paulson Wed, 05 Mar 2003 16:03:33 +0100 changeset 13846 b2c494d76012 parent 13845 5a04de077a9f child 13847 a5e48bc08148
new examples theory
```--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/HOL/UNITY/Comp/Progress.thy	Wed Mar 05 16:03:33 2003 +0100
@@ -0,0 +1,110 @@
+(*  Title:      HOL/UNITY/Transformers
+    ID:         \$Id\$
+    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
+    Copyright   2003  University of Cambridge
+
+David Meier's thesis
+*)
+
+
+theory Progress = UNITY_Main:
+
+
+
+(*????????????????Int*)
+lemma int_nat_eq [simp]: "int (nat z) = (if 0 \<le> z then z else 0)"
+by simp
+
+
+
+
+subsection {*The Composition of Two Single-Assignment Programs*}
+text{*Thesis Section 4.4.2*}
+
+constdefs
+  FF :: "int program"
+    "FF == mk_total_program (UNIV, {range (\<lambda>x. (x, x+1))}, UNIV)"
+
+  GG :: "int program"
+    "GG == mk_total_program (UNIV, {range (\<lambda>x. (x, 2*x))}, UNIV)"
+
+subsubsection {*Calculating @{term "wens_set FF (atLeast k)"}*}
+
+lemma Domain_actFF: "Domain (range (\<lambda>x::int. (x, x + 1))) = UNIV"
+by force
+
+lemma FF_eq:
+      "FF = mk_program (UNIV, {range (\<lambda>x. (x, x+1))}, UNIV)"
+by (simp add: FF_def mk_total_program_def totalize_def totalize_act_def
+              program_equalityI Domain_actFF)
+
+lemma wp_actFF:
+     "wp (range (\<lambda>x::int. (x, x + 1))) (atLeast k) = atLeast (k - 1)"
+
+lemma wens_FF: "wens FF (range (\<lambda>x. (x, x+1))) (atLeast k) = atLeast (k - 1)"
+by (force simp add: FF_eq wens_single_eq wp_actFF)
+
+lemma single_valued_actFF: "single_valued (range (\<lambda>x::int. (x, x + 1)))"
+
+lemma wens_single_finite_FF:
+     "wens_single_finite (range (\<lambda>x. (x, x+1))) (atLeast k) n =
+      atLeast (k - int n)"
+apply (induct n, simp)
+            def_wens_single_finite_Suc_eq_wens [OF FF_eq single_valued_actFF])
+done
+
+lemma wens_single_FF_eq_UNIV:
+     "wens_single (range (\<lambda>x::int. (x, x + 1))) (atLeast k) = UNIV"
+apply (rule_tac x="nat (k-x)" in exI)
+done
+
+lemma wens_set_FF:
+     "wens_set FF (atLeast k) = insert UNIV (atLeast ` atMost k)"
+apply (auto simp add: wens_set_single_eq [OF FF_eq single_valued_actFF]
+                      wens_single_FF_eq_UNIV wens_single_finite_FF)
+apply (erule notE)
+apply (rule_tac x="nat (k-xa)" in range_eqI)
+done
+
+subsubsection {*Proving @{term "FF \<in> UNIV leadsTo atLeast (k::int)"}*}
+
+lemma atLeast_ensures: "FF \<in> atLeast (k - 1) ensures atLeast (k::int)"
+apply (simp add: Progress.wens_FF [symmetric] wens_ensures)
+done
+
+lemma atLeast_leadsTo: "FF \<in> atLeast (k - int n) leadsTo atLeast (k::int)"
+apply (induct n)
+apply (rule_tac A = "atLeast (k - int n - 1)" in leadsTo_weaken_L)
+ apply (blast intro: leadsTo_Trans atLeast_ensures, force)
+done
+
+lemma UN_atLeast_UNIV: "(\<Union>n. atLeast (k - int n)) = UNIV"
+apply auto
+apply (rule_tac x = "nat (k - x)" in exI, simp)
+done
+
+apply (subst UN_atLeast_UNIV [symmetric])