13 (* To be moved elsewhere *) |
13 (* To be moved elsewhere *) |
14 (* ------------------------------------------------------------------------- *) |
14 (* ------------------------------------------------------------------------- *) |
15 |
15 |
16 declare vector_add_ldistrib[simp] vector_ssub_ldistrib[simp] vector_smult_assoc[simp] vector_smult_rneg[simp] |
16 declare vector_add_ldistrib[simp] vector_ssub_ldistrib[simp] vector_smult_assoc[simp] vector_smult_rneg[simp] |
17 declare vector_sadd_rdistrib[simp] vector_sub_rdistrib[simp] |
17 declare vector_sadd_rdistrib[simp] vector_sub_rdistrib[simp] |
18 declare UNIV_1[simp] |
|
19 |
18 |
20 (*lemma dim1in[intro]:"Suc 0 \<in> {1::nat .. CARD(1)}" by auto*) |
19 (*lemma dim1in[intro]:"Suc 0 \<in> {1::nat .. CARD(1)}" by auto*) |
21 |
20 |
22 lemmas vector_component_simps = vector_minus_component vector_smult_component vector_add_component vector_le_def Cart_lambda_beta basis_component vector_uminus_component |
21 lemmas vector_component_simps = vector_minus_component vector_smult_component vector_add_component vector_le_def Cart_lambda_beta basis_component vector_uminus_component |
23 |
|
24 lemma dest_vec1_simps[simp]: fixes a::"real^1" |
|
25 shows "a$1 = 0 \<longleftrightarrow> a = 0" (*"a \<le> 1 \<longleftrightarrow> dest_vec1 a \<le> 1" "0 \<le> a \<longleftrightarrow> 0 \<le> dest_vec1 a"*) |
|
26 "a \<le> b \<longleftrightarrow> dest_vec1 a \<le> dest_vec1 b" "dest_vec1 (1::real^1) = 1" |
|
27 by(auto simp add: vector_le_def Cart_eq) |
|
28 |
22 |
29 lemma norm_not_0:"(x::real^'n)\<noteq>0 \<Longrightarrow> norm x \<noteq> 0" by auto |
23 lemma norm_not_0:"(x::real^'n)\<noteq>0 \<Longrightarrow> norm x \<noteq> 0" by auto |
30 |
24 |
31 lemma setsum_delta_notmem: assumes "x\<notin>s" |
25 lemma setsum_delta_notmem: assumes "x\<notin>s" |
32 shows "setsum (\<lambda>y. if (y = x) then P x else Q y) s = setsum Q s" |
26 shows "setsum (\<lambda>y. if (y = x) then P x else Q y) s = setsum Q s" |
45 |
39 |
46 lemma not_disjointI:"x\<in>A \<Longrightarrow> x\<in>B \<Longrightarrow> A \<inter> B \<noteq> {}" by blast |
40 lemma not_disjointI:"x\<in>A \<Longrightarrow> x\<in>B \<Longrightarrow> A \<inter> B \<noteq> {}" by blast |
47 |
41 |
48 lemma if_smult:"(if P then x else (y::real)) *\<^sub>R v = (if P then x *\<^sub>R v else y *\<^sub>R v)" by auto |
42 lemma if_smult:"(if P then x else (y::real)) *\<^sub>R v = (if P then x *\<^sub>R v else y *\<^sub>R v)" by auto |
49 |
43 |
50 lemma mem_interval_1: fixes x :: "real^1" shows |
|
51 "(x \<in> {a .. b} \<longleftrightarrow> dest_vec1 a \<le> dest_vec1 x \<and> dest_vec1 x \<le> dest_vec1 b)" |
|
52 "(x \<in> {a<..<b} \<longleftrightarrow> dest_vec1 a < dest_vec1 x \<and> dest_vec1 x < dest_vec1 b)" |
|
53 by(simp_all add: Cart_eq vector_less_def vector_le_def) |
|
54 |
|
55 lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::real^'n)) ` {a..b} = |
44 lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::real^'n)) ` {a..b} = |
56 (if {a..b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a..m *\<^sub>R b} else {m *\<^sub>R b..m *\<^sub>R a})" |
45 (if {a..b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a..m *\<^sub>R b} else {m *\<^sub>R b..m *\<^sub>R a})" |
57 using image_affinity_interval[of m 0 a b] by auto |
46 using image_affinity_interval[of m 0 a b] by auto |
58 |
|
59 lemma dest_vec1_inverval: |
|
60 "dest_vec1 ` {a .. b} = {dest_vec1 a .. dest_vec1 b}" |
|
61 "dest_vec1 ` {a<.. b} = {dest_vec1 a<.. dest_vec1 b}" |
|
62 "dest_vec1 ` {a ..<b} = {dest_vec1 a ..<dest_vec1 b}" |
|
63 "dest_vec1 ` {a<..<b} = {dest_vec1 a<..<dest_vec1 b}" |
|
64 apply(rule_tac [!] equalityI) |
|
65 unfolding subset_eq Ball_def Bex_def mem_interval_1 image_iff |
|
66 apply(rule_tac [!] allI)apply(rule_tac [!] impI) |
|
67 apply(rule_tac[2] x="vec1 x" in exI)apply(rule_tac[4] x="vec1 x" in exI) |
|
68 apply(rule_tac[6] x="vec1 x" in exI)apply(rule_tac[8] x="vec1 x" in exI) |
|
69 by (auto simp add: vector_less_def vector_le_def) |
|
70 |
|
71 lemma dest_vec1_setsum: assumes "finite S" |
|
72 shows " dest_vec1 (setsum f S) = setsum (\<lambda>x. dest_vec1 (f x)) S" |
|
73 using dest_vec1_sum[OF assms] by auto |
|
74 |
47 |
75 lemma dist_triangle_eq: |
48 lemma dist_triangle_eq: |
76 fixes x y z :: "real ^ _" |
49 fixes x y z :: "real ^ _" |
77 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)" |
50 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)" |
78 proof- have *:"x - y + (y - z) = x - z" by auto |
51 proof- have *:"x - y + (y - z) = x - z" by auto |
1290 apply(rule_tac x="(\<lambda>v. v + (y - a)) ` t" in exI) apply(rule_tac x="\<lambda>v. u (v - (y - a))" in exI) |
1260 apply(rule_tac x="(\<lambda>v. v + (y - a)) ` t" in exI) apply(rule_tac x="\<lambda>v. u (v - (y - a))" in exI) |
1291 using obt(1, 3) by auto |
1261 using obt(1, 3) by auto |
1292 qed |
1262 qed |
1293 qed |
1263 qed |
1294 |
1264 |
1295 lemma open_dest_vec1_vimage: "open S \<Longrightarrow> open (dest_vec1 -` S)" |
|
1296 unfolding open_vector_def forall_1 by auto |
|
1297 |
|
1298 lemma tendsto_dest_vec1 [tendsto_intros]: |
|
1299 "(f ---> l) net \<Longrightarrow> ((\<lambda>x. dest_vec1 (f x)) ---> dest_vec1 l) net" |
|
1300 by(rule tendsto_Cart_nth) |
|
1301 |
|
1302 lemma continuous_dest_vec1: "continuous net f \<Longrightarrow> continuous net (\<lambda>x. dest_vec1 (f x))" |
|
1303 unfolding continuous_def by (rule tendsto_dest_vec1) |
|
1304 |
|
1305 (* TODO: move *) |
1265 (* TODO: move *) |
1306 lemma compact_real_interval: |
1266 lemma compact_real_interval: |
1307 fixes a b :: real shows "compact {a..b}" |
1267 fixes a b :: real shows "compact {a..b}" |
1308 proof - |
1268 proof (rule bounded_closed_imp_compact) |
1309 have "continuous_on {vec1 a .. vec1 b} dest_vec1" |
1269 have "\<forall>y\<in>{a..b}. dist a y \<le> dist a b" |
1310 unfolding continuous_on |
1270 unfolding dist_real_def by auto |
1311 by (simp add: tendsto_dest_vec1 Lim_at_within Lim_ident_at) |
1271 thus "bounded {a..b}" unfolding bounded_def by fast |
1312 moreover have "compact {vec1 a .. vec1 b}" by (rule compact_interval) |
1272 show "closed {a..b}" by (rule closed_real_atLeastAtMost) |
1313 ultimately have "compact (dest_vec1 ` {vec1 a .. vec1 b})" |
|
1314 by (rule compact_continuous_image) |
|
1315 also have "dest_vec1 ` {vec1 a .. vec1 b} = {a..b}" |
|
1316 by (auto simp add: image_def Bex_def exists_vec1) |
|
1317 finally show ?thesis . |
|
1318 qed |
1273 qed |
1319 |
1274 |
1320 lemma compact_convex_combinations: |
1275 lemma compact_convex_combinations: |
1321 fixes s t :: "'a::real_normed_vector set" |
1276 fixes s t :: "'a::real_normed_vector set" |
1322 assumes "compact s" "compact t" |
1277 assumes "compact s" "compact t" |
2013 assumes "compact s" "0 \<in> s" "x \<noteq> 0" |
1968 assumes "compact s" "0 \<in> s" "x \<noteq> 0" |
2014 obtains u where "0 \<le> u" "(u *\<^sub>R x) \<in> frontier s" "\<forall>v>u. (v *\<^sub>R x) \<notin> s" |
1969 obtains u where "0 \<le> u" "(u *\<^sub>R x) \<in> frontier s" "\<forall>v>u. (v *\<^sub>R x) \<notin> s" |
2015 proof- |
1970 proof- |
2016 obtain b where b:"b>0" "\<forall>x\<in>s. norm x \<le> b" using compact_imp_bounded[OF assms(1), unfolded bounded_pos] by auto |
1971 obtain b where b:"b>0" "\<forall>x\<in>s. norm x \<le> b" using compact_imp_bounded[OF assms(1), unfolded bounded_pos] by auto |
2017 let ?A = "{y. \<exists>u. 0 \<le> u \<and> u \<le> b / norm(x) \<and> (y = u *\<^sub>R x)}" |
1972 let ?A = "{y. \<exists>u. 0 \<le> u \<and> u \<le> b / norm(x) \<and> (y = u *\<^sub>R x)}" |
2018 have A:"?A = (\<lambda>u. dest_vec1 u *\<^sub>R x) ` {0 .. vec1 (b / norm x)}" |
1973 have A:"?A = (\<lambda>u. u *\<^sub>R x) ` {0 .. b / norm x}" |
2019 unfolding image_image[of "\<lambda>u. u *\<^sub>R x" "\<lambda>x. dest_vec1 x", THEN sym] |
1974 by auto |
2020 unfolding dest_vec1_inverval vec1_dest_vec1 by auto |
|
2021 have "compact ?A" unfolding A apply(rule compact_continuous_image, rule continuous_at_imp_continuous_on) |
1975 have "compact ?A" unfolding A apply(rule compact_continuous_image, rule continuous_at_imp_continuous_on) |
2022 apply(rule, rule continuous_vmul) |
1976 apply(rule, rule continuous_vmul) |
2023 apply (rule continuous_dest_vec1) |
1977 apply(rule continuous_at_id) by(rule compact_real_interval) |
2024 apply(rule continuous_at_id) by(rule compact_interval) |
|
2025 moreover have "{y. \<exists>u\<ge>0. u \<le> b / norm x \<and> y = u *\<^sub>R x} \<inter> s \<noteq> {}" apply(rule not_disjointI[OF _ assms(2)]) |
1978 moreover have "{y. \<exists>u\<ge>0. u \<le> b / norm x \<and> y = u *\<^sub>R x} \<inter> s \<noteq> {}" apply(rule not_disjointI[OF _ assms(2)]) |
2026 unfolding mem_Collect_eq using `b>0` assms(3) by(auto intro!: divide_nonneg_pos) |
1979 unfolding mem_Collect_eq using `b>0` assms(3) by(auto intro!: divide_nonneg_pos) |
2027 ultimately obtain u y where obt: "u\<ge>0" "u \<le> b / norm x" "y = u *\<^sub>R x" |
1980 ultimately obtain u y where obt: "u\<ge>0" "u \<le> b / norm x" "y = u *\<^sub>R x" |
2028 "y\<in>?A" "y\<in>s" "\<forall>z\<in>?A \<inter> s. dist 0 z \<le> dist 0 y" using distance_attains_sup[OF compact_inter[OF _ assms(1), of ?A], of 0] by auto |
1981 "y\<in>?A" "y\<in>s" "\<forall>z\<in>?A \<inter> s. dist 0 z \<le> dist 0 y" using distance_attains_sup[OF compact_inter[OF _ assms(1), of ?A], of 0] by auto |
2029 |
1982 |
2230 |
2183 |
2231 definition "epigraph s (f::_ \<Rightarrow> real) = {xy. fst xy \<in> s \<and> f (fst xy) \<le> snd xy}" |
2184 definition "epigraph s (f::_ \<Rightarrow> real) = {xy. fst xy \<in> s \<and> f (fst xy) \<le> snd xy}" |
2232 |
2185 |
2233 lemma mem_epigraph: "(x, y) \<in> epigraph s f \<longleftrightarrow> x \<in> s \<and> f x \<le> y" unfolding epigraph_def by auto |
2186 lemma mem_epigraph: "(x, y) \<in> epigraph s f \<longleftrightarrow> x \<in> s \<and> f x \<le> y" unfolding epigraph_def by auto |
2234 |
2187 |
2235 (** move this**) |
|
2236 lemma forall_dest_vec1: "(\<forall>x. P x) \<longleftrightarrow> (\<forall>x. P(dest_vec1 x))" |
|
2237 apply safe defer apply(erule_tac x="vec1 x" in allE) by auto |
|
2238 |
|
2239 (** This might break sooner or later. In fact it did already once. **) |
2188 (** This might break sooner or later. In fact it did already once. **) |
2240 lemma convex_epigraph: |
2189 lemma convex_epigraph: |
2241 "convex(epigraph s f) \<longleftrightarrow> convex_on s f \<and> convex s" |
2190 "convex(epigraph s f) \<longleftrightarrow> convex_on s f \<and> convex s" |
2242 unfolding convex_def convex_on_def |
2191 unfolding convex_def convex_on_def |
2243 unfolding Ball_def split_paired_All epigraph_def |
2192 unfolding Ball_def split_paired_All epigraph_def |
2262 |
2211 |
2263 lemma forall_of_pastecart': |
2212 lemma forall_of_pastecart': |
2264 "(\<forall>p. P (fstcart p) (sndcart p)) \<longleftrightarrow> (\<forall>x y. P x y)" apply meson |
2213 "(\<forall>p. P (fstcart p) (sndcart p)) \<longleftrightarrow> (\<forall>x y. P x y)" apply meson |
2265 apply(erule_tac x="pastecart x y" in allE) unfolding o_def by auto |
2214 apply(erule_tac x="pastecart x y" in allE) unfolding o_def by auto |
2266 |
2215 |
2267 lemma forall_of_dest_vec1: "(\<forall>v. P (\<lambda>x. dest_vec1 (v x))) \<longleftrightarrow> (\<forall>x. P x)" |
2216 (* TODO: move *) |
2268 apply rule apply rule apply(erule_tac x="(vec1 \<circ> x)" in allE) unfolding o_def vec1_dest_vec1 by auto |
|
2269 |
|
2270 lemma forall_of_dest_vec1': "(\<forall>v. P (dest_vec1 v)) \<longleftrightarrow> (\<forall>x. P x)" |
|
2271 apply rule apply rule apply(erule_tac x="(vec1 x)" in allE) defer apply rule |
|
2272 apply(erule_tac x="dest_vec1 v" in allE) unfolding o_def vec1_dest_vec1 by auto |
|
2273 |
|
2274 lemma fst_setsum: "fst (\<Sum>x\<in>A. f x) = (\<Sum>x\<in>A. fst (f x))" |
2217 lemma fst_setsum: "fst (\<Sum>x\<in>A. f x) = (\<Sum>x\<in>A. fst (f x))" |
2275 by (cases "finite A", induct set: finite, simp_all) |
2218 by (cases "finite A", induct set: finite, simp_all) |
2276 |
2219 |
|
2220 (* TODO: move *) |
2277 lemma snd_setsum: "snd (\<Sum>x\<in>A. f x) = (\<Sum>x\<in>A. snd (f x))" |
2221 lemma snd_setsum: "snd (\<Sum>x\<in>A. f x) = (\<Sum>x\<in>A. snd (f x))" |
2278 by (cases "finite A", induct set: finite, simp_all) |
2222 by (cases "finite A", induct set: finite, simp_all) |
2279 |
2223 |
2280 lemma convex_on: |
2224 lemma convex_on: |
2281 assumes "convex s" |
2225 assumes "convex s" |
2320 using is_interval_convex convex_connected by auto |
2264 using is_interval_convex convex_connected by auto |
2321 |
2265 |
2322 lemma convex_interval: "convex {a .. b}" "convex {a<..<b::real^'n}" |
2266 lemma convex_interval: "convex {a .. b}" "convex {a<..<b::real^'n}" |
2323 apply(rule_tac[!] is_interval_convex) using is_interval_interval by auto |
2267 apply(rule_tac[!] is_interval_convex) using is_interval_interval by auto |
2324 |
2268 |
|
2269 (* FIXME: rewrite these lemmas without using vec1 |
2325 subsection {* On @{text "real^1"}, @{text "is_interval"}, @{text "convex"} and @{text "connected"} are all equivalent. *} |
2270 subsection {* On @{text "real^1"}, @{text "is_interval"}, @{text "convex"} and @{text "connected"} are all equivalent. *} |
2326 |
2271 |
2327 lemma is_interval_1: |
2272 lemma is_interval_1: |
2328 "is_interval s \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. \<forall> x. dest_vec1 a \<le> dest_vec1 x \<and> dest_vec1 x \<le> dest_vec1 b \<longrightarrow> x \<in> s)" |
2273 "is_interval s \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. \<forall> x. dest_vec1 a \<le> dest_vec1 x \<and> dest_vec1 x \<le> dest_vec1 b \<longrightarrow> x \<in> s)" |
2329 unfolding is_interval_def forall_1 by auto |
2274 unfolding is_interval_def forall_1 by auto |
2348 by(metis is_interval_convex convex_connected is_interval_connected_1) |
2293 by(metis is_interval_convex convex_connected is_interval_connected_1) |
2349 |
2294 |
2350 lemma convex_connected_1: |
2295 lemma convex_connected_1: |
2351 "connected s \<longleftrightarrow> convex (s::(real^1) set)" |
2296 "connected s \<longleftrightarrow> convex (s::(real^1) set)" |
2352 by(metis is_interval_convex convex_connected is_interval_connected_1) |
2297 by(metis is_interval_convex convex_connected is_interval_connected_1) |
2353 |
2298 *) |
2354 subsection {* Another intermediate value theorem formulation. *} |
2299 subsection {* Another intermediate value theorem formulation. *} |
2355 |
2300 |
2356 lemma ivt_increasing_component_on_1: fixes f::"real^1 \<Rightarrow> real^'n" |
2301 lemma ivt_increasing_component_on_1: fixes f::"real \<Rightarrow> real^'n" |
2357 assumes "dest_vec1 a \<le> dest_vec1 b" "continuous_on {a .. b} f" "(f a)$k \<le> y" "y \<le> (f b)$k" |
2302 assumes "a \<le> b" "continuous_on {a .. b} f" "(f a)$k \<le> y" "y \<le> (f b)$k" |
2358 shows "\<exists>x\<in>{a..b}. (f x)$k = y" |
2303 shows "\<exists>x\<in>{a..b}. (f x)$k = y" |
2359 proof- have "f a \<in> f ` {a..b}" "f b \<in> f ` {a..b}" apply(rule_tac[!] imageI) |
2304 proof- have "f a \<in> f ` {a..b}" "f b \<in> f ` {a..b}" apply(rule_tac[!] imageI) |
2360 using assms(1) by(auto simp add: vector_le_def) |
2305 using assms(1) by(auto simp add: vector_le_def) |
2361 thus ?thesis using connected_ivt_component[of "f ` {a..b}" "f a" "f b" k y] |
2306 thus ?thesis using connected_ivt_component[of "f ` {a..b}" "f a" "f b" k y] |
2362 using connected_continuous_image[OF assms(2) convex_connected[OF convex_interval(1)]] |
2307 using connected_continuous_image[OF assms(2) convex_connected[OF convex_real_interval(5)]] |
2363 using assms by(auto intro!: imageI) qed |
2308 using assms by(auto intro!: imageI) qed |
2364 |
2309 |
2365 lemma ivt_increasing_component_1: fixes f::"real^1 \<Rightarrow> real^'n" |
2310 lemma ivt_increasing_component_1: fixes f::"real \<Rightarrow> real^'n" |
2366 shows "dest_vec1 a \<le> dest_vec1 b \<Longrightarrow> \<forall>x\<in>{a .. b}. continuous (at x) f |
2311 shows "a \<le> b \<Longrightarrow> \<forall>x\<in>{a .. b}. continuous (at x) f |
2367 \<Longrightarrow> f a$k \<le> y \<Longrightarrow> y \<le> f b$k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)$k = y" |
2312 \<Longrightarrow> f a$k \<le> y \<Longrightarrow> y \<le> f b$k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)$k = y" |
2368 by(rule ivt_increasing_component_on_1) |
2313 by(rule ivt_increasing_component_on_1) |
2369 (auto simp add: continuous_at_imp_continuous_on) |
2314 (auto simp add: continuous_at_imp_continuous_on) |
2370 |
2315 |
2371 lemma ivt_decreasing_component_on_1: fixes f::"real^1 \<Rightarrow> real^'n" |
2316 lemma ivt_decreasing_component_on_1: fixes f::"real \<Rightarrow> real^'n" |
2372 assumes "dest_vec1 a \<le> dest_vec1 b" "continuous_on {a .. b} f" "(f b)$k \<le> y" "y \<le> (f a)$k" |
2317 assumes "a \<le> b" "continuous_on {a .. b} f" "(f b)$k \<le> y" "y \<le> (f a)$k" |
2373 shows "\<exists>x\<in>{a..b}. (f x)$k = y" |
2318 shows "\<exists>x\<in>{a..b}. (f x)$k = y" |
2374 apply(subst neg_equal_iff_equal[THEN sym]) unfolding vector_uminus_component[THEN sym] |
2319 apply(subst neg_equal_iff_equal[THEN sym]) unfolding vector_uminus_component[THEN sym] |
2375 apply(rule ivt_increasing_component_on_1) using assms using continuous_on_neg |
2320 apply(rule ivt_increasing_component_on_1) using assms using continuous_on_neg |
2376 by auto |
2321 by auto |
2377 |
2322 |
2378 lemma ivt_decreasing_component_1: fixes f::"real^1 \<Rightarrow> real^'n" |
2323 lemma ivt_decreasing_component_1: fixes f::"real \<Rightarrow> real^'n" |
2379 shows "dest_vec1 a \<le> dest_vec1 b \<Longrightarrow> \<forall>x\<in>{a .. b}. continuous (at x) f |
2324 shows "a \<le> b \<Longrightarrow> \<forall>x\<in>{a .. b}. continuous (at x) f |
2380 \<Longrightarrow> f b$k \<le> y \<Longrightarrow> y \<le> f a$k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)$k = y" |
2325 \<Longrightarrow> f b$k \<le> y \<Longrightarrow> y \<le> f a$k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)$k = y" |
2381 by(rule ivt_decreasing_component_on_1) |
2326 by(rule ivt_decreasing_component_on_1) |
2382 (auto simp: continuous_at_imp_continuous_on) |
2327 (auto simp: continuous_at_imp_continuous_on) |
2383 |
2328 |
2384 subsection {* A bound within a convex hull, and so an interval. *} |
2329 subsection {* A bound within a convex hull, and so an interval. *} |
3035 using assms and path_image_join_subset[of g1 g2] by auto |
2980 using assms and path_image_join_subset[of g1 g2] by auto |
3036 |
2981 |
3037 lemma simple_path_reversepath: assumes "simple_path g" shows "simple_path (reversepath g)" |
2982 lemma simple_path_reversepath: assumes "simple_path g" shows "simple_path (reversepath g)" |
3038 using assms unfolding simple_path_def reversepath_def apply- apply(rule ballI)+ |
2983 using assms unfolding simple_path_def reversepath_def apply- apply(rule ballI)+ |
3039 apply(erule_tac x="1-x" in ballE, erule_tac x="1-y" in ballE) |
2984 apply(erule_tac x="1-x" in ballE, erule_tac x="1-y" in ballE) |
3040 unfolding mem_interval_1 by auto |
2985 by auto |
3041 |
2986 |
3042 lemma simple_path_join_loop: |
2987 lemma simple_path_join_loop: |
3043 assumes "injective_path g1" "injective_path g2" "pathfinish g2 = pathstart g1" |
2988 assumes "injective_path g1" "injective_path g2" "pathfinish g2 = pathstart g1" |
3044 "(path_image g1 \<inter> path_image g2) \<subseteq> {pathstart g1,pathstart g2}" |
2989 "(path_image g1 \<inter> path_image g2) \<subseteq> {pathstart g1,pathstart g2}" |
3045 shows "simple_path(g1 +++ g2)" |
2990 shows "simple_path(g1 +++ g2)" |
3048 fix x y::"real" assume xy:"x \<in> {0..1}" "y \<in> {0..1}" "?g x = ?g y" |
2993 fix x y::"real" assume xy:"x \<in> {0..1}" "y \<in> {0..1}" "?g x = ?g y" |
3049 show "x = y \<or> x = 0 \<and> y = 1 \<or> x = 1 \<and> y = 0" proof(case_tac "x \<le> 1/2",case_tac[!] "y \<le> 1/2", unfold not_le) |
2994 show "x = y \<or> x = 0 \<and> y = 1 \<or> x = 1 \<and> y = 0" proof(case_tac "x \<le> 1/2",case_tac[!] "y \<le> 1/2", unfold not_le) |
3050 assume as:"x \<le> 1 / 2" "y \<le> 1 / 2" |
2995 assume as:"x \<le> 1 / 2" "y \<le> 1 / 2" |
3051 hence "g1 (2 *\<^sub>R x) = g1 (2 *\<^sub>R y)" using xy(3) unfolding joinpaths_def by auto |
2996 hence "g1 (2 *\<^sub>R x) = g1 (2 *\<^sub>R y)" using xy(3) unfolding joinpaths_def by auto |
3052 moreover have "2 *\<^sub>R x \<in> {0..1}" "2 *\<^sub>R y \<in> {0..1}" using xy(1,2) as |
2997 moreover have "2 *\<^sub>R x \<in> {0..1}" "2 *\<^sub>R y \<in> {0..1}" using xy(1,2) as |
3053 unfolding mem_interval_1 by auto |
2998 by auto |
3054 ultimately show ?thesis using inj(1)[of "2*\<^sub>R x" "2*\<^sub>R y"] by auto |
2999 ultimately show ?thesis using inj(1)[of "2*\<^sub>R x" "2*\<^sub>R y"] by auto |
3055 next assume as:"x > 1 / 2" "y > 1 / 2" |
3000 next assume as:"x > 1 / 2" "y > 1 / 2" |
3056 hence "g2 (2 *\<^sub>R x - 1) = g2 (2 *\<^sub>R y - 1)" using xy(3) unfolding joinpaths_def by auto |
3001 hence "g2 (2 *\<^sub>R x - 1) = g2 (2 *\<^sub>R y - 1)" using xy(3) unfolding joinpaths_def by auto |
3057 moreover have "2 *\<^sub>R x - 1 \<in> {0..1}" "2 *\<^sub>R y - 1 \<in> {0..1}" using xy(1,2) as unfolding mem_interval_1 by auto |
3002 moreover have "2 *\<^sub>R x - 1 \<in> {0..1}" "2 *\<^sub>R y - 1 \<in> {0..1}" using xy(1,2) as by auto |
3058 ultimately show ?thesis using inj(2)[of "2*\<^sub>R x - 1" "2*\<^sub>R y - 1"] by auto |
3003 ultimately show ?thesis using inj(2)[of "2*\<^sub>R x - 1" "2*\<^sub>R y - 1"] by auto |
3059 next assume as:"x \<le> 1 / 2" "y > 1 / 2" |
3004 next assume as:"x \<le> 1 / 2" "y > 1 / 2" |
3060 hence "?g x \<in> path_image g1" "?g y \<in> path_image g2" unfolding path_image_def joinpaths_def |
3005 hence "?g x \<in> path_image g1" "?g y \<in> path_image g2" unfolding path_image_def joinpaths_def |
3061 using xy(1,2)[unfolded mem_interval_1] by auto |
3006 using xy(1,2) by auto |
3062 moreover have "?g y \<noteq> pathstart g2" using as(2) unfolding pathstart_def joinpaths_def |
3007 moreover have "?g y \<noteq> pathstart g2" using as(2) unfolding pathstart_def joinpaths_def |
3063 using inj(2)[of "2 *\<^sub>R y - 1" 0] and xy(2)[unfolded mem_interval_1] |
3008 using inj(2)[of "2 *\<^sub>R y - 1" 0] and xy(2) |
3064 by (auto simp add: field_simps) |
3009 by (auto simp add: field_simps) |
3065 ultimately have *:"?g x = pathstart g1" using assms(4) unfolding xy(3) by auto |
3010 ultimately have *:"?g x = pathstart g1" using assms(4) unfolding xy(3) by auto |
3066 hence "x = 0" unfolding pathstart_def joinpaths_def using as(1) and xy(1)[unfolded mem_interval_1] |
3011 hence "x = 0" unfolding pathstart_def joinpaths_def using as(1) and xy(1) |
3067 using inj(1)[of "2 *\<^sub>R x" 0] by auto |
3012 using inj(1)[of "2 *\<^sub>R x" 0] by auto |
3068 moreover have "y = 1" using * unfolding xy(3) assms(3)[THEN sym] |
3013 moreover have "y = 1" using * unfolding xy(3) assms(3)[THEN sym] |
3069 unfolding joinpaths_def pathfinish_def using as(2) and xy(2)[unfolded mem_interval_1] |
3014 unfolding joinpaths_def pathfinish_def using as(2) and xy(2) |
3070 using inj(2)[of "2 *\<^sub>R y - 1" 1] by auto |
3015 using inj(2)[of "2 *\<^sub>R y - 1" 1] by auto |
3071 ultimately show ?thesis by auto |
3016 ultimately show ?thesis by auto |
3072 next assume as:"x > 1 / 2" "y \<le> 1 / 2" |
3017 next assume as:"x > 1 / 2" "y \<le> 1 / 2" |
3073 hence "?g x \<in> path_image g2" "?g y \<in> path_image g1" unfolding path_image_def joinpaths_def |
3018 hence "?g x \<in> path_image g2" "?g y \<in> path_image g1" unfolding path_image_def joinpaths_def |
3074 using xy(1,2)[unfolded mem_interval_1] by auto |
3019 using xy(1,2) by auto |
3075 moreover have "?g x \<noteq> pathstart g2" using as(1) unfolding pathstart_def joinpaths_def |
3020 moreover have "?g x \<noteq> pathstart g2" using as(1) unfolding pathstart_def joinpaths_def |
3076 using inj(2)[of "2 *\<^sub>R x - 1" 0] and xy(1)[unfolded mem_interval_1] |
3021 using inj(2)[of "2 *\<^sub>R x - 1" 0] and xy(1) |
3077 by (auto simp add: field_simps) |
3022 by (auto simp add: field_simps) |
3078 ultimately have *:"?g y = pathstart g1" using assms(4) unfolding xy(3) by auto |
3023 ultimately have *:"?g y = pathstart g1" using assms(4) unfolding xy(3) by auto |
3079 hence "y = 0" unfolding pathstart_def joinpaths_def using as(2) and xy(2)[unfolded mem_interval_1] |
3024 hence "y = 0" unfolding pathstart_def joinpaths_def using as(2) and xy(2) |
3080 using inj(1)[of "2 *\<^sub>R y" 0] by auto |
3025 using inj(1)[of "2 *\<^sub>R y" 0] by auto |
3081 moreover have "x = 1" using * unfolding xy(3)[THEN sym] assms(3)[THEN sym] |
3026 moreover have "x = 1" using * unfolding xy(3)[THEN sym] assms(3)[THEN sym] |
3082 unfolding joinpaths_def pathfinish_def using as(1) and xy(1)[unfolded mem_interval_1] |
3027 unfolding joinpaths_def pathfinish_def using as(1) and xy(1) |
3083 using inj(2)[of "2 *\<^sub>R x - 1" 1] by auto |
3028 using inj(2)[of "2 *\<^sub>R x - 1" 1] by auto |
3084 ultimately show ?thesis by auto qed qed |
3029 ultimately show ?thesis by auto qed qed |
3085 |
3030 |
3086 lemma injective_path_join: |
3031 lemma injective_path_join: |
3087 assumes "injective_path g1" "injective_path g2" "pathfinish g1 = pathstart g2" |
3032 assumes "injective_path g1" "injective_path g2" "pathfinish g1 = pathstart g2" |
3090 unfolding injective_path_def proof(rule,rule,rule) let ?g = "g1 +++ g2" |
3035 unfolding injective_path_def proof(rule,rule,rule) let ?g = "g1 +++ g2" |
3091 note inj = assms(1,2)[unfolded injective_path_def, rule_format] |
3036 note inj = assms(1,2)[unfolded injective_path_def, rule_format] |
3092 fix x y assume xy:"x \<in> {0..1}" "y \<in> {0..1}" "(g1 +++ g2) x = (g1 +++ g2) y" |
3037 fix x y assume xy:"x \<in> {0..1}" "y \<in> {0..1}" "(g1 +++ g2) x = (g1 +++ g2) y" |
3093 show "x = y" proof(cases "x \<le> 1/2", case_tac[!] "y \<le> 1/2", unfold not_le) |
3038 show "x = y" proof(cases "x \<le> 1/2", case_tac[!] "y \<le> 1/2", unfold not_le) |
3094 assume "x \<le> 1 / 2" "y \<le> 1 / 2" thus ?thesis using inj(1)[of "2*\<^sub>R x" "2*\<^sub>R y"] and xy |
3039 assume "x \<le> 1 / 2" "y \<le> 1 / 2" thus ?thesis using inj(1)[of "2*\<^sub>R x" "2*\<^sub>R y"] and xy |
3095 unfolding mem_interval_1 joinpaths_def by auto |
3040 unfolding joinpaths_def by auto |
3096 next assume "x > 1 / 2" "y > 1 / 2" thus ?thesis using inj(2)[of "2*\<^sub>R x - 1" "2*\<^sub>R y - 1"] and xy |
3041 next assume "x > 1 / 2" "y > 1 / 2" thus ?thesis using inj(2)[of "2*\<^sub>R x - 1" "2*\<^sub>R y - 1"] and xy |
3097 unfolding mem_interval_1 joinpaths_def by auto |
3042 unfolding joinpaths_def by auto |
3098 next assume as:"x \<le> 1 / 2" "y > 1 / 2" |
3043 next assume as:"x \<le> 1 / 2" "y > 1 / 2" |
3099 hence "?g x \<in> path_image g1" "?g y \<in> path_image g2" unfolding path_image_def joinpaths_def |
3044 hence "?g x \<in> path_image g1" "?g y \<in> path_image g2" unfolding path_image_def joinpaths_def |
3100 using xy(1,2)[unfolded mem_interval_1] by auto |
3045 using xy(1,2) by auto |
3101 hence "?g x = pathfinish g1" "?g y = pathstart g2" using assms(4) unfolding assms(3) xy(3) by auto |
3046 hence "?g x = pathfinish g1" "?g y = pathstart g2" using assms(4) unfolding assms(3) xy(3) by auto |
3102 thus ?thesis using as and inj(1)[of "2 *\<^sub>R x" 1] inj(2)[of "2 *\<^sub>R y - 1" 0] and xy(1,2) |
3047 thus ?thesis using as and inj(1)[of "2 *\<^sub>R x" 1] inj(2)[of "2 *\<^sub>R y - 1" 0] and xy(1,2) |
3103 unfolding pathstart_def pathfinish_def joinpaths_def mem_interval_1 |
3048 unfolding pathstart_def pathfinish_def joinpaths_def |
3104 by auto |
3049 by auto |
3105 next assume as:"x > 1 / 2" "y \<le> 1 / 2" |
3050 next assume as:"x > 1 / 2" "y \<le> 1 / 2" |
3106 hence "?g x \<in> path_image g2" "?g y \<in> path_image g1" unfolding path_image_def joinpaths_def |
3051 hence "?g x \<in> path_image g2" "?g y \<in> path_image g1" unfolding path_image_def joinpaths_def |
3107 using xy(1,2)[unfolded mem_interval_1] by auto |
3052 using xy(1,2) by auto |
3108 hence "?g x = pathstart g2" "?g y = pathfinish g1" using assms(4) unfolding assms(3) xy(3) by auto |
3053 hence "?g x = pathstart g2" "?g y = pathfinish g1" using assms(4) unfolding assms(3) xy(3) by auto |
3109 thus ?thesis using as and inj(2)[of "2 *\<^sub>R x - 1" 0] inj(1)[of "2 *\<^sub>R y" 1] and xy(1,2) |
3054 thus ?thesis using as and inj(2)[of "2 *\<^sub>R x - 1" 0] inj(1)[of "2 *\<^sub>R y" 1] and xy(1,2) |
3110 unfolding pathstart_def pathfinish_def joinpaths_def mem_interval_1 |
3055 unfolding pathstart_def pathfinish_def joinpaths_def |
3111 by auto qed qed |
3056 by auto qed qed |
3112 |
3057 |
3113 lemmas join_paths_simps = path_join path_image_join pathstart_join pathfinish_join |
3058 lemmas join_paths_simps = path_join path_image_join pathstart_join pathfinish_join |
3114 |
3059 |
3115 subsection {* Reparametrizing a closed curve to start at some chosen point. *} |
3060 subsection {* Reparametrizing a closed curve to start at some chosen point. *} |