src/HOL/Real/Hyperreal/HyperDef.ML
author paulson
Wed, 07 Jun 2000 17:14:58 +0200
changeset 9055 f020e00c6304
parent 9043 ca761fe227d8
child 9071 6416d5a5f712
permissions -rw-r--r--
replacing 0hr by (0::hypreal)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
     1
(*  Title       : HOL/Real/Hyperreal/Hyper.ML
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
     2
    ID          : $Id$
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
     3
    Author      : Jacques D. Fleuriot
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
     4
    Copyright   : 1998  University of Cambridge
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
     5
    Description : Ultrapower construction of hyperreals
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
     6
*) 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
     7
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
     8
(*------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
     9
             Proof that the set of naturals is not finite
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    10
 ------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    11
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    12
(*** based on James' proof that the set of naturals is not finite ***)
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
    13
Goal "finite (A::nat set) --> (EX n. ALL m. Suc (n + m) ~: A)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    14
by (rtac impI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    15
by (eres_inst_tac [("F","A")] finite_induct 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    16
by (Blast_tac 1 THEN etac exE 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    17
by (res_inst_tac [("x","n + x")] exI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    18
by (rtac allI 1 THEN eres_inst_tac [("x","x + m")] allE 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    19
by (auto_tac (claset(), simpset() addsimps add_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    20
by (auto_tac (claset(),
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    21
	      simpset() addsimps [add_assoc RS sym,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    22
				  less_add_Suc2 RS less_not_refl2]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    23
qed_spec_mp "finite_exhausts";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    24
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
    25
Goal "finite (A :: nat set) --> (EX n. n ~:A)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    26
by (rtac impI 1 THEN dtac finite_exhausts 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    27
by (Blast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    28
qed_spec_mp "finite_not_covers";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    29
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    30
Goal "~ finite(UNIV:: nat set)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    31
by (fast_tac (claset() addSDs [finite_exhausts]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    32
qed "not_finite_nat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    33
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    34
(*------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    35
   Existence of free ultrafilter over the naturals and proof of various 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    36
   properties of the FreeUltrafilterNat- an arbitrary free ultrafilter
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    37
 ------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    38
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    39
Goal "EX U. U: FreeUltrafilter (UNIV::nat set)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    40
by (rtac (not_finite_nat RS FreeUltrafilter_Ex) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    41
qed "FreeUltrafilterNat_Ex";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    42
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    43
Goalw [FreeUltrafilterNat_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    44
     "FreeUltrafilterNat: FreeUltrafilter(UNIV:: nat set)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    45
by (rtac (FreeUltrafilterNat_Ex RS exE) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    46
by (rtac selectI2 1 THEN ALLGOALS(assume_tac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    47
qed "FreeUltrafilterNat_mem";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    48
Addsimps [FreeUltrafilterNat_mem];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    49
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    50
Goalw [FreeUltrafilterNat_def] "finite x ==> x ~: FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    51
by (rtac (FreeUltrafilterNat_Ex RS exE) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    52
by (rtac selectI2 1 THEN assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    53
by (blast_tac (claset() addDs [mem_FreeUltrafiltersetD1]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    54
qed "FreeUltrafilterNat_finite";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    55
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    56
Goal "x: FreeUltrafilterNat ==> ~ finite x";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    57
by (blast_tac (claset() addDs [FreeUltrafilterNat_finite]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    58
qed "FreeUltrafilterNat_not_finite";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    59
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    60
Goalw [FreeUltrafilterNat_def] "{} ~: FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    61
by (rtac (FreeUltrafilterNat_Ex RS exE) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    62
by (rtac selectI2 1 THEN assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    63
by (blast_tac (claset() addDs [FreeUltrafilter_Ultrafilter,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    64
			       Ultrafilter_Filter,Filter_empty_not_mem]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    65
qed "FreeUltrafilterNat_empty";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    66
Addsimps [FreeUltrafilterNat_empty];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    67
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    68
Goal "[| X: FreeUltrafilterNat;  Y: FreeUltrafilterNat |]  \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    69
\     ==> X Int Y : FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    70
by (cut_facts_tac [FreeUltrafilterNat_mem] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    71
by (blast_tac (claset() addDs [FreeUltrafilter_Ultrafilter,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    72
			       Ultrafilter_Filter,mem_FiltersetD1]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    73
qed "FreeUltrafilterNat_Int";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    74
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    75
Goal "[| X: FreeUltrafilterNat;  X <= Y |] \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    76
\     ==> Y : FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    77
by (cut_facts_tac [FreeUltrafilterNat_mem] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    78
by (blast_tac (claset() addDs [FreeUltrafilter_Ultrafilter,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    79
			       Ultrafilter_Filter,mem_FiltersetD2]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    80
qed "FreeUltrafilterNat_subset";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    81
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    82
Goal "X: FreeUltrafilterNat ==> -X ~: FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    83
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    84
by (dtac FreeUltrafilterNat_Int 1 THEN assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    85
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    86
qed "FreeUltrafilterNat_Compl";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    87
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    88
Goal "X~: FreeUltrafilterNat ==> -X : FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    89
by (cut_facts_tac [FreeUltrafilterNat_mem RS (FreeUltrafilter_iff RS iffD1)] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    90
by (Step_tac 1 THEN dres_inst_tac [("x","X")] bspec 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    91
by (auto_tac (claset(),simpset() addsimps [UNIV_diff_Compl]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    92
qed "FreeUltrafilterNat_Compl_mem";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    93
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    94
Goal "(X ~: FreeUltrafilterNat) = (-X: FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    95
by (blast_tac (claset() addDs [FreeUltrafilterNat_Compl,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    96
			       FreeUltrafilterNat_Compl_mem]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    97
qed "FreeUltrafilterNat_Compl_iff1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    98
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
    99
Goal "(X: FreeUltrafilterNat) = (-X ~: FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   100
by (auto_tac (claset(),
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   101
	      simpset() addsimps [FreeUltrafilterNat_Compl_iff1 RS sym]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   102
qed "FreeUltrafilterNat_Compl_iff2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   103
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   104
Goal "(UNIV::nat set) : FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   105
by (rtac (FreeUltrafilterNat_mem RS FreeUltrafilter_Ultrafilter RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   106
          Ultrafilter_Filter RS mem_FiltersetD4) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   107
qed "FreeUltrafilterNat_UNIV";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   108
Addsimps [FreeUltrafilterNat_UNIV];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   109
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   110
Goal "{n::nat. True}: FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   111
by (subgoal_tac "{n::nat. True} = (UNIV::nat set)" 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   112
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   113
qed "FreeUltrafilterNat_Nat_set";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   114
Addsimps [FreeUltrafilterNat_Nat_set];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   115
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   116
Goal "{n. P(n) = P(n)} : FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   117
by (Simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   118
qed "FreeUltrafilterNat_Nat_set_refl";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   119
AddIs [FreeUltrafilterNat_Nat_set_refl];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   120
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   121
Goal "{n::nat. P} : FreeUltrafilterNat ==> P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   122
by (rtac ccontr 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   123
by (rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   124
by (Asm_full_simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   125
qed "FreeUltrafilterNat_P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   126
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   127
Goal "{n. P(n)} : FreeUltrafilterNat ==> EX n. P(n)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   128
by (rtac ccontr 1 THEN rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   129
by (Asm_full_simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   130
qed "FreeUltrafilterNat_Ex_P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   131
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   132
Goal "ALL n. P(n) ==> {n. P(n)} : FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   133
by (auto_tac (claset() addIs [FreeUltrafilterNat_Nat_set],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   134
qed "FreeUltrafilterNat_all";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   135
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   136
(*-----------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   137
     Define and use Ultrafilter tactics
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   138
 -----------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   139
use "fuf.ML";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   140
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   141
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   142
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   143
(*------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   144
   Now prove one further property of our free ultrafilter
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   145
 -------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   146
Goal "X Un Y: FreeUltrafilterNat \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   147
\     ==> X: FreeUltrafilterNat | Y: FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   148
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   149
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   150
qed "FreeUltrafilterNat_Un";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   151
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   152
(*------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   153
                       Properties of hyprel
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   154
 ------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   155
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   156
(** Proving that hyprel is an equivalence relation **)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   157
(** Natural deduction for hyprel **)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   158
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   159
Goalw [hyprel_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   160
   "((X,Y): hyprel) = ({n. X n = Y n}: FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   161
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   162
qed "hyprel_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   163
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   164
Goalw [hyprel_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   165
     "{n. X n = Y n}: FreeUltrafilterNat  ==> (X,Y): hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   166
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   167
qed "hyprelI";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   168
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   169
Goalw [hyprel_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   170
  "p: hyprel --> (EX X Y. \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   171
\                 p = (X,Y) & {n. X n = Y n} : FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   172
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   173
qed "hyprelE_lemma";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   174
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   175
val [major,minor] = goal thy
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   176
  "[| p: hyprel;  \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   177
\     !!X Y. [| p = (X,Y); {n. X n = Y n}: FreeUltrafilterNat\
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   178
\                    |] ==> Q |] ==> Q";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   179
by (cut_facts_tac [major RS (hyprelE_lemma RS mp)] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   180
by (REPEAT (eresolve_tac [asm_rl,exE,conjE,minor] 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   181
qed "hyprelE";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   182
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   183
AddSIs [hyprelI];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   184
AddSEs [hyprelE];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   185
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   186
Goalw [hyprel_def] "(x,x): hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   187
by (auto_tac (claset(),simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   188
         [FreeUltrafilterNat_Nat_set]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   189
qed "hyprel_refl";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   190
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   191
Goal "{n. X n = Y n} = {n. Y n = X n}";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   192
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   193
qed "lemma_perm";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   194
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   195
Goalw [hyprel_def] "(x,y): hyprel --> (y,x):hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   196
by (auto_tac (claset() addIs [lemma_perm RS subst],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   197
qed_spec_mp "hyprel_sym";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   198
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   199
Goalw [hyprel_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   200
      "(x,y): hyprel --> (y,z):hyprel --> (x,z):hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   201
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   202
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   203
qed_spec_mp "hyprel_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   204
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   205
Goalw [equiv_def, refl_def, sym_def, trans_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   206
    "equiv {x::nat=>real. True} hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   207
by (auto_tac (claset() addSIs [hyprel_refl] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   208
                       addSEs [hyprel_sym,hyprel_trans] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   209
                       delrules [hyprelI,hyprelE],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   210
	      simpset() addsimps [FreeUltrafilterNat_Nat_set]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   211
qed "equiv_hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   212
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   213
val equiv_hyprel_iff =
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   214
    [TrueI, TrueI] MRS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   215
    ([CollectI, CollectI] MRS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   216
    (equiv_hyprel RS eq_equiv_class_iff));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   217
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   218
Goalw  [hypreal_def,hyprel_def,quotient_def] "hyprel^^{x}:hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   219
by (Blast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   220
qed "hyprel_in_hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   221
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   222
Goal "inj_on Abs_hypreal hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   223
by (rtac inj_on_inverseI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   224
by (etac Abs_hypreal_inverse 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   225
qed "inj_on_Abs_hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   226
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   227
Addsimps [equiv_hyprel_iff,inj_on_Abs_hypreal RS inj_on_iff,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   228
          hyprel_iff, hyprel_in_hypreal, Abs_hypreal_inverse];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   229
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   230
Addsimps [equiv_hyprel RS eq_equiv_class_iff];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   231
val eq_hyprelD = equiv_hyprel RSN (2,eq_equiv_class);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   232
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   233
Goal "inj(Rep_hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   234
by (rtac inj_inverseI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   235
by (rtac Rep_hypreal_inverse 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   236
qed "inj_Rep_hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   237
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   238
Goalw [hyprel_def] "x: hyprel ^^ {x}";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   239
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   240
by (auto_tac (claset() addSIs [FreeUltrafilterNat_Nat_set],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   241
qed "lemma_hyprel_refl";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   242
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   243
Addsimps [lemma_hyprel_refl];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   244
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   245
Goalw [hypreal_def] "{} ~: hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   246
by (auto_tac (claset() addSEs [quotientE], simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   247
qed "hypreal_empty_not_mem";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   248
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   249
Addsimps [hypreal_empty_not_mem];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   250
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   251
Goal "Rep_hypreal x ~= {}";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   252
by (cut_inst_tac [("x","x")] Rep_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   253
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   254
qed "Rep_hypreal_nonempty";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   255
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   256
Addsimps [Rep_hypreal_nonempty];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   257
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   258
(*------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   259
   hypreal_of_real: the injection from real to hypreal
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   260
 ------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   261
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   262
Goal "inj(hypreal_of_real)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   263
by (rtac injI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   264
by (rewtac hypreal_of_real_def);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   265
by (dtac (inj_on_Abs_hypreal RS inj_onD) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   266
by (REPEAT (rtac hyprel_in_hypreal 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   267
by (dtac eq_equiv_class 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   268
by (rtac equiv_hyprel 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   269
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   270
by (rtac ccontr 1 THEN rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   271
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   272
qed "inj_hypreal_of_real";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   273
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   274
val [prem] = goal thy
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   275
    "(!!x y. z = Abs_hypreal(hyprel^^{x}) ==> P) ==> P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   276
by (res_inst_tac [("x1","z")] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   277
    (rewrite_rule [hypreal_def] Rep_hypreal RS quotientE) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   278
by (dres_inst_tac [("f","Abs_hypreal")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   279
by (res_inst_tac [("x","x")] prem 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   280
by (asm_full_simp_tac (simpset() addsimps [Rep_hypreal_inverse]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   281
qed "eq_Abs_hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   282
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   283
(**** hypreal_minus: additive inverse on hypreal ****)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   284
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   285
Goalw [congruent_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   286
  "congruent hyprel (%X. hyprel^^{%n. - (X n)})";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   287
by Safe_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   288
by (ALLGOALS Ultra_tac);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   289
qed "hypreal_minus_congruent";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   290
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   291
(*Resolve th against the corresponding facts for hypreal_minus*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   292
val hypreal_minus_ize = RSLIST [equiv_hyprel, hypreal_minus_congruent];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   293
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   294
Goalw [hypreal_minus_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   295
      "- (Abs_hypreal(hyprel^^{%n. X n})) = Abs_hypreal(hyprel ^^ {%n. -(X n)})";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   296
by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   297
by (simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   298
   [hyprel_in_hypreal RS Abs_hypreal_inverse,hypreal_minus_ize UN_equiv_class]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   299
qed "hypreal_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   300
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   301
Goal "- (- z) = (z::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   302
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   303
by (asm_simp_tac (simpset() addsimps [hypreal_minus]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   304
qed "hypreal_minus_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   305
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   306
Addsimps [hypreal_minus_minus];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   307
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   308
Goal "inj(%r::hypreal. -r)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   309
by (rtac injI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   310
by (dres_inst_tac [("f","uminus")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   311
by (asm_full_simp_tac (simpset() addsimps [hypreal_minus_minus]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   312
qed "inj_hypreal_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   313
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   314
Goalw [hypreal_zero_def] "-0 = (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   315
by (simp_tac (simpset() addsimps [hypreal_minus]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   316
qed "hypreal_minus_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   317
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   318
Addsimps [hypreal_minus_zero];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   319
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   320
Goal "(-x = 0) = (x = (0::hypreal))"; 
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   321
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   322
by (auto_tac (claset(),simpset() addsimps [hypreal_zero_def,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   323
    hypreal_minus] @ real_add_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   324
qed "hypreal_minus_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   325
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   326
Addsimps [hypreal_minus_zero_iff];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   327
(**** hrinv: multiplicative inverse on hypreal ****)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   328
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   329
Goalw [congruent_def]
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
   330
  "congruent hyprel (%X. hyprel^^{%n. if X n = #0 then #0 else rinv(X n)})";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   331
by (Auto_tac THEN Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   332
qed "hypreal_hrinv_congruent";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   333
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   334
(* Resolve th against the corresponding facts for hrinv *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   335
val hypreal_hrinv_ize = RSLIST [equiv_hyprel, hypreal_hrinv_congruent];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   336
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   337
Goalw [hrinv_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   338
      "hrinv (Abs_hypreal(hyprel^^{%n. X n})) = \
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
   339
\      Abs_hypreal(hyprel ^^ {%n. if X n = #0 then #0 else rinv(X n)})";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   340
by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   341
by (simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   342
   [hyprel_in_hypreal RS Abs_hypreal_inverse,hypreal_hrinv_ize UN_equiv_class]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   343
qed "hypreal_hrinv";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   344
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   345
Goal "z ~= 0 ==> hrinv (hrinv z) = z";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   346
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   347
by (rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   348
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   349
    [hypreal_hrinv,hypreal_zero_def] setloop (split_tac [expand_if])) 1);
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
   350
by (ultra_tac (claset() addDs (map (full_rename_numerals thy)
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
   351
    [rinv_not_zero,real_rinv_rinv]),simpset()) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   352
qed "hypreal_hrinv_hrinv";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   353
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   354
Addsimps [hypreal_hrinv_hrinv];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   355
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   356
Goalw [hypreal_one_def] "hrinv(1hr) = 1hr";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   357
by (full_simp_tac (simpset() addsimps [hypreal_hrinv,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   358
       real_zero_not_eq_one RS not_sym] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   359
                   setloop (split_tac [expand_if])) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   360
qed "hypreal_hrinv_1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   361
Addsimps [hypreal_hrinv_1];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   362
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   363
(**** hyperreal addition: hypreal_add  ****)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   364
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   365
Goalw [congruent2_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   366
    "congruent2 hyprel (%X Y. hyprel^^{%n. X n + Y n})";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   367
by Safe_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   368
by (ALLGOALS(Ultra_tac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   369
qed "hypreal_add_congruent2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   370
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   371
(*Resolve th against the corresponding facts for hyppreal_add*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   372
val hypreal_add_ize = RSLIST [equiv_hyprel, hypreal_add_congruent2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   373
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   374
Goalw [hypreal_add_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   375
  "Abs_hypreal(hyprel^^{%n. X n}) + Abs_hypreal(hyprel^^{%n. Y n}) = \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   376
\  Abs_hypreal(hyprel^^{%n. X n + Y n})";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   377
by (asm_simp_tac
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   378
    (simpset() addsimps [hypreal_add_ize UN_equiv_class2]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   379
qed "hypreal_add";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   380
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   381
Goal "(z::hypreal) + w = w + z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   382
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   383
by (res_inst_tac [("z","w")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   384
by (asm_simp_tac (simpset() addsimps (real_add_ac @ [hypreal_add])) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   385
qed "hypreal_add_commute";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   386
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   387
Goal "((z1::hypreal) + z2) + z3 = z1 + (z2 + z3)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   388
by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   389
by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   390
by (res_inst_tac [("z","z3")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   391
by (asm_simp_tac (simpset() addsimps [hypreal_add, real_add_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   392
qed "hypreal_add_assoc";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   393
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   394
(*For AC rewriting*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   395
Goal "(x::hypreal)+(y+z)=y+(x+z)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   396
by (rtac (hypreal_add_commute RS trans) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   397
by (rtac (hypreal_add_assoc RS trans) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   398
by (rtac (hypreal_add_commute RS arg_cong) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   399
qed "hypreal_add_left_commute";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   400
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   401
(* hypreal addition is an AC operator *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   402
val hypreal_add_ac = [hypreal_add_assoc,hypreal_add_commute,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   403
                      hypreal_add_left_commute];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   404
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   405
Goalw [hypreal_zero_def] "(0::hypreal) + z = z";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   406
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   407
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   408
    [hypreal_add]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   409
qed "hypreal_add_zero_left";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   410
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   411
Goal "z + (0::hypreal) = z";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   412
by (simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   413
    [hypreal_add_zero_left,hypreal_add_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   414
qed "hypreal_add_zero_right";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   415
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   416
Goalw [hypreal_zero_def] "z + -z = (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   417
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   418
by (asm_full_simp_tac (simpset() addsimps [hypreal_minus,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   419
        hypreal_add]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   420
qed "hypreal_add_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   421
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   422
Goal "-z + z = (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   423
by (simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   424
    [hypreal_add_commute,hypreal_add_minus]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   425
qed "hypreal_add_minus_left";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   426
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   427
Addsimps [hypreal_add_minus,hypreal_add_minus_left,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   428
          hypreal_add_zero_left,hypreal_add_zero_right];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   429
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   430
Goal "EX y. (x::hypreal) + y = 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   431
by (fast_tac (claset() addIs [hypreal_add_minus]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   432
qed "hypreal_minus_ex";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   433
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   434
Goal "EX! y. (x::hypreal) + y = 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   435
by (auto_tac (claset() addIs [hypreal_add_minus],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   436
by (dres_inst_tac [("f","%x. ya+x")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   437
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   438
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   439
qed "hypreal_minus_ex1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   440
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   441
Goal "EX! y. y + (x::hypreal) = 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   442
by (auto_tac (claset() addIs [hypreal_add_minus_left],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   443
by (dres_inst_tac [("f","%x. x+ya")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   444
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   445
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   446
qed "hypreal_minus_left_ex1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   447
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   448
Goal "x + y = (0::hypreal) ==> x = -y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   449
by (cut_inst_tac [("z","y")] hypreal_add_minus_left 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   450
by (res_inst_tac [("x1","y")] (hypreal_minus_left_ex1 RS ex1E) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   451
by (Blast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   452
qed "hypreal_add_minus_eq_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   453
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   454
Goal "EX y::hypreal. x = -y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   455
by (cut_inst_tac [("x","x")] hypreal_minus_ex 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   456
by (etac exE 1 THEN dtac hypreal_add_minus_eq_minus 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   457
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   458
qed "hypreal_as_add_inverse_ex";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   459
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   460
Goal "-(x + (y::hypreal)) = -x + -y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   461
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   462
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   463
by (auto_tac (claset(),simpset() addsimps [hypreal_minus,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   464
    hypreal_add,real_minus_add_distrib]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   465
qed "hypreal_minus_add_distrib";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   466
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   467
Goal "-(y + -(x::hypreal)) = x + -y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   468
by (simp_tac (simpset() addsimps [hypreal_minus_add_distrib,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   469
    hypreal_add_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   470
qed "hypreal_minus_distrib1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   471
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   472
Goal "(x + - (y::hypreal)) + (y + - z) = x + -z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   473
by (res_inst_tac [("w1","y")] (hypreal_add_commute RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   474
by (simp_tac (simpset() addsimps [hypreal_add_left_commute,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   475
    hypreal_add_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   476
by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   477
qed "hypreal_add_minus_cancel1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   478
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   479
Goal "((x::hypreal) + y = x + z) = (y = z)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   480
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   481
by (dres_inst_tac [("f","%t.-x + t")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   482
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   483
qed "hypreal_add_left_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   484
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   485
Goal "z + (x + (y + -z)) = x + (y::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   486
by (simp_tac (simpset() addsimps hypreal_add_ac) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   487
qed "hypreal_add_minus_cancel2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   488
Addsimps [hypreal_add_minus_cancel2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   489
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   490
Goal "y + -(x + y) = -(x::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   491
by (full_simp_tac (simpset() addsimps [hypreal_minus_add_distrib]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   492
by (rtac (hypreal_add_left_commute RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   493
by (Full_simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   494
qed "hypreal_add_minus_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   495
Addsimps [hypreal_add_minus_cancel];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   496
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   497
Goal "y + -(y + x) = -(x::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   498
by (simp_tac (simpset() addsimps [hypreal_minus_add_distrib,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   499
              hypreal_add_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   500
qed "hypreal_add_minus_cancelc";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   501
Addsimps [hypreal_add_minus_cancelc];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   502
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   503
Goal "(z + -x) + (y + -z) = (y + -(x::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   504
by (full_simp_tac (simpset() addsimps [hypreal_minus_add_distrib
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   505
    RS sym, hypreal_add_left_cancel] @ hypreal_add_ac) 1); 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   506
qed "hypreal_add_minus_cancel3";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   507
Addsimps [hypreal_add_minus_cancel3];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   508
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   509
Goal "(y + (x::hypreal)= z + x) = (y = z)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   510
by (simp_tac (simpset() addsimps [hypreal_add_commute,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   511
    hypreal_add_left_cancel]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   512
qed "hypreal_add_right_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   513
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   514
Goal "z + (y + -z) = (y::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   515
by (simp_tac (simpset() addsimps hypreal_add_ac) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   516
qed "hypreal_add_minus_cancel4";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   517
Addsimps [hypreal_add_minus_cancel4];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   518
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   519
Goal "z + (w + (x + (-z + y))) = w + x + (y::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   520
by (simp_tac (simpset() addsimps hypreal_add_ac) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   521
qed "hypreal_add_minus_cancel5";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   522
Addsimps [hypreal_add_minus_cancel5];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   523
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   524
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   525
(**** hyperreal multiplication: hypreal_mult  ****)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   526
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   527
Goalw [congruent2_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   528
    "congruent2 hyprel (%X Y. hyprel^^{%n. X n * Y n})";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   529
by Safe_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   530
by (ALLGOALS(Ultra_tac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   531
qed "hypreal_mult_congruent2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   532
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   533
(*Resolve th against the corresponding facts for hypreal_mult*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   534
val hypreal_mult_ize = RSLIST [equiv_hyprel, hypreal_mult_congruent2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   535
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   536
Goalw [hypreal_mult_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   537
  "Abs_hypreal(hyprel^^{%n. X n}) * Abs_hypreal(hyprel^^{%n. Y n}) = \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   538
\  Abs_hypreal(hyprel^^{%n. X n * Y n})";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   539
by (asm_simp_tac
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   540
    (simpset() addsimps [hypreal_mult_ize UN_equiv_class2]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   541
qed "hypreal_mult";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   542
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   543
Goal "(z::hypreal) * w = w * z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   544
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   545
by (res_inst_tac [("z","w")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   546
by (asm_simp_tac (simpset() addsimps ([hypreal_mult] @ real_mult_ac)) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   547
qed "hypreal_mult_commute";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   548
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   549
Goal "((z1::hypreal) * z2) * z3 = z1 * (z2 * z3)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   550
by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   551
by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   552
by (res_inst_tac [("z","z3")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   553
by (asm_simp_tac (simpset() addsimps [hypreal_mult,real_mult_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   554
qed "hypreal_mult_assoc";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   555
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   556
qed_goal "hypreal_mult_left_commute" thy
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   557
    "(z1::hypreal) * (z2 * z3) = z2 * (z1 * z3)"
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   558
 (fn _ => [rtac (hypreal_mult_commute RS trans) 1, rtac (hypreal_mult_assoc RS trans) 1,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   559
           rtac (hypreal_mult_commute RS arg_cong) 1]);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   560
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   561
(* hypreal multiplication is an AC operator *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   562
val hypreal_mult_ac = [hypreal_mult_assoc, hypreal_mult_commute, 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   563
                       hypreal_mult_left_commute];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   564
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   565
Goalw [hypreal_one_def] "1hr * z = z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   566
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   567
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   568
qed "hypreal_mult_1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   569
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   570
Goal "z * 1hr = z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   571
by (simp_tac (simpset() addsimps [hypreal_mult_commute,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   572
    hypreal_mult_1]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   573
qed "hypreal_mult_1_right";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   574
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   575
Goalw [hypreal_zero_def] "0 * z = (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   576
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   577
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult,real_mult_0]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   578
qed "hypreal_mult_0";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   579
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   580
Goal "z * 0 = (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   581
by (simp_tac (simpset() addsimps [hypreal_mult_commute,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   582
    hypreal_mult_0]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   583
qed "hypreal_mult_0_right";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   584
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   585
Addsimps [hypreal_mult_0,hypreal_mult_0_right];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   586
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   587
Goal "-(x * y) = -x * (y::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   588
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   589
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
9043
ca761fe227d8 First round of changes, towards installation of simprocs
paulson
parents: 9013
diff changeset
   590
by (auto_tac (claset(),
ca761fe227d8 First round of changes, towards installation of simprocs
paulson
parents: 9013
diff changeset
   591
	      simpset() addsimps [hypreal_minus, hypreal_mult] 
ca761fe227d8 First round of changes, towards installation of simprocs
paulson
parents: 9013
diff changeset
   592
                                 @ real_mult_ac @ real_add_ac));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   593
qed "hypreal_minus_mult_eq1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   594
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   595
Goal "-(x * y) = (x::hypreal) * -y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   596
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   597
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   598
by (auto_tac (claset(),simpset() addsimps [hypreal_minus,
9043
ca761fe227d8 First round of changes, towards installation of simprocs
paulson
parents: 9013
diff changeset
   599
					   hypreal_mult] 
ca761fe227d8 First round of changes, towards installation of simprocs
paulson
parents: 9013
diff changeset
   600
                                           @ real_mult_ac @ real_add_ac));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   601
qed "hypreal_minus_mult_eq2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   602
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   603
(*Pull negations out*)
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   604
Addsimps [hypreal_minus_mult_eq2 RS sym, hypreal_minus_mult_eq1 RS sym];
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   605
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   606
Goal "-x*y = (x::hypreal)*-y";
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   607
by Auto_tac;
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   608
qed "hypreal_minus_mult_commute";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   609
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   610
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   611
(*-----------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   612
    A few more theorems
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   613
 ----------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   614
Goal "(z::hypreal) + v = z' + v' ==> z + (v + w) = z' + (v' + w)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   615
by (asm_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   616
qed "hypreal_add_assoc_cong";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   617
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   618
Goal "(z::hypreal) + (v + w) = v + (z + w)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   619
by (REPEAT (ares_tac [hypreal_add_commute RS hypreal_add_assoc_cong] 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   620
qed "hypreal_add_assoc_swap";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   621
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   622
Goal "((z1::hypreal) + z2) * w = (z1 * w) + (z2 * w)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   623
by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   624
by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   625
by (res_inst_tac [("z","w")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   626
by (asm_simp_tac (simpset() addsimps [hypreal_mult,hypreal_add,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   627
     real_add_mult_distrib]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   628
qed "hypreal_add_mult_distrib";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   629
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   630
val hypreal_mult_commute'= read_instantiate [("z","w")] hypreal_mult_commute;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   631
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   632
Goal "(w::hypreal) * (z1 + z2) = (w * z1) + (w * z2)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   633
by (simp_tac (simpset() addsimps [hypreal_mult_commute',hypreal_add_mult_distrib]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   634
qed "hypreal_add_mult_distrib2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   635
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   636
val hypreal_mult_simps = [hypreal_mult_1, hypreal_mult_1_right];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   637
Addsimps hypreal_mult_simps;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   638
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   639
(*** one and zero are distinct ***)
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   640
Goalw [hypreal_zero_def,hypreal_one_def] "0 ~= 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   641
by (auto_tac (claset(),simpset() addsimps [real_zero_not_eq_one]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   642
qed "hypreal_zero_not_eq_one";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   643
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   644
(*** existence of inverse ***)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   645
Goalw [hypreal_one_def,hypreal_zero_def] 
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   646
          "x ~= 0 ==> x*hrinv(x) = 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   647
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   648
by (rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   649
by (asm_full_simp_tac (simpset() addsimps [hypreal_hrinv,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   650
    hypreal_mult] setloop (split_tac [expand_if])) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   651
by (dtac FreeUltrafilterNat_Compl_mem 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   652
by (blast_tac (claset() addSIs [real_mult_inv_right,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   653
    FreeUltrafilterNat_subset]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   654
qed "hypreal_mult_hrinv";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   655
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   656
Goal "x ~= 0 ==> hrinv(x)*x = 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   657
by (asm_simp_tac (simpset() addsimps [hypreal_mult_hrinv,
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   658
				      hypreal_mult_commute]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   659
qed "hypreal_mult_hrinv_left";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   660
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   661
Goal "x ~= 0 ==> EX y. x * y = 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   662
by (fast_tac (claset() addDs [hypreal_mult_hrinv]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   663
qed "hypreal_hrinv_ex";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   664
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   665
Goal "x ~= 0 ==> EX y. y * x = 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   666
by (fast_tac (claset() addDs [hypreal_mult_hrinv_left]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   667
qed "hypreal_hrinv_left_ex";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   668
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   669
Goal "x ~= 0 ==> EX! y. x * y = 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   670
by (auto_tac (claset() addIs [hypreal_mult_hrinv],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   671
by (dres_inst_tac [("f","%x. ya*x")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   672
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   673
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   674
qed "hypreal_hrinv_ex1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   675
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   676
Goal "x ~= 0 ==> EX! y. y * x = 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   677
by (auto_tac (claset() addIs [hypreal_mult_hrinv_left],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   678
by (dres_inst_tac [("f","%x. x*ya")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   679
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   680
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   681
qed "hypreal_hrinv_left_ex1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   682
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   683
Goal "[| y~= 0; x * y = 1hr |]  ==> x = hrinv y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   684
by (forw_inst_tac [("x","y")] hypreal_mult_hrinv_left 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   685
by (res_inst_tac [("x1","y")] (hypreal_hrinv_left_ex1 RS ex1E) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   686
by (assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   687
by (Blast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   688
qed "hypreal_mult_inv_hrinv";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   689
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   690
Goal "x ~= 0 ==> EX y. x = hrinv y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   691
by (forw_inst_tac [("x","x")] hypreal_hrinv_left_ex 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   692
by (etac exE 1 THEN 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   693
    forw_inst_tac [("x","y")] hypreal_mult_inv_hrinv 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   694
by (res_inst_tac [("x","y")] exI 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   695
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   696
qed "hypreal_as_inverse_ex";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   697
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   698
Goal "(c::hypreal) ~= 0 ==> (c*a=c*b) = (a=b)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   699
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   700
by (dres_inst_tac [("f","%x. x*hrinv c")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   701
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_hrinv] @ hypreal_mult_ac)  1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   702
qed "hypreal_mult_left_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   703
    
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   704
Goal "(c::hypreal) ~= 0 ==> (a*c=b*c) = (a=b)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   705
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   706
by (dres_inst_tac [("f","%x. x*hrinv c")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   707
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_hrinv] @ hypreal_mult_ac)  1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   708
qed "hypreal_mult_right_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   709
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   710
Goalw [hypreal_zero_def] "x ~= 0 ==> hrinv(x) ~= 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   711
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   712
by (rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   713
by (asm_full_simp_tac (simpset() addsimps [hypreal_hrinv,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   714
    hypreal_mult] setloop (split_tac [expand_if])) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   715
by (dtac FreeUltrafilterNat_Compl_mem 1 THEN Clarify_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   716
by (ultra_tac (claset() addIs [ccontr] addDs 
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
   717
    [full_rename_numerals thy rinv_not_zero],simpset()) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   718
qed "hrinv_not_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   719
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   720
Addsimps [hypreal_mult_hrinv,hypreal_mult_hrinv_left];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   721
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   722
Goal "[| x ~= 0; y ~= 0 |] ==> x * y ~= (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   723
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   724
by (dres_inst_tac [("f","%z. hrinv x*z")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   725
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   726
qed "hypreal_mult_not_0";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   727
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   728
bind_thm ("hypreal_mult_not_0E",hypreal_mult_not_0 RS notE);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   729
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   730
Goal "x ~= 0 ==> x * x ~= (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   731
by (blast_tac (claset() addDs [hypreal_mult_not_0]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   732
qed "hypreal_mult_self_not_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   733
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   734
Goal "[| x ~= 0; y ~= 0 |] ==> hrinv(x*y) = hrinv(x)*hrinv(y)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   735
by (res_inst_tac [("c1","x")] (hypreal_mult_left_cancel RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   736
by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc RS sym,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   737
    hypreal_mult_not_0]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   738
by (res_inst_tac [("c1","y")] (hypreal_mult_right_cancel RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   739
by (auto_tac (claset(),simpset() addsimps [hypreal_mult_not_0] @ hypreal_mult_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   740
by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc RS sym,hypreal_mult_not_0]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   741
qed "hrinv_mult_eq";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   742
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   743
Goal "x ~= 0 ==> hrinv(-x) = -hrinv(x)";
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   744
by (rtac (hypreal_mult_right_cancel RS iffD1) 1);
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   745
by (stac hypreal_mult_hrinv_left 2);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   746
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   747
qed "hypreal_minus_hrinv";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   748
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   749
Goal "[| x ~= 0; y ~= 0 |] \
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   750
\     ==> hrinv(x*y) = hrinv(x)*hrinv(y)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   751
by (forw_inst_tac [("y","y")] hypreal_mult_not_0 1 THEN assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   752
by (res_inst_tac [("c1","x")] (hypreal_mult_left_cancel RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   753
by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc RS sym]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   754
by (res_inst_tac [("c1","y")] (hypreal_mult_left_cancel RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   755
by (auto_tac (claset(),simpset() addsimps [hypreal_mult_left_commute]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   756
by (asm_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   757
qed "hypreal_hrinv_distrib";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   758
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   759
(*------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   760
                   Theorems for ordering 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   761
 ------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   762
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   763
(* prove introduction and elimination rules for hypreal_less *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   764
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   765
Goalw [hypreal_less_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   766
 "P < (Q::hypreal) = (EX X Y. X : Rep_hypreal(P) & \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   767
\                             Y : Rep_hypreal(Q) & \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   768
\                             {n. X n < Y n} : FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   769
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   770
qed "hypreal_less_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   771
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   772
Goalw [hypreal_less_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   773
 "[| {n. X n < Y n} : FreeUltrafilterNat; \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   774
\         X : Rep_hypreal(P); \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   775
\         Y : Rep_hypreal(Q) |] ==> P < (Q::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   776
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   777
qed "hypreal_lessI";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   778
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   779
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   780
Goalw [hypreal_less_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   781
     "!! R1. [| R1 < (R2::hypreal); \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   782
\         !!X Y. {n. X n < Y n} : FreeUltrafilterNat ==> P; \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   783
\         !!X. X : Rep_hypreal(R1) ==> P; \ 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   784
\         !!Y. Y : Rep_hypreal(R2) ==> P |] \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   785
\     ==> P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   786
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   787
qed "hypreal_lessE";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   788
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   789
Goalw [hypreal_less_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   790
 "R1 < (R2::hypreal) ==> (EX X Y. {n. X n < Y n} : FreeUltrafilterNat & \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   791
\                                  X : Rep_hypreal(R1) & \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   792
\                                  Y : Rep_hypreal(R2))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   793
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   794
qed "hypreal_lessD";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   795
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   796
Goal "~ (R::hypreal) < R";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   797
by (res_inst_tac [("z","R")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   798
by (auto_tac (claset(),simpset() addsimps [hypreal_less_def]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   799
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   800
qed "hypreal_less_not_refl";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   801
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   802
(*** y < y ==> P ***)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   803
bind_thm("hypreal_less_irrefl",hypreal_less_not_refl RS notE);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   804
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   805
Goal "!!(x::hypreal). x < y ==> x ~= y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   806
by (auto_tac (claset(),simpset() addsimps [hypreal_less_not_refl]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   807
qed "hypreal_not_refl2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   808
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   809
Goal "!!(R1::hypreal). [| R1 < R2; R2 < R3 |] ==> R1 < R3";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   810
by (res_inst_tac [("z","R1")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   811
by (res_inst_tac [("z","R2")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   812
by (res_inst_tac [("z","R3")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   813
by (auto_tac (claset() addSIs [exI],simpset() 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   814
     addsimps [hypreal_less_def]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   815
by (ultra_tac (claset() addIs [real_less_trans],simpset()) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   816
qed "hypreal_less_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   817
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   818
Goal "!! (R1::hypreal). [| R1 < R2; R2 < R1 |] ==> P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   819
by (dtac hypreal_less_trans 1 THEN assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   820
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   821
    [hypreal_less_not_refl]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   822
qed "hypreal_less_asym";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   823
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   824
(*--------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   825
  TODO: The following theorem should have been proved 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   826
  first and then used througout the proofs as it probably 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   827
  makes many of them more straightforward. 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   828
 -------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   829
Goalw [hypreal_less_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   830
      "(Abs_hypreal(hyprel^^{%n. X n}) < \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   831
\           Abs_hypreal(hyprel^^{%n. Y n})) = \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   832
\      ({n. X n < Y n} : FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   833
by (auto_tac (claset() addSIs [lemma_hyprel_refl],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   834
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   835
qed "hypreal_less";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   836
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   837
(*---------------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   838
             Hyperreals as a linearly ordered field
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   839
 ---------------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   840
(*** sum order ***)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   841
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   842
Goalw [hypreal_zero_def] 
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   843
      "[| 0 < x; 0 < y |] ==> (0::hypreal) < x + y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   844
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   845
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   846
by (auto_tac (claset(),simpset() addsimps
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   847
    [hypreal_less_def,hypreal_add]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   848
by (auto_tac (claset() addSIs [exI],simpset() addsimps
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   849
    [hypreal_less_def,hypreal_add]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   850
by (ultra_tac (claset() addIs [real_add_order],simpset()) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   851
qed "hypreal_add_order";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   852
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   853
(*** mult order ***)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   854
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   855
Goalw [hypreal_zero_def] 
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   856
          "[| 0 < x; 0 < y |] ==> (0::hypreal) < x * y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   857
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   858
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   859
by (auto_tac (claset() addSIs [exI],simpset() addsimps
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   860
    [hypreal_less_def,hypreal_mult]));
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
   861
by (ultra_tac (claset() addIs [rename_numerals thy 
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
   862
    real_mult_order],simpset()) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   863
qed "hypreal_mult_order";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   864
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   865
(*---------------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   866
                         Trichotomy of the hyperreals
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   867
  --------------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   868
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   869
Goalw [hyprel_def] "EX x. x: hyprel ^^ {%n. #0}";
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
   870
by (res_inst_tac [("x","%n. #0")] exI 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   871
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   872
by (auto_tac (claset() addSIs [FreeUltrafilterNat_Nat_set],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   873
qed "lemma_hyprel_0r_mem";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   874
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   875
Goalw [hypreal_zero_def]"0 <  x | x = 0 | x < (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   876
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   877
by (auto_tac (claset(),simpset() addsimps [hypreal_less_def]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   878
by (cut_facts_tac [lemma_hyprel_0r_mem] 1 THEN etac exE 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   879
by (dres_inst_tac [("x","xa")] spec 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   880
by (dres_inst_tac [("x","x")] spec 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   881
by (cut_inst_tac [("x","x")] lemma_hyprel_refl 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   882
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   883
by (dres_inst_tac [("x","x")] spec 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   884
by (dres_inst_tac [("x","xa")] spec 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   885
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   886
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   887
by (auto_tac (claset() addIs [real_linear_less2],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   888
qed "hypreal_trichotomy";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   889
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   890
val prems = Goal "[| (0::hypreal) < x ==> P; \
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   891
\                 x = 0 ==> P; \
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   892
\                 x < 0 ==> P |] ==> P";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   893
by (cut_inst_tac [("x","x")] hypreal_trichotomy 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   894
by (REPEAT (eresolve_tac (disjE::prems) 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   895
qed "hypreal_trichotomyE";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   896
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   897
(*----------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   898
            More properties of <
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   899
 ----------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   900
Goal "!!(A::hypreal). A < B ==> A + C < B + C";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   901
by (res_inst_tac [("z","A")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   902
by (res_inst_tac [("z","B")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   903
by (res_inst_tac [("z","C")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   904
by (auto_tac (claset() addSIs [exI],simpset() addsimps
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   905
    [hypreal_less_def,hypreal_add]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   906
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   907
qed "hypreal_add_less_mono1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   908
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   909
Goal "!!(A::hypreal). A < B ==> C + A < C + B";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   910
by (auto_tac (claset() addIs [hypreal_add_less_mono1],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   911
    simpset() addsimps [hypreal_add_commute]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   912
qed "hypreal_add_less_mono2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   913
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   914
Goal "((x::hypreal) < y) = (0 < y + -x)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   915
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   916
by (dres_inst_tac [("C","-x")] hypreal_add_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   917
by (dres_inst_tac [("C","x")] hypreal_add_less_mono1 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   918
by (auto_tac (claset(),simpset() addsimps [hypreal_add_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   919
qed "hypreal_less_minus_iff"; 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   920
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   921
Goal "((x::hypreal) < y) = (x + -y< 0)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   922
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   923
by (dres_inst_tac [("C","-y")] hypreal_add_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   924
by (dres_inst_tac [("C","y")] hypreal_add_less_mono1 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   925
by (auto_tac (claset(),simpset() addsimps [hypreal_add_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   926
qed "hypreal_less_minus_iff2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   927
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   928
Goal  "!!(y1 :: hypreal). [| z1 < y1; z2 < y2 |] ==> z1 + z2 < y1 + y2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   929
by (dtac (hypreal_less_minus_iff RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   930
by (dtac (hypreal_less_minus_iff RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   931
by (dtac hypreal_add_order 1 THEN assume_tac 1);
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   932
by (thin_tac "0 < y2 + - z2" 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   933
by (dres_inst_tac [("C","z1 + z2")] hypreal_add_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   934
by (auto_tac (claset(),simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   935
    [hypreal_minus_add_distrib RS sym] @ hypreal_add_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   936
qed "hypreal_add_less_mono";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   937
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   938
Goal "((x::hypreal) = y) = (0 = x + - y)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   939
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   940
by (res_inst_tac [("x1","-y")] (hypreal_add_right_cancel RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   941
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   942
qed "hypreal_eq_minus_iff"; 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   943
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   944
Goal "((x::hypreal) = y) = (0 = y + - x)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   945
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   946
by (res_inst_tac [("x1","-x")] (hypreal_add_right_cancel RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   947
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   948
qed "hypreal_eq_minus_iff2"; 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   949
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   950
Goal "(x = y + z) = (x + -z = (y::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   951
by (auto_tac (claset(),simpset() addsimps [hypreal_add_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   952
qed "hypreal_eq_minus_iff3";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   953
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   954
Goal "(x = z + y) = (x + -z = (y::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   955
by (auto_tac (claset(),simpset() addsimps hypreal_add_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   956
qed "hypreal_eq_minus_iff4";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   957
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   958
Goal "(x ~= a) = (x + -a ~= (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   959
by (auto_tac (claset() addDs [sym RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   960
    (hypreal_eq_minus_iff RS iffD2)],simpset())); 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   961
qed "hypreal_not_eq_minus_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   962
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   963
(*** linearity ***)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   964
Goal "(x::hypreal) < y | x = y | y < x";
7322
d16d7ddcc842 isatool expandshort;
wenzelm
parents: 7218
diff changeset
   965
by (stac hypreal_eq_minus_iff2 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   966
by (res_inst_tac [("x1","x")] (hypreal_less_minus_iff RS ssubst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   967
by (res_inst_tac [("x1","y")] (hypreal_less_minus_iff2 RS ssubst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   968
by (rtac hypreal_trichotomyE 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   969
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   970
qed "hypreal_linear";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   971
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   972
Goal "!!(x::hypreal). [| x < y ==> P;  x = y ==> P; \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   973
\          y < x ==> P |] ==> P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   974
by (cut_inst_tac [("x","x"),("y","y")] hypreal_linear 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   975
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   976
qed "hypreal_linear_less2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   977
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   978
(*------------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   979
                            Properties of <=
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   980
 ------------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   981
(*------ hypreal le iff reals le a.e ------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   982
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   983
Goalw [hypreal_le_def,real_le_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   984
      "(Abs_hypreal(hyprel^^{%n. X n}) <= \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   985
\           Abs_hypreal(hyprel^^{%n. Y n})) = \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   986
\      ({n. X n <= Y n} : FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   987
by (auto_tac (claset(),simpset() addsimps [hypreal_less]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   988
by (ALLGOALS(Ultra_tac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   989
qed "hypreal_le";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   990
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   991
(*---------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   992
(*---------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   993
Goalw [hypreal_le_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   994
     "~(w < z) ==> z <= (w::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   995
by (assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   996
qed "hypreal_leI";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   997
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   998
Goalw [hypreal_le_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   999
      "z<=w ==> ~(w<(z::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1000
by (assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1001
qed "hypreal_leD";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1002
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1003
val hypreal_leE = make_elim hypreal_leD;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1004
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1005
Goal "(~(w < z)) = (z <= (w::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1006
by (fast_tac (claset() addSIs [hypreal_leI,hypreal_leD]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1007
qed "hypreal_less_le_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1008
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1009
Goalw [hypreal_le_def] "~ z <= w ==> w<(z::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1010
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1011
qed "not_hypreal_leE";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1012
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1013
Goalw [hypreal_le_def] "z < w ==> z <= (w::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1014
by (fast_tac (claset() addEs [hypreal_less_asym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1015
qed "hypreal_less_imp_le";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1016
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1017
Goalw [hypreal_le_def] "!!(x::hypreal). x <= y ==> x < y | x = y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1018
by (cut_facts_tac [hypreal_linear] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1019
by (fast_tac (claset() addEs [hypreal_less_irrefl,hypreal_less_asym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1020
qed "hypreal_le_imp_less_or_eq";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1021
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1022
Goalw [hypreal_le_def] "z<w | z=w ==> z <=(w::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1023
by (cut_facts_tac [hypreal_linear] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1024
by (fast_tac (claset() addEs [hypreal_less_irrefl,hypreal_less_asym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1025
qed "hypreal_less_or_eq_imp_le";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1026
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1027
Goal "(x <= (y::hypreal)) = (x < y | x=y)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1028
by (REPEAT(ares_tac [iffI, hypreal_less_or_eq_imp_le, hypreal_le_imp_less_or_eq] 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1029
qed "hypreal_le_eq_less_or_eq";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1030
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1031
Goal "w <= (w::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1032
by (simp_tac (simpset() addsimps [hypreal_le_eq_less_or_eq]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1033
qed "hypreal_le_refl";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1034
Addsimps [hypreal_le_refl];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1035
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1036
Goal "[| i <= j; j < k |] ==> i < (k::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1037
by (dtac hypreal_le_imp_less_or_eq 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1038
by (fast_tac (claset() addIs [hypreal_less_trans]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1039
qed "hypreal_le_less_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1040
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1041
Goal "!! (i::hypreal). [| i < j; j <= k |] ==> i < k";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1042
by (dtac hypreal_le_imp_less_or_eq 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1043
by (fast_tac (claset() addIs [hypreal_less_trans]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1044
qed "hypreal_less_le_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1045
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1046
Goal "[| i <= j; j <= k |] ==> i <= (k::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1047
by (EVERY1 [dtac hypreal_le_imp_less_or_eq, dtac hypreal_le_imp_less_or_eq,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1048
            rtac hypreal_less_or_eq_imp_le, fast_tac (claset() addIs [hypreal_less_trans])]);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1049
qed "hypreal_le_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1050
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1051
Goal "[| z <= w; w <= z |] ==> z = (w::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1052
by (EVERY1 [dtac hypreal_le_imp_less_or_eq, dtac hypreal_le_imp_less_or_eq,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1053
            fast_tac (claset() addEs [hypreal_less_irrefl,hypreal_less_asym])]);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1054
qed "hypreal_le_anti_sym";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1055
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1056
Goal "[| 0 < x; 0 <= y |] ==> (0::hypreal) < x + y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1057
by (auto_tac (claset() addDs [sym,hypreal_le_imp_less_or_eq]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1058
              addIs [hypreal_add_order],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1059
qed "hypreal_add_order_le";            
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1060
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1061
(*------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1062
 ------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1063
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1064
Goal "[| ~ y < x; y ~= x |] ==> x < (y::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1065
by (rtac not_hypreal_leE 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1066
by (fast_tac (claset() addDs [hypreal_le_imp_less_or_eq]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1067
qed "not_less_not_eq_hypreal_less";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1068
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1069
Goal "(0 < -R) = (R < (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1070
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1071
by (dres_inst_tac [("C","R")] hypreal_add_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1072
by (dres_inst_tac [("C","-R")] hypreal_add_less_mono1 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1073
by (auto_tac (claset(),simpset() addsimps [hypreal_add_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1074
qed "hypreal_minus_zero_less_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1075
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1076
Goal "(-R < 0) = ((0::hypreal) < R)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1077
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1078
by (dres_inst_tac [("C","R")] hypreal_add_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1079
by (dres_inst_tac [("C","-R")] hypreal_add_less_mono1 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1080
by (auto_tac (claset(),simpset() addsimps [hypreal_add_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1081
qed "hypreal_minus_zero_less_iff2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1082
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1083
Goal "((x::hypreal) < y) = (-y < -x)";
7322
d16d7ddcc842 isatool expandshort;
wenzelm
parents: 7218
diff changeset
  1084
by (stac hypreal_less_minus_iff 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1085
by (res_inst_tac [("x1","x")] (hypreal_less_minus_iff RS ssubst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1086
by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1087
qed "hypreal_less_swap_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1088
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1089
Goal "((0::hypreal) < x) = (-x < x)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1090
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1091
by (rtac ccontr 2 THEN forward_tac 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1092
    [hypreal_leI RS hypreal_le_imp_less_or_eq] 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1093
by (Step_tac 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1094
by (dtac (hypreal_minus_zero_less_iff RS iffD2) 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1095
by (dres_inst_tac [("R2.0","-x")] hypreal_less_trans 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1096
by (Auto_tac );
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 7322
diff changeset
  1097
by (ftac hypreal_add_order 1 THEN assume_tac 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1098
by (dres_inst_tac [("C","-x"),("B","x + x")] hypreal_add_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1099
by (auto_tac (claset(),simpset() addsimps [hypreal_add_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1100
qed "hypreal_gt_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1101
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1102
Goal "(x < (0::hypreal)) = (x < -x)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1103
by (rtac (hypreal_minus_zero_less_iff RS subst) 1);
7322
d16d7ddcc842 isatool expandshort;
wenzelm
parents: 7218
diff changeset
  1104
by (stac hypreal_gt_zero_iff 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1105
by (Full_simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1106
qed "hypreal_lt_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1107
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1108
Goalw [hypreal_le_def] "((0::hypreal) <= x) = (-x <= x)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1109
by (auto_tac (claset(),simpset() addsimps [hypreal_lt_zero_iff RS sym]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1110
qed "hypreal_ge_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1111
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1112
Goalw [hypreal_le_def] "(x <= (0::hypreal)) = (x <= -x)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1113
by (auto_tac (claset(),simpset() addsimps [hypreal_gt_zero_iff RS sym]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1114
qed "hypreal_le_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1115
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1116
Goal "[| x < 0; y < 0 |] ==> (0::hypreal) < x * y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1117
by (REPEAT(dtac (hypreal_minus_zero_less_iff RS iffD2) 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1118
by (dtac hypreal_mult_order 1 THEN assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1119
by (Asm_full_simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1120
qed "hypreal_mult_less_zero1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1121
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1122
Goal "[| 0 <= x; 0 <= y |] ==> (0::hypreal) <= x * y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1123
by (REPEAT(dtac hypreal_le_imp_less_or_eq 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1124
by (auto_tac (claset() addIs [hypreal_mult_order,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1125
    hypreal_less_imp_le],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1126
qed "hypreal_le_mult_order";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1127
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1128
Goal "[| x <= 0; y <= 0 |] ==> (0::hypreal) <= x * y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1129
by (rtac hypreal_less_or_eq_imp_le 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1130
by (dtac hypreal_le_imp_less_or_eq 1 THEN etac disjE 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1131
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1132
by (dtac hypreal_le_imp_less_or_eq 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1133
by (auto_tac (claset() addDs [hypreal_mult_less_zero1],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1134
qed "real_mult_le_zero1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1135
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1136
Goal "[| 0 <= x; y < 0 |] ==> x * y <= (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1137
by (rtac hypreal_less_or_eq_imp_le 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1138
by (dtac hypreal_le_imp_less_or_eq 1 THEN etac disjE 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1139
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1140
by (dtac (hypreal_minus_zero_less_iff RS iffD2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1141
by (rtac (hypreal_minus_zero_less_iff RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1142
by (blast_tac (claset() addDs [hypreal_mult_order] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1143
    addIs [hypreal_minus_mult_eq2 RS ssubst]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1144
qed "hypreal_mult_le_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1145
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1146
Goal "[| 0 < x; y < 0 |] ==> x*y < (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1147
by (dtac (hypreal_minus_zero_less_iff RS iffD2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1148
by (dtac hypreal_mult_order 1 THEN assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1149
by (rtac (hypreal_minus_zero_less_iff RS iffD1) 1);
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1150
by (Asm_full_simp_tac 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1151
qed "hypreal_mult_less_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1152
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1153
Goalw [hypreal_one_def,hypreal_zero_def,hypreal_less_def] "0 < 1hr";
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1154
by (res_inst_tac [("x","%n. #0")] exI 1);
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1155
by (res_inst_tac [("x","%n. #1")] exI 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1156
by (auto_tac (claset(),simpset() addsimps [real_zero_less_one,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1157
    FreeUltrafilterNat_Nat_set]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1158
qed "hypreal_zero_less_one";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1159
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1160
Goal "[| 0 <= x; 0 <= y |] ==> (0::hypreal) <= x + y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1161
by (REPEAT(dtac hypreal_le_imp_less_or_eq 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1162
by (auto_tac (claset() addIs [hypreal_add_order,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1163
    hypreal_less_imp_le],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1164
qed "hypreal_le_add_order";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1165
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1166
Goal "!!(q1::hypreal). q1 <= q2  ==> x + q1 <= x + q2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1167
by (dtac hypreal_le_imp_less_or_eq 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1168
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1169
by (auto_tac (claset() addSIs [hypreal_le_refl,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1170
    hypreal_less_imp_le,hypreal_add_less_mono1],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1171
    simpset() addsimps [hypreal_add_commute]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1172
qed "hypreal_add_left_le_mono1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1173
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1174
Goal "!!(q1::hypreal). q1 <= q2  ==> q1 + x <= q2 + x";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1175
by (auto_tac (claset() addDs [hypreal_add_left_le_mono1],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1176
    simpset() addsimps [hypreal_add_commute]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1177
qed "hypreal_add_le_mono1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1178
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1179
Goal "!!k l::hypreal. [|i<=j;  k<=l |] ==> i + k <= j + l";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1180
by (etac (hypreal_add_le_mono1 RS hypreal_le_trans) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1181
by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1182
(*j moves to the end because it is free while k, l are bound*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1183
by (etac hypreal_add_le_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1184
qed "hypreal_add_le_mono";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1185
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1186
Goal "!!k l::hypreal. [|i<j;  k<=l |] ==> i + k < j + l";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1187
by (auto_tac (claset() addSDs [hypreal_le_imp_less_or_eq] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1188
    addIs [hypreal_add_less_mono1,hypreal_add_less_mono],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1189
qed "hypreal_add_less_le_mono";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1190
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1191
Goal "!!k l::hypreal. [|i<=j;  k<l |] ==> i + k < j + l";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1192
by (auto_tac (claset() addSDs [hypreal_le_imp_less_or_eq] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1193
    addIs [hypreal_add_less_mono2,hypreal_add_less_mono],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1194
qed "hypreal_add_le_less_mono";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1195
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1196
Goal "(0*x<r)=((0::hypreal)<r)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1197
by (Simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1198
qed "hypreal_mult_0_less";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1199
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1200
Goal "[| (0::hypreal) < z; x < y |] ==> x*z < y*z";       
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1201
by (rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1202
by (dtac (hypreal_less_minus_iff RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1203
by (rtac (hypreal_less_minus_iff RS iffD2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1204
by (dtac hypreal_mult_order 1 THEN assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1205
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_mult_distrib2,
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1206
					   hypreal_mult_commute ]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1207
qed "hypreal_mult_less_mono1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1208
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1209
Goal "[| (0::hypreal)<z; x<y |] ==> z*x<z*y";       
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1210
by (asm_simp_tac (simpset() addsimps [hypreal_mult_commute,hypreal_mult_less_mono1]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1211
qed "hypreal_mult_less_mono2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1212
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1213
Goal "[| (0::hypreal)<=z; x<y |] ==> x*z<=y*z";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1214
by (EVERY1 [rtac hypreal_less_or_eq_imp_le, dtac hypreal_le_imp_less_or_eq]);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1215
by (auto_tac (claset() addIs [hypreal_mult_less_mono1],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1216
qed "hypreal_mult_le_less_mono1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1217
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1218
Goal "[| (0::hypreal)<=z; x<y |] ==> z*x<=z*y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1219
by (asm_simp_tac (simpset() addsimps [hypreal_mult_commute,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1220
				      hypreal_mult_le_less_mono1]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1221
qed "hypreal_mult_le_less_mono2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1222
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1223
Goal "[| (0::hypreal)<=z; x<=y |] ==> z*x<=z*y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1224
by (dres_inst_tac [("x","x")] hypreal_le_imp_less_or_eq 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1225
by (auto_tac (claset() addIs [hypreal_mult_le_less_mono2,hypreal_le_refl],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1226
qed "hypreal_mult_le_le_mono1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1227
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1228
val prem1::prem2::prem3::rest = goal thy
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1229
     "[| (0::hypreal)<y; x<r; y*r<t*s |] ==> y*x<t*s";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1230
by (rtac ([([prem1,prem2] MRS hypreal_mult_less_mono2),prem3] MRS hypreal_less_trans) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1231
qed "hypreal_mult_less_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1232
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1233
Goal "[| 0<=y; x<r; y*r<t*s; (0::hypreal)<t*s|] ==> y*x<t*s";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1234
by (dtac hypreal_le_imp_less_or_eq 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1235
by (fast_tac (HOL_cs addEs [(hypreal_mult_0_less RS iffD2),hypreal_mult_less_trans]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1236
qed "hypreal_mult_le_less_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1237
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1238
Goal "[| 0 <= y; x <= r; y*r < t*s; (0::hypreal) < t*s|] ==> y*x < t*s";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1239
by (dres_inst_tac [("x","x")] hypreal_le_imp_less_or_eq 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1240
by (fast_tac (claset() addIs [hypreal_mult_le_less_trans]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1241
qed "hypreal_mult_le_le_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1242
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1243
Goal "[| 0 < r1; r1 <r2; (0::hypreal) < x; x < y|] \
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1244
\                     ==> r1 * x < r2 * y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1245
by (dres_inst_tac [("x","x")] hypreal_mult_less_mono2 1);
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1246
by (dres_inst_tac [("R1.0","0")] hypreal_less_trans 2);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1247
by (dres_inst_tac [("x","r1")] hypreal_mult_less_mono1 3);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1248
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1249
by (blast_tac (claset() addIs [hypreal_less_trans]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1250
qed "hypreal_mult_less_mono";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1251
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1252
Goal "[| 0 < r1; r1 <r2; 0 < y|] \
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1253
\                           ==> (0::hypreal) < r2 * y";
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1254
by (dres_inst_tac [("R1.0","0")] hypreal_less_trans 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1255
by (assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1256
by (blast_tac (claset() addIs [hypreal_mult_order]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1257
qed "hypreal_mult_order_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1258
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1259
Goal "[| 0 < r1; r1 <= r2; (0::hypreal) <= x; x <= y |] \
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1260
\                  ==> r1 * x <= r2 * y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1261
by (rtac hypreal_less_or_eq_imp_le 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1262
by (REPEAT(dtac hypreal_le_imp_less_or_eq 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1263
by (auto_tac (claset() addIs [hypreal_mult_less_mono,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1264
    hypreal_mult_less_mono1,hypreal_mult_less_mono2,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1265
    hypreal_mult_order_trans,hypreal_mult_order],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1266
qed "hypreal_mult_le_mono";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1267
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1268
(*----------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1269
  hypreal_of_real preserves field and order properties
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1270
 -----------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1271
Goalw [hypreal_of_real_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1272
      "hypreal_of_real ((z1::real) + z2) = \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1273
\      hypreal_of_real z1 + hypreal_of_real z2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1274
by (asm_simp_tac (simpset() addsimps [hypreal_add,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1275
       hypreal_add_mult_distrib]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1276
qed "hypreal_of_real_add";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1277
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1278
Goalw [hypreal_of_real_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1279
            "hypreal_of_real ((z1::real) * z2) = hypreal_of_real z1 * hypreal_of_real z2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1280
by (full_simp_tac (simpset() addsimps [hypreal_mult,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1281
        hypreal_add_mult_distrib2]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1282
qed "hypreal_of_real_mult";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1283
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1284
Goalw [hypreal_less_def,hypreal_of_real_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1285
            "(z1 < z2) = (hypreal_of_real z1 <  hypreal_of_real z2)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1286
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1287
by (res_inst_tac [("x","%n. z1")] exI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1288
by (Step_tac 1); 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1289
by (res_inst_tac [("x","%n. z2")] exI 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1290
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1291
by (rtac FreeUltrafilterNat_P 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1292
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1293
qed "hypreal_of_real_less_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1294
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1295
Addsimps [hypreal_of_real_less_iff RS sym];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1296
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1297
Goalw [hypreal_le_def,real_le_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1298
            "(z1 <= z2) = (hypreal_of_real z1 <=  hypreal_of_real z2)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1299
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1300
qed "hypreal_of_real_le_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1301
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1302
Goalw [hypreal_of_real_def] "hypreal_of_real (-r) = - hypreal_of_real  r";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1303
by (auto_tac (claset(),simpset() addsimps [hypreal_minus]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1304
qed "hypreal_of_real_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1305
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1306
Goal "0 < x ==> 0 < hrinv x";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1307
by (EVERY1[rtac ccontr, dtac hypreal_leI]);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1308
by (forward_tac [hypreal_minus_zero_less_iff2 RS iffD2] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1309
by (forward_tac [hypreal_not_refl2 RS not_sym] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1310
by (dtac (hypreal_not_refl2 RS not_sym RS hrinv_not_zero) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1311
by (EVERY1[dtac hypreal_le_imp_less_or_eq, Step_tac]); 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1312
by (dtac hypreal_mult_less_zero1 1 THEN assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1313
by (auto_tac (claset() addIs [hypreal_zero_less_one RS hypreal_less_asym],
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1314
    simpset() addsimps [hypreal_minus_zero_less_iff]));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1315
qed "hypreal_hrinv_gt_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1316
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1317
Goal "x < 0 ==> hrinv x < 0";
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 7322
diff changeset
  1318
by (ftac hypreal_not_refl2 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1319
by (dtac (hypreal_minus_zero_less_iff RS iffD2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1320
by (rtac (hypreal_minus_zero_less_iff RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1321
by (dtac (hypreal_minus_hrinv RS sym) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1322
by (auto_tac (claset() addIs [hypreal_hrinv_gt_zero],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1323
    simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1324
qed "hypreal_hrinv_less_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1325
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1326
Goalw [hypreal_of_real_def,hypreal_one_def] "hypreal_of_real  #1 = 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1327
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1328
qed "hypreal_of_real_one";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1329
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1330
Goalw [hypreal_of_real_def,hypreal_zero_def] "hypreal_of_real  #0 = 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1331
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1332
qed "hypreal_of_real_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1333
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1334
Goal "(hypreal_of_real  r = 0) = (r = #0)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1335
by (auto_tac (claset() addIs [FreeUltrafilterNat_P],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1336
    simpset() addsimps [hypreal_of_real_def,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1337
    hypreal_zero_def,FreeUltrafilterNat_Nat_set]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1338
qed "hypreal_of_real_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1339
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1340
Goal "(hypreal_of_real  r ~= 0) = (r ~= #0)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1341
by (full_simp_tac (simpset() addsimps [hypreal_of_real_zero_iff]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1342
qed "hypreal_of_real_not_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1343
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1344
Goal "r ~= #0 ==> hrinv (hypreal_of_real r) = \
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1345
\          hypreal_of_real (rinv r)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1346
by (res_inst_tac [("c1","hypreal_of_real r")] (hypreal_mult_left_cancel RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1347
by (etac (hypreal_of_real_not_zero_iff RS iffD2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1348
by (forward_tac [hypreal_of_real_not_zero_iff RS iffD2] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1349
by (auto_tac (claset(),simpset() addsimps [hypreal_of_real_mult RS sym,hypreal_of_real_one]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1350
qed "hypreal_of_real_hrinv";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1351
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1352
Goal "hypreal_of_real r ~= 0 ==> hrinv (hypreal_of_real r) = \
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1353
\          hypreal_of_real (rinv r)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1354
by (etac (hypreal_of_real_not_zero_iff RS iffD1 RS hypreal_of_real_hrinv) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1355
qed "hypreal_of_real_hrinv2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1356
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1357
Goal "x+x=x*(1hr+1hr)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1358
by (simp_tac (simpset() addsimps [hypreal_add_mult_distrib2]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1359
qed "hypreal_add_self";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1360
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1361
Goal "1hr < 1hr + 1hr";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1362
by (rtac (hypreal_less_minus_iff RS iffD2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1363
by (full_simp_tac (simpset() addsimps [hypreal_zero_less_one,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1364
    hypreal_add_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1365
qed "hypreal_one_less_two";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1366
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1367
Goal "0 < 1hr + 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1368
by (rtac ([hypreal_zero_less_one,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1369
          hypreal_one_less_two] MRS hypreal_less_trans) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1370
qed "hypreal_zero_less_two";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1371
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1372
Goal "1hr + 1hr ~= 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1373
by (rtac (hypreal_zero_less_two RS hypreal_not_refl2 RS not_sym) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1374
qed "hypreal_two_not_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1375
Addsimps [hypreal_two_not_zero];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1376
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1377
Goal "x*hrinv(1hr + 1hr) + x*hrinv(1hr + 1hr) = x";
7322
d16d7ddcc842 isatool expandshort;
wenzelm
parents: 7218
diff changeset
  1378
by (stac hypreal_add_self 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1379
by (full_simp_tac (simpset() addsimps [hypreal_mult_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1380
qed "hypreal_sum_of_halves";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1381
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1382
Goal "z ~= 0 ==> x*y = (x*hrinv(z))*(z*y)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1383
by (asm_simp_tac (simpset() addsimps hypreal_mult_ac)  1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1384
qed "lemma_chain";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1385
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1386
Goal "0 < r ==> 0 < r*hrinv(1hr+1hr)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1387
by (dtac (hypreal_zero_less_two RS hypreal_hrinv_gt_zero 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1388
          RS hypreal_mult_less_mono1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1389
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1390
qed "hypreal_half_gt_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1391
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1392
(* TODO: remove redundant  0 < x *)
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1393
Goal "[| 0 < r; 0 < x; r < x |] ==> hrinv x < hrinv r";
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 7322
diff changeset
  1394
by (ftac hypreal_hrinv_gt_zero 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1395
by (forw_inst_tac [("x","x")] hypreal_hrinv_gt_zero 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1396
by (forw_inst_tac [("x","r"),("z","hrinv r")] hypreal_mult_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1397
by (assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1398
by (asm_full_simp_tac (simpset() addsimps [hypreal_not_refl2 RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1399
         not_sym RS hypreal_mult_hrinv]) 1);
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 7322
diff changeset
  1400
by (ftac hypreal_hrinv_gt_zero 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1401
by (forw_inst_tac [("x","1hr"),("z","hrinv x")] hypreal_mult_less_mono2 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1402
by (assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1403
by (asm_full_simp_tac (simpset() addsimps [hypreal_not_refl2 RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1404
         not_sym RS hypreal_mult_hrinv_left,hypreal_mult_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1405
qed "hypreal_hrinv_less_swap";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1406
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1407
Goal "[| 0 < r; 0 < x|] ==> (r < x) = (hrinv x < hrinv r)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1408
by (auto_tac (claset() addIs [hypreal_hrinv_less_swap],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1409
by (res_inst_tac [("t","r")] (hypreal_hrinv_hrinv RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1410
by (etac (hypreal_not_refl2 RS not_sym) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1411
by (res_inst_tac [("t","x")] (hypreal_hrinv_hrinv RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1412
by (etac (hypreal_not_refl2 RS not_sym) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1413
by (auto_tac (claset() addIs [hypreal_hrinv_less_swap],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1414
    simpset() addsimps [hypreal_hrinv_gt_zero]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1415
qed "hypreal_hrinv_less_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1416
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1417
Goal "[| 0 < z; x < y |] ==> x*hrinv(z) < y*hrinv(z)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1418
by (blast_tac (claset() addSIs [hypreal_mult_less_mono1,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1419
    hypreal_hrinv_gt_zero]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1420
qed "hypreal_mult_hrinv_less_mono1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1421
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1422
Goal "[| 0 < z; x < y |] ==> hrinv(z)*x < hrinv(z)*y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1423
by (blast_tac (claset() addSIs [hypreal_mult_less_mono2,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1424
    hypreal_hrinv_gt_zero]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1425
qed "hypreal_mult_hrinv_less_mono2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1426
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1427
Goal "[| (0::hypreal) < z; x*z < y*z |] ==> x < y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1428
by (forw_inst_tac [("x","x*z")] hypreal_mult_hrinv_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1429
by (dtac (hypreal_not_refl2 RS not_sym) 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1430
by (auto_tac (claset() addSDs [hypreal_mult_hrinv],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1431
              simpset() addsimps hypreal_mult_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1432
qed "hypreal_less_mult_right_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1433
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1434
Goal "[| (0::hypreal) < z; z*x < z*y |] ==> x < y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1435
by (auto_tac (claset() addIs [hypreal_less_mult_right_cancel],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1436
    simpset() addsimps [hypreal_mult_commute]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1437
qed "hypreal_less_mult_left_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1438
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1439
Goal "[| 0 < r; (0::hypreal) < ra; \
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1440
\                 r < x; ra < y |] \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1441
\              ==> r*ra < x*y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1442
by (forw_inst_tac [("R2.0","r")] hypreal_less_trans 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1443
by (dres_inst_tac [("z","ra"),("x","r")] hypreal_mult_less_mono1 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1444
by (dres_inst_tac [("z","x"),("x","ra")] hypreal_mult_less_mono2 3);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1445
by (auto_tac (claset() addIs [hypreal_less_trans],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1446
qed "hypreal_mult_less_gt_zero"; 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1447
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1448
Goal "[| 0 < r; (0::hypreal) < ra; \
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1449
\                 r <= x; ra <= y |] \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1450
\              ==> r*ra <= x*y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1451
by (REPEAT(dtac hypreal_le_imp_less_or_eq 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1452
by (rtac hypreal_less_or_eq_imp_le 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1453
by (auto_tac (claset() addIs [hypreal_mult_less_mono1,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1454
    hypreal_mult_less_mono2,hypreal_mult_less_gt_zero],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1455
    simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1456
qed "hypreal_mult_le_ge_zero"; 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1457
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1458
Goal "EX (x::hypreal). x < y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1459
by (rtac (hypreal_add_zero_right RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1460
by (res_inst_tac [("x","y + -1hr")] exI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1461
by (auto_tac (claset() addSIs [hypreal_add_less_mono2],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1462
    simpset() addsimps [hypreal_minus_zero_less_iff2,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1463
    hypreal_zero_less_one] delsimps [hypreal_add_zero_right]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1464
qed "hypreal_less_Ex";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1465
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1466
Goal "!!(A::hypreal). A + C < B + C ==> A < B";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1467
by (dres_inst_tac [("C","-C")] hypreal_add_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1468
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1469
qed "hypreal_less_add_right_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1470
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1471
Goal "!!(A::hypreal). C + A < C + B ==> A < B";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1472
by (dres_inst_tac [("C","-C")] hypreal_add_less_mono2 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1473
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1474
qed "hypreal_less_add_left_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1475
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1476
Goal "(0::hypreal) <= x*x";
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1477
by (res_inst_tac [("x","0"),("y","x")] hypreal_linear_less2 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1478
by (auto_tac (claset() addIs [hypreal_mult_order,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1479
    hypreal_mult_less_zero1,hypreal_less_imp_le],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1480
    simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1481
qed "hypreal_le_square";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1482
Addsimps [hypreal_le_square];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1483
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1484
Goalw [hypreal_le_def] "- (x*x) <= (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1485
by (auto_tac (claset() addSDs [(hypreal_le_square RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1486
    hypreal_le_less_trans)],simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1487
    [hypreal_minus_zero_less_iff,hypreal_less_not_refl]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1488
qed "hypreal_less_minus_square";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1489
Addsimps [hypreal_less_minus_square];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1490
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1491
Goal "[|x ~= 0; y ~= 0 |] ==> \
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1492
\                   hrinv(x) + hrinv(y) = (x + y)*hrinv(x*y)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1493
by (asm_full_simp_tac (simpset() addsimps [hypreal_hrinv_distrib,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1494
             hypreal_add_mult_distrib,hypreal_mult_assoc RS sym]) 1);
7322
d16d7ddcc842 isatool expandshort;
wenzelm
parents: 7218
diff changeset
  1495
by (stac hypreal_mult_assoc 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1496
by (rtac (hypreal_mult_left_commute RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1497
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1498
qed "hypreal_hrinv_add";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1499
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1500
Goal "x = -x ==> x = (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1501
by (dtac (hypreal_eq_minus_iff RS iffD1 RS sym) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1502
by (Asm_full_simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1503
by (dtac (hypreal_add_self RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1504
by (rtac ccontr 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1505
by (blast_tac (claset() addDs [hypreal_two_not_zero RSN
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1506
               (2,hypreal_mult_not_0)]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1507
qed "hypreal_self_eq_minus_self_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1508
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1509
Goal "(x + x = 0) = (x = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1510
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1511
by (dtac (hypreal_add_self RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1512
by (rtac ccontr 1 THEN rtac hypreal_mult_not_0E 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1513
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1514
qed "hypreal_add_self_zero_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1515
Addsimps [hypreal_add_self_zero_cancel];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1516
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1517
Goal "(x + x + y = y) = (x = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1518
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1519
by (dtac (hypreal_eq_minus_iff RS iffD1) 1 THEN dtac sym 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1520
by (auto_tac (claset(),simpset() addsimps [hypreal_add_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1521
qed "hypreal_add_self_zero_cancel2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1522
Addsimps [hypreal_add_self_zero_cancel2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1523
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1524
Goal "(x + (x + y) = y) = (x = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1525
by (simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1526
qed "hypreal_add_self_zero_cancel2a";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1527
Addsimps [hypreal_add_self_zero_cancel2a];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1528
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1529
Goal "(b = -a) = (-b = (a::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1530
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1531
qed "hypreal_minus_eq_swap";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1532
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1533
Goal "(-b = -a) = (b = (a::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1534
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1535
    [hypreal_minus_eq_swap]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1536
qed "hypreal_minus_eq_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1537
Addsimps [hypreal_minus_eq_cancel];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1538
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1539
Goal "x < x + 1hr";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1540
by (cut_inst_tac [("C","x")] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1541
    (hypreal_zero_less_one RS hypreal_add_less_mono2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1542
by (Asm_full_simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1543
qed "hypreal_less_self_add_one";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1544
Addsimps [hypreal_less_self_add_one];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1545
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1546
Goal "((x::hypreal) + x = y + y) = (x = y)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1547
by (auto_tac (claset() addIs [hypreal_two_not_zero RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1548
     hypreal_mult_left_cancel RS iffD1],simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1549
     [hypreal_add_mult_distrib]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1550
qed "hypreal_add_self_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1551
Addsimps [hypreal_add_self_cancel];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1552
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1553
Goal "(y = x + - y + x) = (y = (x::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1554
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1555
by (dres_inst_tac [("x1","y")] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1556
    (hypreal_add_right_cancel RS iffD2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1557
by (auto_tac (claset(),simpset() addsimps hypreal_add_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1558
qed "hypreal_add_self_minus_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1559
Addsimps [hypreal_add_self_minus_cancel];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1560
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1561
Goal "(y = x + (- y + x)) = (y = (x::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1562
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1563
         [hypreal_add_assoc RS sym])1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1564
qed "hypreal_add_self_minus_cancel2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1565
Addsimps [hypreal_add_self_minus_cancel2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1566
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1567
Goal "z + -x = y + (y + (-x + -z)) = (y = (z::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1568
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1569
by (dres_inst_tac [("x1","z")] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1570
    (hypreal_add_right_cancel RS iffD2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1571
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1572
    [hypreal_minus_add_distrib RS sym] @ hypreal_add_ac) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1573
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1574
     [hypreal_add_assoc RS sym,hypreal_add_right_cancel]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1575
qed "hypreal_add_self_minus_cancel3";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1576
Addsimps [hypreal_add_self_minus_cancel3];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1577
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1578
(* check why this does not work without 2nd substiution anymore! *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1579
Goal "x < y ==> x < (x + y)*hrinv(1hr + 1hr)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1580
by (dres_inst_tac [("C","x")] hypreal_add_less_mono2 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1581
by (dtac (hypreal_add_self RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1582
by (dtac (hypreal_zero_less_two RS hypreal_hrinv_gt_zero RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1583
          hypreal_mult_less_mono1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1584
by (auto_tac (claset() addDs [hypreal_two_not_zero RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1585
          (hypreal_mult_hrinv RS subst)],simpset() 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1586
          addsimps [hypreal_mult_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1587
qed "hypreal_less_half_sum";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1588
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1589
(* check why this does not work without 2nd substiution anymore! *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1590
Goal "x < y ==> (x + y)*hrinv(1hr + 1hr) < y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1591
by (dres_inst_tac [("C","y")] hypreal_add_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1592
by (dtac (hypreal_add_self RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1593
by (dtac (hypreal_zero_less_two RS hypreal_hrinv_gt_zero RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1594
          hypreal_mult_less_mono1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1595
by (auto_tac (claset() addDs [hypreal_two_not_zero RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1596
          (hypreal_mult_hrinv RS subst)],simpset() 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1597
          addsimps [hypreal_mult_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1598
qed "hypreal_gt_half_sum";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1599
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1600
Goal "!!(x::hypreal). x < y ==> EX r. x < r & r < y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1601
by (blast_tac (claset() addSIs [hypreal_less_half_sum,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1602
    hypreal_gt_half_sum]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1603
qed "hypreal_dense";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1604
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1605
Goal "(x * x = 0) = (x = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1606
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1607
by (blast_tac (claset() addIs [hypreal_mult_not_0E]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1608
qed "hypreal_mult_self_eq_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1609
Addsimps [hypreal_mult_self_eq_zero_iff];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1610
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1611
Goal "(0 = x * x) = (x = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1612
by (auto_tac (claset() addDs [sym],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1613
qed "hypreal_mult_self_eq_zero_iff2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1614
Addsimps [hypreal_mult_self_eq_zero_iff2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1615
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1616
Goal "(x*x + y*y = 0) = (x = 0 & y = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1617
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1618
by (dtac (sym RS (hypreal_eq_minus_iff3 RS iffD1))  1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1619
by (dtac (sym RS (hypreal_eq_minus_iff4 RS iffD1))  2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1620
by (ALLGOALS(rtac ccontr));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1621
by (ALLGOALS(dtac hypreal_mult_self_not_zero));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1622
by (cut_inst_tac [("x1","x")] (hypreal_le_square 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1623
        RS hypreal_le_imp_less_or_eq) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1624
by (cut_inst_tac [("x1","y")] (hypreal_le_square 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1625
        RS hypreal_le_imp_less_or_eq) 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1626
by (auto_tac (claset() addDs [sym],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1627
by (dres_inst_tac [("x1","y")] (hypreal_less_minus_square 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1628
    RS hypreal_le_less_trans) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1629
by (dres_inst_tac [("x1","x")] (hypreal_less_minus_square 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1630
    RS hypreal_le_less_trans) 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1631
by (auto_tac (claset(),simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1632
       [hypreal_less_not_refl]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1633
qed "hypreal_squares_add_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1634
Addsimps [hypreal_squares_add_zero_iff];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1635
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1636
Goal "x * x ~= 0 ==> (0::hypreal) < x* x + y*y + z*z";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1637
by (cut_inst_tac [("x1","x")] (hypreal_le_square 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1638
        RS hypreal_le_imp_less_or_eq) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1639
by (auto_tac (claset() addSIs 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1640
              [hypreal_add_order_le],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1641
qed "hypreal_sum_squares3_gt_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1642
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1643
Goal "x * x ~= 0 ==> (0::hypreal) < y*y + x*x + z*z";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1644
by (dtac hypreal_sum_squares3_gt_zero 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1645
by (auto_tac (claset(),simpset() addsimps hypreal_add_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1646
qed "hypreal_sum_squares3_gt_zero2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1647
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1648
Goal "x * x ~= 0 ==> (0::hypreal) < y*y + z*z + x*x";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1649
by (dtac hypreal_sum_squares3_gt_zero 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1650
by (auto_tac (claset(),simpset() addsimps hypreal_add_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1651
qed "hypreal_sum_squares3_gt_zero3";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1652
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1653
Goal "(x*x + y*y + z*z = 0) = (x = 0 & y = 0 & z = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1654
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1655
by (ALLGOALS(rtac ccontr));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1656
by (ALLGOALS(dtac hypreal_mult_self_not_zero));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1657
by (auto_tac (claset() addDs [hypreal_not_refl2 RS not_sym,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1658
   hypreal_sum_squares3_gt_zero3,hypreal_sum_squares3_gt_zero,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1659
   hypreal_sum_squares3_gt_zero2],simpset() delsimps
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1660
   [hypreal_mult_self_eq_zero_iff]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1661
qed "hypreal_three_squares_add_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1662
Addsimps [hypreal_three_squares_add_zero_iff];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1663
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1664
Addsimps [rename_numerals thy real_le_square];
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1665
Goal "(x::hypreal)*x <= x*x + y*y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1666
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1667
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1668
by (auto_tac (claset(),simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1669
    [hypreal_mult,hypreal_add,hypreal_le]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1670
qed "hypreal_self_le_add_pos";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1671
Addsimps [hypreal_self_le_add_pos];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1672
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1673
Goal "(x::hypreal)*x <= x*x + y*y + z*z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1674
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1675
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1676
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1677
by (auto_tac (claset(),simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1678
    [hypreal_mult,hypreal_add,hypreal_le,
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1679
    rename_numerals thy real_le_add_order]));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1680
qed "hypreal_self_le_add_pos2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1681
Addsimps [hypreal_self_le_add_pos2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1682
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1683
(*---------------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1684
             Embedding of the naturals in the hyperreals
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1685
 ---------------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1686
Goalw [hypreal_of_posnat_def] "hypreal_of_posnat 0 = 1hr";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1687
by (full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1688
    [pnat_one_iff RS sym,real_of_preal_def]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1689
by (fold_tac [real_one_def]);
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1690
by (simp_tac (simpset() addsimps [hypreal_of_real_one]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1691
qed "hypreal_of_posnat_one";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1692
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1693
Goalw [hypreal_of_posnat_def] "hypreal_of_posnat 1 = 1hr + 1hr";
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1694
by (full_simp_tac (simpset() addsimps [real_of_preal_def,
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1695
    rename_numerals thy (real_one_def RS meta_eq_to_obj_eq),
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1696
     hypreal_add,hypreal_of_real_def,pnat_two_eq,hypreal_one_def,
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1697
    real_add,prat_of_pnat_add RS sym,preal_of_prat_add RS sym] @ 
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1698
    pnat_add_ac) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1699
qed "hypreal_of_posnat_two";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1700
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1701
Goalw [hypreal_of_posnat_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1702
          "hypreal_of_posnat n1 + hypreal_of_posnat n2 = \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1703
\          hypreal_of_posnat (n1 + n2) + 1hr";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1704
by (full_simp_tac (simpset() addsimps [hypreal_of_posnat_one RS sym,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1705
    hypreal_of_real_add RS sym,hypreal_of_posnat_def,real_of_preal_add RS sym,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1706
    preal_of_prat_add RS sym,prat_of_pnat_add RS sym,pnat_of_nat_add]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1707
qed "hypreal_of_posnat_add";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1708
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1709
Goal "hypreal_of_posnat (n + 1) = hypreal_of_posnat n + 1hr";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1710
by (res_inst_tac [("x1","1hr")] (hypreal_add_right_cancel RS iffD1) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1711
by (rtac (hypreal_of_posnat_add RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1712
by (full_simp_tac (simpset() addsimps [hypreal_of_posnat_two,hypreal_add_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1713
qed "hypreal_of_posnat_add_one";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1714
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1715
Goalw [real_of_posnat_def,hypreal_of_posnat_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1716
      "hypreal_of_posnat n = hypreal_of_real (real_of_posnat n)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1717
by (rtac refl 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1718
qed "hypreal_of_real_of_posnat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1719
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1720
Goalw [hypreal_of_posnat_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1721
      "(n < m) = (hypreal_of_posnat n < hypreal_of_posnat m)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1722
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1723
qed "hypreal_of_posnat_less_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1724
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1725
Addsimps [hypreal_of_posnat_less_iff RS sym];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1726
(*---------------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1727
               Existence of infinite hyperreal number
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1728
 ---------------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1729
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1730
Goal "hyprel^^{%n::nat. real_of_posnat n} : hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1731
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1732
qed "hypreal_omega";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1733
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1734
Goalw [omega_def] "Rep_hypreal(whr) : hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1735
by (rtac Rep_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1736
qed "Rep_hypreal_omega";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1737
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1738
(* existence of infinite number not corresponding to any real number *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1739
(* use assumption that member FreeUltrafilterNat is not finite       *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1740
(* a few lemmas first *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1741
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1742
Goal "{n::nat. x = real_of_posnat n} = {} | \
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1743
\     (EX y. {n::nat. x = real_of_posnat n} = {y})";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1744
by (auto_tac (claset() addDs [inj_real_of_posnat RS injD],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1745
qed "lemma_omega_empty_singleton_disj";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1746
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1747
Goal "finite {n::nat. x = real_of_posnat n}";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1748
by (cut_inst_tac [("x","x")] lemma_omega_empty_singleton_disj 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1749
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1750
qed "lemma_finite_omega_set";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1751
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1752
Goalw [omega_def,hypreal_of_real_def] 
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1753
      "~ (EX x. hypreal_of_real x = whr)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1754
by (auto_tac (claset(),simpset() addsimps [lemma_finite_omega_set 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1755
    RS FreeUltrafilterNat_finite]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1756
qed "not_ex_hypreal_of_real_eq_omega";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1757
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1758
Goal "hypreal_of_real x ~= whr";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1759
by (cut_facts_tac [not_ex_hypreal_of_real_eq_omega] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1760
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1761
qed "hypreal_of_real_not_eq_omega";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1762
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1763
(* existence of infinitesimal number also not *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1764
(* corresponding to any real number *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1765
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1766
Goal "{n::nat. x = rinv(real_of_posnat n)} = {} | \
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1767
\     (EX y. {n::nat. x = rinv(real_of_posnat n)} = {y})";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1768
by (Step_tac 1 THEN Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1769
by (auto_tac (claset() addIs [real_of_posnat_rinv_inj],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1770
qed "lemma_epsilon_empty_singleton_disj";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1771
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1772
Goal "finite {n::nat. x = rinv(real_of_posnat n)}";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1773
by (cut_inst_tac [("x","x")] lemma_epsilon_empty_singleton_disj 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1774
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1775
qed "lemma_finite_epsilon_set";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1776
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1777
Goalw [epsilon_def,hypreal_of_real_def] 
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1778
      "~ (EX x. hypreal_of_real x = ehr)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1779
by (auto_tac (claset(),simpset() addsimps [lemma_finite_epsilon_set 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1780
    RS FreeUltrafilterNat_finite]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1781
qed "not_ex_hypreal_of_real_eq_epsilon";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1782
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1783
Goal "hypreal_of_real x ~= ehr";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1784
by (cut_facts_tac [not_ex_hypreal_of_real_eq_epsilon] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1785
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1786
qed "hypreal_of_real_not_eq_epsilon";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1787
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1788
Goalw [epsilon_def,hypreal_zero_def] "ehr ~= 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1789
by (auto_tac (claset(),simpset() addsimps 
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1790
    [rename_numerals thy real_of_posnat_rinv_not_zero]));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1791
qed "hypreal_epsilon_not_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1792
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1793
Addsimps [rename_numerals thy real_of_posnat_not_eq_zero];
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1794
Goalw [omega_def,hypreal_zero_def] "whr ~= 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1795
by (Simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1796
qed "hypreal_omega_not_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1797
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1798
Goal "ehr = hrinv(whr)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1799
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1800
    [hypreal_hrinv,omega_def,epsilon_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1801
    setloop (split_tac [expand_if])) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1802
qed "hypreal_epsilon_hrinv_omega";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1803
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1804
(*----------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1805
     Another embedding of the naturals in the 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1806
    hyperreals (see hypreal_of_posnat)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1807
 ----------------------------------------------------------------*)
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1808
Goalw [hypreal_of_nat_def] "hypreal_of_nat 0 = 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1809
by (full_simp_tac (simpset() addsimps [hypreal_of_posnat_one]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1810
qed "hypreal_of_nat_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1811
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1812
Goalw [hypreal_of_nat_def] "hypreal_of_nat 1 = 1hr";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1813
by (full_simp_tac (simpset() addsimps [hypreal_of_posnat_two,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1814
    hypreal_add_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1815
qed "hypreal_of_nat_one";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1816
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1817
Goalw [hypreal_of_nat_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1818
      "hypreal_of_nat n1 + hypreal_of_nat n2 = \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1819
\      hypreal_of_nat (n1 + n2)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1820
by (full_simp_tac (simpset() addsimps hypreal_add_ac) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1821
by (simp_tac (simpset() addsimps [hypreal_of_posnat_add,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1822
    hypreal_add_assoc RS sym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1823
by (rtac (hypreal_add_commute RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1824
by (simp_tac (simpset() addsimps [hypreal_add_left_cancel,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1825
    hypreal_add_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1826
qed "hypreal_of_nat_add";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1827
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1828
Goal "hypreal_of_nat 2 = 1hr + 1hr";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1829
by (simp_tac (simpset() addsimps [hypreal_of_nat_one 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1830
    RS sym,hypreal_of_nat_add]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1831
qed "hypreal_of_nat_two";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1832
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1833
Goalw [hypreal_of_nat_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1834
      "(n < m) = (hypreal_of_nat n < hypreal_of_nat m)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1835
by (auto_tac (claset() addIs [hypreal_add_less_mono1],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1836
by (dres_inst_tac [("C","1hr")] hypreal_add_less_mono1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1837
by (full_simp_tac (simpset() addsimps [hypreal_add_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1838
qed "hypreal_of_nat_less_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1839
Addsimps [hypreal_of_nat_less_iff RS sym];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1840
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1841
(* naturals embedded in hyperreals is an hyperreal *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1842
Goalw [hypreal_of_nat_def,real_of_nat_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1843
      "hypreal_of_nat  m = Abs_hypreal(hyprel^^{%n. real_of_nat m})";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1844
by (auto_tac (claset(),simpset() addsimps [hypreal_of_real_def,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1845
    hypreal_of_real_of_posnat,hypreal_minus,hypreal_one_def,hypreal_add]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1846
qed "hypreal_of_nat_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1847
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1848
Goal "inj hypreal_of_nat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1849
by (rtac injI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1850
by (auto_tac (claset() addSDs [FreeUltrafilterNat_P],
7825
1be9b63e7d93 replaced {x. True} by UNIV to work with the new simprule, Collect_const
paulson
parents: 7499
diff changeset
  1851
        simpset() addsimps [split_if_mem1, hypreal_of_nat_iff,
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1852
        real_add_right_cancel,inj_real_of_nat RS injD]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1853
qed "inj_hypreal_of_nat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1854
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1855
Goalw [hypreal_of_nat_def,hypreal_of_real_def,hypreal_of_posnat_def,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1856
       real_of_posnat_def,hypreal_one_def,real_of_nat_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1857
       "hypreal_of_nat n = hypreal_of_real (real_of_nat n)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1858
by (simp_tac (simpset() addsimps [hypreal_add,hypreal_minus]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1859
qed "hypreal_of_nat_real_of_nat";