src/HOL/Complex/NSComplex.thy
author paulson
Tue Jan 13 10:37:52 2004 +0100 (2004-01-13)
changeset 14354 988aa4648597
parent 14341 a09441bd4f1e
child 14370 b0064703967b
permissions -rw-r--r--
types complex and hcomplex are now instances of class ringpower:
omitting redundant lemmas
paulson@13957
     1
(*  Title:       NSComplex.thy
paulson@13957
     2
    Author:      Jacques D. Fleuriot
paulson@13957
     3
    Copyright:   2001  University of Edinburgh
paulson@13957
     4
    Description: Nonstandard Complex numbers
paulson@13957
     5
*)
paulson@13957
     6
paulson@14314
     7
theory NSComplex = NSInduct:
paulson@13957
     8
paulson@14318
     9
(* Move to one of the hyperreal theories *)
paulson@14318
    10
lemma hypreal_of_nat: "hypreal_of_nat m = Abs_hypreal(hyprel `` {%n. real m})"
paulson@14318
    11
apply (induct_tac "m")
paulson@14318
    12
apply (auto simp add: hypreal_zero_def hypreal_of_nat_Suc hypreal_zero_num hypreal_one_num hypreal_add real_of_nat_Suc)
paulson@14318
    13
done
paulson@14318
    14
paulson@14335
    15
(* not proved already? strange! *)
paulson@14335
    16
lemma hypreal_of_nat_le_iff:
paulson@14354
    17
      "(hypreal_of_nat n \<le> hypreal_of_nat m) = (n \<le> m)"
paulson@14335
    18
apply (unfold hypreal_le_def)
paulson@14335
    19
apply auto
paulson@14335
    20
done
paulson@14335
    21
declare hypreal_of_nat_le_iff [simp]
paulson@14335
    22
paulson@14354
    23
lemma hypreal_of_nat_ge_zero: "0 \<le> hypreal_of_nat n"
paulson@14335
    24
apply (simp (no_asm) add: hypreal_of_nat_zero [symmetric] 
paulson@14335
    25
         del: hypreal_of_nat_zero)
paulson@14335
    26
done
paulson@14335
    27
declare hypreal_of_nat_ge_zero [simp]
paulson@14335
    28
paulson@14335
    29
declare hypreal_of_nat_ge_zero [THEN hrabs_eqI1, simp]
paulson@14335
    30
paulson@14354
    31
lemma hypreal_of_hypnat_ge_zero: "0 \<le> hypreal_of_hypnat n"
paulson@14335
    32
apply (rule_tac z = "n" in eq_Abs_hypnat)
paulson@14335
    33
apply (simp (no_asm_simp) add: hypreal_of_hypnat hypreal_zero_num hypreal_le)
paulson@14335
    34
done
paulson@14335
    35
declare hypreal_of_hypnat_ge_zero [simp]
paulson@14335
    36
declare hypreal_of_hypnat_ge_zero [THEN hrabs_eqI1, simp]
paulson@14335
    37
paulson@13957
    38
constdefs
paulson@13957
    39
    hcomplexrel :: "((nat=>complex)*(nat=>complex)) set"
paulson@14354
    40
    "hcomplexrel == {p. \<exists>X Y. p = ((X::nat=>complex),Y) &
paulson@13957
    41
                        {n::nat. X(n) = Y(n)}: FreeUltrafilterNat}"
paulson@13957
    42
paulson@14314
    43
typedef hcomplex = "{x::nat=>complex. True}//hcomplexrel"
paulson@14314
    44
  by (auto simp add: quotient_def)
paulson@13957
    45
paulson@14314
    46
instance hcomplex :: zero ..
paulson@14314
    47
instance hcomplex :: one ..
paulson@14314
    48
instance hcomplex :: plus ..
paulson@14314
    49
instance hcomplex :: times ..
paulson@14314
    50
instance hcomplex :: minus ..
paulson@14314
    51
instance hcomplex :: inverse ..
paulson@14314
    52
instance hcomplex :: power ..
paulson@14314
    53
paulson@14314
    54
defs (overloaded)
paulson@14314
    55
  hcomplex_zero_def:
paulson@13957
    56
  "0 == Abs_hcomplex(hcomplexrel `` {%n. (0::complex)})"
paulson@14314
    57
paulson@14314
    58
  hcomplex_one_def:
paulson@13957
    59
  "1 == Abs_hcomplex(hcomplexrel `` {%n. (1::complex)})"
paulson@13957
    60
paulson@13957
    61
paulson@14314
    62
  hcomplex_minus_def:
paulson@14314
    63
  "- z == Abs_hcomplex(UN X: Rep_hcomplex(z).
paulson@14314
    64
                       hcomplexrel `` {%n::nat. - (X n)})"
paulson@13957
    65
paulson@14314
    66
  hcomplex_diff_def:
paulson@13957
    67
  "w - z == w + -(z::hcomplex)"
paulson@14314
    68
paulson@13957
    69
constdefs
paulson@13957
    70
paulson@14314
    71
  hcomplex_of_complex :: "complex => hcomplex"
paulson@13957
    72
  "hcomplex_of_complex z == Abs_hcomplex(hcomplexrel `` {%n. z})"
paulson@14314
    73
paulson@14314
    74
  hcinv  :: "hcomplex => hcomplex"
paulson@14314
    75
  "inverse(P)   == Abs_hcomplex(UN X: Rep_hcomplex(P).
paulson@13957
    76
                    hcomplexrel `` {%n. inverse(X n)})"
paulson@13957
    77
paulson@13957
    78
  (*--- real and Imaginary parts ---*)
paulson@14314
    79
paulson@14314
    80
  hRe :: "hcomplex => hypreal"
paulson@13957
    81
  "hRe(z) == Abs_hypreal(UN X:Rep_hcomplex(z). hyprel `` {%n. Re (X n)})"
paulson@13957
    82
paulson@14314
    83
  hIm :: "hcomplex => hypreal"
paulson@14314
    84
  "hIm(z) == Abs_hypreal(UN X:Rep_hcomplex(z). hyprel `` {%n. Im (X n)})"
paulson@13957
    85
paulson@13957
    86
paulson@13957
    87
  (*----------- modulus ------------*)
paulson@13957
    88
paulson@14314
    89
  hcmod :: "hcomplex => hypreal"
paulson@13957
    90
  "hcmod z == Abs_hypreal(UN X: Rep_hcomplex(z).
paulson@13957
    91
			  hyprel `` {%n. cmod (X n)})"
paulson@13957
    92
paulson@14314
    93
  (*------ imaginary unit ----------*)
paulson@14314
    94
paulson@14314
    95
  iii :: hcomplex
paulson@13957
    96
  "iii == Abs_hcomplex(hcomplexrel `` {%n. ii})"
paulson@13957
    97
paulson@13957
    98
  (*------- complex conjugate ------*)
paulson@13957
    99
paulson@14314
   100
  hcnj :: "hcomplex => hcomplex"
paulson@13957
   101
  "hcnj z == Abs_hcomplex(UN X:Rep_hcomplex(z). hcomplexrel `` {%n. cnj (X n)})"
paulson@13957
   102
paulson@14314
   103
  (*------------ Argand -------------*)
paulson@13957
   104
paulson@14314
   105
  hsgn :: "hcomplex => hcomplex"
paulson@13957
   106
  "hsgn z == Abs_hcomplex(UN X:Rep_hcomplex(z). hcomplexrel `` {%n. sgn(X n)})"
paulson@13957
   107
paulson@14314
   108
  harg :: "hcomplex => hypreal"
paulson@13957
   109
  "harg z == Abs_hypreal(UN X:Rep_hcomplex(z). hyprel `` {%n. arg(X n)})"
paulson@13957
   110
paulson@13957
   111
  (* abbreviation for (cos a + i sin a) *)
paulson@14314
   112
  hcis :: "hypreal => hcomplex"
paulson@13957
   113
  "hcis a == Abs_hcomplex(UN X:Rep_hypreal(a). hcomplexrel `` {%n. cis (X n)})"
paulson@13957
   114
paulson@13957
   115
  (* abbreviation for r*(cos a + i sin a) *)
paulson@14314
   116
  hrcis :: "[hypreal, hypreal] => hcomplex"
paulson@13957
   117
  "hrcis r a == hcomplex_of_hypreal r * hcis a"
paulson@13957
   118
paulson@14314
   119
  (*----- injection from hyperreals -----*)
paulson@14314
   120
paulson@14314
   121
  hcomplex_of_hypreal :: "hypreal => hcomplex"
paulson@13957
   122
  "hcomplex_of_hypreal r == Abs_hcomplex(UN X:Rep_hypreal(r).
paulson@13957
   123
			       hcomplexrel `` {%n. complex_of_real (X n)})"
paulson@13957
   124
paulson@13957
   125
  (*------------ e ^ (x + iy) ------------*)
paulson@13957
   126
paulson@14314
   127
  hexpi :: "hcomplex => hcomplex"
paulson@13957
   128
  "hexpi z == hcomplex_of_hypreal(( *f* exp) (hRe z)) * hcis (hIm z)"
paulson@14314
   129
paulson@13957
   130
paulson@14314
   131
defs (overloaded)
paulson@13957
   132
paulson@13957
   133
  (*----------- division ----------*)
paulson@13957
   134
paulson@14314
   135
  hcomplex_divide_def:
paulson@13957
   136
  "w / (z::hcomplex) == w * inverse z"
paulson@14314
   137
paulson@14314
   138
  hcomplex_add_def:
paulson@13957
   139
  "w + z == Abs_hcomplex(UN X:Rep_hcomplex(w). UN Y:Rep_hcomplex(z).
paulson@13957
   140
		      hcomplexrel `` {%n. X n + Y n})"
paulson@13957
   141
paulson@14314
   142
  hcomplex_mult_def:
paulson@13957
   143
  "w * z == Abs_hcomplex(UN X:Rep_hcomplex(w). UN Y:Rep_hcomplex(z).
paulson@14314
   144
		      hcomplexrel `` {%n. X n * Y n})"
paulson@13957
   145
paulson@13957
   146
paulson@13957
   147
paulson@13957
   148
consts
paulson@14314
   149
  "hcpow"  :: "[hcomplex,hypnat] => hcomplex"     (infixr 80)
paulson@13957
   150
paulson@13957
   151
defs
paulson@13957
   152
  (* hypernatural powers of nonstandard complex numbers *)
paulson@14314
   153
  hcpow_def:
paulson@14314
   154
  "(z::hcomplex) hcpow (n::hypnat)
paulson@13957
   155
      == Abs_hcomplex(UN X:Rep_hcomplex(z). UN Y: Rep_hypnat(n).
paulson@13957
   156
             hcomplexrel `` {%n. (X n) ^ (Y n)})"
paulson@13957
   157
paulson@14314
   158
paulson@14314
   159
lemma hcomplexrel_iff:
paulson@14314
   160
   "((X,Y): hcomplexrel) = ({n. X n = Y n}: FreeUltrafilterNat)"
paulson@14314
   161
apply (unfold hcomplexrel_def)
paulson@14314
   162
apply fast
paulson@14314
   163
done
paulson@14314
   164
paulson@14314
   165
lemma hcomplexrel_refl: "(x,x): hcomplexrel"
paulson@14314
   166
apply (simp add: hcomplexrel_iff) 
paulson@14314
   167
done
paulson@14314
   168
paulson@14314
   169
lemma hcomplexrel_sym: "(x,y): hcomplexrel ==> (y,x):hcomplexrel"
paulson@14314
   170
apply (auto simp add: hcomplexrel_iff eq_commute)
paulson@14314
   171
done
paulson@14314
   172
paulson@14314
   173
lemma hcomplexrel_trans:
paulson@14314
   174
      "[|(x,y): hcomplexrel; (y,z):hcomplexrel|] ==> (x,z):hcomplexrel"
paulson@14314
   175
apply (simp add: hcomplexrel_iff) 
paulson@14314
   176
apply ultra
paulson@14314
   177
done
paulson@14314
   178
paulson@14314
   179
lemma equiv_hcomplexrel: "equiv UNIV hcomplexrel"
paulson@14314
   180
apply (simp add: equiv_def refl_def sym_def trans_def hcomplexrel_refl) 
paulson@14314
   181
apply (blast intro: hcomplexrel_sym hcomplexrel_trans) 
paulson@14314
   182
done
paulson@14314
   183
paulson@14314
   184
lemmas equiv_hcomplexrel_iff =
paulson@14314
   185
    eq_equiv_class_iff [OF equiv_hcomplexrel UNIV_I UNIV_I, simp]
paulson@14314
   186
paulson@14314
   187
lemma hcomplexrel_in_hcomplex [simp]: "hcomplexrel``{x} : hcomplex"
paulson@14314
   188
apply (unfold hcomplex_def hcomplexrel_def quotient_def)
paulson@14314
   189
apply blast
paulson@14314
   190
done
paulson@14314
   191
paulson@14314
   192
lemma inj_on_Abs_hcomplex: "inj_on Abs_hcomplex hcomplex"
paulson@14314
   193
apply (rule inj_on_inverseI)
paulson@14314
   194
apply (erule Abs_hcomplex_inverse)
paulson@14314
   195
done
paulson@14314
   196
paulson@14314
   197
declare inj_on_Abs_hcomplex [THEN inj_on_iff, simp]
paulson@14314
   198
        Abs_hcomplex_inverse [simp]
paulson@14314
   199
paulson@14314
   200
declare equiv_hcomplexrel [THEN eq_equiv_class_iff, simp]
paulson@14314
   201
paulson@14314
   202
declare hcomplexrel_iff [iff]
paulson@14314
   203
paulson@14314
   204
lemma inj_Rep_hcomplex: "inj(Rep_hcomplex)"
paulson@14314
   205
apply (rule inj_on_inverseI)
paulson@14314
   206
apply (rule Rep_hcomplex_inverse)
paulson@14314
   207
done
paulson@14314
   208
paulson@14314
   209
lemma lemma_hcomplexrel_refl: "x: hcomplexrel `` {x}"
paulson@14314
   210
apply (unfold hcomplexrel_def)
paulson@14314
   211
apply (safe)
paulson@14314
   212
apply auto
paulson@14314
   213
done
paulson@14314
   214
declare lemma_hcomplexrel_refl [simp]
paulson@14314
   215
paulson@14354
   216
lemma hcomplex_empty_not_mem: "{} \<notin> hcomplex"
paulson@14314
   217
apply (unfold hcomplex_def)
paulson@14314
   218
apply (auto elim!: quotientE)
paulson@14314
   219
done
paulson@14314
   220
declare hcomplex_empty_not_mem [simp]
paulson@14314
   221
paulson@14354
   222
lemma Rep_hcomplex_nonempty: "Rep_hcomplex x \<noteq> {}"
paulson@14314
   223
apply (cut_tac x = "x" in Rep_hcomplex)
paulson@14314
   224
apply auto
paulson@14314
   225
done
paulson@14314
   226
declare Rep_hcomplex_nonempty [simp]
paulson@14314
   227
paulson@14314
   228
lemma eq_Abs_hcomplex:
paulson@14314
   229
    "(!!x. z = Abs_hcomplex(hcomplexrel `` {x}) ==> P) ==> P"
paulson@14314
   230
apply (rule_tac x1=z in Rep_hcomplex [unfolded hcomplex_def, THEN quotientE])
paulson@14314
   231
apply (drule_tac f = Abs_hcomplex in arg_cong)
paulson@14314
   232
apply (force simp add: Rep_hcomplex_inverse)
paulson@14314
   233
done
paulson@14314
   234
paulson@14314
   235
paulson@14314
   236
subsection{*Properties of Nonstandard Real and Imaginary Parts*}
paulson@14314
   237
paulson@14314
   238
lemma hRe:
paulson@14314
   239
     "hRe(Abs_hcomplex (hcomplexrel `` {X})) =
paulson@14314
   240
      Abs_hypreal(hyprel `` {%n. Re(X n)})"
paulson@14314
   241
apply (unfold hRe_def)
paulson@14314
   242
apply (rule_tac f = "Abs_hypreal" in arg_cong)
paulson@14314
   243
apply (auto , ultra)
paulson@14314
   244
done
paulson@14314
   245
paulson@14314
   246
lemma hIm:
paulson@14314
   247
     "hIm(Abs_hcomplex (hcomplexrel `` {X})) =
paulson@14314
   248
      Abs_hypreal(hyprel `` {%n. Im(X n)})"
paulson@14314
   249
apply (unfold hIm_def)
paulson@14314
   250
apply (rule_tac f = "Abs_hypreal" in arg_cong)
paulson@14314
   251
apply (auto , ultra)
paulson@14314
   252
done
paulson@14314
   253
paulson@14335
   254
lemma hcomplex_hRe_hIm_cancel_iff:
paulson@14335
   255
     "(w=z) = (hRe(w) = hRe(z) & hIm(w) = hIm(z))"
paulson@14314
   256
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   257
apply (rule_tac z = "w" in eq_Abs_hcomplex)
paulson@14314
   258
apply (auto simp add: hRe hIm complex_Re_Im_cancel_iff)
paulson@14314
   259
apply (ultra+)
paulson@14314
   260
done
paulson@14314
   261
paulson@14314
   262
lemma hcomplex_hRe_zero: "hRe 0 = 0"
paulson@14314
   263
apply (unfold hcomplex_zero_def)
paulson@14314
   264
apply (simp (no_asm) add: hRe hypreal_zero_num)
paulson@14314
   265
done
paulson@14314
   266
declare hcomplex_hRe_zero [simp]
paulson@14314
   267
paulson@14314
   268
lemma hcomplex_hIm_zero: "hIm 0 = 0"
paulson@14314
   269
apply (unfold hcomplex_zero_def)
paulson@14314
   270
apply (simp (no_asm) add: hIm hypreal_zero_num)
paulson@14314
   271
done
paulson@14314
   272
declare hcomplex_hIm_zero [simp]
paulson@14314
   273
paulson@14314
   274
lemma hcomplex_hRe_one: "hRe 1 = 1"
paulson@14314
   275
apply (unfold hcomplex_one_def)
paulson@14314
   276
apply (simp (no_asm) add: hRe hypreal_one_num)
paulson@14314
   277
done
paulson@14314
   278
declare hcomplex_hRe_one [simp]
paulson@14314
   279
paulson@14314
   280
lemma hcomplex_hIm_one: "hIm 1 = 0"
paulson@14314
   281
apply (unfold hcomplex_one_def)
paulson@14314
   282
apply (simp (no_asm) add: hIm hypreal_one_def hypreal_zero_num)
paulson@14314
   283
done
paulson@14314
   284
declare hcomplex_hIm_one [simp]
paulson@14314
   285
paulson@14314
   286
paulson@14354
   287
subsection{*Addition for Nonstandard Complex Numbers*}
paulson@14314
   288
paulson@14314
   289
lemma hcomplex_add_congruent2:
paulson@14314
   290
    "congruent2 hcomplexrel (%X Y. hcomplexrel `` {%n. X n + Y n})"
paulson@14314
   291
apply (unfold congruent2_def)
paulson@14314
   292
apply safe
paulson@14314
   293
apply (ultra+)
paulson@14314
   294
done
paulson@14314
   295
paulson@14314
   296
lemma hcomplex_add:
paulson@14314
   297
  "Abs_hcomplex(hcomplexrel``{%n. X n}) + Abs_hcomplex(hcomplexrel``{%n. Y n}) =
paulson@14314
   298
   Abs_hcomplex(hcomplexrel``{%n. X n + Y n})"
paulson@14314
   299
apply (unfold hcomplex_add_def)
paulson@14314
   300
apply (rule_tac f = "Abs_hcomplex" in arg_cong)
paulson@14335
   301
apply (auto, ultra)
paulson@14314
   302
done
paulson@14314
   303
paulson@14314
   304
lemma hcomplex_add_commute: "(z::hcomplex) + w = w + z"
paulson@14314
   305
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   306
apply (rule_tac z = "w" in eq_Abs_hcomplex)
paulson@14335
   307
apply (simp add: complex_add_commute hcomplex_add)
paulson@14314
   308
done
paulson@14314
   309
paulson@14314
   310
lemma hcomplex_add_assoc: "((z1::hcomplex) + z2) + z3 = z1 + (z2 + z3)"
paulson@14314
   311
apply (rule_tac z = "z1" in eq_Abs_hcomplex)
paulson@14314
   312
apply (rule_tac z = "z2" in eq_Abs_hcomplex)
paulson@14314
   313
apply (rule_tac z = "z3" in eq_Abs_hcomplex)
paulson@14335
   314
apply (simp add: hcomplex_add complex_add_assoc)
paulson@14314
   315
done
paulson@14314
   316
paulson@14314
   317
lemma hcomplex_add_zero_left: "(0::hcomplex) + z = z"
paulson@14314
   318
apply (unfold hcomplex_zero_def)
paulson@14314
   319
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   320
apply (simp add: hcomplex_add)
paulson@14314
   321
done
paulson@14314
   322
paulson@14314
   323
lemma hcomplex_add_zero_right: "z + (0::hcomplex) = z"
paulson@14335
   324
apply (simp add: hcomplex_add_zero_left hcomplex_add_commute)
paulson@14314
   325
done
paulson@14314
   326
paulson@14314
   327
lemma hRe_add: "hRe(x + y) = hRe(x) + hRe(y)"
paulson@14314
   328
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   329
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   330
apply (auto simp add: hRe hcomplex_add hypreal_add complex_Re_add)
paulson@14314
   331
done
paulson@14314
   332
paulson@14314
   333
lemma hIm_add: "hIm(x + y) = hIm(x) + hIm(y)"
paulson@14314
   334
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   335
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   336
apply (auto simp add: hIm hcomplex_add hypreal_add complex_Im_add)
paulson@14314
   337
done
paulson@14314
   338
paulson@14354
   339
paulson@14354
   340
subsection{*Additive Inverse on Nonstandard Complex Numbers*}
paulson@14314
   341
paulson@14314
   342
lemma hcomplex_minus_congruent:
paulson@14314
   343
  "congruent hcomplexrel (%X. hcomplexrel `` {%n. - (X n)})"
paulson@14314
   344
apply (unfold congruent_def)
paulson@14314
   345
apply safe
paulson@14314
   346
apply (ultra+)
paulson@14314
   347
done
paulson@14314
   348
paulson@14314
   349
lemma hcomplex_minus:
paulson@14314
   350
  "- (Abs_hcomplex(hcomplexrel `` {%n. X n})) =
paulson@14314
   351
      Abs_hcomplex(hcomplexrel `` {%n. -(X n)})"
paulson@14314
   352
apply (unfold hcomplex_minus_def)
paulson@14314
   353
apply (rule_tac f = "Abs_hcomplex" in arg_cong)
paulson@14335
   354
apply (auto, ultra)
paulson@14314
   355
done
paulson@14314
   356
paulson@14314
   357
lemma hcomplex_add_minus_left: "-z + z = (0::hcomplex)"
paulson@14314
   358
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   359
apply (auto simp add: hcomplex_add hcomplex_minus hcomplex_zero_def)
paulson@14314
   360
done
paulson@14335
   361
paulson@14314
   362
paulson@14314
   363
subsection{*Multiplication for Nonstandard Complex Numbers*}
paulson@14314
   364
paulson@14314
   365
lemma hcomplex_mult:
paulson@14335
   366
  "Abs_hcomplex(hcomplexrel``{%n. X n}) * 
paulson@14335
   367
     Abs_hcomplex(hcomplexrel``{%n. Y n}) =
paulson@14314
   368
   Abs_hcomplex(hcomplexrel``{%n. X n * Y n})"
paulson@14314
   369
apply (unfold hcomplex_mult_def)
paulson@14314
   370
apply (rule_tac f = "Abs_hcomplex" in arg_cong)
paulson@14335
   371
apply (auto, ultra)
paulson@14314
   372
done
paulson@14314
   373
paulson@14314
   374
lemma hcomplex_mult_commute: "(w::hcomplex) * z = z * w"
paulson@14314
   375
apply (rule_tac z = "w" in eq_Abs_hcomplex)
paulson@14314
   376
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   377
apply (auto simp add: hcomplex_mult complex_mult_commute)
paulson@14314
   378
done
paulson@14314
   379
paulson@14314
   380
lemma hcomplex_mult_assoc: "((u::hcomplex) * v) * w = u * (v * w)"
paulson@14314
   381
apply (rule_tac z = "u" in eq_Abs_hcomplex)
paulson@14314
   382
apply (rule_tac z = "v" in eq_Abs_hcomplex)
paulson@14314
   383
apply (rule_tac z = "w" in eq_Abs_hcomplex)
paulson@14314
   384
apply (auto simp add: hcomplex_mult complex_mult_assoc)
paulson@14314
   385
done
paulson@14314
   386
paulson@14314
   387
lemma hcomplex_mult_one_left: "(1::hcomplex) * z = z"
paulson@14314
   388
apply (unfold hcomplex_one_def)
paulson@14314
   389
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   390
apply (auto simp add: hcomplex_mult)
paulson@14314
   391
done
paulson@14314
   392
paulson@14314
   393
lemma hcomplex_mult_zero_left: "(0::hcomplex) * z = 0"
paulson@14314
   394
apply (unfold hcomplex_zero_def)
paulson@14314
   395
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   396
apply (auto simp add: hcomplex_mult)
paulson@14314
   397
done
paulson@14314
   398
paulson@14335
   399
lemma hcomplex_add_mult_distrib:
paulson@14335
   400
     "((z1::hcomplex) + z2) * w = (z1 * w) + (z2 * w)"
paulson@14314
   401
apply (rule_tac z = "z1" in eq_Abs_hcomplex)
paulson@14314
   402
apply (rule_tac z = "z2" in eq_Abs_hcomplex)
paulson@14314
   403
apply (rule_tac z = "w" in eq_Abs_hcomplex)
paulson@14314
   404
apply (auto simp add: hcomplex_mult hcomplex_add complex_add_mult_distrib)
paulson@14314
   405
done
paulson@14314
   406
paulson@14354
   407
lemma hcomplex_zero_not_eq_one: "(0::hcomplex) \<noteq> (1::hcomplex)"
paulson@14314
   408
apply (unfold hcomplex_zero_def hcomplex_one_def)
paulson@14314
   409
apply auto
paulson@14314
   410
done
paulson@14314
   411
declare hcomplex_zero_not_eq_one [simp]
paulson@14314
   412
declare hcomplex_zero_not_eq_one [THEN not_sym, simp]
paulson@14314
   413
paulson@14314
   414
paulson@14314
   415
subsection{*Inverse of Nonstandard Complex Number*}
paulson@14314
   416
paulson@14314
   417
lemma hcomplex_inverse:
paulson@14314
   418
  "inverse (Abs_hcomplex(hcomplexrel `` {%n. X n})) =
paulson@14314
   419
      Abs_hcomplex(hcomplexrel `` {%n. inverse (X n)})"
paulson@14314
   420
apply (unfold hcinv_def)
paulson@14314
   421
apply (rule_tac f = "Abs_hcomplex" in arg_cong)
paulson@14335
   422
apply (auto, ultra)
paulson@14314
   423
done
paulson@14314
   424
paulson@14314
   425
lemma hcomplex_mult_inv_left:
paulson@14354
   426
      "z \<noteq> (0::hcomplex) ==> inverse(z) * z = (1::hcomplex)"
paulson@14314
   427
apply (unfold hcomplex_zero_def hcomplex_one_def)
paulson@14314
   428
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   429
apply (auto simp add: hcomplex_inverse hcomplex_mult)
paulson@14314
   430
apply (ultra)
paulson@14314
   431
apply (rule ccontr)
paulson@14314
   432
apply (drule complex_mult_inv_left)
paulson@14314
   433
apply auto
paulson@14314
   434
done
paulson@14314
   435
paulson@14318
   436
subsection {* The Field of Nonstandard Complex Numbers *}
paulson@14318
   437
paulson@14318
   438
instance hcomplex :: field
paulson@14318
   439
proof
paulson@14318
   440
  fix z u v w :: hcomplex
paulson@14318
   441
  show "(u + v) + w = u + (v + w)"
paulson@14318
   442
    by (simp add: hcomplex_add_assoc)
paulson@14318
   443
  show "z + w = w + z"
paulson@14318
   444
    by (simp add: hcomplex_add_commute)
paulson@14318
   445
  show "0 + z = z"
paulson@14335
   446
    by (simp add: hcomplex_add_zero_left)
paulson@14318
   447
  show "-z + z = 0"
paulson@14335
   448
    by (simp add: hcomplex_add_minus_left)
paulson@14318
   449
  show "z - w = z + -w"
paulson@14318
   450
    by (simp add: hcomplex_diff_def)
paulson@14318
   451
  show "(u * v) * w = u * (v * w)"
paulson@14318
   452
    by (simp add: hcomplex_mult_assoc)
paulson@14318
   453
  show "z * w = w * z"
paulson@14318
   454
    by (simp add: hcomplex_mult_commute)
paulson@14318
   455
  show "1 * z = z"
paulson@14335
   456
    by (simp add: hcomplex_mult_one_left)
paulson@14318
   457
  show "0 \<noteq> (1::hcomplex)"
paulson@14318
   458
    by (rule hcomplex_zero_not_eq_one)
paulson@14318
   459
  show "(u + v) * w = u * w + v * w"
paulson@14318
   460
    by (simp add: hcomplex_add_mult_distrib)
paulson@14341
   461
  show "z+u = z+v ==> u=v"
paulson@14341
   462
    proof -
paulson@14341
   463
      assume eq: "z+u = z+v" 
paulson@14341
   464
      hence "(-z + z) + u = (-z + z) + v" by (simp only: eq hcomplex_add_assoc)
paulson@14341
   465
      thus "u = v" 
paulson@14341
   466
        by (simp only: hcomplex_add_minus_left hcomplex_add_zero_left)
paulson@14341
   467
    qed
paulson@14318
   468
  assume neq: "w \<noteq> 0"
paulson@14318
   469
  thus "z / w = z * inverse w"
paulson@14318
   470
    by (simp add: hcomplex_divide_def)
paulson@14318
   471
  show "inverse w * w = 1"
paulson@14318
   472
    by (rule hcomplex_mult_inv_left)
paulson@14318
   473
qed
paulson@14318
   474
paulson@14318
   475
lemma HCOMPLEX_INVERSE_ZERO: "inverse (0::hcomplex) = 0"
paulson@14335
   476
apply (simp add:  hcomplex_zero_def hcomplex_inverse)
paulson@14314
   477
done
paulson@14318
   478
paulson@14318
   479
lemma HCOMPLEX_DIVISION_BY_ZERO: "a / (0::hcomplex) = 0"
paulson@14335
   480
apply (simp add: hcomplex_divide_def HCOMPLEX_INVERSE_ZERO)
paulson@14318
   481
done
paulson@14318
   482
paulson@14318
   483
instance hcomplex :: division_by_zero
paulson@14318
   484
proof
paulson@14318
   485
  fix x :: hcomplex
paulson@14318
   486
  show "inverse 0 = (0::hcomplex)" by (rule HCOMPLEX_INVERSE_ZERO)
paulson@14318
   487
  show "x/0 = 0" by (rule HCOMPLEX_DIVISION_BY_ZERO) 
paulson@14318
   488
qed
paulson@14314
   489
paulson@14318
   490
subsection{*More Minus Laws*}
paulson@14318
   491
paulson@14318
   492
lemma inj_hcomplex_minus: "inj(%z::hcomplex. -z)"
paulson@14318
   493
apply (rule inj_onI)
paulson@14318
   494
apply (drule_tac f = "uminus" in arg_cong)
paulson@14318
   495
apply simp
paulson@14318
   496
done
paulson@14318
   497
paulson@14318
   498
lemma hRe_minus: "hRe(-z) = - hRe(z)"
paulson@14318
   499
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14318
   500
apply (auto simp add: hRe hcomplex_minus hypreal_minus complex_Re_minus)
paulson@14318
   501
done
paulson@14318
   502
paulson@14318
   503
lemma hIm_minus: "hIm(-z) = - hIm(z)"
paulson@14318
   504
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14318
   505
apply (auto simp add: hIm hcomplex_minus hypreal_minus complex_Im_minus)
paulson@14318
   506
done
paulson@14318
   507
paulson@14318
   508
lemma hcomplex_add_minus_eq_minus:
paulson@14318
   509
      "x + y = (0::hcomplex) ==> x = -y"
paulson@14318
   510
apply (drule Ring_and_Field.equals_zero_I) 
paulson@14318
   511
apply (simp add: minus_equation_iff [of x y]) 
paulson@14318
   512
done
paulson@14318
   513
paulson@14318
   514
paulson@14318
   515
subsection{*More Multiplication Laws*}
paulson@14318
   516
paulson@14318
   517
lemma hcomplex_mult_one_right: "z * (1::hcomplex) = z"
paulson@14318
   518
apply (rule Ring_and_Field.mult_1_right)
paulson@14318
   519
done
paulson@14318
   520
paulson@14318
   521
lemma hcomplex_mult_minus_one: "- 1 * (z::hcomplex) = -z"
paulson@14318
   522
apply (simp (no_asm))
paulson@14318
   523
done
paulson@14318
   524
declare hcomplex_mult_minus_one [simp]
paulson@14318
   525
paulson@14318
   526
lemma hcomplex_mult_minus_one_right: "(z::hcomplex) * - 1 = -z"
paulson@14318
   527
apply (subst hcomplex_mult_commute)
paulson@14318
   528
apply (simp (no_asm))
paulson@14318
   529
done
paulson@14318
   530
declare hcomplex_mult_minus_one_right [simp]
paulson@14318
   531
paulson@14335
   532
lemma hcomplex_mult_left_cancel:
paulson@14354
   533
     "(c::hcomplex) \<noteq> (0::hcomplex) ==> (c*a=c*b) = (a=b)"
paulson@14335
   534
by (simp add: field_mult_cancel_left) 
paulson@14314
   535
paulson@14335
   536
lemma hcomplex_mult_right_cancel:
paulson@14354
   537
     "(c::hcomplex) \<noteq> (0::hcomplex) ==> (a*c=b*c) = (a=b)"
paulson@14335
   538
apply (simp add: Ring_and_Field.field_mult_cancel_right); 
paulson@14314
   539
done
paulson@14314
   540
paulson@14314
   541
paulson@14318
   542
subsection{*Subraction and Division*}
paulson@14314
   543
paulson@14318
   544
lemma hcomplex_diff:
paulson@14318
   545
 "Abs_hcomplex(hcomplexrel``{%n. X n}) - Abs_hcomplex(hcomplexrel``{%n. Y n}) =
paulson@14318
   546
  Abs_hcomplex(hcomplexrel``{%n. X n - Y n})"
paulson@14318
   547
apply (unfold hcomplex_diff_def)
paulson@14318
   548
apply (auto simp add: hcomplex_minus hcomplex_add complex_diff_def)
paulson@14314
   549
done
paulson@14314
   550
paulson@14318
   551
lemma hcomplex_diff_eq_eq: "((x::hcomplex) - y = z) = (x = z + y)"
paulson@14318
   552
apply (rule Ring_and_Field.diff_eq_eq) 
paulson@14314
   553
done
paulson@14314
   554
paulson@14314
   555
lemma hcomplex_add_divide_distrib: "(x+y)/(z::hcomplex) = x/z + y/z"
paulson@14318
   556
apply (rule Ring_and_Field.add_divide_distrib) 
paulson@14314
   557
done
paulson@14314
   558
paulson@14314
   559
paulson@14314
   560
subsection{*Embedding Properties for @{term hcomplex_of_hypreal} Map*}
paulson@14314
   561
paulson@14314
   562
lemma hcomplex_of_hypreal:
paulson@14314
   563
  "hcomplex_of_hypreal (Abs_hypreal(hyprel `` {%n. X n})) =
paulson@14314
   564
      Abs_hcomplex(hcomplexrel `` {%n. complex_of_real (X n)})"
paulson@14314
   565
apply (unfold hcomplex_of_hypreal_def)
paulson@14314
   566
apply (rule_tac f = "Abs_hcomplex" in arg_cong)
paulson@14314
   567
apply auto
paulson@14314
   568
apply (ultra)
paulson@14314
   569
done
paulson@14314
   570
paulson@14314
   571
lemma inj_hcomplex_of_hypreal: "inj hcomplex_of_hypreal"
paulson@14314
   572
apply (rule inj_onI)
paulson@14314
   573
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
   574
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
   575
apply (auto simp add: hcomplex_of_hypreal)
paulson@14314
   576
done
paulson@14314
   577
paulson@14335
   578
lemma hcomplex_of_hypreal_cancel_iff:
paulson@14335
   579
     "(hcomplex_of_hypreal x = hcomplex_of_hypreal y) = (x = y)"
paulson@14314
   580
apply (auto dest: inj_hcomplex_of_hypreal [THEN injD])
paulson@14314
   581
done
paulson@14314
   582
declare hcomplex_of_hypreal_cancel_iff [iff]
paulson@14314
   583
paulson@14335
   584
lemma hcomplex_of_hypreal_minus:
paulson@14335
   585
     "hcomplex_of_hypreal(-x) = - hcomplex_of_hypreal x"
paulson@14314
   586
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
   587
apply (auto simp add: hcomplex_of_hypreal hcomplex_minus hypreal_minus complex_of_real_minus)
paulson@14314
   588
done
paulson@14314
   589
paulson@14335
   590
lemma hcomplex_of_hypreal_inverse:
paulson@14335
   591
     "hcomplex_of_hypreal(inverse x) = inverse(hcomplex_of_hypreal x)"
paulson@14314
   592
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
   593
apply (auto simp add: hcomplex_of_hypreal hypreal_inverse hcomplex_inverse complex_of_real_inverse)
paulson@14314
   594
done
paulson@14314
   595
paulson@14335
   596
lemma hcomplex_of_hypreal_add:
paulson@14335
   597
     "hcomplex_of_hypreal x + hcomplex_of_hypreal y =
paulson@14314
   598
      hcomplex_of_hypreal (x + y)"
paulson@14314
   599
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
   600
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
   601
apply (auto simp add: hcomplex_of_hypreal hypreal_add hcomplex_add complex_of_real_add)
paulson@14314
   602
done
paulson@14314
   603
paulson@14314
   604
lemma hcomplex_of_hypreal_diff:
paulson@14314
   605
     "hcomplex_of_hypreal x - hcomplex_of_hypreal y =
paulson@14314
   606
      hcomplex_of_hypreal (x - y)"
paulson@14314
   607
apply (unfold hcomplex_diff_def)
paulson@14314
   608
apply (auto simp add: hcomplex_of_hypreal_minus [symmetric] hcomplex_of_hypreal_add hypreal_diff_def)
paulson@14314
   609
done
paulson@14314
   610
paulson@14335
   611
lemma hcomplex_of_hypreal_mult:
paulson@14335
   612
     "hcomplex_of_hypreal x * hcomplex_of_hypreal y =
paulson@14314
   613
      hcomplex_of_hypreal (x * y)"
paulson@14314
   614
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
   615
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14335
   616
apply (auto simp add: hcomplex_of_hypreal hypreal_mult hcomplex_mult 
paulson@14335
   617
                      complex_of_real_mult)
paulson@14314
   618
done
paulson@14314
   619
paulson@14314
   620
lemma hcomplex_of_hypreal_divide:
paulson@14314
   621
  "hcomplex_of_hypreal x / hcomplex_of_hypreal y = hcomplex_of_hypreal(x/y)"
paulson@14314
   622
apply (unfold hcomplex_divide_def)
paulson@14314
   623
apply (case_tac "y=0")
paulson@14335
   624
apply (simp)
paulson@14314
   625
apply (auto simp add: hcomplex_of_hypreal_mult hcomplex_of_hypreal_inverse [symmetric])
paulson@14314
   626
apply (simp (no_asm) add: hypreal_divide_def)
paulson@14314
   627
done
paulson@14314
   628
paulson@14314
   629
lemma hcomplex_of_hypreal_one [simp]:
paulson@14314
   630
      "hcomplex_of_hypreal 1 = 1"
paulson@14314
   631
apply (unfold hcomplex_one_def)
paulson@14314
   632
apply (auto simp add: hcomplex_of_hypreal hypreal_one_num)
paulson@14314
   633
done
paulson@14314
   634
paulson@14314
   635
lemma hcomplex_of_hypreal_zero [simp]:
paulson@14314
   636
      "hcomplex_of_hypreal 0 = 0"
paulson@14314
   637
apply (unfold hcomplex_zero_def hypreal_zero_def)
paulson@14314
   638
apply (auto simp add: hcomplex_of_hypreal)
paulson@14314
   639
done
paulson@14314
   640
paulson@14314
   641
lemma hRe_hcomplex_of_hypreal: "hRe(hcomplex_of_hypreal z) = z"
paulson@14314
   642
apply (rule_tac z = "z" in eq_Abs_hypreal)
paulson@14314
   643
apply (auto simp add: hcomplex_of_hypreal hRe)
paulson@14314
   644
done
paulson@14314
   645
declare hRe_hcomplex_of_hypreal [simp]
paulson@14314
   646
paulson@14314
   647
lemma hIm_hcomplex_of_hypreal: "hIm(hcomplex_of_hypreal z) = 0"
paulson@14314
   648
apply (rule_tac z = "z" in eq_Abs_hypreal)
paulson@14314
   649
apply (auto simp add: hcomplex_of_hypreal hIm hypreal_zero_num)
paulson@14314
   650
done
paulson@14314
   651
declare hIm_hcomplex_of_hypreal [simp]
paulson@14314
   652
paulson@14354
   653
lemma hcomplex_of_hypreal_epsilon_not_zero: "hcomplex_of_hypreal epsilon \<noteq> 0"
paulson@14314
   654
apply (auto simp add: hcomplex_of_hypreal epsilon_def hcomplex_zero_def)
paulson@14314
   655
done
paulson@14314
   656
declare hcomplex_of_hypreal_epsilon_not_zero [simp]
paulson@14314
   657
paulson@14318
   658
paulson@14318
   659
subsection{*Modulus (Absolute Value) of Nonstandard Complex Number*}
paulson@14314
   660
paulson@14314
   661
lemma hcmod:
paulson@14314
   662
  "hcmod (Abs_hcomplex(hcomplexrel `` {%n. X n})) =
paulson@14314
   663
      Abs_hypreal(hyprel `` {%n. cmod (X n)})"
paulson@14314
   664
paulson@14314
   665
apply (unfold hcmod_def)
paulson@14314
   666
apply (rule_tac f = "Abs_hypreal" in arg_cong)
paulson@14335
   667
apply (auto, ultra)
paulson@14314
   668
done
paulson@14314
   669
paulson@14314
   670
lemma hcmod_zero [simp]:
paulson@14314
   671
      "hcmod(0) = 0"
paulson@14314
   672
apply (unfold hcomplex_zero_def hypreal_zero_def)
paulson@14314
   673
apply (auto simp add: hcmod)
paulson@14314
   674
done
paulson@14314
   675
paulson@14314
   676
lemma hcmod_one:
paulson@14314
   677
      "hcmod(1) = 1"
paulson@14314
   678
apply (unfold hcomplex_one_def)
paulson@14314
   679
apply (auto simp add: hcmod hypreal_one_num)
paulson@14314
   680
done
paulson@14314
   681
declare hcmod_one [simp]
paulson@14314
   682
paulson@14314
   683
lemma hcmod_hcomplex_of_hypreal: "hcmod(hcomplex_of_hypreal x) = abs x"
paulson@14314
   684
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
   685
apply (auto simp add: hcmod hcomplex_of_hypreal hypreal_hrabs)
paulson@14314
   686
done
paulson@14314
   687
declare hcmod_hcomplex_of_hypreal [simp]
paulson@14314
   688
paulson@14335
   689
lemma hcomplex_of_hypreal_abs:
paulson@14335
   690
     "hcomplex_of_hypreal (abs x) =
paulson@14314
   691
      hcomplex_of_hypreal(hcmod(hcomplex_of_hypreal x))"
paulson@14314
   692
apply (simp (no_asm))
paulson@14314
   693
done
paulson@14314
   694
paulson@14314
   695
paulson@14314
   696
subsection{*Conjugation*}
paulson@14314
   697
paulson@14314
   698
lemma hcnj:
paulson@14314
   699
  "hcnj (Abs_hcomplex(hcomplexrel `` {%n. X n})) =
paulson@14318
   700
   Abs_hcomplex(hcomplexrel `` {%n. cnj(X n)})"
paulson@14314
   701
apply (unfold hcnj_def)
paulson@14314
   702
apply (rule_tac f = "Abs_hcomplex" in arg_cong)
paulson@14335
   703
apply (auto, ultra)
paulson@14314
   704
done
paulson@14314
   705
paulson@14314
   706
lemma inj_hcnj: "inj hcnj"
paulson@14314
   707
apply (rule inj_onI)
paulson@14314
   708
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   709
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   710
apply (auto simp add: hcnj)
paulson@14314
   711
done
paulson@14314
   712
paulson@14314
   713
lemma hcomplex_hcnj_cancel_iff: "(hcnj x = hcnj y) = (x = y)"
paulson@14314
   714
apply (auto dest: inj_hcnj [THEN injD])
paulson@14314
   715
done
paulson@14314
   716
declare hcomplex_hcnj_cancel_iff [simp]
paulson@14314
   717
paulson@14314
   718
lemma hcomplex_hcnj_hcnj: "hcnj (hcnj z) = z"
paulson@14314
   719
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   720
apply (auto simp add: hcnj)
paulson@14314
   721
done
paulson@14314
   722
declare hcomplex_hcnj_hcnj [simp]
paulson@14314
   723
paulson@14335
   724
lemma hcomplex_hcnj_hcomplex_of_hypreal:
paulson@14335
   725
     "hcnj (hcomplex_of_hypreal x) = hcomplex_of_hypreal x"
paulson@14314
   726
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
   727
apply (auto simp add: hcnj hcomplex_of_hypreal)
paulson@14314
   728
done
paulson@14314
   729
declare hcomplex_hcnj_hcomplex_of_hypreal [simp]
paulson@14314
   730
paulson@14314
   731
lemma hcomplex_hmod_hcnj: "hcmod (hcnj z) = hcmod z"
paulson@14314
   732
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   733
apply (auto simp add: hcnj hcmod)
paulson@14314
   734
done
paulson@14314
   735
declare hcomplex_hmod_hcnj [simp]
paulson@14314
   736
paulson@14314
   737
lemma hcomplex_hcnj_minus: "hcnj (-z) = - hcnj z"
paulson@14314
   738
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   739
apply (auto simp add: hcnj hcomplex_minus complex_cnj_minus)
paulson@14314
   740
done
paulson@14314
   741
paulson@14314
   742
lemma hcomplex_hcnj_inverse: "hcnj(inverse z) = inverse(hcnj z)"
paulson@14314
   743
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   744
apply (auto simp add: hcnj hcomplex_inverse complex_cnj_inverse)
paulson@14314
   745
done
paulson@14314
   746
paulson@14314
   747
lemma hcomplex_hcnj_add: "hcnj(w + z) = hcnj(w) + hcnj(z)"
paulson@14314
   748
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   749
apply (rule_tac z = "w" in eq_Abs_hcomplex)
paulson@14314
   750
apply (auto simp add: hcnj hcomplex_add complex_cnj_add)
paulson@14314
   751
done
paulson@14314
   752
paulson@14314
   753
lemma hcomplex_hcnj_diff: "hcnj(w - z) = hcnj(w) - hcnj(z)"
paulson@14314
   754
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   755
apply (rule_tac z = "w" in eq_Abs_hcomplex)
paulson@14314
   756
apply (auto simp add: hcnj hcomplex_diff complex_cnj_diff)
paulson@14314
   757
done
paulson@14314
   758
paulson@14314
   759
lemma hcomplex_hcnj_mult: "hcnj(w * z) = hcnj(w) * hcnj(z)"
paulson@14314
   760
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   761
apply (rule_tac z = "w" in eq_Abs_hcomplex)
paulson@14314
   762
apply (auto simp add: hcnj hcomplex_mult complex_cnj_mult)
paulson@14314
   763
done
paulson@14314
   764
paulson@14314
   765
lemma hcomplex_hcnj_divide: "hcnj(w / z) = (hcnj w)/(hcnj z)"
paulson@14314
   766
apply (unfold hcomplex_divide_def)
paulson@14314
   767
apply (simp (no_asm) add: hcomplex_hcnj_mult hcomplex_hcnj_inverse)
paulson@14314
   768
done
paulson@14314
   769
paulson@14314
   770
lemma hcnj_one: "hcnj 1 = 1"
paulson@14314
   771
apply (unfold hcomplex_one_def)
paulson@14314
   772
apply (simp (no_asm) add: hcnj)
paulson@14314
   773
done
paulson@14314
   774
declare hcnj_one [simp]
paulson@14314
   775
paulson@14314
   776
paulson@14314
   777
(* MOVE to NSComplexBin
paulson@14314
   778
Goal "z + hcnj z =
paulson@14314
   779
      hcomplex_of_hypreal (2 * hRe(z))"
paulson@14314
   780
by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1);
paulson@14314
   781
by (auto_tac (claset(),HOL_ss addsimps [hRe,hcnj,hcomplex_add,
paulson@14314
   782
    hypreal_mult,hcomplex_of_hypreal,complex_add_cnj]));
paulson@14314
   783
qed "hcomplex_add_hcnj";
paulson@14314
   784
paulson@14314
   785
Goal "z - hcnj z = \
paulson@14314
   786
\     hcomplex_of_hypreal (hypreal_of_real 2 * hIm(z)) * iii";
paulson@14314
   787
by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1);
paulson@14314
   788
by (auto_tac (claset(),simpset() addsimps [hIm,hcnj,hcomplex_diff,
paulson@14314
   789
    hypreal_of_real_def,hypreal_mult,hcomplex_of_hypreal,
paulson@14314
   790
    complex_diff_cnj,iii_def,hcomplex_mult]));
paulson@14314
   791
qed "hcomplex_diff_hcnj";
paulson@14314
   792
*)
paulson@14314
   793
paulson@14314
   794
lemma hcomplex_hcnj_zero:
paulson@14314
   795
      "hcnj 0 = 0"
paulson@14314
   796
apply (unfold hcomplex_zero_def)
paulson@14314
   797
apply (auto simp add: hcnj)
paulson@14314
   798
done
paulson@14314
   799
declare hcomplex_hcnj_zero [simp]
paulson@14314
   800
paulson@14314
   801
lemma hcomplex_hcnj_zero_iff: "(hcnj z = 0) = (z = 0)"
paulson@14314
   802
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
   803
apply (auto simp add: hcomplex_zero_def hcnj)
paulson@14314
   804
done
paulson@14314
   805
declare hcomplex_hcnj_zero_iff [iff]
paulson@14314
   806
paulson@14335
   807
lemma hcomplex_mult_hcnj:
paulson@14335
   808
     "z * hcnj z = hcomplex_of_hypreal (hRe(z) ^ 2 + hIm(z) ^ 2)"
paulson@14314
   809
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14323
   810
apply (auto simp add: hcnj hcomplex_mult hcomplex_of_hypreal hRe hIm hypreal_add hypreal_mult complex_mult_cnj numeral_2_eq_2)
paulson@14314
   811
done
paulson@14314
   812
paulson@14314
   813
paulson@14354
   814
subsection{*More Theorems about the Function @{term hcmod}*}
paulson@14314
   815
paulson@14314
   816
lemma hcomplex_hcmod_eq_zero_cancel: "(hcmod x = 0) = (x = 0)"
paulson@14314
   817
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   818
apply (auto simp add: hcmod hcomplex_zero_def hypreal_zero_num)
paulson@14314
   819
done
paulson@14314
   820
declare hcomplex_hcmod_eq_zero_cancel [simp]
paulson@14314
   821
paulson@14335
   822
lemma hcmod_hcomplex_of_hypreal_of_nat:
paulson@14335
   823
     "hcmod (hcomplex_of_hypreal(hypreal_of_nat n)) = hypreal_of_nat n"
paulson@14314
   824
apply auto
paulson@14314
   825
done
paulson@14314
   826
declare hcmod_hcomplex_of_hypreal_of_nat [simp]
paulson@14314
   827
paulson@14335
   828
lemma hcmod_hcomplex_of_hypreal_of_hypnat:
paulson@14335
   829
     "hcmod (hcomplex_of_hypreal(hypreal_of_hypnat n)) = hypreal_of_hypnat n"
paulson@14314
   830
apply auto
paulson@14314
   831
done
paulson@14314
   832
declare hcmod_hcomplex_of_hypreal_of_hypnat [simp]
paulson@14314
   833
paulson@14314
   834
lemma hcmod_minus: "hcmod (-x) = hcmod(x)"
paulson@14314
   835
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   836
apply (auto simp add: hcmod hcomplex_minus)
paulson@14314
   837
done
paulson@14314
   838
declare hcmod_minus [simp]
paulson@14314
   839
paulson@14314
   840
lemma hcmod_mult_hcnj: "hcmod(z * hcnj(z)) = hcmod(z) ^ 2"
paulson@14314
   841
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14323
   842
apply (auto simp add: hcmod hcomplex_mult hcnj hypreal_mult complex_mod_mult_cnj numeral_2_eq_2)
paulson@14314
   843
done
paulson@14314
   844
paulson@14354
   845
lemma hcmod_ge_zero: "(0::hypreal) \<le> hcmod x"
paulson@14314
   846
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   847
apply (auto simp add: hcmod hypreal_zero_num hypreal_le)
paulson@14314
   848
done
paulson@14314
   849
declare hcmod_ge_zero [simp]
paulson@14314
   850
paulson@14314
   851
lemma hrabs_hcmod_cancel: "abs(hcmod x) = hcmod x"
paulson@14314
   852
apply (auto intro: hrabs_eqI1)
paulson@14314
   853
done
paulson@14314
   854
declare hrabs_hcmod_cancel [simp]
paulson@14314
   855
paulson@14314
   856
lemma hcmod_mult: "hcmod(x*y) = hcmod(x) * hcmod(y)"
paulson@14314
   857
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   858
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   859
apply (auto simp add: hcmod hcomplex_mult hypreal_mult complex_mod_mult)
paulson@14314
   860
done
paulson@14314
   861
paulson@14314
   862
lemma hcmod_add_squared_eq:
paulson@14314
   863
     "hcmod(x + y) ^ 2 = hcmod(x) ^ 2 + hcmod(y) ^ 2 + 2 * hRe(x * hcnj y)"
paulson@14314
   864
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   865
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   866
apply (auto simp add: hcmod hcomplex_add hypreal_mult hRe hcnj hcomplex_mult
paulson@14323
   867
                      numeral_2_eq_2 realpow_two [symmetric] 
paulson@14314
   868
                 simp del: realpow_Suc)
paulson@14323
   869
apply (auto simp add: numeral_2_eq_2 [symmetric] complex_mod_add_squared_eq
paulson@14314
   870
                 hypreal_add [symmetric] hypreal_mult [symmetric] 
paulson@14314
   871
                 hypreal_of_real_def [symmetric])
paulson@14314
   872
done
paulson@14314
   873
paulson@14354
   874
lemma hcomplex_hRe_mult_hcnj_le_hcmod: "hRe(x * hcnj y) \<le> hcmod(x * hcnj y)"
paulson@14314
   875
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   876
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   877
apply (auto simp add: hcmod hcnj hcomplex_mult hRe hypreal_le)
paulson@14314
   878
done
paulson@14314
   879
declare hcomplex_hRe_mult_hcnj_le_hcmod [simp]
paulson@14314
   880
paulson@14354
   881
lemma hcomplex_hRe_mult_hcnj_le_hcmod2: "hRe(x * hcnj y) \<le> hcmod(x * y)"
paulson@14314
   882
apply (cut_tac x = "x" and y = "y" in hcomplex_hRe_mult_hcnj_le_hcmod)
paulson@14314
   883
apply (simp add: hcmod_mult)
paulson@14314
   884
done
paulson@14314
   885
declare hcomplex_hRe_mult_hcnj_le_hcmod2 [simp]
paulson@14314
   886
paulson@14354
   887
lemma hcmod_triangle_squared: "hcmod (x + y) ^ 2 \<le> (hcmod(x) + hcmod(y)) ^ 2"
paulson@14314
   888
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   889
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   890
apply (auto simp add: hcmod hcnj hcomplex_add hypreal_mult hypreal_add
paulson@14323
   891
                      hypreal_le realpow_two [symmetric] numeral_2_eq_2
paulson@14314
   892
            simp del: realpow_Suc)
paulson@14323
   893
apply (simp (no_asm) add: numeral_2_eq_2 [symmetric])
paulson@14314
   894
done
paulson@14314
   895
declare hcmod_triangle_squared [simp]
paulson@14314
   896
paulson@14354
   897
lemma hcmod_triangle_ineq: "hcmod (x + y) \<le> hcmod(x) + hcmod(y)"
paulson@14314
   898
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   899
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   900
apply (auto simp add: hcmod hcomplex_add hypreal_add hypreal_le)
paulson@14314
   901
done
paulson@14314
   902
declare hcmod_triangle_ineq [simp]
paulson@14314
   903
paulson@14354
   904
lemma hcmod_triangle_ineq2: "hcmod(b + a) - hcmod b \<le> hcmod a"
paulson@14314
   905
apply (cut_tac x1 = "b" and y1 = "a" and c = "-hcmod b" in hcmod_triangle_ineq [THEN add_right_mono])
paulson@14331
   906
apply (simp add: add_ac)
paulson@14314
   907
done
paulson@14314
   908
declare hcmod_triangle_ineq2 [simp]
paulson@14314
   909
paulson@14314
   910
lemma hcmod_diff_commute: "hcmod (x - y) = hcmod (y - x)"
paulson@14314
   911
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   912
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   913
apply (auto simp add: hcmod hcomplex_diff complex_mod_diff_commute)
paulson@14314
   914
done
paulson@14314
   915
paulson@14335
   916
lemma hcmod_add_less:
paulson@14335
   917
     "[| hcmod x < r; hcmod y < s |] ==> hcmod (x + y) < r + s"
paulson@14314
   918
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   919
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   920
apply (rule_tac z = "r" in eq_Abs_hypreal)
paulson@14314
   921
apply (rule_tac z = "s" in eq_Abs_hypreal)
paulson@14314
   922
apply (auto simp add: hcmod hcomplex_add hypreal_add hypreal_less)
paulson@14314
   923
apply ultra
paulson@14314
   924
apply (auto intro: complex_mod_add_less)
paulson@14314
   925
done
paulson@14314
   926
paulson@14335
   927
lemma hcmod_mult_less:
paulson@14335
   928
     "[| hcmod x < r; hcmod y < s |] ==> hcmod (x * y) < r * s"
paulson@14314
   929
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   930
apply (rule_tac z = "y" in eq_Abs_hcomplex)
paulson@14314
   931
apply (rule_tac z = "r" in eq_Abs_hypreal)
paulson@14314
   932
apply (rule_tac z = "s" in eq_Abs_hypreal)
paulson@14314
   933
apply (auto simp add: hcmod hypreal_mult hypreal_less hcomplex_mult)
paulson@14314
   934
apply ultra
paulson@14314
   935
apply (auto intro: complex_mod_mult_less)
paulson@14314
   936
done
paulson@14314
   937
paulson@14354
   938
lemma hcmod_diff_ineq: "hcmod(a) - hcmod(b) \<le> hcmod(a + b)"
paulson@14314
   939
apply (rule_tac z = "a" in eq_Abs_hcomplex)
paulson@14314
   940
apply (rule_tac z = "b" in eq_Abs_hcomplex)
paulson@14314
   941
apply (auto simp add: hcmod hcomplex_add hypreal_diff hypreal_le)
paulson@14314
   942
done
paulson@14314
   943
declare hcmod_diff_ineq [simp]
paulson@14314
   944
paulson@14314
   945
paulson@14314
   946
paulson@14314
   947
subsection{*A Few Nonlinear Theorems*}
paulson@14314
   948
paulson@14314
   949
lemma hcpow:
paulson@14314
   950
  "Abs_hcomplex(hcomplexrel``{%n. X n}) hcpow
paulson@14314
   951
   Abs_hypnat(hypnatrel``{%n. Y n}) =
paulson@14314
   952
   Abs_hcomplex(hcomplexrel``{%n. X n ^ Y n})"
paulson@14314
   953
apply (unfold hcpow_def)
paulson@14314
   954
apply (rule_tac f = "Abs_hcomplex" in arg_cong)
paulson@14335
   955
apply (auto, ultra)
paulson@14314
   956
done
paulson@14314
   957
paulson@14335
   958
lemma hcomplex_of_hypreal_hyperpow:
paulson@14335
   959
     "hcomplex_of_hypreal (x pow n) = (hcomplex_of_hypreal x) hcpow n"
paulson@14314
   960
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
   961
apply (rule_tac z = "n" in eq_Abs_hypnat)
paulson@14314
   962
apply (auto simp add: hcomplex_of_hypreal hyperpow hcpow complex_of_real_pow)
paulson@14314
   963
done
paulson@14314
   964
paulson@14314
   965
lemma hcmod_hcpow: "hcmod(x hcpow n) = hcmod(x) pow n"
paulson@14314
   966
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14314
   967
apply (rule_tac z = "n" in eq_Abs_hypnat)
paulson@14314
   968
apply (auto simp add: hcpow hyperpow hcmod complex_mod_complexpow)
paulson@14314
   969
done
paulson@14314
   970
paulson@14314
   971
lemma hcmod_hcomplex_inverse: "hcmod(inverse x) = inverse(hcmod x)"
paulson@14314
   972
apply (case_tac "x = 0", simp add: HCOMPLEX_INVERSE_ZERO)
paulson@14314
   973
apply (rule_tac c1 = "hcmod x" in hypreal_mult_left_cancel [THEN iffD1])
paulson@14314
   974
apply (auto simp add: hcmod_mult [symmetric])
paulson@14314
   975
done
paulson@14314
   976
paulson@14314
   977
lemma hcmod_divide:
paulson@14314
   978
      "hcmod(x/y) = hcmod(x)/(hcmod y)"
paulson@14314
   979
apply (unfold hcomplex_divide_def hypreal_divide_def)
paulson@14314
   980
apply (auto simp add: hcmod_mult hcmod_hcomplex_inverse)
paulson@14314
   981
done
paulson@14314
   982
paulson@14314
   983
lemma hcomplex_inverse_divide:
paulson@14314
   984
      "inverse(x/y) = y/(x::hcomplex)"
paulson@14314
   985
apply (unfold hcomplex_divide_def)
paulson@14318
   986
apply (auto simp add: inverse_mult_distrib hcomplex_mult_commute)
paulson@14314
   987
done
paulson@14314
   988
declare hcomplex_inverse_divide [simp]
paulson@14314
   989
paulson@14354
   990
paulson@14354
   991
subsection{*Exponentiation*}
paulson@14354
   992
paulson@14354
   993
primrec
paulson@14354
   994
     hcomplexpow_0:   "z ^ 0       = 1"
paulson@14354
   995
     hcomplexpow_Suc: "z ^ (Suc n) = (z::hcomplex) * (z ^ n)"
paulson@14354
   996
paulson@14354
   997
instance hcomplex :: ringpower
paulson@14354
   998
proof
paulson@14354
   999
  fix z :: hcomplex
paulson@14354
  1000
  fix n :: nat
paulson@14354
  1001
  show "z^0 = 1" by simp
paulson@14354
  1002
  show "z^(Suc n) = z * (z^n)" by simp
paulson@14354
  1003
qed
paulson@14354
  1004
paulson@14354
  1005
paulson@14354
  1006
lemma hcomplex_of_hypreal_pow:
paulson@14354
  1007
     "hcomplex_of_hypreal (x ^ n) = (hcomplex_of_hypreal x) ^ n"
paulson@14354
  1008
apply (induct_tac "n")
paulson@14354
  1009
apply (auto simp add: hcomplex_of_hypreal_mult [symmetric])
paulson@14354
  1010
done
paulson@14354
  1011
paulson@14354
  1012
lemma hcomplex_hcnj_pow: "hcnj(z ^ n) = hcnj(z) ^ n"
paulson@14314
  1013
apply (induct_tac "n")
paulson@14354
  1014
apply (auto simp add: hcomplex_hcnj_mult)
paulson@14354
  1015
done
paulson@14354
  1016
paulson@14354
  1017
lemma hcmod_hcomplexpow: "hcmod(x ^ n) = hcmod(x) ^ n"
paulson@14354
  1018
apply (induct_tac "n")
paulson@14354
  1019
apply (auto simp add: hcmod_mult)
paulson@14354
  1020
done
paulson@14354
  1021
paulson@14354
  1022
lemma hcomplexpow_minus:
paulson@14354
  1023
     "(-x::hcomplex) ^ n = (if even n then (x ^ n) else -(x ^ n))"
paulson@14354
  1024
apply (induct_tac "n")
paulson@14354
  1025
apply auto
paulson@14354
  1026
done
paulson@14354
  1027
paulson@14354
  1028
lemma hcpow_minus:
paulson@14354
  1029
     "(-x::hcomplex) hcpow n =
paulson@14354
  1030
      (if ( *pNat* even) n then (x hcpow n) else -(x hcpow n))"
paulson@14354
  1031
apply (rule_tac z = "x" in eq_Abs_hcomplex)
paulson@14354
  1032
apply (rule_tac z = "n" in eq_Abs_hypnat)
paulson@14354
  1033
apply (auto simp add: hcpow hyperpow starPNat hcomplex_minus)
paulson@14354
  1034
apply ultra
paulson@14354
  1035
apply (auto simp add: complexpow_minus) 
paulson@14354
  1036
apply ultra
paulson@14314
  1037
done
paulson@14314
  1038
paulson@14314
  1039
lemma hcpow_mult: "((r::hcomplex) * s) hcpow n = (r hcpow n) * (s hcpow n)"
paulson@14314
  1040
apply (rule_tac z = "r" in eq_Abs_hcomplex)
paulson@14314
  1041
apply (rule_tac z = "s" in eq_Abs_hcomplex)
paulson@14314
  1042
apply (rule_tac z = "n" in eq_Abs_hypnat)
paulson@14354
  1043
apply (auto simp add: hcpow hypreal_mult hcomplex_mult power_mult_distrib)
paulson@14314
  1044
done
paulson@14314
  1045
paulson@14354
  1046
lemma hcpow_zero [simp]: "0 hcpow (n + 1) = 0"
paulson@14314
  1047
apply (unfold hcomplex_zero_def hypnat_one_def)
paulson@14314
  1048
apply (rule_tac z = "n" in eq_Abs_hypnat)
paulson@14314
  1049
apply (auto simp add: hcpow hypnat_add)
paulson@14314
  1050
done
paulson@14314
  1051
paulson@14354
  1052
lemma hcpow_zero2 [simp]: "0 hcpow (hSuc n) = 0"
paulson@14314
  1053
apply (unfold hSuc_def)
paulson@14314
  1054
apply (simp (no_asm))
paulson@14314
  1055
done
paulson@14314
  1056
paulson@14354
  1057
lemma hcpow_not_zero [simp,intro]: "r \<noteq> 0 ==> r hcpow n \<noteq> (0::hcomplex)"
paulson@14314
  1058
apply (rule_tac z = "r" in eq_Abs_hcomplex)
paulson@14314
  1059
apply (rule_tac z = "n" in eq_Abs_hypnat)
paulson@14314
  1060
apply (auto simp add: hcpow hcomplex_zero_def)
paulson@14314
  1061
apply ultra
paulson@14314
  1062
done
paulson@14314
  1063
paulson@14314
  1064
lemma hcpow_zero_zero: "r hcpow n = (0::hcomplex) ==> r = 0"
paulson@14314
  1065
apply (blast intro: ccontr dest: hcpow_not_zero)
paulson@14314
  1066
done
paulson@14314
  1067
paulson@14314
  1068
lemma hcomplex_i_mult_eq: "iii * iii = - 1"
paulson@14314
  1069
apply (unfold iii_def)
paulson@14314
  1070
apply (auto simp add: hcomplex_mult hcomplex_one_def hcomplex_minus)
paulson@14314
  1071
done
paulson@14314
  1072
declare hcomplex_i_mult_eq [simp]
paulson@14314
  1073
paulson@14314
  1074
lemma hcomplexpow_i_squared: "iii ^ 2 = - 1"
paulson@14323
  1075
apply (simp (no_asm) add: numeral_2_eq_2)
paulson@14314
  1076
done
paulson@14314
  1077
declare hcomplexpow_i_squared [simp]
paulson@14314
  1078
paulson@14354
  1079
lemma hcomplex_i_not_zero: "iii \<noteq> 0"
paulson@14314
  1080
apply (unfold iii_def hcomplex_zero_def)
paulson@14314
  1081
apply auto
paulson@14314
  1082
done
paulson@14314
  1083
declare hcomplex_i_not_zero [simp]
paulson@14314
  1084
paulson@14314
  1085
lemma hcomplex_divide:
paulson@14314
  1086
  "Abs_hcomplex(hcomplexrel``{%n. X n}) / Abs_hcomplex(hcomplexrel``{%n. Y n}) =
paulson@14314
  1087
   Abs_hcomplex(hcomplexrel``{%n. X n / Y n})"
paulson@14314
  1088
apply (unfold hcomplex_divide_def complex_divide_def)
paulson@14314
  1089
apply (auto simp add: hcomplex_inverse hcomplex_mult)
paulson@14314
  1090
done
paulson@14314
  1091
paulson@14314
  1092
paulson@14314
  1093
subsection{*The Function @{term hsgn}*}
paulson@14314
  1094
paulson@14314
  1095
lemma hsgn:
paulson@14314
  1096
  "hsgn (Abs_hcomplex(hcomplexrel `` {%n. X n})) =
paulson@14314
  1097
      Abs_hcomplex(hcomplexrel `` {%n. sgn (X n)})"
paulson@14314
  1098
apply (unfold hsgn_def)
paulson@14314
  1099
apply (rule_tac f = "Abs_hcomplex" in arg_cong)
paulson@14335
  1100
apply (auto, ultra)
paulson@14314
  1101
done
paulson@14314
  1102
paulson@14314
  1103
lemma hsgn_zero: "hsgn 0 = 0"
paulson@14314
  1104
apply (unfold hcomplex_zero_def)
paulson@14314
  1105
apply (simp (no_asm) add: hsgn)
paulson@14314
  1106
done
paulson@14314
  1107
declare hsgn_zero [simp]
paulson@14314
  1108
paulson@14314
  1109
paulson@14314
  1110
lemma hsgn_one: "hsgn 1 = 1"
paulson@14314
  1111
apply (unfold hcomplex_one_def)
paulson@14314
  1112
apply (simp (no_asm) add: hsgn)
paulson@14314
  1113
done
paulson@14314
  1114
declare hsgn_one [simp]
paulson@14314
  1115
paulson@14314
  1116
lemma hsgn_minus: "hsgn (-z) = - hsgn(z)"
paulson@14314
  1117
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
  1118
apply (auto simp add: hsgn hcomplex_minus sgn_minus)
paulson@14314
  1119
done
paulson@14314
  1120
paulson@14314
  1121
lemma hsgn_eq: "hsgn z = z / hcomplex_of_hypreal (hcmod z)"
paulson@14314
  1122
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
  1123
apply (auto simp add: hsgn hcomplex_divide hcomplex_of_hypreal hcmod sgn_eq)
paulson@14314
  1124
done
paulson@14314
  1125
paulson@14335
  1126
lemma lemma_hypreal_P_EX2:
paulson@14354
  1127
     "(\<exists>(x::hypreal) y. P x y) =
paulson@14354
  1128
      (\<exists>f g. P (Abs_hypreal(hyprel `` {f})) (Abs_hypreal(hyprel `` {g})))"
paulson@14314
  1129
apply auto
paulson@14314
  1130
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
  1131
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
  1132
apply auto
paulson@14314
  1133
done
paulson@14314
  1134
paulson@14335
  1135
lemma complex_split2:
paulson@14354
  1136
     "\<forall>(n::nat). \<exists>x y. (z n) = complex_of_real(x) + ii * complex_of_real(y)"
paulson@14314
  1137
apply (blast intro: complex_split)
paulson@14314
  1138
done
paulson@14314
  1139
paulson@14314
  1140
(* Interesting proof! *)
paulson@14335
  1141
lemma hcomplex_split:
paulson@14354
  1142
     "\<exists>x y. z = hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)"
paulson@14314
  1143
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
  1144
apply (auto simp add: lemma_hypreal_P_EX2 hcomplex_of_hypreal iii_def hcomplex_add hcomplex_mult)
paulson@14314
  1145
apply (cut_tac z = "x" in complex_split2)
paulson@14335
  1146
apply (drule choice, safe)+
paulson@14314
  1147
apply (rule_tac x = "f" in exI)
paulson@14314
  1148
apply (rule_tac x = "fa" in exI)
paulson@14314
  1149
apply auto
paulson@14314
  1150
done
paulson@14314
  1151
paulson@14335
  1152
lemma hRe_hcomplex_i:
paulson@14335
  1153
     "hRe(hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)) = x"
paulson@14314
  1154
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
  1155
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
  1156
apply (auto simp add: hRe iii_def hcomplex_add hcomplex_mult hcomplex_of_hypreal)
paulson@14314
  1157
done
paulson@14314
  1158
declare hRe_hcomplex_i [simp]
paulson@14314
  1159
paulson@14335
  1160
lemma hIm_hcomplex_i:
paulson@14335
  1161
     "hIm(hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)) = y"
paulson@14314
  1162
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
  1163
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
  1164
apply (auto simp add: hIm iii_def hcomplex_add hcomplex_mult hcomplex_of_hypreal)
paulson@14314
  1165
done
paulson@14314
  1166
declare hIm_hcomplex_i [simp]
paulson@14314
  1167
paulson@14335
  1168
lemma hcmod_i:
paulson@14335
  1169
     "hcmod (hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)) =
paulson@14314
  1170
      ( *f* sqrt) (x ^ 2 + y ^ 2)"
paulson@14314
  1171
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
  1172
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14323
  1173
apply (auto simp add: hcomplex_of_hypreal iii_def hcomplex_add hcomplex_mult starfun hypreal_mult hypreal_add hcmod cmod_i numeral_2_eq_2)
paulson@14314
  1174
done
paulson@14314
  1175
paulson@14314
  1176
lemma hcomplex_eq_hRe_eq:
paulson@14314
  1177
     "hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya =
paulson@14314
  1178
      hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb
paulson@14314
  1179
       ==> xa = xb"
paulson@14314
  1180
apply (unfold iii_def)
paulson@14314
  1181
apply (rule_tac z = "xa" in eq_Abs_hypreal)
paulson@14314
  1182
apply (rule_tac z = "ya" in eq_Abs_hypreal)
paulson@14314
  1183
apply (rule_tac z = "xb" in eq_Abs_hypreal)
paulson@14314
  1184
apply (rule_tac z = "yb" in eq_Abs_hypreal)
paulson@14314
  1185
apply (auto simp add: hcomplex_mult hcomplex_add hcomplex_of_hypreal)
paulson@14314
  1186
apply (ultra)
paulson@14314
  1187
done
paulson@14314
  1188
paulson@14314
  1189
lemma hcomplex_eq_hIm_eq:
paulson@14314
  1190
     "hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya =
paulson@14314
  1191
      hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb
paulson@14314
  1192
       ==> ya = yb"
paulson@14314
  1193
apply (unfold iii_def)
paulson@14314
  1194
apply (rule_tac z = "xa" in eq_Abs_hypreal)
paulson@14314
  1195
apply (rule_tac z = "ya" in eq_Abs_hypreal)
paulson@14314
  1196
apply (rule_tac z = "xb" in eq_Abs_hypreal)
paulson@14314
  1197
apply (rule_tac z = "yb" in eq_Abs_hypreal)
paulson@14314
  1198
apply (auto simp add: hcomplex_mult hcomplex_add hcomplex_of_hypreal)
paulson@14314
  1199
apply (ultra)
paulson@14314
  1200
done
paulson@14314
  1201
paulson@14335
  1202
lemma hcomplex_eq_cancel_iff:
paulson@14335
  1203
     "(hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya =
paulson@14314
  1204
       hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb) =
paulson@14314
  1205
      ((xa = xb) & (ya = yb))"
paulson@14314
  1206
apply (auto intro: hcomplex_eq_hIm_eq hcomplex_eq_hRe_eq)
paulson@14314
  1207
done
paulson@14314
  1208
declare hcomplex_eq_cancel_iff [simp]
paulson@14314
  1209
paulson@14335
  1210
lemma hcomplex_eq_cancel_iffA:
paulson@14335
  1211
     "(hcomplex_of_hypreal xa + hcomplex_of_hypreal ya * iii =
paulson@14314
  1212
       hcomplex_of_hypreal xb + hcomplex_of_hypreal yb * iii ) = ((xa = xb) & (ya = yb))"
paulson@14314
  1213
apply (auto simp add: hcomplex_mult_commute)
paulson@14314
  1214
done
paulson@14314
  1215
declare hcomplex_eq_cancel_iffA [iff]
paulson@14314
  1216
paulson@14335
  1217
lemma hcomplex_eq_cancel_iffB:
paulson@14335
  1218
     "(hcomplex_of_hypreal xa + hcomplex_of_hypreal ya * iii =
paulson@14314
  1219
       hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb) = ((xa = xb) & (ya = yb))"
paulson@14314
  1220
apply (auto simp add: hcomplex_mult_commute)
paulson@14314
  1221
done
paulson@14314
  1222
declare hcomplex_eq_cancel_iffB [iff]
paulson@14314
  1223
paulson@14335
  1224
lemma hcomplex_eq_cancel_iffC:
paulson@14335
  1225
     "(hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya  =
paulson@14314
  1226
       hcomplex_of_hypreal xb + hcomplex_of_hypreal yb * iii) = ((xa = xb) & (ya = yb))"
paulson@14314
  1227
apply (auto simp add: hcomplex_mult_commute)
paulson@14314
  1228
done
paulson@14314
  1229
declare hcomplex_eq_cancel_iffC [iff]
paulson@14314
  1230
paulson@14335
  1231
lemma hcomplex_eq_cancel_iff2:
paulson@14335
  1232
     "(hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y =
paulson@14314
  1233
      hcomplex_of_hypreal xa) = (x = xa & y = 0)"
paulson@14314
  1234
apply (cut_tac xa = "x" and ya = "y" and xb = "xa" and yb = "0" in hcomplex_eq_cancel_iff)
paulson@14314
  1235
apply (simp del: hcomplex_eq_cancel_iff)
paulson@14314
  1236
done
paulson@14314
  1237
declare hcomplex_eq_cancel_iff2 [simp]
paulson@14314
  1238
paulson@14335
  1239
lemma hcomplex_eq_cancel_iff2a:
paulson@14335
  1240
     "(hcomplex_of_hypreal x + hcomplex_of_hypreal y * iii =
paulson@14314
  1241
      hcomplex_of_hypreal xa) = (x = xa & y = 0)"
paulson@14314
  1242
apply (auto simp add: hcomplex_mult_commute)
paulson@14314
  1243
done
paulson@14314
  1244
declare hcomplex_eq_cancel_iff2a [simp]
paulson@14314
  1245
paulson@14335
  1246
lemma hcomplex_eq_cancel_iff3:
paulson@14335
  1247
     "(hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y =
paulson@14314
  1248
      iii * hcomplex_of_hypreal ya) = (x = 0 & y = ya)"
paulson@14314
  1249
apply (cut_tac xa = "x" and ya = "y" and xb = "0" and yb = "ya" in hcomplex_eq_cancel_iff)
paulson@14314
  1250
apply (simp del: hcomplex_eq_cancel_iff)
paulson@14314
  1251
done
paulson@14314
  1252
declare hcomplex_eq_cancel_iff3 [simp]
paulson@14314
  1253
paulson@14335
  1254
lemma hcomplex_eq_cancel_iff3a:
paulson@14335
  1255
     "(hcomplex_of_hypreal x + hcomplex_of_hypreal y * iii =
paulson@14314
  1256
      iii * hcomplex_of_hypreal ya) = (x = 0 & y = ya)"
paulson@14314
  1257
apply (auto simp add: hcomplex_mult_commute)
paulson@14314
  1258
done
paulson@14314
  1259
declare hcomplex_eq_cancel_iff3a [simp]
paulson@14314
  1260
paulson@14314
  1261
lemma hcomplex_split_hRe_zero:
paulson@14314
  1262
     "hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y = 0
paulson@14314
  1263
      ==> x = 0"
paulson@14314
  1264
apply (unfold iii_def)
paulson@14314
  1265
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
  1266
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
  1267
apply (auto simp add: hcomplex_of_hypreal hcomplex_add hcomplex_mult hcomplex_zero_def hypreal_zero_num)
paulson@14314
  1268
apply ultra
paulson@14314
  1269
apply (auto simp add: complex_split_Re_zero)
paulson@14314
  1270
done
paulson@14314
  1271
paulson@14314
  1272
lemma hcomplex_split_hIm_zero:
paulson@14314
  1273
     "hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y = 0
paulson@14314
  1274
      ==> y = 0"
paulson@14314
  1275
apply (unfold iii_def)
paulson@14314
  1276
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
  1277
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
  1278
apply (auto simp add: hcomplex_of_hypreal hcomplex_add hcomplex_mult hcomplex_zero_def hypreal_zero_num)
paulson@14314
  1279
apply ultra
paulson@14314
  1280
apply (auto simp add: complex_split_Im_zero)
paulson@14314
  1281
done
paulson@14314
  1282
paulson@14314
  1283
lemma hRe_hsgn: "hRe(hsgn z) = hRe(z)/hcmod z"
paulson@14314
  1284
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
  1285
apply (auto simp add: hsgn hcmod hRe hypreal_divide)
paulson@14314
  1286
done
paulson@14314
  1287
declare hRe_hsgn [simp]
paulson@14314
  1288
paulson@14314
  1289
lemma hIm_hsgn: "hIm(hsgn z) = hIm(z)/hcmod z"
paulson@14314
  1290
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
  1291
apply (auto simp add: hsgn hcmod hIm hypreal_divide)
paulson@14314
  1292
done
paulson@14314
  1293
declare hIm_hsgn [simp]
paulson@14314
  1294
paulson@14335
  1295
lemma real_two_squares_add_zero_iff:
paulson@14335
  1296
     "(x*x + y*y = 0) = ((x::real) = 0 & y = 0)"
paulson@14314
  1297
apply (auto intro: real_sum_squares_cancel)
paulson@14314
  1298
done
paulson@14314
  1299
declare real_two_squares_add_zero_iff [simp]
paulson@14314
  1300
paulson@14335
  1301
lemma hcomplex_inverse_complex_split:
paulson@14335
  1302
     "inverse(hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y) =
paulson@14314
  1303
      hcomplex_of_hypreal(x/(x ^ 2 + y ^ 2)) -
paulson@14314
  1304
      iii * hcomplex_of_hypreal(y/(x ^ 2 + y ^ 2))"
paulson@14314
  1305
apply (rule_tac z = "x" in eq_Abs_hypreal)
paulson@14314
  1306
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14323
  1307
apply (auto simp add: hcomplex_of_hypreal hcomplex_mult hcomplex_add iii_def starfun hypreal_mult hypreal_add hcomplex_inverse hypreal_divide hcomplex_diff complex_inverse_complex_split numeral_2_eq_2)
paulson@14314
  1308
done
paulson@14314
  1309
paulson@14314
  1310
lemma hRe_mult_i_eq:
paulson@14314
  1311
    "hRe (iii * hcomplex_of_hypreal y) = 0"
paulson@14314
  1312
apply (unfold iii_def)
paulson@14314
  1313
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
  1314
apply (auto simp add: hcomplex_of_hypreal hcomplex_mult hRe hypreal_zero_num)
paulson@14314
  1315
done
paulson@14314
  1316
declare hRe_mult_i_eq [simp]
paulson@14314
  1317
paulson@14314
  1318
lemma hIm_mult_i_eq:
paulson@14314
  1319
    "hIm (iii * hcomplex_of_hypreal y) = y"
paulson@14314
  1320
apply (unfold iii_def)
paulson@14314
  1321
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
  1322
apply (auto simp add: hcomplex_of_hypreal hcomplex_mult hIm hypreal_zero_num)
paulson@14314
  1323
done
paulson@14314
  1324
declare hIm_mult_i_eq [simp]
paulson@14314
  1325
paulson@14314
  1326
lemma hcmod_mult_i: "hcmod (iii * hcomplex_of_hypreal y) = abs y"
paulson@14314
  1327
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
  1328
apply (auto simp add: hcomplex_of_hypreal hcmod hypreal_hrabs iii_def hcomplex_mult)
paulson@14314
  1329
done
paulson@14314
  1330
declare hcmod_mult_i [simp]
paulson@14314
  1331
paulson@14314
  1332
lemma hcmod_mult_i2: "hcmod (hcomplex_of_hypreal y * iii) = abs y"
paulson@14314
  1333
apply (auto simp add: hcomplex_mult_commute)
paulson@14314
  1334
done
paulson@14314
  1335
declare hcmod_mult_i2 [simp]
paulson@14314
  1336
paulson@14314
  1337
(*---------------------------------------------------------------------------*)
paulson@14314
  1338
(*  harg                                                                     *)
paulson@14314
  1339
(*---------------------------------------------------------------------------*)
paulson@14314
  1340
paulson@14314
  1341
lemma harg:
paulson@14314
  1342
  "harg (Abs_hcomplex(hcomplexrel `` {%n. X n})) =
paulson@14314
  1343
      Abs_hypreal(hyprel `` {%n. arg (X n)})"
paulson@14314
  1344
paulson@14314
  1345
apply (unfold harg_def)
paulson@14314
  1346
apply (rule_tac f = "Abs_hypreal" in arg_cong)
paulson@14335
  1347
apply (auto, ultra)
paulson@14314
  1348
done
paulson@14314
  1349
paulson@14354
  1350
lemma cos_harg_i_mult_zero_pos:
paulson@14335
  1351
     "0 < y ==> ( *f* cos) (harg(iii * hcomplex_of_hypreal y)) = 0"
paulson@14314
  1352
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14354
  1353
apply (auto simp add: hcomplex_of_hypreal iii_def hcomplex_mult 
paulson@14354
  1354
                hypreal_zero_num hypreal_less starfun harg)
paulson@14314
  1355
apply (ultra)
paulson@14314
  1356
done
paulson@14314
  1357
paulson@14354
  1358
lemma cos_harg_i_mult_zero_neg:
paulson@14335
  1359
     "y < 0 ==> ( *f* cos) (harg(iii * hcomplex_of_hypreal y)) = 0"
paulson@14314
  1360
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14354
  1361
apply (auto simp add: hcomplex_of_hypreal iii_def hcomplex_mult
paulson@14354
  1362
                      hypreal_zero_num hypreal_less starfun harg)
paulson@14314
  1363
apply (ultra)
paulson@14314
  1364
done
paulson@14314
  1365
paulson@14354
  1366
lemma cos_harg_i_mult_zero [simp]:
paulson@14354
  1367
     "y \<noteq> 0 ==> ( *f* cos) (harg(iii * hcomplex_of_hypreal y)) = 0"
paulson@14354
  1368
apply (cut_tac x = "y" and y = "0" in hypreal_linear)
paulson@14354
  1369
apply (auto simp add: cos_harg_i_mult_zero_pos cos_harg_i_mult_zero_neg)
paulson@14354
  1370
done
paulson@14354
  1371
paulson@14354
  1372
lemma hcomplex_of_hypreal_zero_iff [simp]:
paulson@14354
  1373
     "(hcomplex_of_hypreal y = 0) = (y = 0)"
paulson@14314
  1374
apply (rule_tac z = "y" in eq_Abs_hypreal)
paulson@14314
  1375
apply (auto simp add: hcomplex_of_hypreal hypreal_zero_num hcomplex_zero_def)
paulson@14314
  1376
done
paulson@14314
  1377
paulson@14314
  1378
paulson@14354
  1379
subsection{*Polar Form for Nonstandard Complex Numbers*}
paulson@14314
  1380
paulson@14335
  1381
lemma complex_split_polar2:
paulson@14354
  1382
     "\<forall>n. \<exists>r a. (z n) = complex_of_real r *
paulson@14314
  1383
      (complex_of_real(cos a) + ii * complex_of_real(sin a))"
paulson@14314
  1384
apply (blast intro: complex_split_polar)
paulson@14314
  1385
done
paulson@14314
  1386
paulson@14314
  1387
lemma hcomplex_split_polar:
paulson@14354
  1388
  "\<exists>r a. z = hcomplex_of_hypreal r *
paulson@14314
  1389
   (hcomplex_of_hypreal(( *f* cos) a) + iii * hcomplex_of_hypreal(( *f* sin) a))"
paulson@14314
  1390
apply (rule_tac z = "z" in eq_Abs_hcomplex)
paulson@14314
  1391
apply (auto simp add: lemma_hypreal_P_EX2 hcomplex_of_hypreal iii_def starfun hcomplex_add hcomplex_mult)
paulson@14314
  1392
apply (cut_tac z = "x" in complex_split_polar2)
paulson@14335
  1393
apply (drule choice, safe)+
paulson@14314
  1394
apply (rule_tac x = "f" in exI)
paulson@14314
  1395
apply (rule_tac x = "fa" in exI)
paulson@14314
  1396
apply auto
paulson@14314
  1397
done
paulson@14314
  1398
paulson@14314
  1399
lemma hcis:
paulson@14314
  1400
  "hcis (Abs_hypreal(hyprel `` {%n. X n})) =
paulson@14314
  1401
      Abs_hcomplex(hcomplexrel `` {%n. cis (X n)})"
paulson@14314
  1402
apply (unfold hcis_def)
paulson@14314
  1403
apply (rule_tac f = "Abs_hcomplex" in arg_cong)
paulson@14314
  1404
apply auto
paulson@14314
  1405
apply (ultra)
paulson@14314
  1406
done
paulson@14314
  1407
paulson@14314
  1408
lemma hcis_eq:
paulson@14314
  1409
   "hcis a =
paulson@14314
  1410
    (hcomplex_of_hypreal(( *f* cos) a) +
paulson@14314
  1411
    iii * hcomplex_of_hypreal(( *f* sin) a))"
paulson@14314
  1412
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1413
apply (auto simp add: starfun hcis hcomplex_of_hypreal iii_def hcomplex_mult hcomplex_add cis_def)
paulson@14314
  1414
done
paulson@14314
  1415
paulson@14314
  1416
lemma hrcis:
paulson@14314
  1417
  "hrcis (Abs_hypreal(hyprel `` {%n. X n})) (Abs_hypreal(hyprel `` {%n. Y n})) =
paulson@14314
  1418
      Abs_hcomplex(hcomplexrel `` {%n. rcis (X n) (Y n)})"
paulson@14314
  1419
apply (unfold hrcis_def)
paulson@14314
  1420
apply (auto simp add: hcomplex_of_hypreal hcomplex_mult hcis rcis_def)
paulson@14314
  1421
done
paulson@14314
  1422
paulson@14354
  1423
lemma hrcis_Ex: "\<exists>r a. z = hrcis r a"
paulson@14314
  1424
apply (simp (no_asm) add: hrcis_def hcis_eq)
paulson@14314
  1425
apply (rule hcomplex_split_polar)
paulson@14314
  1426
done
paulson@14314
  1427
paulson@14335
  1428
lemma hRe_hcomplex_polar:
paulson@14335
  1429
     "hRe(hcomplex_of_hypreal r *
paulson@14314
  1430
      (hcomplex_of_hypreal(( *f* cos) a) +
paulson@14314
  1431
       iii * hcomplex_of_hypreal(( *f* sin) a))) = r * ( *f* cos) a"
paulson@14335
  1432
apply (auto simp add: right_distrib hcomplex_of_hypreal_mult mult_ac)
paulson@14314
  1433
done
paulson@14314
  1434
declare hRe_hcomplex_polar [simp]
paulson@14314
  1435
paulson@14314
  1436
lemma hRe_hrcis: "hRe(hrcis r a) = r * ( *f* cos) a"
paulson@14314
  1437
apply (unfold hrcis_def)
paulson@14314
  1438
apply (auto simp add: hcis_eq)
paulson@14314
  1439
done
paulson@14314
  1440
declare hRe_hrcis [simp]
paulson@14314
  1441
paulson@14335
  1442
lemma hIm_hcomplex_polar:
paulson@14335
  1443
     "hIm(hcomplex_of_hypreal r *
paulson@14314
  1444
      (hcomplex_of_hypreal(( *f* cos) a) +
paulson@14314
  1445
       iii * hcomplex_of_hypreal(( *f* sin) a))) = r * ( *f* sin) a"
paulson@14335
  1446
apply (auto simp add: right_distrib hcomplex_of_hypreal_mult mult_ac)
paulson@14314
  1447
done
paulson@14314
  1448
declare hIm_hcomplex_polar [simp]
paulson@14314
  1449
paulson@14314
  1450
lemma hIm_hrcis: "hIm(hrcis r a) = r * ( *f* sin) a"
paulson@14314
  1451
apply (unfold hrcis_def)
paulson@14314
  1452
apply (auto simp add: hcis_eq)
paulson@14314
  1453
done
paulson@14314
  1454
declare hIm_hrcis [simp]
paulson@14314
  1455
paulson@14335
  1456
lemma hcmod_complex_polar:
paulson@14335
  1457
     "hcmod (hcomplex_of_hypreal r *
paulson@14314
  1458
      (hcomplex_of_hypreal(( *f* cos) a) +
paulson@14314
  1459
       iii * hcomplex_of_hypreal(( *f* sin) a))) = abs r"
paulson@14314
  1460
apply (rule_tac z = "r" in eq_Abs_hypreal)
paulson@14314
  1461
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1462
apply (auto simp add: iii_def starfun hcomplex_of_hypreal hcomplex_mult hcmod hcomplex_add hypreal_hrabs)
paulson@14314
  1463
done
paulson@14314
  1464
declare hcmod_complex_polar [simp]
paulson@14314
  1465
paulson@14314
  1466
lemma hcmod_hrcis: "hcmod(hrcis r a) = abs r"
paulson@14314
  1467
apply (unfold hrcis_def)
paulson@14314
  1468
apply (auto simp add: hcis_eq)
paulson@14314
  1469
done
paulson@14314
  1470
declare hcmod_hrcis [simp]
paulson@14314
  1471
paulson@14314
  1472
(*---------------------------------------------------------------------------*)
paulson@14314
  1473
(*  (r1 * hrcis a) * (r2 * hrcis b) = r1 * r2 * hrcis (a + b)                *)
paulson@14314
  1474
(*---------------------------------------------------------------------------*)
paulson@14314
  1475
paulson@14314
  1476
lemma hcis_hrcis_eq: "hcis a = hrcis 1 a"
paulson@14314
  1477
apply (unfold hrcis_def)
paulson@14314
  1478
apply (simp (no_asm))
paulson@14314
  1479
done
paulson@14314
  1480
declare hcis_hrcis_eq [symmetric, simp]
paulson@14314
  1481
paulson@14314
  1482
lemma hrcis_mult:
paulson@14314
  1483
  "hrcis r1 a * hrcis r2 b = hrcis (r1*r2) (a + b)"
paulson@14314
  1484
apply (unfold hrcis_def)
paulson@14314
  1485
apply (rule_tac z = "r1" in eq_Abs_hypreal)
paulson@14314
  1486
apply (rule_tac z = "r2" in eq_Abs_hypreal)
paulson@14314
  1487
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1488
apply (rule_tac z = "b" in eq_Abs_hypreal)
paulson@14314
  1489
apply (auto simp add: hrcis hcis hypreal_add hypreal_mult hcomplex_of_hypreal
paulson@14314
  1490
                      hcomplex_mult cis_mult [symmetric] 
paulson@14314
  1491
                      complex_of_real_mult [symmetric])
paulson@14314
  1492
done
paulson@14314
  1493
paulson@14314
  1494
lemma hcis_mult: "hcis a * hcis b = hcis (a + b)"
paulson@14314
  1495
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1496
apply (rule_tac z = "b" in eq_Abs_hypreal)
paulson@14314
  1497
apply (auto simp add: hcis hcomplex_mult hypreal_add cis_mult)
paulson@14314
  1498
done
paulson@14314
  1499
paulson@14314
  1500
lemma hcis_zero:
paulson@14314
  1501
  "hcis 0 = 1"
paulson@14314
  1502
apply (unfold hcomplex_one_def)
paulson@14314
  1503
apply (auto simp add: hcis hypreal_zero_num)
paulson@14314
  1504
done
paulson@14314
  1505
declare hcis_zero [simp]
paulson@14314
  1506
paulson@14314
  1507
lemma hrcis_zero_mod:
paulson@14314
  1508
  "hrcis 0 a = 0"
paulson@14314
  1509
apply (unfold hcomplex_zero_def)
paulson@14314
  1510
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1511
apply (auto simp add: hrcis hypreal_zero_num)
paulson@14314
  1512
done
paulson@14314
  1513
declare hrcis_zero_mod [simp]
paulson@14314
  1514
paulson@14314
  1515
lemma hrcis_zero_arg: "hrcis r 0 = hcomplex_of_hypreal r"
paulson@14314
  1516
apply (rule_tac z = "r" in eq_Abs_hypreal)
paulson@14314
  1517
apply (auto simp add: hrcis hypreal_zero_num hcomplex_of_hypreal)
paulson@14314
  1518
done
paulson@14314
  1519
declare hrcis_zero_arg [simp]
paulson@14314
  1520
paulson@14314
  1521
lemma hcomplex_i_mult_minus: "iii * (iii * x) = - x"
paulson@14314
  1522
apply (simp (no_asm) add: hcomplex_mult_assoc [symmetric])
paulson@14314
  1523
done
paulson@14314
  1524
declare hcomplex_i_mult_minus [simp]
paulson@14314
  1525
paulson@14314
  1526
lemma hcomplex_i_mult_minus2: "iii * iii * x = - x"
paulson@14314
  1527
apply (simp (no_asm))
paulson@14314
  1528
done
paulson@14314
  1529
declare hcomplex_i_mult_minus2 [simp]
paulson@14314
  1530
paulson@14314
  1531
lemma hcis_hypreal_of_nat_Suc_mult:
paulson@14314
  1532
   "hcis (hypreal_of_nat (Suc n) * a) = hcis a * hcis (hypreal_of_nat n * a)"
paulson@14314
  1533
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1534
apply (auto simp add: hypreal_of_nat hcis hypreal_mult hcomplex_mult cis_real_of_nat_Suc_mult)
paulson@14314
  1535
done
paulson@14314
  1536
paulson@14314
  1537
lemma NSDeMoivre: "(hcis a) ^ n = hcis (hypreal_of_nat n * a)"
paulson@14314
  1538
apply (induct_tac "n")
paulson@14314
  1539
apply (auto simp add: hcis_hypreal_of_nat_Suc_mult)
paulson@14314
  1540
done
paulson@14314
  1541
paulson@14335
  1542
lemma hcis_hypreal_of_hypnat_Suc_mult:
paulson@14335
  1543
     "hcis (hypreal_of_hypnat (n + 1) * a) =
paulson@14314
  1544
      hcis a * hcis (hypreal_of_hypnat n * a)"
paulson@14314
  1545
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1546
apply (rule_tac z = "n" in eq_Abs_hypnat)
paulson@14314
  1547
apply (auto simp add: hcis hypreal_of_hypnat hypnat_add hypnat_one_def hypreal_mult hcomplex_mult cis_real_of_nat_Suc_mult)
paulson@14314
  1548
done
paulson@14314
  1549
paulson@14314
  1550
lemma NSDeMoivre_ext: "(hcis a) hcpow n = hcis (hypreal_of_hypnat n * a)"
paulson@14314
  1551
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1552
apply (rule_tac z = "n" in eq_Abs_hypnat)
paulson@14314
  1553
apply (auto simp add: hcis hypreal_of_hypnat hypreal_mult hcpow DeMoivre)
paulson@14314
  1554
done
paulson@14314
  1555
paulson@14314
  1556
lemma DeMoivre2:
paulson@14314
  1557
  "(hrcis r a) ^ n = hrcis (r ^ n) (hypreal_of_nat n * a)"
paulson@14314
  1558
apply (unfold hrcis_def)
paulson@14354
  1559
apply (auto simp add: power_mult_distrib NSDeMoivre hcomplex_of_hypreal_pow)
paulson@14314
  1560
done
paulson@14314
  1561
paulson@14314
  1562
lemma DeMoivre2_ext:
paulson@14314
  1563
  "(hrcis r a) hcpow n = hrcis (r pow n) (hypreal_of_hypnat n * a)"
paulson@14314
  1564
apply (unfold hrcis_def)
paulson@14314
  1565
apply (auto simp add: hcpow_mult NSDeMoivre_ext hcomplex_of_hypreal_hyperpow)
paulson@14314
  1566
done
paulson@14314
  1567
paulson@14314
  1568
lemma hcis_inverse: "inverse(hcis a) = hcis (-a)"
paulson@14314
  1569
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1570
apply (auto simp add: hcomplex_inverse hcis hypreal_minus)
paulson@14314
  1571
done
paulson@14314
  1572
declare hcis_inverse [simp]
paulson@14314
  1573
paulson@14314
  1574
lemma hrcis_inverse: "inverse(hrcis r a) = hrcis (inverse r) (-a)"
paulson@14314
  1575
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1576
apply (rule_tac z = "r" in eq_Abs_hypreal)
paulson@14314
  1577
apply (auto simp add: hcomplex_inverse hrcis hypreal_minus hypreal_inverse rcis_inverse)
paulson@14314
  1578
apply (ultra)
paulson@14314
  1579
apply (unfold real_divide_def)
paulson@14314
  1580
apply (auto simp add: INVERSE_ZERO)
paulson@14314
  1581
done
paulson@14314
  1582
paulson@14314
  1583
lemma hRe_hcis: "hRe(hcis a) = ( *f* cos) a"
paulson@14314
  1584
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1585
apply (auto simp add: hcis starfun hRe)
paulson@14314
  1586
done
paulson@14314
  1587
declare hRe_hcis [simp]
paulson@14314
  1588
paulson@14314
  1589
lemma hIm_hcis: "hIm(hcis a) = ( *f* sin) a"
paulson@14314
  1590
apply (rule_tac z = "a" in eq_Abs_hypreal)
paulson@14314
  1591
apply (auto simp add: hcis starfun hIm)
paulson@14314
  1592
done
paulson@14314
  1593
declare hIm_hcis [simp]
paulson@14314
  1594
paulson@14335
  1595
lemma cos_n_hRe_hcis_pow_n:
paulson@14335
  1596
     "( *f* cos) (hypreal_of_nat n * a) = hRe(hcis a ^ n)"
paulson@14314
  1597
apply (auto simp add: NSDeMoivre)
paulson@14314
  1598
done
paulson@14314
  1599
paulson@14335
  1600
lemma sin_n_hIm_hcis_pow_n:
paulson@14335
  1601
     "( *f* sin) (hypreal_of_nat n * a) = hIm(hcis a ^ n)"
paulson@14314
  1602
apply (auto simp add: NSDeMoivre)
paulson@14314
  1603
done
paulson@14314
  1604
paulson@14335
  1605
lemma cos_n_hRe_hcis_hcpow_n:
paulson@14335
  1606
     "( *f* cos) (hypreal_of_hypnat n * a) = hRe(hcis a hcpow n)"
paulson@14314
  1607
apply (auto simp add: NSDeMoivre_ext)
paulson@14314
  1608
done
paulson@14314
  1609
paulson@14335
  1610
lemma sin_n_hIm_hcis_hcpow_n:
paulson@14335
  1611
     "( *f* sin) (hypreal_of_hypnat n * a) = hIm(hcis a hcpow n)"
paulson@14314
  1612
apply (auto simp add: NSDeMoivre_ext)
paulson@14314
  1613
done
paulson@14314
  1614
paulson@14314
  1615
lemma hexpi_add: "hexpi(a + b) = hexpi(a) * hexpi(b)"
paulson@14314
  1616
apply (unfold hexpi_def)
paulson@14314
  1617
apply (rule_tac z = "a" in eq_Abs_hcomplex)
paulson@14314
  1618
apply (rule_tac z = "b" in eq_Abs_hcomplex)
paulson@14314
  1619
apply (auto simp add: hcis hRe hIm hcomplex_add hcomplex_mult hypreal_mult starfun hcomplex_of_hypreal cis_mult [symmetric] complex_Im_add complex_Re_add exp_add complex_of_real_mult)
paulson@14314
  1620
done
paulson@14314
  1621
paulson@14314
  1622
paulson@14354
  1623
subsection{*@{term hcomplex_of_complex}: the Injection from 
paulson@14354
  1624
  type @{typ complex} to to @{typ hcomplex}*}
paulson@14354
  1625
paulson@14354
  1626
lemma inj_hcomplex_of_complex: "inj(hcomplex_of_complex)"
paulson@14354
  1627
apply (rule inj_onI , rule ccontr)
paulson@14354
  1628
apply (auto simp add: hcomplex_of_complex_def)
paulson@14354
  1629
done
paulson@14354
  1630
paulson@14354
  1631
lemma hcomplex_of_complex_i: "iii = hcomplex_of_complex ii"
paulson@14354
  1632
apply (unfold iii_def hcomplex_of_complex_def)
paulson@14354
  1633
apply (simp (no_asm))
paulson@14354
  1634
done
paulson@14314
  1635
paulson@14314
  1636
lemma hcomplex_of_complex_add:
paulson@14314
  1637
     "hcomplex_of_complex (z1 + z2) = hcomplex_of_complex z1 + hcomplex_of_complex z2"
paulson@14314
  1638
apply (unfold hcomplex_of_complex_def)
paulson@14314
  1639
apply (simp (no_asm) add: hcomplex_add)
paulson@14314
  1640
done
paulson@14314
  1641
declare hcomplex_of_complex_add [simp]
paulson@14314
  1642
paulson@14314
  1643
lemma hcomplex_of_complex_mult:
paulson@14314
  1644
     "hcomplex_of_complex (z1 * z2) = hcomplex_of_complex z1 * hcomplex_of_complex z2"
paulson@14314
  1645
apply (unfold hcomplex_of_complex_def)
paulson@14314
  1646
apply (simp (no_asm) add: hcomplex_mult)
paulson@14314
  1647
done
paulson@14314
  1648
declare hcomplex_of_complex_mult [simp]
paulson@14314
  1649
paulson@14314
  1650
lemma hcomplex_of_complex_eq_iff:
paulson@14314
  1651
 "(hcomplex_of_complex z1 = hcomplex_of_complex z2) = (z1 = z2)"
paulson@14314
  1652
apply (unfold hcomplex_of_complex_def)
paulson@14314
  1653
apply auto
paulson@14314
  1654
done
paulson@14314
  1655
declare hcomplex_of_complex_eq_iff [simp]
paulson@14314
  1656
paulson@14335
  1657
lemma hcomplex_of_complex_minus:
paulson@14335
  1658
     "hcomplex_of_complex (-r) = - hcomplex_of_complex  r"
paulson@14314
  1659
apply (unfold hcomplex_of_complex_def)
paulson@14314
  1660
apply (auto simp add: hcomplex_minus)
paulson@14314
  1661
done
paulson@14314
  1662
declare hcomplex_of_complex_minus [simp]
paulson@14314
  1663
paulson@14320
  1664
lemma hcomplex_of_complex_one [simp]:
paulson@14314
  1665
      "hcomplex_of_complex 1 = 1"
paulson@14314
  1666
apply (unfold hcomplex_of_complex_def hcomplex_one_def)
paulson@14314
  1667
apply auto
paulson@14314
  1668
done
paulson@14314
  1669
paulson@14320
  1670
lemma hcomplex_of_complex_zero [simp]:
paulson@14314
  1671
      "hcomplex_of_complex 0 = 0"
paulson@14314
  1672
apply (unfold hcomplex_of_complex_def hcomplex_zero_def)
paulson@14314
  1673
apply (simp (no_asm))
paulson@14314
  1674
done
paulson@14314
  1675
paulson@14314
  1676
lemma hcomplex_of_complex_zero_iff: "(hcomplex_of_complex r = 0) = (r = 0)"
paulson@14314
  1677
apply (auto intro: FreeUltrafilterNat_P simp add: hcomplex_of_complex_def hcomplex_zero_def)
paulson@14314
  1678
done
paulson@14314
  1679
paulson@14335
  1680
lemma hcomplex_of_complex_inverse:
paulson@14335
  1681
     "hcomplex_of_complex (inverse r) = inverse (hcomplex_of_complex r)"
paulson@14314
  1682
apply (case_tac "r=0")
paulson@14336
  1683
apply (simp add: hcomplex_of_complex_zero)
paulson@14336
  1684
apply (rule_tac c1 = "hcomplex_of_complex r" 
paulson@14336
  1685
       in hcomplex_mult_left_cancel [THEN iffD1])
paulson@14314
  1686
apply (force simp add: hcomplex_of_complex_zero_iff)
paulson@14314
  1687
apply (subst hcomplex_of_complex_mult [symmetric])
paulson@14336
  1688
apply (auto simp add: hcomplex_of_complex_one hcomplex_of_complex_zero_iff)
paulson@14314
  1689
done
paulson@14314
  1690
declare hcomplex_of_complex_inverse [simp]
paulson@14314
  1691
paulson@14335
  1692
lemma hcomplex_of_complex_divide:
paulson@14335
  1693
     "hcomplex_of_complex (z1 / z2) = hcomplex_of_complex z1 / hcomplex_of_complex z2"
paulson@14314
  1694
apply (simp (no_asm) add: hcomplex_divide_def complex_divide_def)
paulson@14314
  1695
done
paulson@14314
  1696
declare hcomplex_of_complex_divide [simp]
paulson@14314
  1697
paulson@14314
  1698
lemma hRe_hcomplex_of_complex:
paulson@14314
  1699
   "hRe (hcomplex_of_complex z) = hypreal_of_real (Re z)"
paulson@14314
  1700
apply (unfold hcomplex_of_complex_def hypreal_of_real_def)
paulson@14314
  1701
apply (auto simp add: hRe)
paulson@14314
  1702
done
paulson@14314
  1703
paulson@14314
  1704
lemma hIm_hcomplex_of_complex:
paulson@14314
  1705
   "hIm (hcomplex_of_complex z) = hypreal_of_real (Im z)"
paulson@14314
  1706
apply (unfold hcomplex_of_complex_def hypreal_of_real_def)
paulson@14314
  1707
apply (auto simp add: hIm)
paulson@14314
  1708
done
paulson@14314
  1709
paulson@14314
  1710
lemma hcmod_hcomplex_of_complex:
paulson@14314
  1711
     "hcmod (hcomplex_of_complex x) = hypreal_of_real (cmod x)"
paulson@14314
  1712
apply (unfold hypreal_of_real_def hcomplex_of_complex_def)
paulson@14314
  1713
apply (auto simp add: hcmod)
paulson@14314
  1714
done
paulson@14314
  1715
paulson@14314
  1716
ML
paulson@14314
  1717
{*
paulson@14314
  1718
val hcomplex_zero_def = thm"hcomplex_zero_def";
paulson@14314
  1719
val hcomplex_one_def = thm"hcomplex_one_def";
paulson@14314
  1720
val hcomplex_minus_def = thm"hcomplex_minus_def";
paulson@14314
  1721
val hcomplex_diff_def = thm"hcomplex_diff_def";
paulson@14314
  1722
val hcomplex_divide_def = thm"hcomplex_divide_def";
paulson@14314
  1723
val hcomplex_mult_def = thm"hcomplex_mult_def";
paulson@14314
  1724
val hcomplex_add_def = thm"hcomplex_add_def";
paulson@14314
  1725
val hcomplex_of_complex_def = thm"hcomplex_of_complex_def";
paulson@14314
  1726
val iii_def = thm"iii_def";
paulson@14314
  1727
paulson@14314
  1728
val hcomplexrel_iff = thm"hcomplexrel_iff";
paulson@14314
  1729
val hcomplexrel_refl = thm"hcomplexrel_refl";
paulson@14314
  1730
val hcomplexrel_sym = thm"hcomplexrel_sym";
paulson@14314
  1731
val hcomplexrel_trans = thm"hcomplexrel_trans";
paulson@14314
  1732
val equiv_hcomplexrel = thm"equiv_hcomplexrel";
paulson@14314
  1733
val equiv_hcomplexrel_iff = thm"equiv_hcomplexrel_iff";
paulson@14314
  1734
val hcomplexrel_in_hcomplex = thm"hcomplexrel_in_hcomplex";
paulson@14314
  1735
val inj_on_Abs_hcomplex = thm"inj_on_Abs_hcomplex";
paulson@14314
  1736
val inj_Rep_hcomplex = thm"inj_Rep_hcomplex";
paulson@14314
  1737
val lemma_hcomplexrel_refl = thm"lemma_hcomplexrel_refl";
paulson@14314
  1738
val hcomplex_empty_not_mem = thm"hcomplex_empty_not_mem";
paulson@14314
  1739
val Rep_hcomplex_nonempty = thm"Rep_hcomplex_nonempty";
paulson@14314
  1740
val eq_Abs_hcomplex = thm"eq_Abs_hcomplex";
paulson@14314
  1741
val hRe = thm"hRe";
paulson@14314
  1742
val hIm = thm"hIm";
paulson@14314
  1743
val hcomplex_hRe_hIm_cancel_iff = thm"hcomplex_hRe_hIm_cancel_iff";
paulson@14314
  1744
val hcomplex_hRe_zero = thm"hcomplex_hRe_zero";
paulson@14314
  1745
val hcomplex_hIm_zero = thm"hcomplex_hIm_zero";
paulson@14314
  1746
val hcomplex_hRe_one = thm"hcomplex_hRe_one";
paulson@14314
  1747
val hcomplex_hIm_one = thm"hcomplex_hIm_one";
paulson@14314
  1748
val inj_hcomplex_of_complex = thm"inj_hcomplex_of_complex";
paulson@14314
  1749
val hcomplex_of_complex_i = thm"hcomplex_of_complex_i";
paulson@14314
  1750
val hcomplex_add_congruent2 = thm"hcomplex_add_congruent2";
paulson@14314
  1751
val hcomplex_add = thm"hcomplex_add";
paulson@14314
  1752
val hcomplex_add_commute = thm"hcomplex_add_commute";
paulson@14314
  1753
val hcomplex_add_assoc = thm"hcomplex_add_assoc";
paulson@14314
  1754
val hcomplex_add_zero_left = thm"hcomplex_add_zero_left";
paulson@14314
  1755
val hcomplex_add_zero_right = thm"hcomplex_add_zero_right";
paulson@14314
  1756
val hRe_add = thm"hRe_add";
paulson@14314
  1757
val hIm_add = thm"hIm_add";
paulson@14314
  1758
val hcomplex_minus_congruent = thm"hcomplex_minus_congruent";
paulson@14314
  1759
val hcomplex_minus = thm"hcomplex_minus";
paulson@14314
  1760
val inj_hcomplex_minus = thm"inj_hcomplex_minus";
paulson@14314
  1761
val hcomplex_add_minus_left = thm"hcomplex_add_minus_left";
paulson@14314
  1762
val hRe_minus = thm"hRe_minus";
paulson@14314
  1763
val hIm_minus = thm"hIm_minus";
paulson@14314
  1764
val hcomplex_add_minus_eq_minus = thm"hcomplex_add_minus_eq_minus";
paulson@14314
  1765
val hcomplex_diff = thm"hcomplex_diff";
paulson@14314
  1766
val hcomplex_diff_eq_eq = thm"hcomplex_diff_eq_eq";
paulson@14314
  1767
val hcomplex_mult = thm"hcomplex_mult";
paulson@14314
  1768
val hcomplex_mult_commute = thm"hcomplex_mult_commute";
paulson@14314
  1769
val hcomplex_mult_assoc = thm"hcomplex_mult_assoc";
paulson@14314
  1770
val hcomplex_mult_one_left = thm"hcomplex_mult_one_left";
paulson@14314
  1771
val hcomplex_mult_one_right = thm"hcomplex_mult_one_right";
paulson@14314
  1772
val hcomplex_mult_zero_left = thm"hcomplex_mult_zero_left";
paulson@14314
  1773
val hcomplex_mult_minus_one = thm"hcomplex_mult_minus_one";
paulson@14314
  1774
val hcomplex_mult_minus_one_right = thm"hcomplex_mult_minus_one_right";
paulson@14314
  1775
val hcomplex_add_mult_distrib = thm"hcomplex_add_mult_distrib";
paulson@14314
  1776
val hcomplex_zero_not_eq_one = thm"hcomplex_zero_not_eq_one";
paulson@14314
  1777
val hcomplex_inverse = thm"hcomplex_inverse";
paulson@14314
  1778
val HCOMPLEX_INVERSE_ZERO = thm"HCOMPLEX_INVERSE_ZERO";
paulson@14314
  1779
val HCOMPLEX_DIVISION_BY_ZERO = thm"HCOMPLEX_DIVISION_BY_ZERO";
paulson@14314
  1780
val hcomplex_mult_inv_left = thm"hcomplex_mult_inv_left";
paulson@14314
  1781
val hcomplex_mult_left_cancel = thm"hcomplex_mult_left_cancel";
paulson@14314
  1782
val hcomplex_mult_right_cancel = thm"hcomplex_mult_right_cancel";
paulson@14314
  1783
val hcomplex_add_divide_distrib = thm"hcomplex_add_divide_distrib";
paulson@14314
  1784
val hcomplex_of_hypreal = thm"hcomplex_of_hypreal";
paulson@14314
  1785
val inj_hcomplex_of_hypreal = thm"inj_hcomplex_of_hypreal";
paulson@14314
  1786
val hcomplex_of_hypreal_cancel_iff = thm"hcomplex_of_hypreal_cancel_iff";
paulson@14314
  1787
val hcomplex_of_hypreal_minus = thm"hcomplex_of_hypreal_minus";
paulson@14314
  1788
val hcomplex_of_hypreal_inverse = thm"hcomplex_of_hypreal_inverse";
paulson@14314
  1789
val hcomplex_of_hypreal_add = thm"hcomplex_of_hypreal_add";
paulson@14314
  1790
val hcomplex_of_hypreal_diff = thm"hcomplex_of_hypreal_diff";
paulson@14314
  1791
val hcomplex_of_hypreal_mult = thm"hcomplex_of_hypreal_mult";
paulson@14314
  1792
val hcomplex_of_hypreal_divide = thm"hcomplex_of_hypreal_divide";
paulson@14314
  1793
val hcomplex_of_hypreal_one = thm"hcomplex_of_hypreal_one";
paulson@14314
  1794
val hcomplex_of_hypreal_zero = thm"hcomplex_of_hypreal_zero";
paulson@14314
  1795
val hcomplex_of_hypreal_pow = thm"hcomplex_of_hypreal_pow";
paulson@14314
  1796
val hRe_hcomplex_of_hypreal = thm"hRe_hcomplex_of_hypreal";
paulson@14314
  1797
val hIm_hcomplex_of_hypreal = thm"hIm_hcomplex_of_hypreal";
paulson@14314
  1798
val hcomplex_of_hypreal_epsilon_not_zero = thm"hcomplex_of_hypreal_epsilon_not_zero";
paulson@14314
  1799
val hcmod = thm"hcmod";
paulson@14314
  1800
val hcmod_zero = thm"hcmod_zero";
paulson@14314
  1801
val hcmod_one = thm"hcmod_one";
paulson@14314
  1802
val hcmod_hcomplex_of_hypreal = thm"hcmod_hcomplex_of_hypreal";
paulson@14314
  1803
val hcomplex_of_hypreal_abs = thm"hcomplex_of_hypreal_abs";
paulson@14314
  1804
val hcnj = thm"hcnj";
paulson@14314
  1805
val inj_hcnj = thm"inj_hcnj";
paulson@14314
  1806
val hcomplex_hcnj_cancel_iff = thm"hcomplex_hcnj_cancel_iff";
paulson@14314
  1807
val hcomplex_hcnj_hcnj = thm"hcomplex_hcnj_hcnj";
paulson@14314
  1808
val hcomplex_hcnj_hcomplex_of_hypreal = thm"hcomplex_hcnj_hcomplex_of_hypreal";
paulson@14314
  1809
val hcomplex_hmod_hcnj = thm"hcomplex_hmod_hcnj";
paulson@14314
  1810
val hcomplex_hcnj_minus = thm"hcomplex_hcnj_minus";
paulson@14314
  1811
val hcomplex_hcnj_inverse = thm"hcomplex_hcnj_inverse";
paulson@14314
  1812
val hcomplex_hcnj_add = thm"hcomplex_hcnj_add";
paulson@14314
  1813
val hcomplex_hcnj_diff = thm"hcomplex_hcnj_diff";
paulson@14314
  1814
val hcomplex_hcnj_mult = thm"hcomplex_hcnj_mult";
paulson@14314
  1815
val hcomplex_hcnj_divide = thm"hcomplex_hcnj_divide";
paulson@14314
  1816
val hcnj_one = thm"hcnj_one";
paulson@14314
  1817
val hcomplex_hcnj_pow = thm"hcomplex_hcnj_pow";
paulson@14314
  1818
val hcomplex_hcnj_zero = thm"hcomplex_hcnj_zero";
paulson@14314
  1819
val hcomplex_hcnj_zero_iff = thm"hcomplex_hcnj_zero_iff";
paulson@14314
  1820
val hcomplex_mult_hcnj = thm"hcomplex_mult_hcnj";
paulson@14314
  1821
val hcomplex_hcmod_eq_zero_cancel = thm"hcomplex_hcmod_eq_zero_cancel";
paulson@14314
  1822
val hypreal_of_nat_le_iff = thm"hypreal_of_nat_le_iff";
paulson@14314
  1823
val hypreal_of_nat_ge_zero = thm"hypreal_of_nat_ge_zero";
paulson@14314
  1824
val hypreal_of_hypnat_ge_zero = thm"hypreal_of_hypnat_ge_zero";
paulson@14314
  1825
val hcmod_hcomplex_of_hypreal_of_nat = thm"hcmod_hcomplex_of_hypreal_of_nat";
paulson@14314
  1826
val hcmod_hcomplex_of_hypreal_of_hypnat = thm"hcmod_hcomplex_of_hypreal_of_hypnat";
paulson@14314
  1827
val hcmod_minus = thm"hcmod_minus";
paulson@14314
  1828
val hcmod_mult_hcnj = thm"hcmod_mult_hcnj";
paulson@14314
  1829
val hcmod_ge_zero = thm"hcmod_ge_zero";
paulson@14314
  1830
val hrabs_hcmod_cancel = thm"hrabs_hcmod_cancel";
paulson@14314
  1831
val hcmod_mult = thm"hcmod_mult";
paulson@14314
  1832
val hcmod_add_squared_eq = thm"hcmod_add_squared_eq";
paulson@14314
  1833
val hcomplex_hRe_mult_hcnj_le_hcmod = thm"hcomplex_hRe_mult_hcnj_le_hcmod";
paulson@14314
  1834
val hcomplex_hRe_mult_hcnj_le_hcmod2 = thm"hcomplex_hRe_mult_hcnj_le_hcmod2";
paulson@14314
  1835
val hcmod_triangle_squared = thm"hcmod_triangle_squared";
paulson@14314
  1836
val hcmod_triangle_ineq = thm"hcmod_triangle_ineq";
paulson@14314
  1837
val hcmod_triangle_ineq2 = thm"hcmod_triangle_ineq2";
paulson@14314
  1838
val hcmod_diff_commute = thm"hcmod_diff_commute";
paulson@14314
  1839
val hcmod_add_less = thm"hcmod_add_less";
paulson@14314
  1840
val hcmod_mult_less = thm"hcmod_mult_less";
paulson@14314
  1841
val hcmod_diff_ineq = thm"hcmod_diff_ineq";
paulson@14314
  1842
val hcpow = thm"hcpow";
paulson@14314
  1843
val hcomplex_of_hypreal_hyperpow = thm"hcomplex_of_hypreal_hyperpow";
paulson@14314
  1844
val hcmod_hcomplexpow = thm"hcmod_hcomplexpow";
paulson@14314
  1845
val hcmod_hcpow = thm"hcmod_hcpow";
paulson@14314
  1846
val hcomplexpow_minus = thm"hcomplexpow_minus";
paulson@14314
  1847
val hcpow_minus = thm"hcpow_minus";
paulson@14314
  1848
val hcmod_hcomplex_inverse = thm"hcmod_hcomplex_inverse";
paulson@14314
  1849
val hcmod_divide = thm"hcmod_divide";
paulson@14314
  1850
val hcomplex_inverse_divide = thm"hcomplex_inverse_divide";
paulson@14314
  1851
val hcpow_mult = thm"hcpow_mult";
paulson@14314
  1852
val hcpow_zero = thm"hcpow_zero";
paulson@14314
  1853
val hcpow_zero2 = thm"hcpow_zero2";
paulson@14314
  1854
val hcpow_not_zero = thm"hcpow_not_zero";
paulson@14314
  1855
val hcpow_zero_zero = thm"hcpow_zero_zero";
paulson@14314
  1856
val hcomplex_i_mult_eq = thm"hcomplex_i_mult_eq";
paulson@14314
  1857
val hcomplexpow_i_squared = thm"hcomplexpow_i_squared";
paulson@14314
  1858
val hcomplex_i_not_zero = thm"hcomplex_i_not_zero";
paulson@14314
  1859
val hcomplex_divide = thm"hcomplex_divide";
paulson@14314
  1860
val hsgn = thm"hsgn";
paulson@14314
  1861
val hsgn_zero = thm"hsgn_zero";
paulson@14314
  1862
val hsgn_one = thm"hsgn_one";
paulson@14314
  1863
val hsgn_minus = thm"hsgn_minus";
paulson@14314
  1864
val hsgn_eq = thm"hsgn_eq";
paulson@14314
  1865
val lemma_hypreal_P_EX2 = thm"lemma_hypreal_P_EX2";
paulson@14314
  1866
val complex_split2 = thm"complex_split2";
paulson@14314
  1867
val hcomplex_split = thm"hcomplex_split";
paulson@14314
  1868
val hRe_hcomplex_i = thm"hRe_hcomplex_i";
paulson@14314
  1869
val hIm_hcomplex_i = thm"hIm_hcomplex_i";
paulson@14314
  1870
val hcmod_i = thm"hcmod_i";
paulson@14314
  1871
val hcomplex_eq_hRe_eq = thm"hcomplex_eq_hRe_eq";
paulson@14314
  1872
val hcomplex_eq_hIm_eq = thm"hcomplex_eq_hIm_eq";
paulson@14314
  1873
val hcomplex_eq_cancel_iff = thm"hcomplex_eq_cancel_iff";
paulson@14314
  1874
val hcomplex_eq_cancel_iffA = thm"hcomplex_eq_cancel_iffA";
paulson@14314
  1875
val hcomplex_eq_cancel_iffB = thm"hcomplex_eq_cancel_iffB";
paulson@14314
  1876
val hcomplex_eq_cancel_iffC = thm"hcomplex_eq_cancel_iffC";
paulson@14314
  1877
val hcomplex_eq_cancel_iff2 = thm"hcomplex_eq_cancel_iff2";
paulson@14314
  1878
val hcomplex_eq_cancel_iff2a = thm"hcomplex_eq_cancel_iff2a";
paulson@14314
  1879
val hcomplex_eq_cancel_iff3 = thm"hcomplex_eq_cancel_iff3";
paulson@14314
  1880
val hcomplex_eq_cancel_iff3a = thm"hcomplex_eq_cancel_iff3a";
paulson@14314
  1881
val hcomplex_split_hRe_zero = thm"hcomplex_split_hRe_zero";
paulson@14314
  1882
val hcomplex_split_hIm_zero = thm"hcomplex_split_hIm_zero";
paulson@14314
  1883
val hRe_hsgn = thm"hRe_hsgn";
paulson@14314
  1884
val hIm_hsgn = thm"hIm_hsgn";
paulson@14314
  1885
val real_two_squares_add_zero_iff = thm"real_two_squares_add_zero_iff";
paulson@14314
  1886
val hcomplex_inverse_complex_split = thm"hcomplex_inverse_complex_split";
paulson@14314
  1887
val hRe_mult_i_eq = thm"hRe_mult_i_eq";
paulson@14314
  1888
val hIm_mult_i_eq = thm"hIm_mult_i_eq";
paulson@14314
  1889
val hcmod_mult_i = thm"hcmod_mult_i";
paulson@14314
  1890
val hcmod_mult_i2 = thm"hcmod_mult_i2";
paulson@14314
  1891
val harg = thm"harg";
paulson@14314
  1892
val cos_harg_i_mult_zero = thm"cos_harg_i_mult_zero";
paulson@14314
  1893
val hcomplex_of_hypreal_zero_iff = thm"hcomplex_of_hypreal_zero_iff";
paulson@14314
  1894
val complex_split_polar2 = thm"complex_split_polar2";
paulson@14314
  1895
val hcomplex_split_polar = thm"hcomplex_split_polar";
paulson@14314
  1896
val hcis = thm"hcis";
paulson@14314
  1897
val hcis_eq = thm"hcis_eq";
paulson@14314
  1898
val hrcis = thm"hrcis";
paulson@14314
  1899
val hrcis_Ex = thm"hrcis_Ex";
paulson@14314
  1900
val hRe_hcomplex_polar = thm"hRe_hcomplex_polar";
paulson@14314
  1901
val hRe_hrcis = thm"hRe_hrcis";
paulson@14314
  1902
val hIm_hcomplex_polar = thm"hIm_hcomplex_polar";
paulson@14314
  1903
val hIm_hrcis = thm"hIm_hrcis";
paulson@14314
  1904
val hcmod_complex_polar = thm"hcmod_complex_polar";
paulson@14314
  1905
val hcmod_hrcis = thm"hcmod_hrcis";
paulson@14314
  1906
val hcis_hrcis_eq = thm"hcis_hrcis_eq";
paulson@14314
  1907
val hrcis_mult = thm"hrcis_mult";
paulson@14314
  1908
val hcis_mult = thm"hcis_mult";
paulson@14314
  1909
val hcis_zero = thm"hcis_zero";
paulson@14314
  1910
val hrcis_zero_mod = thm"hrcis_zero_mod";
paulson@14314
  1911
val hrcis_zero_arg = thm"hrcis_zero_arg";
paulson@14314
  1912
val hcomplex_i_mult_minus = thm"hcomplex_i_mult_minus";
paulson@14314
  1913
val hcomplex_i_mult_minus2 = thm"hcomplex_i_mult_minus2";
paulson@14314
  1914
val hypreal_of_nat = thm"hypreal_of_nat";
paulson@14314
  1915
val hcis_hypreal_of_nat_Suc_mult = thm"hcis_hypreal_of_nat_Suc_mult";
paulson@14314
  1916
val NSDeMoivre = thm"NSDeMoivre";
paulson@14314
  1917
val hcis_hypreal_of_hypnat_Suc_mult = thm"hcis_hypreal_of_hypnat_Suc_mult";
paulson@14314
  1918
val NSDeMoivre_ext = thm"NSDeMoivre_ext";
paulson@14314
  1919
val DeMoivre2 = thm"DeMoivre2";
paulson@14314
  1920
val DeMoivre2_ext = thm"DeMoivre2_ext";
paulson@14314
  1921
val hcis_inverse = thm"hcis_inverse";
paulson@14314
  1922
val hrcis_inverse = thm"hrcis_inverse";
paulson@14314
  1923
val hRe_hcis = thm"hRe_hcis";
paulson@14314
  1924
val hIm_hcis = thm"hIm_hcis";
paulson@14314
  1925
val cos_n_hRe_hcis_pow_n = thm"cos_n_hRe_hcis_pow_n";
paulson@14314
  1926
val sin_n_hIm_hcis_pow_n = thm"sin_n_hIm_hcis_pow_n";
paulson@14314
  1927
val cos_n_hRe_hcis_hcpow_n = thm"cos_n_hRe_hcis_hcpow_n";
paulson@14314
  1928
val sin_n_hIm_hcis_hcpow_n = thm"sin_n_hIm_hcis_hcpow_n";
paulson@14314
  1929
val hexpi_add = thm"hexpi_add";
paulson@14314
  1930
val hcomplex_of_complex_add = thm"hcomplex_of_complex_add";
paulson@14314
  1931
val hcomplex_of_complex_mult = thm"hcomplex_of_complex_mult";
paulson@14314
  1932
val hcomplex_of_complex_eq_iff = thm"hcomplex_of_complex_eq_iff";
paulson@14314
  1933
val hcomplex_of_complex_minus = thm"hcomplex_of_complex_minus";
paulson@14314
  1934
val hcomplex_of_complex_one = thm"hcomplex_of_complex_one";
paulson@14314
  1935
val hcomplex_of_complex_zero = thm"hcomplex_of_complex_zero";
paulson@14314
  1936
val hcomplex_of_complex_zero_iff = thm"hcomplex_of_complex_zero_iff";
paulson@14314
  1937
val hcomplex_of_complex_inverse = thm"hcomplex_of_complex_inverse";
paulson@14314
  1938
val hcomplex_of_complex_divide = thm"hcomplex_of_complex_divide";
paulson@14314
  1939
val hRe_hcomplex_of_complex = thm"hRe_hcomplex_of_complex";
paulson@14314
  1940
val hIm_hcomplex_of_complex = thm"hIm_hcomplex_of_complex";
paulson@14314
  1941
val hcmod_hcomplex_of_complex = thm"hcmod_hcomplex_of_complex";
paulson@14314
  1942
*}
paulson@14314
  1943
paulson@13957
  1944
end