src/HOL/Hyperreal/Lim.thy
author huffman
Thu, 09 Nov 2006 00:19:16 +0100
changeset 21257 b7f090c5057d
parent 21239 d4fbe2c87ef1
child 21282 dd647b4d7952
permissions -rw-r--r--
added LIM_norm and related lemmas
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     1
(*  Title       : Lim.thy
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
     2
    ID          : $Id$
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     3
    Author      : Jacques D. Fleuriot
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     4
    Copyright   : 1998  University of Cambridge
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
     5
    Conversion to Isar and new proofs by Lawrence C Paulson, 2004
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     6
*)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     7
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
     8
header{* Limits and Continuity *}
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     9
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15086
diff changeset
    10
theory Lim
15360
300e09825d8b Added "ALL x > y" and relatives.
nipkow
parents: 15251
diff changeset
    11
imports SEQ
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15086
diff changeset
    12
begin
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    13
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    14
text{*Standard and Nonstandard Definitions*}
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    15
19765
dfe940911617 misc cleanup;
wenzelm
parents: 19023
diff changeset
    16
definition
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    17
  LIM :: "['a::real_normed_vector => 'b::real_normed_vector, 'a, 'b] => bool"
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
    18
        ("((_)/ -- (_)/ --> (_))" [60, 0, 60] 60)
19765
dfe940911617 misc cleanup;
wenzelm
parents: 19023
diff changeset
    19
  "f -- a --> L =
20563
44eda2314aab replace (x + - y) with (x - y)
huffman
parents: 20561
diff changeset
    20
     (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & norm (x - a) < s
44eda2314aab replace (x + - y) with (x - y)
huffman
parents: 20561
diff changeset
    21
        --> norm (f x - L) < r)"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    22
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    23
  NSLIM :: "['a::real_normed_vector => 'b::real_normed_vector, 'a, 'b] => bool"
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
    24
            ("((_)/ -- (_)/ --NS> (_))" [60, 0, 60] 60)
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    25
  "f -- a --NS> L =
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    26
    (\<forall>x. (x \<noteq> star_of a & x @= star_of a --> ( *f* f) x @= star_of L))"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    27
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    28
  isCont :: "['a::real_normed_vector => 'b::real_normed_vector, 'a] => bool"
19765
dfe940911617 misc cleanup;
wenzelm
parents: 19023
diff changeset
    29
  "isCont f a = (f -- a --> (f a))"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    30
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    31
  isNSCont :: "['a::real_normed_vector => 'b::real_normed_vector, 'a] => bool"
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
    32
    --{*NS definition dispenses with limit notions*}
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    33
  "isNSCont f a = (\<forall>y. y @= star_of a -->
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    34
         ( *f* f) y @= star_of (f a))"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    35
20752
09cf0e407a45 generalize type of is(NS)UCont
huffman
parents: 20693
diff changeset
    36
  isUCont :: "['a::real_normed_vector => 'b::real_normed_vector] => bool"
09cf0e407a45 generalize type of is(NS)UCont
huffman
parents: 20693
diff changeset
    37
  "isUCont f = (\<forall>r>0. \<exists>s>0. \<forall>x y. norm (x - y) < s \<longrightarrow> norm (f x - f y) < r)"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    38
20752
09cf0e407a45 generalize type of is(NS)UCont
huffman
parents: 20693
diff changeset
    39
  isNSUCont :: "['a::real_normed_vector => 'b::real_normed_vector] => bool"
19765
dfe940911617 misc cleanup;
wenzelm
parents: 19023
diff changeset
    40
  "isNSUCont f = (\<forall>x y. x @= y --> ( *f* f) x @= ( *f* f) y)"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    41
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    42
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
    43
subsection {* Limits of Functions *}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    44
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
    45
subsubsection {* Purely standard proofs *}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    46
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    47
lemma LIM_eq:
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    48
     "f -- a --> L =
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    49
     (\<forall>r>0.\<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r)"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    50
by (simp add: LIM_def diff_minus)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    51
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    52
lemma LIM_I:
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    53
     "(!!r. 0<r ==> \<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r)
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    54
      ==> f -- a --> L"
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    55
by (simp add: LIM_eq)
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    56
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    57
lemma LIM_D:
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    58
     "[| f -- a --> L; 0<r |]
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    59
      ==> \<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    60
by (simp add: LIM_eq)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    61
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
    62
lemma LIM_offset: "f -- a --> L \<Longrightarrow> (\<lambda>x. f (x + k)) -- a - k --> L"
20756
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    63
apply (rule LIM_I)
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    64
apply (drule_tac r="r" in LIM_D, safe)
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    65
apply (rule_tac x="s" in exI, safe)
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    66
apply (drule_tac x="x + k" in spec)
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    67
apply (simp add: compare_rls)
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    68
done
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    69
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
    70
lemma LIM_offset_zero: "f -- a --> L \<Longrightarrow> (\<lambda>h. f (a + h)) -- 0 --> L"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
    71
by (drule_tac k="a" in LIM_offset, simp add: add_commute)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
    72
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
    73
lemma LIM_offset_zero_cancel: "(\<lambda>h. f (a + h)) -- 0 --> L \<Longrightarrow> f -- a --> L"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
    74
by (drule_tac k="- a" in LIM_offset, simp)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
    75
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
    76
lemma LIM_const [simp]: "(%x. k) -- x --> k"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    77
by (simp add: LIM_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    78
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    79
lemma LIM_add:
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    80
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    81
  assumes f: "f -- a --> L" and g: "g -- a --> M"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    82
  shows "(%x. f x + g(x)) -- a --> (L + M)"
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    83
proof (rule LIM_I)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    84
  fix r :: real
20409
eba80f91e3fc speed up some proofs
huffman
parents: 20254
diff changeset
    85
  assume r: "0 < r"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    86
  from LIM_D [OF f half_gt_zero [OF r]]
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    87
  obtain fs
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    88
    where fs:    "0 < fs"
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    89
      and fs_lt: "\<forall>x. x \<noteq> a & norm (x-a) < fs --> norm (f x - L) < r/2"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    90
  by blast
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    91
  from LIM_D [OF g half_gt_zero [OF r]]
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    92
  obtain gs
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    93
    where gs:    "0 < gs"
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    94
      and gs_lt: "\<forall>x. x \<noteq> a & norm (x-a) < gs --> norm (g x - M) < r/2"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    95
  by blast
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    96
  show "\<exists>s>0.\<forall>x. x \<noteq> a \<and> norm (x-a) < s \<longrightarrow> norm (f x + g x - (L + M)) < r"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    97
  proof (intro exI conjI strip)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    98
    show "0 < min fs gs"  by (simp add: fs gs)
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    99
    fix x :: 'a
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   100
    assume "x \<noteq> a \<and> norm (x-a) < min fs gs"
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   101
    hence "x \<noteq> a \<and> norm (x-a) < fs \<and> norm (x-a) < gs" by simp
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   102
    with fs_lt gs_lt
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   103
    have "norm (f x - L) < r/2" and "norm (g x - M) < r/2" by blast+
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   104
    hence "norm (f x - L) + norm (g x - M) < r" by arith
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   105
    thus "norm (f x + g x - (L + M)) < r"
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   106
      by (blast intro: norm_diff_triangle_ineq order_le_less_trans)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   107
  qed
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   108
qed
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   109
21257
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   110
lemma LIM_add_zero:
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   111
  "\<lbrakk>f -- a --> 0; g -- a --> 0\<rbrakk> \<Longrightarrow> (\<lambda>x. f x + g x) -- a --> 0"
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   112
by (drule (1) LIM_add, simp)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   113
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   114
lemma minus_diff_minus:
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   115
  fixes a b :: "'a::ab_group_add"
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   116
  shows "(- a) - (- b) = - (a - b)"
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   117
by simp
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   118
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   119
lemma LIM_minus: "f -- a --> L ==> (%x. -f(x)) -- a --> -L"
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   120
by (simp only: LIM_eq minus_diff_minus norm_minus_cancel)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   121
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   122
lemma LIM_add_minus:
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   123
    "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) + -g(x)) -- x --> (l + -m)"
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   124
by (intro LIM_add LIM_minus)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   125
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   126
lemma LIM_diff:
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   127
    "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) - g(x)) -- x --> l-m"
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   128
by (simp only: diff_minus LIM_add LIM_minus)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   129
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   130
lemma LIM_zero: "f -- a --> l \<Longrightarrow> (\<lambda>x. f x - l) -- a --> 0"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   131
by (simp add: LIM_def)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   132
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   133
lemma LIM_zero_cancel: "(\<lambda>x. f x - l) -- a --> 0 \<Longrightarrow> f -- a --> l"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   134
by (simp add: LIM_def)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   135
21257
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   136
lemma LIM_imp_LIM:
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   137
  assumes f: "f -- a --> l"
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   138
  assumes le: "\<And>x. x \<noteq> a \<Longrightarrow> norm (g x - m) \<le> norm (f x - l)"
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   139
  shows "g -- a --> m"
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   140
apply (rule LIM_I, drule LIM_D [OF f], safe)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   141
apply (rule_tac x="s" in exI, safe)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   142
apply (drule_tac x="x" in spec, safe)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   143
apply (erule (1) order_le_less_trans [OF le])
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   144
done
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   145
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   146
lemma LIM_norm: "f -- a --> l \<Longrightarrow> (\<lambda>x. norm (f x)) -- a --> norm l"
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   147
by (erule LIM_imp_LIM, simp add: norm_triangle_ineq3)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   148
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   149
lemma LIM_norm_zero: "f -- a --> 0 \<Longrightarrow> (\<lambda>x. norm (f x)) -- a --> 0"
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   150
by (drule LIM_norm, simp)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   151
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   152
lemma LIM_norm_zero_cancel: "(\<lambda>x. norm (f x)) -- a --> 0 \<Longrightarrow> f -- a --> 0"
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   153
by (erule LIM_imp_LIM, simp)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   154
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   155
lemma LIM_const_not_eq:
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   156
  fixes a :: "'a::real_normed_div_algebra"
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   157
  shows "k \<noteq> L ==> ~ ((%x. k) -- a --> L)"
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   158
apply (simp add: LIM_eq)
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   159
apply (rule_tac x="norm (k - L)" in exI, simp, safe)
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   160
apply (rule_tac x="a + of_real (s/2)" in exI, simp add: norm_of_real)
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   161
done
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   162
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   163
lemma LIM_const_eq:
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   164
  fixes a :: "'a::real_normed_div_algebra"
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   165
  shows "(%x. k) -- a --> L ==> k = L"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   166
apply (rule ccontr)
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   167
apply (blast dest: LIM_const_not_eq)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   168
done
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   169
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   170
lemma LIM_unique:
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   171
  fixes a :: "'a::real_normed_div_algebra"
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   172
  shows "[| f -- a --> L; f -- a --> M |] ==> L = M"
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   173
apply (drule LIM_diff, assumption)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   174
apply (auto dest!: LIM_const_eq)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   175
done
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   176
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   177
lemma LIM_mult_zero:
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   178
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   179
  assumes f: "f -- a --> 0" and g: "g -- a --> 0"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   180
  shows "(%x. f(x) * g(x)) -- a --> 0"
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   181
proof (rule LIM_I, simp)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   182
  fix r :: real
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   183
  assume r: "0<r"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   184
  from LIM_D [OF f zero_less_one]
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   185
  obtain fs
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   186
    where fs:    "0 < fs"
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   187
      and fs_lt: "\<forall>x. x \<noteq> a & norm (x-a) < fs --> norm (f x) < 1"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   188
  by auto
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   189
  from LIM_D [OF g r]
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   190
  obtain gs
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   191
    where gs:    "0 < gs"
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   192
      and gs_lt: "\<forall>x. x \<noteq> a & norm (x-a) < gs --> norm (g x) < r"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   193
  by auto
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   194
  show "\<exists>s. 0 < s \<and> (\<forall>x. x \<noteq> a \<and> norm (x-a) < s \<longrightarrow> norm (f x * g x) < r)"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   195
  proof (intro exI conjI strip)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   196
    show "0 < min fs gs"  by (simp add: fs gs)
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   197
    fix x :: 'a
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   198
    assume "x \<noteq> a \<and> norm (x-a) < min fs gs"
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   199
    hence  "x \<noteq> a \<and> norm (x-a) < fs \<and> norm (x-a) < gs" by simp
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   200
    with fs_lt gs_lt
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   201
    have "norm (f x) < 1" and "norm (g x) < r" by blast+
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   202
    hence "norm (f x) * norm (g x) < 1*r"
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   203
      by (rule mult_strict_mono' [OF _ _ norm_ge_zero norm_ge_zero])
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   204
    thus "norm (f x * g x) < r"
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   205
      by (simp add: order_le_less_trans [OF norm_mult_ineq])
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   206
  qed
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   207
qed
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   208
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   209
lemma LIM_self: "(%x. x) -- a --> a"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   210
by (auto simp add: LIM_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   211
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   212
text{*Limits are equal for functions equal except at limit point*}
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   213
lemma LIM_equal:
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   214
     "[| \<forall>x. x \<noteq> a --> (f x = g x) |] ==> (f -- a --> l) = (g -- a --> l)"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   215
by (simp add: LIM_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   216
20796
257e01fab4b7 generalize proofs of DERIV_isCont and DERIV_mult
huffman
parents: 20795
diff changeset
   217
lemma LIM_cong:
257e01fab4b7 generalize proofs of DERIV_isCont and DERIV_mult
huffman
parents: 20795
diff changeset
   218
  "\<lbrakk>a = b; \<And>x. x \<noteq> b \<Longrightarrow> f x = g x; l = m\<rbrakk>
257e01fab4b7 generalize proofs of DERIV_isCont and DERIV_mult
huffman
parents: 20795
diff changeset
   219
   \<Longrightarrow> (f -- a --> l) = (g -- b --> m)"
257e01fab4b7 generalize proofs of DERIV_isCont and DERIV_mult
huffman
parents: 20795
diff changeset
   220
by (simp add: LIM_def)
257e01fab4b7 generalize proofs of DERIV_isCont and DERIV_mult
huffman
parents: 20795
diff changeset
   221
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   222
text{*Two uses in Hyperreal/Transcendental.ML*}
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   223
lemma LIM_trans:
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   224
     "[| (%x. f(x) + -g(x)) -- a --> 0;  g -- a --> l |] ==> f -- a --> l"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   225
apply (drule LIM_add, assumption)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   226
apply (auto simp add: add_assoc)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   227
done
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   228
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   229
lemma LIM_compose:
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   230
  assumes g: "g -- l --> g l"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   231
  assumes f: "f -- a --> l"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   232
  shows "(\<lambda>x. g (f x)) -- a --> g l"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   233
proof (rule LIM_I)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   234
  fix r::real assume r: "0 < r"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   235
  obtain s where s: "0 < s"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   236
    and less_r: "\<And>y. \<lbrakk>y \<noteq> l; norm (y - l) < s\<rbrakk> \<Longrightarrow> norm (g y - g l) < r"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   237
    using LIM_D [OF g r] by fast
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   238
  obtain t where t: "0 < t"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   239
    and less_s: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < t\<rbrakk> \<Longrightarrow> norm (f x - l) < s"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   240
    using LIM_D [OF f s] by fast
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   241
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   242
  show "\<exists>t>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < t \<longrightarrow> norm (g (f x) - g l) < r"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   243
  proof (rule exI, safe)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   244
    show "0 < t" using t .
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   245
  next
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   246
    fix x assume "x \<noteq> a" and "norm (x - a) < t"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   247
    hence "norm (f x - l) < s" by (rule less_s)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   248
    thus "norm (g (f x) - g l) < r"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   249
      using r less_r by (case_tac "f x = l", simp_all)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   250
  qed
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   251
qed
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   252
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   253
lemma LIM_o: "\<lbrakk>g -- l --> g l; f -- a --> l\<rbrakk> \<Longrightarrow> (g \<circ> f) -- a --> g l"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   254
unfolding o_def by (rule LIM_compose)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   255
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   256
subsubsection {* Purely nonstandard proofs *}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   257
20754
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   258
lemma NSLIM_I:
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   259
  "(\<And>x. \<lbrakk>x \<noteq> star_of a; x \<approx> star_of a\<rbrakk> \<Longrightarrow> starfun f x \<approx> star_of L)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   260
   \<Longrightarrow> f -- a --NS> L"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   261
by (simp add: NSLIM_def)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   262
20754
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   263
lemma NSLIM_D:
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   264
  "\<lbrakk>f -- a --NS> L; x \<noteq> star_of a; x \<approx> star_of a\<rbrakk>
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   265
   \<Longrightarrow> starfun f x \<approx> star_of L"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   266
by (simp add: NSLIM_def)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   267
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   268
text{*Proving properties of limits using nonstandard definition.
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   269
      The properties hold for standard limits as well!*}
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   270
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   271
lemma NSLIM_mult:
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   272
  fixes l m :: "'a::real_normed_algebra"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   273
  shows "[| f -- x --NS> l; g -- x --NS> m |]
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   274
      ==> (%x. f(x) * g(x)) -- x --NS> (l * m)"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   275
by (auto simp add: NSLIM_def intro!: approx_mult_HFinite)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   276
20794
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   277
lemma starfun_scaleR [simp]:
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   278
  "starfun (\<lambda>x. f x *# g x) = (\<lambda>x. scaleHR (starfun f x) (starfun g x))"
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   279
by transfer (rule refl)
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   280
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   281
lemma NSLIM_scaleR:
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   282
  "[| f -- x --NS> l; g -- x --NS> m |]
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   283
      ==> (%x. f(x) *# g(x)) -- x --NS> (l *# m)"
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   284
by (auto simp add: NSLIM_def intro!: approx_scaleR_HFinite)
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   285
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   286
lemma NSLIM_add:
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   287
     "[| f -- x --NS> l; g -- x --NS> m |]
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   288
      ==> (%x. f(x) + g(x)) -- x --NS> (l + m)"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   289
by (auto simp add: NSLIM_def intro!: approx_add)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   290
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   291
lemma NSLIM_const [simp]: "(%x. k) -- x --NS> k"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   292
by (simp add: NSLIM_def)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   293
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   294
lemma NSLIM_minus: "f -- a --NS> L ==> (%x. -f(x)) -- a --NS> -L"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   295
by (simp add: NSLIM_def)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   296
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   297
lemma NSLIM_add_minus: "[| f -- x --NS> l; g -- x --NS> m |] ==> (%x. f(x) + -g(x)) -- x --NS> (l + -m)"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   298
by (simp only: NSLIM_add NSLIM_minus)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   299
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   300
lemma NSLIM_inverse:
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   301
  fixes L :: "'a::real_normed_div_algebra"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   302
  shows "[| f -- a --NS> L;  L \<noteq> 0 |]
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   303
      ==> (%x. inverse(f(x))) -- a --NS> (inverse L)"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   304
apply (simp add: NSLIM_def, clarify)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   305
apply (drule spec)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   306
apply (auto simp add: star_of_approx_inverse)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   307
done
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   308
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   309
lemma NSLIM_zero:
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   310
  assumes f: "f -- a --NS> l" shows "(%x. f(x) + -l) -- a --NS> 0"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   311
proof -
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   312
  have "(\<lambda>x. f x + - l) -- a --NS> l + -l"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   313
    by (rule NSLIM_add_minus [OF f NSLIM_const])
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   314
  thus ?thesis by simp
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   315
qed
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   316
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   317
lemma NSLIM_zero_cancel: "(%x. f(x) - l) -- x --NS> 0 ==> f -- x --NS> l"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   318
apply (drule_tac g = "%x. l" and m = l in NSLIM_add)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   319
apply (auto simp add: diff_minus add_assoc)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   320
done
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   321
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   322
lemma NSLIM_const_not_eq:
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   323
  fixes a :: real (* TODO: generalize to real_normed_div_algebra *)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   324
  shows "k \<noteq> L ==> ~ ((%x. k) -- a --NS> L)"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   325
apply (simp add: NSLIM_def)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   326
apply (rule_tac x="star_of a + epsilon" in exI)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   327
apply (auto intro: Infinitesimal_add_approx_self [THEN approx_sym]
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   328
            simp add: hypreal_epsilon_not_zero)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   329
done
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   330
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   331
lemma NSLIM_not_zero:
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   332
  fixes a :: real
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   333
  shows "k \<noteq> 0 ==> ~ ((%x. k) -- a --NS> 0)"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   334
by (rule NSLIM_const_not_eq)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   335
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   336
lemma NSLIM_const_eq:
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   337
  fixes a :: real
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   338
  shows "(%x. k) -- a --NS> L ==> k = L"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   339
apply (rule ccontr)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   340
apply (blast dest: NSLIM_const_not_eq)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   341
done
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   342
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   343
text{* can actually be proved more easily by unfolding the definition!*}
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   344
lemma NSLIM_unique:
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   345
  fixes a :: real
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   346
  shows "[| f -- a --NS> L; f -- a --NS> M |] ==> L = M"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   347
apply (drule NSLIM_minus)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   348
apply (drule NSLIM_add, assumption)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   349
apply (auto dest!: NSLIM_const_eq [symmetric])
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   350
apply (simp add: diff_def [symmetric])
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   351
done
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   352
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   353
lemma NSLIM_mult_zero:
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   354
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   355
  shows "[| f -- x --NS> 0; g -- x --NS> 0 |] ==> (%x. f(x)*g(x)) -- x --NS> 0"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   356
by (drule NSLIM_mult, auto)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   357
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   358
lemma NSLIM_self: "(%x. x) -- a --NS> a"
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   359
by (simp add: NSLIM_def)
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   360
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   361
subsubsection {* Equivalence of @{term LIM} and @{term NSLIM} *}
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   362
20754
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   363
lemma LIM_NSLIM:
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   364
  assumes f: "f -- a --> L" shows "f -- a --NS> L"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   365
proof (rule NSLIM_I)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   366
  fix x
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   367
  assume neq: "x \<noteq> star_of a"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   368
  assume approx: "x \<approx> star_of a"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   369
  have "starfun f x - star_of L \<in> Infinitesimal"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   370
  proof (rule InfinitesimalI2)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   371
    fix r::real assume r: "0 < r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   372
    from LIM_D [OF f r]
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   373
    obtain s where s: "0 < s" and
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   374
      less_r: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < s\<rbrakk> \<Longrightarrow> norm (f x - L) < r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   375
      by fast
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   376
    from less_r have less_r':
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   377
       "\<And>x. \<lbrakk>x \<noteq> star_of a; hnorm (x - star_of a) < star_of s\<rbrakk>
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   378
        \<Longrightarrow> hnorm (starfun f x - star_of L) < star_of r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   379
      by transfer
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   380
    from approx have "x - star_of a \<in> Infinitesimal"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   381
      by (unfold approx_def)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   382
    hence "hnorm (x - star_of a) < star_of s"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   383
      using s by (rule InfinitesimalD2)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   384
    with neq show "hnorm (starfun f x - star_of L) < star_of r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   385
      by (rule less_r')
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   386
  qed
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   387
  thus "starfun f x \<approx> star_of L"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   388
    by (unfold approx_def)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   389
qed
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   390
20754
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   391
lemma NSLIM_LIM:
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   392
  assumes f: "f -- a --NS> L" shows "f -- a --> L"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   393
proof (rule LIM_I)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   394
  fix r::real assume r: "0 < r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   395
  have "\<exists>s>0. \<forall>x. x \<noteq> star_of a \<and> hnorm (x - star_of a) < s
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   396
        \<longrightarrow> hnorm (starfun f x - star_of L) < star_of r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   397
  proof (rule exI, safe)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   398
    show "0 < epsilon" by (rule hypreal_epsilon_gt_zero)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   399
  next
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   400
    fix x assume neq: "x \<noteq> star_of a"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   401
    assume "hnorm (x - star_of a) < epsilon"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   402
    with Infinitesimal_epsilon
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   403
    have "x - star_of a \<in> Infinitesimal"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   404
      by (rule hnorm_less_Infinitesimal)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   405
    hence "x \<approx> star_of a"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   406
      by (unfold approx_def)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   407
    with f neq have "starfun f x \<approx> star_of L"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   408
      by (rule NSLIM_D)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   409
    hence "starfun f x - star_of L \<in> Infinitesimal"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   410
      by (unfold approx_def)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   411
    thus "hnorm (starfun f x - star_of L) < star_of r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   412
      using r by (rule InfinitesimalD2)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   413
  qed
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   414
  thus "\<exists>s>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < s \<longrightarrow> norm (f x - L) < r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   415
    by transfer
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   416
qed
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   417
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   418
theorem LIM_NSLIM_iff: "(f -- x --> L) = (f -- x --NS> L)"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   419
by (blast intro: LIM_NSLIM NSLIM_LIM)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   420
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   421
subsubsection {* Derived theorems about @{term LIM} *}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   422
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   423
lemma LIM_mult2:
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   424
  fixes l m :: "'a::real_normed_algebra"
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   425
  shows "[| f -- x --> l; g -- x --> m |]
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   426
      ==> (%x. f(x) * g(x)) -- x --> (l * m)"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   427
by (simp add: LIM_NSLIM_iff NSLIM_mult)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   428
20794
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   429
lemma LIM_scaleR:
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   430
  "[| f -- x --> l; g -- x --> m |]
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   431
      ==> (%x. f(x) *# g(x)) -- x --> (l *# m)"
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   432
by (simp add: LIM_NSLIM_iff NSLIM_scaleR)
02482f9501ac add scaleR lemmas
huffman
parents: 20793
diff changeset
   433
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   434
lemma LIM_add2:
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   435
     "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) + g(x)) -- x --> (l + m)"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   436
by (simp add: LIM_NSLIM_iff NSLIM_add)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   437
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   438
lemma LIM_const2: "(%x. k) -- x --> k"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   439
by (simp add: LIM_NSLIM_iff)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   440
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   441
lemma LIM_minus2: "f -- a --> L ==> (%x. -f(x)) -- a --> -L"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   442
by (simp add: LIM_NSLIM_iff NSLIM_minus)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   443
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   444
lemma LIM_add_minus2: "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) + -g(x)) -- x --> (l + -m)"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   445
by (simp add: LIM_NSLIM_iff NSLIM_add_minus)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   446
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   447
lemma LIM_inverse:
20653
24cda2c5fd40 removed division_by_zero class requirements from several lemmas
huffman
parents: 20635
diff changeset
   448
  fixes L :: "'a::real_normed_div_algebra"
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   449
  shows "[| f -- a --> L; L \<noteq> 0 |]
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   450
      ==> (%x. inverse(f(x))) -- a --> (inverse L)"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   451
by (simp add: LIM_NSLIM_iff NSLIM_inverse)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   452
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   453
lemma LIM_zero2: "f -- a --> l ==> (%x. f(x) + -l) -- a --> 0"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   454
by (simp add: LIM_NSLIM_iff NSLIM_zero)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   455
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   456
lemma LIM_unique2:
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   457
  fixes a :: real
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   458
  shows "[| f -- a --> L; f -- a --> M |] ==> L = M"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   459
by (simp add: LIM_NSLIM_iff NSLIM_unique)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   460
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   461
(* we can use the corresponding thm LIM_mult2 *)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   462
(* for standard definition of limit           *)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   463
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   464
lemma LIM_mult_zero2:
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   465
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra"
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   466
  shows "[| f -- x --> 0; g -- x --> 0 |] ==> (%x. f(x)*g(x)) -- x --> 0"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   467
by (drule LIM_mult2, auto)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   468
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   469
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   470
subsection {* Continuity *}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   471
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   472
subsubsection {* Purely standard proofs *}
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   473
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   474
lemma LIM_isCont_iff: "(f -- a --> f a) = ((\<lambda>h. f (a + h)) -- 0 --> f a)"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   475
by (rule iffI [OF LIM_offset_zero LIM_offset_zero_cancel])
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   476
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   477
lemma isCont_iff: "isCont f x = (\<lambda>h. f (x + h)) -- 0 --> f x"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   478
by (simp add: isCont_def LIM_isCont_iff)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   479
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   480
lemma isCont_Id: "isCont (\<lambda>x. x) a"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   481
unfolding isCont_def by (rule LIM_self)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   482
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   483
lemma isCont_const [simp]: "isCont (%x. k) a"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   484
unfolding isCont_def by (rule LIM_const)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   485
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   486
lemma isCont_add: "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x + g x) a"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   487
unfolding isCont_def by (rule LIM_add)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   488
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   489
lemma isCont_minus: "isCont f a \<Longrightarrow> isCont (\<lambda>x. - f x) a"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   490
unfolding isCont_def by (rule LIM_minus)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   491
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   492
lemma isCont_diff: "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x - g x) a"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   493
unfolding isCont_def by (rule LIM_diff)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   494
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   495
lemma isCont_mult:
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   496
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   497
  shows "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) * g(x)) a"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   498
unfolding isCont_def by (rule LIM_mult2)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   499
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   500
lemma isCont_inverse:
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   501
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_div_algebra"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   502
  shows "[| isCont f x; f x \<noteq> 0 |] ==> isCont (%x. inverse (f x)) x"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   503
unfolding isCont_def by (rule LIM_inverse)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   504
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   505
lemma isCont_LIM_compose:
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   506
  "\<lbrakk>isCont g l; f -- a --> l\<rbrakk> \<Longrightarrow> (\<lambda>x. g (f x)) -- a --> g l"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   507
unfolding isCont_def by (rule LIM_compose)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   508
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   509
lemma isCont_o2: "\<lbrakk>isCont f a; isCont g (f a)\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. g (f x)) a"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   510
unfolding isCont_def by (rule LIM_compose)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   511
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   512
lemma isCont_o: "\<lbrakk>isCont f a; isCont g (f a)\<rbrakk> \<Longrightarrow> isCont (g o f) a"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   513
unfolding o_def by (rule isCont_o2)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   514
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   515
subsubsection {* Nonstandard proofs *}
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   516
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   517
lemma isNSContD: "[| isNSCont f a; y \<approx> hypreal_of_real a |] ==> ( *f* f) y \<approx> hypreal_of_real (f a)"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   518
by (simp add: isNSCont_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   519
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   520
lemma isNSCont_NSLIM: "isNSCont f a ==> f -- a --NS> (f a) "
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   521
by (simp add: isNSCont_def NSLIM_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   522
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   523
lemma NSLIM_isNSCont: "f -- a --NS> (f a) ==> isNSCont f a"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   524
apply (simp add: isNSCont_def NSLIM_def, auto)
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   525
apply (case_tac "y = star_of a", auto)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   526
done
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   527
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   528
text{*NS continuity can be defined using NS Limit in
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   529
    similar fashion to standard def of continuity*}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   530
lemma isNSCont_NSLIM_iff: "(isNSCont f a) = (f -- a --NS> (f a))"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   531
by (blast intro: isNSCont_NSLIM NSLIM_isNSCont)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   532
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   533
text{*Hence, NS continuity can be given
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   534
  in terms of standard limit*}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   535
lemma isNSCont_LIM_iff: "(isNSCont f a) = (f -- a --> (f a))"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   536
by (simp add: LIM_NSLIM_iff isNSCont_NSLIM_iff)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   537
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   538
text{*Moreover, it's trivial now that NS continuity
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   539
  is equivalent to standard continuity*}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   540
lemma isNSCont_isCont_iff: "(isNSCont f a) = (isCont f a)"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   541
apply (simp add: isCont_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   542
apply (rule isNSCont_LIM_iff)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   543
done
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   544
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   545
text{*Standard continuity ==> NS continuity*}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   546
lemma isCont_isNSCont: "isCont f a ==> isNSCont f a"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   547
by (erule isNSCont_isCont_iff [THEN iffD2])
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   548
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   549
text{*NS continuity ==> Standard continuity*}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   550
lemma isNSCont_isCont: "isNSCont f a ==> isCont f a"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   551
by (erule isNSCont_isCont_iff [THEN iffD1])
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   552
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   553
text{*Alternative definition of continuity*}
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   554
(* Prove equivalence between NS limits - *)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   555
(* seems easier than using standard def  *)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   556
lemma NSLIM_h_iff: "(f -- a --NS> L) = ((%h. f(a + h)) -- 0 --NS> L)"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   557
apply (simp add: NSLIM_def, auto)
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   558
apply (drule_tac x = "star_of a + x" in spec)
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   559
apply (drule_tac [2] x = "- star_of a + x" in spec, safe, simp)
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   560
apply (erule mem_infmal_iff [THEN iffD2, THEN Infinitesimal_add_approx_self [THEN approx_sym]])
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   561
apply (erule_tac [3] approx_minus_iff2 [THEN iffD1])
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   562
 prefer 2 apply (simp add: add_commute diff_def [symmetric])
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   563
apply (rule_tac x = x in star_cases)
17318
bc1c75855f3d starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents: 17298
diff changeset
   564
apply (rule_tac [2] x = x in star_cases)
bc1c75855f3d starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents: 17298
diff changeset
   565
apply (auto simp add: starfun star_of_def star_n_minus star_n_add add_assoc approx_refl star_n_zero_num)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   566
done
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   567
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   568
lemma NSLIM_isCont_iff: "(f -- a --NS> f a) = ((%h. f(a + h)) -- 0 --NS> f a)"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   569
by (rule NSLIM_h_iff)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   570
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   571
lemma isNSCont_minus: "isNSCont f a ==> isNSCont (%x. - f x) a"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   572
by (simp add: isNSCont_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   573
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   574
lemma isNSCont_inverse:
20653
24cda2c5fd40 removed division_by_zero class requirements from several lemmas
huffman
parents: 20635
diff changeset
   575
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_div_algebra"
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   576
  shows "[| isNSCont f x; f x \<noteq> 0 |] ==> isNSCont (%x. inverse (f x)) x"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   577
by (auto intro: isCont_inverse simp add: isNSCont_isCont_iff)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   578
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   579
lemma isNSCont_const [simp]: "isNSCont (%x. k) a"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   580
by (simp add: isNSCont_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   581
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   582
lemma isNSCont_abs [simp]: "isNSCont abs (a::real)"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   583
apply (simp add: isNSCont_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   584
apply (auto intro: approx_hrabs simp add: hypreal_of_real_hrabs [symmetric] starfun_rabs_hrabs)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   585
done
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   586
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   587
lemma isCont_abs [simp]: "isCont abs (a::real)"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   588
by (auto simp add: isNSCont_isCont_iff [symmetric])
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   589
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   590
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   591
(****************************************************************
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   592
(%* Leave as commented until I add topology theory or remove? *%)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   593
(%*------------------------------------------------------------
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   594
  Elementary topology proof for a characterisation of
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   595
  continuity now: a function f is continuous if and only
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   596
  if the inverse image, {x. f(x) \<in> A}, of any open set A
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   597
  is always an open set
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   598
 ------------------------------------------------------------*%)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   599
Goal "[| isNSopen A; \<forall>x. isNSCont f x |]
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   600
               ==> isNSopen {x. f x \<in> A}"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   601
by (auto_tac (claset(),simpset() addsimps [isNSopen_iff1]));
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   602
by (dtac (mem_monad_approx RS approx_sym);
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   603
by (dres_inst_tac [("x","a")] spec 1);
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   604
by (dtac isNSContD 1 THEN assume_tac 1)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   605
by (dtac bspec 1 THEN assume_tac 1)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   606
by (dres_inst_tac [("x","( *f* f) x")] approx_mem_monad2 1);
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   607
by (blast_tac (claset() addIs [starfun_mem_starset]);
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   608
qed "isNSCont_isNSopen";
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   609
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   610
Goalw [isNSCont_def]
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   611
          "\<forall>A. isNSopen A --> isNSopen {x. f x \<in> A} \
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   612
\              ==> isNSCont f x";
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   613
by (auto_tac (claset() addSIs [(mem_infmal_iff RS iffD1) RS
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   614
     (approx_minus_iff RS iffD2)],simpset() addsimps
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   615
      [Infinitesimal_def,SReal_iff]));
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   616
by (dres_inst_tac [("x","{z. abs(z + -f(x)) < ya}")] spec 1);
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   617
by (etac (isNSopen_open_interval RSN (2,impE));
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   618
by (auto_tac (claset(),simpset() addsimps [isNSopen_def,isNSnbhd_def]));
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   619
by (dres_inst_tac [("x","x")] spec 1);
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   620
by (auto_tac (claset() addDs [approx_sym RS approx_mem_monad],
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   621
    simpset() addsimps [hypreal_of_real_zero RS sym,STAR_starfun_rabs_add_minus]));
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   622
qed "isNSopen_isNSCont";
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   623
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   624
Goal "(\<forall>x. isNSCont f x) = \
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   625
\     (\<forall>A. isNSopen A --> isNSopen {x. f(x) \<in> A})";
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   626
by (blast_tac (claset() addIs [isNSCont_isNSopen,
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   627
    isNSopen_isNSCont]);
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   628
qed "isNSCont_isNSopen_iff";
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   629
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   630
(%*------- Standard version of same theorem --------*%)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   631
Goal "(\<forall>x. isCont f x) = \
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   632
\         (\<forall>A. isopen A --> isopen {x. f(x) \<in> A})";
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   633
by (auto_tac (claset() addSIs [isNSCont_isNSopen_iff],
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   634
              simpset() addsimps [isNSopen_isopen_iff RS sym,
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   635
              isNSCont_isCont_iff RS sym]));
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   636
qed "isCont_isopen_iff";
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   637
*******************************************************************)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   638
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   639
subsection {* Uniform Continuity *}
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   640
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   641
lemma isNSUContD: "[| isNSUCont f; x \<approx> y|] ==> ( *f* f) x \<approx> ( *f* f) y"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   642
by (simp add: isNSUCont_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   643
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   644
lemma isUCont_isCont: "isUCont f ==> isCont f x"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   645
by (simp add: isUCont_def isCont_def LIM_def, meson)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   646
20754
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   647
lemma isUCont_isNSUCont:
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   648
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   649
  assumes f: "isUCont f" shows "isNSUCont f"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   650
proof (unfold isNSUCont_def, safe)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   651
  fix x y :: "'a star"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   652
  assume approx: "x \<approx> y"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   653
  have "starfun f x - starfun f y \<in> Infinitesimal"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   654
  proof (rule InfinitesimalI2)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   655
    fix r::real assume r: "0 < r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   656
    with f obtain s where s: "0 < s" and
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   657
      less_r: "\<And>x y. norm (x - y) < s \<Longrightarrow> norm (f x - f y) < r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   658
      by (auto simp add: isUCont_def)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   659
    from less_r have less_r':
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   660
       "\<And>x y. hnorm (x - y) < star_of s
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   661
        \<Longrightarrow> hnorm (starfun f x - starfun f y) < star_of r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   662
      by transfer
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   663
    from approx have "x - y \<in> Infinitesimal"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   664
      by (unfold approx_def)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   665
    hence "hnorm (x - y) < star_of s"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   666
      using s by (rule InfinitesimalD2)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   667
    thus "hnorm (starfun f x - starfun f y) < star_of r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   668
      by (rule less_r')
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   669
  qed
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   670
  thus "starfun f x \<approx> starfun f y"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   671
    by (unfold approx_def)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   672
qed
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   673
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   674
lemma isNSUCont_isUCont:
20754
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   675
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   676
  assumes f: "isNSUCont f" shows "isUCont f"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   677
proof (unfold isUCont_def, safe)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   678
  fix r::real assume r: "0 < r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   679
  have "\<exists>s>0. \<forall>x y. hnorm (x - y) < s
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   680
        \<longrightarrow> hnorm (starfun f x - starfun f y) < star_of r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   681
  proof (rule exI, safe)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   682
    show "0 < epsilon" by (rule hypreal_epsilon_gt_zero)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   683
  next
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   684
    fix x y :: "'a star"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   685
    assume "hnorm (x - y) < epsilon"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   686
    with Infinitesimal_epsilon
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   687
    have "x - y \<in> Infinitesimal"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   688
      by (rule hnorm_less_Infinitesimal)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   689
    hence "x \<approx> y"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   690
      by (unfold approx_def)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   691
    with f have "starfun f x \<approx> starfun f y"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   692
      by (simp add: isNSUCont_def)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   693
    hence "starfun f x - starfun f y \<in> Infinitesimal"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   694
      by (unfold approx_def)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   695
    thus "hnorm (starfun f x - starfun f y) < star_of r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   696
      using r by (rule InfinitesimalD2)
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   697
  qed
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   698
  thus "\<exists>s>0. \<forall>x y. norm (x - y) < s \<longrightarrow> norm (f x - f y) < r"
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   699
    by transfer
9c053a494dc6 add intro/dest rules for NSLIM; rewrite equivalence proofs using transfer
huffman
parents: 20752
diff changeset
   700
qed
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   701
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   702
subsection {* Relation of LIM and LIMSEQ *}
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   703
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   704
lemma LIMSEQ_SEQ_conv1:
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   705
  fixes a :: "'a::real_normed_vector"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   706
  assumes X: "X -- a --> L"
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   707
  shows "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   708
proof (safe intro!: LIMSEQ_I)
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   709
  fix S :: "nat \<Rightarrow> 'a"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   710
  fix r :: real
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   711
  assume rgz: "0 < r"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   712
  assume as: "\<forall>n. S n \<noteq> a"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   713
  assume S: "S ----> a"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   714
  from LIM_D [OF X rgz] obtain s
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   715
    where sgz: "0 < s"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   716
    and aux: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < s\<rbrakk> \<Longrightarrow> norm (X x - L) < r"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   717
    by fast
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   718
  from LIMSEQ_D [OF S sgz]
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   719
  obtain no where "\<forall>n\<ge>no. norm (S n - a) < s" by fast
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   720
  hence "\<forall>n\<ge>no. norm (X (S n) - L) < r" by (simp add: aux as)
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   721
  thus "\<exists>no. \<forall>n\<ge>no. norm (X (S n) - L) < r" ..
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   722
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   723
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   724
lemma LIMSEQ_SEQ_conv2:
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   725
  fixes a :: real
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   726
  assumes "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   727
  shows "X -- a --> L"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   728
proof (rule ccontr)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   729
  assume "\<not> (X -- a --> L)"
20563
44eda2314aab replace (x + - y) with (x - y)
huffman
parents: 20561
diff changeset
   730
  hence "\<not> (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & norm (x - a) < s --> norm (X x - L) < r)" by (unfold LIM_def)
44eda2314aab replace (x + - y) with (x - y)
huffman
parents: 20561
diff changeset
   731
  hence "\<exists>r > 0. \<forall>s > 0. \<exists>x. \<not>(x \<noteq> a \<and> \<bar>x - a\<bar> < s --> norm (X x - L) < r)" by simp
44eda2314aab replace (x + - y) with (x - y)
huffman
parents: 20561
diff changeset
   732
  hence "\<exists>r > 0. \<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x - a\<bar> < s \<and> norm (X x - L) \<ge> r)" by (simp add: linorder_not_less)
44eda2314aab replace (x + - y) with (x - y)
huffman
parents: 20561
diff changeset
   733
  then obtain r where rdef: "r > 0 \<and> (\<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x - a\<bar> < s \<and> norm (X x - L) \<ge> r))" by auto
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   734
20563
44eda2314aab replace (x + - y) with (x - y)
huffman
parents: 20561
diff changeset
   735
  let ?F = "\<lambda>n::nat. SOME x. x\<noteq>a \<and> \<bar>x - a\<bar> < inverse (real (Suc n)) \<and> norm (X x - L) \<ge> r"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   736
  have "\<And>n. \<exists>x. x\<noteq>a \<and> \<bar>x - a\<bar> < inverse (real (Suc n)) \<and> norm (X x - L) \<ge> r"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   737
    using rdef by simp
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   738
  hence F: "\<And>n. ?F n \<noteq> a \<and> \<bar>?F n - a\<bar> < inverse (real (Suc n)) \<and> norm (X (?F n) - L) \<ge> r"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   739
    by (rule someI_ex)
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   740
  hence F1: "\<And>n. ?F n \<noteq> a"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   741
    and F2: "\<And>n. \<bar>?F n - a\<bar> < inverse (real (Suc n))"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   742
    and F3: "\<And>n. norm (X (?F n) - L) \<ge> r"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   743
    by fast+
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   744
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   745
  have "?F ----> a"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   746
  proof (rule LIMSEQ_I, unfold real_norm_def)
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   747
      fix e::real
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   748
      assume "0 < e"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   749
        (* choose no such that inverse (real (Suc n)) < e *)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   750
      have "\<exists>no. inverse (real (Suc no)) < e" by (rule reals_Archimedean)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   751
      then obtain m where nodef: "inverse (real (Suc m)) < e" by auto
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   752
      show "\<exists>no. \<forall>n. no \<le> n --> \<bar>?F n - a\<bar> < e"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   753
      proof (intro exI allI impI)
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   754
        fix n
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   755
        assume mlen: "m \<le> n"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   756
        have "\<bar>?F n - a\<bar> < inverse (real (Suc n))"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   757
          by (rule F2)
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   758
        also have "inverse (real (Suc n)) \<le> inverse (real (Suc m))"
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   759
          by auto
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   760
        also from nodef have
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   761
          "inverse (real (Suc m)) < e" .
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   762
        finally show "\<bar>?F n - a\<bar> < e" .
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   763
      qed
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   764
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   765
  
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   766
  moreover have "\<forall>n. ?F n \<noteq> a"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   767
    by (rule allI) (rule F1)
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   768
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   769
  moreover from prems have "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   770
  ultimately have "(\<lambda>n. X (?F n)) ----> L" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   771
  
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   772
  moreover have "\<not> ((\<lambda>n. X (?F n)) ----> L)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   773
  proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   774
    {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   775
      fix no::nat
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   776
      obtain n where "n = no + 1" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   777
      then have nolen: "no \<le> n" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   778
        (* We prove this by showing that for any m there is an n\<ge>m such that |X (?F n) - L| \<ge> r *)
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   779
      have "norm (X (?F n) - L) \<ge> r"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   780
        by (rule F3)
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   781
      with nolen have "\<exists>n. no \<le> n \<and> norm (X (?F n) - L) \<ge> r" by fast
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   782
    }
20563
44eda2314aab replace (x + - y) with (x - y)
huffman
parents: 20561
diff changeset
   783
    then have "(\<forall>no. \<exists>n. no \<le> n \<and> norm (X (?F n) - L) \<ge> r)" by simp
44eda2314aab replace (x + - y) with (x - y)
huffman
parents: 20561
diff changeset
   784
    with rdef have "\<exists>e>0. (\<forall>no. \<exists>n. no \<le> n \<and> norm (X (?F n) - L) \<ge> e)" by auto
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   785
    thus ?thesis by (unfold LIMSEQ_def, auto simp add: linorder_not_less)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   786
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   787
  ultimately show False by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   788
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   789
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   790
lemma LIMSEQ_SEQ_conv:
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   791
  "(\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> (a::real) \<longrightarrow> (\<lambda>n. X (S n)) ----> L) =
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   792
   (X -- a --> L)"
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   793
proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   794
  assume "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   795
  show "X -- a --> L" by (rule LIMSEQ_SEQ_conv2)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   796
next
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   797
  assume "(X -- a --> L)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   798
  show "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by (rule LIMSEQ_SEQ_conv1)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   799
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   800
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   801
end