# HG changeset patch # User nipkow # Date 1348551462 -7200 # Node ID 6abbede3ae128e13afddc8638be3d390401a98cc # Parent 47e4178f9a94bc3d3d8acc42fbc0c06e765293f6 tuned diff -r 47e4178f9a94 -r 6abbede3ae12 src/HOL/IMP/Abs_Int3.thy --- a/src/HOL/IMP/Abs_Int3.thy Mon Sep 24 19:11:35 2012 +0200 +++ b/src/HOL/IMP/Abs_Int3.thy Tue Sep 25 07:37:42 2012 +0200 @@ -277,7 +277,7 @@ definition pfp_wn :: "('a::{preord,widen,narrow} \ 'a) \ 'a \ 'a option" where "pfp_wn f x = - (case iter_widen f x of None \ None | Some y \ iter_narrow f y)" + (case iter_widen f x of None \ None | Some p \ iter_narrow f p)" lemma iter_widen_pfp: "iter_widen f x = Some p \ f p \ p" @@ -306,24 +306,24 @@ lemma iter_narrow_pfp: assumes mono: "!!x1 x2::_::WN_Lc. P x1 \ P x2 \ x1 \ x2 \ f x1 \ f x2" -and Pinv: "!!x. P x \ P(f x)" "!!x1 x2. P x1 \ P x2 \ P(x1 \ x2)" and "P x0" -and "f x0 \ x0" and "iter_narrow f x0 = Some x" -shows "P x \ f x \ x" +and Pinv: "!!x. P x \ P(f x)" "!!x1 x2. P x1 \ P x2 \ P(x1 \ x2)" +and "P p0" and "f p0 \ p0" and "iter_narrow f p0 = Some p" +shows "P p \ f p \ p" proof- - let ?Q = "%x. P x \ f x \ x \ x \ x0" - { fix x assume "?Q x" + let ?Q = "%p. P p \ f p \ p \ p \ p0" + { fix p assume "?Q p" note P = conjunct1[OF this] and 12 = conjunct2[OF this] note 1 = conjunct1[OF 12] and 2 = conjunct2[OF 12] - let ?x' = "x \ f x" - have "?Q ?x'" + let ?p' = "p \ f p" + have "?Q ?p'" proof auto - show "P ?x'" by (blast intro: P Pinv) - have "f ?x' \ f x" by(rule mono[OF `P (x \ f x)` P narrow2[OF 1]]) - also have "\ \ ?x'" by(rule narrow1[OF 1]) - finally show "f ?x' \ ?x'" . - have "?x' \ x" by (rule narrow2[OF 1]) - also have "x \ x0" by(rule 2) - finally show "?x' \ x0" . + show "P ?p'" by (blast intro: P Pinv) + have "f ?p' \ f p" by(rule mono[OF `P (p \ f p)` P narrow2[OF 1]]) + also have "\ \ ?p'" by(rule narrow1[OF 1]) + finally show "f ?p' \ ?p'" . + have "?p' \ p" by (rule narrow2[OF 1]) + also have "p \ p0" by(rule 2) + finally show "?p' \ p0" . qed } thus ?thesis @@ -332,16 +332,16 @@ qed lemma pfp_wn_pfp: -assumes mono: "!!x1 x2::_::WN_Lc. P x1 \ P x2 \ x1 \ x2 \ f x1 \ f x2" +assumes mono: "!!x1 x2::_::WN_Lc. P x1 \ P x2 \ x1 \ x2 \ f x1 \ f x2" and Pinv: "P x" "!!x. P x \ P(f x)" "!!x1 x2. P x1 \ P x2 \ P(x1 \ x2)" "!!x1 x2. P x1 \ P x2 \ P(x1 \ x2)" -and pfp_wn: "pfp_wn f x = Some x'" shows "P x' \ f x' \ x'" +and pfp_wn: "pfp_wn f x = Some p" shows "P p \ f p \ p" proof- - from pfp_wn obtain p - where its: "iter_widen f x = Some p" "iter_narrow f p = Some x'" + from pfp_wn obtain p0 + where its: "iter_widen f x = Some p0" "iter_narrow f p0 = Some p" by(auto simp: pfp_wn_def split: option.splits) - have "P p" by (blast intro: iter_widen_inv[where P="P"] its(1) Pinv(1-3)) + have "P p0" by (blast intro: iter_widen_inv[where P="P"] its(1) Pinv(1-3)) thus ?thesis by - (assumption | rule iter_narrow_pfp[where P=P] mono Pinv(2,4) iter_widen_pfp its)+ @@ -433,7 +433,7 @@ fixes n :: "'av \ nat" assumes m_widen: "~ y \ x \ m(x \ y) < m x" assumes n_mono: "x \ y \ n x \ n y" -assumes n_narrow: "~ x \ x \ y \ n(x \ y) < n x" +assumes n_narrow: "y \ x \ ~ x \ x \ y \ n(x \ y) < n x" begin @@ -473,9 +473,10 @@ done -definition "n_s S = (\x\dom S. n(fun S x))" +definition n_s :: "'av st \ nat" ("n\<^isub>s") where +"n\<^isub>s S = (\x\dom S. n(fun S x))" -lemma n_s_mono: assumes "S1 \ S2" shows "n_s S1 \ n_s S2" +lemma n_s_mono: assumes "S1 \ S2" shows "n\<^isub>s S1 \ n\<^isub>s S2" proof- from assms have [simp]: "dom S1 = dom S2" "\x\dom S1. fun S1 x \ fun S2 x" by(simp_all add: le_st_def) @@ -486,14 +487,14 @@ lemma n_s_narrow: assumes "finite(dom S1)" and "S2 \ S1" "\ S1 \ S1 \ S2" -shows "n_s (S1 \ S2) < n_s S1" +shows "n\<^isub>s (S1 \ S2) < n\<^isub>s S1" proof- from `S2\S1` have [simp]: "dom S1 = dom S2" "\x\dom S1. fun S2 x \ fun S1 x" by(simp_all add: le_st_def) have 1: "\x\dom S1. n(fun (S1 \ S2) x) \ n(fun S1 x)" by(auto simp: le_st_def narrow_st_def n_mono WN_class.narrow2) have 2: "\x\dom S1. n(fun (S1 \ S2) x) < n(fun S1 x)" using `\ S1 \ S1 \ S2` - by(auto simp: le_st_def narrow_st_def intro: n_narrow) + by(force simp: le_st_def narrow_st_def intro: n_narrow) have "(\x\dom S1. n(fun (S1 \ S2) x)) < (\x\dom S1. n(fun S1 x))" apply(rule setsum_strict_mono_ex1[OF `finite(dom S1)`]) using 1 2 by blast+ moreover have "dom (S1 \ S2) = dom S1" by(simp add: narrow_st_def) @@ -501,22 +502,25 @@ qed -definition "n_o opt = (case opt of None \ 0 | Some x \ n_s x + 1)" +definition n_o :: "'av st option \ nat" ("n\<^isub>o") where +"n\<^isub>o opt = (case opt of None \ 0 | Some S \ n\<^isub>s S + 1)" -lemma n_o_mono: "S1 \ S2 \ n_o S1 \ n_o S2" +lemma n_o_mono: "S1 \ S2 \ n\<^isub>o S1 \ n\<^isub>o S2" by(induction S1 S2 rule: le_option.induct)(auto simp: n_o_def n_s_mono) lemma n_o_narrow: "S1 \ L X \ S2 \ L X \ finite X - \ S2 \ S1 \ \ S1 \ S1 \ S2 \ n_o (S1 \ S2) < n_o S1" + \ S2 \ S1 \ \ S1 \ S1 \ S2 \ n\<^isub>o (S1 \ S2) < n\<^isub>o S1" apply(induction S1 S2 rule: narrow_option.induct) apply(auto simp: n_o_def L_st_def n_s_narrow) done -definition "n_c C = (let as = annos C in \i=0.. nat" ("n\<^isub>c") where +"n\<^isub>c C = (let as = annos C in \io (as!i))" lemma n_c_narrow: "C1 \ Lc c \ C2 \ Lc c \ - C2 \ C1 \ \ C1 \ C1 \ C2 \ n_c (C1 \ C2) < n_c C1" + C2 \ C1 \ \ C1 \ C1 \ C2 \ n\<^isub>c (C1 \ C2) < n\<^isub>c C1" apply(auto simp: n_c_def Let_def Lc_acom_def narrow_acom_def) apply(subgoal_tac "length(annos C2) = length(annos C1)") prefer 2 apply (simp add: size_annos_same2) @@ -620,7 +624,8 @@ next case goal4 thus ?case by(rule n_ivl_mono) next - case goal5 thus ?case by(rule n_ivl_narrow) + case goal5 from goal5(2) show ?case by(rule n_ivl_narrow) + -- "note that the first assms is unnecessary for intervals" qed