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