7 |
7 |
8 header{*Defining the Reals from the Positive Reals*} |
8 header{*Defining the Reals from the Positive Reals*} |
9 |
9 |
10 theory RealDef |
10 theory RealDef |
11 imports PReal |
11 imports PReal |
12 uses ("Tools/real_arith.ML") |
|
13 begin |
12 begin |
14 |
13 |
15 definition |
14 definition |
16 realrel :: "((preal * preal) * (preal * preal)) set" where |
15 realrel :: "((preal * preal) * (preal * preal)) set" where |
17 [code del]: "realrel = {p. \<exists>x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) & x1+y2 = x2+y1}" |
16 [code del]: "realrel = {p. \<exists>x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) & x1+y2 = x2+y1}" |
958 lemma real_of_nat_number_of [simp]: |
957 lemma real_of_nat_number_of [simp]: |
959 "real (number_of v :: nat) = |
958 "real (number_of v :: nat) = |
960 (if neg (number_of v :: int) then 0 |
959 (if neg (number_of v :: int) then 0 |
961 else (number_of v :: real))" |
960 else (number_of v :: real))" |
962 by (simp add: real_of_int_real_of_nat [symmetric] int_nat_number_of) |
961 by (simp add: real_of_int_real_of_nat [symmetric] int_nat_number_of) |
963 |
962 |
964 |
963 declaration {* |
965 use "Tools/real_arith.ML" |
964 K (Lin_Arith.add_inj_thms [@{thm real_of_nat_le_iff} RS iffD2, @{thm real_of_nat_inject} RS iffD2] |
966 declaration {* K real_arith_setup *} |
965 (* not needed because x < (y::nat) can be rewritten as Suc x <= y: real_of_nat_less_iff RS iffD2 *) |
|
966 #> Lin_Arith.add_inj_thms [@{thm real_of_int_le_iff} RS iffD2, @{thm real_of_int_inject} RS iffD2] |
|
967 (* not needed because x < (y::int) can be rewritten as x + 1 <= y: real_of_int_less_iff RS iffD2 *) |
|
968 #> Lin_Arith.add_simps [@{thm real_of_nat_zero}, @{thm real_of_nat_Suc}, @{thm real_of_nat_add}, |
|
969 @{thm real_of_nat_mult}, @{thm real_of_int_zero}, @{thm real_of_one}, |
|
970 @{thm real_of_int_add}, @{thm real_of_int_minus}, @{thm real_of_int_diff}, |
|
971 @{thm real_of_int_mult}, @{thm real_of_int_of_nat_eq}, |
|
972 @{thm real_of_nat_number_of}, @{thm real_number_of}] |
|
973 #> Lin_Arith.add_inj_const (@{const_name real}, HOLogic.natT --> HOLogic.realT) |
|
974 #> Lin_Arith.add_inj_const (@{const_name real}, HOLogic.intT --> HOLogic.realT)) |
|
975 *} |
967 |
976 |
968 |
977 |
969 subsection{* Simprules combining x+y and 0: ARE THEY NEEDED?*} |
978 subsection{* Simprules combining x+y and 0: ARE THEY NEEDED?*} |
970 |
979 |
971 text{*Needed in this non-standard form by Hyperreal/Transcendental*} |
980 text{*Needed in this non-standard form by Hyperreal/Transcendental*} |