src/HOL/ex/Sqrt.thy
 changeset 45917 1ce1bc9ff64a parent 32479 521cc9bf2958 child 46495 8e8a339e176f
```     1.1 --- a/src/HOL/ex/Sqrt.thy	Sun Dec 18 14:28:14 2011 +0100
1.2 +++ b/src/HOL/ex/Sqrt.thy	Mon Dec 19 17:10:45 2011 +0100
1.3 @@ -1,5 +1,5 @@
1.4  (*  Title:      HOL/ex/Sqrt.thy
1.5 -    Author:     Markus Wenzel, TU Muenchen
1.6 +    Author:     Markus Wenzel, Tobias Nipkow, TU Muenchen
1.7  *)
1.8
1.9  header {*  Square roots of primes are irrational *}
1.10 @@ -47,7 +47,7 @@
1.11    with p show False by simp
1.12  qed
1.13
1.14 -corollary "sqrt (real (2::nat)) \<notin> \<rat>"
1.15 +corollary sqrt_real_2_not_rat: "sqrt (real (2::nat)) \<notin> \<rat>"
1.16    by (rule sqrt_prime_irrational) (rule two_is_prime_nat)
1.17
1.18
1.19 @@ -87,4 +87,22 @@
1.20    with p show False by simp
1.21  qed
1.22
1.23 +
1.24 +text{* Another old chestnut, which is a consequence of the irrationality of 2. *}
1.25 +
1.26 +lemma "\<exists>a b::real. a \<notin> \<rat> \<and> b \<notin> \<rat> \<and> a powr b \<in> \<rat>" (is "EX a b. ?P a b")
1.27 +proof cases
1.28 +  assume "sqrt 2 powr sqrt 2 \<in> \<rat>"
1.29 +  hence "?P (sqrt 2) (sqrt 2)" by(metis sqrt_real_2_not_rat[simplified])
1.30 +  thus ?thesis by blast
1.31 +next
1.32 +  assume 1: "sqrt 2 powr sqrt 2 \<notin> \<rat>"
1.33 +  have "(sqrt 2 powr sqrt 2) powr sqrt 2 = 2"
1.34 +    using powr_realpow[of _ 2]
1.35 +    by (simp add: powr_powr power2_eq_square[symmetric])
1.36 +  hence "?P (sqrt 2 powr sqrt 2) (sqrt 2)"
1.37 +    by (metis 1 Rats_number_of sqrt_real_2_not_rat[simplified])
1.38 +  thus ?thesis by blast
1.39 +qed
1.40 +
1.41  end
```