equal
deleted
inserted
replaced
203 |
203 |
204 (**** nat: magnitide of an integer, as a natural number ****) |
204 (**** nat: magnitide of an integer, as a natural number ****) |
205 |
205 |
206 Goalw [nat_def] "nat(int n) = n"; |
206 Goalw [nat_def] "nat(int n) = n"; |
207 by Auto_tac; |
207 by Auto_tac; |
208 qed "nat_nat"; |
208 qed "nat_int"; |
209 |
209 |
210 Goalw [nat_def] "nat(- int n) = 0"; |
210 Goalw [nat_def] "nat(- int n) = 0"; |
211 by (auto_tac (claset(), |
211 by (auto_tac (claset(), |
212 simpset() addsimps [neg_eq_less_int0, zminus_zless])); |
212 simpset() addsimps [neg_eq_less_int0, zminus_zless])); |
213 qed "nat_zminus_nat"; |
213 qed "nat_zminus_int"; |
214 |
214 |
215 Addsimps [nat_nat, nat_zminus_nat]; |
215 Addsimps [nat_int, nat_zminus_int]; |
216 |
216 |
217 Goal "~ neg z ==> int (nat z) = z"; |
217 Goal "~ neg z ==> int (nat z) = z"; |
218 by (dtac (not_neg_eq_ge_int0 RS iffD1) 1); |
218 by (dtac (not_neg_eq_ge_int0 RS iffD1) 1); |
219 by (dtac zle_imp_zless_or_eq 1); |
219 by (dtac zle_imp_zless_or_eq 1); |
220 by (auto_tac (claset(), simpset() addsimps [zless_iff_Suc_zadd])); |
220 by (auto_tac (claset(), simpset() addsimps [zless_iff_Suc_zadd])); |
243 |
243 |
244 Goal "z <= int 0 ==> nat z = 0"; |
244 Goal "z <= int 0 ==> nat z = 0"; |
245 by (auto_tac (claset(), |
245 by (auto_tac (claset(), |
246 simpset() addsimps [order_le_less, neg_eq_less_int0, |
246 simpset() addsimps [order_le_less, neg_eq_less_int0, |
247 zle_def, neg_nat])); |
247 zle_def, neg_nat])); |
248 qed "nat_le_0"; |
248 qed "nat_le_int0"; |
249 |
249 |
250 Goal "(nat w < nat z) = (int 0 < z & w < z)"; |
250 Goal "(nat w < nat z) = (int 0 < z & w < z)"; |
251 by (case_tac "int 0 < z" 1); |
251 by (case_tac "int 0 < z" 1); |
252 by (auto_tac (claset(), |
252 by (auto_tac (claset(), |
253 simpset() addsimps [lemma, nat_le_0, linorder_not_less])); |
253 simpset() addsimps [lemma, nat_le_int0, linorder_not_less])); |
254 qed "zless_nat_conj"; |
254 qed "zless_nat_conj"; |
255 |
255 |
256 |
256 |
257 (* a case theorem distinguishing non-negative and negative int *) |
257 (* a case theorem distinguishing non-negative and negative int *) |
258 |
258 |