src/HOL/Analysis/Ordered_Euclidean_Space.thy
author paulson <lp15@cam.ac.uk>
Tue May 08 10:32:07 2018 +0100 (14 months ago)
changeset 68120 2f161c6910f7
parent 67981 349c639e593c
child 68239 0764ee22a4d1
permissions -rw-r--r--
tidying more messy proofs
immler@54780
     1
theory Ordered_Euclidean_Space
immler@54780
     2
imports
immler@56189
     3
  Cartesian_Euclidean_Space
wenzelm@66453
     4
  "HOL-Library.Product_Order"
immler@54780
     5
begin
immler@54780
     6
wenzelm@60420
     7
subsection \<open>An ordering on euclidean spaces that will allow us to talk about intervals\<close>
immler@54780
     8
immler@54780
     9
class ordered_euclidean_space = ord + inf + sup + abs + Inf + Sup + euclidean_space +
immler@54780
    10
  assumes eucl_le: "x \<le> y \<longleftrightarrow> (\<forall>i\<in>Basis. x \<bullet> i \<le> y \<bullet> i)"
immler@54780
    11
  assumes eucl_less_le_not_le: "x < y \<longleftrightarrow> x \<le> y \<and> \<not> y \<le> x"
immler@54780
    12
  assumes eucl_inf: "inf x y = (\<Sum>i\<in>Basis. inf (x \<bullet> i) (y \<bullet> i) *\<^sub>R i)"
immler@54780
    13
  assumes eucl_sup: "sup x y = (\<Sum>i\<in>Basis. sup (x \<bullet> i) (y \<bullet> i) *\<^sub>R i)"
immler@54780
    14
  assumes eucl_Inf: "Inf X = (\<Sum>i\<in>Basis. (INF x:X. x \<bullet> i) *\<^sub>R i)"
immler@54780
    15
  assumes eucl_Sup: "Sup X = (\<Sum>i\<in>Basis. (SUP x:X. x \<bullet> i) *\<^sub>R i)"
wenzelm@61945
    16
  assumes eucl_abs: "\<bar>x\<bar> = (\<Sum>i\<in>Basis. \<bar>x \<bullet> i\<bar> *\<^sub>R i)"
immler@54780
    17
begin
immler@54780
    18
immler@54780
    19
subclass order
wenzelm@61169
    20
  by standard
immler@54780
    21
    (auto simp: eucl_le eucl_less_le_not_le intro!: euclidean_eqI antisym intro: order.trans)
immler@54780
    22
immler@54780
    23
subclass ordered_ab_group_add_abs
wenzelm@61169
    24
  by standard (auto simp: eucl_le inner_add_left eucl_abs abs_leI)
immler@54780
    25
immler@54780
    26
subclass ordered_real_vector
wenzelm@61169
    27
  by standard (auto simp: eucl_le intro!: mult_left_mono mult_right_mono)
immler@54780
    28
immler@54780
    29
subclass lattice
wenzelm@61169
    30
  by standard (auto simp: eucl_inf eucl_sup eucl_le)
immler@54780
    31
immler@54780
    32
subclass distrib_lattice
wenzelm@61169
    33
  by standard (auto simp: eucl_inf eucl_sup sup_inf_distrib1 intro!: euclidean_eqI)
immler@54780
    34
immler@54780
    35
subclass conditionally_complete_lattice
immler@54780
    36
proof
immler@54780
    37
  fix z::'a and X::"'a set"
immler@54780
    38
  assume "X \<noteq> {}"
immler@54780
    39
  hence "\<And>i. (\<lambda>x. x \<bullet> i) ` X \<noteq> {}" by simp
immler@54780
    40
  thus "(\<And>x. x \<in> X \<Longrightarrow> z \<le> x) \<Longrightarrow> z \<le> Inf X" "(\<And>x. x \<in> X \<Longrightarrow> x \<le> z) \<Longrightarrow> Sup X \<le> z"
haftmann@62343
    41
    by (auto simp: eucl_Inf eucl_Sup eucl_le
immler@54780
    42
      intro!: cInf_greatest cSup_least)
immler@54780
    43
qed (force intro!: cInf_lower cSup_upper
immler@54780
    44
      simp: bdd_below_def bdd_above_def preorder_class.bdd_below_def preorder_class.bdd_above_def
haftmann@62343
    45
        eucl_Inf eucl_Sup eucl_le)+
immler@54780
    46
immler@54780
    47
lemma inner_Basis_inf_left: "i \<in> Basis \<Longrightarrow> inf x y \<bullet> i = inf (x \<bullet> i) (y \<bullet> i)"
immler@54780
    48
  and inner_Basis_sup_left: "i \<in> Basis \<Longrightarrow> sup x y \<bullet> i = sup (x \<bullet> i) (y \<bullet> i)"
nipkow@64267
    49
  by (simp_all add: eucl_inf eucl_sup inner_sum_left inner_Basis if_distrib comm_monoid_add_class.sum.delta
immler@54780
    50
      cong: if_cong)
immler@54780
    51
immler@54780
    52
lemma inner_Basis_INF_left: "i \<in> Basis \<Longrightarrow> (INF x:X. f x) \<bullet> i = (INF x:X. f x \<bullet> i)"
immler@54780
    53
  and inner_Basis_SUP_left: "i \<in> Basis \<Longrightarrow> (SUP x:X. f x) \<bullet> i = (SUP x:X. f x \<bullet> i)"
haftmann@56166
    54
  using eucl_Sup [of "f ` X"] eucl_Inf [of "f ` X"] by (simp_all add: comp_def)
immler@54780
    55
wenzelm@61945
    56
lemma abs_inner: "i \<in> Basis \<Longrightarrow> \<bar>x\<bar> \<bullet> i = \<bar>x \<bullet> i\<bar>"
immler@54780
    57
  by (auto simp: eucl_abs)
immler@54780
    58
immler@54780
    59
lemma
immler@54780
    60
  abs_scaleR: "\<bar>a *\<^sub>R b\<bar> = \<bar>a\<bar> *\<^sub>R \<bar>b\<bar>"
immler@54780
    61
  by (auto simp: eucl_abs abs_mult intro!: euclidean_eqI)
immler@54780
    62
immler@54780
    63
lemma interval_inner_leI:
immler@54780
    64
  assumes "x \<in> {a .. b}" "0 \<le> i"
immler@54780
    65
  shows "a\<bullet>i \<le> x\<bullet>i" "x\<bullet>i \<le> b\<bullet>i"
immler@54780
    66
  using assms
immler@54780
    67
  unfolding euclidean_inner[of a i] euclidean_inner[of x i] euclidean_inner[of b i]
nipkow@64267
    68
  by (auto intro!: ordered_comm_monoid_add_class.sum_mono mult_right_mono simp: eucl_le)
immler@54780
    69
immler@54780
    70
lemma inner_nonneg_nonneg:
immler@54780
    71
  shows "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> a \<bullet> b"
immler@54780
    72
  using interval_inner_leI[of a 0 a b]
immler@54780
    73
  by auto
immler@54780
    74
immler@54780
    75
lemma inner_Basis_mono:
immler@54780
    76
  shows "a \<le> b \<Longrightarrow> c \<in> Basis  \<Longrightarrow> a \<bullet> c \<le> b \<bullet> c"
immler@54780
    77
  by (simp add: eucl_le)
immler@54780
    78
immler@54780
    79
lemma Basis_nonneg[intro, simp]: "i \<in> Basis \<Longrightarrow> 0 \<le> i"
immler@54780
    80
  by (auto simp: eucl_le inner_Basis)
immler@54780
    81
immler@54781
    82
lemma Sup_eq_maximum_componentwise:
immler@54781
    83
  fixes s::"'a set"
immler@54781
    84
  assumes i: "\<And>b. b \<in> Basis \<Longrightarrow> X \<bullet> b = i b \<bullet> b"
immler@54781
    85
  assumes sup: "\<And>b x. b \<in> Basis \<Longrightarrow> x \<in> s \<Longrightarrow> x \<bullet> b \<le> X \<bullet> b"
immler@54781
    86
  assumes i_s: "\<And>b. b \<in> Basis \<Longrightarrow> (i b \<bullet> b) \<in> (\<lambda>x. x \<bullet> b) ` s"
immler@54781
    87
  shows "Sup s = X"
immler@54781
    88
  using assms
nipkow@64267
    89
  unfolding eucl_Sup euclidean_representation_sum
haftmann@62343
    90
  by (auto intro!: conditionally_complete_lattice_class.cSup_eq_maximum)
immler@54781
    91
immler@54781
    92
lemma Inf_eq_minimum_componentwise:
immler@54781
    93
  assumes i: "\<And>b. b \<in> Basis \<Longrightarrow> X \<bullet> b = i b \<bullet> b"
immler@54781
    94
  assumes sup: "\<And>b x. b \<in> Basis \<Longrightarrow> x \<in> s \<Longrightarrow> X \<bullet> b \<le> x \<bullet> b"
immler@54781
    95
  assumes i_s: "\<And>b. b \<in> Basis \<Longrightarrow> (i b \<bullet> b) \<in> (\<lambda>x. x \<bullet> b) ` s"
immler@54781
    96
  shows "Inf s = X"
immler@54781
    97
  using assms
nipkow@64267
    98
  unfolding eucl_Inf euclidean_representation_sum
haftmann@62343
    99
  by (auto intro!: conditionally_complete_lattice_class.cInf_eq_minimum)
immler@54781
   100
immler@54780
   101
end
immler@54780
   102
immler@54781
   103
lemma
immler@54781
   104
  compact_attains_Inf_componentwise:
immler@54781
   105
  fixes b::"'a::ordered_euclidean_space"
immler@54781
   106
  assumes "b \<in> Basis" assumes "X \<noteq> {}" "compact X"
immler@54781
   107
  obtains x where "x \<in> X" "x \<bullet> b = Inf X \<bullet> b" "\<And>y. y \<in> X \<Longrightarrow> x \<bullet> b \<le> y \<bullet> b"
immler@54781
   108
proof atomize_elim
immler@54781
   109
  let ?proj = "(\<lambda>x. x \<bullet> b) ` X"
immler@54781
   110
  from assms have "compact ?proj" "?proj \<noteq> {}"
hoelzl@56371
   111
    by (auto intro!: compact_continuous_image continuous_intros)
immler@54781
   112
  from compact_attains_inf[OF this]
immler@54781
   113
  obtain s x
immler@54781
   114
    where s: "s\<in>(\<lambda>x. x \<bullet> b) ` X" "\<And>t. t\<in>(\<lambda>x. x \<bullet> b) ` X \<Longrightarrow> s \<le> t"
immler@54781
   115
      and x: "x \<in> X" "s = x \<bullet> b" "\<And>y. y \<in> X \<Longrightarrow> x \<bullet> b \<le> y \<bullet> b"
immler@54781
   116
    by auto
immler@54781
   117
  hence "Inf ?proj = x \<bullet> b"
haftmann@62343
   118
    by (auto intro!: conditionally_complete_lattice_class.cInf_eq_minimum)
immler@54781
   119
  hence "x \<bullet> b = Inf X \<bullet> b"
nipkow@64267
   120
    by (auto simp: eucl_Inf inner_sum_left inner_Basis if_distrib \<open>b \<in> Basis\<close> sum.delta
haftmann@56166
   121
      cong: if_cong)
immler@54781
   122
  with x show "\<exists>x. x \<in> X \<and> x \<bullet> b = Inf X \<bullet> b \<and> (\<forall>y. y \<in> X \<longrightarrow> x \<bullet> b \<le> y \<bullet> b)" by blast
immler@54781
   123
qed
immler@54781
   124
immler@54781
   125
lemma
immler@54781
   126
  compact_attains_Sup_componentwise:
immler@54781
   127
  fixes b::"'a::ordered_euclidean_space"
immler@54781
   128
  assumes "b \<in> Basis" assumes "X \<noteq> {}" "compact X"
immler@54781
   129
  obtains x where "x \<in> X" "x \<bullet> b = Sup X \<bullet> b" "\<And>y. y \<in> X \<Longrightarrow> y \<bullet> b \<le> x \<bullet> b"
immler@54781
   130
proof atomize_elim
immler@54781
   131
  let ?proj = "(\<lambda>x. x \<bullet> b) ` X"
immler@54781
   132
  from assms have "compact ?proj" "?proj \<noteq> {}"
hoelzl@56371
   133
    by (auto intro!: compact_continuous_image continuous_intros)
immler@54781
   134
  from compact_attains_sup[OF this]
immler@54781
   135
  obtain s x
immler@54781
   136
    where s: "s\<in>(\<lambda>x. x \<bullet> b) ` X" "\<And>t. t\<in>(\<lambda>x. x \<bullet> b) ` X \<Longrightarrow> t \<le> s"
immler@54781
   137
      and x: "x \<in> X" "s = x \<bullet> b" "\<And>y. y \<in> X \<Longrightarrow> y \<bullet> b \<le> x \<bullet> b"
immler@54781
   138
    by auto
immler@54781
   139
  hence "Sup ?proj = x \<bullet> b"
haftmann@62343
   140
    by (auto intro!: cSup_eq_maximum)
immler@54781
   141
  hence "x \<bullet> b = Sup X \<bullet> b"
nipkow@64267
   142
    by (auto simp: eucl_Sup[where 'a='a] inner_sum_left inner_Basis if_distrib \<open>b \<in> Basis\<close> sum.delta
haftmann@62343
   143
      cong: if_cong)
immler@54781
   144
  with x show "\<exists>x. x \<in> X \<and> x \<bullet> b = Sup X \<bullet> b \<and> (\<forall>y. y \<in> X \<longrightarrow> y \<bullet> b \<le> x \<bullet> b)" by blast
immler@54781
   145
qed
immler@54781
   146
immler@54780
   147
lemma (in order) atLeastatMost_empty'[simp]:
immler@54780
   148
  "(~ a <= b) \<Longrightarrow> {a..b} = {}"
immler@54780
   149
  by (auto)
immler@54780
   150
immler@54780
   151
instance real :: ordered_euclidean_space
haftmann@62343
   152
  by standard auto
immler@54780
   153
immler@54780
   154
lemma in_Basis_prod_iff:
immler@54780
   155
  fixes i::"'a::euclidean_space*'b::euclidean_space"
immler@54780
   156
  shows "i \<in> Basis \<longleftrightarrow> fst i = 0 \<and> snd i \<in> Basis \<or> snd i = 0 \<and> fst i \<in> Basis"
immler@54780
   157
  by (cases i) (auto simp: Basis_prod_def)
immler@54780
   158
wenzelm@61945
   159
instantiation prod :: (abs, abs) abs
immler@54780
   160
begin
immler@54780
   161
wenzelm@61945
   162
definition "\<bar>x\<bar> = (\<bar>fst x\<bar>, \<bar>snd x\<bar>)"
immler@54780
   163
wenzelm@61945
   164
instance ..
wenzelm@61945
   165
immler@54780
   166
end
immler@54780
   167
immler@54780
   168
instance prod :: (ordered_euclidean_space, ordered_euclidean_space) ordered_euclidean_space
wenzelm@61169
   169
  by standard
nipkow@64267
   170
    (auto intro!: add_mono simp add: euclidean_representation_sum'  Ball_def inner_prod_def
immler@54780
   171
      in_Basis_prod_iff inner_Basis_inf_left inner_Basis_sup_left inner_Basis_INF_left Inf_prod_def
immler@54780
   172
      inner_Basis_SUP_left Sup_prod_def less_prod_def less_eq_prod_def eucl_le[where 'a='a]
immler@54780
   173
      eucl_le[where 'a='b] abs_prod_def abs_inner)
immler@54780
   174
wenzelm@61808
   175
text\<open>Instantiation for intervals on \<open>ordered_euclidean_space\<close>\<close>
immler@56188
   176
immler@56188
   177
lemma
wenzelm@61076
   178
  fixes a :: "'a::ordered_euclidean_space"
immler@56188
   179
  shows cbox_interval: "cbox a b = {a..b}"
immler@56188
   180
    and interval_cbox: "{a..b} = cbox a b"
immler@56188
   181
    and eucl_le_atMost: "{x. \<forall>i\<in>Basis. x \<bullet> i <= a \<bullet> i} = {..a}"
immler@56188
   182
    and eucl_le_atLeast: "{x. \<forall>i\<in>Basis. a \<bullet> i <= x \<bullet> i} = {a..}"
immler@56188
   183
    by (auto simp: eucl_le[where 'a='a] eucl_less_def box_def cbox_def)
immler@56188
   184
lp15@67981
   185
lemma vec_nth_real_1_iff_cbox [simp]:
lp15@67981
   186
  fixes a b :: real
lp15@67981
   187
  shows "(\<lambda>x::real^1. x $ 1) ` S = {a..b} \<longleftrightarrow> S = cbox (vec a) (vec b)"
lp15@67981
   188
  by (metis interval_cbox vec_nth_1_iff_cbox)
lp15@67981
   189
immler@56188
   190
lemma closed_eucl_atLeastAtMost[simp, intro]:
wenzelm@61076
   191
  fixes a :: "'a::ordered_euclidean_space"
immler@56188
   192
  shows "closed {a..b}"
immler@56188
   193
  by (simp add: cbox_interval[symmetric] closed_cbox)
immler@56188
   194
immler@56188
   195
lemma closed_eucl_atMost[simp, intro]:
wenzelm@61076
   196
  fixes a :: "'a::ordered_euclidean_space"
immler@56188
   197
  shows "closed {..a}"
lp15@66827
   198
  by (simp add: closed_interval_left eucl_le_atMost[symmetric])
immler@56188
   199
immler@56188
   200
lemma closed_eucl_atLeast[simp, intro]:
wenzelm@61076
   201
  fixes a :: "'a::ordered_euclidean_space"
immler@56188
   202
  shows "closed {a..}"
lp15@66827
   203
  by (simp add: closed_interval_right eucl_le_atLeast[symmetric])
immler@56188
   204
lp15@64758
   205
lemma bounded_closed_interval [simp]:
immler@56189
   206
  fixes a :: "'a::ordered_euclidean_space"
immler@56189
   207
  shows "bounded {a .. b}"
immler@56189
   208
  using bounded_cbox[of a b]
immler@56189
   209
  by (metis interval_cbox)
immler@56189
   210
lp15@64758
   211
lemma convex_closed_interval [simp]:
immler@56190
   212
  fixes a :: "'a::ordered_euclidean_space"
immler@56190
   213
  shows "convex {a .. b}"
immler@56190
   214
  using convex_box[of a b]
immler@56190
   215
  by (metis interval_cbox)
immler@56190
   216
immler@56188
   217
lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::_::ordered_euclidean_space)) ` {a .. b} =
immler@56188
   218
  (if {a .. b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a .. m *\<^sub>R b} else {m *\<^sub>R b .. m *\<^sub>R a})"
immler@56188
   219
  using image_smult_cbox[of m a b]
immler@56188
   220
  by (simp add: cbox_interval)
immler@54780
   221
immler@67685
   222
lemma [simp]:
immler@67685
   223
  fixes a b::"'a::ordered_euclidean_space" and r s::real
immler@67685
   224
  shows is_interval_io: "is_interval {..<r}"
immler@67685
   225
    and is_interval_ic: "is_interval {..a}"
immler@67685
   226
    and is_interval_oi: "is_interval {r<..}"
immler@67685
   227
    and is_interval_ci: "is_interval {a..}"
immler@67685
   228
    and is_interval_oo: "is_interval {r<..<s}"
immler@67685
   229
    and is_interval_oc: "is_interval {r<..s}"
immler@67685
   230
    and is_interval_co: "is_interval {r..<s}"
immler@67685
   231
    and is_interval_cc: "is_interval {b..a}"
immler@67685
   232
  by (force simp: is_interval_def eucl_le[where 'a='a])+
immler@67685
   233
immler@67685
   234
lemma is_interval_real_ereal_oo: "is_interval (real_of_ereal ` {N<..<M::ereal})"
immler@67685
   235
  by (auto simp: real_atLeastGreaterThan_eq)
immler@56189
   236
lp15@64758
   237
lemma compact_interval [simp]:
immler@56190
   238
  fixes a b::"'a::ordered_euclidean_space"
immler@56190
   239
  shows "compact {a .. b}"
immler@56190
   240
  by (metis compact_cbox interval_cbox)
immler@56190
   241
lp15@62620
   242
lemma homeomorphic_closed_intervals:
lp15@62620
   243
  fixes a :: "'a::euclidean_space" and b and c :: "'a::euclidean_space" and d
lp15@62620
   244
  assumes "box a b \<noteq> {}" and "box c d \<noteq> {}"
lp15@62620
   245
    shows "(cbox a b) homeomorphic (cbox c d)"
lp15@62620
   246
apply (rule homeomorphic_convex_compact)
lp15@62620
   247
using assms apply auto
lp15@62620
   248
done
lp15@62620
   249
lp15@62620
   250
lemma homeomorphic_closed_intervals_real:
lp15@62620
   251
  fixes a::real and b and c::real and d
lp15@62620
   252
  assumes "a<b" and "c<d"
lp15@62620
   253
    shows "{a..b} homeomorphic {c..d}"
lp15@62620
   254
by (metis assms compact_interval continuous_on_id convex_real_interval(5) emptyE homeomorphic_convex_compact interior_atLeastAtMost_real mvt)
lp15@62620
   255
immler@54780
   256
no_notation
immler@54780
   257
  eucl_less (infix "<e" 50)
immler@54780
   258
immler@56189
   259
lemma One_nonneg: "0 \<le> (\<Sum>Basis::'a::ordered_euclidean_space)"
nipkow@64267
   260
  by (auto intro: sum_nonneg)
immler@56189
   261
immler@56190
   262
lemma
immler@56190
   263
  fixes a b::"'a::ordered_euclidean_space"
immler@56190
   264
  shows bdd_above_cbox[intro, simp]: "bdd_above (cbox a b)"
immler@56190
   265
    and bdd_below_cbox[intro, simp]: "bdd_below (cbox a b)"
immler@56190
   266
    and bdd_above_box[intro, simp]: "bdd_above (box a b)"
immler@56190
   267
    and bdd_below_box[intro, simp]: "bdd_below (box a b)"
immler@56190
   268
  unfolding atomize_conj
immler@56190
   269
  by (metis bdd_above_Icc bdd_above_mono bdd_below_Icc bdd_below_mono bounded_box
lp15@68120
   270
            bounded_subset_cbox_symmetric interval_cbox)
immler@56190
   271
immler@56189
   272
instantiation vec :: (ordered_euclidean_space, finite) ordered_euclidean_space
immler@56189
   273
begin
immler@56189
   274
immler@56189
   275
definition "inf x y = (\<chi> i. inf (x $ i) (y $ i))"
immler@56189
   276
definition "sup x y = (\<chi> i. sup (x $ i) (y $ i))"
immler@56189
   277
definition "Inf X = (\<chi> i. (INF x:X. x $ i))"
immler@56189
   278
definition "Sup X = (\<chi> i. (SUP x:X. x $ i))"
wenzelm@61945
   279
definition "\<bar>x\<bar> = (\<chi> i. \<bar>x $ i\<bar>)"
immler@56189
   280
immler@56189
   281
instance
wenzelm@61169
   282
  apply standard
nipkow@64267
   283
  unfolding euclidean_representation_sum'
immler@56189
   284
  apply (auto simp: less_eq_vec_def inf_vec_def sup_vec_def Inf_vec_def Sup_vec_def inner_axis
immler@56189
   285
    Basis_vec_def inner_Basis_inf_left inner_Basis_sup_left inner_Basis_INF_left
immler@56189
   286
    inner_Basis_SUP_left eucl_le[where 'a='a] less_le_not_le abs_vec_def abs_inner)
immler@56189
   287
  done
immler@56189
   288
immler@54780
   289
end
immler@56189
   290
lp15@63469
   291
lemma ANR_interval [iff]:
lp15@63469
   292
    fixes a :: "'a::ordered_euclidean_space"
lp15@63469
   293
    shows "ANR{a..b}"
lp15@63469
   294
by (simp add: interval_cbox)
lp15@63469
   295
lp15@63469
   296
lemma ENR_interval [iff]:
lp15@63469
   297
    fixes a :: "'a::ordered_euclidean_space"
lp15@63469
   298
    shows "ENR{a..b}"
lp15@63469
   299
  by (auto simp: interval_cbox)
lp15@63469
   300
immler@56189
   301
end
immler@56189
   302