src/HOL/Multivariate_Analysis/Path_Connected.thy
author wenzelm
Tue, 02 Jun 2015 09:10:05 +0200
changeset 60357 bc0827281dc1
parent 60303 00c06f1315d0
child 60420 884f54e01427
permissions -rw-r--r--
tuned proof;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41959
b460124855b8 tuned headers;
wenzelm
parents: 39302
diff changeset
     1
(*  Title:      HOL/Multivariate_Analysis/Path_Connected.thy
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
     2
    Author:     Robert Himmelmann, TU Muenchen, and LCP with material from HOL Light
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
     3
*)
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
     4
58877
262572d90bc6 modernized header;
wenzelm
parents: 56371
diff changeset
     5
section {* Continuous paths and path-connected sets *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
     6
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
     7
theory Path_Connected
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
     8
imports Convex_Euclidean_Space
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
     9
begin
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    10
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    11
(*FIXME move up?*)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    12
lemma image_add_atLeastAtMost [simp]:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    13
  fixes d::"'a::linordered_idom" shows "(op + d ` {a..b}) = {a+d..b+d}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    14
  apply auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    15
  apply (rule_tac x="x-d" in rev_image_eqI, auto)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    16
  done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    17
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    18
lemma image_diff_atLeastAtMost [simp]:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    19
  fixes d::"'a::linordered_idom" shows "(op - d ` {a..b}) = {d-b..d-a}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    20
  apply auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    21
  apply (rule_tac x="d-x" in rev_image_eqI, auto)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    22
  done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    23
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    24
lemma image_mult_atLeastAtMost [simp]:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    25
  fixes d::"'a::linordered_field"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    26
  assumes "d>0" shows "(op * d ` {a..b}) = {d*a..d*b}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    27
  using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    28
  apply auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    29
  apply (rule_tac x="x/d" in rev_image_eqI)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    30
  apply (auto simp: field_simps)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    31
  done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    32
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    33
lemma image_affinity_interval:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    34
  fixes c :: "'a::ordered_real_vector"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    35
  shows "((\<lambda>x. m *\<^sub>R x + c) ` {a..b}) = (if {a..b}={} then {}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    36
            else if 0 <= m then {m *\<^sub>R a + c .. m  *\<^sub>R b + c}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    37
            else {m *\<^sub>R b + c .. m *\<^sub>R a + c})"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    38
  apply (case_tac "m=0", force)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    39
  apply (auto simp: scaleR_left_mono)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    40
  apply (rule_tac x="inverse m *\<^sub>R (x-c)" in rev_image_eqI, auto simp: pos_le_divideR_eq le_diff_eq scaleR_left_mono_neg)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    41
  apply (metis diff_le_eq inverse_inverse_eq order.not_eq_order_implies_strict pos_le_divideR_eq positive_imp_inverse_positive)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    42
  apply (rule_tac x="inverse m *\<^sub>R (x-c)" in rev_image_eqI, auto simp: not_le neg_le_divideR_eq diff_le_eq)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    43
  using le_diff_eq scaleR_le_cancel_left_neg 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    44
  apply fastforce
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    45
  done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    46
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    47
lemma image_affinity_atLeastAtMost:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    48
  fixes c :: "'a::linordered_field"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    49
  shows "((\<lambda>x. m*x + c) ` {a..b}) = (if {a..b}={} then {}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    50
            else if 0 \<le> m then {m*a + c .. m *b + c}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    51
            else {m*b + c .. m*a + c})"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    52
  apply (case_tac "m=0", auto)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    53
  apply (rule_tac x="inverse m*(x-c)" in rev_image_eqI, auto simp: field_simps)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    54
  apply (rule_tac x="inverse m*(x-c)" in rev_image_eqI, auto simp: field_simps)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    55
  done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    56
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    57
lemma image_affinity_atLeastAtMost_diff:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    58
  fixes c :: "'a::linordered_field"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    59
  shows "((\<lambda>x. m*x - c) ` {a..b}) = (if {a..b}={} then {}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    60
            else if 0 \<le> m then {m*a - c .. m*b - c}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    61
            else {m*b - c .. m*a - c})"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    62
  using image_affinity_atLeastAtMost [of m "-c" a b]
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    63
  by simp
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    64
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    65
lemma image_affinity_atLeastAtMost_div_diff:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    66
  fixes c :: "'a::linordered_field"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    67
  shows "((\<lambda>x. x/m - c) ` {a..b}) = (if {a..b}={} then {}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    68
            else if 0 \<le> m then {a/m - c .. b/m - c}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    69
            else {b/m - c .. a/m - c})"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    70
  using image_affinity_atLeastAtMost_diff [of "inverse m" c a b]
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    71
  by (simp add: field_class.field_divide_inverse algebra_simps)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    72
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    73
lemma closed_segment_real_eq:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    74
  fixes u::real shows "closed_segment u v = (\<lambda>x. (v - u) * x + u) ` {0..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    75
  by (simp add: add.commute [of u] image_affinity_atLeastAtMost [where c=u] closed_segment_eq_real_ivl)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    76
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
    77
subsection {* Paths and Arcs *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    78
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    79
definition path :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> bool"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    80
  where "path g \<longleftrightarrow> continuous_on {0..1} g"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    81
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    82
definition pathstart :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> 'a"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    83
  where "pathstart g = g 0"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    84
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    85
definition pathfinish :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> 'a"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    86
  where "pathfinish g = g 1"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    87
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    88
definition path_image :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> 'a set"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    89
  where "path_image g = g ` {0 .. 1}"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    90
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    91
definition reversepath :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> real \<Rightarrow> 'a"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    92
  where "reversepath g = (\<lambda>x. g(1 - x))"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    93
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    94
definition joinpaths :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> (real \<Rightarrow> 'a) \<Rightarrow> real \<Rightarrow> 'a"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    95
    (infixr "+++" 75)
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    96
  where "g1 +++ g2 = (\<lambda>x. if x \<le> 1/2 then g1 (2 * x) else g2 (2 * x - 1))"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    97
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    98
definition simple_path :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> bool"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    99
  where "simple_path g \<longleftrightarrow>
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   100
     path g \<and> (\<forall>x\<in>{0..1}. \<forall>y\<in>{0..1}. g x = g y \<longrightarrow> x = y \<or> x = 0 \<and> y = 1 \<or> x = 1 \<and> y = 0)"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   101
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   102
definition arc :: "(real \<Rightarrow> 'a :: topological_space) \<Rightarrow> bool"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   103
  where "arc g \<longleftrightarrow> path g \<and> inj_on g {0..1}"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   104
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   105
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   106
subsection{*Invariance theorems*}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   107
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   108
lemma path_eq: "path p \<Longrightarrow> (\<And>t. t \<in> {0..1} \<Longrightarrow> p t = q t) \<Longrightarrow> path q"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   109
  using continuous_on_eq path_def by blast
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   110
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   111
lemma path_continuous_image: "path g \<Longrightarrow> continuous_on (path_image g) f \<Longrightarrow> path(f o g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   112
  unfolding path_def path_image_def
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   113
  using continuous_on_compose by blast
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   114
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   115
lemma path_translation_eq:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   116
  fixes g :: "real \<Rightarrow> 'a :: real_normed_vector"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   117
  shows "path((\<lambda>x. a + x) o g) = path g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   118
proof -
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   119
  have g: "g = (\<lambda>x. -a + x) o ((\<lambda>x. a + x) o g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   120
    by (rule ext) simp
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   121
  show ?thesis
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   122
    unfolding path_def
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   123
    apply safe
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   124
    apply (subst g)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   125
    apply (rule continuous_on_compose)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   126
    apply (auto intro: continuous_intros)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   127
    done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   128
qed
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   129
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   130
lemma path_linear_image_eq:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   131
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   132
   assumes "linear f" "inj f"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   133
     shows "path(f o g) = path g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   134
proof -
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   135
  from linear_injective_left_inverse [OF assms]
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   136
  obtain h where h: "linear h" "h \<circ> f = id"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   137
    by blast
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   138
  then have g: "g = h o (f o g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   139
    by (metis comp_assoc id_comp)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   140
  show ?thesis
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   141
    unfolding path_def
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   142
    using h assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   143
    by (metis g continuous_on_compose linear_continuous_on linear_conv_bounded_linear)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   144
qed
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   145
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   146
lemma pathstart_translation: "pathstart((\<lambda>x. a + x) o g) = a + pathstart g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   147
  by (simp add: pathstart_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   148
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   149
lemma pathstart_linear_image_eq: "linear f \<Longrightarrow> pathstart(f o g) = f(pathstart g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   150
  by (simp add: pathstart_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   151
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   152
lemma pathfinish_translation: "pathfinish((\<lambda>x. a + x) o g) = a + pathfinish g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   153
  by (simp add: pathfinish_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   154
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   155
lemma pathfinish_linear_image: "linear f \<Longrightarrow> pathfinish(f o g) = f(pathfinish g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   156
  by (simp add: pathfinish_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   157
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   158
lemma path_image_translation: "path_image((\<lambda>x. a + x) o g) = (\<lambda>x. a + x) ` (path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   159
  by (simp add: image_comp path_image_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   160
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   161
lemma path_image_linear_image: "linear f \<Longrightarrow> path_image(f o g) = f ` (path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   162
  by (simp add: image_comp path_image_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   163
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   164
lemma reversepath_translation: "reversepath((\<lambda>x. a + x) o g) = (\<lambda>x. a + x) o reversepath g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   165
  by (rule ext) (simp add: reversepath_def)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   166
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   167
lemma reversepath_linear_image: "linear f \<Longrightarrow> reversepath(f o g) = f o reversepath g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   168
  by (rule ext) (simp add: reversepath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   169
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   170
lemma joinpaths_translation:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   171
    "((\<lambda>x. a + x) o g1) +++ ((\<lambda>x. a + x) o g2) = (\<lambda>x. a + x) o (g1 +++ g2)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   172
  by (rule ext) (simp add: joinpaths_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   173
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   174
lemma joinpaths_linear_image: "linear f \<Longrightarrow> (f o g1) +++ (f o g2) = f o (g1 +++ g2)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   175
  by (rule ext) (simp add: joinpaths_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   176
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   177
lemma simple_path_translation_eq: 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   178
  fixes g :: "real \<Rightarrow> 'a::euclidean_space"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   179
  shows "simple_path((\<lambda>x. a + x) o g) = simple_path g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   180
  by (simp add: simple_path_def path_translation_eq)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   181
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   182
lemma simple_path_linear_image_eq:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   183
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   184
  assumes "linear f" "inj f"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   185
    shows "simple_path(f o g) = simple_path g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   186
  using assms inj_on_eq_iff [of f]
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   187
  by (auto simp: path_linear_image_eq simple_path_def path_translation_eq)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   188
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   189
lemma arc_translation_eq:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   190
  fixes g :: "real \<Rightarrow> 'a::euclidean_space"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   191
  shows "arc((\<lambda>x. a + x) o g) = arc g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   192
  by (auto simp: arc_def inj_on_def path_translation_eq)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   193
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   194
lemma arc_linear_image_eq:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   195
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   196
   assumes "linear f" "inj f"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   197
     shows  "arc(f o g) = arc g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   198
  using assms inj_on_eq_iff [of f]
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   199
  by (auto simp: arc_def inj_on_def path_linear_image_eq)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   200
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   201
subsection{*Basic lemmas about paths*}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   202
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   203
lemma arc_imp_simple_path: "arc g \<Longrightarrow> simple_path g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   204
  by (simp add: arc_def inj_on_def simple_path_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   205
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   206
lemma arc_imp_path: "arc g \<Longrightarrow> path g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   207
  using arc_def by blast
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   208
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   209
lemma simple_path_imp_path: "simple_path g \<Longrightarrow> path g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   210
  using simple_path_def by blast
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   211
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   212
lemma simple_path_cases: "simple_path g \<Longrightarrow> arc g \<or> pathfinish g = pathstart g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   213
  unfolding simple_path_def arc_def inj_on_def pathfinish_def pathstart_def
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   214
  by (force)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   215
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   216
lemma simple_path_imp_arc: "simple_path g \<Longrightarrow> pathfinish g \<noteq> pathstart g \<Longrightarrow> arc g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   217
  using simple_path_cases by auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   218
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   219
lemma arc_distinct_ends: "arc g \<Longrightarrow> pathfinish g \<noteq> pathstart g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   220
  unfolding arc_def inj_on_def pathfinish_def pathstart_def
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   221
  by fastforce
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   222
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   223
lemma arc_simple_path: "arc g \<longleftrightarrow> simple_path g \<and> pathfinish g \<noteq> pathstart g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   224
  using arc_distinct_ends arc_imp_simple_path simple_path_cases by blast
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   225
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   226
lemma simple_path_eq_arc: "pathfinish g \<noteq> pathstart g \<Longrightarrow> (simple_path g = arc g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   227
  by (simp add: arc_simple_path)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   228
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   229
lemma path_image_nonempty: "path_image g \<noteq> {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 53640
diff changeset
   230
  unfolding path_image_def image_is_empty box_eq_empty
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   231
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   232
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   233
lemma pathstart_in_path_image[intro]: "pathstart g \<in> path_image g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   234
  unfolding pathstart_def path_image_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   235
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   236
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   237
lemma pathfinish_in_path_image[intro]: "pathfinish g \<in> path_image g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   238
  unfolding pathfinish_def path_image_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   239
  by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   240
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   241
lemma connected_path_image[intro]: "path g \<Longrightarrow> connected (path_image g)"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   242
  unfolding path_def path_image_def
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   243
  using connected_continuous_image connected_Icc by blast
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   244
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   245
lemma compact_path_image[intro]: "path g \<Longrightarrow> compact (path_image g)"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   246
  unfolding path_def path_image_def
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   247
  using compact_continuous_image connected_Icc by blast
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   248
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   249
lemma reversepath_reversepath[simp]: "reversepath (reversepath g) = g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   250
  unfolding reversepath_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   251
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   252
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   253
lemma pathstart_reversepath[simp]: "pathstart (reversepath g) = pathfinish g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   254
  unfolding pathstart_def reversepath_def pathfinish_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   255
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   256
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   257
lemma pathfinish_reversepath[simp]: "pathfinish (reversepath g) = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   258
  unfolding pathstart_def reversepath_def pathfinish_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   259
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   260
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   261
lemma pathstart_join[simp]: "pathstart (g1 +++ g2) = pathstart g1"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   262
  unfolding pathstart_def joinpaths_def pathfinish_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   263
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   264
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   265
lemma pathfinish_join[simp]: "pathfinish (g1 +++ g2) = pathfinish g2"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   266
  unfolding pathstart_def joinpaths_def pathfinish_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   267
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   268
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   269
lemma path_image_reversepath[simp]: "path_image (reversepath g) = path_image g"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   270
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   271
  have *: "\<And>g. path_image (reversepath g) \<subseteq> path_image g"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   272
    unfolding path_image_def subset_eq reversepath_def Ball_def image_iff
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   273
    by force
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   274
  show ?thesis
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   275
    using *[of g] *[of "reversepath g"]
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   276
    unfolding reversepath_reversepath
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   277
    by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   278
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   279
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   280
lemma path_reversepath [simp]: "path (reversepath g) \<longleftrightarrow> path g"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   281
proof -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   282
  have *: "\<And>g. path g \<Longrightarrow> path (reversepath g)"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   283
    unfolding path_def reversepath_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   284
    apply (rule continuous_on_compose[unfolded o_def, of _ "\<lambda>x. 1 - x"])
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   285
    apply (intro continuous_intros)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   286
    apply (rule continuous_on_subset[of "{0..1}"])
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   287
    apply assumption
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   288
    apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   289
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   290
  show ?thesis
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   291
    using *[of "reversepath g"] *[of g]
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   292
    unfolding reversepath_reversepath
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   293
    by (rule iffI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   294
qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   295
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   296
lemma arc_reversepath:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   297
  assumes "arc g" shows "arc(reversepath g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   298
proof -
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   299
  have injg: "inj_on g {0..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   300
    using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   301
    by (simp add: arc_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   302
  have **: "\<And>x y::real. 1-x = 1-y \<Longrightarrow> x = y"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   303
    by simp
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   304
  show ?thesis
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   305
    apply (auto simp: arc_def inj_on_def path_reversepath)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   306
    apply (simp add: arc_imp_path assms)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   307
    apply (rule **)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   308
    apply (rule inj_onD [OF injg])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   309
    apply (auto simp: reversepath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   310
    done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   311
qed
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   312
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   313
lemma simple_path_reversepath: "simple_path g \<Longrightarrow> simple_path (reversepath g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   314
  apply (simp add: simple_path_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   315
  apply (force simp: reversepath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   316
  done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   317
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   318
lemmas reversepath_simps =
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   319
  path_reversepath path_image_reversepath pathstart_reversepath pathfinish_reversepath
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   320
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   321
lemma path_join[simp]:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   322
  assumes "pathfinish g1 = pathstart g2"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   323
  shows "path (g1 +++ g2) \<longleftrightarrow> path g1 \<and> path g2"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   324
  unfolding path_def pathfinish_def pathstart_def
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 50935
diff changeset
   325
proof safe
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 50935
diff changeset
   326
  assume cont: "continuous_on {0..1} (g1 +++ g2)"
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 50935
diff changeset
   327
  have g1: "continuous_on {0..1} g1 \<longleftrightarrow> continuous_on {0..1} ((g1 +++ g2) \<circ> (\<lambda>x. x / 2))"
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 50935
diff changeset
   328
    by (intro continuous_on_cong refl) (auto simp: joinpaths_def)
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 50935
diff changeset
   329
  have g2: "continuous_on {0..1} g2 \<longleftrightarrow> continuous_on {0..1} ((g1 +++ g2) \<circ> (\<lambda>x. x / 2 + 1/2))"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   330
    using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   331
    by (intro continuous_on_cong refl) (auto simp: joinpaths_def pathfinish_def pathstart_def)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   332
  show "continuous_on {0..1} g1" and "continuous_on {0..1} g2"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51478
diff changeset
   333
    unfolding g1 g2
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   334
    by (auto intro!: continuous_intros continuous_on_subset[OF cont] simp del: o_apply)
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 50935
diff changeset
   335
next
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 50935
diff changeset
   336
  assume g1g2: "continuous_on {0..1} g1" "continuous_on {0..1} g2"
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 50935
diff changeset
   337
  have 01: "{0 .. 1} = {0..1/2} \<union> {1/2 .. 1::real}"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   338
    by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   339
  {
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   340
    fix x :: real
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   341
    assume "0 \<le> x" and "x \<le> 1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   342
    then have "x \<in> (\<lambda>x. x * 2) ` {0..1 / 2}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   343
      by (intro image_eqI[where x="x/2"]) auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   344
  }
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 50935
diff changeset
   345
  note 1 = this
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   346
  {
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   347
    fix x :: real
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   348
    assume "0 \<le> x" and "x \<le> 1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   349
    then have "x \<in> (\<lambda>x. x * 2 - 1) ` {1 / 2..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   350
      by (intro image_eqI[where x="x/2 + 1/2"]) auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   351
  }
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 50935
diff changeset
   352
  note 2 = this
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   353
  show "continuous_on {0..1} (g1 +++ g2)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   354
    using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   355
    unfolding joinpaths_def 01
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   356
    apply (intro continuous_on_cases closed_atLeastAtMost g1g2[THEN continuous_on_compose2] continuous_intros)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   357
    apply (auto simp: field_simps pathfinish_def pathstart_def intro!: 1 2)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   358
    done
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   359
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   360
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   361
section {*Path Images*}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   362
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   363
lemma bounded_path_image: "path g \<Longrightarrow> bounded(path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   364
  by (simp add: compact_imp_bounded compact_path_image)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   365
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   366
lemma closed_path_image: 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   367
  fixes g :: "real \<Rightarrow> 'a::t2_space"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   368
  shows "path g \<Longrightarrow> closed(path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   369
  by (metis compact_path_image compact_imp_closed)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   370
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   371
lemma connected_simple_path_image: "simple_path g \<Longrightarrow> connected(path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   372
  by (metis connected_path_image simple_path_imp_path)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   373
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   374
lemma compact_simple_path_image: "simple_path g \<Longrightarrow> compact(path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   375
  by (metis compact_path_image simple_path_imp_path)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   376
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   377
lemma bounded_simple_path_image: "simple_path g \<Longrightarrow> bounded(path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   378
  by (metis bounded_path_image simple_path_imp_path)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   379
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   380
lemma closed_simple_path_image:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   381
  fixes g :: "real \<Rightarrow> 'a::t2_space"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   382
  shows "simple_path g \<Longrightarrow> closed(path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   383
  by (metis closed_path_image simple_path_imp_path)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   384
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   385
lemma connected_arc_image: "arc g \<Longrightarrow> connected(path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   386
  by (metis connected_path_image arc_imp_path)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   387
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   388
lemma compact_arc_image: "arc g \<Longrightarrow> compact(path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   389
  by (metis compact_path_image arc_imp_path)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   390
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   391
lemma bounded_arc_image: "arc g \<Longrightarrow> bounded(path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   392
  by (metis bounded_path_image arc_imp_path)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   393
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   394
lemma closed_arc_image:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   395
  fixes g :: "real \<Rightarrow> 'a::t2_space"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   396
  shows "arc g \<Longrightarrow> closed(path_image g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   397
  by (metis closed_path_image arc_imp_path)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   398
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   399
lemma path_image_join_subset: "path_image (g1 +++ g2) \<subseteq> path_image g1 \<union> path_image g2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   400
  unfolding path_image_def joinpaths_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   401
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   402
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   403
lemma subset_path_image_join:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   404
  assumes "path_image g1 \<subseteq> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   405
    and "path_image g2 \<subseteq> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   406
  shows "path_image (g1 +++ g2) \<subseteq> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   407
  using path_image_join_subset[of g1 g2] and assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   408
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   409
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   410
lemma path_image_join:
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   411
    "pathfinish g1 = pathstart g2 \<Longrightarrow> path_image(g1 +++ g2) = path_image g1 \<union> path_image g2"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   412
  apply (rule subset_antisym [OF path_image_join_subset])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   413
  apply (auto simp: pathfinish_def pathstart_def path_image_def joinpaths_def image_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   414
  apply (drule sym)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   415
  apply (rule_tac x="xa/2" in bexI, auto)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   416
  apply (rule ccontr)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   417
  apply (drule_tac x="(xa+1)/2" in bspec)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   418
  apply (auto simp: field_simps)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   419
  apply (drule_tac x="1/2" in bspec, auto)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   420
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   421
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   422
lemma not_in_path_image_join:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   423
  assumes "x \<notin> path_image g1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   424
    and "x \<notin> path_image g2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   425
  shows "x \<notin> path_image (g1 +++ g2)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   426
  using assms and path_image_join_subset[of g1 g2]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   427
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   428
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   429
lemma pathstart_compose: "pathstart(f o p) = f(pathstart p)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   430
  by (simp add: pathstart_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   431
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   432
lemma pathfinish_compose: "pathfinish(f o p) = f(pathfinish p)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   433
  by (simp add: pathfinish_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   434
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   435
lemma path_image_compose: "path_image (f o p) = f ` (path_image p)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   436
  by (simp add: image_comp path_image_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   437
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   438
lemma path_compose_join: "f o (p +++ q) = (f o p) +++ (f o q)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   439
  by (rule ext) (simp add: joinpaths_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   440
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   441
lemma path_compose_reversepath: "f o reversepath p = reversepath(f o p)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   442
  by (rule ext) (simp add: reversepath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   443
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   444
lemma join_paths_eq:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   445
  "(\<And>t. t \<in> {0..1} \<Longrightarrow> p t = p' t) \<Longrightarrow>
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   446
   (\<And>t. t \<in> {0..1} \<Longrightarrow> q t = q' t)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   447
   \<Longrightarrow>  t \<in> {0..1} \<Longrightarrow> (p +++ q) t = (p' +++ q') t"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   448
  by (auto simp: joinpaths_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   449
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   450
lemma simple_path_inj_on: "simple_path g \<Longrightarrow> inj_on g {0<..<1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   451
  by (auto simp: simple_path_def path_image_def inj_on_def less_eq_real_def Ball_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   452
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   453
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   454
subsection{*Simple paths with the endpoints removed*}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   455
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   456
lemma simple_path_endless:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   457
    "simple_path c \<Longrightarrow> path_image c - {pathstart c,pathfinish c} = c ` {0<..<1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   458
  apply (auto simp: simple_path_def path_image_def pathstart_def pathfinish_def Ball_def Bex_def image_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   459
  apply (metis eq_iff le_less_linear)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   460
  apply (metis leD linear)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   461
  using less_eq_real_def zero_le_one apply blast
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   462
  using less_eq_real_def zero_le_one apply blast
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   463
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   464
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   465
lemma connected_simple_path_endless:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   466
    "simple_path c \<Longrightarrow> connected(path_image c - {pathstart c,pathfinish c})"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   467
apply (simp add: simple_path_endless)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   468
apply (rule connected_continuous_image)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   469
apply (meson continuous_on_subset greaterThanLessThan_subseteq_atLeastAtMost_iff le_numeral_extra(3) le_numeral_extra(4) path_def simple_path_imp_path)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   470
by auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   471
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   472
lemma nonempty_simple_path_endless:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   473
    "simple_path c \<Longrightarrow> path_image c - {pathstart c,pathfinish c} \<noteq> {}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   474
  by (simp add: simple_path_endless)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   475
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   476
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   477
subsection{* The operations on paths*}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   478
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   479
lemma path_image_subset_reversepath: "path_image(reversepath g) \<le> path_image g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   480
  by (auto simp: path_image_def reversepath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   481
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   482
lemma continuous_on_op_minus: "continuous_on (s::real set) (op - x)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   483
  by (rule continuous_intros | simp)+
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   484
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   485
lemma path_imp_reversepath: "path g \<Longrightarrow> path(reversepath g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   486
  apply (auto simp: path_def reversepath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   487
  using continuous_on_compose [of "{0..1}" "\<lambda>x. 1 - x" g]
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   488
  apply (auto simp: continuous_on_op_minus)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   489
  done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   490
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   491
lemma forall_01_trivial: "(\<forall>x\<in>{0..1}. x \<le> 0 \<longrightarrow> P x) \<longleftrightarrow> P (0::real)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   492
  by auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   493
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   494
lemma forall_half1_trivial: "(\<forall>x\<in>{1/2..1}. x * 2 \<le> 1 \<longrightarrow> P x) \<longleftrightarrow> P (1/2::real)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   495
  by auto (metis add_divide_distrib mult_2_right real_sum_of_halves)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   496
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   497
lemma continuous_on_joinpaths:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   498
  assumes "continuous_on {0..1} g1" "continuous_on {0..1} g2" "pathfinish g1 = pathstart g2"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   499
    shows "continuous_on {0..1} (g1 +++ g2)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   500
proof -
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   501
  have *: "{0..1::real} = {0..1/2} \<union> {1/2..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   502
    by auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   503
  have gg: "g2 0 = g1 1"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   504
    by (metis assms(3) pathfinish_def pathstart_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   505
  have 1: "continuous_on {0..1 / 2} (g1 +++ g2)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   506
    apply (rule continuous_on_eq [of _ "g1 o (\<lambda>x. 2*x)"])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   507
    apply (simp add: joinpaths_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   508
    apply (rule continuous_intros | simp add: assms)+
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   509
    done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   510
  have 2: "continuous_on {1 / 2..1} (g1 +++ g2)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   511
    apply (rule continuous_on_eq [of _ "g2 o (\<lambda>x. 2*x-1)"])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   512
    apply (simp add: joinpaths_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   513
    apply (rule continuous_intros | simp add: forall_half1_trivial gg)+
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   514
    apply (rule continuous_on_subset)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   515
    apply (rule assms, auto)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   516
    done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   517
  show ?thesis
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   518
    apply (subst *)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   519
    apply (rule continuous_on_union)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   520
    using 1 2
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   521
    apply auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   522
    done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   523
qed
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   524
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   525
lemma path_join_imp: "\<lbrakk>path g1; path g2; pathfinish g1 = pathstart g2\<rbrakk> \<Longrightarrow> path(g1 +++ g2)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   526
  by (simp add: path_join)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   527
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   528
lemmas join_paths_simps = path_join path_image_join pathstart_join pathfinish_join
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   529
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   530
lemma simple_path_join_loop:
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   531
  assumes "arc g1" "arc g2" 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   532
          "pathfinish g1 = pathstart g2"  "pathfinish g2 = pathstart g1" 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   533
          "path_image g1 \<inter> path_image g2 \<subseteq> {pathstart g1, pathstart g2}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   534
  shows "simple_path(g1 +++ g2)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   535
proof -
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   536
  have injg1: "inj_on g1 {0..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   537
    using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   538
    by (simp add: arc_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   539
  have injg2: "inj_on g2 {0..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   540
    using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   541
    by (simp add: arc_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   542
  have g12: "g1 1 = g2 0" 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   543
   and g21: "g2 1 = g1 0" 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   544
   and sb:  "g1 ` {0..1} \<inter> g2 ` {0..1} \<subseteq> {g1 0, g2 0}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   545
    using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   546
    by (simp_all add: arc_def pathfinish_def pathstart_def path_image_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   547
  { fix x and y::real
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   548
    assume xyI: "x = 1 \<longrightarrow> y \<noteq> 0" 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   549
       and xy: "x \<le> 1" "0 \<le> y" " y * 2 \<le> 1" "\<not> x * 2 \<le> 1" "g2 (2 * x - 1) = g1 (2 * y)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   550
    have g1im: "g1 (2 * y) \<in> g1 ` {0..1} \<inter> g2 ` {0..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   551
      using xy
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   552
      apply simp
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   553
      apply (rule_tac x="2 * x - 1" in image_eqI, auto)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   554
      done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   555
    have False
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   556
      using subsetD [OF sb g1im] xy 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   557
      apply auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   558
      apply (drule inj_onD [OF injg1])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   559
      using g21 [symmetric] xyI
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   560
      apply (auto dest: inj_onD [OF injg2])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   561
      done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   562
   } note * = this
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   563
  { fix x and y::real
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   564
    assume xy: "y \<le> 1" "0 \<le> x" "\<not> y * 2 \<le> 1" "x * 2 \<le> 1" "g1 (2 * x) = g2 (2 * y - 1)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   565
    have g1im: "g1 (2 * x) \<in> g1 ` {0..1} \<inter> g2 ` {0..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   566
      using xy
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   567
      apply simp
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   568
      apply (rule_tac x="2 * x" in image_eqI, auto)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   569
      done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   570
    have "x = 0 \<and> y = 1"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   571
      using subsetD [OF sb g1im] xy 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   572
      apply auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   573
      apply (force dest: inj_onD [OF injg1])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   574
      using  g21 [symmetric]
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   575
      apply (auto dest: inj_onD [OF injg2])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   576
      done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   577
   } note ** = this
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   578
  show ?thesis
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   579
    using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   580
    apply (simp add: arc_def simple_path_def path_join, clarify)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   581
    apply (simp add: joinpaths_def split: split_if_asm)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   582
    apply (force dest: inj_onD [OF injg1])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   583
    apply (metis *)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   584
    apply (metis **)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   585
    apply (force dest: inj_onD [OF injg2])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   586
    done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   587
qed
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   588
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   589
lemma arc_join:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   590
  assumes "arc g1" "arc g2" 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   591
          "pathfinish g1 = pathstart g2"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   592
          "path_image g1 \<inter> path_image g2 \<subseteq> {pathstart g2}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   593
    shows "arc(g1 +++ g2)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   594
proof -
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   595
  have injg1: "inj_on g1 {0..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   596
    using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   597
    by (simp add: arc_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   598
  have injg2: "inj_on g2 {0..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   599
    using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   600
    by (simp add: arc_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   601
  have g11: "g1 1 = g2 0"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   602
   and sb:  "g1 ` {0..1} \<inter> g2 ` {0..1} \<subseteq> {g2 0}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   603
    using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   604
    by (simp_all add: arc_def pathfinish_def pathstart_def path_image_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   605
  { fix x and y::real
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   606
    assume xy: "x \<le> 1" "0 \<le> y" " y * 2 \<le> 1" "\<not> x * 2 \<le> 1" "g2 (2 * x - 1) = g1 (2 * y)"       
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   607
    have g1im: "g1 (2 * y) \<in> g1 ` {0..1} \<inter> g2 ` {0..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   608
      using xy
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   609
      apply simp
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   610
      apply (rule_tac x="2 * x - 1" in image_eqI, auto)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   611
      done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   612
    have False
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   613
      using subsetD [OF sb g1im] xy 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   614
      by (auto dest: inj_onD [OF injg2])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   615
   } note * = this
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   616
  show ?thesis
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   617
    apply (simp add: arc_def inj_on_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   618
    apply (clarsimp simp add: arc_imp_path assms path_join)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   619
    apply (simp add: joinpaths_def split: split_if_asm)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   620
    apply (force dest: inj_onD [OF injg1])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   621
    apply (metis *)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   622
    apply (metis *)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   623
    apply (force dest: inj_onD [OF injg2])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   624
    done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   625
qed
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   626
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   627
lemma reversepath_joinpaths:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   628
    "pathfinish g1 = pathstart g2 \<Longrightarrow> reversepath(g1 +++ g2) = reversepath g2 +++ reversepath g1"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   629
  unfolding reversepath_def pathfinish_def pathstart_def joinpaths_def
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   630
  by (rule ext) (auto simp: mult.commute)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   631
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   632
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   633
subsection{* Choosing a subpath of an existing path*}
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   634
    
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   635
definition subpath :: "real \<Rightarrow> real \<Rightarrow> (real \<Rightarrow> 'a) \<Rightarrow> real \<Rightarrow> 'a::real_normed_vector"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   636
  where "subpath a b g \<equiv> \<lambda>x. g((b - a) * x + a)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   637
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   638
lemma path_image_subpath_gen [simp]: 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   639
  fixes g :: "real \<Rightarrow> 'a::real_normed_vector"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   640
  shows "path_image(subpath u v g) = g ` (closed_segment u v)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   641
  apply (simp add: closed_segment_real_eq path_image_def subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   642
  apply (subst o_def [of g, symmetric])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   643
  apply (simp add: image_comp [symmetric])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   644
  done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   645
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   646
lemma path_image_subpath [simp]:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   647
  fixes g :: "real \<Rightarrow> 'a::real_normed_vector"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   648
  shows "path_image(subpath u v g) = (if u \<le> v then g ` {u..v} else g ` {v..u})"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   649
  by (simp add: closed_segment_eq_real_ivl)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   650
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   651
lemma path_subpath [simp]:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   652
  fixes g :: "real \<Rightarrow> 'a::real_normed_vector"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   653
  assumes "path g" "u \<in> {0..1}" "v \<in> {0..1}"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   654
    shows "path(subpath u v g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   655
proof -
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   656
  have "continuous_on {0..1} (g o (\<lambda>x. ((v-u) * x+ u)))"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   657
    apply (rule continuous_intros | simp)+
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   658
    apply (simp add: image_affinity_atLeastAtMost [where c=u])
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   659
    using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   660
    apply (auto simp: path_def continuous_on_subset)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   661
    done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   662
  then show ?thesis
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   663
    by (simp add: path_def subpath_def)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   664
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   665
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   666
lemma pathstart_subpath [simp]: "pathstart(subpath u v g) = g(u)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   667
  by (simp add: pathstart_def subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   668
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   669
lemma pathfinish_subpath [simp]: "pathfinish(subpath u v g) = g(v)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   670
  by (simp add: pathfinish_def subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   671
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   672
lemma subpath_trivial [simp]: "subpath 0 1 g = g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   673
  by (simp add: subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   674
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   675
lemma subpath_reversepath: "subpath 1 0 g = reversepath g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   676
  by (simp add: reversepath_def subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   677
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   678
lemma reversepath_subpath: "reversepath(subpath u v g) = subpath v u g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   679
  by (simp add: reversepath_def subpath_def algebra_simps)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   680
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   681
lemma subpath_translation: "subpath u v ((\<lambda>x. a + x) o g) = (\<lambda>x. a + x) o subpath u v g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   682
  by (rule ext) (simp add: subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   683
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   684
lemma subpath_linear_image: "linear f \<Longrightarrow> subpath u v (f o g) = f o subpath u v g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   685
  by (rule ext) (simp add: subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   686
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   687
lemma affine_ineq: 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   688
  fixes x :: "'a::linordered_idom" 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   689
  assumes "x \<le> 1" "v < u"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   690
    shows "v + x * u \<le> u + x * v"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   691
proof -
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   692
  have "(1-x)*(u-v) \<ge> 0"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   693
    using assms by auto
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   694
  then show ?thesis
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   695
    by (simp add: algebra_simps)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   696
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   697
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   698
lemma simple_path_subpath_eq: 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   699
  "simple_path(subpath u v g) \<longleftrightarrow>
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   700
     path(subpath u v g) \<and> u\<noteq>v \<and>
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   701
     (\<forall>x y. x \<in> closed_segment u v \<and> y \<in> closed_segment u v \<and> g x = g y
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   702
                \<longrightarrow> x = y \<or> x = u \<and> y = v \<or> x = v \<and> y = u)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   703
    (is "?lhs = ?rhs")
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   704
proof (rule iffI)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   705
  assume ?lhs
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   706
  then have p: "path (\<lambda>x. g ((v - u) * x + u))"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   707
        and sim: "(\<And>x y. \<lbrakk>x\<in>{0..1}; y\<in>{0..1}; g ((v - u) * x + u) = g ((v - u) * y + u)\<rbrakk> 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   708
                  \<Longrightarrow> x = y \<or> x = 0 \<and> y = 1 \<or> x = 1 \<and> y = 0)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   709
    by (auto simp: simple_path_def subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   710
  { fix x y
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   711
    assume "x \<in> closed_segment u v" "y \<in> closed_segment u v" "g x = g y"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   712
    then have "x = y \<or> x = u \<and> y = v \<or> x = v \<and> y = u"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   713
    using sim [of "(x-u)/(v-u)" "(y-u)/(v-u)"] p
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   714
    by (auto simp: closed_segment_real_eq image_affinity_atLeastAtMost divide_simps 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   715
       split: split_if_asm)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   716
  } moreover
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   717
  have "path(subpath u v g) \<and> u\<noteq>v"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   718
    using sim [of "1/3" "2/3"] p
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   719
    by (auto simp: subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   720
  ultimately show ?rhs
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   721
    by metis
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   722
next
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   723
  assume ?rhs
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   724
  then 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   725
  have d1: "\<And>x y. \<lbrakk>g x = g y; u \<le> x; x \<le> v; u \<le> y; y \<le> v\<rbrakk> \<Longrightarrow> x = y \<or> x = u \<and> y = v \<or> x = v \<and> y = u"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   726
   and d2: "\<And>x y. \<lbrakk>g x = g y; v \<le> x; x \<le> u; v \<le> y; y \<le> u\<rbrakk> \<Longrightarrow> x = y \<or> x = u \<and> y = v \<or> x = v \<and> y = u"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   727
   and ne: "u < v \<or> v < u"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   728
   and psp: "path (subpath u v g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   729
    by (auto simp: closed_segment_real_eq image_affinity_atLeastAtMost)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   730
  have [simp]: "\<And>x. u + x * v = v + x * u \<longleftrightarrow> u=v \<or> x=1"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   731
    by algebra
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   732
  show ?lhs using psp ne
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   733
    unfolding simple_path_def subpath_def
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   734
    by (fastforce simp add: algebra_simps affine_ineq mult_left_mono crossproduct_eq dest: d1 d2)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   735
qed
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   736
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   737
lemma arc_subpath_eq: 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   738
  "arc(subpath u v g) \<longleftrightarrow> path(subpath u v g) \<and> u\<noteq>v \<and> inj_on g (closed_segment u v)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   739
    (is "?lhs = ?rhs")
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   740
proof (rule iffI)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   741
  assume ?lhs
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   742
  then have p: "path (\<lambda>x. g ((v - u) * x + u))"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   743
        and sim: "(\<And>x y. \<lbrakk>x\<in>{0..1}; y\<in>{0..1}; g ((v - u) * x + u) = g ((v - u) * y + u)\<rbrakk> 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   744
                  \<Longrightarrow> x = y)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   745
    by (auto simp: arc_def inj_on_def subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   746
  { fix x y
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   747
    assume "x \<in> closed_segment u v" "y \<in> closed_segment u v" "g x = g y"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   748
    then have "x = y"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   749
    using sim [of "(x-u)/(v-u)" "(y-u)/(v-u)"] p
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   750
    by (force simp add: inj_on_def closed_segment_real_eq image_affinity_atLeastAtMost divide_simps 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   751
       split: split_if_asm)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   752
  } moreover
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   753
  have "path(subpath u v g) \<and> u\<noteq>v"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   754
    using sim [of "1/3" "2/3"] p
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   755
    by (auto simp: subpath_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   756
  ultimately show ?rhs
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   757
    unfolding inj_on_def   
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   758
    by metis
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   759
next
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   760
  assume ?rhs
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   761
  then 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   762
  have d1: "\<And>x y. \<lbrakk>g x = g y; u \<le> x; x \<le> v; u \<le> y; y \<le> v\<rbrakk> \<Longrightarrow> x = y"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   763
   and d2: "\<And>x y. \<lbrakk>g x = g y; v \<le> x; x \<le> u; v \<le> y; y \<le> u\<rbrakk> \<Longrightarrow> x = y"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   764
   and ne: "u < v \<or> v < u"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   765
   and psp: "path (subpath u v g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   766
    by (auto simp: inj_on_def closed_segment_real_eq image_affinity_atLeastAtMost)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   767
  show ?lhs using psp ne
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   768
    unfolding arc_def subpath_def inj_on_def
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   769
    by (auto simp: algebra_simps affine_ineq mult_left_mono crossproduct_eq dest: d1 d2)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   770
qed
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   771
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   772
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   773
lemma simple_path_subpath: 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   774
  assumes "simple_path g" "u \<in> {0..1}" "v \<in> {0..1}" "u \<noteq> v"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   775
  shows "simple_path(subpath u v g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   776
  using assms
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   777
  apply (simp add: simple_path_subpath_eq simple_path_imp_path)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   778
  apply (simp add: simple_path_def closed_segment_real_eq image_affinity_atLeastAtMost, fastforce)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   779
  done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   780
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   781
lemma arc_simple_path_subpath:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   782
    "\<lbrakk>simple_path g; u \<in> {0..1}; v \<in> {0..1}; g u \<noteq> g v\<rbrakk> \<Longrightarrow> arc(subpath u v g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   783
  by (force intro: simple_path_subpath simple_path_imp_arc)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   784
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   785
lemma arc_subpath_arc:
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   786
    "\<lbrakk>arc g; u \<in> {0..1}; v \<in> {0..1}; u \<noteq> v\<rbrakk> \<Longrightarrow> arc(subpath u v g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   787
  by (meson arc_def arc_imp_simple_path arc_simple_path_subpath inj_onD)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   788
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   789
lemma arc_simple_path_subpath_interior: 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   790
    "\<lbrakk>simple_path g; u \<in> {0..1}; v \<in> {0..1}; u \<noteq> v; \<bar>u-v\<bar> < 1\<rbrakk> \<Longrightarrow> arc(subpath u v g)"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   791
    apply (rule arc_simple_path_subpath)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   792
    apply (force simp: simple_path_def)+
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   793
    done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   794
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   795
lemma path_image_subpath_subset: 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   796
    "\<lbrakk>path g; u \<in> {0..1}; v \<in> {0..1}\<rbrakk> \<Longrightarrow> path_image(subpath u v g) \<subseteq> path_image g"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   797
  apply (simp add: closed_segment_real_eq image_affinity_atLeastAtMost)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   798
  apply (auto simp: path_image_def)
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   799
  done
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   800
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   801
lemma join_subpaths_middle: "subpath (0) ((1 / 2)) p +++ subpath ((1 / 2)) 1 p = p"
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   802
  by (rule ext) (simp add: joinpaths_def subpath_def divide_simps)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   803
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   804
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   805
subsection {* Reparametrizing a closed curve to start at some chosen point *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   806
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   807
definition shiftpath :: "real \<Rightarrow> (real \<Rightarrow> 'a::topological_space) \<Rightarrow> real \<Rightarrow> 'a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   808
  where "shiftpath a f = (\<lambda>x. if (a + x) \<le> 1 then f (a + x) else f (a + x - 1))"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   809
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   810
lemma pathstart_shiftpath: "a \<le> 1 \<Longrightarrow> pathstart (shiftpath a g) = g a"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   811
  unfolding pathstart_def shiftpath_def by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   812
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   813
lemma pathfinish_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   814
  assumes "0 \<le> a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   815
    and "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   816
  shows "pathfinish (shiftpath a g) = g a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   817
  using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   818
  unfolding pathstart_def pathfinish_def shiftpath_def
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   819
  by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   820
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   821
lemma endpoints_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   822
  assumes "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   823
    and "a \<in> {0 .. 1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   824
  shows "pathfinish (shiftpath a g) = g a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   825
    and "pathstart (shiftpath a g) = g a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   826
  using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   827
  by (auto intro!: pathfinish_shiftpath pathstart_shiftpath)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   828
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   829
lemma closed_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   830
  assumes "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   831
    and "a \<in> {0..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   832
  shows "pathfinish (shiftpath a g) = pathstart (shiftpath a g)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   833
  using endpoints_shiftpath[OF assms]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   834
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   835
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   836
lemma path_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   837
  assumes "path g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   838
    and "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   839
    and "a \<in> {0..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   840
  shows "path (shiftpath a g)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   841
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   842
  have *: "{0 .. 1} = {0 .. 1-a} \<union> {1-a .. 1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   843
    using assms(3) by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   844
  have **: "\<And>x. x + a = 1 \<Longrightarrow> g (x + a - 1) = g (x + a)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   845
    using assms(2)[unfolded pathfinish_def pathstart_def]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   846
    by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   847
  show ?thesis
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   848
    unfolding path_def shiftpath_def *
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   849
    apply (rule continuous_on_union)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   850
    apply (rule closed_real_atLeastAtMost)+
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   851
    apply (rule continuous_on_eq[of _ "g \<circ> (\<lambda>x. a + x)"])
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   852
    prefer 3
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   853
    apply (rule continuous_on_eq[of _ "g \<circ> (\<lambda>x. a - 1 + x)"])
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   854
    defer
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   855
    prefer 3
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   856
    apply (rule continuous_intros)+
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   857
    prefer 2
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   858
    apply (rule continuous_intros)+
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   859
    apply (rule_tac[1-2] continuous_on_subset[OF assms(1)[unfolded path_def]])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   860
    using assms(3) and **
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   861
    apply auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   862
    apply (auto simp add: field_simps)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   863
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   864
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   865
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   866
lemma shiftpath_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   867
  assumes "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   868
    and "a \<in> {0..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   869
    and "x \<in> {0..1}"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   870
  shows "shiftpath (1 - a) (shiftpath a g) x = g x"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   871
  using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   872
  unfolding pathfinish_def pathstart_def shiftpath_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   873
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   874
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   875
lemma path_image_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   876
  assumes "a \<in> {0..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   877
    and "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   878
  shows "path_image (shiftpath a g) = path_image g"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   879
proof -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   880
  { fix x
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   881
    assume as: "g 1 = g 0" "x \<in> {0..1::real}" " \<forall>y\<in>{0..1} \<inter> {x. \<not> a + x \<le> 1}. g x \<noteq> g (a + y - 1)"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   882
    then have "\<exists>y\<in>{0..1} \<inter> {x. a + x \<le> 1}. g x = g (a + y)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   883
    proof (cases "a \<le> x")
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   884
      case False
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   885
      then show ?thesis
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   886
        apply (rule_tac x="1 + x - a" in bexI)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   887
        using as(1,2) and as(3)[THEN bspec[where x="1 + x - a"]] and assms(1)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   888
        apply (auto simp add: field_simps atomize_not)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   889
        done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   890
    next
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   891
      case True
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   892
      then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   893
        using as(1-2) and assms(1)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   894
        apply (rule_tac x="x - a" in bexI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   895
        apply (auto simp add: field_simps)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   896
        done
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   897
    qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   898
  }
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   899
  then show ?thesis
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   900
    using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   901
    unfolding shiftpath_def path_image_def pathfinish_def pathstart_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   902
    by (auto simp add: image_iff)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   903
qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   904
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   905
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   906
subsection {* Special case of straight-line paths *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   907
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   908
definition linepath :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> real \<Rightarrow> 'a"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   909
  where "linepath a b = (\<lambda>x. (1 - x) *\<^sub>R a + x *\<^sub>R b)"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   910
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   911
lemma pathstart_linepath[simp]: "pathstart (linepath a b) = a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   912
  unfolding pathstart_def linepath_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   913
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   914
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   915
lemma pathfinish_linepath[simp]: "pathfinish (linepath a b) = b"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   916
  unfolding pathfinish_def linepath_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   917
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   918
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   919
lemma continuous_linepath_at[intro]: "continuous (at x) (linepath a b)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   920
  unfolding linepath_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   921
  by (intro continuous_intros)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   922
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   923
lemma continuous_on_linepath[intro]: "continuous_on s (linepath a b)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   924
  using continuous_linepath_at
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   925
  by (auto intro!: continuous_at_imp_continuous_on)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   926
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   927
lemma path_linepath[intro]: "path (linepath a b)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   928
  unfolding path_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   929
  by (rule continuous_on_linepath)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   930
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   931
lemma path_image_linepath[simp]: "path_image (linepath a b) = closed_segment a b"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   932
  unfolding path_image_def segment linepath_def
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   933
  by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   934
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   935
lemma reversepath_linepath[simp]: "reversepath (linepath a b) = linepath b a"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   936
  unfolding reversepath_def linepath_def
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   937
  by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   938
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   939
lemma arc_linepath:
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   940
  assumes "a \<noteq> b"
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   941
  shows "arc (linepath a b)"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   942
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   943
  {
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   944
    fix x y :: "real"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   945
    assume "x *\<^sub>R b + y *\<^sub>R a = x *\<^sub>R a + y *\<^sub>R b"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   946
    then have "(x - y) *\<^sub>R a = (x - y) *\<^sub>R b"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   947
      by (simp add: algebra_simps)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   948
    with assms have "x = y"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   949
      by simp
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   950
  }
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   951
  then show ?thesis
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   952
    unfolding arc_def inj_on_def 
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   953
    by (simp add:  path_linepath) (force simp: algebra_simps linepath_def)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   954
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   955
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   956
lemma simple_path_linepath[intro]: "a \<noteq> b \<Longrightarrow> simple_path (linepath a b)"
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
   957
  by (simp add: arc_imp_simple_path arc_linepath)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   958
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   959
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   960
subsection {* Bounding a point away from a path *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   961
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   962
lemma not_on_path_ball:
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   963
  fixes g :: "real \<Rightarrow> 'a::heine_borel"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   964
  assumes "path g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   965
    and "z \<notin> path_image g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   966
  shows "\<exists>e > 0. ball z e \<inter> path_image g = {}"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   967
proof -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   968
  obtain a where "a \<in> path_image g" "\<forall>y \<in> path_image g. dist z a \<le> dist z y"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   969
    using distance_attains_inf[OF _ path_image_nonempty, of g z]
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   970
    using compact_path_image[THEN compact_imp_closed, OF assms(1)] by auto
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   971
  then show ?thesis
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   972
    apply (rule_tac x="dist z a" in exI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   973
    using assms(2)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   974
    apply (auto intro!: dist_pos_lt)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   975
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   976
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   977
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   978
lemma not_on_path_cball:
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   979
  fixes g :: "real \<Rightarrow> 'a::heine_borel"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   980
  assumes "path g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   981
    and "z \<notin> path_image g"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   982
  shows "\<exists>e>0. cball z e \<inter> (path_image g) = {}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   983
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   984
  obtain e where "ball z e \<inter> path_image g = {}" "e > 0"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   985
    using not_on_path_ball[OF assms] by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   986
  moreover have "cball z (e/2) \<subseteq> ball z e"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   987
    using `e > 0` by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   988
  ultimately show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   989
    apply (rule_tac x="e/2" in exI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   990
    apply auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   991
    done
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   992
qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   993
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   994
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   995
subsection {* Path component, considered as a "joinability" relation (from Tom Hales) *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   996
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   997
definition "path_component s x y \<longleftrightarrow>
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   998
  (\<exists>g. path g \<and> path_image g \<subseteq> s \<and> pathstart g = x \<and> pathfinish g = y)"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   999
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1000
lemmas path_defs = path_def pathstart_def pathfinish_def path_image_def path_component_def
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1001
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1002
lemma path_component_mem:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1003
  assumes "path_component s x y"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1004
  shows "x \<in> s" and "y \<in> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1005
  using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1006
  unfolding path_defs
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1007
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1008
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1009
lemma path_component_refl:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1010
  assumes "x \<in> s"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1011
  shows "path_component s x x"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1012
  unfolding path_defs
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1013
  apply (rule_tac x="\<lambda>u. x" in exI)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1014
  using assms
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
  1015
  apply (auto intro!: continuous_intros)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1016
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1017
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1018
lemma path_component_refl_eq: "path_component s x x \<longleftrightarrow> x \<in> s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1019
  by (auto intro!: path_component_mem path_component_refl)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1020
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1021
lemma path_component_sym: "path_component s x y \<Longrightarrow> path_component s y x"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1022
  using assms
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1023
  unfolding path_component_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1024
  apply (erule exE)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1025
  apply (rule_tac x="reversepath g" in exI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1026
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1027
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1028
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1029
lemma path_component_trans:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1030
  assumes "path_component s x y"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1031
    and "path_component s y z"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1032
  shows "path_component s x z"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1033
  using assms
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1034
  unfolding path_component_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1035
  apply (elim exE)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1036
  apply (rule_tac x="g +++ ga" in exI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1037
  apply (auto simp add: path_image_join)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1038
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1039
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1040
lemma path_component_of_subset: "s \<subseteq> t \<Longrightarrow> path_component s x y \<Longrightarrow> path_component t x y"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1041
  unfolding path_component_def by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1042
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1043
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1044
text {* Can also consider it as a set, as the name suggests. *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1045
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1046
lemma path_component_set:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1047
  "{y. path_component s x y} =
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1048
    {y. (\<exists>g. path g \<and> path_image g \<subseteq> s \<and> pathstart g = x \<and> pathfinish g = y)}"
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
  1049
  unfolding mem_Collect_eq path_component_def
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1050
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1051
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1052
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 41959
diff changeset
  1053
lemma path_component_subset: "{y. path_component s x y} \<subseteq> s"
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
  1054
  by (auto simp add: path_component_mem(2))
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1055
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 41959
diff changeset
  1056
lemma path_component_eq_empty: "{y. path_component s x y} = {} \<longleftrightarrow> x \<notin> s"
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
  1057
  using path_component_mem path_component_refl_eq
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
  1058
    by fastforce
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1059
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1060
subsection {* Path connectedness of a space *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1061
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1062
definition "path_connected s \<longleftrightarrow>
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1063
  (\<forall>x\<in>s. \<forall>y\<in>s. \<exists>g. path g \<and> path_image g \<subseteq> s \<and> pathstart g = x \<and> pathfinish g = y)"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1064
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1065
lemma path_connected_component: "path_connected s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>y\<in>s. path_component s x y)"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1066
  unfolding path_connected_def path_component_def by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1067
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1068
lemma path_connected_component_set: "path_connected s \<longleftrightarrow> (\<forall>x\<in>s. {y. path_component s x y} = s)"
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
  1069
  unfolding path_connected_component path_component_subset 
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1070
  apply auto
60303
00c06f1315d0 New material about paths, and some lemmas
paulson
parents: 59557
diff changeset
  1071
  using path_component_mem(2) by blast
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1072
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1073
subsection {* Some useful lemmas about path-connectedness *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1074
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1075
lemma convex_imp_path_connected:
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1076
  fixes s :: "'a::real_normed_vector set"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1077
  assumes "convex s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1078
  shows "path_connected s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1079
  unfolding path_connected_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1080
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1081
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1082
  apply (rule_tac x = "linepath x y" in exI)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1083
  unfolding path_image_linepath
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1084
  using assms [unfolded convex_contains_segment]
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1085
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1086
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1087
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1088
lemma path_connected_imp_connected:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1089
  assumes "path_connected s"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1090
  shows "connected s"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1091
  unfolding connected_def not_ex
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1092
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1093
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1094
  apply (rule ccontr)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1095
  unfolding not_not
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1096
  apply (elim conjE)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1097
proof -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1098
  fix e1 e2
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1099
  assume as: "open e1" "open e2" "s \<subseteq> e1 \<union> e2" "e1 \<inter> e2 \<inter> s = {}" "e1 \<inter> s \<noteq> {}" "e2 \<inter> s \<noteq> {}"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1100
  then obtain x1 x2 where obt:"x1 \<in> e1 \<inter> s" "x2 \<in> e2 \<inter> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1101
    by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1102
  then obtain g where g: "path g" "path_image g \<subseteq> s" "pathstart g = x1" "pathfinish g = x2"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1103
    using assms[unfolded path_connected_def,rule_format,of x1 x2] by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1104
  have *: "connected {0..1::real}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1105
    by (auto intro!: convex_connected convex_real_interval)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1106
  have "{0..1} \<subseteq> {x \<in> {0..1}. g x \<in> e1} \<union> {x \<in> {0..1}. g x \<in> e2}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1107
    using as(3) g(2)[unfolded path_defs] by blast
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1108
  moreover have "{x \<in> {0..1}. g x \<in> e1} \<inter> {x \<in> {0..1}. g x \<in> e2} = {}"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1109
    using as(4) g(2)[unfolded path_defs]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1110
    unfolding subset_eq
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1111
    by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1112
  moreover have "{x \<in> {0..1}. g x \<in> e1} \<noteq> {} \<and> {x \<in> {0..1}. g x \<in> e2} \<noteq> {}"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1113
    using g(3,4)[unfolded path_defs]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1114
    using obt
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1115
    by (simp add: ex_in_conv [symmetric], metis zero_le_one order_refl)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1116
  ultimately show False
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1117
    using *[unfolded connected_local not_ex, rule_format,
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1118
      of "{x\<in>{0..1}. g x \<in> e1}" "{x\<in>{0..1}. g x \<in> e2}"]
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1119
    using continuous_open_in_preimage[OF g(1)[unfolded path_def] as(1)]
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1120
    using continuous_open_in_preimage[OF g(1)[unfolded path_def] as(2)]
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1121
    by auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1122
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1123
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1124
lemma open_path_component:
53593
a7bcbb5a17d8 removed outdated comments
huffman
parents: 51481
diff changeset
  1125
  fixes s :: "'a::real_normed_vector set"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1126
  assumes "open s"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1127
  shows "open {y. path_component s x y}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1128
  unfolding open_contains_ball
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1129
proof
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1130
  fix y
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1131
  assume as: "y \<in> {y. path_component s x y}"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
  1132
  then have "y \<in> s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1133
    apply -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1134
    apply (rule path_component_mem(2))
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1135
    unfolding mem_Collect_eq
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1136
    apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1137
    done
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1138
  then obtain e where e: "e > 0" "ball y e \<subseteq> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1139
    using assms[unfolded open_contains_ball]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1140
    by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1141
  show "\<exists>e > 0. ball y e \<subseteq> {y. path_component s x y}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1142
    apply (rule_tac x=e in exI)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1143
    apply (rule,rule `e>0`)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1144
    apply rule
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1145
    unfolding mem_ball mem_Collect_eq
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1146
  proof -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1147
    fix z
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1148
    assume "dist y z < e"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
  1149
    then show "path_component s x z"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1150
      apply (rule_tac path_component_trans[of _ _ y])
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1151
      defer
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1152
      apply (rule path_component_of_subset[OF e(2)])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1153
      apply (rule convex_imp_path_connected[OF convex_ball, unfolded path_connected_component, rule_format])
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1154
      using `e > 0` as
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1155
      apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1156
      done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1157
  qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1158
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1159
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1160
lemma open_non_path_component:
53593
a7bcbb5a17d8 removed outdated comments
huffman
parents: 51481
diff changeset
  1161
  fixes s :: "'a::real_normed_vector set"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1162
  assumes "open s"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1163
  shows "open (s - {y. path_component s x y})"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1164
  unfolding open_contains_ball
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1165
proof
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1166
  fix y
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1167
  assume as: "y \<in> s - {y. path_component s x y}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1168
  then obtain e where e: "e > 0" "ball y e \<subseteq> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1169
    using assms [unfolded open_contains_ball]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1170
    by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1171
  show "\<exists>e>0. ball y e \<subseteq> s - {y. path_component s x y}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1172
    apply (rule_tac x=e in exI)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1173
    apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1174
    apply (rule `e>0`)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1175
    apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1176
    apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1177
    defer
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1178
  proof (rule ccontr)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1179
    fix z
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1180
    assume "z \<in> ball y e" "\<not> z \<notin> {y. path_component s x y}"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
  1181
    then have "y \<in> {y. path_component s x y}"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1182
      unfolding not_not mem_Collect_eq using `e>0`
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1183
      apply -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1184
      apply (rule path_component_trans, assumption)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1185
      apply (rule path_component_of_subset[OF e(2)])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1186
      apply (rule convex_imp_path_connected[OF convex_ball, unfolded path_connected_component, rule_format])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1187
      apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1188
      done
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1189
    then show False
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1190
      using as by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1191
  qed (insert e(2), auto)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1192
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1193
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1194
lemma connected_open_path_connected:
53593
a7bcbb5a17d8 removed outdated comments
huffman
parents: 51481
diff changeset
  1195
  fixes s :: "'a::real_normed_vector set"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1196
  assumes "open s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1197
    and "connected s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1198
  shows "path_connected s"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1199
  unfolding path_connected_component_set
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1200
proof (rule, rule, rule path_component_subset, rule)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1201
  fix x y
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1202
  assume "x \<in> s" and "y \<in> s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1203
  show "y \<in> {y. path_component s x y}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1204
  proof (rule ccontr)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1205
    assume "\<not> ?thesis"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1206
    moreover have "{y. path_component s x y} \<inter> s \<noteq> {}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1207
      using `x \<in> s` path_component_eq_empty path_component_subset[of s x]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1208
      by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1209
    ultimately
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1210
    show False
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1211
      using `y \<in> s` open_non_path_component[OF assms(1)] open_path_component[OF assms(1)]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1212
      using assms(2)[unfolded connected_def not_ex, rule_format,
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1213
        of"{y. path_component s x y}" "s - {y. path_component s x y}"]
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1214
      by auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1215
  qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1216
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1217
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1218
lemma path_connected_continuous_image:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1219
  assumes "continuous_on s f"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1220
    and "path_connected s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1221
  shows "path_connected (f ` s)"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1222
  unfolding path_connected_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1223
proof (rule, rule)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1224
  fix x' y'
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1225
  assume "x' \<in> f ` s" "y' \<in> f ` s"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1226
  then obtain x y where x: "x \<in> s" and y: "y \<in> s" and x': "x' = f x" and y': "y' = f y"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1227
    by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1228
  from x y obtain g where "path g \<and> path_image g \<subseteq> s \<and> pathstart g = x \<and> pathfinish g = y"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1229
    using assms(2)[unfolded path_connected_def] by fast
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
  1230
  then show "\<exists>g. path g \<and> path_image g \<subseteq> f ` s \<and> pathstart g = x' \<and> pathfinish g = y'"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1231
    unfolding x' y'
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1232
    apply (rule_tac x="f \<circ> g" in exI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1233
    unfolding path_defs
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51478
diff changeset
  1234
    apply (intro conjI continuous_on_compose continuous_on_subset[OF assms(1)])
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51478
diff changeset
  1235
    apply auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1236
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1237
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1238
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1239
lemma homeomorphic_path_connectedness:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1240
  "s homeomorphic t \<Longrightarrow> path_connected s \<longleftrightarrow> path_connected t"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1241
  unfolding homeomorphic_def homeomorphism_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1242
  apply (erule exE|erule conjE)+
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1243
  apply rule
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1244
  apply (drule_tac f=f in path_connected_continuous_image)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1245
  prefer 3
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1246
  apply (drule_tac f=g in path_connected_continuous_image)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1247
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1248
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1249
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1250
lemma path_connected_empty: "path_connected {}"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1251
  unfolding path_connected_def by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1252
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1253
lemma path_connected_singleton: "path_connected {a}"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1254
  unfolding path_connected_def pathstart_def pathfinish_def path_image_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1255
  apply clarify
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1256
  apply (rule_tac x="\<lambda>x. a" in exI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1257
  apply (simp add: image_constant_conv)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1258
  apply (simp add: path_def continuous_on_const)
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1259
  done
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1260
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1261
lemma path_connected_Un:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1262
  assumes "path_connected s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1263
    and "path_connected t"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1264
    and "s \<inter> t \<noteq> {}"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1265
  shows "path_connected (s \<union> t)"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1266
  unfolding path_connected_component
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1267
proof (rule, rule)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1268
  fix x y
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1269
  assume as: "x \<in> s \<union> t" "y \<in> s \<union> t"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1270
  from assms(3) obtain z where "z \<in> s \<inter> t"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1271
    by auto
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
  1272
  then show "path_component (s \<union> t) x y"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1273
    using as and assms(1-2)[unfolded path_connected_component]
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1274
    apply -
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1275
    apply (erule_tac[!] UnE)+
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1276
    apply (rule_tac[2-3] path_component_trans[of _ _ z])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1277
    apply (auto simp add:path_component_of_subset [OF Un_upper1] path_component_of_subset[OF Un_upper2])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1278
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1279
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1280
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1281
lemma path_connected_UNION:
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1282
  assumes "\<And>i. i \<in> A \<Longrightarrow> path_connected (S i)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1283
    and "\<And>i. i \<in> A \<Longrightarrow> z \<in> S i"
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1284
  shows "path_connected (\<Union>i\<in>A. S i)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1285
  unfolding path_connected_component
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1286
proof clarify
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1287
  fix x i y j
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1288
  assume *: "i \<in> A" "x \<in> S i" "j \<in> A" "y \<in> S j"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
  1289
  then have "path_component (S i) x z" and "path_component (S j) z y"
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1290
    using assms by (simp_all add: path_connected_component)
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
  1291
  then have "path_component (\<Union>i\<in>A. S i) x z" and "path_component (\<Union>i\<in>A. S i) z y"
48125
602dc0215954 tuned proofs -- prefer direct "rotated" instead of old-style COMP;
wenzelm
parents: 44647
diff changeset
  1292
    using *(1,3) by (auto elim!: path_component_of_subset [rotated])
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
  1293
  then show "path_component (\<Union>i\<in>A. S i) x y"
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1294
    by (rule path_component_trans)
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1295
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1296
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1297
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1298
subsection {* Sphere is path-connected *}
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36583
diff changeset
  1299
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1300
lemma path_connected_punctured_universe:
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1301
  assumes "2 \<le> DIM('a::euclidean_space)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1302
  shows "path_connected ((UNIV::'a set) - {a})"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1303
proof -
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1304
  let ?A = "{x::'a. \<exists>i\<in>Basis. x \<bullet> i < a \<bullet> i}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1305
  let ?B = "{x::'a. \<exists>i\<in>Basis. a \<bullet> i < x \<bullet> i}"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1306
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1307
  have A: "path_connected ?A"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1308
    unfolding Collect_bex_eq
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1309
  proof (rule path_connected_UNION)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1310
    fix i :: 'a
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1311
    assume "i \<in> Basis"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1312
    then show "(\<Sum>i\<in>Basis. (a \<bullet> i - 1)*\<^sub>R i) \<in> {x::'a. x \<bullet> i < a \<bullet> i}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1313
      by simp
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1314
    show "path_connected {x. x \<bullet> i < a \<bullet> i}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1315
      using convex_imp_path_connected [OF convex_halfspace_lt, of i "a \<bullet> i"]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1316
      by (simp add: inner_commute)
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1317
  qed
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1318
  have B: "path_connected ?B"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1319
    unfolding Collect_bex_eq
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1320
  proof (rule path_connected_UNION)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1321
    fix i :: 'a
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1322
    assume "i \<in> Basis"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1323
    then show "(\<Sum>i\<in>Basis. (a \<bullet> i + 1) *\<^sub>R i) \<in> {x::'a. a \<bullet> i < x \<bullet> i}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1324
      by simp
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1325
    show "path_connected {x. a \<bullet> i < x \<bullet> i}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1326
      using convex_imp_path_connected [OF convex_halfspace_gt, of "a \<bullet> i" i]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1327
      by (simp add: inner_commute)
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1328
  qed
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1329
  obtain S :: "'a set" where "S \<subseteq> Basis" and "card S = Suc (Suc 0)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1330
    using ex_card[OF assms]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1331
    by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1332
  then obtain b0 b1 :: 'a where "b0 \<in> Basis" and "b1 \<in> Basis" and "b0 \<noteq> b1"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1333
    unfolding card_Suc_eq by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1334
  then have "a + b0 - b1 \<in> ?A \<inter> ?B"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1335
    by (auto simp: inner_simps inner_Basis)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1336
  then have "?A \<inter> ?B \<noteq> {}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1337
    by fast
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1338
  with A B have "path_connected (?A \<union> ?B)"
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1339
    by (rule path_connected_Un)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49654
diff changeset
  1340
  also have "?A \<union> ?B = {x. \<exists>i\<in>Basis. x \<bullet> i \<noteq> a \<bullet> i}"
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1341
    unfolding neq_iff bex_disj_distrib Collect_disj_eq ..
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1342
  also have "\<dots> = {x. x \<noteq> a}"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1343
    unfolding euclidean_eq_iff [where 'a='a]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1344
    by (simp add: Bex_def)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1345
  also have "\<dots> = UNIV - {a}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1346
    by auto
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1347
  finally show ?thesis .
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1348
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1349
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1350
lemma path_connected_sphere:
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1351
  assumes "2 \<le> DIM('a::euclidean_space)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1352
  shows "path_connected {x::'a. norm (x - a) = r}"
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1353
proof (rule linorder_cases [of r 0])
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1354
  assume "r < 0"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1355
  then have "{x::'a. norm(x - a) = r} = {}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1356
    by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1357
  then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1358
    using path_connected_empty by simp
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1359
next
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1360
  assume "r = 0"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1361
  then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1362
    using path_connected_singleton by simp
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1363
next
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1364
  assume r: "0 < r"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1365
  have *: "{x::'a. norm(x - a) = r} = (\<lambda>x. a + r *\<^sub>R x) ` {x. norm x = 1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1366
    apply (rule set_eqI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1367
    apply rule
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1368
    unfolding image_iff
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1369
    apply (rule_tac x="(1/r) *\<^sub>R (x - a)" in bexI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1370
    unfolding mem_Collect_eq norm_scaleR
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1371
    using r
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1372
    apply (auto simp add: scaleR_right_diff_distrib)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1373
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1374
  have **: "{x::'a. norm x = 1} = (\<lambda>x. (1/norm x) *\<^sub>R x) ` (UNIV - {0})"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1375
    apply (rule set_eqI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1376
    apply rule
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1377
    unfolding image_iff
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1378
    apply (rule_tac x=x in bexI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1379
    unfolding mem_Collect_eq
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1380
    apply (auto split: split_if_asm)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
  1381
    done
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44531
diff changeset
  1382
  have "continuous_on (UNIV - {0}) (\<lambda>x::'a. 1 / norm x)"
59557
ebd8ecacfba6 establish unique preferred fact names
haftmann
parents: 58877
diff changeset
  1383
    by (auto intro!: continuous_intros)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1384
  then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1385
    unfolding * **
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1386
    using path_connected_punctured_universe[OF assms]
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
  1387
    by (auto intro!: path_connected_continuous_image continuous_intros)
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
  1388
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1389
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1390
lemma connected_sphere: "2 \<le> DIM('a::euclidean_space) \<Longrightarrow> connected {x::'a. norm (x - a) = r}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1391
  using path_connected_sphere path_connected_imp_connected
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
  1392
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1393
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
  1394
end