author | paulson |
Mon, 22 Dec 2003 18:29:20 +0100 | |
changeset 14314 | 314da085adf3 |
parent 14313 | f79633c262a3 |
child 14315 | d3e98d53533c |
src/HOL/Complex/NSComplex.ML | file | annotate | diff | comparison | revisions | |
src/HOL/Complex/NSComplex.thy | file | annotate | diff | comparison | revisions | |
src/HOL/IsaMakefile | file | annotate | diff | comparison | revisions |
--- a/src/HOL/Complex/NSComplex.ML Mon Dec 22 16:22:14 2003 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1897 +0,0 @@ -(* Title: NSComplex.ML - Author: Jacques D. Fleuriot - Copyhright: 2001 University of Edinburgh - Description: Nonstandard Complex numbers -*) - -Goalw [hcomplexrel_def] - "((X,Y): hcomplexrel) = ({n. X n = Y n}: FreeUltrafilterNat)"; -by (Fast_tac 1); -qed "hcomplexrel_iff"; - -Goalw [hcomplexrel_def] - "!!X. {n. X n = Y n}: FreeUltrafilterNat \ -\ ==> (X,Y): hcomplexrel"; -by (Fast_tac 1); -qed "hcomplexrelI"; - -Goalw [hcomplexrel_def] - "p: hcomplexrel --> (EX X Y. \ -\ p = (X,Y) & {n. X n = Y n} : FreeUltrafilterNat)"; -by (Fast_tac 1); -qed "hcomplexrelE_lemma"; - -val [major,minor] = goal thy - "[| p: hcomplexrel; \ -\ !!X Y. [| p = (X,Y); {n. X n = Y n}: FreeUltrafilterNat\ -\ |] ==> Q |] ==> Q"; -by (cut_facts_tac [major RS (hcomplexrelE_lemma RS mp)] 1); -by (REPEAT (eresolve_tac [asm_rl,exE,conjE,minor] 1)); -qed "hcomplexrelE"; - -AddSIs [hcomplexrelI]; -AddSEs [hcomplexrelE]; - -Goalw [hcomplexrel_def] "(x,x): hcomplexrel"; -by (Auto_tac); -qed "hcomplexrel_refl"; - -Goalw [hcomplexrel_def] "(x,y): hcomplexrel ==> (y,x):hcomplexrel"; -by (auto_tac (claset(), simpset() addsimps [eq_commute])); -qed "hcomplexrel_sym"; - -Goalw [hcomplexrel_def] - "(x,y): hcomplexrel --> (y,z):hcomplexrel --> (x,z):hcomplexrel"; -by (Auto_tac); -by (Ultra_tac 1); -qed_spec_mp "hcomplexrel_trans"; - -Goalw [equiv_def, refl_def, sym_def, trans_def] - "equiv {x::nat=>complex. True} hcomplexrel"; -by (auto_tac (claset() addSIs [hcomplexrel_refl] addSEs - [hcomplexrel_sym,hcomplexrel_trans] delrules [hcomplexrelI,hcomplexrelE], - simpset())); -qed "equiv_hcomplexrel"; - -val equiv_hcomplexrel_iff = - [TrueI, TrueI] MRS - ([CollectI, CollectI] MRS - (equiv_hcomplexrel RS eq_equiv_class_iff)); - -Goalw [hcomplex_def,hcomplexrel_def,quotient_def] "hcomplexrel``{x}:hcomplex"; -by (Blast_tac 1); -qed "hcomplexrel_in_hcomplex"; - -Goal "inj_on Abs_hcomplex hcomplex"; -by (rtac inj_on_inverseI 1); -by (etac Abs_hcomplex_inverse 1); -qed "inj_on_Abs_hcomplex"; - -Addsimps [equiv_hcomplexrel_iff,inj_on_Abs_hcomplex RS inj_on_iff, - hcomplexrel_iff, hcomplexrel_in_hcomplex, Abs_hcomplex_inverse]; - -Addsimps [equiv_hcomplexrel RS eq_equiv_class_iff]; -val eq_hcomplexrelD = equiv_hcomplexrel RSN (2,eq_equiv_class); - -Goal "inj(Rep_hcomplex)"; -by (rtac inj_inverseI 1); -by (rtac Rep_hcomplex_inverse 1); -qed "inj_Rep_hcomplex"; - -Goalw [hcomplexrel_def] "x: hcomplexrel `` {x}"; -by (Step_tac 1); -by (Auto_tac); -qed "lemma_hcomplexrel_refl"; -Addsimps [lemma_hcomplexrel_refl]; - -Goalw [hcomplex_def] "{} ~: hcomplex"; -by (auto_tac (claset() addSEs [quotientE],simpset())); -qed "hcomplex_empty_not_mem"; -Addsimps [hcomplex_empty_not_mem]; - -Goal "Rep_hcomplex x ~= {}"; -by (cut_inst_tac [("x","x")] Rep_hcomplex 1); -by (Auto_tac); -qed "Rep_hcomplex_nonempty"; -Addsimps [Rep_hcomplex_nonempty]; - -val [prem] = goal thy - "(!!x. z = Abs_hcomplex(hcomplexrel `` {x}) ==> P) ==> P"; -by (res_inst_tac [("x1","z")] - (rewrite_rule [hcomplex_def] Rep_hcomplex RS quotientE) 1); -by (dres_inst_tac [("f","Abs_hcomplex")] arg_cong 1); -by (res_inst_tac [("x","x")] prem 1); -by (asm_full_simp_tac (simpset() addsimps [Rep_hcomplex_inverse]) 1); -qed "eq_Abs_hcomplex"; - -(*-----------------------------------------------------------------------*) -(* Properties of nonstandard real and imaginary parts *) -(*-----------------------------------------------------------------------*) - -Goalw [hRe_def] - "hRe(Abs_hcomplex (hcomplexrel `` {X})) = \ -\ Abs_hypreal(hyprel `` {%n. Re(X n)})"; -by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1); -by (Auto_tac THEN Ultra_tac 1); -qed "hRe"; - -Goalw [hIm_def] - "hIm(Abs_hcomplex (hcomplexrel `` {X})) = \ -\ Abs_hypreal(hyprel `` {%n. Im(X n)})"; -by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1); -by (Auto_tac THEN Ultra_tac 1); -qed "hIm"; - -Goal "(w=z) = (hRe(w) = hRe(z) & hIm(w) = hIm(z))"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","w")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hRe,hIm, - complex_Re_Im_cancel_iff])); -by (ALLGOALS(Ultra_tac)); -qed "hcomplex_hRe_hIm_cancel_iff"; - -Goalw [hcomplex_zero_def] "hRe 0 = 0"; -by (simp_tac (simpset() addsimps [hRe,hypreal_zero_num]) 1); -qed "hcomplex_hRe_zero"; -Addsimps [hcomplex_hRe_zero]; - -Goalw [hcomplex_zero_def] "hIm 0 = 0"; -by (simp_tac (simpset() addsimps [hIm,hypreal_zero_num]) 1); -qed "hcomplex_hIm_zero"; -Addsimps [hcomplex_hIm_zero]; - -Goalw [hcomplex_one_def] "hRe 1 = 1"; -by (simp_tac (simpset() addsimps [hRe,hypreal_one_num]) 1); -qed "hcomplex_hRe_one"; -Addsimps [hcomplex_hRe_one]; - -Goalw [hcomplex_one_def] "hIm 1 = 0"; -by (simp_tac (simpset() addsimps [hIm,hypreal_one_def,hypreal_zero_num]) 1); -qed "hcomplex_hIm_one"; -Addsimps [hcomplex_hIm_one]; - -(*-----------------------------------------------------------------------*) -(* hcomplex_of_complex: the injection from complex to hcomplex *) -(* ----------------------------------------------------------------------*) - -Goal "inj(hcomplex_of_complex)"; -by (rtac injI 1 THEN rtac ccontr 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_complex_def])); -qed "inj_hcomplex_of_complex"; - -Goalw [iii_def,hcomplex_of_complex_def] "iii = hcomplex_of_complex ii"; -by (Simp_tac 1); -qed "hcomplex_of_complex_i"; - -(*-----------------------------------------------------------------------*) -(* Addition for nonstandard complex numbers: hcomplex_add *) -(* ----------------------------------------------------------------------*) - -Goalw [congruent2_def] - "congruent2 hcomplexrel (%X Y. hcomplexrel `` {%n. X n + Y n})"; -by (safe_tac (claset())); -by (ALLGOALS(Ultra_tac)); -qed "hcomplex_add_congruent2"; - -Goalw [hcomplex_add_def] - "Abs_hcomplex(hcomplexrel``{%n. X n}) + Abs_hcomplex(hcomplexrel``{%n. Y n}) = \ -\ Abs_hcomplex(hcomplexrel``{%n. X n + Y n})"; -by (res_inst_tac [("f","Abs_hcomplex")] arg_cong 1); -by Auto_tac; -by (Ultra_tac 1); -qed "hcomplex_add"; - -Goal "(z::hcomplex) + w = w + z"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","w")] eq_Abs_hcomplex 1); -by (asm_simp_tac (simpset() addsimps (complex_add_ac @ [hcomplex_add])) 1); -qed "hcomplex_add_commute"; - -Goal "((z1::hcomplex) + z2) + z3 = z1 + (z2 + z3)"; -by (res_inst_tac [("z","z1")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","z2")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","z3")] eq_Abs_hcomplex 1); -by (asm_simp_tac (simpset() addsimps [hcomplex_add,complex_add_assoc]) 1); -qed "hcomplex_add_assoc"; - -(*For AC rewriting*) -Goal "(x::hcomplex)+(y+z)=y+(x+z)"; -by (rtac (hcomplex_add_commute RS trans) 1); -by (rtac (hcomplex_add_assoc RS trans) 1); -by (rtac (hcomplex_add_commute RS arg_cong) 1); -qed "hcomplex_add_left_commute"; - -(* hcomplex addition is an AC operator *) -val hcomplex_add_ac = [hcomplex_add_assoc,hcomplex_add_commute, - hcomplex_add_left_commute]; - -Goalw [hcomplex_zero_def] "(0::hcomplex) + z = z"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (asm_full_simp_tac (simpset() addsimps - [hcomplex_add]) 1); -qed "hcomplex_add_zero_left"; - -Goal "z + (0::hcomplex) = z"; -by (simp_tac (simpset() addsimps - [hcomplex_add_zero_left,hcomplex_add_commute]) 1); -qed "hcomplex_add_zero_right"; -Addsimps [hcomplex_add_zero_left,hcomplex_add_zero_right]; - -Goal "hRe(x + y) = hRe(x) + hRe(y)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hRe,hcomplex_add, - hypreal_add,complex_Re_add])); -qed "hRe_add"; - -Goal "hIm(x + y) = hIm(x) + hIm(y)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hIm,hcomplex_add, - hypreal_add,complex_Im_add])); -qed "hIm_add"; - -(*-----------------------------------------------------------------------*) -(* hypreal_minus: additive inverse on nonstandard complex *) -(* ----------------------------------------------------------------------*) - -Goalw [congruent_def] - "congruent hcomplexrel (%X. hcomplexrel `` {%n. - (X n)})"; -by (safe_tac (claset())); -by (ALLGOALS(Ultra_tac)); -qed "hcomplex_minus_congruent"; - -Goalw [hcomplex_minus_def] - "- (Abs_hcomplex(hcomplexrel `` {%n. X n})) = \ -\ Abs_hcomplex(hcomplexrel `` {%n. -(X n)})"; -by (res_inst_tac [("f","Abs_hcomplex")] arg_cong 1); -by (Auto_tac THEN Ultra_tac 1); -qed "hcomplex_minus"; - -Goal "- (- z) = (z::hcomplex)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (asm_simp_tac (simpset() addsimps [hcomplex_minus]) 1); -qed "hcomplex_minus_minus"; -Addsimps [hcomplex_minus_minus]; - -Goal "inj(%z::hcomplex. -z)"; -by (rtac injI 1); -by (dres_inst_tac [("f","uminus")] arg_cong 1); -by (Asm_full_simp_tac 1); -qed "inj_hcomplex_minus"; - -Goalw [hcomplex_zero_def] "- 0 = (0::hcomplex)"; -by (simp_tac (simpset() addsimps [hcomplex_minus]) 1); -qed "hcomplex_minus_zero"; -Addsimps [hcomplex_minus_zero]; - -Goal "(-x = 0) = (x = (0::hcomplex))"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_zero_def, - hcomplex_minus] @ complex_add_ac)); -qed "hcomplex_minus_zero_iff"; -Addsimps [hcomplex_minus_zero_iff]; - -Goal "(0 = -x) = (x = (0::hcomplex))"; -by (auto_tac (claset() addDs [sym],simpset())); -qed "hcomplex_minus_zero_iff2"; -Addsimps [hcomplex_minus_zero_iff2]; - -Goal "(-x ~= 0) = (x ~= (0::hcomplex))"; -by Auto_tac; -qed "hcomplex_minus_not_zero_iff"; - -Goal "z + - z = (0::hcomplex)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_add,hcomplex_minus, - hcomplex_zero_def])); -qed "hcomplex_add_minus_right"; -Addsimps [hcomplex_add_minus_right]; - -Goal "-z + z = (0::hcomplex)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_add,hcomplex_minus, - hcomplex_zero_def])); -qed "hcomplex_add_minus_left"; -Addsimps [hcomplex_add_minus_left]; - -Goal "z + (- z + w) = (w::hcomplex)"; -by (simp_tac (simpset() addsimps [hcomplex_add_assoc RS sym]) 1); -qed "hcomplex_add_minus_cancel"; - -Goal "(-z) + (z + w) = (w::hcomplex)"; -by (simp_tac (simpset() addsimps [hcomplex_add_assoc RS sym]) 1); -qed "hcomplex_minus_add_cancel"; - -Goal "hRe(-z) = - hRe(z)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hRe,hcomplex_minus, - hypreal_minus,complex_Re_minus])); -qed "hRe_minus"; - -Goal "hIm(-z) = - hIm(z)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hIm,hcomplex_minus, - hypreal_minus,complex_Im_minus])); -qed "hIm_minus"; - -Goalw [hcomplex_zero_def] - "x + y = (0::hcomplex) ==> x = -y"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_add,hcomplex_minus])); -by (ultra_tac (claset() addIs [complex_add_minus_eq_minus],simpset()) 1); -qed "hcomplex_add_minus_eq_minus"; - -Goal "-(x + y) = -x + -(y::hcomplex)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_add,hcomplex_minus])); -qed "hcomplex_minus_add_distrib"; -Addsimps [hcomplex_minus_add_distrib]; - -Goal "((x::hcomplex) + y = x + z) = (y = z)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_add])); -qed "hcomplex_add_left_cancel"; -AddIffs [hcomplex_add_left_cancel]; - -Goal "(y + (x::hcomplex)= z + x) = (y = z)"; -by (simp_tac (simpset() addsimps [hcomplex_add_commute]) 1); -qed "hcomplex_add_right_cancel"; -AddIffs [hcomplex_add_right_cancel]; - -Goal "((x::hcomplex) = y) = ((0::hcomplex) = x + - y)"; -by (Step_tac 1); -by (res_inst_tac [("x1","-y")] - (hcomplex_add_right_cancel RS iffD1) 2); -by (Auto_tac); -qed "hcomplex_eq_minus_iff"; - -Goal "((x::hcomplex) = y) = (x + - y = (0::hcomplex))"; -by (Step_tac 1); -by (res_inst_tac [("x1","-y")] - (hcomplex_add_right_cancel RS iffD1) 2); -by (Auto_tac); -qed "hcomplex_eq_minus_iff2"; - -(*-----------------------------------------------------------------------*) -(* Subraction for nonstandard complex numbers: hcomplex_diff *) -(* ----------------------------------------------------------------------*) - -Goalw [hcomplex_diff_def] - "Abs_hcomplex(hcomplexrel``{%n. X n}) - Abs_hcomplex(hcomplexrel``{%n. Y n}) = \ -\ Abs_hcomplex(hcomplexrel``{%n. X n - Y n})"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_minus,hcomplex_add, - complex_diff_def])); -qed "hcomplex_diff"; - -Goalw [hcomplex_diff_def] "(z::hcomplex) - z = (0::hcomplex)"; -by (Simp_tac 1); -qed "hcomplex_diff_zero"; -Addsimps [hcomplex_diff_zero]; - -Goal "(0::hcomplex) - x = -x"; -by (simp_tac (simpset() addsimps [hcomplex_diff_def]) 1); -qed "hcomplex_diff_0"; - -Goal "x - (0::hcomplex) = x"; -by (simp_tac (simpset() addsimps [hcomplex_diff_def]) 1); -qed "hcomplex_diff_0_right"; - -Goal "x - x = (0::hcomplex)"; -by (simp_tac (simpset() addsimps [hcomplex_diff_def]) 1); -qed "hcomplex_diff_self"; - -Addsimps [hcomplex_diff_0, hcomplex_diff_0_right, hcomplex_diff_self]; - -Goal "((x::hcomplex) - y = z) = (x = z + y)"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_diff_def,hcomplex_add_assoc])); -qed "hcomplex_diff_eq_eq"; - -(*-----------------------------------------------------------------------*) -(* Multiplication for nonstandard complex numbers: hcomplex_mult *) -(* ----------------------------------------------------------------------*) - -Goalw [hcomplex_mult_def] - "Abs_hcomplex(hcomplexrel``{%n. X n}) * Abs_hcomplex(hcomplexrel``{%n. Y n}) = \ -\ Abs_hcomplex(hcomplexrel``{%n. X n * Y n})"; -by (res_inst_tac [("f","Abs_hcomplex")] arg_cong 1); -by (Auto_tac THEN Ultra_tac 1); -qed "hcomplex_mult"; - -Goal "(w::hcomplex) * z = z * w"; -by (res_inst_tac [("z","w")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult, - complex_mult_commute])); -qed "hcomplex_mult_commute"; - -Goal "((u::hcomplex) * v) * w = u * (v * w)"; -by (res_inst_tac [("z","u")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","v")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","w")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult, - complex_mult_assoc])); -qed "hcomplex_mult_assoc"; - -Goal "(x::hcomplex) * (y * z) = y * (x * z)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult, - complex_mult_left_commute])); -qed "hcomplex_mult_left_commute"; - -val hcomplex_mult_ac = [hcomplex_mult_assoc,hcomplex_mult_commute, - hcomplex_mult_left_commute]; - -Goalw [hcomplex_one_def] "(1::hcomplex) * z = z"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult])); -qed "hcomplex_mult_one_left"; -Addsimps [hcomplex_mult_one_left]; - -Goal "z * (1::hcomplex) = z"; -by (simp_tac (simpset() addsimps [hcomplex_mult_commute]) 1); -qed "hcomplex_mult_one_right"; -Addsimps [hcomplex_mult_one_right]; - -Goalw [hcomplex_zero_def] "(0::hcomplex) * z = 0"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult])); -qed "hcomplex_mult_zero_left"; -Addsimps [hcomplex_mult_zero_left]; - -Goal "z * (0::hcomplex) = 0"; -by (simp_tac (simpset() addsimps [hcomplex_mult_commute]) 1); -qed "hcomplex_mult_zero_right"; -Addsimps [hcomplex_mult_zero_right]; - -Goal "-(x * y) = -x * (y::hcomplex)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult, - hcomplex_minus])); -qed "hcomplex_minus_mult_eq1"; - -Goal "-(x * y) = x * -(y::hcomplex)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult, - hcomplex_minus])); -qed "hcomplex_minus_mult_eq2"; - -Addsimps [hcomplex_minus_mult_eq1 RS sym,hcomplex_minus_mult_eq2 RS sym]; - -Goal "- 1 * (z::hcomplex) = -z"; -by (Simp_tac 1); -qed "hcomplex_mult_minus_one"; -Addsimps [hcomplex_mult_minus_one]; - -Goal "(z::hcomplex) * - 1 = -z"; -by (stac hcomplex_mult_commute 1); -by (Simp_tac 1); -qed "hcomplex_mult_minus_one_right"; -Addsimps [hcomplex_mult_minus_one_right]; - -Goal "-x * -y = x * (y::hcomplex)"; -by Auto_tac; -qed "hcomplex_minus_mult_cancel"; -Addsimps [hcomplex_minus_mult_cancel]; - -Goal "-x * y = x * -(y::hcomplex)"; -by Auto_tac; -qed "hcomplex_minus_mult_commute"; - -qed_goal "hcomplex_add_assoc_cong" thy - "!!z. (z::hcomplex) + v = z' + v' ==> z + (v + w) = z' + (v' + w)" - (fn _ => [(asm_simp_tac (simpset() addsimps [hcomplex_add_assoc RS sym]) 1)]); - -qed_goal "hcomplex_add_assoc_swap" thy "(z::hcomplex) + (v + w) = v + (z + w)" - (fn _ => [(REPEAT (ares_tac [hcomplex_add_commute RS hcomplex_add_assoc_cong] 1))]); - -Goal "((z1::hcomplex) + z2) * w = (z1 * w) + (z2 * w)"; -by (res_inst_tac [("z","z1")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","z2")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","w")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult,hcomplex_add, - complex_add_mult_distrib])); -qed "hcomplex_add_mult_distrib"; - -Goal "(w::hcomplex) * (z1 + z2) = (w * z1) + (w * z2)"; -by (res_inst_tac [("z1","z1 + z2")] (hcomplex_mult_commute RS ssubst) 1); -by (simp_tac (simpset() addsimps [hcomplex_add_mult_distrib]) 1); -by (simp_tac (simpset() addsimps [hcomplex_mult_commute]) 1); -qed "hcomplex_add_mult_distrib2"; - -Goalw [hcomplex_zero_def,hcomplex_one_def] "(0::hcomplex) ~= (1::hcomplex)"; -by Auto_tac; -qed "hcomplex_zero_not_eq_one"; -Addsimps [hcomplex_zero_not_eq_one]; -Addsimps [hcomplex_zero_not_eq_one RS not_sym]; - -(*-----------------------------------------------------------------------*) -(* Inverse of nonstandard complex number *) -(*-----------------------------------------------------------------------*) - -Goalw [hcinv_def] - "inverse (Abs_hcomplex(hcomplexrel `` {%n. X n})) = \ -\ Abs_hcomplex(hcomplexrel `` {%n. inverse (X n)})"; -by (res_inst_tac [("f","Abs_hcomplex")] arg_cong 1); -by (Auto_tac THEN Ultra_tac 1); -qed "hcomplex_inverse"; - -Goalw [hcomplex_zero_def] "inverse (0::hcomplex) = 0"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_inverse])); -qed "HCOMPLEX_INVERSE_ZERO"; - -Goal "a / (0::hcomplex) = 0"; -by (simp_tac (simpset() addsimps [hcomplex_divide_def, HCOMPLEX_INVERSE_ZERO]) 1); -qed "HCOMPLEX_DIVISION_BY_ZERO"; (*NOT for adding to default simpset*) - -fun hcomplex_div_undefined_case_tac s i = - case_tac s i THEN - asm_simp_tac (simpset() addsimps [HCOMPLEX_DIVISION_BY_ZERO, HCOMPLEX_INVERSE_ZERO]) i; - -Goalw [hcomplex_zero_def,hcomplex_one_def] - "z ~= (0::hcomplex) ==> inverse(z) * z = (1::hcomplex)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_inverse,hcomplex_mult])); -by (Ultra_tac 1); -by (rtac ccontr 1 THEN dtac (complex_mult_inv_left) 1); -by Auto_tac; -qed "hcomplex_mult_inv_left"; -Addsimps [hcomplex_mult_inv_left]; - -Goal "z ~= (0::hcomplex) ==> z * inverse(z) = (1::hcomplex)"; -by (auto_tac (claset() addIs [hcomplex_mult_commute RS subst],simpset())); -qed "hcomplex_mult_inv_right"; -Addsimps [hcomplex_mult_inv_right]; - -Goal "(c::hcomplex) ~= (0::hcomplex) ==> (c*a=c*b) = (a=b)"; -by Auto_tac; -by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1); -by (asm_full_simp_tac (simpset() addsimps hcomplex_mult_ac) 1); -qed "hcomplex_mult_left_cancel"; - -Goal "(c::hcomplex) ~= (0::hcomplex) ==> (a*c=b*c) = (a=b)"; -by (Step_tac 1); -by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1); -by (asm_full_simp_tac (simpset() addsimps hcomplex_mult_ac) 1); -qed "hcomplex_mult_right_cancel"; - -Goal "z ~= (0::hcomplex) ==> inverse(z) ~= 0"; -by (Step_tac 1); -by (ftac (hcomplex_mult_right_cancel RS iffD2) 1); -by (thin_tac "inverse z = 0" 2); -by (assume_tac 1 THEN Auto_tac); -qed "hcomplex_inverse_not_zero"; -Addsimps [hcomplex_inverse_not_zero]; - -Goal "[| x ~= (0::hcomplex); y ~= 0 |] ==> x * y ~= 0"; -by (Step_tac 1); -by (dres_inst_tac [("f","%z. inverse x*z")] arg_cong 1); -by (asm_full_simp_tac (simpset() addsimps [hcomplex_mult_assoc RS sym]) 1); -qed "hcomplex_mult_not_zero"; - -bind_thm ("hcomplex_mult_not_zeroE",hcomplex_mult_not_zero RS notE); - -Goal "inverse(inverse x) = (x::hcomplex)"; -by (hcomplex_div_undefined_case_tac "x = 0" 1); -by (res_inst_tac [("c1","inverse x")] (hcomplex_mult_right_cancel RS iffD1) 1); -by (etac hcomplex_inverse_not_zero 1); -by (auto_tac (claset() addDs [hcomplex_inverse_not_zero],simpset())); -qed "hcomplex_inverse_inverse"; -Addsimps [hcomplex_inverse_inverse]; - -Goalw [hcomplex_one_def] "inverse((1::hcomplex)) = 1"; -by (simp_tac (simpset() addsimps [hcomplex_inverse]) 1); -qed "hcomplex_inverse_one"; -Addsimps [hcomplex_inverse_one]; - -Goal "inverse(-x) = -inverse(x::hcomplex)"; -by (hcomplex_div_undefined_case_tac "x = 0" 1); -by (res_inst_tac [("c1","-x")] (hcomplex_mult_right_cancel RS iffD1) 1); -by (stac hcomplex_mult_inv_left 2); -by Auto_tac; -qed "hcomplex_minus_inverse"; - -Goal "inverse(x*y) = inverse x * inverse (y::hcomplex)"; -by (hcomplex_div_undefined_case_tac "x = 0" 1); -by (hcomplex_div_undefined_case_tac "y = 0" 1); -by (res_inst_tac [("c1","x*y")] (hcomplex_mult_left_cancel RS iffD1) 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult_not_zero] - @ hcomplex_mult_ac)); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult_not_zero, - hcomplex_mult_assoc RS sym])); -qed "hcomplex_inverse_distrib"; - -(*** division ***) - -(* adding some of these theorems to simpset as for reals: not 100% convinced for some*) - -Goal "(x::hcomplex) * (y/z) = (x*y)/z"; -by (simp_tac (simpset() addsimps [hcomplex_divide_def, hcomplex_mult_assoc]) 1); -qed "hcomplex_times_divide1_eq"; - -Goal "(y/z) * (x::hcomplex) = (y*x)/z"; -by (simp_tac (simpset() addsimps [hcomplex_divide_def] @ hcomplex_mult_ac) 1); -qed "hcomplex_times_divide2_eq"; - -Addsimps [hcomplex_times_divide1_eq, hcomplex_times_divide2_eq]; - -Goal "(x::hcomplex) / (y/z) = (x*z)/y"; -by (simp_tac (simpset() addsimps [hcomplex_divide_def, hcomplex_inverse_distrib]@ - hcomplex_mult_ac) 1); -qed "hcomplex_divide_divide1_eq"; - -Goal "((x::hcomplex) / y) / z = x/(y*z)"; -by (simp_tac (simpset() addsimps [hcomplex_divide_def, hcomplex_inverse_distrib, - hcomplex_mult_assoc]) 1); -qed "hcomplex_divide_divide2_eq"; - -Addsimps [hcomplex_divide_divide1_eq, hcomplex_divide_divide2_eq]; - -(** As with multiplication, pull minus signs OUT of the / operator **) - -Goal "(-x) / (y::hcomplex) = - (x/y)"; -by (simp_tac (simpset() addsimps [hcomplex_divide_def]) 1); -qed "hcomplex_minus_divide_eq"; -Addsimps [hcomplex_minus_divide_eq]; - -Goal "(x / -(y::hcomplex)) = - (x/y)"; -by (simp_tac (simpset() addsimps [hcomplex_divide_def, hcomplex_minus_inverse]) 1); -qed "hcomplex_divide_minus_eq"; -Addsimps [hcomplex_divide_minus_eq]; - -Goal "(x+y)/(z::hcomplex) = x/z + y/z"; -by (simp_tac (simpset() addsimps [hcomplex_divide_def, hcomplex_add_mult_distrib]) 1); -qed "hcomplex_add_divide_distrib"; - -(*---------------------------------------------------------------------------*) -(* Embedding properties for hcomplex_of_hypreal map *) -(*---------------------------------------------------------------------------*) - -Goalw [hcomplex_of_hypreal_def] - "hcomplex_of_hypreal (Abs_hypreal(hyprel `` {%n. X n})) = \ -\ Abs_hcomplex(hcomplexrel `` {%n. complex_of_real (X n)})"; -by (res_inst_tac [("f","Abs_hcomplex")] arg_cong 1); -by Auto_tac; -by (Ultra_tac 1); -qed "hcomplex_of_hypreal"; - -Goal "inj hcomplex_of_hypreal"; -by (rtac injI 1); -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal])); -qed "inj_hcomplex_of_hypreal"; - -Goal "(hcomplex_of_hypreal x = hcomplex_of_hypreal y) = (x = y)"; -by (auto_tac (claset() addDs [inj_hcomplex_of_hypreal RS injD],simpset())); -qed "hcomplex_of_hypreal_cancel_iff"; -AddIffs [hcomplex_of_hypreal_cancel_iff]; - -Goal "hcomplex_of_hypreal(-x) = - hcomplex_of_hypreal x"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hcomplex_minus,hypreal_minus,complex_of_real_minus])); -qed "hcomplex_of_hypreal_minus"; - -Goal "hcomplex_of_hypreal(inverse x) = inverse(hcomplex_of_hypreal x)"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hypreal_inverse,hcomplex_inverse,complex_of_real_inverse])); -qed "hcomplex_of_hypreal_inverse"; - -Goal "hcomplex_of_hypreal x + hcomplex_of_hypreal y = \ -\ hcomplex_of_hypreal (x + y)"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hypreal_add,hcomplex_add,complex_of_real_add])); -qed "hcomplex_of_hypreal_add"; - -Goalw [hcomplex_diff_def] - "hcomplex_of_hypreal x - hcomplex_of_hypreal y = \ -\ hcomplex_of_hypreal (x - y)"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal_minus - RS sym,hcomplex_of_hypreal_add,hypreal_diff_def])); -qed "hcomplex_of_hypreal_diff"; - -Goal "hcomplex_of_hypreal x * hcomplex_of_hypreal y = \ -\ hcomplex_of_hypreal (x * y)"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hypreal_mult,hcomplex_mult,complex_of_real_mult])); -qed "hcomplex_of_hypreal_mult"; - -Goalw [hcomplex_divide_def] - "hcomplex_of_hypreal x / hcomplex_of_hypreal y = hcomplex_of_hypreal(x/y)"; -by (case_tac "y=0" 1); -by (asm_simp_tac (simpset() addsimps [HYPREAL_DIVISION_BY_ZERO,HYPREAL_INVERSE_ZERO, - HCOMPLEX_INVERSE_ZERO]) 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal_mult, - hcomplex_of_hypreal_inverse RS sym])); -by (simp_tac (simpset() addsimps [hypreal_divide_def]) 1); -qed "hcomplex_of_hypreal_divide"; - -Goalw [hcomplex_one_def] - "hcomplex_of_hypreal 1 = 1"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal,hypreal_one_num])); -qed "hcomplex_of_hypreal_one"; - -Goalw [hcomplex_zero_def,hypreal_zero_def] - "hcomplex_of_hypreal 0 = 0"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal])); -qed "hcomplex_of_hypreal_zero"; - -Addsimps [hcomplex_of_hypreal_one,hcomplex_of_hypreal_zero, - rename_numerals hcomplex_of_hypreal_zero]; - -Goal "hcomplex_of_hypreal (x ^ n) = (hcomplex_of_hypreal x) ^ n"; -by (induct_tac "n" 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal_mult RS sym])); -qed "hcomplex_of_hypreal_pow"; - -Goal "hRe(hcomplex_of_hypreal z) = z"; -by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal,hRe])); -qed "hRe_hcomplex_of_hypreal"; -Addsimps [hRe_hcomplex_of_hypreal]; - -Goal "hIm(hcomplex_of_hypreal z) = 0"; -by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal,hIm, - hypreal_zero_num])); -qed "hIm_hcomplex_of_hypreal"; -Addsimps [hIm_hcomplex_of_hypreal]; - -Goal "hcomplex_of_hypreal epsilon ~= 0"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - epsilon_def,hcomplex_zero_def])); -qed "hcomplex_of_hypreal_epsilon_not_zero"; -Addsimps [hcomplex_of_hypreal_epsilon_not_zero]; - -(*---------------------------------------------------------------------------*) -(* Modulus (absolute value) of nonstandard complex number *) -(*---------------------------------------------------------------------------*) - -Goalw [hcmod_def] - "hcmod (Abs_hcomplex(hcomplexrel `` {%n. X n})) = \ -\ Abs_hypreal(hyprel `` {%n. cmod (X n)})"; -by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1); -by (Auto_tac THEN Ultra_tac 1); -qed "hcmod"; - -Goalw [hcomplex_zero_def,hypreal_zero_def] - "hcmod(0) = 0"; -by (auto_tac (claset(),simpset() addsimps [hcmod])); -qed "hcmod_zero"; -Addsimps [hcmod_zero,rename_numerals hcmod_zero]; - -Goalw [hcomplex_one_def] - "hcmod(1) = 1"; -by (auto_tac (claset(),simpset() addsimps [hcmod,hypreal_one_num])); -qed "hcmod_one"; -Addsimps [hcmod_one]; - -Goal "hcmod(hcomplex_of_hypreal x) = abs x"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hcomplex_of_hypreal, - hypreal_hrabs])); -qed "hcmod_hcomplex_of_hypreal"; -Addsimps [hcmod_hcomplex_of_hypreal]; - -Goal "hcomplex_of_hypreal (abs x) = \ -\ hcomplex_of_hypreal(hcmod(hcomplex_of_hypreal x))"; -by (Simp_tac 1); -qed "hcomplex_of_hypreal_abs"; - -(*---------------------------------------------------------------------------*) -(* conjugation *) -(*---------------------------------------------------------------------------*) - -Goalw [hcnj_def] - "hcnj (Abs_hcomplex(hcomplexrel `` {%n. X n})) = \ -\ Abs_hcomplex(hcomplexrel `` {%n. cnj(X n)})"; -by (res_inst_tac [("f","Abs_hcomplex")] arg_cong 1); -by (Auto_tac THEN Ultra_tac 1); -qed "hcnj"; - -Goal "inj hcnj"; -by (rtac injI 1); -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcnj])); -qed "inj_hcnj"; - -Goal "(hcnj x = hcnj y) = (x = y)"; -by (auto_tac (claset() addDs [inj_hcnj RS injD],simpset())); -qed "hcomplex_hcnj_cancel_iff"; -Addsimps [hcomplex_hcnj_cancel_iff]; - -Goal "hcnj (hcnj z) = z"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcnj])); -qed "hcomplex_hcnj_hcnj"; -Addsimps [hcomplex_hcnj_hcnj]; - -Goal "hcnj (hcomplex_of_hypreal x) = hcomplex_of_hypreal x"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcnj,hcomplex_of_hypreal])); -qed "hcomplex_hcnj_hcomplex_of_hypreal"; -Addsimps [hcomplex_hcnj_hcomplex_of_hypreal]; - -Goal "hcmod (hcnj z) = hcmod z"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcnj,hcmod])); -qed "hcomplex_hmod_hcnj"; -Addsimps [hcomplex_hmod_hcnj]; - -Goal "hcnj (-z) = - hcnj z"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcnj,hcomplex_minus, - complex_cnj_minus])); -qed "hcomplex_hcnj_minus"; - -Goal "hcnj(inverse z) = inverse(hcnj z)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcnj,hcomplex_inverse, - complex_cnj_inverse])); -qed "hcomplex_hcnj_inverse"; - -Goal "hcnj(w + z) = hcnj(w) + hcnj(z)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","w")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcnj,hcomplex_add, - complex_cnj_add])); -qed "hcomplex_hcnj_add"; - -Goal "hcnj(w - z) = hcnj(w) - hcnj(z)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","w")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcnj,hcomplex_diff, - complex_cnj_diff])); -qed "hcomplex_hcnj_diff"; - -Goal "hcnj(w * z) = hcnj(w) * hcnj(z)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","w")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcnj,hcomplex_mult, - complex_cnj_mult])); -qed "hcomplex_hcnj_mult"; - -Goalw [hcomplex_divide_def] "hcnj(w / z) = (hcnj w)/(hcnj z)"; -by (simp_tac (simpset() addsimps [hcomplex_hcnj_mult,hcomplex_hcnj_inverse]) 1); -qed "hcomplex_hcnj_divide"; - -Goalw [hcomplex_one_def] "hcnj 1 = 1"; -by (simp_tac (simpset() addsimps [hcnj]) 1); -qed "hcnj_one"; -Addsimps [hcnj_one]; - -Goal "hcnj(z ^ n) = hcnj(z) ^ n"; -by (induct_tac "n" 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_hcnj_mult])); -qed "hcomplex_hcnj_pow"; - -(* MOVE to NSComplexBin -Goal "z + hcnj z = \ -\ hcomplex_of_hypreal (2 * hRe(z))"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),HOL_ss addsimps [hRe,hcnj,hcomplex_add, - hypreal_mult,hcomplex_of_hypreal,complex_add_cnj])); -qed "hcomplex_add_hcnj"; - -Goal "z - hcnj z = \ -\ hcomplex_of_hypreal (hypreal_of_real 2 * hIm(z)) * iii"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hIm,hcnj,hcomplex_diff, - hypreal_of_real_def,hypreal_mult,hcomplex_of_hypreal, - complex_diff_cnj,iii_def,hcomplex_mult])); -qed "hcomplex_diff_hcnj"; -*) - -Goalw [hcomplex_zero_def] - "hcnj 0 = 0"; -by (auto_tac (claset(),simpset() addsimps [hcnj])); -qed "hcomplex_hcnj_zero"; -Addsimps [hcomplex_hcnj_zero]; - -Goal "(hcnj z = 0) = (z = 0)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_zero_def, - hcnj])); -qed "hcomplex_hcnj_zero_iff"; -AddIffs [hcomplex_hcnj_zero_iff]; - -Goal "z * hcnj z = hcomplex_of_hypreal (hRe(z) ^ 2 + hIm(z) ^ 2)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcnj,hcomplex_mult, - hcomplex_of_hypreal,hRe,hIm,hypreal_add,hypreal_mult, - complex_mult_cnj,two_eq_Suc_Suc])); -qed "hcomplex_mult_hcnj"; - - -(*---------------------------------------------------------------------------*) -(* some algebra etc. *) -(*---------------------------------------------------------------------------*) - -Goal "(x*y = (0::hcomplex)) = (x = 0 | y = 0)"; -by Auto_tac; -by (auto_tac (claset() addIs [ccontr] addDs - [hcomplex_mult_not_zero],simpset())); -qed "hcomplex_mult_zero_iff"; -Addsimps [hcomplex_mult_zero_iff]; - -Goal "(x + y = x) = (y = (0::hcomplex))"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_add, - hcomplex_zero_def])); -qed "hcomplex_add_left_cancel_zero"; -Addsimps [hcomplex_add_left_cancel_zero]; - -Goalw [hcomplex_diff_def] - "((z1::hcomplex) - z2) * w = (z1 * w) - (z2 * w)"; -by (simp_tac (simpset() addsimps [hcomplex_add_mult_distrib]) 1); -qed "hcomplex_diff_mult_distrib"; - -Goalw [hcomplex_diff_def] - "(w::hcomplex) * (z1 - z2) = (w * z1) - (w * z2)"; -by (simp_tac (simpset() addsimps [hcomplex_add_mult_distrib2]) 1); -qed "hcomplex_diff_mult_distrib2"; - -(*---------------------------------------------------------------------------*) -(* More theorems about hcmod *) -(*---------------------------------------------------------------------------*) - -Goal "(hcmod x = 0) = (x = 0)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hcomplex_zero_def, - hypreal_zero_num])); -qed "hcomplex_hcmod_eq_zero_cancel"; -Addsimps [hcomplex_hcmod_eq_zero_cancel]; - -(* not proved already? strange! *) -Goalw [hypreal_le_def] - "(hypreal_of_nat n <= hypreal_of_nat m) = (n <= m)"; -by Auto_tac; -qed "hypreal_of_nat_le_iff"; -Addsimps [hypreal_of_nat_le_iff]; - -Goal "0 <= hypreal_of_nat n"; -by (simp_tac (simpset() addsimps [hypreal_of_nat_zero RS sym] - delsimps [hypreal_of_nat_zero]) 1); -qed "hypreal_of_nat_ge_zero"; -Addsimps [hypreal_of_nat_ge_zero]; - -Addsimps [hypreal_of_nat_ge_zero RS hrabs_eqI1]; - -Goal "0 <= hypreal_of_hypnat n"; -by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); -by (asm_simp_tac (simpset() addsimps [hypreal_of_hypnat, - hypreal_zero_num,hypreal_le]) 1); -qed "hypreal_of_hypnat_ge_zero"; -Addsimps [hypreal_of_hypnat_ge_zero]; - -Addsimps [hypreal_of_hypnat_ge_zero RS hrabs_eqI1]; - -Goal "hcmod (hcomplex_of_hypreal(hypreal_of_nat n)) = hypreal_of_nat n"; -by Auto_tac; -qed "hcmod_hcomplex_of_hypreal_of_nat"; -Addsimps [hcmod_hcomplex_of_hypreal_of_nat]; - -Goal "hcmod (hcomplex_of_hypreal(hypreal_of_hypnat n)) = hypreal_of_hypnat n"; -by Auto_tac; -qed "hcmod_hcomplex_of_hypreal_of_hypnat"; -Addsimps [hcmod_hcomplex_of_hypreal_of_hypnat]; - -Goal "hcmod (-x) = hcmod(x)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hcomplex_minus])); -qed "hcmod_minus"; -Addsimps [hcmod_minus]; - -Goal "hcmod(z * hcnj(z)) = hcmod(z) ^ 2"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hcomplex_mult, - hcnj,hypreal_mult,complex_mod_mult_cnj,two_eq_Suc_Suc])); -qed "hcmod_mult_hcnj"; - -Goal "(0::hypreal) <= hcmod x"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod, - hypreal_zero_num,hypreal_le])); -qed "hcmod_ge_zero"; -Addsimps [hcmod_ge_zero]; - -Goal "abs(hcmod x) = hcmod x"; -by (auto_tac (claset() addIs [hrabs_eqI1],simpset())); -qed "hrabs_hcmod_cancel"; -Addsimps [hrabs_hcmod_cancel]; - -Goal "hcmod(x*y) = hcmod(x) * hcmod(y)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hcomplex_mult, - hypreal_mult,complex_mod_mult])); -qed "hcmod_mult"; - -Goal "hcmod(x + y) ^ 2 = hcmod(x) ^ 2 + hcmod(y) ^ 2 + 2 * hRe(x * hcnj y)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hcomplex_add, - hypreal_mult,hRe,hcnj,hcomplex_mult,two_eq_Suc_Suc, - realpow_two RS sym] delsimps [realpow_Suc])); -by (auto_tac (claset(),simpset() addsimps [two_eq_Suc_Suc RS sym, - complex_mod_add_squared_eq,hypreal_add RS sym,hypreal_mult RS sym, - symmetric hypreal_of_real_def])); -qed "hcmod_add_squared_eq"; - -Goal "hRe(x * hcnj y) <= hcmod(x * hcnj y)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hcnj, - hcomplex_mult,hRe,hypreal_le])); -qed "hcomplex_hRe_mult_hcnj_le_hcmod"; -Addsimps [hcomplex_hRe_mult_hcnj_le_hcmod]; - -Goal "hRe(x * hcnj y) <= hcmod(x * y)"; -by (cut_inst_tac [("x","x"),("y","y")] hcomplex_hRe_mult_hcnj_le_hcmod 1); -by (asm_full_simp_tac (simpset() addsimps [hcmod_mult]) 1); -qed "hcomplex_hRe_mult_hcnj_le_hcmod2"; -Addsimps [hcomplex_hRe_mult_hcnj_le_hcmod2]; - -Goal "hcmod (x + y) ^ 2 <= (hcmod(x) + hcmod(y)) ^ 2"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hcnj, - hcomplex_add,hypreal_mult,hypreal_add,hypreal_le, - realpow_two RS sym,two_eq_Suc_Suc] delsimps [realpow_Suc])); -by (simp_tac (simpset() addsimps [two_eq_Suc_Suc RS sym]) 1); -qed "hcmod_triangle_squared"; -Addsimps [hcmod_triangle_squared]; - -Goal "hcmod (x + y) <= hcmod(x) + hcmod(y)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod, - hcomplex_add,hypreal_add,hypreal_le])); -qed "hcmod_triangle_ineq"; -Addsimps [hcmod_triangle_ineq]; - -Goal "hcmod(b + a) - hcmod b <= hcmod a"; -by (cut_inst_tac [("x1","b"),("y1","a"),("c","-hcmod b")] - (hcmod_triangle_ineq RS add_right_mono) 1); -by (asm_full_simp_tac (simpset() addsimps hypreal_add_ac) 1); -qed "hcmod_triangle_ineq2"; -Addsimps [hcmod_triangle_ineq2]; - -Goal "hcmod (x - y) = hcmod (y - x)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod, - hcomplex_diff,complex_mod_diff_commute])); -qed "hcmod_diff_commute"; - -Goal "[| hcmod x < r; hcmod y < s |] ==> hcmod (x + y) < r + s"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","r")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","s")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hcomplex_add, - hypreal_add,hypreal_less])); -by (ultra_tac (claset() addIs [complex_mod_add_less],simpset()) 1); -qed "hcmod_add_less"; - -Goal "[| hcmod x < r; hcmod y < s |] ==> hcmod (x * y) < r * s"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","y")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","r")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","s")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hypreal_mult, - hypreal_less,hcomplex_mult])); -by (ultra_tac (claset() addIs [complex_mod_mult_less],simpset()) 1); -qed "hcmod_mult_less"; - -goal NSComplex.thy "hcmod(a) - hcmod(b) <= hcmod(a + b)"; -by (res_inst_tac [("z","a")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","b")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcmod,hcomplex_add, - hypreal_diff,hypreal_le])); -qed "hcmod_diff_ineq"; -Addsimps [hcmod_diff_ineq]; - - -(*---------------------------------------------------------------------------*) -(* a few nonlinear theorems *) -(*---------------------------------------------------------------------------*) - -Goalw [hcpow_def] - "Abs_hcomplex(hcomplexrel``{%n. X n}) hcpow \ -\ Abs_hypnat(hypnatrel``{%n. Y n}) = \ -\ Abs_hcomplex(hcomplexrel``{%n. X n ^ Y n})"; -by (res_inst_tac [("f","Abs_hcomplex")] arg_cong 1); -by (Auto_tac THEN Ultra_tac 1); -qed "hcpow"; - -Goal "hcomplex_of_hypreal (x pow n) = (hcomplex_of_hypreal x) hcpow n"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hyperpow,hcpow,complex_of_real_pow])); -qed "hcomplex_of_hypreal_hyperpow"; - -Goal "hcmod(x ^ n) = hcmod(x) ^ n"; -by (induct_tac "n" 1); -by (auto_tac (claset(),simpset() addsimps [hcmod_mult])); -qed "hcmod_hcomplexpow"; - -Goal "hcmod(x hcpow n) = hcmod(x) pow n"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); -by (auto_tac (claset(),simpset() addsimps [hcpow,hyperpow, - hcmod,complex_mod_complexpow])); -qed "hcmod_hcpow"; - -Goal "(-x::hcomplex) ^ n = (if even n then (x ^ n) else -(x ^ n))"; -by (induct_tac "n" 1); -by Auto_tac; -qed "hcomplexpow_minus"; - -Goal "(-x::hcomplex) hcpow n = \ -\ (if ( *pNat* even) n then (x hcpow n) else -(x hcpow n))"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); -by (auto_tac (claset(),simpset() addsimps [hcpow,hyperpow,starPNat, - hcomplex_minus])); -by (ALLGOALS(ultra_tac (claset(),simpset() addsimps [complexpow_minus]))); -qed "hcpow_minus"; - -Goal "inverse(-x) = - inverse (x::hcomplex)"; -by (res_inst_tac [("z","x")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_inverse,hcomplex_minus, - complex_inverse_minus])); -qed "hccomplex_inverse_minus"; - -Goalw [hcomplex_divide_def] "x / (1::hcomplex) = x"; -by (Simp_tac 1); -qed "hcomplex_div_one"; -Addsimps [hcomplex_div_one]; - -Goal "hcmod(inverse x) = inverse(hcmod x)"; -by (hcomplex_div_undefined_case_tac "x = 0" 1); -by (res_inst_tac [("c1","hcmod x")] (hypreal_mult_left_cancel RS iffD1) 1); -by (auto_tac (claset(),simpset() addsimps [hcmod_mult RS sym])); -qed "hcmod_hcomplex_inverse"; - -Goalw [hcomplex_divide_def,hypreal_divide_def] - "hcmod(x/y) = hcmod(x)/(hcmod y)"; -by (auto_tac (claset(),simpset() addsimps [hcmod_mult, - hcmod_hcomplex_inverse])); -qed "hcmod_divide"; - -Goalw [hcomplex_divide_def] - "inverse(x/y) = y/(x::hcomplex)"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_inverse_distrib, - hcomplex_mult_commute])); -qed "hcomplex_inverse_divide"; -Addsimps [hcomplex_inverse_divide]; - -Goal "((r::hcomplex) * s) ^ n = (r ^ n) * (s ^ n)"; -by (induct_tac "n" 1); -by (auto_tac (claset(),simpset() addsimps hcomplex_mult_ac)); -qed "hcomplexpow_mult"; - -Goal "((r::hcomplex) * s) hcpow n = (r hcpow n) * (s hcpow n)"; -by (res_inst_tac [("z","r")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","s")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); -by (auto_tac (claset(),simpset() addsimps [hcpow,hypreal_mult, - hcomplex_mult,complexpow_mult])); -qed "hcpow_mult"; - -Goal "(0::hcomplex) ^ (Suc n) = 0"; -by (Auto_tac); -qed "hcomplexpow_zero"; -Addsimps [hcomplexpow_zero]; - -Goalw [hcomplex_zero_def,hypnat_one_def] - "0 hcpow (n + 1) = 0"; -by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); -by (auto_tac (claset(),simpset() addsimps [hcpow,hypnat_add])); -qed "hcpow_zero"; -Addsimps [hcpow_zero]; - -Goalw [hSuc_def] - "0 hcpow (hSuc n) = 0"; -by (Simp_tac 1); -qed "hcpow_zero2"; -Addsimps [hcpow_zero2]; - -Goal "r ~= (0::hcomplex) --> r ^ n ~= 0"; -by (induct_tac "n" 1); -by (auto_tac (claset(),simpset() addsimps - [hcomplex_mult_not_zero])); -qed_spec_mp "hcomplexpow_not_zero"; -Addsimps [hcomplexpow_not_zero]; -AddIs [hcomplexpow_not_zero]; - -Goal "r ~= 0 ==> r hcpow n ~= (0::hcomplex)"; -by (res_inst_tac [("z","r")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); -by (auto_tac (claset(),simpset() addsimps [hcpow, - hcomplex_zero_def])); -by (ultra_tac (claset() addDs [complexpow_zero_zero],simpset()) 1); -qed "hcpow_not_zero"; -Addsimps [hcpow_not_zero]; -AddIs [hcpow_not_zero]; - -Goal "r ^ n = (0::hcomplex) ==> r = 0"; -by (blast_tac (claset() addIs [ccontr] - addDs [hcomplexpow_not_zero]) 1); -qed "hcomplexpow_zero_zero"; - -Goal "r hcpow n = (0::hcomplex) ==> r = 0"; -by (blast_tac (claset() addIs [ccontr] - addDs [hcpow_not_zero]) 1); -qed "hcpow_zero_zero"; - -Goalw [iii_def] "iii * iii = - 1"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult, - hcomplex_one_def,hcomplex_minus])); -qed "hcomplex_i_mult_eq"; -Addsimps [hcomplex_i_mult_eq]; - -Goal "iii ^ 2 = - 1"; -by (simp_tac (simpset() addsimps [two_eq_Suc_Suc]) 1); -qed "hcomplexpow_i_squared"; -Addsimps [hcomplexpow_i_squared]; - -Goalw [iii_def,hcomplex_zero_def] "iii ~= 0"; -by Auto_tac; -qed "hcomplex_i_not_zero"; -Addsimps [hcomplex_i_not_zero]; - -Goal "x * y ~= (0::hcomplex) ==> x ~= 0"; -by Auto_tac; -qed "hcomplex_mult_eq_zero_cancel1"; - -Goal "x * y ~= (0::hcomplex) ==> y ~= 0"; -by Auto_tac; -qed "hcomplex_mult_eq_zero_cancel2"; - -Goal "(x * y ~= (0::hcomplex)) = (x ~= 0 & y ~= 0)"; -by Auto_tac; -qed "hcomplex_mult_not_eq_zero_iff"; -AddIffs [hcomplex_mult_not_eq_zero_iff]; - -Goalw [hcomplex_divide_def,complex_divide_def] - "Abs_hcomplex(hcomplexrel``{%n. X n}) / Abs_hcomplex(hcomplexrel``{%n. Y n}) = \ -\ Abs_hcomplex(hcomplexrel``{%n. X n / Y n})"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_inverse,hcomplex_mult])); -qed "hcomplex_divide"; - -(*---------------------------------------------------------------------------*) -(* hsgn *) -(*---------------------------------------------------------------------------*) - -Goalw [hsgn_def] - "hsgn (Abs_hcomplex(hcomplexrel `` {%n. X n})) = \ -\ Abs_hcomplex(hcomplexrel `` {%n. sgn (X n)})"; -by (res_inst_tac [("f","Abs_hcomplex")] arg_cong 1); -by (Auto_tac THEN Ultra_tac 1); -qed "hsgn"; - -Addsimps [rename_numerals sgn_zero]; -Goalw [hcomplex_zero_def] "hsgn 0 = 0"; -by (simp_tac (simpset() addsimps [hsgn]) 1); -qed "hsgn_zero"; -Addsimps[hsgn_zero]; - -Addsimps [rename_numerals sgn_one]; - -Goalw [hcomplex_one_def] "hsgn 1 = 1"; -by (simp_tac (simpset() addsimps [hsgn]) 1); -qed "hsgn_one"; -Addsimps[hsgn_one]; - -Goal "hsgn (-z) = - hsgn(z)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hsgn,hcomplex_minus, - sgn_minus])); -qed "hsgn_minus"; - -Goal "hsgn z = z / hcomplex_of_hypreal (hcmod z)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hsgn,hcomplex_divide, - hcomplex_of_hypreal,hcmod,sgn_eq])); -qed "hsgn_eq"; - -Goal "(EX (x::hypreal) y. P x y) = \ -\ (EX f g. P (Abs_hypreal(hyprel `` {f})) (Abs_hypreal(hyprel `` {g})))"; -by Auto_tac; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by Auto_tac; -qed "lemma_hypreal_P_EX2"; - -Goal "ALL (n::nat). EX x y. (z n) = complex_of_real(x) + ii * complex_of_real(y)"; -by (blast_tac (claset() addIs [complex_split]) 1); -qed "complex_split2"; - -(* Interesting proof! *) -Goal "EX x y. z = hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [lemma_hypreal_P_EX2, - hcomplex_of_hypreal,iii_def,hcomplex_add,hcomplex_mult])); -by (cut_inst_tac [("z","x")] complex_split2 1); -by (REPEAT(dtac choice 1 THEN Step_tac 1)); -by (res_inst_tac [("x","f")] exI 1); -by (res_inst_tac [("x","fa")] exI 1); -by Auto_tac; -qed "hcomplex_split"; - -Goal "hRe(hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)) = x"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hRe,iii_def,hcomplex_add, - hcomplex_mult,hcomplex_of_hypreal])); -qed "hRe_hcomplex_i"; -Addsimps [hRe_hcomplex_i]; - -Goal "hIm(hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)) = y"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hIm,iii_def,hcomplex_add, - hcomplex_mult,hcomplex_of_hypreal])); -qed "hIm_hcomplex_i"; -Addsimps [hIm_hcomplex_i]; - -Goal "hcmod (hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)) = \ -\ ( *f* sqrt) (x ^ 2 + y ^ 2)"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - iii_def,hcomplex_add,hcomplex_mult,starfun,hypreal_mult, - hypreal_add,hcmod,cmod_i,two_eq_Suc_Suc])); -qed "hcmod_i"; - -Goalw [iii_def] - "hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya = \ -\ hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb \ -\ ==> xa = xb"; -by (res_inst_tac [("z","xa")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","ya")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","xb")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","yb")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult,hcomplex_add, - hcomplex_of_hypreal])); -by (Ultra_tac 1); -qed "hcomplex_eq_hRe_eq"; - -Goalw [iii_def] - "hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya = \ -\ hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb \ -\ ==> ya = yb"; -by (res_inst_tac [("z","xa")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","ya")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","xb")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","yb")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult,hcomplex_add, - hcomplex_of_hypreal])); -by (Ultra_tac 1); -qed "hcomplex_eq_hIm_eq"; - -Goal "(hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya = \ -\ hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb) = \ -\ ((xa = xb) & (ya = yb))"; -by (auto_tac (claset() addIs [hcomplex_eq_hIm_eq,hcomplex_eq_hRe_eq],simpset())); -qed "hcomplex_eq_cancel_iff"; -Addsimps [hcomplex_eq_cancel_iff]; - -Goal "(hcomplex_of_hypreal xa + hcomplex_of_hypreal ya * iii = \ -\ hcomplex_of_hypreal xb + hcomplex_of_hypreal yb * iii ) = ((xa = xb) & (ya = yb))"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult_commute])); -qed "hcomplex_eq_cancel_iffA"; -AddIffs [hcomplex_eq_cancel_iffA]; - -Goal "(hcomplex_of_hypreal xa + hcomplex_of_hypreal ya * iii = \ -\ hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb) = ((xa = xb) & (ya = yb))"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult_commute])); -qed "hcomplex_eq_cancel_iffB"; -AddIffs [hcomplex_eq_cancel_iffB]; - -Goal "(hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya = \ -\ hcomplex_of_hypreal xb + hcomplex_of_hypreal yb * iii) = ((xa = xb) & (ya = yb))"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult_commute])); -qed "hcomplex_eq_cancel_iffC"; -AddIffs [hcomplex_eq_cancel_iffC]; - -Goal"(hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y = \ -\ hcomplex_of_hypreal xa) = (x = xa & y = 0)"; -by (cut_inst_tac [("xa","x"),("ya","y"),("xb","xa"),("yb","0")] - hcomplex_eq_cancel_iff 1); -by (asm_full_simp_tac (simpset() delsimps [hcomplex_eq_cancel_iff]) 1); -qed "hcomplex_eq_cancel_iff2"; -Addsimps [hcomplex_eq_cancel_iff2]; - -Goal"(hcomplex_of_hypreal x + hcomplex_of_hypreal y * iii = \ -\ hcomplex_of_hypreal xa) = (x = xa & y = 0)"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult_commute])); -qed "hcomplex_eq_cancel_iff2a"; -Addsimps [hcomplex_eq_cancel_iff2a]; - -Goal "(hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y = \ -\ iii * hcomplex_of_hypreal ya) = (x = 0 & y = ya)"; -by (cut_inst_tac [("xa","x"),("ya","y"),("xb","0"),("yb","ya")] - hcomplex_eq_cancel_iff 1); -by (asm_full_simp_tac (simpset() delsimps [hcomplex_eq_cancel_iff]) 1); -qed "hcomplex_eq_cancel_iff3"; -Addsimps [hcomplex_eq_cancel_iff3]; - -Goal "(hcomplex_of_hypreal x + hcomplex_of_hypreal y * iii = \ -\ iii * hcomplex_of_hypreal ya) = (x = 0 & y = ya)"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult_commute])); -qed "hcomplex_eq_cancel_iff3a"; -Addsimps [hcomplex_eq_cancel_iff3a]; - -Goalw [iii_def] - "hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y = 0 \ -\ ==> x = 0"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hcomplex_add,hcomplex_mult,hcomplex_zero_def,hypreal_zero_num])); -by (ultra_tac (claset(),simpset() addsimps [complex_split_Re_zero]) 1); -qed "hcomplex_split_hRe_zero"; - -Goalw [iii_def] - "hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y = 0 \ -\ ==> y = 0"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hcomplex_add,hcomplex_mult,hcomplex_zero_def,hypreal_zero_num])); -by (ultra_tac (claset(),simpset() addsimps [complex_split_Im_zero]) 1); -qed "hcomplex_split_hIm_zero"; - -Goal "hRe(hsgn z) = hRe(z)/hcmod z"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hsgn,hcmod,hRe,hypreal_divide])); -qed "hRe_hsgn"; -Addsimps [hRe_hsgn]; - -Goal "hIm(hsgn z) = hIm(z)/hcmod z"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hsgn,hcmod,hIm,hypreal_divide])); -qed "hIm_hsgn"; -Addsimps [hIm_hsgn]; - -Goal "(x*x + y*y = 0) = ((x::real) = 0 & y = 0)"; -by (auto_tac (claset() addIs [real_sum_squares_cancel],simpset())); -qed "real_two_squares_add_zero_iff"; -Addsimps [real_two_squares_add_zero_iff]; - -Goal "inverse(hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y) = \ -\ hcomplex_of_hypreal(x/(x ^ 2 + y ^ 2)) - \ -\ iii * hcomplex_of_hypreal(y/(x ^ 2 + y ^ 2))"; -by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hcomplex_mult,hcomplex_add,iii_def,starfun,hypreal_mult, - hypreal_add,hcomplex_inverse,hypreal_divide,hcomplex_diff, - complex_inverse_complex_split,two_eq_Suc_Suc])); -qed "hcomplex_inverse_complex_split"; - -Goalw [iii_def] - "hRe (iii * hcomplex_of_hypreal y) = 0"; -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hcomplex_mult,hRe,hypreal_zero_num])); -qed "hRe_mult_i_eq"; -Addsimps [hRe_mult_i_eq]; - -Goalw [iii_def] - "hIm (iii * hcomplex_of_hypreal y) = y"; -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hcomplex_mult,hIm,hypreal_zero_num])); -qed "hIm_mult_i_eq"; -Addsimps [hIm_mult_i_eq]; - -Goal "hcmod (iii * hcomplex_of_hypreal y) = abs y"; -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hcmod,hypreal_hrabs,iii_def,hcomplex_mult])); -qed "hcmod_mult_i"; -Addsimps [hcmod_mult_i]; - -Goal "hcmod (hcomplex_of_hypreal y * iii) = abs y"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_mult_commute])); -qed "hcmod_mult_i2"; -Addsimps [hcmod_mult_i2]; - -(*---------------------------------------------------------------------------*) -(* harg *) -(*---------------------------------------------------------------------------*) - -Goalw [harg_def] - "harg (Abs_hcomplex(hcomplexrel `` {%n. X n})) = \ -\ Abs_hypreal(hyprel `` {%n. arg (X n)})"; -by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1); -by (Auto_tac THEN Ultra_tac 1); -qed "harg"; - -Goal "0 < y ==> ( *f* cos) (harg(iii * hcomplex_of_hypreal y)) = 0"; -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - iii_def,hcomplex_mult,hypreal_zero_num,hypreal_less,starfun, - harg])); -by (Ultra_tac 1); -qed "cos_harg_i_mult_zero"; -Addsimps [cos_harg_i_mult_zero]; - -Goal "y < 0 ==> ( *f* cos) (harg(iii * hcomplex_of_hypreal y)) = 0"; -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - iii_def,hcomplex_mult,hypreal_zero_num,hypreal_less,starfun, - harg])); -by (Ultra_tac 1); -qed "cos_harg_i_mult_zero2"; -Addsimps [cos_harg_i_mult_zero2]; - -Goal "(hcomplex_of_hypreal y ~= 0) = (y ~= 0)"; -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hypreal_zero_num,hcomplex_zero_def])); -qed "hcomplex_of_hypreal_not_zero_iff"; -Addsimps [hcomplex_of_hypreal_not_zero_iff]; - -Goal "(hcomplex_of_hypreal y = 0) = (y = 0)"; -by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal, - hypreal_zero_num,hcomplex_zero_def])); -qed "hcomplex_of_hypreal_zero_iff"; -Addsimps [hcomplex_of_hypreal_zero_iff]; - -Goal "y ~= 0 ==> ( *f* cos) (harg(iii * hcomplex_of_hypreal y)) = 0"; -by (cut_inst_tac [("x","y"),("y","0")] hypreal_linear 1); -by Auto_tac; -qed "cos_harg_i_mult_zero3"; -Addsimps [cos_harg_i_mult_zero3]; - -(*---------------------------------------------------------------------------*) -(* Polar form for nonstandard complex numbers *) -(*---------------------------------------------------------------------------*) - -Goal "ALL n. EX r a. (z n) = complex_of_real r * \ -\ (complex_of_real(cos a) + ii * complex_of_real(sin a))"; -by (blast_tac (claset() addIs [complex_split_polar]) 1); -qed "complex_split_polar2"; - -Goal - "EX r a. z = hcomplex_of_hypreal r * \ -\ (hcomplex_of_hypreal(( *f* cos) a) + iii * hcomplex_of_hypreal(( *f* sin) a))"; -by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [lemma_hypreal_P_EX2, - hcomplex_of_hypreal,iii_def,starfun,hcomplex_add,hcomplex_mult])); -by (cut_inst_tac [("z","x")] complex_split_polar2 1); -by (REPEAT(dtac choice 1 THEN Step_tac 1)); -by (res_inst_tac [("x","f")] exI 1); -by (res_inst_tac [("x","fa")] exI 1); -by Auto_tac; -qed "hcomplex_split_polar"; - -Goalw [hcis_def] - "hcis (Abs_hypreal(hyprel `` {%n. X n})) = \ -\ Abs_hcomplex(hcomplexrel `` {%n. cis (X n)})"; -by (res_inst_tac [("f","Abs_hcomplex")] arg_cong 1); -by Auto_tac; -by (Ultra_tac 1); -qed "hcis"; - -Goal - "hcis a = \ -\ (hcomplex_of_hypreal(( *f* cos) a) + \ -\ iii * hcomplex_of_hypreal(( *f* sin) a))"; -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [starfun, hcis, - hcomplex_of_hypreal,iii_def,hcomplex_mult,hcomplex_add, - cis_def])); -qed "hcis_eq"; - -Goalw [hrcis_def] - "hrcis (Abs_hypreal(hyprel `` {%n. X n})) (Abs_hypreal(hyprel `` {%n. Y n})) = \ -\ Abs_hcomplex(hcomplexrel `` {%n. rcis (X n) (Y n)})"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_of_hypreal,hcomplex_mult, - hcis,rcis_def])); -qed "hrcis"; - -Goal "EX r a. z = hrcis r a"; -by (simp_tac (simpset() addsimps [hrcis_def,hcis_eq]) 1); -by (rtac hcomplex_split_polar 1); -qed "hrcis_Ex"; - -Goal "hRe(hcomplex_of_hypreal r * \ -\ (hcomplex_of_hypreal(( *f* cos) a) + \ -\ iii * hcomplex_of_hypreal(( *f* sin) a))) = r * ( *f* cos) a"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_add_mult_distrib2, - hcomplex_of_hypreal_mult] @ hcomplex_mult_ac)); -qed "hRe_hcomplex_polar"; -Addsimps [hRe_hcomplex_polar]; - -Goalw [hrcis_def] "hRe(hrcis r a) = r * ( *f* cos) a"; -by (auto_tac (claset(),simpset() addsimps [hcis_eq])); -qed "hRe_hrcis"; -Addsimps [hRe_hrcis]; - -Goal "hIm(hcomplex_of_hypreal r * \ -\ (hcomplex_of_hypreal(( *f* cos) a) + \ -\ iii * hcomplex_of_hypreal(( *f* sin) a))) = r * ( *f* sin) a"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_add_mult_distrib2, - hcomplex_of_hypreal_mult] @ hcomplex_mult_ac)); -qed "hIm_hcomplex_polar"; -Addsimps [hIm_hcomplex_polar]; - -Goalw [hrcis_def] "hIm(hrcis r a) = r * ( *f* sin) a"; -by (auto_tac (claset(),simpset() addsimps [hcis_eq])); -qed "hIm_hrcis"; -Addsimps [hIm_hrcis]; - -Goal "hcmod (hcomplex_of_hypreal r * \ -\ (hcomplex_of_hypreal(( *f* cos) a) + \ -\ iii * hcomplex_of_hypreal(( *f* sin) a))) = abs r"; -by (res_inst_tac [("z","r")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [iii_def,starfun, - hcomplex_of_hypreal,hcomplex_mult,hcmod,hcomplex_add, - hypreal_hrabs])); -qed "hcmod_complex_polar"; -Addsimps [hcmod_complex_polar]; - -Goalw [hrcis_def] "hcmod(hrcis r a) = abs r"; -by (auto_tac (claset(),simpset() addsimps [hcis_eq])); -qed "hcmod_hrcis"; -Addsimps [hcmod_hrcis]; - -(*---------------------------------------------------------------------------*) -(* (r1 * hrcis a) * (r2 * hrcis b) = r1 * r2 * hrcis (a + b) *) -(*---------------------------------------------------------------------------*) - -Goalw [hrcis_def] "hcis a = hrcis 1 a"; -by (Simp_tac 1); -qed "hcis_hrcis_eq"; -Addsimps [hcis_hrcis_eq RS sym]; - -Goalw [hrcis_def] - "hrcis r1 a * hrcis r2 b = hrcis (r1*r2) (a + b)"; -by (res_inst_tac [("z","r1")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","r2")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","b")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hrcis,hcis, - hypreal_add,hypreal_mult,hcomplex_of_hypreal, - hcomplex_mult,cis_mult RS sym,complex_of_real_mult - RS sym] addsimps complex_mult_ac)); -qed "hrcis_mult"; - -Goal "hcis a * hcis b = hcis (a + b)"; -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","b")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcis,hcomplex_mult, - hypreal_add,cis_mult])); -qed "hcis_mult"; - -Goalw [hcomplex_one_def] - "hcis 0 = 1"; -by (auto_tac (claset(),simpset() addsimps [hcis,hypreal_zero_num])); -qed "hcis_zero"; -Addsimps [hcis_zero]; - -Goalw [hcomplex_zero_def] - "hrcis 0 a = 0"; -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hrcis,hypreal_zero_num])); -qed "hrcis_zero_mod"; -Addsimps [hrcis_zero_mod]; - -Goal "hrcis r 0 = hcomplex_of_hypreal r"; -by (res_inst_tac [("z","r")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hrcis, - hypreal_zero_num,hcomplex_of_hypreal])); -qed "hrcis_zero_arg"; -Addsimps [hrcis_zero_arg]; - -Goal "iii * (iii * x) = - x"; -by (simp_tac (simpset() addsimps [hcomplex_mult_assoc RS sym]) 1); -qed "hcomplex_i_mult_minus"; -Addsimps [hcomplex_i_mult_minus]; - -Goal "iii * iii * x = - x"; -by (Simp_tac 1); -qed "hcomplex_i_mult_minus2"; -Addsimps [hcomplex_i_mult_minus2]; - -(* Move to one of the hyperreal theories *) -Goal "hypreal_of_nat m = Abs_hypreal(hyprel `` {%n. real m})"; -by (induct_tac "m" 1); -by (auto_tac (claset(),simpset() addsimps [hypreal_zero_def, - hypreal_of_nat_Suc,hypreal_zero_num, - hypreal_one_num,hypreal_add,real_of_nat_Suc])); -qed "hypreal_of_nat"; - -Goal - "hcis (hypreal_of_nat (Suc n) * a) = hcis a * hcis (hypreal_of_nat n * a)"; -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hypreal_of_nat,hcis, - hypreal_mult,hcomplex_mult,cis_real_of_nat_Suc_mult])); -qed "hcis_hypreal_of_nat_Suc_mult"; - -Goal "(hcis a) ^ n = hcis (hypreal_of_nat n * a)"; -by (induct_tac "n" 1); -by (auto_tac (claset(),simpset() addsimps [hcis_hypreal_of_nat_Suc_mult])); -qed "NSDeMoivre"; - -Goal "hcis (hypreal_of_hypnat (n + 1) * a) = \ -\ hcis a * hcis (hypreal_of_hypnat n * a)"; -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); -by (auto_tac (claset(),simpset() addsimps [hcis,hypreal_of_hypnat, - hypnat_add,hypnat_one_def,hypreal_mult,hcomplex_mult, - cis_real_of_nat_Suc_mult])); -qed "hcis_hypreal_of_hypnat_Suc_mult"; - -Goal "(hcis a) hcpow n = hcis (hypreal_of_hypnat n * a)"; -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); -by (auto_tac (claset(),simpset() addsimps [hcis,hypreal_of_hypnat, - hypreal_mult,hcpow,DeMoivre])); -qed "NSDeMoivre_ext"; - -Goalw [hrcis_def] - "(hrcis r a) ^ n = hrcis (r ^ n) (hypreal_of_nat n * a)"; -by (auto_tac (claset(),simpset() addsimps [hcomplexpow_mult, - NSDeMoivre,hcomplex_of_hypreal_pow])); -qed "DeMoivre2"; - -Goalw [hrcis_def] - "(hrcis r a) hcpow n = hrcis (r pow n) (hypreal_of_hypnat n * a)"; -by (auto_tac (claset(),simpset() addsimps [hcpow_mult, - NSDeMoivre_ext,hcomplex_of_hypreal_hyperpow])); -qed "DeMoivre2_ext"; - -Goal "inverse(hcis a) = hcis (-a)"; -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_inverse,hcis,hypreal_minus])); -qed "hcis_inverse"; -Addsimps [hcis_inverse]; - -Goal "inverse(hrcis r a) = hrcis (inverse r) (-a)"; -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (res_inst_tac [("z","r")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcomplex_inverse,hrcis,hypreal_minus, - hypreal_inverse,rcis_inverse])); -by (Ultra_tac 1); -by (rewtac real_divide_def); -by (auto_tac (claset(),simpset() addsimps [INVERSE_ZERO])); -qed "hrcis_inverse"; - -Goal "hRe(hcis a) = ( *f* cos) a"; -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcis,starfun,hRe])); -qed "hRe_hcis"; -Addsimps [hRe_hcis]; - -Goal "hIm(hcis a) = ( *f* sin) a"; -by (res_inst_tac [("z","a")] eq_Abs_hypreal 1); -by (auto_tac (claset(),simpset() addsimps [hcis,starfun,hIm])); -qed "hIm_hcis"; -Addsimps [hIm_hcis]; - -Goal "( *f* cos) (hypreal_of_nat n * a) = hRe(hcis a ^ n)"; -by (auto_tac (claset(),simpset() addsimps [NSDeMoivre])); -qed "cos_n_hRe_hcis_pow_n"; - -Goal "( *f* sin) (hypreal_of_nat n * a) = hIm(hcis a ^ n)"; -by (auto_tac (claset(),simpset() addsimps [NSDeMoivre])); -qed "sin_n_hIm_hcis_pow_n"; - -Goal "( *f* cos) (hypreal_of_hypnat n * a) = hRe(hcis a hcpow n)"; -by (auto_tac (claset(),simpset() addsimps [NSDeMoivre_ext])); -qed "cos_n_hRe_hcis_hcpow_n"; - -Goal "( *f* sin) (hypreal_of_hypnat n * a) = hIm(hcis a hcpow n)"; -by (auto_tac (claset(),simpset() addsimps [NSDeMoivre_ext])); -qed "sin_n_hIm_hcis_hcpow_n"; - -Goalw [hexpi_def] "hexpi(a + b) = hexpi(a) * hexpi(b)"; -by (res_inst_tac [("z","a")] eq_Abs_hcomplex 1); -by (res_inst_tac [("z","b")] eq_Abs_hcomplex 1); -by (auto_tac (claset(),simpset() addsimps [hcis,hRe,hIm, - hcomplex_add,hcomplex_mult,hypreal_mult,starfun, - hcomplex_of_hypreal,cis_mult RS sym,complex_Im_add, - complex_Re_add,exp_add,complex_of_real_mult])); -qed "hexpi_add"; - -(*----------------------------------------------------------------------------------*) -(* hcomplex_of_complex preserves field and order properties *) -(*----------------------------------------------------------------------------------*) - -Goalw [hcomplex_of_complex_def] - "hcomplex_of_complex (z1 + z2) = hcomplex_of_complex z1 + hcomplex_of_complex z2"; -by (simp_tac (simpset() addsimps [hcomplex_add]) 1); -qed "hcomplex_of_complex_add"; -Addsimps [hcomplex_of_complex_add]; - -Goalw [hcomplex_of_complex_def] - "hcomplex_of_complex (z1 * z2) = hcomplex_of_complex z1 * hcomplex_of_complex z2"; -by (simp_tac (simpset() addsimps [hcomplex_mult]) 1); -qed "hcomplex_of_complex_mult"; -Addsimps [hcomplex_of_complex_mult]; - -Goalw [hcomplex_of_complex_def] - "(hcomplex_of_complex z1 = hcomplex_of_complex z2) = (z1 = z2)"; -by Auto_tac; -qed "hcomplex_of_complex_eq_iff"; -Addsimps [hcomplex_of_complex_eq_iff]; - -Goalw [hcomplex_of_complex_def] "hcomplex_of_complex (-r) = - hcomplex_of_complex r"; -by (auto_tac (claset(),simpset() addsimps [hcomplex_minus])); -qed "hcomplex_of_complex_minus"; -Addsimps [hcomplex_of_complex_minus]; - -Goalw [hcomplex_of_complex_def,hcomplex_one_def] - "hcomplex_of_complex 1 = 1"; -by Auto_tac; -qed "hcomplex_of_complex_one"; - -Goalw [hcomplex_of_complex_def,hcomplex_zero_def] - "hcomplex_of_complex 0 = 0"; -by (Simp_tac 1); -qed "hcomplex_of_complex_zero"; - -Goal "(hcomplex_of_complex r = 0) = (r = 0)"; -by (auto_tac (claset() addIs [FreeUltrafilterNat_P], - simpset() addsimps [hcomplex_of_complex_def, - hcomplex_zero_def])); -qed "hcomplex_of_complex_zero_iff"; - -Goal "hcomplex_of_complex (inverse r) = inverse (hcomplex_of_complex r)"; -by (case_tac "r=0" 1); -by (asm_simp_tac (simpset() addsimps [COMPLEX_INVERSE_ZERO, - HCOMPLEX_INVERSE_ZERO, hcomplex_of_complex_zero, - COMPLEX_DIVIDE_ZERO]) 1); -by (res_inst_tac [("c1","hcomplex_of_complex r")] - (hcomplex_mult_left_cancel RS iffD1) 1); -by (stac (hcomplex_of_complex_mult RS sym) 2); -by (auto_tac (claset(), - simpset() addsimps [hcomplex_of_complex_one, hcomplex_of_complex_zero_iff])); -qed "hcomplex_of_complex_inverse"; -Addsimps [hcomplex_of_complex_inverse]; - -Goal "hcomplex_of_complex (z1 / z2) = hcomplex_of_complex z1 / hcomplex_of_complex z2"; -by (simp_tac (simpset() addsimps [hcomplex_divide_def, complex_divide_def]) 1); -qed "hcomplex_of_complex_divide"; -Addsimps [hcomplex_of_complex_divide]; - -Goalw [hcomplex_of_complex_def,hypreal_of_real_def] - "hRe (hcomplex_of_complex z) = hypreal_of_real (Re z)"; -by (auto_tac (claset(),simpset() addsimps [hRe])); -qed "hRe_hcomplex_of_complex"; - -Goalw [hcomplex_of_complex_def,hypreal_of_real_def] - "hIm (hcomplex_of_complex z) = hypreal_of_real (Im z)"; -by (auto_tac (claset(),simpset() addsimps [hIm])); -qed "hIm_hcomplex_of_complex"; - -Goalw [hypreal_of_real_def,hcomplex_of_complex_def] - "hcmod (hcomplex_of_complex x) = hypreal_of_real (cmod x)"; -by (auto_tac (claset(),simpset() addsimps [hcmod])); -qed "hcmod_hcomplex_of_complex";
--- a/src/HOL/Complex/NSComplex.thy Mon Dec 22 16:22:14 2003 +0100 +++ b/src/HOL/Complex/NSComplex.thy Mon Dec 22 18:29:20 2003 +0100 @@ -4,124 +4,2232 @@ Description: Nonstandard Complex numbers *) -NSComplex = NSInduct + +theory NSComplex = NSInduct: constdefs hcomplexrel :: "((nat=>complex)*(nat=>complex)) set" - "hcomplexrel == {p. EX X Y. p = ((X::nat=>complex),Y) & + "hcomplexrel == {p. EX X Y. p = ((X::nat=>complex),Y) & {n::nat. X(n) = Y(n)}: FreeUltrafilterNat}" -typedef hcomplex = "{x::nat=>complex. True}//hcomplexrel" (quotient_def) +typedef hcomplex = "{x::nat=>complex. True}//hcomplexrel" + by (auto simp add: quotient_def) -instance - hcomplex :: {zero,one,plus,times,minus,power,inverse} - -defs - hcomplex_zero_def +instance hcomplex :: zero .. +instance hcomplex :: one .. +instance hcomplex :: plus .. +instance hcomplex :: times .. +instance hcomplex :: minus .. +instance hcomplex :: inverse .. +instance hcomplex :: power .. + +defs (overloaded) + hcomplex_zero_def: "0 == Abs_hcomplex(hcomplexrel `` {%n. (0::complex)})" - - hcomplex_one_def + + hcomplex_one_def: "1 == Abs_hcomplex(hcomplexrel `` {%n. (1::complex)})" - hcomplex_minus_def - "- z == Abs_hcomplex(UN X: Rep_hcomplex(z). hcomplexrel `` {%n::nat. - (X n)})" + hcomplex_minus_def: + "- z == Abs_hcomplex(UN X: Rep_hcomplex(z). + hcomplexrel `` {%n::nat. - (X n)})" - hcomplex_diff_def + hcomplex_diff_def: "w - z == w + -(z::hcomplex)" - + constdefs - hcomplex_of_complex :: complex => hcomplex + hcomplex_of_complex :: "complex => hcomplex" "hcomplex_of_complex z == Abs_hcomplex(hcomplexrel `` {%n. z})" - - hcinv :: hcomplex => hcomplex - "inverse(P) == Abs_hcomplex(UN X: Rep_hcomplex(P). + + hcinv :: "hcomplex => hcomplex" + "inverse(P) == Abs_hcomplex(UN X: Rep_hcomplex(P). hcomplexrel `` {%n. inverse(X n)})" (*--- real and Imaginary parts ---*) - - hRe :: hcomplex => hypreal + + hRe :: "hcomplex => hypreal" "hRe(z) == Abs_hypreal(UN X:Rep_hcomplex(z). hyprel `` {%n. Re (X n)})" - hIm :: hcomplex => hypreal - "hIm(z) == Abs_hypreal(UN X:Rep_hcomplex(z). hyprel `` {%n. Im (X n)})" + hIm :: "hcomplex => hypreal" + "hIm(z) == Abs_hypreal(UN X:Rep_hcomplex(z). hyprel `` {%n. Im (X n)})" (*----------- modulus ------------*) - hcmod :: hcomplex => hypreal + hcmod :: "hcomplex => hypreal" "hcmod z == Abs_hypreal(UN X: Rep_hcomplex(z). hyprel `` {%n. cmod (X n)})" - (*------ imaginary unit ----------*) - - iii :: hcomplex + (*------ imaginary unit ----------*) + + iii :: hcomplex "iii == Abs_hcomplex(hcomplexrel `` {%n. ii})" (*------- complex conjugate ------*) - hcnj :: hcomplex => hcomplex + hcnj :: "hcomplex => hcomplex" "hcnj z == Abs_hcomplex(UN X:Rep_hcomplex(z). hcomplexrel `` {%n. cnj (X n)})" - (*------------ Argand -------------*) + (*------------ Argand -------------*) - hsgn :: hcomplex => hcomplex + hsgn :: "hcomplex => hcomplex" "hsgn z == Abs_hcomplex(UN X:Rep_hcomplex(z). hcomplexrel `` {%n. sgn(X n)})" - harg :: hcomplex => hypreal + harg :: "hcomplex => hypreal" "harg z == Abs_hypreal(UN X:Rep_hcomplex(z). hyprel `` {%n. arg(X n)})" (* abbreviation for (cos a + i sin a) *) - hcis :: hypreal => hcomplex + hcis :: "hypreal => hcomplex" "hcis a == Abs_hcomplex(UN X:Rep_hypreal(a). hcomplexrel `` {%n. cis (X n)})" (* abbreviation for r*(cos a + i sin a) *) - hrcis :: [hypreal, hypreal] => hcomplex + hrcis :: "[hypreal, hypreal] => hcomplex" "hrcis r a == hcomplex_of_hypreal r * hcis a" - (*----- injection from hyperreals -----*) - - hcomplex_of_hypreal :: hypreal => hcomplex + (*----- injection from hyperreals -----*) + + hcomplex_of_hypreal :: "hypreal => hcomplex" "hcomplex_of_hypreal r == Abs_hcomplex(UN X:Rep_hypreal(r). hcomplexrel `` {%n. complex_of_real (X n)})" (*------------ e ^ (x + iy) ------------*) - hexpi :: hcomplex => hcomplex + hexpi :: "hcomplex => hcomplex" "hexpi z == hcomplex_of_hypreal(( *f* exp) (hRe z)) * hcis (hIm z)" - + -defs - +defs (overloaded) (*----------- division ----------*) - hcomplex_divide_def + hcomplex_divide_def: "w / (z::hcomplex) == w * inverse z" - - hcomplex_add_def + + hcomplex_add_def: "w + z == Abs_hcomplex(UN X:Rep_hcomplex(w). UN Y:Rep_hcomplex(z). hcomplexrel `` {%n. X n + Y n})" - hcomplex_mult_def + hcomplex_mult_def: "w * z == Abs_hcomplex(UN X:Rep_hcomplex(w). UN Y:Rep_hcomplex(z). - hcomplexrel `` {%n. X n * Y n})" + hcomplexrel `` {%n. X n * Y n})" primrec - hcomplexpow_0 "z ^ 0 = 1" - hcomplexpow_Suc "z ^ (Suc n) = (z::hcomplex) * (z ^ n)" + hcomplexpow_0: "z ^ 0 = 1" + hcomplexpow_Suc: "z ^ (Suc n) = (z::hcomplex) * (z ^ n)" consts - "hcpow" :: [hcomplex,hypnat] => hcomplex (infixr 80) + "hcpow" :: "[hcomplex,hypnat] => hcomplex" (infixr 80) defs (* hypernatural powers of nonstandard complex numbers *) - hcpow_def - "(z::hcomplex) hcpow (n::hypnat) + hcpow_def: + "(z::hcomplex) hcpow (n::hypnat) == Abs_hcomplex(UN X:Rep_hcomplex(z). UN Y: Rep_hypnat(n). hcomplexrel `` {%n. (X n) ^ (Y n)})" + +lemma hcomplexrel_iff: + "((X,Y): hcomplexrel) = ({n. X n = Y n}: FreeUltrafilterNat)" +apply (unfold hcomplexrel_def) +apply fast +done + +lemma hcomplexrel_refl: "(x,x): hcomplexrel" +apply (simp add: hcomplexrel_iff) +done + +lemma hcomplexrel_sym: "(x,y): hcomplexrel ==> (y,x):hcomplexrel" +apply (auto simp add: hcomplexrel_iff eq_commute) +done + +lemma hcomplexrel_trans: + "[|(x,y): hcomplexrel; (y,z):hcomplexrel|] ==> (x,z):hcomplexrel" +apply (simp add: hcomplexrel_iff) +apply ultra +done + +lemma equiv_hcomplexrel: "equiv UNIV hcomplexrel" +apply (simp add: equiv_def refl_def sym_def trans_def hcomplexrel_refl) +apply (blast intro: hcomplexrel_sym hcomplexrel_trans) +done + +lemmas equiv_hcomplexrel_iff = + eq_equiv_class_iff [OF equiv_hcomplexrel UNIV_I UNIV_I, simp] + +lemma hcomplexrel_in_hcomplex [simp]: "hcomplexrel``{x} : hcomplex" +apply (unfold hcomplex_def hcomplexrel_def quotient_def) +apply blast +done + +lemma inj_on_Abs_hcomplex: "inj_on Abs_hcomplex hcomplex" +apply (rule inj_on_inverseI) +apply (erule Abs_hcomplex_inverse) +done + +declare inj_on_Abs_hcomplex [THEN inj_on_iff, simp] + Abs_hcomplex_inverse [simp] + +declare equiv_hcomplexrel [THEN eq_equiv_class_iff, simp] + +declare hcomplexrel_iff [iff] + +lemma inj_Rep_hcomplex: "inj(Rep_hcomplex)" +apply (rule inj_on_inverseI) +apply (rule Rep_hcomplex_inverse) +done + +lemma lemma_hcomplexrel_refl: "x: hcomplexrel `` {x}" +apply (unfold hcomplexrel_def) +apply (safe) +apply auto +done +declare lemma_hcomplexrel_refl [simp] + +lemma hcomplex_empty_not_mem: "{} ~: hcomplex" +apply (unfold hcomplex_def) +apply (auto elim!: quotientE) +done +declare hcomplex_empty_not_mem [simp] + +lemma Rep_hcomplex_nonempty: "Rep_hcomplex x ~= {}" +apply (cut_tac x = "x" in Rep_hcomplex) +apply auto +done +declare Rep_hcomplex_nonempty [simp] + +lemma eq_Abs_hcomplex: + "(!!x. z = Abs_hcomplex(hcomplexrel `` {x}) ==> P) ==> P" +apply (rule_tac x1=z in Rep_hcomplex [unfolded hcomplex_def, THEN quotientE]) +apply (drule_tac f = Abs_hcomplex in arg_cong) +apply (force simp add: Rep_hcomplex_inverse) +done + + +subsection{*Properties of Nonstandard Real and Imaginary Parts*} + +lemma hRe: + "hRe(Abs_hcomplex (hcomplexrel `` {X})) = + Abs_hypreal(hyprel `` {%n. Re(X n)})" +apply (unfold hRe_def) +apply (rule_tac f = "Abs_hypreal" in arg_cong) +apply (auto , ultra) +done + +lemma hIm: + "hIm(Abs_hcomplex (hcomplexrel `` {X})) = + Abs_hypreal(hyprel `` {%n. Im(X n)})" +apply (unfold hIm_def) +apply (rule_tac f = "Abs_hypreal" in arg_cong) +apply (auto , ultra) +done + +lemma hcomplex_hRe_hIm_cancel_iff: "(w=z) = (hRe(w) = hRe(z) & hIm(w) = hIm(z))" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (rule_tac z = "w" in eq_Abs_hcomplex) +apply (auto simp add: hRe hIm complex_Re_Im_cancel_iff) +apply (ultra+) +done + +lemma hcomplex_hRe_zero: "hRe 0 = 0" +apply (unfold hcomplex_zero_def) +apply (simp (no_asm) add: hRe hypreal_zero_num) +done +declare hcomplex_hRe_zero [simp] + +lemma hcomplex_hIm_zero: "hIm 0 = 0" +apply (unfold hcomplex_zero_def) +apply (simp (no_asm) add: hIm hypreal_zero_num) +done +declare hcomplex_hIm_zero [simp] + +lemma hcomplex_hRe_one: "hRe 1 = 1" +apply (unfold hcomplex_one_def) +apply (simp (no_asm) add: hRe hypreal_one_num) +done +declare hcomplex_hRe_one [simp] + +lemma hcomplex_hIm_one: "hIm 1 = 0" +apply (unfold hcomplex_one_def) +apply (simp (no_asm) add: hIm hypreal_one_def hypreal_zero_num) +done +declare hcomplex_hIm_one [simp] + +(*-----------------------------------------------------------------------*) +(* hcomplex_of_complex: the injection from complex to hcomplex *) +(* ----------------------------------------------------------------------*) + +lemma inj_hcomplex_of_complex: "inj(hcomplex_of_complex)" +apply (rule inj_onI , rule ccontr) +apply (auto simp add: hcomplex_of_complex_def) +done + +lemma hcomplex_of_complex_i: "iii = hcomplex_of_complex ii" +apply (unfold iii_def hcomplex_of_complex_def) +apply (simp (no_asm)) +done + +(*-----------------------------------------------------------------------*) +(* Addition for nonstandard complex numbers: hcomplex_add *) +(* ----------------------------------------------------------------------*) + +lemma hcomplex_add_congruent2: + "congruent2 hcomplexrel (%X Y. hcomplexrel `` {%n. X n + Y n})" +apply (unfold congruent2_def) +apply safe +apply (ultra+) +done + +lemma hcomplex_add: + "Abs_hcomplex(hcomplexrel``{%n. X n}) + Abs_hcomplex(hcomplexrel``{%n. Y n}) = + Abs_hcomplex(hcomplexrel``{%n. X n + Y n})" +apply (unfold hcomplex_add_def) +apply (rule_tac f = "Abs_hcomplex" in arg_cong) +apply auto +apply (ultra) +done + +lemma hcomplex_add_commute: "(z::hcomplex) + w = w + z" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (rule_tac z = "w" in eq_Abs_hcomplex) +apply (simp (no_asm_simp) add: complex_add_commute hcomplex_add) +done + +lemma hcomplex_add_assoc: "((z1::hcomplex) + z2) + z3 = z1 + (z2 + z3)" +apply (rule_tac z = "z1" in eq_Abs_hcomplex) +apply (rule_tac z = "z2" in eq_Abs_hcomplex) +apply (rule_tac z = "z3" in eq_Abs_hcomplex) +apply (simp (no_asm_simp) add: hcomplex_add complex_add_assoc) +done + +(*For AC rewriting*) +lemma hcomplex_add_left_commute: "(x::hcomplex)+(y+z)=y+(x+z)" +apply (rule hcomplex_add_commute [THEN trans]) +apply (rule hcomplex_add_assoc [THEN trans]) +apply (rule hcomplex_add_commute [THEN arg_cong]) +done + +(* hcomplex addition is an AC operator *) +lemmas hcomplex_add_ac = hcomplex_add_assoc hcomplex_add_commute + hcomplex_add_left_commute + +lemma hcomplex_add_zero_left: "(0::hcomplex) + z = z" +apply (unfold hcomplex_zero_def) +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (simp add: hcomplex_add) +done + +lemma hcomplex_add_zero_right: "z + (0::hcomplex) = z" +apply (simp (no_asm) add: hcomplex_add_zero_left hcomplex_add_commute) +done +declare hcomplex_add_zero_left [simp] hcomplex_add_zero_right [simp] + +lemma hRe_add: "hRe(x + y) = hRe(x) + hRe(y)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hRe hcomplex_add hypreal_add complex_Re_add) +done + +lemma hIm_add: "hIm(x + y) = hIm(x) + hIm(y)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hIm hcomplex_add hypreal_add complex_Im_add) +done + +(*-----------------------------------------------------------------------*) +(* hypreal_minus: additive inverse on nonstandard complex *) +(* ----------------------------------------------------------------------*) + +lemma hcomplex_minus_congruent: + "congruent hcomplexrel (%X. hcomplexrel `` {%n. - (X n)})" + +apply (unfold congruent_def) +apply safe +apply (ultra+) +done + +lemma hcomplex_minus: + "- (Abs_hcomplex(hcomplexrel `` {%n. X n})) = + Abs_hcomplex(hcomplexrel `` {%n. -(X n)})" +apply (unfold hcomplex_minus_def) +apply (rule_tac f = "Abs_hcomplex" in arg_cong) +apply (auto , ultra) +done + +lemma hcomplex_minus_minus: "- (- z) = (z::hcomplex)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (simp (no_asm_simp) add: hcomplex_minus) +done +declare hcomplex_minus_minus [simp] + +lemma inj_hcomplex_minus: "inj(%z::hcomplex. -z)" +apply (rule inj_onI) +apply (drule_tac f = "uminus" in arg_cong) +apply simp +done + +lemma hcomplex_minus_zero: "- 0 = (0::hcomplex)" +apply (unfold hcomplex_zero_def) +apply (simp (no_asm) add: hcomplex_minus) +done +declare hcomplex_minus_zero [simp] + +lemma hcomplex_minus_zero_iff: "(-x = 0) = (x = (0::hcomplex))" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_zero_def hcomplex_minus) +done +declare hcomplex_minus_zero_iff [simp] + +lemma hcomplex_minus_zero_iff2: "(0 = -x) = (x = (0::hcomplex))" +apply (auto dest: sym) +done +declare hcomplex_minus_zero_iff2 [simp] + +lemma hcomplex_minus_not_zero_iff: "(-x ~= 0) = (x ~= (0::hcomplex))" +apply auto +done + +lemma hcomplex_add_minus_right: "z + - z = (0::hcomplex)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_add hcomplex_minus hcomplex_zero_def) +done +declare hcomplex_add_minus_right [simp] + +lemma hcomplex_add_minus_left: "-z + z = (0::hcomplex)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_add hcomplex_minus hcomplex_zero_def) +done +declare hcomplex_add_minus_left [simp] + +lemma hcomplex_add_minus_cancel: "z + (- z + w) = (w::hcomplex)" +apply (simp (no_asm) add: hcomplex_add_assoc [symmetric]) +done + +lemma hcomplex_minus_add_cancel: "(-z) + (z + w) = (w::hcomplex)" +apply (simp (no_asm) add: hcomplex_add_assoc [symmetric]) +done + +lemma hRe_minus: "hRe(-z) = - hRe(z)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hRe hcomplex_minus hypreal_minus complex_Re_minus) +done + +lemma hIm_minus: "hIm(-z) = - hIm(z)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hIm hcomplex_minus hypreal_minus complex_Im_minus) +done + +lemma hcomplex_add_minus_eq_minus: + "x + y = (0::hcomplex) ==> x = -y" +apply (unfold hcomplex_zero_def) +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_add hcomplex_minus) +apply ultra +done + +lemma hcomplex_minus_add_distrib: "-(x + y) = -x + -(y::hcomplex)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_add hcomplex_minus) +done +declare hcomplex_minus_add_distrib [simp] + +lemma hcomplex_add_left_cancel: "((x::hcomplex) + y = x + z) = (y = z)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_add) +done +declare hcomplex_add_left_cancel [iff] + +lemma hcomplex_add_right_cancel: "(y + (x::hcomplex)= z + x) = (y = z)" +apply (simp (no_asm) add: hcomplex_add_commute) +done +declare hcomplex_add_right_cancel [iff] + +lemma hcomplex_eq_minus_iff: "((x::hcomplex) = y) = ((0::hcomplex) = x + - y)" +apply (safe) +apply (rule_tac [2] x1 = "-y" in hcomplex_add_right_cancel [THEN iffD1]) +apply auto +done + +lemma hcomplex_eq_minus_iff2: "((x::hcomplex) = y) = (x + - y = (0::hcomplex))" +apply (safe) +apply (rule_tac [2] x1 = "-y" in hcomplex_add_right_cancel [THEN iffD1]) +apply auto +done + +subsection{*Subraction for Nonstandard Complex Numbers*} + +lemma hcomplex_diff: + "Abs_hcomplex(hcomplexrel``{%n. X n}) - Abs_hcomplex(hcomplexrel``{%n. Y n}) = + Abs_hcomplex(hcomplexrel``{%n. X n - Y n})" + +apply (unfold hcomplex_diff_def) +apply (auto simp add: hcomplex_minus hcomplex_add complex_diff_def) +done + +lemma hcomplex_diff_zero: "(z::hcomplex) - z = (0::hcomplex)" +apply (unfold hcomplex_diff_def) +apply (simp (no_asm)) +done +declare hcomplex_diff_zero [simp] + +lemma hcomplex_diff_0: "(0::hcomplex) - x = -x" +apply (simp (no_asm) add: hcomplex_diff_def) +done + +lemma hcomplex_diff_0_right: "x - (0::hcomplex) = x" +apply (simp (no_asm) add: hcomplex_diff_def) +done + +lemma hcomplex_diff_self: "x - x = (0::hcomplex)" +apply (simp (no_asm) add: hcomplex_diff_def) +done + +declare hcomplex_diff_0 [simp] hcomplex_diff_0_right [simp] hcomplex_diff_self [simp] + +lemma hcomplex_diff_eq_eq: "((x::hcomplex) - y = z) = (x = z + y)" +apply (auto simp add: hcomplex_diff_def hcomplex_add_assoc) +done + +subsection{*Multiplication for Nonstandard Complex Numbers*} + +lemma hcomplex_mult: + "Abs_hcomplex(hcomplexrel``{%n. X n}) * Abs_hcomplex(hcomplexrel``{%n. Y n}) = + Abs_hcomplex(hcomplexrel``{%n. X n * Y n})" + +apply (unfold hcomplex_mult_def) +apply (rule_tac f = "Abs_hcomplex" in arg_cong) +apply (auto , ultra) +done + +lemma hcomplex_mult_commute: "(w::hcomplex) * z = z * w" +apply (rule_tac z = "w" in eq_Abs_hcomplex) +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_mult complex_mult_commute) +done + +lemma hcomplex_mult_assoc: "((u::hcomplex) * v) * w = u * (v * w)" +apply (rule_tac z = "u" in eq_Abs_hcomplex) +apply (rule_tac z = "v" in eq_Abs_hcomplex) +apply (rule_tac z = "w" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_mult complex_mult_assoc) +done + +lemma hcomplex_mult_left_commute: "(x::hcomplex) * (y * z) = y * (x * z)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_mult complex_mult_left_commute) +done + +lemmas hcomplex_mult_ac = hcomplex_mult_assoc hcomplex_mult_commute + hcomplex_mult_left_commute + +lemma hcomplex_mult_one_left: "(1::hcomplex) * z = z" +apply (unfold hcomplex_one_def) +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_mult) +done +declare hcomplex_mult_one_left [simp] + +lemma hcomplex_mult_one_right: "z * (1::hcomplex) = z" +apply (simp (no_asm) add: hcomplex_mult_commute) +done +declare hcomplex_mult_one_right [simp] + +lemma hcomplex_mult_zero_left: "(0::hcomplex) * z = 0" +apply (unfold hcomplex_zero_def) +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_mult) +done +declare hcomplex_mult_zero_left [simp] + +lemma hcomplex_mult_zero_right: "z * (0::hcomplex) = 0" +apply (simp (no_asm) add: hcomplex_mult_commute) +done +declare hcomplex_mult_zero_right [simp] + +lemma hcomplex_minus_mult_eq1: "-(x * y) = -x * (y::hcomplex)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_mult hcomplex_minus) +done + +lemma hcomplex_minus_mult_eq2: "-(x * y) = x * -(y::hcomplex)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_mult hcomplex_minus) +done + +declare hcomplex_minus_mult_eq1 [symmetric, simp] hcomplex_minus_mult_eq2 [symmetric, simp] + +lemma hcomplex_mult_minus_one: "- 1 * (z::hcomplex) = -z" +apply (simp (no_asm)) +done +declare hcomplex_mult_minus_one [simp] + +lemma hcomplex_mult_minus_one_right: "(z::hcomplex) * - 1 = -z" +apply (subst hcomplex_mult_commute) +apply (simp (no_asm)) +done +declare hcomplex_mult_minus_one_right [simp] + +lemma hcomplex_minus_mult_cancel: "-x * -y = x * (y::hcomplex)" +apply auto +done +declare hcomplex_minus_mult_cancel [simp] + +lemma hcomplex_minus_mult_commute: "-x * y = x * -(y::hcomplex)" +apply auto +done + +lemma hcomplex_add_mult_distrib: "((z1::hcomplex) + z2) * w = (z1 * w) + (z2 * w)" +apply (rule_tac z = "z1" in eq_Abs_hcomplex) +apply (rule_tac z = "z2" in eq_Abs_hcomplex) +apply (rule_tac z = "w" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_mult hcomplex_add complex_add_mult_distrib) +done + +lemma hcomplex_add_mult_distrib2: "(w::hcomplex) * (z1 + z2) = (w * z1) + (w * z2)" +apply (rule_tac z1 = "z1 + z2" in hcomplex_mult_commute [THEN ssubst]) +apply (simp (no_asm) add: hcomplex_add_mult_distrib) +apply (simp (no_asm) add: hcomplex_mult_commute) +done + +lemma hcomplex_zero_not_eq_one: "(0::hcomplex) ~= (1::hcomplex)" +apply (unfold hcomplex_zero_def hcomplex_one_def) +apply auto +done +declare hcomplex_zero_not_eq_one [simp] +declare hcomplex_zero_not_eq_one [THEN not_sym, simp] + + +subsection{*Inverse of Nonstandard Complex Number*} + +lemma hcomplex_inverse: + "inverse (Abs_hcomplex(hcomplexrel `` {%n. X n})) = + Abs_hcomplex(hcomplexrel `` {%n. inverse (X n)})" +apply (unfold hcinv_def) +apply (rule_tac f = "Abs_hcomplex" in arg_cong) +apply (auto , ultra) +done + +lemma HCOMPLEX_INVERSE_ZERO: "inverse (0::hcomplex) = 0" +apply (unfold hcomplex_zero_def) +apply (auto simp add: hcomplex_inverse) +done + +lemma HCOMPLEX_DIVISION_BY_ZERO: "a / (0::hcomplex) = 0" +apply (simp (no_asm) add: hcomplex_divide_def HCOMPLEX_INVERSE_ZERO) +done + +lemma hcomplex_mult_inv_left: + "z ~= (0::hcomplex) ==> inverse(z) * z = (1::hcomplex)" +apply (unfold hcomplex_zero_def hcomplex_one_def) +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_inverse hcomplex_mult) +apply (ultra) +apply (rule ccontr) +apply (drule complex_mult_inv_left) +apply auto +done +declare hcomplex_mult_inv_left [simp] + +lemma hcomplex_mult_inv_right: "z ~= (0::hcomplex) ==> z * inverse(z) = (1::hcomplex)" +apply (auto intro: hcomplex_mult_commute [THEN subst]) +done +declare hcomplex_mult_inv_right [simp] + +lemma hcomplex_mult_left_cancel: "(c::hcomplex) ~= (0::hcomplex) ==> (c*a=c*b) = (a=b)" +apply auto +apply (drule_tac f = "%x. x*inverse c" in arg_cong) +apply (simp add: hcomplex_mult_ac) +done + +lemma hcomplex_mult_right_cancel: "(c::hcomplex) ~= (0::hcomplex) ==> (a*c=b*c) = (a=b)" +apply (safe) +apply (drule_tac f = "%x. x*inverse c" in arg_cong) +apply (simp add: hcomplex_mult_ac) +done + +lemma hcomplex_inverse_not_zero: "z ~= (0::hcomplex) ==> inverse(z) ~= 0" +apply (safe) +apply (frule hcomplex_mult_right_cancel [THEN iffD2]) +apply (erule_tac [2] V = "inverse z = 0" in thin_rl) +apply (assumption , auto) +done +declare hcomplex_inverse_not_zero [simp] + +lemma hcomplex_mult_not_zero: "[| x ~= (0::hcomplex); y ~= 0 |] ==> x * y ~= 0" +apply (safe) +apply (drule_tac f = "%z. inverse x*z" in arg_cong) +apply (simp add: hcomplex_mult_assoc [symmetric]) +done + +lemmas hcomplex_mult_not_zeroE = hcomplex_mult_not_zero [THEN notE, standard] + +lemma hcomplex_inverse_inverse: "inverse(inverse x) = (x::hcomplex)" +apply (case_tac "x = 0", simp add: HCOMPLEX_INVERSE_ZERO) +apply (rule_tac c1 = "inverse x" in hcomplex_mult_right_cancel [THEN iffD1]) +apply (erule hcomplex_inverse_not_zero) +apply (auto dest: hcomplex_inverse_not_zero) +done +declare hcomplex_inverse_inverse [simp] + +lemma hcomplex_inverse_one: "inverse((1::hcomplex)) = 1" +apply (unfold hcomplex_one_def) +apply (simp (no_asm) add: hcomplex_inverse) +done +declare hcomplex_inverse_one [simp] + +lemma hcomplex_minus_inverse: "inverse(-x) = -inverse(x::hcomplex)" +apply (case_tac "x = 0", simp add: HCOMPLEX_INVERSE_ZERO) +apply (rule_tac c1 = "-x" in hcomplex_mult_right_cancel [THEN iffD1]) +apply (force ); +apply (subst hcomplex_mult_inv_left) +apply auto +done + +lemma hcomplex_inverse_distrib: "inverse(x*y) = inverse x * inverse (y::hcomplex)" +apply (case_tac "x = 0", simp add: HCOMPLEX_INVERSE_ZERO) +apply (case_tac "y = 0", simp add: HCOMPLEX_INVERSE_ZERO) +apply (rule_tac c1 = "x*y" in hcomplex_mult_left_cancel [THEN iffD1]) +apply (auto simp add: hcomplex_mult_not_zero hcomplex_mult_ac) +apply (auto simp add: hcomplex_mult_not_zero hcomplex_mult_assoc [symmetric]) +done + +subsection{*Division*} + +lemma hcomplex_times_divide1_eq: "(x::hcomplex) * (y/z) = (x*y)/z" +apply (simp (no_asm) add: hcomplex_divide_def hcomplex_mult_assoc) +done + +lemma hcomplex_times_divide2_eq: "(y/z) * (x::hcomplex) = (y*x)/z" +apply (simp (no_asm) add: hcomplex_divide_def hcomplex_mult_ac) +done + +declare hcomplex_times_divide1_eq [simp] hcomplex_times_divide2_eq [simp] + +lemma hcomplex_divide_divide1_eq: "(x::hcomplex) / (y/z) = (x*z)/y" +apply (simp (no_asm) add: hcomplex_divide_def hcomplex_inverse_distrib hcomplex_mult_ac) +done + +lemma hcomplex_divide_divide2_eq: "((x::hcomplex) / y) / z = x/(y*z)" +apply (simp (no_asm) add: hcomplex_divide_def hcomplex_inverse_distrib hcomplex_mult_assoc) +done + +declare hcomplex_divide_divide1_eq [simp] hcomplex_divide_divide2_eq [simp] + +(** As with multiplication, pull minus signs OUT of the / operator **) + +lemma hcomplex_minus_divide_eq: "(-x) / (y::hcomplex) = - (x/y)" +apply (simp (no_asm) add: hcomplex_divide_def) +done +declare hcomplex_minus_divide_eq [simp] + +lemma hcomplex_divide_minus_eq: "(x / -(y::hcomplex)) = - (x/y)" +apply (simp (no_asm) add: hcomplex_divide_def hcomplex_minus_inverse) +done +declare hcomplex_divide_minus_eq [simp] + +lemma hcomplex_add_divide_distrib: "(x+y)/(z::hcomplex) = x/z + y/z" +apply (simp (no_asm) add: hcomplex_divide_def hcomplex_add_mult_distrib) +done + + +subsection{*Embedding Properties for @{term hcomplex_of_hypreal} Map*} + +lemma hcomplex_of_hypreal: + "hcomplex_of_hypreal (Abs_hypreal(hyprel `` {%n. X n})) = + Abs_hcomplex(hcomplexrel `` {%n. complex_of_real (X n)})" +apply (unfold hcomplex_of_hypreal_def) +apply (rule_tac f = "Abs_hcomplex" in arg_cong) +apply auto +apply (ultra) +done + +lemma inj_hcomplex_of_hypreal: "inj hcomplex_of_hypreal" +apply (rule inj_onI) +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal) +done + +lemma hcomplex_of_hypreal_cancel_iff: "(hcomplex_of_hypreal x = hcomplex_of_hypreal y) = (x = y)" +apply (auto dest: inj_hcomplex_of_hypreal [THEN injD]) +done +declare hcomplex_of_hypreal_cancel_iff [iff] + +lemma hcomplex_of_hypreal_minus: "hcomplex_of_hypreal(-x) = - hcomplex_of_hypreal x" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hcomplex_minus hypreal_minus complex_of_real_minus) +done + +lemma hcomplex_of_hypreal_inverse: "hcomplex_of_hypreal(inverse x) = inverse(hcomplex_of_hypreal x)" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hypreal_inverse hcomplex_inverse complex_of_real_inverse) +done + +lemma hcomplex_of_hypreal_add: "hcomplex_of_hypreal x + hcomplex_of_hypreal y = + hcomplex_of_hypreal (x + y)" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hypreal_add hcomplex_add complex_of_real_add) +done + +lemma hcomplex_of_hypreal_diff: + "hcomplex_of_hypreal x - hcomplex_of_hypreal y = + hcomplex_of_hypreal (x - y)" +apply (unfold hcomplex_diff_def) +apply (auto simp add: hcomplex_of_hypreal_minus [symmetric] hcomplex_of_hypreal_add hypreal_diff_def) +done + +lemma hcomplex_of_hypreal_mult: "hcomplex_of_hypreal x * hcomplex_of_hypreal y = + hcomplex_of_hypreal (x * y)" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hypreal_mult hcomplex_mult complex_of_real_mult) +done + +lemma hcomplex_of_hypreal_divide: + "hcomplex_of_hypreal x / hcomplex_of_hypreal y = hcomplex_of_hypreal(x/y)" +apply (unfold hcomplex_divide_def) +apply (case_tac "y=0") +apply (simp (no_asm_simp) add: HYPREAL_DIVISION_BY_ZERO HYPREAL_INVERSE_ZERO HCOMPLEX_INVERSE_ZERO) +apply (auto simp add: hcomplex_of_hypreal_mult hcomplex_of_hypreal_inverse [symmetric]) +apply (simp (no_asm) add: hypreal_divide_def) +done + +lemma hcomplex_of_hypreal_one [simp]: + "hcomplex_of_hypreal 1 = 1" +apply (unfold hcomplex_one_def) +apply (auto simp add: hcomplex_of_hypreal hypreal_one_num) +done + +lemma hcomplex_of_hypreal_zero [simp]: + "hcomplex_of_hypreal 0 = 0" +apply (unfold hcomplex_zero_def hypreal_zero_def) +apply (auto simp add: hcomplex_of_hypreal) +done + +lemma hcomplex_of_hypreal_pow: + "hcomplex_of_hypreal (x ^ n) = (hcomplex_of_hypreal x) ^ n" +apply (induct_tac "n") +apply (auto simp add: hcomplex_of_hypreal_mult [symmetric]) +done + +lemma hRe_hcomplex_of_hypreal: "hRe(hcomplex_of_hypreal z) = z" +apply (rule_tac z = "z" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hRe) +done +declare hRe_hcomplex_of_hypreal [simp] + +lemma hIm_hcomplex_of_hypreal: "hIm(hcomplex_of_hypreal z) = 0" +apply (rule_tac z = "z" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hIm hypreal_zero_num) +done +declare hIm_hcomplex_of_hypreal [simp] + +lemma hcomplex_of_hypreal_epsilon_not_zero: "hcomplex_of_hypreal epsilon ~= 0" +apply (auto simp add: hcomplex_of_hypreal epsilon_def hcomplex_zero_def) +done +declare hcomplex_of_hypreal_epsilon_not_zero [simp] + +(*---------------------------------------------------------------------------*) +(* Modulus (absolute value) of nonstandard complex number *) +(*---------------------------------------------------------------------------*) + +lemma hcmod: + "hcmod (Abs_hcomplex(hcomplexrel `` {%n. X n})) = + Abs_hypreal(hyprel `` {%n. cmod (X n)})" + +apply (unfold hcmod_def) +apply (rule_tac f = "Abs_hypreal" in arg_cong) +apply (auto , ultra) +done + +lemma hcmod_zero [simp]: + "hcmod(0) = 0" +apply (unfold hcomplex_zero_def hypreal_zero_def) +apply (auto simp add: hcmod) +done + +lemma hcmod_one: + "hcmod(1) = 1" +apply (unfold hcomplex_one_def) +apply (auto simp add: hcmod hypreal_one_num) +done +declare hcmod_one [simp] + +lemma hcmod_hcomplex_of_hypreal: "hcmod(hcomplex_of_hypreal x) = abs x" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (auto simp add: hcmod hcomplex_of_hypreal hypreal_hrabs) +done +declare hcmod_hcomplex_of_hypreal [simp] + +lemma hcomplex_of_hypreal_abs: "hcomplex_of_hypreal (abs x) = + hcomplex_of_hypreal(hcmod(hcomplex_of_hypreal x))" +apply (simp (no_asm)) +done + + +subsection{*Conjugation*} + +lemma hcnj: + "hcnj (Abs_hcomplex(hcomplexrel `` {%n. X n})) = + Abs_hcomplex(hcomplexrel `` {%n. cnj(X n)})" + +apply (unfold hcnj_def) +apply (rule_tac f = "Abs_hcomplex" in arg_cong) +apply (auto , ultra) +done + +lemma inj_hcnj: "inj hcnj" +apply (rule inj_onI) +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcnj) +done + +lemma hcomplex_hcnj_cancel_iff: "(hcnj x = hcnj y) = (x = y)" +apply (auto dest: inj_hcnj [THEN injD]) +done +declare hcomplex_hcnj_cancel_iff [simp] + +lemma hcomplex_hcnj_hcnj: "hcnj (hcnj z) = z" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcnj) +done +declare hcomplex_hcnj_hcnj [simp] + +lemma hcomplex_hcnj_hcomplex_of_hypreal: "hcnj (hcomplex_of_hypreal x) = hcomplex_of_hypreal x" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (auto simp add: hcnj hcomplex_of_hypreal) +done +declare hcomplex_hcnj_hcomplex_of_hypreal [simp] + +lemma hcomplex_hmod_hcnj: "hcmod (hcnj z) = hcmod z" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcnj hcmod) +done +declare hcomplex_hmod_hcnj [simp] + +lemma hcomplex_hcnj_minus: "hcnj (-z) = - hcnj z" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcnj hcomplex_minus complex_cnj_minus) +done + +lemma hcomplex_hcnj_inverse: "hcnj(inverse z) = inverse(hcnj z)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcnj hcomplex_inverse complex_cnj_inverse) +done + +lemma hcomplex_hcnj_add: "hcnj(w + z) = hcnj(w) + hcnj(z)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (rule_tac z = "w" in eq_Abs_hcomplex) +apply (auto simp add: hcnj hcomplex_add complex_cnj_add) +done + +lemma hcomplex_hcnj_diff: "hcnj(w - z) = hcnj(w) - hcnj(z)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (rule_tac z = "w" in eq_Abs_hcomplex) +apply (auto simp add: hcnj hcomplex_diff complex_cnj_diff) +done + +lemma hcomplex_hcnj_mult: "hcnj(w * z) = hcnj(w) * hcnj(z)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (rule_tac z = "w" in eq_Abs_hcomplex) +apply (auto simp add: hcnj hcomplex_mult complex_cnj_mult) +done + +lemma hcomplex_hcnj_divide: "hcnj(w / z) = (hcnj w)/(hcnj z)" +apply (unfold hcomplex_divide_def) +apply (simp (no_asm) add: hcomplex_hcnj_mult hcomplex_hcnj_inverse) +done + +lemma hcnj_one: "hcnj 1 = 1" +apply (unfold hcomplex_one_def) +apply (simp (no_asm) add: hcnj) +done +declare hcnj_one [simp] + +lemma hcomplex_hcnj_pow: "hcnj(z ^ n) = hcnj(z) ^ n" +apply (induct_tac "n") +apply (auto simp add: hcomplex_hcnj_mult) +done + +(* MOVE to NSComplexBin +Goal "z + hcnj z = + hcomplex_of_hypreal (2 * hRe(z))" +by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); +by (auto_tac (claset(),HOL_ss addsimps [hRe,hcnj,hcomplex_add, + hypreal_mult,hcomplex_of_hypreal,complex_add_cnj])); +qed "hcomplex_add_hcnj"; + +Goal "z - hcnj z = \ +\ hcomplex_of_hypreal (hypreal_of_real 2 * hIm(z)) * iii"; +by (res_inst_tac [("z","z")] eq_Abs_hcomplex 1); +by (auto_tac (claset(),simpset() addsimps [hIm,hcnj,hcomplex_diff, + hypreal_of_real_def,hypreal_mult,hcomplex_of_hypreal, + complex_diff_cnj,iii_def,hcomplex_mult])); +qed "hcomplex_diff_hcnj"; +*) + +lemma hcomplex_hcnj_zero: + "hcnj 0 = 0" +apply (unfold hcomplex_zero_def) +apply (auto simp add: hcnj) +done +declare hcomplex_hcnj_zero [simp] + +lemma hcomplex_hcnj_zero_iff: "(hcnj z = 0) = (z = 0)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_zero_def hcnj) +done +declare hcomplex_hcnj_zero_iff [iff] + +lemma hcomplex_mult_hcnj: "z * hcnj z = hcomplex_of_hypreal (hRe(z) ^ 2 + hIm(z) ^ 2)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcnj hcomplex_mult hcomplex_of_hypreal hRe hIm hypreal_add hypreal_mult complex_mult_cnj two_eq_Suc_Suc) +done + + +(*---------------------------------------------------------------------------*) +(* some algebra etc. *) +(*---------------------------------------------------------------------------*) + +lemma hcomplex_mult_zero_iff: "(x*y = (0::hcomplex)) = (x = 0 | y = 0)" +apply auto +apply (auto intro: ccontr dest: hcomplex_mult_not_zero) +done +declare hcomplex_mult_zero_iff [simp] + +lemma hcomplex_add_left_cancel_zero: "(x + y = x) = (y = (0::hcomplex))" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_add hcomplex_zero_def) +done +declare hcomplex_add_left_cancel_zero [simp] + +lemma hcomplex_diff_mult_distrib: + "((z1::hcomplex) - z2) * w = (z1 * w) - (z2 * w)" +apply (unfold hcomplex_diff_def) +apply (simp (no_asm) add: hcomplex_add_mult_distrib) +done + +lemma hcomplex_diff_mult_distrib2: + "(w::hcomplex) * (z1 - z2) = (w * z1) - (w * z2)" +apply (unfold hcomplex_diff_def) +apply (simp (no_asm) add: hcomplex_add_mult_distrib2) +done + +(*---------------------------------------------------------------------------*) +(* More theorems about hcmod *) +(*---------------------------------------------------------------------------*) + +lemma hcomplex_hcmod_eq_zero_cancel: "(hcmod x = 0) = (x = 0)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hcomplex_zero_def hypreal_zero_num) +done +declare hcomplex_hcmod_eq_zero_cancel [simp] + +(* not proved already? strange! *) +lemma hypreal_of_nat_le_iff: + "(hypreal_of_nat n <= hypreal_of_nat m) = (n <= m)" +apply (unfold hypreal_le_def) +apply auto +done +declare hypreal_of_nat_le_iff [simp] + +lemma hypreal_of_nat_ge_zero: "0 <= hypreal_of_nat n" +apply (simp (no_asm) add: hypreal_of_nat_zero [symmetric] + del: hypreal_of_nat_zero) +done +declare hypreal_of_nat_ge_zero [simp] + +declare hypreal_of_nat_ge_zero [THEN hrabs_eqI1, simp] + +lemma hypreal_of_hypnat_ge_zero: "0 <= hypreal_of_hypnat n" +apply (rule_tac z = "n" in eq_Abs_hypnat) +apply (simp (no_asm_simp) add: hypreal_of_hypnat hypreal_zero_num hypreal_le) +done +declare hypreal_of_hypnat_ge_zero [simp] + +declare hypreal_of_hypnat_ge_zero [THEN hrabs_eqI1, simp] + +lemma hcmod_hcomplex_of_hypreal_of_nat: "hcmod (hcomplex_of_hypreal(hypreal_of_nat n)) = hypreal_of_nat n" +apply auto +done +declare hcmod_hcomplex_of_hypreal_of_nat [simp] + +lemma hcmod_hcomplex_of_hypreal_of_hypnat: "hcmod (hcomplex_of_hypreal(hypreal_of_hypnat n)) = hypreal_of_hypnat n" +apply auto +done +declare hcmod_hcomplex_of_hypreal_of_hypnat [simp] + +lemma hcmod_minus: "hcmod (-x) = hcmod(x)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hcomplex_minus) +done +declare hcmod_minus [simp] + +lemma hcmod_mult_hcnj: "hcmod(z * hcnj(z)) = hcmod(z) ^ 2" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hcomplex_mult hcnj hypreal_mult complex_mod_mult_cnj two_eq_Suc_Suc) +done + +lemma hcmod_ge_zero: "(0::hypreal) <= hcmod x" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hypreal_zero_num hypreal_le) +done +declare hcmod_ge_zero [simp] + +lemma hrabs_hcmod_cancel: "abs(hcmod x) = hcmod x" +apply (auto intro: hrabs_eqI1) +done +declare hrabs_hcmod_cancel [simp] + +lemma hcmod_mult: "hcmod(x*y) = hcmod(x) * hcmod(y)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hcomplex_mult hypreal_mult complex_mod_mult) +done + +lemma hcmod_add_squared_eq: + "hcmod(x + y) ^ 2 = hcmod(x) ^ 2 + hcmod(y) ^ 2 + 2 * hRe(x * hcnj y)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hcomplex_add hypreal_mult hRe hcnj hcomplex_mult + two_eq_Suc_Suc realpow_two [symmetric] + simp del: realpow_Suc) +apply (auto simp add: two_eq_Suc_Suc [symmetric] complex_mod_add_squared_eq + hypreal_add [symmetric] hypreal_mult [symmetric] + hypreal_of_real_def [symmetric]) +done + +lemma hcomplex_hRe_mult_hcnj_le_hcmod: "hRe(x * hcnj y) <= hcmod(x * hcnj y)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hcnj hcomplex_mult hRe hypreal_le) +done +declare hcomplex_hRe_mult_hcnj_le_hcmod [simp] + +lemma hcomplex_hRe_mult_hcnj_le_hcmod2: "hRe(x * hcnj y) <= hcmod(x * y)" +apply (cut_tac x = "x" and y = "y" in hcomplex_hRe_mult_hcnj_le_hcmod) +apply (simp add: hcmod_mult) +done +declare hcomplex_hRe_mult_hcnj_le_hcmod2 [simp] + +lemma hcmod_triangle_squared: "hcmod (x + y) ^ 2 <= (hcmod(x) + hcmod(y)) ^ 2" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hcnj hcomplex_add hypreal_mult hypreal_add + hypreal_le realpow_two [symmetric] two_eq_Suc_Suc + simp del: realpow_Suc) +apply (simp (no_asm) add: two_eq_Suc_Suc [symmetric]) +done +declare hcmod_triangle_squared [simp] + +lemma hcmod_triangle_ineq: "hcmod (x + y) <= hcmod(x) + hcmod(y)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hcomplex_add hypreal_add hypreal_le) +done +declare hcmod_triangle_ineq [simp] + +lemma hcmod_triangle_ineq2: "hcmod(b + a) - hcmod b <= hcmod a" +apply (cut_tac x1 = "b" and y1 = "a" and c = "-hcmod b" in hcmod_triangle_ineq [THEN add_right_mono]) +apply (simp add: hypreal_add_ac) +done +declare hcmod_triangle_ineq2 [simp] + +lemma hcmod_diff_commute: "hcmod (x - y) = hcmod (y - x)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hcomplex_diff complex_mod_diff_commute) +done + +lemma hcmod_add_less: "[| hcmod x < r; hcmod y < s |] ==> hcmod (x + y) < r + s" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (rule_tac z = "r" in eq_Abs_hypreal) +apply (rule_tac z = "s" in eq_Abs_hypreal) +apply (auto simp add: hcmod hcomplex_add hypreal_add hypreal_less) +apply ultra +apply (auto intro: complex_mod_add_less) +done + +lemma hcmod_mult_less: "[| hcmod x < r; hcmod y < s |] ==> hcmod (x * y) < r * s" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "y" in eq_Abs_hcomplex) +apply (rule_tac z = "r" in eq_Abs_hypreal) +apply (rule_tac z = "s" in eq_Abs_hypreal) +apply (auto simp add: hcmod hypreal_mult hypreal_less hcomplex_mult) +apply ultra +apply (auto intro: complex_mod_mult_less) +done + +lemma hcmod_diff_ineq: "hcmod(a) - hcmod(b) <= hcmod(a + b)" +apply (rule_tac z = "a" in eq_Abs_hcomplex) +apply (rule_tac z = "b" in eq_Abs_hcomplex) +apply (auto simp add: hcmod hcomplex_add hypreal_diff hypreal_le) +done +declare hcmod_diff_ineq [simp] + + + +subsection{*A Few Nonlinear Theorems*} + +lemma hcpow: + "Abs_hcomplex(hcomplexrel``{%n. X n}) hcpow + Abs_hypnat(hypnatrel``{%n. Y n}) = + Abs_hcomplex(hcomplexrel``{%n. X n ^ Y n})" +apply (unfold hcpow_def) +apply (rule_tac f = "Abs_hcomplex" in arg_cong) +apply (auto , ultra) +done + +lemma hcomplex_of_hypreal_hyperpow: "hcomplex_of_hypreal (x pow n) = (hcomplex_of_hypreal x) hcpow n" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "n" in eq_Abs_hypnat) +apply (auto simp add: hcomplex_of_hypreal hyperpow hcpow complex_of_real_pow) +done + +lemma hcmod_hcomplexpow: "hcmod(x ^ n) = hcmod(x) ^ n" +apply (induct_tac "n") +apply (auto simp add: hcmod_mult) +done + +lemma hcmod_hcpow: "hcmod(x hcpow n) = hcmod(x) pow n" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "n" in eq_Abs_hypnat) +apply (auto simp add: hcpow hyperpow hcmod complex_mod_complexpow) +done + +lemma hcomplexpow_minus: "(-x::hcomplex) ^ n = (if even n then (x ^ n) else -(x ^ n))" +apply (induct_tac "n") +apply auto +done + +lemma hcpow_minus: "(-x::hcomplex) hcpow n = + (if ( *pNat* even) n then (x hcpow n) else -(x hcpow n))" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (rule_tac z = "n" in eq_Abs_hypnat) +apply (auto simp add: hcpow hyperpow starPNat hcomplex_minus) +apply ultra +apply (auto simp add: complexpow_minus) +apply ultra +done + +lemma hccomplex_inverse_minus: "inverse(-x) = - inverse (x::hcomplex)" +apply (rule_tac z = "x" in eq_Abs_hcomplex) +apply (auto simp add: hcomplex_inverse hcomplex_minus complex_inverse_minus) +done + +lemma hcomplex_div_one: "x / (1::hcomplex) = x" +apply (unfold hcomplex_divide_def) +apply (simp (no_asm)) +done +declare hcomplex_div_one [simp] + +lemma hcmod_hcomplex_inverse: "hcmod(inverse x) = inverse(hcmod x)" +apply (case_tac "x = 0", simp add: HCOMPLEX_INVERSE_ZERO) +apply (rule_tac c1 = "hcmod x" in hypreal_mult_left_cancel [THEN iffD1]) +apply (auto simp add: hcmod_mult [symmetric]) +done + +lemma hcmod_divide: + "hcmod(x/y) = hcmod(x)/(hcmod y)" +apply (unfold hcomplex_divide_def hypreal_divide_def) +apply (auto simp add: hcmod_mult hcmod_hcomplex_inverse) +done + +lemma hcomplex_inverse_divide: + "inverse(x/y) = y/(x::hcomplex)" +apply (unfold hcomplex_divide_def) +apply (auto simp add: hcomplex_inverse_distrib hcomplex_mult_commute) +done +declare hcomplex_inverse_divide [simp] + +lemma hcomplexpow_mult: "((r::hcomplex) * s) ^ n = (r ^ n) * (s ^ n)" +apply (induct_tac "n") +apply (auto simp add: hcomplex_mult_ac) +done + +lemma hcpow_mult: "((r::hcomplex) * s) hcpow n = (r hcpow n) * (s hcpow n)" +apply (rule_tac z = "r" in eq_Abs_hcomplex) +apply (rule_tac z = "s" in eq_Abs_hcomplex) +apply (rule_tac z = "n" in eq_Abs_hypnat) +apply (auto simp add: hcpow hypreal_mult hcomplex_mult complexpow_mult) +done + +lemma hcomplexpow_zero: "(0::hcomplex) ^ (Suc n) = 0" +apply auto +done +declare hcomplexpow_zero [simp] + +lemma hcpow_zero: + "0 hcpow (n + 1) = 0" +apply (unfold hcomplex_zero_def hypnat_one_def) +apply (rule_tac z = "n" in eq_Abs_hypnat) +apply (auto simp add: hcpow hypnat_add) +done +declare hcpow_zero [simp] + +lemma hcpow_zero2: + "0 hcpow (hSuc n) = 0" +apply (unfold hSuc_def) +apply (simp (no_asm)) +done +declare hcpow_zero2 [simp] + +lemma hcomplexpow_not_zero [rule_format (no_asm)]: "r ~= (0::hcomplex) --> r ^ n ~= 0" +apply (induct_tac "n") +apply (auto simp add: hcomplex_mult_not_zero) +done +declare hcomplexpow_not_zero [simp] +declare hcomplexpow_not_zero [intro] + +lemma hcpow_not_zero: "r ~= 0 ==> r hcpow n ~= (0::hcomplex)" +apply (rule_tac z = "r" in eq_Abs_hcomplex) +apply (rule_tac z = "n" in eq_Abs_hypnat) +apply (auto simp add: hcpow hcomplex_zero_def) +apply ultra +apply (auto dest: complexpow_zero_zero) +done +declare hcpow_not_zero [simp] +declare hcpow_not_zero [intro] + +lemma hcomplexpow_zero_zero: "r ^ n = (0::hcomplex) ==> r = 0" +apply (blast intro: ccontr dest: hcomplexpow_not_zero) +done + +lemma hcpow_zero_zero: "r hcpow n = (0::hcomplex) ==> r = 0" +apply (blast intro: ccontr dest: hcpow_not_zero) +done + +lemma hcomplex_i_mult_eq: "iii * iii = - 1" +apply (unfold iii_def) +apply (auto simp add: hcomplex_mult hcomplex_one_def hcomplex_minus) +done +declare hcomplex_i_mult_eq [simp] + +lemma hcomplexpow_i_squared: "iii ^ 2 = - 1" +apply (simp (no_asm) add: two_eq_Suc_Suc) +done +declare hcomplexpow_i_squared [simp] + +lemma hcomplex_i_not_zero: "iii ~= 0" +apply (unfold iii_def hcomplex_zero_def) +apply auto +done +declare hcomplex_i_not_zero [simp] + +lemma hcomplex_mult_eq_zero_cancel1: "x * y ~= (0::hcomplex) ==> x ~= 0" +apply auto +done + +lemma hcomplex_mult_eq_zero_cancel2: "x * y ~= (0::hcomplex) ==> y ~= 0" +apply auto +done + +lemma hcomplex_mult_not_eq_zero_iff: "(x * y ~= (0::hcomplex)) = (x ~= 0 & y ~= 0)" +apply auto +done +declare hcomplex_mult_not_eq_zero_iff [iff] + +lemma hcomplex_divide: + "Abs_hcomplex(hcomplexrel``{%n. X n}) / Abs_hcomplex(hcomplexrel``{%n. Y n}) = + Abs_hcomplex(hcomplexrel``{%n. X n / Y n})" +apply (unfold hcomplex_divide_def complex_divide_def) +apply (auto simp add: hcomplex_inverse hcomplex_mult) +done + + +subsection{*The Function @{term hsgn}*} + +lemma hsgn: + "hsgn (Abs_hcomplex(hcomplexrel `` {%n. X n})) = + Abs_hcomplex(hcomplexrel `` {%n. sgn (X n)})" +apply (unfold hsgn_def) +apply (rule_tac f = "Abs_hcomplex" in arg_cong) +apply (auto , ultra) +done + +lemma hsgn_zero: "hsgn 0 = 0" +apply (unfold hcomplex_zero_def) +apply (simp (no_asm) add: hsgn) +done +declare hsgn_zero [simp] + + +lemma hsgn_one: "hsgn 1 = 1" +apply (unfold hcomplex_one_def) +apply (simp (no_asm) add: hsgn) +done +declare hsgn_one [simp] + +lemma hsgn_minus: "hsgn (-z) = - hsgn(z)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hsgn hcomplex_minus sgn_minus) +done + +lemma hsgn_eq: "hsgn z = z / hcomplex_of_hypreal (hcmod z)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hsgn hcomplex_divide hcomplex_of_hypreal hcmod sgn_eq) +done + +lemma lemma_hypreal_P_EX2: "(EX (x::hypreal) y. P x y) = + (EX f g. P (Abs_hypreal(hyprel `` {f})) (Abs_hypreal(hyprel `` {g})))" +apply auto +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply auto +done + +lemma complex_split2: "ALL (n::nat). EX x y. (z n) = complex_of_real(x) + ii * complex_of_real(y)" +apply (blast intro: complex_split) +done + +(* Interesting proof! *) +lemma hcomplex_split: "EX x y. z = hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: lemma_hypreal_P_EX2 hcomplex_of_hypreal iii_def hcomplex_add hcomplex_mult) +apply (cut_tac z = "x" in complex_split2) +apply (drule choice , safe)+ +apply (rule_tac x = "f" in exI) +apply (rule_tac x = "fa" in exI) +apply auto +done + +lemma hRe_hcomplex_i: "hRe(hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)) = x" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hRe iii_def hcomplex_add hcomplex_mult hcomplex_of_hypreal) +done +declare hRe_hcomplex_i [simp] + +lemma hIm_hcomplex_i: "hIm(hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)) = y" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hIm iii_def hcomplex_add hcomplex_mult hcomplex_of_hypreal) +done +declare hIm_hcomplex_i [simp] + +lemma hcmod_i: "hcmod (hcomplex_of_hypreal(x) + iii * hcomplex_of_hypreal(y)) = + ( *f* sqrt) (x ^ 2 + y ^ 2)" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal iii_def hcomplex_add hcomplex_mult starfun hypreal_mult hypreal_add hcmod cmod_i two_eq_Suc_Suc) +done + +lemma hcomplex_eq_hRe_eq: + "hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya = + hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb + ==> xa = xb" +apply (unfold iii_def) +apply (rule_tac z = "xa" in eq_Abs_hypreal) +apply (rule_tac z = "ya" in eq_Abs_hypreal) +apply (rule_tac z = "xb" in eq_Abs_hypreal) +apply (rule_tac z = "yb" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_mult hcomplex_add hcomplex_of_hypreal) +apply (ultra) +done + +lemma hcomplex_eq_hIm_eq: + "hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya = + hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb + ==> ya = yb" +apply (unfold iii_def) +apply (rule_tac z = "xa" in eq_Abs_hypreal) +apply (rule_tac z = "ya" in eq_Abs_hypreal) +apply (rule_tac z = "xb" in eq_Abs_hypreal) +apply (rule_tac z = "yb" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_mult hcomplex_add hcomplex_of_hypreal) +apply (ultra) +done + +lemma hcomplex_eq_cancel_iff: "(hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya = + hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb) = + ((xa = xb) & (ya = yb))" +apply (auto intro: hcomplex_eq_hIm_eq hcomplex_eq_hRe_eq) +done +declare hcomplex_eq_cancel_iff [simp] + +lemma hcomplex_eq_cancel_iffA: "(hcomplex_of_hypreal xa + hcomplex_of_hypreal ya * iii = + hcomplex_of_hypreal xb + hcomplex_of_hypreal yb * iii ) = ((xa = xb) & (ya = yb))" +apply (auto simp add: hcomplex_mult_commute) +done +declare hcomplex_eq_cancel_iffA [iff] + +lemma hcomplex_eq_cancel_iffB: "(hcomplex_of_hypreal xa + hcomplex_of_hypreal ya * iii = + hcomplex_of_hypreal xb + iii * hcomplex_of_hypreal yb) = ((xa = xb) & (ya = yb))" +apply (auto simp add: hcomplex_mult_commute) +done +declare hcomplex_eq_cancel_iffB [iff] + +lemma hcomplex_eq_cancel_iffC: "(hcomplex_of_hypreal xa + iii * hcomplex_of_hypreal ya = + hcomplex_of_hypreal xb + hcomplex_of_hypreal yb * iii) = ((xa = xb) & (ya = yb))" +apply (auto simp add: hcomplex_mult_commute) +done +declare hcomplex_eq_cancel_iffC [iff] + +lemma hcomplex_eq_cancel_iff2: "(hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y = + hcomplex_of_hypreal xa) = (x = xa & y = 0)" +apply (cut_tac xa = "x" and ya = "y" and xb = "xa" and yb = "0" in hcomplex_eq_cancel_iff) +apply (simp del: hcomplex_eq_cancel_iff) +done +declare hcomplex_eq_cancel_iff2 [simp] + +lemma hcomplex_eq_cancel_iff2a: "(hcomplex_of_hypreal x + hcomplex_of_hypreal y * iii = + hcomplex_of_hypreal xa) = (x = xa & y = 0)" +apply (auto simp add: hcomplex_mult_commute) +done +declare hcomplex_eq_cancel_iff2a [simp] + +lemma hcomplex_eq_cancel_iff3: "(hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y = + iii * hcomplex_of_hypreal ya) = (x = 0 & y = ya)" +apply (cut_tac xa = "x" and ya = "y" and xb = "0" and yb = "ya" in hcomplex_eq_cancel_iff) +apply (simp del: hcomplex_eq_cancel_iff) +done +declare hcomplex_eq_cancel_iff3 [simp] + +lemma hcomplex_eq_cancel_iff3a: "(hcomplex_of_hypreal x + hcomplex_of_hypreal y * iii = + iii * hcomplex_of_hypreal ya) = (x = 0 & y = ya)" +apply (auto simp add: hcomplex_mult_commute) +done +declare hcomplex_eq_cancel_iff3a [simp] + +lemma hcomplex_split_hRe_zero: + "hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y = 0 + ==> x = 0" +apply (unfold iii_def) +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hcomplex_add hcomplex_mult hcomplex_zero_def hypreal_zero_num) +apply ultra +apply (auto simp add: complex_split_Re_zero) +done + +lemma hcomplex_split_hIm_zero: + "hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y = 0 + ==> y = 0" +apply (unfold iii_def) +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hcomplex_add hcomplex_mult hcomplex_zero_def hypreal_zero_num) +apply ultra +apply (auto simp add: complex_split_Im_zero) +done + +lemma hRe_hsgn: "hRe(hsgn z) = hRe(z)/hcmod z" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hsgn hcmod hRe hypreal_divide) +done +declare hRe_hsgn [simp] + +lemma hIm_hsgn: "hIm(hsgn z) = hIm(z)/hcmod z" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: hsgn hcmod hIm hypreal_divide) +done +declare hIm_hsgn [simp] + +lemma real_two_squares_add_zero_iff: "(x*x + y*y = 0) = ((x::real) = 0 & y = 0)" +apply (auto intro: real_sum_squares_cancel) +done +declare real_two_squares_add_zero_iff [simp] + +lemma hcomplex_inverse_complex_split: "inverse(hcomplex_of_hypreal x + iii * hcomplex_of_hypreal y) = + hcomplex_of_hypreal(x/(x ^ 2 + y ^ 2)) - + iii * hcomplex_of_hypreal(y/(x ^ 2 + y ^ 2))" +apply (rule_tac z = "x" in eq_Abs_hypreal) +apply (rule_tac z = "y" in eq_Abs_hypreal) +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 two_eq_Suc_Suc) +done + +lemma hRe_mult_i_eq: + "hRe (iii * hcomplex_of_hypreal y) = 0" +apply (unfold iii_def) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hcomplex_mult hRe hypreal_zero_num) +done +declare hRe_mult_i_eq [simp] + +lemma hIm_mult_i_eq: + "hIm (iii * hcomplex_of_hypreal y) = y" +apply (unfold iii_def) +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hcomplex_mult hIm hypreal_zero_num) +done +declare hIm_mult_i_eq [simp] + +lemma hcmod_mult_i: "hcmod (iii * hcomplex_of_hypreal y) = abs y" +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hcmod hypreal_hrabs iii_def hcomplex_mult) +done +declare hcmod_mult_i [simp] + +lemma hcmod_mult_i2: "hcmod (hcomplex_of_hypreal y * iii) = abs y" +apply (auto simp add: hcomplex_mult_commute) +done +declare hcmod_mult_i2 [simp] + +(*---------------------------------------------------------------------------*) +(* harg *) +(*---------------------------------------------------------------------------*) + +lemma harg: + "harg (Abs_hcomplex(hcomplexrel `` {%n. X n})) = + Abs_hypreal(hyprel `` {%n. arg (X n)})" + +apply (unfold harg_def) +apply (rule_tac f = "Abs_hypreal" in arg_cong) +apply (auto , ultra) +done + +lemma cos_harg_i_mult_zero: "0 < y ==> ( *f* cos) (harg(iii * hcomplex_of_hypreal y)) = 0" +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal iii_def hcomplex_mult hypreal_zero_num hypreal_less starfun harg) +apply (ultra) +done +declare cos_harg_i_mult_zero [simp] + +lemma cos_harg_i_mult_zero2: "y < 0 ==> ( *f* cos) (harg(iii * hcomplex_of_hypreal y)) = 0" +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal iii_def hcomplex_mult hypreal_zero_num hypreal_less starfun harg) +apply (ultra) +done +declare cos_harg_i_mult_zero2 [simp] + +lemma hcomplex_of_hypreal_not_zero_iff: "(hcomplex_of_hypreal y ~= 0) = (y ~= 0)" +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hypreal_zero_num hcomplex_zero_def) +done +declare hcomplex_of_hypreal_not_zero_iff [simp] + +lemma hcomplex_of_hypreal_zero_iff: "(hcomplex_of_hypreal y = 0) = (y = 0)" +apply (rule_tac z = "y" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_of_hypreal hypreal_zero_num hcomplex_zero_def) +done +declare hcomplex_of_hypreal_zero_iff [simp] + +lemma cos_harg_i_mult_zero3: "y ~= 0 ==> ( *f* cos) (harg(iii * hcomplex_of_hypreal y)) = 0" +apply (cut_tac x = "y" and y = "0" in hypreal_linear) +apply auto +done +declare cos_harg_i_mult_zero3 [simp] + +(*---------------------------------------------------------------------------*) +(* Polar form for nonstandard complex numbers *) +(*---------------------------------------------------------------------------*) + +lemma complex_split_polar2: "ALL n. EX r a. (z n) = complex_of_real r * + (complex_of_real(cos a) + ii * complex_of_real(sin a))" +apply (blast intro: complex_split_polar) +done + +lemma hcomplex_split_polar: + "EX r a. z = hcomplex_of_hypreal r * + (hcomplex_of_hypreal(( *f* cos) a) + iii * hcomplex_of_hypreal(( *f* sin) a))" +apply (rule_tac z = "z" in eq_Abs_hcomplex) +apply (auto simp add: lemma_hypreal_P_EX2 hcomplex_of_hypreal iii_def starfun hcomplex_add hcomplex_mult) +apply (cut_tac z = "x" in complex_split_polar2) +apply (drule choice , safe)+ +apply (rule_tac x = "f" in exI) +apply (rule_tac x = "fa" in exI) +apply auto +done + +lemma hcis: + "hcis (Abs_hypreal(hyprel `` {%n. X n})) = + Abs_hcomplex(hcomplexrel `` {%n. cis (X n)})" +apply (unfold hcis_def) +apply (rule_tac f = "Abs_hcomplex" in arg_cong) +apply auto +apply (ultra) +done + +lemma hcis_eq: + "hcis a = + (hcomplex_of_hypreal(( *f* cos) a) + + iii * hcomplex_of_hypreal(( *f* sin) a))" +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (auto simp add: starfun hcis hcomplex_of_hypreal iii_def hcomplex_mult hcomplex_add cis_def) +done + +lemma hrcis: + "hrcis (Abs_hypreal(hyprel `` {%n. X n})) (Abs_hypreal(hyprel `` {%n. Y n})) = + Abs_hcomplex(hcomplexrel `` {%n. rcis (X n) (Y n)})" +apply (unfold hrcis_def) +apply (auto simp add: hcomplex_of_hypreal hcomplex_mult hcis rcis_def) +done + +lemma hrcis_Ex: "EX r a. z = hrcis r a" +apply (simp (no_asm) add: hrcis_def hcis_eq) +apply (rule hcomplex_split_polar) +done + +lemma hRe_hcomplex_polar: "hRe(hcomplex_of_hypreal r * + (hcomplex_of_hypreal(( *f* cos) a) + + iii * hcomplex_of_hypreal(( *f* sin) a))) = r * ( *f* cos) a" +apply (auto simp add: hcomplex_add_mult_distrib2 hcomplex_of_hypreal_mult hcomplex_mult_ac) +done +declare hRe_hcomplex_polar [simp] + +lemma hRe_hrcis: "hRe(hrcis r a) = r * ( *f* cos) a" +apply (unfold hrcis_def) +apply (auto simp add: hcis_eq) +done +declare hRe_hrcis [simp] + +lemma hIm_hcomplex_polar: "hIm(hcomplex_of_hypreal r * + (hcomplex_of_hypreal(( *f* cos) a) + + iii * hcomplex_of_hypreal(( *f* sin) a))) = r * ( *f* sin) a" +apply (auto simp add: hcomplex_add_mult_distrib2 hcomplex_of_hypreal_mult hcomplex_mult_ac) +done +declare hIm_hcomplex_polar [simp] + +lemma hIm_hrcis: "hIm(hrcis r a) = r * ( *f* sin) a" +apply (unfold hrcis_def) +apply (auto simp add: hcis_eq) +done +declare hIm_hrcis [simp] + +lemma hcmod_complex_polar: "hcmod (hcomplex_of_hypreal r * + (hcomplex_of_hypreal(( *f* cos) a) + + iii * hcomplex_of_hypreal(( *f* sin) a))) = abs r" +apply (rule_tac z = "r" in eq_Abs_hypreal) +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (auto simp add: iii_def starfun hcomplex_of_hypreal hcomplex_mult hcmod hcomplex_add hypreal_hrabs) +done +declare hcmod_complex_polar [simp] + +lemma hcmod_hrcis: "hcmod(hrcis r a) = abs r" +apply (unfold hrcis_def) +apply (auto simp add: hcis_eq) +done +declare hcmod_hrcis [simp] + +(*---------------------------------------------------------------------------*) +(* (r1 * hrcis a) * (r2 * hrcis b) = r1 * r2 * hrcis (a + b) *) +(*---------------------------------------------------------------------------*) + +lemma hcis_hrcis_eq: "hcis a = hrcis 1 a" + +apply (unfold hrcis_def) +apply (simp (no_asm)) +done +declare hcis_hrcis_eq [symmetric, simp] + +lemma hrcis_mult: + "hrcis r1 a * hrcis r2 b = hrcis (r1*r2) (a + b)" +apply (unfold hrcis_def) +apply (rule_tac z = "r1" in eq_Abs_hypreal) +apply (rule_tac z = "r2" in eq_Abs_hypreal) +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (rule_tac z = "b" in eq_Abs_hypreal) +apply (auto simp add: hrcis hcis hypreal_add hypreal_mult hcomplex_of_hypreal + hcomplex_mult cis_mult [symmetric] + complex_of_real_mult [symmetric]) +done + +lemma hcis_mult: "hcis a * hcis b = hcis (a + b)" +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (rule_tac z = "b" in eq_Abs_hypreal) +apply (auto simp add: hcis hcomplex_mult hypreal_add cis_mult) +done + +lemma hcis_zero: + "hcis 0 = 1" +apply (unfold hcomplex_one_def) +apply (auto simp add: hcis hypreal_zero_num) +done +declare hcis_zero [simp] + +lemma hrcis_zero_mod: + "hrcis 0 a = 0" +apply (unfold hcomplex_zero_def) +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (auto simp add: hrcis hypreal_zero_num) +done +declare hrcis_zero_mod [simp] + +lemma hrcis_zero_arg: "hrcis r 0 = hcomplex_of_hypreal r" +apply (rule_tac z = "r" in eq_Abs_hypreal) +apply (auto simp add: hrcis hypreal_zero_num hcomplex_of_hypreal) +done +declare hrcis_zero_arg [simp] + +lemma hcomplex_i_mult_minus: "iii * (iii * x) = - x" +apply (simp (no_asm) add: hcomplex_mult_assoc [symmetric]) +done +declare hcomplex_i_mult_minus [simp] + +lemma hcomplex_i_mult_minus2: "iii * iii * x = - x" +apply (simp (no_asm)) +done +declare hcomplex_i_mult_minus2 [simp] + +(* Move to one of the hyperreal theories *) +lemma hypreal_of_nat: "hypreal_of_nat m = Abs_hypreal(hyprel `` {%n. real m})" +apply (induct_tac "m") +apply (auto simp add: hypreal_zero_def hypreal_of_nat_Suc hypreal_zero_num hypreal_one_num hypreal_add real_of_nat_Suc) +done + +lemma hcis_hypreal_of_nat_Suc_mult: + "hcis (hypreal_of_nat (Suc n) * a) = hcis a * hcis (hypreal_of_nat n * a)" +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (auto simp add: hypreal_of_nat hcis hypreal_mult hcomplex_mult cis_real_of_nat_Suc_mult) +done + +lemma NSDeMoivre: "(hcis a) ^ n = hcis (hypreal_of_nat n * a)" +apply (induct_tac "n") +apply (auto simp add: hcis_hypreal_of_nat_Suc_mult) +done + +lemma hcis_hypreal_of_hypnat_Suc_mult: "hcis (hypreal_of_hypnat (n + 1) * a) = + hcis a * hcis (hypreal_of_hypnat n * a)" +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (rule_tac z = "n" in eq_Abs_hypnat) +apply (auto simp add: hcis hypreal_of_hypnat hypnat_add hypnat_one_def hypreal_mult hcomplex_mult cis_real_of_nat_Suc_mult) +done + +lemma NSDeMoivre_ext: "(hcis a) hcpow n = hcis (hypreal_of_hypnat n * a)" +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (rule_tac z = "n" in eq_Abs_hypnat) +apply (auto simp add: hcis hypreal_of_hypnat hypreal_mult hcpow DeMoivre) +done + +lemma DeMoivre2: + "(hrcis r a) ^ n = hrcis (r ^ n) (hypreal_of_nat n * a)" +apply (unfold hrcis_def) +apply (auto simp add: hcomplexpow_mult NSDeMoivre hcomplex_of_hypreal_pow) +done + +lemma DeMoivre2_ext: + "(hrcis r a) hcpow n = hrcis (r pow n) (hypreal_of_hypnat n * a)" +apply (unfold hrcis_def) +apply (auto simp add: hcpow_mult NSDeMoivre_ext hcomplex_of_hypreal_hyperpow) +done + +lemma hcis_inverse: "inverse(hcis a) = hcis (-a)" +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_inverse hcis hypreal_minus) +done +declare hcis_inverse [simp] + +lemma hrcis_inverse: "inverse(hrcis r a) = hrcis (inverse r) (-a)" +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (rule_tac z = "r" in eq_Abs_hypreal) +apply (auto simp add: hcomplex_inverse hrcis hypreal_minus hypreal_inverse rcis_inverse) +apply (ultra) +apply (unfold real_divide_def) +apply (auto simp add: INVERSE_ZERO) +done + +lemma hRe_hcis: "hRe(hcis a) = ( *f* cos) a" +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (auto simp add: hcis starfun hRe) +done +declare hRe_hcis [simp] + +lemma hIm_hcis: "hIm(hcis a) = ( *f* sin) a" +apply (rule_tac z = "a" in eq_Abs_hypreal) +apply (auto simp add: hcis starfun hIm) +done +declare hIm_hcis [simp] + +lemma cos_n_hRe_hcis_pow_n: "( *f* cos) (hypreal_of_nat n * a) = hRe(hcis a ^ n)" +apply (auto simp add: NSDeMoivre) +done + +lemma sin_n_hIm_hcis_pow_n: "( *f* sin) (hypreal_of_nat n * a) = hIm(hcis a ^ n)" +apply (auto simp add: NSDeMoivre) +done + +lemma cos_n_hRe_hcis_hcpow_n: "( *f* cos) (hypreal_of_hypnat n * a) = hRe(hcis a hcpow n)" +apply (auto simp add: NSDeMoivre_ext) +done + +lemma sin_n_hIm_hcis_hcpow_n: "( *f* sin) (hypreal_of_hypnat n * a) = hIm(hcis a hcpow n)" +apply (auto simp add: NSDeMoivre_ext) +done + +lemma hexpi_add: "hexpi(a + b) = hexpi(a) * hexpi(b)" +apply (unfold hexpi_def) +apply (rule_tac z = "a" in eq_Abs_hcomplex) +apply (rule_tac z = "b" in eq_Abs_hcomplex) +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) +done + + +subsection{*@{term hcomplex_of_complex} Preserves Field Properties*} + +lemma hcomplex_of_complex_add: + "hcomplex_of_complex (z1 + z2) = hcomplex_of_complex z1 + hcomplex_of_complex z2" +apply (unfold hcomplex_of_complex_def) +apply (simp (no_asm) add: hcomplex_add) +done +declare hcomplex_of_complex_add [simp] + +lemma hcomplex_of_complex_mult: + "hcomplex_of_complex (z1 * z2) = hcomplex_of_complex z1 * hcomplex_of_complex z2" +apply (unfold hcomplex_of_complex_def) +apply (simp (no_asm) add: hcomplex_mult) +done +declare hcomplex_of_complex_mult [simp] + +lemma hcomplex_of_complex_eq_iff: + "(hcomplex_of_complex z1 = hcomplex_of_complex z2) = (z1 = z2)" +apply (unfold hcomplex_of_complex_def) +apply auto +done +declare hcomplex_of_complex_eq_iff [simp] + +lemma hcomplex_of_complex_minus: "hcomplex_of_complex (-r) = - hcomplex_of_complex r" +apply (unfold hcomplex_of_complex_def) +apply (auto simp add: hcomplex_minus) +done +declare hcomplex_of_complex_minus [simp] + +lemma hcomplex_of_complex_one: + "hcomplex_of_complex 1 = 1" +apply (unfold hcomplex_of_complex_def hcomplex_one_def) +apply auto +done + +lemma hcomplex_of_complex_zero: + "hcomplex_of_complex 0 = 0" +apply (unfold hcomplex_of_complex_def hcomplex_zero_def) +apply (simp (no_asm)) +done + +lemma hcomplex_of_complex_zero_iff: "(hcomplex_of_complex r = 0) = (r = 0)" +apply (auto intro: FreeUltrafilterNat_P simp add: hcomplex_of_complex_def hcomplex_zero_def) +done + +lemma hcomplex_of_complex_inverse: "hcomplex_of_complex (inverse r) = inverse (hcomplex_of_complex r)" +apply (case_tac "r=0") +apply (simp (no_asm_simp) add: COMPLEX_INVERSE_ZERO HCOMPLEX_INVERSE_ZERO hcomplex_of_complex_zero COMPLEX_DIVIDE_ZERO) +apply (rule_tac c1 = "hcomplex_of_complex r" in hcomplex_mult_left_cancel [THEN iffD1]) +apply (force simp add: hcomplex_of_complex_zero_iff) +apply (subst hcomplex_of_complex_mult [symmetric]) +apply (auto simp add: hcomplex_of_complex_one hcomplex_of_complex_zero_iff); +done +declare hcomplex_of_complex_inverse [simp] + +lemma hcomplex_of_complex_divide: "hcomplex_of_complex (z1 / z2) = hcomplex_of_complex z1 / hcomplex_of_complex z2" +apply (simp (no_asm) add: hcomplex_divide_def complex_divide_def) +done +declare hcomplex_of_complex_divide [simp] + +lemma hRe_hcomplex_of_complex: + "hRe (hcomplex_of_complex z) = hypreal_of_real (Re z)" +apply (unfold hcomplex_of_complex_def hypreal_of_real_def) +apply (auto simp add: hRe) +done + +lemma hIm_hcomplex_of_complex: + "hIm (hcomplex_of_complex z) = hypreal_of_real (Im z)" +apply (unfold hcomplex_of_complex_def hypreal_of_real_def) +apply (auto simp add: hIm) +done + +lemma hcmod_hcomplex_of_complex: + "hcmod (hcomplex_of_complex x) = hypreal_of_real (cmod x)" +apply (unfold hypreal_of_real_def hcomplex_of_complex_def) +apply (auto simp add: hcmod) +done + +ML +{* +val hcomplex_zero_def = thm"hcomplex_zero_def"; +val hcomplex_one_def = thm"hcomplex_one_def"; +val hcomplex_minus_def = thm"hcomplex_minus_def"; +val hcomplex_diff_def = thm"hcomplex_diff_def"; +val hcomplex_divide_def = thm"hcomplex_divide_def"; +val hcomplex_mult_def = thm"hcomplex_mult_def"; +val hcomplex_add_def = thm"hcomplex_add_def"; +val hcomplex_of_complex_def = thm"hcomplex_of_complex_def"; +val iii_def = thm"iii_def"; + +val hcomplexrel_iff = thm"hcomplexrel_iff"; +val hcomplexrel_refl = thm"hcomplexrel_refl"; +val hcomplexrel_sym = thm"hcomplexrel_sym"; +val hcomplexrel_trans = thm"hcomplexrel_trans"; +val equiv_hcomplexrel = thm"equiv_hcomplexrel"; +val equiv_hcomplexrel_iff = thm"equiv_hcomplexrel_iff"; +val hcomplexrel_in_hcomplex = thm"hcomplexrel_in_hcomplex"; +val inj_on_Abs_hcomplex = thm"inj_on_Abs_hcomplex"; +val inj_Rep_hcomplex = thm"inj_Rep_hcomplex"; +val lemma_hcomplexrel_refl = thm"lemma_hcomplexrel_refl"; +val hcomplex_empty_not_mem = thm"hcomplex_empty_not_mem"; +val Rep_hcomplex_nonempty = thm"Rep_hcomplex_nonempty"; +val eq_Abs_hcomplex = thm"eq_Abs_hcomplex"; +val hRe = thm"hRe"; +val hIm = thm"hIm"; +val hcomplex_hRe_hIm_cancel_iff = thm"hcomplex_hRe_hIm_cancel_iff"; +val hcomplex_hRe_zero = thm"hcomplex_hRe_zero"; +val hcomplex_hIm_zero = thm"hcomplex_hIm_zero"; +val hcomplex_hRe_one = thm"hcomplex_hRe_one"; +val hcomplex_hIm_one = thm"hcomplex_hIm_one"; +val inj_hcomplex_of_complex = thm"inj_hcomplex_of_complex"; +val hcomplex_of_complex_i = thm"hcomplex_of_complex_i"; +val hcomplex_add_congruent2 = thm"hcomplex_add_congruent2"; +val hcomplex_add = thm"hcomplex_add"; +val hcomplex_add_commute = thm"hcomplex_add_commute"; +val hcomplex_add_assoc = thm"hcomplex_add_assoc"; +val hcomplex_add_left_commute = thm"hcomplex_add_left_commute"; +val hcomplex_add_zero_left = thm"hcomplex_add_zero_left"; +val hcomplex_add_zero_right = thm"hcomplex_add_zero_right"; +val hRe_add = thm"hRe_add"; +val hIm_add = thm"hIm_add"; +val hcomplex_minus_congruent = thm"hcomplex_minus_congruent"; +val hcomplex_minus = thm"hcomplex_minus"; +val hcomplex_minus_minus = thm"hcomplex_minus_minus"; +val inj_hcomplex_minus = thm"inj_hcomplex_minus"; +val hcomplex_minus_zero = thm"hcomplex_minus_zero"; +val hcomplex_minus_zero_iff = thm"hcomplex_minus_zero_iff"; +val hcomplex_minus_zero_iff2 = thm"hcomplex_minus_zero_iff2"; +val hcomplex_minus_not_zero_iff = thm"hcomplex_minus_not_zero_iff"; +val hcomplex_add_minus_right = thm"hcomplex_add_minus_right"; +val hcomplex_add_minus_left = thm"hcomplex_add_minus_left"; +val hcomplex_add_minus_cancel = thm"hcomplex_add_minus_cancel"; +val hcomplex_minus_add_cancel = thm"hcomplex_minus_add_cancel"; +val hRe_minus = thm"hRe_minus"; +val hIm_minus = thm"hIm_minus"; +val hcomplex_add_minus_eq_minus = thm"hcomplex_add_minus_eq_minus"; +val hcomplex_minus_add_distrib = thm"hcomplex_minus_add_distrib"; +val hcomplex_add_left_cancel = thm"hcomplex_add_left_cancel"; +val hcomplex_add_right_cancel = thm"hcomplex_add_right_cancel"; +val hcomplex_eq_minus_iff = thm"hcomplex_eq_minus_iff"; +val hcomplex_eq_minus_iff2 = thm"hcomplex_eq_minus_iff2"; +val hcomplex_diff = thm"hcomplex_diff"; +val hcomplex_diff_zero = thm"hcomplex_diff_zero"; +val hcomplex_diff_0 = thm"hcomplex_diff_0"; +val hcomplex_diff_0_right = thm"hcomplex_diff_0_right"; +val hcomplex_diff_self = thm"hcomplex_diff_self"; +val hcomplex_diff_eq_eq = thm"hcomplex_diff_eq_eq"; +val hcomplex_mult = thm"hcomplex_mult"; +val hcomplex_mult_commute = thm"hcomplex_mult_commute"; +val hcomplex_mult_assoc = thm"hcomplex_mult_assoc"; +val hcomplex_mult_left_commute = thm"hcomplex_mult_left_commute"; +val hcomplex_mult_one_left = thm"hcomplex_mult_one_left"; +val hcomplex_mult_one_right = thm"hcomplex_mult_one_right"; +val hcomplex_mult_zero_left = thm"hcomplex_mult_zero_left"; +val hcomplex_mult_zero_right = thm"hcomplex_mult_zero_right"; +val hcomplex_minus_mult_eq1 = thm"hcomplex_minus_mult_eq1"; +val hcomplex_minus_mult_eq2 = thm"hcomplex_minus_mult_eq2"; +val hcomplex_mult_minus_one = thm"hcomplex_mult_minus_one"; +val hcomplex_mult_minus_one_right = thm"hcomplex_mult_minus_one_right"; +val hcomplex_minus_mult_cancel = thm"hcomplex_minus_mult_cancel"; +val hcomplex_minus_mult_commute = thm"hcomplex_minus_mult_commute"; +val hcomplex_add_mult_distrib = thm"hcomplex_add_mult_distrib"; +val hcomplex_add_mult_distrib2 = thm"hcomplex_add_mult_distrib2"; +val hcomplex_zero_not_eq_one = thm"hcomplex_zero_not_eq_one"; +val hcomplex_inverse = thm"hcomplex_inverse"; +val HCOMPLEX_INVERSE_ZERO = thm"HCOMPLEX_INVERSE_ZERO"; +val HCOMPLEX_DIVISION_BY_ZERO = thm"HCOMPLEX_DIVISION_BY_ZERO"; +val hcomplex_mult_inv_left = thm"hcomplex_mult_inv_left"; +val hcomplex_mult_inv_right = thm"hcomplex_mult_inv_right"; +val hcomplex_mult_left_cancel = thm"hcomplex_mult_left_cancel"; +val hcomplex_mult_right_cancel = thm"hcomplex_mult_right_cancel"; +val hcomplex_inverse_not_zero = thm"hcomplex_inverse_not_zero"; +val hcomplex_mult_not_zero = thm"hcomplex_mult_not_zero"; +val hcomplex_mult_not_zeroE = thm"hcomplex_mult_not_zeroE"; +val hcomplex_inverse_inverse = thm"hcomplex_inverse_inverse"; +val hcomplex_inverse_one = thm"hcomplex_inverse_one"; +val hcomplex_minus_inverse = thm"hcomplex_minus_inverse"; +val hcomplex_inverse_distrib = thm"hcomplex_inverse_distrib"; +val hcomplex_times_divide1_eq = thm"hcomplex_times_divide1_eq"; +val hcomplex_times_divide2_eq = thm"hcomplex_times_divide2_eq"; +val hcomplex_divide_divide1_eq = thm"hcomplex_divide_divide1_eq"; +val hcomplex_divide_divide2_eq = thm"hcomplex_divide_divide2_eq"; +val hcomplex_minus_divide_eq = thm"hcomplex_minus_divide_eq"; +val hcomplex_divide_minus_eq = thm"hcomplex_divide_minus_eq"; +val hcomplex_add_divide_distrib = thm"hcomplex_add_divide_distrib"; +val hcomplex_of_hypreal = thm"hcomplex_of_hypreal"; +val inj_hcomplex_of_hypreal = thm"inj_hcomplex_of_hypreal"; +val hcomplex_of_hypreal_cancel_iff = thm"hcomplex_of_hypreal_cancel_iff"; +val hcomplex_of_hypreal_minus = thm"hcomplex_of_hypreal_minus"; +val hcomplex_of_hypreal_inverse = thm"hcomplex_of_hypreal_inverse"; +val hcomplex_of_hypreal_add = thm"hcomplex_of_hypreal_add"; +val hcomplex_of_hypreal_diff = thm"hcomplex_of_hypreal_diff"; +val hcomplex_of_hypreal_mult = thm"hcomplex_of_hypreal_mult"; +val hcomplex_of_hypreal_divide = thm"hcomplex_of_hypreal_divide"; +val hcomplex_of_hypreal_one = thm"hcomplex_of_hypreal_one"; +val hcomplex_of_hypreal_zero = thm"hcomplex_of_hypreal_zero"; +val hcomplex_of_hypreal_pow = thm"hcomplex_of_hypreal_pow"; +val hRe_hcomplex_of_hypreal = thm"hRe_hcomplex_of_hypreal"; +val hIm_hcomplex_of_hypreal = thm"hIm_hcomplex_of_hypreal"; +val hcomplex_of_hypreal_epsilon_not_zero = thm"hcomplex_of_hypreal_epsilon_not_zero"; +val hcmod = thm"hcmod"; +val hcmod_zero = thm"hcmod_zero"; +val hcmod_one = thm"hcmod_one"; +val hcmod_hcomplex_of_hypreal = thm"hcmod_hcomplex_of_hypreal"; +val hcomplex_of_hypreal_abs = thm"hcomplex_of_hypreal_abs"; +val hcnj = thm"hcnj"; +val inj_hcnj = thm"inj_hcnj"; +val hcomplex_hcnj_cancel_iff = thm"hcomplex_hcnj_cancel_iff"; +val hcomplex_hcnj_hcnj = thm"hcomplex_hcnj_hcnj"; +val hcomplex_hcnj_hcomplex_of_hypreal = thm"hcomplex_hcnj_hcomplex_of_hypreal"; +val hcomplex_hmod_hcnj = thm"hcomplex_hmod_hcnj"; +val hcomplex_hcnj_minus = thm"hcomplex_hcnj_minus"; +val hcomplex_hcnj_inverse = thm"hcomplex_hcnj_inverse"; +val hcomplex_hcnj_add = thm"hcomplex_hcnj_add"; +val hcomplex_hcnj_diff = thm"hcomplex_hcnj_diff"; +val hcomplex_hcnj_mult = thm"hcomplex_hcnj_mult"; +val hcomplex_hcnj_divide = thm"hcomplex_hcnj_divide"; +val hcnj_one = thm"hcnj_one"; +val hcomplex_hcnj_pow = thm"hcomplex_hcnj_pow"; +val hcomplex_hcnj_zero = thm"hcomplex_hcnj_zero"; +val hcomplex_hcnj_zero_iff = thm"hcomplex_hcnj_zero_iff"; +val hcomplex_mult_hcnj = thm"hcomplex_mult_hcnj"; +val hcomplex_mult_zero_iff = thm"hcomplex_mult_zero_iff"; +val hcomplex_add_left_cancel_zero = thm"hcomplex_add_left_cancel_zero"; +val hcomplex_diff_mult_distrib = thm"hcomplex_diff_mult_distrib"; +val hcomplex_diff_mult_distrib2 = thm"hcomplex_diff_mult_distrib2"; +val hcomplex_hcmod_eq_zero_cancel = thm"hcomplex_hcmod_eq_zero_cancel"; +val hypreal_of_nat_le_iff = thm"hypreal_of_nat_le_iff"; +val hypreal_of_nat_ge_zero = thm"hypreal_of_nat_ge_zero"; +val hypreal_of_hypnat_ge_zero = thm"hypreal_of_hypnat_ge_zero"; +val hcmod_hcomplex_of_hypreal_of_nat = thm"hcmod_hcomplex_of_hypreal_of_nat"; +val hcmod_hcomplex_of_hypreal_of_hypnat = thm"hcmod_hcomplex_of_hypreal_of_hypnat"; +val hcmod_minus = thm"hcmod_minus"; +val hcmod_mult_hcnj = thm"hcmod_mult_hcnj"; +val hcmod_ge_zero = thm"hcmod_ge_zero"; +val hrabs_hcmod_cancel = thm"hrabs_hcmod_cancel"; +val hcmod_mult = thm"hcmod_mult"; +val hcmod_add_squared_eq = thm"hcmod_add_squared_eq"; +val hcomplex_hRe_mult_hcnj_le_hcmod = thm"hcomplex_hRe_mult_hcnj_le_hcmod"; +val hcomplex_hRe_mult_hcnj_le_hcmod2 = thm"hcomplex_hRe_mult_hcnj_le_hcmod2"; +val hcmod_triangle_squared = thm"hcmod_triangle_squared"; +val hcmod_triangle_ineq = thm"hcmod_triangle_ineq"; +val hcmod_triangle_ineq2 = thm"hcmod_triangle_ineq2"; +val hcmod_diff_commute = thm"hcmod_diff_commute"; +val hcmod_add_less = thm"hcmod_add_less"; +val hcmod_mult_less = thm"hcmod_mult_less"; +val hcmod_diff_ineq = thm"hcmod_diff_ineq"; +val hcpow = thm"hcpow"; +val hcomplex_of_hypreal_hyperpow = thm"hcomplex_of_hypreal_hyperpow"; +val hcmod_hcomplexpow = thm"hcmod_hcomplexpow"; +val hcmod_hcpow = thm"hcmod_hcpow"; +val hcomplexpow_minus = thm"hcomplexpow_minus"; +val hcpow_minus = thm"hcpow_minus"; +val hccomplex_inverse_minus = thm"hccomplex_inverse_minus"; +val hcomplex_div_one = thm"hcomplex_div_one"; +val hcmod_hcomplex_inverse = thm"hcmod_hcomplex_inverse"; +val hcmod_divide = thm"hcmod_divide"; +val hcomplex_inverse_divide = thm"hcomplex_inverse_divide"; +val hcomplexpow_mult = thm"hcomplexpow_mult"; +val hcpow_mult = thm"hcpow_mult"; +val hcomplexpow_zero = thm"hcomplexpow_zero"; +val hcpow_zero = thm"hcpow_zero"; +val hcpow_zero2 = thm"hcpow_zero2"; +val hcomplexpow_not_zero = thm"hcomplexpow_not_zero"; +val hcpow_not_zero = thm"hcpow_not_zero"; +val hcomplexpow_zero_zero = thm"hcomplexpow_zero_zero"; +val hcpow_zero_zero = thm"hcpow_zero_zero"; +val hcomplex_i_mult_eq = thm"hcomplex_i_mult_eq"; +val hcomplexpow_i_squared = thm"hcomplexpow_i_squared"; +val hcomplex_i_not_zero = thm"hcomplex_i_not_zero"; +val hcomplex_mult_eq_zero_cancel1 = thm"hcomplex_mult_eq_zero_cancel1"; +val hcomplex_mult_eq_zero_cancel2 = thm"hcomplex_mult_eq_zero_cancel2"; +val hcomplex_mult_not_eq_zero_iff = thm"hcomplex_mult_not_eq_zero_iff"; +val hcomplex_divide = thm"hcomplex_divide"; +val hsgn = thm"hsgn"; +val hsgn_zero = thm"hsgn_zero"; +val hsgn_one = thm"hsgn_one"; +val hsgn_minus = thm"hsgn_minus"; +val hsgn_eq = thm"hsgn_eq"; +val lemma_hypreal_P_EX2 = thm"lemma_hypreal_P_EX2"; +val complex_split2 = thm"complex_split2"; +val hcomplex_split = thm"hcomplex_split"; +val hRe_hcomplex_i = thm"hRe_hcomplex_i"; +val hIm_hcomplex_i = thm"hIm_hcomplex_i"; +val hcmod_i = thm"hcmod_i"; +val hcomplex_eq_hRe_eq = thm"hcomplex_eq_hRe_eq"; +val hcomplex_eq_hIm_eq = thm"hcomplex_eq_hIm_eq"; +val hcomplex_eq_cancel_iff = thm"hcomplex_eq_cancel_iff"; +val hcomplex_eq_cancel_iffA = thm"hcomplex_eq_cancel_iffA"; +val hcomplex_eq_cancel_iffB = thm"hcomplex_eq_cancel_iffB"; +val hcomplex_eq_cancel_iffC = thm"hcomplex_eq_cancel_iffC"; +val hcomplex_eq_cancel_iff2 = thm"hcomplex_eq_cancel_iff2"; +val hcomplex_eq_cancel_iff2a = thm"hcomplex_eq_cancel_iff2a"; +val hcomplex_eq_cancel_iff3 = thm"hcomplex_eq_cancel_iff3"; +val hcomplex_eq_cancel_iff3a = thm"hcomplex_eq_cancel_iff3a"; +val hcomplex_split_hRe_zero = thm"hcomplex_split_hRe_zero"; +val hcomplex_split_hIm_zero = thm"hcomplex_split_hIm_zero"; +val hRe_hsgn = thm"hRe_hsgn"; +val hIm_hsgn = thm"hIm_hsgn"; +val real_two_squares_add_zero_iff = thm"real_two_squares_add_zero_iff"; +val hcomplex_inverse_complex_split = thm"hcomplex_inverse_complex_split"; +val hRe_mult_i_eq = thm"hRe_mult_i_eq"; +val hIm_mult_i_eq = thm"hIm_mult_i_eq"; +val hcmod_mult_i = thm"hcmod_mult_i"; +val hcmod_mult_i2 = thm"hcmod_mult_i2"; +val harg = thm"harg"; +val cos_harg_i_mult_zero = thm"cos_harg_i_mult_zero"; +val cos_harg_i_mult_zero2 = thm"cos_harg_i_mult_zero2"; +val hcomplex_of_hypreal_not_zero_iff = thm"hcomplex_of_hypreal_not_zero_iff"; +val hcomplex_of_hypreal_zero_iff = thm"hcomplex_of_hypreal_zero_iff"; +val cos_harg_i_mult_zero3 = thm"cos_harg_i_mult_zero3"; +val complex_split_polar2 = thm"complex_split_polar2"; +val hcomplex_split_polar = thm"hcomplex_split_polar"; +val hcis = thm"hcis"; +val hcis_eq = thm"hcis_eq"; +val hrcis = thm"hrcis"; +val hrcis_Ex = thm"hrcis_Ex"; +val hRe_hcomplex_polar = thm"hRe_hcomplex_polar"; +val hRe_hrcis = thm"hRe_hrcis"; +val hIm_hcomplex_polar = thm"hIm_hcomplex_polar"; +val hIm_hrcis = thm"hIm_hrcis"; +val hcmod_complex_polar = thm"hcmod_complex_polar"; +val hcmod_hrcis = thm"hcmod_hrcis"; +val hcis_hrcis_eq = thm"hcis_hrcis_eq"; +val hrcis_mult = thm"hrcis_mult"; +val hcis_mult = thm"hcis_mult"; +val hcis_zero = thm"hcis_zero"; +val hrcis_zero_mod = thm"hrcis_zero_mod"; +val hrcis_zero_arg = thm"hrcis_zero_arg"; +val hcomplex_i_mult_minus = thm"hcomplex_i_mult_minus"; +val hcomplex_i_mult_minus2 = thm"hcomplex_i_mult_minus2"; +val hypreal_of_nat = thm"hypreal_of_nat"; +val hcis_hypreal_of_nat_Suc_mult = thm"hcis_hypreal_of_nat_Suc_mult"; +val NSDeMoivre = thm"NSDeMoivre"; +val hcis_hypreal_of_hypnat_Suc_mult = thm"hcis_hypreal_of_hypnat_Suc_mult"; +val NSDeMoivre_ext = thm"NSDeMoivre_ext"; +val DeMoivre2 = thm"DeMoivre2"; +val DeMoivre2_ext = thm"DeMoivre2_ext"; +val hcis_inverse = thm"hcis_inverse"; +val hrcis_inverse = thm"hrcis_inverse"; +val hRe_hcis = thm"hRe_hcis"; +val hIm_hcis = thm"hIm_hcis"; +val cos_n_hRe_hcis_pow_n = thm"cos_n_hRe_hcis_pow_n"; +val sin_n_hIm_hcis_pow_n = thm"sin_n_hIm_hcis_pow_n"; +val cos_n_hRe_hcis_hcpow_n = thm"cos_n_hRe_hcis_hcpow_n"; +val sin_n_hIm_hcis_hcpow_n = thm"sin_n_hIm_hcis_hcpow_n"; +val hexpi_add = thm"hexpi_add"; +val hcomplex_of_complex_add = thm"hcomplex_of_complex_add"; +val hcomplex_of_complex_mult = thm"hcomplex_of_complex_mult"; +val hcomplex_of_complex_eq_iff = thm"hcomplex_of_complex_eq_iff"; +val hcomplex_of_complex_minus = thm"hcomplex_of_complex_minus"; +val hcomplex_of_complex_one = thm"hcomplex_of_complex_one"; +val hcomplex_of_complex_zero = thm"hcomplex_of_complex_zero"; +val hcomplex_of_complex_zero_iff = thm"hcomplex_of_complex_zero_iff"; +val hcomplex_of_complex_inverse = thm"hcomplex_of_complex_inverse"; +val hcomplex_of_complex_divide = thm"hcomplex_of_complex_divide"; +val hRe_hcomplex_of_complex = thm"hRe_hcomplex_of_complex"; +val hIm_hcomplex_of_complex = thm"hIm_hcomplex_of_complex"; +val hcmod_hcomplex_of_complex = thm"hcmod_hcomplex_of_complex"; + +val hcomplex_add_ac = thms"hcomplex_add_ac"; +val hcomplex_mult_ac = thms"hcomplex_mult_ac"; +*} + end
--- a/src/HOL/IsaMakefile Mon Dec 22 16:22:14 2003 +0100 +++ b/src/HOL/IsaMakefile Mon Dec 22 18:29:20 2003 +0100 @@ -173,7 +173,7 @@ Complex/ComplexArith0.ML Complex/ComplexArith0.thy\ Complex/ComplexBin.ML Complex/ComplexBin.thy\ Complex/NSCA.ML Complex/NSCA.thy\ - Complex/NSComplex.ML Complex/NSComplex.thy\ + Complex/NSComplex.thy\ Complex/NSComplexArith0.ML Complex/NSComplexArith0.thy\ Complex/NSComplexBin.ML Complex/NSComplexBin.thy @cd Complex; $(ISATOOL) usedir -b $(OUT)/HOL HOL-Complex