src/HOL/Hyperreal/HyperOrd.ML
author wenzelm
Wed, 05 Dec 2001 03:13:57 +0100
changeset 12378 86c58273f8c0
parent 12018 ec054019c910
child 14268 5cf13e80be0e
permissions -rw-r--r--
removed bang_args;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     1
(*  Title:	 Real/Hyperreal/HyperOrd.ML
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     2
    Author:      Jacques D. Fleuriot
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     3
    Copyright:   1998 University of Cambridge
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     4
                 2000 University of Edinburgh
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     5
    Description: Type "hypreal" is a linear order and also 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     6
                 satisfies plus_ac0: + is an AC-operator with zero
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     7
*)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     8
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     9
(**** The simproc abel_cancel ****)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    10
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    11
(*** Two lemmas needed for the simprocs ***)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    12
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    13
(*Deletion of other terms in the formula, seeking the -x at the front of z*)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    14
Goal "((x::hypreal) + (y + z) = y + u) = ((x + z) = u)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    15
by (stac hypreal_add_left_commute 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    16
by (rtac hypreal_add_left_cancel 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    17
qed "hypreal_add_cancel_21";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    18
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    19
(*A further rule to deal with the case that
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    20
  everything gets cancelled on the right.*)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    21
Goal "((x::hypreal) + (y + z) = y) = (x = -z)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    22
by (stac hypreal_add_left_commute 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    23
by (res_inst_tac [("t", "y")] (hypreal_add_zero_right RS subst) 1
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    24
    THEN stac hypreal_add_left_cancel 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    25
by (simp_tac (simpset() addsimps [hypreal_eq_diff_eq RS sym]) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    26
qed "hypreal_add_cancel_end";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    27
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    28
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    29
structure Hyperreal_Cancel_Data =
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    30
struct
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    31
  val ss		= HOL_ss
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    32
  val eq_reflection	= eq_reflection
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    33
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    34
  val sg_ref		= Sign.self_ref (Theory.sign_of (the_context ()))
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    35
  val T			= Type("HyperDef.hypreal",[])
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    36
  val zero		= Const ("0", T)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    37
  val restrict_to_left  = restrict_to_left
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    38
  val add_cancel_21	= hypreal_add_cancel_21
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    39
  val add_cancel_end	= hypreal_add_cancel_end
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    40
  val add_left_cancel	= hypreal_add_left_cancel
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    41
  val add_assoc		= hypreal_add_assoc
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    42
  val add_commute	= hypreal_add_commute
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    43
  val add_left_commute	= hypreal_add_left_commute
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    44
  val add_0		= hypreal_add_zero_left
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    45
  val add_0_right	= hypreal_add_zero_right
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    46
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    47
  val eq_diff_eq	= hypreal_eq_diff_eq
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    48
  val eqI_rules		= [hypreal_less_eqI, hypreal_eq_eqI, hypreal_le_eqI]
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    49
  fun dest_eqI th = 
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10919
diff changeset
    50
      #1 (HOLogic.dest_bin "op =" HOLogic.boolT
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    51
	      (HOLogic.dest_Trueprop (concl_of th)))
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    52
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    53
  val diff_def		= hypreal_diff_def
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    54
  val minus_add_distrib	= hypreal_minus_add_distrib
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    55
  val minus_minus	= hypreal_minus_minus
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    56
  val minus_0		= hypreal_minus_zero
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    57
  val add_inverses	= [hypreal_add_minus, hypreal_add_minus_left]
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    58
  val cancel_simps	= [hypreal_add_minus_cancelA, hypreal_minus_add_cancelA]
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    59
end;
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    60
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    61
structure Hyperreal_Cancel = Abel_Cancel (Hyperreal_Cancel_Data);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    62
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    63
Addsimprocs [Hyperreal_Cancel.sum_conv, Hyperreal_Cancel.rel_conv];
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    64
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    65
Goal "- (z - y) = y - (z::hypreal)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    66
by (Simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    67
qed "hypreal_minus_diff_eq";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    68
Addsimps [hypreal_minus_diff_eq];
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    69
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    70
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    71
Goal "((x::hypreal) < y) = (-y < -x)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    72
by (stac hypreal_less_minus_iff 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    73
by (res_inst_tac [("x1","x")] (hypreal_less_minus_iff RS ssubst) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    74
by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    75
qed "hypreal_less_swap_iff";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    76
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    77
Goalw [hypreal_zero_def] 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    78
      "((0::hypreal) < x) = (-x < x)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    79
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    80
by (auto_tac (claset(), simpset() addsimps [hypreal_less, hypreal_minus]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    81
by (ALLGOALS(Ultra_tac));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    82
qed "hypreal_gt_zero_iff";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    83
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    84
Goal "(A::hypreal) < B ==> A + C < B + C";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    85
by (res_inst_tac [("z","A")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    86
by (res_inst_tac [("z","B")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    87
by (res_inst_tac [("z","C")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    88
by (auto_tac (claset() addSIs [exI], 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    89
              simpset() addsimps [hypreal_less_def,hypreal_add]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    90
by (Ultra_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    91
qed "hypreal_add_less_mono1";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    92
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    93
Goal "!!(A::hypreal). A < B ==> C + A < C + B";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    94
by (auto_tac (claset() addIs [hypreal_add_less_mono1],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    95
    simpset() addsimps [hypreal_add_commute]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    96
qed "hypreal_add_less_mono2";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    97
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    98
Goal "(x < (0::hypreal)) = (x < -x)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    99
by (rtac (hypreal_minus_zero_less_iff RS subst) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   100
by (stac hypreal_gt_zero_iff 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   101
by (Full_simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   102
qed "hypreal_lt_zero_iff";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   103
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   104
Goalw [hypreal_zero_def] "[| 0 < x; 0 < y |] ==> (0::hypreal) < x + y";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   105
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   106
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   107
by (auto_tac (claset(),
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   108
              simpset() addsimps [hypreal_less_def,hypreal_add]));
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   109
by (auto_tac (claset() addSIs [exI],
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   110
              simpset() addsimps [hypreal_less_def,hypreal_add]));
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   111
by (ultra_tac (claset() addIs [real_add_order], simpset()) 1);
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   112
qed "hypreal_add_order";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   113
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   114
Goal "[| 0 < x; 0 <= y |] ==> (0::hypreal) < x + y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   115
by (auto_tac (claset() addDs [sym, order_le_imp_less_or_eq]
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   116
                       addIs [hypreal_add_order],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   117
              simpset()));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   118
qed "hypreal_add_order_le";            
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   119
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   120
Goalw [hypreal_zero_def] "[| 0 < x; 0 < y |] ==> (0::hypreal) < x * y";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   121
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   122
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   123
by (auto_tac (claset() addSIs [exI],
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   124
              simpset() addsimps [hypreal_less_def,hypreal_mult]));
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   125
by (ultra_tac (claset() addIs [real_mult_order], simpset()) 1);
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   126
qed "hypreal_mult_order";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   127
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   128
Goal "[| x < 0; y < 0 |] ==> (0::hypreal) < x * y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   129
by (REPEAT(dtac (hypreal_minus_zero_less_iff RS iffD2) 1));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   130
by (dtac hypreal_mult_order 1 THEN assume_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   131
by (Asm_full_simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   132
qed "hypreal_mult_less_zero1";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   133
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   134
Goal "[| 0 < x; y < 0 |] ==> x*y < (0::hypreal)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   135
by (dtac (hypreal_minus_zero_less_iff RS iffD2) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   136
by (dtac hypreal_mult_order 1 THEN assume_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   137
by (rtac (hypreal_minus_zero_less_iff RS iffD1) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   138
by (Asm_full_simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   139
qed "hypreal_mult_less_zero";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   140
11713
883d559b0b8c sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents: 11701
diff changeset
   141
Goalw [hypreal_one_def,hypreal_zero_def,hypreal_less_def] "0 < (1::hypreal)";
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   142
by (res_inst_tac [("x","%n. 0")] exI 1);
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   143
by (res_inst_tac [("x","%n. 1")] exI 1);
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   144
by (auto_tac (claset(),
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   145
        simpset() addsimps [real_zero_less_one, FreeUltrafilterNat_Nat_set]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   146
qed "hypreal_zero_less_one";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   147
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   148
Goal "[| 0 <= x; 0 <= y |] ==> (0::hypreal) <= x + y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   149
by (REPEAT(dtac order_le_imp_less_or_eq 1));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   150
by (auto_tac (claset() addIs [hypreal_add_order, order_less_imp_le],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   151
              simpset()));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   152
qed "hypreal_le_add_order";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   153
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   154
(*** Monotonicity results ***)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   155
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   156
Goal "(v+z < w+z) = (v < (w::hypreal))";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   157
by (Simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   158
qed "hypreal_add_right_cancel_less";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   159
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   160
Goal "(z+v < z+w) = (v < (w::hypreal))";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   161
by (Simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   162
qed "hypreal_add_left_cancel_less";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   163
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   164
Addsimps [hypreal_add_right_cancel_less, 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   165
          hypreal_add_left_cancel_less];
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   166
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   167
Goal "(v+z <= w+z) = (v <= (w::hypreal))";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   168
by (Simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   169
qed "hypreal_add_right_cancel_le";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   170
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   171
Goal "(z+v <= z+w) = (v <= (w::hypreal))";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   172
by (Simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   173
qed "hypreal_add_left_cancel_le";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   174
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   175
Addsimps [hypreal_add_right_cancel_le, hypreal_add_left_cancel_le];
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   176
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   177
Goal  "[| (z1::hypreal) < y1; z2 < y2 |] ==> z1 + z2 < y1 + y2";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   178
by (dtac (hypreal_less_minus_iff RS iffD1) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   179
by (dtac (hypreal_less_minus_iff RS iffD1) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   180
by (dtac hypreal_add_order 1 THEN assume_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   181
by (thin_tac "0 < y2 + - z2" 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   182
by (dres_inst_tac [("C","z1 + z2")] hypreal_add_less_mono1 1);
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   183
by (auto_tac (claset(),
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   184
      simpset() addsimps [hypreal_minus_add_distrib RS sym] @ hypreal_add_ac
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   185
                delsimps [hypreal_minus_add_distrib]));
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   186
qed "hypreal_add_less_mono";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   187
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   188
Goal "(q1::hypreal) <= q2  ==> x + q1 <= x + q2";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   189
by (dtac order_le_imp_less_or_eq 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   190
by (Step_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   191
by (auto_tac (claset() addSIs [order_less_imp_le,hypreal_add_less_mono1],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   192
              simpset() addsimps [hypreal_add_commute]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   193
qed "hypreal_add_left_le_mono1";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   194
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   195
Goal "(q1::hypreal) <= q2  ==> q1 + x <= q2 + x";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   196
by (auto_tac (claset() addDs [hypreal_add_left_le_mono1],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   197
              simpset() addsimps [hypreal_add_commute]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   198
qed "hypreal_add_le_mono1";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   199
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   200
Goal "[|(i::hypreal)<=j;  k<=l |] ==> i + k <= j + l";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   201
by (etac (hypreal_add_le_mono1 RS order_trans) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   202
by (Simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   203
qed "hypreal_add_le_mono";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   204
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   205
Goal "[|(i::hypreal)<j;  k<=l |] ==> i + k < j + l";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   206
by (auto_tac (claset() addSDs [order_le_imp_less_or_eq] 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   207
                       addIs [hypreal_add_less_mono1,hypreal_add_less_mono],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   208
    simpset()));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   209
qed "hypreal_add_less_le_mono";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   210
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   211
Goal "[|(i::hypreal)<=j;  k<l |] ==> i + k < j + l";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   212
by (auto_tac (claset() addSDs [order_le_imp_less_or_eq] 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   213
                       addIs [hypreal_add_less_mono2,hypreal_add_less_mono],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   214
              simpset()));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   215
qed "hypreal_add_le_less_mono";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   216
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   217
Goal "(A::hypreal) + C < B + C ==> A < B";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   218
by (Full_simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   219
qed "hypreal_less_add_right_cancel";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   220
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   221
Goal "(C::hypreal) + A < C + B ==> A < B";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   222
by (Full_simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   223
qed "hypreal_less_add_left_cancel";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   224
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   225
Goal "[|r < x; (0::hypreal) <= y|] ==> r < x + y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   226
by (auto_tac (claset() addDs [hypreal_add_less_le_mono],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   227
    simpset()));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   228
qed "hypreal_add_zero_less_le_mono";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   229
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   230
Goal "!!(A::hypreal). A + C <= B + C ==> A <= B";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   231
by (dres_inst_tac [("x","-C")] hypreal_add_le_mono1 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   232
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc]) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   233
qed "hypreal_le_add_right_cancel";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   234
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   235
Goal "!!(A::hypreal). C + A <= C + B ==> A <= B";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   236
by (dres_inst_tac [("x","-C")] hypreal_add_left_le_mono1 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   237
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_assoc RS sym]) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   238
qed "hypreal_le_add_left_cancel";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   239
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   240
Goal "(0::hypreal) <= x*x";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   241
by (res_inst_tac [("x","0"),("y","x")] hypreal_linear_less2 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   242
by (auto_tac (claset() addIs [hypreal_mult_order,
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   243
                              hypreal_mult_less_zero1,order_less_imp_le],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   244
              simpset()));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   245
qed "hypreal_le_square";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   246
Addsimps [hypreal_le_square];
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   247
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   248
Goalw [hypreal_le_def] "- (x*x) <= (0::hypreal)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   249
by (auto_tac (claset() addSDs [hypreal_le_square RS order_le_less_trans],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   250
      simpset() addsimps [hypreal_minus_zero_less_iff]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   251
qed "hypreal_less_minus_square";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   252
Addsimps [hypreal_less_minus_square];
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   253
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   254
Goal "(0*x<r)=((0::hypreal)<r)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   255
by (Simp_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   256
qed "hypreal_mult_0_less";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   257
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   258
Goal "[| (0::hypreal) < z; x < y |] ==> x*z < y*z";       
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   259
by (rotate_tac 1 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   260
by (dtac (hypreal_less_minus_iff RS iffD1) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   261
by (rtac (hypreal_less_minus_iff RS iffD2) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   262
by (dtac hypreal_mult_order 1 THEN assume_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   263
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_mult_distrib2,
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   264
					   hypreal_mult_commute ]) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   265
qed "hypreal_mult_less_mono1";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   266
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   267
Goal "[| (0::hypreal)<z; x<y |] ==> z*x<z*y";       
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   268
by (asm_simp_tac (simpset() addsimps [hypreal_mult_commute,hypreal_mult_less_mono1]) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   269
qed "hypreal_mult_less_mono2";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   270
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   271
Goal "[| (0::hypreal)<=z; x<y |] ==> x*z<=y*z";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   272
by (EVERY1 [rtac hypreal_less_or_eq_imp_le, dtac order_le_imp_less_or_eq]);
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   273
by (auto_tac (claset() addIs [hypreal_mult_less_mono1], simpset()));
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   274
qed "hypreal_mult_le_less_mono1";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   275
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   276
Goal "[| (0::hypreal)<=z; x<y |] ==> z*x<=z*y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   277
by (asm_simp_tac (simpset() addsimps [hypreal_mult_commute,
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   278
				      hypreal_mult_le_less_mono1]) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   279
qed "hypreal_mult_le_less_mono2";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   280
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   281
val prem1::prem2::prem3::rest = goal thy
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   282
     "[| (0::hypreal)<y; x<r; y*r<t*s |] ==> y*x<t*s";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   283
by (rtac ([[prem1,prem2] MRS hypreal_mult_less_mono2, prem3] 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   284
          MRS order_less_trans) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   285
qed "hypreal_mult_less_trans";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   286
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   287
Goal "[| 0<=y; x<r; y*r<t*s; (0::hypreal)<t*s|] ==> y*x<t*s";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   288
by (dtac order_le_imp_less_or_eq 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   289
by (fast_tac (HOL_cs addEs [hypreal_mult_0_less RS iffD2,
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   290
                            hypreal_mult_less_trans]) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   291
qed "hypreal_mult_le_less_trans";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   292
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   293
Goal "[| 0 <= y; x <= r; y*r < t*s; (0::hypreal) < t*s|] ==> y*x < t*s";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   294
by (dres_inst_tac [("x","x")] order_le_imp_less_or_eq 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   295
by (fast_tac (claset() addIs [hypreal_mult_le_less_trans]) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   296
qed "hypreal_mult_le_le_trans";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   297
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   298
Goal "[| u<v;  x<y;  (0::hypreal) < v;  0 < x |] ==> u*x < v* y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   299
by (etac (hypreal_mult_less_mono1 RS order_less_trans) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   300
by (assume_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   301
by (etac hypreal_mult_less_mono2 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   302
by (assume_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   303
qed "hypreal_mult_less_mono";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   304
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   305
(*UNUSED at present but possibly more useful than hypreal_mult_less_mono*)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   306
Goal "[| x < y;  r1 < r2;  (0::hypreal) <= r1;  0 <= x|] ==> r1 * x < r2 * y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   307
by (subgoal_tac "0<r2" 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   308
by (blast_tac (claset() addIs [order_le_less_trans]) 2); 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   309
by (case_tac "x=0" 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   310
by (auto_tac (claset() addSDs [order_le_imp_less_or_eq] 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   311
	               addIs [hypreal_mult_less_mono, hypreal_mult_order],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   312
	      simpset()));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   313
qed "hypreal_mult_less_mono'";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   314
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   315
Goal "0 < x ==> 0 < inverse (x::hypreal)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   316
by (EVERY1[rtac ccontr, dtac hypreal_leI]);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   317
by (forward_tac [hypreal_minus_zero_less_iff2 RS iffD2] 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   318
by (forward_tac [hypreal_not_refl2 RS not_sym] 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   319
by (dtac (hypreal_not_refl2 RS not_sym RS hypreal_inverse_not_zero) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   320
by (EVERY1[dtac order_le_imp_less_or_eq, Step_tac]); 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   321
by (dtac hypreal_mult_less_zero1 1 THEN assume_tac 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   322
by (auto_tac (claset() addIs [hypreal_zero_less_one RS hypreal_less_asym],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   323
                 simpset() addsimps [hypreal_minus_zero_less_iff]));
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   324
qed "hypreal_inverse_gt_0";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   325
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   326
Goal "x < 0 ==> inverse (x::hypreal) < 0";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   327
by (ftac hypreal_not_refl2 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   328
by (dtac (hypreal_minus_zero_less_iff RS iffD2) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   329
by (rtac (hypreal_minus_zero_less_iff RS iffD1) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   330
by (stac (hypreal_minus_inverse RS sym) 1);
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   331
by (auto_tac (claset() addIs [hypreal_inverse_gt_0],  simpset()));
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   332
qed "hypreal_inverse_less_0";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   333
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   334
Goal "(x::hypreal)*x <= x*x + y*y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   335
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   336
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   337
by (auto_tac (claset(),
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   338
              simpset() addsimps [hypreal_mult,hypreal_add,hypreal_le]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   339
qed "hypreal_self_le_add_pos";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   340
Addsimps [hypreal_self_le_add_pos];
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   341
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   342
(*lcp: new lemma unfortunately needed...*)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   343
Goal "-(x*x) <= (y*y::real)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   344
by (rtac order_trans 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   345
by (rtac real_le_square 2);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   346
by Auto_tac;
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   347
qed "minus_square_le_square";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   348
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   349
Goal "(x::hypreal)*x <= x*x + y*y + z*z";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   350
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   351
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   352
by (res_inst_tac [("z","z")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   353
by (auto_tac (claset(),
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   354
	      simpset() addsimps [hypreal_mult, hypreal_add, hypreal_le,
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   355
				  minus_square_le_square]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   356
qed "hypreal_self_le_add_pos2";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   357
Addsimps [hypreal_self_le_add_pos2];
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   358
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   359
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   360
(*----------------------------------------------------------------------------
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   361
               Existence of infinite hyperreal number
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   362
 ----------------------------------------------------------------------------*)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   363
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   364
Goalw [omega_def] "Rep_hypreal(omega) : hypreal";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   365
by (rtac Rep_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   366
qed "Rep_hypreal_omega";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   367
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   368
(* existence of infinite number not corresponding to any real number *)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   369
(* use assumption that member FreeUltrafilterNat is not finite       *)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   370
(* a few lemmas first *)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   371
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   372
Goal "{n::nat. x = real n} = {} | \
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   373
\     (EX y. {n::nat. x = real n} = {y})";
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   374
by (auto_tac (claset() addDs [inj_real_of_nat RS injD], simpset()));
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   375
qed "lemma_omega_empty_singleton_disj";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   376
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   377
Goal "finite {n::nat. x = real n}";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   378
by (cut_inst_tac [("x","x")] lemma_omega_empty_singleton_disj 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   379
by Auto_tac;
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   380
qed "lemma_finite_omega_set";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   381
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   382
Goalw [omega_def,hypreal_of_real_def] 
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   383
      "~ (EX x. hypreal_of_real x = omega)";
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   384
by (auto_tac (claset(),
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   385
    simpset() addsimps [real_of_nat_Suc, real_diff_eq_eq RS sym, 
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   386
                    lemma_finite_omega_set RS FreeUltrafilterNat_finite]));
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   387
qed "not_ex_hypreal_of_real_eq_omega";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   388
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   389
Goal "hypreal_of_real x ~= omega";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   390
by (cut_facts_tac [not_ex_hypreal_of_real_eq_omega] 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   391
by Auto_tac;
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   392
qed "hypreal_of_real_not_eq_omega";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   393
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   394
(* existence of infinitesimal number also not *)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   395
(* corresponding to any real number *)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   396
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   397
Goal "inverse (real (x::nat)) = inverse (real y) ==> x = y";
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   398
by (rtac (inj_real_of_nat RS injD) 1);
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   399
by (Asm_full_simp_tac 1); 
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   400
qed "real_of_nat_inverse_inj";
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   401
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   402
Goal "{n::nat. x = inverse(real(Suc n))} = {} | \
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   403
\     (EX y. {n::nat. x = inverse(real(Suc n))} = {y})";
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   404
by (auto_tac (claset(), simpset() addsimps [inj_real_of_nat RS inj_eq]));
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   405
qed "lemma_epsilon_empty_singleton_disj";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   406
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   407
Goal "finite {n. x = inverse(real(Suc n))}";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   408
by (cut_inst_tac [("x","x")] lemma_epsilon_empty_singleton_disj 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   409
by Auto_tac;
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   410
qed "lemma_finite_epsilon_set";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   411
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   412
Goalw [epsilon_def,hypreal_of_real_def] 
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   413
      "~ (EX x. hypreal_of_real x = epsilon)";
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   414
by (auto_tac (claset(),
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   415
  simpset() addsimps [lemma_finite_epsilon_set RS FreeUltrafilterNat_finite]));
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   416
qed "not_ex_hypreal_of_real_eq_epsilon";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   417
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   418
Goal "hypreal_of_real x ~= epsilon";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   419
by (cut_facts_tac [not_ex_hypreal_of_real_eq_epsilon] 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   420
by Auto_tac;
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   421
qed "hypreal_of_real_not_eq_epsilon";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   422
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   423
Goalw [epsilon_def,hypreal_zero_def] "epsilon ~= 0";
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   424
by Auto_tac;  
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   425
by (auto_tac (claset(),
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   426
     simpset() addsimps [real_of_nat_Suc_gt_zero RS real_not_refl2 RS not_sym]));
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   427
qed "hypreal_epsilon_not_zero";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   428
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10784
diff changeset
   429
Goal "epsilon = inverse(omega)";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   430
by (asm_full_simp_tac (simpset() addsimps 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   431
                     [hypreal_inverse, omega_def, epsilon_def]) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   432
qed "hypreal_epsilon_inverse_omega";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   433
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   434
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   435
(* this proof is so much simpler than one for reals!! *)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   436
Goal "[| 0 < r; r < x |] ==> inverse x < inverse (r::hypreal)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   437
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   438
by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   439
by (auto_tac (claset(),
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   440
      simpset() addsimps [hypreal_inverse, hypreal_less,hypreal_zero_def]));
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   441
by (ultra_tac (claset() addIs [real_inverse_less_swap], simpset()) 1);
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   442
qed "hypreal_inverse_less_swap";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   443
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   444
Goal "[| 0 < r; 0 < x|] ==> (r < x) = (inverse x < inverse (r::hypreal))";
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10751
diff changeset
   445
by (auto_tac (claset() addIs [hypreal_inverse_less_swap], simpset()));
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   446
by (res_inst_tac [("t","r")] (hypreal_inverse_inverse RS subst) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   447
by (res_inst_tac [("t","x")] (hypreal_inverse_inverse RS subst) 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   448
by (rtac hypreal_inverse_less_swap 1);
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   449
by (auto_tac (claset(), simpset() addsimps [hypreal_inverse_gt_0]));
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   450
qed "hypreal_inverse_less_iff";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   451
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   452
Goal "[| 0 < z; x < y |] ==> x * inverse z < y * inverse (z::hypreal)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   453
by (blast_tac (claset() addSIs [hypreal_mult_less_mono1,
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   454
                                hypreal_inverse_gt_0]) 1);
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   455
qed "hypreal_mult_inverse_less_mono1";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   456
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   457
Goal "[| 0 < z; x < y |] ==> inverse z * x < inverse (z::hypreal) * y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   458
by (blast_tac (claset() addSIs [hypreal_mult_less_mono2,
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   459
                                hypreal_inverse_gt_0]) 1);
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   460
qed "hypreal_mult_inverse_less_mono2";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   461
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   462
Goal "[| (0::hypreal) < z; x*z < y*z |] ==> x < y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   463
by (forw_inst_tac [("x","x*z")] hypreal_mult_inverse_less_mono1 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   464
by (dtac (hypreal_not_refl2 RS not_sym) 2);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   465
by (auto_tac (claset() addSDs [hypreal_mult_inverse],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   466
              simpset() addsimps hypreal_mult_ac));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   467
qed "hypreal_less_mult_right_cancel";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   468
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   469
Goal "[| (0::hypreal) < z; z*x < z*y |] ==> x < y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   470
by (auto_tac (claset() addIs [hypreal_less_mult_right_cancel],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   471
    simpset() addsimps [hypreal_mult_commute]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   472
qed "hypreal_less_mult_left_cancel";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   473
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   474
Goal "[| 0 < r; (0::hypreal) < ra; r < x; ra < y |] ==> r*ra < x*y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   475
by (forw_inst_tac [("y","r")] order_less_trans 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   476
by (dres_inst_tac [("z","ra"),("x","r")] hypreal_mult_less_mono1 2);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   477
by (dres_inst_tac [("z","x"),("x","ra")] hypreal_mult_less_mono2 3);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   478
by (auto_tac (claset() addIs [order_less_trans], simpset()));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   479
qed "hypreal_mult_less_gt_zero"; 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   480
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   481
Goal "[| 0 < r; (0::hypreal) < ra; r <= x; ra <= y |] ==> r*ra <= x*y";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   482
by (REPEAT(dtac order_le_imp_less_or_eq 1));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   483
by (rtac hypreal_less_or_eq_imp_le 1);
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   484
by (auto_tac (claset() addIs [hypreal_mult_less_mono1,
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   485
                         hypreal_mult_less_mono2,hypreal_mult_less_gt_zero],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   486
    simpset()));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   487
qed "hypreal_mult_le_ge_zero"; 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   488
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   489
(*----------------------------------------------------------------------------
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   490
     Some convenient biconditionals for products of signs 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   491
 ----------------------------------------------------------------------------*)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   492
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   493
Goal "((0::hypreal) < x*y) = (0 < x & 0 < y | x < 0 & y < 0)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   494
 by (auto_tac (claset(), 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   495
               simpset() addsimps [order_le_less, linorder_not_less, 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   496
                              hypreal_mult_order, hypreal_mult_less_zero1]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   497
by (ALLGOALS (rtac ccontr)); 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   498
by (auto_tac (claset(), 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   499
              simpset() addsimps [order_le_less, linorder_not_less]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   500
by (ALLGOALS (etac rev_mp)); 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   501
by (ALLGOALS (dtac hypreal_mult_less_zero THEN' assume_tac));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   502
by (auto_tac (claset() addDs [order_less_not_sym], 
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   503
              simpset() addsimps [hypreal_mult_commute]));  
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   504
qed "hypreal_0_less_mult_iff";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   505
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   506
Goal "((0::hypreal) <= x*y) = (0 <= x & 0 <= y | x <= 0 & y <= 0)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   507
by (auto_tac (claset() addDs [hypreal_mult_zero_disj],
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   508
              simpset() addsimps [order_le_less, linorder_not_less,
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   509
                                  hypreal_0_less_mult_iff]));
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   510
qed "hypreal_0_le_mult_iff";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   511
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   512
Goal "(x*y < (0::hypreal)) = (0 < x & y < 0 | x < 0 & 0 < y)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   513
by (auto_tac (claset(), 
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   514
              simpset() addsimps [hypreal_0_le_mult_iff, 
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   515
                                  linorder_not_le RS sym]));
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   516
by (auto_tac (claset() addDs [order_less_not_sym],  
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   517
              simpset() addsimps [linorder_not_le]));
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   518
qed "hypreal_mult_less_0_iff";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   519
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   520
Goal "(x*y <= (0::hypreal)) = (0 <= x & y <= 0 | x <= 0 & 0 <= y)";
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   521
by (auto_tac (claset() addDs [order_less_not_sym], 
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   522
              simpset() addsimps [hypreal_0_less_mult_iff, 
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   523
                                  linorder_not_less RS sym]));
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
   524
qed "hypreal_mult_le_0_iff";
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   525