18 another extension of the notions to the integers, and added a number |
18 another extension of the notions to the integers, and added a number |
19 of results to "Primes" and "GCD". IntPrimes also defined and developed |
19 of results to "Primes" and "GCD". IntPrimes also defined and developed |
20 the congruence relations on the integers. The notion was extended to |
20 the congruence relations on the integers. The notion was extended to |
21 the natural numbers by Chiaeb. |
21 the natural numbers by Chiaeb. |
22 |
22 |
|
23 Jeremy Avigad combined all of these, made everything uniform for the |
|
24 natural numbers and the integers, and added a number of new theorems. |
|
25 |
23 Tobias Nipkow cleaned up a lot. |
26 Tobias Nipkow cleaned up a lot. |
24 *) |
27 *) |
25 |
28 |
26 |
29 |
27 header {* GCD *} |
30 header {* GCD *} |
28 |
31 |
29 theory GCD |
32 theory GCD |
30 imports NatTransfer |
33 imports Fact |
31 begin |
34 begin |
32 |
35 |
33 declare One_nat_def [simp del] |
36 declare One_nat_def [simp del] |
34 |
37 |
35 subsection {* gcd *} |
38 subsection {* gcd *} |
1728 from coprime_divprod_nat[OF pab pna] have ?thesis by blast } |
1731 from coprime_divprod_nat[OF pab pna] have ?thesis by blast } |
1729 ultimately have ?thesis by blast} |
1732 ultimately have ?thesis by blast} |
1730 ultimately show ?thesis by blast |
1733 ultimately show ?thesis by blast |
1731 qed |
1734 qed |
1732 |
1735 |
|
1736 subsection {* Infinitely many primes *} |
|
1737 |
|
1738 lemma next_prime_bound: "\<exists>(p::nat). prime p \<and> n < p \<and> p <= fact n + 1" |
|
1739 proof- |
|
1740 have f1: "fact n + 1 \<noteq> 1" using fact_ge_one_nat [of n] by arith |
|
1741 from prime_factor_nat [OF f1] |
|
1742 obtain p where "prime p" and "p dvd fact n + 1" by auto |
|
1743 hence "p \<le> fact n + 1" |
|
1744 by (intro dvd_imp_le, auto) |
|
1745 {assume "p \<le> n" |
|
1746 from `prime p` have "p \<ge> 1" |
|
1747 by (cases p, simp_all) |
|
1748 with `p <= n` have "p dvd fact n" |
|
1749 by (intro dvd_fact_nat) |
|
1750 with `p dvd fact n + 1` have "p dvd fact n + 1 - fact n" |
|
1751 by (rule dvd_diff_nat) |
|
1752 hence "p dvd 1" by simp |
|
1753 hence "p <= 1" by auto |
|
1754 moreover from `prime p` have "p > 1" by auto |
|
1755 ultimately have False by auto} |
|
1756 hence "n < p" by arith |
|
1757 with `prime p` and `p <= fact n + 1` show ?thesis by auto |
|
1758 qed |
|
1759 |
|
1760 lemma bigger_prime: "\<exists>p. prime p \<and> p > (n::nat)" |
|
1761 using next_prime_bound by auto |
|
1762 |
|
1763 lemma primes_infinite: "\<not> (finite {(p::nat). prime p})" |
|
1764 proof |
|
1765 assume "finite {(p::nat). prime p}" |
|
1766 with Max_ge have "(EX b. (ALL x : {(p::nat). prime p}. x <= b))" |
|
1767 by auto |
|
1768 then obtain b where "ALL (x::nat). prime x \<longrightarrow> x <= b" |
|
1769 by auto |
|
1770 with bigger_prime [of b] show False by auto |
|
1771 qed |
|
1772 |
|
1773 |
1733 end |
1774 end |