7292
|
1 |
(* Title: RealInt.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Jacques D. Fleuriot
|
|
4 |
Copyright: 1999 University of Edinburgh
|
|
5 |
Description: Embedding the integers in the reals
|
|
6 |
*)
|
|
7 |
|
|
8 |
|
|
9 |
Goalw [congruent_def]
|
|
10 |
"congruent intrel (%p. split (%i j. realrel ^^ \
|
|
11 |
\ {(preal_of_prat (prat_of_pnat (pnat_of_nat i)), \
|
|
12 |
\ preal_of_prat (prat_of_pnat (pnat_of_nat j)))}) p)";
|
|
13 |
by (auto_tac (claset(),simpset() addsimps [pnat_of_nat_add,
|
|
14 |
prat_of_pnat_add RS sym,preal_of_prat_add RS sym]));
|
|
15 |
qed "real_of_int_congruent";
|
|
16 |
|
|
17 |
val real_of_int_ize = RSLIST [equiv_intrel, real_of_int_congruent];
|
|
18 |
|
|
19 |
Goalw [real_of_int_def]
|
|
20 |
"real_of_int (Abs_Integ (intrel ^^ {(i, j)})) = \
|
|
21 |
\ Abs_real(realrel ^^ \
|
|
22 |
\ {(preal_of_prat (prat_of_pnat (pnat_of_nat i)), \
|
|
23 |
\ preal_of_prat (prat_of_pnat (pnat_of_nat j)))})";
|
|
24 |
by (res_inst_tac [("f","Abs_real")] arg_cong 1);
|
|
25 |
by (simp_tac (simpset() addsimps
|
|
26 |
[realrel_in_real RS Abs_real_inverse,
|
|
27 |
real_of_int_ize UN_equiv_class]) 1);
|
|
28 |
qed "real_of_int";
|
|
29 |
|
|
30 |
Goal "inj(real_of_int)";
|
|
31 |
by (rtac injI 1);
|
|
32 |
by (res_inst_tac [("z","x")] eq_Abs_Integ 1);
|
|
33 |
by (res_inst_tac [("z","y")] eq_Abs_Integ 1);
|
|
34 |
by (auto_tac (claset() addSDs [inj_preal_of_prat RS injD,
|
|
35 |
inj_prat_of_pnat RS injD,inj_pnat_of_nat RS injD],
|
|
36 |
simpset() addsimps [real_of_int,preal_of_prat_add RS sym,
|
|
37 |
prat_of_pnat_add RS sym,pnat_of_nat_add]));
|
|
38 |
qed "inj_real_of_int";
|
|
39 |
|
|
40 |
Goalw [int_def,real_zero_def] "real_of_int (int 0) = 0r";
|
|
41 |
by (simp_tac (simpset() addsimps [real_of_int, preal_add_commute]) 1);
|
|
42 |
qed "real_of_int_zero";
|
|
43 |
|
|
44 |
Goalw [int_def,real_one_def] "real_of_int (int 1) = 1r";
|
|
45 |
by (auto_tac (claset(),
|
|
46 |
simpset() addsimps [real_of_int,
|
|
47 |
preal_of_prat_add RS sym,pnat_two_eq,
|
|
48 |
prat_of_pnat_add RS sym,pnat_one_iff RS sym]));
|
|
49 |
qed "real_of_int_one";
|
|
50 |
|
|
51 |
Goal "real_of_int x + real_of_int y = real_of_int (x + y)";
|
|
52 |
by (res_inst_tac [("z","x")] eq_Abs_Integ 1);
|
|
53 |
by (res_inst_tac [("z","y")] eq_Abs_Integ 1);
|
|
54 |
by (auto_tac (claset(),simpset() addsimps [real_of_int,
|
|
55 |
preal_of_prat_add RS sym,prat_of_pnat_add RS sym,
|
|
56 |
zadd,real_add,pnat_of_nat_add] @ pnat_add_ac));
|
|
57 |
qed "real_of_int_add";
|
|
58 |
|
|
59 |
Goal "-real_of_int x = real_of_int (-x)";
|
|
60 |
by (res_inst_tac [("z","x")] eq_Abs_Integ 1);
|
|
61 |
by (auto_tac (claset(),simpset() addsimps [real_of_int,
|
|
62 |
real_minus,zminus]));
|
|
63 |
qed "real_of_int_minus";
|
|
64 |
|
|
65 |
Goalw [zdiff_def,real_diff_def]
|
|
66 |
"real_of_int x - real_of_int y = real_of_int (x - y)";
|
|
67 |
by (simp_tac (simpset() addsimps [real_of_int_add,
|
|
68 |
real_of_int_minus]) 1);
|
|
69 |
qed "real_of_int_diff";
|
|
70 |
|
|
71 |
Goal "real_of_int x * real_of_int y = real_of_int (x * y)";
|
|
72 |
by (res_inst_tac [("z","x")] eq_Abs_Integ 1);
|
|
73 |
by (res_inst_tac [("z","y")] eq_Abs_Integ 1);
|
|
74 |
by (auto_tac (claset(),simpset() addsimps [real_of_int,
|
|
75 |
real_mult,zmult,preal_of_prat_mult RS sym,pnat_of_nat_mult,
|
|
76 |
prat_of_pnat_mult RS sym,preal_of_prat_add RS sym,
|
|
77 |
prat_of_pnat_add RS sym,pnat_of_nat_add] @ mult_ac @add_ac
|
|
78 |
@ pnat_add_ac));
|
|
79 |
qed "real_of_int_mult";
|
|
80 |
|
|
81 |
Goal "real_of_int (int (Suc n)) = real_of_int (int n) + 1r";
|
|
82 |
by (simp_tac (simpset() addsimps [real_of_int_one RS sym,
|
|
83 |
real_of_int_add,zadd_int]) 1);
|
|
84 |
qed "real_of_int_Suc";
|
|
85 |
|
|
86 |
(* relating two of the embeddings *)
|
|
87 |
Goal "real_of_int (int n) = real_of_nat n";
|
|
88 |
by (induct_tac "n" 1);
|
|
89 |
by (auto_tac (claset(),simpset() addsimps [real_of_int_zero,
|
|
90 |
real_of_nat_zero,real_of_int_Suc,real_of_nat_Suc]));
|
|
91 |
qed "real_of_int_real_of_nat";
|
|
92 |
|
|
93 |
Goal "~neg z ==> real_of_nat (nat z) = real_of_int z";
|
|
94 |
by (asm_simp_tac (simpset() addsimps [not_neg_nat,
|
|
95 |
real_of_int_real_of_nat RS sym]) 1);
|
|
96 |
qed "real_of_nat_real_of_int";
|
|
97 |
|
|
98 |
(* put with other properties of real_of_nat? *)
|
|
99 |
Goal "neg z ==> real_of_nat (nat z) = 0r";
|
|
100 |
by (asm_simp_tac (simpset() addsimps [neg_nat,
|
|
101 |
real_of_nat_zero]) 1);
|
|
102 |
qed "real_of_nat_neg_int";
|
|
103 |
Addsimps [real_of_nat_neg_int];
|
|
104 |
|
|
105 |
Goal "(real_of_int x = 0r) = (x = int 0)";
|
|
106 |
by (auto_tac (claset() addIs [inj_real_of_int RS injD],
|
|
107 |
simpset() addsimps [real_of_int_zero]));
|
|
108 |
qed "real_of_int_zero_cancel";
|
|
109 |
Addsimps [real_of_int_zero_cancel];
|
|
110 |
|
|
111 |
Goal "real_of_int x < real_of_int y ==> x < y";
|
|
112 |
by (rtac ccontr 1 THEN dtac (linorder_not_less RS iffD1) 1);
|
|
113 |
by (auto_tac (claset(),
|
|
114 |
simpset() addsimps [zle_iff_zadd, real_of_int_add RS sym,
|
|
115 |
real_of_int_real_of_nat,
|
|
116 |
real_of_nat_zero RS sym]));
|
|
117 |
qed "real_of_int_less_cancel";
|
|
118 |
|
|
119 |
Goal "x < y ==> (real_of_int x < real_of_int y)";
|
|
120 |
by (auto_tac (claset(),
|
|
121 |
simpset() addsimps [zless_iff_Suc_zadd, real_of_int_add RS sym,
|
|
122 |
real_of_int_real_of_nat,
|
|
123 |
real_of_nat_Suc]));
|
|
124 |
by (simp_tac (simpset() addsimps [real_of_nat_one RS
|
|
125 |
sym,real_of_nat_zero RS sym,real_of_nat_add]) 1);
|
|
126 |
qed "real_of_int_less_mono";
|
|
127 |
|
|
128 |
Goal "(real_of_int x < real_of_int y) = (x < y)";
|
|
129 |
by (auto_tac (claset() addIs [real_of_int_less_cancel,
|
|
130 |
real_of_int_less_mono],
|
|
131 |
simpset()));
|
|
132 |
qed "real_of_int_less_iff";
|
|
133 |
Addsimps [real_of_int_less_iff];
|
|
134 |
|
|
135 |
Goal "(real_of_int x <= real_of_int y) = (x <= y)";
|
|
136 |
by (auto_tac (claset(),
|
|
137 |
simpset() addsimps [real_le_def, zle_def]));
|
|
138 |
qed "real_of_int_le_iff";
|
|
139 |
Addsimps [real_of_int_le_iff];
|
|
140 |
|
|
141 |
Goal "(real_of_int x = real_of_int y) = (x = y)";
|
|
142 |
by (auto_tac (claset() addSIs [order_antisym],
|
|
143 |
simpset() addsimps [real_of_int_le_iff RS iffD1]));
|
|
144 |
qed "real_of_int_eq_iff";
|
|
145 |
Addsimps [real_of_int_eq_iff];
|