src/HOL/Real/Hyperreal/Lim.ML
author paulson
Fri, 15 Dec 2000 17:41:38 +0100
changeset 10677 36625483213f
parent 10670 4b0e346c8ca3
child 10690 cd80241125b0
permissions -rw-r--r--
further round of tidying
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
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
     9
(*DELETE?????*)
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    10
fun ARITH_PROVE str = prove_goal thy str 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    11
                      (fn prems => [cut_facts_tac prems 1,arith_tac 1]);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    12
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    13
Goal "(x + - a = (#0::real)) = (x=a)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    14
by (arith_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    15
qed "real_add_minus_iff";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    16
Addsimps [real_add_minus_iff];
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    17
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    18
(*---------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    19
   Theory of limits, continuity and differentiation of 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    20
   real=>real functions 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    21
 ----------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    22
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
    23
\    (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
    24
\          --> abs(f x + -L) < r))))";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    25
by Auto_tac;
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    26
qed "LIM_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    27
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    28
Goalw [LIM_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
    29
      "[| f -- a --> L; #0 < r |] \
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    30
\           ==> (EX s. #0 < s & (ALL x. (x ~= a \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    31
\           & (abs(x + -a) < s) --> abs(f x + -L) < r)))";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    32
by Auto_tac;
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    33
qed "LIMD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    34
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    35
Goalw [LIM_def] "(%x. k) -- x --> k";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    36
by Auto_tac;
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    37
qed "LIM_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    38
Addsimps [LIM_const];
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
(***-----------------------------------------------------------***)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    41
(***  Some Purely Standard Proofs - Can be used for comparison ***)
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
(*--------------- 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    45
    LIM_add    
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    46
 ---------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    47
Goalw [LIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    48
     "[| f -- x --> l; g -- x --> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    49
\     ==> (%x. f(x) + g(x)) -- x --> (l + m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    50
by (Step_tac 1);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
    51
by (REPEAT(dres_inst_tac [("x","r/#2")] spec 1));
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
    52
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
    53
          RSN (2,real_mult_less_mono2))) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    54
by (Asm_full_simp_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    55
by (Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    56
by (res_inst_tac [("R1.0","s"),("R2.0","sa")] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    57
    real_linear_less2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    58
by (res_inst_tac [("x","s")] exI 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    59
by (res_inst_tac [("x","sa")] exI 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    60
by (res_inst_tac [("x","sa")] exI 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    61
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    62
by (REPEAT(dres_inst_tac [("x","xa")] spec 1) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    63
    THEN step_tac (claset() addSEs [real_less_trans]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    64
by (REPEAT(dres_inst_tac [("x","xa")] spec 2) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    65
    THEN step_tac (claset() addSEs [real_less_trans]) 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    66
by (REPEAT(dres_inst_tac [("x","xa")] spec 3) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    67
    THEN step_tac (claset() addSEs [real_less_trans]) 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    68
by (ALLGOALS(rtac (abs_sum_triangle_ineq RS real_le_less_trans)));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    69
by (ALLGOALS(rtac (real_sum_of_halves RS subst)));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    70
by (auto_tac (claset() addIs [real_add_less_mono],simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    71
qed "LIM_add";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    72
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    73
Goalw [LIM_def] "f -- a --> L ==> (%x. -f(x)) -- a --> -L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    74
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
    75
                                       abs_minus_cancel] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
    76
                    delsimps [real_minus_add_distrib,real_minus_minus]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    77
qed "LIM_minus";
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
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    80
     LIM_add_minus
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    81
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    82
Goal "[| f -- x --> l; g -- x --> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    83
\     ==> (%x. f(x) + -g(x)) -- x --> (l + -m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    84
by (blast_tac (claset() addDs [LIM_add,LIM_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    85
qed "LIM_add_minus";
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
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    88
     LIM_zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    89
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    90
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
    91
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
    92
by (rtac LIM_add_minus 1 THEN Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    93
qed "LIM_zero";
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
(*--------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    96
   Limit not zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    97
 --------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    98
Goalw [LIM_def] "k ~= #0 ==> ~ ((%x. k) -- x --> #0)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
    99
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
   100
by (auto_tac (claset(),simpset() addsimps [abs_minus_eqI2,abs_eqI2]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   101
by (dtac (rename_numerals (real_minus_zero_less_iff RS iffD2)) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   102
by (res_inst_tac [("x","-k")] exI 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   103
by (res_inst_tac [("x","k")] exI 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   104
by Auto_tac;
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   105
by (ALLGOALS(dres_inst_tac [("y","s")] real_dense));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   106
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   107
by (ALLGOALS(res_inst_tac [("x","r + x")] exI));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   108
by (auto_tac (claset(),simpset() addsimps [real_add_assoc,abs_eqI2]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   109
qed "LIM_not_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   110
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   111
(* [| k ~= #0; (%x. k) -- x --> #0 |] ==> R *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   112
bind_thm("LIM_not_zeroE", (LIM_not_zero RS notE));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   113
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   114
Goal "(%x. k) -- x --> L ==> k = L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   115
by (rtac ccontr 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   116
by (dtac LIM_zero 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   117
by (rtac LIM_not_zeroE 1 THEN assume_tac 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   118
by (arith_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   119
qed "LIM_const_eq";
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
(*------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   122
     Limit is Unique
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   123
 ------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   124
Goal "[| f -- x --> L; f -- x --> M |] ==> L = M";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   125
by (dtac LIM_minus 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   126
by (dtac LIM_add 1 THEN assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   127
by (auto_tac (claset() addSDs [LIM_const_eq RS sym],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   128
    simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   129
qed "LIM_unique";
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
(*-------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   132
    LIM_mult_zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   133
 -------------*)
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   134
Goalw [LIM_def] "[| f -- x --> #0; g -- x --> #0 |] \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   135
\         ==> (%x. f(x)*g(x)) -- x --> #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   136
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   137
by (dres_inst_tac [("x","#1")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   138
by (dres_inst_tac [("x","r")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   139
by (cut_facts_tac [real_zero_less_one] 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   140
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   141
    [abs_mult]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   142
by (Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   143
by (res_inst_tac [("R1.0","s"),("R2.0","sa")] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   144
    real_linear_less2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   145
by (res_inst_tac [("x","s")] exI 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   146
by (res_inst_tac [("x","sa")] exI 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   147
by (res_inst_tac [("x","sa")] exI 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   148
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   149
by (REPEAT(dres_inst_tac [("x","xa")] spec 1) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   150
    THEN step_tac (claset() addSEs [real_less_trans]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   151
by (REPEAT(dres_inst_tac [("x","xa")] spec 2) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   152
    THEN step_tac (claset() addSEs [real_less_trans]) 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   153
by (REPEAT(dres_inst_tac [("x","xa")] spec 3) 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   154
    THEN step_tac (claset() addSEs [real_less_trans]) 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   155
by (ALLGOALS(res_inst_tac [("t","r")] (real_mult_1 RS subst)));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   156
by (ALLGOALS(rtac abs_mult_less2));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   157
by Auto_tac;
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   158
qed "LIM_mult_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   159
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   160
Goalw [LIM_def] "(%x. x) -- a --> a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   161
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   162
qed "LIM_self";
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
(*--------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   165
   Limits are equal for functions equal except at limit point
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   166
 --------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   167
Goalw [LIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   168
      "[| ALL x. x ~= a --> (f x = g x) |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   169
\           ==> (f -- a --> l) = (g -- a --> l)";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   170
by (auto_tac (claset(), simpset() addsimps [real_add_minus_iff]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   171
qed "LIM_equal";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   172
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   173
Goal "[| (%x. f(x) + -g(x)) -- a --> #0; \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   174
\        g -- a --> l |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   175
\      ==> f -- a --> l";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   176
by (dtac LIM_add 1 THEN assume_tac 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   177
by (auto_tac (claset(), simpset() addsimps [real_add_assoc]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   178
qed "LIM_trans";
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
(***-------------------------------------------------------------***)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   181
(***           End of Purely Standard Proofs                     ***)
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
(*--------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   184
       Standard and NS definitions of Limit
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   185
 --------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   186
Goalw [LIM_def,NSLIM_def,inf_close_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   187
      "f -- x --> L ==> f -- x --NS> L";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   188
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   189
    (simpset() addsimps [Infinitesimal_FreeUltrafilterNat_iff]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   190
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   191
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
   192
by (auto_tac (claset(),
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   193
      simpset() addsimps [real_add_minus_iff,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   194
                          starfun, hypreal_minus,hypreal_of_real_minus RS sym,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   195
                          hypreal_of_real_def, hypreal_add]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   196
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
   197
by (dres_inst_tac [("x","u")] spec 1 THEN Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   198
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
   199
by (subgoal_tac "ALL n::nat. (xa n) ~= x & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   200
\                    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
   201
by (Blast_tac 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   202
by (dtac FreeUltrafilterNat_all 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   203
by (Ultra_tac 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   204
qed "LIM_NSLIM";
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
(*---------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   207
    Limit: NS definition ==> standard definition
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   208
 ---------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   209
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   210
Goal "ALL s. #0 < s --> (EX xa.  xa ~= x & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   211
\        abs (xa + - x) < s  & r <= abs (f xa + -L)) \
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   212
\     ==> ALL n::nat. EX xa.  xa ~= x & \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   213
\             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
   214
by (Step_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   215
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
   216
by Auto_tac;
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   217
val lemma_LIM = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   218
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   219
Goal "ALL s. #0 < s --> (EX xa.  xa ~= x & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   220
\        abs (xa + - x) < s  & r <= abs (f xa + -L)) \
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   221
\     ==> EX X. ALL n::nat. X n ~= x & \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   222
\               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
   223
by (dtac lemma_LIM 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   224
by (dtac choice 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   225
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   226
val lemma_skolemize_LIM2 = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   227
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   228
Goal "ALL n. X n ~= x & \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   229
\         abs (X n + - x) < inverse (real_of_posnat  n) & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   230
\         r <= abs (f (X n) + - L) ==> \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   231
\         ALL n. abs (X n + - x) < inverse (real_of_posnat  n)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   232
by (Auto_tac );
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   233
val lemma_simp = result();
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
(*-------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   236
    NSLIM => LIM
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
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   239
Goalw [LIM_def,NSLIM_def,inf_close_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   240
      "f -- x --NS> L ==> f -- x --> L";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   241
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   242
    (simpset() addsimps [Infinitesimal_FreeUltrafilterNat_iff]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   243
by (EVERY1[Step_tac, rtac ccontr, Asm_full_simp_tac]);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   244
by (fold_tac [real_le_def]);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   245
by (dtac lemma_skolemize_LIM2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   246
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   247
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
   248
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   249
    (simpset() addsimps [starfun,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   250
                         hypreal_minus,hypreal_of_real_minus RS sym,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   251
                         hypreal_of_real_def,hypreal_add]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   252
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   253
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
   254
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   255
    (simpset() addsimps 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   256
       [Infinitesimal_FreeUltrafilterNat_iff,hypreal_of_real_def,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   257
        hypreal_minus,hypreal_of_real_minus,hypreal_add]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   258
by (Blast_tac 1); 
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   259
by (rotate_tac 2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   260
by (dres_inst_tac [("x","r")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   261
by (Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   262
by (dtac FreeUltrafilterNat_all 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   263
by (Ultra_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   264
qed "NSLIM_LIM";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   265
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   266
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   267
(**** Key result ****)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   268
Goal "(f -- x --> L) = (f -- x --NS> L)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   269
by (blast_tac (claset() addIs [LIM_NSLIM,NSLIM_LIM]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   270
qed "LIM_NSLIM_iff";
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
(*-------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   273
(*   Proving properties of limits using nonstandard definition and   *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   274
(*   hence, the properties hold for standard limits as well          *)
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
(*------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   277
      NSLIM_mult and hence (trivially) LIM_mult
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
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   280
Goalw [NSLIM_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   281
     "[| f -- x --NS> l; g -- x --NS> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   282
\     ==> (%x. f(x) * g(x)) -- x --NS> (l * m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   283
by (auto_tac (claset() addSIs [starfun_mult_HFinite_inf_close],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   284
              simpset() addsimps [hypreal_of_real_mult]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   285
qed "NSLIM_mult";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   286
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   287
Goal "[| f -- x --> l; g -- x --> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   288
\     ==> (%x. f(x) * g(x)) -- x --> (l * m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   289
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   290
    NSLIM_mult]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   291
qed "LIM_mult2";
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
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   294
      NSLIM_add and hence (trivially) LIM_add
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   295
      Note the much shorter proof
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   296
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   297
Goalw [NSLIM_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   298
     "[| f -- x --NS> l; g -- x --NS> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   299
\     ==> (%x. f(x) + g(x)) -- x --NS> (l + m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   300
by (auto_tac (claset() addSIs [starfun_add_inf_close],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   301
              simpset() addsimps [hypreal_of_real_add]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   302
qed "NSLIM_add";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   303
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   304
Goal "[| f -- x --> l; g -- x --> m |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   305
\     ==> (%x. f(x) + g(x)) -- x --> (l + m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   306
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   307
    NSLIM_add]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   308
qed "LIM_add2";
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
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   311
     NSLIM_const
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   312
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   313
Goalw [NSLIM_def] "(%x. k) -- x --NS> k";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   314
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   315
qed "NSLIM_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   316
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   317
Addsimps [NSLIM_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   318
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   319
Goal "(%x. k) -- x --> k";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   320
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   321
qed "LIM_const2";
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
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   324
     NSLIM_minus
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   325
 ----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   326
Goalw [NSLIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   327
      "f -- a --NS> L ==> (%x. -f(x)) -- a --NS> -L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   328
by (auto_tac (claset() addIs [inf_close_minus],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   329
    simpset() addsimps [starfun_minus RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   330
    hypreal_of_real_minus]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   331
qed "NSLIM_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   332
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   333
Goal "f -- a --> L ==> (%x. -f(x)) -- a --> -L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   334
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   335
    NSLIM_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   336
qed "LIM_minus2";
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
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   339
     NSLIM_add_minus
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   340
 ----------------------------------------------*)
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   341
Goal "[| f -- x --NS> l; g -- x --NS> m |] \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   342
\     ==> (%x. f(x) + -g(x)) -- x --NS> (l + -m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   343
by (blast_tac (claset() addDs [NSLIM_add,NSLIM_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   344
qed "NSLIM_add_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   345
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   346
Goal "[| f -- x --> l; g -- x --> m |] \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   347
\     ==> (%x. f(x) + -g(x)) -- x --> (l + -m)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   348
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   349
    NSLIM_add_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   350
qed "LIM_add_minus2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   351
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   352
(*-----------------------------
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   353
    NSLIM_inverse
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   354
 -----------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   355
Goalw [NSLIM_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   356
     "[| f -- a --NS> L;  L ~= #0 |] \
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   357
\     ==> (%x. inverse(f(x))) -- a --NS> (inverse L)";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   358
by (Clarify_tac 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   359
by (dtac spec 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   360
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   361
              simpset() addsimps [hypreal_of_real_not_zero_iff RS sym,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   362
                                  hypreal_of_real_inverse RS sym]));
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   363
by (forward_tac [inf_close_hypreal_of_real_not_zero] 1 THEN assume_tac 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   364
by (dtac hypreal_of_real_HFinite_diff_Infinitesimal 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   365
by (stac (starfun_inverse RS sym) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   366
by (auto_tac (claset() addSEs [inf_close_inverse],
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   367
              simpset() addsimps [hypreal_of_real_zero_iff]));
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   368
qed "NSLIM_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   369
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   370
Goal "[| f -- a --> L; \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   371
\        L ~= #0 |] ==> (%x. inverse(f(x))) -- a --> (inverse L)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   372
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   373
    NSLIM_inverse]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   374
qed "LIM_inverse";
10045
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
(*------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   377
    NSLIM_zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   378
 ------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   379
Goal "f -- a --NS> l ==> (%x. f(x) + -l) -- a --NS> #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   380
by (res_inst_tac [("z1","l")] (rename_numerals 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   381
    (real_add_minus RS subst)) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   382
by (rtac NSLIM_add_minus 1 THEN Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   383
qed "NSLIM_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   384
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   385
Goal "f -- a --> l ==> (%x. f(x) + -l) -- a --> #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   386
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   387
    NSLIM_zero]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   388
qed "LIM_zero2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   389
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   390
Goal "(%x. f(x) - l) -- x --NS> #0 ==> f -- x --NS> l";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   391
by (dres_inst_tac [("g","%x. l"),("m","l")] NSLIM_add 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   392
by (auto_tac (claset(),simpset() addsimps [real_diff_def,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   393
    real_add_assoc]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   394
qed "NSLIM_zero_cancel";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   395
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   396
Goal "(%x. f(x) - l) -- x --> #0 ==> f -- x --> l";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   397
by (dres_inst_tac [("g","%x. l"),("m","l")] LIM_add 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   398
by (auto_tac (claset(),simpset() addsimps [real_diff_def,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   399
    real_add_assoc]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   400
qed "LIM_zero_cancel";
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
(*--------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   403
   NSLIM_not_zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   404
 --------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   405
Goalw [NSLIM_def] "k ~= #0 ==> ~ ((%x. k) -- x --NS> #0)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   406
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   407
by (res_inst_tac [("x","hypreal_of_real x + ehr")] exI 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   408
by (auto_tac (claset() addIs [Infinitesimal_add_inf_close_self 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   409
    RS inf_close_sym],simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   410
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
   411
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   412
    hypreal_epsilon_not_zero]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   413
qed "NSLIM_not_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   414
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   415
(* [| k ~= #0; (%x. k) -- x --NS> #0 |] ==> R *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   416
bind_thm("NSLIM_not_zeroE", (NSLIM_not_zero RS notE));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   417
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   418
Goal "k ~= #0 ==> ~ ((%x. k) -- x --> #0)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   419
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   420
    NSLIM_not_zero]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   421
qed "LIM_not_zero2";
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
(*-------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   424
   NSLIM of constant function
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   425
 -------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   426
Goal "(%x. k) -- x --NS> L ==> k = L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   427
by (rtac ccontr 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   428
by (dtac NSLIM_zero 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   429
by (rtac NSLIM_not_zeroE 1 THEN assume_tac 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   430
by (arith_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   431
qed "NSLIM_const_eq";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   432
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   433
Goal "(%x. k) -- x --> L ==> k = L";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   434
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   435
    NSLIM_const_eq]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   436
qed "LIM_const_eq2";
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
(*------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   439
     NS Limit is Unique
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   440
 ------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   441
(* can actually be proved more easily by unfolding def! *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   442
Goal "[| f -- x --NS> L; f -- x --NS> M |] ==> L = M";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   443
by (dtac NSLIM_minus 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   444
by (dtac NSLIM_add 1 THEN assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   445
by (auto_tac (claset() addSDs [NSLIM_const_eq RS sym],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   446
    simpset() addsimps [real_add_minus]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   447
qed "NSLIM_unique";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   448
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   449
Goal "[| f -- x --> L; f -- x --> M |] ==> L = M";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   450
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   451
    NSLIM_unique]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   452
qed "LIM_unique2";
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
(*--------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   455
    NSLIM_mult_zero
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   456
 --------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   457
Goal "[| f -- x --NS> #0; g -- x --NS> #0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   458
\         ==> (%x. f(x)*g(x)) -- x --NS> #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   459
by (dtac NSLIM_mult 1 THEN Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   460
qed "NSLIM_mult_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   461
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   462
(* we can use the corresponding thm LIM_mult2 *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   463
(* for standard definition of limit           *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   464
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   465
Goal "[| f -- x --> #0; g -- x --> #0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   466
\     ==> (%x. f(x)*g(x)) -- x --> #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   467
by (dtac LIM_mult2 1 THEN Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   468
qed "LIM_mult_zero2";
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
(*----------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   471
    NSLIM_self
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   472
 ----------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   473
Goalw [NSLIM_def] "(%x. x) -- a --NS> a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   474
by (auto_tac (claset() addIs [starfun_Idfun_inf_close],simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   475
qed "NSLIM_self";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   476
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   477
Goal "(%x. x) -- a --> a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   478
by (simp_tac (simpset() addsimps [LIM_NSLIM_iff,NSLIM_self]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   479
qed "LIM_self2";
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
(*-----------------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   482
   Derivatives and Continuity - NS and Standard properties
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
(*---------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   485
    Continuity 
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
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   488
Goalw [isNSCont_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   489
      "[| isNSCont f a; y @= hypreal_of_real a |] \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   490
\           ==> (*f* f) y @= hypreal_of_real (f a)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   491
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   492
qed "isNSContD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   493
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   494
Goalw [isNSCont_def,NSLIM_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   495
      "isNSCont f a ==> f -- a --NS> (f a) ";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   496
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   497
qed "isNSCont_NSLIM";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   498
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   499
Goalw [isNSCont_def,NSLIM_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   500
      "f -- a --NS> (f a) ==> isNSCont f a";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   501
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   502
by (res_inst_tac [("Q","y = hypreal_of_real a")] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   503
    (excluded_middle RS disjE) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   504
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   505
qed "NSLIM_isNSCont";
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
(*-----------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   508
    NS continuity can be defined using NS Limit in
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   509
    similar fashion to standard def of continuity
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   510
 -----------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   511
Goal "(isNSCont f a) = (f -- a --NS> (f a))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   512
by (blast_tac (claset() addIs [isNSCont_NSLIM,NSLIM_isNSCont]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   513
qed "isNSCont_NSLIM_iff";
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
(*----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   516
  Hence, NS continuity can be given
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   517
  in terms of standard limit
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   518
 ---------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   519
Goal "(isNSCont f a) = (f -- a --> (f a))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   520
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   521
    [LIM_NSLIM_iff,isNSCont_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   522
qed "isNSCont_LIM_iff";
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
(*-----------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   525
  Moreover, it's trivial now that NS continuity 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   526
  is equivalent to standard continuity
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   527
 -----------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   528
Goalw [isCont_def] "(isNSCont f a) = (isCont f a)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   529
by (rtac isNSCont_LIM_iff 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   530
qed "isNSCont_isCont_iff";
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
(*----------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   533
  Standard continuity ==> NS continuity 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   534
 ----------------------------------------*)
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   535
Goal "isCont f a ==> isNSCont f a";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   536
by (etac (isNSCont_isCont_iff RS iffD2) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   537
qed "isCont_isNSCont";
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
(*----------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   540
  NS continuity ==> Standard continuity 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   541
 ----------------------------------------*)
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   542
Goal "isNSCont f a ==> isCont f a";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   543
by (etac (isNSCont_isCont_iff RS iffD1) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   544
qed "isNSCont_isCont";
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
(*--------------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   547
                 Alternative definition of continuity
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   548
 --------------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   549
(* Prove equivalence between NS limits - *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   550
(* seems easier than using standard def  *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   551
Goalw [NSLIM_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   552
      "(f -- a --NS> L) = ((%h. f(a + h)) -- #0 --NS> L)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   553
by (auto_tac (claset(),simpset() addsimps [hypreal_of_real_zero]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   554
by (dres_inst_tac [("x","hypreal_of_real a + x")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   555
by (dres_inst_tac [("x","-hypreal_of_real a + x")] spec 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   556
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   557
by (dtac (sym RS (hypreal_eq_minus_iff4 RS iffD1)) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   558
by (rtac ((mem_infmal_iff RS iffD2) RS 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   559
    (Infinitesimal_add_inf_close_self RS inf_close_sym)) 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   560
by (rtac (inf_close_minus_iff2 RS iffD1) 5);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   561
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 4);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   562
by (dtac (sym RS (hypreal_eq_minus_iff RS iffD2)) 4);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   563
by (res_inst_tac [("z","x")] eq_Abs_hypreal 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   564
by (res_inst_tac [("z","x")] eq_Abs_hypreal 6);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   565
by (auto_tac (claset(),simpset() addsimps [starfun,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   566
    hypreal_of_real_def,hypreal_minus,hypreal_add,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   567
    real_add_assoc,inf_close_refl,hypreal_zero_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   568
qed "NSLIM_h_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   569
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   570
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
   571
by (rtac NSLIM_h_iff 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   572
qed "NSLIM_isCont_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   573
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   574
Goal "(f -- a --> f a) = ((%h. f(a + h)) -- #0 --> f(a))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   575
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   576
    NSLIM_isCont_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   577
qed "LIM_isCont_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   578
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   579
Goalw [isCont_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   580
      "(isCont f x) = ((%h. f(x + h)) -- #0 --> f(x))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   581
by (simp_tac (simpset() addsimps [LIM_isCont_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   582
qed "isCont_iff";
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
(*--------------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   585
   Immediate application of nonstandard criterion for continuity can offer 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   586
   very simple proofs of some standard property of continuous functions
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
(*------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   589
     sum continuous
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   590
 ------------------------*)
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   591
Goal "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) + g(x)) a";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   592
by (auto_tac (claset() addIs [starfun_add_inf_close],simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   593
              [isNSCont_isCont_iff RS sym,isNSCont_def,hypreal_of_real_add]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   594
qed "isCont_add";
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
(*------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   597
     mult continuous
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   598
 ------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   599
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
   600
by (auto_tac (claset() addSIs [starfun_mult_HFinite_inf_close],simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   601
              [isNSCont_isCont_iff RS sym,isNSCont_def,hypreal_of_real_mult]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   602
qed "isCont_mult";
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
(*-------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   605
     composition of continuous functions
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   606
     Note very short straightforard proof!
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   607
 ------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   608
Goal "[| isCont f a; isCont g (f a) |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   609
\     ==> isCont (g o f) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   610
by (auto_tac (claset(),simpset() addsimps [isNSCont_isCont_iff RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   611
              isNSCont_def,starfun_o RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   612
qed "isCont_o";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   613
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   614
Goal "[| isCont f a; isCont g (f a) |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   615
\     ==> isCont (%x. g (f x)) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   616
by (auto_tac (claset() addDs [isCont_o],simpset() addsimps [o_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   617
qed "isCont_o2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   618
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   619
Goalw [isNSCont_def] "isNSCont f a ==> isNSCont (%x. - f x) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   620
by (auto_tac (claset(),simpset() addsimps [starfun_minus RS sym, 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   621
    hypreal_of_real_minus])); 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   622
qed "isNSCont_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   623
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   624
Goal "isCont f a ==> isCont (%x. - f x) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   625
by (auto_tac (claset(),simpset() addsimps [isNSCont_isCont_iff RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   626
              isNSCont_minus]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   627
qed "isCont_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   628
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   629
Goalw [isCont_def]  
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   630
      "[| isCont f x; f x ~= #0 |] ==> isCont (%x. inverse (f x)) x";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   631
by (blast_tac (claset() addIs [LIM_inverse]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   632
qed "isCont_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   633
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   634
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
   635
by (auto_tac (claset() addIs [isCont_inverse],simpset() addsimps 
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   636
    [isNSCont_isCont_iff]));
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   637
qed "isNSCont_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   638
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   639
Goalw [real_diff_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   640
      "[| 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
   641
by (auto_tac (claset() addIs [isCont_add,isCont_minus],simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   642
qed "isCont_diff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   643
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   644
Goalw [isCont_def]  "isCont (%x. k) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   645
by (Simp_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   646
qed "isCont_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   647
Addsimps [isCont_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   648
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   649
Goalw [isNSCont_def]  "isNSCont (%x. k) a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   650
by (Simp_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   651
qed "isNSCont_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   652
Addsimps [isNSCont_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   653
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   654
Goalw [isNSCont_def]  "isNSCont abs a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   655
by (auto_tac (claset() addIs [inf_close_hrabs],simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   656
    [hypreal_of_real_hrabs RS sym,starfun_rabs_hrabs]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   657
qed "isNSCont_rabs";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   658
Addsimps [isNSCont_rabs];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   659
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   660
Goal "isCont abs a";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   661
by (auto_tac (claset(),simpset() addsimps [isNSCont_isCont_iff RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   662
qed "isCont_rabs";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   663
Addsimps [isCont_rabs];
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
(****************************************************************
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   666
(%* Leave as commented until I add topology theory or remove? *%)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   667
(%*------------------------------------------------------------
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   668
  Elementary topology proof for a characterisation of 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   669
  continuity now: a function f is continuous if and only 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   670
  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
   671
  is always an open set
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   672
 ------------------------------------------------------------*%)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   673
Goal "[| isNSopen A; ALL x. isNSCont f x |] \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   674
\              ==> isNSopen {x. f x : A}";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   675
by (auto_tac (claset(),simpset() addsimps [isNSopen_iff1]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   676
by (dtac (mem_monad_inf_close RS inf_close_sym) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   677
by (dres_inst_tac [("x","a")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   678
by (dtac isNSContD 1 THEN assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   679
by (dtac bspec 1 THEN assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   680
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
   681
by (blast_tac (claset() addIs [starfun_mem_starset]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   682
qed "isNSCont_isNSopen";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   683
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   684
Goalw [isNSCont_def]
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   685
          "ALL A. isNSopen A --> isNSopen {x. f x : A} \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   686
\              ==> isNSCont f x";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   687
by (auto_tac (claset() addSIs [(mem_infmal_iff RS iffD1) RS 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   688
     (inf_close_minus_iff RS iffD2)],simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   689
      [Infinitesimal_def,SReal_iff]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   690
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
   691
by (etac (isNSopen_open_interval RSN (2,impE)) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   692
by (auto_tac (claset(),simpset() addsimps [isNSopen_def,isNSnbhd_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   693
by (dres_inst_tac [("x","x")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   694
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
   695
    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
   696
qed "isNSopen_isNSCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   697
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   698
Goal "(ALL x. isNSCont f x) = \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   699
\     (ALL A. isNSopen A --> isNSopen {x. f(x) : A})";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   700
by (blast_tac (claset() addIs [isNSCont_isNSopen,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   701
    isNSopen_isNSCont]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   702
qed "isNSCont_isNSopen_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   703
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   704
(%*------- Standard version of same theorem --------*%)
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   705
Goal "(ALL x. isCont f x) = \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   706
\         (ALL A. isopen A --> isopen {x. f(x) : A})";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   707
by (auto_tac (claset() addSIs [isNSCont_isNSopen_iff],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   708
              simpset() addsimps [isNSopen_isopen_iff RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   709
              isNSCont_isCont_iff RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   710
qed "isCont_isopen_iff";
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
(*-----------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   714
                        Uniform continuity
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   715
 ------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   716
Goalw [isNSUCont_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   717
      "[| isNSUCont f; x @= y|] ==> (*f* f) x @= (*f* f) y";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   718
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   719
qed "isNSUContD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   720
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   721
Goalw [isUCont_def,isCont_def,LIM_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   722
     "isUCont f ==> EX x. isCont f x";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   723
by (Force_tac 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   724
qed "isUCont_isCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   725
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   726
Goalw [isNSUCont_def,isUCont_def,inf_close_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   727
     "isUCont f ==> isNSUCont f";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   728
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   729
    [Infinitesimal_FreeUltrafilterNat_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   730
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   731
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   732
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   733
by (auto_tac (claset(),simpset() addsimps [starfun,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   734
    hypreal_minus, hypreal_add]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   735
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
   736
by (dres_inst_tac [("x","u")] spec 1 THEN Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   737
by (dres_inst_tac [("x","s")] spec 1 THEN Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   738
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
   739
by (Blast_tac 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   740
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
   741
by (dtac FreeUltrafilterNat_all 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   742
by (Ultra_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   743
qed "isUCont_isNSUCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   744
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   745
Goal "ALL s. #0 < s --> \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   746
\              (EX xa y. abs (xa + - y) < s  & \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   747
\              r <= abs (f xa + -f y)) ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   748
\              ALL n::nat. EX xa y.  \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   749
\              abs(xa + -y) < inverse(real_of_posnat n) & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   750
\              r <= abs(f xa + -f y)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   751
by (Step_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   752
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
   753
by Auto_tac;
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   754
val lemma_LIMu = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   755
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   756
Goal "ALL s. #0 < s --> \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   757
\              (EX xa y. abs (xa + - y) < s  & \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   758
\              r <= abs (f xa + -f y)) ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   759
\              EX X Y. ALL n::nat. \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   760
\              abs(X n + -(Y n)) < inverse(real_of_posnat n) & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   761
\              r <= abs(f (X n) + -f (Y n))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   762
by (dtac lemma_LIMu 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   763
by (dtac choice 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   764
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   765
by (dtac choice 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   766
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   767
val lemma_skolemize_LIM2u = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   768
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   769
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
   770
\         r <= abs (f (X n) + - f(Y n)) ==> \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   771
\         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
   772
by (Auto_tac );
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   773
val lemma_simpu = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   774
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   775
Goal "{n. f (X n) + - f(Y n) = Ya n} Int \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
   776
\         {n. abs (X n + - Y n) < inverse (real_of_posnat  n) & \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   777
\             r <= abs (f (X n) + - f(Y n))} <= \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   778
\         {n. r <= abs (Ya n)}";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   779
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   780
val lemma_Intu = result ();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   781
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   782
Goalw [isNSUCont_def,isUCont_def,inf_close_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   783
     "isNSUCont f ==> isUCont f";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   784
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   785
    [Infinitesimal_FreeUltrafilterNat_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   786
by (EVERY1[Step_tac, rtac ccontr, Asm_full_simp_tac]);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   787
by (fold_tac [real_le_def]);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   788
by (dtac lemma_skolemize_LIM2u 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   789
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   790
by (dres_inst_tac [("x","Abs_hypreal(hyprel^^{X})")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   791
by (dres_inst_tac [("x","Abs_hypreal(hyprel^^{Y})")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   792
by (asm_full_simp_tac (simpset() addsimps [starfun,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   793
    hypreal_minus,hypreal_add]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   794
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   795
by (dtac (lemma_simpu RS real_seq_to_hypreal_Infinitesimal2) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   796
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   797
    [Infinitesimal_FreeUltrafilterNat_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   798
     hypreal_minus,hypreal_add]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   799
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   800
by (rotate_tac 2 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   801
by (dres_inst_tac [("x","r")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   802
by (Clarify_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   803
by (dtac FreeUltrafilterNat_all 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   804
by (Ultra_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   805
qed "isNSUCont_isUCont";
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
(*------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   808
                         Derivatives
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   809
 ------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   810
Goalw [deriv_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   811
      "(DERIV f x :> D) = ((%h. (f(x + h) + - f(x))/h) -- #0 --> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   812
by (Blast_tac 1);        
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   813
qed "DERIV_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   814
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   815
Goalw [deriv_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   816
      "(DERIV f x :> D) = ((%h. (f(x + h) + - f(x))/h) -- #0 --NS> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   817
by (simp_tac (simpset() addsimps [LIM_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   818
qed "DERIV_NS_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   819
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   820
Goalw [deriv_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   821
      "DERIV f x :> D \
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   822
\      ==> (%h. (f(x + h) + - f(x))/h) -- #0 --> D";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   823
by (Blast_tac 1);        
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   824
qed "DERIVD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   825
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   826
Goalw [deriv_def] "DERIV f x :> D ==> \
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   827
\          (%h. (f(x + h) + - f(x))/h) -- #0 --NS> D";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   828
by (asm_full_simp_tac (simpset() addsimps [LIM_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   829
qed "NS_DERIVD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   830
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   831
(* Uniqueness *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   832
Goalw [deriv_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   833
      "[| DERIV f x :> D; DERIV f x :> E |] ==> D = E";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   834
by (blast_tac (claset() addIs [LIM_unique]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   835
qed "DERIV_unique";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   836
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   837
Goalw [nsderiv_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   838
     "[| NSDERIV f x :> D; NSDERIV f x :> E |] ==> D = E";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   839
by (cut_facts_tac [Infinitesimal_epsilon,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   840
             hypreal_epsilon_not_zero] 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   841
by (auto_tac (claset() addSDs [bspec] addSIs 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   842
   [inj_hypreal_of_real RS injD] addDs [inf_close_trans3],simpset()));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   843
qed "NSDeriv_unique";
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
(*------------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   846
                          Differentiable
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
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   849
Goalw [differentiable_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   850
      "f differentiable x ==> EX D. DERIV f x :> D";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   851
by (assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   852
qed "differentiableD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   853
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   854
Goalw [differentiable_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   855
      "DERIV f x :> D ==> f differentiable x";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   856
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   857
qed "differentiableI";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   858
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   859
Goalw [NSdifferentiable_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   860
      "f NSdifferentiable x ==> EX D. NSDERIV f x :> D";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   861
by (assume_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   862
qed "NSdifferentiableD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   863
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   864
Goalw [NSdifferentiable_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   865
      "NSDERIV f x :> D ==> f NSdifferentiable x";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   866
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   867
qed "NSdifferentiableI";
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
(*--------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   870
      Alternative definition for differentiability
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
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   873
Goalw [LIM_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   874
 "((%h. (f(a + h) + - f(a))/h) -- #0 --> D) = \
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   875
\ ((%x. (f(x) + -f(a)) / (x + -a)) -- a --> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   876
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   877
by (ALLGOALS(dtac spec));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   878
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   879
by (Blast_tac 1 THEN Blast_tac 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   880
by (ALLGOALS(res_inst_tac [("x","s")] exI));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   881
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   882
by (dres_inst_tac [("x","x + -a")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   883
by (dres_inst_tac [("x","x + a")] spec 2);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   884
by (auto_tac (claset(), simpset() addsimps real_add_ac));
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   885
by (arith_tac 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   886
qed "DERIV_LIM_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   887
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   888
Goalw [deriv_def] "(DERIV f x :> D) = \
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   889
\         ((%z. (f(z) + -f(x)) / (z + -x)) -- x --> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   890
by (simp_tac (simpset() addsimps [DERIV_LIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   891
qed "DERIV_iff2";
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
(*--------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   894
  Equivalence of NS and standard defs of differentiation
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
(*-------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   897
   First NSDERIV in terms of NSLIM 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   898
 -------------------------------------------*)
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   899
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   900
Addsimps [starfun_Id];  (*???????Star.ML?????*)
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   901
(*--- first equivalence ---*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   902
Goalw [nsderiv_def,NSLIM_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   903
      "(NSDERIV f x :> D) = ((%h. (f(x + h) + - f(x))/h) -- #0 --NS> D)";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   904
by (auto_tac (claset(), simpset() addsimps [hypreal_of_real_zero]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   905
by (dres_inst_tac [("x","xa")] bspec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   906
by (rtac ccontr 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   907
by (dres_inst_tac [("x","h")] spec 3);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   908
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   909
              simpset() addsimps [mem_infmal_iff,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   910
            starfun_divide RS sym, starfun_add RS sym,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   911
            hypreal_of_real_minus, starfun_lambda_cancel]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   912
qed "NSDERIV_NSLIM_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   913
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   914
(*--- second equivalence ---*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   915
Goal "(NSDERIV f x :> D) = \
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   916
\         ((%z. (f(z) + -f(x)) / (z + -x)) -- x --NS> D)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   917
by (full_simp_tac (simpset() addsimps 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   918
     [NSDERIV_NSLIM_iff, DERIV_LIM_iff, LIM_NSLIM_iff RS sym]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   919
qed "NSDERIV_NSLIM_iff2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   920
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   921
(* while we're at it! *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   922
Goalw [real_diff_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   923
     "(NSDERIV f x :> D) = \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   924
\     (ALL xa. \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   925
\       xa ~= hypreal_of_real x & xa @= hypreal_of_real x --> \
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   926
\       (*f* (%z. (f z - f x) / (z - x))) xa @= hypreal_of_real D)";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   927
by (auto_tac (claset(), simpset() addsimps [NSDERIV_NSLIM_iff2, NSLIM_def]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   928
qed "NSDERIV_iff2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   929
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   930
Addsimps [inf_close_refl];
10670
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
   931
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   932
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   933
(*FIXME: replace both of these by simprocs for cancellation of common factors*)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   934
Goal "h ~= (0::hypreal) ==> (x/h)*h = x";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   935
by (asm_simp_tac 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   936
    (simpset() addsimps [hypreal_divide_def, hypreal_mult_inverse_left, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   937
                         hypreal_mult_assoc]) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   938
qed "hypreal_divide_mult_self_eq"; 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   939
Addsimps [hypreal_divide_mult_self_eq];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   940
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   941
Goal "h ~= (0::real) ==> (x/h)*h = x";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   942
by (asm_full_simp_tac 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   943
    (simpset() addsimps [real_divide_def, real_mult_inv_left, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   944
                         real_mult_assoc]) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   945
qed "real_divide_mult_self_eq"; 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   946
Addsimps [real_divide_mult_self_eq];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   947
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   948
Goal "(NSDERIV f x :> D) ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   949
\    (ALL xa. \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   950
\       xa @= hypreal_of_real x --> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   951
\       (*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
   952
by (auto_tac (claset(),simpset() addsimps [NSDERIV_iff2]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   953
by (case_tac "xa = hypreal_of_real x" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   954
by (auto_tac (claset(),simpset() addsimps [hypreal_diff_def,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   955
    hypreal_of_real_zero]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   956
by (dres_inst_tac [("x","xa")] spec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   957
by Auto_tac;
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   958
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
   959
     inf_close_mult1 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   960
by (ALLGOALS(dtac (hypreal_not_eq_minus_iff RS iffD1)));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   961
by (subgoal_tac "(*f* (%z. z - x)) xa ~= (0::hypreal)" 2);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   962
by (rotate_tac ~1 2);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   963
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   964
    simpset() addsimps [starfun_divide RS sym, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   965
	    starfun_add RS sym, real_diff_def, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   966
	    hypreal_of_real_minus, hypreal_diff_def, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   967
	    (inf_close_minus_iff RS iffD1) RS (mem_infmal_iff RS iffD2),  
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   968
	    Infinitesimal_subset_HFinite RS subsetD]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   969
qed "NSDERIVD5";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   970
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   971
Goal "(NSDERIV f x :> D) ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   972
\     (ALL h: Infinitesimal. \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   973
\              ((*f* f)(hypreal_of_real x + h) - \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   974
\                hypreal_of_real (f x))@= (hypreal_of_real D) * h)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   975
by (auto_tac (claset(),simpset() addsimps [nsderiv_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   976
by (case_tac "h = (0::hypreal)" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   977
by (auto_tac (claset(),simpset() addsimps [hypreal_diff_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   978
by (dres_inst_tac [("x","h")] bspec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   979
by (dres_inst_tac [("c","h")] inf_close_mult1 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   980
by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   981
              simpset() addsimps [hypreal_diff_def]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   982
qed "NSDERIVD4";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   983
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   984
Goal "(NSDERIV f x :> D) ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   985
\     (ALL h: Infinitesimal - {0}. \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   986
\              ((*f* f)(hypreal_of_real x + h) - \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   987
\                hypreal_of_real (f x))@= (hypreal_of_real D) * h)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   988
by (auto_tac (claset(),simpset() addsimps [nsderiv_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   989
by (rtac ccontr 1 THEN dres_inst_tac [("x","h")] bspec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   990
by (dres_inst_tac [("c","h")] inf_close_mult1 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   991
by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
   992
              simpset() addsimps [hypreal_mult_assoc, hypreal_diff_def]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   993
qed "NSDERIVD3";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   994
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   995
(*--------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   996
          Now equivalence between NSDERIV and DERIV
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   997
 -------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   998
Goalw [deriv_def] "(NSDERIV f x :> D) = (DERIV f x :> D)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
   999
by (simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,LIM_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1000
qed "NSDERIV_DERIV_iff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1001
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1002
(*---------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1003
         Differentiability implies continuity 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1004
         nice and simple "algebraic" proof
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1005
 --------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1006
Goalw [nsderiv_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1007
      "NSDERIV f x :> D ==> isNSCont f x";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1008
by (auto_tac (claset(),simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1009
        [isNSCont_NSLIM_iff,NSLIM_def]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1010
by (dtac (inf_close_minus_iff RS iffD1) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1011
by (dtac (hypreal_not_eq_minus_iff RS iffD1) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1012
by (dres_inst_tac [("x","-hypreal_of_real x + xa")] bspec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1013
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1014
    [hypreal_add_assoc RS sym]) 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1015
by (auto_tac (claset(),simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1016
    [mem_infmal_iff RS sym,hypreal_add_commute]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1017
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
  1018
by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1019
    RS subsetD],simpset() addsimps [hypreal_mult_assoc]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1020
by (dres_inst_tac [("x3","D")] (HFinite_hypreal_of_real RSN
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1021
    (2,Infinitesimal_HFinite_mult) RS (mem_infmal_iff RS iffD1)) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1022
by (blast_tac (claset() addIs [inf_close_trans,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1023
    hypreal_mult_commute RS subst,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1024
    (inf_close_minus_iff RS iffD2)]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1025
qed "NSDERIV_isNSCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1026
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1027
(* Now Sandard proof *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1028
Goal "DERIV f x :> D ==> isCont f x";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1029
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1030
    [NSDERIV_DERIV_iff RS sym, isNSCont_isCont_iff RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1031
     NSDERIV_isNSCont]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1032
qed "DERIV_isCont";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1033
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
      Differentiation rules for combinations of functions
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1036
      follow from clear, straightforard, algebraic 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1037
      manipulations
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1038
 ----------------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1039
(*-------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1040
    Constant function
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1041
 ------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1042
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1043
(* use simple constant nslimit theorem *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1044
Goal "(NSDERIV (%x. k) x :> #0)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1045
by (simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1046
    [NSDERIV_NSLIM_iff,real_add_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1047
qed "NSDERIV_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1048
Addsimps [NSDERIV_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1049
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1050
Goal "(DERIV (%x. k) x :> #0)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1051
by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1052
qed "DERIV_const";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1053
Addsimps [DERIV_const];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1054
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
    Sum of functions- proved easily
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1057
 ----------------------------------------------------*)
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1058
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1059
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1060
Goal "hypreal_of_real (z1 / z2) = hypreal_of_real z1 / hypreal_of_real z2";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1061
by (simp_tac (simpset() addsimps [hypreal_divide_def, real_divide_def, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1062
                          hypreal_of_real_mult, hypreal_of_real_inverse]) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1063
qed "hypreal_of_real_divide";  (**??????HYPERDEF.ML??????*)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1064
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1065
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1066
(**??????HYPERDEF.ML???after inverse_distrib???*)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1067
Goal "(x::hypreal) * (y/z) = (x*y)/z";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1068
by (simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 1); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1069
qed "hypreal_times_divide1_eq";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1070
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1071
Goal "(y/z) * (x::hypreal) = (y*x)/z";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1072
by (simp_tac (simpset() addsimps [hypreal_divide_def]@hypreal_mult_ac) 1); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1073
qed "hypreal_times_divide2_eq";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1074
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1075
Addsimps [hypreal_times_divide1_eq, hypreal_times_divide2_eq];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1076
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1077
Goal "(x::hypreal) / (y/z) = (x*z)/y";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1078
by (simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_inverse_distrib]@
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1079
                                 hypreal_mult_ac) 1); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1080
qed "hypreal_divide_divide1_eq";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1081
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1082
Goal "((x::hypreal) / y) / z = x/(y*z)";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1083
by (simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_inverse_distrib, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1084
                                  hypreal_mult_assoc]) 1); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1085
qed "hypreal_divide_divide2_eq";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1086
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1087
Addsimps [hypreal_divide_divide1_eq, hypreal_divide_divide2_eq];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1088
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1089
(** As with multiplication, pull minus signs OUT of the / operator **)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1090
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1091
Goal "(-x) / (y::hypreal) = - (x/y)";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1092
by (simp_tac (simpset() addsimps [hypreal_divide_def]) 1); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1093
qed "hypreal_minus_divide_eq";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1094
Addsimps [hypreal_minus_divide_eq];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1095
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1096
Goal "(x / -(y::hypreal)) = - (x/y)";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1097
by (simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_minus_inverse]) 1); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1098
qed "hypreal_divide_minus_eq";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1099
Addsimps [hypreal_divide_minus_eq];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1100
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1101
Goal "(x+y)/(z::hypreal) = x/z + y/z";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1102
by (simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_add_mult_distrib]) 1); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1103
qed "hypreal_add_divide_distrib";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1104
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1105
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1106
Goal "[| NSDERIV f x :> Da;  NSDERIV g x :> Db |] \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1107
\     ==> NSDERIV (%x. f x + g x) x :> Da + Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1108
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1109
           NSLIM_def]) 1 THEN REPEAT(Step_tac 1));
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1110
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1111
       simpset() addsimps [starfun_divide RS sym, starfun_add RS sym,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1112
    hypreal_of_real_minus, hypreal_of_real_add, hypreal_of_real_divide,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1113
    hypreal_add_divide_distrib]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1114
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
  1115
by (auto_tac (claset(),simpset() addsimps hypreal_add_ac));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1116
qed "NSDERIV_add";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1117
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1118
(* Standard theorem *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1119
Goal "[| DERIV f x :> Da; DERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1120
\     ==> DERIV (%x. f x + g x) x :> Da + Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1121
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_add,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1122
    NSDERIV_DERIV_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1123
qed "DERIV_add";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1124
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
  Product of functions - Proof is trivial but tedious
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1127
  and long due to rearrangement of terms  
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1128
 ----------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1129
(* lemma - terms manipulation tedious as usual*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1130
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1131
Goal "((a::real)*b) + -(c*d) = (b*(a + -c)) + \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1132
\                           (c*(b + -d))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1133
by (full_simp_tac (simpset() addsimps [real_add_mult_distrib2,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1134
    real_minus_mult_eq2 RS sym,real_mult_commute]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1135
val lemma_nsderiv1 = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1136
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1137
(*FIXME: replace both of these by simprocs for cancellation of common factors*)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1138
Goal "h ~= (0::hypreal) ==> (x*h)/h = x";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1139
by (asm_simp_tac 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1140
    (simpset() addsimps [hypreal_divide_def, hypreal_mult_inverse_left, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1141
                         hypreal_mult_assoc]) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1142
qed "hypreal_divide_mult2_self_eq"; 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1143
Addsimps [hypreal_divide_mult2_self_eq];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1144
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1145
Goal "h ~= (0::real) ==> (x*h)/h = x";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1146
by (asm_full_simp_tac 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1147
    (simpset() addsimps [real_divide_def, real_mult_inv_left, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1148
                         real_mult_assoc]) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1149
qed "real_divide_mult2_self_eq"; 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1150
Addsimps [real_divide_mult2_self_eq];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1151
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1152
Goal "[| (x + y) / z = hypreal_of_real D + yb; z ~= 0; \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1153
\        z : Infinitesimal; yb : Infinitesimal |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1154
\     ==> x + y @= 0";
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1155
by (forw_inst_tac [("c1","z")] (hypreal_mult_right_cancel RS iffD2) 1 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1156
    THEN assume_tac 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1157
by (thin_tac "(x + y) / z = hypreal_of_real  D + yb" 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1158
by (auto_tac (claset() addSIs [Infinitesimal_HFinite_mult2, HFinite_add],
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1159
              simpset() addsimps [hypreal_mult_assoc, mem_infmal_iff RS sym]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1160
by (etac (Infinitesimal_subset_HFinite RS subsetD) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1161
val lemma_nsderiv2 = result();
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1162
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1163
Goal "[| NSDERIV f x :> Da; NSDERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1164
\     ==> NSDERIV (%x. f x * g x) x :> (Da * g(x)) + (Db * f(x))";
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1165
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff, NSLIM_def]) 1 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1166
    THEN REPEAT(Step_tac 1));
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1167
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1168
       simpset() addsimps [starfun_divide RS sym, starfun_mult RS sym,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1169
              starfun_add RS sym,starfun_lambda_cancel,hypreal_of_real_zero,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1170
              lemma_nsderiv1]));
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1171
by (simp_tac (simpset() addsimps [hypreal_add_divide_distrib]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1172
by (REPEAT(dtac (bex_Infinitesimal_iff2 RS iffD2) 1));
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1173
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1174
        simpset() delsimps [hypreal_times_divide1_eq]
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1175
		  addsimps [hypreal_times_divide1_eq RS sym, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1176
                            hypreal_of_real_minus]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1177
by (dres_inst_tac [("D","Db")] lemma_nsderiv2 1);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1178
by (dtac (inf_close_minus_iff RS iffD2 RS (bex_Infinitesimal_iff2 RS iffD2)) 4);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1179
by (auto_tac (claset() addSIs [inf_close_add_mono1],
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1180
    simpset() addsimps [hypreal_of_real_add,hypreal_add_mult_distrib,
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1181
         hypreal_add_mult_distrib2,hypreal_of_real_mult,hypreal_mult_commute,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1182
         hypreal_add_assoc]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1183
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
  1184
    (hypreal_add_commute RS subst) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1185
by (auto_tac (claset() addSIs [Infinitesimal_add_inf_close_self2 RS 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1186
                 inf_close_sym,Infinitesimal_add,Infinitesimal_mult,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1187
                 Infinitesimal_hypreal_of_real_mult,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1188
                 Infinitesimal_hypreal_of_real_mult2 ],
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1189
      simpset() addsimps [hypreal_add_assoc RS sym]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1190
qed "NSDERIV_mult";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1191
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1192
Goal "[| DERIV f x :> Da; DERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1193
\     ==> 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
  1194
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_mult,
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1195
                                           NSDERIV_DERIV_iff RS sym]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1196
qed "DERIV_mult";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1197
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1198
(*----------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1199
   Multiplying by a constant
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1200
 ---------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1201
Goal "NSDERIV f x :> D \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1202
\     ==> NSDERIV (%x. c * f x) x :> c*D";
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1203
by (asm_full_simp_tac 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1204
    (simpset() addsimps [real_times_divide1_eq RS sym, NSDERIV_NSLIM_iff,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1205
                         real_minus_mult_eq2, real_add_mult_distrib2 RS sym] 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1206
             delsimps [real_times_divide1_eq, real_minus_mult_eq2 RS sym]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1207
by (etac (NSLIM_const RS NSLIM_mult) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1208
qed "NSDERIV_cmult";
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
(* let's do the standard proof though theorem *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1211
(* LIM_mult2 follows from a NS proof          *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1212
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1213
Goalw [deriv_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1214
      "DERIV f x :> D \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1215
\      ==> DERIV (%x. c * f x) x :> c*D";
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1216
by (asm_full_simp_tac 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1217
    (simpset() addsimps [real_times_divide1_eq RS sym, NSDERIV_NSLIM_iff,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1218
                         real_minus_mult_eq2, real_add_mult_distrib2 RS sym] 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1219
             delsimps [real_times_divide1_eq, real_minus_mult_eq2 RS sym]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1220
by (etac (LIM_const RS LIM_mult2) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1221
qed "DERIV_cmult";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1222
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1223
(*--------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1224
   Negation of function
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
Goal "NSDERIV f x :> D \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1227
\      ==> NSDERIV (%x. -(f x)) x :> -D";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1228
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1229
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
  1230
by (asm_simp_tac (simpset() addsimps [real_minus_add_distrib RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1231
    real_minus_mult_eq1 RS sym] delsimps [real_minus_add_distrib,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1232
    real_minus_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1233
by (etac NSLIM_minus 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1234
qed "NSDERIV_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1235
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1236
Goal "DERIV f x :> D \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1237
\     ==> DERIV (%x. -(f x)) x :> -D";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1238
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1239
    [NSDERIV_minus,NSDERIV_DERIV_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1240
qed "DERIV_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1241
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1242
(*-------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1243
   Subtraction
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1244
 ------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1245
Goal "[| NSDERIV f x :> Da; NSDERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1246
\     ==> NSDERIV (%x. f x + -g x) x :> Da + -Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1247
by (blast_tac (claset() addDs [NSDERIV_add,NSDERIV_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1248
qed "NSDERIV_add_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1249
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1250
Goal "[| DERIV f x :> Da; DERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1251
\     ==> DERIV (%x. f x + -g x) x :> Da + -Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1252
by (blast_tac (claset() addDs [DERIV_add,DERIV_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1253
qed "DERIV_add_minus";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1254
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1255
Goalw [real_diff_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1256
     "[| NSDERIV f x :> Da; NSDERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1257
\     ==> NSDERIV (%x. f x - g x) x :> Da - Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1258
by (blast_tac (claset() addIs [NSDERIV_add_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1259
qed "NSDERIV_diff";
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
Goalw [real_diff_def]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1262
     "[| DERIV f x :> Da; DERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1263
\      ==> DERIV (%x. f x - g x) x :> Da - Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1264
by (blast_tac (claset() addIs [DERIV_add_minus]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1265
qed "DERIV_diff";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1266
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1267
(*---------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1268
                     (NS) Increment
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1269
 ---------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1270
Goalw [increment_def] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1271
      "f NSdifferentiable x ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1272
\     increment f x h = (*f* f) (hypreal_of_real(x) + h) + \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1273
\     -hypreal_of_real (f x)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1274
by (Blast_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1275
qed "incrementI";
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
Goal "NSDERIV f x :> D ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1278
\    increment f x h = (*f* f) (hypreal_of_real(x) + h) + \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1279
\    -hypreal_of_real (f x)";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1280
by (etac (NSdifferentiableI RS incrementI) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1281
qed "incrementI2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1282
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1283
(*FIXME: replace by simprocs for cancellation of common factors*)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1284
Goal "h ~= (0::hypreal) ==> h/h = 1hr";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1285
by (asm_simp_tac 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1286
    (simpset() addsimps [hypreal_divide_def, hypreal_mult_inverse_left]) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1287
qed "hypreal_divide_self_eq"; 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1288
Addsimps [hypreal_divide_self_eq];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1289
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1290
(* The Increment theorem -- Keisler p. 65 *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1291
Goal "[| NSDERIV f x :> D; h: Infinitesimal; h ~= 0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1292
\     ==> 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
  1293
by (forw_inst_tac [("h","h")] incrementI2 1 THEN rewtac nsderiv_def);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1294
by (dtac bspec 1 THEN Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1295
by (dtac (bex_Infinitesimal_iff2 RS iffD2) 1 THEN Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1296
by (forw_inst_tac [("b1","hypreal_of_real(D) + y")] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1297
    (hypreal_mult_right_cancel RS iffD2) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1298
by (thin_tac "((*f* f) (hypreal_of_real(x) + h) + \
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1299
\   - hypreal_of_real (f x)) / h = hypreal_of_real(D) + y" 2);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1300
by (assume_tac 1);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1301
by (asm_full_simp_tac (simpset() addsimps [hypreal_times_divide1_eq RS sym]
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1302
             delsimps [hypreal_times_divide1_eq]) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1303
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1304
              simpset() addsimps [hypreal_add_mult_distrib]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1305
qed "increment_thm";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1306
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1307
Goal "[| NSDERIV f x :> D; h @= 0; h ~= 0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1308
\      ==> EX e: Infinitesimal. increment f x h = \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1309
\             hypreal_of_real(D)*h + e*h";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1310
by (blast_tac (claset() addSDs [mem_infmal_iff RS iffD2] 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1311
    addSIs [increment_thm]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1312
qed "increment_thm2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1313
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1314
Goal "[| NSDERIV f x :> D; h @= 0; h ~= 0 |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1315
\     ==> increment f x h @= 0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1316
by (dtac increment_thm2 1 THEN auto_tac (claset() addSIs 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1317
    [Infinitesimal_HFinite_mult2,HFinite_add],simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1318
    [hypreal_add_mult_distrib RS sym,mem_infmal_iff RS sym]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1319
by (etac (Infinitesimal_subset_HFinite RS subsetD) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1320
qed "increment_inf_close_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1321
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1322
(*---------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1323
   Similarly to the above, the chain rule admits an entirely
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1324
   straightforward derivation. Compare this with Harrison's
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1325
   HOL proof of the chain rule, which proved to be trickier and
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1326
   required an alternative characterisation of differentiability- 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1327
   the so-called Carathedory derivative. Our main problem is
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1328
   manipulation of terms.
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1329
 --------------------------------------------------------------*)
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1330
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1331
(*???HYPERDEF.ML???*)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1332
Goal "(0::hypreal)/x = 0";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1333
by (simp_tac (simpset() addsimps [hypreal_divide_def]) 1); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1334
qed "hypreal_zero_divide";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1335
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1336
Goal "x/1hr = x";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1337
by (simp_tac (simpset() addsimps [hypreal_divide_def]) 1); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1338
qed "hypreal_divide_one";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1339
Addsimps [hypreal_zero_divide, hypreal_divide_one];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1340
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1341
(* lemmas *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1342
Goalw [nsderiv_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1343
      "[| NSDERIV g x :> D; \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1344
\              (*f* g) (hypreal_of_real(x) + xa) = hypreal_of_real(g x);\
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1345
\              xa : Infinitesimal;\
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1346
\              xa ~= 0 \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1347
\           |] ==> D = #0";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1348
by (dtac bspec 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1349
by (Auto_tac);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1350
by (asm_full_simp_tac (simpset() addsimps [hypreal_of_real_zero RS sym]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1351
qed "NSDERIV_zero";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1352
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1353
(* can be proved differently using NSLIM_isCont_iff *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1354
Goalw [nsderiv_def] 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1355
      "[| NSDERIV f x :> D; \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1356
\              h: Infinitesimal; h ~= 0 \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1357
\           |] ==> (*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
  1358
by (asm_full_simp_tac (simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1359
    [mem_infmal_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1360
by (rtac Infinitesimal_ratio 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1361
by (rtac inf_close_hypreal_of_real_HFinite 3);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1362
by (Auto_tac);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1363
qed "NSDERIV_inf_close";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1364
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1365
(*--------------------------------------------------------------- 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1366
   from one version of differentiability 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1367
 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1368
                f(x) - f(a)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1369
              --------------- @= Db
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1370
                  x - a
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1371
 ---------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1372
Goal "[| NSDERIV f (g x) :> Da; \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1373
\        (*f* g) (hypreal_of_real(x) + xa) ~= hypreal_of_real (g x); \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1374
\        (*f* g) (hypreal_of_real(x) + xa) @= hypreal_of_real (g x) \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1375
\     |] ==> ((*f* f) ((*f* g) (hypreal_of_real(x) + xa)) \
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1376
\                  + - hypreal_of_real (f (g x))) \
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1377
\             / ((*f* g) (hypreal_of_real(x) + xa) + - hypreal_of_real (g x)) \
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1378
\            @= hypreal_of_real(Da)";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1379
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1380
       simpset() addsimps [NSDERIV_NSLIM_iff2, NSLIM_def, starfun_divide RS sym,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1381
                           hypreal_of_real_minus,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1382
                           starfun_add RS sym]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1383
qed "NSDERIVD1";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1384
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1385
(*-------------------------------------------------------------- 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1386
   from other version of differentiability 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1387
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1388
                f(x + h) - f(x)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1389
               ----------------- @= Db
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1390
                       h
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1391
 --------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1392
Goal "[| NSDERIV g x :> Db; xa: Infinitesimal; xa ~= 0 |] \
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1393
\     ==> ((*f* g) (hypreal_of_real(x) + xa) + - hypreal_of_real(g x)) / xa \
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1394
\         @= hypreal_of_real(Db)";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1395
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1396
    simpset() addsimps [NSDERIV_NSLIM_iff, NSLIM_def, starfun_divide RS sym,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1397
		starfun_add RS sym, hypreal_of_real_zero, mem_infmal_iff,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1398
		starfun_lambda_cancel,hypreal_of_real_minus]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1399
qed "NSDERIVD2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1400
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1401
(*---------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1402
  This proof uses both possible definitions
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1403
  for differentiability.
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1404
 --------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1405
Goal "[| NSDERIV f (g x) :> Da; NSDERIV g x :> Db |] \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1406
\     ==> NSDERIV (f o g) x :> Da * Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1407
by (asm_simp_tac (simpset() addsimps [NSDERIV_NSLIM_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1408
    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
  1409
by (forw_inst_tac [("f","g")] NSDERIV_inf_close 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1410
by (auto_tac (claset(),simpset() addsimps [starfun_add RS sym,
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1411
    hypreal_of_real_minus, hypreal_of_real_mult,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1412
    starfun_lambda_cancel2,starfun_o RS sym, starfun_divide RS sym]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1413
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
  1414
by (dres_inst_tac [("g","g")] NSDERIV_zero 1);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1415
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1416
    simpset() addsimps [hypreal_divide_def, hypreal_of_real_zero]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1417
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
  1418
    ("y1","inverse xa")] (lemma_chain RS ssubst) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1419
by (etac (hypreal_not_eq_minus_iff RS iffD1) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1420
by (rtac inf_close_mult_hypreal_of_real 1);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1421
by (fold_tac [hypreal_divide_def]);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1422
by (blast_tac (claset() addIs [NSDERIVD1,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1423
    inf_close_minus_iff RS iffD2]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1424
by (blast_tac (claset() addIs [NSDERIVD2]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1425
qed "NSDERIV_chain";
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
(* standard version *)
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1428
Goal "[| DERIV f (g x) :> Da; \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1429
\                 DERIV g x :> Db \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1430
\              |] ==> DERIV (f o g) x :> Da * Db";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1431
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_DERIV_iff RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1432
    NSDERIV_chain]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1433
qed "DERIV_chain";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1434
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1435
Goal "[| DERIV f (g x) :> Da; DERIV g x :> Db |] \
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1436
\     ==> DERIV (%x. f (g x)) x :> Da * Db";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1437
by (auto_tac (claset() addDs [DERIV_chain], simpset() addsimps [o_def]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1438
qed "DERIV_chain2";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1439
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1440
(*------------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1441
           Differentiation of natural number powers
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1442
 ------------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1443
Goal "NSDERIV (%x. x) x :> #1";
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1444
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1445
     simpset() addsimps [NSDERIV_NSLIM_iff,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1446
          NSLIM_def, starfun_divide RS sym,starfun_Id, hypreal_of_real_zero,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1447
           hypreal_of_real_one]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1448
qed "NSDERIV_Id";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1449
Addsimps [NSDERIV_Id];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1450
10670
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  1451
(*derivative of the identity function*)
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1452
Goal "DERIV (%x. x) x :> #1";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1453
by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1454
qed "DERIV_Id";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1455
Addsimps [DERIV_Id];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1456
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1457
bind_thm ("isCont_Id", DERIV_Id RS DERIV_isCont);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1458
10670
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  1459
(*derivative of linear multiplication*)
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1460
Goal "DERIV (op * c) x :> c";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1461
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
  1462
by (Asm_full_simp_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1463
qed "DERIV_cmult_Id";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1464
Addsimps [DERIV_cmult_Id];
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1465
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1466
Goal "NSDERIV (op * c) x :> c";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1467
by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1468
qed "NSDERIV_cmult_Id";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1469
Addsimps [NSDERIV_cmult_Id];
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 "DERIV (%x. x ^ n) x :> real_of_nat n * (x ^ (n - 1))";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1472
by (induct_tac "n" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1473
by (dtac (DERIV_Id RS DERIV_mult) 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1474
by (auto_tac (claset(),simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1475
    [real_add_mult_distrib]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1476
by (case_tac "0 < n" 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1477
by (dres_inst_tac [("x","x")] realpow_minus_mult 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1478
by (auto_tac (claset(),simpset() addsimps 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1479
    [real_mult_assoc,real_add_commute]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1480
qed "DERIV_pow";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1481
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1482
(* NS version *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1483
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
  1484
by (simp_tac (simpset() addsimps [NSDERIV_DERIV_iff,DERIV_pow]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1485
qed "NSDERIV_pow";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1486
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1487
(*---------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1488
                    Power of -1 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1489
 ---------------------------------------------------------------*)
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1490
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1491
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1492
(*FIXME: replace by simprocs for cancellation of common factors*)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1493
Goal "h ~= (0::hypreal) ==> (h*x)/h = x";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1494
by (asm_simp_tac 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1495
    (simpset() addsimps [inst "z" "h" hypreal_mult_commute]) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1496
qed "hypreal_times_divide_self_eq"; 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1497
Addsimps [hypreal_times_divide_self_eq];
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1498
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1499
(*Can't get rid of x ~= #0 because it isn't continuous at zero*)
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1500
Goalw [nsderiv_def]
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1501
     "x ~= #0 ==> NSDERIV (%x. inverse(x)) x :> (- (inverse x ^ 2))";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1502
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
  1503
by (forward_tac [Infinitesimal_add_not_zero] 1);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1504
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1505
     simpset() addsimps [starfun_inverse_inverse,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1506
         hypreal_of_real_inverse RS sym,hypreal_of_real_minus,realpow_two,
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1507
         hypreal_of_real_mult,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1508
         hypreal_of_real_divide] 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1509
               delsimps [hypreal_minus_mult_eq1 RS sym,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1510
                         hypreal_minus_mult_eq2 RS sym]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1511
by (dtac (hypreal_of_real_not_zero_iff RS iffD2) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1512
by (asm_full_simp_tac (simpset() addsimps [hypreal_inverse_add,
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1513
         inverse_mult_eq RS sym, hypreal_minus_inverse RS sym] 
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1514
         @ hypreal_add_ac @ hypreal_mult_ac delsimps [hypreal_minus_mult_eq1 RS
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1515
         sym,hypreal_minus_mult_eq2 RS sym] ) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1516
by (asm_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1517
         hypreal_add_mult_distrib2] delsimps [hypreal_minus_mult_eq1 RS
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1518
         sym,hypreal_minus_mult_eq2 RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1519
by (dres_inst_tac [("x3","x") ] ((HFinite_hypreal_of_real RSN
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1520
         (2,Infinitesimal_HFinite_mult2)) RS  
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1521
          (Infinitesimal_minus_iff RS iffD1)) 1); 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1522
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
  1523
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
  1524
by (rtac inverse_add_Infinitesimal_inf_close2 2);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1525
by (auto_tac (claset() addIs [HFinite_minus_iff RS iffD1]
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1526
         addSDs [Infinitesimal_minus_iff RS iffD2,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1527
         hypreal_of_real_HFinite_diff_Infinitesimal], simpset() addsimps 
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1528
         [hypreal_minus_inverse RS sym,hypreal_of_real_mult RS sym]));
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1529
qed "NSDERIV_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1530
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1531
Goal "x ~= #0 ==> DERIV (%x. inverse(x)) x :> (-(inverse x ^ 2))";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1532
by (asm_simp_tac (simpset() addsimps [NSDERIV_inverse,
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1533
         NSDERIV_DERIV_iff RS sym] delsimps [thm "realpow_Suc"]) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1534
qed "DERIV_inverse";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1535
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1536
(*--------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1537
        Derivative of inverse 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1538
 -------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1539
Goal "[| DERIV f x :> d; f(x) ~= #0 |] \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1540
\     ==> DERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ 2)))";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1541
by (rtac (real_mult_commute RS subst) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1542
by (asm_simp_tac (simpset() addsimps [real_minus_mult_eq1,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1543
    realpow_inverse] delsimps [thm "realpow_Suc", 
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1544
    real_minus_mult_eq1 RS sym]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1545
by (fold_goals_tac [o_def]);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1546
by (blast_tac (claset() addSIs [DERIV_chain,DERIV_inverse]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1547
qed "DERIV_inverse_fun";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1548
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1549
Goal "[| NSDERIV f x :> d; f(x) ~= #0 |] \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1550
\     ==> NSDERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ 2)))";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1551
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_DERIV_iff,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1552
            DERIV_inverse_fun] delsimps [thm "realpow_Suc"]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1553
qed "NSDERIV_inverse_fun";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1554
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1555
(*--------------------------------------------------------------
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1556
        Derivative of quotient 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1557
 -------------------------------------------------------------*)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1558
Goal "[| DERIV f x :> d; DERIV g x :> e; g(x) ~= #0 |] \
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1559
\      ==> DERIV (%y. f(y) / (g y)) x :> (d*g(x) + -(e*f(x))) / (g(x) ^ 2)";
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10045
diff changeset
  1560
by (dres_inst_tac [("f","g")] DERIV_inverse_fun 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1561
by (dtac DERIV_mult 2);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1562
by (REPEAT(assume_tac 1));
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1563
by (asm_full_simp_tac
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1564
    (simpset() addsimps [real_divide_def, real_add_mult_distrib2,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1565
                         realpow_inverse,real_minus_mult_eq1] @ real_mult_ac 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1566
       delsimps [thm "realpow_Suc", real_minus_mult_eq1 RS sym,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1567
                 real_minus_mult_eq2 RS sym]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1568
qed "DERIV_quotient";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1569
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1570
Goal "[| NSDERIV f x :> d; DERIV g x :> e; g(x) ~= #0 |] \
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1571
\      ==> NSDERIV (%y. f(y) / (g y)) x :> (d*g(x) \
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1572
\                           + -(e*f(x))) / (g(x) ^ 2)";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1573
by (asm_full_simp_tac (simpset() addsimps [NSDERIV_DERIV_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1574
            DERIV_quotient] delsimps [thm "realpow_Suc"]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1575
qed "NSDERIV_quotient";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1576
 
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1577
(* ------------------------------------------------------------------------ *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1578
(* Caratheodory formulation of derivative at a point: standard proof        *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1579
(* ------------------------------------------------------------------------ *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1580
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1581
Goal "(DERIV f x :> l) = \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1582
\     (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
  1583
by (Step_tac 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1584
by (res_inst_tac 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1585
    [("x","%z. if  z = x then l else (f(z) - f(x)) / (z - x)")] exI 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1586
by (auto_tac (claset(),simpset() addsimps [real_mult_assoc,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1587
    ARITH_PROVE "z ~= x ==> z - x ~= (#0::real)"]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1588
by (auto_tac (claset(),simpset() addsimps [isCont_iff,DERIV_iff]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1589
by (ALLGOALS(rtac (LIM_equal RS iffD1)));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1590
by (auto_tac (claset(),simpset() addsimps [real_diff_def,real_mult_assoc]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1591
qed "CARAT_DERIV";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1592
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1593
Goal "NSDERIV f x :> l ==> \
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1594
\     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
  1595
by (auto_tac (claset(),simpset() addsimps [NSDERIV_DERIV_iff,
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1596
    isNSCont_isCont_iff,CARAT_DERIV]));
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1597
qed "CARAT_NSDERIV";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1598
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1599
(* How about a NS proof? *)
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1600
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
  1601
\     ==> NSDERIV f x :> l";
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1602
by (auto_tac (claset(), 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1603
              simpset() addsimps [NSDERIV_iff2, starfun_mult RS sym, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1604
                                  starfun_divide RS sym]));
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1605
by (auto_tac (claset(),
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1606
              simpset() addsimps [hypreal_mult_assoc,
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1607
                                  starfun_diff RS sym]));
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1608
by (asm_full_simp_tac (simpset() addsimps [hypreal_eq_minus_iff3 RS sym,
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1609
                                           hypreal_diff_def]) 1);
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1610
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
  1611
            hypreal_diff_def]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1612
by (asm_full_simp_tac (simpset() addsimps [isNSCont_def]) 1);
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1613
qed "CARAT_DERIVD";
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1614
 
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1615
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1616
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1617
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1618
(* 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
  1619
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1620
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1621
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
  1622
by (induct_tac "no" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1623
by (auto_tac (claset() addIs [real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1624
qed_spec_mp "lemma_f_mono_add";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1625
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1626
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1627
(* IMPROVE?: long proof! *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1628
Goal "[| ALL n. f(n) <= f(Suc n); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1629
\        ALL n. g(Suc n) <= g(n); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1630
\        ALL n. f(n) <= g(n) |] \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1631
\     ==> 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
  1632
\                           ((ALL n. m <= g(n)) & g ----> m)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1633
by (subgoal_tac "Bseq f" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1634
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
  1635
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1636
by (auto_tac (claset() addIs [real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1637
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
  1638
by (induct_tac "na" 3);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1639
by (auto_tac (claset() addIs [real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1640
by (subgoal_tac "monoseq f" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1641
by (subgoal_tac "monoseq g" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1642
by (subgoal_tac "Bseq g" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1643
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
  1644
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1645
by (auto_tac (claset() addIs [real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1646
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
  1647
by (induct_tac "na" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1648
by (auto_tac (claset() addIs [real_le_trans],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1649
by (auto_tac (claset() addSDs [Bseq_monoseq_convergent],
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1650
    simpset() addsimps [convergent_LIMSEQ_iff]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1651
by (res_inst_tac [("x","lim f")] exI 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1652
by (res_inst_tac [("x","lim g")] exI 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1653
by (auto_tac (claset() addIs [LIMSEQ_le],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1654
by (rtac real_leI 1 THEN rtac real_leI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1655
by (auto_tac (claset(),simpset() addsimps [LIMSEQ_iff,monoseq_Suc]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1656
by (ALLGOALS (dtac real_less_sum_gt_zero));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1657
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
  1658
by (rotate_tac 4 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1659
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
  1660
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1661
by (ALLGOALS(rotate_tac 5));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1662
by (ALLGOALS(dres_inst_tac [("x","no + n")] spec));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1663
by (Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1664
by (subgoal_tac "0 <= f(no + n) - lim f" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1665
by (induct_tac "no" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1666
by (auto_tac (claset() addIs [real_le_trans],
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1667
    simpset() addsimps [real_diff_def]));
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1668
by (asm_full_simp_tac (simpset() addsimps [inst "r" "f ?x + ?y" abs_real_def]) 1); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1669
by (dres_inst_tac [("i"," f (no + n)"),("no1","no")] 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1670
    (lemma_f_mono_add RSN (2,real_less_le_trans)) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1671
by (subgoal_tac "g(no + n) <= lim g" 3);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1672
by (induct_tac "no" 4);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1673
by (auto_tac (claset() addIs [real_le_trans],
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1674
    simpset() addsimps [real_diff_def,abs_minus_add_cancel]));
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1675
by (asm_full_simp_tac (simpset() addsimps [inst "r" "lim g + ?y" abs_real_def]) 2); 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1676
by (cut_inst_tac [("f", "%x. -(g x)"), ("m","n"), ("no","no")] 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1677
    lemma_f_mono_add 2);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1678
by (auto_tac (claset(), simpset() addsimps [add_commute]));
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1679
qed "lemma_nest";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1680
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1681
Goal "[| ALL n. f(n) <= f(Suc n); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1682
\        ALL n. g(Suc n) <= g(n); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1683
\        ALL n. f(n) <= g(n); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1684
\        (%n. f(n) - g(n)) ----> 0 |] \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1685
\     ==> EX l. ((ALL n. f(n) <= l) & f ----> l) & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1686
\               ((ALL n. l <= g(n)) & g ----> l)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1687
by (dtac lemma_nest 1 THEN Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1688
by (subgoal_tac "l = m" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1689
by (dres_inst_tac [("X","f")] LIMSEQ_diff 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1690
by (auto_tac (claset() addIs [LIMSEQ_unique],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1691
qed "lemma_nest_unique";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1692
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1693
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
  1694
by (rtac ex1I 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1695
by (rtac conjI 1 THEN rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1696
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
  1697
by (Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1698
by (rtac ext 1 THEN induct_tac "n" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1699
by (Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1700
qed "nat_Axiom";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1701
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1702
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1703
(*?????????OBSOLETE????????***)
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1704
Goal "((x::real) = y / (#2 * z)) = (#2 * x = y/z)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1705
by Auto_tac;  
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1706
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
  1707
by Auto_tac;  
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1708
qed "eq_divide_2_times_iff";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1709
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1710
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1711
val [prem1,prem2] =
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1712
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
  1713
\        ALL x. EX d::real. 0 < d & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1714
\               (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
  1715
\     |] ==> ALL a b. a <= b --> P(a,b)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1716
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1717
by (cut_inst_tac [("e","(a,b)"),
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1718
    ("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
  1719
\              then ((fst fn + snd fn) /#2,snd fn) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1720
\              else (fst fn,(fst fn + snd fn)/#2)")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1721
    nat_Axiom 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1722
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
  1723
(* set up 1st premise of lemma_nest_unique *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1724
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
  1725
by (rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1726
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1727
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1728
by (dres_inst_tac [("x","na")] spec 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1729
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
  1730
by (Asm_simp_tac 3);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1731
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1732
(* 2nd premise *) 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1733
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
  1734
by (rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1735
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1736
by (dres_inst_tac [("x","0")] spec 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1737
by (Asm_simp_tac 3);  (*super slow, but proved!*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1738
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1739
(* 3rd premise? [lcp] *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1740
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
  1741
by (rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1742
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1743
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1744
by (Asm_simp_tac 2 THEN rtac impI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1745
by (rtac ccontr 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1746
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
  1747
by (assume_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1748
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
  1749
by (Asm_full_simp_tac 4); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1750
by (Asm_full_simp_tac 4); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1751
by (Asm_full_simp_tac 2); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1752
by (Asm_simp_tac 2); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1753
(* 3rd premise [looks like the 4th to lcp!] *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1754
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
  1755
by (rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1756
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1757
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1758
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1759
(* FIXME: simplification takes a very long time! *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1760
by (ALLGOALS(thin_tac "ALL y. \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1761
\            y 0 = (a, b) & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1762
\            (ALL n. \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1763
\                y (Suc n) = \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1764
\                (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
  1765
\                 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
  1766
\                 else (fst (y n),\
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1767
\                       (fst (y n) + snd (y n)) /#2))) --> \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1768
\            y = fn"));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1769
(*another premise? the 5th? lcp*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1770
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
  1771
\                       (b - a) * inverse(#2 ^ n)" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1772
by (rtac allI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1773
by (induct_tac "n" 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1774
by (Asm_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1775
by (asm_full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1776
    (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
  1777
                         real_diff_mult_distrib2]) 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1778
(*end of the premises [lcp]*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1779
by (dtac lemma_nest_unique 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1780
by (REPEAT(assume_tac 1));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1781
by (Step_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1782
by (rtac LIMSEQ_minus_cancel 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1783
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
  1784
    realpow_inverse]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1785
by (subgoal_tac "#0 = (b-a) * #0" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1786
by (eres_inst_tac [("t","#0")] ssubst 1); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1787
by (rtac (LIMSEQ_const RS LIMSEQ_mult) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1788
by (rtac LIMSEQ_realpow_zero 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1789
by (Asm_full_simp_tac 3); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1790
by (EVERY1[Simp_tac, Simp_tac]);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1791
by (cut_facts_tac [prem2] 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1792
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
  1793
by (rewtac LIMSEQ_def);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1794
by (dres_inst_tac [("x","d/#2")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1795
by (dres_inst_tac [("x","d/#2")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1796
by (dtac real_less_half_sum 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1797
by (thin_tac "ALL n. \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1798
\             fn (Suc n) = \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1799
\             (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
  1800
\              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
  1801
\              else (fst (fn n), \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1802
\                    (fst (fn n) + snd (fn n))/#2))" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1803
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1804
by (ALLGOALS(Asm_full_simp_tac));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1805
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
  1806
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
  1807
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1808
by (ALLGOALS(Asm_full_simp_tac));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1809
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
  1810
\                       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
  1811
by (rtac (real_sum_of_halves RS subst) 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1812
by (rewtac real_diff_def);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1813
by (rtac real_add_less_mono 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1814
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1815
by (Asm_full_simp_tac 2); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1816
by (Asm_full_simp_tac 2); 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1817
by (res_inst_tac [("y1","fst(fn (no + noa)) ")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1818
    (abs_minus_add_cancel RS subst) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1819
by (subgoal_tac "#0 <= (l + - fst (fn (no + noa)))" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1820
by (subgoal_tac "#0 <= (snd (fn (no + noa)) + - l)" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1821
by (asm_simp_tac (simpset() addsimps [abs_eqI1] @ real_add_ac) 1);
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  1822
by (ALLGOALS(asm_simp_tac (simpset() addsimps real_add_divide_distrib::real_add_ac)));
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1823
qed "lemma_BOLZANO";
10045
c76b73e16711 New theories: construction of hypernaturals, nonstandard extensions,
fleuriot
parents:
diff changeset
  1824
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1825
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
  1826
\         (ALL x. EX d::real. 0 < d & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1827
\               (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
  1828
\         --> (ALL a b. a <= b --> P(a,b))";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1829
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1830
by (rtac (lemma_BOLZANO RS allE) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1831
by (assume_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1832
by (ALLGOALS(Blast_tac));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1833
qed "lemma_BOLZANO2";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1834
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1835
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1836
(* Intermediate Value Theorem (prove contrapositive by bisection)             *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1837
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1838
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1839
Goal "[| f(a) <= y & y <= f(b); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1840
\        a <= b; \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1841
\        (ALL x. a <= x & x <= b --> isCont f x) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1842
\     |] ==> EX x. a <= x & x <= b & f(x) = y";
10659
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1843
by (rtac contrapos_pp 1);
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1844
by (assume_tac 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1845
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
  1846
\   ~(f(u) <= y & y <= f(v))")] lemma_BOLZANO2 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1847
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1848
by (ALLGOALS(Asm_full_simp_tac));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1849
by (Blast_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1850
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
  1851
by (rtac ccontr 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1852
by (subgoal_tac "a <= x & x <= b" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1853
by (Asm_full_simp_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1854
by (rotate_tac 3 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1855
by (dres_inst_tac [("x","1r")] spec 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1856
by (Step_tac 2);
10659
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1857
by (Asm_full_simp_tac 2);
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1858
by (Asm_full_simp_tac 2);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1859
by (REPEAT(blast_tac (claset() addIs [real_le_trans]) 2));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1860
by (REPEAT(dres_inst_tac [("x","x")] spec 1));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1861
by (Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1862
(**)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1863
by (rotate_tac 4 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1864
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
  1865
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1866
by (asm_full_simp_tac (simpset() addsimps [real_less_le,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1867
                                           abs_ge_zero,real_diff_def]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1868
by (dtac (sym RS (abs_zero_iff RS iffD2)) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1869
by (arith_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1870
by (dres_inst_tac [("x","s")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1871
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1872
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
  1873
by (Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1874
by (dres_inst_tac [("x","ba - x")] spec 1);
10659
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1875
by (auto_tac (claset(),
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1876
     simpset() 
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1877
	       addsimps [abs_iff, real_diff_le_eq,
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1878
       (real_diff_def RS meta_eq_to_obj_eq) RS sym,
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1879
       real_less_le_iff, real_le_diff_eq, 
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1880
       CLAIM "(~(x::real) <= y) = (y < x)",
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1881
       CLAIM "(-x < -y) = ((y::real) < x)",
10659
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1882
       CLAIM "(-(y - x)) = (x - (y::real))",
58b6cfd8ecf3 working proofs up to isCont_has_Ub
paulson
parents: 10648
diff changeset
  1883
       CLAIM "(x-y=#0) = (x = (y::real))"]));
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1884
by (dres_inst_tac [("x","aa - x")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1885
by (case_tac "x <= aa" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1886
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
  1887
    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
  1888
    RS sym]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1889
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
  1890
by (assume_tac 1 THEN Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1891
qed "IVT";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1892
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1893
Goal "[| f(b) <= y & y <= f(a); \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1894
\        a <= b; \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1895
\        (ALL x. a <= x & x <= b --> isCont f x) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1896
\     |] ==> EX x. a <= x & x <= b & f(x) = y";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1897
by (subgoal_tac "- f a <= -y & -y <= - f b" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1898
by (thin_tac "f b <= y & y <= f a" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1899
by (dres_inst_tac [("f","%x. - f x")] IVT 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1900
by (auto_tac (claset() addIs [isCont_minus],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1901
qed "IVT2";
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
Goal "(f(a) <= y & y <= f(b) & a <= b & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1904
\     (ALL x. a <= x & x <= b --> isCont f x)) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1905
\     --> (EX x. a <= x & x <= b & f(x) = y)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1906
by (blast_tac (claset() addIs [IVT]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1907
qed "IVT_objl";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1908
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1909
Goal "(f(b) <= y & y <= f(a) & a <= b & \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1910
\     (ALL x. a <= x & x <= b --> isCont f x)) \
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1911
\     --> (EX x. a <= x & x <= b & f(x) = y)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1912
by (blast_tac (claset() addIs [IVT2]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1913
qed "IVT2_objl";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1914
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1915
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1916
(* By bisection, function continuous on closed interval is bounded above      *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1917
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1918
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1919
Goal "abs (real_of_nat x) = real_of_nat x";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1920
by (auto_tac (claset() addIs [abs_eqI1],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1921
qed "abs_real_of_nat_cancel";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1922
Addsimps [abs_real_of_nat_cancel];
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1923
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1924
Goal "~ abs(x) + 1r < x";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1925
by (rtac real_leD 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1926
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
  1927
qed "abs_add_one_not_less_self";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1928
Addsimps [abs_add_one_not_less_self];
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1929
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1930
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1931
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
  1932
\     ==> 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
  1933
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
  1934
\                         (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
  1935
    lemma_BOLZANO2 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1936
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1937
by (ALLGOALS(Asm_full_simp_tac));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1938
by (cut_inst_tac [("x","M"),("y","Ma")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1939
    (CLAIM "x <= y | y <= (x::real)") 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1940
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1941
by (res_inst_tac [("x","Ma")] exI 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1942
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1943
by (cut_inst_tac [("x","xb"),("y","xa")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1944
    (CLAIM "x <= y | y <= (x::real)") 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1945
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1946
by (rtac real_le_trans 1 THEN assume_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1947
by (Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1948
by (Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1949
by (res_inst_tac [("x","M")] exI 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1950
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1951
by (cut_inst_tac [("x","xb"),("y","xa")] 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1952
    (CLAIM "x <= y | y <= (x::real)") 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1953
by (Step_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1954
by (Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1955
by (rtac real_le_trans 1 THEN assume_tac 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1956
by (Asm_full_simp_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1957
by (case_tac "a <= x & x <= b" 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1958
by (res_inst_tac [("x","#1")] exI 2);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1959
by (auto_tac (claset(),
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1960
              simpset() addsimps [LIM_def,isCont_iff]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1961
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
  1962
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
  1963
by (dres_inst_tac [("x","#1")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1964
by Auto_tac;  
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1965
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
  1966
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
  1967
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
  1968
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
  1969
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
  1970
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
  1971
              simpset() addsimps [real_diff_def,abs_ge_self]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1972
(*arith_tac problem: this step should not be needed*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1973
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
  1974
by (auto_tac (claset(),
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1975
              simpset() addsimps [abs_real_def] addsplits [split_if_asm]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1976
qed "isCont_bounded";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1977
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1978
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1979
(* Refine the above to existence of least upper bound                         *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1980
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1981
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1982
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
  1983
\     (EX t. isLub UNIV S t)";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1984
by (blast_tac (claset() addIs [reals_complete]) 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1985
qed "lemma_reals_complete";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1986
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1987
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
  1988
\        ==> 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
  1989
\                  (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
  1990
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
  1991
    lemma_reals_complete 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1992
by (Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1993
by (dtac isCont_bounded 1 THEN assume_tac 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1994
by (auto_tac (claset(),simpset() addsimps [isUb_def,leastP_def,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1995
    isLub_def,setge_def,setle_def]));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1996
by (rtac exI 1 THEN Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1997
by (REPEAT(dtac spec 1) THEN Auto_tac);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1998
by (dres_inst_tac [("x","x")] spec 1);
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  1999
by (auto_tac (claset() addSIs [real_leI],simpset()));
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  2000
qed "isCont_has_Ub";
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  2001
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  2002
(*----------------------------------------------------------------------------*)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  2003
(* Now show that it attains its upper bound                                   *)
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
  2004
(*----------------------------------------------------------------------------*)
10662
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2005
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2006
Goal "[| a <= b; ALL x. a <= x & x <= b --> isCont f x |] \
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2007
\        ==> EX M. (ALL x. a <= x & x <= b --> f(x) <= M) & \
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2008
\                  (EX x. a <= x & x <= b & f(x) = M)";
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2009
by (ftac isCont_has_Ub 1 THEN assume_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2010
by (Clarify_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2011
by (res_inst_tac [("x","M")] exI 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2012
by (Asm_full_simp_tac 1); 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2013
by (rtac ccontr 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2014
by (subgoal_tac "ALL x. a <= x & x <= b --> f x < M" 1 THEN Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2015
by (rtac ccontr 2 THEN dtac real_leI 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2016
by (dres_inst_tac [("z","M")] real_le_anti_sym 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2017
by (REPEAT(Blast_tac 2));
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2018
by (subgoal_tac "ALL x. a <= x & x <= b --> isCont (%x. inverse(M - f x)) x" 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2019
by (Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2020
by (EVERY[rtac isCont_inverse 2, rtac isCont_diff 2, rtac notI 4]);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2021
by (ALLGOALS(asm_full_simp_tac (simpset() addsimps [real_diff_eq_eq])));
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2022
by (Blast_tac 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2023
by (subgoal_tac 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2024
    "EX k. ALL x. a <= x & x <= b --> (%x. inverse(M - (f x))) x <= k" 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2025
by (rtac isCont_bounded 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2026
by (Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2027
by (subgoal_tac "ALL x. a <= x & x <= b --> #0 < inverse(M - f(x))" 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2028
by (Asm_full_simp_tac 1); 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2029
by (Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2030
by (asm_full_simp_tac (simpset() addsimps [real_less_diff_eq]) 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2031
by (subgoal_tac 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2032
    "ALL x. a <= x & x <= b --> (%x. inverse(M - (f x))) x < (k + #1)" 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2033
by (Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2034
by (res_inst_tac [("j","k")] real_le_less_trans 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2035
by (asm_full_simp_tac (simpset() addsimps [real_zero_less_one]) 3);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2036
by (Asm_full_simp_tac 2); 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2037
by (subgoal_tac "ALL x. a <= x & x <= b --> \
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2038
\                inverse(k + #1) < inverse((%x. inverse(M - (f x))) x)" 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2039
by (Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2040
by (rtac real_inverse_less_swap 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2041
by (ALLGOALS Asm_full_simp_tac);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2042
by (dres_inst_tac [("P", "%N. N<M --> ?Q N"),
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2043
                   ("x","M - inverse(k + #1)")] spec 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2044
by (Step_tac 1 THEN dtac real_leI 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2045
by (dtac (real_le_diff_eq RS iffD1) 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2046
by (REPEAT(dres_inst_tac [("x","a")] spec 1));
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2047
by (Asm_full_simp_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2048
by (asm_full_simp_tac 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2049
    (simpset() addsimps [real_inverse_eq_divide, pos_real_divide_le_eq]) 1); 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2050
by (cut_inst_tac [("x","k"),("y","M-f a")] real_0_less_mult_iff 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2051
by (Asm_full_simp_tac 1); 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2052
(*last one*)
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2053
by (REPEAT(dres_inst_tac [("x","x")] spec 1));
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2054
by (Asm_full_simp_tac 1); 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2055
qed "isCont_eq_Ub";
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2056
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2057
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2058
(*----------------------------------------------------------------------------*)
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2059
(* Same theorem for lower bound                                               *)
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2060
(*----------------------------------------------------------------------------*)
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2061
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2062
Goal "[| a <= b; ALL x. a <= x & x <= b --> isCont f x |] \
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2063
\        ==> EX M. (ALL x. a <= x & x <= b --> M <= f(x)) & \
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2064
\                  (EX x. a <= x & x <= b & f(x) = M)";
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2065
by (subgoal_tac "ALL x. a <= x & x <= b --> isCont (%x. -(f x)) x" 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2066
by (blast_tac (claset() addIs [isCont_minus]) 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2067
by (dres_inst_tac [("f","(%x. -(f x))")] isCont_eq_Ub 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2068
by (Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2069
by (Auto_tac);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2070
qed "isCont_eq_Lb";
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2071
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2072
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2073
(* ------------------------------------------------------------------------- *)
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2074
(* Another version.                                                          *)
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2075
(* ------------------------------------------------------------------------- *)
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2076
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2077
Goal "[|a <= b; ALL x. a <= x & x <= b --> isCont f x |] \
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2078
\     ==> EX L M. (ALL x. a <= x & x <= b --> L <= f(x) & f(x) <= M) & \
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2079
\         (ALL y. L <= y & y <= M --> (EX x. a <= x & x <= b & (f(x) = y)))";
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2080
by (ftac isCont_eq_Lb 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2081
by (ftac isCont_eq_Ub 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2082
by (REPEAT(assume_tac 1));
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2083
by (Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2084
by (res_inst_tac [("x","f x")] exI 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2085
by (res_inst_tac [("x","f xa")] exI 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2086
by (Asm_full_simp_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2087
by (Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2088
by (cut_inst_tac [("x","x"),("y","xa")] (CLAIM "x <= y | y <= (x::real)") 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2089
by (Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2090
by (cut_inst_tac [("f","f"),("a","x"),("b","xa"),("y","y")] IVT_objl 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2091
by (cut_inst_tac [("f","f"),("a","xa"),("b","x"),("y","y")] IVT2_objl 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2092
by (Step_tac 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2093
by (res_inst_tac [("x","xb")] exI 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2094
by (res_inst_tac [("x","xb")] exI 4);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2095
by (ALLGOALS(Asm_full_simp_tac));
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2096
qed "isCont_Lb_Ub";
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2097
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2098
(*----------------------------------------------------------------------------*)
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2099
(* If f'(x) > 0 then x is locally strictly increasing at the right            *)
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2100
(*----------------------------------------------------------------------------*)
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2101
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2102
Goalw [deriv_def,LIM_def] 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2103
    "[| DERIV f x :> l;  #0 < l |] ==> \
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2104
\      EX d. #0 < d & (ALL h. #0 < h & h < d --> f(x) < f(x + h))";
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2105
by (dtac spec 1 THEN Auto_tac);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2106
by (res_inst_tac [("x","s")] exI 1 THEN Auto_tac);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2107
by (subgoal_tac "#0 < l*h" 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2108
by (asm_full_simp_tac (simpset() addsimps [real_0_less_mult_iff]) 2); 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2109
by (dres_inst_tac [("x","h")] spec 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2110
by (asm_full_simp_tac
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2111
    (simpset() addsimps [abs_real_def, real_inverse_eq_divide, 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2112
                 pos_real_le_divide_eq, pos_real_less_divide_eq]
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2113
              addsplits [split_if_asm]) 1); 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2114
qed "DERIV_left_inc";
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2115
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2116
Goalw [deriv_def,LIM_def] 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2117
    "[| DERIV f x :> l;  l < #0 |] ==> \
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2118
\      EX d. #0 < d & (ALL h. #0 < h & h < d --> f(x) < f(x - h))";
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2119
by (dres_inst_tac [("x","-l")] spec 1 THEN Auto_tac);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2120
by (res_inst_tac [("x","s")] exI 1 THEN Auto_tac);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2121
by (subgoal_tac "l*h < #0" 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2122
by (asm_full_simp_tac (simpset() addsimps [real_mult_less_0_iff]) 2); 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2123
by (dres_inst_tac [("x","-h")] spec 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2124
by (asm_full_simp_tac
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2125
    (simpset() addsimps [abs_real_def, real_inverse_eq_divide, 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2126
                         pos_real_less_divide_eq,
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2127
                         symmetric real_diff_def]
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2128
               addsplits [split_if_asm]) 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2129
by (subgoal_tac "#0 < (f (x - h) - f x)/h" 1);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2130
by (arith_tac 2);
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2131
by (asm_full_simp_tac
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2132
    (simpset() addsimps [pos_real_less_divide_eq]) 1); 
cf6be1804912 new material, including default simprules that should be introduced earlier
paulson
parents: 10659
diff changeset
  2133
qed "DERIV_left_dec";
10670
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2134
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2135
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2136
Goal "[| DERIV f x :> l; \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2137
\        EX d. #0 < d & (ALL y. abs(x - y) < d --> f(y) <= f(x)) |] \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2138
\     ==> l = #0";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2139
by (res_inst_tac [("R1.0","l"),("R2.0","#0")] real_linear_less2 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2140
by (Step_tac 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2141
by (dtac DERIV_left_dec 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2142
by (dtac DERIV_left_inc 3);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2143
by (Step_tac 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2144
by (dres_inst_tac [("d1.0","d"),("d2.0","da")] real_lbound_gt_zero 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2145
by (dres_inst_tac [("d1.0","d"),("d2.0","da")] real_lbound_gt_zero 3);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2146
by (Step_tac 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2147
by (dres_inst_tac [("x","x - e")] spec 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2148
by (dres_inst_tac [("x","x + e")] spec 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2149
by (auto_tac (claset(),simpset() addsimps [abs_eqI2,abs_minus_cancel]));
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2150
qed "DERIV_local_max";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2151
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2152
(*----------------------------------------------------------------------------*)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2153
(* Similar theorem for a local minimum                                        *)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2154
(*----------------------------------------------------------------------------*)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2155
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2156
Goal "[| DERIV f x :> l; \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2157
\        EX d::real. #0 < d & (ALL y. abs(x - y) < d --> f(x) <= f(y)) |] \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2158
\     ==> l = #0";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2159
by (dtac (DERIV_minus RS DERIV_local_max) 1); 
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2160
by Auto_tac;  
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2161
qed "DERIV_local_min";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2162
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2163
(*----------------------------------------------------------------------------*)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2164
(* In particular if a function is locally flat                                *)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2165
(*----------------------------------------------------------------------------*)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2166
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2167
Goal "[| DERIV f x :> l; \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2168
\        EX d. #0 < d & (ALL y. abs(x - y) < d --> f(x) = f(y)) |] \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2169
\     ==> l = #0";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2170
by (auto_tac (claset() addSDs [DERIV_local_max],simpset()));
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2171
qed "DERIV_local_const";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2172
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2173
(*----------------------------------------------------------------------------*)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2174
(* Lemma about introducing open ball in open interval                         *)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2175
(*----------------------------------------------------------------------------*)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2176
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2177
Goal "[| a < x;  x < b |] ==> \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2178
\       EX d::real. #0 < d &  (ALL y. abs(x - y) < d --> a < y & y < b)";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2179
by (simp_tac (simpset() addsimps [abs_interval_iff]) 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2180
by (cut_inst_tac [("x","x - a"),("y","b - x")] 
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2181
    (CLAIM "x <= y | y <= (x::real)") 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2182
by (Step_tac 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2183
by (res_inst_tac [("x","x - a")] exI 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2184
by (res_inst_tac [("x","b - x")] exI 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2185
by (Auto_tac);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2186
by (auto_tac (claset(),simpset() addsimps [real_less_diff_eq]));
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2187
qed "lemma_interval_lt";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2188
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2189
Goal "[| a < x;  x < b |] ==> \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2190
\       EX d::real. #0 < d &  (ALL y. abs(x - y) < d --> a <= y & y <= b)";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2191
by (dtac lemma_interval_lt 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2192
by (Auto_tac);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2193
by (auto_tac (claset() addSIs [exI] ,simpset()));
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2194
qed "lemma_interval";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2195
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2196
(*-----------------------------------------------------------------------
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2197
            Rolle's Theorem
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2198
   If f is defined and continuous on the finite closed interval [a,b]
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2199
   and differentiable a least on the open interval (a,b), and f(a) = f(b),
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2200
   then x0 : (a,b) such that f'(x0) = #0
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2201
 ----------------------------------------------------------------------*)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2202
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2203
Goal "[| a < b; f(a) = f(b); \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2204
\        ALL x. a <= x & x <= b --> isCont f x; \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2205
\        ALL x. a < x & x < b --> f differentiable x \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2206
\     |] ==> EX z. a < z & z < b & DERIV f z :> #0";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2207
by (ftac (real_less_imp_le RS isCont_eq_Ub) 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2208
by (EVERY1[assume_tac,Step_tac]);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2209
by (ftac (real_less_imp_le RS isCont_eq_Lb) 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2210
by (EVERY1[assume_tac,Step_tac]);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2211
by (case_tac "a < x & x < b" 1 THEN etac conjE 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2212
by (Asm_full_simp_tac 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2213
by (forw_inst_tac [("a","a"),("x","x")] lemma_interval 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2214
by (EVERY1[assume_tac,etac exE]);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2215
by (res_inst_tac [("x","x")] exI 1 THEN Asm_full_simp_tac 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2216
by (subgoal_tac "(EX l. DERIV f x :> l) & \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2217
\        (EX d. #0 < d & (ALL y. abs(x - y) < d --> f(y) <= f(x)))" 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2218
by (Clarify_tac 1 THEN rtac conjI 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2219
by (blast_tac (claset() addIs [differentiableD]) 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2220
by (Blast_tac 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2221
by (ftac DERIV_local_max 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2222
by (EVERY1[Blast_tac,Blast_tac]);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2223
by (case_tac "a < xa & xa < b" 1 THEN etac conjE 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2224
by (Asm_full_simp_tac 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2225
by (forw_inst_tac [("a","a"),("x","xa")] lemma_interval 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2226
by (EVERY1[assume_tac,etac exE]);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2227
by (res_inst_tac [("x","xa")] exI 1 THEN Asm_full_simp_tac 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2228
by (subgoal_tac "(EX l. DERIV f xa :> l) & \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2229
\        (EX d. #0 < d & (ALL y. abs(xa - y) < d --> f(xa) <= f(y)))" 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2230
by (Clarify_tac 1 THEN rtac conjI 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2231
by (blast_tac (claset() addIs [differentiableD]) 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2232
by (Blast_tac 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2233
by (ftac DERIV_local_min 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2234
by (EVERY1[Blast_tac,Blast_tac]);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2235
by (subgoal_tac "ALL x. a <= x & x <= b --> f(x) = f(b)" 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2236
by (Clarify_tac 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2237
by (rtac real_le_anti_sym 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2238
by (subgoal_tac "f b = f x" 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2239
by (Asm_full_simp_tac 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2240
by (res_inst_tac [("x1","a"),("y1","x")] (real_le_imp_less_or_eq RS disjE) 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2241
by (assume_tac 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2242
by (dres_inst_tac [("z","x"),("w","b")] real_le_anti_sym 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2243
by (subgoal_tac "f b = f xa" 5);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2244
by (Asm_full_simp_tac 5);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2245
by (res_inst_tac [("x1","a"),("y1","xa")] (real_le_imp_less_or_eq RS disjE) 5);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2246
by (assume_tac 5);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2247
by (dres_inst_tac [("z","xa"),("w","b")] real_le_anti_sym 5);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2248
by (REPEAT(Asm_full_simp_tac 2));
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2249
by (dtac real_dense 1 THEN etac exE 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2250
by (res_inst_tac [("x","r")] exI 1 THEN Asm_full_simp_tac 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2251
by (etac conjE 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2252
by (forw_inst_tac [("a","a"),("x","r")] lemma_interval 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2253
by (EVERY1[assume_tac, etac exE]);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2254
by (subgoal_tac "(EX l. DERIV f r :> l) & \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2255
\        (EX d. #0 < d & (ALL y. abs(r - y) < d --> f(r) = f(y)))" 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2256
by (Clarify_tac 1 THEN rtac conjI 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2257
by (blast_tac (claset() addIs [differentiableD]) 2);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2258
by (EVERY1[ftac DERIV_local_const, Blast_tac, Blast_tac]);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2259
by (res_inst_tac [("x","d")] exI 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2260
by (EVERY1[rtac conjI, Blast_tac, rtac allI, rtac impI]);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2261
by (res_inst_tac [("s","f b")] trans 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2262
by (blast_tac (claset() addSDs [real_less_imp_le]) 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2263
by (rtac sym 1 THEN Blast_tac 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2264
qed "Rolle";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2265
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2266
(*----------------------------------------------------------------------------*)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2267
(* Mean value theorem                                                         *)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2268
(*----------------------------------------------------------------------------*)
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2269
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2270
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  2271
(*????????TO BE OBSOLETE?????????*)
10670
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2272
Goal "k~=#0 ==> (k*m) / k = (m::real)";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2273
by (dres_inst_tac [("n","#1")] real_mult_div_cancel1 1); 
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2274
by (Asm_full_simp_tac 1); 
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2275
qed "real_mult_div_self1";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2276
Addsimps [real_mult_div_self1];
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2277
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2278
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  2279
(**???FIXME: replace by simproc*??*)
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  2280
Goal "h ~= (0::real) ==> (h*x)/h = x";
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  2281
by (asm_full_simp_tac 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  2282
    (simpset() addsimps [real_divide_mult2_self_eq, 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  2283
                         real_mult_commute]) 1);
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  2284
qed "real_divide_mult3_self_eq"; 
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  2285
Delsimps [real_divide_mult3_self_eq];
10670
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2286
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2287
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2288
Goal "f a - (f b - f a)/(b - a) * a = \
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2289
\     f b - (f b - f a)/(b - a) * (b::real)";
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2290
by (case_tac "a = b" 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2291
by (asm_full_simp_tac (simpset() addsimps [REAL_DIVIDE_ZERO]) 1); 
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2292
by (res_inst_tac [("c1","b - a")] (real_mult_left_cancel RS iffD1) 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2293
by (arith_tac 1);
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2294
by (auto_tac (claset(),
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2295
              simpset() addsimps [real_diff_mult_distrib2, real_diff_eq_eq, 
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  2296
                                  inst "a" "a" eq_commute]));
10670
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2297
by (auto_tac (claset(),
10677
36625483213f further round of tidying
paulson
parents: 10670
diff changeset
  2298
           simpset() addsimps [real_diff_mult_distrib2, real_mult_commute]));
10670
4b0e346c8ca3 many new proofs; still needs tidying
paulson
parents: 10662
diff changeset
  2299
qed "lemma_MVT";