195 Goal "1hr + 1hr ~= 0"; |
195 Goal "1hr + 1hr ~= 0"; |
196 by (rtac (hypreal_zero_less_two RS hypreal_not_refl2 RS not_sym) 1); |
196 by (rtac (hypreal_zero_less_two RS hypreal_not_refl2 RS not_sym) 1); |
197 qed "hypreal_two_not_zero"; |
197 qed "hypreal_two_not_zero"; |
198 Addsimps [hypreal_two_not_zero]; |
198 Addsimps [hypreal_two_not_zero]; |
199 |
199 |
200 Goal "x*hrinv(1hr + 1hr) + x*hrinv(1hr + 1hr) = x"; |
200 Goal "x*inverse(1hr + 1hr) + x*inverse(1hr + 1hr) = x"; |
201 by (stac hypreal_add_self 1); |
201 by (stac hypreal_add_self 1); |
202 by (full_simp_tac (simpset() addsimps [hypreal_mult_assoc, |
202 by (full_simp_tac (simpset() addsimps [hypreal_mult_assoc, |
203 hypreal_two_not_zero RS hypreal_mult_hrinv_left]) 1); |
203 hypreal_two_not_zero RS hypreal_mult_inverse_left]) 1); |
204 qed "hypreal_sum_of_halves"; |
204 qed "hypreal_sum_of_halves"; |
205 |
205 |
206 Goal "[| 0 <= x; 0 <= y |] ==> (0::hypreal) <= x + y"; |
206 Goal "[| 0 <= x; 0 <= y |] ==> (0::hypreal) <= x + y"; |
207 by (REPEAT(dtac hypreal_le_imp_less_or_eq 1)); |
207 by (REPEAT(dtac hypreal_le_imp_less_or_eq 1)); |
208 by (auto_tac (claset() addIs [hypreal_add_order, |
208 by (auto_tac (claset() addIs [hypreal_add_order, |
380 by (auto_tac (claset() addIs [hypreal_mult_less_mono, |
380 by (auto_tac (claset() addIs [hypreal_mult_less_mono, |
381 hypreal_mult_less_mono1,hypreal_mult_less_mono2, |
381 hypreal_mult_less_mono1,hypreal_mult_less_mono2, |
382 hypreal_mult_order_trans,hypreal_mult_order],simpset())); |
382 hypreal_mult_order_trans,hypreal_mult_order],simpset())); |
383 qed "hypreal_mult_le_mono"; |
383 qed "hypreal_mult_le_mono"; |
384 |
384 |
385 Goal "0 < x ==> 0 < hrinv x"; |
385 Goal "0 < x ==> 0 < inverse (x::hypreal)"; |
386 by (EVERY1[rtac ccontr, dtac hypreal_leI]); |
386 by (EVERY1[rtac ccontr, dtac hypreal_leI]); |
387 by (forward_tac [hypreal_minus_zero_less_iff2 RS iffD2] 1); |
387 by (forward_tac [hypreal_minus_zero_less_iff2 RS iffD2] 1); |
388 by (forward_tac [hypreal_not_refl2 RS not_sym] 1); |
388 by (forward_tac [hypreal_not_refl2 RS not_sym] 1); |
389 by (dtac (hypreal_not_refl2 RS not_sym RS hrinv_not_zero) 1); |
389 by (dtac (hypreal_not_refl2 RS not_sym RS hypreal_inverse_not_zero) 1); |
390 by (EVERY1[dtac hypreal_le_imp_less_or_eq, Step_tac]); |
390 by (EVERY1[dtac hypreal_le_imp_less_or_eq, Step_tac]); |
391 by (dtac hypreal_mult_less_zero1 1 THEN assume_tac 1); |
391 by (dtac hypreal_mult_less_zero1 1 THEN assume_tac 1); |
392 by (auto_tac (claset() addIs [hypreal_zero_less_one RS hypreal_less_asym], |
392 by (auto_tac (claset() addIs [hypreal_zero_less_one RS hypreal_less_asym], |
393 simpset() addsimps [hypreal_minus_zero_less_iff])); |
393 simpset() addsimps [hypreal_minus_zero_less_iff])); |
394 qed "hypreal_hrinv_gt_zero"; |
394 qed "hypreal_inverse_gt_zero"; |
395 |
395 |
396 Goal "x < 0 ==> hrinv x < 0"; |
396 Goal "x < 0 ==> inverse (x::hypreal) < 0"; |
397 by (ftac hypreal_not_refl2 1); |
397 by (ftac hypreal_not_refl2 1); |
398 by (dtac (hypreal_minus_zero_less_iff RS iffD2) 1); |
398 by (dtac (hypreal_minus_zero_less_iff RS iffD2) 1); |
399 by (rtac (hypreal_minus_zero_less_iff RS iffD1) 1); |
399 by (rtac (hypreal_minus_zero_less_iff RS iffD1) 1); |
400 by (dtac (hypreal_minus_hrinv RS sym) 1); |
400 by (dtac (hypreal_minus_inverse RS sym) 1); |
401 by (auto_tac (claset() addIs [hypreal_hrinv_gt_zero], |
401 by (auto_tac (claset() addIs [hypreal_inverse_gt_zero], |
402 simpset())); |
402 simpset())); |
403 qed "hypreal_hrinv_less_zero"; |
403 qed "hypreal_inverse_less_zero"; |
404 |
404 |
405 (* check why this does not work without 2nd substitution anymore! *) |
405 (* check why this does not work without 2nd substitution anymore! *) |
406 Goal "x < y ==> x < (x + y)*hrinv(1hr + 1hr)"; |
406 Goal "x < y ==> x < (x + y)*inverse(1hr + 1hr)"; |
407 by (dres_inst_tac [("C","x")] hypreal_add_less_mono2 1); |
407 by (dres_inst_tac [("C","x")] hypreal_add_less_mono2 1); |
408 by (dtac (hypreal_add_self RS subst) 1); |
408 by (dtac (hypreal_add_self RS subst) 1); |
409 by (dtac (hypreal_zero_less_two RS hypreal_hrinv_gt_zero RS |
409 by (dtac (hypreal_zero_less_two RS hypreal_inverse_gt_zero RS |
410 hypreal_mult_less_mono1) 1); |
410 hypreal_mult_less_mono1) 1); |
411 by (auto_tac (claset() addDs [hypreal_two_not_zero RS |
411 by (auto_tac (claset() addDs [hypreal_two_not_zero RS |
412 (hypreal_mult_hrinv RS subst)],simpset() |
412 (hypreal_mult_inverse RS subst)],simpset() |
413 addsimps [hypreal_mult_assoc])); |
413 addsimps [hypreal_mult_assoc])); |
414 qed "hypreal_less_half_sum"; |
414 qed "hypreal_less_half_sum"; |
415 |
415 |
416 (* check why this does not work without 2nd substitution anymore! *) |
416 (* check why this does not work without 2nd substitution anymore! *) |
417 Goal "x < y ==> (x + y)*hrinv(1hr + 1hr) < y"; |
417 Goal "x < y ==> (x + y)*inverse(1hr + 1hr) < y"; |
418 by (dres_inst_tac [("C","y")] hypreal_add_less_mono1 1); |
418 by (dres_inst_tac [("C","y")] hypreal_add_less_mono1 1); |
419 by (dtac (hypreal_add_self RS subst) 1); |
419 by (dtac (hypreal_add_self RS subst) 1); |
420 by (dtac (hypreal_zero_less_two RS hypreal_hrinv_gt_zero RS |
420 by (dtac (hypreal_zero_less_two RS hypreal_inverse_gt_zero RS |
421 hypreal_mult_less_mono1) 1); |
421 hypreal_mult_less_mono1) 1); |
422 by (auto_tac (claset() addDs [hypreal_two_not_zero RS |
422 by (auto_tac (claset() addDs [hypreal_two_not_zero RS |
423 (hypreal_mult_hrinv RS subst)],simpset() |
423 (hypreal_mult_inverse RS subst)],simpset() |
424 addsimps [hypreal_mult_assoc])); |
424 addsimps [hypreal_mult_assoc])); |
425 qed "hypreal_gt_half_sum"; |
425 qed "hypreal_gt_half_sum"; |
426 |
426 |
427 Goal "!!(x::hypreal). x < y ==> EX r. x < r & r < y"; |
427 Goal "!!(x::hypreal). x < y ==> EX r. x < r & r < y"; |
428 by (blast_tac (claset() addSIs [hypreal_less_half_sum, |
428 by (blast_tac (claset() addSIs [hypreal_less_half_sum, |
582 qed "hypreal_of_real_not_eq_omega"; |
582 qed "hypreal_of_real_not_eq_omega"; |
583 |
583 |
584 (* existence of infinitesimal number also not *) |
584 (* existence of infinitesimal number also not *) |
585 (* corresponding to any real number *) |
585 (* corresponding to any real number *) |
586 |
586 |
587 Goal "{n::nat. x = rinv(real_of_posnat n)} = {} | \ |
587 Goal "{n::nat. x = inverse(real_of_posnat n)} = {} | \ |
588 \ (EX y. {n::nat. x = rinv(real_of_posnat n)} = {y})"; |
588 \ (EX y. {n::nat. x = inverse(real_of_posnat n)} = {y})"; |
589 by (Step_tac 1 THEN Step_tac 1); |
589 by (Step_tac 1 THEN Step_tac 1); |
590 by (auto_tac (claset() addIs [real_of_posnat_rinv_inj],simpset())); |
590 by (auto_tac (claset() addIs [real_of_posnat_inverse_inj],simpset())); |
591 qed "lemma_epsilon_empty_singleton_disj"; |
591 qed "lemma_epsilon_empty_singleton_disj"; |
592 |
592 |
593 Goal "finite {n::nat. x = rinv(real_of_posnat n)}"; |
593 Goal "finite {n::nat. x = inverse(real_of_posnat n)}"; |
594 by (cut_inst_tac [("x","x")] lemma_epsilon_empty_singleton_disj 1); |
594 by (cut_inst_tac [("x","x")] lemma_epsilon_empty_singleton_disj 1); |
595 by Auto_tac; |
595 by Auto_tac; |
596 qed "lemma_finite_epsilon_set"; |
596 qed "lemma_finite_epsilon_set"; |
597 |
597 |
598 Goalw [epsilon_def,hypreal_of_real_def] |
598 Goalw [epsilon_def,hypreal_of_real_def] |
606 by Auto_tac; |
606 by Auto_tac; |
607 qed "hypreal_of_real_not_eq_epsilon"; |
607 qed "hypreal_of_real_not_eq_epsilon"; |
608 |
608 |
609 Goalw [epsilon_def,hypreal_zero_def] "ehr ~= 0"; |
609 Goalw [epsilon_def,hypreal_zero_def] "ehr ~= 0"; |
610 by (auto_tac (claset(), |
610 by (auto_tac (claset(), |
611 simpset() addsimps [rename_numerals real_of_posnat_rinv_not_zero])); |
611 simpset() addsimps [rename_numerals real_of_posnat_inverse_not_zero])); |
612 qed "hypreal_epsilon_not_zero"; |
612 qed "hypreal_epsilon_not_zero"; |
613 |
613 |
614 Addsimps [rename_numerals real_of_posnat_not_eq_zero]; |
614 Addsimps [rename_numerals real_of_posnat_not_eq_zero]; |
615 Goalw [omega_def,hypreal_zero_def] "whr ~= 0"; |
615 Goalw [omega_def,hypreal_zero_def] "whr ~= 0"; |
616 by (Simp_tac 1); |
616 by (Simp_tac 1); |
617 qed "hypreal_omega_not_zero"; |
617 qed "hypreal_omega_not_zero"; |
618 |
618 |
619 Goal "ehr = hrinv(whr)"; |
619 Goal "ehr = inverse(whr)"; |
620 by (asm_full_simp_tac (simpset() addsimps |
620 by (asm_full_simp_tac (simpset() addsimps |
621 [hypreal_hrinv,omega_def,epsilon_def]) 1); |
621 [hypreal_inverse,omega_def,epsilon_def]) 1); |
622 qed "hypreal_epsilon_hrinv_omega"; |
622 qed "hypreal_epsilon_inverse_omega"; |
623 |
623 |
624 (*---------------------------------------------------------------- |
624 (*---------------------------------------------------------------- |
625 Another embedding of the naturals in the |
625 Another embedding of the naturals in the |
626 hyperreals (see hypreal_of_posnat) |
626 hyperreals (see hypreal_of_posnat) |
627 ----------------------------------------------------------------*) |
627 ----------------------------------------------------------------*) |
685 Goalw [hypreal_of_nat_def] |
685 Goalw [hypreal_of_nat_def] |
686 "hypreal_of_nat (Suc n) = hypreal_of_nat n + 1hr"; |
686 "hypreal_of_nat (Suc n) = hypreal_of_nat n + 1hr"; |
687 by (simp_tac (simpset() addsimps [hypreal_of_posnat_Suc] @ hypreal_add_ac) 1); |
687 by (simp_tac (simpset() addsimps [hypreal_of_posnat_Suc] @ hypreal_add_ac) 1); |
688 qed "hypreal_of_nat_Suc"; |
688 qed "hypreal_of_nat_Suc"; |
689 |
689 |
690 Goal "0 < r ==> 0 < r*hrinv(1hr+1hr)"; |
690 Goal "0 < r ==> 0 < r*inverse(1hr+1hr)"; |
691 by (dtac (hypreal_zero_less_two RS hypreal_hrinv_gt_zero |
691 by (dtac (hypreal_zero_less_two RS hypreal_inverse_gt_zero |
692 RS hypreal_mult_less_mono1) 1); |
692 RS hypreal_mult_less_mono1) 1); |
693 by Auto_tac; |
693 by Auto_tac; |
694 qed "hypreal_half_gt_zero"; |
694 qed "hypreal_half_gt_zero"; |
695 |
695 |
696 (* this proof is so much simpler than one for reals!! *) |
696 (* this proof is so much simpler than one for reals!! *) |
697 Goal "[| 0 < r; r < x |] ==> hrinv x < hrinv r"; |
697 Goal "[| 0 < r; r < x |] ==> inverse x < inverse (r::hypreal)"; |
698 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
698 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
699 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1); |
699 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1); |
700 by (auto_tac (claset(),simpset() addsimps [hypreal_hrinv, |
700 by (auto_tac (claset(),simpset() addsimps [hypreal_inverse, |
701 hypreal_less,hypreal_zero_def])); |
701 hypreal_less,hypreal_zero_def])); |
702 by (ultra_tac (claset() addIs [real_rinv_less_swap],simpset()) 1); |
702 by (ultra_tac (claset() addIs [real_inverse_less_swap],simpset()) 1); |
703 qed "hypreal_hrinv_less_swap"; |
703 qed "hypreal_inverse_less_swap"; |
704 |
704 |
705 Goal "[| 0 < r; 0 < x|] ==> (r < x) = (hrinv x < hrinv r)"; |
705 Goal "[| 0 < r; 0 < x|] ==> (r < x) = (inverse x < inverse (r::hypreal))"; |
706 by (auto_tac (claset() addIs [hypreal_hrinv_less_swap],simpset())); |
706 by (auto_tac (claset() addIs [hypreal_inverse_less_swap],simpset())); |
707 by (res_inst_tac [("t","r")] (hypreal_hrinv_hrinv RS subst) 1); |
707 by (res_inst_tac [("t","r")] (hypreal_inverse_inverse RS subst) 1); |
708 by (etac (hypreal_not_refl2 RS not_sym) 1); |
708 by (etac (hypreal_not_refl2 RS not_sym) 1); |
709 by (res_inst_tac [("t","x")] (hypreal_hrinv_hrinv RS subst) 1); |
709 by (res_inst_tac [("t","x")] (hypreal_inverse_inverse RS subst) 1); |
710 by (etac (hypreal_not_refl2 RS not_sym) 1); |
710 by (etac (hypreal_not_refl2 RS not_sym) 1); |
711 by (auto_tac (claset() addIs [hypreal_hrinv_less_swap], |
711 by (auto_tac (claset() addIs [hypreal_inverse_less_swap], |
712 simpset() addsimps [hypreal_hrinv_gt_zero])); |
712 simpset() addsimps [hypreal_inverse_gt_zero])); |
713 qed "hypreal_hrinv_less_iff"; |
713 qed "hypreal_inverse_less_iff"; |
714 |
714 |
715 Goal "[| 0 < z; x < y |] ==> x*hrinv(z) < y*hrinv(z)"; |
715 Goal "[| 0 < z; x < y |] ==> x * inverse z < y * inverse (z::hypreal)"; |
716 by (blast_tac (claset() addSIs [hypreal_mult_less_mono1, |
716 by (blast_tac (claset() addSIs [hypreal_mult_less_mono1, |
717 hypreal_hrinv_gt_zero]) 1); |
717 hypreal_inverse_gt_zero]) 1); |
718 qed "hypreal_mult_hrinv_less_mono1"; |
718 qed "hypreal_mult_inverse_less_mono1"; |
719 |
719 |
720 Goal "[| 0 < z; x < y |] ==> hrinv(z)*x < hrinv(z)*y"; |
720 Goal "[| 0 < z; x < y |] ==> inverse z * x < inverse (z::hypreal) * y"; |
721 by (blast_tac (claset() addSIs [hypreal_mult_less_mono2, |
721 by (blast_tac (claset() addSIs [hypreal_mult_less_mono2, |
722 hypreal_hrinv_gt_zero]) 1); |
722 hypreal_inverse_gt_zero]) 1); |
723 qed "hypreal_mult_hrinv_less_mono2"; |
723 qed "hypreal_mult_inverse_less_mono2"; |
724 |
724 |
725 Goal "[| (0::hypreal) < z; x*z < y*z |] ==> x < y"; |
725 Goal "[| (0::hypreal) < z; x*z < y*z |] ==> x < y"; |
726 by (forw_inst_tac [("x","x*z")] hypreal_mult_hrinv_less_mono1 1); |
726 by (forw_inst_tac [("x","x*z")] hypreal_mult_inverse_less_mono1 1); |
727 by (dtac (hypreal_not_refl2 RS not_sym) 2); |
727 by (dtac (hypreal_not_refl2 RS not_sym) 2); |
728 by (auto_tac (claset() addSDs [hypreal_mult_hrinv], |
728 by (auto_tac (claset() addSDs [hypreal_mult_inverse], |
729 simpset() addsimps hypreal_mult_ac)); |
729 simpset() addsimps hypreal_mult_ac)); |
730 qed "hypreal_less_mult_right_cancel"; |
730 qed "hypreal_less_mult_right_cancel"; |
731 |
731 |
732 Goal "[| (0::hypreal) < z; z*x < z*y |] ==> x < y"; |
732 Goal "[| (0::hypreal) < z; z*x < z*y |] ==> x < y"; |
733 by (auto_tac (claset() addIs [hypreal_less_mult_right_cancel], |
733 by (auto_tac (claset() addIs [hypreal_less_mult_right_cancel], |