src/HOL/Real/ContNotDenum.thy
author kleing
Sun, 12 Feb 2006 12:29:01 +0100
changeset 19023 5652a536b7e8
child 19765 dfe940911617
permissions -rw-r--r--
* include generalised MVT in HyperReal (contributed by Benjamin Porter) * add non-denumerability of continuum in Real, includes closed intervals on real (contributed by Benjamin Porter, #22 in http://www.cs.ru.nl/~freek/100/)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
     1
(*  Title       : HOL/Real/ContNonDenum
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
     2
    ID          : $Id$
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
     3
    Author      : Benjamin Porter, Monash University, NICTA, 2005
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
     4
*)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
     5
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
     6
header {* Non-denumerability of the Continuum. *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
     7
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
     8
theory ContNotDenum
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
     9
imports RComplete
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    10
begin
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    11
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    12
section {* Abstract *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    13
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    14
text {* The following document presents a proof that the Continuum is
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    15
uncountable. It is formalised in the Isabelle/Isar theorem proving
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    16
system.
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    17
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    18
{\em Theorem:} The Continuum @{text "\<real>"} is not denumerable. In other
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    19
words, there does not exist a function f:@{text "\<nat>\<Rightarrow>\<real>"} such that f is
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    20
surjective.
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    21
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    22
{\em Outline:} An elegant informal proof of this result uses Cantor's
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    23
Diagonalisation argument. The proof presented here is not this
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    24
one. First we formalise some properties of closed intervals, then we
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    25
prove the Nested Interval Property. This property relies on the
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    26
completeness of the Real numbers and is the foundation for our
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    27
argument. Informally it states that an intersection of countable
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    28
closed intervals (where each successive interval is a subset of the
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    29
last) is non-empty. We then assume a surjective function f:@{text
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    30
"\<nat>\<Rightarrow>\<real>"} exists and find a real x such that x is not in the range of f
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    31
by generating a sequence of closed intervals then using the NIP. *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    32
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    33
section {* Closed Intervals *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    34
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    35
text {* This section formalises some properties of closed intervals. *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    36
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    37
subsection {* Definition *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    38
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    39
constdefs closed_int :: "real \<Rightarrow> real \<Rightarrow> real set"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    40
  "closed_int x y \<equiv> {z. x \<le> z \<and> z \<le> y}"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    41
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    42
subsection {* Properties *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    43
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    44
lemma closed_int_subset:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    45
  assumes xy: "x1 \<ge> x0" "y1 \<le> y0"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    46
  shows "closed_int x1 y1 \<subseteq> closed_int x0 y0"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    47
proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    48
  {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    49
    fix x::real
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    50
    assume "x \<in> closed_int x1 y1"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    51
    hence "x \<ge> x1 \<and> x \<le> y1" by (unfold closed_int_def, simp)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    52
    with xy have "x \<ge> x0 \<and> x \<le> y0" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    53
    hence "x \<in> closed_int x0 y0" by (unfold closed_int_def, simp)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    54
  }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    55
  thus ?thesis by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    56
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    57
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    58
lemma closed_int_least:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    59
  assumes a: "a \<le> b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    60
  shows "a \<in> closed_int a b \<and> (\<forall>x \<in> closed_int a b. a \<le> x)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    61
proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    62
  from a have "a\<in>{x. a\<le>x \<and> x\<le>b}" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    63
  thus "a \<in> closed_int a b" by (unfold closed_int_def)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    64
next
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    65
  have "\<forall>x\<in>{x. a\<le>x \<and> x\<le>b}. a\<le>x" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    66
  thus "\<forall>x \<in> closed_int a b. a \<le> x" by (unfold closed_int_def)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    67
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    68
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    69
lemma closed_int_most:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    70
  assumes a: "a \<le> b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    71
  shows "b \<in> closed_int a b \<and> (\<forall>x \<in> closed_int a b. x \<le> b)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    72
proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    73
  from a have "b\<in>{x. a\<le>x \<and> x\<le>b}" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    74
  thus "b \<in> closed_int a b" by (unfold closed_int_def)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    75
next
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    76
  have "\<forall>x\<in>{x. a\<le>x \<and> x\<le>b}. x\<le>b" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    77
  thus "\<forall>x \<in> closed_int a b. x\<le>b" by (unfold closed_int_def)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    78
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    79
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    80
lemma closed_not_empty:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    81
  shows "a \<le> b \<Longrightarrow> \<exists>x. x \<in> closed_int a b" 
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    82
  by (auto dest: closed_int_least)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    83
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    84
lemma closed_mem:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    85
  assumes "a \<le> c" and "c \<le> b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    86
  shows "c \<in> closed_int a b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    87
  by (unfold closed_int_def) auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    88
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    89
lemma closed_subset:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    90
  assumes ac: "a \<le> b"  "c \<le> d" 
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    91
  assumes closed: "closed_int a b \<subseteq> closed_int c d"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    92
  shows "b \<ge> c"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    93
proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    94
  from closed have "\<forall>x\<in>closed_int a b. x\<in>closed_int c d" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    95
  hence "\<forall>x. a\<le>x \<and> x\<le>b \<longrightarrow> c\<le>x \<and> x\<le>d" by (unfold closed_int_def, auto)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    96
  with ac have "c\<le>b \<and> b\<le>d" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    97
  thus ?thesis by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    98
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
    99
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   100
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   101
section {* Nested Interval Property *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   102
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   103
theorem NIP:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   104
  fixes f::"nat \<Rightarrow> real set"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   105
  assumes subset: "\<forall>n. f (Suc n) \<subseteq> f n"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   106
  and closed: "\<forall>n. \<exists>a b. f n = closed_int a b \<and> a \<le> b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   107
  shows "(\<Inter>n. f n) \<noteq> {}"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   108
proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   109
  let ?g = "\<lambda>n. (SOME c. c\<in>(f n) \<and> (\<forall>x\<in>(f n). c \<le> x))"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   110
  have ne: "\<forall>n. \<exists>x. x\<in>(f n)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   111
  proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   112
    fix n
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   113
    from closed have "\<exists>a b. f n = closed_int a b \<and> a \<le> b" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   114
    then obtain a and b where fn: "f n = closed_int a b \<and> a \<le> b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   115
    hence "a \<le> b" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   116
    with closed_not_empty have "\<exists>x. x\<in>closed_int a b" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   117
    with fn show "\<exists>x. x\<in>(f n)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   118
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   119
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   120
  have gdef: "\<forall>n. (?g n)\<in>(f n) \<and> (\<forall>x\<in>(f n). (?g n)\<le>x)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   121
  proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   122
    fix n
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   123
    from closed have "\<exists>a b. f n = closed_int a b \<and> a \<le> b" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   124
    then obtain a and b where ff: "f n = closed_int a b" and "a \<le> b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   125
    hence "a \<le> b" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   126
    hence "a\<in>closed_int a b \<and> (\<forall>x\<in>closed_int a b. a \<le> x)" by (rule closed_int_least)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   127
    with ff have "a\<in>(f n) \<and> (\<forall>x\<in>(f n). a \<le> x)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   128
    hence "\<exists>c. c\<in>(f n) \<and> (\<forall>x\<in>(f n). c \<le> x)" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   129
    thus "(?g n)\<in>(f n) \<and> (\<forall>x\<in>(f n). (?g n)\<le>x)" by (rule someI_ex)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   130
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   131
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   132
  -- "A denotes the set of all left-most points of all the intervals ..."
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   133
  moreover obtain A where Adef: "A = ?g ` \<nat>" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   134
  ultimately have "\<exists>x. x\<in>A"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   135
  proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   136
    have "(0::nat) \<in> \<nat>" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   137
    moreover have "?g 0 = ?g 0" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   138
    ultimately have "?g 0 \<in> ?g ` \<nat>" by (rule  rev_image_eqI)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   139
    with Adef have "?g 0 \<in> A" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   140
    thus ?thesis ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   141
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   142
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   143
  -- "Now show that A is bounded above ..."
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   144
  moreover have "\<exists>y. isUb (UNIV::real set) A y"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   145
  proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   146
    {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   147
      fix n
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   148
      from ne have ex: "\<exists>x. x\<in>(f n)" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   149
      from gdef have "(?g n)\<in>(f n) \<and> (\<forall>x\<in>(f n). (?g n)\<le>x)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   150
      moreover
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   151
      from closed have "\<exists>a b. f n = closed_int a b \<and> a \<le> b" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   152
      then obtain a and b where "f n = closed_int a b \<and> a \<le> b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   153
      hence "b\<in>(f n) \<and> (\<forall>x\<in>(f n). x \<le> b)" using closed_int_most by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   154
      ultimately have "\<forall>x\<in>(f n). (?g n) \<le> b" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   155
      with ex have "(?g n) \<le> b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   156
      hence "\<exists>b. (?g n) \<le> b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   157
    }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   158
    hence aux: "\<forall>n. \<exists>b. (?g n) \<le> b" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   159
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   160
    have fs: "\<forall>n::nat. f n \<subseteq> f 0"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   161
    proof (rule allI, induct_tac n)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   162
      show "f 0 \<subseteq> f 0" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   163
    next
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   164
      fix n
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   165
      assume "f n \<subseteq> f 0"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   166
      moreover from subset have "f (Suc n) \<subseteq> f n" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   167
      ultimately show "f (Suc n) \<subseteq> f 0" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   168
    qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   169
    have "\<forall>n. (?g n)\<in>(f 0)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   170
    proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   171
      fix n
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   172
      from gdef have "(?g n)\<in>(f n) \<and> (\<forall>x\<in>(f n). (?g n)\<le>x)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   173
      hence "?g n \<in> f n" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   174
      with fs show "?g n \<in> f 0" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   175
    qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   176
    moreover from closed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   177
      obtain a and b where "f 0 = closed_int a b" and alb: "a \<le> b" by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   178
    ultimately have "\<forall>n. ?g n \<in> closed_int a b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   179
    with alb have "\<forall>n. ?g n \<le> b" using closed_int_most by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   180
    with Adef have "\<forall>y\<in>A. y\<le>b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   181
    hence "A *<= b" by (unfold setle_def)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   182
    moreover have "b \<in> (UNIV::real set)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   183
    ultimately have "A *<= b \<and> b \<in> (UNIV::real set)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   184
    hence "isUb (UNIV::real set) A b" by (unfold isUb_def)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   185
    thus ?thesis by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   186
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   187
  -- "by the Axiom Of Completeness, A has a least upper bound ..."
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   188
  ultimately have "\<exists>t. isLub UNIV A t" by (rule reals_complete)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   189
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   190
  -- "denote this least upper bound as t ..."
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   191
  then obtain t where tdef: "isLub UNIV A t" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   192
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   193
  -- "and finally show that this least upper bound is in all the intervals..."
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   194
  have "\<forall>n. t \<in> f n"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   195
  proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   196
    fix n::nat
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   197
    from closed obtain a and b where
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   198
      int: "f n = closed_int a b" and alb: "a \<le> b" by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   199
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   200
    have "t \<ge> a"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   201
    proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   202
      have "a \<in> A"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   203
      proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   204
          (* by construction *)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   205
        from alb int have ain: "a\<in>f n \<and> (\<forall>x\<in>f n. a \<le> x)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   206
          using closed_int_least by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   207
        moreover have "\<forall>e. e\<in>f n \<and> (\<forall>x\<in>f n. e \<le> x) \<longrightarrow> e = a"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   208
        proof clarsimp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   209
          fix e
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   210
          assume ein: "e \<in> f n" and lt: "\<forall>x\<in>f n. e \<le> x"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   211
          from lt ain have aux: "\<forall>x\<in>f n. a \<le> x \<and> e \<le> x" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   212
  
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   213
          from ein aux have "a \<le> e \<and> e \<le> e" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   214
          moreover from ain aux have "a \<le> a \<and> e \<le> a" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   215
          ultimately show "e = a" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   216
        qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   217
        hence "\<And>e.  e\<in>f n \<and> (\<forall>x\<in>f n. e \<le> x) \<Longrightarrow> e = a" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   218
        ultimately have "(?g n) = a" by (rule some_equality)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   219
        moreover
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   220
        {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   221
          have "n = of_nat n" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   222
          moreover have "of_nat n \<in> \<nat>" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   223
          ultimately have "n \<in> \<nat>"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   224
            apply -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   225
            apply (subst(asm) eq_sym_conv)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   226
            apply (erule subst)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   227
            .
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   228
        }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   229
        with Adef have "(?g n) \<in> A" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   230
        ultimately show ?thesis by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   231
      qed 
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   232
      with tdef show "a \<le> t" by (rule isLubD2)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   233
    qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   234
    moreover have "t \<le> b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   235
    proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   236
      have "isUb UNIV A b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   237
      proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   238
        {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   239
          from alb int have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   240
            ain: "b\<in>f n \<and> (\<forall>x\<in>f n. x \<le> b)" using closed_int_most by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   241
          
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   242
          have subsetd: "\<forall>m. \<forall>n. f (n + m) \<subseteq> f n"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   243
          proof (rule allI, induct_tac m)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   244
            show "\<forall>n. f (n + 0) \<subseteq> f n" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   245
          next
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   246
            fix m n
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   247
            assume pp: "\<forall>p. f (p + n) \<subseteq> f p"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   248
            {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   249
              fix p
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   250
              from pp have "f (p + n) \<subseteq> f p" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   251
              moreover from subset have "f (Suc (p + n)) \<subseteq> f (p + n)" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   252
              hence "f (p + (Suc n)) \<subseteq> f (p + n)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   253
              ultimately have "f (p + (Suc n)) \<subseteq> f p" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   254
            }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   255
            thus "\<forall>p. f (p + Suc n) \<subseteq> f p" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   256
          qed 
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   257
          have subsetm: "\<forall>\<alpha> \<beta>. \<alpha> \<ge> \<beta> \<longrightarrow> (f \<alpha>) \<subseteq> (f \<beta>)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   258
          proof ((rule allI)+, rule impI)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   259
            fix \<alpha>::nat and \<beta>::nat
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   260
            assume "\<beta> \<le> \<alpha>"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   261
            hence "\<exists>k. \<alpha> = \<beta> + k" by (simp only: le_iff_add)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   262
            then obtain k where "\<alpha> = \<beta> + k" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   263
            moreover
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   264
            from subsetd have "f (\<beta> + k) \<subseteq> f \<beta>" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   265
            ultimately show "f \<alpha> \<subseteq> f \<beta>" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   266
          qed 
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   267
          
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   268
          fix m   
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   269
          {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   270
            assume "m \<ge> n"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   271
            with subsetm have "f m \<subseteq> f n" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   272
            with ain have "\<forall>x\<in>f m. x \<le> b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   273
            moreover
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   274
            from gdef have "?g m \<in> f m \<and> (\<forall>x\<in>f m. ?g m \<le> x)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   275
            ultimately have "?g m \<le> b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   276
          }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   277
          moreover
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   278
          {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   279
            assume "\<not>(m \<ge> n)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   280
            hence "m < n" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   281
            with subsetm have sub: "(f n) \<subseteq> (f m)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   282
            from closed obtain ma and mb where
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   283
              "f m = closed_int ma mb \<and> ma \<le> mb" by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   284
            hence one: "ma \<le> mb" and fm: "f m = closed_int ma mb" by auto 
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   285
            from one alb sub fm int have "ma \<le> b" using closed_subset by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   286
            moreover have "(?g m) = ma"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   287
            proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   288
              from gdef have "?g m \<in> f m \<and> (\<forall>x\<in>f m. ?g m \<le> x)" ..
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   289
              moreover from one have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   290
                "ma \<in> closed_int ma mb \<and> (\<forall>x\<in>closed_int ma mb. ma \<le> x)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   291
                by (rule closed_int_least)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   292
              with fm have "ma\<in>f m \<and> (\<forall>x\<in>f m. ma \<le> x)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   293
              ultimately have "ma \<le> ?g m \<and> ?g m \<le> ma" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   294
              thus "?g m = ma" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   295
            qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   296
            ultimately have "?g m \<le> b" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   297
          } 
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   298
          ultimately have "?g m \<le> b" by (rule case_split)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   299
        }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   300
        with Adef have "\<forall>y\<in>A. y\<le>b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   301
        hence "A *<= b" by (unfold setle_def)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   302
        moreover have "b \<in> (UNIV::real set)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   303
        ultimately have "A *<= b \<and> b \<in> (UNIV::real set)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   304
        thus "isUb (UNIV::real set) A b" by (unfold isUb_def)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   305
      qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   306
      with tdef show "t \<le> b" by (rule isLub_le_isUb)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   307
    qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   308
    ultimately have "t \<in> closed_int a b" by (rule closed_mem)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   309
    with int show "t \<in> f n" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   310
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   311
  hence "t \<in> (\<Inter>n. f n)" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   312
  thus ?thesis by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   313
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   314
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   315
section {* Generating the intervals *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   316
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   317
subsubsection {* Existence of non-singleton closed intervals *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   318
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   319
text {* This lemma asserts that given any non-singleton closed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   320
interval (a,b) and any element c, there exists a closed interval that
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   321
is a subset of (a,b) and that does not contain c and is a
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   322
non-singleton itself. *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   323
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   324
lemma closed_subset_ex:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   325
  fixes c::real
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   326
  assumes alb: "a < b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   327
  shows
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   328
    "\<exists>ka kb. ka < kb \<and> closed_int ka kb \<subseteq> closed_int a b \<and> c \<notin> (closed_int ka kb)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   329
proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   330
  {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   331
    assume clb: "c < b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   332
    {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   333
      assume cla: "c < a"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   334
      from alb cla clb have "c \<notin> closed_int a b" by (unfold closed_int_def, auto)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   335
      with alb have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   336
        "a < b \<and> closed_int a b \<subseteq> closed_int a b \<and> c \<notin> closed_int a b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   337
        by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   338
      hence
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   339
        "\<exists>ka kb. ka < kb \<and> closed_int ka kb \<subseteq> closed_int a b \<and> c \<notin> (closed_int ka kb)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   340
        by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   341
    }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   342
    moreover
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   343
    {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   344
      assume ncla: "\<not>(c < a)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   345
      with clb have cdef: "a \<le> c \<and> c < b" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   346
      obtain ka where kadef: "ka = (c + b)/2" by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   347
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   348
      from kadef clb have kalb: "ka < b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   349
      moreover from kadef cdef have kagc: "ka > c" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   350
      ultimately have "c\<notin>(closed_int ka b)" by (unfold closed_int_def, auto)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   351
      moreover from cdef kagc have "ka \<ge> a" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   352
      hence "closed_int ka b \<subseteq> closed_int a b" by (unfold closed_int_def, auto)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   353
      ultimately have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   354
        "ka < b  \<and> closed_int ka b \<subseteq> closed_int a b \<and> c \<notin> closed_int ka b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   355
        using kalb by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   356
      hence
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   357
        "\<exists>ka kb. ka < kb \<and> closed_int ka kb \<subseteq> closed_int a b \<and> c \<notin> (closed_int ka kb)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   358
        by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   359
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   360
    }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   361
    ultimately have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   362
      "\<exists>ka kb. ka < kb \<and> closed_int ka kb \<subseteq> closed_int a b \<and> c \<notin> (closed_int ka kb)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   363
      by (rule case_split)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   364
  }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   365
  moreover
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   366
  {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   367
    assume "\<not> (c < b)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   368
    hence cgeb: "c \<ge> b" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   369
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   370
    obtain kb where kbdef: "kb = (a + b)/2" by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   371
    with alb have kblb: "kb < b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   372
    with kbdef cgeb have "a < kb \<and> kb < c" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   373
    moreover hence "c \<notin> (closed_int a kb)" by (unfold closed_int_def, auto)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   374
    moreover from kblb have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   375
      "closed_int a kb \<subseteq> closed_int a b" by (unfold closed_int_def, auto)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   376
    ultimately have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   377
      "a < kb \<and>  closed_int a kb \<subseteq> closed_int a b \<and> c\<notin>closed_int a kb"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   378
      by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   379
    hence
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   380
      "\<exists>ka kb. ka < kb \<and> closed_int ka kb \<subseteq> closed_int a b \<and> c \<notin> (closed_int ka kb)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   381
      by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   382
  }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   383
  ultimately show ?thesis by (rule case_split)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   384
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   385
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   386
subsection {* newInt: Interval generation *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   387
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   388
text {* Given a function f:@{text "\<nat>\<Rightarrow>\<real>"}, newInt (Suc n) f returns a
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   389
closed interval such that @{text "newInt (Suc n) f \<subseteq> newInt n f"} and
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   390
does not contain @{text "f (Suc n)"}. With the base case defined such
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   391
that @{text "(f 0)\<notin>newInt 0 f"}. *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   392
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   393
subsubsection {* Definition *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   394
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   395
consts newInt :: "nat \<Rightarrow> (nat \<Rightarrow> real) \<Rightarrow> (real set)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   396
primrec
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   397
"newInt 0 f = closed_int (f 0 + 1) (f 0 + 2)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   398
"newInt (Suc n) f =
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   399
  (SOME e. (\<exists>e1 e2.
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   400
   e1 < e2 \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   401
   e = closed_int e1 e2 \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   402
   e \<subseteq> (newInt n f) \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   403
   (f (Suc n)) \<notin> e)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   404
  )"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   405
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   406
subsubsection {* Properties *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   407
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   408
text {* We now show that every application of newInt returns an
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   409
appropriate interval. *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   410
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   411
lemma newInt_ex:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   412
  "\<exists>a b. a < b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   413
   newInt (Suc n) f = closed_int a b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   414
   newInt (Suc n) f \<subseteq> newInt n f \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   415
   f (Suc n) \<notin> newInt (Suc n) f"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   416
proof (induct n)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   417
  case 0
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   418
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   419
  let ?e = "SOME e. \<exists>e1 e2.
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   420
   e1 < e2 \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   421
   e = closed_int e1 e2 \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   422
   e \<subseteq> closed_int (f 0 + 1) (f 0 + 2) \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   423
   f (Suc 0) \<notin> e"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   424
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   425
  have "newInt (Suc 0) f = ?e" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   426
  moreover
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   427
  have "f 0 + 1 < f 0 + 2" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   428
  with closed_subset_ex have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   429
    "\<exists>ka kb. ka < kb \<and> closed_int ka kb \<subseteq> closed_int (f 0 + 1) (f 0 + 2) \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   430
     f (Suc 0) \<notin> (closed_int ka kb)" .
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   431
  hence
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   432
    "\<exists>e. \<exists>ka kb. ka < kb \<and> e = closed_int ka kb \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   433
     e \<subseteq> closed_int (f 0 + 1) (f 0 + 2) \<and> f (Suc 0) \<notin> e" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   434
  hence
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   435
    "\<exists>ka kb. ka < kb \<and> ?e = closed_int ka kb \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   436
     ?e \<subseteq> closed_int (f 0 + 1) (f 0 + 2) \<and> f (Suc 0) \<notin> ?e"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   437
    by (rule someI_ex)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   438
  ultimately have "\<exists>e1 e2. e1 < e2 \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   439
   newInt (Suc 0) f = closed_int e1 e2 \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   440
   newInt (Suc 0) f \<subseteq> closed_int (f 0 + 1) (f 0 + 2) \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   441
   f (Suc 0) \<notin> newInt (Suc 0) f" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   442
  thus
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   443
    "\<exists>a b. a < b \<and> newInt (Suc 0) f = closed_int a b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   444
     newInt (Suc 0) f \<subseteq> newInt 0 f \<and> f (Suc 0) \<notin> newInt (Suc 0) f"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   445
    by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   446
next
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   447
  case (Suc n)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   448
  hence "\<exists>a b.
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   449
   a < b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   450
   newInt (Suc n) f = closed_int a b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   451
   newInt (Suc n) f \<subseteq> newInt n f \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   452
   f (Suc n) \<notin> newInt (Suc n) f" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   453
  then obtain a and b where ab: "a < b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   454
   newInt (Suc n) f = closed_int a b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   455
   newInt (Suc n) f \<subseteq> newInt n f \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   456
   f (Suc n) \<notin> newInt (Suc n) f" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   457
  hence cab: "closed_int a b = newInt (Suc n) f" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   458
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   459
  let ?e = "SOME e. \<exists>e1 e2.
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   460
    e1 < e2 \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   461
    e = closed_int e1 e2 \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   462
    e \<subseteq> closed_int a b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   463
    f (Suc (Suc n)) \<notin> e"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   464
  from cab have ni: "newInt (Suc (Suc n)) f = ?e" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   465
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   466
  from ab have "a < b" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   467
  with closed_subset_ex have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   468
    "\<exists>ka kb. ka < kb \<and> closed_int ka kb \<subseteq> closed_int a b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   469
     f (Suc (Suc n)) \<notin> closed_int ka kb" .
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   470
  hence
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   471
    "\<exists>e. \<exists>ka kb. ka < kb \<and> e = closed_int ka kb \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   472
     closed_int ka kb \<subseteq> closed_int a b \<and> f (Suc (Suc n)) \<notin> closed_int ka kb"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   473
    by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   474
  hence
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   475
    "\<exists>e.  \<exists>ka kb. ka < kb \<and> e = closed_int ka kb \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   476
     e \<subseteq> closed_int a b \<and> f (Suc (Suc n)) \<notin> e" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   477
  hence
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   478
    "\<exists>ka kb. ka < kb \<and> ?e = closed_int ka kb \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   479
     ?e \<subseteq> closed_int a b \<and> f (Suc (Suc n)) \<notin> ?e" by (rule someI_ex)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   480
  with ab ni show
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   481
    "\<exists>ka kb. ka < kb \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   482
     newInt (Suc (Suc n)) f = closed_int ka kb \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   483
     newInt (Suc (Suc n)) f \<subseteq> newInt (Suc n) f \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   484
     f (Suc (Suc n)) \<notin> newInt (Suc (Suc n)) f" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   485
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   486
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   487
lemma newInt_subset:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   488
  "newInt (Suc n) f \<subseteq> newInt n f"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   489
  using newInt_ex by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   490
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   491
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   492
text {* Another fundamental property is that no element in the range
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   493
of f is in the intersection of all closed intervals generated by
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   494
newInt. *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   495
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   496
lemma newInt_inter:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   497
  "\<forall>n. f n \<notin> (\<Inter>n. newInt n f)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   498
proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   499
  fix n::nat
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   500
  {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   501
    assume n0: "n = 0"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   502
    moreover have "newInt 0 f = closed_int (f 0 + 1) (f 0 + 2)" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   503
    ultimately have "f n \<notin> newInt n f" by (unfold closed_int_def, simp)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   504
  }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   505
  moreover
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   506
  {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   507
    assume "\<not> n = 0"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   508
    hence "n > 0" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   509
    then obtain m where ndef: "n = Suc m" by (auto simp add: gr0_conv_Suc)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   510
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   511
    from newInt_ex have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   512
      "\<exists>a b. a < b \<and> (newInt (Suc m) f) = closed_int a b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   513
       newInt (Suc m) f \<subseteq> newInt m f \<and> f (Suc m) \<notin> newInt (Suc m) f" .
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   514
    then have "f (Suc m) \<notin> newInt (Suc m) f" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   515
    with ndef have "f n \<notin> newInt n f" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   516
  }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   517
  ultimately have "f n \<notin> newInt n f" by (rule case_split)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   518
  thus "f n \<notin> (\<Inter>n. newInt n f)" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   519
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   520
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   521
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   522
lemma newInt_notempty:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   523
  "(\<Inter>n. newInt n f) \<noteq> {}"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   524
proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   525
  let ?g = "\<lambda>n. newInt n f"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   526
  have "\<forall>n. ?g (Suc n) \<subseteq> ?g n"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   527
  proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   528
    fix n
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   529
    show "?g (Suc n) \<subseteq> ?g n" by (rule newInt_subset)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   530
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   531
  moreover have "\<forall>n. \<exists>a b. ?g n = closed_int a b \<and> a \<le> b"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   532
  proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   533
    fix n::nat
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   534
    {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   535
      assume "n = 0"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   536
      then have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   537
        "?g n = closed_int (f 0 + 1) (f 0 + 2) \<and> (f 0 + 1 \<le> f 0 + 2)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   538
        by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   539
      hence "\<exists>a b. ?g n = closed_int a b \<and> a \<le> b" by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   540
    }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   541
    moreover
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   542
    {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   543
      assume "\<not> n = 0"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   544
      then have "n > 0" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   545
      then obtain m where nd: "n = Suc m" by (auto simp add: gr0_conv_Suc)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   546
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   547
      have
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   548
        "\<exists>a b. a < b \<and> (newInt (Suc m) f) = closed_int a b \<and>
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   549
        (newInt (Suc m) f) \<subseteq> (newInt m f) \<and> (f (Suc m)) \<notin> (newInt (Suc m) f)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   550
        by (rule newInt_ex)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   551
      then obtain a and b where
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   552
        "a < b \<and> (newInt (Suc m) f) = closed_int a b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   553
      with nd have "?g n = closed_int a b \<and> a \<le> b" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   554
      hence "\<exists>a b. ?g n = closed_int a b \<and> a \<le> b" by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   555
    }
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   556
    ultimately show "\<exists>a b. ?g n = closed_int a b \<and> a \<le> b" by (rule case_split)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   557
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   558
  ultimately show ?thesis by (rule NIP)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   559
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   560
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   561
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   562
section {* Final Theorem *}
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   563
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   564
theorem real_non_denum:
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   565
  shows "\<not> (\<exists>f::nat\<Rightarrow>real. surj f)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   566
proof -- "by contradiction"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   567
  assume "\<exists>f::nat\<Rightarrow>real. surj f"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   568
  then obtain f::"nat\<Rightarrow>real" where "surj f" by auto
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   569
  hence rangeF: "range f = UNIV" by (rule surj_range)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   570
  -- "We now produce a real number x that is not in the range of f, using the properties of newInt. "
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   571
  have "\<exists>x. x \<in> (\<Inter>n. newInt n f)" using newInt_notempty by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   572
  moreover have "\<forall>n. f n \<notin> (\<Inter>n. newInt n f)" by (rule newInt_inter)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   573
  ultimately obtain x where "x \<in> (\<Inter>n. newInt n f)" and "\<forall>n. f n \<noteq> x" by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   574
  moreover from rangeF have "x \<in> range f" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   575
  ultimately show False by blast
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   576
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   577
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
diff changeset
   578
end