src/HOL/Real/Hyperreal/Lim.ML
author paulson
Wed, 13 Dec 2000 10:34:31 +0100
changeset 10659 58b6cfd8ecf3
parent 10648 a8c647cfa31f
child 10662 cf6be1804912
permissions -rw-r--r--
working proofs up to isCont_has_Ub
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
     1
(*  Title       : Lim.ML
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
     2
    Author      : Jacques D. Fleuriot
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
     3
    Copyright   : 1998  University of Cambridge
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
     4
    Description : Theory of limits, continuity and 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
     5
                  differentiation of real=>real functions
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
     6
*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
     7
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
     8
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
     9
fun ARITH_PROVE str = prove_goal thy str 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    10
                      (fn prems => [cut_facts_tac prems 1,arith_tac 1]);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    11
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    12
Goal "(x + - a = (#0::real)) = (x=a)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    13
by (arith_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    14
qed "real_add_minus_iff";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    15
Addsimps [real_add_minus_iff];
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    16
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    17
(*---------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    18
   Theory of limits, continuity and differentiation of 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    19
   real=>real functions 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    20
 ----------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    21
Goalw [LIM_def] "(f -- a --> L) = (ALL r. #0 < r --> \
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    22
\    (EX s. #0 < s & (ALL x. (x ~= a & (abs(x + -a) < s) \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    23
\          --> abs(f x + -L) < r))))";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    24
by Auto_tac;
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    25
qed "LIM_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    26
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    27
Goalw [LIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    28
      "!!a. [| f -- a --> L; #0 < r |] \
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    29
\           ==> (EX s. #0 < s & (ALL x. (x ~= a \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    30
\           & (abs(x + -a) < s) --> abs(f x + -L) < r)))";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    31
by Auto_tac;
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    32
qed "LIMD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    33
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    34
Goalw [LIM_def] "(%x. k) -- x --> k";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    35
by Auto_tac;
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    36
qed "LIM_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    37
Addsimps [LIM_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    38
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    39
(***-----------------------------------------------------------***)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    40
(***  Some Purely Standard Proofs - Can be used for comparison ***)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    41
(***-----------------------------------------------------------***)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    42
 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    43
(*--------------- 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    44
    LIM_add    
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    45
 ---------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    46
Goalw [LIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    47
     "[| f -- x --> l; g -- x --> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    48
\     ==> (%x. f(x) + g(x)) -- x --> (l + m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    49
by (Step_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
    50
by (REPEAT(dres_inst_tac [("x","r*inverse(#1 + #1)")] spec 1));
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
    51
by (dtac (rename_numerals (real_zero_less_two RS real_inverse_gt_zero 
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    52
          RSN (2,real_mult_less_mono2))) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    53
by (Asm_full_simp_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    54
by (Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    55
by (res_inst_tac [("R1.0","s"),("R2.0","sa")] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    56
    real_linear_less2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    57
by (res_inst_tac [("x","s")] exI 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    58
by (res_inst_tac [("x","sa")] exI 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    59
by (res_inst_tac [("x","sa")] exI 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    60
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    61
by (REPEAT(dres_inst_tac [("x","xa")] spec 1) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    62
    THEN step_tac (claset() addSEs [real_less_trans]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    63
by (REPEAT(dres_inst_tac [("x","xa")] spec 2) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    64
    THEN step_tac (claset() addSEs [real_less_trans]) 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    65
by (REPEAT(dres_inst_tac [("x","xa")] spec 3) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    66
    THEN step_tac (claset() addSEs [real_less_trans]) 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    67
by (ALLGOALS(rtac (abs_sum_triangle_ineq RS real_le_less_trans)));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    68
by (ALLGOALS(rtac (real_sum_of_halves RS subst)));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    69
by (auto_tac (claset() addIs [real_add_less_mono],simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    70
qed "LIM_add";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    71
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    72
Goalw [LIM_def] "f -- a --> L ==> (%x. -f(x)) -- a --> -L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    73
by (full_simp_tac (simpset() addsimps [real_minus_add_distrib RS sym,
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    74
                                       abs_minus_cancel] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    75
                    delsimps [real_minus_add_distrib,real_minus_minus]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    76
qed "LIM_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    77
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    78
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    79
     LIM_add_minus
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    80
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    81
Goal "[| f -- x --> l; g -- x --> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    82
\     ==> (%x. f(x) + -g(x)) -- x --> (l + -m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    83
by (blast_tac (claset() addDs [LIM_add,LIM_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    84
qed "LIM_add_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    85
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    86
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    87
     LIM_zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    88
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    89
Goal "f -- a --> l ==> (%x. f(x) + -l) -- a --> #0";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    90
by (res_inst_tac [("z1","l")] (rename_numerals (real_add_minus RS subst)) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    91
by (rtac LIM_add_minus 1 THEN Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    92
qed "LIM_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    93
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    94
(*--------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    95
   Limit not zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    96
 --------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    97
Goalw [LIM_def] "k ~= #0 ==> ~ ((%x. k) -- x --> #0)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    98
by (res_inst_tac [("R1.0","k"),("R2.0","#0")] real_linear_less2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    99
by (auto_tac (claset(),simpset() addsimps [abs_minus_eqI2,abs_eqI2]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   100
by (dtac (rename_numerals (real_minus_zero_less_iff RS iffD2)) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   101
by (res_inst_tac [("x","-k")] exI 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   102
by (res_inst_tac [("x","k")] exI 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   103
by Auto_tac;
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   104
by (ALLGOALS(dres_inst_tac [("y","s")] real_dense));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   105
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   106
by (ALLGOALS(res_inst_tac [("x","r + x")] exI));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   107
by (auto_tac (claset(),simpset() addsimps [real_add_assoc,abs_eqI2]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   108
qed "LIM_not_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   109
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   110
(* [| k ~= #0; (%x. k) -- x --> #0 |] ==> R *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   111
bind_thm("LIM_not_zeroE", (LIM_not_zero RS notE));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   112
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   113
Goal "(%x. k) -- x --> L ==> k = L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   114
by (rtac ccontr 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   115
by (dtac LIM_zero 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   116
by (rtac LIM_not_zeroE 1 THEN assume_tac 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   117
by (arith_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   118
qed "LIM_const_eq";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   119
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   120
(*------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   121
     Limit is Unique
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   122
 ------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   123
Goal "[| f -- x --> L; f -- x --> M |] ==> L = M";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   124
by (dtac LIM_minus 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   125
by (dtac LIM_add 1 THEN assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   126
by (auto_tac (claset() addSDs [LIM_const_eq RS sym],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   127
    simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   128
qed "LIM_unique";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   129
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   130
(*-------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   131
    LIM_mult_zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   132
 -------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   133
Goalw [LIM_def] "!!f. [| f -- x --> #0; g -- x --> #0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   134
\         ==> (%x. f(x)*g(x)) -- x --> #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   135
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   136
by (dres_inst_tac [("x","#1")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   137
by (dres_inst_tac [("x","r")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   138
by (cut_facts_tac [real_zero_less_one] 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   139
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   140
    [abs_mult]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   141
by (Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   142
by (res_inst_tac [("R1.0","s"),("R2.0","sa")] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   143
    real_linear_less2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   144
by (res_inst_tac [("x","s")] exI 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   145
by (res_inst_tac [("x","sa")] exI 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   146
by (res_inst_tac [("x","sa")] exI 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   147
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   148
by (REPEAT(dres_inst_tac [("x","xa")] spec 1) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   149
    THEN step_tac (claset() addSEs [real_less_trans]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   150
by (REPEAT(dres_inst_tac [("x","xa")] spec 2) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   151
    THEN step_tac (claset() addSEs [real_less_trans]) 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   152
by (REPEAT(dres_inst_tac [("x","xa")] spec 3) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   153
    THEN step_tac (claset() addSEs [real_less_trans]) 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   154
by (ALLGOALS(res_inst_tac [("t","r")] (real_mult_1 RS subst)));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   155
by (ALLGOALS(rtac abs_mult_less2));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   156
by Auto_tac;
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   157
qed "LIM_mult_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   158
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   159
Goalw [LIM_def] "(%x. x) -- a --> a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   160
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   161
qed "LIM_self";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   162
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   163
(*--------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   164
   Limits are equal for functions equal except at limit point
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   165
 --------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   166
Goalw [LIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   167
      "[| ALL x. x ~= a --> (f x = g x) |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   168
\           ==> (f -- a --> l) = (g -- a --> l)";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   169
by (auto_tac (claset(), simpset() addsimps [real_add_minus_iff]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   170
qed "LIM_equal";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   171
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   172
Goal "[| (%x. f(x) + -g(x)) -- a --> #0; \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   173
\        g -- a --> l |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   174
\      ==> f -- a --> l";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   175
by (dtac LIM_add 1 THEN assume_tac 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   176
by (auto_tac (claset(), simpset() addsimps [real_add_assoc]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   177
qed "LIM_trans";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   178
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   179
(***-------------------------------------------------------------***)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   180
(***           End of Purely Standard Proofs                     ***)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   181
(***-------------------------------------------------------------***)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   182
(*--------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   183
       Standard and NS definitions of Limit
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   184
 --------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   185
Goalw [LIM_def,NSLIM_def,inf_close_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   186
      "f -- x --> L ==> f -- x --NS> L";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   187
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   188
    (simpset() addsimps [Infinitesimal_FreeUltrafilterNat_iff]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   189
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   190
by (res_inst_tac [("z","xa")] eq_Abs_hypreal 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   191
by (auto_tac (claset(),
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   192
      simpset() addsimps [real_add_minus_iff,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   193
                          starfun, hypreal_minus,hypreal_of_real_minus RS sym,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   194
                          hypreal_of_real_def, hypreal_add]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   195
by (rtac bexI 1 THEN rtac lemma_hyprel_refl 2 THEN Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   196
by (dres_inst_tac [("x","u")] spec 1 THEN Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   197
by (dres_inst_tac [("x","s")] spec 1 THEN Clarify_tac 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   198
by (subgoal_tac "ALL n::nat. (xa n) ~= x & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   199
\                    abs ((xa n) + - x) < s --> abs (f (xa n) + - L) < u" 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   200
by (Blast_tac 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   201
by (dtac FreeUltrafilterNat_all 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   202
by (Ultra_tac 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   203
qed "LIM_NSLIM";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   204
 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   205
(*---------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   206
    Limit: NS definition ==> standard definition
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   207
 ---------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   208
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   209
Goal "ALL s. #0 < s --> (EX xa.  xa ~= x & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   210
\        abs (xa + - x) < s  & r <= abs (f xa + -L)) \
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   211
\     ==> ALL n::nat. EX xa.  xa ~= x & \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   212
\             abs(xa + -x) < inverse(real_of_posnat n) & r <= abs(f xa + -L)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   213
by (Step_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   214
by (cut_inst_tac [("n1","n")] (real_of_posnat_gt_zero RS real_inverse_gt_zero) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   215
by Auto_tac;
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   216
val lemma_LIM = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   217
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   218
Goal "ALL s. #0 < s --> (EX xa.  xa ~= x & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   219
\        abs (xa + - x) < s  & r <= abs (f xa + -L)) \
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   220
\     ==> EX X. ALL n::nat. X n ~= x & \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   221
\               abs(X n + -x) < inverse(real_of_posnat n) & r <= abs(f (X n) + -L)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   222
by (dtac lemma_LIM 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   223
by (dtac choice 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   224
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   225
val lemma_skolemize_LIM2 = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   226
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   227
Goal "!!X. ALL n. X n ~= x & \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   228
\         abs (X n + - x) < inverse (real_of_posnat  n) & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   229
\         r <= abs (f (X n) + - L) ==> \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   230
\         ALL n. abs (X n + - x) < inverse (real_of_posnat  n)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   231
by (Auto_tac );
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   232
val lemma_simp = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   233
 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   234
(*-------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   235
    NSLIM => LIM
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   236
 -------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   237
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   238
Goalw [LIM_def,NSLIM_def,inf_close_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   239
      "!!f. f -- x --NS> L ==> f -- x --> L";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   240
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   241
    (simpset() addsimps [Infinitesimal_FreeUltrafilterNat_iff]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   242
by (EVERY1[Step_tac, rtac ccontr, Asm_full_simp_tac]);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   243
by (fold_tac [real_le_def]);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   244
by (dtac lemma_skolemize_LIM2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   245
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   246
by (dres_inst_tac [("x","Abs_hypreal(hyprel^^{X})")] spec 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   247
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   248
    (simpset() addsimps [starfun,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   249
                         hypreal_minus,hypreal_of_real_minus RS sym,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   250
                         hypreal_of_real_def,hypreal_add]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   251
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   252
by (dtac (lemma_simp RS real_seq_to_hypreal_Infinitesimal) 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   253
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   254
    (simpset() addsimps 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   255
       [Infinitesimal_FreeUltrafilterNat_iff,hypreal_of_real_def,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   256
        hypreal_minus,hypreal_of_real_minus,hypreal_add]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   257
by (Blast_tac 1); 
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   258
by (rotate_tac 2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   259
by (dres_inst_tac [("x","r")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   260
by (Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   261
by (dtac FreeUltrafilterNat_all 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   262
by (Ultra_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   263
qed "NSLIM_LIM";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   264
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   265
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   266
(**** Key result ****)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   267
Goal "(f -- x --> L) = (f -- x --NS> L)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   268
by (blast_tac (claset() addIs [LIM_NSLIM,NSLIM_LIM]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   269
qed "LIM_NSLIM_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   270
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   271
(*-------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   272
(*   Proving properties of limits using nonstandard definition and   *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   273
(*   hence, the properties hold for standard limits as well          *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   274
(*-------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   275
(*------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   276
      NSLIM_mult and hence (trivially) LIM_mult
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   277
 ------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   278
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   279
Goalw [NSLIM_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   280
     "[| f -- x --NS> l; g -- x --NS> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   281
\     ==> (%x. f(x) * g(x)) -- x --NS> (l * m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   282
by (auto_tac (claset() addSIs [starfun_mult_HFinite_inf_close],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   283
              simpset() addsimps [hypreal_of_real_mult]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   284
qed "NSLIM_mult";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   285
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   286
Goal "[| f -- x --> l; g -- x --> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   287
\     ==> (%x. f(x) * g(x)) -- x --> (l * m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   288
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   289
    NSLIM_mult]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   290
qed "LIM_mult2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   291
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   292
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   293
      NSLIM_add and hence (trivially) LIM_add
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   294
      Note the much shorter proof
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   295
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   296
Goalw [NSLIM_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   297
     "[| f -- x --NS> l; g -- x --NS> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   298
\     ==> (%x. f(x) + g(x)) -- x --NS> (l + m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   299
by (auto_tac (claset() addSIs [starfun_add_inf_close],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   300
              simpset() addsimps [hypreal_of_real_add]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   301
qed "NSLIM_add";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   302
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   303
Goal "[| f -- x --> l; g -- x --> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   304
\     ==> (%x. f(x) + g(x)) -- x --> (l + m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   305
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   306
    NSLIM_add]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   307
qed "LIM_add2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   308
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   309
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   310
     NSLIM_const
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   311
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   312
Goalw [NSLIM_def] "(%x. k) -- x --NS> k";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   313
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   314
qed "NSLIM_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   315
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   316
Addsimps [NSLIM_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   317
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   318
Goal "(%x. k) -- x --> k";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   319
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   320
qed "LIM_const2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   321
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   322
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   323
     NSLIM_minus
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   324
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   325
Goalw [NSLIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   326
      "f -- a --NS> L ==> (%x. -f(x)) -- a --NS> -L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   327
by (auto_tac (claset() addIs [inf_close_minus],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   328
    simpset() addsimps [starfun_minus RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   329
    hypreal_of_real_minus]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   330
qed "NSLIM_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   331
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   332
Goal "f -- a --> L ==> (%x. -f(x)) -- a --> -L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   333
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   334
    NSLIM_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   335
qed "LIM_minus2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   336
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   337
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   338
     NSLIM_add_minus
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   339
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   340
Goal "!!f. [| f -- x --NS> l; g -- x --NS> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   341
\     ==> (%x. f(x) + -g(x)) -- x --NS> (l + -m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   342
by (blast_tac (claset() addDs [NSLIM_add,NSLIM_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   343
qed "NSLIM_add_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   344
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   345
Goal "!!f. [| f -- x --> l; g -- x --> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   346
\     ==> (%x. f(x) + -g(x)) -- x --> (l + -m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   347
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   348
    NSLIM_add_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   349
qed "LIM_add_minus2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   350
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   351
(*-----------------------------
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   352
    NSLIM_inverse
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   353
 -----------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   354
Goalw [NSLIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   355
      "!!f. [| f -- a --NS> L; \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   356
\              L ~= #0 \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   357
\           |] ==> (%x. inverse(f(x))) -- a --NS> (inverse L)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   358
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   359
by (dtac spec 1 THEN auto_tac (claset(),simpset() 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   360
    addsimps [hypreal_of_real_not_zero_iff RS sym,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   361
    hypreal_of_real_inverse RS sym]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   362
by (forward_tac [inf_close_hypreal_of_real_not_zero] 1 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   363
    THEN assume_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   364
by (auto_tac (claset() addSEs [(starfun_inverse2 RS subst),
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   365
    inf_close_inverse,hypreal_of_real_HFinite_diff_Infinitesimal],
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   366
    simpset()));
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   367
qed "NSLIM_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   368
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   369
Goal "[| f -- a --> L; \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   370
\        L ~= #0 |] ==> (%x. inverse(f(x))) -- a --> (inverse L)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   371
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   372
    NSLIM_inverse]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   373
qed "LIM_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   374
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   375
(*------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   376
    NSLIM_zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   377
 ------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   378
Goal "f -- a --NS> l ==> (%x. f(x) + -l) -- a --NS> #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   379
by (res_inst_tac [("z1","l")] (rename_numerals 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   380
    (real_add_minus RS subst)) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   381
by (rtac NSLIM_add_minus 1 THEN Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   382
qed "NSLIM_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   383
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   384
Goal "f -- a --> l ==> (%x. f(x) + -l) -- a --> #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   385
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   386
    NSLIM_zero]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   387
qed "LIM_zero2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   388
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   389
Goal "(%x. f(x) - l) -- x --NS> #0 ==> f -- x --NS> l";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   390
by (dres_inst_tac [("g","%x. l"),("m","l")] NSLIM_add 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   391
by (auto_tac (claset(),simpset() addsimps [real_diff_def,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   392
    real_add_assoc]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   393
qed "NSLIM_zero_cancel";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   394
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   395
Goal "(%x. f(x) - l) -- x --> #0 ==> f -- x --> l";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   396
by (dres_inst_tac [("g","%x. l"),("m","l")] LIM_add 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   397
by (auto_tac (claset(),simpset() addsimps [real_diff_def,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   398
    real_add_assoc]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   399
qed "LIM_zero_cancel";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   400
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   401
(*--------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   402
   NSLIM_not_zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   403
 --------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   404
Goalw [NSLIM_def] "k ~= #0 ==> ~ ((%x. k) -- x --NS> #0)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   405
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   406
by (res_inst_tac [("x","hypreal_of_real x + ehr")] exI 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   407
by (auto_tac (claset() addIs [Infinitesimal_add_inf_close_self 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   408
    RS inf_close_sym],simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   409
by (dres_inst_tac [("x1","-hypreal_of_real x")] (hypreal_add_left_cancel RS iffD2) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   410
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   411
    hypreal_epsilon_not_zero]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   412
qed "NSLIM_not_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   413
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   414
(* [| k ~= #0; (%x. k) -- x --NS> #0 |] ==> R *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   415
bind_thm("NSLIM_not_zeroE", (NSLIM_not_zero RS notE));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   416
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   417
Goal "k ~= #0 ==> ~ ((%x. k) -- x --> #0)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   418
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   419
    NSLIM_not_zero]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   420
qed "LIM_not_zero2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   421
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   422
(*-------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   423
   NSLIM of constant function
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   424
 -------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   425
Goal "(%x. k) -- x --NS> L ==> k = L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   426
by (rtac ccontr 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   427
by (dtac NSLIM_zero 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   428
by (rtac NSLIM_not_zeroE 1 THEN assume_tac 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   429
by (arith_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   430
qed "NSLIM_const_eq";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   431
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   432
Goal "(%x. k) -- x --> L ==> k = L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   433
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   434
    NSLIM_const_eq]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   435
qed "LIM_const_eq2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   436
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   437
(*------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   438
     NS Limit is Unique
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   439
 ------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   440
(* can actually be proved more easily by unfolding def! *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   441
Goal "[| f -- x --NS> L; f -- x --NS> M |] ==> L = M";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   442
by (dtac NSLIM_minus 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   443
by (dtac NSLIM_add 1 THEN assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   444
by (auto_tac (claset() addSDs [NSLIM_const_eq RS sym],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   445
    simpset() addsimps [real_add_minus]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   446
qed "NSLIM_unique";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   447
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   448
Goal "[| f -- x --> L; f -- x --> M |] ==> L = M";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   449
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   450
    NSLIM_unique]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   451
qed "LIM_unique2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   452
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   453
(*--------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   454
    NSLIM_mult_zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   455
 --------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   456
Goal "[| f -- x --NS> #0; g -- x --NS> #0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   457
\         ==> (%x. f(x)*g(x)) -- x --NS> #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   458
by (dtac NSLIM_mult 1 THEN Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   459
qed "NSLIM_mult_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   460
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   461
(* we can use the corresponding thm LIM_mult2 *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   462
(* for standard definition of limit           *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   463
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   464
Goal "[| f -- x --> #0; g -- x --> #0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   465
\     ==> (%x. f(x)*g(x)) -- x --> #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   466
by (dtac LIM_mult2 1 THEN Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   467
qed "LIM_mult_zero2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   468
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   469
(*----------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   470
    NSLIM_self
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   471
 ----------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   472
Goalw [NSLIM_def] "(%x. x) -- a --NS> a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   473
by (auto_tac (claset() addIs [starfun_Idfun_inf_close],simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   474
qed "NSLIM_self";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   475
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   476
Goal "(%x. x) -- a --> a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   477
by (simp_tac (simpset() addsimps [LIM_NSLIM_iff,NSLIM_self]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   478
qed "LIM_self2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   479
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   480
(*-----------------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   481
   Derivatives and Continuity - NS and Standard properties
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   482
 -----------------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   483
(*---------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   484
    Continuity 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   485
 ---------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   486
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   487
Goalw [isNSCont_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   488
      "!!f. [| isNSCont f a; y @= hypreal_of_real a |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   489
\           ==> (*f* f) y @= hypreal_of_real (f a)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   490
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   491
qed "isNSContD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   492
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   493
Goalw [isNSCont_def,NSLIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   494
      "!!f. isNSCont f a ==> f -- a --NS> (f a) ";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   495
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   496
qed "isNSCont_NSLIM";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   497
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   498
Goalw [isNSCont_def,NSLIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   499
      "!!f. f -- a --NS> (f a) ==> isNSCont f a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   500
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   501
by (res_inst_tac [("Q","y = hypreal_of_real a")] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   502
    (excluded_middle RS disjE) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   503
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   504
qed "NSLIM_isNSCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   505
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   506
(*-----------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   507
    NS continuity can be defined using NS Limit in
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   508
    similar fashion to standard def of continuity
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   509
 -----------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   510
Goal "(isNSCont f a) = (f -- a --NS> (f a))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   511
by (blast_tac (claset() addIs [isNSCont_NSLIM,NSLIM_isNSCont]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   512
qed "isNSCont_NSLIM_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   513
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   514
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   515
  Hence, NS continuity can be given
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   516
  in terms of standard limit
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   517
 ---------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   518
Goal "(isNSCont f a) = (f -- a --> (f a))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   519
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   520
    [LIM_NSLIM_iff,isNSCont_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   521
qed "isNSCont_LIM_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   522
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   523
(*-----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   524
  Moreover, it's trivial now that NS continuity 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   525
  is equivalent to standard continuity
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   526
 -----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   527
Goalw [isCont_def] "(isNSCont f a) = (isCont f a)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   528
by (rtac isNSCont_LIM_iff 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   529
qed "isNSCont_isCont_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   530
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   531
(*----------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   532
  Standard continuity ==> NS continuity 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   533
 ----------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   534
Goal "!!f. isCont f a ==> isNSCont f a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   535
by (etac (isNSCont_isCont_iff RS iffD2) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   536
qed "isCont_isNSCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   537
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   538
(*----------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   539
  NS continuity ==> Standard continuity 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   540
 ----------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   541
Goal "!!f. isNSCont f a ==> isCont f a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   542
by (etac (isNSCont_isCont_iff RS iffD1) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   543
qed "isNSCont_isCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   544
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   545
(*--------------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   546
                 Alternative definition of continuity
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   547
 --------------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   548
(* Prove equivalence between NS limits - *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   549
(* seems easier than using standard def  *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   550
Goalw [NSLIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   551
      "(f -- a --NS> L) = ((%h. f(a + h)) -- #0 --NS> L)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   552
by (auto_tac (claset(),simpset() addsimps [hypreal_of_real_zero]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   553
by (dres_inst_tac [("x","hypreal_of_real a + x")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   554
by (dres_inst_tac [("x","-hypreal_of_real a + x")] spec 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   555
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   556
by (dtac (sym RS (hypreal_eq_minus_iff4 RS iffD1)) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   557
by (rtac ((mem_infmal_iff RS iffD2) RS 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   558
    (Infinitesimal_add_inf_close_self RS inf_close_sym)) 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   559
by (rtac (inf_close_minus_iff2 RS iffD1) 5);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   560
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 4);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   561
by (dtac (sym RS (hypreal_eq_minus_iff RS iffD2)) 4);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   562
by (res_inst_tac [("z","x")] eq_Abs_hypreal 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   563
by (res_inst_tac [("z","x")] eq_Abs_hypreal 6);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   564
by (auto_tac (claset(),simpset() addsimps [starfun,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   565
    hypreal_of_real_def,hypreal_minus,hypreal_add,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   566
    real_add_assoc,inf_close_refl,hypreal_zero_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   567
qed "NSLIM_h_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   568
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   569
Goal "(f -- a --NS> f a) = ((%h. f(a + h)) -- #0 --NS> f a)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   570
by (rtac NSLIM_h_iff 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   571
qed "NSLIM_isCont_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   572
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   573
Goal "(f -- a --> f a) = ((%h. f(a + h)) -- #0 --> f(a))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   574
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   575
    NSLIM_isCont_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   576
qed "LIM_isCont_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   577
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   578
Goalw [isCont_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   579
      "(isCont f x) = ((%h. f(x + h)) -- #0 --> f(x))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   580
by (simp_tac (simpset() addsimps [LIM_isCont_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   581
qed "isCont_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   582
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   583
(*--------------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   584
   Immediate application of nonstandard criterion for continuity can offer 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   585
   very simple proofs of some standard property of continuous functions
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   586
 --------------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   587
(*------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   588
     sum continuous
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   589
 ------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   590
Goal "!!f. [| isCont f a; isCont g a |] ==> isCont (%x. f(x) + g(x)) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   591
by (auto_tac (claset() addIs [starfun_add_inf_close],simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   592
              [isNSCont_isCont_iff RS sym,isNSCont_def,hypreal_of_real_add]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   593
qed "isCont_add";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   594
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   595
(*------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   596
     mult continuous
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   597
 ------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   598
Goal "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) * g(x)) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   599
by (auto_tac (claset() addSIs [starfun_mult_HFinite_inf_close],simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   600
              [isNSCont_isCont_iff RS sym,isNSCont_def,hypreal_of_real_mult]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   601
qed "isCont_mult";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   602
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   603
(*-------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   604
     composition of continuous functions
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   605
     Note very short straightforard proof!
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   606
 ------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   607
Goal "[| isCont f a; isCont g (f a) |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   608
\     ==> isCont (g o f) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   609
by (auto_tac (claset(),simpset() addsimps [isNSCont_isCont_iff RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   610
              isNSCont_def,starfun_o RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   611
qed "isCont_o";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   612
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   613
Goal "[| isCont f a; isCont g (f a) |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   614
\     ==> isCont (%x. g (f x)) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   615
by (auto_tac (claset() addDs [isCont_o],simpset() addsimps [o_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   616
qed "isCont_o2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   617
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   618
Goalw [isNSCont_def] "isNSCont f a ==> isNSCont (%x. - f x) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   619
by (auto_tac (claset(),simpset() addsimps [starfun_minus RS sym, 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   620
    hypreal_of_real_minus])); 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   621
qed "isNSCont_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   622
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   623
Goal "isCont f a ==> isCont (%x. - f x) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   624
by (auto_tac (claset(),simpset() addsimps [isNSCont_isCont_iff RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   625
              isNSCont_minus]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   626
qed "isCont_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   627
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   628
Goalw [isCont_def]  
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   629
      "[| isCont f x; f x ~= #0 |] ==> isCont (%x. inverse (f x)) x";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   630
by (blast_tac (claset() addIs [LIM_inverse]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   631
qed "isCont_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   632
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   633
Goal "[| isNSCont f x; f x ~= #0 |] ==> isNSCont (%x. inverse (f x)) x";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   634
by (auto_tac (claset() addIs [isCont_inverse],simpset() addsimps 
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   635
    [isNSCont_isCont_iff]));
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   636
qed "isNSCont_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   637
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   638
Goalw [real_diff_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   639
      "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) - g(x)) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   640
by (auto_tac (claset() addIs [isCont_add,isCont_minus],simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   641
qed "isCont_diff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   642
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   643
Goalw [isCont_def]  "isCont (%x. k) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   644
by (Simp_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   645
qed "isCont_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   646
Addsimps [isCont_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   647
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   648
Goalw [isNSCont_def]  "isNSCont (%x. k) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   649
by (Simp_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   650
qed "isNSCont_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   651
Addsimps [isNSCont_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   652
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   653
Goalw [isNSCont_def]  "isNSCont abs a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   654
by (auto_tac (claset() addIs [inf_close_hrabs],simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   655
    [hypreal_of_real_hrabs RS sym,starfun_rabs_hrabs]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   656
qed "isNSCont_rabs";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   657
Addsimps [isNSCont_rabs];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   658
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   659
Goal "isCont abs a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   660
by (auto_tac (claset(),simpset() addsimps [isNSCont_isCont_iff RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   661
qed "isCont_rabs";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   662
Addsimps [isCont_rabs];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   663
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   664
(****************************************************************
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   665
(* Leave as commented until I add topology theory or remove? *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   666
(*------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   667
  Elementary topology proof for a characterisation of 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   668
  continuity now: a function f is continuous if and only 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   669
  if the inverse image, {x. f(x) : A}, of any open set A 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   670
  is always an open set
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   671
 ------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   672
Goal "!!A. [| isNSopen A; ALL x. isNSCont f x |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   673
\              ==> isNSopen {x. f x : A}";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   674
by (auto_tac (claset(),simpset() addsimps [isNSopen_iff1]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   675
by (dtac (mem_monad_inf_close RS inf_close_sym) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   676
by (dres_inst_tac [("x","a")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   677
by (dtac isNSContD 1 THEN assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   678
by (dtac bspec 1 THEN assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   679
by (dres_inst_tac [("x","( *f* f) x")] inf_close_mem_monad2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   680
by (blast_tac (claset() addIs [starfun_mem_starset]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   681
qed "isNSCont_isNSopen";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   682
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   683
Goalw [isNSCont_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   684
          "!!x. ALL A. isNSopen A --> isNSopen {x. f x : A} \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   685
\              ==> isNSCont f x";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   686
by (auto_tac (claset() addSIs [(mem_infmal_iff RS iffD1) RS 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   687
     (inf_close_minus_iff RS iffD2)],simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   688
      [Infinitesimal_def,SReal_iff]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   689
by (dres_inst_tac [("x","{z. abs(z + -f(x)) < ya}")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   690
by (etac (isNSopen_open_interval RSN (2,impE)) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   691
by (auto_tac (claset(),simpset() addsimps [isNSopen_def,isNSnbhd_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   692
by (dres_inst_tac [("x","x")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   693
by (auto_tac (claset() addDs [inf_close_sym RS inf_close_mem_monad],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   694
    simpset() addsimps [hypreal_of_real_zero RS sym,STAR_starfun_rabs_add_minus]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   695
qed "isNSopen_isNSCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   696
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   697
Goal "(ALL x. isNSCont f x) = \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   698
\     (ALL A. isNSopen A --> isNSopen {x. f(x) : A})";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   699
by (blast_tac (claset() addIs [isNSCont_isNSopen,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   700
    isNSopen_isNSCont]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   701
qed "isNSCont_isNSopen_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   702
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   703
(*------- Standard version of same theorem --------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   704
Goal "(ALL x. isCont f x) = \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   705
\         (ALL A. isopen A --> isopen {x. f(x) : A})";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   706
by (auto_tac (claset() addSIs [isNSCont_isNSopen_iff],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   707
              simpset() addsimps [isNSopen_isopen_iff RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   708
              isNSCont_isCont_iff RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   709
qed "isCont_isopen_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   710
*******************************************************************)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   711
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   712
(*-----------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   713
                        Uniform continuity
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   714
 ------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   715
Goalw [isNSUCont_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   716
      "[| isNSUCont f; x @= y|] ==> (*f* f) x @= (*f* f) y";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   717
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   718
qed "isNSUContD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   719
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   720
Goalw [isUCont_def,isCont_def,LIM_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   721
     "isUCont f ==> EX x. isCont f x";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   722
by (Force_tac 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   723
qed "isUCont_isCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   724
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   725
Goalw [isNSUCont_def,isUCont_def,inf_close_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   726
     "isUCont f ==> isNSUCont f";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   727
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   728
    [Infinitesimal_FreeUltrafilterNat_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   729
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   730
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   731
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   732
by (auto_tac (claset(),simpset() addsimps [starfun,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   733
    hypreal_minus, hypreal_add]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   734
by (rtac bexI 1 THEN rtac lemma_hyprel_refl 2 THEN Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   735
by (dres_inst_tac [("x","u")] spec 1 THEN Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   736
by (dres_inst_tac [("x","s")] spec 1 THEN Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   737
by (subgoal_tac "ALL n::nat. abs ((xa n) + - (xb n)) < s --> abs (f (xa n) + - f (xb n)) < u" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   738
by (Blast_tac 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   739
by (thin_tac "ALL x y. abs (x + - y) < s --> abs (f x + - f y) < u" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   740
by (dtac FreeUltrafilterNat_all 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   741
by (Ultra_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   742
qed "isUCont_isNSUCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   743
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   744
Goal "!!x. ALL s. #0 < s --> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   745
\              (EX xa y. abs (xa + - y) < s  & \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   746
\              r <= abs (f xa + -f y)) ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   747
\              ALL n::nat. EX xa y.  \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   748
\              abs(xa + -y) < inverse(real_of_posnat n) & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   749
\              r <= abs(f xa + -f y)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   750
by (Step_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   751
by (cut_inst_tac [("n1","n")] (real_of_posnat_gt_zero RS real_inverse_gt_zero) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   752
by Auto_tac;
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   753
val lemma_LIMu = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   754
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   755
Goal "!!x. ALL s. #0 < s --> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   756
\              (EX xa y. abs (xa + - y) < s  & \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   757
\              r <= abs (f xa + -f y)) ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   758
\              EX X Y. ALL n::nat. \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   759
\              abs(X n + -(Y n)) < inverse(real_of_posnat n) & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   760
\              r <= abs(f (X n) + -f (Y n))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   761
by (dtac lemma_LIMu 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   762
by (dtac choice 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   763
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   764
by (dtac choice 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   765
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   766
val lemma_skolemize_LIM2u = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   767
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   768
Goal "ALL n. abs (X n + -Y n) < inverse (real_of_posnat  n) & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   769
\         r <= abs (f (X n) + - f(Y n)) ==> \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   770
\         ALL n. abs (X n + - Y n) < inverse (real_of_posnat  n)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   771
by (Auto_tac );
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   772
val lemma_simpu = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   773
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   774
Goal "{n. f (X n) + - f(Y n) = Ya n} Int \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   775
\         {n. abs (X n + - Y n) < inverse (real_of_posnat  n) & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   776
\             r <= abs (f (X n) + - f(Y n))} <= \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   777
\         {n. r <= abs (Ya n)}";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   778
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   779
val lemma_Intu = result ();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   780
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   781
Goalw [isNSUCont_def,isUCont_def,inf_close_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   782
     "isNSUCont f ==> isUCont f";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   783
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   784
    [Infinitesimal_FreeUltrafilterNat_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   785
by (EVERY1[Step_tac, rtac ccontr, Asm_full_simp_tac]);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   786
by (fold_tac [real_le_def]);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   787
by (dtac lemma_skolemize_LIM2u 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   788
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   789
by (dres_inst_tac [("x","Abs_hypreal(hyprel^^{X})")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   790
by (dres_inst_tac [("x","Abs_hypreal(hyprel^^{Y})")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   791
by (asm_full_simp_tac (simpset() addsimps [starfun,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   792
    hypreal_minus,hypreal_add]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   793
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   794
by (dtac (lemma_simpu RS real_seq_to_hypreal_Infinitesimal2) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   795
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   796
    [Infinitesimal_FreeUltrafilterNat_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   797
     hypreal_minus,hypreal_add]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   798
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   799
by (rotate_tac 2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   800
by (dres_inst_tac [("x","r")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   801
by (Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   802
by (dtac FreeUltrafilterNat_all 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   803
by (Ultra_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   804
qed "isNSUCont_isUCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   805
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   806
(*------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   807
                         Derivatives
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   808
 ------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   809
Goalw [deriv_def] 
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   810
      "(DERIV f x :> D) = ((%h. (f(x + h) + - f(x))*inverse(h)) -- #0 --> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   811
by (Blast_tac 1);        
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   812
qed "DERIV_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   813
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   814
Goalw [deriv_def] 
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   815
      "(DERIV f x :> D) = ((%h. (f(x + h) + - f(x))*inverse(h)) -- #0 --NS> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   816
by (simp_tac (simpset() addsimps [LIM_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   817
qed "DERIV_NS_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   818
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   819
Goalw [deriv_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   820
      "DERIV f x :> D \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   821
\      ==> (%h. (f(x + h) + - f(x))*inverse(h)) -- #0 --> D";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   822
by (Blast_tac 1);        
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   823
qed "DERIVD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   824
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   825
Goalw [deriv_def] "DERIV f x :> D ==> \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   826
\          (%h. (f(x + h) + - f(x))*inverse(h)) -- #0 --NS> D";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   827
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   828
qed "NS_DERIVD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   829
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   830
(* Uniqueness *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   831
Goalw [deriv_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   832
      "!!f. [| DERIV f x :> D; DERIV f x :> E |] ==> D = E";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   833
by (blast_tac (claset() addIs [LIM_unique]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   834
qed "DERIV_unique";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   835
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   836
Goalw [nsderiv_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   837
     "!!f. [| NSDERIV f x :> D; NSDERIV f x :> E |] ==> D = E";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   838
by (cut_facts_tac [Infinitesimal_epsilon,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   839
             hypreal_epsilon_not_zero] 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   840
by (auto_tac (claset() addSDs [bspec] addSIs 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   841
   [inj_hypreal_of_real RS injD] addDs [inf_close_trans3],simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   842
qed "NSDeriv_unique";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   843
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   844
(*------------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   845
                          Differentiable
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   846
 ------------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   847
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   848
Goalw [differentiable_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   849
      "!!f. f differentiable x ==> EX D. DERIV f x :> D";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   850
by (assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   851
qed "differentiableD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   852
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   853
Goalw [differentiable_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   854
      "!!f. DERIV f x :> D ==> f differentiable x";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   855
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   856
qed "differentiableI";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   857
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   858
Goalw [NSdifferentiable_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   859
      "!!f. f NSdifferentiable x ==> EX D. NSDERIV f x :> D";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   860
by (assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   861
qed "NSdifferentiableD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   862
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   863
Goalw [NSdifferentiable_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   864
      "!!f. NSDERIV f x :> D ==> f NSdifferentiable x";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   865
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   866
qed "NSdifferentiableI";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   867
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   868
(*--------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   869
      Alternative definition for differentiability
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   870
 -------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   871
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   872
Goalw [LIM_def] 
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   873
 "((%h. (f(a + h) + - f(a))*inverse(h)) -- #0 --> D) = \
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   874
\ ((%x. (f(x) + -f(a))*inverse(x + -a)) -- a --> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   875
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   876
by (ALLGOALS(dtac spec));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   877
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   878
by (Blast_tac 1 THEN Blast_tac 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   879
by (ALLGOALS(res_inst_tac [("x","s")] exI));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   880
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   881
by (dres_inst_tac [("x","x + -a")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   882
by (dres_inst_tac [("x","x + a")] spec 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   883
by (auto_tac (claset(),simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   884
     real_add_ac));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   885
qed "DERIV_LIM_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   886
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   887
Goalw [deriv_def] "(DERIV f x :> D) = \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   888
\         ((%z. (f(z) + -f(x))*inverse(z + -x)) -- x --> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   889
by (simp_tac (simpset() addsimps [DERIV_LIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   890
qed "DERIV_iff2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   891
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   892
(*--------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   893
  Equivalence of NS and standard defs of differentiation
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   894
 -------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   895
(*-------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   896
   First NSDERIV in terms of NSLIM 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   897
 -------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   898
(*--- first equivalence ---*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   899
Goalw [nsderiv_def,NSLIM_def] 
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   900
      "(NSDERIV f x :> D) = ((%h. (f(x + h) + - f(x))*inverse(h)) -- #0 --NS> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   901
by (auto_tac (claset(),simpset() addsimps [hypreal_of_real_zero]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   902
by (dres_inst_tac [("x","xa")] bspec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   903
by (rtac ccontr 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   904
by (dres_inst_tac [("x","h")] spec 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   905
by (auto_tac (claset(),simpset() addsimps [mem_infmal_iff,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   906
    starfun_mult RS sym,starfun_inverse_inverse,starfun_add RS sym,
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   907
    hypreal_of_real_minus,starfun_lambda_cancel]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   908
qed "NSDERIV_NSLIM_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   909
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   910
(*--- second equivalence ---*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   911
Goal "(NSDERIV f x :> D) = \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   912
\         ((%z. (f(z) + -f(x))*inverse(z + -x)) -- x --NS> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   913
by (full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   914
    [NSDERIV_NSLIM_iff,DERIV_LIM_iff,LIM_NSLIM_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   915
qed "NSDERIV_NSLIM_iff2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   916
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   917
(* while we're at it! *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   918
Goalw [real_diff_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   919
     "(NSDERIV f x :> D) = \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   920
\     (ALL xa. \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   921
\       xa ~= hypreal_of_real x & xa @= hypreal_of_real x --> \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   922
\       (*f* (%z. (f z - f x) * inverse (z - x))) xa @= hypreal_of_real D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   923
by (auto_tac (claset(),simpset() addsimps [NSDERIV_NSLIM_iff2,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   924
    NSLIM_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   925
qed "NSDERIV_iff2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   926
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   927
Addsimps [inf_close_refl];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   928
Goal "(NSDERIV f x :> D) ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   929
\    (ALL xa. \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   930
\       xa @= hypreal_of_real x --> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   931
\       (*f* (%z. f z - f x)) xa @= hypreal_of_real D * (xa - hypreal_of_real x))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   932
by (auto_tac (claset(),simpset() addsimps [NSDERIV_iff2]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   933
by (case_tac "xa = hypreal_of_real x" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   934
by (auto_tac (claset(),simpset() addsimps [hypreal_diff_def,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   935
    hypreal_of_real_zero]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   936
by (dres_inst_tac [("x","xa")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   937
by Auto_tac;
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   938
by (dres_inst_tac [("c","xa - hypreal_of_real x"),("b","hypreal_of_real D")]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   939
     inf_close_mult1 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   940
by (ALLGOALS(dtac (hypreal_not_eq_minus_iff RS iffD1)));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   941
by (subgoal_tac "(*f* (%z. z - x)) xa ~= (0::hypreal)" 2);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   942
by (dtac (starfun_inverse2 RS sym) 2);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   943
by (auto_tac (claset() addDs [hypreal_mult_inverse_left],
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   944
    simpset() addsimps [starfun_mult RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   945
    hypreal_mult_assoc,starfun_add RS sym,real_diff_def,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   946
    starfun_Id,hypreal_of_real_minus,hypreal_diff_def,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   947
    (inf_close_minus_iff RS iffD1) RS (mem_infmal_iff RS iffD2), 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   948
    Infinitesimal_subset_HFinite RS subsetD]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   949
qed "NSDERIVD5";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   950
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   951
Goal "(NSDERIV f x :> D) ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   952
\     (ALL h: Infinitesimal. \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   953
\              ((*f* f)(hypreal_of_real x + h) - \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   954
\                hypreal_of_real (f x))@= (hypreal_of_real D) * h)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   955
by (auto_tac (claset(),simpset() addsimps [nsderiv_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   956
by (case_tac "h = (0::hypreal)" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   957
by (auto_tac (claset(),simpset() addsimps [hypreal_diff_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   958
by (dres_inst_tac [("x","h")] bspec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   959
by (dres_inst_tac [("c","h")] inf_close_mult1 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   960
by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   961
    simpset() addsimps [hypreal_mult_assoc,hypreal_diff_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   962
qed "NSDERIVD4";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   963
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   964
Goal "(NSDERIV f x :> D) ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   965
\     (ALL h: Infinitesimal - {0}. \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   966
\              ((*f* f)(hypreal_of_real x + h) - \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   967
\                hypreal_of_real (f x))@= (hypreal_of_real D) * h)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   968
by (auto_tac (claset(),simpset() addsimps [nsderiv_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   969
by (rtac ccontr 1 THEN dres_inst_tac [("x","h")] bspec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   970
by (dres_inst_tac [("c","h")] inf_close_mult1 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   971
by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   972
    simpset() addsimps [hypreal_mult_assoc,hypreal_diff_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   973
qed "NSDERIVD3";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   974
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   975
(*--------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   976
          Now equivalence between NSDERIV and DERIV
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   977
 -------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   978
Goalw [deriv_def] "(NSDERIV f x :> D) = (DERIV f x :> D)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   979
by (simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,LIM_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   980
qed "NSDERIV_DERIV_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   981
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   982
(*---------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   983
         Differentiability implies continuity 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   984
         nice and simple "algebraic" proof
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   985
 --------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   986
Goalw [nsderiv_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   987
      "NSDERIV f x :> D ==> isNSCont f x";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   988
by (auto_tac (claset(),simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   989
        [isNSCont_NSLIM_iff,NSLIM_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   990
by (dtac (inf_close_minus_iff RS iffD1) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   991
by (dtac (hypreal_not_eq_minus_iff RS iffD1) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   992
by (dres_inst_tac [("x","-hypreal_of_real x + xa")] bspec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   993
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   994
    [hypreal_add_assoc RS sym]) 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   995
by (auto_tac (claset(),simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   996
    [mem_infmal_iff RS sym,hypreal_add_commute]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   997
by (dres_inst_tac [("c","xa + -hypreal_of_real x")] inf_close_mult1 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   998
by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   999
    RS subsetD],simpset() addsimps [hypreal_mult_assoc]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1000
by (dres_inst_tac [("x3","D")] (HFinite_hypreal_of_real RSN
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1001
    (2,Infinitesimal_HFinite_mult) RS (mem_infmal_iff RS iffD1)) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1002
by (blast_tac (claset() addIs [inf_close_trans,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1003
    hypreal_mult_commute RS subst,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1004
    (inf_close_minus_iff RS iffD2)]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1005
qed "NSDERIV_isNSCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1006
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1007
(* Now Sandard proof *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1008
Goal "DERIV f x :> D ==> isCont f x";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1009
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1010
    [NSDERIV_DERIV_iff RS sym, isNSCont_isCont_iff RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1011
     NSDERIV_isNSCont]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1012
qed "DERIV_isCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1013
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1014
(*----------------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1015
      Differentiation rules for combinations of functions
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1016
      follow from clear, straightforard, algebraic 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1017
      manipulations
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1018
 ----------------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1019
(*-------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1020
    Constant function
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1021
 ------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1022
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1023
(* use simple constant nslimit theorem *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1024
Goal "(NSDERIV (%x. k) x :> #0)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1025
by (simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1026
    [NSDERIV_NSLIM_iff,real_add_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1027
qed "NSDERIV_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1028
Addsimps [NSDERIV_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1029
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1030
Goal "(DERIV (%x. k) x :> #0)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1031
by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1032
qed "DERIV_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1033
Addsimps [DERIV_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1034
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1035
(*-----------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1036
    Sum of functions- proved easily
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1037
 ----------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1038
Goal "[| NSDERIV f x :> Da; NSDERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1039
\     ==> NSDERIV (%x. f x + g x) x :> Da + Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1040
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1041
    NSLIM_def]) 1 THEN REPEAT(Step_tac 1));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1042
by (auto_tac (claset(),simpset() addsimps [starfun_add RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1043
    starfun_mult RS sym,hypreal_of_real_minus,hypreal_of_real_add,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1044
    hypreal_minus_add_distrib,hypreal_add_mult_distrib]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1045
by (thin_tac "xa @= hypreal_of_real #0" 1 THEN dtac inf_close_add 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1046
by (auto_tac (claset(),simpset() addsimps hypreal_add_ac));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1047
qed "NSDERIV_add";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1048
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1049
(* Standard theorem *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1050
Goal "[| DERIV f x :> Da; DERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1051
\     ==> DERIV (%x. f x + g x) x :> Da + Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1052
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_add,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1053
    NSDERIV_DERIV_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1054
qed "DERIV_add";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1055
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1056
(*-----------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1057
  Product of functions - Proof is trivial but tedious
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1058
  and long due to rearrangement of terms  
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1059
 ----------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1060
(* lemma - terms manipulation tedious as usual*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1061
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1062
Goal "((a::real)*b) + -(c*d) = (b*(a + -c)) + \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1063
\                           (c*(b + -d))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1064
by (full_simp_tac (simpset() addsimps [real_add_mult_distrib2,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1065
    real_minus_mult_eq2 RS sym,real_mult_commute]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1066
val lemma_nsderiv1 = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1067
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1068
Goal "[| (x + y) * inverse z = hypreal_of_real D + yb; z ~= 0; \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1069
\        z : Infinitesimal; yb : Infinitesimal |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1070
\     ==> x + y @= 0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1071
by (forw_inst_tac [("c1","z")] (hypreal_mult_right_cancel 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1072
               RS iffD2) 1 THEN assume_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1073
by (thin_tac "(x + y) * inverse z = hypreal_of_real  D + yb" 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1074
by (auto_tac (claset() addSIs [Infinitesimal_HFinite_mult2,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1075
              HFinite_add],simpset() addsimps [hypreal_mult_assoc,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1076
              mem_infmal_iff RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1077
by (etac (Infinitesimal_subset_HFinite RS subsetD) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1078
val lemma_nsderiv2 = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1079
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1080
Goal "[| NSDERIV f x :> Da; NSDERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1081
\     ==> NSDERIV (%x. f x * g x) x :> (Da * g(x)) + (Db * f(x))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1082
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1083
    NSLIM_def]) 1 THEN REPEAT(Step_tac 1));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1084
by (auto_tac (claset(),simpset() addsimps [starfun_mult RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1085
    starfun_add RS sym,starfun_lambda_cancel,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1086
    starfun_inverse_inverse,hypreal_of_real_zero,lemma_nsderiv1]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1087
by (simp_tac (simpset() addsimps [hypreal_add_mult_distrib]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1088
by (REPEAT(dtac (bex_Infinitesimal_iff2 RS iffD2) 1));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1089
by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1090
    hypreal_of_real_minus]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1091
by (dres_inst_tac [("D","Db")] lemma_nsderiv2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1092
by (dtac ((inf_close_minus_iff RS iffD2) RS 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1093
    (bex_Infinitesimal_iff2 RS iffD2)) 4);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1094
by (auto_tac (claset() addSIs [inf_close_add_mono1],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1095
    simpset() addsimps [hypreal_of_real_add,hypreal_add_mult_distrib,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1096
    hypreal_add_mult_distrib2,hypreal_of_real_mult,hypreal_mult_commute,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1097
    hypreal_add_assoc]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1098
by (res_inst_tac [("w1","hypreal_of_real Db * hypreal_of_real (f x)")]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1099
    (hypreal_add_commute RS subst) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1100
by (auto_tac (claset() addSIs [Infinitesimal_add_inf_close_self2 RS 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1101
    inf_close_sym,Infinitesimal_add,Infinitesimal_mult,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1102
    Infinitesimal_hypreal_of_real_mult,Infinitesimal_hypreal_of_real_mult2 ],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1103
    simpset() addsimps [hypreal_add_assoc RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1104
qed "NSDERIV_mult";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1105
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1106
Goal "[| DERIV f x :> Da; DERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1107
\     ==> DERIV (%x. f x * g x) x :> (Da * g(x)) + (Db * f(x))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1108
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_mult,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1109
    NSDERIV_DERIV_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1110
qed "DERIV_mult";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1111
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1112
(*----------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1113
   Multiplying by a constant
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1114
 ---------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1115
Goal "NSDERIV f x :> D \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1116
\     ==> NSDERIV (%x. c * f x) x :> c*D";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1117
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1118
    real_minus_mult_eq2,real_add_mult_distrib2 RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1119
    real_mult_assoc] delsimps [real_minus_mult_eq2 RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1120
by (etac (NSLIM_const RS NSLIM_mult) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1121
qed "NSDERIV_cmult";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1122
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1123
(* let's do the standard proof though theorem *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1124
(* LIM_mult2 follows from a NS proof          *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1125
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1126
Goalw [deriv_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1127
      "DERIV f x :> D \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1128
\      ==> DERIV (%x. c * f x) x :> c*D";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1129
by (asm_full_simp_tac (simpset() addsimps [
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1130
    real_minus_mult_eq2,real_add_mult_distrib2 RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1131
    real_mult_assoc] delsimps [real_minus_mult_eq2 RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1132
by (etac (LIM_const RS LIM_mult2) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1133
qed "DERIV_cmult";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1134
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1135
(*--------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1136
   Negation of function
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1137
 -------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1138
Goal "NSDERIV f x :> D \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1139
\      ==> NSDERIV (%x. -(f x)) x :> -D";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1140
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1141
by (res_inst_tac [("t","f x")] (real_minus_minus RS subst) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1142
by (asm_simp_tac (simpset() addsimps [real_minus_add_distrib RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1143
    real_minus_mult_eq1 RS sym] delsimps [real_minus_add_distrib,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1144
    real_minus_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1145
by (etac NSLIM_minus 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1146
qed "NSDERIV_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1147
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1148
Goal "DERIV f x :> D \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1149
\     ==> DERIV (%x. -(f x)) x :> -D";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1150
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1151
    [NSDERIV_minus,NSDERIV_DERIV_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1152
qed "DERIV_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1153
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1154
(*-------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1155
   Subtraction
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1156
 ------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1157
Goal "[| NSDERIV f x :> Da; NSDERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1158
\     ==> NSDERIV (%x. f x + -g x) x :> Da + -Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1159
by (blast_tac (claset() addDs [NSDERIV_add,NSDERIV_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1160
qed "NSDERIV_add_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1161
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1162
Goal "[| DERIV f x :> Da; DERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1163
\     ==> DERIV (%x. f x + -g x) x :> Da + -Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1164
by (blast_tac (claset() addDs [DERIV_add,DERIV_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1165
qed "DERIV_add_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1166
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1167
Goalw [real_diff_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1168
     "[| NSDERIV f x :> Da; NSDERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1169
\     ==> NSDERIV (%x. f x - g x) x :> Da - Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1170
by (blast_tac (claset() addIs [NSDERIV_add_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1171
qed "NSDERIV_diff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1172
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1173
Goalw [real_diff_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1174
     "[| DERIV f x :> Da; DERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1175
\      ==> DERIV (%x. f x - g x) x :> Da - Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1176
by (blast_tac (claset() addIs [DERIV_add_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1177
qed "DERIV_diff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1178
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1179
(*---------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1180
                     (NS) Increment
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1181
 ---------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1182
Goalw [increment_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1183
      "f NSdifferentiable x ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1184
\     increment f x h = (*f* f) (hypreal_of_real(x) + h) + \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1185
\     -hypreal_of_real (f x)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1186
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1187
qed "incrementI";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1188
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1189
Goal "NSDERIV f x :> D ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1190
\    increment f x h = (*f* f) (hypreal_of_real(x) + h) + \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1191
\    -hypreal_of_real (f x)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1192
by (etac (NSdifferentiableI RS incrementI) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1193
qed "incrementI2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1194
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1195
(* The Increment theorem -- Keisler p. 65 *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1196
Goal "[| NSDERIV f x :> D; h: Infinitesimal; h ~= 0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1197
\     ==> EX e: Infinitesimal. increment f x h = hypreal_of_real(D)*h + e*h";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1198
by (forw_inst_tac [("h","h")] incrementI2 1 THEN rewtac nsderiv_def);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1199
by (dtac bspec 1 THEN Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1200
by (dtac (bex_Infinitesimal_iff2 RS iffD2) 1 THEN Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1201
by (forw_inst_tac [("b1","hypreal_of_real(D) + y")] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1202
   (hypreal_mult_right_cancel RS iffD2) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1203
by (thin_tac "((*f* f) (hypreal_of_real(x) + h) + \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1204
\   - hypreal_of_real (f x)) * inverse h = hypreal_of_real(D) + y" 2);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1205
by (assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1206
by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1207
    hypreal_add_mult_distrib]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1208
qed "increment_thm";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1209
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1210
Goal "[| NSDERIV f x :> D; h @= 0; h ~= 0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1211
\      ==> EX e: Infinitesimal. increment f x h = \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1212
\             hypreal_of_real(D)*h + e*h";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1213
by (blast_tac (claset() addSDs [mem_infmal_iff RS iffD2] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1214
    addSIs [increment_thm]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1215
qed "increment_thm2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1216
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1217
Goal "[| NSDERIV f x :> D; h @= 0; h ~= 0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1218
\     ==> increment f x h @= 0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1219
by (dtac increment_thm2 1 THEN auto_tac (claset() addSIs 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1220
    [Infinitesimal_HFinite_mult2,HFinite_add],simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1221
    [hypreal_add_mult_distrib RS sym,mem_infmal_iff RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1222
by (etac (Infinitesimal_subset_HFinite RS subsetD) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1223
qed "increment_inf_close_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1224
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1225
(*---------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1226
   Similarly to the above, the chain rule admits an entirely
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1227
   straightforward derivation. Compare this with Harrison's
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1228
   HOL proof of the chain rule, which proved to be trickier and
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1229
   required an alternative characterisation of differentiability- 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1230
   the so-called Carathedory derivative. Our main problem is
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1231
   manipulation of terms.
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1232
 --------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1233
(* lemmas *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1234
Goalw [nsderiv_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1235
      "!!f. [| NSDERIV g x :> D; \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1236
\              (*f* g) (hypreal_of_real(x) + xa) = hypreal_of_real(g x);\
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1237
\              xa : Infinitesimal;\
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1238
\              xa ~= 0 \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1239
\           |] ==> D = #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1240
by (dtac bspec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1241
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1242
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1243
    [hypreal_of_real_zero RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1244
qed "NSDERIV_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1245
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1246
(* can be proved differently using NSLIM_isCont_iff *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1247
Goalw [nsderiv_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1248
      "!!f. [| NSDERIV f x :> D; \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1249
\              h: Infinitesimal; h ~= 0 \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1250
\           |] ==> (*f* f) (hypreal_of_real(x) + h) + -hypreal_of_real(f x) @= 0";    
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1251
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1252
    [mem_infmal_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1253
by (rtac Infinitesimal_ratio 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1254
by (rtac inf_close_hypreal_of_real_HFinite 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1255
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1256
qed "NSDERIV_inf_close";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1257
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1258
(*--------------------------------------------------------------- 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1259
   from one version of differentiability 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1260
 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1261
                f(x) - f(a)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1262
              --------------- @= Db
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1263
                  x - a
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1264
 ---------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1265
Goal "[| NSDERIV f (g x) :> Da; \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1266
\        (*f* g) (hypreal_of_real(x) + xa) ~= hypreal_of_real (g x); \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1267
\        (*f* g) (hypreal_of_real(x) + xa) @= hypreal_of_real (g x) \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1268
\     |] ==> ((*f* f) ((*f* g) (hypreal_of_real(x) + xa)) \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1269
\                  + - hypreal_of_real (f (g x)))* \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1270
\                  inverse ((*f* g) (hypreal_of_real(x) + xa) + \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1271
\                        - hypreal_of_real (g x)) @= hypreal_of_real(Da)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1272
by (auto_tac (claset(),simpset() addsimps [NSDERIV_NSLIM_iff2,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1273
    NSLIM_def,starfun_mult RS sym,hypreal_of_real_minus,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1274
    starfun_add RS sym,starfun_inverse3]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1275
qed "NSDERIVD1";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1276
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1277
(*-------------------------------------------------------------- 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1278
   from other version of differentiability 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1279
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1280
                f(x + h) - f(x)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1281
               ----------------- @= Db
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1282
                       h
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1283
 --------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1284
Goal "[| NSDERIV g x :> Db; xa: Infinitesimal; xa ~= 0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1285
\     ==> ((*f* g) (hypreal_of_real(x) + xa) + - hypreal_of_real(g x)) * \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1286
\                     inverse xa @= hypreal_of_real(Db)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1287
by (auto_tac (claset(),simpset() addsimps [NSDERIV_NSLIM_iff,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1288
    NSLIM_def,starfun_mult RS sym,starfun_inverse_inverse,
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1289
    starfun_add RS sym,hypreal_of_real_zero,mem_infmal_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1290
    starfun_lambda_cancel,hypreal_of_real_minus]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1291
qed "NSDERIVD2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1292
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1293
(*---------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1294
  This proof uses both possible definitions
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1295
  for differentiability.
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1296
 --------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1297
Goal "[| NSDERIV f (g x) :> Da; NSDERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1298
\     ==> NSDERIV (f o g) x :> Da * Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1299
by (asm_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1300
    NSLIM_def,hypreal_of_real_zero,mem_infmal_iff RS sym]) 1 THEN Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1301
by (forw_inst_tac [("f","g")] NSDERIV_inf_close 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1302
by (auto_tac (claset(),simpset() addsimps [starfun_add RS sym,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1303
    hypreal_of_real_minus,starfun_inverse_inverse,hypreal_of_real_mult,
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1304
    starfun_lambda_cancel2,starfun_o RS sym,starfun_mult RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1305
by (case_tac "(*f* g) (hypreal_of_real(x) + xa) = hypreal_of_real (g x)" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1306
by (dres_inst_tac [("g","g")] NSDERIV_zero 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1307
by (auto_tac (claset(),simpset() 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1308
    addsimps [hypreal_of_real_zero,inf_close_refl]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1309
by (res_inst_tac [("z1","(*f* g) (hypreal_of_real(x) + xa) + -hypreal_of_real (g x)"),
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1310
    ("y1","inverse xa")] (lemma_chain RS ssubst) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1311
by (etac (hypreal_not_eq_minus_iff RS iffD1) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1312
by (rtac inf_close_mult_hypreal_of_real 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1313
by (blast_tac (claset() addIs [NSDERIVD1,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1314
    inf_close_minus_iff RS iffD2]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1315
by (blast_tac (claset() addIs [NSDERIVD2]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1316
qed "NSDERIV_chain";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1317
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1318
(* standard version *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1319
Goal "!!f. [| DERIV f (g x) :> Da; \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1320
\                 DERIV g x :> Db \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1321
\              |] ==> DERIV (f o g) x :> Da * Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1322
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_DERIV_iff RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1323
    NSDERIV_chain]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1324
qed "DERIV_chain";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1325
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1326
Goal "[| DERIV f (g x) :> Da; DERIV g x :> Db |] \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1327
\     ==> DERIV (%x. f (g x)) x :> Da * Db";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1328
by (auto_tac (claset() addDs [DERIV_chain], simpset() addsimps [o_def]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1329
qed "DERIV_chain2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1330
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1331
Goal "[| DERIV f x :> D; D = E |] ==> DERIV f x :> E";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1332
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1333
val lemma_DERIV_tac = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1334
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1335
(*------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1336
           Differentiation of natural number powers
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1337
 ------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1338
Goal "NSDERIV (%x. x) x :> #1";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1339
by (auto_tac (claset(),simpset() addsimps [NSDERIV_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1340
    NSLIM_def,starfun_mult RS sym,starfun_Id,hypreal_of_real_zero,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1341
    starfun_inverse_inverse,hypreal_of_real_one] 
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1342
    @ real_add_ac));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1343
qed "NSDERIV_Id";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1344
Addsimps [NSDERIV_Id];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1345
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1346
Goal "DERIV (%x. x) x :> #1";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1347
by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1348
qed "DERIV_Id";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1349
Addsimps [DERIV_Id];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1350
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1351
Goal "DERIV (op * c) x :> c";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1352
by (cut_inst_tac [("c","c"),("x","x")] (DERIV_Id RS DERIV_cmult) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1353
by (Asm_full_simp_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1354
qed "DERIV_cmult_Id";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1355
Addsimps [DERIV_cmult_Id];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1356
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1357
Goal "NSDERIV (op * c) x :> c";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1358
by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1359
qed "NSDERIV_cmult_Id";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1360
Addsimps [NSDERIV_cmult_Id];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1361
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1362
Goal "DERIV (%x. x ^ n) x :> real_of_nat n * (x ^ (n - 1))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1363
by (induct_tac "n" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1364
by (dtac (DERIV_Id RS DERIV_mult) 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1365
by (auto_tac (claset(),simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1366
    [real_add_mult_distrib]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1367
by (case_tac "0 < n" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1368
by (dres_inst_tac [("x","x")] realpow_minus_mult 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1369
by (auto_tac (claset(),simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1370
    [real_mult_assoc,real_add_commute]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1371
qed "DERIV_pow";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1372
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1373
(* NS version *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1374
Goal "NSDERIV (%x. x ^ n) x :> real_of_nat n * (x ^ (n - 1))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1375
by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff,DERIV_pow]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1376
qed "NSDERIV_pow";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1377
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1378
(*---------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1379
                    Power of -1 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1380
 ---------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1381
Goalw [nsderiv_def]
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1382
     "x ~= #0 ==> NSDERIV (%x. inverse(x)) x :> (- (inverse x ^ 2))";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1383
by (rtac ballI 1 THEN Asm_full_simp_tac 1 THEN Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1384
by (forward_tac [Infinitesimal_add_not_zero] 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1385
by (auto_tac (claset(),simpset() addsimps [starfun_inverse_inverse,
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1386
         hypreal_of_real_inverse RS sym,hypreal_of_real_minus,realpow_two,
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1387
         hypreal_of_real_mult] delsimps [hypreal_minus_mult_eq1 RS
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1388
         sym,hypreal_minus_mult_eq2 RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1389
by (dtac (hypreal_of_real_not_zero_iff RS iffD2) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1390
by (asm_full_simp_tac (simpset() addsimps [hypreal_inverse_add,
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1391
         inverse_mult_eq RS sym, hypreal_minus_inverse RS sym] 
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1392
         @ hypreal_add_ac @ hypreal_mult_ac delsimps [hypreal_minus_mult_eq1 RS
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1393
         sym,hypreal_minus_mult_eq2 RS sym] ) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1394
by (asm_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1395
         hypreal_add_mult_distrib2] delsimps [hypreal_minus_mult_eq1 RS
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1396
         sym,hypreal_minus_mult_eq2 RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1397
by (dres_inst_tac [("x3","x") ] ((HFinite_hypreal_of_real RSN
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1398
         (2,Infinitesimal_HFinite_mult2)) RS  
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1399
          (Infinitesimal_minus_iff RS iffD1)) 1); 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1400
by (forw_inst_tac [("x","hypreal_of_real x"),("y","hypreal_of_real x")] hypreal_mult_not_0 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1401
by (res_inst_tac [("y"," inverse(- hypreal_of_real x * hypreal_of_real x)")] inf_close_trans 2);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1402
by (rtac inverse_add_Infinitesimal_inf_close2 2);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1403
by (auto_tac (claset() addIs [HFinite_minus_iff RS iffD1]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1404
         addSDs [Infinitesimal_minus_iff RS iffD2,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1405
         hypreal_of_real_HFinite_diff_Infinitesimal], simpset() addsimps 
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1406
         [hypreal_minus_inverse RS sym,hypreal_of_real_mult RS sym]));
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1407
qed "NSDERIV_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1408
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1409
Goal "x ~= #0 ==> DERIV (%x. inverse(x)) x :> (-(inverse x ^ 2))";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1410
by (asm_simp_tac (simpset() addsimps [NSDERIV_inverse,
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1411
         NSDERIV_DERIV_iff RS sym] delsimps [thm "realpow_Suc"]) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1412
qed "DERIV_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1413
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1414
(*--------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1415
        Derivative of inverse 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1416
 -------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1417
Goal "[| DERIV f x :> d; f(x) ~= #0 |] \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1418
\     ==> DERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ 2)))";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1419
by (rtac (real_mult_commute RS subst) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1420
by (asm_simp_tac (simpset() addsimps [real_minus_mult_eq1,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1421
    realpow_inverse] delsimps [thm "realpow_Suc", 
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1422
    real_minus_mult_eq1 RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1423
by (fold_goals_tac [o_def]);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1424
by (blast_tac (claset() addSIs [DERIV_chain,DERIV_inverse]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1425
qed "DERIV_inverse_fun";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1426
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1427
Goal "[| NSDERIV f x :> d; f(x) ~= #0 |] \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1428
\     ==> NSDERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ 2)))";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1429
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_DERIV_iff,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1430
            DERIV_inverse_fun] delsimps [thm "realpow_Suc"]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1431
qed "NSDERIV_inverse_fun";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1432
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1433
(*--------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1434
        Derivative of quotient 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1435
 -------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1436
Goal "[| DERIV f x :> d; DERIV g x :> e; g(x) ~= #0 |] \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1437
\      ==> DERIV (%y. f(y)*inverse(g y)) x :> (d*g(x) \
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1438
\                           + -(e*f(x)))*inverse(g(x) ^ 2)";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1439
by (dres_inst_tac [("f","g")] DERIV_inverse_fun 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1440
by (dtac DERIV_mult 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1441
by (REPEAT(assume_tac 1));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1442
by (asm_full_simp_tac (simpset() addsimps [real_add_mult_distrib2,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1443
        realpow_inverse,real_minus_mult_eq1] @ real_mult_ac delsimps
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1444
        [thm "realpow_Suc",real_minus_mult_eq1 RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1445
         real_minus_mult_eq2 RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1446
qed "DERIV_quotient";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1447
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1448
Goal "[| NSDERIV f x :> d; DERIV g x :> e; g(x) ~= #0 |] \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1449
\      ==> NSDERIV (%y. f(y)*inverse(g y)) x :> (d*g(x) \
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1450
\                           + -(e*f(x)))*inverse(g(x) ^ 2)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1451
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_DERIV_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1452
            DERIV_quotient] delsimps [thm "realpow_Suc"]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1453
qed "NSDERIV_quotient";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1454
 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1455
(* ------------------------------------------------------------------------ *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1456
(* Caratheodory formulation of derivative at a point: standard proof        *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1457
(* ------------------------------------------------------------------------ *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1458
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1459
Goal "(DERIV f x :> l) = \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1460
\     (EX g. (ALL z. f z - f x = g z * (z - x)) & isCont g x & g x = l)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1461
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1462
by (res_inst_tac 
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1463
    [("x","%z. if  z = x then l else (f(z) - f(x)) * inverse (z - x)")] exI 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1464
by (auto_tac (claset(),simpset() addsimps [real_mult_assoc,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1465
    ARITH_PROVE "z ~= x ==> z - x ~= (#0::real)"]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1466
by (auto_tac (claset(),simpset() addsimps [isCont_iff,DERIV_iff]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1467
by (ALLGOALS(rtac (LIM_equal RS iffD1)));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1468
by (auto_tac (claset(),simpset() addsimps [real_diff_def,real_mult_assoc]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1469
qed "CARAT_DERIV";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1470
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1471
Goal "NSDERIV f x :> l ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1472
\     EX g. (ALL z. f z - f x = g z * (z - x)) & isNSCont g x & g x = l";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1473
by (auto_tac (claset(),simpset() addsimps [NSDERIV_DERIV_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1474
    isNSCont_isCont_iff,CARAT_DERIV]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1475
qed "CARAT_NSDERIV";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1476
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1477
(* How about a NS proof? *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1478
Goal "(ALL z. f z - f x = g z * (z - x)) & isNSCont g x & g x = l \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1479
\     ==> NSDERIV f x :> l";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1480
by (auto_tac (claset(),simpset() addsimps [NSDERIV_iff2,starfun_mult
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1481
    RS sym]));
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1482
by (rtac (starfun_inverse2 RS subst) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1483
by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1484
    starfun_diff RS sym,starfun_Id]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1485
by (asm_full_simp_tac (simpset() addsimps [hypreal_eq_minus_iff3 RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1486
    hypreal_diff_def]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1487
by (dtac (CLAIM_SIMP "x ~= y ==> x - y ~= (0::hypreal)" [hypreal_eq_minus_iff3 RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1488
            hypreal_diff_def]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1489
by (asm_full_simp_tac (simpset() addsimps [isNSCont_def]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1490
qed "CARAT_DERIVD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1491
 
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1492
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1493
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1494
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1495
(* Useful lemmas about nested intervals and proof by bisection (cf.Harrison)  *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1496
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1497
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1498
Goal "(ALL n. (f::nat=>real) n <= f (Suc n)) --> f m <= f(m + no)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1499
by (induct_tac "no" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1500
by (auto_tac (claset() addIs [real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1501
qed_spec_mp "lemma_f_mono_add";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1502
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1503
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1504
(* IMPROVE?: long proof! *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1505
Goal "[| ALL n. f(n) <= f(Suc n); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1506
\        ALL n. g(Suc n) <= g(n); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1507
\        ALL n. f(n) <= g(n) |] \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1508
\     ==> EX l m. l <= m &  ((ALL n. f(n) <= l) & f ----> l) & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1509
\                           ((ALL n. m <= g(n)) & g ----> m)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1510
by (subgoal_tac "Bseq f" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1511
by (res_inst_tac [("k","f 0"),("K","g 0")] BseqI2 2 THEN rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1512
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1513
by (auto_tac (claset() addIs [real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1514
by (res_inst_tac [("j","g(Suc na)")] real_le_trans 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1515
by (induct_tac "na" 3);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1516
by (auto_tac (claset() addIs [real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1517
by (subgoal_tac "monoseq f" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1518
by (subgoal_tac "monoseq g" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1519
by (subgoal_tac "Bseq g" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1520
by (res_inst_tac [("k","f 0"),("K","g 0")] BseqI2 2 THEN rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1521
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1522
by (auto_tac (claset() addIs [real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1523
by (res_inst_tac [("j","f(Suc na)")] real_le_trans 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1524
by (induct_tac "na" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1525
by (auto_tac (claset() addIs [real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1526
by (auto_tac (claset() addSDs [Bseq_monoseq_convergent],
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1527
    simpset() addsimps [convergent_LIMSEQ_iff]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1528
by (res_inst_tac [("x","lim f")] exI 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1529
by (res_inst_tac [("x","lim g")] exI 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1530
by (auto_tac (claset() addIs [LIMSEQ_le],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1531
by (rtac real_leI 1 THEN rtac real_leI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1532
by (auto_tac (claset(),simpset() addsimps [LIMSEQ_iff,monoseq_Suc]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1533
by (ALLGOALS (dtac real_less_sum_gt_zero));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1534
by (dres_inst_tac [("x","f n + - lim f")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1535
by (rotate_tac 4 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1536
by (dres_inst_tac [("x","lim g + - g n")] spec 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1537
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1538
by (ALLGOALS(rotate_tac 5));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1539
by (ALLGOALS(dres_inst_tac [("x","no + n")] spec));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1540
by (Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1541
by (subgoal_tac "0 <= f(no + n) - lim f" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1542
by (induct_tac "no" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1543
by (auto_tac (claset() addIs [real_le_trans],
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1544
    simpset() addsimps [real_diff_def]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1545
by (dtac abs_eqI1 1 THEN Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1546
by (dres_inst_tac [("i"," f (no + n)"),("no1","no")] (lemma_f_mono_add 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1547
    RSN (2,real_less_le_trans)) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1548
by (subgoal_tac "0 <= lim g + - g(no + n)" 3);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1549
by (induct_tac "no" 4);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1550
by (auto_tac (claset() addIs [real_le_trans],
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1551
    simpset() addsimps [real_diff_def,abs_minus_add_cancel]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1552
by (dtac abs_eqI1 2 THEN Asm_full_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1553
by (dres_inst_tac [("i","- g (no + n)"),("no1","no")] (lemma_f_mono_add 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1554
    RSN (2,real_less_le_trans)) 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1555
by (auto_tac (claset(),simpset() addsimps [add_commute]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1556
qed "lemma_nest";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1557
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1558
Goal "[| ALL n. f(n) <= f(Suc n); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1559
\        ALL n. g(Suc n) <= g(n); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1560
\        ALL n. f(n) <= g(n); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1561
\        (%n. f(n) - g(n)) ----> 0 |] \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1562
\     ==> EX l. ((ALL n. f(n) <= l) & f ----> l) & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1563
\               ((ALL n. l <= g(n)) & g ----> l)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1564
by (dtac lemma_nest 1 THEN Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1565
by (subgoal_tac "l = m" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1566
by (dres_inst_tac [("X","f")] LIMSEQ_diff 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1567
by (auto_tac (claset() addIs [LIMSEQ_unique],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1568
qed "lemma_nest_unique";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1569
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1570
Goal "EX! fn. (fn 0 = e) & (ALL n. fn (Suc n) = f n (fn n))";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1571
by (rtac ex1I 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1572
by (rtac conjI 1 THEN rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1573
by (rtac def_nat_rec_0 1 THEN rtac def_nat_rec_Suc 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1574
by (Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1575
by (rtac ext 1 THEN induct_tac "n" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1576
by (Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1577
qed "nat_Axiom";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1578
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1579
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1580
(****************************************************************
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1581
REPLACING THE VERSION IN REALORD.ML
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1582
****************************************************************)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1583
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1584
(*NEW VERSION with #2*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1585
Goal "x < y ==> x < (x + y) / (#2::real)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1586
by Auto_tac;
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1587
(*proof was
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1588
by (dres_inst_tac [("C","x")] real_add_less_mono2 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1589
by (dtac (real_add_self RS subst) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1590
by (dtac (real_zero_less_two RS real_inverse_gt_zero RS 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1591
          real_mult_less_mono1) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1592
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1593
    (simpset() addsimps [real_mult_assoc, real_inverse_eq_divide]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1594
*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1595
qed "real_less_half_sum";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1596
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1597
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1598
(*Replaces "inverse #nn" by #1/#nn *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1599
Addsimps [inst "x" "number_of ?w" real_inverse_eq_divide];
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1600
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1601
Goal "((x::real) = y / (#2 * z)) = (#2 * x = y/z)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1602
by Auto_tac;  
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1603
by (dres_inst_tac [("f","%u. (#1/#2)*u")] arg_cong 1); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1604
by Auto_tac;  
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1605
qed "eq_divide_2_times_iff";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1606
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1607
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1608
val [prem1,prem2] =
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1609
Goal "[| !!a b c. [| a <= b; b <= c; P(a,b); P(b,c)|] ==> P(a,c); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1610
\        ALL x. EX d::real. 0 < d & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1611
\               (ALL a b. a <= x & x <= b & (b - a) < d --> P(a,b)) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1612
\     |] ==> ALL a b. a <= b --> P(a,b)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1613
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1614
by (cut_inst_tac [("e","(a,b)"),
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1615
    ("f","%n fn. if P(fst fn, (fst fn + snd fn)/#2) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1616
\              then ((fst fn + snd fn) /#2,snd fn) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1617
\              else (fst fn,(fst fn + snd fn)/#2)")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1618
    nat_Axiom 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1619
by (etac ex1E 1 THEN etac conjE 1 THEN rtac ccontr 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1620
(* set up 1st premise of lemma_nest_unique *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1621
by (subgoal_tac "ALL n. fst((fn::nat =>(real*real)) n) <= snd (fn n)" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1622
by (rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1623
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1624
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1625
by (dres_inst_tac [("x","na")] spec 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1626
by (case_tac "P (fst (fn na), (fst (fn na) + snd (fn na)) / #2)" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1627
by (Asm_simp_tac 3);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1628
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1629
(* 2nd premise *) 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1630
by (subgoal_tac "ALL n. fst(fn n) <= fst (fn (Suc n))" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1631
by (rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1632
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1633
by (dres_inst_tac [("x","0")] spec 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1634
by (Asm_simp_tac 3);  (*super slow, but proved!*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1635
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1636
(* 3rd premise? [lcp] *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1637
by (subgoal_tac "ALL n. ~P(fst(fn n),snd(fn n))" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1638
by (rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1639
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1640
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1641
by (Asm_simp_tac 2 THEN rtac impI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1642
by (rtac ccontr 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1643
by (res_inst_tac [("Pa","P (fst (fn na), snd (fn na))")] swap 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1644
by (assume_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1645
by (res_inst_tac [("b","(fst(fn na) + snd(fn na))/#2")] prem1 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1646
by (Asm_full_simp_tac 4); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1647
by (Asm_full_simp_tac 4); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1648
by (Asm_full_simp_tac 2); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1649
by (Asm_simp_tac 2); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1650
(* 3rd premise [looks like the 4th to lcp!] *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1651
by (subgoal_tac "ALL n. snd(fn (Suc n)) <= snd (fn n)" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1652
by (rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1653
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1654
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1655
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1656
(* FIXME: simplification takes a very long time! *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1657
by (ALLGOALS(thin_tac "ALL y. \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1658
\            y 0 = (a, b) & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1659
\            (ALL n. \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1660
\                y (Suc n) = \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1661
\                (if P (fst (y n), (fst (y n) + snd (y n)) /#2) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1662
\                 then ((fst (y n) + snd (y n)) /#2, snd (y n)) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1663
\                 else (fst (y n),\
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1664
\                       (fst (y n) + snd (y n)) /#2))) --> \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1665
\            y = fn"));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1666
(*another premise? the 5th? lcp*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1667
by (subgoal_tac "ALL n. snd(fn n) - fst(fn n) = \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1668
\                       (b - a) * inverse(#2 ^ n)" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1669
by (rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1670
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1671
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1672
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1673
    (simpset() addsimps [eq_divide_2_times_iff, real_inverse_eq_divide,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1674
                         real_diff_mult_distrib2]) 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1675
(*end of the premises [lcp]*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1676
by (dtac lemma_nest_unique 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1677
by (REPEAT(assume_tac 1));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1678
by (Step_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1679
by (rtac LIMSEQ_minus_cancel 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1680
by (asm_simp_tac (simpset() addsimps [CLAIM "-((a::real) - b) = (b - a)",
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1681
    realpow_inverse]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1682
by (subgoal_tac "#0 = (b-a) * #0" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1683
by (eres_inst_tac [("t","#0")] ssubst 1); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1684
by (rtac (LIMSEQ_const RS LIMSEQ_mult) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1685
by (rtac LIMSEQ_realpow_zero 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1686
by (Asm_full_simp_tac 3); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1687
by (EVERY1[Simp_tac, Simp_tac]);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1688
by (cut_facts_tac [prem2] 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1689
by (dres_inst_tac [("x","l")] spec 1 THEN Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1690
by (rewtac LIMSEQ_def);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1691
by (dres_inst_tac [("x","d/#2")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1692
by (dres_inst_tac [("x","d/#2")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1693
by (dtac real_less_half_sum 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1694
by (thin_tac "ALL n. \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1695
\             fn (Suc n) = \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1696
\             (if P (fst (fn n), (fst (fn n) + snd (fn n))/#2) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1697
\              then ((fst (fn n) + snd (fn n))/#2, snd (fn n)) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1698
\              else (fst (fn n), \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1699
\                    (fst (fn n) + snd (fn n))/#2))" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1700
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1701
by (ALLGOALS(Asm_full_simp_tac));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1702
by (dres_inst_tac [("x","fst(fn (no + noa))")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1703
by (dres_inst_tac [("x","snd(fn (no + noa))")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1704
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1705
by (ALLGOALS(Asm_full_simp_tac));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1706
by (res_inst_tac [("j","abs(fst(fn(no + noa)) - l) + \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1707
\                       abs(snd(fn(no + noa)) - l)")] real_le_less_trans 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1708
by (rtac (real_sum_of_halves RS subst) 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1709
by (rewtac real_diff_def);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1710
by (rtac real_add_less_mono 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1711
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1712
by (Asm_full_simp_tac 2); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1713
by (Asm_full_simp_tac 2); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1714
by (res_inst_tac [("y1","fst(fn (no + noa)) ")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1715
    (abs_minus_add_cancel RS subst) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1716
by (subgoal_tac "#0 <= (l + - fst (fn (no + noa)))" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1717
by (subgoal_tac "#0 <= (snd (fn (no + noa)) + - l)" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1718
by (asm_simp_tac (simpset() addsimps [abs_eqI1] @ real_add_ac) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1719
by (asm_simp_tac (simpset() addsimps real_add_ac) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1720
by (res_inst_tac [("C","l")] real_le_add_right_cancel 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1721
by (res_inst_tac [("C"," fst (fn (no + noa))")] real_le_add_right_cancel 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1722
by (ALLGOALS(asm_simp_tac (simpset() addsimps real_add_ac)));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1723
qed "lemma_BOLZANO";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1724
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1725
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1726
Goal "((ALL a b c. (a <= b & b <= c & P(a,b) & P(b,c)) --> P(a,c)) & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1727
\         (ALL x. EX d::real. 0 < d & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1728
\               (ALL a b. a <= x & x <= b & (b - a) < d --> P(a,b)))) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1729
\         --> (ALL a b. a <= b --> P(a,b))";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1730
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1731
by (rtac (lemma_BOLZANO RS allE) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1732
by (assume_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1733
by (ALLGOALS(Blast_tac));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1734
qed "lemma_BOLZANO2";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1735
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1736
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1737
(* Intermediate Value Theorem (prove contrapositive by bisection)             *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1738
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1739
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1740
Goal "[| f(a) <= y & y <= f(b); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1741
\        a <= b; \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1742
\        (ALL x. a <= x & x <= b --> isCont f x) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1743
\     |] ==> EX x. a <= x & x <= b & f(x) = y";
10659
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1744
by (rtac contrapos_pp 1);
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1745
by (assume_tac 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1746
by (cut_inst_tac [("P","%(u,v). a <= u & u <= v & v <= b --> \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1747
\   ~(f(u) <= y & y <= f(v))")] lemma_BOLZANO2 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1748
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1749
by (ALLGOALS(Asm_full_simp_tac));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1750
by (Blast_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1751
by (asm_full_simp_tac (simpset() addsimps [isCont_iff,LIM_def]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1752
by (rtac ccontr 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1753
by (subgoal_tac "a <= x & x <= b" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1754
by (Asm_full_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1755
by (rotate_tac 3 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1756
by (dres_inst_tac [("x","1r")] spec 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1757
by (Step_tac 2);
10659
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1758
by (Asm_full_simp_tac 2);
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1759
by (Asm_full_simp_tac 2);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1760
by (REPEAT(blast_tac (claset() addIs [real_le_trans]) 2));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1761
by (REPEAT(dres_inst_tac [("x","x")] spec 1));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1762
by (Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1763
(**)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1764
by (rotate_tac 4 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1765
by (dres_inst_tac [("x","abs(y - f x)")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1766
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1767
by (asm_full_simp_tac (simpset() addsimps [real_less_le,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1768
                                           abs_ge_zero,real_diff_def]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1769
by (dtac (sym RS (abs_zero_iff RS iffD2)) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1770
by (arith_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1771
by (dres_inst_tac [("x","s")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1772
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1773
by (cut_inst_tac [("R1.0","f x"),("R2.0","y")] real_linear 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1774
by (Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1775
by (dres_inst_tac [("x","ba - x")] spec 1);
10659
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1776
by (auto_tac (claset(),
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1777
     simpset() 
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1778
	       addsimps [abs_iff, real_diff_le_eq,
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1779
       (real_diff_def RS meta_eq_to_obj_eq) RS sym,
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1780
       real_less_le_iff, real_le_diff_eq, 
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1781
       CLAIM "(~(x::real) <= y) = (y < x)",
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1782
       CLAIM "(-x < -y) = ((y::real) < x)",
10659
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1783
       CLAIM "(-(y - x)) = (x - (y::real))",
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1784
       CLAIM "(x-y=#0) = (x = (y::real))"]));
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1785
by (dres_inst_tac [("x","aa - x")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1786
by (case_tac "x <= aa" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1787
by (auto_tac (claset(),simpset() addsimps [real_minus_zero_le_iff2,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1788
    real_le_diff_eq,real_diff_le_eq,(real_le_def RS meta_eq_to_obj_eq) 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1789
    RS sym]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1790
by (dres_inst_tac [("z","x"),("w","aa")] real_le_anti_sym 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1791
by (assume_tac 1 THEN Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1792
qed "IVT";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1793
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1794
Goal "[| f(b) <= y & y <= f(a); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1795
\        a <= b; \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1796
\        (ALL x. a <= x & x <= b --> isCont f x) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1797
\     |] ==> EX x. a <= x & x <= b & f(x) = y";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1798
by (subgoal_tac "- f a <= -y & -y <= - f b" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1799
by (thin_tac "f b <= y & y <= f a" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1800
by (dres_inst_tac [("f","%x. - f x")] IVT 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1801
by (auto_tac (claset() addIs [isCont_minus],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1802
qed "IVT2";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1803
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1804
Goal "(f(a) <= y & y <= f(b) & a <= b & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1805
\     (ALL x. a <= x & x <= b --> isCont f x)) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1806
\     --> (EX x. a <= x & x <= b & f(x) = y)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1807
by (blast_tac (claset() addIs [IVT]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1808
qed "IVT_objl";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1809
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1810
Goal "(f(b) <= y & y <= f(a) & a <= b & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1811
\     (ALL x. a <= x & x <= b --> isCont f x)) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1812
\     --> (EX x. a <= x & x <= b & f(x) = y)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1813
by (blast_tac (claset() addIs [IVT2]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1814
qed "IVT2_objl";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1815
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1816
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1817
(* By bisection, function continuous on closed interval is bounded above      *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1818
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1819
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1820
Goal "abs (real_of_nat x) = real_of_nat x";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1821
by (auto_tac (claset() addIs [abs_eqI1],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1822
qed "abs_real_of_nat_cancel";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1823
Addsimps [abs_real_of_nat_cancel];
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1824
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1825
Goal "~ abs(x) + 1r < x";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1826
by (rtac real_leD 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1827
by (auto_tac (claset() addIs [abs_ge_self RS real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1828
qed "abs_add_one_not_less_self";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1829
Addsimps [abs_add_one_not_less_self];
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1830
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1831
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1832
Goal "[| a <= b; ALL x. a <= x & x <= b --> isCont f x |]\
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1833
\     ==> EX M. ALL x. a <= x & x <= b --> f(x) <= M";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1834
by (cut_inst_tac [("P","%(u,v). a <= u & u <= v & v <= b --> \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1835
\                         (EX M. ALL x. u <= x & x <= v --> f x <= M)")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1836
    lemma_BOLZANO2 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1837
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1838
by (ALLGOALS(Asm_full_simp_tac));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1839
by (cut_inst_tac [("x","M"),("y","Ma")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1840
    (CLAIM "x <= y | y <= (x::real)") 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1841
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1842
by (res_inst_tac [("x","Ma")] exI 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1843
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1844
by (cut_inst_tac [("x","xb"),("y","xa")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1845
    (CLAIM "x <= y | y <= (x::real)") 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1846
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1847
by (rtac real_le_trans 1 THEN assume_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1848
by (Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1849
by (Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1850
by (res_inst_tac [("x","M")] exI 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1851
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1852
by (cut_inst_tac [("x","xb"),("y","xa")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1853
    (CLAIM "x <= y | y <= (x::real)") 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1854
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1855
by (Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1856
by (rtac real_le_trans 1 THEN assume_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1857
by (Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1858
by (case_tac "a <= x & x <= b" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1859
by (res_inst_tac [("x","#1")] exI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1860
by (auto_tac (claset(),
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1861
              simpset() addsimps [LIM_def,isCont_iff]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1862
by (dres_inst_tac [("x","x")] spec 1 THEN Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1863
by (thin_tac "ALL M. EX x. a <= x & x <= b & ~ f x <= M" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1864
by (dres_inst_tac [("x","#1")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1865
by Auto_tac;  
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1866
by (res_inst_tac [("x","s")] exI 1 THEN Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1867
by (res_inst_tac [("x","abs(f x) + #1")] exI 1 THEN Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1868
by (dres_inst_tac [("x","xa - x")] spec 1 THEN Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1869
by (res_inst_tac [("j","abs(f xa)")] real_le_trans 3);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1870
by (res_inst_tac [("j","abs(f x) + abs(f(xa) - f(x))")] real_le_trans 4);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1871
by (auto_tac (claset() addIs [abs_triangle_ineq RSN (2, real_le_trans)],
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1872
              simpset() addsimps [real_diff_def,abs_ge_self]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1873
(*arith_tac problem: this step should not be needed*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1874
by (asm_full_simp_tac (simpset() addsimps [rename_numerals (real_eq_minus_iff2 RS sym)]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1875
by (auto_tac (claset(),
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1876
              simpset() addsimps [abs_real_def] addsplits [split_if_asm]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1877
qed "isCont_bounded";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1878
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1879
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1880
(* Refine the above to existence of least upper bound                         *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1881
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1882
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1883
Goal "((EX x. x : S) & (EX y. isUb UNIV S (y::real))) --> \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1884
\     (EX t. isLub UNIV S t)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1885
by (blast_tac (claset() addIs [reals_complete]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1886
qed "lemma_reals_complete";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1887
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1888
Goal "[| a <= b; ALL x. a <= x & x <= b --> isCont f x |] \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1889
\        ==> EX M. (ALL x. a <= x & x <= b --> f(x) <= M) & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1890
\                  (ALL N. N < M --> (EX x. a <= x & x <= b & N < f(x)))";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1891
by (cut_inst_tac [("S","Collect (%y. EX x. a <= x & x <= b & y = f x)")]
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1892
    lemma_reals_complete 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1893
by (Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1894
by (dtac isCont_bounded 1 THEN assume_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1895
by (auto_tac (claset(),simpset() addsimps [isUb_def,leastP_def,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1896
    isLub_def,setge_def,setle_def]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1897
by (rtac exI 1 THEN Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1898
by (REPEAT(dtac spec 1) THEN Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1899
by (dres_inst_tac [("x","x")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1900
by (auto_tac (claset() addSIs [real_leI],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1901
qed "isCont_has_Ub";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1902
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1903
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1904
(* Now show that it attains its upper bound                                   *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1905
(*----------------------------------------------------------------------------*)