src/HOL/Real/Hyperreal/HyperDef.ML
author paulson
Tue, 12 Dec 2000 12:01:19 +0100
changeset 10648 a8c647cfa31f
parent 10607 352f6f209775
child 10677 36625483213f
permissions -rw-r--r--
first stage in tidying up Real and Hyperreal. Factor cancellation simprocs inverse #0 = #0 simprules for division corrected ambigous syntax definitions in Hyperreal
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);
9969
4753185f1dd2 renamed (most of...) the select rules
paulson
parents: 9432
diff changeset
    46
by (rtac someI2 1 THEN ALLGOALS(assume_tac));
7218
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);
9969
4753185f1dd2 renamed (most of...) the select rules
paulson
parents: 9432
diff changeset
    52
by (rtac someI2 1 THEN assume_tac 1);
7218
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);
9969
4753185f1dd2 renamed (most of...) the select rules
paulson
parents: 9432
diff changeset
    62
by (rtac someI2 1 THEN assume_tac 1);
7218
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
9391
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   110
Goal "UNIV : FreeUltrafilterNat";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   111
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   112
qed "FreeUltrafilterNat_Nat_set";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   113
Addsimps [FreeUltrafilterNat_Nat_set];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   114
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   115
Goal "{n. P(n) = P(n)} : FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   116
by (Simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   117
qed "FreeUltrafilterNat_Nat_set_refl";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   118
AddIs [FreeUltrafilterNat_Nat_set_refl];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   119
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   120
Goal "{n::nat. P} : FreeUltrafilterNat ==> P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   121
by (rtac ccontr 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   122
by (rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   123
by (Asm_full_simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   124
qed "FreeUltrafilterNat_P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   125
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   126
Goal "{n. P(n)} : FreeUltrafilterNat ==> EX n. P(n)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   127
by (rtac ccontr 1 THEN rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   128
by (Asm_full_simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   129
qed "FreeUltrafilterNat_Ex_P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   130
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   131
Goal "ALL n. P(n) ==> {n. P(n)} : FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   132
by (auto_tac (claset() addIs [FreeUltrafilterNat_Nat_set],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   133
qed "FreeUltrafilterNat_all";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   134
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   135
(*-------------------------------------------------------
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   136
     Define and use Ultrafilter tactics
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   137
 -------------------------------------------------------*)
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   138
use "fuf.ML";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   139
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   140
(*-------------------------------------------------------
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   141
  Now prove one further property of our free ultrafilter
7218
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
Goal "X Un Y: FreeUltrafilterNat \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   144
\     ==> X: FreeUltrafilterNat | Y: FreeUltrafilterNat";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   145
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   146
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   147
qed "FreeUltrafilterNat_Un";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   148
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   149
(*-------------------------------------------------------
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   150
   Properties of hyprel
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   151
 -------------------------------------------------------*)
7218
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
(** Proving that hyprel is an equivalence relation **)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   154
(** Natural deduction for hyprel **)
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
Goalw [hyprel_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   157
   "((X,Y): hyprel) = ({n. X n = Y n}: FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   158
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   159
qed "hyprel_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   160
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   161
Goalw [hyprel_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   162
     "{n. X n = Y n}: FreeUltrafilterNat  ==> (X,Y): hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   163
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   164
qed "hyprelI";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   165
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   166
Goalw [hyprel_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   167
  "p: hyprel --> (EX X Y. \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   168
\                 p = (X,Y) & {n. X n = Y n} : FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   169
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   170
qed "hyprelE_lemma";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   171
9432
8b7aad2abcc9 avoid referencing thy value;
wenzelm
parents: 9391
diff changeset
   172
val [major,minor] = goal (the_context ())
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   173
  "[| p: hyprel;  \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   174
\     !!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
   175
\                    |] ==> Q |] ==> Q";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   176
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
   177
by (REPEAT (eresolve_tac [asm_rl,exE,conjE,minor] 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   178
qed "hyprelE";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   179
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   180
AddSIs [hyprelI];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   181
AddSEs [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
Goalw [hyprel_def] "(x,x): hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   184
by (auto_tac (claset(),simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   185
         [FreeUltrafilterNat_Nat_set]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   186
qed "hyprel_refl";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   187
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   188
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
   189
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   190
qed "lemma_perm";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   191
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   192
Goalw [hyprel_def] "(x,y): hyprel --> (y,x):hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   193
by (auto_tac (claset() addIs [lemma_perm RS subst],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   194
qed_spec_mp "hyprel_sym";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   195
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   196
Goalw [hyprel_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   197
      "(x,y): hyprel --> (y,z):hyprel --> (x,z):hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   198
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   199
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   200
qed_spec_mp "hyprel_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   201
9391
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   202
Goalw [equiv_def, refl_def, sym_def, trans_def] "equiv UNIV hyprel";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   203
by (auto_tac (claset() addSIs [hyprel_refl] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   204
                       addSEs [hyprel_sym,hyprel_trans] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   205
                       delrules [hyprelI,hyprelE],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   206
	      simpset() addsimps [FreeUltrafilterNat_Nat_set]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   207
qed "equiv_hyprel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   208
9391
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   209
(* (hyprel ^^ {x} = hyprel ^^ {y}) = ((x,y) : hyprel) *)
9108
9fff97d29837 bind_thm(s);
wenzelm
parents: 9071
diff changeset
   210
bind_thm ("equiv_hyprel_iff",
9391
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   211
    	  [equiv_hyprel, UNIV_I, UNIV_I] MRS eq_equiv_class_iff);
7218
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
Goalw  [hypreal_def,hyprel_def,quotient_def] "hyprel^^{x}:hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   214
by (Blast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   215
qed "hyprel_in_hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   216
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   217
Goal "inj_on Abs_hypreal hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   218
by (rtac inj_on_inverseI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   219
by (etac Abs_hypreal_inverse 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   220
qed "inj_on_Abs_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
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
   223
          hyprel_iff, hyprel_in_hypreal, Abs_hypreal_inverse];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   224
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   225
Addsimps [equiv_hyprel RS eq_equiv_class_iff];
9108
9fff97d29837 bind_thm(s);
wenzelm
parents: 9071
diff changeset
   226
bind_thm ("eq_hyprelD", equiv_hyprel RSN (2,eq_equiv_class));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   227
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   228
Goal "inj(Rep_hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   229
by (rtac inj_inverseI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   230
by (rtac Rep_hypreal_inverse 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   231
qed "inj_Rep_hypreal";
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
Goalw [hyprel_def] "x: hyprel ^^ {x}";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   234
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   235
by (auto_tac (claset() addSIs [FreeUltrafilterNat_Nat_set],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   236
qed "lemma_hyprel_refl";
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
Addsimps [lemma_hyprel_refl];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   239
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   240
Goalw [hypreal_def] "{} ~: hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   241
by (auto_tac (claset() addSEs [quotientE], simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   242
qed "hypreal_empty_not_mem";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   243
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   244
Addsimps [hypreal_empty_not_mem];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   245
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   246
Goal "Rep_hypreal x ~= {}";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   247
by (cut_inst_tac [("x","x")] Rep_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   248
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   249
qed "Rep_hypreal_nonempty";
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
Addsimps [Rep_hypreal_nonempty];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   252
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   253
(*------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   254
   hypreal_of_real: the injection from real to hypreal
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
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   257
Goal "inj(hypreal_of_real)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   258
by (rtac injI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   259
by (rewtac hypreal_of_real_def);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   260
by (dtac (inj_on_Abs_hypreal RS inj_onD) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   261
by (REPEAT (rtac hyprel_in_hypreal 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   262
by (dtac eq_equiv_class 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   263
by (rtac equiv_hyprel 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   264
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   265
by (rtac ccontr 1 THEN rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   266
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   267
qed "inj_hypreal_of_real";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   268
9432
8b7aad2abcc9 avoid referencing thy value;
wenzelm
parents: 9391
diff changeset
   269
val [prem] = goal (the_context ())
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   270
    "(!!x y. z = Abs_hypreal(hyprel^^{x}) ==> P) ==> P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   271
by (res_inst_tac [("x1","z")] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   272
    (rewrite_rule [hypreal_def] Rep_hypreal RS quotientE) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   273
by (dres_inst_tac [("f","Abs_hypreal")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   274
by (res_inst_tac [("x","x")] prem 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   275
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
   276
qed "eq_Abs_hypreal";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   277
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   278
(**** hypreal_minus: additive inverse on hypreal ****)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   279
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   280
Goalw [congruent_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   281
  "congruent hyprel (%X. hyprel^^{%n. - (X n)})";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   282
by Safe_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   283
by (ALLGOALS Ultra_tac);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   284
qed "hypreal_minus_congruent";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   285
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   286
Goalw [hypreal_minus_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   287
      "- (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
   288
by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   289
by (simp_tac (simpset() addsimps 
9391
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   290
   [hyprel_in_hypreal RS Abs_hypreal_inverse,
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   291
    [equiv_hyprel, hypreal_minus_congruent] MRS UN_equiv_class]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   292
qed "hypreal_minus";
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
Goal "- (- z) = (z::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   295
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   296
by (asm_simp_tac (simpset() addsimps [hypreal_minus]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   297
qed "hypreal_minus_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   298
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   299
Addsimps [hypreal_minus_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 "inj(%r::hypreal. -r)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   302
by (rtac injI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   303
by (dres_inst_tac [("f","uminus")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   304
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
   305
qed "inj_hypreal_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   306
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   307
Goalw [hypreal_zero_def] "-0 = (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   308
by (simp_tac (simpset() addsimps [hypreal_minus]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   309
qed "hypreal_minus_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   310
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   311
Addsimps [hypreal_minus_zero];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   312
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   313
Goal "(-x = 0) = (x = (0::hypreal))"; 
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   314
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   315
by (auto_tac (claset(),simpset() addsimps [hypreal_zero_def,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   316
    hypreal_minus] @ real_add_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   317
qed "hypreal_minus_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   318
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   319
Addsimps [hypreal_minus_zero_iff];
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   320
(**** multiplicative inverse on hypreal ****)
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   321
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   322
Goalw [congruent_def]
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   323
  "congruent hyprel (%X. hyprel^^{%n. if X n = #0 then #0 else inverse(X n)})";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   324
by (Auto_tac THEN Ultra_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   325
qed "hypreal_inverse_congruent";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   326
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   327
Goalw [hypreal_inverse_def]
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   328
      "inverse (Abs_hypreal(hyprel^^{%n. X n})) = \
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   329
\      Abs_hypreal(hyprel ^^ {%n. if X n = #0 then #0 else inverse(X n)})";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   330
by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   331
by (simp_tac (simpset() addsimps 
9391
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   332
   [hyprel_in_hypreal RS Abs_hypreal_inverse,
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   333
    [equiv_hyprel, hypreal_inverse_congruent] MRS UN_equiv_class]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   334
qed "hypreal_inverse";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   335
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   336
Goal "z ~= 0 ==> inverse (inverse (z::hypreal)) = z";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   337
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   338
by (rotate_tac 1 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   339
by (asm_full_simp_tac (simpset() addsimps 
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   340
    [hypreal_inverse,hypreal_zero_def] addsplits [split_if]) 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   341
by (ultra_tac (claset() addDs (map rename_numerals [real_inverse_not_zero]),
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   342
	       simpset() addsimps [real_inverse_inverse]) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   343
qed "hypreal_inverse_inverse";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   344
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   345
Addsimps [hypreal_inverse_inverse];
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   346
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   347
Goalw [hypreal_one_def] "inverse(1hr) = 1hr";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   348
by (full_simp_tac (simpset() addsimps [hypreal_inverse,
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   349
                                       real_zero_not_eq_one RS not_sym]) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   350
qed "hypreal_inverse_1";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   351
Addsimps [hypreal_inverse_1];
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   352
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   353
(**** hyperreal addition: hypreal_add  ****)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   354
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   355
Goalw [congruent2_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   356
    "congruent2 hyprel (%X Y. hyprel^^{%n. X n + Y n})";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   357
by Safe_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   358
by (ALLGOALS(Ultra_tac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   359
qed "hypreal_add_congruent2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   360
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   361
Goalw [hypreal_add_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   362
  "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
   363
\  Abs_hypreal(hyprel^^{%n. X n + Y n})";
9391
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   364
by (simp_tac (simpset() addsimps 
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   365
         [[equiv_hyprel, hypreal_add_congruent2] MRS UN_equiv_class2]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   366
qed "hypreal_add";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   367
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   368
Goal "(z::hypreal) + w = w + z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   369
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   370
by (res_inst_tac [("z","w")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   371
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
   372
qed "hypreal_add_commute";
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
Goal "((z1::hypreal) + z2) + z3 = z1 + (z2 + z3)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   375
by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   376
by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   377
by (res_inst_tac [("z","z3")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   378
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
   379
qed "hypreal_add_assoc";
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
(*For AC rewriting*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   382
Goal "(x::hypreal)+(y+z)=y+(x+z)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   383
by (rtac (hypreal_add_commute RS trans) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   384
by (rtac (hypreal_add_assoc RS trans) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   385
by (rtac (hypreal_add_commute RS arg_cong) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   386
qed "hypreal_add_left_commute";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   387
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   388
(* hypreal addition is an AC operator *)
9108
9fff97d29837 bind_thm(s);
wenzelm
parents: 9071
diff changeset
   389
bind_thms ("hypreal_add_ac", [hypreal_add_assoc,hypreal_add_commute,
9fff97d29837 bind_thm(s);
wenzelm
parents: 9071
diff changeset
   390
                      hypreal_add_left_commute]);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   391
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   392
Goalw [hypreal_zero_def] "(0::hypreal) + z = z";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   393
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   394
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   395
    [hypreal_add]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   396
qed "hypreal_add_zero_left";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   397
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   398
Goal "z + (0::hypreal) = z";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   399
by (simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   400
    [hypreal_add_zero_left,hypreal_add_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   401
qed "hypreal_add_zero_right";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   402
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   403
Goalw [hypreal_zero_def] "z + -z = (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   404
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   405
by (asm_full_simp_tac (simpset() addsimps [hypreal_minus, hypreal_add]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   406
qed "hypreal_add_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   407
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   408
Goal "-z + z = (0::hypreal)";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   409
by (simp_tac (simpset() addsimps [hypreal_add_commute, hypreal_add_minus]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   410
qed "hypreal_add_minus_left";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   411
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   412
Addsimps [hypreal_add_minus,hypreal_add_minus_left,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   413
          hypreal_add_zero_left,hypreal_add_zero_right];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   414
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   415
Goal "EX y. (x::hypreal) + y = 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   416
by (fast_tac (claset() addIs [hypreal_add_minus]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   417
qed "hypreal_minus_ex";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   418
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   419
Goal "EX! y. (x::hypreal) + y = 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   420
by (auto_tac (claset() addIs [hypreal_add_minus],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   421
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
   422
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
   423
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
   424
qed "hypreal_minus_ex1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   425
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   426
Goal "EX! y. y + (x::hypreal) = 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   427
by (auto_tac (claset() addIs [hypreal_add_minus_left],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   428
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
   429
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
   430
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
   431
qed "hypreal_minus_left_ex1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   432
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   433
Goal "x + y = (0::hypreal) ==> x = -y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   434
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
   435
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
   436
by (Blast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   437
qed "hypreal_add_minus_eq_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   438
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   439
Goal "EX y::hypreal. x = -y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   440
by (cut_inst_tac [("x","x")] hypreal_minus_ex 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   441
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
   442
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   443
qed "hypreal_as_add_inverse_ex";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   444
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   445
Goal "-(x + (y::hypreal)) = -x + -y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   446
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   447
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   448
by (auto_tac (claset(),
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   449
              simpset() addsimps [hypreal_minus, hypreal_add,
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   450
                                  real_minus_add_distrib]));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   451
qed "hypreal_minus_add_distrib";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   452
Addsimps [hypreal_minus_add_distrib];
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   453
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   454
Goal "-(y + -(x::hypreal)) = x + -y";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   455
by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   456
qed "hypreal_minus_distrib1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   457
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   458
Goal "(x + - (y::hypreal)) + (y + - z) = x + -z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   459
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
   460
by (simp_tac (simpset() addsimps [hypreal_add_left_commute,
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   461
                                  hypreal_add_assoc]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   462
by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   463
qed "hypreal_add_minus_cancel1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   464
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   465
Goal "((x::hypreal) + y = x + z) = (y = z)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   466
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   467
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
   468
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
   469
qed "hypreal_add_left_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   470
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   471
Goal "z + (x + (y + -z)) = x + (y::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   472
by (simp_tac (simpset() addsimps hypreal_add_ac) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   473
qed "hypreal_add_minus_cancel2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   474
Addsimps [hypreal_add_minus_cancel2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   475
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   476
Goal "y + -(x + y) = -(x::hypreal)";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   477
by (Full_simp_tac 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   478
by (rtac (hypreal_add_left_commute RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   479
by (Full_simp_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   480
qed "hypreal_add_minus_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   481
Addsimps [hypreal_add_minus_cancel];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   482
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   483
Goal "y + -(y + x) = -(x::hypreal)";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   484
by (simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   485
qed "hypreal_add_minus_cancelc";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   486
Addsimps [hypreal_add_minus_cancelc];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   487
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   488
Goal "(z + -x) + (y + -z) = (y + -(x::hypreal))";
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   489
by (full_simp_tac
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   490
    (simpset() addsimps [hypreal_minus_add_distrib RS sym, 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   491
                         hypreal_add_left_cancel] @ hypreal_add_ac 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   492
               delsimps [hypreal_minus_add_distrib]) 1); 
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   493
qed "hypreal_add_minus_cancel3";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   494
Addsimps [hypreal_add_minus_cancel3];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   495
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   496
Goal "(y + (x::hypreal)= z + x) = (y = z)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   497
by (simp_tac (simpset() addsimps [hypreal_add_commute,
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   498
                                  hypreal_add_left_cancel]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   499
qed "hypreal_add_right_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   500
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   501
Goal "z + (y + -z) = (y::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   502
by (simp_tac (simpset() addsimps hypreal_add_ac) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   503
qed "hypreal_add_minus_cancel4";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   504
Addsimps [hypreal_add_minus_cancel4];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   505
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   506
Goal "z + (w + (x + (-z + y))) = w + x + (y::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   507
by (simp_tac (simpset() addsimps hypreal_add_ac) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   508
qed "hypreal_add_minus_cancel5";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   509
Addsimps [hypreal_add_minus_cancel5];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   510
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   511
Goal "z + ((- z) + w) = (w::hypreal)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   512
by (simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   513
qed "hypreal_add_minus_cancelA";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   514
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   515
Goal "(-z) + (z + w) = (w::hypreal)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   516
by (simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   517
qed "hypreal_minus_add_cancelA";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   518
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   519
Addsimps [hypreal_add_minus_cancelA, hypreal_minus_add_cancelA];
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   520
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   521
(**** hyperreal multiplication: hypreal_mult  ****)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   522
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   523
Goalw [congruent2_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   524
    "congruent2 hyprel (%X Y. hyprel^^{%n. X n * Y n})";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   525
by Safe_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   526
by (ALLGOALS(Ultra_tac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   527
qed "hypreal_mult_congruent2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   528
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   529
Goalw [hypreal_mult_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   530
  "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
   531
\  Abs_hypreal(hyprel^^{%n. X n * Y n})";
9391
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   532
by (simp_tac (simpset() addsimps 
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9387
diff changeset
   533
      [[equiv_hyprel, hypreal_mult_congruent2] MRS UN_equiv_class2]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   534
qed "hypreal_mult";
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
Goal "(z::hypreal) * w = w * z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   537
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   538
by (res_inst_tac [("z","w")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   539
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
   540
qed "hypreal_mult_commute";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   541
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   542
Goal "((z1::hypreal) * z2) * z3 = z1 * (z2 * z3)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   543
by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   544
by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   545
by (res_inst_tac [("z","z3")] 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_assoc]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   547
qed "hypreal_mult_assoc";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   548
9432
8b7aad2abcc9 avoid referencing thy value;
wenzelm
parents: 9391
diff changeset
   549
qed_goal "hypreal_mult_left_commute" (the_context ())
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   550
    "(z1::hypreal) * (z2 * z3) = z2 * (z1 * z3)"
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   551
 (fn _ => [rtac (hypreal_mult_commute RS trans) 1, 
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10607
diff changeset
   552
           rtac (hypreal_mult_assoc RS trans) 1,
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   553
           rtac (hypreal_mult_commute RS arg_cong) 1]);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   554
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   555
(* hypreal multiplication is an AC operator *)
9108
9fff97d29837 bind_thm(s);
wenzelm
parents: 9071
diff changeset
   556
bind_thms ("hypreal_mult_ac", [hypreal_mult_assoc, hypreal_mult_commute, 
9fff97d29837 bind_thm(s);
wenzelm
parents: 9071
diff changeset
   557
                       hypreal_mult_left_commute]);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   558
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   559
Goalw [hypreal_one_def] "1hr * z = z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   560
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   561
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   562
qed "hypreal_mult_1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   563
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   564
Goal "z * 1hr = z";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   565
by (simp_tac (simpset() addsimps [hypreal_mult_commute,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   566
    hypreal_mult_1]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   567
qed "hypreal_mult_1_right";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   568
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   569
Goalw [hypreal_zero_def] "0 * z = (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   570
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   571
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
   572
qed "hypreal_mult_0";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   573
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   574
Goal "z * 0 = (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   575
by (simp_tac (simpset() addsimps [hypreal_mult_commute,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   576
    hypreal_mult_0]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   577
qed "hypreal_mult_0_right";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   578
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   579
Addsimps [hypreal_mult_0,hypreal_mult_0_right];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   580
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   581
Goal "-(x * y) = -x * (y::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   582
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   583
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
   584
by (auto_tac (claset(),
ca761fe227d8 First round of changes, towards installation of simprocs
paulson
parents: 9013
diff changeset
   585
	      simpset() addsimps [hypreal_minus, hypreal_mult] 
ca761fe227d8 First round of changes, towards installation of simprocs
paulson
parents: 9013
diff changeset
   586
                                 @ real_mult_ac @ real_add_ac));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   587
qed "hypreal_minus_mult_eq1";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   588
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   589
Goal "-(x * y) = (x::hypreal) * -y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   590
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   591
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   592
by (auto_tac (claset(),simpset() addsimps [hypreal_minus,
9043
ca761fe227d8 First round of changes, towards installation of simprocs
paulson
parents: 9013
diff changeset
   593
					   hypreal_mult] 
ca761fe227d8 First round of changes, towards installation of simprocs
paulson
parents: 9013
diff changeset
   594
                                           @ real_mult_ac @ real_add_ac));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   595
qed "hypreal_minus_mult_eq2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   596
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   597
(*Pull negations out*)
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   598
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
   599
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   600
Goal "-x*y = (x::hypreal)*-y";
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   601
by Auto_tac;
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   602
qed "hypreal_minus_mult_commute";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   603
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   604
(*-----------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   605
    A few more theorems
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   606
 ----------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   607
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
   608
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
   609
qed "hypreal_add_assoc_cong";
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
Goal "(z::hypreal) + (v + w) = v + (z + w)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   612
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
   613
qed "hypreal_add_assoc_swap";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   614
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   615
Goal "((z1::hypreal) + z2) * w = (z1 * w) + (z2 * w)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   616
by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   617
by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   618
by (res_inst_tac [("z","w")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   619
by (asm_simp_tac (simpset() addsimps [hypreal_mult,hypreal_add,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   620
     real_add_mult_distrib]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   621
qed "hypreal_add_mult_distrib";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   622
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   623
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
   624
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   625
Goal "(w::hypreal) * (z1 + z2) = (w * z1) + (w * z2)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   626
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
   627
qed "hypreal_add_mult_distrib2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   628
9108
9fff97d29837 bind_thm(s);
wenzelm
parents: 9071
diff changeset
   629
bind_thms ("hypreal_mult_simps", [hypreal_mult_1, hypreal_mult_1_right]);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   630
Addsimps hypreal_mult_simps;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   631
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   632
(* 07/00 *)
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   633
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   634
Goalw [hypreal_diff_def] "((z1::hypreal) - z2) * w = (z1 * w) - (z2 * w)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   635
by (simp_tac (simpset() addsimps [hypreal_add_mult_distrib]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   636
qed "hypreal_diff_mult_distrib";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   637
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   638
Goal "(w::hypreal) * (z1 - z2) = (w * z1) - (w * z2)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   639
by (simp_tac (simpset() addsimps [hypreal_mult_commute', 
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   640
				  hypreal_diff_mult_distrib]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   641
qed "hypreal_diff_mult_distrib2";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   642
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   643
(*** one and zero are distinct ***)
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   644
Goalw [hypreal_zero_def,hypreal_one_def] "0 ~= 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   645
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
   646
qed "hypreal_zero_not_eq_one";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   647
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   648
(*** existence of inverse ***)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   649
Goalw [hypreal_one_def,hypreal_zero_def] 
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   650
          "x ~= 0 ==> x*inverse(x) = 1hr";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   651
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   652
by (rotate_tac 1 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   653
by (asm_full_simp_tac (simpset() addsimps [hypreal_inverse,
9387
3bab31b55a95 addsplits [split_if];
wenzelm
parents: 9385
diff changeset
   654
    hypreal_mult] addsplits [split_if]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   655
by (dtac FreeUltrafilterNat_Compl_mem 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   656
by (blast_tac (claset() addSIs [real_mult_inv_right,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   657
    FreeUltrafilterNat_subset]) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   658
qed "hypreal_mult_inverse";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   659
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   660
Goal "x ~= 0 ==> inverse(x)*x = 1hr";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   661
by (asm_simp_tac (simpset() addsimps [hypreal_mult_inverse,
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   662
				      hypreal_mult_commute]) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   663
qed "hypreal_mult_inverse_left";
7218
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. x * y = 1hr";
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   666
by (fast_tac (claset() addDs [hypreal_mult_inverse]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   667
qed "hypreal_inverse_ex";
7218
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. y * x = 1hr";
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   670
by (fast_tac (claset() addDs [hypreal_mult_inverse_left]) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   671
qed "hypreal_inverse_left_ex";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   672
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   673
Goal "x ~= 0 ==> EX! y. x * y = 1hr";
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   674
by (auto_tac (claset() addIs [hypreal_mult_inverse],simpset()));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   675
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
   676
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
   677
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_commute]) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   678
qed "hypreal_inverse_ex1";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   679
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   680
Goal "x ~= 0 ==> EX! y. y * x = 1hr";
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   681
by (auto_tac (claset() addIs [hypreal_mult_inverse_left],simpset()));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   682
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
   683
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
   684
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_commute]) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   685
qed "hypreal_inverse_left_ex1";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   686
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   687
Goal "[| y~= 0; x * y = 1hr |]  ==> x = inverse y";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   688
by (forw_inst_tac [("x","y")] hypreal_mult_inverse_left 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   689
by (res_inst_tac [("x1","y")] (hypreal_inverse_left_ex1 RS ex1E) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   690
by (assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   691
by (Blast_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   692
qed "hypreal_mult_inv_inverse";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   693
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   694
Goal "x ~= 0 ==> EX y. x = inverse (y::hypreal)";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   695
by (forw_inst_tac [("x","x")] hypreal_inverse_left_ex 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   696
by (etac exE 1 THEN 
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   697
    forw_inst_tac [("x","y")] hypreal_mult_inv_inverse 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   698
by (res_inst_tac [("x","y")] exI 2);
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
qed "hypreal_as_inverse_ex";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   701
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   702
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
   703
by Auto_tac;
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   704
by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   705
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_inverse] @ hypreal_mult_ac)  1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   706
qed "hypreal_mult_left_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   707
    
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   708
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
   709
by (Step_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   710
by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   711
by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_inverse] @ hypreal_mult_ac)  1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   712
qed "hypreal_mult_right_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   713
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   714
Goalw [hypreal_zero_def] "x ~= 0 ==> inverse (x::hypreal) ~= 0";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   715
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   716
by (rotate_tac 1 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   717
by (asm_full_simp_tac (simpset() addsimps [hypreal_inverse,
9387
3bab31b55a95 addsplits [split_if];
wenzelm
parents: 9385
diff changeset
   718
    hypreal_mult] addsplits [split_if]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   719
by (dtac FreeUltrafilterNat_Compl_mem 1 THEN Clarify_tac 1);
9071
paulson
parents: 9055
diff changeset
   720
by (ultra_tac (claset() addIs [ccontr]
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   721
                        addDs [rename_numerals real_inverse_not_zero],
9071
paulson
parents: 9055
diff changeset
   722
	       simpset()) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   723
qed "hypreal_inverse_not_zero";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   724
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   725
Addsimps [hypreal_mult_inverse,hypreal_mult_inverse_left];
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   726
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   727
Goal "[| x ~= 0; y ~= 0 |] ==> x * y ~= (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   728
by (Step_tac 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   729
by (dres_inst_tac [("f","%z. inverse x*z")] arg_cong 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   730
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
   731
qed "hypreal_mult_not_0";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   732
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   733
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
   734
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   735
Goal "x*y = (0::hypreal) ==> x = 0 | y = 0";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   736
by (auto_tac (claset() addIs [ccontr] addDs 
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   737
    [hypreal_mult_not_0],simpset()));
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   738
qed "hypreal_mult_zero_disj";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   739
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   740
Goal "x ~= 0 ==> x * x ~= (0::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   741
by (blast_tac (claset() addDs [hypreal_mult_not_0]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   742
qed "hypreal_mult_self_not_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   743
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   744
Goal "[| x ~= 0; y ~= 0 |] ==> inverse(x*y) = inverse(x)*inverse(y::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   745
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
   746
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
   747
    hypreal_mult_not_0]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   748
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
   749
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
   750
by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc RS sym,hypreal_mult_not_0]));
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   751
qed "inverse_mult_eq";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   752
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   753
Goal "x ~= 0 ==> inverse(-x) = -inverse(x::hypreal)";
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   754
by (rtac (hypreal_mult_right_cancel RS iffD1) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   755
by (stac hypreal_mult_inverse_left 2);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   756
by Auto_tac;
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   757
qed "hypreal_minus_inverse";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   758
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   759
Goal "[| x ~= 0; y ~= 0 |] \
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   760
\     ==> inverse(x*y) = inverse(x)*inverse(y::hypreal)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   761
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
   762
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
   763
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
   764
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
   765
by (auto_tac (claset(),simpset() addsimps [hypreal_mult_left_commute]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   766
by (asm_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym]) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   767
qed "hypreal_inverse_distrib";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   768
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   769
(*------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   770
                   Theorems for ordering 
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
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   773
(* prove introduction and elimination rules for hypreal_less *)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   774
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   775
Goalw [hypreal_less_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   776
 "P < (Q::hypreal) = (EX X Y. X : Rep_hypreal(P) & \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   777
\                             Y : Rep_hypreal(Q) & \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   778
\                             {n. X n < Y n} : FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   779
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   780
qed "hypreal_less_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   781
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   782
Goalw [hypreal_less_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   783
 "[| {n. X n < Y n} : FreeUltrafilterNat; \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   784
\         X : Rep_hypreal(P); \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   785
\         Y : Rep_hypreal(Q) |] ==> P < (Q::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   786
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   787
qed "hypreal_lessI";
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
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   790
Goalw [hypreal_less_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   791
     "!! R1. [| R1 < (R2::hypreal); \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   792
\         !!X Y. {n. X n < Y n} : FreeUltrafilterNat ==> P; \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   793
\         !!X. X : Rep_hypreal(R1) ==> P; \ 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   794
\         !!Y. Y : Rep_hypreal(R2) ==> P |] \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   795
\     ==> P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   796
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   797
qed "hypreal_lessE";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   798
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   799
Goalw [hypreal_less_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   800
 "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
   801
\                                  X : Rep_hypreal(R1) & \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   802
\                                  Y : Rep_hypreal(R2))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   803
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   804
qed "hypreal_lessD";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   805
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   806
Goal "~ (R::hypreal) < R";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   807
by (res_inst_tac [("z","R")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   808
by (auto_tac (claset(),simpset() addsimps [hypreal_less_def]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   809
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   810
qed "hypreal_less_not_refl";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   811
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   812
(*** y < y ==> P ***)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   813
bind_thm("hypreal_less_irrefl",hypreal_less_not_refl RS notE);
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   814
AddSEs [hypreal_less_irrefl];
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   815
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   816
Goal "!!(x::hypreal). x < y ==> x ~= y";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   817
by (auto_tac (claset(),simpset() addsimps [hypreal_less_not_refl]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   818
qed "hypreal_not_refl2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   819
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   820
Goal "!!(R1::hypreal). [| R1 < R2; R2 < R3 |] ==> R1 < R3";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   821
by (res_inst_tac [("z","R1")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   822
by (res_inst_tac [("z","R2")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   823
by (res_inst_tac [("z","R3")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   824
by (auto_tac (claset() addSIs [exI],simpset() 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   825
     addsimps [hypreal_less_def]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   826
by (ultra_tac (claset() addIs [real_less_trans],simpset()) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   827
qed "hypreal_less_trans";
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
Goal "!! (R1::hypreal). [| R1 < R2; R2 < R1 |] ==> P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   830
by (dtac hypreal_less_trans 1 THEN assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   831
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   832
    [hypreal_less_not_refl]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   833
qed "hypreal_less_asym";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   834
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   835
(*-------------------------------------------------------
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   836
  TODO: The following theorem should have been proved 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   837
  first and then used througout the proofs as it probably 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   838
  makes many of them more straightforward. 
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
Goalw [hypreal_less_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   841
      "(Abs_hypreal(hyprel^^{%n. X n}) < \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   842
\           Abs_hypreal(hyprel^^{%n. Y n})) = \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   843
\      ({n. X n < Y n} : FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   844
by (auto_tac (claset() addSIs [lemma_hyprel_refl],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   845
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   846
qed "hypreal_less";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   847
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   848
(*---------------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   849
             Hyperreals as a linearly ordered field
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   850
 ---------------------------------------------------------------------------------*)
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   851
(*** sum order 
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   852
Goalw [hypreal_zero_def] 
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   853
      "[| 0 < x; 0 < y |] ==> (0::hypreal) < x + y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   854
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   855
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   856
by (auto_tac (claset(),simpset() addsimps
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   857
    [hypreal_less_def,hypreal_add]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   858
by (auto_tac (claset() addSIs [exI],simpset() addsimps
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   859
    [hypreal_less_def,hypreal_add]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   860
by (ultra_tac (claset() addIs [real_add_order],simpset()) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   861
qed "hypreal_add_order";
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   862
***)
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   863
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
   864
(*** mult order 
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   865
Goalw [hypreal_zero_def] 
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   866
          "[| 0 < x; 0 < y |] ==> (0::hypreal) < x * y";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   867
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   868
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   869
by (auto_tac (claset() addSIs [exI],simpset() addsimps
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   870
    [hypreal_less_def,hypreal_mult]));
9432
8b7aad2abcc9 avoid referencing thy value;
wenzelm
parents: 9391
diff changeset
   871
by (ultra_tac (claset() addIs [rename_numerals real_mult_order],
9071
paulson
parents: 9055
diff changeset
   872
	       simpset()) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   873
qed "hypreal_mult_order";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   874
****)
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   875
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   876
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   877
(*---------------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   878
                         Trichotomy of the hyperreals
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   879
  --------------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   880
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   881
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
   882
by (res_inst_tac [("x","%n. #0")] exI 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   883
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   884
by (auto_tac (claset() addSIs [FreeUltrafilterNat_Nat_set],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   885
qed "lemma_hyprel_0r_mem";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   886
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   887
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
   888
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   889
by (auto_tac (claset(),simpset() addsimps [hypreal_less_def]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   890
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
   891
by (dres_inst_tac [("x","xa")] spec 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   892
by (dres_inst_tac [("x","x")] spec 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   893
by (cut_inst_tac [("x","x")] lemma_hyprel_refl 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   894
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   895
by (dres_inst_tac [("x","x")] spec 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   896
by (dres_inst_tac [("x","xa")] spec 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   897
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   898
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   899
by (auto_tac (claset() addIs [real_linear_less2],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   900
qed "hypreal_trichotomy";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   901
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   902
val prems = Goal "[| (0::hypreal) < x ==> P; \
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   903
\                 x = 0 ==> P; \
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   904
\                 x < 0 ==> P |] ==> P";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   905
by (cut_inst_tac [("x","x")] hypreal_trichotomy 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   906
by (REPEAT (eresolve_tac (disjE::prems) 1));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   907
qed "hypreal_trichotomyE";
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
(*----------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   910
            More properties of <
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   911
 ----------------------------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   912
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   913
Goal "((x::hypreal) < y) = (0 < y + -x)";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   914
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   915
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   916
by (auto_tac (claset(),simpset() addsimps [hypreal_add,
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   917
    hypreal_zero_def,hypreal_minus,hypreal_less]));
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   918
by (ALLGOALS(Ultra_tac));
7218
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
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   921
Goal "((x::hypreal) < y) = (x + -y < 0)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   922
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   923
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   924
by (auto_tac (claset(),simpset() addsimps [hypreal_add,
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   925
    hypreal_zero_def,hypreal_minus,hypreal_less]));
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   926
by (ALLGOALS(Ultra_tac));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   927
qed "hypreal_less_minus_iff2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   928
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   929
Goal "((x::hypreal) = y) = (0 = x + - y)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   930
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   931
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
   932
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   933
qed "hypreal_eq_minus_iff"; 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   934
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   935
Goal "((x::hypreal) = y) = (0 = y + - x)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   936
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   937
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
   938
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   939
qed "hypreal_eq_minus_iff2"; 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   940
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   941
(* 07/00 *)
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   942
Goal "(0::hypreal) - x = -x";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   943
by (simp_tac (simpset() addsimps [hypreal_diff_def]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   944
qed "hypreal_diff_zero";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   945
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   946
Goal "x - (0::hypreal) = x";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   947
by (simp_tac (simpset() addsimps [hypreal_diff_def]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   948
qed "hypreal_diff_zero_right";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   949
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   950
Goal "x - x = (0::hypreal)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   951
by (simp_tac (simpset() addsimps [hypreal_diff_def]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   952
qed "hypreal_diff_self";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   953
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   954
Addsimps [hypreal_diff_zero, hypreal_diff_zero_right, hypreal_diff_self];
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   955
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   956
Goal "(x = y + z) = (x + -z = (y::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   957
by (auto_tac (claset(),simpset() addsimps [hypreal_add_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   958
qed "hypreal_eq_minus_iff3";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   959
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   960
Goal "(x = z + y) = (x + -z = (y::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   961
by (auto_tac (claset(),simpset() addsimps hypreal_add_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   962
qed "hypreal_eq_minus_iff4";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   963
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
   964
Goal "(x ~= a) = (x + -a ~= (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   965
by (auto_tac (claset() addDs [sym RS 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   966
    (hypreal_eq_minus_iff RS iffD2)],simpset())); 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   967
qed "hypreal_not_eq_minus_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   968
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   969
(*** linearity ***)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   970
Goal "(x::hypreal) < y | x = y | y < x";
7322
d16d7ddcc842 isatool expandshort;
wenzelm
parents: 7218
diff changeset
   971
by (stac hypreal_eq_minus_iff2 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   972
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
   973
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
   974
by (rtac hypreal_trichotomyE 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";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   977
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   978
Goal "((w::hypreal) ~= z) = (w<z | z<w)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   979
by (cut_facts_tac [hypreal_linear] 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   980
by (Blast_tac 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   981
qed "hypreal_neq_iff";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
   982
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   983
Goal "!!(x::hypreal). [| x < y ==> P;  x = y ==> P; \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   984
\          y < x ==> P |] ==> P";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   985
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
   986
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   987
qed "hypreal_linear_less2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   988
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   989
(*------------------------------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   990
                            Properties of <=
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
(*------ hypreal le iff reals le a.e ------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   993
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   994
Goalw [hypreal_le_def,real_le_def]
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   995
      "(Abs_hypreal(hyprel^^{%n. X n}) <= \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   996
\           Abs_hypreal(hyprel^^{%n. Y n})) = \
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   997
\      ({n. X n <= Y n} : FreeUltrafilterNat)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   998
by (auto_tac (claset(),simpset() addsimps [hypreal_less]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
   999
by (ALLGOALS(Ultra_tac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1000
qed "hypreal_le";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1001
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
(*---------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1004
Goalw [hypreal_le_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1005
     "~(w < z) ==> z <= (w::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1006
by (assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1007
qed "hypreal_leI";
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] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1010
      "z<=w ==> ~(w<(z::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1011
by (assume_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1012
qed "hypreal_leD";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1013
9108
9fff97d29837 bind_thm(s);
wenzelm
parents: 9071
diff changeset
  1014
bind_thm ("hypreal_leE", make_elim hypreal_leD);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1015
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1016
Goal "(~(w < z)) = (z <= (w::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1017
by (fast_tac (claset() addSIs [hypreal_leI,hypreal_leD]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1018
qed "hypreal_less_le_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1019
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1020
Goalw [hypreal_le_def] "~ z <= w ==> w<(z::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1021
by (Fast_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1022
qed "not_hypreal_leE";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1023
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1024
Goalw [hypreal_le_def] "z < w ==> z <= (w::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1025
by (fast_tac (claset() addEs [hypreal_less_asym]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1026
qed "hypreal_less_imp_le";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1027
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1028
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
  1029
by (cut_facts_tac [hypreal_linear] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1030
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
  1031
qed "hypreal_le_imp_less_or_eq";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1032
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1033
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
  1034
by (cut_facts_tac [hypreal_linear] 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1035
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
  1036
qed "hypreal_less_or_eq_imp_le";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1037
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1038
Goal "(x <= (y::hypreal)) = (x < y | x=y)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1039
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
  1040
qed "hypreal_le_eq_less_or_eq";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1041
val hypreal_le_less = hypreal_le_eq_less_or_eq;
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1042
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1043
Goal "w <= (w::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1044
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
  1045
qed "hypreal_le_refl";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1046
Addsimps [hypreal_le_refl];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1047
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1048
(* Axiom 'linorder_linear' of class 'linorder': *)
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1049
Goal "(z::hypreal) <= w | w <= z";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1050
by (simp_tac (simpset() addsimps [hypreal_le_less]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1051
by (cut_facts_tac [hypreal_linear] 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1052
by (Blast_tac 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1053
qed "hypreal_le_linear";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1054
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1055
Goal "[| i <= j; j < k |] ==> i < (k::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1056
by (dtac hypreal_le_imp_less_or_eq 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1057
by (fast_tac (claset() addIs [hypreal_less_trans]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1058
qed "hypreal_le_less_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1059
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1060
Goal "!! (i::hypreal). [| i < j; j <= k |] ==> i < k";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1061
by (dtac hypreal_le_imp_less_or_eq 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1062
by (fast_tac (claset() addIs [hypreal_less_trans]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1063
qed "hypreal_less_le_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1064
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1065
Goal "[| i <= j; j <= k |] ==> i <= (k::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1066
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
  1067
            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
  1068
qed "hypreal_le_trans";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1069
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1070
Goal "[| z <= w; w <= z |] ==> z = (w::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1071
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
  1072
            fast_tac (claset() addEs [hypreal_less_irrefl,hypreal_less_asym])]);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1073
qed "hypreal_le_anti_sym";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1074
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1075
Goal "[| ~ y < x; y ~= x |] ==> x < (y::hypreal)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1076
by (rtac not_hypreal_leE 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1077
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
  1078
qed "not_less_not_eq_hypreal_less";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1079
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1080
(* Axiom 'order_less_le' of class 'order': *)
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1081
Goal "(w::hypreal) < z = (w <= z & w ~= z)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1082
by (simp_tac (simpset() addsimps [hypreal_le_def, hypreal_neq_iff]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1083
by (blast_tac (claset() addIs [hypreal_less_asym]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1084
qed "hypreal_less_le";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1085
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1086
Goal "(0 < -R) = (R < (0::hypreal))";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1087
by (res_inst_tac [("z","R")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1088
by (auto_tac (claset(),simpset() addsimps [hypreal_zero_def,
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1089
    hypreal_less,hypreal_minus]));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1090
qed "hypreal_minus_zero_less_iff";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1091
Addsimps [hypreal_minus_zero_less_iff];
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1092
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1093
Goal "(-R < 0) = ((0::hypreal) < R)";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1094
by (res_inst_tac [("z","R")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1095
by (auto_tac (claset(),simpset() addsimps [hypreal_zero_def,
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1096
    hypreal_less,hypreal_minus]));
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1097
by (ALLGOALS(Ultra_tac));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1098
qed "hypreal_minus_zero_less_iff2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1099
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1100
Goalw [hypreal_le_def] "((0::hypreal) <= -r) = (r <= (0::hypreal))";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1101
by (simp_tac (simpset() addsimps 
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1102
    [hypreal_minus_zero_less_iff2]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1103
qed "hypreal_minus_zero_le_iff";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1104
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1105
(*----------------------------------------------------------
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1106
  hypreal_of_real preserves field and order properties
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1107
 -----------------------------------------------------------*)
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1108
Goalw [hypreal_of_real_def] 
9071
paulson
parents: 9055
diff changeset
  1109
     "hypreal_of_real (z1 + z2) = \
paulson
parents: 9055
diff changeset
  1110
\     hypreal_of_real z1 + hypreal_of_real z2";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1111
by (asm_simp_tac (simpset() addsimps [hypreal_add,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1112
       hypreal_add_mult_distrib]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1113
qed "hypreal_of_real_add";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1114
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1115
Goalw [hypreal_of_real_def] 
9071
paulson
parents: 9055
diff changeset
  1116
     "hypreal_of_real (z1 * z2) = hypreal_of_real z1 * hypreal_of_real z2";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1117
by (full_simp_tac (simpset() addsimps [hypreal_mult,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1118
        hypreal_add_mult_distrib2]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1119
qed "hypreal_of_real_mult";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1120
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1121
Goalw [hypreal_less_def,hypreal_of_real_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1122
            "(z1 < z2) = (hypreal_of_real z1 <  hypreal_of_real z2)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1123
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1124
by (res_inst_tac [("x","%n. z1")] exI 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1125
by (Step_tac 1); 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1126
by (res_inst_tac [("x","%n. z2")] exI 2);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1127
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1128
by (rtac FreeUltrafilterNat_P 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1129
by (Ultra_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1130
qed "hypreal_of_real_less_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1131
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1132
Addsimps [hypreal_of_real_less_iff RS sym];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1133
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1134
Goalw [hypreal_le_def,real_le_def] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1135
            "(z1 <= z2) = (hypreal_of_real z1 <=  hypreal_of_real z2)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1136
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1137
qed "hypreal_of_real_le_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1138
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1139
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
  1140
by (auto_tac (claset(),simpset() addsimps [hypreal_minus]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1141
qed "hypreal_of_real_minus";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1142
9013
9dd0274f76af Updated files to remove 0r and 1r from theorems in descendant theories
fleuriot
parents: 8856
diff changeset
  1143
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
  1144
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1145
qed "hypreal_of_real_one";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1146
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1147
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
  1148
by (Step_tac 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1149
qed "hypreal_of_real_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1150
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1151
Goal "(hypreal_of_real  r = 0) = (r = #0)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1152
by (auto_tac (claset() addIs [FreeUltrafilterNat_P],
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1153
    simpset() addsimps [hypreal_of_real_def,
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1154
    hypreal_zero_def,FreeUltrafilterNat_Nat_set]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1155
qed "hypreal_of_real_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1156
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1157
Goal "(hypreal_of_real  r ~= 0) = (r ~= #0)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1158
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
  1159
qed "hypreal_of_real_not_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1160
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1161
Goal "r ~= #0 ==> inverse (hypreal_of_real r) = \
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1162
\          hypreal_of_real (inverse r)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1163
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
  1164
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
  1165
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
  1166
by (auto_tac (claset(),simpset() addsimps [hypreal_of_real_mult RS sym,hypreal_of_real_one]));
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1167
qed "hypreal_of_real_inverse";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1168
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1169
Goal "hypreal_of_real r ~= 0 ==> inverse (hypreal_of_real r) = \
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1170
\          hypreal_of_real (inverse r)";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1171
by (etac (hypreal_of_real_not_zero_iff RS iffD1 RS hypreal_of_real_inverse) 1);
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1172
qed "hypreal_of_real_inverse2";
7218
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 "x+x=x*(1hr+1hr)";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1175
by (simp_tac (simpset() addsimps [hypreal_add_mult_distrib2]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1176
qed "hypreal_add_self";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1177
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1178
Goal "(z::hypreal) ~= 0 ==> x*y = (x*inverse(z))*(z*y)";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1179
by (asm_simp_tac (simpset() addsimps hypreal_mult_ac)  1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1180
qed "lemma_chain";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1181
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1182
Goal "[|(x::hypreal) ~= 0; y ~= 0 |] ==> \
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1183
\                   inverse(x) + inverse(y) = (x + y)*inverse(x*y)";
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1184
by (asm_full_simp_tac (simpset() addsimps [hypreal_inverse_distrib,
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1185
             hypreal_add_mult_distrib,hypreal_mult_assoc RS sym]) 1);
7322
d16d7ddcc842 isatool expandshort;
wenzelm
parents: 7218
diff changeset
  1186
by (stac hypreal_mult_assoc 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1187
by (rtac (hypreal_mult_left_commute RS subst) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1188
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 1);
10607
352f6f209775 converted rinv and hrinv to inverse;
bauerg
parents: 10043
diff changeset
  1189
qed "hypreal_inverse_add";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1190
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1191
Goal "x = -x ==> x = (0::hypreal)";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1192
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1193
by (auto_tac (claset(),simpset() addsimps [hypreal_minus,
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1194
    hypreal_zero_def]));
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1195
by (Ultra_tac 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1196
qed "hypreal_self_eq_minus_self_zero";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1197
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1198
Goal "(x + x = 0) = (x = (0::hypreal))";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1199
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1200
by (auto_tac (claset(),simpset() addsimps [hypreal_add,
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1201
    hypreal_zero_def]));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1202
qed "hypreal_add_self_zero_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1203
Addsimps [hypreal_add_self_zero_cancel];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1204
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1205
Goal "(x + x + y = y) = (x = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1206
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1207
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
  1208
by (auto_tac (claset(),simpset() addsimps [hypreal_add_assoc]));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1209
qed "hypreal_add_self_zero_cancel2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1210
Addsimps [hypreal_add_self_zero_cancel2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1211
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1212
Goal "(x + (x + y) = y) = (x = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1213
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
  1214
qed "hypreal_add_self_zero_cancel2a";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1215
Addsimps [hypreal_add_self_zero_cancel2a];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1216
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1217
Goal "(b = -a) = (-b = (a::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1218
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1219
qed "hypreal_minus_eq_swap";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1220
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1221
Goal "(-b = -a) = (b = (a::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1222
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1223
    [hypreal_minus_eq_swap]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1224
qed "hypreal_minus_eq_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1225
Addsimps [hypreal_minus_eq_cancel];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1226
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1227
Goal "x < x + 1hr";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1228
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1229
by (auto_tac (claset(),simpset() addsimps [hypreal_add,
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1230
    hypreal_one_def,hypreal_less]));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1231
qed "hypreal_less_self_add_one";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1232
Addsimps [hypreal_less_self_add_one];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1233
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1234
Goal "((x::hypreal) + x = y + y) = (x = y)";
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1235
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1236
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1237
by (auto_tac (claset(),simpset() addsimps [hypreal_add]));
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1238
by (ALLGOALS(Ultra_tac));
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1239
qed "hypreal_add_self_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1240
Addsimps [hypreal_add_self_cancel];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1241
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1242
Goal "(y = x + - y + x) = (y = (x::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1243
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1244
by (dres_inst_tac [("x1","y")] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1245
    (hypreal_add_right_cancel RS iffD2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1246
by (auto_tac (claset(),simpset() addsimps hypreal_add_ac));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1247
qed "hypreal_add_self_minus_cancel";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1248
Addsimps [hypreal_add_self_minus_cancel];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1249
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1250
Goal "(y = x + (- y + x)) = (y = (x::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1251
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1252
         [hypreal_add_assoc RS sym])1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1253
qed "hypreal_add_self_minus_cancel2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1254
Addsimps [hypreal_add_self_minus_cancel2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1255
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1256
(* of course, can prove this by "transfer" as well *)
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1257
Goal "z + -x = y + (y + (-x + -z)) = (y = (z::hypreal))";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1258
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1259
by (dres_inst_tac [("x1","z")] 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1260
    (hypreal_add_right_cancel RS iffD2) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1261
by (asm_full_simp_tac (simpset() addsimps 
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1262
    [hypreal_minus_add_distrib RS sym] @ hypreal_add_ac
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1263
    delsimps [hypreal_minus_add_distrib]) 1);
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1264
by (asm_full_simp_tac (simpset() addsimps 
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1265
     [hypreal_add_assoc RS sym,hypreal_add_right_cancel]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1266
qed "hypreal_add_self_minus_cancel3";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1267
Addsimps [hypreal_add_self_minus_cancel3];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1268
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1269
Goal "(x * x = 0) = (x = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1270
by Auto_tac;
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1271
by (blast_tac (claset() addIs [hypreal_mult_not_0E]) 1);
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1272
qed "hypreal_mult_self_eq_zero_iff";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1273
Addsimps [hypreal_mult_self_eq_zero_iff];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1274
9055
f020e00c6304 replacing 0hr by (0::hypreal)
paulson
parents: 9043
diff changeset
  1275
Goal "(0 = x * x) = (x = (0::hypreal))";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1276
by (auto_tac (claset() addDs [sym],simpset()));
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1277
qed "hypreal_mult_self_eq_zero_iff2";
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1278
Addsimps [hypreal_mult_self_eq_zero_iff2];
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1279
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1280
Goalw [hypreal_diff_def] "(x<y) = (x-y < (0::hypreal))";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1281
by (rtac hypreal_less_minus_iff2 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1282
qed "hypreal_less_eq_diff";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1283
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1284
(*** Subtraction laws ***)
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1285
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1286
Goal "x + (y - z) = (x + y) - (z::hypreal)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1287
by (simp_tac (simpset() addsimps hypreal_diff_def::hypreal_add_ac) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1288
qed "hypreal_add_diff_eq";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1289
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1290
Goal "(x - y) + z = (x + z) - (y::hypreal)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1291
by (simp_tac (simpset() addsimps hypreal_diff_def::hypreal_add_ac) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1292
qed "hypreal_diff_add_eq";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1293
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1294
Goal "(x - y) - z = x - (y + (z::hypreal))";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1295
by (simp_tac (simpset() addsimps hypreal_diff_def::hypreal_add_ac) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1296
qed "hypreal_diff_diff_eq";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1297
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1298
Goal "x - (y - z) = (x + z) - (y::hypreal)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1299
by (simp_tac (simpset() addsimps hypreal_diff_def::hypreal_add_ac) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1300
qed "hypreal_diff_diff_eq2";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1301
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1302
Goal "(x-y < z) = (x < z + (y::hypreal))";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1303
by (stac hypreal_less_eq_diff 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1304
by (res_inst_tac [("y1", "z")] (hypreal_less_eq_diff RS ssubst) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1305
by (simp_tac (simpset() addsimps hypreal_diff_def::hypreal_add_ac) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1306
qed "hypreal_diff_less_eq";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1307
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1308
Goal "(x < z-y) = (x + (y::hypreal) < z)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1309
by (stac hypreal_less_eq_diff 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1310
by (res_inst_tac [("y1", "z-y")] (hypreal_less_eq_diff RS ssubst) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1311
by (simp_tac (simpset() addsimps hypreal_diff_def::hypreal_add_ac) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1312
qed "hypreal_less_diff_eq";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1313
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1314
Goalw [hypreal_le_def] "(x-y <= z) = (x <= z + (y::hypreal))";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1315
by (simp_tac (simpset() addsimps [hypreal_less_diff_eq]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1316
qed "hypreal_diff_le_eq";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1317
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1318
Goalw [hypreal_le_def] "(x <= z-y) = (x + (y::hypreal) <= z)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1319
by (simp_tac (simpset() addsimps [hypreal_diff_less_eq]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1320
qed "hypreal_le_diff_eq";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1321
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1322
Goalw [hypreal_diff_def] "(x-y = z) = (x = z + (y::hypreal))";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1323
by (auto_tac (claset(), simpset() addsimps [hypreal_add_assoc]));
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1324
qed "hypreal_diff_eq_eq";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1325
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1326
Goalw [hypreal_diff_def] "(x = z-y) = (x + (y::hypreal) = z)";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1327
by (auto_tac (claset(), simpset() addsimps [hypreal_add_assoc]));
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1328
qed "hypreal_eq_diff_eq";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1329
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1330
(*This list of rewrites simplifies (in)equalities by bringing subtractions
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1331
  to the top and then moving negative terms to the other side.  
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1332
  Use with hypreal_add_ac*)
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1333
val hypreal_compare_rls = 
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1334
  [symmetric hypreal_diff_def,
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1335
   hypreal_add_diff_eq, hypreal_diff_add_eq, hypreal_diff_diff_eq, hypreal_diff_diff_eq2, 
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1336
   hypreal_diff_less_eq, hypreal_less_diff_eq, hypreal_diff_le_eq, hypreal_le_diff_eq, 
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1337
   hypreal_diff_eq_eq, hypreal_eq_diff_eq];
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1338
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1339
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1340
(** For the cancellation simproc.
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1341
    The idea is to cancel like terms on opposite sides by subtraction **)
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1342
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1343
Goal "(x::hypreal) - y = x' - y' ==> (x<y) = (x'<y')";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1344
by (stac hypreal_less_eq_diff 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1345
by (res_inst_tac [("y1", "y")] (hypreal_less_eq_diff RS ssubst) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1346
by (Asm_simp_tac 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1347
qed "hypreal_less_eqI";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1348
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1349
Goal "(x::hypreal) - y = x' - y' ==> (y<=x) = (y'<=x')";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1350
by (dtac hypreal_less_eqI 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1351
by (asm_simp_tac (simpset() addsimps [hypreal_le_def]) 1);
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1352
qed "hypreal_le_eqI";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1353
10043
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1354
Goal "(x::hypreal) - y = x' - y' ==> (x=y) = (x'=y')";
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1355
by Safe_tac;
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1356
by (ALLGOALS
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1357
    (asm_full_simp_tac
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1358
     (simpset() addsimps [hypreal_eq_diff_eq, hypreal_diff_eq_eq])));
a0364652e115 Updated Files with new theorems
fleuriot
parents: 9969
diff changeset
  1359
qed "hypreal_eq_eqI";
7218
bfa767b4dc51 new theory Real/Hyperreal/HyperDef and file fuf.ML
paulson
parents:
diff changeset
  1360