src/HOL/Hyperreal/Integration.ML
author paulson
Fri, 19 Mar 2004 10:51:03 +0100
changeset 14477 cc61fd03e589
parent 14435 9e22eeccf129
child 15079 2ef899e4526d
permissions -rw-r--r--
conversion of Hyperreal/Lim to new-style
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
     1
(*  Title       : Integration.ML
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
     2
    Author      : Jacques D. Fleuriot
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
     3
    Copyright   : 2000  University of Edinburgh
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
     4
    Description : Theory of integration (c.f. Harison's HOL development)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
     5
*)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
     6
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14365
diff changeset
     7
val mult_2 = thm"mult_2";
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14365
diff changeset
     8
val mult_2_right = thm"mult_2_right";
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14365
diff changeset
     9
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    10
Goalw [psize_def] "a = b ==> psize (%n. if n = 0 then a else b) = 0";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    11
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    12
qed "partition_zero";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    13
Addsimps [partition_zero];
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    14
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    15
Goalw [psize_def] "a < b ==> psize (%n. if n = 0 then a else b) = 1";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    16
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    17
by (rtac some_equality 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    18
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    19
by (dres_inst_tac [("x","1")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    20
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    21
qed "partition_one";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    22
Addsimps [partition_one];
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    23
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    24
Goalw [partition_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    25
   "a <= b ==> partition(a,b)(%n. if n = 0 then a else b)";
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14336
diff changeset
    26
by (auto_tac (claset(),simpset() addsimps [order_le_less]));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    27
qed "partition_single";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    28
Addsimps [partition_single];
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    29
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    30
Goalw [partition_def] "partition(a,b) D ==> (D(0) = a)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    31
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    32
qed "partition_lhs";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    33
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    34
Goalw [partition_def]
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    35
       "(partition(a,b) D) = \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    36
\       ((D 0 = a) & \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    37
\        (ALL n. n < (psize D) --> D n < D(Suc n)) & \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    38
\        (ALL n. (psize D) <= n --> (D n = b)))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    39
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    40
by (ALLGOALS(subgoal_tac "psize D = N"));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    41
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    42
by (ALLGOALS(simp_tac (simpset() addsimps [psize_def])));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    43
by (ALLGOALS(rtac some_equality));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    44
by (Blast_tac 1 THEN Blast_tac 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    45
by (ALLGOALS(rtac ccontr));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    46
by (ALLGOALS(dtac (ARITH_PROVE "n ~= (N::nat) ==> n < N | N < n")));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    47
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    48
by (dres_inst_tac [("x","Na")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    49
by (rotate_tac 3 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    50
by (dres_inst_tac [("x","Suc Na")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    51
by (Asm_full_simp_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    52
by (rotate_tac 2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    53
by (dres_inst_tac [("x","N")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    54
by (Asm_full_simp_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    55
by (dres_inst_tac [("x","Na")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    56
by (rotate_tac 3 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    57
by (dres_inst_tac [("x","Suc Na")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    58
by (Asm_full_simp_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    59
by (rotate_tac 2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    60
by (dres_inst_tac [("x","N")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    61
by (Asm_full_simp_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    62
qed "partition";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    63
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    64
Goal "partition(a,b) D ==> (D(psize D) = b)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    65
by (dtac (partition RS subst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    66
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    67
by (REPEAT(dres_inst_tac [("x","psize D")] spec 1));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    68
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    69
qed "partition_rhs";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    70
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    71
Goal "[|partition(a,b) D; psize D <= n |] ==> (D n = b)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    72
by (dtac (partition RS subst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    73
by (Blast_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    74
qed "partition_rhs2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    75
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    76
Goal 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    77
 "partition(a,b) D & m + Suc d <= n & n <= (psize D) --> D(m) < D(m + Suc d)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    78
by (induct_tac "d" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    79
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    80
by (ALLGOALS(dtac (partition RS subst)));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    81
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    82
by (ALLGOALS(dtac (ARITH_PROVE "Suc m <= n ==> m < n")));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    83
by (ALLGOALS(dtac less_le_trans));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    84
by (assume_tac 1 THEN assume_tac 2);
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14336
diff changeset
    85
by (ALLGOALS(blast_tac (claset() addIs [order_less_trans])));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    86
qed_spec_mp "lemma_partition_lt_gen";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    87
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    88
Goal "m < n ==> EX d. n = m + Suc d";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    89
by (auto_tac (claset(),simpset() addsimps [less_iff_Suc_add]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    90
qed "less_eq_add_Suc";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    91
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    92
Goal "[|partition(a,b) D; m < n; n <= (psize D)|] ==> D(m) < D(n)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    93
by (auto_tac (claset() addDs [less_eq_add_Suc] addIs [lemma_partition_lt_gen],
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    94
    simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    95
qed "partition_lt_gen";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    96
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    97
Goal "partition(a,b) D ==> (n < (psize D) --> D(0) < D(Suc n))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    98
by (dtac (partition RS subst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
    99
by (induct_tac "n" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   100
by (Blast_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   101
by (blast_tac (claset() addSDs [leI] addDs 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   102
    [(ARITH_PROVE "m <= n ==> m <= Suc n"),
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14336
diff changeset
   103
    le_less_trans,order_less_trans]) 1);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   104
qed_spec_mp "partition_lt";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   105
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   106
Goal "partition(a,b) D ==> a <= b";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   107
by (ftac (partition RS subst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   108
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   109
by (rotate_tac 2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   110
by (dres_inst_tac [("x","psize D")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   111
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   112
by (rtac ccontr 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   113
by (case_tac "psize D = 0" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   114
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   115
by (dres_inst_tac [("n","psize D - 1")] partition_lt 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   116
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   117
qed "partition_le";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   118
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   119
Goal "[|partition(a,b) D; n < (psize D)|] ==> D(n) < D(psize D)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   120
by (auto_tac (claset() addIs [partition_lt_gen],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   121
qed "partition_gt";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   122
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   123
Goal "partition(a,b) D ==> ((a = b) = (psize D = 0))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   124
by (ftac (partition RS subst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   125
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   126
by (rotate_tac 2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   127
by (dres_inst_tac [("x","psize D")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   128
by (rtac ccontr 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   129
by (dres_inst_tac [("n","psize D - 1")] partition_lt 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   130
by (Blast_tac 3 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   131
qed "partition_eq";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   132
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   133
Goal "partition(a,b) D ==> a <= D(r)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   134
by (ftac (partition RS subst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   135
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   136
by (induct_tac "r" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   137
by (cut_inst_tac [("m","Suc n"),("n","psize D")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   138
    (ARITH_PROVE "m < n | n <= (m::nat)") 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   139
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   140
by (eres_inst_tac [("j","D n")] real_le_trans 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   141
by (dres_inst_tac [("x","n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   142
by (blast_tac (claset() addIs [less_trans,order_less_imp_le]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   143
by (res_inst_tac [("j","b")] real_le_trans 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   144
by (etac partition_le 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   145
by (Blast_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   146
qed "partition_lb";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   147
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   148
Goal "[| partition(a,b) D; psize D ~= 0 |] ==> a < D(Suc n)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   149
by (res_inst_tac [("t","a")] (partition_lhs RS subst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   150
by (assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   151
by (cut_inst_tac [("m","psize D"),("n","Suc n")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   152
    (ARITH_PROVE "m < n | n <= (m::nat)") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   153
by (ftac (partition RS subst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   154
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   155
by (rotate_tac 3 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   156
by (dres_inst_tac [("x","Suc n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   157
by (etac impE 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   158
by (etac less_imp_le 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   159
by (ftac partition_rhs 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   160
by (dtac partition_gt 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   161
by (Asm_simp_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   162
by (blast_tac (claset() addIs [partition_lt,less_le_trans]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   163
qed "partition_lb_lt";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   164
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   165
Goal "partition(a,b) D ==> D(r) <= b";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   166
by (ftac (partition RS subst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   167
by (cut_inst_tac [("m","r"),("n","psize D")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   168
    (ARITH_PROVE "m < n | n <= (m::nat)") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   169
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   170
by (Blast_tac 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   171
by (subgoal_tac "ALL x. D((psize D) - x) <= b" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   172
by (rotate_tac 4 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   173
by (dres_inst_tac [("x","psize D - r")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   174
by (dtac (ARITH_PROVE "p < m ==> m - (m - p) = (p::nat)") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   175
by (thin_tac "ALL n. psize D <= n --> D n = b" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   176
by (Asm_full_simp_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   177
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   178
by (induct_tac "x" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   179
by (Simp_tac 1 THEN Blast_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   180
by (case_tac "psize D - Suc n = 0" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   181
by (thin_tac "ALL n. psize D <= n --> D n = b" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   182
by (asm_simp_tac (simpset() addsimps [partition_le]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   183
by (rtac real_le_trans 1 THEN assume_tac 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   184
by (rtac (ARITH_PROVE "0 < m - Suc n ==> (m - n) = Suc(m - Suc n)" 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   185
          RS ssubst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   186
by (dres_inst_tac [("x","psize D - Suc n")] spec 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   187
by (thin_tac "ALL n. psize D <= n --> D n = b" 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   188
by (Asm_full_simp_tac 2);
14329
ff3210fe968f re-organized some hyperreal and real lemmas
paulson
parents: 14305
diff changeset
   189
by (arith_tac 1);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   190
qed "partition_ub";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   191
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   192
Goal "[| partition(a,b) D; n < psize D |] ==> D(n) < b"; 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   193
by (blast_tac (claset() addIs [partition_rhs RS subst] addIs
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   194
    [partition_gt]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   195
qed "partition_ub_lt";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   196
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   197
Goal "[| partition (a, b) D1; partition (b, c) D2 |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   198
\      ==> (ALL n. \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   199
\            n < psize D1 + psize D2 --> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   200
\            (if n < psize D1 then D1 n else D2 (n - psize D1)) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   201
\            < (if Suc n < psize D1 then D1 (Suc n) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   202
\               else D2 (Suc n - psize D1))) & \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   203
\        (ALL n. \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   204
\            psize D1 + psize D2 <= n --> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   205
\            (if n < psize D1 then D1 n else D2 (n - psize D1)) = \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   206
\            (if psize D1 + psize D2 < psize D1 then D1 (psize D1 + psize D2) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   207
\             else D2 (psize D1 + psize D2 - psize D1)))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   208
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   209
by (auto_tac (claset() addIs [partition_lt_gen],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   210
by (dres_inst_tac [("m","psize D1")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   211
    (leI RSN(2,ARITH_PROVE "[| n < m; m <= Suc n |] ==> m = Suc n")) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   212
by (assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   213
by (auto_tac (claset() addSIs [partition_lt_gen],
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   214
    simpset() addsimps [partition_lhs,partition_ub_lt]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   215
by (blast_tac (claset() addIs [ARITH_PROVE "~n < m ==> n - m < Suc n - m"]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   216
by (auto_tac (claset(),simpset() addsimps [
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   217
    ARITH_PROVE "~ n < m ==> (Suc n - m <= p) = (Suc n <= m + p)"]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   218
by (dtac (ARITH_PROVE "p + q <= (n::nat) ==> q <= n - p") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   219
by (auto_tac (claset() addSIs [partition_rhs2], simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   220
    [partition_rhs]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   221
qed "lemma_partition_append1";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   222
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   223
Goal "[| partition (a, b) D1; partition (b, c) D2; N < psize D1 |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   224
\     ==> D1(N) < D2 (psize D2)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   225
by (res_inst_tac [("y","D1(psize D1)")] order_less_le_trans 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   226
by (etac partition_gt 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   227
by (auto_tac (claset(),simpset() addsimps [partition_rhs,partition_le]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   228
qed "lemma_psize1";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   229
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   230
Goal "[| partition (a, b) D1; partition (b, c) D2 |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   231
\     ==> psize (%n. if n < psize D1 then D1 n else D2 (n - psize D1)) = \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   232
\         psize D1 + psize D2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   233
by (res_inst_tac 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   234
    [("D2","%n. if n < psize D1 then D1 n else D2 (n - psize D1)")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   235
    ((psize_def RS meta_eq_to_obj_eq) RS ssubst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   236
by (rtac some1_equality 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   237
by (blast_tac (claset() addSIs [lemma_partition_append1]) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   238
by (rtac ex1I 1 THEN rtac lemma_partition_append1 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   239
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   240
by (rtac ccontr 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   241
by (dtac (ARITH_PROVE "m ~= n ==> m < n | n < (m::nat)") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   242
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   243
by (rotate_tac 3 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   244
by (dres_inst_tac [("x","psize D1 + psize D2")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   245
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   246
by (case_tac "N < psize D1" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   247
by (auto_tac (claset() addDs [lemma_psize1],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   248
by (dtac leI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   249
by (dtac (ARITH_PROVE "[|p <= n; n < p + m|] ==> n - p < (m::nat)") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   250
by (assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   251
by (dres_inst_tac [("a","b"),("b","c")] partition_gt 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   252
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   253
by (dres_inst_tac [("x","psize D1 + psize D2")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   254
by (auto_tac (claset(),simpset() addsimps [partition_rhs2]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   255
qed "lemma_partition_append2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   256
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   257
Goalw [tpart_def]
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   258
"[|psize D = 0; tpart(a,b) (D,p)|] ==> a = b";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   259
by (auto_tac (claset(),simpset() addsimps [partition_eq]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   260
qed "tpart_eq_lhs_rhs";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   261
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   262
Goalw [tpart_def] "tpart(a,b) (D,p) ==> partition(a,b) D";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   263
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   264
qed "tpart_partition";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   265
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   266
Goal "[| tpart(a,b) (D1,p1); fine(g) (D1,p1); \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   267
\        tpart(b,c) (D2,p2); fine(g) (D2,p2) |] \ 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   268
\      ==> EX D p. tpart(a,c) (D,p) & fine(g) (D,p)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   269
by (res_inst_tac 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   270
    [("x","%n. if n < psize D1 then D1 n else D2 (n - psize D1)")] exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   271
by (res_inst_tac 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   272
    [("x","%n. if n < psize D1 then p1 n else p2 (n - psize D1)")] exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   273
by (cut_inst_tac [("m","psize D1")] (ARITH_PROVE "0 < (m::nat) | m = 0") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   274
by (auto_tac (claset() addDs [tpart_eq_lhs_rhs],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   275
by (asm_full_simp_tac (simpset() addsimps [fine_def,
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   276
    [tpart_partition,tpart_partition] MRS lemma_partition_append2]) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   277
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   278
by (dres_inst_tac [("m","psize D1"),("n","n")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   279
    (leI RSN(2,ARITH_PROVE "[| n < m; m <= Suc n |] ==> m = Suc n")) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   280
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   281
by (dtac (tpart_partition RS partition_rhs) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   282
by (dtac (tpart_partition RS partition_lhs) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   283
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   284
by (rotate_tac 3 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   285
by (dres_inst_tac [("x","n - psize D1")] spec 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   286
by (auto_tac (claset(),simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   287
    [ARITH_PROVE "[| (0::nat) < p; p <= n |] ==> (n - p < m) = (n < p + m)",
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   288
     ARITH_PROVE "~n < p ==> Suc n - p = Suc(n - p)"]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   289
by (auto_tac (claset(),simpset() addsimps [tpart_def,
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   290
    ARITH_PROVE "~n < p ==> Suc n - p = Suc(n - p)"]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   291
by (dres_inst_tac [("m","psize D1"),("n","n")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   292
    (leI RSN(2,ARITH_PROVE "[| n < m; m <= Suc n |] ==> m = Suc n")) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   293
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   294
by (dtac partition_rhs 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   295
by (dtac partition_lhs 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   296
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   297
by (rtac (partition RS ssubst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   298
by (rtac (lemma_partition_append2 RS ssubst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   299
by (rtac conjI 3);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   300
by (dtac lemma_partition_append1 4);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   301
by (auto_tac (claset(),simpset() addsimps [partition_lhs,partition_rhs]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   302
qed "partition_append";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   303
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   304
(* ------------------------------------------------------------------------ *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   305
(* We can always find a division which is fine wrt any gauge                *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   306
(* ------------------------------------------------------------------------ *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   307
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   308
Goal "[| a <= b; gauge(%x. a <= x & x <= b) g |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   309
\     ==> EX D p. tpart(a,b) (D,p) & fine g (D,p)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   310
by (cut_inst_tac 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   311
 [("P","%(u,v). a <= u & v <= b --> (EX D p. tpart(u,v) (D,p) & fine(g) (D,p))")]
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   312
 lemma_BOLZANO2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   313
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   314
by (REPEAT(blast_tac (claset() addIs [real_le_trans]) 1));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   315
by (auto_tac (claset() addIs [partition_append],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   316
by (case_tac "a <= x & x <= b" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   317
by (res_inst_tac [("x","1")] exI 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   318
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   319
by (res_inst_tac [("x","g x")] exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   320
by (auto_tac (claset(),simpset() addsimps [gauge_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   321
by (res_inst_tac [("x","%n. if n = 0 then aa else ba")] exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   322
by (res_inst_tac [("x","%n. if n = 0 then x else ba")] exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   323
by (auto_tac (claset(),simpset() addsimps [tpart_def,fine_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   324
qed "partition_exists";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   325
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   326
(* ------------------------------------------------------------------------ *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   327
(* Lemmas about combining gauges                                            *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   328
(* ------------------------------------------------------------------------ *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   329
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   330
Goalw [gauge_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   331
     "[| gauge(E) g1; gauge(E) g2 |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   332
\     ==> gauge(E) (%x. if g1(x) < g2(x) then g1(x) else g2(x))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   333
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   334
qed "gauge_min";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   335
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   336
Goalw [fine_def]
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   337
      "fine (%x. if g1(x) < g2(x) then g1(x) else g2(x)) (D,p) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   338
\      ==> fine(g1) (D,p) & fine(g2) (D,p)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   339
by (auto_tac (claset(),simpset() addsimps [split_if]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   340
qed "fine_min";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   341
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   342
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   343
(* ------------------------------------------------------------------------ *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   344
(* The integral is unique if it exists                                      *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   345
(* ------------------------------------------------------------------------ *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   346
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   347
Goalw [Integral_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   348
    "[| a <= b; Integral(a,b) f k1; Integral(a,b) f k2 |] ==> k1 = k2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   349
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   350
by (REPEAT(dres_inst_tac [("x","abs(k1 - k2)/2")] spec 1));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   351
by (Auto_tac THEN TRYALL(arith_tac));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   352
by (dtac gauge_min 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   353
by (dres_inst_tac [("g","%x. if g x < ga x then g x else ga x")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   354
    partition_exists 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   355
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   356
by (dtac fine_min 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   357
by (REPEAT(dtac spec 1) THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   358
by (subgoal_tac 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   359
    "abs((rsum(D,p) f - k2) - (rsum(D,p) f - k1)) < abs(k1 - k2)" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   360
by (arith_tac 1);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   361
by (dtac add_strict_mono 1 THEN assume_tac 1);
14305
f17ca9f6dc8c tidying first part of HyperArith0.ML, using generic lemmas
paulson
parents: 14294
diff changeset
   362
by (auto_tac (claset(),
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   363
    HOL_ss addsimps [left_distrib RS sym,
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14365
diff changeset
   364
                     mult_2_right RS sym, mult_less_cancel_right]));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   365
by (ALLGOALS(arith_tac));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   366
qed "Integral_unique";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   367
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   368
Goalw [Integral_def] "Integral(a,a) f 0";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   369
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   370
by (res_inst_tac [("x","%x. 1")] exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   371
by (auto_tac (claset() addDs [partition_eq],simpset() addsimps [gauge_def,
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   372
     tpart_def,rsum_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   373
qed "Integral_zero"; 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   374
Addsimps [Integral_zero];
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   375
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   376
Goal "sumr 0 m (%n. D (Suc n) - D n) = D(m) - D 0";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   377
by (induct_tac "m" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   378
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   379
qed "sumr_partition_eq_diff_bounds";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   380
Addsimps [sumr_partition_eq_diff_bounds];
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   381
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   382
Goal "a <= b ==> Integral(a,b) (%x. 1) (b - a)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   383
by (dtac real_le_imp_less_or_eq 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   384
by (auto_tac (claset(),simpset() addsimps [rsum_def,Integral_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   385
by (res_inst_tac [("x","%x. b - a")] exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   386
by (auto_tac (claset(),simpset() addsimps [gauge_def,
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   387
    abs_interval_iff,tpart_def,partition]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   388
qed "Integral_eq_diff_bounds";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   389
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   390
Goal "a <= b ==> Integral(a,b) (%x. c)  (c*(b - a))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   391
by (dtac real_le_imp_less_or_eq 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   392
by (auto_tac (claset(),simpset() addsimps [rsum_def,Integral_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   393
by (res_inst_tac [("x","%x. b - a")] exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   394
by (auto_tac (claset(),simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   395
    [sumr_mult RS sym,gauge_def,abs_interval_iff,
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   396
     right_diff_distrib RS sym,partition,tpart_def]));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   397
qed "Integral_mult_const";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   398
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   399
Goal "[| a <= b; Integral(a,b) f k |] ==> Integral(a,b) (%x. c * f x) (c * k)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   400
by (dtac real_le_imp_less_or_eq 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   401
by (auto_tac (claset() addDs [[real_le_refl,Integral_zero] MRS Integral_unique],
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   402
    simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   403
by (auto_tac (claset(),simpset() addsimps [rsum_def,Integral_def,
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   404
    sumr_mult RS sym,real_mult_assoc]));
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14277
diff changeset
   405
by (res_inst_tac [("a2","c")] ((abs_ge_zero RS real_le_imp_less_or_eq)
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   406
    RS disjE) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   407
by (dtac sym 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   408
by (Asm_full_simp_tac 2 THEN Blast_tac 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   409
by (dres_inst_tac [("x","e/abs c")] spec 1 THEN Auto_tac);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   410
by (asm_full_simp_tac (simpset() addsimps [zero_less_mult_iff,
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   411
    real_divide_def]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   412
by (rtac exI 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   413
by (REPEAT(dtac spec 1) THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   414
by (res_inst_tac [("z1","inverse(abs c)")] (real_mult_less_iff1 RS iffD1) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   415
by (fold_tac [real_divide_def]);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   416
by (auto_tac (claset(),
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   417
      simpset() addsimps [right_diff_distrib RS sym,
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   418
                     abs_mult, real_mult_assoc RS sym,
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   419
    ARITH_PROVE "c ~= 0 ==> abs (c::real) ~= 0",
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   420
    positive_imp_inverse_positive]));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   421
qed "Integral_mult";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   422
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   423
(* ------------------------------------------------------------------------ *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   424
(* Fundamental theorem of calculus (Part I)                                 *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   425
(* ------------------------------------------------------------------------ *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   426
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   427
(* "Straddle Lemma" : Swartz & Thompson: AMM 95(7) 1988 *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   428
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   429
Goal "ALL x. P(x) --> (EX y. Q x y) ==> EX f. (ALL x. P(x) --> Q x (f x))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   430
by (cut_inst_tac [("S","Collect (%x. P x)"),("Q","Q")] (CLAIM_SIMP 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   431
    "(ALL x:S. (EX y. Q x y)) --> (EX f. (ALL x:S. Q x (f x)))" [bchoice]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   432
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   433
qed "choiceP";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   434
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   435
Goal "ALL x. P(x) --> (EX y. R(y) & (EX z. Q x y z)) ==> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   436
\     EX f fa. (ALL x. P(x) --> R(f x) & Q x (f x) (fa x))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   437
by (dtac (CLAIM "(ALL x. P(x) --> (EX y. R(y) & (EX z. Q x y z))) = \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   438
\                (ALL x. P(x) --> (EX y z. R(y) & Q x y z))" RS iffD1) 1);;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   439
by (dtac choiceP 1 THEN Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   440
by (dtac choiceP 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   441
qed "choiceP2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   442
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   443
Goal "ALL x. (EX y. R(y) & (EX z. Q x y z)) ==> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   444
\     EX f fa. (ALL x. R(f x) & Q x (f x) (fa x))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   445
by (dtac (CLAIM "(ALL x. (EX y. R(y) & (EX z. Q x y z))) = \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   446
\                (ALL x. (EX y z. R(y) & Q x y z))" RS iffD1) 1);;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   447
by (dtac choice 1 THEN Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   448
by (dtac choice 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   449
qed "choice2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   450
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   451
(* new simplifications e.g. (y < x/n) = (y * n < x) are a real nuisance 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   452
   they break the original proofs and make new proofs longer!                 *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   453
Goalw [gauge_def]
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   454
     "[| ALL x. a <= x & x <= b --> DERIV f x :> f'(x); 0 < e |]\
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   455
\     ==> EX g. gauge(%x. a <= x & x <= b) g & \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   456
\               (ALL x u v. a <= u & u <= x & x <= v & v <= b & (v - u) < g(x) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   457
\                 --> abs((f(v) - f(u)) - (f'(x) * (v - u))) <= e * (v - u))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   458
by (subgoal_tac "ALL x. a <= x & x <= b --> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   459
\                  (EX d. 0 < d & \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   460
\                     (ALL u v. u <= x & x <= v & (v - u) < d --> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   461
\                     abs((f(v) - f(u)) - (f'(x) * (v - u))) <= e * (v - u)))" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   462
by (dtac choiceP 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   463
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   464
by (dtac spec 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   465
by (auto_tac (claset(),simpset() addsimps [DERIV_iff2,LIM_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   466
by (dres_inst_tac [("x","e/2")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   467
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   468
by (subgoal_tac "ALL z. abs(z - x) < s --> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   469
\        abs((f(z) - f(x)) - (f'(x) * (z - x))) <= (e / 2) * abs(z - x)" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   470
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   471
by (case_tac "0 < abs(z - x)" 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   472
by (dtac (ARITH_PROVE "~ 0 < abs z ==> z = (0::real)") 3);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   473
by (asm_full_simp_tac (simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   474
    [ARITH_PROVE "(z - x = 0) = (z = (x::real))"]) 3);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   475
by (dres_inst_tac [("x","z")] spec 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   476
by (res_inst_tac [("z1","abs(inverse(z - x))")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   477
         (real_mult_le_cancel_iff2 RS iffD1) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   478
by (Asm_full_simp_tac 2);
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14277
diff changeset
   479
by (asm_full_simp_tac (simpset() 
14336
8f731d3cd65b Deleting more redundant theorems
paulson
parents: 14334
diff changeset
   480
     delsimps [abs_inverse, abs_mult]
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14277
diff changeset
   481
     addsimps [abs_mult RS sym, real_mult_assoc RS sym]) 2);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   482
by (subgoal_tac "inverse (z - x) * (f z - f x - f' x * (z - x)) = \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   483
\                (f z - f x)/(z - x) - f' x" 2);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   484
by (asm_full_simp_tac (simpset() addsimps [abs_mult RS sym] @ mult_ac) 2);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   485
by (asm_full_simp_tac (simpset() addsimps [real_diff_def]) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   486
by (rtac (real_mult_commute RS subst) 2);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   487
by (asm_full_simp_tac (simpset() addsimps [left_distrib,
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   488
    real_diff_def]) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   489
by (dtac (CLAIM "z ~= x ==> z + -x ~= (0::real)") 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   490
by (asm_full_simp_tac (simpset() addsimps [real_mult_assoc,
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   491
    real_divide_def]) 2);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   492
by (simp_tac (simpset() addsimps [left_distrib]) 2);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   493
by (res_inst_tac [("x","s")] exI 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   494
by (res_inst_tac [("u1","u"),("v1","v")] (ARITH_PROVE "u < v | v <= (u::real)"
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   495
    RS disjE) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   496
by (dres_inst_tac [("x","v")] real_le_imp_less_or_eq 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   497
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   498
(*29*)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   499
by (res_inst_tac [("j","abs((f(v) - f(x)) - (f'(x) * (v - x))) + \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   500
\                  abs((f(x) - f(u)) - (f'(x) * (x - u)))")] real_le_trans 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   501
by (rtac (abs_triangle_ineq RSN (2,real_le_trans)) 1);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   502
by (asm_full_simp_tac (simpset() addsimps [right_diff_distrib]) 1);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   503
by (arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   504
by (res_inst_tac [("t","e*(v - u)")] (real_sum_of_halves RS subst) 1);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   505
by (rtac add_mono 1);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   506
by (res_inst_tac [("j","(e / 2) * abs(v - x)")] real_le_trans 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   507
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   508
by (Asm_full_simp_tac 2 THEN arith_tac 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   509
by (ALLGOALS (thin_tac "ALL xa. \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   510
\             xa ~= x & abs (xa + - x) < s --> \
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14435
diff changeset
   511
\             abs ((f xa - f x) / (xa - x) + - f' x) * 2 < e"));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   512
by (dres_inst_tac [("x","v")] spec 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   513
by (arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   514
by (dres_inst_tac [("x","u")] spec 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   515
by (arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   516
by (subgoal_tac "abs (f u - f x - f' x * (u - x)) = \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   517
\                abs (f x - f u - f' x * (x - u))" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   518
by (Asm_full_simp_tac 1);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   519
by (asm_full_simp_tac (simpset() addsimps [right_distrib,
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   520
    real_diff_def]) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   521
by (arith_tac 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   522
by(rtac real_le_trans 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   523
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   524
by (arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   525
qed "lemma_straddle";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   526
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   527
Goal "((number_of c - 1) * x <= 0) =((number_of c ::real) * x <= x)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   528
by (rtac ((ARITH_PROVE "(x <= y) = (x - y <= (0::real))") RS ssubst) 1);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   529
by (simp_tac (simpset() addsimps [left_diff_distrib,
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   530
    CLAIM_SIMP "c * x - x = (c - 1) * (x::real)" [left_diff_distrib]]) 1);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   531
qed "lemma_number_of_mult_le";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   532
 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   533
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   534
Goal "[|a <= b; ALL x. a <= x & x <= b --> DERIV f x :> f'(x) |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   535
\     ==> Integral(a,b) f' (f(b) - f(a))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   536
by (dtac real_le_imp_less_or_eq 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   537
by (auto_tac (claset(),simpset() addsimps [Integral_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   538
by (rtac ccontr 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   539
by (subgoal_tac "ALL e. 0 < e --> \ 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   540
\                   (EX g. gauge (%x. a <= x & x <= b) g & \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   541
\                   (ALL D p. \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   542
\                       tpart (a, b) (D, p) & fine g (D, p) --> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   543
\                       abs (rsum (D, p) f' - (f b - f a)) <= e))" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   544
by (rotate_tac 3 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   545
by (dres_inst_tac [("x","e/2")] spec 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   546
by (dtac spec 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   547
by (REPEAT(dtac spec 1) THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   548
by (dres_inst_tac [("e","ea/(b - a)")] lemma_straddle 1);
14277
ad66687ece6e more field division lemmas transferred from Real to Ring_and_Field
paulson
parents: 13958
diff changeset
   549
by (auto_tac (claset(),simpset() addsimps [thm"Ring_and_Field.zero_less_divide_iff"]));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   550
by (rtac exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   551
by (auto_tac (claset(),simpset() addsimps [tpart_def,rsum_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   552
by (subgoal_tac "sumr 0 (psize D) (%n. f(D(Suc n)) - f(D n)) = \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   553
\   f b - f a" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   554
by (cut_inst_tac [("D","%n. f(D n)"),("m","psize D")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   555
    sumr_partition_eq_diff_bounds 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   556
by (asm_full_simp_tac (simpset() addsimps [partition_lhs,partition_rhs]) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   557
by (dtac sym 1 THEN Asm_full_simp_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   558
by (simp_tac (simpset() addsimps [sumr_diff]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   559
by (rtac (sumr_rabs RS real_le_trans) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   560
by (subgoal_tac 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   561
    "ea = sumr 0 (psize D) (%n. (ea / (b - a)) * (D(Suc n) - (D n)))" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   562
by (asm_full_simp_tac (simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   563
    [ARITH_PROVE "abs(y - (x::real)) = abs(x - y)"]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   564
by (res_inst_tac [("t","ea")] ssubst 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   565
by (rtac sumr_le2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   566
by (rtac (sumr_mult RS subst) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   567
by (auto_tac (claset(),simpset() addsimps [partition_rhs,
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   568
    partition_lhs,partition_lb,partition_ub,fine_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   569
qed "FTC1";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   570
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   571
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   572
Goal "[| Integral(a,b) f k1; k2 = k1 |] ==> Integral(a,b) f k2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   573
by (Asm_simp_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   574
qed "Integral_subst";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   575
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   576
Goal "[| a <= b; b <= c; Integral(a,b) f' k1; Integral(b,c) f' k2; \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   577
\        ALL x. a <= x & x <= c --> DERIV f x :> f' x |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   578
\    ==> Integral(a,c) f' (k1 + k2)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   579
by (rtac (FTC1 RS Integral_subst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   580
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   581
by (ftac FTC1 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   582
by (forw_inst_tac [("a","b")] FTC1 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   583
by (dres_inst_tac [("x","x")] spec 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   584
by (dres_inst_tac [("k2.0","f b - f a")] Integral_unique 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   585
by (dres_inst_tac [("k2.0","f c - f b")] Integral_unique 3);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   586
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   587
qed "Integral_add";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   588
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   589
Goal "partition(a,b) D ==> psize D = (LEAST n. D(n) = b)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   590
by (auto_tac (claset() addSIs [Least_equality RS sym,partition_rhs],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   591
by (rtac ccontr 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   592
by (dtac partition_ub_lt 1);
14365
3d4df8c166ae replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents: 14336
diff changeset
   593
by (auto_tac (claset(), simpset() addsimps [linorder_not_less RS sym]));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   594
qed "partition_psize_Least";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   595
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   596
Goal "partition (a, c) D ==> ~ (EX n. c < D(n))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   597
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   598
by (dres_inst_tac [("r","n")] partition_ub 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   599
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   600
qed "lemma_partition_bounded";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   601
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   602
Goal "partition (a, c) D ==> D = (%n. if D n < c then D n else c)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   603
by (rtac ext 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   604
by (auto_tac (claset() addSDs [lemma_partition_bounded],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   605
by (dres_inst_tac [("x","n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   606
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   607
qed "lemma_partition_eq";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   608
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   609
Goal "partition (a, c) D ==> D = (%n. if D n <= c then D n else c)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   610
by (rtac ext 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   611
by (auto_tac (claset() addSDs [lemma_partition_bounded],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   612
by (dres_inst_tac [("x","n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   613
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   614
qed "lemma_partition_eq2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   615
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   616
Goal "[| partition(a,b) D; n < psize D |] ==> D n < D (Suc n)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   617
by (auto_tac (claset(),simpset() addsimps [partition]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   618
qed "partition_lt_Suc";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   619
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   620
Goal "tpart(a,c) (D,p) ==> p = (%n. if D n < c then p n else c)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   621
by (rtac ext 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   622
by (auto_tac (claset(),simpset() addsimps [tpart_def]));
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   623
by (dtac (linorder_not_less RS iffD1) 1);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   624
by (dres_inst_tac [("r","Suc n")] partition_ub 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   625
by (dres_inst_tac [("x","n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   626
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   627
qed "tpart_tag_eq";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   628
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   629
(*----------------------------------------------------------------------------*)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   630
(* Lemmas for Additivity Theorem of gauge integral                            *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   631
(*----------------------------------------------------------------------------*)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   632
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   633
Goal "[| a <= D n; D n < b; partition(a,b) D |] ==> n < psize D";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   634
by (dtac (partition RS iffD1) 1 THEN Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   635
by (rtac ccontr 1 THEN dtac leI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   636
by Auto_tac;
14435
9e22eeccf129 Conversion of Poly to Isar script, and other tidying of HOL/Hyperreal
paulson
parents: 14387
diff changeset
   637
qed "lemma_additivity1";
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   638
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   639
Goal "[| a <= D n; partition(a,D n) D |] ==> psize D <= n";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   640
by (rtac ccontr 1 THEN dtac not_leE 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   641
by (ftac (partition RS iffD1) 1 THEN Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   642
by (forw_inst_tac [("r","Suc n")] partition_ub 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   643
by (auto_tac (claset() addSDs [spec],simpset()));
14435
9e22eeccf129 Conversion of Poly to Isar script, and other tidying of HOL/Hyperreal
paulson
parents: 14387
diff changeset
   644
qed "lemma_additivity2";
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   645
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   646
Goal "[| partition(a,b) D; psize D < m |] ==> D(m) = D(psize D)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   647
by (auto_tac (claset(),simpset() addsimps [partition]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   648
qed "partition_eq_bound";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   649
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   650
Goal "[| partition(a,b) D; psize D < m |] ==> D(r) <= D(m)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   651
by (ftac (partition RS iffD1) 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   652
by (etac partition_ub 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   653
qed "partition_ub2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   654
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   655
Goalw [tpart_def]
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   656
    "[| tpart(a,b) (D,p); psize D <= m |] ==> p(m) = D(m)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   657
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   658
by (dres_inst_tac [("x","m")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   659
by (auto_tac (claset(),simpset() addsimps [partition_rhs2]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   660
qed "tag_point_eq_partition_point";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   661
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   662
Goal "[| partition(a,b) D; D m < D n |] ==> m < n";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   663
by (cut_inst_tac [("m","n"),("n","psize D")] less_linear 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   664
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   665
by (rtac ccontr 1 THEN dtac leI 1 THEN dtac le_imp_less_or_eq 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   666
by (cut_inst_tac [("m","m"),("n","psize D")] less_linear 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   667
by (auto_tac (claset() addDs [partition_gt],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   668
by (dres_inst_tac [("n","m")] partition_lt_gen 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   669
by (ftac partition_eq_bound 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   670
by (dtac partition_gt 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   671
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   672
by (rtac ccontr 1 THEN dtac leI 1 THEN dtac le_imp_less_or_eq 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   673
by (auto_tac (claset() addDs [partition_eq_bound],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   674
by (rtac ccontr 1 THEN dtac leI 1 THEN dtac le_imp_less_or_eq 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   675
by (ftac partition_eq_bound 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   676
by (dres_inst_tac [("m","m")] partition_eq_bound 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   677
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   678
qed "partition_lt_cancel";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   679
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   680
Goalw [psize_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   681
     "[| a <= D n; D n < b; partition (a, b) D |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   682
\     ==> psize (%x. if D x < D n then D(x) else D n) = n";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   683
by (ftac lemma_additivity1 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   684
by (assume_tac 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   685
by (rtac some_equality 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   686
by (auto_tac (claset() addIs [partition_lt_Suc],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   687
by (dres_inst_tac [("n","n")] partition_lt_gen 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   688
by (assume_tac 1 THEN arith_tac 1 THEN arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   689
by (cut_inst_tac [("m","na"),("n","psize D")] less_linear 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   690
by (auto_tac (claset() addDs [partition_lt_cancel],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   691
by (rtac ccontr 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   692
by (dtac (ARITH_PROVE "m ~= (n::nat) ==> m < n | n < m") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   693
by (etac disjE 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   694
by (rotate_tac 5 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   695
by (dres_inst_tac [("x","n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   696
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   697
by (dres_inst_tac [("n","n")] partition_lt_gen 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   698
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   699
by (arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   700
by (dres_inst_tac [("x","n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   701
by (asm_full_simp_tac (simpset() addsimps [split_if]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   702
qed "lemma_additivity4_psize_eq";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   703
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   704
Goal "partition (a, b) D  \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   705
\     ==> psize (%x. if D x < D n then D(x) else D n) <= psize D";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   706
by (forw_inst_tac [("r","n")] partition_ub 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   707
by (dres_inst_tac [("x","D n")] real_le_imp_less_or_eq 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   708
by (auto_tac (claset(),simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   709
    [lemma_partition_eq RS sym]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   710
by (forw_inst_tac [("r","n")] partition_lb 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   711
by (dtac lemma_additivity4_psize_eq 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   712
by (rtac ccontr 3 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   713
by (ftac (not_leE RSN (2,partition_eq_bound)) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   714
by (auto_tac (claset(),simpset() addsimps [partition_rhs]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   715
qed "lemma_psize_left_less_psize";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   716
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   717
Goal "[| partition(a,b) D; na < psize (%x. if D x < D n then D(x) else D n) |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   718
\     ==> na < psize D";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   719
by (etac (lemma_psize_left_less_psize RSN (2,less_le_trans)) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   720
by (assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   721
qed "lemma_psize_left_less_psize2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   722
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   723
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   724
Goal "[| partition(a,b) D; D na < D n; D n < D (Suc na); \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   725
\        n < psize D |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   726
\     ==> False";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   727
by (cut_inst_tac [("m","n"),("n","Suc na")] less_linear 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   728
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   729
by (dres_inst_tac [("n","n")] partition_lt_gen 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   730
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   731
by (cut_inst_tac [("m","psize D"),("n","na")] less_linear 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   732
by (auto_tac (claset(),simpset() addsimps [partition_rhs2]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   733
by (dtac (ARITH_PROVE "n < Suc na ==> n < na | n = na") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   734
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   735
by (dres_inst_tac [("n","na")] partition_lt_gen 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   736
by Auto_tac;
14435
9e22eeccf129 Conversion of Poly to Isar script, and other tidying of HOL/Hyperreal
paulson
parents: 14387
diff changeset
   737
qed "lemma_additivity3";
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   738
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   739
Goalw [psize_def] "psize (%x. k) = 0";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   740
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   741
qed "psize_const";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   742
Addsimps [psize_const];
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   743
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   744
Goal "[| partition(a,b) D; D na < D n; D n < D (Suc na); \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   745
\        na < psize D |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   746
\     ==> False";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   747
by (forw_inst_tac [("m","n")] partition_lt_cancel 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   748
by (auto_tac (claset() addIs [lemma_additivity3],simpset()));
14435
9e22eeccf129 Conversion of Poly to Isar script, and other tidying of HOL/Hyperreal
paulson
parents: 14387
diff changeset
   749
qed "lemma_additivity3a";
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   750
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   751
Goal "[| partition(a,b) D; D n < b |] ==> psize (%x. D (x + n)) <= psize D - n";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   752
by (res_inst_tac [("D2","(%x. D (x + n))")] (psize_def RS 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   753
    meta_eq_to_obj_eq RS ssubst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   754
by (res_inst_tac [("a","psize D - n")] someI2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   755
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   756
by (dtac (ARITH_PROVE "(m::nat) < n - p  ==> m + p < n") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   757
by (asm_full_simp_tac (simpset() addsimps [partition]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   758
by (dtac (ARITH_PROVE "(m::nat) - n <= p  ==> m <= p + n") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   759
by (case_tac "psize D <= n" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   760
by (dtac not_leE 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   761
by (asm_simp_tac (simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   762
    [ARITH_PROVE "p <= n ==> p - n = (0::nat)"]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   763
by (blast_tac (claset() addDs [partition_rhs2]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   764
by (asm_full_simp_tac (simpset() addsimps [partition]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   765
by (rtac ccontr 1 THEN dtac not_leE 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   766
by (dres_inst_tac [("x","psize D - n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   767
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   768
by (ftac partition_rhs 1 THEN Step_tac 1); 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   769
by (ftac partition_lt_cancel 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   770
by (dtac (partition  RS iffD1) 1 THEN Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   771
by (subgoal_tac "~  D (psize D - n + n) < D (Suc (psize D - n + n))" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   772
by (Blast_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   773
by (rotate_tac 6 1 THEN dres_inst_tac [("x","Suc (psize D)")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   774
by (Asm_simp_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   775
qed "better_lemma_psize_right_eq1";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   776
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   777
Goal "partition (a, D n) D ==> psize D <= n";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   778
by (rtac ccontr 1 THEN dtac not_leE 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   779
by (ftac partition_lt_Suc 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   780
by (forw_inst_tac [("r","Suc n")] partition_ub 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   781
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   782
qed "psize_le_n";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   783
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   784
Goal "partition(a,D n) D ==> psize (%x. D (x + n)) <= psize D - n";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   785
by (res_inst_tac [("D2","(%x. D (x + n))")] (psize_def RS 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   786
    meta_eq_to_obj_eq RS ssubst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   787
by (res_inst_tac [("a","psize D - n")] someI2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   788
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   789
by (dtac (ARITH_PROVE "(m::nat) < n - p  ==> m + p < n") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   790
by (asm_full_simp_tac (simpset() addsimps [partition]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   791
by (dtac (ARITH_PROVE "(m::nat) - n <= p  ==> m <= p + n") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   792
by (case_tac "psize D <= n" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   793
by (dtac not_leE 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   794
by (asm_simp_tac (simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   795
    [ARITH_PROVE "p <= n ==> p - n = (0::nat)"]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   796
by (blast_tac (claset() addDs [partition_rhs2]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   797
by (asm_full_simp_tac (simpset() addsimps [partition]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   798
by (rtac ccontr 1 THEN dtac not_leE 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   799
by (ftac psize_le_n 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   800
by (dres_inst_tac [("x","psize D - n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   801
by (asm_full_simp_tac (simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   802
    [ARITH_PROVE "p <= n ==> p - n = (0::nat)"]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   803
by (dtac (partition  RS iffD1) 1 THEN Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   804
by (rotate_tac 5 1 THEN dres_inst_tac [("x","Suc n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   805
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   806
qed "better_lemma_psize_right_eq1a";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   807
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   808
Goal "partition(a,b) D ==> psize (%x. D (x + n)) <= psize D - n";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   809
by (forw_inst_tac [("r1","n")] (partition_ub RS real_le_imp_less_or_eq) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   810
by (blast_tac (claset() addIs [better_lemma_psize_right_eq1a,
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   811
    better_lemma_psize_right_eq1]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   812
qed "better_lemma_psize_right_eq";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   813
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   814
Goal "[| partition(a,b) D; D n < b |] ==> psize (%x. D (x + n)) <= psize D";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   815
by (res_inst_tac [("D2","(%x. D (x + n))")] (psize_def RS 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   816
    meta_eq_to_obj_eq RS ssubst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   817
by (res_inst_tac [("a","psize D - n")] someI2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   818
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   819
by (dtac (ARITH_PROVE "(m::nat) < n - p  ==> m + p < n") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   820
by (asm_full_simp_tac (simpset() addsimps [partition]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   821
by (subgoal_tac "n <= psize D" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   822
by (dtac (ARITH_PROVE "(m::nat) - n <= p  ==> m <= p + n") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   823
by (asm_full_simp_tac (simpset() addsimps [partition]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   824
by (rtac ccontr 1 THEN dtac not_leE 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   825
by (dtac (less_imp_le RSN (2,partition_rhs2)) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   826
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   827
by (rtac ccontr 1 THEN dtac not_leE 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   828
by (dres_inst_tac [("x","psize D")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   829
by (asm_full_simp_tac (simpset() addsimps [partition]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   830
qed "lemma_psize_right_eq1";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   831
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   832
(* should be combined with previous theorem; also proof has redundancy *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   833
Goal "partition(a,D n) D ==> psize (%x. D (x + n)) <= psize D";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   834
by (res_inst_tac [("D2","(%x. D (x + n))")] (psize_def RS 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   835
    meta_eq_to_obj_eq RS ssubst) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   836
by (res_inst_tac [("a","psize D - n")] someI2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   837
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   838
by (dtac (ARITH_PROVE "(m::nat) < n - p  ==> m + p < n") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   839
by (asm_full_simp_tac (simpset() addsimps [partition]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   840
by (dtac (ARITH_PROVE "(m::nat) - n <= p  ==> m <= p + n") 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   841
by (case_tac "psize D <= n" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   842
by (dtac not_leE 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   843
by (asm_simp_tac (simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   844
    [ARITH_PROVE "p <= n ==> p - n = (0::nat)"]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   845
by (blast_tac (claset() addDs [partition_rhs2]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   846
by (asm_full_simp_tac (simpset() addsimps [partition]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   847
by (rtac ccontr 1 THEN dtac not_leE 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   848
by (dres_inst_tac [("x","psize D")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   849
by (asm_full_simp_tac (simpset() addsimps [partition]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   850
qed "lemma_psize_right_eq1a";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   851
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   852
Goal "[| partition(a,b) D |] ==> psize (%x. D (x + n)) <= psize D";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   853
by (forw_inst_tac [("r1","n")] (partition_ub RS real_le_imp_less_or_eq) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   854
by (blast_tac (claset() addIs [lemma_psize_right_eq1a,lemma_psize_right_eq1]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   855
qed "lemma_psize_right_eq";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   856
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   857
Goal "[| a <= D n; tpart (a, b) (D, p) |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   858
\     ==> tpart(a, D n) (%x. if D x < D n then D(x) else D n, \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   859
\         %x. if D x < D n then p(x) else D n)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   860
by (forw_inst_tac [("r","n")] (tpart_partition RS partition_ub) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   861
by (dres_inst_tac [("x","D n")] real_le_imp_less_or_eq 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   862
by (auto_tac (claset(),simpset() addsimps 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   863
    [tpart_partition RS lemma_partition_eq RS sym,
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   864
     tpart_tag_eq RS sym]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   865
by (ftac (tpart_partition RSN (3,lemma_additivity1)) 1); 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   866
by (auto_tac (claset(),simpset() addsimps [tpart_def]));
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   867
by (dtac ((linorder_not_less RS iffD1) RS real_le_imp_less_or_eq) 2);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   868
by (Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   869
by (blast_tac (claset() addDs [lemma_additivity3]) 2);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   870
by (dtac (linorder_not_less RS iffD1) 2 THEN dres_inst_tac [("x","na")] spec 2);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   871
by (arith_tac 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   872
by (ftac lemma_additivity4_psize_eq 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   873
by (REPEAT(assume_tac 1));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   874
by (rtac (partition RS iffD2) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   875
by (ftac (partition RS iffD1) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   876
by (auto_tac (claset() addIs [partition_lt_gen],simpset() addsimps []));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   877
by (dres_inst_tac [("n","n")] partition_lt_gen 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   878
by (assume_tac 1 THEN arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   879
by (Blast_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   880
by (dtac partition_lt_cancel 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   881
qed "tpart_left1";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   882
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   883
Goal "[| a <= D n; tpart (a, b) (D, p); gauge (%x. a <= x & x <= D n) g;\
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   884
\        fine (%x. if x < D n then min (g x) ((D n - x)/ 2) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   885
\                else if x = D n then min (g (D n)) (ga (D n)) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   886
\                     else min (ga x) ((x - D n)/ 2)) (D, p) |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   887
\     ==> fine g \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   888
\          (%x. if D x < D n then D(x) else D n, \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   889
\           %x. if D x < D n then p(x) else D n)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   890
by (auto_tac (claset(),simpset() addsimps [fine_def,tpart_def,gauge_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   891
by (ALLGOALS (ftac lemma_psize_left_less_psize2));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   892
by (TRYALL(assume_tac));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   893
by (ALLGOALS (dres_inst_tac [("x","na")] spec) THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   894
by (ALLGOALS(dres_inst_tac [("x","na")] spec));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   895
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   896
by (asm_full_simp_tac (simpset() addsimps [split_if]) 1);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   897
by (dtac ((linorder_not_less RS iffD1) RS real_le_imp_less_or_eq) 1);
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   898
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   899
by (blast_tac (claset() addDs [lemma_additivity3a]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   900
by (dtac sym 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   901
qed "fine_left1";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   902
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   903
Goal "[| a <= D n; tpart (a, b) (D, p) |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   904
\     ==> tpart(D n, b) (%x. D(x + n),%x. p(x + n))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   905
by (asm_full_simp_tac (simpset() addsimps [tpart_def,partition_def]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   906
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   907
by (res_inst_tac [("x","N - n")] exI 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   908
by (rotate_tac 2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   909
by (dres_inst_tac [("x","na + n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   910
by (rotate_tac 3 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   911
by (dres_inst_tac [("x","na + n")] spec 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   912
by (ALLGOALS(arith_tac));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   913
qed "tpart_right1";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   914
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   915
Goal "[| a <= D n; tpart (a, b) (D, p); gauge (%x. D n <= x & x <= b) ga;\
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   916
\        fine (%x. if x < D n then min (g x) ((D n - x)/ 2) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   917
\                else if x = D n then min (g (D n)) (ga (D n)) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   918
\                     else min (ga x) ((x - D n)/ 2)) (D, p) |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   919
\     ==> fine ga (%x. D(x + n),%x. p(x + n))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   920
by (auto_tac (claset(),simpset() addsimps [fine_def,gauge_def]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   921
by (dres_inst_tac [("x","na + n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   922
by (forw_inst_tac [("n","n")] (tpart_partition RS better_lemma_psize_right_eq) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   923
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   924
by (arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   925
by (asm_full_simp_tac (simpset() addsimps [tpart_def]) 1 THEN Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   926
by (subgoal_tac "D n <= p (na + n)" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   927
by (dres_inst_tac [("y","p (na + n)")] real_le_imp_less_or_eq 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   928
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   929
by (asm_full_simp_tac (simpset() addsimps [split_if]) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   930
by (Asm_full_simp_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   931
by (dtac less_le_trans 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   932
by (rotate_tac 5 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   933
by (dres_inst_tac [("x","na + n")] spec 1 THEN Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   934
by (rtac real_le_trans 1 THEN assume_tac 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   935
by (case_tac "na = 0" 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   936
by (rtac (partition_lt_gen RS order_less_imp_le) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   937
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   938
by (arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   939
qed "fine_right1";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   940
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   941
Goalw [rsum_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   942
   "rsum (D, p) (%x. f x + g x) =  rsum (D, p) f + rsum(D, p) g";
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   943
by (auto_tac (claset(),simpset() addsimps [sumr_add,left_distrib]));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   944
qed "rsum_add";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   945
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   946
(* Bartle/Sherbert: Theorem 10.1.5 p. 278 *)
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   947
Goalw [Integral_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   948
    "[| a <= b; Integral(a,b) f k1; Integral(a,b) g k2 |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   949
\    ==> Integral(a,b) (%x. f x + g x) (k1 + k2)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   950
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   951
by (REPEAT(dres_inst_tac [("x","e/2")] spec 1));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   952
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   953
by (dtac gauge_min 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   954
by (res_inst_tac [("x","(%x. if ga x < gaa x then ga x else gaa x)")] exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   955
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   956
by (dtac fine_min 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   957
by (REPEAT(dtac spec 1) THEN Auto_tac);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   958
by (dres_inst_tac  [("a","abs (rsum (D, p) f - k1)* 2"),
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   959
    ("c","abs (rsum (D, p) g - k2) * 2")] 
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   960
    add_strict_mono 1 THEN assume_tac 1);
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
   961
by (auto_tac (claset(),HOL_ss addsimps [rsum_add,left_distrib RS sym,
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14365
diff changeset
   962
    mult_2_right RS sym,real_mult_less_iff1,CLAIM "(0::real) < 2"]));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   963
by (arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   964
qed "Integral_add_fun";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   965
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   966
Goal "[| partition(a,b) D; r < psize D |] ==> 0 < D (Suc r) - D r";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   967
by (auto_tac (claset(),simpset() addsimps [partition]));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   968
qed "partition_lt_gen2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   969
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   970
Goalw [tpart_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   971
     "[| ALL x. a <= x & x <= b --> f x <= g x; \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   972
\        tpart(a,b) (D,p) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   973
\     |] ==> ALL n. n <= psize D --> f (p n) <= g (p n)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   974
by (Auto_tac THEN ftac (partition RS iffD1) 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   975
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   976
by (dres_inst_tac [("x","p n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   977
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   978
by (case_tac "n = 0" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   979
by (rtac (partition_lt_gen RS order_less_le_trans RS order_less_imp_le) 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   980
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   981
by (dtac le_imp_less_or_eq 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   982
by (dres_inst_tac [("x","psize D")] spec 2 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   983
by (dres_inst_tac [("r","Suc n")] partition_ub 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   984
by (dres_inst_tac [("x","n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   985
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   986
qed "lemma_Integral_le";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   987
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   988
Goalw [rsum_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   989
     "[| ALL x. a <= x & x <= b --> f x <= g x; \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   990
\        tpart(a,b) (D,p) \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   991
\     |] ==> rsum(D,p) f <= rsum(D,p) g";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   992
by (auto_tac (claset() addSIs [sumr_le2] addDs 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   993
    [tpart_partition RS partition_lt_gen2] addSDs 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   994
    [lemma_Integral_le],simpset()));
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   995
qed "lemma_Integral_rsum_le";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   996
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   997
Goalw [Integral_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   998
    "[| a <= b; \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
   999
\       ALL x. a <= x & x <= b --> f(x) <= g(x); \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1000
\       Integral(a,b) f k1; Integral(a,b) g k2 \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1001
\    |] ==> k1 <= k2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1002
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1003
by (rotate_tac 2 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1004
by (dres_inst_tac [("x","abs(k1 - k2)/2")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1005
by (dres_inst_tac [("x","abs(k1 - k2)/2")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1006
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1007
by (dtac gauge_min 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1008
by (dres_inst_tac [("g","%x. if ga x < gaa x then ga x else gaa x")] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1009
    partition_exists 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1010
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1011
by (dtac fine_min 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1012
by (dres_inst_tac [("x","D")] spec 1 THEN dres_inst_tac [("x","D")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1013
by (dres_inst_tac [("x","p")] spec 1 THEN dres_inst_tac [("x","p")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1014
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1015
by (ftac lemma_Integral_rsum_le 1 THEN assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1016
by (subgoal_tac 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1017
    "abs((rsum(D,p) f - k1) - (rsum(D,p) g - k2)) < abs(k1 - k2)" 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1018
by (arith_tac 1);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
  1019
by (dtac add_strict_mono 1 THEN assume_tac 1);
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
  1020
by (auto_tac (claset(),HOL_ss addsimps [left_distrib RS sym,
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14365
diff changeset
  1021
    mult_2_right RS sym,real_mult_less_iff1,CLAIM "(0::real) < 2"]));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1022
by (arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1023
qed "Integral_le";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1024
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1025
Goalw [Integral_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1026
     "(EX k. Integral(a,b) f k) ==> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1027
\     (ALL e. 0 < e --> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1028
\              (EX g. gauge (%x. a <= x & x <= b) g & \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1029
\                      (ALL D1 D2 p1 p2. \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1030
\                           tpart(a,b) (D1, p1) & fine g (D1,p1) & \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1031
\                           tpart(a,b) (D2, p2) & fine g (D2,p2) --> \ 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1032
\                           abs(rsum(D1,p1) f - rsum(D2,p2) f) < e)))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1033
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1034
by (dres_inst_tac [("x","e/2")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1035
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1036
by (rtac exI 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1037
by (forw_inst_tac [("x","D1")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1038
by (forw_inst_tac [("x","D2")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1039
by (REPEAT(dtac spec 1) THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1040
by (thin_tac "0 < e" 1);
14334
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
  1041
by (dtac add_strict_mono 1 THEN assume_tac 1);
6137d24eef79 tweaking of lemmas in RealDef, RealOrd
paulson
parents: 14329
diff changeset
  1042
by (auto_tac (claset(),HOL_ss addsimps [left_distrib RS sym,
14387
e96d5c42c4b0 Polymorphic treatment of binary arithmetic using axclasses
paulson
parents: 14365
diff changeset
  1043
    mult_2_right RS sym,real_mult_less_iff1,CLAIM "(0::real) < 2"]));
13958
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1044
by (arith_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1045
qed "Integral_imp_Cauchy";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1046
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1047
Goalw [Cauchy_def] 
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1048
     "Cauchy X = \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1049
\     (ALL j. (EX M. ALL m n. M <= m & M <= n --> \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1050
\              abs (X m + - X n) < inverse(real (Suc j))))";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1051
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1052
by (dtac reals_Archimedean 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1053
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1054
by (dres_inst_tac [("x","n")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1055
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1056
by (res_inst_tac [("x","M")] exI 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1057
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1058
by (dres_inst_tac [("x","m")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1059
by (dres_inst_tac [("x","na")] spec 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1060
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1061
qed "Cauchy_iff2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1062
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1063
Goal "[| a <= b; ALL n. gauge (%x. a <= x & x <= b) (fa n) |] \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1064
\     ==> ALL n. EX D p. tpart (a, b) (D, p) & fine (fa n) (D, p)";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1065
by (Step_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1066
by (rtac partition_exists 1 THEN Auto_tac);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1067
qed "partition_exists2";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1068
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1069
Goal "[| a <= b; ALL c. a <= c & c <= b --> f' c <= g' c; \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1070
\        ALL x. DERIV f x :> f' x; ALL x. DERIV g x :> g' x \
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1071
\     |] ==> f b - f a <= g b - g a";
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1072
by (rtac Integral_le 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1073
by (assume_tac 1);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1074
by (rtac FTC1 2);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1075
by (rtac FTC1 4);
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1076
by Auto_tac;
c1c67582c9b5 New material on integration, etc. Moving Hyperreal/ex
paulson
parents:
diff changeset
  1077
qed "monotonic_anti_derivative";