author | wenzelm |
Sun, 10 Mar 2002 21:46:27 +0100 | |
changeset 13053 | 68ffc262c766 |
parent 12843 | 50bd380e6675 |
child 13757 | 33b84d172c97 |
permissions | -rw-r--r-- |
10603 | 1 |
(* ID: $Id$ *) |
10764 | 2 |
theory Numbers = Real: |
10603 | 3 |
|
4 |
ML "Pretty.setmargin 64" |
|
10777 | 5 |
ML "IsarOutput.indent := 0" (*we don't want 5 for listing theorems*) |
10603 | 6 |
|
7 |
text{* |
|
8 |
||
9 |
numeric literals; default simprules; can re-orient |
|
10 |
*} |
|
11 |
||
11711 | 12 |
lemma "2 * m = m + m" |
10880 | 13 |
txt{* |
14 |
@{subgoals[display,indent=0,margin=65]} |
|
15 |
*}; |
|
10603 | 16 |
oops |
17 |
||
10880 | 18 |
consts h :: "nat \<Rightarrow> nat" |
19 |
recdef h "{}" |
|
11711 | 20 |
"h i = (if i = 3 then 2 else i)" |
10880 | 21 |
|
10603 | 22 |
text{* |
11711 | 23 |
@{term"h 3 = 2"} |
10880 | 24 |
@{term"h i = i"} |
25 |
*} |
|
10603 | 26 |
|
10880 | 27 |
text{* |
10603 | 28 |
@{thm[display] numeral_0_eq_0[no_vars]} |
29 |
\rulename{numeral_0_eq_0} |
|
30 |
||
31 |
@{thm[display] numeral_1_eq_1[no_vars]} |
|
32 |
\rulename{numeral_1_eq_1} |
|
33 |
||
34 |
@{thm[display] add_2_eq_Suc[no_vars]} |
|
35 |
\rulename{add_2_eq_Suc} |
|
36 |
||
37 |
@{thm[display] add_2_eq_Suc'[no_vars]} |
|
38 |
\rulename{add_2_eq_Suc'} |
|
39 |
||
40 |
@{thm[display] add_assoc[no_vars]} |
|
41 |
\rulename{add_assoc} |
|
42 |
||
43 |
@{thm[display] add_commute[no_vars]} |
|
44 |
\rulename{add_commute} |
|
45 |
||
46 |
@{thm[display] add_left_commute[no_vars]} |
|
47 |
\rulename{add_left_commute} |
|
48 |
||
49 |
these form add_ac; similarly there is mult_ac |
|
50 |
*} |
|
51 |
||
52 |
lemma "Suc(i + j*l*k + m*n) = f (n*m + i + k*j*l)" |
|
10880 | 53 |
txt{* |
54 |
@{subgoals[display,indent=0,margin=65]} |
|
55 |
*}; |
|
10603 | 56 |
apply (simp add: add_ac mult_ac) |
10880 | 57 |
txt{* |
58 |
@{subgoals[display,indent=0,margin=65]} |
|
59 |
*}; |
|
10603 | 60 |
oops |
61 |
||
62 |
text{* |
|
63 |
@{thm[display] mult_le_mono[no_vars]} |
|
64 |
\rulename{mult_le_mono} |
|
65 |
||
66 |
@{thm[display] mult_less_mono1[no_vars]} |
|
67 |
\rulename{mult_less_mono1} |
|
68 |
||
69 |
@{thm[display] div_le_mono[no_vars]} |
|
70 |
\rulename{div_le_mono} |
|
71 |
||
72 |
@{thm[display] add_mult_distrib[no_vars]} |
|
73 |
\rulename{add_mult_distrib} |
|
74 |
||
75 |
@{thm[display] diff_mult_distrib[no_vars]} |
|
76 |
\rulename{diff_mult_distrib} |
|
77 |
||
78 |
@{thm[display] mod_mult_distrib[no_vars]} |
|
79 |
\rulename{mod_mult_distrib} |
|
80 |
||
81 |
@{thm[display] nat_diff_split[no_vars]} |
|
82 |
\rulename{nat_diff_split} |
|
83 |
*} |
|
84 |
||
85 |
||
12156
d2758965362e
new-style numerals without leading #, along with generic 0 and 1
paulson
parents:
11711
diff
changeset
|
86 |
lemma "(n - 1) * (n + 1) = n * n - (1::nat)" |
12843
50bd380e6675
iff del: less_Suc0 -- luckily this does NOT affect the printed text;
wenzelm
parents:
12156
diff
changeset
|
87 |
apply (clarsimp split: nat_diff_split iff del: less_Suc0) |
12156
d2758965362e
new-style numerals without leading #, along with generic 0 and 1
paulson
parents:
11711
diff
changeset
|
88 |
--{* @{subgoals[display,indent=0,margin=65]} *} |
d2758965362e
new-style numerals without leading #, along with generic 0 and 1
paulson
parents:
11711
diff
changeset
|
89 |
apply (subgoal_tac "n=0", force, arith) |
d2758965362e
new-style numerals without leading #, along with generic 0 and 1
paulson
parents:
11711
diff
changeset
|
90 |
done |
d2758965362e
new-style numerals without leading #, along with generic 0 and 1
paulson
parents:
11711
diff
changeset
|
91 |
|
d2758965362e
new-style numerals without leading #, along with generic 0 and 1
paulson
parents:
11711
diff
changeset
|
92 |
|
11711 | 93 |
lemma "(n - 2) * (n + 2) = n * n - (4::nat)" |
12156
d2758965362e
new-style numerals without leading #, along with generic 0 and 1
paulson
parents:
11711
diff
changeset
|
94 |
apply (simp split: nat_diff_split, clarify) |
11480 | 95 |
--{* @{subgoals[display,indent=0,margin=65]} *} |
96 |
apply (subgoal_tac "n=0 | n=1", force, arith) |
|
10603 | 97 |
done |
98 |
||
99 |
text{* |
|
100 |
@{thm[display] mod_if[no_vars]} |
|
101 |
\rulename{mod_if} |
|
102 |
||
103 |
@{thm[display] mod_div_equality[no_vars]} |
|
104 |
\rulename{mod_div_equality} |
|
105 |
||
106 |
||
107 |
@{thm[display] div_mult1_eq[no_vars]} |
|
108 |
\rulename{div_mult1_eq} |
|
109 |
||
110 |
@{thm[display] mod_mult1_eq[no_vars]} |
|
111 |
\rulename{mod_mult1_eq} |
|
112 |
||
113 |
@{thm[display] div_mult2_eq[no_vars]} |
|
114 |
\rulename{div_mult2_eq} |
|
115 |
||
116 |
@{thm[display] mod_mult2_eq[no_vars]} |
|
117 |
\rulename{mod_mult2_eq} |
|
118 |
||
119 |
@{thm[display] div_mult_mult1[no_vars]} |
|
120 |
\rulename{div_mult_mult1} |
|
121 |
||
122 |
@{thm[display] DIVISION_BY_ZERO_DIV[no_vars]} |
|
123 |
\rulename{DIVISION_BY_ZERO_DIV} |
|
124 |
||
125 |
@{thm[display] DIVISION_BY_ZERO_MOD[no_vars]} |
|
126 |
\rulename{DIVISION_BY_ZERO_MOD} |
|
127 |
||
128 |
@{thm[display] dvd_anti_sym[no_vars]} |
|
129 |
\rulename{dvd_anti_sym} |
|
130 |
||
131 |
@{thm[display] dvd_add[no_vars]} |
|
132 |
\rulename{dvd_add} |
|
133 |
||
134 |
For the integers, I'd list a few theorems that somehow involve negative |
|
135 |
numbers. |
|
136 |
||
137 |
Division, remainder of negatives |
|
138 |
||
139 |
||
140 |
@{thm[display] pos_mod_sign[no_vars]} |
|
141 |
\rulename{pos_mod_sign} |
|
142 |
||
143 |
@{thm[display] pos_mod_bound[no_vars]} |
|
144 |
\rulename{pos_mod_bound} |
|
145 |
||
146 |
@{thm[display] neg_mod_sign[no_vars]} |
|
147 |
\rulename{neg_mod_sign} |
|
148 |
||
149 |
@{thm[display] neg_mod_bound[no_vars]} |
|
150 |
\rulename{neg_mod_bound} |
|
151 |
||
152 |
@{thm[display] zdiv_zadd1_eq[no_vars]} |
|
153 |
\rulename{zdiv_zadd1_eq} |
|
154 |
||
155 |
@{thm[display] zmod_zadd1_eq[no_vars]} |
|
156 |
\rulename{zmod_zadd1_eq} |
|
157 |
||
158 |
@{thm[display] zdiv_zmult1_eq[no_vars]} |
|
159 |
\rulename{zdiv_zmult1_eq} |
|
160 |
||
161 |
@{thm[display] zmod_zmult1_eq[no_vars]} |
|
162 |
\rulename{zmod_zmult1_eq} |
|
163 |
||
164 |
@{thm[display] zdiv_zmult2_eq[no_vars]} |
|
165 |
\rulename{zdiv_zmult2_eq} |
|
166 |
||
167 |
@{thm[display] zmod_zmult2_eq[no_vars]} |
|
168 |
\rulename{zmod_zmult2_eq} |
|
169 |
||
170 |
@{thm[display] abs_mult[no_vars]} |
|
171 |
\rulename{abs_mult} |
|
172 |
*} |
|
173 |
||
11174 | 174 |
lemma "abs (x+y) \<le> abs x + abs (y :: int)" |
10880 | 175 |
by arith |
176 |
||
11711 | 177 |
lemma "abs (2*x) = 2 * abs (x :: int)" |
11174 | 178 |
by (simp add: zabs_def) |
179 |
||
10764 | 180 |
text {*REALS |
181 |
||
182 |
@{thm[display] realpow_abs[no_vars]} |
|
183 |
\rulename{realpow_abs} |
|
184 |
||
185 |
@{thm[display] real_dense[no_vars]} |
|
186 |
\rulename{real_dense} |
|
10603 | 187 |
|
188 |
@{thm[display] realpow_abs[no_vars]} |
|
189 |
\rulename{realpow_abs} |
|
190 |
||
10764 | 191 |
@{thm[display] real_times_divide1_eq[no_vars]} |
192 |
\rulename{real_times_divide1_eq} |
|
193 |
||
194 |
@{thm[display] real_times_divide2_eq[no_vars]} |
|
195 |
\rulename{real_times_divide2_eq} |
|
196 |
||
197 |
@{thm[display] real_divide_divide1_eq[no_vars]} |
|
198 |
\rulename{real_divide_divide1_eq} |
|
199 |
||
200 |
@{thm[display] real_divide_divide2_eq[no_vars]} |
|
201 |
\rulename{real_divide_divide2_eq} |
|
202 |
||
203 |
@{thm[display] real_minus_divide_eq[no_vars]} |
|
204 |
\rulename{real_minus_divide_eq} |
|
205 |
||
206 |
@{thm[display] real_divide_minus_eq[no_vars]} |
|
207 |
\rulename{real_divide_minus_eq} |
|
208 |
||
209 |
This last NOT a simprule |
|
210 |
||
10777 | 211 |
@{thm[display] real_add_divide_distrib[no_vars]} |
212 |
\rulename{real_add_divide_distrib} |
|
10764 | 213 |
*} |
10603 | 214 |
|
11711 | 215 |
lemma "3/4 < (7/8 :: real)" |
11174 | 216 |
by simp |
217 |
||
11711 | 218 |
lemma "P ((3/4) * (8/15 :: real))" |
11174 | 219 |
txt{* |
220 |
@{subgoals[display,indent=0,margin=65]} |
|
221 |
*}; |
|
222 |
apply simp |
|
223 |
txt{* |
|
224 |
@{subgoals[display,indent=0,margin=65]} |
|
225 |
*}; |
|
226 |
oops |
|
227 |
||
11711 | 228 |
lemma "(3/4) * (8/15) < (x :: real)" |
11174 | 229 |
txt{* |
230 |
@{subgoals[display,indent=0,margin=65]} |
|
231 |
*}; |
|
232 |
apply simp |
|
233 |
txt{* |
|
234 |
@{subgoals[display,indent=0,margin=65]} |
|
235 |
*}; |
|
236 |
oops |
|
237 |
||
11711 | 238 |
lemma "(3/4) * (10^15) < (x :: real)" |
11174 | 239 |
apply simp |
240 |
oops |
|
241 |
||
242 |
||
243 |
||
10603 | 244 |
end |