--- a/src/HOL/Analysis/Affine.thy Sat Dec 31 11:09:19 2022 +0000
+++ b/src/HOL/Analysis/Affine.thy Sun Jan 01 00:45:55 2023 +0000
@@ -51,7 +51,7 @@
using dim_unique[of B B "card B"] assms span_superset[of B] by auto
have "dim B \<le> card (Basis :: 'a set)"
using dim_subset_UNIV[of B] by simp
- from ex_card[OF this] obtain d :: "'a set" where d: "d \<subseteq> Basis" and t: "card d = dim B"
+ from obtain_subset_with_card_n[OF this] obtain d :: "'a set" where d: "d \<subseteq> Basis" and t: "card d = dim B"
by auto
let ?t = "{x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}"
have "\<exists>f. linear f \<and> f ` B = d \<and> f ` span B = ?t \<and> inj_on f (span B)"
--- a/src/HOL/Analysis/Determinants.thy Sat Dec 31 11:09:19 2022 +0000
+++ b/src/HOL/Analysis/Determinants.thy Sun Jan 01 00:45:55 2023 +0000
@@ -1025,7 +1025,7 @@
then show ?thesis
using \<open>A *v axis k 1 = a\<close> that by auto
next
- from ex_card[OF 2] obtain h i::'n where "h \<noteq> i"
+ from obtain_subset_with_card_n[OF 2] obtain h i::'n where "h \<noteq> i"
by (auto simp add: eval_nat_numeral card_Suc_eq)
then obtain j where "j \<noteq> k"
by (metis (full_types))
--- a/src/HOL/Analysis/Linear_Algebra.thy Sat Dec 31 11:09:19 2022 +0000
+++ b/src/HOL/Analysis/Linear_Algebra.thy Sun Jan 01 00:45:55 2023 +0000
@@ -68,38 +68,17 @@
fixes a :: "'a::ab_group_add"
assumes "(\<lambda>x. a + x) ` A = (\<lambda>x. a + x) ` B"
shows "A = B"
-proof -
- have "(\<lambda>x. -a + x) ` ((\<lambda>x. a + x) ` A) = (\<lambda>x. - a + x) ` ((\<lambda>x. a + x) ` B)"
- using assms by auto
- then show ?thesis
- using translation_assoc[of "-a" a A] translation_assoc[of "-a" a B] by auto
-qed
+ using assms translation_assoc by fastforce
lemma translation_galois:
fixes a :: "'a::ab_group_add"
shows "T = ((\<lambda>x. a + x) ` S) \<longleftrightarrow> S = ((\<lambda>x. (- a) + x) ` T)"
- using translation_assoc[of "-a" a S]
- apply auto
- using translation_assoc[of a "-a" T]
- apply auto
- done
+ by (metis add.right_inverse group_cancel.rule0 translation_invert translation_assoc)
lemma translation_inverse_subset:
assumes "((\<lambda>x. - a + x) ` V) \<le> (S :: 'n::ab_group_add set)"
shows "V \<le> ((\<lambda>x. a + x) ` S)"
-proof -
- {
- fix x
- assume "x \<in> V"
- then have "x-a \<in> S" using assms by auto
- then have "x \<in> {a + v |v. v \<in> S}"
- apply auto
- apply (rule exI[of _ "x-a"], simp)
- done
- then have "x \<in> ((\<lambda>x. a+x) ` S)" by auto
- }
- then show ?thesis by auto
-qed
+ by (metis assms subset_image_iff translation_galois)
subsection\<^marker>\<open>tag unimportant\<close> \<open>More interesting properties of the norm\<close>
@@ -120,41 +99,25 @@
qed
lemma vector_eq: "x = y \<longleftrightarrow> x \<bullet> x = x \<bullet> y \<and> y \<bullet> y = x \<bullet> x"
- (is "?lhs \<longleftrightarrow> ?rhs")
-proof
- assume ?lhs
- then show ?rhs by simp
-next
- assume ?rhs
- then have "x \<bullet> x - x \<bullet> y = 0 \<and> x \<bullet> y - y \<bullet> y = 0"
- by simp
- then have "x \<bullet> (x - y) = 0 \<and> y \<bullet> (x - y) = 0"
- by (simp add: inner_diff inner_commute)
- then have "(x - y) \<bullet> (x - y) = 0"
- by (simp add: field_simps inner_diff inner_commute)
- then show "x = y" by simp
-qed
+ by (metis (no_types, opaque_lifting) inner_commute inner_diff_right inner_eq_zero_iff right_minus_eq)
lemma norm_triangle_half_r:
- "norm (y - x1) < e / 2 \<Longrightarrow> norm (y - x2) < e / 2 \<Longrightarrow> norm (x1 - x2) < e"
+ "norm (y - x1) < e/2 \<Longrightarrow> norm (y - x2) < e/2 \<Longrightarrow> norm (x1 - x2) < e"
using dist_triangle_half_r unfolding dist_norm[symmetric] by auto
lemma norm_triangle_half_l:
- assumes "norm (x - y) < e / 2"
- and "norm (x' - y) < e / 2"
+ assumes "norm (x - y) < e/2" and "norm (x' - y) < e/2"
shows "norm (x - x') < e"
- using dist_triangle_half_l[OF assms[unfolded dist_norm[symmetric]]]
- unfolding dist_norm[symmetric] .
+ by (metis assms dist_norm dist_triangle_half_l)
lemma abs_triangle_half_r:
fixes y :: "'a::linordered_field"
- shows "abs (y - x1) < e / 2 \<Longrightarrow> abs (y - x2) < e / 2 \<Longrightarrow> abs (x1 - x2) < e"
+ shows "abs (y - x1) < e/2 \<Longrightarrow> abs (y - x2) < e/2 \<Longrightarrow> abs (x1 - x2) < e"
by linarith
lemma abs_triangle_half_l:
fixes y :: "'a::linordered_field"
- assumes "abs (x - y) < e / 2"
- and "abs (x' - y) < e / 2"
+ assumes "abs (x - y) < e/2" and "abs (x' - y) < e/2"
shows "abs (x - x') < e"
using assms by linarith
@@ -163,41 +126,15 @@
and "finite S \<Longrightarrow> sum f (insert x S) = (if x \<in> S then sum f S else f x + sum f S)"
by (auto simp add: insert_absorb)
-lemma vector_eq_ldot: "(\<forall>x. x \<bullet> y = x \<bullet> z) \<longleftrightarrow> y = z"
-proof
- assume "\<forall>x. x \<bullet> y = x \<bullet> z"
- then have "\<forall>x. x \<bullet> (y - z) = 0"
- by (simp add: inner_diff)
- then have "(y - z) \<bullet> (y - z) = 0" ..
- then show "y = z" by simp
-qed simp
-
-lemma vector_eq_rdot: "(\<forall>z. x \<bullet> z = y \<bullet> z) \<longleftrightarrow> x = y"
-proof
- assume "\<forall>z. x \<bullet> z = y \<bullet> z"
- then have "\<forall>z. (x - y) \<bullet> z = 0"
- by (simp add: inner_diff)
- then have "(x - y) \<bullet> (x - y) = 0" ..
- then show "x = y" by simp
-qed simp
+lemma vector_eq_ldot: "(\<forall>x. x \<bullet> y = x \<bullet> z) \<longleftrightarrow> y = z" and vector_eq_rdot: "(\<forall>z. x \<bullet> z = y \<bullet> z) \<longleftrightarrow> x = y"
+ by (metis inner_commute vector_eq)+
subsection \<open>Substandard Basis\<close>
lemma ex_card:
assumes "n \<le> card A"
shows "\<exists>S\<subseteq>A. card S = n"
-proof (cases "finite A")
- case True
- from ex_bij_betw_nat_finite[OF this] obtain f where f: "bij_betw f {0..<card A} A" ..
- moreover from f \<open>n \<le> card A\<close> have "{..< n} \<subseteq> {..< card A}" "inj_on f {..< n}"
- by (auto simp: bij_betw_def intro: subset_inj_on)
- ultimately have "f ` {..< n} \<subseteq> A" "card (f ` {..< n}) = n"
- by (auto simp: bij_betw_def card_image)
- then show ?thesis by blast
-next
- case False
- with \<open>n \<le> card A\<close> show ?thesis by force
-qed
+ by (meson assms obtain_subset_with_card_n)
lemma subspace_substandard: "subspace {x::'a::euclidean_space. (\<forall>i\<in>Basis. P i \<longrightarrow> x\<bullet>i = 0)}"
by (auto simp: subspace_def inner_add_left)
@@ -271,7 +208,7 @@
lemma norm_add_Pythagorean:
assumes "orthogonal a b"
- shows "norm(a + b) ^ 2 = norm a ^ 2 + norm b ^ 2"
+ shows "(norm (a + b))\<^sup>2 = (norm a)\<^sup>2 + (norm b)\<^sup>2"
proof -
from assms have "(a - (0 - b)) \<bullet> (a - (0 - b)) = a \<bullet> a - (0 - b \<bullet> b)"
by (simp add: algebra_simps orthogonal_def inner_commute)
@@ -300,12 +237,7 @@
lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation:
"orthogonal_transformation f \<longleftrightarrow> linear f \<and> (\<forall>v. norm (f v) = norm v)"
- unfolding orthogonal_transformation_def
- apply auto
- apply (erule_tac x=v in allE)+
- apply (simp add: norm_eq_sqrt_inner)
- apply (simp add: dot_norm linear_add[symmetric])
- done
+ by (smt (verit, ccfv_threshold) dot_norm linear_add norm_eq_sqrt_inner orthogonal_transformation_def)
lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_id [simp]: "orthogonal_transformation (\<lambda>x. x)"
by (simp add: linear_iff orthogonal_transformation_def)
@@ -431,15 +363,8 @@
next
fix h
assume "\<forall>x y. inner (f x) y = inner x (h y)"
- then have "\<forall>x y. inner x (g y) = inner x (h y)"
- using assms by simp
- then have "\<forall>x y. inner x (g y - h y) = 0"
- by (simp add: inner_diff_right)
- then have "\<forall>y. inner (g y - h y) (g y - h y) = 0"
- by simp
- then have "\<forall>y. h y = g y"
- by simp
- then show "h = g" by (simp add: ext)
+ then show "h = g"
+ by (metis assms ext vector_eq_ldot)
qed
text \<open>TODO: The following lemmas about adjoints should hold for any
@@ -524,32 +449,18 @@
proof -
from Basis_le_norm[OF that, of x]
show "norm (?g i) \<le> norm (f i) * norm x"
- unfolding norm_scaleR by (metis mult.commute mult_left_mono norm_ge_zero)
+ unfolding norm_scaleR by (metis mult.commute mult_left_mono norm_ge_zero)
qed
from sum_norm_le[of _ ?g, OF th]
show "norm (f x) \<le> ?B * norm x"
- unfolding th0 sum_distrib_right by metis
+ by (simp add: sum_distrib_right th0)
qed
qed
lemma linear_conv_bounded_linear:
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
shows "linear f \<longleftrightarrow> bounded_linear f"
-proof
- assume "linear f"
- then interpret f: linear f .
- show "bounded_linear f"
- proof
- have "\<exists>B. \<forall>x. norm (f x) \<le> B * norm x"
- using \<open>linear f\<close> by (rule linear_bounded)
- then show "\<exists>K. \<forall>x. norm (f x) \<le> norm x * K"
- by (simp add: mult.commute)
- qed
-next
- assume "bounded_linear f"
- then interpret f: bounded_linear f .
- show "linear f" ..
-qed
+ by (metis mult.commute bounded_linear_axioms.intro bounded_linear_def linear_bounded)
lemmas linear_linear = linear_conv_bounded_linear[symmetric]
@@ -562,17 +473,11 @@
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
assumes lf: "linear f"
obtains B where "B > 0" "\<And>x. norm (f x) \<le> B * norm x"
-proof -
- have "\<exists>B > 0. \<forall>x. norm (f x) \<le> norm x * B"
- using lf unfolding linear_conv_bounded_linear
- by (rule bounded_linear.pos_bounded)
- with that show ?thesis
- by (auto simp: mult.commute)
-qed
+ by (metis bounded_linear.pos_bounded lf linear_linear mult.commute)
lemma linear_invertible_bounded_below_pos:
fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::euclidean_space"
- assumes "linear f" "linear g" "g \<circ> f = id"
+ assumes "linear f" "linear g" and gf: "g \<circ> f = id"
obtains B where "B > 0" "\<And>x. B * norm x \<le> norm(f x)"
proof -
obtain B where "B > 0" and B: "\<And>x. norm (g x) \<le> B * norm x"
@@ -582,13 +487,8 @@
show "0 < 1/B"
by (simp add: \<open>B > 0\<close>)
show "1/B * norm x \<le> norm (f x)" for x
- proof -
- have "1/B * norm x = 1/B * norm (g (f x))"
- using assms by (simp add: pointfree_idE)
- also have "\<dots> \<le> norm (f x)"
- using B [of "f x"] by (simp add: \<open>B > 0\<close> mult.commute pos_divide_le_eq)
- finally show ?thesis .
- qed
+ by (smt (verit, ccfv_SIG) B \<open>0 < B\<close> gf comp_apply divide_inverse id_apply inverse_eq_divide
+ less_divide_eq mult.commute)
qed
qed
@@ -663,15 +563,10 @@
fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector"
assumes bh: "bilinear h"
shows "\<exists>B > 0. \<forall>x y. norm (h x y) \<le> B * norm x * norm y"
-proof -
- have "\<exists>B > 0. \<forall>x y. norm (h x y) \<le> norm x * norm y * B"
- using bh [unfolded bilinear_conv_bounded_bilinear]
- by (rule bounded_bilinear.pos_bounded)
- then show ?thesis
- by (simp only: ac_simps)
-qed
+ by (metis mult.assoc bh bilinear_conv_bounded_bilinear bounded_bilinear.pos_bounded mult.commute)
-lemma bounded_linear_imp_has_derivative: "bounded_linear f \<Longrightarrow> (f has_derivative f) net"
+lemma bounded_linear_imp_has_derivative:
+ "bounded_linear f \<Longrightarrow> (f has_derivative f) net"
by (auto simp add: has_derivative_def linear_diff linear_linear linear_def
dest: bounded_linear.linear)
@@ -723,8 +618,7 @@
assumes "pairwise orthogonal S"
and "\<And>y. y \<in> S \<Longrightarrow> orthogonal x y"
shows "pairwise orthogonal (insert x S)"
- using assms unfolding pairwise_def
- by (auto simp add: orthogonal_commute)
+ using assms by (auto simp: pairwise_def orthogonal_commute)
lemma basis_orthogonal:
fixes B :: "'a::real_inner set"
@@ -735,9 +629,7 @@
proof (induct rule: finite_induct)
case empty
then show ?case
- apply (rule exI[where x="{}"])
- apply (auto simp add: pairwise_def)
- done
+ using pairwise_empty by blast
next
case (insert a B)
note fB = \<open>finite B\<close> and aB = \<open>a \<notin> B\<close>
@@ -748,21 +640,15 @@
let ?C = "insert ?a C"
from C(1) have fC: "finite ?C"
by simp
- from fB aB C(1,2) have cC: "card ?C \<le> card (insert a B)"
- by (simp add: card_insert_if)
+ have cC: "card ?C \<le> card (insert a B)"
+ using C aB card_insert_if local.insert(1) by fastforce
{
fix x k
have th0: "\<And>(a::'a) b c. a - (b - c) = c + (a - b)"
by (simp add: field_simps)
have "x - k *\<^sub>R (a - (\<Sum>x\<in>C. (x \<bullet> a / (x \<bullet> x)) *\<^sub>R x)) \<in> span C \<longleftrightarrow> x - k *\<^sub>R a \<in> span C"
- apply (simp only: scaleR_right_diff_distrib th0)
- apply (rule span_add_eq)
- apply (rule span_scale)
- apply (rule span_sum)
- apply (rule span_scale)
- apply (rule span_base)
- apply assumption
- done
+ unfolding scaleR_right_diff_distrib th0
+ by (intro span_add_eq span_scale span_sum span_base)
}
then have SC: "span ?C = span (insert a B)"
unfolding set_eq_iff span_breakdown_eq C(3)[symmetric] by auto
@@ -773,15 +659,14 @@
by blast
have fth: "finite (C - {y})"
using C by simp
- have "orthogonal ?a y"
+ have "y \<noteq> 0 \<Longrightarrow> \<forall>x\<in>C - {y}. x \<bullet> a * (x \<bullet> y) / (x \<bullet> x) = 0"
+ using \<open>pairwise orthogonal C\<close>
+ by (metis Cy DiffE div_0 insertCI mult_zero_right orthogonal_def pairwise_insert)
+ then have "orthogonal ?a y"
unfolding orthogonal_def
unfolding inner_diff inner_sum_left right_minus_eq
unfolding sum.remove [OF \<open>finite C\<close> \<open>y \<in> C\<close>]
- apply (clarsimp simp add: inner_commute[of y a])
- apply (rule sum.neutral)
- apply clarsimp
- apply (rule C(4)[unfolded pairwise_def orthogonal_def, rule_format])
- using \<open>y \<in> C\<close> by auto
+ by (auto simp add: sum.neutral inner_commute[of y a])
}
with \<open>pairwise orthogonal C\<close> have CPO: "pairwise orthogonal ?C"
by (rule pairwise_orthogonal_insert)
@@ -792,8 +677,7 @@
lemma orthogonal_basis_exists:
fixes V :: "('a::euclidean_space) set"
- shows "\<exists>B. independent B \<and> B \<subseteq> span V \<and> V \<subseteq> span B \<and>
- (card B = dim V) \<and> pairwise orthogonal B"
+ shows "\<exists>B. independent B \<and> B \<subseteq> span V \<and> V \<subseteq> span B \<and> (card B = dim V) \<and> pairwise orthogonal B"
proof -
from basis_exists[of V] obtain B where
B: "B \<subseteq> V" "independent B" "V \<subseteq> span B" "card B = dim V"
@@ -807,18 +691,15 @@
by (metis span_superset span_mono subset_trans)
from span_mono[OF B(3)] C have SVC: "span V \<subseteq> span C"
by (simp add: span_span)
- from card_le_dim_spanning[OF CSV SVC C(1)] C(2,3) fB
- have iC: "independent C"
- by (simp)
from C fB have "card C \<le> dim V"
by simp
moreover have "dim V \<le> card C"
using span_card_ge_dim[OF CSV SVC C(1)]
by simp
- ultimately have CdV: "card C = dim V"
+ ultimately have "card C = dim V"
using C(1) by simp
- from C B CSV CdV iC show ?thesis
- by auto
+ with C B CSV show ?thesis
+ by (metis SVC card_eq_dim dim_span)
qed
text \<open>Low-dimensional subset is in a hyperplane (weak orthogonal complement).\<close>
@@ -831,22 +712,15 @@
from sU obtain a where a: "a \<notin> span S"
by blast
from orthogonal_basis_exists obtain B where
- B: "independent B" "B \<subseteq> span S" "S \<subseteq> span B"
- "card B = dim S" "pairwise orthogonal B"
+ B: "independent B" "B \<subseteq> span S" "S \<subseteq> span B" "card B = dim S" "pairwise orthogonal B"
by blast
from B have fB: "finite B" "card B = dim S"
using independent_bound by auto
- from span_mono[OF B(2)] span_mono[OF B(3)]
have sSB: "span S = span B"
- by (simp add: span_span)
+ by (simp add: B span_eq)
let ?a = "a - sum (\<lambda>b. (a \<bullet> b / (b \<bullet> b)) *\<^sub>R b) B"
have "sum (\<lambda>b. (a \<bullet> b / (b \<bullet> b)) *\<^sub>R b) B \<in> span S"
- unfolding sSB
- apply (rule span_sum)
- apply (rule span_scale)
- apply (rule span_base)
- apply assumption
- done
+ by (simp add: sSB span_base span_mul span_sum)
with a have a0:"?a \<noteq> 0"
by auto
have "?a \<bullet> x = 0" if "x\<in>span B" for x
@@ -861,23 +735,19 @@
by blast
have fth: "finite (B - {x})"
using fB by simp
- have "?a \<bullet> x = 0"
+ have "(\<Sum>b\<in>B - {x}. a \<bullet> b * (b \<bullet> x) / (b \<bullet> b)) = 0" if "x \<noteq> 0"
+ by (smt (verit) B' B(5) DiffD2 divide_eq_0_iff inner_real_def inner_zero_right insertCI orthogonal_def pairwise_insert sum.neutral)
+ then have "?a \<bullet> x = 0"
apply (subst B')
using fB fth
unfolding sum_clauses(2)[OF fth]
- apply simp unfolding inner_simps
- apply (clarsimp simp add: inner_add inner_sum_left)
- apply (rule sum.neutral, rule ballI)
- apply (simp only: inner_commute)
- apply (auto simp add: x field_simps
- intro: B(5)[unfolded pairwise_def orthogonal_def, rule_format])
- done
+ by (auto simp add: inner_add_left inner_diff_left inner_sum_left)
}
then show "?a \<bullet> x = 0" if "x \<in> B" for x
using that by blast
qed
- with a0 show ?thesis
- unfolding sSB by (auto intro: exI[where x="?a"])
+ with a0 sSB show ?thesis
+ by blast
qed
lemma span_not_univ_subset_hyperplane:
@@ -890,19 +760,7 @@
fixes S :: "'a::euclidean_space set"
assumes d: "dim S < DIM('a)"
shows "\<exists>a::'a. a \<noteq> 0 \<and> span S \<subseteq> {x. a \<bullet> x = 0}"
-proof -
- {
- assume "span S = UNIV"
- then have "dim (span S) = dim (UNIV :: ('a) set)"
- by simp
- then have "dim S = DIM('a)"
- by (metis Euclidean_Space.dim_UNIV dim_span)
- with d have False by arith
- }
- then have th: "span S \<noteq> UNIV"
- by blast
- from span_not_univ_subset_hyperplane[OF th] show ?thesis .
-qed
+ using d dim_eq_full nless_le span_not_univ_subset_hyperplane by blast
lemma linear_eq_stdbasis:
fixes f :: "'a::euclidean_space \<Rightarrow> _"
@@ -910,8 +768,7 @@
and lg: "linear g"
and fg: "\<And>b. b \<in> Basis \<Longrightarrow> f b = g b"
shows "f = g"
- using linear_eq_on_span[OF lf lg, of Basis] fg
- by auto
+ using linear_eq_on_span[OF lf lg, of Basis] fg by auto
text \<open>Similar results for bilinear functions.\<close>
@@ -932,15 +789,9 @@
span_add Ball_def
intro: bilinear_ladd[OF bf])
have sfg: "\<And>x. x \<in> B \<Longrightarrow> subspace {a. f x a = g x a}"
- apply (auto simp add: subspace_def)
- using bf bg unfolding bilinear_def linear_iff
- apply (auto simp add: span_zero bilinear_rzero[OF bf] bilinear_rzero[OF bg]
- span_add Ball_def
- intro: bilinear_ladd[OF bf])
- done
+ by (auto simp: subspace_def bf bg bilinear_rzero bilinear_radd bilinear_rmul)
have "\<forall>y\<in> span C. f x y = g x y" if "x \<in> span B" for x
- apply (rule span_induct [OF that sp])
- using fg sfg span_induct by blast
+ using span_induct [OF that sp] fg sfg span_induct by blast
then show ?thesis
using SB TC assms by auto
qed
@@ -972,8 +823,7 @@
fixes x :: "'a::euclidean_space"
shows "finite {\<bar>x \<bullet> i\<bar> |i. i \<in> Basis}"
and "{\<bar>x \<bullet> i\<bar> |i. i \<in> Basis} \<noteq> {}"
- unfolding infnorm_set_image
- by auto
+ unfolding infnorm_set_image by auto
lemma infnorm_pos_le:
fixes x :: "'a::euclidean_space"
@@ -1010,16 +860,7 @@
by (metis infnorm_neg minus_diff_eq)
lemma absdiff_infnorm: "\<bar>infnorm x - infnorm y\<bar> \<le> infnorm (x - y)"
-proof -
- have *: "\<And>(nx::real) n ny. nx \<le> n + ny \<Longrightarrow> ny \<le> n + nx \<Longrightarrow> \<bar>nx - ny\<bar> \<le> n"
- by arith
- show ?thesis
- proof (rule *)
- from infnorm_triangle[of "x - y" " y"] infnorm_triangle[of "x - y" "-x"]
- show "infnorm x \<le> infnorm (x - y) + infnorm y" "infnorm y \<le> infnorm (x - y) + infnorm x"
- by (simp_all add: field_simps infnorm_neg)
- qed
-qed
+ by (smt (verit, del_insts) diff_add_cancel infnorm_sub infnorm_triangle)
lemma real_abs_infnorm: "\<bar>infnorm x\<bar> = infnorm x"
using infnorm_pos_le[of x] by arith
@@ -1065,9 +906,9 @@
by (simp add: zero_le_mult_iff infnorm_pos_le)
have "x \<bullet> x \<le> (\<Sum>b\<in>Basis. x \<bullet> b * (x \<bullet> b))"
by (metis euclidean_inner order_refl)
- also have "... \<le> DIM('a) * \<bar>infnorm x\<bar>\<^sup>2"
+ also have "\<dots> \<le> DIM('a) * \<bar>infnorm x\<bar>\<^sup>2"
by (rule sum_bounded_above) (metis Basis_le_infnorm abs_le_square_iff power2_eq_square real_abs_infnorm)
- also have "... \<le> (sqrt DIM('a) * infnorm x)\<^sup>2"
+ also have "\<dots> \<le> (sqrt DIM('a) * infnorm x)\<^sup>2"
by (simp add: power_mult_distrib)
finally show "x \<bullet> x \<le> (sqrt DIM('a) * infnorm x)\<^sup>2" .
qed
@@ -1091,11 +932,11 @@
then show ?thesis
by auto
next
- case False
+ case False
from inner_eq_zero_iff[of "norm y *\<^sub>R x - norm x *\<^sub>R y"]
have "?rhs \<longleftrightarrow>
(norm y * (norm y * norm x * norm x - norm x * (x \<bullet> y)) -
- norm x * (norm y * (y \<bullet> x) - norm x * norm y * norm y) = 0)"
+ norm x * (norm y * (y \<bullet> x) - norm x * norm y * norm y) = 0)"
using False unfolding inner_simps
by (auto simp add: power2_norm_eq_inner[symmetric] power2_eq_square inner_commute field_simps)
also have "\<dots> \<longleftrightarrow> (2 * norm x * norm y * (norm x * norm y - x \<bullet> y) = 0)"
@@ -1108,20 +949,9 @@
lemma norm_cauchy_schwarz_abs_eq:
"\<bar>x \<bullet> y\<bar> = norm x * norm y \<longleftrightarrow>
norm x *\<^sub>R y = norm y *\<^sub>R x \<or> norm x *\<^sub>R y = - norm y *\<^sub>R x"
- (is "?lhs \<longleftrightarrow> ?rhs")
-proof -
- have th: "\<And>(x::real) a. a \<ge> 0 \<Longrightarrow> \<bar>x\<bar> = a \<longleftrightarrow> x = a \<or> x = - a"
- by arith
- have "?rhs \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x \<or> norm (- x) *\<^sub>R y = norm y *\<^sub>R (- x)"
- by simp
- also have "\<dots> \<longleftrightarrow> (x \<bullet> y = norm x * norm y \<or> (- x) \<bullet> y = norm x * norm y)"
- unfolding norm_cauchy_schwarz_eq[symmetric]
- unfolding norm_minus_cancel norm_scaleR ..
- also have "\<dots> \<longleftrightarrow> ?lhs"
- unfolding th[OF mult_nonneg_nonneg, OF norm_ge_zero[of x] norm_ge_zero[of y]] inner_simps
- by auto
- finally show ?thesis ..
-qed
+ using norm_cauchy_schwarz_eq [symmetric, of x y]
+ using norm_cauchy_schwarz_eq [symmetric, of "-x" y] Cauchy_Schwarz_ineq2 [of x y]
+ by auto
lemma norm_triangle_eq:
fixes x y :: "'a::real_inner"
@@ -1137,9 +967,7 @@
have "norm (x + y) = norm x + norm y \<longleftrightarrow> (norm (x + y))\<^sup>2 = (norm x + norm y)\<^sup>2"
by simp
also have "\<dots> \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x"
- unfolding norm_cauchy_schwarz_eq[symmetric]
- unfolding power2_norm_eq_inner inner_simps
- by (simp add: power2_norm_eq_inner[symmetric] power2_eq_square inner_commute field_simps)
+ by (smt (verit, best) dot_norm inner_real_def inner_simps norm_cauchy_schwarz_eq power2_eq_square)
finally show ?thesis .
qed
@@ -1147,11 +975,7 @@
fixes x y z :: "'a::real_inner"
shows "dist x z = dist x y + dist y z \<longleftrightarrow>
norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y)"
-proof -
- have *: "x - y + (y - z) = x - z" by auto
- show ?thesis unfolding dist_norm norm_triangle_eq[of "x - y" "y - z", unfolded *]
- by (auto simp:norm_minus_commute)
-qed
+ by (metis (no_types, lifting) add_diff_eq diff_add_cancel dist_norm norm_triangle_eq)
subsection \<open>Collinearity\<close>
@@ -1163,7 +987,7 @@
proof
assume ?lhs
then show ?rhs
- unfolding collinear_def by (metis Groups.add_ac(2) diff_add_cancel)
+ unfolding collinear_def by (metis add.commute diff_add_cancel)
next
assume ?rhs
then obtain u v where *: "\<And>x. x \<in> S \<Longrightarrow> \<exists>c. x = u + c *\<^sub>R v"
@@ -1192,8 +1016,7 @@
using \<open>v \<noteq> 0\<close> by blast
qed
then show ?thesis
- apply (clarsimp simp: collinear_def)
- by (metis scaleR_zero_right vector_fraction_eq_iff)
+ by (metis collinear_def)
qed
lemma collinear_subset: "\<lbrakk>collinear T; S \<subseteq> T\<rbrakk> \<Longrightarrow> collinear S"
@@ -1206,9 +1029,7 @@
by (simp add: collinear_def)
lemma collinear_2 [iff]: "collinear {x, y}"
- apply (simp add: collinear_def)
- apply (rule exI[where x="x - y"])
- by (metis minus_diff_eq scaleR_left.minus scaleR_one)
+ by (simp add: collinear_def) (metis minus_diff_eq scaleR_left.minus scaleR_one)
lemma collinear_lemma: "collinear {0, x, y} \<longleftrightarrow> x = 0 \<or> y = 0 \<or> (\<exists>c. y = c *\<^sub>R x)"
(is "?lhs \<longleftrightarrow> ?rhs")
@@ -1237,15 +1058,8 @@
then obtain c where c: "y = c *\<^sub>R x"
using False by blast
show ?lhs
- unfolding collinear_def c
- apply (rule exI[where x=x])
- apply auto
- apply (rule exI[where x="- 1"], simp)
- apply (rule exI[where x= "-c"], simp)
- apply (rule exI[where x=1], simp)
- apply (rule exI[where x="1 - c"], simp add: scaleR_left_diff_distrib)
- apply (rule exI[where x="c - 1"], simp add: scaleR_left_diff_distrib)
- done
+ apply (simp add: collinear_def c)
+ by (metis (mono_tags, lifting) scaleR_left.minus scaleR_left_diff_distrib scaleR_one)
qed
qed
@@ -1291,11 +1105,8 @@
fixes x y :: "'a::real_inner"
assumes "norm (x + y) = norm x + norm y"
shows "collinear{0,x,y}"
-proof (cases "x = 0 \<or> y = 0")
- case False
- with assms show ?thesis
- by (meson norm_cauchy_schwarz_abs_eq norm_cauchy_schwarz_equal norm_triangle_eq)
-qed (use collinear_lemma in blast)
+ using assms norm_cauchy_schwarz_abs_eq norm_cauchy_schwarz_equal norm_triangle_eq
+ by blast
subsection\<open>Properties of special hyperplanes\<close>
@@ -1315,7 +1126,7 @@
proof -
have "x = (\<Sum>b\<in>Basis. (x \<bullet> b) *\<^sub>R b)"
by (simp add: euclidean_representation)
- also have "... = (\<Sum>b \<in> Basis - {k}. (x \<bullet> b) *\<^sub>R b)"
+ also have "\<dots> = (\<Sum>b \<in> Basis - {k}. (x \<bullet> b) *\<^sub>R b)"
by (auto simp: sum.remove [of _ k] inner_commute assms that)
finally have "x = (\<Sum>b\<in>Basis - {k}. (x \<bullet> b) *\<^sub>R b)" .
then show ?thesis
@@ -1331,11 +1142,7 @@
lemma dim_special_hyperplane:
fixes k :: "'n::euclidean_space"
shows "k \<in> Basis \<Longrightarrow> dim {x. k \<bullet> x = 0} = DIM('n) - 1"
-apply (simp add: special_hyperplane_span)
-apply (rule dim_unique [OF subset_refl])
-apply (auto simp: independent_substdbasis)
-apply (metis member_remove remove_def span_base)
-done
+ by (metis Diff_subset card_Diff_singleton indep_card_eq_dim_span independent_substdbasis special_hyperplane_span)
proposition dim_hyperplane:
fixes a :: "'a::euclidean_space"
@@ -1358,20 +1165,17 @@
using \<open>independent B\<close> independent_bound by blast
have "UNIV \<subseteq> span (insert a B)"
proof fix y::'a
- obtain r z where z: "y = r *\<^sub>R a + z" "a \<bullet> z = 0"
- apply (rule_tac r="(a \<bullet> y) / (a \<bullet> a)" and z = "y - ((a \<bullet> y) / (a \<bullet> a)) *\<^sub>R a" in that)
- using assms
- by (auto simp: algebra_simps)
- show "y \<in> span (insert a B)"
- by (metis (mono_tags, lifting) z Bsub span_eq_iff
- add_diff_cancel_left' mem_Collect_eq span0 span_breakdown_eq span_subspace subspB)
+ obtain r z where "y = r *\<^sub>R a + z" "a \<bullet> z = 0"
+ by (metis add.commute diff_add_cancel vector_sub_project_orthogonal)
+ then show "y \<in> span (insert a B)"
+ by (metis (mono_tags, lifting) Bsub add_diff_cancel_left'
+ mem_Collect_eq span0 span_breakdown_eq span_eq subspB)
qed
- then have dima: "DIM('a) = dim(insert a B)"
+ then have "DIM('a) = dim(insert a B)"
by (metis independent_Basis span_Basis dim_eq_card top.extremum_uniqueI)
then show ?thesis
- by (metis (mono_tags, lifting) Bsub Diff_insert_absorb \<open>a \<notin> span B\<close> ind card0
- card_Diff_singleton dim_span indep_card_eq_dim_span insertI1 subsetCE
- subspB)
+ by (metis One_nat_def \<open>a \<notin> span B\<close> \<open>finite B\<close> card0 card_insert_disjoint
+ diff_Suc_Suc diff_zero dim_eq_card_independent ind span_base)
qed
lemma lowdim_eq_hyperplane:
@@ -1379,14 +1183,10 @@
assumes "dim S = DIM('a) - 1"
obtains a where "a \<noteq> 0" and "span S = {x. a \<bullet> x = 0}"
proof -
- have dimS: "dim S < DIM('a)"
- by (simp add: assms)
- then obtain b where b: "b \<noteq> 0" "span S \<subseteq> {a. b \<bullet> a = 0}"
- using lowdim_subset_hyperplane [of S] by fastforce
- show ?thesis
- apply (rule that[OF b(1)])
- apply (rule subspace_dim_equal)
- by (auto simp: assms b dim_hyperplane subspace_hyperplane)
+ obtain b where b: "b \<noteq> 0" "span S \<subseteq> {a. b \<bullet> a = 0}"
+ by (metis DIM_positive assms diff_less zero_less_one lowdim_subset_hyperplane)
+ then show ?thesis
+ by (metis assms dim_hyperplane dim_span dim_subset subspace_dim_equal subspace_hyperplane subspace_span that)
qed
lemma dim_eq_hyperplane:
@@ -1409,10 +1209,9 @@
using a by (force simp: span_explicit)
then have "a \<bullet> a = a \<bullet> (\<Sum>v\<in>T. U v *\<^sub>R v)"
by simp
- also have "... = 0"
+ also have "\<dots> = 0"
apply (simp add: inner_sum_right)
- apply (rule comm_monoid_add_class.sum.neutral)
- by (metis "0" DiffE \<open>T \<subseteq> S - {a}\<close> mult_not_zero singletonI subsetCE \<open>a \<in> S\<close>)
+ by (smt (verit) "0" DiffE \<open>T \<subseteq> S - {a}\<close> in_mono insertCI mult_not_zero sum.neutral that(1))
finally show ?thesis
using \<open>0 \<notin> S\<close> \<open>a \<in> S\<close> by auto
qed
@@ -1424,14 +1223,8 @@
fixes S :: "'a::euclidean_space set"
assumes "pairwise orthogonal S"
shows "finite S"
-proof -
- have "independent (S - {0})"
- apply (rule pairwise_orthogonal_independent)
- apply (metis Diff_iff assms pairwise_def)
- by blast
- then show ?thesis
- by (meson independent_imp_finite infinite_remove)
-qed
+ by (metis Set.set_insert assms finite_insert independent_bound pairwise_insert
+ pairwise_orthogonal_independent)
lemma subspace_orthogonal_to_vector: "subspace {y. orthogonal x y}"
by (simp add: subspace_def orthogonal_clauses)
@@ -1457,7 +1250,7 @@
proof -
have "a \<bullet> x = (\<Sum>y\<in>S. if y = x then y \<bullet> a else 0)"
by (simp add: \<open>finite S\<close> inner_commute that)
- also have "... = (\<Sum>b\<in>S. b \<bullet> a * (b \<bullet> x) / (b \<bullet> b))"
+ also have "\<dots> = (\<Sum>b\<in>S. b \<bullet> a * (b \<bullet> x) / (b \<bullet> b))"
apply (rule sum.cong [OF refl], simp)
by (meson S orthogonal_def pairwise_def that)
finally show ?thesis
@@ -1487,20 +1280,15 @@
(auto simp: Gram_Schmidt_step a'_def insert.prems orthogonal_commute
pairwise_orthogonal_insert span_clauses)
have orthS: "\<And>x. x \<in> S \<Longrightarrow> a' \<bullet> x = 0"
- apply (simp add: a'_def)
- using Gram_Schmidt_step [OF \<open>pairwise orthogonal S\<close>]
- apply (force simp: orthogonal_def inner_commute span_superset [THEN subsetD])
- done
+ using Gram_Schmidt_step a'_def insert.prems orthogonal_commute orthogonal_def span_base by blast
have "span (S \<union> insert a' U) = span (insert a' (S \<union> T))"
using spanU by simp
- also have "... = span (insert a (S \<union> T))"
- apply (rule eq_span_insert_eq)
- apply (simp add: a'_def span_neg span_sum span_base span_mul)
- done
- also have "... = span (S \<union> insert a T)"
+ also have "\<dots> = span (insert a (S \<union> T))"
+ by (simp add: a'_def span_neg span_sum span_base span_mul eq_span_insert_eq)
+ also have "\<dots> = span (S \<union> insert a T)"
by simp
finally show ?case
- by (rule_tac x="insert a' U" in exI) (use orthU in auto)
+ using orthU by blast
qed
@@ -1524,14 +1312,12 @@
obtains U where "U \<inter> (insert 0 S) = {}" "pairwise orthogonal (S \<union> U)"
"span (S \<union> U) = span (S \<union> T)"
proof -
- obtain U where "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> T)"
+ obtain U where U: "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> T)"
using orthogonal_extension assms by blast
- then show ?thesis
- apply (rule_tac U = "U - (insert 0 S)" in that)
- apply blast
- apply (force simp: pairwise_def)
- apply (metis Un_Diff_cancel Un_insert_left span_redundant span_zero)
- done
+ moreover have "pairwise orthogonal (S \<union> (U - insert 0 S))"
+ by (smt (verit, best) Un_Diff_Int Un_iff U pairwise_def)
+ ultimately show ?thesis
+ by (metis Diff_disjoint Un_Diff_cancel Un_insert_left inf_commute span_insert_0 that)
qed
subsection\<open>Decomposing a vector into parts in orthogonal subspaces\<close>
@@ -1542,27 +1328,14 @@
fixes S :: "'a :: euclidean_space set"
assumes "subspace S"
obtains B where "B \<subseteq> S" "pairwise orthogonal B" "span B = S"
-proof -
- obtain B where "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S"
- using basis_exists by blast
- with orthogonal_extension [of "{}" B]
- show ?thesis
- by (metis Un_empty_left assms pairwise_empty span_superset span_subspace that)
-qed
+ by (metis assms basis_orthogonal basis_subspace_exists span_eq)
lemma orthogonal_basis_subspace:
fixes S :: "'a :: euclidean_space set"
assumes "subspace S"
obtains B where "0 \<notin> B" "B \<subseteq> S" "pairwise orthogonal B" "independent B"
"card B = dim S" "span B = S"
-proof -
- obtain B where "B \<subseteq> S" "pairwise orthogonal B" "span B = S"
- using assms orthogonal_spanningset_subspace by blast
- then show ?thesis
- apply (rule_tac B = "B - {0}" in that)
- apply (auto simp: indep_card_eq_dim_span pairwise_subset pairwise_orthogonal_independent elim: pairwise_subset)
- done
-qed
+ by (metis assms dependent_zero orthogonal_basis_exists span_eq span_eq_iff)
proposition orthonormal_basis_subspace:
fixes S :: "'a :: euclidean_space set"
@@ -1609,7 +1382,7 @@
obtain B where "B \<subseteq> span S" and orthB: "pairwise orthogonal B"
and "\<And>x. x \<in> B \<Longrightarrow> norm x = 1"
and "independent B" "card B = dim S" "span B = span S"
- by (rule orthonormal_basis_subspace [of "span S", OF subspace_span]) (auto)
+ by (metis dim_span orthonormal_basis_subspace subspace_span)
with assms obtain u where spanBT: "span B \<subseteq> span T" and "u \<notin> span B" "u \<in> span T"
by auto
obtain C where orthBC: "pairwise orthogonal (B \<union> C)" and spanBC: "span (B \<union> C) = span (B \<union> {u})"
@@ -1630,9 +1403,8 @@
then obtain x where "x \<in> C" "x \<noteq> 0" "x \<notin> B"
by blast
then have "x \<in> span T"
- by (metis (no_types, lifting) Un_insert_right Un_upper2 \<open>u \<in> span T\<close> spanBT spanBC
- \<open>u \<in> span T\<close> insert_subset span_superset span_mono
- span_span subsetCE subset_trans sup_bot.comm_neutral)
+ by (smt (verit, ccfv_SIG) Set.set_insert \<open>u \<in> span T\<close> empty_subsetI insert_subset
+ le_sup_iff spanBC spanBT span_mono span_span span_superset subset_trans)
moreover have "orthogonal x y" if "y \<in> span B" for y
using that
proof (rule span_induct)
@@ -1652,8 +1424,7 @@
obtains x where "x \<noteq> 0" "\<And>y. y \<in> span S \<Longrightarrow> orthogonal x y"
proof -
have "span S \<subset> UNIV"
- by (metis (mono_tags) UNIV_I assms inner_eq_zero_iff less_le lowdim_subset_hyperplane
- mem_Collect_eq top.extremum_strict top.not_eq_extremum)
+ by (metis assms dim_eq_full order_less_imp_not_less top.not_eq_extremum)
with orthogonal_to_subspace_exists_gen [of S UNIV] that show ?thesis
by (auto)
qed
@@ -1683,11 +1454,8 @@
have orth: "orthogonal (x - ?a) w" if "w \<in> span S" for w
by (simp add: Gram_Schmidt_step \<open>pairwise orthogonal T\<close> \<open>span T = span S\<close>
orthogonal_commute that)
- show ?thesis
- apply (rule_tac y = "?a" and z = "x - ?a" in that)
- apply (meson \<open>T \<subseteq> span S\<close> span_scale span_sum subsetCE)
- apply (fact orth, simp)
- done
+ with that[of ?a "x-?a"] \<open>T \<subseteq> span S\<close> show ?thesis
+ by (simp add: span_mul span_sum subsetD)
qed
lemma orthogonal_subspace_decomp_unique:
@@ -1702,15 +1470,15 @@
moreover have "\<And>a b. \<lbrakk>a \<in> span S; b \<in> span T\<rbrakk> \<Longrightarrow> orthogonal a b"
by (meson orth orthogonal_commute orthogonal_to_span)
ultimately have "0 = x' - x"
- by (metis (full_types) add_diff_cancel_left' ST diff_right_commute orthogonal_clauses(10) orthogonal_clauses(5) orthogonal_self)
+ using assms
+ by (metis add.commute add_diff_cancel_right' diff_right_commute orthogonal_self span_diff)
with assms show ?thesis by auto
qed
lemma vector_in_orthogonal_spanningset:
fixes a :: "'a::euclidean_space"
obtains S where "a \<in> S" "pairwise orthogonal S" "span S = UNIV"
- by (metis UNIV_I Un_iff empty_iff insert_subset orthogonal_extension pairwise_def
- pairwise_orthogonal_insert span_UNIV subsetI subset_antisym)
+ by (metis UnI1 Un_UNIV_right insertI1 orthogonal_extension pairwise_singleton span_UNIV)
lemma vector_in_orthogonal_basis:
fixes a :: "'a::euclidean_space"
@@ -1755,17 +1523,15 @@
using \<open>pairwise orthogonal S\<close> by (auto simp: pairwise_def orthogonal_def)
show "\<And>x. x \<in> (\<lambda>x. x /\<^sub>R norm x) ` S \<Longrightarrow> norm x = 1"
using \<open>0 \<notin> S\<close> by (auto simp: field_split_simps)
- then show "independent ?S"
+ then show ind: "independent ?S"
by (metis \<open>pairwise orthogonal ((\<lambda>x. x /\<^sub>R norm x) ` S)\<close> norm_zero pairwise_orthogonal_independent zero_neq_one)
have "inj_on (\<lambda>x. x /\<^sub>R norm x) S"
unfolding inj_on_def
by (metis (full_types) S(1) \<open>0 \<notin> S\<close> inverse_nonzero_iff_nonzero norm_eq_zero orthogonal_scaleR orthogonal_self pairwise_def)
then show "card ?S = DIM('a)"
by (simp add: card_image S)
- show "span ?S = UNIV"
- by (metis (no_types) \<open>0 \<notin> S\<close> \<open>finite S\<close> \<open>span S = UNIV\<close>
- field_class.field_inverse_zero inverse_inverse_eq less_irrefl span_image_scale
- zero_less_norm_iff)
+ then show "span ?S = UNIV"
+ by (metis ind dim_eq_card dim_eq_full)
qed
qed
@@ -1786,12 +1552,10 @@
by (auto simp add: span_Un image_def)
also have "dim \<dots> = dim {x + y |x y. x \<in> span A \<and> y \<in> span B}"
by (auto intro!: arg_cong [where f=dim])
- also have "... = dim {x + y |x y. x \<in> span A \<and> y \<in> span B} + dim(span A \<inter> span B)"
- by (auto simp: dest: 0)
- also have "... = dim (span A) + dim (span B)"
- by (rule dim_sums_Int) (auto)
- also have "... = dim A + dim B"
- by (simp)
+ also have "\<dots> = dim {x + y |x y. x \<in> span A \<and> y \<in> span B} + dim(span A \<inter> span B)"
+ by (auto dest: 0)
+ also have "\<dots> = dim A + dim B"
+ using dim_sums_Int by fastforce
finally show ?thesis .
qed
@@ -1810,17 +1574,16 @@
proof -
obtain y z where "x = y + z" "y \<in> span A" and orth: "\<And>w. w \<in> span A \<Longrightarrow> orthogonal z w"
using orthogonal_subspace_decomp_exists [of A x] that by auto
+ moreover
have "y \<in> span B"
using \<open>y \<in> span A\<close> assms(3) span_mono by blast
- then have "z \<in> {a \<in> B. \<forall>x. x \<in> A \<longrightarrow> orthogonal x a}"
- apply simp
- using \<open>x = y + z\<close> assms(1) assms(2) orth orthogonal_commute span_add_eq
- span_eq_iff that by blast
+ ultimately have "z \<in> B \<and> (\<forall>x. x \<in> A \<longrightarrow> orthogonal x z)"
+ using assms by (metis orthogonal_commute span_add_eq span_eq_iff that)
then have z: "z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y}"
- by (meson span_superset subset_iff)
+ by (simp add: span_base)
then show ?thesis
- apply (auto simp: span_Un image_def \<open>x = y + z\<close> \<open>y \<in> span A\<close>)
- using \<open>y \<in> span A\<close> add.commute by blast
+ by (smt (verit, best) \<open>x = y + z\<close> \<open>y \<in> span A\<close> le_sup_iff span_add_eq span_subspace_induct
+ span_superset subset_iff subspace_span)
qed
show "span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)"
by (rule span_minimal) (auto intro: * span_minimal)
@@ -1845,12 +1608,8 @@
qed
lemma linear_continuous_at:
- assumes "bounded_linear f"
- shows "continuous (at a) f"
- unfolding continuous_at using assms
- apply (rule bounded_linear.tendsto)
- apply (rule tendsto_ident_at)
- done
+ "bounded_linear f \<Longrightarrow>continuous (at a) f"
+ by (simp add: bounded_linear.isUCont isUCont_isCont)
lemma linear_continuous_within:
"bounded_linear f \<Longrightarrow> continuous (at x within s) f"
@@ -1869,21 +1628,7 @@
using linear_bounded_pos [OF \<open>linear h\<close>] by blast
show ?thesis
unfolding tendsto_iff
- proof (intro allI impI)
- show "\<forall>\<^sub>F x in F. dist (h (f x)) (h l) < e" if "e > 0" for e
- proof -
- have "\<forall>\<^sub>F x in F. dist (f x) l < e/B"
- by (simp add: \<open>0 < B\<close> assms(1) tendstoD that)
- then show ?thesis
- unfolding dist_norm
- proof (rule eventually_mono)
- show "norm (h (f x) - h l) < e" if "norm (f x - l) < e / B" for x
- using that B
- apply (simp add: field_split_simps)
- by (metis \<open>linear h\<close> le_less_trans linear_diff)
- qed
- qed
- qed
+ by (simp add: assms bounded_linear.tendsto linear_linear tendstoD)
qed
lemma linear_continuous_compose:
--- a/src/HOL/Analysis/Path_Connected.thy Sat Dec 31 11:09:19 2022 +0000
+++ b/src/HOL/Analysis/Path_Connected.thy Sun Jan 01 00:45:55 2023 +0000
@@ -2497,7 +2497,7 @@
by (simp add: inner_commute)
qed
obtain S :: "'a set" where "S \<subseteq> Basis" and "card S = Suc (Suc 0)"
- using ex_card[OF assms]
+ using obtain_subset_with_card_n[OF assms]
by auto
then obtain b0 b1 :: 'a where "b0 \<in> Basis" and "b1 \<in> Basis" and "b0 \<noteq> b1"
unfolding card_Suc_eq by auto
--- a/src/HOL/Analysis/Topology_Euclidean_Space.thy Sat Dec 31 11:09:19 2022 +0000
+++ b/src/HOL/Analysis/Topology_Euclidean_Space.thy Sun Jan 01 00:45:55 2023 +0000
@@ -1307,18 +1307,11 @@
assume i: "i \<in> Basis"
have "dist (x - (e / 2) *\<^sub>R i) x < e"
and "dist (x + (e / 2) *\<^sub>R i) x < e"
- unfolding dist_norm
- apply auto
- unfolding norm_minus_cancel
- using norm_Basis[OF i] \<open>e>0\<close>
- apply auto
- done
+ using norm_Basis[OF i] \<open>e>0\<close> by (auto simp: dist_norm)
then have "a \<bullet> i \<le> (x - (e / 2) *\<^sub>R i) \<bullet> i" and "(x + (e / 2) *\<^sub>R i) \<bullet> i \<le> b \<bullet> i"
using e[THEN spec[where x="x - (e/2) *\<^sub>R i"]]
and e[THEN spec[where x="x + (e/2) *\<^sub>R i"]]
- unfolding mem_box
- using i
- by blast+
+ unfolding mem_box using i by blast+
then have "a \<bullet> i < x \<bullet> i" and "x \<bullet> i < b \<bullet> i"
using \<open>e>0\<close> i
by (auto simp: inner_diff_left inner_Basis inner_add_left)
@@ -1349,8 +1342,7 @@
lemma bounded_box [simp]:
fixes a :: "'a::euclidean_space"
shows "bounded (box a b)"
- using bounded_cbox[of a b] box_subset_cbox[of a b] bounded_subset[of "cbox a b" "box a b"]
- by simp
+ by (metis bounded_cbox bounded_interior interior_cbox)
lemma not_interval_UNIV [simp]:
fixes a :: "'a::euclidean_space"
@@ -1385,12 +1377,7 @@
have "a \<bullet> i = e * (a \<bullet> i) + (1 - e) * (a \<bullet> i)"
unfolding left_diff_distrib by simp
also have "\<dots> < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)"
- proof (rule add_less_le_mono)
- show "e * (a \<bullet> i) < e * (x \<bullet> i)"
- using \<open>0 < e\<close> i mem_box(1) x by auto
- show "(1 - e) * (a \<bullet> i) \<le> (1 - e) * (y \<bullet> i)"
- by (meson diff_ge_0_iff_ge \<open>e \<le> 1\<close> i mem_box(2) mult_left_mono y)
- qed
+ by (smt (verit, best) e i mem_box mult_le_cancel_left_pos mult_left_mono x y)
finally have "a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i"
unfolding inner_simps by auto
moreover
@@ -1398,12 +1385,7 @@
have "b \<bullet> i = e * (b\<bullet>i) + (1 - e) * (b\<bullet>i)"
unfolding left_diff_distrib by simp
also have "\<dots> > e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)"
- proof (rule add_less_le_mono)
- show "e * (x \<bullet> i) < e * (b \<bullet> i)"
- using \<open>0 < e\<close> i mem_box(1) x by auto
- show "(1 - e) * (y \<bullet> i) \<le> (1 - e) * (b \<bullet> i)"
- by (meson diff_ge_0_iff_ge \<open>e \<le> 1\<close> i mem_box(2) mult_left_mono y)
- qed
+ by (smt (verit, best) e i mem_box mult_le_cancel_left_pos mult_left_mono x y)
finally have "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i"
unfolding inner_simps by auto
}
@@ -1427,7 +1409,7 @@
let ?c = "(1 / 2) *\<^sub>R (a + b)"
{
fix x
- assume as:"x \<in> cbox a b"
+ assume as: "x \<in> cbox a b"
define f where [abs_def]: "f n = x + (inverse (real n + 1)) *\<^sub>R (?c - x)" for n
{
fix n
@@ -1445,22 +1427,16 @@
}
moreover
{
- assume "\<not> (f \<longlongrightarrow> x) sequentially"
- {
- fix e :: real
- assume "e > 0"
- then obtain N :: nat where N: "inverse (real (N + 1)) < e"
- using reals_Archimedean by auto
- have "inverse (real n + 1) < e" if "N \<le> n" for n
- by (auto intro!: that le_less_trans [OF _ N])
- then have "\<exists>N::nat. \<forall>n\<ge>N. inverse (real n + 1) < e" by auto
- }
- then have "((\<lambda>n. inverse (real n + 1)) \<longlongrightarrow> 0) sequentially"
+ have "\<exists>N::nat. \<forall>n\<ge>N. inverse (real n + 1) < \<epsilon>" if "\<epsilon> > 0" for \<epsilon>
+ using reals_Archimedean [of \<epsilon>] that
+ by (metis inverse_inverse_eq inverse_less_imp_less nat_le_real_less order_less_trans
+ reals_Archimedean2)
+ then have "(\<lambda>n. inverse (real n + 1)) \<longlonglongrightarrow> 0"
unfolding lim_sequentially by(auto simp: dist_norm)
- then have "(f \<longlongrightarrow> x) sequentially"
+ then have "f \<longlonglongrightarrow> x"
unfolding f_def
- using tendsto_add[OF tendsto_const, of "\<lambda>n::nat. (inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b) - x)" 0 sequentially x]
- using tendsto_scaleR [OF _ tendsto_const, of "\<lambda>n::nat. inverse (real n + 1)" 0 sequentially "((1 / 2) *\<^sub>R (a + b) - x)"]
+ using tendsto_add[OF tendsto_const, of "\<lambda>n. (inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b) - x)" 0 sequentially x]
+ using tendsto_scaleR [OF _ tendsto_const, of "\<lambda>n. inverse (real n + 1)" 0 sequentially "((1 / 2) *\<^sub>R (a + b) - x)"]
by auto
}
ultimately have "x \<in> closure (box a b)"
@@ -1491,12 +1467,7 @@
fixes S :: "('a::euclidean_space) set"
assumes "bounded S"
obtains a where "S \<subseteq> cbox (-a) a"
-proof -
- obtain a where "S \<subseteq> box (-a) a"
- using bounded_subset_box_symmetric[OF assms] by auto
- then show ?thesis
- by (meson box_subset_cbox dual_order.trans that)
-qed
+ by (meson assms bounded_subset_box_symmetric box_subset_cbox order.trans)
lemma frontier_cbox:
fixes a b :: "'a::euclidean_space"
@@ -1506,16 +1477,7 @@
lemma frontier_box:
fixes a b :: "'a::euclidean_space"
shows "frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)"
-proof (cases "box a b = {}")
- case True
- then show ?thesis
- using frontier_empty by auto
-next
- case False
- then show ?thesis
- unfolding frontier_def and closure_box[OF False] and interior_open[OF open_box]
- by auto
-qed
+ by (simp add: frontier_def interior_open open_box)
lemma Int_interval_mixed_eq_empty:
fixes a :: "'a::euclidean_space"
@@ -1549,28 +1511,21 @@
with l have "eventually (\<lambda>n. \<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e / (real_of_nat DIM('a))) sequentially"
by simp
moreover
- {
- fix n
+ { fix n
assume n: "\<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e / (real_of_nat DIM('a))"
have "dist (f (r n)) l \<le> (\<Sum>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i))"
- apply (subst euclidean_dist_l2)
- using zero_le_dist
- apply (rule L2_set_le_sum)
- done
+ using L2_set_le_sum [OF zero_le_dist] by (subst euclidean_dist_l2)
also have "\<dots> < (\<Sum>i\<in>(Basis::'a set). e / (real_of_nat DIM('a)))"
- apply (rule sum_strict_mono)
- using n
- apply auto
- done
+ by (meson eucl.finite_Basis n nonempty_Basis sum_strict_mono)
finally have "dist (f (r n)) l < e"
by auto
}
- ultimately have "eventually (\<lambda>n. dist (f (r n)) l < e) sequentially"
+ ultimately have "\<forall>\<^sub>F n in sequentially. dist (f (r n)) l < e"
by (rule eventually_mono)
}
- then have *: "((f \<circ> r) \<longlongrightarrow> l) sequentially"
+ then have *: "(f \<circ> r) \<longlonglongrightarrow> l"
unfolding o_def tendsto_iff by simp
- with r show "\<exists>l r. strict_mono r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially"
+ with r show "\<exists>l r. strict_mono r \<and> (f \<circ> r) \<longlonglongrightarrow> l"
by auto
qed
@@ -1592,10 +1547,8 @@
fix A::"'a set"
assume "open A"
show "\<exists>B'\<subseteq>B. \<Union>B' = A"
- apply (rule exI[of _ "{b\<in>B. b \<subseteq> A}"])
- apply (subst (3) open_UNION_box[OF \<open>open A\<close>])
- apply (auto simp: a b B_def)
- done
+ using open_UNION_box[OF \<open>open A\<close>]
+ by (smt (verit, ccfv_threshold) B_def a b image_iff mem_Collect_eq subsetI)
qed
ultimately
have "topological_basis B"
@@ -1658,10 +1611,11 @@
by (simp add: False b cSUP_least)
finally have bi: "x \<bullet> i \<le> b \<bullet> i" .
show "x \<bullet> i \<in> (\<lambda>x. x \<bullet> i) ` S"
- apply (rule_tac x="\<Sum>j\<in>Basis. (if j = i then x \<bullet> i else a \<bullet> j) *\<^sub>R j" in image_eqI)
+ apply (rule_tac x="\<Sum>j\<in>Basis. (((\<bullet>)a)(i := x \<bullet> j))j *\<^sub>R j" in image_eqI)
apply (simp add: i)
apply (rule mem_is_intervalI [OF \<open>is_interval S\<close> \<open>a \<in> S\<close> \<open>b \<in> S\<close>])
- using i ai bi apply force
+ using i ai bi
+ apply force
done
qed
have "S = cbox a b"
@@ -1714,10 +1668,7 @@
assume ?lhs
then show ?rhs
unfolding tendsto_def
- apply clarify
- apply (drule_tac x="{s. s \<bullet> i \<in> S}" in spec)
- apply (auto simp: open_preimage_inner)
- done
+ by (smt (verit) eventually_elim2 mem_Collect_eq open_preimage_inner)
next
assume R: ?rhs
then have "\<And>e. e > 0 \<Longrightarrow> \<forall>i\<in>Basis. \<forall>\<^sub>F x in F. dist (f x \<bullet> i) (l \<bullet> i) < e"
@@ -1735,19 +1686,15 @@
have "L2_set (\<lambda>i. dist (f x \<bullet> i) (l \<bullet> i)) Basis \<le> sum (\<lambda>i. dist (f x \<bullet> i) (l \<bullet> i)) Basis"
by (simp add: L2_set_le_sum)
also have "... < DIM('b) * (e / real DIM('b))"
- apply (rule sum_bounded_above_strict)
- using that by auto
+ by (meson DIM_positive sum_bounded_above_strict that)
also have "... = e"
by (simp add: field_simps)
finally show "L2_set (\<lambda>i. dist (f x \<bullet> i) (l \<bullet> i)) Basis < e" .
qed
have "\<forall>\<^sub>F x in F. \<forall>i\<in>Basis. dist (f x \<bullet> i) (l \<bullet> i) < e / DIM('b)"
- apply (rule R')
- using \<open>0 < e\<close> by simp
+ by (simp add: R' \<open>0 < e\<close>)
then show "\<forall>\<^sub>F x in F. dist (f x) l < e"
- apply (rule eventually_mono)
- apply (subst euclidean_dist_l2)
- using * by blast
+ by eventually_elim (metis (full_types) "*" euclidean_dist_l2)
qed
qed
@@ -1759,22 +1706,21 @@
corollary continuous_on_componentwise:
fixes S :: "'a :: t2_space set"
shows "continuous_on S f \<longleftrightarrow> (\<forall>i \<in> Basis. continuous_on S (\<lambda>x. (f x \<bullet> i)))"
- apply (simp add: continuous_on_eq_continuous_within)
- using continuous_componentwise by blast
+ by (metis continuous_componentwise continuous_on_eq_continuous_within)
lemma linear_componentwise_iff:
- "(linear f') \<longleftrightarrow> (\<forall>i\<in>Basis. linear (\<lambda>x. f' x \<bullet> i))"
- apply (auto simp: linear_iff inner_left_distrib)
- apply (metis inner_left_distrib euclidean_eq_iff)
- by (metis euclidean_eqI inner_scaleR_left)
+ "linear f' \<longleftrightarrow> (\<forall>i\<in>Basis. linear (\<lambda>x. f' x \<bullet> i))" (is "?lhs \<longleftrightarrow> ?rhs")
+proof
+ show "?lhs \<Longrightarrow> ?rhs"
+ by (simp add: Real_Vector_Spaces.linear_iff inner_left_distrib)
+ show "?rhs \<Longrightarrow> ?lhs"
+ by (simp add: linear_iff) (metis euclidean_eqI inner_left_distrib inner_scaleR_left)
+qed
lemma bounded_linear_componentwise_iff:
"(bounded_linear f') \<longleftrightarrow> (\<forall>i\<in>Basis. bounded_linear (\<lambda>x. f' x \<bullet> i))"
(is "?lhs = ?rhs")
proof
- assume ?lhs then show ?rhs
- by (simp add: bounded_linear_inner_left_comp)
-next
assume ?rhs
then have "(\<forall>i\<in>Basis. \<exists>K. \<forall>x. \<bar>f' x \<bullet> i\<bar> \<le> norm x * K)" "linear f'"
by (auto simp: bounded_linear_def bounded_linear_axioms_def linear_componentwise_iff [symmetric] ball_conj_distrib)
@@ -1792,7 +1738,7 @@
qed
then show ?lhs
by (force simp: bounded_linear_def bounded_linear_axioms_def \<open>linear f'\<close>)
-qed
+qed (simp add: bounded_linear_inner_left_comp)
subsection\<^marker>\<open>tag unimportant\<close> \<open>Continuous Extension\<close>
@@ -1853,8 +1799,7 @@
obtain d where d: "0 < d"
"\<And>x'. x' \<in> cbox a b \<Longrightarrow> dist x' (clamp a b x) < d \<Longrightarrow> dist (f x') (f (clamp a b x)) < e"
by force
- show "\<exists>d>0. \<forall>x'. dist x' x < d \<longrightarrow>
- dist (f (clamp a b x')) (f (clamp a b x)) < e"
+ show "\<exists>d>0. \<forall>x'. dist x' x < d \<longrightarrow> dist (f (clamp a b x')) (f (clamp a b x)) < e"
using le
by (auto intro!: d clamp_in_interval dist_clamps_le_dist_args[THEN le_less_trans])
qed
@@ -1876,8 +1821,7 @@
from bounded obtain c where f_bound: "\<forall>x\<in>f ` cbox a b. dist undefined x \<le> c"
by (auto simp: bounded_any_center[where a=undefined])
then show ?thesis
- by (auto intro!: exI[where x=c] clamp_in_interval[OF le[rule_format]]
- simp: bounded_any_center[where a=undefined])
+ by (metis bounded bounded_subset clamp_in_interval image_mono image_subsetI le range_composition)
qed (auto simp: clamp_empty_interval image_def)
@@ -1888,9 +1832,7 @@
fixes x a b :: "'a::euclidean_space"
assumes x: "x \<in> cbox a b"
shows "ext_cont f a b x = f x"
- using assms
- unfolding ext_cont_def
- by (auto simp: clamp_def mem_box intro!: euclidean_eqI[where 'a='a] arg_cong[where f=f])
+ using assms by (simp add: ext_cont_def)
lemma continuous_on_ext_cont[continuous_intros]:
"continuous_on (cbox a b) f \<Longrightarrow> continuous_on S (ext_cont f a b)"
@@ -1909,18 +1851,16 @@
and Un: "\<And>S. open S \<Longrightarrow> \<exists>U. U \<subseteq> \<B> \<and> S = \<Union>U"
using univ_second_countable by blast
have *: "infinite (range (\<lambda>n. ball (0::'a) (inverse(Suc n))))"
- apply (rule Infinite_Set.range_inj_infinite)
- apply (simp add: inj_on_def ball_eq_ball_iff)
- done
+ by (simp add: inj_on_def ball_eq_ball_iff Infinite_Set.range_inj_infinite)
have "infinite \<B>"
proof
assume "finite \<B>"
then have "finite (Union ` (Pow \<B>))"
by simp
- then have "finite (range (\<lambda>n. ball (0::'a) (inverse(Suc n))))"
- apply (rule rev_finite_subset)
+ moreover have "range (\<lambda>n. ball 0 (inverse (real (Suc n)))) \<subseteq> \<Union> ` Pow \<B>"
by (metis (no_types, lifting) PowI image_eqI image_subset_iff Un [OF open_ball])
- with * show False by simp
+ ultimately show False
+ by (metis finite_subset *)
qed
obtain f :: "nat \<Rightarrow> 'a set" where "\<B> = range f" "inj f"
by (blast intro: countable_as_injective_image [OF \<open>countable \<B>\<close> \<open>infinite \<B>\<close>])
@@ -1931,9 +1871,7 @@
using \<open>inj f\<close> \<open>\<B> = range f\<close> apply force
done
show ?thesis
- apply (rule that [OF \<open>inj f\<close> _ *])
- apply (auto simp: \<open>\<B> = range f\<close> opn)
- done
+ using "*" \<open>\<B> = range f\<close> \<open>inj f\<close> opn that by force
qed
proposition separable:
@@ -1969,14 +1907,8 @@
using \<open>0 < e\<close> \<U> \<open>x \<in> S\<close> by auto
next
case False
- then obtain C where "C \<in> \<U>" by blast
- show ?thesis
- proof
- show "dist (f C) x < e"
- by (metis Int_iff Union_iff \<U> \<open>C \<in> \<U>\<close> dist_commute f mem_ball subsetCE)
- show "C \<in> \<B>"
- using \<open>\<U> \<subseteq> \<B>\<close> \<open>C \<in> \<U>\<close> by blast
- qed
+ then show ?thesis
+ by (metis IntI Union_iff \<U> \<open>0 < e\<close> \<open>x \<in> S\<close> dist_commute dist_self f inf_le2 mem_ball subset_eq)
qed
qed
qed
@@ -2001,8 +1933,7 @@
then show "norm (x - y) \<le> 2*r" by simp
qed (simp add: that)
have "2*r = dist (a + r *\<^sub>R (SOME i. i \<in> Basis)) (a - r *\<^sub>R (SOME i. i \<in> Basis))"
- apply (simp add: dist_norm)
- by (metis abs_of_nonneg mult.right_neutral norm_numeral norm_scaleR norm_some_Basis real_norm_def scaleR_2 that)
+ using \<open>0 \<le> r\<close> that by (simp add: dist_norm flip: scaleR_2)
also have "... \<le> diameter (cball a r)"
apply (rule diameter_bounded_bound)
using that by (auto simp: dist_norm)
@@ -2023,8 +1954,8 @@
lemma diameter_closed_interval [simp]: "diameter {a..b} = (if b < a then 0 else b-a)"
proof -
- have "{a .. b} = cball ((a+b)/2) ((b-a)/2)"
- by (auto simp: dist_norm abs_if field_split_simps split: if_split_asm)
+ have "{a..b} = cball ((a+b)/2) ((b-a)/2)"
+ using atLeastAtMost_eq_cball by blast
then show ?thesis
by simp
qed
@@ -2032,7 +1963,7 @@
lemma diameter_open_interval [simp]: "diameter {a<..<b} = (if b < a then 0 else b-a)"
proof -
have "{a <..< b} = ball ((a+b)/2) ((b-a)/2)"
- by (auto simp: dist_norm abs_if field_split_simps split: if_split_asm)
+ using greaterThanLessThan_eq_ball by blast
then show ?thesis
by simp
qed
@@ -2101,10 +2032,8 @@
shows "open(f ` A) \<longleftrightarrow> open A"
proof
assume "open(f ` A)"
- then have "open(f -` (f ` A))"
- using assms by (force simp: linear_continuous_at linear_conv_bounded_linear continuous_open_vimage)
then show "open A"
- by (simp add: assms bij_is_inj inj_vimage_image_eq)
+ by (metis assms bij_is_inj continuous_open_vimage inj_vimage_image_eq linear_continuous_at linear_linear)
next
assume "open A"
then show "open(f ` A)"
@@ -2114,20 +2043,9 @@
corollary interior_bijective_linear_image:
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
assumes "linear f" "bij f"
- shows "interior (f ` S) = f ` interior S" (is "?lhs = ?rhs")
-proof safe
- fix x
- assume x: "x \<in> ?lhs"
- then obtain T where "open T" and "x \<in> T" and "T \<subseteq> f ` S"
- by (metis interiorE)
- then show "x \<in> ?rhs"
- by (metis (no_types, opaque_lifting) assms subsetD interior_maximal open_bijective_linear_image_eq subset_image_iff)
-next
- fix x
- assume x: "x \<in> interior S"
- then show "f x \<in> interior (f ` S)"
- by (meson assms imageI image_mono interiorI interior_subset open_bijective_linear_image_eq open_interior)
-qed
+ shows "interior (f ` S) = f ` interior S"
+ by (smt (verit) assms bij_is_inj inj_image_subset_iff interior_maximal interior_subset
+ open_bijective_linear_image_eq open_interior subset_antisym subset_imageE)
lemma interior_injective_linear_image:
fixes f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space"
@@ -2234,10 +2152,9 @@
shows "closed(f ` s)"
proof -
obtain e where "e > 0" and e: "\<forall>x\<in>s. e * norm x \<le> norm (f x)"
- using injective_imp_isometric[OF assms(4,1,2,3)] by auto
- show ?thesis
- using complete_isometric_image[OF \<open>e>0\<close> assms(1,2) e] and assms(4)
- unfolding complete_eq_closed[symmetric] by auto
+ using assms injective_imp_isometric by blast
+ with assms show ?thesis
+ by (meson complete_eq_closed complete_isometric_image)
qed
@@ -2274,9 +2191,8 @@
show "closedin (top_of_set (range f)) (f ` S)"
using continuous_closedin_preimage [OF confg cgf] by simp
show "closed (range f)"
- apply (rule closed_injective_image_subspace)
- using f apply (auto simp: linear_linear linear_injective_0)
- done
+ using closed_injective_image_subspace f linear_conv_bounded_linear
+ linear_injective_0 subspace_UNIV by blast
qed
qed
@@ -2289,25 +2205,28 @@
lemma closure_injective_linear_image:
fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
shows "\<lbrakk>linear f; inj f\<rbrakk> \<Longrightarrow> f ` (closure S) = closure (f ` S)"
- apply (rule subset_antisym)
- apply (simp add: closure_linear_image_subset)
- by (simp add: closure_minimal closed_injective_linear_image closure_subset image_mono)
+ by (simp add: closed_injective_linear_image closure_linear_image_subset
+ closure_minimal closure_subset image_mono subset_antisym)
lemma closure_bounded_linear_image:
- fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
- shows "\<lbrakk>linear f; bounded S\<rbrakk> \<Longrightarrow> f ` (closure S) = closure (f ` S)"
- apply (rule subset_antisym, simp add: closure_linear_image_subset)
- apply (rule closure_minimal, simp add: closure_subset image_mono)
- by (meson bounded_closure closed_closure compact_continuous_image compact_eq_bounded_closed linear_continuous_on linear_conv_bounded_linear)
+ fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
+ assumes "linear f" "bounded S"
+ shows "f ` (closure S) = closure (f ` S)" (is "?lhs = ?rhs")
+proof
+ show "?lhs \<subseteq> ?rhs"
+ using assms closure_linear_image_subset by blast
+ show "?rhs \<subseteq> ?lhs"
+ using assms by (meson closure_minimal closure_subset compact_closure compact_eq_bounded_closed
+ compact_continuous_image image_mono linear_continuous_on linear_linear)
+qed
lemma closure_scaleR:
fixes S :: "'a::real_normed_vector set"
- shows "((*\<^sub>R) c) ` (closure S) = closure (((*\<^sub>R) c) ` S)"
+ shows "((*\<^sub>R) c) ` (closure S) = closure (((*\<^sub>R) c) ` S)" (is "?lhs = ?rhs")
proof
- show "((*\<^sub>R) c) ` (closure S) \<subseteq> closure (((*\<^sub>R) c) ` S)"
- using bounded_linear_scaleR_right
- by (rule closure_bounded_linear_image_subset)
- show "closure (((*\<^sub>R) c) ` S) \<subseteq> ((*\<^sub>R) c) ` (closure S)"
+ show "?lhs \<subseteq> ?rhs"
+ using bounded_linear_scaleR_right by (rule closure_bounded_linear_image_subset)
+ show "?rhs \<subseteq> ?lhs"
by (intro closure_minimal image_mono closure_subset closed_scaling closed_closure)
qed
@@ -2326,73 +2245,55 @@
qed
lemma closed_subspace:
- fixes s :: "'a::euclidean_space set"
- assumes "subspace s"
- shows "closed s"
+ fixes S :: "'a::euclidean_space set"
+ assumes "subspace S"
+ shows "closed S"
proof -
- have "dim s \<le> card (Basis :: 'a set)"
+ have "dim S \<le> card (Basis :: 'a set)"
using dim_subset_UNIV by auto
- with ex_card[OF this] obtain d :: "'a set" where t: "card d = dim s" and d: "d \<subseteq> Basis"
- by auto
+ with obtain_subset_with_card_n
+ obtain d :: "'a set" where cd: "card d = dim S" and d: "d \<subseteq> Basis"
+ by metis
let ?t = "{x::'a. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}"
- have "\<exists>f. linear f \<and> f ` {x::'a. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} = s \<and>
+ have "\<exists>f. linear f \<and> f ` {x::'a. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} = S \<and>
inj_on f {x::'a. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}"
- using dim_substandard[of d] t d assms
+ using dim_substandard[of d] cd d assms
by (intro subspace_isomorphism[OF subspace_substandard[of "\<lambda>i. i \<notin> d"]]) (auto simp: inner_Basis)
then obtain f where f:
"linear f"
- "f ` {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} = s"
+ "f ` {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} = S"
"inj_on f {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}"
by blast
interpret f: bounded_linear f
using f by (simp add: linear_conv_bounded_linear)
have "x \<in> ?t \<Longrightarrow> f x = 0 \<Longrightarrow> x = 0" for x
using f.zero d f(3)[THEN inj_onD, of x 0] by auto
- moreover have "closed ?t" by (rule closed_substandard)
- moreover have "subspace ?t" by (rule subspace_substandard)
- ultimately show ?thesis
- using closed_injective_image_subspace[of ?t f]
- unfolding f(2) using f(1) unfolding linear_conv_bounded_linear by auto
+ then show ?thesis
+ using closed_injective_image_subspace[of ?t f] closed_substandard subspace_substandard
+ using f(2) f.bounded_linear_axioms by force
qed
-lemma complete_subspace: "subspace s \<Longrightarrow> complete s"
- for s :: "'a::euclidean_space set"
+lemma complete_subspace: "subspace S \<Longrightarrow> complete S"
+ for S :: "'a::euclidean_space set"
using complete_eq_closed closed_subspace by auto
-lemma closed_span [iff]: "closed (span s)"
- for s :: "'a::euclidean_space set"
+lemma closed_span [iff]: "closed (span S)"
+ for S :: "'a::euclidean_space set"
by (simp add: closed_subspace)
-lemma dim_closure [simp]: "dim (closure s) = dim s" (is "?dc = ?d")
- for s :: "'a::euclidean_space set"
-proof -
- have "?dc \<le> ?d"
- using closure_minimal[OF span_superset, of s]
- using closed_subspace[OF subspace_span, of s]
- using dim_subset[of "closure s" "span s"]
- by simp
- then show ?thesis
- using dim_subset[OF closure_subset, of s]
- by simp
-qed
+lemma dim_closure [simp]: "dim (closure S) = dim S" (is "?dc = ?d")
+ for S :: "'a::euclidean_space set"
+ by (metis closed_span closure_minimal closure_subset dim_eq_span span_eq_dim span_superset subset_le_dim)
subsection \<open>Set Distance\<close>
lemma setdist_compact_closed:
fixes A :: "'a::heine_borel set"
- assumes A: "compact A" and B: "closed B"
+ assumes "compact A" "closed B"
and "A \<noteq> {}" "B \<noteq> {}"
shows "\<exists>x \<in> A. \<exists>y \<in> B. dist x y = setdist A B"
-proof -
- obtain x where "x \<in> A" "setdist A B = infdist x B"
- by (metis A assms(3) setdist_attains_inf setdist_sym)
- moreover
- obtain y where"y \<in> B" "infdist x B = dist x y"
- using B \<open>B \<noteq> {}\<close> infdist_attains_inf by blast
- ultimately show ?thesis
- using \<open>x \<in> A\<close> \<open>y \<in> B\<close> by auto
-qed
+ by (metis assms infdist_attains_inf setdist_attains_inf setdist_sym)
lemma setdist_closed_compact:
fixes S :: "'a::heine_borel set"
@@ -2406,14 +2307,10 @@
assumes S: "compact S" and T: "closed T"
shows "setdist S T = 0 \<longleftrightarrow> S = {} \<or> T = {} \<or> S \<inter> T \<noteq> {}"
proof (cases "S = {} \<or> T = {}")
- case True
- then show ?thesis
- by force
-next
case False
then show ?thesis
- by (metis S T disjoint_iff_not_equal in_closed_iff_infdist_zero setdist_attains_inf setdist_eq_0I setdist_sym)
-qed
+ by (metis S T disjoint_iff in_closed_iff_infdist_zero setdist_attains_inf setdist_eq_0I setdist_sym)
+qed auto
corollary setdist_gt_0_compact_closed:
assumes S: "compact S" and T: "closed T"