src/HOL/Analysis/Tagged_Division.thy
author wenzelm
Mon, 22 May 2017 00:23:25 +0200
changeset 65897 94b0da1b242e
parent 64911 f0e07600de47
child 66112 0e640e04fc56
permissions -rw-r--r--
back to scala-2.11.8 due to apparent non-termination of HOL-Codegenerator_Test;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
     1
(*  Title:      HOL/Analysis/Tagged_Division.thy
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
     2
    Author:     John Harrison
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
     3
    Author:     Robert Himmelmann, TU Muenchen (Translation from HOL light); proofs reworked by LCP
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
     4
*)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
     5
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
     6
section \<open>Tagged divisions used for the Henstock-Kurzweil gauge integration\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
     7
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
     8
theory Tagged_Division
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
     9
imports
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    10
  Topology_Euclidean_Space
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    11
begin
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    12
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    13
lemma finite_product_dependent:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    14
  assumes "finite s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    15
    and "\<And>x. x \<in> s \<Longrightarrow> finite (t x)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    16
  shows "finite {(i, j) |i j. i \<in> s \<and> j \<in> t i}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    17
  using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    18
proof induct
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    19
  case (insert x s)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    20
  have *: "{(i, j) |i j. i \<in> insert x s \<and> j \<in> t i} =
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    21
    (\<lambda>y. (x,y)) ` (t x) \<union> {(i, j) |i j. i \<in> s \<and> j \<in> t i}" by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    22
  show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    23
    unfolding *
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    24
    apply (rule finite_UnI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    25
    using insert
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    26
    apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    27
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    28
qed auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    29
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    30
lemma sum_sum_product:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    31
  assumes "finite s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    32
    and "\<forall>i\<in>s. finite (t i)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
    33
  shows "sum (\<lambda>i. sum (x i) (t i)::real) s =
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
    34
    sum (\<lambda>(i,j). x i j) {(i,j) | i j. i \<in> s \<and> j \<in> t i}"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    35
  using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    36
proof induct
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    37
  case (insert a s)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    38
  have *: "{(i, j) |i j. i \<in> insert a s \<and> j \<in> t i} =
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    39
    (\<lambda>y. (a,y)) ` (t a) \<union> {(i, j) |i j. i \<in> s \<and> j \<in> t i}" by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    40
  show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    41
    unfolding *
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
    42
    apply (subst sum.union_disjoint)
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
    43
    unfolding sum.insert[OF insert(1-2)]
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    44
    prefer 4
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    45
    apply (subst insert(3))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    46
    unfolding add_right_cancel
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    47
  proof -
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
    48
    show "sum (x a) (t a) = (\<Sum>(xa, y)\<in> Pair a ` t a. x xa y)"
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
    49
      apply (subst sum.reindex)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    50
      unfolding inj_on_def
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    51
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    52
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    53
    show "finite {(i, j) |i j. i \<in> s \<and> j \<in> t i}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    54
      apply (rule finite_product_dependent)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    55
      using insert
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    56
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    57
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    58
  qed (insert insert, auto)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    59
qed auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    60
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    61
lemmas scaleR_simps = scaleR_zero_left scaleR_minus_left scaleR_left_diff_distrib
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    62
  scaleR_zero_right scaleR_minus_right scaleR_right_diff_distrib scaleR_eq_0_iff
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    63
  scaleR_cancel_left scaleR_cancel_right scaleR_add_right scaleR_add_left real_vector_class.scaleR_one
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    64
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    65
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    66
subsection \<open>Sundries\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    67
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    68
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    69
text\<open>A transitive relation is well-founded if all initial segments are finite.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    70
lemma wf_finite_segments:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    71
  assumes "irrefl r" and "trans r" and "\<And>x. finite {y. (y, x) \<in> r}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    72
  shows "wf (r)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    73
  apply (simp add: trans_wf_iff wf_iff_acyclic_if_finite converse_def assms)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    74
  using acyclic_def assms irrefl_def trans_Restr by fastforce
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    75
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    76
text\<open>For creating values between @{term u} and @{term v}.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    77
lemma scaling_mono:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    78
  fixes u::"'a::linordered_field"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    79
  assumes "u \<le> v" "0 \<le> r" "r \<le> s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    80
    shows "u + r * (v - u) / s \<le> v"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    81
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    82
  have "r/s \<le> 1" using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    83
    using divide_le_eq_1 by fastforce
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    84
  then have "(r/s) * (v - u) \<le> 1 * (v - u)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    85
    by (meson diff_ge_0_iff_ge mult_right_mono \<open>u \<le> v\<close>)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    86
  then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    87
    by (simp add: field_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    88
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    89
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    90
lemma conjunctD2: assumes "a \<and> b" shows a b using assms by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    91
lemma conjunctD3: assumes "a \<and> b \<and> c" shows a b c using assms by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    92
lemma conjunctD4: assumes "a \<and> b \<and> c \<and> d" shows a b c d using assms by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    93
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    94
lemma cond_cases: "(P \<Longrightarrow> Q x) \<Longrightarrow> (\<not> P \<Longrightarrow> Q y) \<Longrightarrow> Q (if P then x else y)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    95
  by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    96
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    97
declare norm_triangle_ineq4[intro]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    98
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
    99
lemma transitive_stepwise_le:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   100
  assumes "\<And>x. R x x" "\<And>x y z. R x y \<Longrightarrow> R y z \<Longrightarrow> R x z" and "\<And>n. R n (Suc n)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   101
  shows "\<forall>n\<ge>m. R m n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   102
proof (intro allI impI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   103
  show "m \<le> n \<Longrightarrow> R m n" for n
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   104
    by (induction rule: dec_induct)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   105
       (use assms in blast)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   106
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   107
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   108
subsection \<open>Some useful lemmas about intervals.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   109
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   110
lemma interior_subset_union_intervals:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   111
  assumes "i = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   112
    and "j = cbox c d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   113
    and "interior j \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   114
    and "i \<subseteq> j \<union> s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   115
    and "interior i \<inter> interior j = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   116
  shows "interior i \<subseteq> interior s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   117
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   118
  have "box a b \<inter> cbox c d = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   119
     using inter_interval_mixed_eq_empty[of c d a b] and assms(3,5)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   120
     unfolding assms(1,2) interior_cbox by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   121
  moreover
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   122
  have "box a b \<subseteq> cbox c d \<union> s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   123
    apply (rule order_trans,rule box_subset_cbox)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   124
    using assms(4) unfolding assms(1,2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   125
    apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   126
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   127
  ultimately
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   128
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   129
    unfolding assms interior_cbox
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   130
      by auto (metis IntI UnE empty_iff interior_maximal open_box subsetCE subsetI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   131
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   132
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   133
lemma interior_Union_subset_cbox:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   134
  assumes "finite f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   135
  assumes f: "\<And>s. s \<in> f \<Longrightarrow> \<exists>a b. s = cbox a b" "\<And>s. s \<in> f \<Longrightarrow> interior s \<subseteq> t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   136
    and t: "closed t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   137
  shows "interior (\<Union>f) \<subseteq> t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   138
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   139
  have [simp]: "s \<in> f \<Longrightarrow> closed s" for s
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   140
    using f by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   141
  define E where "E = {s\<in>f. interior s = {}}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   142
  then have "finite E" "E \<subseteq> {s\<in>f. interior s = {}}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   143
    using \<open>finite f\<close> by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   144
  then have "interior (\<Union>f) = interior (\<Union>(f - E))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   145
  proof (induction E rule: finite_subset_induct')
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   146
    case (insert s f')
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   147
    have "interior (\<Union>(f - insert s f') \<union> s) = interior (\<Union>(f - insert s f'))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   148
      using insert.hyps \<open>finite f\<close> by (intro interior_closed_Un_empty_interior) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   149
    also have "\<Union>(f - insert s f') \<union> s = \<Union>(f - f')"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   150
      using insert.hyps by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   151
    finally show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   152
      by (simp add: insert.IH)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   153
  qed simp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   154
  also have "\<dots> \<subseteq> \<Union>(f - E)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   155
    by (rule interior_subset)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   156
  also have "\<dots> \<subseteq> t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   157
  proof (rule Union_least)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   158
    fix s assume "s \<in> f - E"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   159
    with f[of s] obtain a b where s: "s \<in> f" "s = cbox a b" "box a b \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   160
      by (fastforce simp: E_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   161
    have "closure (interior s) \<subseteq> closure t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   162
      by (intro closure_mono f \<open>s \<in> f\<close>)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   163
    with s \<open>closed t\<close> show "s \<subseteq> t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   164
      by simp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   165
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   166
  finally show ?thesis .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   167
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   168
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   169
lemma inter_interior_unions_intervals:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   170
    "finite f \<Longrightarrow> open s \<Longrightarrow> \<forall>t\<in>f. \<exists>a b. t = cbox a b \<Longrightarrow> \<forall>t\<in>f. s \<inter> (interior t) = {} \<Longrightarrow> s \<inter> interior (\<Union>f) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   171
  using interior_Union_subset_cbox[of f "UNIV - s"] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   172
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   173
lemma interval_split:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   174
  fixes a :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   175
  assumes "k \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   176
  shows
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   177
    "cbox a b \<inter> {x. x\<bullet>k \<le> c} = cbox a (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) c else b\<bullet>i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   178
    "cbox a b \<inter> {x. x\<bullet>k \<ge> c} = cbox (\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) c else a\<bullet>i) *\<^sub>R i) b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   179
  apply (rule_tac[!] set_eqI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   180
  unfolding Int_iff mem_box mem_Collect_eq
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   181
  using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   182
  apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   183
  done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   184
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   185
lemma interval_not_empty: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow> cbox a b \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   186
  by (simp add: box_ne_empty)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   187
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   188
subsection \<open>Bounds on intervals where they exist.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   189
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   190
definition interval_upperbound :: "('a::euclidean_space) set \<Rightarrow> 'a"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   191
  where "interval_upperbound s = (\<Sum>i\<in>Basis. (SUP x:s. x\<bullet>i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   192
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   193
definition interval_lowerbound :: "('a::euclidean_space) set \<Rightarrow> 'a"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   194
  where "interval_lowerbound s = (\<Sum>i\<in>Basis. (INF x:s. x\<bullet>i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   195
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   196
lemma interval_upperbound[simp]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   197
  "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   198
    interval_upperbound (cbox a b) = (b::'a::euclidean_space)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   199
  unfolding interval_upperbound_def euclidean_representation_sum cbox_def
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   200
  by (safe intro!: cSup_eq) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   201
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   202
lemma interval_lowerbound[simp]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   203
  "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   204
    interval_lowerbound (cbox a b) = (a::'a::euclidean_space)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   205
  unfolding interval_lowerbound_def euclidean_representation_sum cbox_def
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   206
  by (safe intro!: cInf_eq) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   207
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   208
lemmas interval_bounds = interval_upperbound interval_lowerbound
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   209
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   210
lemma
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   211
  fixes X::"real set"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   212
  shows interval_upperbound_real[simp]: "interval_upperbound X = Sup X"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   213
    and interval_lowerbound_real[simp]: "interval_lowerbound X = Inf X"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   214
  by (auto simp: interval_upperbound_def interval_lowerbound_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   215
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   216
lemma interval_bounds'[simp]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   217
  assumes "cbox a b \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   218
  shows "interval_upperbound (cbox a b) = b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   219
    and "interval_lowerbound (cbox a b) = a"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   220
  using assms unfolding box_ne_empty by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   221
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   222
lemma interval_upperbound_Times:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   223
  assumes "A \<noteq> {}" and "B \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   224
  shows "interval_upperbound (A \<times> B) = (interval_upperbound A, interval_upperbound B)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   225
proof-
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   226
  from assms have fst_image_times': "A = fst ` (A \<times> B)" by simp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   227
  have "(\<Sum>i\<in>Basis. (SUP x:A \<times> B. x \<bullet> (i, 0)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (SUP x:A. x \<bullet> i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   228
      by (subst (2) fst_image_times') (simp del: fst_image_times add: o_def inner_Pair_0)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   229
  moreover from assms have snd_image_times': "B = snd ` (A \<times> B)" by simp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   230
  have "(\<Sum>i\<in>Basis. (SUP x:A \<times> B. x \<bullet> (0, i)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (SUP x:B. x \<bullet> i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   231
      by (subst (2) snd_image_times') (simp del: snd_image_times add: o_def inner_Pair_0)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   232
  ultimately show ?thesis unfolding interval_upperbound_def
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   233
      by (subst sum_Basis_prod_eq) (auto simp add: sum_prod)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   234
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   235
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   236
lemma interval_lowerbound_Times:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   237
  assumes "A \<noteq> {}" and "B \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   238
  shows "interval_lowerbound (A \<times> B) = (interval_lowerbound A, interval_lowerbound B)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   239
proof-
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   240
  from assms have fst_image_times': "A = fst ` (A \<times> B)" by simp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   241
  have "(\<Sum>i\<in>Basis. (INF x:A \<times> B. x \<bullet> (i, 0)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (INF x:A. x \<bullet> i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   242
      by (subst (2) fst_image_times') (simp del: fst_image_times add: o_def inner_Pair_0)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   243
  moreover from assms have snd_image_times': "B = snd ` (A \<times> B)" by simp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   244
  have "(\<Sum>i\<in>Basis. (INF x:A \<times> B. x \<bullet> (0, i)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (INF x:B. x \<bullet> i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   245
      by (subst (2) snd_image_times') (simp del: snd_image_times add: o_def inner_Pair_0)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   246
  ultimately show ?thesis unfolding interval_lowerbound_def
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   247
      by (subst sum_Basis_prod_eq) (auto simp add: sum_prod)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   248
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   249
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   250
subsection \<open>The notion of a gauge --- simply an open set containing the point.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   251
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   252
definition "gauge d \<longleftrightarrow> (\<forall>x. x \<in> d x \<and> open (d x))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   253
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   254
lemma gaugeI:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   255
  assumes "\<And>x. x \<in> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   256
    and "\<And>x. open (g x)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   257
  shows "gauge g"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   258
  using assms unfolding gauge_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   259
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   260
lemma gaugeD[dest]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   261
  assumes "gauge d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   262
  shows "x \<in> d x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   263
    and "open (d x)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   264
  using assms unfolding gauge_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   265
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   266
lemma gauge_ball_dependent: "\<forall>x. 0 < e x \<Longrightarrow> gauge (\<lambda>x. ball x (e x))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   267
  unfolding gauge_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   268
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   269
lemma gauge_ball[intro]: "0 < e \<Longrightarrow> gauge (\<lambda>x. ball x e)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   270
  unfolding gauge_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   271
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   272
lemma gauge_trivial[intro!]: "gauge (\<lambda>x. ball x 1)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   273
  by (rule gauge_ball) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   274
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   275
lemma gauge_inter[intro]: "gauge d1 \<Longrightarrow> gauge d2 \<Longrightarrow> gauge (\<lambda>x. d1 x \<inter> d2 x)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   276
  unfolding gauge_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   277
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   278
lemma gauge_inters:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   279
  assumes "finite s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   280
    and "\<forall>d\<in>s. gauge (f d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   281
  shows "gauge (\<lambda>x. \<Inter>{f d x | d. d \<in> s})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   282
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   283
  have *: "\<And>x. {f d x |d. d \<in> s} = (\<lambda>d. f d x) ` s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   284
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   285
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   286
    unfolding gauge_def unfolding *
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   287
    using assms unfolding Ball_def Inter_iff mem_Collect_eq gauge_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   288
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   289
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   290
lemma gauge_existence_lemma:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   291
  "(\<forall>x. \<exists>d :: real. p x \<longrightarrow> 0 < d \<and> q d x) \<longleftrightarrow> (\<forall>x. \<exists>d>0. p x \<longrightarrow> q d x)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   292
  by (metis zero_less_one)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   293
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   294
subsection \<open>Attempt a systematic general set of "offset" results for components.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   295
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   296
lemma gauge_modify:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   297
  assumes "(\<forall>s. open s \<longrightarrow> open {x. f(x) \<in> s})" "gauge d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   298
  shows "gauge (\<lambda>x. {y. f y \<in> d (f x)})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   299
  using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   300
  unfolding gauge_def
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   301
  apply safe
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   302
  defer
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   303
  apply (erule_tac x="f x" in allE)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   304
  apply (erule_tac x="d (f x)" in allE)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   305
  apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   306
  done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   307
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   308
subsection \<open>Divisions.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   309
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   310
definition division_of (infixl "division'_of" 40)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   311
where
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   312
  "s division_of i \<longleftrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   313
    finite s \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   314
    (\<forall>k\<in>s. k \<subseteq> i \<and> k \<noteq> {} \<and> (\<exists>a b. k = cbox a b)) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   315
    (\<forall>k1\<in>s. \<forall>k2\<in>s. k1 \<noteq> k2 \<longrightarrow> interior(k1) \<inter> interior(k2) = {}) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   316
    (\<Union>s = i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   317
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   318
lemma division_ofD[dest]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   319
  assumes "s division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   320
  shows "finite s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   321
    and "\<And>k. k \<in> s \<Longrightarrow> k \<subseteq> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   322
    and "\<And>k. k \<in> s \<Longrightarrow> k \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   323
    and "\<And>k. k \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   324
    and "\<And>k1 k2. k1 \<in> s \<Longrightarrow> k2 \<in> s \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow> interior(k1) \<inter> interior(k2) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   325
    and "\<Union>s = i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   326
  using assms unfolding division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   327
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   328
lemma division_ofI:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   329
  assumes "finite s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   330
    and "\<And>k. k \<in> s \<Longrightarrow> k \<subseteq> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   331
    and "\<And>k. k \<in> s \<Longrightarrow> k \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   332
    and "\<And>k. k \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   333
    and "\<And>k1 k2. k1 \<in> s \<Longrightarrow> k2 \<in> s \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow> interior k1 \<inter> interior k2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   334
    and "\<Union>s = i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   335
  shows "s division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   336
  using assms unfolding division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   337
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   338
lemma division_of_finite: "s division_of i \<Longrightarrow> finite s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   339
  unfolding division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   340
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   341
lemma division_of_self[intro]: "cbox a b \<noteq> {} \<Longrightarrow> {cbox a b} division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   342
  unfolding division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   343
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   344
lemma division_of_trivial[simp]: "s division_of {} \<longleftrightarrow> s = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   345
  unfolding division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   346
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   347
lemma division_of_sing[simp]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   348
  "s division_of cbox a (a::'a::euclidean_space) \<longleftrightarrow> s = {cbox a a}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   349
  (is "?l = ?r")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   350
proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   351
  assume ?r
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   352
  moreover
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   353
  { fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   354
    assume "s = {{a}}" "k\<in>s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   355
    then have "\<exists>x y. k = cbox x y"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   356
      apply (rule_tac x=a in exI)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   357
      apply (force simp: cbox_sing)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   358
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   359
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   360
  ultimately show ?l
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   361
    unfolding division_of_def cbox_sing by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   362
next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   363
  assume ?l
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   364
  note * = conjunctD4[OF this[unfolded division_of_def cbox_sing]]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   365
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   366
    fix x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   367
    assume x: "x \<in> s" have "x = {a}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   368
      using *(2)[rule_format,OF x] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   369
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   370
  moreover have "s \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   371
    using *(4) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   372
  ultimately show ?r
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   373
    unfolding cbox_sing by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   374
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   375
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   376
lemma elementary_empty: obtains p where "p division_of {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   377
  unfolding division_of_trivial by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   378
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   379
lemma elementary_interval: obtains p where "p division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   380
  by (metis division_of_trivial division_of_self)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   381
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   382
lemma division_contains: "s division_of i \<Longrightarrow> \<forall>x\<in>i. \<exists>k\<in>s. x \<in> k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   383
  unfolding division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   384
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   385
lemma forall_in_division:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   386
  "d division_of i \<Longrightarrow> (\<forall>x\<in>d. P x) \<longleftrightarrow> (\<forall>a b. cbox a b \<in> d \<longrightarrow> P (cbox a b))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   387
  unfolding division_of_def by fastforce
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   388
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   389
lemma division_of_subset:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   390
  assumes "p division_of (\<Union>p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   391
    and "q \<subseteq> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   392
  shows "q division_of (\<Union>q)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   393
proof (rule division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   394
  note * = division_ofD[OF assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   395
  show "finite q"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   396
    using "*"(1) assms(2) infinite_super by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   397
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   398
    fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   399
    assume "k \<in> q"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   400
    then have kp: "k \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   401
      using assms(2) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   402
    show "k \<subseteq> \<Union>q"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   403
      using \<open>k \<in> q\<close> by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   404
    show "\<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   405
      using *(4)[OF kp] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   406
    show "k \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   407
      using *(3)[OF kp] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   408
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   409
  fix k1 k2
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   410
  assume "k1 \<in> q" "k2 \<in> q" "k1 \<noteq> k2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   411
  then have **: "k1 \<in> p" "k2 \<in> p" "k1 \<noteq> k2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   412
    using assms(2) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   413
  show "interior k1 \<inter> interior k2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   414
    using *(5)[OF **] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   415
qed auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   416
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   417
lemma division_of_union_self[intro]: "p division_of s \<Longrightarrow> p division_of (\<Union>p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   418
  unfolding division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   419
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   420
lemma division_inter:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   421
  fixes s1 s2 :: "'a::euclidean_space set"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   422
  assumes "p1 division_of s1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   423
    and "p2 division_of s2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   424
  shows "{k1 \<inter> k2 | k1 k2. k1 \<in> p1 \<and> k2 \<in> p2 \<and> k1 \<inter> k2 \<noteq> {}} division_of (s1 \<inter> s2)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   425
  (is "?A' division_of _")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   426
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   427
  let ?A = "{s. s \<in>  (\<lambda>(k1,k2). k1 \<inter> k2) ` (p1 \<times> p2) \<and> s \<noteq> {}}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   428
  have *: "?A' = ?A" by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   429
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   430
    unfolding *
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   431
  proof (rule division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   432
    have "?A \<subseteq> (\<lambda>(x, y). x \<inter> y) ` (p1 \<times> p2)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   433
      by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   434
    moreover have "finite (p1 \<times> p2)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   435
      using assms unfolding division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   436
    ultimately show "finite ?A" by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   437
    have *: "\<And>s. \<Union>{x\<in>s. x \<noteq> {}} = \<Union>s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   438
      by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   439
    show "\<Union>?A = s1 \<inter> s2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   440
      apply (rule set_eqI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   441
      unfolding * and UN_iff
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   442
      using division_ofD(6)[OF assms(1)] and division_ofD(6)[OF assms(2)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   443
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   444
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   445
    {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   446
      fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   447
      assume "k \<in> ?A"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   448
      then obtain k1 k2 where k: "k = k1 \<inter> k2" "k1 \<in> p1" "k2 \<in> p2" "k \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   449
        by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   450
      then show "k \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   451
        by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   452
      show "k \<subseteq> s1 \<inter> s2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   453
        using division_ofD(2)[OF assms(1) k(2)] and division_ofD(2)[OF assms(2) k(3)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   454
        unfolding k by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   455
      obtain a1 b1 where k1: "k1 = cbox a1 b1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   456
        using division_ofD(4)[OF assms(1) k(2)] by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   457
      obtain a2 b2 where k2: "k2 = cbox a2 b2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   458
        using division_ofD(4)[OF assms(2) k(3)] by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   459
      show "\<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   460
        unfolding k k1 k2 unfolding Int_interval by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   461
    }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   462
    fix k1 k2
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   463
    assume "k1 \<in> ?A"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   464
    then obtain x1 y1 where k1: "k1 = x1 \<inter> y1" "x1 \<in> p1" "y1 \<in> p2" "k1 \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   465
      by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   466
    assume "k2 \<in> ?A"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   467
    then obtain x2 y2 where k2: "k2 = x2 \<inter> y2" "x2 \<in> p1" "y2 \<in> p2" "k2 \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   468
      by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   469
    assume "k1 \<noteq> k2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   470
    then have th: "x1 \<noteq> x2 \<or> y1 \<noteq> y2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   471
      unfolding k1 k2 by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   472
    have *: "interior x1 \<inter> interior x2 = {} \<or> interior y1 \<inter> interior y2 = {} \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   473
      interior (x1 \<inter> y1) \<subseteq> interior x1 \<Longrightarrow> interior (x1 \<inter> y1) \<subseteq> interior y1 \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   474
      interior (x2 \<inter> y2) \<subseteq> interior x2 \<Longrightarrow> interior (x2 \<inter> y2) \<subseteq> interior y2 \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   475
      interior (x1 \<inter> y1) \<inter> interior (x2 \<inter> y2) = {}" by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   476
    show "interior k1 \<inter> interior k2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   477
      unfolding k1 k2
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   478
      apply (rule *)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   479
      using assms division_ofD(5) k1 k2(2) k2(3) th apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   480
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   481
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   482
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   483
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   484
lemma division_inter_1:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   485
  assumes "d division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   486
    and "cbox a (b::'a::euclidean_space) \<subseteq> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   487
  shows "{cbox a b \<inter> k | k. k \<in> d \<and> cbox a b \<inter> k \<noteq> {}} division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   488
proof (cases "cbox a b = {}")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   489
  case True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   490
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   491
    unfolding True and division_of_trivial by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   492
next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   493
  case False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   494
  have *: "cbox a b \<inter> i = cbox a b" using assms(2) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   495
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   496
    using division_inter[OF division_of_self[OF False] assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   497
    unfolding * by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   498
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   499
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   500
lemma elementary_inter:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   501
  fixes s t :: "'a::euclidean_space set"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   502
  assumes "p1 division_of s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   503
    and "p2 division_of t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   504
  shows "\<exists>p. p division_of (s \<inter> t)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   505
using assms division_inter by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   506
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   507
lemma elementary_inters:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   508
  assumes "finite f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   509
    and "f \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   510
    and "\<forall>s\<in>f. \<exists>p. p division_of (s::('a::euclidean_space) set)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   511
  shows "\<exists>p. p division_of (\<Inter>f)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   512
  using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   513
proof (induct f rule: finite_induct)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   514
  case (insert x f)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   515
  show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   516
  proof (cases "f = {}")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   517
    case True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   518
    then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   519
      unfolding True using insert by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   520
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   521
    case False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   522
    obtain p where "p division_of \<Inter>f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   523
      using insert(3)[OF False insert(5)[unfolded ball_simps,THEN conjunct2]] ..
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   524
    moreover obtain px where "px division_of x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   525
      using insert(5)[rule_format,OF insertI1] ..
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   526
    ultimately show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   527
      by (simp add: elementary_inter Inter_insert)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   528
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   529
qed auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   530
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   531
lemma division_disjoint_union:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   532
  assumes "p1 division_of s1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   533
    and "p2 division_of s2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   534
    and "interior s1 \<inter> interior s2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   535
  shows "(p1 \<union> p2) division_of (s1 \<union> s2)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   536
proof (rule division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   537
  note d1 = division_ofD[OF assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   538
  note d2 = division_ofD[OF assms(2)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   539
  show "finite (p1 \<union> p2)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   540
    using d1(1) d2(1) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   541
  show "\<Union>(p1 \<union> p2) = s1 \<union> s2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   542
    using d1(6) d2(6) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   543
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   544
    fix k1 k2
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   545
    assume as: "k1 \<in> p1 \<union> p2" "k2 \<in> p1 \<union> p2" "k1 \<noteq> k2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   546
    moreover
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   547
    let ?g="interior k1 \<inter> interior k2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   548
    {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   549
      assume as: "k1\<in>p1" "k2\<in>p2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   550
      have ?g
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   551
        using interior_mono[OF d1(2)[OF as(1)]] interior_mono[OF d2(2)[OF as(2)]]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   552
        using assms(3) by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   553
    }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   554
    moreover
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   555
    {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   556
      assume as: "k1\<in>p2" "k2\<in>p1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   557
      have ?g
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   558
        using interior_mono[OF d1(2)[OF as(2)]] interior_mono[OF d2(2)[OF as(1)]]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   559
        using assms(3) by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   560
    }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   561
    ultimately show ?g
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   562
      using d1(5)[OF _ _ as(3)] and d2(5)[OF _ _ as(3)] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   563
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   564
  fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   565
  assume k: "k \<in> p1 \<union> p2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   566
  show "k \<subseteq> s1 \<union> s2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   567
    using k d1(2) d2(2) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   568
  show "k \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   569
    using k d1(3) d2(3) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   570
  show "\<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   571
    using k d1(4) d2(4) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   572
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   573
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   574
lemma partial_division_extend_1:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   575
  fixes a b c d :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   576
  assumes incl: "cbox c d \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   577
    and nonempty: "cbox c d \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   578
  obtains p where "p division_of (cbox a b)" "cbox c d \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   579
proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   580
  let ?B = "\<lambda>f::'a\<Rightarrow>'a \<times> 'a.
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   581
    cbox (\<Sum>i\<in>Basis. (fst (f i) \<bullet> i) *\<^sub>R i) (\<Sum>i\<in>Basis. (snd (f i) \<bullet> i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   582
  define p where "p = ?B ` (Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   583
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   584
  show "cbox c d \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   585
    unfolding p_def
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   586
    by (auto simp add: box_eq_empty cbox_def intro!: image_eqI[where x="\<lambda>(i::'a)\<in>Basis. (c, d)"])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   587
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   588
    fix i :: 'a
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   589
    assume "i \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   590
    with incl nonempty have "a \<bullet> i \<le> c \<bullet> i" "c \<bullet> i \<le> d \<bullet> i" "d \<bullet> i \<le> b \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   591
      unfolding box_eq_empty subset_box by (auto simp: not_le)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   592
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   593
  note ord = this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   594
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   595
  show "p division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   596
  proof (rule division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   597
    show "finite p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   598
      unfolding p_def by (auto intro!: finite_PiE)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   599
    {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   600
      fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   601
      assume "k \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   602
      then obtain f where f: "f \<in> Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)}" and k: "k = ?B f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   603
        by (auto simp: p_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   604
      then show "\<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   605
        by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   606
      have "k \<subseteq> cbox a b \<and> k \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   607
      proof (simp add: k box_eq_empty subset_box not_less, safe)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   608
        fix i :: 'a
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   609
        assume i: "i \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   610
        with f have "f i = (a, c) \<or> f i = (c, d) \<or> f i = (d, b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   611
          by (auto simp: PiE_iff)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   612
        with i ord[of i]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   613
        show "a \<bullet> i \<le> fst (f i) \<bullet> i" "snd (f i) \<bullet> i \<le> b \<bullet> i" "fst (f i) \<bullet> i \<le> snd (f i) \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   614
          by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   615
      qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   616
      then show "k \<noteq> {}" "k \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   617
        by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   618
      {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   619
        fix l
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   620
        assume "l \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   621
        then obtain g where g: "g \<in> Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)}" and l: "l = ?B g"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   622
          by (auto simp: p_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   623
        assume "l \<noteq> k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   624
        have "\<exists>i\<in>Basis. f i \<noteq> g i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   625
        proof (rule ccontr)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   626
          assume "\<not> ?thesis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   627
          with f g have "f = g"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   628
            by (auto simp: PiE_iff extensional_def fun_eq_iff)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   629
          with \<open>l \<noteq> k\<close> show False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   630
            by (simp add: l k)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   631
        qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   632
        then obtain i where *: "i \<in> Basis" "f i \<noteq> g i" ..
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   633
        then have "f i = (a, c) \<or> f i = (c, d) \<or> f i = (d, b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   634
                  "g i = (a, c) \<or> g i = (c, d) \<or> g i = (d, b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   635
          using f g by (auto simp: PiE_iff)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   636
        with * ord[of i] show "interior l \<inter> interior k = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   637
          by (auto simp add: l k interior_cbox disjoint_interval intro!: bexI[of _ i])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   638
      }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   639
      note \<open>k \<subseteq> cbox a b\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   640
    }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   641
    moreover
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   642
    {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   643
      fix x assume x: "x \<in> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   644
      have "\<forall>i\<in>Basis. \<exists>l. x \<bullet> i \<in> {fst l \<bullet> i .. snd l \<bullet> i} \<and> l \<in> {(a, c), (c, d), (d, b)}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   645
      proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   646
        fix i :: 'a
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   647
        assume "i \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   648
        with x ord[of i]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   649
        have "(a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> c \<bullet> i) \<or> (c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i) \<or>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   650
            (d \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   651
          by (auto simp: cbox_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   652
        then show "\<exists>l. x \<bullet> i \<in> {fst l \<bullet> i .. snd l \<bullet> i} \<and> l \<in> {(a, c), (c, d), (d, b)}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   653
          by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   654
      qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   655
      then obtain f where
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   656
        f: "\<forall>i\<in>Basis. x \<bullet> i \<in> {fst (f i) \<bullet> i..snd (f i) \<bullet> i} \<and> f i \<in> {(a, c), (c, d), (d, b)}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   657
        unfolding bchoice_iff ..
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   658
      moreover from f have "restrict f Basis \<in> Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   659
        by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   660
      moreover from f have "x \<in> ?B (restrict f Basis)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   661
        by (auto simp: mem_box)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   662
      ultimately have "\<exists>k\<in>p. x \<in> k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   663
        unfolding p_def by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   664
    }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   665
    ultimately show "\<Union>p = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   666
      by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   667
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   668
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   669
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   670
lemma partial_division_extend_interval:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   671
  assumes "p division_of (\<Union>p)" "(\<Union>p) \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   672
  obtains q where "p \<subseteq> q" "q division_of cbox a (b::'a::euclidean_space)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   673
proof (cases "p = {}")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   674
  case True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   675
  obtain q where "q division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   676
    by (rule elementary_interval)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   677
  then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   678
    using True that by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   679
next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   680
  case False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   681
  note p = division_ofD[OF assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   682
  have div_cbox: "\<forall>k\<in>p. \<exists>q. q division_of cbox a b \<and> k \<in> q"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   683
  proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   684
    fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   685
    assume kp: "k \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   686
    obtain c d where k: "k = cbox c d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   687
      using p(4)[OF kp] by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   688
    have *: "cbox c d \<subseteq> cbox a b" "cbox c d \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   689
      using p(2,3)[OF kp, unfolded k] using assms(2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   690
      by (blast intro: order.trans)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   691
    obtain q where "q division_of cbox a b" "cbox c d \<in> q"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   692
      by (rule partial_division_extend_1[OF *])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   693
    then show "\<exists>q. q division_of cbox a b \<and> k \<in> q"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   694
      unfolding k by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   695
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   696
  obtain q where q: "\<And>x. x \<in> p \<Longrightarrow> q x division_of cbox a b" "\<And>x. x \<in> p \<Longrightarrow> x \<in> q x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   697
    using bchoice[OF div_cbox] by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   698
  { fix x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   699
    assume x: "x \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   700
    have "q x division_of \<Union>q x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   701
      apply (rule division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   702
      using division_ofD[OF q(1)[OF x]]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   703
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   704
      done }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   705
  then have "\<And>x. x \<in> p \<Longrightarrow> \<exists>d. d division_of \<Union>(q x - {x})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   706
    by (meson Diff_subset division_of_subset)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   707
  then have "\<exists>d. d division_of \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   708
    apply -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   709
    apply (rule elementary_inters [OF finite_imageI[OF p(1)]])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   710
    apply (auto simp: False elementary_inters [OF finite_imageI[OF p(1)]])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   711
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   712
  then obtain d where d: "d division_of \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p)" ..
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   713
  have "d \<union> p division_of cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   714
  proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   715
    have te: "\<And>s f t. s \<noteq> {} \<Longrightarrow> \<forall>i\<in>s. f i \<union> i = t \<Longrightarrow> t = \<Inter>(f ` s) \<union> \<Union>s" by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   716
    have cbox_eq: "cbox a b = \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p) \<union> \<Union>p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   717
    proof (rule te[OF False], clarify)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   718
      fix i
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   719
      assume i: "i \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   720
      show "\<Union>(q i - {i}) \<union> i = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   721
        using division_ofD(6)[OF q(1)[OF i]] using q(2)[OF i] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   722
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   723
    { fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   724
      assume k: "k \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   725
      have *: "\<And>u t s. t \<inter> s = {} \<Longrightarrow> u \<subseteq> s \<Longrightarrow> u \<inter> t = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   726
        by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   727
      have "interior (\<Inter>i\<in>p. \<Union>(q i - {i})) \<inter> interior k = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   728
      proof (rule *[OF inter_interior_unions_intervals])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   729
        note qk=division_ofD[OF q(1)[OF k]]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   730
        show "finite (q k - {k})" "open (interior k)" "\<forall>t\<in>q k - {k}. \<exists>a b. t = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   731
          using qk by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   732
        show "\<forall>t\<in>q k - {k}. interior k \<inter> interior t = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   733
          using qk(5) using q(2)[OF k] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   734
        show "interior (\<Inter>i\<in>p. \<Union>(q i - {i})) \<subseteq> interior (\<Union>(q k - {k}))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   735
          apply (rule interior_mono)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   736
          using k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   737
          apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   738
          done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   739
      qed } note [simp] = this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   740
    show "d \<union> p division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   741
      unfolding cbox_eq
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   742
      apply (rule division_disjoint_union[OF d assms(1)])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   743
      apply (rule inter_interior_unions_intervals)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   744
      apply (rule p open_interior ballI)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   745
      apply simp_all
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   746
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   747
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   748
  then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   749
    by (meson Un_upper2 that)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   750
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   751
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   752
lemma elementary_bounded[dest]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   753
  fixes s :: "'a::euclidean_space set"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   754
  shows "p division_of s \<Longrightarrow> bounded s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   755
  unfolding division_of_def by (metis bounded_Union bounded_cbox)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   756
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   757
lemma elementary_subset_cbox:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   758
  "p division_of s \<Longrightarrow> \<exists>a b. s \<subseteq> cbox a (b::'a::euclidean_space)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   759
  by (meson elementary_bounded bounded_subset_cbox)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   760
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   761
lemma division_union_intervals_exists:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   762
  fixes a b :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   763
  assumes "cbox a b \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   764
  obtains p where "(insert (cbox a b) p) division_of (cbox a b \<union> cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   765
proof (cases "cbox c d = {}")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   766
  case True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   767
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   768
    apply (rule that[of "{}"])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   769
    unfolding True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   770
    using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   771
    apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   772
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   773
next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   774
  case False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   775
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   776
  proof (cases "cbox a b \<inter> cbox c d = {}")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   777
    case True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   778
    then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   779
      by (metis that False assms division_disjoint_union division_of_self insert_is_Un interior_Int interior_empty)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   780
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   781
    case False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   782
    obtain u v where uv: "cbox a b \<inter> cbox c d = cbox u v"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   783
      unfolding Int_interval by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   784
    have uv_sub: "cbox u v \<subseteq> cbox c d" using uv by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   785
    obtain p where "p division_of cbox c d" "cbox u v \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   786
      by (rule partial_division_extend_1[OF uv_sub False[unfolded uv]])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   787
    note p = this division_ofD[OF this(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   788
    have "interior (cbox a b \<inter> \<Union>(p - {cbox u v})) = interior(cbox u v \<inter> \<Union>(p - {cbox u v}))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   789
      apply (rule arg_cong[of _ _ interior])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   790
      using p(8) uv by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   791
    also have "\<dots> = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   792
      unfolding interior_Int
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   793
      apply (rule inter_interior_unions_intervals)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   794
      using p(6) p(7)[OF p(2)] p(3)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   795
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   796
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   797
    finally have [simp]: "interior (cbox a b) \<inter> interior (\<Union>(p - {cbox u v})) = {}" by simp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   798
    have cbe: "cbox a b \<union> cbox c d = cbox a b \<union> \<Union>(p - {cbox u v})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   799
      using p(8) unfolding uv[symmetric] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   800
    have "insert (cbox a b) (p - {cbox u v}) division_of cbox a b \<union> \<Union>(p - {cbox u v})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   801
    proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   802
      have "{cbox a b} division_of cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   803
        by (simp add: assms division_of_self)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   804
      then show "insert (cbox a b) (p - {cbox u v}) division_of cbox a b \<union> \<Union>(p - {cbox u v})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   805
        by (metis (no_types) Diff_subset \<open>interior (cbox a b) \<inter> interior (\<Union>(p - {cbox u v})) = {}\<close> division_disjoint_union division_of_subset insert_is_Un p(1) p(8))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   806
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   807
    with that[of "p - {cbox u v}"] show ?thesis by (simp add: cbe)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   808
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   809
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   810
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   811
lemma division_of_unions:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   812
  assumes "finite f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   813
    and "\<And>p. p \<in> f \<Longrightarrow> p division_of (\<Union>p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   814
    and "\<And>k1 k2. k1 \<in> \<Union>f \<Longrightarrow> k2 \<in> \<Union>f \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow> interior k1 \<inter> interior k2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   815
  shows "\<Union>f division_of \<Union>\<Union>f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   816
  using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   817
  by (auto intro!: division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   818
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   819
lemma elementary_union_interval:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   820
  fixes a b :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   821
  assumes "p division_of \<Union>p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   822
  obtains q where "q division_of (cbox a b \<union> \<Union>p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   823
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   824
  note assm = division_ofD[OF assms]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   825
  have lem1: "\<And>f s. \<Union>\<Union>(f ` s) = \<Union>((\<lambda>x. \<Union>(f x)) ` s)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   826
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   827
  have lem2: "\<And>f s. f \<noteq> {} \<Longrightarrow> \<Union>{s \<union> t |t. t \<in> f} = s \<union> \<Union>f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   828
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   829
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   830
    presume "p = {} \<Longrightarrow> thesis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   831
      "cbox a b = {} \<Longrightarrow> thesis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   832
      "cbox a b \<noteq> {} \<Longrightarrow> interior (cbox a b) = {} \<Longrightarrow> thesis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   833
      "p \<noteq> {} \<Longrightarrow> interior (cbox a b)\<noteq>{} \<Longrightarrow> cbox a b \<noteq> {} \<Longrightarrow> thesis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   834
    then show thesis by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   835
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   836
    assume as: "p = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   837
    obtain p where "p division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   838
      by (rule elementary_interval)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   839
    then show thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   840
      using as that by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   841
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   842
    assume as: "cbox a b = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   843
    show thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   844
      using as assms that by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   845
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   846
    assume as: "interior (cbox a b) = {}" "cbox a b \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   847
    show thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   848
      apply (rule that[of "insert (cbox a b) p"],rule division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   849
      unfolding finite_insert
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   850
      apply (rule assm(1)) unfolding Union_insert
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   851
      using assm(2-4) as
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   852
      apply -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   853
      apply (fast dest: assm(5))+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   854
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   855
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   856
    assume as: "p \<noteq> {}" "interior (cbox a b) \<noteq> {}" "cbox a b \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   857
    have "\<forall>k\<in>p. \<exists>q. (insert (cbox a b) q) division_of (cbox a b \<union> k)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   858
    proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   859
      fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   860
      assume kp: "k \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   861
      from assm(4)[OF kp] obtain c d where "k = cbox c d" by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   862
      then show "\<exists>q. (insert (cbox a b) q) division_of (cbox a b \<union> k)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   863
        by (meson as(3) division_union_intervals_exists)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   864
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   865
    from bchoice[OF this] obtain q where "\<forall>x\<in>p. insert (cbox a b) (q x) division_of (cbox a b) \<union> x" ..
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   866
    note q = division_ofD[OF this[rule_format]]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   867
    let ?D = "\<Union>{insert (cbox a b) (q k) | k. k \<in> p}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   868
    show thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   869
    proof (rule that[OF division_ofI])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   870
      have *: "{insert (cbox a b) (q k) |k. k \<in> p} = (\<lambda>k. insert (cbox a b) (q k)) ` p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   871
        by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   872
      show "finite ?D"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   873
        using "*" assm(1) q(1) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   874
      show "\<Union>?D = cbox a b \<union> \<Union>p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   875
        unfolding * lem1
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   876
        unfolding lem2[OF as(1), of "cbox a b", symmetric]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   877
        using q(6)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   878
        by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   879
      fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   880
      assume k: "k \<in> ?D"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   881
      then show "k \<subseteq> cbox a b \<union> \<Union>p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   882
        using q(2) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   883
      show "k \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   884
        using q(3) k by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   885
      show "\<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   886
        using q(4) k by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   887
      fix k'
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   888
      assume k': "k' \<in> ?D" "k \<noteq> k'"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   889
      obtain x where x: "k \<in> insert (cbox a b) (q x)" "x\<in>p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   890
        using k by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   891
      obtain x' where x': "k'\<in>insert (cbox a b) (q x')" "x'\<in>p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   892
        using k' by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   893
      show "interior k \<inter> interior k' = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   894
      proof (cases "x = x'")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   895
        case True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   896
        show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   897
          using True k' q(5) x' x by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   898
      next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   899
        case False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   900
        {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   901
          presume "k = cbox a b \<Longrightarrow> ?thesis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   902
            and "k' = cbox a b \<Longrightarrow> ?thesis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   903
            and "k \<noteq> cbox a b \<Longrightarrow> k' \<noteq> cbox a b \<Longrightarrow> ?thesis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   904
          then show ?thesis by linarith
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   905
        next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   906
          assume as': "k  = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   907
          show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   908
            using as' k' q(5) x' by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   909
        next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   910
          assume as': "k' = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   911
          show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   912
            using as' k'(2) q(5) x by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   913
        }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   914
        assume as': "k \<noteq> cbox a b" "k' \<noteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   915
        obtain c d where k: "k = cbox c d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   916
          using q(4)[OF x(2,1)] by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   917
        have "interior k \<inter> interior (cbox a b) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   918
          using as' k'(2) q(5) x by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   919
        then have "interior k \<subseteq> interior x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   920
        using interior_subset_union_intervals
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   921
          by (metis as(2) k q(2) x interior_subset_union_intervals)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   922
        moreover
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   923
        obtain c d where c_d: "k' = cbox c d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   924
          using q(4)[OF x'(2,1)] by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   925
        have "interior k' \<inter> interior (cbox a b) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   926
          using as'(2) q(5) x' by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   927
        then have "interior k' \<subseteq> interior x'"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   928
          by (metis as(2) c_d interior_subset_union_intervals q(2) x'(1) x'(2))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   929
        ultimately show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   930
          using assm(5)[OF x(2) x'(2) False] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   931
      qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   932
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   933
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   934
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   935
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   936
lemma elementary_unions_intervals:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   937
  assumes fin: "finite f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   938
    and "\<And>s. s \<in> f \<Longrightarrow> \<exists>a b. s = cbox a (b::'a::euclidean_space)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   939
  obtains p where "p division_of (\<Union>f)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   940
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   941
  have "\<exists>p. p division_of (\<Union>f)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   942
  proof (induct_tac f rule:finite_subset_induct)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   943
    show "\<exists>p. p division_of \<Union>{}" using elementary_empty by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   944
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   945
    fix x F
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   946
    assume as: "finite F" "x \<notin> F" "\<exists>p. p division_of \<Union>F" "x\<in>f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   947
    from this(3) obtain p where p: "p division_of \<Union>F" ..
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   948
    from assms(2)[OF as(4)] obtain a b where x: "x = cbox a b" by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   949
    have *: "\<Union>F = \<Union>p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   950
      using division_ofD[OF p] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   951
    show "\<exists>p. p division_of \<Union>insert x F"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   952
      using elementary_union_interval[OF p[unfolded *], of a b]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   953
      unfolding Union_insert x * by metis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   954
  qed (insert assms, auto)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   955
  then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   956
    using that by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   957
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   958
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   959
lemma elementary_union:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   960
  fixes s t :: "'a::euclidean_space set"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   961
  assumes "ps division_of s" "pt division_of t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   962
  obtains p where "p division_of (s \<union> t)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   963
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   964
  have *: "s \<union> t = \<Union>ps \<union> \<Union>pt"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   965
    using assms unfolding division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   966
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   967
    apply (rule elementary_unions_intervals[of "ps \<union> pt"])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   968
    using assms apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   969
    by (simp add: * that)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   970
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   971
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   972
lemma partial_division_extend:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   973
  fixes t :: "'a::euclidean_space set"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   974
  assumes "p division_of s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   975
    and "q division_of t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   976
    and "s \<subseteq> t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   977
  obtains r where "p \<subseteq> r" and "r division_of t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   978
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   979
  note divp = division_ofD[OF assms(1)] and divq = division_ofD[OF assms(2)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   980
  obtain a b where ab: "t \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   981
    using elementary_subset_cbox[OF assms(2)] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   982
  obtain r1 where "p \<subseteq> r1" "r1 division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   983
    using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   984
    by (metis ab dual_order.trans partial_division_extend_interval divp(6))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   985
  note r1 = this division_ofD[OF this(2)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   986
  obtain p' where "p' division_of \<Union>(r1 - p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   987
    apply (rule elementary_unions_intervals[of "r1 - p"])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   988
    using r1(3,6)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   989
    apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   990
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   991
  then obtain r2 where r2: "r2 division_of (\<Union>(r1 - p)) \<inter> (\<Union>q)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   992
    by (metis assms(2) divq(6) elementary_inter)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   993
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   994
    fix x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   995
    assume x: "x \<in> t" "x \<notin> s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   996
    then have "x\<in>\<Union>r1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   997
      unfolding r1 using ab by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   998
    then obtain r where r: "r \<in> r1" "x \<in> r"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
   999
      unfolding Union_iff ..
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1000
    moreover
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1001
    have "r \<notin> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1002
    proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1003
      assume "r \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1004
      then have "x \<in> s" using divp(2) r by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1005
      then show False using x by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1006
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1007
    ultimately have "x\<in>\<Union>(r1 - p)" by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1008
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1009
  then have *: "t = \<Union>p \<union> (\<Union>(r1 - p) \<inter> \<Union>q)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1010
    unfolding divp divq using assms(3) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1011
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1012
    apply (rule that[of "p \<union> r2"])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1013
    unfolding *
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1014
    defer
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1015
    apply (rule division_disjoint_union)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1016
    unfolding divp(6)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1017
    apply(rule assms r2)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1018
  proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1019
    have "interior s \<inter> interior (\<Union>(r1-p)) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1020
    proof (rule inter_interior_unions_intervals)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1021
      show "finite (r1 - p)" and "open (interior s)" and "\<forall>t\<in>r1-p. \<exists>a b. t = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1022
        using r1 by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1023
      have *: "\<And>s. (\<And>x. x \<in> s \<Longrightarrow> False) \<Longrightarrow> s = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1024
        by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1025
      show "\<forall>t\<in>r1-p. interior s \<inter> interior t = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1026
      proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1027
        fix m x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1028
        assume as: "m \<in> r1 - p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1029
        have "interior m \<inter> interior (\<Union>p) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1030
        proof (rule inter_interior_unions_intervals)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1031
          show "finite p" and "open (interior m)" and "\<forall>t\<in>p. \<exists>a b. t = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1032
            using divp by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1033
          show "\<forall>t\<in>p. interior m \<inter> interior t = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1034
            by (metis DiffD1 DiffD2 as r1(1) r1(7) set_rev_mp)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1035
        qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1036
        then show "interior s \<inter> interior m = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1037
          unfolding divp by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1038
      qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1039
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1040
    then show "interior s \<inter> interior (\<Union>(r1-p) \<inter> (\<Union>q)) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1041
      using interior_subset by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1042
  qed auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1043
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1044
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1045
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1046
lemma division_split:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1047
  fixes a :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1048
  assumes "p division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1049
    and k: "k\<in>Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1050
  shows "{l \<inter> {x. x\<bullet>k \<le> c} | l. l \<in> p \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}} division_of(cbox a b \<inter> {x. x\<bullet>k \<le> c})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1051
      (is "?p1 division_of ?I1")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1052
    and "{l \<inter> {x. x\<bullet>k \<ge> c} | l. l \<in> p \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}} division_of (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1053
      (is "?p2 division_of ?I2")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1054
proof (rule_tac[!] division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1055
  note p = division_ofD[OF assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1056
  show "finite ?p1" "finite ?p2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1057
    using p(1) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1058
  show "\<Union>?p1 = ?I1" "\<Union>?p2 = ?I2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1059
    unfolding p(6)[symmetric] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1060
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1061
    fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1062
    assume "k \<in> ?p1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1063
    then guess l unfolding mem_Collect_eq by (elim exE conjE) note l=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1064
    guess u v using p(4)[OF l(2)] by (elim exE) note uv=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1065
    show "k \<subseteq> ?I1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1066
      using l p(2) uv by force
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1067
    show  "k \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1068
      by (simp add: l)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1069
    show  "\<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1070
      apply (simp add: l uv p(2-3)[OF l(2)])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1071
      apply (subst interval_split[OF k])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1072
      apply (auto intro: order.trans)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1073
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1074
    fix k'
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1075
    assume "k' \<in> ?p1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1076
    then guess l' unfolding mem_Collect_eq by (elim exE conjE) note l'=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1077
    assume "k \<noteq> k'"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1078
    then show "interior k \<inter> interior k' = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1079
      unfolding l l' using p(5)[OF l(2) l'(2)] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1080
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1081
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1082
    fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1083
    assume "k \<in> ?p2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1084
    then guess l unfolding mem_Collect_eq by (elim exE conjE) note l=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1085
    guess u v using p(4)[OF l(2)] by (elim exE) note uv=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1086
    show "k \<subseteq> ?I2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1087
      using l p(2) uv by force
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1088
    show  "k \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1089
      by (simp add: l)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1090
    show  "\<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1091
      apply (simp add: l uv p(2-3)[OF l(2)])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1092
      apply (subst interval_split[OF k])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1093
      apply (auto intro: order.trans)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1094
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1095
    fix k'
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1096
    assume "k' \<in> ?p2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1097
    then guess l' unfolding mem_Collect_eq by (elim exE conjE) note l'=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1098
    assume "k \<noteq> k'"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1099
    then show "interior k \<inter> interior k' = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1100
      unfolding l l' using p(5)[OF l(2) l'(2)] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1101
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1102
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1103
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1104
subsection \<open>Tagged (partial) divisions.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1105
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1106
definition tagged_partial_division_of (infixr "tagged'_partial'_division'_of" 40)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1107
  where "s tagged_partial_division_of i \<longleftrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1108
    finite s \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1109
    (\<forall>x k. (x, k) \<in> s \<longrightarrow> x \<in> k \<and> k \<subseteq> i \<and> (\<exists>a b. k = cbox a b)) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1110
    (\<forall>x1 k1 x2 k2. (x1, k1) \<in> s \<and> (x2, k2) \<in> s \<and> (x1, k1) \<noteq> (x2, k2) \<longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1111
      interior k1 \<inter> interior k2 = {})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1112
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1113
lemma tagged_partial_division_ofD[dest]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1114
  assumes "s tagged_partial_division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1115
  shows "finite s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1116
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1117
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1118
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1119
    and "\<And>x1 k1 x2 k2. (x1,k1) \<in> s \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1120
      (x2, k2) \<in> s \<Longrightarrow> (x1, k1) \<noteq> (x2, k2) \<Longrightarrow> interior k1 \<inter> interior k2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1121
  using assms unfolding tagged_partial_division_of_def by blast+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1122
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1123
definition tagged_division_of (infixr "tagged'_division'_of" 40)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1124
  where "s tagged_division_of i \<longleftrightarrow> s tagged_partial_division_of i \<and> (\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1125
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1126
lemma tagged_division_of_finite: "s tagged_division_of i \<Longrightarrow> finite s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1127
  unfolding tagged_division_of_def tagged_partial_division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1128
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1129
lemma tagged_division_of:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1130
  "s tagged_division_of i \<longleftrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1131
    finite s \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1132
    (\<forall>x k. (x, k) \<in> s \<longrightarrow> x \<in> k \<and> k \<subseteq> i \<and> (\<exists>a b. k = cbox a b)) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1133
    (\<forall>x1 k1 x2 k2. (x1, k1) \<in> s \<and> (x2, k2) \<in> s \<and> (x1, k1) \<noteq> (x2, k2) \<longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1134
      interior k1 \<inter> interior k2 = {}) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1135
    (\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1136
  unfolding tagged_division_of_def tagged_partial_division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1137
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1138
lemma tagged_division_ofI:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1139
  assumes "finite s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1140
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1141
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1142
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1143
    and "\<And>x1 k1 x2 k2. (x1,k1) \<in> s \<Longrightarrow> (x2, k2) \<in> s \<Longrightarrow> (x1, k1) \<noteq> (x2, k2) \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1144
      interior k1 \<inter> interior k2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1145
    and "(\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1146
  shows "s tagged_division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1147
  unfolding tagged_division_of
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1148
  using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1149
  apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1150
  apply fastforce+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1151
  done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1152
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1153
lemma tagged_division_ofD[dest]:  (*FIXME USE A LOCALE*)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1154
  assumes "s tagged_division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1155
  shows "finite s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1156
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1157
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1158
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1159
    and "\<And>x1 k1 x2 k2. (x1, k1) \<in> s \<Longrightarrow> (x2, k2) \<in> s \<Longrightarrow> (x1, k1) \<noteq> (x2, k2) \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1160
      interior k1 \<inter> interior k2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1161
    and "(\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1162
  using assms unfolding tagged_division_of by blast+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1163
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1164
lemma division_of_tagged_division:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1165
  assumes "s tagged_division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1166
  shows "(snd ` s) division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1167
proof (rule division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1168
  note assm = tagged_division_ofD[OF assms]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1169
  show "\<Union>(snd ` s) = i" "finite (snd ` s)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1170
    using assm by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1171
  fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1172
  assume k: "k \<in> snd ` s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1173
  then obtain xk where xk: "(xk, k) \<in> s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1174
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1175
  then show "k \<subseteq> i" "k \<noteq> {}" "\<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1176
    using assm by fastforce+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1177
  fix k'
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1178
  assume k': "k' \<in> snd ` s" "k \<noteq> k'"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1179
  from this(1) obtain xk' where xk': "(xk', k') \<in> s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1180
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1181
  then show "interior k \<inter> interior k' = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1182
    using assm(5) k'(2) xk by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1183
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1184
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1185
lemma partial_division_of_tagged_division:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1186
  assumes "s tagged_partial_division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1187
  shows "(snd ` s) division_of \<Union>(snd ` s)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1188
proof (rule division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1189
  note assm = tagged_partial_division_ofD[OF assms]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1190
  show "finite (snd ` s)" "\<Union>(snd ` s) = \<Union>(snd ` s)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1191
    using assm by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1192
  fix k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1193
  assume k: "k \<in> snd ` s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1194
  then obtain xk where xk: "(xk, k) \<in> s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1195
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1196
  then show "k \<noteq> {}" "\<exists>a b. k = cbox a b" "k \<subseteq> \<Union>(snd ` s)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1197
    using assm by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1198
  fix k'
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1199
  assume k': "k' \<in> snd ` s" "k \<noteq> k'"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1200
  from this(1) obtain xk' where xk': "(xk', k') \<in> s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1201
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1202
  then show "interior k \<inter> interior k' = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1203
    using assm(5) k'(2) xk by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1204
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1205
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1206
lemma tagged_partial_division_subset:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1207
  assumes "s tagged_partial_division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1208
    and "t \<subseteq> s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1209
  shows "t tagged_partial_division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1210
  using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1211
  unfolding tagged_partial_division_of_def
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1212
  using finite_subset[OF assms(2)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1213
  by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1214
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1215
lemma tag_in_interval: "p tagged_division_of i \<Longrightarrow> (x, k) \<in> p \<Longrightarrow> x \<in> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1216
  by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1217
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1218
lemma tagged_division_of_empty: "{} tagged_division_of {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1219
  unfolding tagged_division_of by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1220
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1221
lemma tagged_partial_division_of_trivial[simp]: "p tagged_partial_division_of {} \<longleftrightarrow> p = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1222
  unfolding tagged_partial_division_of_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1223
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1224
lemma tagged_division_of_trivial[simp]: "p tagged_division_of {} \<longleftrightarrow> p = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1225
  unfolding tagged_division_of by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1226
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1227
lemma tagged_division_of_self: "x \<in> cbox a b \<Longrightarrow> {(x,cbox a b)} tagged_division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1228
  by (rule tagged_division_ofI) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1229
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1230
lemma tagged_division_of_self_real: "x \<in> {a .. b::real} \<Longrightarrow> {(x,{a .. b})} tagged_division_of {a .. b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1231
  unfolding box_real[symmetric]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1232
  by (rule tagged_division_of_self)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1233
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1234
lemma tagged_division_union:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1235
  assumes "p1 tagged_division_of s1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1236
    and "p2 tagged_division_of s2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1237
    and "interior s1 \<inter> interior s2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1238
  shows "(p1 \<union> p2) tagged_division_of (s1 \<union> s2)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1239
proof (rule tagged_division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1240
  note p1 = tagged_division_ofD[OF assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1241
  note p2 = tagged_division_ofD[OF assms(2)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1242
  show "finite (p1 \<union> p2)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1243
    using p1(1) p2(1) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1244
  show "\<Union>{k. \<exists>x. (x, k) \<in> p1 \<union> p2} = s1 \<union> s2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1245
    using p1(6) p2(6) by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1246
  fix x k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1247
  assume xk: "(x, k) \<in> p1 \<union> p2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1248
  show "x \<in> k" "\<exists>a b. k = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1249
    using xk p1(2,4) p2(2,4) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1250
  show "k \<subseteq> s1 \<union> s2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1251
    using xk p1(3) p2(3) by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1252
  fix x' k'
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1253
  assume xk': "(x', k') \<in> p1 \<union> p2" "(x, k) \<noteq> (x', k')"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1254
  have *: "\<And>a b. a \<subseteq> s1 \<Longrightarrow> b \<subseteq> s2 \<Longrightarrow> interior a \<inter> interior b = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1255
    using assms(3) interior_mono by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1256
  show "interior k \<inter> interior k' = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1257
    apply (cases "(x, k) \<in> p1")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1258
    apply (meson "*" UnE assms(1) assms(2) p1(5) tagged_division_ofD(3) xk'(1) xk'(2))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1259
    by (metis "*" UnE assms(1) assms(2) inf_sup_aci(1) p2(5) tagged_division_ofD(3) xk xk'(1) xk'(2))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1260
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1261
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1262
lemma tagged_division_unions:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1263
  assumes "finite iset"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1264
    and "\<forall>i\<in>iset. pfn i tagged_division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1265
    and "\<forall>i1\<in>iset. \<forall>i2\<in>iset. i1 \<noteq> i2 \<longrightarrow> interior(i1) \<inter> interior(i2) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1266
  shows "\<Union>(pfn ` iset) tagged_division_of (\<Union>iset)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1267
proof (rule tagged_division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1268
  note assm = tagged_division_ofD[OF assms(2)[rule_format]]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1269
  show "finite (\<Union>(pfn ` iset))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1270
    using assms by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1271
  have "\<Union>{k. \<exists>x. (x, k) \<in> \<Union>(pfn ` iset)} = \<Union>((\<lambda>i. \<Union>{k. \<exists>x. (x, k) \<in> pfn i}) ` iset)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1272
    by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1273
  also have "\<dots> = \<Union>iset"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1274
    using assm(6) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1275
  finally show "\<Union>{k. \<exists>x. (x, k) \<in> \<Union>(pfn ` iset)} = \<Union>iset" .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1276
  fix x k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1277
  assume xk: "(x, k) \<in> \<Union>(pfn ` iset)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1278
  then obtain i where i: "i \<in> iset" "(x, k) \<in> pfn i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1279
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1280
  show "x \<in> k" "\<exists>a b. k = cbox a b" "k \<subseteq> \<Union>iset"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1281
    using assm(2-4)[OF i] using i(1) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1282
  fix x' k'
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1283
  assume xk': "(x', k') \<in> \<Union>(pfn ` iset)" "(x, k) \<noteq> (x', k')"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1284
  then obtain i' where i': "i' \<in> iset" "(x', k') \<in> pfn i'"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1285
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1286
  have *: "\<And>a b. i \<noteq> i' \<Longrightarrow> a \<subseteq> i \<Longrightarrow> b \<subseteq> i' \<Longrightarrow> interior a \<inter> interior b = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1287
    using i(1) i'(1)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1288
    using assms(3)[rule_format] interior_mono
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1289
    by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1290
  show "interior k \<inter> interior k' = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1291
    apply (cases "i = i'")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1292
    using assm(5) i' i(2) xk'(2) apply blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1293
    using "*" assm(3) i' i by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1294
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1295
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1296
lemma tagged_partial_division_of_union_self:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1297
  assumes "p tagged_partial_division_of s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1298
  shows "p tagged_division_of (\<Union>(snd ` p))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1299
  apply (rule tagged_division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1300
  using tagged_partial_division_ofD[OF assms]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1301
  apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1302
  done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1303
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1304
lemma tagged_division_of_union_self:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1305
  assumes "p tagged_division_of s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1306
  shows "p tagged_division_of (\<Union>(snd ` p))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1307
  apply (rule tagged_division_ofI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1308
  using tagged_division_ofD[OF assms]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1309
  apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1310
  done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1311
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1312
subsection \<open>Functions closed on boxes: morphisms from boxes to monoids\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1313
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1314
text \<open>This auxiliary structure is used to sum up over the elements of a division. Main theorem is
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64910
diff changeset
  1315
  \<open>operative_division\<close>. Instances for the monoid are @{typ "'a option"}, @{typ real}, and
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1316
  @{typ bool}.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1317
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1318
paragraph \<open>Using additivity of lifted function to encode definedness.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1319
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1320
definition lift_option :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'a option \<Rightarrow> 'b option \<Rightarrow> 'c option"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1321
where
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1322
  "lift_option f a' b' = Option.bind a' (\<lambda>a. Option.bind b' (\<lambda>b. Some (f a b)))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1323
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1324
lemma lift_option_simps[simp]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1325
  "lift_option f (Some a) (Some b) = Some (f a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1326
  "lift_option f None b' = None"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1327
  "lift_option f a' None = None"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1328
  by (auto simp: lift_option_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1329
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1330
lemma comm_monoid_lift_option:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1331
  assumes "comm_monoid f z"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1332
  shows "comm_monoid (lift_option f) (Some z)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1333
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1334
  from assms interpret comm_monoid f z .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1335
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1336
    by standard (auto simp: lift_option_def ac_simps split: bind_split)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1337
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1338
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1339
lemma comm_monoid_and: "comm_monoid HOL.conj True"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1340
  by standard auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1341
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1342
lemma comm_monoid_set_and: "comm_monoid_set HOL.conj True"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1343
  by (rule comm_monoid_set.intro) (fact comm_monoid_and)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1344
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1345
paragraph \<open>Operative\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1346
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1347
definition (in comm_monoid) operative :: "('b::euclidean_space set \<Rightarrow> 'a) \<Rightarrow> bool"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1348
  where "operative g \<longleftrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1349
    (\<forall>a b. box a b = {} \<longrightarrow> g (cbox a b) = \<^bold>1) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1350
    (\<forall>a b c. \<forall>k\<in>Basis. g (cbox a b) = g (cbox a b \<inter> {x. x\<bullet>k \<le> c}) \<^bold>* g (cbox a b \<inter> {x. x\<bullet>k \<ge> c}))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1351
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1352
lemma (in comm_monoid) operativeD[dest]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1353
  assumes "operative g"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1354
  shows "\<And>a b. box a b = {} \<Longrightarrow> g (cbox a b) = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1355
    and "\<And>a b c k. k \<in> Basis \<Longrightarrow> g (cbox a b) = g (cbox a b \<inter> {x. x\<bullet>k \<le> c}) \<^bold>* g (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1356
  using assms unfolding operative_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1357
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1358
lemma (in comm_monoid) operative_empty:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1359
  assumes g: "operative g" shows "g {} = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1360
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1361
  have *: "cbox One (-One) = ({}::'b set)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1362
    by (auto simp: box_eq_empty inner_sum_left inner_Basis sum.If_cases ex_in_conv)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1363
  moreover have "box One (-One) = ({}::'b set)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1364
    using box_subset_cbox[of One "-One"] by (auto simp: *)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1365
  ultimately show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1366
    using operativeD(1)[OF g, of One "-One"] by simp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1367
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1368
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1369
definition "division_points (k::('a::euclidean_space) set) d =
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1370
   {(j,x). j \<in> Basis \<and> (interval_lowerbound k)\<bullet>j < x \<and> x < (interval_upperbound k)\<bullet>j \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1371
     (\<exists>i\<in>d. (interval_lowerbound i)\<bullet>j = x \<or> (interval_upperbound i)\<bullet>j = x)}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1372
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1373
lemma division_points_finite:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1374
  fixes i :: "'a::euclidean_space set"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1375
  assumes "d division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1376
  shows "finite (division_points i d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1377
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1378
  note assm = division_ofD[OF assms]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1379
  let ?M = "\<lambda>j. {(j,x)|x. (interval_lowerbound i)\<bullet>j < x \<and> x < (interval_upperbound i)\<bullet>j \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1380
    (\<exists>i\<in>d. (interval_lowerbound i)\<bullet>j = x \<or> (interval_upperbound i)\<bullet>j = x)}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1381
  have *: "division_points i d = \<Union>(?M ` Basis)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1382
    unfolding division_points_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1383
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1384
    unfolding * using assm by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1385
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1386
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1387
lemma division_points_subset:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1388
  fixes a :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1389
  assumes "d division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1390
    and "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i"  "a\<bullet>k < c" "c < b\<bullet>k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1391
    and k: "k \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1392
  shows "division_points (cbox a b \<inter> {x. x\<bullet>k \<le> c}) {l \<inter> {x. x\<bullet>k \<le> c} | l . l \<in> d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}} \<subseteq>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1393
      division_points (cbox a b) d" (is ?t1)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1394
    and "division_points (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) {l \<inter> {x. x\<bullet>k \<ge> c} | l . l \<in> d \<and> ~(l \<inter> {x. x\<bullet>k \<ge> c} = {})} \<subseteq>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1395
      division_points (cbox a b) d" (is ?t2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1396
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1397
  note assm = division_ofD[OF assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1398
  have *: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1399
    "\<forall>i\<in>Basis. a\<bullet>i \<le> (\<Sum>i\<in>Basis. (if i = k then min (b \<bullet> k) c else  b \<bullet> i) *\<^sub>R i) \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1400
    "\<forall>i\<in>Basis. (\<Sum>i\<in>Basis. (if i = k then max (a \<bullet> k) c else a \<bullet> i) *\<^sub>R i) \<bullet> i \<le> b\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1401
    "min (b \<bullet> k) c = c" "max (a \<bullet> k) c = c"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1402
    using assms using less_imp_le by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1403
  show ?t1 (*FIXME a horrible mess*)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1404
    unfolding division_points_def interval_split[OF k, of a b]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1405
    unfolding interval_bounds[OF *(1)] interval_bounds[OF *(2)] interval_bounds[OF *(3)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1406
    unfolding *
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1407
    apply (rule subsetI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1408
    unfolding mem_Collect_eq split_beta
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1409
    apply (erule bexE conjE)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1410
    apply (simp add: )
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1411
    apply (erule exE conjE)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1412
  proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1413
    fix i l x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1414
    assume as:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1415
      "a \<bullet> fst x < snd x" "snd x < (if fst x = k then c else b \<bullet> fst x)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1416
      "interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1417
      "i = l \<inter> {x. x \<bullet> k \<le> c}" "l \<in> d" "l \<inter> {x. x \<bullet> k \<le> c} \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1418
      and fstx: "fst x \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1419
    from assm(4)[OF this(5)] guess u v apply-by(erule exE)+ note l=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1420
    have *: "\<forall>i\<in>Basis. u \<bullet> i \<le> (\<Sum>i\<in>Basis. (if i = k then min (v \<bullet> k) c else v \<bullet> i) *\<^sub>R i) \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1421
      using as(6) unfolding l interval_split[OF k] box_ne_empty as .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1422
    have **: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1423
      using l using as(6) unfolding box_ne_empty[symmetric] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1424
    show "\<exists>i\<in>d. interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1425
      apply (rule bexI[OF _ \<open>l \<in> d\<close>])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1426
      using as(1-3,5) fstx
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1427
      unfolding l interval_bounds[OF **] interval_bounds[OF *] interval_split[OF k] as
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1428
      apply (auto split: if_split_asm)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1429
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1430
    show "snd x < b \<bullet> fst x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1431
      using as(2) \<open>c < b\<bullet>k\<close> by (auto split: if_split_asm)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1432
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1433
  show ?t2
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1434
    unfolding division_points_def interval_split[OF k, of a b]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1435
    unfolding interval_bounds[OF *(1)] interval_bounds[OF *(2)] interval_bounds[OF *(3)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1436
    unfolding *
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1437
    unfolding subset_eq
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1438
    apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1439
    unfolding mem_Collect_eq split_beta
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1440
    apply (erule bexE conjE)+
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1441
    apply (simp only: mem_Collect_eq inner_sum_left_Basis simp_thms)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1442
    apply (erule exE conjE)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1443
  proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1444
    fix i l x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1445
    assume as:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1446
      "(if fst x = k then c else a \<bullet> fst x) < snd x" "snd x < b \<bullet> fst x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1447
      "interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1448
      "i = l \<inter> {x. c \<le> x \<bullet> k}" "l \<in> d" "l \<inter> {x. c \<le> x \<bullet> k} \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1449
      and fstx: "fst x \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1450
    from assm(4)[OF this(5)] guess u v by (elim exE) note l=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1451
    have *: "\<forall>i\<in>Basis. (\<Sum>i\<in>Basis. (if i = k then max (u \<bullet> k) c else u \<bullet> i) *\<^sub>R i) \<bullet> i \<le> v \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1452
      using as(6) unfolding l interval_split[OF k] box_ne_empty as .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1453
    have **: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1454
      using l using as(6) unfolding box_ne_empty[symmetric] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1455
    show "\<exists>i\<in>d. interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1456
      apply (rule bexI[OF _ \<open>l \<in> d\<close>])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1457
      using as(1-3,5) fstx
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1458
      unfolding l interval_bounds[OF **] interval_bounds[OF *] interval_split[OF k] as
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1459
      apply (auto split: if_split_asm)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1460
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1461
    show "a \<bullet> fst x < snd x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1462
      using as(1) \<open>a\<bullet>k < c\<close> by (auto split: if_split_asm)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1463
   qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1464
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1465
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1466
lemma division_points_psubset:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1467
  fixes a :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1468
  assumes "d division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1469
      and "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i"  "a\<bullet>k < c" "c < b\<bullet>k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1470
      and "l \<in> d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1471
      and "interval_lowerbound l\<bullet>k = c \<or> interval_upperbound l\<bullet>k = c"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1472
      and k: "k \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1473
  shows "division_points (cbox a b \<inter> {x. x\<bullet>k \<le> c}) {l \<inter> {x. x\<bullet>k \<le> c} | l. l\<in>d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}} \<subset>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1474
         division_points (cbox a b) d" (is "?D1 \<subset> ?D")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1475
    and "division_points (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) {l \<inter> {x. x\<bullet>k \<ge> c} | l. l\<in>d \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}} \<subset>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1476
         division_points (cbox a b) d" (is "?D2 \<subset> ?D")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1477
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1478
  have ab: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1479
    using assms(2) by (auto intro!:less_imp_le)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1480
  guess u v using division_ofD(4)[OF assms(1,5)] by (elim exE) note l=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1481
  have uv: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i" "\<forall>i\<in>Basis. a\<bullet>i \<le> u\<bullet>i \<and> v\<bullet>i \<le> b\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1482
    using division_ofD(2,2,3)[OF assms(1,5)] unfolding l box_ne_empty
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1483
    using subset_box(1)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1484
    apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1485
    apply blast+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1486
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1487
  have *: "interval_upperbound (cbox a b \<inter> {x. x \<bullet> k \<le> interval_upperbound l \<bullet> k}) \<bullet> k = interval_upperbound l \<bullet> k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1488
          "interval_upperbound (cbox a b \<inter> {x. x \<bullet> k \<le> interval_lowerbound l \<bullet> k}) \<bullet> k = interval_lowerbound l \<bullet> k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1489
    unfolding l interval_split[OF k] interval_bounds[OF uv(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1490
    using uv[rule_format, of k] ab k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1491
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1492
  have "\<exists>x. x \<in> ?D - ?D1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1493
    using assms(3-)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1494
    unfolding division_points_def interval_bounds[OF ab]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1495
    apply -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1496
    apply (erule disjE)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1497
    apply (rule_tac x="(k,(interval_lowerbound l)\<bullet>k)" in exI, force simp add: *)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1498
    apply (rule_tac x="(k,(interval_upperbound l)\<bullet>k)" in exI, force simp add: *)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1499
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1500
  moreover have "?D1 \<subseteq> ?D"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1501
    by (auto simp add: assms division_points_subset)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1502
  ultimately show "?D1 \<subset> ?D"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1503
    by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1504
  have *: "interval_lowerbound (cbox a b \<inter> {x. x \<bullet> k \<ge> interval_lowerbound l \<bullet> k}) \<bullet> k = interval_lowerbound l \<bullet> k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1505
    "interval_lowerbound (cbox a b \<inter> {x. x \<bullet> k \<ge> interval_upperbound l \<bullet> k}) \<bullet> k = interval_upperbound l \<bullet> k"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1506
    unfolding l interval_split[OF k] interval_bounds[OF uv(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1507
    using uv[rule_format, of k] ab k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1508
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1509
  have "\<exists>x. x \<in> ?D - ?D2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1510
    using assms(3-)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1511
    unfolding division_points_def interval_bounds[OF ab]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1512
    apply -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1513
    apply (erule disjE)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1514
    apply (rule_tac x="(k,(interval_lowerbound l)\<bullet>k)" in exI, force simp add: *)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1515
    apply (rule_tac x="(k,(interval_upperbound l)\<bullet>k)" in exI, force simp add: *)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1516
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1517
  moreover have "?D2 \<subseteq> ?D"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1518
    by (auto simp add: assms division_points_subset)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1519
  ultimately show "?D2 \<subset> ?D"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1520
    by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1521
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1522
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1523
lemma division_split_left_inj:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1524
  fixes type :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1525
  assumes "d division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1526
    and "k1 \<in> d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1527
    and "k2 \<in> d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1528
    and "k1 \<noteq> k2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1529
    and "k1 \<inter> {x::'a. x\<bullet>k \<le> c} = k2 \<inter> {x. x\<bullet>k \<le> c}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1530
    and k: "k\<in>Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1531
  shows "interior (k1 \<inter> {x. x\<bullet>k \<le> c}) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1532
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1533
  note d=division_ofD[OF assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1534
  guess u1 v1 using d(4)[OF assms(2)] by (elim exE) note uv1=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1535
  guess u2 v2 using d(4)[OF assms(3)] by (elim exE) note uv2=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1536
  have **: "\<And>s t u. s \<inter> t = {} \<Longrightarrow> u \<subseteq> s \<Longrightarrow> u \<subseteq> t \<Longrightarrow> u = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1537
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1538
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1539
    unfolding uv1 uv2
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1540
    apply (rule **[OF d(5)[OF assms(2-4)]])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1541
    apply (simp add: uv1)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1542
    using assms(5) uv1 by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1543
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1544
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1545
lemma division_split_right_inj:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1546
  fixes type :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1547
  assumes "d division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1548
    and "k1 \<in> d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1549
    and "k2 \<in> d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1550
    and "k1 \<noteq> k2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1551
    and "k1 \<inter> {x::'a. x\<bullet>k \<ge> c} = k2 \<inter> {x. x\<bullet>k \<ge> c}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1552
    and k: "k \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1553
  shows "interior (k1 \<inter> {x. x\<bullet>k \<ge> c}) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1554
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1555
  note d=division_ofD[OF assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1556
  guess u1 v1 using d(4)[OF assms(2)] by (elim exE) note uv1=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1557
  guess u2 v2 using d(4)[OF assms(3)] by (elim exE) note uv2=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1558
  have **: "\<And>s t u. s \<inter> t = {} \<Longrightarrow> u \<subseteq> s \<Longrightarrow> u \<subseteq> t \<Longrightarrow> u = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1559
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1560
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1561
    unfolding uv1 uv2
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1562
    apply (rule **[OF d(5)[OF assms(2-4)]])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1563
    apply (simp add: uv1)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1564
    using assms(5) uv1 by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1565
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1566
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1567
lemma interval_doublesplit:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1568
  fixes a :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1569
  assumes "k \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1570
  shows "cbox a b \<inter> {x . \<bar>x\<bullet>k - c\<bar> \<le> (e::real)} =
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1571
    cbox (\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) (c - e) else a\<bullet>i) *\<^sub>R i)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1572
     (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) (c + e) else b\<bullet>i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1573
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1574
  have *: "\<And>x c e::real. \<bar>x - c\<bar> \<le> e \<longleftrightarrow> x \<ge> c - e \<and> x \<le> c + e"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1575
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1576
  have **: "\<And>s P Q. s \<inter> {x. P x \<and> Q x} = (s \<inter> {x. Q x}) \<inter> {x. P x}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1577
    by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1578
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1579
    unfolding * ** interval_split[OF assms] by (rule refl)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1580
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1581
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1582
lemma division_doublesplit:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1583
  fixes a :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1584
  assumes "p division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1585
    and k: "k \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1586
  shows "(\<lambda>l. l \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> e}) ` {l\<in>p. l \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> e} \<noteq> {}}
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1587
         division_of  (cbox a b \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> e})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1588
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1589
  have *: "\<And>x c. \<bar>x - c\<bar> \<le> e \<longleftrightarrow> x \<ge> c - e \<and> x \<le> c + e"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1590
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1591
  have **: "\<And>p q p' q'. p division_of q \<Longrightarrow> p = p' \<Longrightarrow> q = q' \<Longrightarrow> p' division_of q'"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1592
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1593
  note division_split(1)[OF assms, where c="c+e",unfolded interval_split[OF k]]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1594
  note division_split(2)[OF this, where c="c-e" and k=k,OF k]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1595
  then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1596
    apply (rule **)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1597
    subgoal
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1598
      apply (simp add: abs_diff_le_iff field_simps Collect_conj_eq setcompr_eq_image[symmetric])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1599
      apply (rule equalityI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1600
      apply blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1601
      apply clarsimp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1602
      apply (rule_tac x="l \<inter> {x. c + e \<ge> x \<bullet> k}" in exI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1603
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1604
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1605
    by (simp add: interval_split k interval_doublesplit)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1606
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1607
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1608
lemma (in comm_monoid_set) operative_division:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1609
  fixes g :: "'b::euclidean_space set \<Rightarrow> 'a"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1610
  assumes g: "operative g" and d: "d division_of (cbox a b)" shows "F g d = g (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1611
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1612
  define C where [abs_def]: "C = card (division_points (cbox a b) d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1613
  then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1614
    using d
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1615
  proof (induction C arbitrary: a b d rule: less_induct)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1616
    case (less a b d)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1617
    show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1618
    proof cases
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1619
      assume "box a b = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1620
      { fix k assume "k\<in>d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1621
        then obtain a' b' where k: "k = cbox a' b'"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1622
          using division_ofD(4)[OF less.prems] by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1623
        with \<open>k\<in>d\<close> division_ofD(2)[OF less.prems] have "cbox a' b' \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1624
          by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1625
        then have "box a' b' \<subseteq> box a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1626
          unfolding subset_box by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1627
        then have "g k = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1628
          using operativeD(1)[OF g, of a' b'] k by (simp add: \<open>box a b = {}\<close>) }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1629
      then show "box a b = {} \<Longrightarrow> F g d = g (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1630
        by (auto intro!: neutral simp: operativeD(1)[OF g])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1631
    next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1632
      assume "box a b \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1633
      then have ab: "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i" and ab': "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1634
        by (auto simp: box_ne_empty)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1635
      show "F g d = g (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1636
      proof (cases "division_points (cbox a b) d = {}")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1637
        case True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1638
        { fix u v and j :: 'b
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1639
          assume j: "j \<in> Basis" and as: "cbox u v \<in> d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1640
          then have "cbox u v \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1641
            using less.prems by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1642
          then have uv: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i" "u\<bullet>j \<le> v\<bullet>j"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1643
            using j unfolding box_ne_empty by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1644
          have *: "\<And>p r Q. \<not> j\<in>Basis \<or> p \<or> r \<or> (\<forall>x\<in>d. Q x) \<Longrightarrow> p \<or> r \<or> Q (cbox u v)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1645
            using as j by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1646
          have "(j, u\<bullet>j) \<notin> division_points (cbox a b) d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1647
               "(j, v\<bullet>j) \<notin> division_points (cbox a b) d" using True by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1648
          note this[unfolded de_Morgan_conj division_points_def mem_Collect_eq split_conv interval_bounds[OF ab'] bex_simps]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1649
          note *[OF this(1)] *[OF this(2)] note this[unfolded interval_bounds[OF uv(1)]]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1650
          moreover
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1651
          have "a\<bullet>j \<le> u\<bullet>j" "v\<bullet>j \<le> b\<bullet>j"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1652
            using division_ofD(2,2,3)[OF \<open>d division_of cbox a b\<close> as]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1653
            apply (metis j subset_box(1) uv(1))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1654
            by (metis \<open>cbox u v \<subseteq> cbox a b\<close> j subset_box(1) uv(1))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1655
          ultimately have "u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = a\<bullet>j \<or> u\<bullet>j = b\<bullet>j \<and> v\<bullet>j = b\<bullet>j \<or> u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = b\<bullet>j"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1656
            unfolding not_less de_Morgan_disj using ab[rule_format,of j] uv(2) j by force }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1657
        then have d': "\<forall>i\<in>d. \<exists>u v. i = cbox u v \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1658
          (\<forall>j\<in>Basis. u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = a\<bullet>j \<or> u\<bullet>j = b\<bullet>j \<and> v\<bullet>j = b\<bullet>j \<or> u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = b\<bullet>j)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1659
          unfolding forall_in_division[OF less.prems] by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1660
        have "(1/2) *\<^sub>R (a+b) \<in> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1661
          unfolding mem_box using ab by (auto simp: inner_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1662
        note this[unfolded division_ofD(6)[OF \<open>d division_of cbox a b\<close>,symmetric] Union_iff]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1663
        then guess i .. note i=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1664
        guess u v using d'[rule_format,OF i(1)] by (elim exE conjE) note uv=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1665
        have "cbox a b \<in> d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1666
        proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1667
          have "u = a" "v = b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1668
            unfolding euclidean_eq_iff[where 'a='b]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1669
          proof safe
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1670
            fix j :: 'b
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1671
            assume j: "j \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1672
            note i(2)[unfolded uv mem_box,rule_format,of j]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1673
            then show "u \<bullet> j = a \<bullet> j" and "v \<bullet> j = b \<bullet> j"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1674
              using uv(2)[rule_format,of j] j by (auto simp: inner_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1675
          qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1676
          then have "i = cbox a b" using uv by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1677
          then show ?thesis using i by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1678
        qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1679
        then have deq: "d = insert (cbox a b) (d - {cbox a b})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1680
          by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1681
        have "F g (d - {cbox a b}) = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1682
        proof (intro neutral ballI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1683
          fix x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1684
          assume x: "x \<in> d - {cbox a b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1685
          then have "x\<in>d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1686
            by auto note d'[rule_format,OF this]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1687
          then guess u v by (elim exE conjE) note uv=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1688
          have "u \<noteq> a \<or> v \<noteq> b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1689
            using x[unfolded uv] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1690
          then obtain j where "u\<bullet>j \<noteq> a\<bullet>j \<or> v\<bullet>j \<noteq> b\<bullet>j" and j: "j \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1691
            unfolding euclidean_eq_iff[where 'a='b] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1692
          then have "u\<bullet>j = v\<bullet>j"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1693
            using uv(2)[rule_format,OF j] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1694
          then have "box u v = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1695
            using j unfolding box_eq_empty by (auto intro!: bexI[of _ j])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1696
          then show "g x = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1697
            unfolding uv(1) by (rule operativeD(1)[OF g])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1698
        qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1699
        then show "F g d = g (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1700
          using division_ofD[OF less.prems]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1701
          apply (subst deq)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1702
          apply (subst insert)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1703
          apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1704
          done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1705
      next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1706
        case False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1707
        then have "\<exists>x. x \<in> division_points (cbox a b) d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1708
          by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1709
        then guess k c
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1710
          unfolding split_paired_Ex division_points_def mem_Collect_eq split_conv
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1711
          apply (elim exE conjE)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1712
          done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1713
        note this(2-4,1) note kc=this[unfolded interval_bounds[OF ab']]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1714
        from this(3) guess j .. note j=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1715
        define d1 where "d1 = {l \<inter> {x. x\<bullet>k \<le> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1716
        define d2 where "d2 = {l \<inter> {x. x\<bullet>k \<ge> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1717
        define cb where "cb = (\<Sum>i\<in>Basis. (if i = k then c else b\<bullet>i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1718
        define ca where "ca = (\<Sum>i\<in>Basis. (if i = k then c else a\<bullet>i) *\<^sub>R i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1719
        note division_points_psubset[OF \<open>d division_of cbox a b\<close> ab kc(1-2) j]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1720
        note psubset_card_mono[OF _ this(1)] psubset_card_mono[OF _ this(2)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1721
        then have *: "F g d1 = g (cbox a b \<inter> {x. x\<bullet>k \<le> c})" "F g d2 = g (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1722
          unfolding interval_split[OF kc(4)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1723
          apply (rule_tac[!] "less.hyps"[rule_format])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1724
          using division_split[OF \<open>d division_of cbox a b\<close>, where k=k and c=c]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1725
          apply (simp_all add: interval_split kc d1_def d2_def division_points_finite[OF \<open>d division_of cbox a b\<close>])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1726
          done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1727
        { fix l y
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1728
          assume as: "l \<in> d" "y \<in> d" "l \<inter> {x. x \<bullet> k \<le> c} = y \<inter> {x. x \<bullet> k \<le> c}" "l \<noteq> y"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1729
          from division_ofD(4)[OF \<open>d division_of cbox a b\<close> this(1)] guess u v by (elim exE) note leq=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1730
          have "g (l \<inter> {x. x \<bullet> k \<le> c}) = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1731
            unfolding leq interval_split[OF kc(4)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1732
            apply (rule operativeD[OF g])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1733
            unfolding interior_cbox[symmetric] interval_split[symmetric, OF kc(4)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1734
            using division_split_left_inj less as kc leq by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1735
        } note fxk_le = this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1736
        { fix l y
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1737
          assume as: "l \<in> d" "y \<in> d" "l \<inter> {x. c \<le> x \<bullet> k} = y \<inter> {x. c \<le> x \<bullet> k}" "l \<noteq> y"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1738
          from division_ofD(4)[OF \<open>d division_of cbox a b\<close> this(1)] guess u v by (elim exE) note leq=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1739
          have "g (l \<inter> {x. x \<bullet> k \<ge> c}) = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1740
            unfolding leq interval_split[OF kc(4)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1741
            apply (rule operativeD(1)[OF g])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1742
            unfolding interior_cbox[symmetric] interval_split[symmetric,OF kc(4)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1743
            using division_split_right_inj less leq as kc by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1744
        } note fxk_ge = this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1745
        have d1_alt: "d1 = (\<lambda>l. l \<inter> {x. x\<bullet>k \<le> c}) ` {l \<in> d. l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1746
          using d1_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1747
        have d2_alt: "d2 = (\<lambda>l. l \<inter> {x. x\<bullet>k \<ge> c}) ` {l \<in> d. l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1748
          using d2_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1749
        have "g (cbox a b) = F g d1 \<^bold>* F g d2" (is "_ = ?prev")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1750
          unfolding * using g kc(4) by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1751
        also have "F g d1 = F (\<lambda>l. g (l \<inter> {x. x\<bullet>k \<le> c})) d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1752
          unfolding d1_alt using division_of_finite[OF less.prems] fxk_le
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1753
          by (subst reindex_nontrivial) (auto intro!: mono_neutral_cong_left simp: operative_empty[OF g])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1754
        also have "F g d2 = F (\<lambda>l. g (l \<inter> {x. x\<bullet>k \<ge> c})) d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1755
          unfolding d2_alt using division_of_finite[OF less.prems] fxk_ge
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1756
          by (subst reindex_nontrivial) (auto intro!: mono_neutral_cong_left simp: operative_empty[OF g])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1757
        also have *: "\<forall>x\<in>d. g x = g (x \<inter> {x. x \<bullet> k \<le> c}) \<^bold>* g (x \<inter> {x. c \<le> x \<bullet> k})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1758
          unfolding forall_in_division[OF \<open>d division_of cbox a b\<close>]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1759
          using g kc(4) by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1760
        have "F (\<lambda>l. g (l \<inter> {x. x\<bullet>k \<le> c})) d \<^bold>* F (\<lambda>l. g (l \<inter> {x. x\<bullet>k \<ge> c})) d = F g d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1761
          using * by (simp add: distrib)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1762
        finally show ?thesis by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1763
      qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1764
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1765
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1766
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1767
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1768
lemma (in comm_monoid_set) over_tagged_division_lemma:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1769
  assumes "p tagged_division_of i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1770
    and "\<And>u v. cbox u v \<noteq> {} \<Longrightarrow> box u v = {} \<Longrightarrow> d (cbox u v) = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1771
  shows "F (\<lambda>(x,k). d k) p = F d (snd ` p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1772
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1773
  have *: "(\<lambda>(x,k). d k) = d \<circ> snd"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1774
    unfolding o_def by (rule ext) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1775
  note assm = tagged_division_ofD[OF assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1776
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1777
    unfolding *
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1778
  proof (rule reindex_nontrivial[symmetric])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1779
    show "finite p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1780
      using assm by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1781
    fix x y
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1782
    assume "x\<in>p" "y\<in>p" "x\<noteq>y" "snd x = snd y"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1783
    obtain a b where ab: "snd x = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1784
      using assm(4)[of "fst x" "snd x"] \<open>x\<in>p\<close> by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1785
    have "(fst x, snd y) \<in> p" "(fst x, snd y) \<noteq> y"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1786
      by (metis prod.collapse \<open>x\<in>p\<close> \<open>snd x = snd y\<close> \<open>x \<noteq> y\<close>)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1787
    with \<open>x\<in>p\<close> \<open>y\<in>p\<close> have "interior (snd x) \<inter> interior (snd y) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1788
      by (intro assm(5)[of "fst x" _ "fst y"]) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1789
    then have "box a b = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1790
      unfolding \<open>snd x = snd y\<close>[symmetric] ab by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1791
    then have "d (cbox a b) = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1792
      using assm(2)[of "fst x" "snd x"] \<open>x\<in>p\<close> ab[symmetric] by (intro assms(2)) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1793
    then show "d (snd x) = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1794
      unfolding ab by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1795
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1796
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1797
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1798
lemma (in comm_monoid_set) operative_tagged_division:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1799
  assumes f: "operative g" and d: "d tagged_division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1800
  shows "F (\<lambda>(x, l). g l) d = g (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1801
  unfolding d[THEN division_of_tagged_division, THEN operative_division[OF f], symmetric]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1802
  by (simp add: f[THEN operativeD(1)] over_tagged_division_lemma[OF d])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1803
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1804
lemma interval_real_split:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1805
  "{a .. b::real} \<inter> {x. x \<le> c} = {a .. min b c}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1806
  "{a .. b} \<inter> {x. c \<le> x} = {max a c .. b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1807
  apply (metis Int_atLeastAtMostL1 atMost_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1808
  apply (metis Int_atLeastAtMostL2 atLeast_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1809
  done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1810
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1811
lemma (in comm_monoid) operative_1_lt:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1812
  "operative (g :: real set \<Rightarrow> 'a) \<longleftrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1813
    ((\<forall>a b. b \<le> a \<longrightarrow> g {a .. b} = \<^bold>1) \<and> (\<forall>a b c. a < c \<and> c < b \<longrightarrow> g {a .. c} \<^bold>* g {c .. b} = g {a .. b}))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1814
  apply (simp add: operative_def atMost_def[symmetric] atLeast_def[symmetric])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1815
proof safe
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1816
  fix a b c :: real
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1817
  assume *: "\<forall>a b c. g {a..b} = g {a..min b c} \<^bold>* g {max a c..b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1818
  assume "a < c" "c < b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1819
  with *[rule_format, of a b c] show "g {a..c} \<^bold>* g {c..b} = g {a..b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1820
    by (simp add: less_imp_le min.absorb2 max.absorb2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1821
next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1822
  fix a b c :: real
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1823
  assume as: "\<forall>a b. b \<le> a \<longrightarrow> g {a..b} = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1824
    "\<forall>a b c. a < c \<and> c < b \<longrightarrow> g {a..c} \<^bold>* g {c..b} = g {a..b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1825
  from as(1)[rule_format, of 0 1] as(1)[rule_format, of a a for a] as(2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1826
  have [simp]: "g {} = \<^bold>1" "\<And>a. g {a} = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1827
    "\<And>a b c. a < c \<Longrightarrow> c < b \<Longrightarrow> g {a..c} \<^bold>* g {c..b} = g {a..b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1828
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1829
  show "g {a..b} = g {a..min b c} \<^bold>* g {max a c..b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1830
    by (auto simp: min_def max_def le_less)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1831
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1832
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1833
lemma (in comm_monoid) operative_1_le:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1834
  "operative (g :: real set \<Rightarrow> 'a) \<longleftrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1835
    ((\<forall>a b. b \<le> a \<longrightarrow> g {a..b} = \<^bold>1) \<and> (\<forall>a b c. a \<le> c \<and> c \<le> b \<longrightarrow> g {a .. c} \<^bold>* g {c .. b} = g {a .. b}))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1836
  unfolding operative_1_lt
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1837
proof safe
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1838
  fix a b c :: real
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1839
  assume as: "\<forall>a b c. a \<le> c \<and> c \<le> b \<longrightarrow> g {a..c} \<^bold>* g {c..b} = g {a..b}" "a < c" "c < b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1840
  show "g {a..c} \<^bold>* g {c..b} = g {a..b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1841
    apply (rule as(1)[rule_format])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1842
    using as(2-)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1843
    apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1844
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1845
next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1846
  fix a b c :: real
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1847
  assume "\<forall>a b. b \<le> a \<longrightarrow> g {a .. b} = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1848
    and "\<forall>a b c. a < c \<and> c < b \<longrightarrow> g {a..c} \<^bold>* g {c..b} = g {a..b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1849
    and "a \<le> c"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1850
    and "c \<le> b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1851
  note as = this[rule_format]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1852
  show "g {a..c} \<^bold>* g {c..b} = g {a..b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1853
  proof (cases "c = a \<or> c = b")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1854
    case False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1855
    then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1856
      apply -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1857
      apply (subst as(2))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1858
      using as(3-)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1859
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1860
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1861
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1862
    case True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1863
    then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1864
    proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1865
      assume *: "c = a"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1866
      then have "g {a .. c} = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1867
        apply -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1868
        apply (rule as(1)[rule_format])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1869
        apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1870
        done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1871
      then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1872
        unfolding * by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1873
    next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1874
      assume *: "c = b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1875
      then have "g {c .. b} = \<^bold>1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1876
        apply -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1877
        apply (rule as(1)[rule_format])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1878
        apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1879
        done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1880
      then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1881
        unfolding * by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1882
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1883
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1884
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1885
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1886
lemma tagged_division_union_interval:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1887
  fixes a :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1888
  assumes "p1 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<le> (c::real)})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1889
    and "p2 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1890
    and k: "k \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1891
  shows "(p1 \<union> p2) tagged_division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1892
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1893
  have *: "cbox a b = (cbox a b \<inter> {x. x\<bullet>k \<le> c}) \<union> (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1894
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1895
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1896
    apply (subst *)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1897
    apply (rule tagged_division_union[OF assms(1-2)])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1898
    unfolding interval_split[OF k] interior_cbox
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1899
    using k
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1900
    apply (auto simp add: box_def elim!: ballE[where x=k])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1901
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1902
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1903
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1904
lemma tagged_division_union_interval_real:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1905
  fixes a :: real
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1906
  assumes "p1 tagged_division_of ({a .. b} \<inter> {x. x\<bullet>k \<le> (c::real)})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1907
    and "p2 tagged_division_of ({a .. b} \<inter> {x. x\<bullet>k \<ge> c})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1908
    and k: "k \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1909
  shows "(p1 \<union> p2) tagged_division_of {a .. b}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1910
  using assms
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1911
  unfolding box_real[symmetric]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1912
  by (rule tagged_division_union_interval)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1913
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1914
lemma tagged_division_split_left_inj:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1915
  "d tagged_division_of i \<Longrightarrow> (x1, k1) \<in> d \<Longrightarrow> (x2, k2) \<in> d \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1916
    k1 \<inter> {x. x\<bullet>k \<le> c} = k2 \<inter> {x. x\<bullet>k \<le> c} \<Longrightarrow> k \<in> Basis \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1917
    interior (k1 \<inter> {x. x\<bullet>k \<le> c}) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1918
  by (intro division_split_left_inj[of "snd`d" i k1 k2, OF division_of_tagged_division])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1919
     (auto simp add: snd_def[abs_def] image_iff split: prod.split )
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1920
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1921
lemma tagged_division_split_right_inj:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1922
  "d tagged_division_of i \<Longrightarrow> (x1, k1) \<in> d \<Longrightarrow> (x2, k2) \<in> d \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1923
    k1 \<inter> {x. x\<bullet>k \<ge> c} = k2 \<inter> {x. x\<bullet>k \<ge> c} \<Longrightarrow> k \<in> Basis \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1924
    interior (k1 \<inter> {x. x\<bullet>k \<ge> c}) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1925
  by (intro division_split_right_inj[of "snd`d" i k1 k2, OF division_of_tagged_division])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1926
     (auto simp add: snd_def[abs_def] image_iff split: prod.split )
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1927
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1928
subsection \<open>Special case of additivity we need for the FTC.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1929
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1930
lemma additive_tagged_division_1:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1931
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1932
  assumes "a \<le> b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1933
    and "p tagged_division_of {a..b}"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1934
  shows "sum (\<lambda>(x,k). f(Sup k) - f(Inf k)) p = f b - f a"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1935
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1936
  let ?f = "(\<lambda>k::(real) set. if k = {} then 0 else f(interval_upperbound k) - f(interval_lowerbound k))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1937
  have ***: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1938
    using assms by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1939
  have *: "add.operative ?f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1940
    unfolding add.operative_1_lt box_eq_empty
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1941
    by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1942
  have **: "cbox a b \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1943
    using assms(1) by auto
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1944
  note sum.operative_tagged_division[OF * assms(2)[simplified box_real[symmetric]]]
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1945
  note * = this[unfolded if_not_P[OF **] interval_bounds[OF ***],symmetric]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1946
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1947
    unfolding *
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1948
    apply (rule sum.cong)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1949
    unfolding split_paired_all split_conv
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1950
    using assms(2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1951
    apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1952
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1953
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1954
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1955
lemma bgauge_existence_lemma: "(\<forall>x\<in>s. \<exists>d::real. 0 < d \<and> q d x) \<longleftrightarrow> (\<forall>x. \<exists>d>0. x\<in>s \<longrightarrow> q d x)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1956
  by (meson zero_less_one)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1958
lemma additive_tagged_division_1':
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1959
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1960
  assumes "a \<le> b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1961
    and "p tagged_division_of {a..b}"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1962
  shows "sum (\<lambda>(x,k). f (Sup k) - f(Inf k)) p = f b - f a"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1963
  using additive_tagged_division_1[OF _ assms(2), of f]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1964
  using assms(1)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1965
  by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1966
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1967
subsection \<open>Fine-ness of a partition w.r.t. a gauge.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1968
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1969
definition fine  (infixr "fine" 46)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1970
  where "d fine s \<longleftrightarrow> (\<forall>(x,k) \<in> s. k \<subseteq> d x)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1971
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1972
lemma fineI:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1973
  assumes "\<And>x k. (x, k) \<in> s \<Longrightarrow> k \<subseteq> d x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1974
  shows "d fine s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1975
  using assms unfolding fine_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1976
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1977
lemma fineD[dest]:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1978
  assumes "d fine s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1979
  shows "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> d x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1980
  using assms unfolding fine_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1981
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1982
lemma fine_inter: "(\<lambda>x. d1 x \<inter> d2 x) fine p \<longleftrightarrow> d1 fine p \<and> d2 fine p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1983
  unfolding fine_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1984
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1985
lemma fine_inters:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1986
 "(\<lambda>x. \<Inter>{f d x | d.  d \<in> s}) fine p \<longleftrightarrow> (\<forall>d\<in>s. (f d) fine p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1987
  unfolding fine_def by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1988
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1989
lemma fine_union: "d fine p1 \<Longrightarrow> d fine p2 \<Longrightarrow> d fine (p1 \<union> p2)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1990
  unfolding fine_def by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1991
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1992
lemma fine_unions: "(\<And>p. p \<in> ps \<Longrightarrow> d fine p) \<Longrightarrow> d fine (\<Union>ps)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1993
  unfolding fine_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1994
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1995
lemma fine_subset: "p \<subseteq> q \<Longrightarrow> d fine q \<Longrightarrow> d fine p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1996
  unfolding fine_def by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1997
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1998
subsection \<open>Some basic combining lemmas.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  1999
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2000
lemma tagged_division_unions_exists:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2001
  assumes "finite iset"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2002
    and "\<forall>i\<in>iset. \<exists>p. p tagged_division_of i \<and> d fine p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2003
    and "\<forall>i1\<in>iset. \<forall>i2\<in>iset. i1 \<noteq> i2 \<longrightarrow> interior i1 \<inter> interior i2 = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2004
    and "\<Union>iset = i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2005
   obtains p where "p tagged_division_of i" and "d fine p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2006
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2007
  obtain pfn where pfn:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2008
    "\<And>x. x \<in> iset \<Longrightarrow> pfn x tagged_division_of x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2009
    "\<And>x. x \<in> iset \<Longrightarrow> d fine pfn x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2010
    using bchoice[OF assms(2)] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2011
  show thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2012
    apply (rule_tac p="\<Union>(pfn ` iset)" in that)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2013
    using assms(1) assms(3) assms(4) pfn(1) tagged_division_unions apply force
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2014
    by (metis (mono_tags, lifting) fine_unions imageE pfn(2))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2015
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2016
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2017
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2018
subsection \<open>The set we're concerned with must be closed.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2019
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2020
lemma division_of_closed:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2021
  fixes i :: "'n::euclidean_space set"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2022
  shows "s division_of i \<Longrightarrow> closed i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2023
  unfolding division_of_def by fastforce
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2024
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2025
subsection \<open>General bisection principle for intervals; might be useful elsewhere.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2026
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2027
lemma interval_bisection_step:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2028
  fixes type :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2029
  assumes "P {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2030
    and "\<forall>s t. P s \<and> P t \<and> interior(s) \<inter> interior(t) = {} \<longrightarrow> P (s \<union> t)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2031
    and "\<not> P (cbox a (b::'a))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2032
  obtains c d where "\<not> P (cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2033
    and "\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> c\<bullet>i \<le> d\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i \<and> 2 * (d\<bullet>i - c\<bullet>i) \<le> b\<bullet>i - a\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2034
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2035
  have "cbox a b \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2036
    using assms(1,3) by metis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2037
  then have ab: "\<And>i. i\<in>Basis \<Longrightarrow> a \<bullet> i \<le> b \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2038
    by (force simp: mem_box)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2039
  { fix f
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2040
    have "\<lbrakk>finite f;
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2041
           \<And>s. s\<in>f \<Longrightarrow> P s;
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2042
           \<And>s. s\<in>f \<Longrightarrow> \<exists>a b. s = cbox a b;
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2043
           \<And>s t. s\<in>f \<Longrightarrow> t\<in>f \<Longrightarrow> s \<noteq> t \<Longrightarrow> interior s \<inter> interior t = {}\<rbrakk> \<Longrightarrow> P (\<Union>f)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2044
    proof (induct f rule: finite_induct)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2045
      case empty
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2046
      show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2047
        using assms(1) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2048
    next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2049
      case (insert x f)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2050
      show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2051
        unfolding Union_insert
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2052
        apply (rule assms(2)[rule_format])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2053
        using inter_interior_unions_intervals [of f "interior x"]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2054
        apply (auto simp: insert)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2055
        by (metis IntI empty_iff insert.hyps(2) insert.prems(3) insert_iff)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2056
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2057
  } note UN_cases = this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2058
  let ?A = "{cbox c d | c d::'a. \<forall>i\<in>Basis. (c\<bullet>i = a\<bullet>i) \<and> (d\<bullet>i = (a\<bullet>i + b\<bullet>i) / 2) \<or>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2059
    (c\<bullet>i = (a\<bullet>i + b\<bullet>i) / 2) \<and> (d\<bullet>i = b\<bullet>i)}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2060
  let ?PP = "\<lambda>c d. \<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> c\<bullet>i \<le> d\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i \<and> 2 * (d\<bullet>i - c\<bullet>i) \<le> b\<bullet>i - a\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2061
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2062
    presume "\<forall>c d. ?PP c d \<longrightarrow> P (cbox c d) \<Longrightarrow> False"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2063
    then show thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2064
      unfolding atomize_not not_all
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2065
      by (blast intro: that)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2066
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2067
  assume as: "\<forall>c d. ?PP c d \<longrightarrow> P (cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2068
  have "P (\<Union>?A)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2069
  proof (rule UN_cases)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2070
    let ?B = "(\<lambda>s. cbox (\<Sum>i\<in>Basis. (if i \<in> s then a\<bullet>i else (a\<bullet>i + b\<bullet>i) / 2) *\<^sub>R i::'a)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2071
      (\<Sum>i\<in>Basis. (if i \<in> s then (a\<bullet>i + b\<bullet>i) / 2 else b\<bullet>i) *\<^sub>R i)) ` {s. s \<subseteq> Basis}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2072
    have "?A \<subseteq> ?B"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2073
    proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2074
      fix x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2075
      assume "x \<in> ?A"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2076
      then obtain c d
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2077
        where x:  "x = cbox c d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2078
                  "\<And>i. i \<in> Basis \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2079
                        c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2080
                        c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i" by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2081
      show "x \<in> ?B"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2082
        unfolding image_iff x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2083
        apply (rule_tac x="{i. i\<in>Basis \<and> c\<bullet>i = a\<bullet>i}" in bexI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2084
        apply (rule arg_cong2 [where f = cbox])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2085
        using x(2) ab
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2086
        apply (auto simp add: euclidean_eq_iff[where 'a='a])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2087
        by fastforce
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2088
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2089
    then show "finite ?A"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2090
      by (rule finite_subset) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2091
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2092
    fix s
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2093
    assume "s \<in> ?A"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2094
    then obtain c d
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2095
      where s: "s = cbox c d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2096
               "\<And>i. i \<in> Basis \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2097
                     c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2098
                     c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2099
      by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2100
    show "P s"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2101
      unfolding s
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2102
      apply (rule as[rule_format])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2103
      using ab s(2) by force
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2104
    show "\<exists>a b. s = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2105
      unfolding s by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2106
    fix t
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2107
    assume "t \<in> ?A"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2108
    then obtain e f where t:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2109
      "t = cbox e f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2110
      "\<And>i. i \<in> Basis \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2111
        e \<bullet> i = a \<bullet> i \<and> f \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2112
        e \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> f \<bullet> i = b \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2113
      by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2114
    assume "s \<noteq> t"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2115
    then have "\<not> (c = e \<and> d = f)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2116
      unfolding s t by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2117
    then obtain i where "c\<bullet>i \<noteq> e\<bullet>i \<or> d\<bullet>i \<noteq> f\<bullet>i" and i': "i \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2118
      unfolding euclidean_eq_iff[where 'a='a] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2119
    then have i: "c\<bullet>i \<noteq> e\<bullet>i" "d\<bullet>i \<noteq> f\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2120
      using s(2) t(2) apply fastforce
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2121
      using t(2)[OF i'] \<open>c \<bullet> i \<noteq> e \<bullet> i \<or> d \<bullet> i \<noteq> f \<bullet> i\<close> i' s(2) t(2) by fastforce
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2122
    have *: "\<And>s t. (\<And>a. a \<in> s \<Longrightarrow> a \<in> t \<Longrightarrow> False) \<Longrightarrow> s \<inter> t = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2123
      by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2124
    show "interior s \<inter> interior t = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2125
      unfolding s t interior_cbox
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2126
    proof (rule *)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2127
      fix x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2128
      assume "x \<in> box c d" "x \<in> box e f"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2129
      then have x: "c\<bullet>i < d\<bullet>i" "e\<bullet>i < f\<bullet>i" "c\<bullet>i < f\<bullet>i" "e\<bullet>i < d\<bullet>i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2130
        unfolding mem_box using i'
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2131
        by force+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2132
      show False  using s(2)[OF i']
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2133
      proof safe
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2134
        assume as: "c \<bullet> i = a \<bullet> i" "d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2135
        show False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2136
          using t(2)[OF i'] and i x unfolding as by (fastforce simp add:field_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2137
      next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2138
        assume as: "c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2" "d \<bullet> i = b \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2139
        show False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2140
          using t(2)[OF i'] and i x unfolding as by(fastforce simp add:field_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2141
      qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2142
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2143
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2144
  also have "\<Union>?A = cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2145
  proof (rule set_eqI,rule)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2146
    fix x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2147
    assume "x \<in> \<Union>?A"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2148
    then obtain c d where x:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2149
      "x \<in> cbox c d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2150
      "\<And>i. i \<in> Basis \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2151
        c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2152
        c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2153
      by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2154
    show "x\<in>cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2155
      unfolding mem_box
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2156
    proof safe
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2157
      fix i :: 'a
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2158
      assume i: "i \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2159
      then show "a \<bullet> i \<le> x \<bullet> i" "x \<bullet> i \<le> b \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2160
        using x(2)[OF i] x(1)[unfolded mem_box,THEN bspec, OF i] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2161
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2162
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2163
    fix x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2164
    assume x: "x \<in> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2165
    have "\<forall>i\<in>Basis.
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2166
      \<exists>c d. (c = a\<bullet>i \<and> d = (a\<bullet>i + b\<bullet>i) / 2 \<or> c = (a\<bullet>i + b\<bullet>i) / 2 \<and> d = b\<bullet>i) \<and> c\<le>x\<bullet>i \<and> x\<bullet>i \<le> d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2167
      (is "\<forall>i\<in>Basis. \<exists>c d. ?P i c d")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2168
      unfolding mem_box
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2169
    proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2170
      fix i :: 'a
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2171
      assume i: "i \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2172
      have "?P i (a\<bullet>i) ((a \<bullet> i + b \<bullet> i) / 2) \<or> ?P i ((a \<bullet> i + b \<bullet> i) / 2) (b\<bullet>i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2173
        using x[unfolded mem_box,THEN bspec, OF i] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2174
      then show "\<exists>c d. ?P i c d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2175
        by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2176
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2177
    then show "x\<in>\<Union>?A"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2178
      unfolding Union_iff Bex_def mem_Collect_eq choice_Basis_iff
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2179
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2180
      apply (rule_tac x="cbox xa xaa" in exI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2181
      unfolding mem_box
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2182
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2183
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2184
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2185
  finally show False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2186
    using assms by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2187
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2188
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2189
lemma interval_bisection:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2190
  fixes type :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2191
  assumes "P {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2192
    and "(\<forall>s t. P s \<and> P t \<and> interior(s) \<inter> interior(t) = {} \<longrightarrow> P(s \<union> t))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2193
    and "\<not> P (cbox a (b::'a))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2194
  obtains x where "x \<in> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2195
    and "\<forall>e>0. \<exists>c d. x \<in> cbox c d \<and> cbox c d \<subseteq> ball x e \<and> cbox c d \<subseteq> cbox a b \<and> \<not> P (cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2196
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2197
  have "\<forall>x. \<exists>y. \<not> P (cbox (fst x) (snd x)) \<longrightarrow> (\<not> P (cbox (fst y) (snd y)) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2198
    (\<forall>i\<in>Basis. fst x\<bullet>i \<le> fst y\<bullet>i \<and> fst y\<bullet>i \<le> snd y\<bullet>i \<and> snd y\<bullet>i \<le> snd x\<bullet>i \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2199
       2 * (snd y\<bullet>i - fst y\<bullet>i) \<le> snd x\<bullet>i - fst x\<bullet>i))" (is "\<forall>x. ?P x")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2200
  proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2201
    show "?P x" for x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2202
    proof (cases "P (cbox (fst x) (snd x))")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2203
      case True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2204
      then show ?thesis by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2205
    next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2206
      case as: False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2207
      obtain c d where "\<not> P (cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2208
        "\<forall>i\<in>Basis.
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2209
           fst x \<bullet> i \<le> c \<bullet> i \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2210
           c \<bullet> i \<le> d \<bullet> i \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2211
           d \<bullet> i \<le> snd x \<bullet> i \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2212
           2 * (d \<bullet> i - c \<bullet> i) \<le> snd x \<bullet> i - fst x \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2213
        by (rule interval_bisection_step[of P, OF assms(1-2) as])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2214
      then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2215
        apply -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2216
        apply (rule_tac x="(c,d)" in exI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2217
        apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2218
        done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2219
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2220
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2221
  then obtain f where f:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2222
    "\<forall>x.
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2223
      \<not> P (cbox (fst x) (snd x)) \<longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2224
      \<not> P (cbox (fst (f x)) (snd (f x))) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2225
        (\<forall>i\<in>Basis.
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2226
            fst x \<bullet> i \<le> fst (f x) \<bullet> i \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2227
            fst (f x) \<bullet> i \<le> snd (f x) \<bullet> i \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2228
            snd (f x) \<bullet> i \<le> snd x \<bullet> i \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2229
            2 * (snd (f x) \<bullet> i - fst (f x) \<bullet> i) \<le> snd x \<bullet> i - fst x \<bullet> i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2230
    apply -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2231
    apply (drule choice)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2232
    apply blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2233
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2234
  define AB A B where ab_def: "AB n = (f ^^ n) (a,b)" "A n = fst(AB n)" "B n = snd(AB n)" for n
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2235
  have "A 0 = a" "B 0 = b" "\<And>n. \<not> P (cbox (A(Suc n)) (B(Suc n))) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2236
    (\<forall>i\<in>Basis. A(n)\<bullet>i \<le> A(Suc n)\<bullet>i \<and> A(Suc n)\<bullet>i \<le> B(Suc n)\<bullet>i \<and> B(Suc n)\<bullet>i \<le> B(n)\<bullet>i \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2237
    2 * (B(Suc n)\<bullet>i - A(Suc n)\<bullet>i) \<le> B(n)\<bullet>i - A(n)\<bullet>i)" (is "\<And>n. ?P n")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2238
  proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2239
    show "A 0 = a" "B 0 = b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2240
      unfolding ab_def by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2241
    note S = ab_def funpow.simps o_def id_apply
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2242
    show "?P n" for n
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2243
    proof (induct n)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2244
      case 0
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2245
      then show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2246
        unfolding S
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2247
        apply (rule f[rule_format]) using assms(3)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2248
        apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2249
        done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2250
    next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2251
      case (Suc n)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2252
      show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2253
        unfolding S
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2254
        apply (rule f[rule_format])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2255
        using Suc
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2256
        unfolding S
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2257
        apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2258
        done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2259
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2260
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2261
  note AB = this(1-2) conjunctD2[OF this(3),rule_format]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2262
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2263
  have interv: "\<exists>n. \<forall>x\<in>cbox (A n) (B n). \<forall>y\<in>cbox (A n) (B n). dist x y < e"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2264
    if e: "0 < e" for e
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2265
  proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2266
    obtain n where n: "(\<Sum>i\<in>Basis. b \<bullet> i - a \<bullet> i) / e < 2 ^ n"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2267
      using real_arch_pow[of 2 "(sum (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis) / e"] by auto
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2268
    show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2269
    proof (rule exI [where x=n], clarify)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2270
      fix x y
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2271
      assume xy: "x\<in>cbox (A n) (B n)" "y\<in>cbox (A n) (B n)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2272
      have "dist x y \<le> sum (\<lambda>i. \<bar>(x - y)\<bullet>i\<bar>) Basis"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2273
        unfolding dist_norm by(rule norm_le_l1)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2274
      also have "\<dots> \<le> sum (\<lambda>i. B n\<bullet>i - A n\<bullet>i) Basis"
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2275
      proof (rule sum_mono)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2276
        fix i :: 'a
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2277
        assume i: "i \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2278
        show "\<bar>(x - y) \<bullet> i\<bar> \<le> B n \<bullet> i - A n \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2279
          using xy[unfolded mem_box,THEN bspec, OF i]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2280
          by (auto simp: inner_diff_left)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2281
      qed
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2282
      also have "\<dots> \<le> sum (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis / 2^n"
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2283
        unfolding sum_divide_distrib
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2284
      proof (rule sum_mono)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2285
        show "B n \<bullet> i - A n \<bullet> i \<le> (b \<bullet> i - a \<bullet> i) / 2 ^ n" if i: "i \<in> Basis" for i
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2286
        proof (induct n)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2287
          case 0
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2288
          then show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2289
            unfolding AB by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2290
        next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2291
          case (Suc n)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2292
          have "B (Suc n) \<bullet> i - A (Suc n) \<bullet> i \<le> (B n \<bullet> i - A n \<bullet> i) / 2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2293
            using AB(4)[of i n] using i by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2294
          also have "\<dots> \<le> (b \<bullet> i - a \<bullet> i) / 2 ^ Suc n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2295
            using Suc by (auto simp add: field_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2296
          finally show ?case .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2297
        qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2298
      qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2299
      also have "\<dots> < e"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2300
        using n using e by (auto simp add: field_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2301
      finally show "dist x y < e" .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2302
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2303
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2304
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2305
    fix n m :: nat
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2306
    assume "m \<le> n" then have "cbox (A n) (B n) \<subseteq> cbox (A m) (B m)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2307
    proof (induction rule: inc_induct)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2308
      case (step i)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2309
      show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2310
        using AB(4) by (intro order_trans[OF step.IH] subset_box_imp) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2311
    qed simp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2312
  } note ABsubset = this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2313
  have "\<exists>a. \<forall>n. a\<in> cbox (A n) (B n)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2314
    by (rule decreasing_closed_nest[rule_format,OF closed_cbox _ ABsubset interv])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2315
      (metis nat.exhaust AB(1-3) assms(1,3))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2316
  then obtain x0 where x0: "\<And>n. x0 \<in> cbox (A n) (B n)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2317
    by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2318
  show thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2319
  proof (rule that[rule_format, of x0])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2320
    show "x0\<in>cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2321
      using x0[of 0] unfolding AB .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2322
    fix e :: real
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2323
    assume "e > 0"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2324
    from interv[OF this] obtain n
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2325
      where n: "\<forall>x\<in>cbox (A n) (B n). \<forall>y\<in>cbox (A n) (B n). dist x y < e" ..
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2326
    have "\<not> P (cbox (A n) (B n))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2327
      apply (cases "0 < n")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2328
      using AB(3)[of "n - 1"] assms(3) AB(1-2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2329
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2330
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2331
    moreover have "cbox (A n) (B n) \<subseteq> ball x0 e"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2332
      using n using x0[of n] by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2333
    moreover have "cbox (A n) (B n) \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2334
      unfolding AB(1-2)[symmetric] by (rule ABsubset) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2335
    ultimately show "\<exists>c d. x0 \<in> cbox c d \<and> cbox c d \<subseteq> ball x0 e \<and> cbox c d \<subseteq> cbox a b \<and> \<not> P (cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2336
      apply (rule_tac x="A n" in exI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2337
      apply (rule_tac x="B n" in exI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2338
      apply (auto simp: x0)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2339
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2340
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2341
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2342
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2343
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2344
subsection \<open>Cousin's lemma.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2345
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2346
lemma fine_division_exists:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2347
  fixes a b :: "'a::euclidean_space"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2348
  assumes "gauge g"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2349
  obtains p where "p tagged_division_of (cbox a b)" "g fine p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2350
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2351
  presume "\<not> (\<exists>p. p tagged_division_of (cbox a b) \<and> g fine p) \<Longrightarrow> False"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2352
  then obtain p where "p tagged_division_of (cbox a b)" "g fine p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2353
    by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2354
  then show thesis ..
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2355
next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2356
  assume as: "\<not> (\<exists>p. p tagged_division_of (cbox a b) \<and> g fine p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2357
  obtain x where x:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2358
      "x \<in> (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2359
      "\<And>e. 0 < e \<Longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2360
        \<exists>c d.
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2361
          x \<in> cbox c d \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2362
          cbox c d \<subseteq> ball x e \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2363
          cbox c d \<subseteq> (cbox a b) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2364
          \<not> (\<exists>p. p tagged_division_of cbox c d \<and> g fine p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2365
    apply (rule interval_bisection[of "\<lambda>s. \<exists>p. p tagged_division_of s \<and> g fine p", OF _ _ as])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2366
    apply (simp add: fine_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2367
    apply (metis tagged_division_union fine_union)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2368
    apply (auto simp: )
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2369
    done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2370
  obtain e where e: "e > 0" "ball x e \<subseteq> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2371
    using gaugeD[OF assms, of x] unfolding open_contains_ball by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2372
  from x(2)[OF e(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2373
  obtain c d where c_d: "x \<in> cbox c d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2374
                        "cbox c d \<subseteq> ball x e"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2375
                        "cbox c d \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2376
                        "\<not> (\<exists>p. p tagged_division_of cbox c d \<and> g fine p)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2377
    by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2378
  have "g fine {(x, cbox c d)}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2379
    unfolding fine_def using e using c_d(2) by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2380
  then show False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2381
    using tagged_division_of_self[OF c_d(1)] using c_d by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2382
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2383
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2384
lemma fine_division_exists_real:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2385
  fixes a b :: real
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2386
  assumes "gauge g"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2387
  obtains p where "p tagged_division_of {a .. b}" "g fine p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2388
  by (metis assms box_real(2) fine_division_exists)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2389
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2390
subsection \<open>A technical lemma about "refinement" of division.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2391
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2392
lemma tagged_division_finer:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2393
  fixes p :: "('a::euclidean_space \<times> ('a::euclidean_space set)) set"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2394
  assumes "p tagged_division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2395
    and "gauge d"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2396
  obtains q where "q tagged_division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2397
    and "d fine q"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2398
    and "\<forall>(x,k) \<in> p. k \<subseteq> d(x) \<longrightarrow> (x,k) \<in> q"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2399
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2400
  let ?P = "\<lambda>p. p tagged_partial_division_of (cbox a b) \<longrightarrow> gauge d \<longrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2401
    (\<exists>q. q tagged_division_of (\<Union>{k. \<exists>x. (x,k) \<in> p}) \<and> d fine q \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2402
      (\<forall>(x,k) \<in> p. k \<subseteq> d(x) \<longrightarrow> (x,k) \<in> q))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2403
  {
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2404
    have *: "finite p" "p tagged_partial_division_of (cbox a b)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2405
      using assms(1)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2406
      unfolding tagged_division_of_def
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2407
      by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2408
    presume "\<And>p. finite p \<Longrightarrow> ?P p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2409
    from this[rule_format,OF * assms(2)] guess q .. note q=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2410
    then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2411
      apply -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2412
      apply (rule that[of q])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2413
      unfolding tagged_division_ofD[OF assms(1)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2414
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2415
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2416
  }
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2417
  fix p :: "('a::euclidean_space \<times> ('a::euclidean_space set)) set"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2418
  assume as: "finite p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2419
  show "?P p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2420
    apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2421
    apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2422
    using as
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2423
  proof (induct p)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2424
    case empty
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2425
    show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2426
      apply (rule_tac x="{}" in exI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2427
      unfolding fine_def
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2428
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2429
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2430
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2431
    case (insert xk p)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2432
    guess x k using surj_pair[of xk] by (elim exE) note xk=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2433
    note tagged_partial_division_subset[OF insert(4) subset_insertI]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2434
    from insert(3)[OF this insert(5)] guess q1 .. note q1 = conjunctD3[OF this]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2435
    have *: "\<Union>{l. \<exists>y. (y,l) \<in> insert xk p} = k \<union> \<Union>{l. \<exists>y. (y,l) \<in> p}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2436
      unfolding xk by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2437
    note p = tagged_partial_division_ofD[OF insert(4)]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2438
    from p(4)[unfolded xk, OF insertI1] guess u v by (elim exE) note uv=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2439
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2440
    have "finite {k. \<exists>x. (x, k) \<in> p}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2441
      apply (rule finite_subset[of _ "snd ` p"])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2442
      using p
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2443
      apply safe
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2444
      apply (metis image_iff snd_conv)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2445
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2446
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2447
    then have int: "interior (cbox u v) \<inter> interior (\<Union>{k. \<exists>x. (x, k) \<in> p}) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2448
      apply (rule inter_interior_unions_intervals)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2449
      apply (rule open_interior)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2450
      apply (rule_tac[!] ballI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2451
      unfolding mem_Collect_eq
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2452
      apply (erule_tac[!] exE)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2453
      apply (drule p(4)[OF insertI2])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2454
      apply assumption
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2455
      apply (rule p(5))
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2456
      unfolding uv xk
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2457
      apply (rule insertI1)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2458
      apply (rule insertI2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2459
      apply assumption
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2460
      using insert(2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2461
      unfolding uv xk
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2462
      apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2463
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2464
    show ?case
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2465
    proof (cases "cbox u v \<subseteq> d x")
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2466
      case True
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2467
      then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2468
        apply (rule_tac x="{(x,cbox u v)} \<union> q1" in exI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2469
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2470
        unfolding * uv
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2471
        apply (rule tagged_division_union)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2472
        apply (rule tagged_division_of_self)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2473
        apply (rule p[unfolded xk uv] insertI1)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2474
        apply (rule q1)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2475
        apply (rule int)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2476
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2477
        apply (rule fine_union)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2478
        apply (subst fine_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2479
        defer
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2480
        apply (rule q1)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2481
        unfolding Ball_def split_paired_All split_conv
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2482
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2483
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2484
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2485
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2486
        apply (erule insertE)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2487
        apply (simp add: uv xk)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2488
        apply (rule UnI2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2489
        apply (drule q1(3)[rule_format])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2490
        unfolding xk uv
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2491
        apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2492
        done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2493
    next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2494
      case False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2495
      from fine_division_exists[OF assms(2), of u v] guess q2 . note q2=this
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2496
      show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2497
        apply (rule_tac x="q2 \<union> q1" in exI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2498
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2499
        unfolding * uv
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2500
        apply (rule tagged_division_union q2 q1 int fine_union)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2501
        unfolding Ball_def split_paired_All split_conv
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2502
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2503
        apply (rule fine_union)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2504
        apply (rule q1 q2)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2505
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2506
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2507
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2508
        apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2509
        apply (erule insertE)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2510
        apply (rule UnI2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2511
        apply (simp add: False uv xk)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2512
        apply (drule q1(3)[rule_format])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2513
        using False
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2514
        unfolding xk uv
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2515
        apply auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2516
        done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2517
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2518
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2519
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2520
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2521
subsubsection \<open>Covering lemma\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2522
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2523
text\<open> Some technical lemmas used in the approximation results that follow. Proof of the covering
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2524
  lemma is an obvious multidimensional generalization of Lemma 3, p65 of Swartz's
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2525
  "Introduction to Gauge Integrals". \<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2526
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2527
proposition covering_lemma:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2528
  assumes "S \<subseteq> cbox a b" "box a b \<noteq> {}" "gauge g"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2529
  obtains \<D> where
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2530
    "countable \<D>"  "\<Union>\<D> \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2531
    "\<And>K. K \<in> \<D> \<Longrightarrow> interior K \<noteq> {} \<and> (\<exists>c d. K = cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2532
    "pairwise (\<lambda>A B. interior A \<inter> interior B = {}) \<D>"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2533
    "\<And>K. K \<in> \<D> \<Longrightarrow> \<exists>x \<in> S \<inter> K. K \<subseteq> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2534
    "\<And>u v. cbox u v \<in> \<D> \<Longrightarrow> \<exists>n. \<forall>i \<in> Basis. v \<bullet> i - u \<bullet> i = (b \<bullet> i - a \<bullet> i) / 2^n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2535
    "S \<subseteq> \<Union>\<D>"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2536
proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2537
  have aibi: "\<And>i. i \<in> Basis \<Longrightarrow> a \<bullet> i \<le> b \<bullet> i" and normab: "0 < norm(b - a)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2538
    using \<open>box a b \<noteq> {}\<close> box_eq_empty box_sing by fastforce+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2539
  let ?K0 = "\<lambda>(n, f::'a\<Rightarrow>nat).
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2540
                    cbox (\<Sum>i \<in> Basis. (a \<bullet> i + (f i / 2^n) * (b \<bullet> i - a \<bullet> i)) *\<^sub>R i)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2541
                         (\<Sum>i \<in> Basis. (a \<bullet> i + ((f i + 1) / 2^n) * (b \<bullet> i - a \<bullet> i)) *\<^sub>R i)"
64910
6108dddad9f0 more symbols via abbrevs;
wenzelm
parents: 64267
diff changeset
  2542
  let ?D0 = "?K0 ` (SIGMA n:UNIV. Pi\<^sub>E Basis (\<lambda>i::'a. lessThan (2^n)))"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2543
  obtain \<D>0 where count: "countable \<D>0"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2544
             and sub: "\<Union>\<D>0 \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2545
             and int:  "\<And>K. K \<in> \<D>0 \<Longrightarrow> (interior K \<noteq> {}) \<and> (\<exists>c d. K = cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2546
             and intdj: "\<And>A B. \<lbrakk>A \<in> \<D>0; B \<in> \<D>0\<rbrakk> \<Longrightarrow> A \<subseteq> B \<or> B \<subseteq> A \<or> interior A \<inter> interior B = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2547
             and SK: "\<And>x. x \<in> S \<Longrightarrow> \<exists>K \<in> \<D>0. x \<in> K \<and> K \<subseteq> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2548
             and cbox: "\<And>u v. cbox u v \<in> \<D>0 \<Longrightarrow> \<exists>n. \<forall>i \<in> Basis. v \<bullet> i - u \<bullet> i = (b \<bullet> i - a \<bullet> i) / 2^n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2549
             and fin: "\<And>K. K \<in> \<D>0 \<Longrightarrow> finite {L \<in> \<D>0. K \<subseteq> L}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2550
  proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2551
    show "countable ?D0"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2552
      by (simp add: countable_PiE)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2553
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2554
    show "\<Union>?D0 \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2555
      apply (simp add: UN_subset_iff)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2556
      apply (intro conjI allI ballI subset_box_imp)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2557
       apply (simp add: divide_simps zero_le_mult_iff aibi)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2558
      apply (force simp: aibi scaling_mono nat_less_real_le dest: PiE_mem)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2559
      done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2560
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2561
    show "\<And>K. K \<in> ?D0 \<Longrightarrow> interior K \<noteq> {} \<and> (\<exists>c d. K = cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2562
      using \<open>box a b \<noteq> {}\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2563
      by (clarsimp simp: box_eq_empty) (fastforce simp add: divide_simps dest: PiE_mem)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2564
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2565
    have realff: "(real w) * 2^m < (real v) * 2^n \<longleftrightarrow> w * 2^m < v * 2^n" for m n v w
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2566
      using of_nat_less_iff less_imp_of_nat_less by fastforce
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2567
    have *: "\<forall>v w. ?K0(m,v) \<subseteq> ?K0(n,w) \<or> ?K0(n,w) \<subseteq> ?K0(m,v) \<or> interior(?K0(m,v)) \<inter> interior(?K0(n,w)) = {}"
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64910
diff changeset
  2568
      for m n \<comment>\<open>The symmetry argument requires a single HOL formula\<close>
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2569
    proof (rule linorder_wlog [where a=m and b=n], intro allI impI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2570
      fix v w m and n::nat
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64910
diff changeset
  2571
      assume "m \<le> n" \<comment>\<open>WLOG we can assume @{term"m \<le> n"}, when the first disjunct becomes impossible\<close>
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2572
      have "?K0(n,w) \<subseteq> ?K0(m,v) \<or> interior(?K0(m,v)) \<inter> interior(?K0(n,w)) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2573
        apply (simp add: subset_box disjoint_interval)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2574
        apply (rule ccontr)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2575
        apply (clarsimp simp add: aibi mult_le_cancel_right divide_le_cancel not_less not_le)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2576
        apply (drule_tac x=i in bspec, assumption)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2577
        using \<open>m\<le>n\<close> realff [of _ _ "1+_"] realff [of "1+_"_ "1+_"]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2578
        apply (auto simp: divide_simps add.commute not_le nat_le_iff_add realff)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2579
        apply (simp add: power_add, metis (no_types, hide_lams) mult_Suc mult_less_cancel2 not_less_eq mult.assoc)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2580
        done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2581
      then show "?K0(m,v) \<subseteq> ?K0(n,w) \<or> ?K0(n,w) \<subseteq> ?K0(m,v) \<or> interior(?K0(m,v)) \<inter> interior(?K0(n,w)) = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2582
        by meson
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2583
    qed auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2584
    show "\<And>A B. \<lbrakk>A \<in> ?D0; B \<in> ?D0\<rbrakk> \<Longrightarrow> A \<subseteq> B \<or> B \<subseteq> A \<or> interior A \<inter> interior B = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2585
      apply (erule imageE SigmaE)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2586
      using * by simp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2587
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2588
    show "\<exists>K \<in> ?D0. x \<in> K \<and> K \<subseteq> g x" if "x \<in> S" for x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2589
    proof (simp only: bex_simps split_paired_Bex_Sigma)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2590
      show "\<exists>n. \<exists>f \<in> Basis \<rightarrow>\<^sub>E {..<2 ^ n}. x \<in> ?K0(n,f) \<and> ?K0(n,f) \<subseteq> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2591
      proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2592
        obtain e where "0 < e"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2593
                   and e: "\<And>y. (\<And>i. i \<in> Basis \<Longrightarrow> \<bar>x \<bullet> i - y \<bullet> i\<bar> \<le> e) \<Longrightarrow> y \<in> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2594
        proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2595
          have "x \<in> g x" "open (g x)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2596
            using \<open>gauge g\<close> by (auto simp: gauge_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2597
          then obtain \<epsilon> where "0 < \<epsilon>" and \<epsilon>: "ball x \<epsilon> \<subseteq> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2598
            using openE by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2599
          have "norm (x - y) < \<epsilon>"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2600
               if "(\<And>i. i \<in> Basis \<Longrightarrow> \<bar>x \<bullet> i - y \<bullet> i\<bar> \<le> \<epsilon> / (2 * real DIM('a)))" for y
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2601
          proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2602
            have "norm (x - y) \<le> (\<Sum>i\<in>Basis. \<bar>x \<bullet> i - y \<bullet> i\<bar>)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2603
              by (metis (no_types, lifting) inner_diff_left norm_le_l1 sum.cong)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2604
            also have "... \<le> DIM('a) * (\<epsilon> / (2 * real DIM('a)))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2605
              by (meson sum_bounded_above that)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2606
            also have "... = \<epsilon> / 2"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2607
              by (simp add: divide_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2608
            also have "... < \<epsilon>"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2609
              by (simp add: \<open>0 < \<epsilon>\<close>)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2610
            finally show ?thesis .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2611
          qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2612
          then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2613
            by (rule_tac e = "\<epsilon> / 2 / DIM('a)" in that) (simp_all add:  \<open>0 < \<epsilon>\<close> dist_norm subsetD [OF \<epsilon>])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2614
        qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2615
        have xab: "x \<in> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2616
          using \<open>x \<in> S\<close> \<open>S \<subseteq> cbox a b\<close> by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2617
        obtain n where n: "norm (b - a) / 2^n < e"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2618
          using real_arch_pow_inv [of "e / norm(b - a)" "1/2"] normab \<open>0 < e\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2619
          by (auto simp: divide_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2620
        then have "norm (b - a) < e * 2^n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2621
          by (auto simp: divide_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2622
        then have bai: "b \<bullet> i - a \<bullet> i < e * 2 ^ n" if "i \<in> Basis" for i
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2623
        proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2624
          have "b \<bullet> i - a \<bullet> i \<le> norm (b - a)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2625
            by (metis abs_of_nonneg dual_order.trans inner_diff_left linear norm_ge_zero Basis_le_norm that)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2626
          also have "... < e * 2 ^ n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2627
            using \<open>norm (b - a) < e * 2 ^ n\<close> by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2628
          finally show ?thesis .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2629
        qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2630
        have D: "(a + n \<le> x \<and> x \<le> a + m) \<Longrightarrow> (a + n \<le> y \<and> y \<le> a + m) \<Longrightarrow> abs(x - y) \<le> m - n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2631
                 for a m n x and y::real
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2632
          by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2633
        have "\<forall>i\<in>Basis. \<exists>k<2 ^ n. (a \<bullet> i + real k * (b \<bullet> i - a \<bullet> i) / 2 ^ n \<le> x \<bullet> i \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2634
               x \<bullet> i \<le> a \<bullet> i + (real k + 1) * (b \<bullet> i - a \<bullet> i) / 2 ^ n)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2635
        proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2636
          fix i::'a assume "i \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2637
          consider "x \<bullet> i = b \<bullet> i" | "x \<bullet> i < b \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2638
            using \<open>i \<in> Basis\<close> mem_box(2) xab by force
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2639
          then show "\<exists>k<2 ^ n. (a \<bullet> i + real k * (b \<bullet> i - a \<bullet> i) / 2 ^ n \<le> x \<bullet> i \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2640
                          x \<bullet> i \<le> a \<bullet> i + (real k + 1) * (b \<bullet> i - a \<bullet> i) / 2 ^ n)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2641
          proof cases
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2642
            case 1 then show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2643
              by (rule_tac x = "2^n - 1" in exI) (auto simp: algebra_simps divide_simps of_nat_diff \<open>i \<in> Basis\<close> aibi)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2644
          next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2645
            case 2
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2646
            then have abi_less: "a \<bullet> i < b \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2647
              using \<open>i \<in> Basis\<close> xab by (auto simp: mem_box)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2648
            let ?k = "nat \<lfloor>2 ^ n * (x \<bullet> i - a \<bullet> i) / (b \<bullet> i - a \<bullet> i)\<rfloor>"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2649
            show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2650
            proof (intro exI conjI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2651
              show "?k < 2 ^ n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2652
                using aibi xab \<open>i \<in> Basis\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2653
                by (force simp: nat_less_iff floor_less_iff divide_simps 2 mem_box)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2654
            next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2655
              have "a \<bullet> i + real ?k * (b \<bullet> i - a \<bullet> i) / 2 ^ n \<le>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2656
                    a \<bullet> i + (2 ^ n * (x \<bullet> i - a \<bullet> i) / (b \<bullet> i - a \<bullet> i)) * (b \<bullet> i - a \<bullet> i) / 2 ^ n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2657
                apply (intro add_left_mono mult_right_mono divide_right_mono of_nat_floor)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2658
                using aibi [OF \<open>i \<in> Basis\<close>] xab 2
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2659
                  apply (simp_all add: \<open>i \<in> Basis\<close> mem_box divide_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2660
                done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2661
              also have "... = x \<bullet> i"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2662
                using abi_less by (simp add: divide_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2663
              finally show "a \<bullet> i + real ?k * (b \<bullet> i - a \<bullet> i) / 2 ^ n \<le> x \<bullet> i" .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2664
            next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2665
              have "x \<bullet> i \<le> a \<bullet> i + (2 ^ n * (x \<bullet> i - a \<bullet> i) / (b \<bullet> i - a \<bullet> i)) * (b \<bullet> i - a \<bullet> i) / 2 ^ n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2666
                using abi_less by (simp add: divide_simps algebra_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2667
              also have "... \<le> a \<bullet> i + (real ?k + 1) * (b \<bullet> i - a \<bullet> i) / 2 ^ n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2668
                apply (intro add_left_mono mult_right_mono divide_right_mono of_nat_floor)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2669
                using aibi [OF \<open>i \<in> Basis\<close>] xab
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2670
                  apply (auto simp: \<open>i \<in> Basis\<close> mem_box divide_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2671
                done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2672
              finally show "x \<bullet> i \<le> a \<bullet> i + (real ?k + 1) * (b \<bullet> i - a \<bullet> i) / 2 ^ n" .
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2673
            qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2674
          qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2675
        qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2676
        then have "\<exists>f\<in>Basis \<rightarrow>\<^sub>E {..<2 ^ n}. x \<in> ?K0(n,f)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2677
          apply (simp add: mem_box Bex_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2678
          apply (clarify dest!: bchoice)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2679
          apply (rule_tac x="restrict f Basis" in exI, simp)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2680
          done
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2681
        moreover have "\<And>f. x \<in> ?K0(n,f) \<Longrightarrow> ?K0(n,f) \<subseteq> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2682
          apply (clarsimp simp add: mem_box)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2683
          apply (rule e)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2684
          apply (drule bspec D, assumption)+
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2685
          apply (erule order_trans)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2686
          apply (simp add: divide_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2687
          using bai by (force simp: algebra_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2688
        ultimately show ?thesis by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2689
      qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2690
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2691
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2692
    show "\<And>u v. cbox u v \<in> ?D0 \<Longrightarrow> \<exists>n. \<forall>i \<in> Basis. v \<bullet> i - u \<bullet> i = (b \<bullet> i - a \<bullet> i) / 2^n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2693
      by (force simp: eq_cbox box_eq_empty field_simps dest!: aibi)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2694
  next
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2695
    obtain j::'a where "j \<in> Basis"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2696
      using nonempty_Basis by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2697
    have "finite {L \<in> ?D0. ?K0(n,f) \<subseteq> L}" if "f \<in> Basis \<rightarrow>\<^sub>E {..<2 ^ n}" for n f
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2698
    proof (rule finite_subset)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2699
      let ?B = "(\<lambda>(n, f::'a\<Rightarrow>nat). cbox (\<Sum>i\<in>Basis. (a \<bullet> i + (f i) / 2^n * (b \<bullet> i - a \<bullet> i)) *\<^sub>R i)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2700
                                        (\<Sum>i\<in>Basis. (a \<bullet> i + ((f i) + 1) / 2^n * (b \<bullet> i - a \<bullet> i)) *\<^sub>R i))
64910
6108dddad9f0 more symbols via abbrevs;
wenzelm
parents: 64267
diff changeset
  2701
                ` (SIGMA m:atMost n. Pi\<^sub>E Basis (\<lambda>i::'a. lessThan (2^m)))"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2702
      have "?K0(m,g) \<in> ?B" if "g \<in> Basis \<rightarrow>\<^sub>E {..<2 ^ m}" "?K0(n,f) \<subseteq> ?K0(m,g)" for m g
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2703
      proof -
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2704
        have dd: "w / m \<le> v / n \<and> (v+1) / n \<le> (w+1) / m
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2705
                  \<Longrightarrow> inverse n \<le> inverse m" for w m v n::real
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2706
          by (auto simp: divide_simps algebra_simps)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2707
        have bjaj: "b \<bullet> j - a \<bullet> j > 0"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2708
          using \<open>j \<in> Basis\<close> \<open>box a b \<noteq> {}\<close> box_eq_empty(1) by fastforce
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2709
        have "((g j) / 2 ^ m) * (b \<bullet> j - a \<bullet> j) \<le> ((f j) / 2 ^ n) * (b \<bullet> j - a \<bullet> j) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2710
              (((f j) + 1) / 2 ^ n) * (b \<bullet> j - a \<bullet> j) \<le> (((g j) + 1) / 2 ^ m) * (b \<bullet> j - a \<bullet> j)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2711
          using that \<open>j \<in> Basis\<close> by (simp add: subset_box algebra_simps divide_simps aibi)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2712
        then have "((g j) / 2 ^ m) \<le> ((f j) / 2 ^ n) \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2713
          ((real(f j) + 1) / 2 ^ n) \<le> ((real(g j) + 1) / 2 ^ m)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2714
          by (metis bjaj mult.commute of_nat_1 of_nat_add real_mult_le_cancel_iff2)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2715
        then have "inverse (2^n) \<le> (inverse (2^m) :: real)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2716
          by (rule dd)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2717
        then have "m \<le> n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2718
          by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2719
        show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2720
          by (rule imageI) (simp add: \<open>m \<le> n\<close> that)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2721
      qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2722
      then show "{L \<in> ?D0. ?K0(n,f) \<subseteq> L} \<subseteq> ?B"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2723
        by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2724
      show "finite ?B"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2725
        by (intro finite_imageI finite_SigmaI finite_atMost finite_lessThan finite_PiE finite_Basis)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2726
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2727
    then show "finite {L \<in> ?D0. K \<subseteq> L}" if "K \<in> ?D0" for K
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2728
      using that by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2729
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2730
  let ?D1 = "{K \<in> \<D>0. \<exists>x \<in> S \<inter> K. K \<subseteq> g x}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2731
  obtain \<D> where count: "countable \<D>"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2732
             and sub: "\<Union>\<D> \<subseteq> cbox a b"  "S \<subseteq> \<Union>\<D>"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2733
             and int:  "\<And>K. K \<in> \<D> \<Longrightarrow> (interior K \<noteq> {}) \<and> (\<exists>c d. K = cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2734
             and intdj: "\<And>A B. \<lbrakk>A \<in> \<D>; B \<in> \<D>\<rbrakk> \<Longrightarrow> A \<subseteq> B \<or> B \<subseteq> A \<or> interior A \<inter> interior B = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2735
             and SK: "\<And>K. K \<in> \<D> \<Longrightarrow> \<exists>x. x \<in> S \<inter> K \<and> K \<subseteq> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2736
             and cbox: "\<And>u v. cbox u v \<in> \<D> \<Longrightarrow> \<exists>n. \<forall>i \<in> Basis. v \<bullet> i - u \<bullet> i = (b \<bullet> i - a \<bullet> i) / 2^n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2737
             and fin: "\<And>K. K \<in> \<D> \<Longrightarrow> finite {L. L \<in> \<D> \<and> K \<subseteq> L}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2738
  proof
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2739
    show "countable ?D1" using count countable_subset
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2740
      by (simp add: count countable_subset)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2741
    show "\<Union>?D1 \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2742
      using sub by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2743
    show "S \<subseteq> \<Union>?D1"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2744
      using SK by (force simp:)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2745
    show "\<And>K. K \<in> ?D1 \<Longrightarrow> (interior K \<noteq> {}) \<and> (\<exists>c d. K = cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2746
      using int by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2747
    show "\<And>A B. \<lbrakk>A \<in> ?D1; B \<in> ?D1\<rbrakk> \<Longrightarrow> A \<subseteq> B \<or> B \<subseteq> A \<or> interior A \<inter> interior B = {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2748
      using intdj by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2749
    show "\<And>K. K \<in> ?D1 \<Longrightarrow> \<exists>x. x \<in> S \<inter> K \<and> K \<subseteq> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2750
      by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2751
    show "\<And>u v. cbox u v \<in> ?D1 \<Longrightarrow> \<exists>n. \<forall>i \<in> Basis. v \<bullet> i - u \<bullet> i = (b \<bullet> i - a \<bullet> i) / 2^n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2752
      using cbox by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2753
    show "\<And>K. K \<in> ?D1 \<Longrightarrow> finite {L. L \<in> ?D1 \<and> K \<subseteq> L}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2754
      using fin by simp (metis (mono_tags, lifting) Collect_mono rev_finite_subset)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2755
  qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2756
  let ?\<D> = "{K \<in> \<D>. \<forall>K'. K' \<in> \<D> \<and> K \<noteq> K' \<longrightarrow> ~(K \<subseteq> K')}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2757
  show ?thesis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2758
  proof (rule that)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2759
    show "countable ?\<D>"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2760
      by (blast intro: countable_subset [OF _ count])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2761
    show "\<Union>?\<D> \<subseteq> cbox a b"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2762
      using sub by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2763
    show "S \<subseteq> \<Union>?\<D>"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2764
    proof clarsimp
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2765
      fix x
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2766
      assume "x \<in> S"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2767
      then obtain X where "x \<in> X" "X \<in> \<D>" using \<open>S \<subseteq> \<Union>\<D>\<close> by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2768
      let ?R = "{(K,L). K \<in> \<D> \<and> L \<in> \<D> \<and> L \<subset> K}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2769
      have irrR: "irrefl ?R" by (force simp: irrefl_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2770
      have traR: "trans ?R" by (force simp: trans_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2771
      have finR: "\<And>x. finite {y. (y, x) \<in> ?R}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2772
        by simp (metis (mono_tags, lifting) fin \<open>X \<in> \<D>\<close> finite_subset mem_Collect_eq psubset_imp_subset subsetI)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2773
      have "{X \<in> \<D>. x \<in> X} \<noteq> {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2774
        using \<open>X \<in> \<D>\<close> \<open>x \<in> X\<close> by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2775
      then obtain Y where "Y \<in> {X \<in> \<D>. x \<in> X}" "\<And>Y'. (Y', Y) \<in> ?R \<Longrightarrow> Y' \<notin> {X \<in> \<D>. x \<in> X}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2776
        by (rule wfE_min' [OF wf_finite_segments [OF irrR traR finR]]) blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2777
      then show "\<exists>Y. Y \<in> \<D> \<and> (\<forall>K'. K' \<in> \<D> \<and> Y \<noteq> K' \<longrightarrow> \<not> Y \<subseteq> K') \<and> x \<in> Y"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2778
        by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2779
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2780
    show "\<And>K. K \<in> ?\<D> \<Longrightarrow> interior K \<noteq> {} \<and> (\<exists>c d. K = cbox c d)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2781
      by (blast intro: dest: int)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2782
    show "pairwise (\<lambda>A B. interior A \<inter> interior B = {}) ?\<D>"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2783
      using intdj by (simp add: pairwise_def) metis
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2784
    show "\<And>K. K \<in> ?\<D> \<Longrightarrow> \<exists>x \<in> S \<inter> K. K \<subseteq> g x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2785
      using SK by force
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2786
    show "\<And>u v. cbox u v \<in> ?\<D> \<Longrightarrow> \<exists>n. \<forall>i\<in>Basis. v \<bullet> i - u \<bullet> i = (b \<bullet> i - a \<bullet> i) / 2^n"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2787
      using cbox by force
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2788
    qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2789
qed
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2790
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2791
subsection \<open>Division filter\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2792
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2793
text \<open>Divisions over all gauges towards finer divisions.\<close>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2794
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2795
definition division_filter :: "'a::euclidean_space set \<Rightarrow> ('a \<times> 'a set) set filter"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2796
  where "division_filter s = (INF g:{g. gauge g}. principal {p. p tagged_division_of s \<and> g fine p})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2797
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2798
lemma eventually_division_filter:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2799
  "(\<forall>\<^sub>F p in division_filter s. P p) \<longleftrightarrow>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2800
    (\<exists>g. gauge g \<and> (\<forall>p. p tagged_division_of s \<and> g fine p \<longrightarrow> P p))"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2801
  unfolding division_filter_def
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2802
proof (subst eventually_INF_base; clarsimp)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2803
  fix g1 g2 :: "'a \<Rightarrow> 'a set" show "gauge g1 \<Longrightarrow> gauge g2 \<Longrightarrow> \<exists>x. gauge x \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2804
    {p. p tagged_division_of s \<and> x fine p} \<subseteq> {p. p tagged_division_of s \<and> g1 fine p} \<and>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2805
    {p. p tagged_division_of s \<and> x fine p} \<subseteq> {p. p tagged_division_of s \<and> g2 fine p}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2806
    by (intro exI[of _ "\<lambda>x. g1 x \<inter> g2 x"]) (auto simp: fine_inter)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2807
qed (auto simp: eventually_principal)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2808
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2809
lemma division_filter_not_empty: "division_filter (cbox a b) \<noteq> bot"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2810
  unfolding trivial_limit_def eventually_division_filter
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2811
  by (auto elim: fine_division_exists)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2812
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2813
lemma eventually_division_filter_tagged_division:
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2814
  "eventually (\<lambda>p. p tagged_division_of s) (division_filter s)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2815
  unfolding eventually_division_filter by (intro exI[of _ "\<lambda>x. ball x 1"]) auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents:
diff changeset
  2816
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2817
end