# HG changeset patch # User paulson # Date 1483462129 0 # Node ID 3b33d2fc5fc01a66d96f0d914168f0061bb89e8e # Parent 7e3924224769346df21d06eed2a14884fd0d2a31 A few new lemmas and needed adaptations diff -r 7e3924224769 -r 3b33d2fc5fc0 src/HOL/Analysis/Cauchy_Integral_Theorem.thy --- a/src/HOL/Analysis/Cauchy_Integral_Theorem.thy Mon Jan 02 18:08:04 2017 +0100 +++ b/src/HOL/Analysis/Cauchy_Integral_Theorem.thy Tue Jan 03 16:48:49 2017 +0000 @@ -4601,11 +4601,11 @@ by metis note ee_rule = ee [THEN conjunct2, rule_format] define C where "C = (\t. ball t (ee t / 3)) ` {0..1}" - have "\t \ C. open t" by (simp add: C_def) - moreover have "{0..1} \ \C" - using ee [THEN conjunct1] by (auto simp: C_def dist_norm) - ultimately obtain C' where C': "C' \ C" "finite C'" and C'01: "{0..1} \ \C'" - by (rule compactE [OF compact_interval]) + obtain C' where C': "C' \ C" "finite C'" and C'01: "{0..1} \ \C'" + proof (rule compactE [OF compact_interval]) + show "{0..1} \ \C" + using ee [THEN conjunct1] by (auto simp: C_def dist_norm) + qed (use C_def in auto) define kk where "kk = {t \ {0..1}. ball t (ee t / 3) \ C'}" have kk01: "kk \ {0..1}" by (auto simp: kk_def) define e where "e = Min (ee ` kk)" diff -r 7e3924224769 -r 3b33d2fc5fc0 src/HOL/Analysis/Ordered_Euclidean_Space.thy --- a/src/HOL/Analysis/Ordered_Euclidean_Space.thy Mon Jan 02 18:08:04 2017 +0100 +++ b/src/HOL/Analysis/Ordered_Euclidean_Space.thy Tue Jan 03 16:48:49 2017 +0000 @@ -197,13 +197,13 @@ shows "closed {a..}" by (simp add: eucl_le_atLeast[symmetric]) -lemma bounded_closed_interval: +lemma bounded_closed_interval [simp]: fixes a :: "'a::ordered_euclidean_space" shows "bounded {a .. b}" using bounded_cbox[of a b] by (metis interval_cbox) -lemma convex_closed_interval: +lemma convex_closed_interval [simp]: fixes a :: "'a::ordered_euclidean_space" shows "convex {a .. b}" using convex_box[of a b] @@ -214,11 +214,11 @@ using image_smult_cbox[of m a b] by (simp add: cbox_interval) -lemma is_interval_closed_interval: +lemma is_interval_closed_interval [simp]: "is_interval {a .. (b::'a::ordered_euclidean_space)}" by (metis cbox_interval is_interval_cbox) -lemma compact_interval: +lemma compact_interval [simp]: fixes a b::"'a::ordered_euclidean_space" shows "compact {a .. b}" by (metis compact_cbox interval_cbox) diff -r 7e3924224769 -r 3b33d2fc5fc0 src/HOL/Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Analysis/Topology_Euclidean_Space.thy Mon Jan 02 18:08:04 2017 +0100 +++ b/src/HOL/Analysis/Topology_Euclidean_Space.thy Tue Jan 03 16:48:49 2017 +0000 @@ -794,28 +794,28 @@ by (simp add: subtopology_superset) lemma openin_subtopology_empty: - "openin (subtopology U {}) s \ s = {}" + "openin (subtopology U {}) S \ S = {}" by (metis Int_empty_right openin_empty openin_subtopology) lemma closedin_subtopology_empty: - "closedin (subtopology U {}) s \ s = {}" + "closedin (subtopology U {}) S \ S = {}" by (metis Int_empty_right closedin_empty closedin_subtopology) -lemma closedin_subtopology_refl: - "closedin (subtopology U u) u \ u \ topspace U" +lemma closedin_subtopology_refl [simp]: + "closedin (subtopology U X) X \ X \ topspace U" by (metis closedin_def closedin_topspace inf.absorb_iff2 le_inf_iff topspace_subtopology) lemma openin_imp_subset: - "openin (subtopology U s) t \ t \ s" + "openin (subtopology U S) T \ T \ S" by (metis Int_iff openin_subtopology subsetI) lemma closedin_imp_subset: - "closedin (subtopology U s) t \ t \ s" + "closedin (subtopology U S) T \ T \ S" by (simp add: closedin_def topspace_subtopology) lemma openin_subtopology_Un: - "openin (subtopology U t) s \ openin (subtopology U u) s - \ openin (subtopology U (t \ u)) s" + "openin (subtopology U T) S \ openin (subtopology U u) S + \ openin (subtopology U (T \ u)) S" by (simp add: openin_subtopology) blast @@ -1061,6 +1061,9 @@ lemma sphere_cball [simp,intro]: "sphere z r \ cball z r" by force +lemma cball_diff_sphere: "cball a r - sphere a r = ball a r" + by auto + lemma subset_ball[intro]: "d \ e \ ball x d \ ball x e" by (simp add: subset_eq) @@ -1073,6 +1076,12 @@ lemma ball_min_Int: "ball a (min r s) = ball a r \ ball a s" by (simp add: set_eq_iff) +lemma cball_max_Un: "cball a (max r s) = cball a r \ cball a s" + by (simp add: set_eq_iff) arith + +lemma cball_min_Int: "cball a (min r s) = cball a r \ cball a s" + by (simp add: set_eq_iff) + lemma cball_diff_eq_sphere: "cball a r - ball a r = {x. dist x a = r}" by (auto simp: cball_def ball_def dist_commute) @@ -2463,6 +2472,54 @@ apply (simp add: connected_component_maximal connected_component_mono subset_antisym) using connected_component_eq_empty by blast +proposition connected_Times: + assumes S: "connected S" and T: "connected T" + shows "connected (S \ T)" +proof (clarsimp simp add: connected_iff_connected_component) + fix x y x' y' + assume xy: "x \ S" "y \ T" "x' \ S" "y' \ T" + with xy obtain U V where U: "connected U" "U \ S" "x \ U" "x' \ U" + and V: "connected V" "V \ T" "y \ V" "y' \ V" + using S T \x \ S\ \x' \ S\ by blast+ + show "connected_component (S \ T) (x, y) (x', y')" + unfolding connected_component_def + proof (intro exI conjI) + show "connected ((\x. (x, y)) ` U \ Pair x' ` V)" + proof (rule connected_Un) + have "continuous_on U (\x. (x, y))" + by (intro continuous_intros) + then show "connected ((\x. (x, y)) ` U)" + by (rule connected_continuous_image) (rule \connected U\) + have "continuous_on V (Pair x')" + by (intro continuous_intros) + then show "connected (Pair x' ` V)" + by (rule connected_continuous_image) (rule \connected V\) + qed (use U V in auto) + qed (use U V in auto) +qed + +corollary connected_Times_eq [simp]: + "connected (S \ T) \ S = {} \ T = {} \ connected S \ connected T" (is "?lhs = ?rhs") +proof + assume L: ?lhs + show ?rhs + proof (cases "S = {} \ T = {}") + case True + then show ?thesis by auto + next + case False + have "connected (fst ` (S \ T))" "connected (snd ` (S \ T))" + using continuous_on_fst continuous_on_snd continuous_on_id + by (blast intro: connected_continuous_image [OF _ L])+ + with False show ?thesis + by auto + qed +next + assume ?rhs + then show ?lhs + by (auto simp: connected_Times) +qed + subsection \The set of connected components of a set\ @@ -7240,7 +7297,7 @@ then have "\c\{T. open T \ S \ T \ C}. open c" and "S \ \{T. open T \ S \ T \ C}" unfolding openin_open by force+ with \compact S\ obtain D where "D \ {T. open T \ S \ T \ C}" and "finite D" and "S \ \D" - by (rule compactE) + by (meson compactE) then have "image (\T. S \ T) D \ C \ finite (image (\T. S \ T) D) \ S \ \(image (\T. S \ T) D)" by auto then show "\D\C. finite D \ S \ \D" .. @@ -10189,7 +10246,7 @@ by metis from * have "\t\Y ` K. open t" "K \ \(Y ` K)" by auto with \compact K\ obtain CC where CC: "CC \ Y ` K" "finite CC" "K \ \CC" - by (rule compactE) + by (meson compactE) then obtain c where c: "\C. C \ CC \ c C \ K \ C = Y (c C)" by (force intro!: choice) with * CC show ?thesis diff -r 7e3924224769 -r 3b33d2fc5fc0 src/HOL/Int.thy --- a/src/HOL/Int.thy Mon Jan 02 18:08:04 2017 +0100 +++ b/src/HOL/Int.thy Tue Jan 03 16:48:49 2017 +0000 @@ -832,6 +832,10 @@ end +lemma (in linordered_idom) Ints_abs [simp]: + shows "a \ \ \ abs a \ \" + by (auto simp: abs_if) + lemma (in linordered_idom) Nats_altdef2: "\ = {n \ \. n \ 0}" proof (intro subsetI equalityI) fix x :: 'a @@ -968,6 +972,24 @@ for z :: int by arith +lemma Ints_nonzero_abs_ge1: + fixes x:: "'a :: linordered_idom" + assumes "x \ Ints" "x \ 0" + shows "1 \ abs x" +proof (rule Ints_cases [OF \x \ Ints\]) + fix z::int + assume "x = of_int z" + with \x \ 0\ + show "1 \ \x\" + apply (auto simp add: abs_if) + by (metis diff_0 of_int_1 of_int_le_iff of_int_minus zle_diff1_eq) +qed + +lemma Ints_nonzero_abs_less1: + fixes x:: "'a :: linordered_idom" + shows "\x \ Ints; abs x < 1\ \ x = 0" + using Ints_nonzero_abs_ge1 [of x] by auto + subsection \The functions @{term nat} and @{term int}\ diff -r 7e3924224769 -r 3b33d2fc5fc0 src/HOL/Orderings.thy --- a/src/HOL/Orderings.thy Mon Jan 02 18:08:04 2017 +0100 +++ b/src/HOL/Orderings.thy Tue Jan 03 16:48:49 2017 +0000 @@ -405,6 +405,10 @@ lemma not_le_imp_less: "\ y \ x \ x < y" unfolding not_le . +lemma linorder_less_wlog[case_names less refl sym]: + "\\a b. a < b \ P a b; \a. P a a; \a b. P b a \ P a b\ \ P a b" + using antisym_conv3 by blast + text \Dual order\ lemma dual_linorder: diff -r 7e3924224769 -r 3b33d2fc5fc0 src/HOL/Rat.thy --- a/src/HOL/Rat.thy Mon Jan 02 18:08:04 2017 +0100 +++ b/src/HOL/Rat.thy Tue Jan 03 16:48:49 2017 +0000 @@ -824,9 +824,15 @@ lemma Rats_of_int [simp]: "of_int z \ \" by (subst of_rat_of_int_eq [symmetric]) (rule Rats_of_rat) +lemma Ints_subset_Rats: "\ \ \" + using Ints_cases Rats_of_int by blast + lemma Rats_of_nat [simp]: "of_nat n \ \" by (subst of_rat_of_nat_eq [symmetric]) (rule Rats_of_rat) +lemma Nats_subset_Rats: "\ \ \" + using Ints_subset_Rats Nats_subset_Ints by blast + lemma Rats_number_of [simp]: "numeral w \ \" by (subst of_rat_numeral_eq [symmetric]) (rule Rats_of_rat) diff -r 7e3924224769 -r 3b33d2fc5fc0 src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Mon Jan 02 18:08:04 2017 +0100 +++ b/src/HOL/Topological_Spaces.thy Tue Jan 03 16:48:49 2017 +0000 @@ -1547,6 +1547,18 @@ lemma tendsto_compose_filtermap: "((g \ f) \ T) F \ (g \ T) (filtermap f F)" by (simp add: filterlim_def filtermap_filtermap comp_def) +lemma tendsto_compose_at: + assumes f: "(f \ y) F" and g: "(g \ z) (at y)" and fg: "eventually (\w. f w = y \ g y = z) F" + shows "((g \ f) \ z) F" +proof - + have "(\\<^sub>F a in F. f a \ y) \ g y = z" + using fg by force + moreover have "(g \ z) (filtermap f F) \ \ (\\<^sub>F a in F. f a \ y)" + by (metis (no_types) filterlim_atI filterlim_def tendsto_mono f g) + ultimately show ?thesis + by (metis (no_types) f filterlim_compose filterlim_filtermap g tendsto_at_iff_tendsto_nhds tendsto_compose_filtermap) +qed + subsubsection \Relation of \LIM\ and \LIMSEQ\\ @@ -2087,12 +2099,10 @@ lemma compact_empty[simp]: "compact {}" by (auto intro!: compactI) -lemma compactE: - assumes "compact s" - and "\t\C. open t" - and "s \ \C" - obtains C' where "C' \ C" and "finite C'" and "s \ \C'" - using assms unfolding compact_eq_heine_borel by metis +lemma compactE: (*related to COMPACT_IMP_HEINE_BOREL in HOL Light*) + assumes "compact S" "S \ \\" "\B. B \ \ \ open B" + obtains \' where "\' \ \" "finite \'" "S \ \\'" + by (meson assms compact_eq_heine_borel) lemma compactE_image: assumes "compact s" @@ -2197,9 +2207,7 @@ fix y assume "y \ - s" let ?C = "\x\s. {u. open u \ x \ u \ eventually (\y. y \ u) (nhds y)}" - note \compact s\ - moreover have "\u\?C. open u" by simp - moreover have "s \ \?C" + have "s \ \?C" proof fix x assume "x \ s" @@ -2209,8 +2217,8 @@ with \x \ s\ show "x \ \?C" unfolding eventually_nhds by auto qed - ultimately obtain D where "D \ ?C" and "finite D" and "s \ \D" - by (rule compactE) + then obtain D where "D \ ?C" and "finite D" and "s \ \D" + by (rule compactE [OF \compact s\]) auto from \D \ ?C\ have "\x\D. eventually (\y. y \ x) (nhds y)" by auto with \finite D\ have "eventually (\y. y \ \D) (nhds y)" diff -r 7e3924224769 -r 3b33d2fc5fc0 src/HOL/Transcendental.thy --- a/src/HOL/Transcendental.thy Mon Jan 02 18:08:04 2017 +0100 +++ b/src/HOL/Transcendental.thy Tue Jan 03 16:48:49 2017 +0000 @@ -2370,6 +2370,53 @@ qed (rule exp_at_top) qed +subsubsection\ A couple of simple bounds\ + +lemma exp_plus_inverse_exp: + fixes x::real + shows "2 \ exp x + inverse (exp x)" +proof - + have "2 \ exp x + exp (-x)" + using exp_ge_add_one_self [of x] exp_ge_add_one_self [of "-x"] + by linarith + then show ?thesis + by (simp add: exp_minus) +qed + +lemma real_le_x_sinh: + fixes x::real + assumes "0 \ x" + shows "x \ (exp x - inverse(exp x)) / 2" +proof - + have *: "exp a - inverse(exp a) - 2*a \ exp b - inverse(exp b) - 2*b" if "a \ b" for a b::real + apply (rule DERIV_nonneg_imp_nondecreasing [OF that]) + using exp_plus_inverse_exp + apply (intro exI allI impI conjI derivative_eq_intros | force)+ + done + show ?thesis + using*[OF assms] by simp +qed + +lemma real_le_abs_sinh: + fixes x::real + shows "abs x \ abs((exp x - inverse(exp x)) / 2)" +proof (cases "0 \ x") + case True + show ?thesis + using real_le_x_sinh [OF True] True by (simp add: abs_if) +next + case False + have "-x \ (exp(-x) - inverse(exp(-x))) / 2" + by (meson False linear neg_le_0_iff_le real_le_x_sinh) + also have "... \ \(exp x - inverse (exp x)) / 2\" + by (metis (no_types, hide_lams) abs_divide abs_le_iff abs_minus_cancel + add.inverse_inverse exp_minus minus_diff_eq order_refl) + finally show ?thesis + using False by linarith +qed + +subsection\The general logarithm\ + definition log :: "real \ real \ real" \ \logarithm of @{term x} to base @{term a}\ where "log a x = ln x / ln a"