src/HOL/Multivariate_Analysis/Path_Connected.thy
author blanchet
Fri, 01 Aug 2014 14:43:57 +0200
changeset 57743 0af2d5dfb0ac
parent 56371 fb9ae0727548
child 58877 262572d90bc6
permissions -rw-r--r--
pushing skolems under 'iff' sometimes breaks things further down the proof (as was to be feared)
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
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
     2
    Author:     Robert Himmelmann, TU Muenchen
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
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
     5
header {* Continuous paths and path-connected sets *}
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
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    11
subsection {* Paths. *}
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    12
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    13
definition path :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> bool"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    14
  where "path g \<longleftrightarrow> continuous_on {0..1} g"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    15
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    16
definition pathstart :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> 'a"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    17
  where "pathstart g = g 0"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    18
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    19
definition pathfinish :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> 'a"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    20
  where "pathfinish g = g 1"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    21
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    22
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
    23
  where "path_image g = g ` {0 .. 1}"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    24
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    25
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
    26
  where "reversepath g = (\<lambda>x. g(1 - x))"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    27
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    28
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
    29
    (infixr "+++" 75)
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    30
  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
    31
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    32
definition simple_path :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> bool"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    33
  where "simple_path g \<longleftrightarrow>
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    34
    (\<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
    35
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    36
definition injective_path :: "(real \<Rightarrow> 'a::topological_space) \<Rightarrow> bool"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    37
  where "injective_path g \<longleftrightarrow> (\<forall>x\<in>{0..1}. \<forall>y\<in>{0..1}. g x = g y \<longrightarrow> x = y)"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    38
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    39
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    40
subsection {* Some lemmas about these concepts. *}
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    41
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    42
lemma injective_imp_simple_path: "injective_path g \<Longrightarrow> simple_path g"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    43
  unfolding injective_path_def simple_path_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    44
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    45
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    46
lemma path_image_nonempty: "path_image g \<noteq> {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 53640
diff changeset
    47
  unfolding path_image_def image_is_empty box_eq_empty
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    48
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    49
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    50
lemma pathstart_in_path_image[intro]: "pathstart g \<in> path_image g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    51
  unfolding pathstart_def path_image_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    52
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    53
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    54
lemma pathfinish_in_path_image[intro]: "pathfinish g \<in> path_image g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    55
  unfolding pathfinish_def path_image_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    56
  by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    57
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    58
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
    59
  unfolding path_def path_image_def
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    60
  apply (erule connected_continuous_image)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    61
  apply (rule convex_connected, rule convex_real_interval)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    62
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    63
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    64
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
    65
  unfolding path_def path_image_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    66
  apply (erule compact_continuous_image)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 53640
diff changeset
    67
  apply (rule compact_Icc)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    68
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    69
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    70
lemma reversepath_reversepath[simp]: "reversepath (reversepath g) = g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    71
  unfolding reversepath_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    72
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    73
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    74
lemma pathstart_reversepath[simp]: "pathstart (reversepath g) = pathfinish g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    75
  unfolding pathstart_def reversepath_def pathfinish_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    76
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    77
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    78
lemma pathfinish_reversepath[simp]: "pathfinish (reversepath g) = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    79
  unfolding pathstart_def reversepath_def pathfinish_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    80
  by auto
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
lemma pathstart_join[simp]: "pathstart (g1 +++ g2) = pathstart g1"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    83
  unfolding pathstart_def joinpaths_def pathfinish_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    84
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    85
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    86
lemma pathfinish_join[simp]: "pathfinish (g1 +++ g2) = pathfinish g2"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    87
  unfolding pathstart_def joinpaths_def pathfinish_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    88
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
    89
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    90
lemma path_image_reversepath[simp]: "path_image (reversepath g) = path_image g"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    91
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    92
  have *: "\<And>g. path_image (reversepath g) \<subseteq> path_image g"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    93
    unfolding path_image_def subset_eq reversepath_def Ball_def image_iff
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    94
    apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    95
    apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    96
    apply (erule bexE)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
    97
    apply (rule_tac x="1 - xa" in bexI)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    98
    apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
    99
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   100
  show ?thesis
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   101
    using *[of g] *[of "reversepath g"]
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   102
    unfolding reversepath_reversepath
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   103
    by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   104
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   105
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   106
lemma path_reversepath [simp]: "path (reversepath g) \<longleftrightarrow> path g"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   107
proof -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   108
  have *: "\<And>g. path g \<Longrightarrow> path (reversepath g)"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   109
    unfolding path_def reversepath_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   110
    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
   111
    apply (intro continuous_intros)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   112
    apply (rule continuous_on_subset[of "{0..1}"])
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   113
    apply assumption
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   114
    apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   115
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   116
  show ?thesis
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   117
    using *[of "reversepath g"] *[of g]
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   118
    unfolding reversepath_reversepath
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   119
    by (rule iffI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   120
qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   121
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   122
lemmas reversepath_simps =
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   123
  path_reversepath path_image_reversepath pathstart_reversepath pathfinish_reversepath
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   124
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   125
lemma path_join[simp]:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   126
  assumes "pathfinish g1 = pathstart g2"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   127
  shows "path (g1 +++ g2) \<longleftrightarrow> path g1 \<and> path g2"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   128
  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
   129
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
   130
  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
   131
  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
   132
    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
   133
  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
   134
    using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   135
    by (intro continuous_on_cong refl) (auto simp: joinpaths_def pathfinish_def pathstart_def)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   136
  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
   137
    unfolding g1 g2
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   138
    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
   139
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
   140
  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
   141
  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
   142
    by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   143
  {
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   144
    fix x :: real
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   145
    assume "0 \<le> x" and "x \<le> 1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   146
    then have "x \<in> (\<lambda>x. x * 2) ` {0..1 / 2}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   147
      by (intro image_eqI[where x="x/2"]) auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   148
  }
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
   149
  note 1 = this
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   150
  {
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   151
    fix x :: real
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   152
    assume "0 \<le> x" and "x \<le> 1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   153
    then have "x \<in> (\<lambda>x. x * 2 - 1) ` {1 / 2..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   154
      by (intro image_eqI[where x="x/2 + 1/2"]) auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   155
  }
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
   156
  note 2 = this
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   157
  show "continuous_on {0..1} (g1 +++ g2)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   158
    using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   159
    unfolding joinpaths_def 01
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   160
    apply (intro continuous_on_cases closed_atLeastAtMost g1g2[THEN continuous_on_compose2] continuous_intros)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   161
    apply (auto simp: field_simps pathfinish_def pathstart_def intro!: 1 2)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   162
    done
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   163
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   164
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   165
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
   166
  unfolding path_image_def joinpaths_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   167
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   168
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   169
lemma subset_path_image_join:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   170
  assumes "path_image g1 \<subseteq> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   171
    and "path_image g2 \<subseteq> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   172
  shows "path_image (g1 +++ g2) \<subseteq> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   173
  using path_image_join_subset[of g1 g2] and assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   174
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   175
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   176
lemma path_image_join:
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
   177
  assumes "pathfinish g1 = pathstart g2"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   178
  shows "path_image (g1 +++ g2) = path_image g1 \<union> path_image g2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   179
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   180
  apply (rule path_image_join_subset)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   181
  apply rule
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   182
  unfolding Un_iff
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   183
proof (erule disjE)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   184
  fix x
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   185
  assume "x \<in> path_image g1"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   186
  then obtain y where y: "y \<in> {0..1}" "x = g1 y"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   187
    unfolding path_image_def image_iff by auto
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   188
  then show "x \<in> path_image (g1 +++ g2)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   189
    unfolding joinpaths_def path_image_def image_iff
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   190
    apply (rule_tac x="(1/2) *\<^sub>R y" in bexI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   191
    apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   192
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   193
next
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   194
  fix x
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   195
  assume "x \<in> path_image g2"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   196
  then obtain y where y: "y \<in> {0..1}" "x = g2 y"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   197
    unfolding path_image_def image_iff by auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   198
  then show "x \<in> path_image (g1 +++ g2)"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   199
    unfolding joinpaths_def path_image_def image_iff
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   200
    apply (rule_tac x="(1/2) *\<^sub>R (y + 1)" in bexI)
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
   201
    using assms(1)[unfolded pathfinish_def pathstart_def]
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   202
    apply (auto simp add: add_divide_distrib)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   203
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   204
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   205
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   206
lemma not_in_path_image_join:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   207
  assumes "x \<notin> path_image g1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   208
    and "x \<notin> path_image g2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   209
  shows "x \<notin> path_image (g1 +++ g2)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   210
  using assms and path_image_join_subset[of g1 g2]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   211
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   212
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   213
lemma simple_path_reversepath:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   214
  assumes "simple_path g"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   215
  shows "simple_path (reversepath g)"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   216
  using assms
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   217
  unfolding simple_path_def reversepath_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   218
  apply -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   219
  apply (rule ballI)+
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   220
  apply (erule_tac x="1-x" in ballE)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   221
  apply (erule_tac x="1-y" in ballE)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   222
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   223
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   224
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   225
lemma simple_path_join_loop:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   226
  assumes "injective_path g1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   227
    and "injective_path g2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   228
    and "pathfinish g2 = pathstart g1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   229
    and "path_image g1 \<inter> path_image g2 \<subseteq> {pathstart g1, pathstart g2}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   230
  shows "simple_path (g1 +++ g2)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   231
  unfolding simple_path_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   232
proof (intro ballI impI)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   233
  let ?g = "g1 +++ g2"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   234
  note inj = assms(1,2)[unfolded injective_path_def, rule_format]
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   235
  fix x y :: real
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   236
  assume xy: "x \<in> {0..1}" "y \<in> {0..1}" "?g x = ?g y"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   237
  show "x = y \<or> x = 0 \<and> y = 1 \<or> x = 1 \<and> y = 0"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   238
  proof (cases "x \<le> 1/2", case_tac[!] "y \<le> 1/2", unfold not_le)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   239
    assume as: "x \<le> 1 / 2" "y \<le> 1 / 2"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   240
    then have "g1 (2 *\<^sub>R x) = g1 (2 *\<^sub>R y)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   241
      using xy(3)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   242
      unfolding joinpaths_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   243
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   244
    moreover have "2 *\<^sub>R x \<in> {0..1}" "2 *\<^sub>R y \<in> {0..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   245
      using xy(1,2) as
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   246
      by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   247
    ultimately show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   248
      using inj(1)[of "2*\<^sub>R x" "2*\<^sub>R y"]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   249
      by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   250
  next
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   251
    assume as: "x > 1 / 2" "y > 1 / 2"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   252
    then have "g2 (2 *\<^sub>R x - 1) = g2 (2 *\<^sub>R y - 1)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   253
      using xy(3)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   254
      unfolding joinpaths_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   255
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   256
    moreover have "2 *\<^sub>R x - 1 \<in> {0..1}" "2 *\<^sub>R y - 1 \<in> {0..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   257
      using xy(1,2) as
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   258
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   259
    ultimately show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   260
      using inj(2)[of "2*\<^sub>R x - 1" "2*\<^sub>R y - 1"] by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   261
  next
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   262
    assume as: "x \<le> 1 / 2" "y > 1 / 2"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   263
    then have "?g x \<in> path_image g1" "?g y \<in> path_image g2"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   264
      unfolding path_image_def joinpaths_def
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   265
      using xy(1,2) by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   266
    moreover have "?g y \<noteq> pathstart g2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   267
      using as(2)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   268
      unfolding pathstart_def joinpaths_def
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   269
      using inj(2)[of "2 *\<^sub>R y - 1" 0] and xy(2)
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   270
      by (auto simp add: field_simps)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   271
    ultimately have *: "?g x = pathstart g1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   272
      using assms(4)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   273
      unfolding xy(3)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   274
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   275
    then have "x = 0"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   276
      unfolding pathstart_def joinpaths_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   277
      using as(1) and xy(1)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   278
      using inj(1)[of "2 *\<^sub>R x" 0]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   279
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   280
    moreover have "y = 1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   281
      using *
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   282
      unfolding xy(3) assms(3)[symmetric]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   283
      unfolding joinpaths_def pathfinish_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   284
      using as(2) and xy(2)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   285
      using inj(2)[of "2 *\<^sub>R y - 1" 1]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   286
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   287
    ultimately show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   288
      by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   289
  next
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   290
    assume as: "x > 1 / 2" "y \<le> 1 / 2"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   291
    then have "?g x \<in> path_image g2" and "?g y \<in> path_image g1"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   292
      unfolding path_image_def joinpaths_def
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   293
      using xy(1,2) by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   294
    moreover have "?g x \<noteq> pathstart g2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   295
      using as(1)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   296
      unfolding pathstart_def joinpaths_def
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   297
      using inj(2)[of "2 *\<^sub>R x - 1" 0] and xy(1)
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   298
      by (auto simp add: field_simps)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   299
    ultimately have *: "?g y = pathstart g1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   300
      using assms(4)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   301
      unfolding xy(3)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   302
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   303
    then have "y = 0"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   304
      unfolding pathstart_def joinpaths_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   305
      using as(2) and xy(2)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   306
      using inj(1)[of "2 *\<^sub>R y" 0]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   307
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   308
    moreover have "x = 1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   309
      using *
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   310
      unfolding xy(3)[symmetric] assms(3)[symmetric]
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   311
      unfolding joinpaths_def pathfinish_def using as(1) and xy(1)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   312
      using inj(2)[of "2 *\<^sub>R x - 1" 1]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   313
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   314
    ultimately show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   315
      by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   316
  qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   317
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   318
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   319
lemma injective_path_join:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   320
  assumes "injective_path g1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   321
    and "injective_path g2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   322
    and "pathfinish g1 = pathstart g2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   323
    and "path_image g1 \<inter> path_image g2 \<subseteq> {pathstart g2}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   324
  shows "injective_path (g1 +++ g2)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   325
  unfolding injective_path_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   326
proof (rule, rule, rule)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   327
  let ?g = "g1 +++ g2"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   328
  note inj = assms(1,2)[unfolded injective_path_def, rule_format]
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   329
  fix x y
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   330
  assume xy: "x \<in> {0..1}" "y \<in> {0..1}" "(g1 +++ g2) x = (g1 +++ g2) y"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   331
  show "x = y"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   332
  proof (cases "x \<le> 1/2", case_tac[!] "y \<le> 1/2", unfold not_le)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   333
    assume "x \<le> 1 / 2" and "y \<le> 1 / 2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   334
    then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   335
      using inj(1)[of "2*\<^sub>R x" "2*\<^sub>R y"] and xy
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   336
      unfolding joinpaths_def by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   337
  next
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   338
    assume "x > 1 / 2" and "y > 1 / 2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   339
    then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   340
      using inj(2)[of "2*\<^sub>R x - 1" "2*\<^sub>R y - 1"] and xy
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   341
      unfolding joinpaths_def by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   342
  next
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   343
    assume as: "x \<le> 1 / 2" "y > 1 / 2"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   344
    then have "?g x \<in> path_image g1" and "?g y \<in> path_image g2"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   345
      unfolding path_image_def joinpaths_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   346
      using xy(1,2)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   347
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   348
    then have "?g x = pathfinish g1" and "?g y = pathstart g2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   349
      using assms(4)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   350
      unfolding assms(3) xy(3)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   351
      by auto
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   352
    then show ?thesis
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   353
      using as and inj(1)[of "2 *\<^sub>R x" 1] inj(2)[of "2 *\<^sub>R y - 1" 0] and xy(1,2)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   354
      unfolding pathstart_def pathfinish_def joinpaths_def
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   355
      by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   356
  next
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   357
    assume as:"x > 1 / 2" "y \<le> 1 / 2"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   358
    then have "?g x \<in> path_image g2" and "?g y \<in> path_image g1"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   359
      unfolding path_image_def joinpaths_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   360
      using xy(1,2)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   361
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   362
    then have "?g x = pathstart g2" and "?g y = pathfinish g1"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   363
      using assms(4)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   364
      unfolding assms(3) xy(3)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   365
      by auto
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   366
    then show ?thesis using as and inj(2)[of "2 *\<^sub>R x - 1" 0] inj(1)[of "2 *\<^sub>R y" 1] and xy(1,2)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   367
      unfolding pathstart_def pathfinish_def joinpaths_def
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   368
      by auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   369
  qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   370
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   371
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   372
lemmas join_paths_simps = path_join path_image_join pathstart_join pathfinish_join
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   373
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   374
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   375
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
   376
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   377
definition shiftpath :: "real \<Rightarrow> (real \<Rightarrow> 'a::topological_space) \<Rightarrow> real \<Rightarrow> 'a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   378
  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
   379
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   380
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
   381
  unfolding pathstart_def shiftpath_def by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   382
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   383
lemma pathfinish_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   384
  assumes "0 \<le> a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   385
    and "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   386
  shows "pathfinish (shiftpath a g) = g a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   387
  using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   388
  unfolding pathstart_def pathfinish_def shiftpath_def
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   389
  by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   390
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   391
lemma endpoints_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   392
  assumes "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   393
    and "a \<in> {0 .. 1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   394
  shows "pathfinish (shiftpath a g) = g a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   395
    and "pathstart (shiftpath a g) = g a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   396
  using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   397
  by (auto intro!: pathfinish_shiftpath pathstart_shiftpath)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   398
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   399
lemma closed_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   400
  assumes "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   401
    and "a \<in> {0..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   402
  shows "pathfinish (shiftpath a g) = pathstart (shiftpath a g)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   403
  using endpoints_shiftpath[OF assms]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   404
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   405
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   406
lemma path_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   407
  assumes "path g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   408
    and "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   409
    and "a \<in> {0..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   410
  shows "path (shiftpath a g)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   411
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   412
  have *: "{0 .. 1} = {0 .. 1-a} \<union> {1-a .. 1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   413
    using assms(3) by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   414
  have **: "\<And>x. x + a = 1 \<Longrightarrow> g (x + a - 1) = g (x + a)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   415
    using assms(2)[unfolded pathfinish_def pathstart_def]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   416
    by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   417
  show ?thesis
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   418
    unfolding path_def shiftpath_def *
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   419
    apply (rule continuous_on_union)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   420
    apply (rule closed_real_atLeastAtMost)+
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   421
    apply (rule continuous_on_eq[of _ "g \<circ> (\<lambda>x. a + x)"])
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   422
    prefer 3
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   423
    apply (rule continuous_on_eq[of _ "g \<circ> (\<lambda>x. a - 1 + x)"])
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   424
    defer
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   425
    prefer 3
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   426
    apply (rule continuous_intros)+
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   427
    prefer 2
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   428
    apply (rule continuous_intros)+
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   429
    apply (rule_tac[1-2] continuous_on_subset[OF assms(1)[unfolded path_def]])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   430
    using assms(3) and **
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   431
    apply auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   432
    apply (auto simp add: field_simps)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   433
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   434
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   435
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   436
lemma shiftpath_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   437
  assumes "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   438
    and "a \<in> {0..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   439
    and "x \<in> {0..1}"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   440
  shows "shiftpath (1 - a) (shiftpath a g) x = g x"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   441
  using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   442
  unfolding pathfinish_def pathstart_def shiftpath_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   443
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   444
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   445
lemma path_image_shiftpath:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   446
  assumes "a \<in> {0..1}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   447
    and "pathfinish g = pathstart g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   448
  shows "path_image (shiftpath a g) = path_image g"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   449
proof -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   450
  { fix x
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   451
    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
   452
    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
   453
    proof (cases "a \<le> x")
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   454
      case False
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   455
      then show ?thesis
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   456
        apply (rule_tac x="1 + x - a" in bexI)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   457
        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
   458
        apply (auto simp add: field_simps atomize_not)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   459
        done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   460
    next
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   461
      case True
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   462
      then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   463
        using as(1-2) and assms(1)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   464
        apply (rule_tac x="x - a" in bexI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   465
        apply (auto simp add: field_simps)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   466
        done
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   467
    qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   468
  }
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   469
  then show ?thesis
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   470
    using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   471
    unfolding shiftpath_def path_image_def pathfinish_def pathstart_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   472
    by (auto simp add: image_iff)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   473
qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   474
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   475
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   476
subsection {* Special case of straight-line paths *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   477
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   478
definition linepath :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> real \<Rightarrow> 'a"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   479
  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
   480
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   481
lemma pathstart_linepath[simp]: "pathstart (linepath a b) = a"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   482
  unfolding pathstart_def linepath_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   483
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   484
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   485
lemma pathfinish_linepath[simp]: "pathfinish (linepath a b) = b"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   486
  unfolding pathfinish_def linepath_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   487
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   488
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   489
lemma continuous_linepath_at[intro]: "continuous (at x) (linepath a b)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   490
  unfolding linepath_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   491
  by (intro continuous_intros)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   492
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   493
lemma continuous_on_linepath[intro]: "continuous_on s (linepath a b)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   494
  using continuous_linepath_at
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   495
  by (auto intro!: continuous_at_imp_continuous_on)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   496
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   497
lemma path_linepath[intro]: "path (linepath a b)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   498
  unfolding path_def
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   499
  by (rule continuous_on_linepath)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   500
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   501
lemma path_image_linepath[simp]: "path_image (linepath a b) = closed_segment a b"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   502
  unfolding path_image_def segment linepath_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   503
  apply (rule set_eqI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   504
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   505
  defer
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   506
  unfolding mem_Collect_eq image_iff
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   507
  apply (erule exE)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   508
  apply (rule_tac x="u *\<^sub>R 1" in bexI)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   509
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   510
  done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   511
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   512
lemma reversepath_linepath[simp]: "reversepath (linepath a b) = linepath b a"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   513
  unfolding reversepath_def linepath_def
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   514
  by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   515
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   516
lemma injective_path_linepath:
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   517
  assumes "a \<noteq> b"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   518
  shows "injective_path (linepath a b)"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   519
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   520
  {
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   521
    fix x y :: "real"
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   522
    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
   523
    then have "(x - y) *\<^sub>R a = (x - y) *\<^sub>R b"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   524
      by (simp add: algebra_simps)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   525
    with assms have "x = y"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   526
      by simp
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   527
  }
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   528
  then show ?thesis
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   529
    unfolding injective_path_def linepath_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   530
    by (auto simp add: algebra_simps)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   531
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   532
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   533
lemma simple_path_linepath[intro]: "a \<noteq> b \<Longrightarrow> simple_path (linepath a b)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   534
  by (auto intro!: injective_imp_simple_path injective_path_linepath)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   535
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   536
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   537
subsection {* Bounding a point away from a path *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   538
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   539
lemma not_on_path_ball:
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   540
  fixes g :: "real \<Rightarrow> 'a::heine_borel"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   541
  assumes "path g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   542
    and "z \<notin> path_image g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   543
  shows "\<exists>e > 0. ball z e \<inter> path_image g = {}"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   544
proof -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   545
  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
   546
    using distance_attains_inf[OF _ path_image_nonempty, of g z]
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   547
    using compact_path_image[THEN compact_imp_closed, OF assms(1)] by auto
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   548
  then show ?thesis
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   549
    apply (rule_tac x="dist z a" in exI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   550
    using assms(2)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   551
    apply (auto intro!: dist_pos_lt)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   552
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   553
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   554
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   555
lemma not_on_path_cball:
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   556
  fixes g :: "real \<Rightarrow> 'a::heine_borel"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   557
  assumes "path g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   558
    and "z \<notin> path_image g"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   559
  shows "\<exists>e>0. cball z e \<inter> (path_image g) = {}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   560
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   561
  obtain e where "ball z e \<inter> path_image g = {}" "e > 0"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   562
    using not_on_path_ball[OF assms] by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   563
  moreover have "cball z (e/2) \<subseteq> ball z e"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   564
    using `e > 0` by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   565
  ultimately show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   566
    apply (rule_tac x="e/2" in exI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   567
    apply auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   568
    done
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   569
qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   570
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   571
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   572
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
   573
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   574
definition "path_component s x y \<longleftrightarrow>
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   575
  (\<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
   576
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   577
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
   578
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   579
lemma path_component_mem:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   580
  assumes "path_component s x y"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   581
  shows "x \<in> s" and "y \<in> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   582
  using assms
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   583
  unfolding path_defs
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   584
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   585
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   586
lemma path_component_refl:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   587
  assumes "x \<in> s"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   588
  shows "path_component s x x"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   589
  unfolding path_defs
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   590
  apply (rule_tac x="\<lambda>u. x" in exI)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   591
  using assms
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   592
  apply (auto intro!: continuous_intros)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   593
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   594
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   595
lemma path_component_refl_eq: "path_component s x x \<longleftrightarrow> x \<in> s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   596
  by (auto intro!: path_component_mem path_component_refl)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   597
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   598
lemma path_component_sym: "path_component s x y \<Longrightarrow> path_component s y x"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   599
  using assms
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   600
  unfolding path_component_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   601
  apply (erule exE)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   602
  apply (rule_tac x="reversepath g" in exI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   603
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   604
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   605
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   606
lemma path_component_trans:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   607
  assumes "path_component s x y"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   608
    and "path_component s y z"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   609
  shows "path_component s x z"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   610
  using assms
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   611
  unfolding path_component_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   612
  apply (elim exE)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   613
  apply (rule_tac x="g +++ ga" in exI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   614
  apply (auto simp add: path_image_join)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   615
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   616
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   617
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
   618
  unfolding path_component_def by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   619
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   620
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   621
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
   622
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   623
lemma path_component_set:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   624
  "{y. path_component s x y} =
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   625
    {y. (\<exists>g. path g \<and> path_image g \<subseteq> s \<and> pathstart g = x \<and> pathfinish g = y)}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   626
  apply (rule set_eqI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   627
  unfolding mem_Collect_eq
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   628
  unfolding path_component_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   629
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   630
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   631
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 41959
diff changeset
   632
lemma path_component_subset: "{y. path_component s x y} \<subseteq> s"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   633
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   634
  apply (rule path_component_mem(2))
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   635
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   636
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   637
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 41959
diff changeset
   638
lemma path_component_eq_empty: "{y. path_component s x y} = {} \<longleftrightarrow> x \<notin> s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   639
  apply rule
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   640
  apply (drule equals0D[of _ x])
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   641
  defer
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   642
  apply (rule equals0I)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   643
  unfolding mem_Collect_eq
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   644
  apply (drule path_component_mem(1))
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   645
  using path_component_refl
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   646
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   647
  done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   648
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   649
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   650
subsection {* Path connectedness of a space *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   651
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   652
definition "path_connected s \<longleftrightarrow>
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   653
  (\<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
   654
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   655
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
   656
  unfolding path_connected_def path_component_def by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   657
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   658
lemma path_connected_component_set: "path_connected s \<longleftrightarrow> (\<forall>x\<in>s. {y. path_component s x y} = s)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   659
  unfolding path_connected_component
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   660
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   661
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   662
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   663
  apply (rule path_component_subset)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   664
  unfolding subset_eq mem_Collect_eq Ball_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   665
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   666
  done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   667
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   668
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   669
subsection {* Some useful lemmas about path-connectedness *}
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   670
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   671
lemma convex_imp_path_connected:
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   672
  fixes s :: "'a::real_normed_vector set"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   673
  assumes "convex s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   674
  shows "path_connected s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   675
  unfolding path_connected_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   676
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   677
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   678
  apply (rule_tac x = "linepath x y" in exI)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   679
  unfolding path_image_linepath
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   680
  using assms [unfolded convex_contains_segment]
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   681
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   682
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   683
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   684
lemma path_connected_imp_connected:
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   685
  assumes "path_connected s"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   686
  shows "connected s"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   687
  unfolding connected_def not_ex
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   688
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   689
  apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   690
  apply (rule ccontr)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   691
  unfolding not_not
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   692
  apply (elim conjE)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   693
proof -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   694
  fix e1 e2
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   695
  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
   696
  then obtain x1 x2 where obt:"x1 \<in> e1 \<inter> s" "x2 \<in> e2 \<inter> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   697
    by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   698
  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
   699
    using assms[unfolded path_connected_def,rule_format,of x1 x2] by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   700
  have *: "connected {0..1::real}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   701
    by (auto intro!: convex_connected convex_real_interval)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   702
  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
   703
    using as(3) g(2)[unfolded path_defs] by blast
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   704
  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
   705
    using as(4) g(2)[unfolded path_defs]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   706
    unfolding subset_eq
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   707
    by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   708
  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
   709
    using g(3,4)[unfolded path_defs]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   710
    using obt
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   711
    by (simp add: ex_in_conv [symmetric], metis zero_le_one order_refl)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   712
  ultimately show False
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   713
    using *[unfolded connected_local not_ex, rule_format,
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   714
      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
   715
    using continuous_open_in_preimage[OF g(1)[unfolded path_def] as(1)]
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   716
    using continuous_open_in_preimage[OF g(1)[unfolded path_def] as(2)]
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   717
    by auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   718
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   719
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   720
lemma open_path_component:
53593
a7bcbb5a17d8 removed outdated comments
huffman
parents: 51481
diff changeset
   721
  fixes s :: "'a::real_normed_vector set"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   722
  assumes "open s"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   723
  shows "open {y. path_component s x y}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   724
  unfolding open_contains_ball
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   725
proof
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   726
  fix y
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   727
  assume as: "y \<in> {y. path_component s x y}"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   728
  then have "y \<in> s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   729
    apply -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   730
    apply (rule path_component_mem(2))
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   731
    unfolding mem_Collect_eq
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   732
    apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   733
    done
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   734
  then obtain e where e: "e > 0" "ball y e \<subseteq> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   735
    using assms[unfolded open_contains_ball]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   736
    by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   737
  show "\<exists>e > 0. ball y e \<subseteq> {y. path_component s x y}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   738
    apply (rule_tac x=e in exI)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   739
    apply (rule,rule `e>0`)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   740
    apply rule
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   741
    unfolding mem_ball mem_Collect_eq
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   742
  proof -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   743
    fix z
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   744
    assume "dist y z < e"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   745
    then show "path_component s x z"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   746
      apply (rule_tac path_component_trans[of _ _ y])
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   747
      defer
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   748
      apply (rule path_component_of_subset[OF e(2)])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   749
      apply (rule convex_imp_path_connected[OF convex_ball, unfolded path_connected_component, rule_format])
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   750
      using `e > 0` as
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   751
      apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   752
      done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   753
  qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   754
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   755
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   756
lemma open_non_path_component:
53593
a7bcbb5a17d8 removed outdated comments
huffman
parents: 51481
diff changeset
   757
  fixes s :: "'a::real_normed_vector set"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   758
  assumes "open s"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   759
  shows "open (s - {y. path_component s x y})"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   760
  unfolding open_contains_ball
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   761
proof
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   762
  fix y
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   763
  assume as: "y \<in> s - {y. path_component s x y}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   764
  then obtain e where e: "e > 0" "ball y e \<subseteq> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   765
    using assms [unfolded open_contains_ball]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   766
    by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   767
  show "\<exists>e>0. ball y e \<subseteq> s - {y. path_component s x y}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   768
    apply (rule_tac x=e in exI)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   769
    apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   770
    apply (rule `e>0`)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   771
    apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   772
    apply rule
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   773
    defer
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   774
  proof (rule ccontr)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   775
    fix z
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   776
    assume "z \<in> ball y e" "\<not> z \<notin> {y. path_component s x y}"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   777
    then have "y \<in> {y. path_component s x y}"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   778
      unfolding not_not mem_Collect_eq using `e>0`
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   779
      apply -
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   780
      apply (rule path_component_trans, assumption)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   781
      apply (rule path_component_of_subset[OF e(2)])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   782
      apply (rule convex_imp_path_connected[OF convex_ball, unfolded path_connected_component, rule_format])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   783
      apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   784
      done
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   785
    then show False
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   786
      using as by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   787
  qed (insert e(2), auto)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   788
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   789
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   790
lemma connected_open_path_connected:
53593
a7bcbb5a17d8 removed outdated comments
huffman
parents: 51481
diff changeset
   791
  fixes s :: "'a::real_normed_vector set"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   792
  assumes "open s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   793
    and "connected s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   794
  shows "path_connected s"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   795
  unfolding path_connected_component_set
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   796
proof (rule, rule, rule path_component_subset, rule)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   797
  fix x y
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   798
  assume "x \<in> s" and "y \<in> s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   799
  show "y \<in> {y. path_component s x y}"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   800
  proof (rule ccontr)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   801
    assume "\<not> ?thesis"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   802
    moreover have "{y. path_component s x y} \<inter> s \<noteq> {}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   803
      using `x \<in> s` path_component_eq_empty path_component_subset[of s x]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   804
      by auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   805
    ultimately
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   806
    show False
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   807
      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
   808
      using assms(2)[unfolded connected_def not_ex, rule_format,
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   809
        of"{y. path_component s x y}" "s - {y. path_component s x y}"]
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   810
      by auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   811
  qed
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   812
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   813
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   814
lemma path_connected_continuous_image:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   815
  assumes "continuous_on s f"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   816
    and "path_connected s"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   817
  shows "path_connected (f ` s)"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   818
  unfolding path_connected_def
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   819
proof (rule, rule)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   820
  fix x' y'
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   821
  assume "x' \<in> f ` s" "y' \<in> f ` s"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   822
  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
   823
    by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   824
  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
   825
    using assms(2)[unfolded path_connected_def] by fast
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   826
  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
   827
    unfolding x' y'
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   828
    apply (rule_tac x="f \<circ> g" in exI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   829
    unfolding path_defs
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51478
diff changeset
   830
    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
   831
    apply auto
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   832
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   833
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   834
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   835
lemma homeomorphic_path_connectedness:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   836
  "s homeomorphic t \<Longrightarrow> path_connected s \<longleftrightarrow> path_connected t"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   837
  unfolding homeomorphic_def homeomorphism_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   838
  apply (erule exE|erule conjE)+
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   839
  apply rule
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   840
  apply (drule_tac f=f in path_connected_continuous_image)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   841
  prefer 3
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   842
  apply (drule_tac f=g in path_connected_continuous_image)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   843
  apply auto
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   844
  done
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   845
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   846
lemma path_connected_empty: "path_connected {}"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   847
  unfolding path_connected_def by auto
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   848
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   849
lemma path_connected_singleton: "path_connected {a}"
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   850
  unfolding path_connected_def pathstart_def pathfinish_def path_image_def
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   851
  apply clarify
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   852
  apply (rule_tac x="\<lambda>x. a" in exI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   853
  apply (simp add: image_constant_conv)
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   854
  apply (simp add: path_def continuous_on_const)
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   855
  done
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   856
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   857
lemma path_connected_Un:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   858
  assumes "path_connected s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   859
    and "path_connected t"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   860
    and "s \<inter> t \<noteq> {}"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   861
  shows "path_connected (s \<union> t)"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   862
  unfolding path_connected_component
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   863
proof (rule, rule)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   864
  fix x y
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   865
  assume as: "x \<in> s \<union> t" "y \<in> s \<union> t"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   866
  from assms(3) obtain z where "z \<in> s \<inter> t"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   867
    by auto
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   868
  then show "path_component (s \<union> t) x y"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   869
    using as and assms(1-2)[unfolded path_connected_component]
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   870
    apply -
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   871
    apply (erule_tac[!] UnE)+
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   872
    apply (rule_tac[2-3] path_component_trans[of _ _ z])
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   873
    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
   874
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   875
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   876
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   877
lemma path_connected_UNION:
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   878
  assumes "\<And>i. i \<in> A \<Longrightarrow> path_connected (S i)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   879
    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
   880
  shows "path_connected (\<Union>i\<in>A. S i)"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   881
  unfolding path_connected_component
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   882
proof clarify
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   883
  fix x i y j
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   884
  assume *: "i \<in> A" "x \<in> S i" "j \<in> A" "y \<in> S j"
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   885
  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
   886
    using assms by (simp_all add: path_connected_component)
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   887
  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
   888
    using *(1,3) by (auto elim!: path_component_of_subset [rotated])
49654
366d8b41ca17 tuned proofs;
wenzelm
parents: 49653
diff changeset
   889
  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
   890
    by (rule path_component_trans)
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   891
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   892
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   893
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   894
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
   895
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   896
lemma path_connected_punctured_universe:
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   897
  assumes "2 \<le> DIM('a::euclidean_space)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   898
  shows "path_connected ((UNIV::'a set) - {a})"
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   899
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
   900
  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
   901
  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
   902
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   903
  have A: "path_connected ?A"
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   904
    unfolding Collect_bex_eq
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   905
  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
   906
    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
   907
    assume "i \<in> Basis"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   908
    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
   909
      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
   910
    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
   911
      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
   912
      by (simp add: inner_commute)
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   913
  qed
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   914
  have B: "path_connected ?B"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   915
    unfolding Collect_bex_eq
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   916
  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
   917
    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
   918
    assume "i \<in> Basis"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   919
    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
   920
      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
   921
    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
   922
      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
   923
      by (simp add: inner_commute)
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   924
  qed
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   925
  obtain S :: "'a set" where "S \<subseteq> Basis" and "card S = Suc (Suc 0)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   926
    using ex_card[OF assms]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   927
    by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   928
  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
   929
    unfolding card_Suc_eq by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   930
  then have "a + b0 - b1 \<in> ?A \<inter> ?B"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   931
    by (auto simp: inner_simps inner_Basis)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   932
  then have "?A \<inter> ?B \<noteq> {}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   933
    by fast
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   934
  with A B have "path_connected (?A \<union> ?B)"
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   935
    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
   936
  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
   937
    unfolding neq_iff bex_disj_distrib Collect_disj_eq ..
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   938
  also have "\<dots> = {x. x \<noteq> a}"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   939
    unfolding euclidean_eq_iff [where 'a='a]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   940
    by (simp add: Bex_def)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   941
  also have "\<dots> = UNIV - {a}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   942
    by auto
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   943
  finally show ?thesis .
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   944
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   945
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   946
lemma path_connected_sphere:
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   947
  assumes "2 \<le> DIM('a::euclidean_space)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   948
  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
   949
proof (rule linorder_cases [of r 0])
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   950
  assume "r < 0"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   951
  then have "{x::'a. norm(x - a) = r} = {}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   952
    by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   953
  then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   954
    using path_connected_empty by simp
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   955
next
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   956
  assume "r = 0"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   957
  then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   958
    using path_connected_singleton by simp
37674
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   959
next
f86de9c00c47 convert theorem path_connected_sphere to euclidean_space class
huffman
parents: 37489
diff changeset
   960
  assume r: "0 < r"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   961
  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
   962
    apply (rule set_eqI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   963
    apply rule
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   964
    unfolding image_iff
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   965
    apply (rule_tac x="(1/r) *\<^sub>R (x - a)" in bexI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   966
    unfolding mem_Collect_eq norm_scaleR
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   967
    using r
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   968
    apply (auto simp add: scaleR_right_diff_distrib)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   969
    done
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   970
  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
   971
    apply (rule set_eqI)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   972
    apply rule
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   973
    unfolding image_iff
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   974
    apply (rule_tac x=x in bexI)
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   975
    unfolding mem_Collect_eq
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   976
    apply (auto split: split_if_asm)
49653
03bc7afe8814 tuned proofs;
wenzelm
parents: 48125
diff changeset
   977
    done
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44531
diff changeset
   978
  have "continuous_on (UNIV - {0}) (\<lambda>x::'a. 1 / norm x)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   979
    unfolding field_divide_inverse
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   980
    by (simp add: continuous_intros)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   981
  then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   982
    unfolding * **
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   983
    using path_connected_punctured_universe[OF assms]
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56188
diff changeset
   984
    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
   985
qed
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   986
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   987
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
   988
  using path_connected_sphere path_connected_imp_connected
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53593
diff changeset
   989
  by auto
36583
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   990
68ce5760c585 move path-related stuff into new theory file
huffman
parents:
diff changeset
   991
end