equal
deleted
inserted
replaced
1260 [code del]: "Ints = range of_int" |
1260 [code del]: "Ints = range of_int" |
1261 |
1261 |
1262 notation (xsymbols) |
1262 notation (xsymbols) |
1263 Ints ("\<int>") |
1263 Ints ("\<int>") |
1264 |
1264 |
|
1265 lemma Ints_of_int [simp]: "of_int z \<in> \<int>" |
|
1266 by (simp add: Ints_def) |
|
1267 |
|
1268 lemma Ints_of_nat [simp]: "of_nat n \<in> \<int>" |
|
1269 apply (simp add: Ints_def) |
|
1270 apply (rule range_eqI) |
|
1271 apply (rule of_int_of_nat_eq [symmetric]) |
|
1272 done |
|
1273 |
1265 lemma Ints_0 [simp]: "0 \<in> \<int>" |
1274 lemma Ints_0 [simp]: "0 \<in> \<int>" |
1266 apply (simp add: Ints_def) |
1275 apply (simp add: Ints_def) |
1267 apply (rule range_eqI) |
1276 apply (rule range_eqI) |
1268 apply (rule of_int_0 [symmetric]) |
1277 apply (rule of_int_0 [symmetric]) |
1269 done |
1278 done |
1284 apply (auto simp add: Ints_def) |
1293 apply (auto simp add: Ints_def) |
1285 apply (rule range_eqI) |
1294 apply (rule range_eqI) |
1286 apply (rule of_int_minus [symmetric]) |
1295 apply (rule of_int_minus [symmetric]) |
1287 done |
1296 done |
1288 |
1297 |
|
1298 lemma Ints_diff [simp]: "a \<in> \<int> \<Longrightarrow> b \<in> \<int> \<Longrightarrow> a - b \<in> \<int>" |
|
1299 apply (auto simp add: Ints_def) |
|
1300 apply (rule range_eqI) |
|
1301 apply (rule of_int_diff [symmetric]) |
|
1302 done |
|
1303 |
1289 lemma Ints_mult [simp]: "a \<in> \<int> \<Longrightarrow> b \<in> \<int> \<Longrightarrow> a * b \<in> \<int>" |
1304 lemma Ints_mult [simp]: "a \<in> \<int> \<Longrightarrow> b \<in> \<int> \<Longrightarrow> a * b \<in> \<int>" |
1290 apply (auto simp add: Ints_def) |
1305 apply (auto simp add: Ints_def) |
1291 apply (rule range_eqI) |
1306 apply (rule range_eqI) |
1292 apply (rule of_int_mult [symmetric]) |
1307 apply (rule of_int_mult [symmetric]) |
1293 done |
1308 done |
|
1309 |
|
1310 lemma Ints_power [simp]: "a \<in> \<int> \<Longrightarrow> a ^ n \<in> \<int>" |
|
1311 by (induct n) simp_all |
1294 |
1312 |
1295 lemma Ints_cases [cases set: Ints]: |
1313 lemma Ints_cases [cases set: Ints]: |
1296 assumes "q \<in> \<int>" |
1314 assumes "q \<in> \<int>" |
1297 obtains (of_int) z where "q = of_int z" |
1315 obtains (of_int) z where "q = of_int z" |
1298 unfolding Ints_def |
1316 unfolding Ints_def |
1305 lemma Ints_induct [case_names of_int, induct set: Ints]: |
1323 lemma Ints_induct [case_names of_int, induct set: Ints]: |
1306 "q \<in> \<int> \<Longrightarrow> (\<And>z. P (of_int z)) \<Longrightarrow> P q" |
1324 "q \<in> \<int> \<Longrightarrow> (\<And>z. P (of_int z)) \<Longrightarrow> P q" |
1307 by (rule Ints_cases) auto |
1325 by (rule Ints_cases) auto |
1308 |
1326 |
1309 end |
1327 end |
1310 |
|
1311 lemma Ints_diff [simp]: "a \<in> \<int> \<Longrightarrow> b \<in> \<int> \<Longrightarrow> a-b \<in> \<int>" |
|
1312 apply (auto simp add: Ints_def) |
|
1313 apply (rule range_eqI) |
|
1314 apply (rule of_int_diff [symmetric]) |
|
1315 done |
|
1316 |
1328 |
1317 text {* The premise involving @{term Ints} prevents @{term "a = 1/2"}. *} |
1329 text {* The premise involving @{term Ints} prevents @{term "a = 1/2"}. *} |
1318 |
1330 |
1319 lemma Ints_double_eq_0_iff: |
1331 lemma Ints_double_eq_0_iff: |
1320 assumes in_Ints: "a \<in> Ints" |
1332 assumes in_Ints: "a \<in> Ints" |
1348 hence "1 + z + z = 0" by (simp only: of_int_eq_iff) |
1360 hence "1 + z + z = 0" by (simp only: of_int_eq_iff) |
1349 with odd_nonzero show False by blast |
1361 with odd_nonzero show False by blast |
1350 qed |
1362 qed |
1351 qed |
1363 qed |
1352 |
1364 |
1353 lemma Ints_number_of: |
1365 lemma Ints_number_of [simp]: |
1354 "(number_of w :: 'a::number_ring) \<in> Ints" |
1366 "(number_of w :: 'a::number_ring) \<in> Ints" |
1355 unfolding number_of_eq Ints_def by simp |
1367 unfolding number_of_eq Ints_def by simp |
|
1368 |
|
1369 lemma Nats_number_of [simp]: |
|
1370 "Int.Pls \<le> w \<Longrightarrow> (number_of w :: 'a::number_ring) \<in> Nats" |
|
1371 unfolding Int.Pls_def number_of_eq |
|
1372 by (simp only: of_nat_nat [symmetric] of_nat_in_Nats) |
1356 |
1373 |
1357 lemma Ints_odd_less_0: |
1374 lemma Ints_odd_less_0: |
1358 assumes in_Ints: "a \<in> Ints" |
1375 assumes in_Ints: "a \<in> Ints" |
1359 shows "(1 + a + a < 0) = (a < (0::'a::linordered_idom))" |
1376 shows "(1 + a + a < 0) = (a < (0::'a::linordered_idom))" |
1360 proof - |
1377 proof - |