src/HOL/Nonstandard_Analysis/HLim.thy
author traytel
Fri, 28 Feb 2020 21:23:11 +0100
changeset 71494 cbe0b6b0bed8
parent 70723 4e39d87c9737
child 80914 d97fdabd9e2b
permissions -rw-r--r--
tuned lift_bnf's user interface for quotients
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
62479
716336f19aa9 clarified session;
wenzelm
parents: 61982
diff changeset
     1
(*  Title:      HOL/Nonstandard_Analysis/HLim.thy
41589
bbd861837ebc tuned headers;
wenzelm
parents: 37887
diff changeset
     2
    Author:     Jacques D. Fleuriot, University of Cambridge
bbd861837ebc tuned headers;
wenzelm
parents: 37887
diff changeset
     3
    Author:     Lawrence C Paulson
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     4
*)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     5
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
     6
section \<open>Limits and Continuity (Nonstandard)\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     7
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     8
theory HLim
63579
73939a9b70a3 support 'abbrevs' within theory header;
wenzelm
parents: 63040
diff changeset
     9
  imports Star
73939a9b70a3 support 'abbrevs' within theory header;
wenzelm
parents: 63040
diff changeset
    10
  abbrevs "--->" = "\<midarrow>\<rightarrow>\<^sub>N\<^sub>S"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    11
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    12
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    13
text \<open>Nonstandard Definitions.\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    14
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    15
definition NSLIM :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    16
    ("((_)/ \<midarrow>(_)/\<rightarrow>\<^sub>N\<^sub>S (_))" [60, 0, 60] 60)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    17
  where "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L \<longleftrightarrow> (\<forall>x. x \<noteq> star_of a \<and> x \<approx> star_of a \<longrightarrow> ( *f* f) x \<approx> star_of L)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    18
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    19
definition isNSCont :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a \<Rightarrow> bool"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    20
  where  \<comment> \<open>NS definition dispenses with limit notions\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    21
    "isNSCont f a \<longleftrightarrow> (\<forall>y. y \<approx> star_of a \<longrightarrow> ( *f* f) y \<approx> star_of (f a))"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    22
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    23
definition isNSUCont :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> bool"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    24
  where "isNSUCont f \<longleftrightarrow> (\<forall>x y. x \<approx> y \<longrightarrow> ( *f* f) x \<approx> ( *f* f) y)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    25
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    26
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61971
diff changeset
    27
subsection \<open>Limits of Functions\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    28
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    29
lemma NSLIM_I: "(\<And>x. x \<noteq> star_of a \<Longrightarrow> x \<approx> star_of a \<Longrightarrow> starfun f x \<approx> star_of L) \<Longrightarrow> f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    30
  by (simp add: NSLIM_def)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    31
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    32
lemma NSLIM_D: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L \<Longrightarrow> x \<noteq> star_of a \<Longrightarrow> x \<approx> star_of a \<Longrightarrow> starfun f x \<approx> star_of L"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    33
  by (simp add: NSLIM_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    34
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    35
text \<open>Proving properties of limits using nonstandard definition.
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    36
  The properties hold for standard limits as well!\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    37
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    38
lemma NSLIM_mult: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x * g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l * m)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    39
  for l m :: "'a::real_normed_algebra"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    40
  by (auto simp add: NSLIM_def intro!: approx_mult_HFinite)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    41
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    42
lemma starfun_scaleR [simp]: "starfun (\<lambda>x. f x *\<^sub>R g x) = (\<lambda>x. scaleHR (starfun f x) (starfun g x))"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    43
  by transfer (rule refl)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    44
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    45
lemma NSLIM_scaleR: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x *\<^sub>R g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l *\<^sub>R m)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    46
  by (auto simp add: NSLIM_def intro!: approx_scaleR_HFinite)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    47
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    48
lemma NSLIM_add: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x + g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l + m)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    49
  by (auto simp add: NSLIM_def intro!: approx_add)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    50
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    51
lemma NSLIM_const [simp]: "(\<lambda>x. k) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S k"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    52
  by (simp add: NSLIM_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    53
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    54
lemma NSLIM_minus: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L \<Longrightarrow> (\<lambda>x. - f x) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S -L"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    55
  by (simp add: NSLIM_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    56
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    57
lemma NSLIM_diff: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x - g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l - m)"
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 51525
diff changeset
    58
  by (simp only: NSLIM_add NSLIM_minus diff_conv_add_uminus)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    59
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    60
lemma NSLIM_add_minus: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x + - g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l + -m)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    61
  by (simp only: NSLIM_add NSLIM_minus)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    62
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    63
lemma NSLIM_inverse: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L \<Longrightarrow> L \<noteq> 0 \<Longrightarrow> (\<lambda>x. inverse (f x)) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S (inverse L)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    64
  for L :: "'a::real_normed_div_algebra"
70228
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    65
  unfolding NSLIM_def by (metis (no_types) star_of_approx_inverse star_of_simps(6) starfun_inverse)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    66
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    67
lemma NSLIM_zero:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    68
  assumes f: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S l"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    69
  shows "(\<lambda>x. f(x) - l) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S 0"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    70
proof -
61971
720fa884656e more symbols;
wenzelm
parents: 58878
diff changeset
    71
  have "(\<lambda>x. f x - l) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S l - l"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    72
    by (rule NSLIM_diff [OF f NSLIM_const])
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
    73
  then show ?thesis by simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    74
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    75
70228
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    76
lemma NSLIM_zero_cancel: 
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    77
  assumes "(\<lambda>x. f x - l) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    78
  shows "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    79
proof -
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    80
  have "(\<lambda>x. f x - l + l) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0 + l"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    81
    by (fast intro: assms NSLIM_const NSLIM_add)
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    82
  then show ?thesis
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    83
    by simp
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    84
qed
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    85
70228
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    86
lemma NSLIM_const_eq:
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    87
  fixes a :: "'a::real_normed_algebra_1"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    88
  assumes "(\<lambda>x. k) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S l"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    89
  shows "k = l"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    90
proof -
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    91
  have "\<not> (\<lambda>x. k) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S l" if "k \<noteq> l"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    92
  proof -
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    93
    have "star_of a + of_hypreal \<epsilon> \<approx> star_of a"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    94
      by (simp add: approx_def)
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    95
    then show ?thesis
70723
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70228
diff changeset
    96
      using epsilon_not_zero that by (force simp add: NSLIM_def)
70228
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    97
  qed
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    98
  with assms show ?thesis by metis
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
    99
qed
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   100
70228
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   101
lemma NSLIM_unique: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S M \<Longrightarrow> l = M"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   102
  for a :: "'a::real_normed_algebra_1"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   103
  by (drule (1) NSLIM_diff) (auto dest!: NSLIM_const_eq)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   104
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   105
lemma NSLIM_mult_zero: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0 \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0 \<Longrightarrow> (\<lambda>x. f x * g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   106
  for f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   107
  by (drule NSLIM_mult) auto
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   108
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   109
lemma NSLIM_self: "(\<lambda>x. x) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S a"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   110
  by (simp add: NSLIM_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   111
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   112
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 68611
diff changeset
   113
subsubsection \<open>Equivalence of \<^term>\<open>filterlim\<close> and \<^term>\<open>NSLIM\<close>\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   114
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   115
lemma LIM_NSLIM:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   116
  assumes f: "f \<midarrow>a\<rightarrow> L"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   117
  shows "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   118
proof (rule NSLIM_I)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   119
  fix x
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   120
  assume neq: "x \<noteq> star_of a"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   121
  assume approx: "x \<approx> star_of a"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   122
  have "starfun f x - star_of L \<in> Infinitesimal"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   123
  proof (rule InfinitesimalI2)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   124
    fix r :: real
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   125
    assume r: "0 < r"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   126
    from LIM_D [OF f r] obtain s
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   127
      where s: "0 < s" and less_r: "\<And>x. x \<noteq> a \<Longrightarrow> norm (x - a) < s \<Longrightarrow> norm (f x - L) < r"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   128
      by fast
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   129
    from less_r have less_r':
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   130
      "\<And>x. x \<noteq> star_of a \<Longrightarrow> hnorm (x - star_of a) < star_of s \<Longrightarrow>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   131
        hnorm (starfun f x - star_of L) < star_of r"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   132
      by transfer
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   133
    from approx have "x - star_of a \<in> Infinitesimal"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   134
      by (simp only: approx_def)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   135
    then have "hnorm (x - star_of a) < star_of s"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   136
      using s by (rule InfinitesimalD2)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   137
    with neq show "hnorm (starfun f x - star_of L) < star_of r"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   138
      by (rule less_r')
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   139
  qed
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   140
  then show "starfun f x \<approx> star_of L"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   141
    by (unfold approx_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   142
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   143
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   144
lemma NSLIM_LIM:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   145
  assumes f: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   146
  shows "f \<midarrow>a\<rightarrow> L"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   147
proof (rule LIM_I)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   148
  fix r :: real
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   149
  assume r: "0 < r"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   150
  have "\<exists>s>0. \<forall>x. x \<noteq> star_of a \<and> hnorm (x - star_of a) < s \<longrightarrow>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   151
    hnorm (starfun f x - star_of L) < star_of r"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   152
  proof (rule exI, safe)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   153
    show "0 < \<epsilon>"
70723
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70228
diff changeset
   154
      by (rule epsilon_gt_zero)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   155
  next
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   156
    fix x
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   157
    assume neq: "x \<noteq> star_of a"
61981
1b5845c62fa0 more symbols;
wenzelm
parents: 61976
diff changeset
   158
    assume "hnorm (x - star_of a) < \<epsilon>"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   159
    with Infinitesimal_epsilon have "x - star_of a \<in> Infinitesimal"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   160
      by (rule hnorm_less_Infinitesimal)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   161
    then have "x \<approx> star_of a"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   162
      by (unfold approx_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   163
    with f neq have "starfun f x \<approx> star_of L"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   164
      by (rule NSLIM_D)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   165
    then have "starfun f x - star_of L \<in> Infinitesimal"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   166
      by (unfold approx_def)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   167
    then show "hnorm (starfun f x - star_of L) < star_of r"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   168
      using r by (rule InfinitesimalD2)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   169
  qed
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   170
  then show "\<exists>s>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < s \<longrightarrow> norm (f x - L) < r"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   171
    by transfer
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   172
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   173
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   174
theorem LIM_NSLIM_iff: "f \<midarrow>x\<rightarrow> L \<longleftrightarrow> f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S L"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   175
  by (blast intro: LIM_NSLIM NSLIM_LIM)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   176
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   177
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61971
diff changeset
   178
subsection \<open>Continuity\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   179
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   180
lemma isNSContD: "isNSCont f a \<Longrightarrow> y \<approx> star_of a \<Longrightarrow> ( *f* f) y \<approx> star_of (f a)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   181
  by (simp add: isNSCont_def)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   182
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   183
lemma isNSCont_NSLIM: "isNSCont f a \<Longrightarrow> f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S (f a)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   184
  by (simp add: isNSCont_def NSLIM_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   185
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   186
lemma NSLIM_isNSCont: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S (f a) \<Longrightarrow> isNSCont f a"
70228
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   187
  by (force simp add: isNSCont_def NSLIM_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   188
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   189
text \<open>NS continuity can be defined using NS Limit in
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   190
  similar fashion to standard definition of continuity.\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   191
lemma isNSCont_NSLIM_iff: "isNSCont f a \<longleftrightarrow> f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S (f a)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   192
  by (blast intro: isNSCont_NSLIM NSLIM_isNSCont)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   193
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   194
text \<open>Hence, NS continuity can be given in terms of standard limit.\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   195
lemma isNSCont_LIM_iff: "(isNSCont f a) = (f \<midarrow>a\<rightarrow> (f a))"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   196
  by (simp add: LIM_NSLIM_iff isNSCont_NSLIM_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   197
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   198
text \<open>Moreover, it's trivial now that NS continuity
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   199
  is equivalent to standard continuity.\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   200
lemma isNSCont_isCont_iff: "isNSCont f a \<longleftrightarrow> isCont f a"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   201
  by (simp add: isCont_def) (rule isNSCont_LIM_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   202
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   203
text \<open>Standard continuity \<open>\<Longrightarrow>\<close> NS continuity.\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   204
lemma isCont_isNSCont: "isCont f a \<Longrightarrow> isNSCont f a"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   205
  by (erule isNSCont_isCont_iff [THEN iffD2])
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   206
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64435
diff changeset
   207
text \<open>NS continuity \<open>\<Longrightarrow>\<close> Standard continuity.\<close>
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64435
diff changeset
   208
lemma isNSCont_isCont: "isNSCont f a \<Longrightarrow> isCont f a"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   209
  by (erule isNSCont_isCont_iff [THEN iffD1])
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   210
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   211
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   212
text \<open>Alternative definition of continuity.\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   213
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   214
text \<open>Prove equivalence between NS limits --
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   215
  seems easier than using standard definition.\<close>
70228
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   216
lemma NSLIM_at0_iff: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L \<longleftrightarrow> (\<lambda>h. f (a + h)) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S L"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   217
proof
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   218
  assume "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   219
  then show "(\<lambda>h. f (a + h)) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S L"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   220
    by (simp add: NSLIM_def) (metis (no_types) add_cancel_left_right approx_add_left_iff starfun_lambda_cancel)
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   221
next
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   222
  assume *: "(\<lambda>h. f (a + h)) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S L"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   223
  show "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   224
  proof (clarsimp simp: NSLIM_def)
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   225
    fix x
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   226
    assume "x \<noteq> star_of a" "x \<approx> star_of a"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   227
    then have "(*f* (\<lambda>h. f (a + h))) (- star_of a + x) \<approx> star_of L"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   228
      by (metis (no_types, lifting) "*" NSLIM_D add.right_neutral add_minus_cancel approx_minus_iff2 star_zero_def)
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   229
    then show "(*f* f) x \<approx> star_of L"
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   230
      by (simp add: starfun_lambda_cancel)
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   231
  qed
2d5b122aa0ff De-applying and combining lemmas to make structured proofs
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   232
qed
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   233
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   234
lemma isNSCont_minus: "isNSCont f a \<Longrightarrow> isNSCont (\<lambda>x. - f x) a"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   235
  by (simp add: isNSCont_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   236
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   237
lemma isNSCont_inverse: "isNSCont f x \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow> isNSCont (\<lambda>x. inverse (f x)) x"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   238
  for f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_div_algebra"
68611
4bc4b5c0ccfc de-applying, etc.
paulson <lp15@cam.ac.uk>
parents: 66827
diff changeset
   239
  using NSLIM_inverse NSLIM_isNSCont isNSCont_NSLIM by blast
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   240
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   241
lemma isNSCont_const [simp]: "isNSCont (\<lambda>x. k) a"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   242
  by (simp add: isNSCont_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   243
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   244
lemma isNSCont_abs [simp]: "isNSCont abs a"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   245
  for a :: real
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   246
  by (auto simp: isNSCont_def intro: approx_hrabs simp: starfun_rabs_hrabs)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   247
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   248
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61971
diff changeset
   249
subsection \<open>Uniform Continuity\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   250
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   251
lemma isNSUContD: "isNSUCont f \<Longrightarrow> x \<approx> y \<Longrightarrow> ( *f* f) x \<approx> ( *f* f) y"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   252
  by (simp add: isNSUCont_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   253
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   254
lemma isUCont_isNSUCont:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   255
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   256
  assumes f: "isUCont f"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   257
  shows "isNSUCont f"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   258
  unfolding isNSUCont_def
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   259
proof safe
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   260
  fix x y :: "'a star"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   261
  assume approx: "x \<approx> y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   262
  have "starfun f x - starfun f y \<in> Infinitesimal"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   263
  proof (rule InfinitesimalI2)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   264
    fix r :: real
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   265
    assume r: "0 < r"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   266
    with f obtain s where s: "0 < s"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   267
      and less_r: "\<And>x y. norm (x - y) < s \<Longrightarrow> norm (f x - f y) < r"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 28562
diff changeset
   268
      by (auto simp add: isUCont_def dist_norm)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   269
    from less_r have less_r':
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   270
      "\<And>x y. hnorm (x - y) < star_of s \<Longrightarrow> hnorm (starfun f x - starfun f y) < star_of r"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   271
      by transfer
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   272
    from approx have "x - y \<in> Infinitesimal"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   273
      by (unfold approx_def)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   274
    then have "hnorm (x - y) < star_of s"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   275
      using s by (rule InfinitesimalD2)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   276
    then show "hnorm (starfun f x - starfun f y) < star_of r"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   277
      by (rule less_r')
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   278
  qed
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   279
  then show "starfun f x \<approx> starfun f y"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   280
    by (unfold approx_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   281
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   282
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   283
lemma isNSUCont_isUCont:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   284
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   285
  assumes f: "isNSUCont f"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   286
  shows "isUCont f"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   287
  unfolding isUCont_def dist_norm
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   288
proof safe
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   289
  fix r :: real
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   290
  assume r: "0 < r"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   291
  have "\<exists>s>0. \<forall>x y. hnorm (x - y) < s \<longrightarrow> hnorm (starfun f x - starfun f y) < star_of r"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   292
  proof (rule exI, safe)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   293
    show "0 < \<epsilon>"
70723
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70228
diff changeset
   294
      by (rule epsilon_gt_zero)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   295
  next
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   296
    fix x y :: "'a star"
61981
1b5845c62fa0 more symbols;
wenzelm
parents: 61976
diff changeset
   297
    assume "hnorm (x - y) < \<epsilon>"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   298
    with Infinitesimal_epsilon have "x - y \<in> Infinitesimal"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   299
      by (rule hnorm_less_Infinitesimal)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   300
    then have "x \<approx> y"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   301
      by (unfold approx_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   302
    with f have "starfun f x \<approx> starfun f y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   303
      by (simp add: isNSUCont_def)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   304
    then have "starfun f x - starfun f y \<in> Infinitesimal"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   305
      by (unfold approx_def)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   306
    then show "hnorm (starfun f x - starfun f y) < star_of r"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   307
      using r by (rule InfinitesimalD2)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   308
  qed
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63579
diff changeset
   309
  then show "\<exists>s>0. \<forall>x y. norm (x - y) < s \<longrightarrow> norm (f x - f y) < r"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   310
    by transfer
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   311
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   312
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   313
end