305 qed "inj_hypreal_minus"; |
305 qed "inj_hypreal_minus"; |
306 |
306 |
307 Goalw [hypreal_zero_def] "-0 = (0::hypreal)"; |
307 Goalw [hypreal_zero_def] "-0 = (0::hypreal)"; |
308 by (simp_tac (simpset() addsimps [hypreal_minus]) 1); |
308 by (simp_tac (simpset() addsimps [hypreal_minus]) 1); |
309 qed "hypreal_minus_zero"; |
309 qed "hypreal_minus_zero"; |
310 |
|
311 Addsimps [hypreal_minus_zero]; |
310 Addsimps [hypreal_minus_zero]; |
312 |
311 |
313 Goal "(-x = 0) = (x = (0::hypreal))"; |
312 Goal "(-x = 0) = (x = (0::hypreal))"; |
314 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
313 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
315 by (auto_tac (claset(),simpset() addsimps [hypreal_zero_def, |
314 by (auto_tac (claset(), |
316 hypreal_minus] @ real_add_ac)); |
315 simpset() addsimps [hypreal_zero_def, hypreal_minus, eq_commute] @ |
|
316 real_add_ac)); |
317 qed "hypreal_minus_zero_iff"; |
317 qed "hypreal_minus_zero_iff"; |
318 |
318 |
319 Addsimps [hypreal_minus_zero_iff]; |
319 Addsimps [hypreal_minus_zero_iff]; |
|
320 |
|
321 |
|
322 (**** hyperreal addition: hypreal_add ****) |
|
323 |
|
324 Goalw [congruent2_def] |
|
325 "congruent2 hyprel (%X Y. hyprel^^{%n. X n + Y n})"; |
|
326 by Safe_tac; |
|
327 by (ALLGOALS(Ultra_tac)); |
|
328 qed "hypreal_add_congruent2"; |
|
329 |
|
330 Goalw [hypreal_add_def] |
|
331 "Abs_hypreal(hyprel^^{%n. X n}) + Abs_hypreal(hyprel^^{%n. Y n}) = \ |
|
332 \ Abs_hypreal(hyprel^^{%n. X n + Y n})"; |
|
333 by (simp_tac (simpset() addsimps |
|
334 [[equiv_hyprel, hypreal_add_congruent2] MRS UN_equiv_class2]) 1); |
|
335 qed "hypreal_add"; |
|
336 |
|
337 Goal "(z::hypreal) + w = w + z"; |
|
338 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
339 by (res_inst_tac [("z","w")] eq_Abs_hypreal 1); |
|
340 by (asm_simp_tac (simpset() addsimps (real_add_ac @ [hypreal_add])) 1); |
|
341 qed "hypreal_add_commute"; |
|
342 |
|
343 Goal "((z1::hypreal) + z2) + z3 = z1 + (z2 + z3)"; |
|
344 by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1); |
|
345 by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1); |
|
346 by (res_inst_tac [("z","z3")] eq_Abs_hypreal 1); |
|
347 by (asm_simp_tac (simpset() addsimps [hypreal_add, real_add_assoc]) 1); |
|
348 qed "hypreal_add_assoc"; |
|
349 |
|
350 (*For AC rewriting*) |
|
351 Goal "(x::hypreal)+(y+z)=y+(x+z)"; |
|
352 by (rtac (hypreal_add_commute RS trans) 1); |
|
353 by (rtac (hypreal_add_assoc RS trans) 1); |
|
354 by (rtac (hypreal_add_commute RS arg_cong) 1); |
|
355 qed "hypreal_add_left_commute"; |
|
356 |
|
357 (* hypreal addition is an AC operator *) |
|
358 bind_thms ("hypreal_add_ac", [hypreal_add_assoc,hypreal_add_commute, |
|
359 hypreal_add_left_commute]); |
|
360 |
|
361 Goalw [hypreal_zero_def] "(0::hypreal) + z = z"; |
|
362 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
363 by (asm_full_simp_tac (simpset() addsimps |
|
364 [hypreal_add]) 1); |
|
365 qed "hypreal_add_zero_left"; |
|
366 |
|
367 Goal "z + (0::hypreal) = z"; |
|
368 by (simp_tac (simpset() addsimps |
|
369 [hypreal_add_zero_left,hypreal_add_commute]) 1); |
|
370 qed "hypreal_add_zero_right"; |
|
371 |
|
372 Goalw [hypreal_zero_def] "z + -z = (0::hypreal)"; |
|
373 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
374 by (asm_full_simp_tac (simpset() addsimps [hypreal_minus, hypreal_add]) 1); |
|
375 qed "hypreal_add_minus"; |
|
376 |
|
377 Goal "-z + z = (0::hypreal)"; |
|
378 by (simp_tac (simpset() addsimps [hypreal_add_commute, hypreal_add_minus]) 1); |
|
379 qed "hypreal_add_minus_left"; |
|
380 |
|
381 Addsimps [hypreal_add_minus,hypreal_add_minus_left, |
|
382 hypreal_add_zero_left,hypreal_add_zero_right]; |
|
383 |
|
384 Goal "EX y. (x::hypreal) + y = 0"; |
|
385 by (fast_tac (claset() addIs [hypreal_add_minus]) 1); |
|
386 qed "hypreal_minus_ex"; |
|
387 |
|
388 Goal "EX! y. (x::hypreal) + y = 0"; |
|
389 by (auto_tac (claset() addIs [hypreal_add_minus], simpset())); |
|
390 by (dres_inst_tac [("f","%x. ya+x")] arg_cong 1); |
|
391 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
392 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
|
393 qed "hypreal_minus_ex1"; |
|
394 |
|
395 Goal "EX! y. y + (x::hypreal) = 0"; |
|
396 by (auto_tac (claset() addIs [hypreal_add_minus_left], simpset())); |
|
397 by (dres_inst_tac [("f","%x. x+ya")] arg_cong 1); |
|
398 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc]) 1); |
|
399 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
|
400 qed "hypreal_minus_left_ex1"; |
|
401 |
|
402 Goal "x + y = (0::hypreal) ==> x = -y"; |
|
403 by (cut_inst_tac [("z","y")] hypreal_add_minus_left 1); |
|
404 by (res_inst_tac [("x1","y")] (hypreal_minus_left_ex1 RS ex1E) 1); |
|
405 by (Blast_tac 1); |
|
406 qed "hypreal_add_minus_eq_minus"; |
|
407 |
|
408 Goal "EX y::hypreal. x = -y"; |
|
409 by (cut_inst_tac [("x","x")] hypreal_minus_ex 1); |
|
410 by (etac exE 1 THEN dtac hypreal_add_minus_eq_minus 1); |
|
411 by (Fast_tac 1); |
|
412 qed "hypreal_as_add_inverse_ex"; |
|
413 |
|
414 Goal "-(x + (y::hypreal)) = -x + -y"; |
|
415 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
|
416 by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); |
|
417 by (auto_tac (claset(), |
|
418 simpset() addsimps [hypreal_minus, hypreal_add, |
|
419 real_minus_add_distrib])); |
|
420 qed "hypreal_minus_add_distrib"; |
|
421 Addsimps [hypreal_minus_add_distrib]; |
|
422 |
|
423 Goal "-(y + -(x::hypreal)) = x + -y"; |
|
424 by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
|
425 qed "hypreal_minus_distrib1"; |
|
426 |
|
427 Goal "(x + - (y::hypreal)) + (y + - z) = x + -z"; |
|
428 by (res_inst_tac [("w1","y")] (hypreal_add_commute RS subst) 1); |
|
429 by (simp_tac (simpset() addsimps [hypreal_add_left_commute, |
|
430 hypreal_add_assoc]) 1); |
|
431 by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
|
432 qed "hypreal_add_minus_cancel1"; |
|
433 |
|
434 Goal "((x::hypreal) + y = x + z) = (y = z)"; |
|
435 by (Step_tac 1); |
|
436 by (dres_inst_tac [("f","%t.-x + t")] arg_cong 1); |
|
437 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
438 qed "hypreal_add_left_cancel"; |
|
439 |
|
440 Goal "z + (x + (y + -z)) = x + (y::hypreal)"; |
|
441 by (simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
442 qed "hypreal_add_minus_cancel2"; |
|
443 Addsimps [hypreal_add_minus_cancel2]; |
|
444 |
|
445 Goal "y + -(x + y) = -(x::hypreal)"; |
|
446 by (Full_simp_tac 1); |
|
447 by (rtac (hypreal_add_left_commute RS subst) 1); |
|
448 by (Full_simp_tac 1); |
|
449 qed "hypreal_add_minus_cancel"; |
|
450 Addsimps [hypreal_add_minus_cancel]; |
|
451 |
|
452 Goal "y + -(y + x) = -(x::hypreal)"; |
|
453 by (simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
454 qed "hypreal_add_minus_cancelc"; |
|
455 Addsimps [hypreal_add_minus_cancelc]; |
|
456 |
|
457 Goal "(z + -x) + (y + -z) = (y + -(x::hypreal))"; |
|
458 by (full_simp_tac |
|
459 (simpset() addsimps [hypreal_minus_add_distrib RS sym, |
|
460 hypreal_add_left_cancel] @ hypreal_add_ac |
|
461 delsimps [hypreal_minus_add_distrib]) 1); |
|
462 qed "hypreal_add_minus_cancel3"; |
|
463 Addsimps [hypreal_add_minus_cancel3]; |
|
464 |
|
465 Goal "(y + (x::hypreal)= z + x) = (y = z)"; |
|
466 by (simp_tac (simpset() addsimps [hypreal_add_commute, |
|
467 hypreal_add_left_cancel]) 1); |
|
468 qed "hypreal_add_right_cancel"; |
|
469 |
|
470 Goal "z + (y + -z) = (y::hypreal)"; |
|
471 by (simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
472 qed "hypreal_add_minus_cancel4"; |
|
473 Addsimps [hypreal_add_minus_cancel4]; |
|
474 |
|
475 Goal "z + (w + (x + (-z + y))) = w + x + (y::hypreal)"; |
|
476 by (simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
477 qed "hypreal_add_minus_cancel5"; |
|
478 Addsimps [hypreal_add_minus_cancel5]; |
|
479 |
|
480 Goal "z + ((- z) + w) = (w::hypreal)"; |
|
481 by (simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
482 qed "hypreal_add_minus_cancelA"; |
|
483 |
|
484 Goal "(-z) + (z + w) = (w::hypreal)"; |
|
485 by (simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
486 qed "hypreal_minus_add_cancelA"; |
|
487 |
|
488 Addsimps [hypreal_add_minus_cancelA, hypreal_minus_add_cancelA]; |
|
489 |
|
490 (**** hyperreal multiplication: hypreal_mult ****) |
|
491 |
|
492 Goalw [congruent2_def] |
|
493 "congruent2 hyprel (%X Y. hyprel^^{%n. X n * Y n})"; |
|
494 by Safe_tac; |
|
495 by (ALLGOALS(Ultra_tac)); |
|
496 qed "hypreal_mult_congruent2"; |
|
497 |
|
498 Goalw [hypreal_mult_def] |
|
499 "Abs_hypreal(hyprel^^{%n. X n}) * Abs_hypreal(hyprel^^{%n. Y n}) = \ |
|
500 \ Abs_hypreal(hyprel^^{%n. X n * Y n})"; |
|
501 by (simp_tac (simpset() addsimps |
|
502 [[equiv_hyprel, hypreal_mult_congruent2] MRS UN_equiv_class2]) 1); |
|
503 qed "hypreal_mult"; |
|
504 |
|
505 Goal "(z::hypreal) * w = w * z"; |
|
506 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
507 by (res_inst_tac [("z","w")] eq_Abs_hypreal 1); |
|
508 by (asm_simp_tac (simpset() addsimps ([hypreal_mult] @ real_mult_ac)) 1); |
|
509 qed "hypreal_mult_commute"; |
|
510 |
|
511 Goal "((z1::hypreal) * z2) * z3 = z1 * (z2 * z3)"; |
|
512 by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1); |
|
513 by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1); |
|
514 by (res_inst_tac [("z","z3")] eq_Abs_hypreal 1); |
|
515 by (asm_simp_tac (simpset() addsimps [hypreal_mult,real_mult_assoc]) 1); |
|
516 qed "hypreal_mult_assoc"; |
|
517 |
|
518 qed_goal "hypreal_mult_left_commute" (the_context ()) |
|
519 "(z1::hypreal) * (z2 * z3) = z2 * (z1 * z3)" |
|
520 (fn _ => [rtac (hypreal_mult_commute RS trans) 1, |
|
521 rtac (hypreal_mult_assoc RS trans) 1, |
|
522 rtac (hypreal_mult_commute RS arg_cong) 1]); |
|
523 |
|
524 (* hypreal multiplication is an AC operator *) |
|
525 bind_thms ("hypreal_mult_ac", [hypreal_mult_assoc, hypreal_mult_commute, |
|
526 hypreal_mult_left_commute]); |
|
527 |
|
528 Goalw [hypreal_one_def] "1hr * z = z"; |
|
529 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
530 by (asm_full_simp_tac (simpset() addsimps [hypreal_mult]) 1); |
|
531 qed "hypreal_mult_1"; |
|
532 |
|
533 Goal "z * 1hr = z"; |
|
534 by (simp_tac (simpset() addsimps [hypreal_mult_commute, |
|
535 hypreal_mult_1]) 1); |
|
536 qed "hypreal_mult_1_right"; |
|
537 |
|
538 Goalw [hypreal_zero_def] "0 * z = (0::hypreal)"; |
|
539 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
540 by (asm_full_simp_tac (simpset() addsimps [hypreal_mult,real_mult_0]) 1); |
|
541 qed "hypreal_mult_0"; |
|
542 |
|
543 Goal "z * 0 = (0::hypreal)"; |
|
544 by (simp_tac (simpset() addsimps [hypreal_mult_commute, hypreal_mult_0]) 1); |
|
545 qed "hypreal_mult_0_right"; |
|
546 |
|
547 Addsimps [hypreal_mult_0,hypreal_mult_0_right]; |
|
548 |
|
549 Goal "-(x * y) = -x * (y::hypreal)"; |
|
550 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
|
551 by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); |
|
552 by (auto_tac (claset(), |
|
553 simpset() addsimps [hypreal_minus, hypreal_mult] |
|
554 @ real_mult_ac @ real_add_ac)); |
|
555 qed "hypreal_minus_mult_eq1"; |
|
556 |
|
557 Goal "-(x * y) = (x::hypreal) * -y"; |
|
558 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
|
559 by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); |
|
560 by (auto_tac (claset(), simpset() addsimps [hypreal_minus, hypreal_mult] |
|
561 @ real_mult_ac @ real_add_ac)); |
|
562 qed "hypreal_minus_mult_eq2"; |
|
563 |
|
564 (*Pull negations out*) |
|
565 Addsimps [hypreal_minus_mult_eq2 RS sym, hypreal_minus_mult_eq1 RS sym]; |
|
566 |
|
567 Goal "-x*y = (x::hypreal)*-y"; |
|
568 by Auto_tac; |
|
569 qed "hypreal_minus_mult_commute"; |
|
570 |
|
571 (*----------------------------------------------------------------------------- |
|
572 A few more theorems |
|
573 ----------------------------------------------------------------------------*) |
|
574 Goal "(z::hypreal) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"; |
|
575 by (asm_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
576 qed "hypreal_add_assoc_cong"; |
|
577 |
|
578 Goal "(z::hypreal) + (v + w) = v + (z + w)"; |
|
579 by (REPEAT (ares_tac [hypreal_add_commute RS hypreal_add_assoc_cong] 1)); |
|
580 qed "hypreal_add_assoc_swap"; |
|
581 |
|
582 Goal "((z1::hypreal) + z2) * w = (z1 * w) + (z2 * w)"; |
|
583 by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1); |
|
584 by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1); |
|
585 by (res_inst_tac [("z","w")] eq_Abs_hypreal 1); |
|
586 by (asm_simp_tac (simpset() addsimps [hypreal_mult,hypreal_add, |
|
587 real_add_mult_distrib]) 1); |
|
588 qed "hypreal_add_mult_distrib"; |
|
589 |
|
590 val hypreal_mult_commute'= read_instantiate [("z","w")] hypreal_mult_commute; |
|
591 |
|
592 Goal "(w::hypreal) * (z1 + z2) = (w * z1) + (w * z2)"; |
|
593 by (simp_tac (simpset() addsimps [hypreal_mult_commute',hypreal_add_mult_distrib]) 1); |
|
594 qed "hypreal_add_mult_distrib2"; |
|
595 |
|
596 bind_thms ("hypreal_mult_simps", [hypreal_mult_1, hypreal_mult_1_right]); |
|
597 Addsimps hypreal_mult_simps; |
|
598 |
|
599 (* 07/00 *) |
|
600 |
|
601 Goalw [hypreal_diff_def] "((z1::hypreal) - z2) * w = (z1 * w) - (z2 * w)"; |
|
602 by (simp_tac (simpset() addsimps [hypreal_add_mult_distrib]) 1); |
|
603 qed "hypreal_diff_mult_distrib"; |
|
604 |
|
605 Goal "(w::hypreal) * (z1 - z2) = (w * z1) - (w * z2)"; |
|
606 by (simp_tac (simpset() addsimps [hypreal_mult_commute', |
|
607 hypreal_diff_mult_distrib]) 1); |
|
608 qed "hypreal_diff_mult_distrib2"; |
|
609 |
|
610 (*** one and zero are distinct ***) |
|
611 Goalw [hypreal_zero_def,hypreal_one_def] "0 ~= 1hr"; |
|
612 by (auto_tac (claset(), simpset() addsimps [real_zero_not_eq_one])); |
|
613 qed "hypreal_zero_not_eq_one"; |
|
614 |
|
615 |
320 (**** multiplicative inverse on hypreal ****) |
616 (**** multiplicative inverse on hypreal ****) |
321 |
617 |
322 Goalw [congruent_def] |
618 Goalw [congruent_def] |
323 "congruent hyprel (%X. hyprel^^{%n. if X n = #0 then #0 else inverse(X n)})"; |
619 "congruent hyprel (%X. hyprel^^{%n. if X n = #0 then #0 else inverse(X n)})"; |
324 by (Auto_tac THEN Ultra_tac 1); |
620 by (Auto_tac THEN Ultra_tac 1); |
331 by (simp_tac (simpset() addsimps |
627 by (simp_tac (simpset() addsimps |
332 [hyprel_in_hypreal RS Abs_hypreal_inverse, |
628 [hyprel_in_hypreal RS Abs_hypreal_inverse, |
333 [equiv_hyprel, hypreal_inverse_congruent] MRS UN_equiv_class]) 1); |
629 [equiv_hyprel, hypreal_inverse_congruent] MRS UN_equiv_class]) 1); |
334 qed "hypreal_inverse"; |
630 qed "hypreal_inverse"; |
335 |
631 |
336 Goal "z ~= 0 ==> inverse (inverse (z::hypreal)) = z"; |
632 Goal "inverse 0 = (0::hypreal)"; |
|
633 by (simp_tac (simpset() addsimps [hypreal_inverse, hypreal_zero_def]) 1); |
|
634 qed "HYPREAL_INVERSE_ZERO"; |
|
635 |
|
636 Goal "a / (0::hypreal) = 0"; |
|
637 by (simp_tac |
|
638 (simpset() addsimps [hypreal_divide_def, HYPREAL_INVERSE_ZERO]) 1); |
|
639 qed "HYPREAL_DIVISION_BY_ZERO"; (*NOT for adding to default simpset*) |
|
640 |
|
641 fun hypreal_div_undefined_case_tac s i = |
|
642 case_tac s i THEN |
|
643 asm_simp_tac |
|
644 (simpset() addsimps [HYPREAL_DIVISION_BY_ZERO, HYPREAL_INVERSE_ZERO]) i; |
|
645 |
|
646 Goal "inverse (inverse (z::hypreal)) = z"; |
|
647 by (hypreal_div_undefined_case_tac "z=0" 1); |
337 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
648 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
338 by (rotate_tac 1 1); |
|
339 by (asm_full_simp_tac (simpset() addsimps |
649 by (asm_full_simp_tac (simpset() addsimps |
340 [hypreal_inverse,hypreal_zero_def] addsplits [split_if]) 1); |
650 [hypreal_inverse, hypreal_zero_def]) 1); |
341 by (ultra_tac (claset() addDs (map rename_numerals [real_inverse_not_zero]), |
|
342 simpset() addsimps [real_inverse_inverse]) 1); |
|
343 qed "hypreal_inverse_inverse"; |
651 qed "hypreal_inverse_inverse"; |
344 |
|
345 Addsimps [hypreal_inverse_inverse]; |
652 Addsimps [hypreal_inverse_inverse]; |
346 |
653 |
347 Goalw [hypreal_one_def] "inverse(1hr) = 1hr"; |
654 Goalw [hypreal_one_def] "inverse(1hr) = 1hr"; |
348 by (full_simp_tac (simpset() addsimps [hypreal_inverse, |
655 by (full_simp_tac (simpset() addsimps [hypreal_inverse, |
349 real_zero_not_eq_one RS not_sym]) 1); |
656 real_zero_not_eq_one RS not_sym]) 1); |
350 qed "hypreal_inverse_1"; |
657 qed "hypreal_inverse_1"; |
351 Addsimps [hypreal_inverse_1]; |
658 Addsimps [hypreal_inverse_1]; |
352 |
659 |
353 (**** hyperreal addition: hypreal_add ****) |
|
354 |
|
355 Goalw [congruent2_def] |
|
356 "congruent2 hyprel (%X Y. hyprel^^{%n. X n + Y n})"; |
|
357 by Safe_tac; |
|
358 by (ALLGOALS(Ultra_tac)); |
|
359 qed "hypreal_add_congruent2"; |
|
360 |
|
361 Goalw [hypreal_add_def] |
|
362 "Abs_hypreal(hyprel^^{%n. X n}) + Abs_hypreal(hyprel^^{%n. Y n}) = \ |
|
363 \ Abs_hypreal(hyprel^^{%n. X n + Y n})"; |
|
364 by (simp_tac (simpset() addsimps |
|
365 [[equiv_hyprel, hypreal_add_congruent2] MRS UN_equiv_class2]) 1); |
|
366 qed "hypreal_add"; |
|
367 |
|
368 Goal "(z::hypreal) + w = w + z"; |
|
369 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
370 by (res_inst_tac [("z","w")] eq_Abs_hypreal 1); |
|
371 by (asm_simp_tac (simpset() addsimps (real_add_ac @ [hypreal_add])) 1); |
|
372 qed "hypreal_add_commute"; |
|
373 |
|
374 Goal "((z1::hypreal) + z2) + z3 = z1 + (z2 + z3)"; |
|
375 by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1); |
|
376 by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1); |
|
377 by (res_inst_tac [("z","z3")] eq_Abs_hypreal 1); |
|
378 by (asm_simp_tac (simpset() addsimps [hypreal_add, real_add_assoc]) 1); |
|
379 qed "hypreal_add_assoc"; |
|
380 |
|
381 (*For AC rewriting*) |
|
382 Goal "(x::hypreal)+(y+z)=y+(x+z)"; |
|
383 by (rtac (hypreal_add_commute RS trans) 1); |
|
384 by (rtac (hypreal_add_assoc RS trans) 1); |
|
385 by (rtac (hypreal_add_commute RS arg_cong) 1); |
|
386 qed "hypreal_add_left_commute"; |
|
387 |
|
388 (* hypreal addition is an AC operator *) |
|
389 bind_thms ("hypreal_add_ac", [hypreal_add_assoc,hypreal_add_commute, |
|
390 hypreal_add_left_commute]); |
|
391 |
|
392 Goalw [hypreal_zero_def] "(0::hypreal) + z = z"; |
|
393 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
394 by (asm_full_simp_tac (simpset() addsimps |
|
395 [hypreal_add]) 1); |
|
396 qed "hypreal_add_zero_left"; |
|
397 |
|
398 Goal "z + (0::hypreal) = z"; |
|
399 by (simp_tac (simpset() addsimps |
|
400 [hypreal_add_zero_left,hypreal_add_commute]) 1); |
|
401 qed "hypreal_add_zero_right"; |
|
402 |
|
403 Goalw [hypreal_zero_def] "z + -z = (0::hypreal)"; |
|
404 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
405 by (asm_full_simp_tac (simpset() addsimps [hypreal_minus, hypreal_add]) 1); |
|
406 qed "hypreal_add_minus"; |
|
407 |
|
408 Goal "-z + z = (0::hypreal)"; |
|
409 by (simp_tac (simpset() addsimps [hypreal_add_commute, hypreal_add_minus]) 1); |
|
410 qed "hypreal_add_minus_left"; |
|
411 |
|
412 Addsimps [hypreal_add_minus,hypreal_add_minus_left, |
|
413 hypreal_add_zero_left,hypreal_add_zero_right]; |
|
414 |
|
415 Goal "EX y. (x::hypreal) + y = 0"; |
|
416 by (fast_tac (claset() addIs [hypreal_add_minus]) 1); |
|
417 qed "hypreal_minus_ex"; |
|
418 |
|
419 Goal "EX! y. (x::hypreal) + y = 0"; |
|
420 by (auto_tac (claset() addIs [hypreal_add_minus],simpset())); |
|
421 by (dres_inst_tac [("f","%x. ya+x")] arg_cong 1); |
|
422 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
423 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
|
424 qed "hypreal_minus_ex1"; |
|
425 |
|
426 Goal "EX! y. y + (x::hypreal) = 0"; |
|
427 by (auto_tac (claset() addIs [hypreal_add_minus_left],simpset())); |
|
428 by (dres_inst_tac [("f","%x. x+ya")] arg_cong 1); |
|
429 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc]) 1); |
|
430 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
|
431 qed "hypreal_minus_left_ex1"; |
|
432 |
|
433 Goal "x + y = (0::hypreal) ==> x = -y"; |
|
434 by (cut_inst_tac [("z","y")] hypreal_add_minus_left 1); |
|
435 by (res_inst_tac [("x1","y")] (hypreal_minus_left_ex1 RS ex1E) 1); |
|
436 by (Blast_tac 1); |
|
437 qed "hypreal_add_minus_eq_minus"; |
|
438 |
|
439 Goal "EX y::hypreal. x = -y"; |
|
440 by (cut_inst_tac [("x","x")] hypreal_minus_ex 1); |
|
441 by (etac exE 1 THEN dtac hypreal_add_minus_eq_minus 1); |
|
442 by (Fast_tac 1); |
|
443 qed "hypreal_as_add_inverse_ex"; |
|
444 |
|
445 Goal "-(x + (y::hypreal)) = -x + -y"; |
|
446 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
|
447 by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); |
|
448 by (auto_tac (claset(), |
|
449 simpset() addsimps [hypreal_minus, hypreal_add, |
|
450 real_minus_add_distrib])); |
|
451 qed "hypreal_minus_add_distrib"; |
|
452 Addsimps [hypreal_minus_add_distrib]; |
|
453 |
|
454 Goal "-(y + -(x::hypreal)) = x + -y"; |
|
455 by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
|
456 qed "hypreal_minus_distrib1"; |
|
457 |
|
458 Goal "(x + - (y::hypreal)) + (y + - z) = x + -z"; |
|
459 by (res_inst_tac [("w1","y")] (hypreal_add_commute RS subst) 1); |
|
460 by (simp_tac (simpset() addsimps [hypreal_add_left_commute, |
|
461 hypreal_add_assoc]) 1); |
|
462 by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
|
463 qed "hypreal_add_minus_cancel1"; |
|
464 |
|
465 Goal "((x::hypreal) + y = x + z) = (y = z)"; |
|
466 by (Step_tac 1); |
|
467 by (dres_inst_tac [("f","%t.-x + t")] arg_cong 1); |
|
468 by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
469 qed "hypreal_add_left_cancel"; |
|
470 |
|
471 Goal "z + (x + (y + -z)) = x + (y::hypreal)"; |
|
472 by (simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
473 qed "hypreal_add_minus_cancel2"; |
|
474 Addsimps [hypreal_add_minus_cancel2]; |
|
475 |
|
476 Goal "y + -(x + y) = -(x::hypreal)"; |
|
477 by (Full_simp_tac 1); |
|
478 by (rtac (hypreal_add_left_commute RS subst) 1); |
|
479 by (Full_simp_tac 1); |
|
480 qed "hypreal_add_minus_cancel"; |
|
481 Addsimps [hypreal_add_minus_cancel]; |
|
482 |
|
483 Goal "y + -(y + x) = -(x::hypreal)"; |
|
484 by (simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
485 qed "hypreal_add_minus_cancelc"; |
|
486 Addsimps [hypreal_add_minus_cancelc]; |
|
487 |
|
488 Goal "(z + -x) + (y + -z) = (y + -(x::hypreal))"; |
|
489 by (full_simp_tac |
|
490 (simpset() addsimps [hypreal_minus_add_distrib RS sym, |
|
491 hypreal_add_left_cancel] @ hypreal_add_ac |
|
492 delsimps [hypreal_minus_add_distrib]) 1); |
|
493 qed "hypreal_add_minus_cancel3"; |
|
494 Addsimps [hypreal_add_minus_cancel3]; |
|
495 |
|
496 Goal "(y + (x::hypreal)= z + x) = (y = z)"; |
|
497 by (simp_tac (simpset() addsimps [hypreal_add_commute, |
|
498 hypreal_add_left_cancel]) 1); |
|
499 qed "hypreal_add_right_cancel"; |
|
500 |
|
501 Goal "z + (y + -z) = (y::hypreal)"; |
|
502 by (simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
503 qed "hypreal_add_minus_cancel4"; |
|
504 Addsimps [hypreal_add_minus_cancel4]; |
|
505 |
|
506 Goal "z + (w + (x + (-z + y))) = w + x + (y::hypreal)"; |
|
507 by (simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
508 qed "hypreal_add_minus_cancel5"; |
|
509 Addsimps [hypreal_add_minus_cancel5]; |
|
510 |
|
511 Goal "z + ((- z) + w) = (w::hypreal)"; |
|
512 by (simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
513 qed "hypreal_add_minus_cancelA"; |
|
514 |
|
515 Goal "(-z) + (z + w) = (w::hypreal)"; |
|
516 by (simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
517 qed "hypreal_minus_add_cancelA"; |
|
518 |
|
519 Addsimps [hypreal_add_minus_cancelA, hypreal_minus_add_cancelA]; |
|
520 |
|
521 (**** hyperreal multiplication: hypreal_mult ****) |
|
522 |
|
523 Goalw [congruent2_def] |
|
524 "congruent2 hyprel (%X Y. hyprel^^{%n. X n * Y n})"; |
|
525 by Safe_tac; |
|
526 by (ALLGOALS(Ultra_tac)); |
|
527 qed "hypreal_mult_congruent2"; |
|
528 |
|
529 Goalw [hypreal_mult_def] |
|
530 "Abs_hypreal(hyprel^^{%n. X n}) * Abs_hypreal(hyprel^^{%n. Y n}) = \ |
|
531 \ Abs_hypreal(hyprel^^{%n. X n * Y n})"; |
|
532 by (simp_tac (simpset() addsimps |
|
533 [[equiv_hyprel, hypreal_mult_congruent2] MRS UN_equiv_class2]) 1); |
|
534 qed "hypreal_mult"; |
|
535 |
|
536 Goal "(z::hypreal) * w = w * z"; |
|
537 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
538 by (res_inst_tac [("z","w")] eq_Abs_hypreal 1); |
|
539 by (asm_simp_tac (simpset() addsimps ([hypreal_mult] @ real_mult_ac)) 1); |
|
540 qed "hypreal_mult_commute"; |
|
541 |
|
542 Goal "((z1::hypreal) * z2) * z3 = z1 * (z2 * z3)"; |
|
543 by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1); |
|
544 by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1); |
|
545 by (res_inst_tac [("z","z3")] eq_Abs_hypreal 1); |
|
546 by (asm_simp_tac (simpset() addsimps [hypreal_mult,real_mult_assoc]) 1); |
|
547 qed "hypreal_mult_assoc"; |
|
548 |
|
549 qed_goal "hypreal_mult_left_commute" (the_context ()) |
|
550 "(z1::hypreal) * (z2 * z3) = z2 * (z1 * z3)" |
|
551 (fn _ => [rtac (hypreal_mult_commute RS trans) 1, |
|
552 rtac (hypreal_mult_assoc RS trans) 1, |
|
553 rtac (hypreal_mult_commute RS arg_cong) 1]); |
|
554 |
|
555 (* hypreal multiplication is an AC operator *) |
|
556 bind_thms ("hypreal_mult_ac", [hypreal_mult_assoc, hypreal_mult_commute, |
|
557 hypreal_mult_left_commute]); |
|
558 |
|
559 Goalw [hypreal_one_def] "1hr * z = z"; |
|
560 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
561 by (asm_full_simp_tac (simpset() addsimps [hypreal_mult]) 1); |
|
562 qed "hypreal_mult_1"; |
|
563 |
|
564 Goal "z * 1hr = z"; |
|
565 by (simp_tac (simpset() addsimps [hypreal_mult_commute, |
|
566 hypreal_mult_1]) 1); |
|
567 qed "hypreal_mult_1_right"; |
|
568 |
|
569 Goalw [hypreal_zero_def] "0 * z = (0::hypreal)"; |
|
570 by (res_inst_tac [("z","z")] eq_Abs_hypreal 1); |
|
571 by (asm_full_simp_tac (simpset() addsimps [hypreal_mult,real_mult_0]) 1); |
|
572 qed "hypreal_mult_0"; |
|
573 |
|
574 Goal "z * 0 = (0::hypreal)"; |
|
575 by (simp_tac (simpset() addsimps [hypreal_mult_commute, |
|
576 hypreal_mult_0]) 1); |
|
577 qed "hypreal_mult_0_right"; |
|
578 |
|
579 Addsimps [hypreal_mult_0,hypreal_mult_0_right]; |
|
580 |
|
581 Goal "-(x * y) = -x * (y::hypreal)"; |
|
582 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
|
583 by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); |
|
584 by (auto_tac (claset(), |
|
585 simpset() addsimps [hypreal_minus, hypreal_mult] |
|
586 @ real_mult_ac @ real_add_ac)); |
|
587 qed "hypreal_minus_mult_eq1"; |
|
588 |
|
589 Goal "-(x * y) = (x::hypreal) * -y"; |
|
590 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
|
591 by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); |
|
592 by (auto_tac (claset(),simpset() addsimps [hypreal_minus, |
|
593 hypreal_mult] |
|
594 @ real_mult_ac @ real_add_ac)); |
|
595 qed "hypreal_minus_mult_eq2"; |
|
596 |
|
597 (*Pull negations out*) |
|
598 Addsimps [hypreal_minus_mult_eq2 RS sym, hypreal_minus_mult_eq1 RS sym]; |
|
599 |
|
600 Goal "-x*y = (x::hypreal)*-y"; |
|
601 by Auto_tac; |
|
602 qed "hypreal_minus_mult_commute"; |
|
603 |
|
604 (*----------------------------------------------------------------------------- |
|
605 A few more theorems |
|
606 ----------------------------------------------------------------------------*) |
|
607 Goal "(z::hypreal) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"; |
|
608 by (asm_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1); |
|
609 qed "hypreal_add_assoc_cong"; |
|
610 |
|
611 Goal "(z::hypreal) + (v + w) = v + (z + w)"; |
|
612 by (REPEAT (ares_tac [hypreal_add_commute RS hypreal_add_assoc_cong] 1)); |
|
613 qed "hypreal_add_assoc_swap"; |
|
614 |
|
615 Goal "((z1::hypreal) + z2) * w = (z1 * w) + (z2 * w)"; |
|
616 by (res_inst_tac [("z","z1")] eq_Abs_hypreal 1); |
|
617 by (res_inst_tac [("z","z2")] eq_Abs_hypreal 1); |
|
618 by (res_inst_tac [("z","w")] eq_Abs_hypreal 1); |
|
619 by (asm_simp_tac (simpset() addsimps [hypreal_mult,hypreal_add, |
|
620 real_add_mult_distrib]) 1); |
|
621 qed "hypreal_add_mult_distrib"; |
|
622 |
|
623 val hypreal_mult_commute'= read_instantiate [("z","w")] hypreal_mult_commute; |
|
624 |
|
625 Goal "(w::hypreal) * (z1 + z2) = (w * z1) + (w * z2)"; |
|
626 by (simp_tac (simpset() addsimps [hypreal_mult_commute',hypreal_add_mult_distrib]) 1); |
|
627 qed "hypreal_add_mult_distrib2"; |
|
628 |
|
629 bind_thms ("hypreal_mult_simps", [hypreal_mult_1, hypreal_mult_1_right]); |
|
630 Addsimps hypreal_mult_simps; |
|
631 |
|
632 (* 07/00 *) |
|
633 |
|
634 Goalw [hypreal_diff_def] "((z1::hypreal) - z2) * w = (z1 * w) - (z2 * w)"; |
|
635 by (simp_tac (simpset() addsimps [hypreal_add_mult_distrib]) 1); |
|
636 qed "hypreal_diff_mult_distrib"; |
|
637 |
|
638 Goal "(w::hypreal) * (z1 - z2) = (w * z1) - (w * z2)"; |
|
639 by (simp_tac (simpset() addsimps [hypreal_mult_commute', |
|
640 hypreal_diff_mult_distrib]) 1); |
|
641 qed "hypreal_diff_mult_distrib2"; |
|
642 |
|
643 (*** one and zero are distinct ***) |
|
644 Goalw [hypreal_zero_def,hypreal_one_def] "0 ~= 1hr"; |
|
645 by (auto_tac (claset(),simpset() addsimps [real_zero_not_eq_one])); |
|
646 qed "hypreal_zero_not_eq_one"; |
|
647 |
660 |
648 (*** existence of inverse ***) |
661 (*** existence of inverse ***) |
|
662 |
649 Goalw [hypreal_one_def,hypreal_zero_def] |
663 Goalw [hypreal_one_def,hypreal_zero_def] |
650 "x ~= 0 ==> x*inverse(x) = 1hr"; |
664 "x ~= 0 ==> x*inverse(x) = 1hr"; |
651 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
665 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
652 by (rotate_tac 1 1); |
666 by (rotate_tac 1 1); |
653 by (asm_full_simp_tac (simpset() addsimps [hypreal_inverse, |
667 by (asm_full_simp_tac (simpset() addsimps [hypreal_inverse, hypreal_mult]) 1); |
654 hypreal_mult] addsplits [split_if]) 1); |
|
655 by (dtac FreeUltrafilterNat_Compl_mem 1); |
668 by (dtac FreeUltrafilterNat_Compl_mem 1); |
656 by (blast_tac (claset() addSIs [real_mult_inv_right, |
669 by (blast_tac (claset() addSIs [real_mult_inv_right, |
657 FreeUltrafilterNat_subset]) 1); |
670 FreeUltrafilterNat_subset]) 1); |
658 qed "hypreal_mult_inverse"; |
671 qed "hypreal_mult_inverse"; |
659 |
672 |
660 Goal "x ~= 0 ==> inverse(x)*x = 1hr"; |
673 Goal "x ~= 0 ==> inverse(x)*x = 1hr"; |
661 by (asm_simp_tac (simpset() addsimps [hypreal_mult_inverse, |
674 by (asm_simp_tac (simpset() addsimps [hypreal_mult_inverse, |
662 hypreal_mult_commute]) 1); |
675 hypreal_mult_commute]) 1); |
663 qed "hypreal_mult_inverse_left"; |
676 qed "hypreal_mult_inverse_left"; |
664 |
|
665 Goal "x ~= 0 ==> EX y. x * y = 1hr"; |
|
666 by (fast_tac (claset() addDs [hypreal_mult_inverse]) 1); |
|
667 qed "hypreal_inverse_ex"; |
|
668 |
|
669 Goal "x ~= 0 ==> EX y. y * x = 1hr"; |
|
670 by (fast_tac (claset() addDs [hypreal_mult_inverse_left]) 1); |
|
671 qed "hypreal_inverse_left_ex"; |
|
672 |
|
673 Goal "x ~= 0 ==> EX! y. x * y = 1hr"; |
|
674 by (auto_tac (claset() addIs [hypreal_mult_inverse],simpset())); |
|
675 by (dres_inst_tac [("f","%x. ya*x")] arg_cong 1); |
|
676 by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym]) 1); |
|
677 by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_commute]) 1); |
|
678 qed "hypreal_inverse_ex1"; |
|
679 |
|
680 Goal "x ~= 0 ==> EX! y. y * x = 1hr"; |
|
681 by (auto_tac (claset() addIs [hypreal_mult_inverse_left],simpset())); |
|
682 by (dres_inst_tac [("f","%x. x*ya")] arg_cong 1); |
|
683 by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_assoc]) 1); |
|
684 by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_commute]) 1); |
|
685 qed "hypreal_inverse_left_ex1"; |
|
686 |
|
687 Goal "[| y~= 0; x * y = 1hr |] ==> x = inverse y"; |
|
688 by (forw_inst_tac [("x","y")] hypreal_mult_inverse_left 1); |
|
689 by (res_inst_tac [("x1","y")] (hypreal_inverse_left_ex1 RS ex1E) 1); |
|
690 by (assume_tac 1); |
|
691 by (Blast_tac 1); |
|
692 qed "hypreal_mult_inv_inverse"; |
|
693 |
|
694 Goal "x ~= 0 ==> EX y. x = inverse (y::hypreal)"; |
|
695 by (forw_inst_tac [("x","x")] hypreal_inverse_left_ex 1); |
|
696 by (etac exE 1 THEN |
|
697 forw_inst_tac [("x","y")] hypreal_mult_inv_inverse 1); |
|
698 by (res_inst_tac [("x","y")] exI 2); |
|
699 by Auto_tac; |
|
700 qed "hypreal_as_inverse_ex"; |
|
701 |
677 |
702 Goal "(c::hypreal) ~= 0 ==> (c*a=c*b) = (a=b)"; |
678 Goal "(c::hypreal) ~= 0 ==> (c*a=c*b) = (a=b)"; |
703 by Auto_tac; |
679 by Auto_tac; |
704 by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1); |
680 by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1); |
705 by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_inverse] @ hypreal_mult_ac) 1); |
681 by (asm_full_simp_tac (simpset() addsimps [hypreal_mult_inverse] @ hypreal_mult_ac) 1); |
731 qed "hypreal_mult_not_0"; |
701 qed "hypreal_mult_not_0"; |
732 |
702 |
733 bind_thm ("hypreal_mult_not_0E",hypreal_mult_not_0 RS notE); |
703 bind_thm ("hypreal_mult_not_0E",hypreal_mult_not_0 RS notE); |
734 |
704 |
735 Goal "x*y = (0::hypreal) ==> x = 0 | y = 0"; |
705 Goal "x*y = (0::hypreal) ==> x = 0 | y = 0"; |
736 by (auto_tac (claset() addIs [ccontr] addDs |
706 by (auto_tac (claset() addIs [ccontr] addDs [hypreal_mult_not_0], |
737 [hypreal_mult_not_0],simpset())); |
707 simpset())); |
738 qed "hypreal_mult_zero_disj"; |
708 qed "hypreal_mult_zero_disj"; |
739 |
709 |
740 Goal "x ~= 0 ==> x * x ~= (0::hypreal)"; |
710 Goal "x ~= 0 ==> x * x ~= (0::hypreal)"; |
741 by (blast_tac (claset() addDs [hypreal_mult_not_0]) 1); |
711 by (blast_tac (claset() addDs [hypreal_mult_not_0]) 1); |
742 qed "hypreal_mult_self_not_zero"; |
712 qed "hypreal_mult_self_not_zero"; |
743 |
713 |
744 Goal "[| x ~= 0; y ~= 0 |] ==> inverse(x*y) = inverse(x)*inverse(y::hypreal)"; |
714 Goal "[| x ~= 0; y ~= 0 |] ==> inverse(x*y) = inverse(x)*inverse(y::hypreal)"; |
745 by (res_inst_tac [("c1","x")] (hypreal_mult_left_cancel RS iffD1) 1); |
715 by (res_inst_tac [("c1","x")] (hypreal_mult_left_cancel RS iffD1) 1); |
746 by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc RS sym, |
716 by (auto_tac (claset(), |
747 hypreal_mult_not_0])); |
717 simpset() addsimps [hypreal_mult_assoc RS sym, hypreal_mult_not_0])); |
748 by (res_inst_tac [("c1","y")] (hypreal_mult_right_cancel RS iffD1) 1); |
718 by (res_inst_tac [("c1","y")] (hypreal_mult_right_cancel RS iffD1) 1); |
749 by (auto_tac (claset(),simpset() addsimps [hypreal_mult_not_0] @ hypreal_mult_ac)); |
719 by (auto_tac (claset(), |
750 by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc RS sym,hypreal_mult_not_0])); |
720 simpset() addsimps [hypreal_mult_not_0] @ hypreal_mult_ac)); |
|
721 by (auto_tac (claset(), |
|
722 simpset() addsimps [hypreal_mult_assoc RS sym, hypreal_mult_not_0])); |
751 qed "inverse_mult_eq"; |
723 qed "inverse_mult_eq"; |
752 |
724 |
753 Goal "x ~= 0 ==> inverse(-x) = -inverse(x::hypreal)"; |
725 Goal "inverse(-x) = -inverse(x::hypreal)"; |
|
726 by (hypreal_div_undefined_case_tac "x=0" 1); |
754 by (rtac (hypreal_mult_right_cancel RS iffD1) 1); |
727 by (rtac (hypreal_mult_right_cancel RS iffD1) 1); |
755 by (stac hypreal_mult_inverse_left 2); |
728 by (stac hypreal_mult_inverse_left 2); |
756 by Auto_tac; |
729 by Auto_tac; |
757 qed "hypreal_minus_inverse"; |
730 qed "hypreal_minus_inverse"; |
758 |
731 |
759 Goal "[| x ~= 0; y ~= 0 |] \ |
732 Goal "inverse(x*y) = inverse(x)*inverse(y::hypreal)"; |
760 \ ==> inverse(x*y) = inverse(x)*inverse(y::hypreal)"; |
733 by (hypreal_div_undefined_case_tac "x=0" 1); |
|
734 by (hypreal_div_undefined_case_tac "y=0" 1); |
761 by (forw_inst_tac [("y","y")] hypreal_mult_not_0 1 THEN assume_tac 1); |
735 by (forw_inst_tac [("y","y")] hypreal_mult_not_0 1 THEN assume_tac 1); |
762 by (res_inst_tac [("c1","x")] (hypreal_mult_left_cancel RS iffD1) 1); |
736 by (res_inst_tac [("c1","x")] (hypreal_mult_left_cancel RS iffD1) 1); |
763 by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc RS sym])); |
737 by (auto_tac (claset(), simpset() addsimps [hypreal_mult_assoc RS sym])); |
764 by (res_inst_tac [("c1","y")] (hypreal_mult_left_cancel RS iffD1) 1); |
738 by (res_inst_tac [("c1","y")] (hypreal_mult_left_cancel RS iffD1) 1); |
765 by (auto_tac (claset(),simpset() addsimps [hypreal_mult_left_commute])); |
739 by (auto_tac (claset(), simpset() addsimps [hypreal_mult_left_commute])); |
766 by (asm_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym]) 1); |
740 by (asm_simp_tac (simpset() addsimps [hypreal_mult_assoc RS sym]) 1); |
767 qed "hypreal_inverse_distrib"; |
741 qed "hypreal_inverse_distrib"; |
768 |
742 |
769 (*------------------------------------------------------------------ |
743 (*------------------------------------------------------------------ |
770 Theorems for ordering |
744 Theorems for ordering |
1138 |
1111 |
1139 Goalw [hypreal_of_real_def] "hypreal_of_real (-r) = - hypreal_of_real r"; |
1112 Goalw [hypreal_of_real_def] "hypreal_of_real (-r) = - hypreal_of_real r"; |
1140 by (auto_tac (claset(),simpset() addsimps [hypreal_minus])); |
1113 by (auto_tac (claset(),simpset() addsimps [hypreal_minus])); |
1141 qed "hypreal_of_real_minus"; |
1114 qed "hypreal_of_real_minus"; |
1142 |
1115 |
|
1116 (*DON'T insert this or the next one as default simprules. |
|
1117 They are used in both orientations and anyway aren't the ones we finally |
|
1118 need, which would use binary literals.*) |
1143 Goalw [hypreal_of_real_def,hypreal_one_def] "hypreal_of_real #1 = 1hr"; |
1119 Goalw [hypreal_of_real_def,hypreal_one_def] "hypreal_of_real #1 = 1hr"; |
1144 by (Step_tac 1); |
1120 by (Step_tac 1); |
1145 qed "hypreal_of_real_one"; |
1121 qed "hypreal_of_real_one"; |
1146 |
1122 |
1147 Goalw [hypreal_of_real_def,hypreal_zero_def] "hypreal_of_real #0 = 0"; |
1123 Goalw [hypreal_of_real_def,hypreal_zero_def] "hypreal_of_real #0 = 0"; |
1148 by (Step_tac 1); |
1124 by (Step_tac 1); |
1149 qed "hypreal_of_real_zero"; |
1125 qed "hypreal_of_real_zero"; |
1150 |
1126 |
1151 Goal "(hypreal_of_real r = 0) = (r = #0)"; |
1127 Goal "(hypreal_of_real r = 0) = (r = #0)"; |
1152 by (auto_tac (claset() addIs [FreeUltrafilterNat_P], |
1128 by (auto_tac (claset() addIs [FreeUltrafilterNat_P], |
1153 simpset() addsimps [hypreal_of_real_def, |
1129 simpset() addsimps [hypreal_of_real_def, |
1154 hypreal_zero_def,FreeUltrafilterNat_Nat_set])); |
1130 hypreal_zero_def,FreeUltrafilterNat_Nat_set])); |
1155 qed "hypreal_of_real_zero_iff"; |
1131 qed "hypreal_of_real_zero_iff"; |
1156 |
1132 |
1157 Goal "(hypreal_of_real r ~= 0) = (r ~= #0)"; |
1133 (*FIXME: delete*) |
|
1134 Goal "(hypreal_of_real r ~= 0) = (r ~= #0)"; |
1158 by (full_simp_tac (simpset() addsimps [hypreal_of_real_zero_iff]) 1); |
1135 by (full_simp_tac (simpset() addsimps [hypreal_of_real_zero_iff]) 1); |
1159 qed "hypreal_of_real_not_zero_iff"; |
1136 qed "hypreal_of_real_not_zero_iff"; |
1160 |
1137 |
1161 Goal "r ~= #0 ==> inverse (hypreal_of_real r) = \ |
1138 Goal "inverse (hypreal_of_real r) = hypreal_of_real (inverse r)"; |
1162 \ hypreal_of_real (inverse r)"; |
1139 by (case_tac "r=#0" 1); |
1163 by (res_inst_tac [("c1","hypreal_of_real r")] (hypreal_mult_left_cancel RS iffD1) 1); |
1140 by (asm_simp_tac (simpset() addsimps [REAL_DIVIDE_ZERO, INVERSE_ZERO, |
|
1141 HYPREAL_INVERSE_ZERO, hypreal_of_real_zero]) 1); |
|
1142 by (res_inst_tac [("c1","hypreal_of_real r")] |
|
1143 (hypreal_mult_left_cancel RS iffD1) 1); |
1164 by (etac (hypreal_of_real_not_zero_iff RS iffD2) 1); |
1144 by (etac (hypreal_of_real_not_zero_iff RS iffD2) 1); |
1165 by (forward_tac [hypreal_of_real_not_zero_iff RS iffD2] 1); |
1145 by (forward_tac [hypreal_of_real_not_zero_iff RS iffD2] 1); |
1166 by (auto_tac (claset(),simpset() addsimps [hypreal_of_real_mult RS sym,hypreal_of_real_one])); |
1146 by (auto_tac (claset(), |
|
1147 simpset() addsimps [hypreal_of_real_one, hypreal_of_real_mult RS sym])); |
1167 qed "hypreal_of_real_inverse"; |
1148 qed "hypreal_of_real_inverse"; |
1168 |
|
1169 Goal "hypreal_of_real r ~= 0 ==> inverse (hypreal_of_real r) = \ |
|
1170 \ hypreal_of_real (inverse r)"; |
|
1171 by (etac (hypreal_of_real_not_zero_iff RS iffD1 RS hypreal_of_real_inverse) 1); |
|
1172 qed "hypreal_of_real_inverse2"; |
|
1173 |
1149 |
1174 Goal "x+x=x*(1hr+1hr)"; |
1150 Goal "x+x=x*(1hr+1hr)"; |
1175 by (simp_tac (simpset() addsimps [hypreal_add_mult_distrib2]) 1); |
1151 by (simp_tac (simpset() addsimps [hypreal_add_mult_distrib2]) 1); |
1176 qed "hypreal_add_self"; |
1152 qed "hypreal_add_self"; |
1177 |
1153 |
|
1154 (*FIXME: DELETE (used in Lim.ML) *) |
1178 Goal "(z::hypreal) ~= 0 ==> x*y = (x*inverse(z))*(z*y)"; |
1155 Goal "(z::hypreal) ~= 0 ==> x*y = (x*inverse(z))*(z*y)"; |
1179 by (asm_simp_tac (simpset() addsimps hypreal_mult_ac) 1); |
1156 by (asm_simp_tac (simpset() addsimps hypreal_mult_ac) 1); |
1180 qed "lemma_chain"; |
1157 qed "lemma_chain"; |
1181 |
1158 |
1182 Goal "[|(x::hypreal) ~= 0; y ~= 0 |] ==> \ |
1159 Goal "[|(x::hypreal) ~= 0; y ~= 0 |] ==> \ |