# HG changeset patch # User paulson # Date 1497543743 -3600 # Node ID def95e0bc529e3c1693bc398eafe33e3ce4dfe60 # Parent c9c9438cfc0f5bf1498e0ae4fec183ec1191bfd3 Some new material. SIMPRULE STATUS for sum/prod.delta rules! diff -r c9c9438cfc0f -r def95e0bc529 src/HOL/Analysis/Bounded_Linear_Function.thy --- a/src/HOL/Analysis/Bounded_Linear_Function.thy Thu Jun 15 11:11:36 2017 +0200 +++ b/src/HOL/Analysis/Bounded_Linear_Function.thy Thu Jun 15 17:22:23 2017 +0100 @@ -387,7 +387,7 @@ have "(\j\Basis. \i\Basis. (x \ i * (f i \ j)) *\<^sub>R j) \ b = (\j\Basis. if j = b then (\i\Basis. (x \ i * (f i \ j))) else 0)" using b - by (auto simp add: algebra_simps inner_sum_left inner_Basis split: if_split intro!: sum.cong) + by (simp add: inner_sum_left inner_Basis if_distrib cong: if_cong) (simp add: sum.commute) also have "\ = (\i\Basis. (x \ i * (f i \ b)))" using b by (simp add: sum.delta) also have "\ = f x \ b" diff -r c9c9438cfc0f -r def95e0bc529 src/HOL/Analysis/Complex_Analysis_Basics.thy --- a/src/HOL/Analysis/Complex_Analysis_Basics.thy Thu Jun 15 11:11:36 2017 +0200 +++ b/src/HOL/Analysis/Complex_Analysis_Basics.thy Thu Jun 15 17:22:23 2017 +0100 @@ -919,7 +919,6 @@ apply (auto simp: bounded_linear_mult_right) done -(*Used only once, in Multivariate/cauchy.ml. *) lemma has_complex_derivative_inverse_strong: fixes f :: "complex \ complex" shows "DERIV f x :> f' \ diff -r c9c9438cfc0f -r def95e0bc529 src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Thu Jun 15 11:11:36 2017 +0200 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Thu Jun 15 17:22:23 2017 +0100 @@ -55,7 +55,7 @@ lemma content_unit[iff]: "content (cbox 0 (One::'a::euclidean_space)) = 1" by simp -lemma content_pos_le[intro]: "0 \ content (cbox a b)" +lemma content_pos_le [iff]: "0 \ content X" by simp corollary content_nonneg [simp]: "~ content (cbox a b) < 0" @@ -157,20 +157,18 @@ lemma sum_content_null: assumes "content (cbox a b) = 0" and "p tagged_division_of (cbox a b)" - shows "sum (\(x,k). content k *\<^sub>R f x) p = (0::'a::real_normed_vector)" + shows "(\(x,k)\p. content k *\<^sub>R f x) = (0::'a::real_normed_vector)" proof (rule sum.neutral, rule) fix y assume y: "y \ p" obtain x k where xk: "y = (x, k)" using surj_pair[of y] by blast - note assm = tagged_division_ofD(3-4)[OF assms(2) y[unfolded xk]] - from this(2) obtain c d where k: "k = cbox c d" by blast + then obtain c d where k: "k = cbox c d" "k \ cbox a b" + by (metis assms(2) tagged_division_ofD(3) tagged_division_ofD(4) y) have "(\(x, k). content k *\<^sub>R f x) y = content k *\<^sub>R f x" unfolding xk by auto also have "\ = 0" - using content_subset[OF assm(1)[unfolded k]] content_pos_le[of c d] - unfolding assms(1) k - by auto + using assms(1) content_0_subset k(2) by auto finally show "(\(x, k). content k *\<^sub>R f x) y = 0" . qed @@ -446,6 +444,11 @@ "(f has_integral y) s \ ((\x. f x *\<^sub>R c) has_integral (y *\<^sub>R c)) s" using has_integral_linear[OF _ bounded_linear_scaleR_left] by (simp add: comp_def) +lemma integrable_on_scaleR_left: + assumes "f integrable_on A" + shows "(\x. f x *\<^sub>R y) integrable_on A" + using assms has_integral_scaleR_left unfolding integrable_on_def by blast + lemma has_integral_mult_left: fixes c :: "_ :: real_normed_algebra" shows "(f has_integral y) s \ ((\x. f x * c) has_integral (y * c)) s" @@ -670,12 +673,8 @@ by (auto intro: has_integral_sum integrable_integral) lemma integrable_sum: - "\finite t; \a\t. (f a) integrable_on s\ \ (\x. sum (\a. f a x) t) integrable_on s" - unfolding integrable_on_def - apply (drule bchoice) - using has_integral_sum[of t] - apply auto - done + "\finite I; \a. a \ I \ f a integrable_on S\ \ (\x. \a\I. f a x) integrable_on S" + unfolding integrable_on_def using has_integral_sum[of I] by metis lemma has_integral_eq: assumes "\x. x \ s \ f x = g x" @@ -5493,32 +5492,10 @@ apply (rule_tac[!] sum_nonneg) apply safe unfolding real_scaleR_def right_diff_distrib[symmetric] - apply (rule_tac[!] mult_nonneg_nonneg) - proof - - fix a b - assume ab: "(a, b) \ p1" - show "0 \ content b" - using *(3)[OF ab] - apply safe - apply (rule content_pos_le) + apply (rule_tac[!] mult_nonneg_nonneg) + apply simp_all + using obt(4) prems(1) prems(4) apply (blast intro: elim: dest!: bspec)+ done - then show "0 \ content b" . - show "0 \ f a - g a" "0 \ h a - f a" - using *(1-2)[OF ab] - using obt(4)[rule_format,of a] - by auto - next - fix a b - assume ab: "(a, b) \ p2" - show "0 \ content b" - using *(6)[OF ab] - apply safe - apply (rule content_pos_le) - done - then show "0 \ content b" . - show "0 \ f a - g a" and "0 \ h a - f a" - using *(4-5)[OF ab] using obt(4)[rule_format,of a] by auto - qed then show ?case apply - unfolding real_norm_def @@ -6317,7 +6294,7 @@ proof (rule, goal_cases) case prems: (1 x) have "e / (4 * content (cbox a b)) > 0" - using \e>0\ False content_pos_le[of a b] by (simp add: less_le) + by (simp add: False content_lt_nz e) from assms(3)[rule_format, OF prems, THEN LIMSEQ_D, OF this] guess n .. note n=this then show ?case @@ -7094,9 +7071,10 @@ also have "\ = content (cbox a b) * e * norm (x - x0)" by simp also have "\ < e' * norm (x - x0)" - using \e' > 0\ content_pos_le[of a b] - by (intro mult_strict_right_mono[OF _ \0 < norm (x - x0)\]) - (auto simp: divide_simps e_def simp del: measure_nonneg) + using \e' > 0\ + apply (intro mult_strict_right_mono[OF _ \0 < norm (x - x0)\]) + apply (auto simp: divide_simps e_def) + by (metis \0 < e\ e_def order.asym zero_less_divide_iff) finally have "norm (?F x - ?F x0 - ?dF (x - x0)) < e' * norm (x - x0)" . then show ?case by (auto simp: divide_simps) @@ -7207,8 +7185,7 @@ define e' where "e' = e / 2" with \e > 0\ have "e' > 0" by simp then have "\\<^sub>F n in F. \x\cbox a b. norm (f n x - g x) < e' / content (cbox a b)" - using u content_nonzero content_pos_le[of a b] - by (auto simp: uniform_limit_iff dist_norm simp del: measure_nonneg) + using u content_nonzero by (auto simp: uniform_limit_iff dist_norm zero_less_measure_iff) then show "\\<^sub>F n in F. dist (I n) J < e" proof eventually_elim case (elim n) diff -r c9c9438cfc0f -r def95e0bc529 src/HOL/Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Analysis/Topology_Euclidean_Space.thy Thu Jun 15 11:11:36 2017 +0200 +++ b/src/HOL/Analysis/Topology_Euclidean_Space.thy Thu Jun 15 17:22:23 2017 +0100 @@ -1665,8 +1665,8 @@ definition "is_interval (s::('a::euclidean_space) set) \ (\a\s. \b\s. \x. (\i\Basis. ((a\i \ x\i \ x\i \ b\i) \ (b\i \ x\i \ x\i \ a\i))) \ x \ s)" -lemma is_interval_cbox: "is_interval (cbox a (b::'a::euclidean_space))" (is ?th1) - and is_interval_box: "is_interval (box a b)" (is ?th2) +lemma is_interval_cbox [simp]: "is_interval (cbox a (b::'a::euclidean_space))" (is ?th1) + and is_interval_box [simp]: "is_interval (box a b)" (is ?th2) unfolding is_interval_def mem_box Ball_def atLeastAtMost_iff by (meson order_trans le_less_trans less_le_trans less_trans)+ @@ -1726,12 +1726,28 @@ by (simp add: box_ne_empty inner_Basis inner_sum_left sum_nonneg) lemma box01_nonempty [simp]: "box 0 One \ {}" - by (simp add: box_ne_empty inner_Basis inner_sum_left) (simp add: sum.remove) + by (simp add: box_ne_empty inner_Basis inner_sum_left) lemma empty_as_interval: "{} = cbox One (0::'a::euclidean_space)" using nonempty_Basis box01_nonempty box_eq_empty(1) box_ne_empty(1) by blast - +lemma interval_subset_is_interval: + assumes "is_interval S" + shows "cbox a b \ S \ cbox a b = {} \ a \ S \ b \ S" (is "?lhs = ?rhs") +proof + assume ?lhs + then show ?rhs using box_ne_empty(1) mem_box(2) by fastforce +next + assume ?rhs + have "cbox a b \ S" if "a \ S" "b \ S" + using assms unfolding is_interval_def + apply (clarsimp simp add: mem_box) + using that by blast + with \?rhs\ show ?lhs + by blast +qed + + subsection \Connectedness\ lemma connected_local: @@ -5641,35 +5657,6 @@ qed qed (metis compact_imp_complete compact_imp_seq_compact seq_compact_imp_totally_bounded) -lemma cauchy: "Cauchy s \ (\e>0.\ N::nat. \n\N. dist(s n)(s N) < e)" (is "?lhs = ?rhs") -proof - - { - assume ?rhs - { - fix e::real - assume "e>0" - with \?rhs\ obtain N where N:"\n\N. dist (s n) (s N) < e/2" - by (erule_tac x="e/2" in allE) auto - { - fix n m - assume nm:"N \ m \ N \ n" - then have "dist (s m) (s n) < e" using N - using dist_triangle_half_l[of "s m" "s N" "e" "s n"] - by blast - } - then have "\N. \m n. N \ m \ N \ n \ dist (s m) (s n) < e" - by blast - } - then have ?lhs - unfolding cauchy_def - by blast - } - then show ?thesis - unfolding cauchy_def - using dist_triangle_half_l - by blast -qed - lemma cauchy_imp_bounded: assumes "Cauchy s" shows "bounded (range s)" @@ -6978,6 +6965,11 @@ ultimately show ?thesis .. qed +lemma bounded_uniformly_continuous_image: + fixes f :: "'a :: heine_borel \ 'b :: heine_borel" + assumes "uniformly_continuous_on S f" "bounded S" + shows "bounded(image f S)" + by (metis (no_types, lifting) assms bounded_closure_image compact_closure compact_continuous_image compact_eq_bounded_closed image_cong uniformly_continuous_imp_continuous uniformly_continuous_on_extension_on_closure) subsection\Quotient maps\ @@ -9521,7 +9513,7 @@ have "\N. \n\N. norm (x n - x N) < d" if "d > 0" for d :: real proof - from that obtain N where N: "\n\N. norm (f (x n) - f (x N)) < e * d" - using cf[unfolded cauchy o_def dist_norm, THEN spec[where x="e*d"]] e + using cf[unfolded Cauchy_def o_def dist_norm, THEN spec[where x="e*d"]] e by auto have "norm (x n - x N) < d" if "n \ N" for n proof - @@ -9538,7 +9530,7 @@ then show ?thesis by auto qed then show ?thesis - by (simp add: cauchy dist_norm) + by (simp add: Cauchy_altdef2 dist_norm) qed lemma complete_isometric_image: diff -r c9c9438cfc0f -r def95e0bc529 src/HOL/Computational_Algebra/Formal_Power_Series.thy --- a/src/HOL/Computational_Algebra/Formal_Power_Series.thy Thu Jun 15 11:11:36 2017 +0200 +++ b/src/HOL/Computational_Algebra/Formal_Power_Series.thy Thu Jun 15 17:22:23 2017 +0100 @@ -923,9 +923,7 @@ lemma fps_sum_rep_nth: "(sum (\i. fps_const(a$i)*X^i) {0..m})$n = (if n \ m then a$n else 0::'a::comm_ring_1)" - apply (auto simp add: fps_sum_nth cond_value_iff cong del: if_weak_cong) - apply (simp add: sum.delta') - done + by (auto simp add: fps_sum_nth cond_value_iff cong del: if_weak_cong) lemma fps_notation: "(\n. sum (\i. fps_const(a$i) * X^i) {0..n}) \ a" (is "?s \ a") diff -r c9c9438cfc0f -r def95e0bc529 src/HOL/Groups_Big.thy --- a/src/HOL/Groups_Big.thy Thu Jun 15 11:11:36 2017 +0200 +++ b/src/HOL/Groups_Big.thy Thu Jun 15 17:22:23 2017 +0100 @@ -332,7 +332,7 @@ by (intro reindex_bij_betw_not_neutral[OF _ _ bij]) auto qed -lemma delta: +lemma delta [simp]: assumes fS: "finite S" shows "F (\k. if k = a then b k else \<^bold>1) S = (if a \ S then b a else \<^bold>1)" proof - @@ -355,7 +355,7 @@ qed qed -lemma delta': +lemma delta' [simp]: assumes fin: "finite S" shows "F (\k. if a = k then b k else \<^bold>1) S = (if a \ S then b a else \<^bold>1)" using delta [OF fin, of a b, symmetric] by (auto intro: cong) diff -r c9c9438cfc0f -r def95e0bc529 src/HOL/Probability/Fin_Map.thy --- a/src/HOL/Probability/Fin_Map.thy Thu Jun 15 11:11:36 2017 +0200 +++ b/src/HOL/Probability/Fin_Map.thy Thu Jun 15 17:22:23 2017 +0100 @@ -474,7 +474,7 @@ fix P::"nat \ 'a \\<^sub>F 'b" assume "Cauchy P" then obtain Nd where Nd: "\n. n \ Nd \ dist (P n) (P Nd) < 1" - by (force simp: cauchy) + by (force simp: Cauchy_altdef2) define d where "d = domain (P Nd)" with Nd have dim: "\n. n \ Nd \ domain (P n) = d" using dist_le_1_imp_domain_eq by auto have [simp]: "finite d" unfolding d_def by simp @@ -484,11 +484,11 @@ have q: "\i. i \ d \ q i = Q i" by (auto simp add: Q_def Abs_fmap_inverse) { fix i assume "i \ d" - have "Cauchy (p i)" unfolding cauchy p_def + have "Cauchy (p i)" unfolding Cauchy_altdef2 p_def proof safe fix e::real assume "0 < e" with \Cauchy P\ obtain N where N: "\n. n\N \ dist (P n) (P N) < min e 1" - by (force simp: cauchy min_def) + by (force simp: Cauchy_altdef2 min_def) hence "\n. n \ N \ domain (P n) = domain (P N)" using dist_le_1_imp_domain_eq by auto with dim have dim: "\n. n \ N \ domain (P n) = d" by (metis nat_le_linear) show "\N. \n\N. dist ((P n) i) ((P N) i) < e" diff -r c9c9438cfc0f -r def95e0bc529 src/HOL/Probability/Probability_Mass_Function.thy --- a/src/HOL/Probability/Probability_Mass_Function.thy Thu Jun 15 11:11:36 2017 +0200 +++ b/src/HOL/Probability/Probability_Mass_Function.thy Thu Jun 15 17:22:23 2017 +0100 @@ -2111,7 +2111,7 @@ by (rule sum.commute) also have "\ = (\xa = 0.. A then (\x\set (map fst xs). if x = fst (xs ! xa) then snd (xs ! xa) else 0) else 0)" - by (auto intro!: sum.cong sum.neutral) + by (auto intro!: sum.cong sum.neutral simp del: sum.delta) also have "\ = (\xa = 0.. A then snd (xs ! xa) else 0)" by (intro sum.cong refl) (simp_all add: sum.delta) also have "\ = sum_list (map snd (filter (\x. fst x \ A) xs))" diff -r c9c9438cfc0f -r def95e0bc529 src/HOL/Real_Vector_Spaces.thy --- a/src/HOL/Real_Vector_Spaces.thy Thu Jun 15 11:11:36 2017 +0200 +++ b/src/HOL/Real_Vector_Spaces.thy Thu Jun 15 17:22:23 2017 +0100 @@ -1949,6 +1949,33 @@ qed qed +lemma (in metric_space) Cauchy_altdef2: "Cauchy s \ (\e>0. \N::nat. \n\N. dist(s n)(s N) < e)" (is "?lhs = ?rhs") +proof + assume "Cauchy s" + then show ?rhs by (force simp add: Cauchy_def) +next + assume ?rhs + { + fix e::real + assume "e>0" + with \?rhs\ obtain N where N: "\n\N. dist (s n) (s N) < e/2" + by (erule_tac x="e/2" in allE) auto + { + fix n m + assume nm: "N \ m \ N \ n" + then have "dist (s m) (s n) < e" using N + using dist_triangle_half_l[of "s m" "s N" "e" "s n"] + by blast + } + then have "\N. \m n. N \ m \ N \ n \ dist (s m) (s n) < e" + by blast + } + then have ?lhs + unfolding Cauchy_def by blast + then show ?lhs + by blast +qed + lemma (in metric_space) metric_CauchyI: "(\e. 0 < e \ \M. \m\M. \n\M. dist (X m) (X n) < e) \ Cauchy X" by (simp add: Cauchy_def)