src/HOL/Library/Poly_Deriv.thy
 author paulson Thu Apr 03 17:26:04 2014 +0100 (2014-04-03) changeset 56383 8e7052e9fda4 parent 56381 0556204bc230 child 58199 5fbe474b5da8 permissions -rw-r--r--
Cleaned up some messy proofs
 wenzelm@41959 ` 1` ```(* Title: HOL/Library/Poly_Deriv.thy ``` huffman@29985 ` 2` ``` Author: Amine Chaieb ``` wenzelm@41959 ` 3` ``` Author: Brian Huffman ``` huffman@29985 ` 4` ```*) ``` huffman@29985 ` 5` huffman@29985 ` 6` ```header{* Polynomials and Differentiation *} ``` huffman@29985 ` 7` huffman@29985 ` 8` ```theory Poly_Deriv ``` huffman@29985 ` 9` ```imports Deriv Polynomial ``` huffman@29985 ` 10` ```begin ``` huffman@29985 ` 11` huffman@29985 ` 12` ```subsection {* Derivatives of univariate polynomials *} ``` huffman@29985 ` 13` haftmann@52380 ` 14` ```function pderiv :: "'a::real_normed_field poly \ 'a poly" ``` haftmann@52380 ` 15` ```where ``` haftmann@52380 ` 16` ``` [simp del]: "pderiv (pCons a p) = (if p = 0 then 0 else p + pCons 0 (pderiv p))" ``` haftmann@52380 ` 17` ``` by (auto intro: pCons_cases) ``` haftmann@52380 ` 18` haftmann@52380 ` 19` ```termination pderiv ``` haftmann@52380 ` 20` ``` by (relation "measure degree") simp_all ``` huffman@29985 ` 21` haftmann@52380 ` 22` ```lemma pderiv_0 [simp]: ``` haftmann@52380 ` 23` ``` "pderiv 0 = 0" ``` haftmann@52380 ` 24` ``` using pderiv.simps [of 0 0] by simp ``` huffman@29985 ` 25` haftmann@52380 ` 26` ```lemma pderiv_pCons: ``` haftmann@52380 ` 27` ``` "pderiv (pCons a p) = p + pCons 0 (pderiv p)" ``` haftmann@52380 ` 28` ``` by (simp add: pderiv.simps) ``` huffman@29985 ` 29` huffman@29985 ` 30` ```lemma coeff_pderiv: "coeff (pderiv p) n = of_nat (Suc n) * coeff p (Suc n)" ``` lp15@56383 ` 31` ``` by (induct p arbitrary: n) ``` lp15@56383 ` 32` ``` (auto simp add: pderiv_pCons coeff_pCons algebra_simps split: nat.split) ``` huffman@29985 ` 33` haftmann@52380 ` 34` ```primrec pderiv_coeffs :: "'a::comm_monoid_add list \ 'a list" ``` haftmann@52380 ` 35` ```where ``` haftmann@52380 ` 36` ``` "pderiv_coeffs [] = []" ``` haftmann@52380 ` 37` ```| "pderiv_coeffs (x # xs) = plus_coeffs xs (cCons 0 (pderiv_coeffs xs))" ``` haftmann@52380 ` 38` haftmann@52380 ` 39` ```lemma coeffs_pderiv [code abstract]: ``` haftmann@52380 ` 40` ``` "coeffs (pderiv p) = pderiv_coeffs (coeffs p)" ``` haftmann@52380 ` 41` ``` by (rule sym, induct p) (simp_all add: pderiv_pCons coeffs_plus_eq_plus_coeffs cCons_def) ``` haftmann@52380 ` 42` huffman@29985 ` 43` ```lemma pderiv_eq_0_iff: "pderiv p = 0 \ degree p = 0" ``` huffman@29985 ` 44` ``` apply (rule iffI) ``` huffman@29985 ` 45` ``` apply (cases p, simp) ``` haftmann@52380 ` 46` ``` apply (simp add: poly_eq_iff coeff_pderiv del: of_nat_Suc) ``` haftmann@52380 ` 47` ``` apply (simp add: poly_eq_iff coeff_pderiv coeff_eq_0) ``` huffman@29985 ` 48` ``` done ``` huffman@29985 ` 49` huffman@29985 ` 50` ```lemma degree_pderiv: "degree (pderiv p) = degree p - 1" ``` huffman@29985 ` 51` ``` apply (rule order_antisym [OF degree_le]) ``` huffman@29985 ` 52` ``` apply (simp add: coeff_pderiv coeff_eq_0) ``` huffman@29985 ` 53` ``` apply (cases "degree p", simp) ``` huffman@29985 ` 54` ``` apply (rule le_degree) ``` huffman@29985 ` 55` ``` apply (simp add: coeff_pderiv del: of_nat_Suc) ``` lp15@56383 ` 56` ``` apply (metis degree_0 leading_coeff_0_iff nat.distinct(1)) ``` huffman@29985 ` 57` ``` done ``` huffman@29985 ` 58` huffman@29985 ` 59` ```lemma pderiv_singleton [simp]: "pderiv [:a:] = 0" ``` huffman@29985 ` 60` ```by (simp add: pderiv_pCons) ``` huffman@29985 ` 61` huffman@29985 ` 62` ```lemma pderiv_add: "pderiv (p + q) = pderiv p + pderiv q" ``` haftmann@52380 ` 63` ```by (rule poly_eqI, simp add: coeff_pderiv algebra_simps) ``` huffman@29985 ` 64` huffman@29985 ` 65` ```lemma pderiv_minus: "pderiv (- p) = - pderiv p" ``` haftmann@52380 ` 66` ```by (rule poly_eqI, simp add: coeff_pderiv) ``` huffman@29985 ` 67` huffman@29985 ` 68` ```lemma pderiv_diff: "pderiv (p - q) = pderiv p - pderiv q" ``` haftmann@52380 ` 69` ```by (rule poly_eqI, simp add: coeff_pderiv algebra_simps) ``` huffman@29985 ` 70` huffman@29985 ` 71` ```lemma pderiv_smult: "pderiv (smult a p) = smult a (pderiv p)" ``` haftmann@52380 ` 72` ```by (rule poly_eqI, simp add: coeff_pderiv algebra_simps) ``` huffman@29985 ` 73` huffman@29985 ` 74` ```lemma pderiv_mult: "pderiv (p * q) = p * pderiv q + q * pderiv p" ``` lp15@56383 ` 75` ```by (induct p) (auto simp: pderiv_add pderiv_smult pderiv_pCons algebra_simps) ``` huffman@29985 ` 76` huffman@29985 ` 77` ```lemma pderiv_power_Suc: ``` huffman@29985 ` 78` ``` "pderiv (p ^ Suc n) = smult (of_nat (Suc n)) (p ^ n) * pderiv p" ``` huffman@29985 ` 79` ```apply (induct n) ``` huffman@29985 ` 80` ```apply simp ``` huffman@29985 ` 81` ```apply (subst power_Suc) ``` huffman@29985 ` 82` ```apply (subst pderiv_mult) ``` huffman@29985 ` 83` ```apply (erule ssubst) ``` huffman@47108 ` 84` ```apply (simp only: of_nat_Suc smult_add_left smult_1_left) ``` lp15@56383 ` 85` ```apply (simp add: algebra_simps) ``` huffman@29985 ` 86` ```done ``` huffman@29985 ` 87` huffman@29985 ` 88` ```lemma DERIV_pow2: "DERIV (%x. x ^ Suc n) x :> real (Suc n) * (x ^ n)" ``` huffman@44317 ` 89` ```by (rule DERIV_cong, rule DERIV_pow, simp) ``` huffman@29985 ` 90` ```declare DERIV_pow2 [simp] DERIV_pow [simp] ``` huffman@29985 ` 91` huffman@29985 ` 92` ```lemma DERIV_add_const: "DERIV f x :> D ==> DERIV (%x. a + f x :: 'a::real_normed_field) x :> D" ``` huffman@44317 ` 93` ```by (rule DERIV_cong, rule DERIV_add, auto) ``` huffman@29985 ` 94` huffman@29985 ` 95` ```lemma poly_DERIV[simp]: "DERIV (%x. poly p x) x :> poly (pderiv p) x" ``` hoelzl@56381 ` 96` ``` by (induct p, auto intro!: derivative_eq_intros simp add: pderiv_pCons) ``` huffman@29985 ` 97` huffman@29985 ` 98` ```text{* Consequences of the derivative theorem above*} ``` huffman@29985 ` 99` hoelzl@56181 ` 100` ```lemma poly_differentiable[simp]: "(%x. poly p x) differentiable (at x::real filter)" ``` hoelzl@56181 ` 101` ```apply (simp add: real_differentiable_def) ``` huffman@29985 ` 102` ```apply (blast intro: poly_DERIV) ``` huffman@29985 ` 103` ```done ``` huffman@29985 ` 104` huffman@29985 ` 105` ```lemma poly_isCont[simp]: "isCont (%x. poly p x) (x::real)" ``` huffman@29985 ` 106` ```by (rule poly_DERIV [THEN DERIV_isCont]) ``` huffman@29985 ` 107` huffman@29985 ` 108` ```lemma poly_IVT_pos: "[| a < b; poly p (a::real) < 0; 0 < poly p b |] ``` huffman@29985 ` 109` ``` ==> \x. a < x & x < b & (poly p x = 0)" ``` lp15@56383 ` 110` ```using IVT_objl [of "poly p" a 0 b] ``` lp15@56383 ` 111` ```by (auto simp add: order_le_less) ``` huffman@29985 ` 112` huffman@29985 ` 113` ```lemma poly_IVT_neg: "[| (a::real) < b; 0 < poly p a; poly p b < 0 |] ``` huffman@29985 ` 114` ``` ==> \x. a < x & x < b & (poly p x = 0)" ``` huffman@29985 ` 115` ```by (insert poly_IVT_pos [where p = "- p" ]) simp ``` huffman@29985 ` 116` huffman@29985 ` 117` ```lemma poly_MVT: "(a::real) < b ==> ``` huffman@29985 ` 118` ``` \x. a < x & x < b & (poly p b - poly p a = (b - a) * poly (pderiv p) x)" ``` lp15@56383 ` 119` ```using MVT [of a b "poly p"] ``` lp15@56383 ` 120` ```apply auto ``` huffman@29985 ` 121` ```apply (rule_tac x = z in exI) ``` lp15@56217 ` 122` ```apply (auto simp add: mult_left_cancel poly_DERIV [THEN DERIV_unique]) ``` huffman@29985 ` 123` ```done ``` huffman@29985 ` 124` huffman@29985 ` 125` ```text{*Lemmas for Derivatives*} ``` huffman@29985 ` 126` huffman@29985 ` 127` ```lemma order_unique_lemma: ``` huffman@29985 ` 128` ``` fixes p :: "'a::idom poly" ``` lp15@56383 ` 129` ``` assumes "[:-a, 1:] ^ n dvd p" "\ [:-a, 1:] ^ Suc n dvd p" ``` huffman@29985 ` 130` ``` shows "n = order a p" ``` huffman@29985 ` 131` ```unfolding Polynomial.order_def ``` huffman@29985 ` 132` ```apply (rule Least_equality [symmetric]) ``` lp15@56383 ` 133` ```apply (rule assms) ``` lp15@56383 ` 134` ```by (metis assms not_less_eq_eq power_le_dvd) ``` huffman@29985 ` 135` huffman@29985 ` 136` ```lemma lemma_order_pderiv1: ``` huffman@29985 ` 137` ``` "pderiv ([:- a, 1:] ^ Suc n * q) = [:- a, 1:] ^ Suc n * pderiv q + ``` huffman@29985 ` 138` ``` smult (of_nat (Suc n)) (q * [:- a, 1:] ^ n)" ``` huffman@29985 ` 139` ```apply (simp only: pderiv_mult pderiv_power_Suc) ``` huffman@30273 ` 140` ```apply (simp del: power_Suc of_nat_Suc add: pderiv_pCons) ``` huffman@29985 ` 141` ```done ``` huffman@29985 ` 142` huffman@29985 ` 143` ```lemma dvd_add_cancel1: ``` huffman@29985 ` 144` ``` fixes a b c :: "'a::comm_ring_1" ``` huffman@29985 ` 145` ``` shows "a dvd b + c \ a dvd b \ a dvd c" ``` haftmann@35050 ` 146` ``` by (drule (1) Rings.dvd_diff, simp) ``` huffman@29985 ` 147` lp15@56383 ` 148` ```lemma lemma_order_pderiv: ``` lp15@56383 ` 149` ``` assumes n: "0 < n" ``` lp15@56383 ` 150` ``` and pd: "pderiv p \ 0" ``` lp15@56383 ` 151` ``` and pe: "p = [:- a, 1:] ^ n * q" ``` lp15@56383 ` 152` ``` and nd: "~ [:- a, 1:] dvd q" ``` lp15@56383 ` 153` ``` shows "n = Suc (order a (pderiv p))" ``` lp15@56383 ` 154` ```using n ``` lp15@56383 ` 155` ```proof - ``` lp15@56383 ` 156` ``` have "pderiv ([:- a, 1:] ^ n * q) \ 0" ``` lp15@56383 ` 157` ``` using assms by auto ``` lp15@56383 ` 158` ``` obtain n' where "n = Suc n'" "0 < Suc n'" "pderiv ([:- a, 1:] ^ Suc n' * q) \ 0" ``` lp15@56383 ` 159` ``` using assms by (cases n) auto ``` lp15@56383 ` 160` ``` then have *: "!!k l. k dvd k * pderiv q + smult (of_nat (Suc n')) l \ k dvd l" ``` lp15@56383 ` 161` ``` by (metis dvd_add_cancel1 dvd_smult_iff dvd_triv_left of_nat_eq_0_iff old.nat.distinct(2)) ``` lp15@56383 ` 162` ``` have "n' = order a (pderiv ([:- a, 1:] ^ Suc n' * q))" ``` lp15@56383 ` 163` ``` proof (rule order_unique_lemma) ``` lp15@56383 ` 164` ``` show "[:- a, 1:] ^ n' dvd pderiv ([:- a, 1:] ^ Suc n' * q)" ``` lp15@56383 ` 165` ``` apply (subst lemma_order_pderiv1) ``` lp15@56383 ` 166` ``` apply (rule dvd_add) ``` lp15@56383 ` 167` ``` apply (metis dvdI dvd_mult2 power_Suc2) ``` lp15@56383 ` 168` ``` apply (metis dvd_smult dvd_triv_right) ``` lp15@56383 ` 169` ``` done ``` lp15@56383 ` 170` ``` next ``` lp15@56383 ` 171` ``` show "\ [:- a, 1:] ^ Suc n' dvd pderiv ([:- a, 1:] ^ Suc n' * q)" ``` lp15@56383 ` 172` ``` apply (subst lemma_order_pderiv1) ``` lp15@56383 ` 173` ``` by (metis * nd dvd_mult_cancel_right field_power_not_zero pCons_eq_0_iff power_Suc zero_neq_one) ``` lp15@56383 ` 174` ``` qed ``` lp15@56383 ` 175` ``` then show ?thesis ``` lp15@56383 ` 176` ``` by (metis `n = Suc n'` pe) ``` lp15@56383 ` 177` ```qed ``` huffman@29985 ` 178` huffman@29985 ` 179` ```lemma order_decomp: ``` huffman@29985 ` 180` ``` "p \ 0 ``` huffman@29985 ` 181` ``` ==> \q. p = [:-a, 1:] ^ (order a p) * q & ``` huffman@29985 ` 182` ``` ~([:-a, 1:] dvd q)" ``` huffman@29985 ` 183` ```apply (drule order [where a=a]) ``` lp15@56383 ` 184` ```by (metis dvdE dvd_mult_cancel_left power_Suc2) ``` huffman@29985 ` 185` huffman@29985 ` 186` ```lemma order_pderiv: "[| pderiv p \ 0; order a p \ 0 |] ``` huffman@29985 ` 187` ``` ==> (order a p = Suc (order a (pderiv p)))" ``` huffman@29985 ` 188` ```apply (case_tac "p = 0", simp) ``` huffman@29985 ` 189` ```apply (drule_tac a = a and p = p in order_decomp) ``` huffman@29985 ` 190` ```using neq0_conv ``` huffman@29985 ` 191` ```apply (blast intro: lemma_order_pderiv) ``` huffman@29985 ` 192` ```done ``` huffman@29985 ` 193` huffman@29985 ` 194` ```lemma order_mult: "p * q \ 0 \ order a (p * q) = order a p + order a q" ``` huffman@29985 ` 195` ```proof - ``` huffman@29985 ` 196` ``` def i \ "order a p" ``` huffman@29985 ` 197` ``` def j \ "order a q" ``` huffman@29985 ` 198` ``` def t \ "[:-a, 1:]" ``` huffman@29985 ` 199` ``` have t_dvd_iff: "\u. t dvd u \ poly u a = 0" ``` huffman@29985 ` 200` ``` unfolding t_def by (simp add: dvd_iff_poly_eq_0) ``` huffman@29985 ` 201` ``` assume "p * q \ 0" ``` huffman@29985 ` 202` ``` then show "order a (p * q) = i + j" ``` huffman@29985 ` 203` ``` apply clarsimp ``` huffman@29985 ` 204` ``` apply (drule order [where a=a and p=p, folded i_def t_def]) ``` huffman@29985 ` 205` ``` apply (drule order [where a=a and p=q, folded j_def t_def]) ``` huffman@29985 ` 206` ``` apply clarify ``` lp15@56383 ` 207` ``` apply (erule dvdE)+ ``` huffman@29985 ` 208` ``` apply (rule order_unique_lemma [symmetric], fold t_def) ``` lp15@56383 ` 209` ``` apply (simp_all add: power_add t_dvd_iff) ``` huffman@29985 ` 210` ``` done ``` huffman@29985 ` 211` ```qed ``` huffman@29985 ` 212` huffman@29985 ` 213` ```text{*Now justify the standard squarefree decomposition, i.e. f / gcd(f,f'). *} ``` huffman@29985 ` 214` huffman@29985 ` 215` ```lemma order_divides: "[:-a, 1:] ^ n dvd p \ p = 0 \ n \ order a p" ``` huffman@29985 ` 216` ```apply (cases "p = 0", auto) ``` huffman@29985 ` 217` ```apply (drule order_2 [where a=a and p=p]) ``` lp15@56383 ` 218` ```apply (metis not_less_eq_eq power_le_dvd) ``` huffman@29985 ` 219` ```apply (erule power_le_dvd [OF order_1]) ``` huffman@29985 ` 220` ```done ``` huffman@29985 ` 221` huffman@29985 ` 222` ```lemma poly_squarefree_decomp_order: ``` huffman@29985 ` 223` ``` assumes "pderiv p \ 0" ``` huffman@29985 ` 224` ``` and p: "p = q * d" ``` huffman@29985 ` 225` ``` and p': "pderiv p = e * d" ``` huffman@29985 ` 226` ``` and d: "d = r * p + s * pderiv p" ``` huffman@29985 ` 227` ``` shows "order a q = (if order a p = 0 then 0 else 1)" ``` huffman@29985 ` 228` ```proof (rule classical) ``` huffman@29985 ` 229` ``` assume 1: "order a q \ (if order a p = 0 then 0 else 1)" ``` huffman@29985 ` 230` ``` from `pderiv p \ 0` have "p \ 0" by auto ``` huffman@29985 ` 231` ``` with p have "order a p = order a q + order a d" ``` huffman@29985 ` 232` ``` by (simp add: order_mult) ``` huffman@29985 ` 233` ``` with 1 have "order a p \ 0" by (auto split: if_splits) ``` huffman@29985 ` 234` ``` have "order a (pderiv p) = order a e + order a d" ``` huffman@29985 ` 235` ``` using `pderiv p \ 0` `pderiv p = e * d` by (simp add: order_mult) ``` huffman@29985 ` 236` ``` have "order a p = Suc (order a (pderiv p))" ``` huffman@29985 ` 237` ``` using `pderiv p \ 0` `order a p \ 0` by (rule order_pderiv) ``` huffman@29985 ` 238` ``` have "d \ 0" using `p \ 0` `p = q * d` by simp ``` huffman@29985 ` 239` ``` have "([:-a, 1:] ^ (order a (pderiv p))) dvd d" ``` huffman@29985 ` 240` ``` apply (simp add: d) ``` huffman@29985 ` 241` ``` apply (rule dvd_add) ``` huffman@29985 ` 242` ``` apply (rule dvd_mult) ``` huffman@29985 ` 243` ``` apply (simp add: order_divides `p \ 0` ``` huffman@29985 ` 244` ``` `order a p = Suc (order a (pderiv p))`) ``` huffman@29985 ` 245` ``` apply (rule dvd_mult) ``` huffman@29985 ` 246` ``` apply (simp add: order_divides) ``` huffman@29985 ` 247` ``` done ``` huffman@29985 ` 248` ``` then have "order a (pderiv p) \ order a d" ``` huffman@29985 ` 249` ``` using `d \ 0` by (simp add: order_divides) ``` huffman@29985 ` 250` ``` show ?thesis ``` huffman@29985 ` 251` ``` using `order a p = order a q + order a d` ``` huffman@29985 ` 252` ``` using `order a (pderiv p) = order a e + order a d` ``` huffman@29985 ` 253` ``` using `order a p = Suc (order a (pderiv p))` ``` huffman@29985 ` 254` ``` using `order a (pderiv p) \ order a d` ``` huffman@29985 ` 255` ``` by auto ``` huffman@29985 ` 256` ```qed ``` huffman@29985 ` 257` huffman@29985 ` 258` ```lemma poly_squarefree_decomp_order2: "[| pderiv p \ 0; ``` huffman@29985 ` 259` ``` p = q * d; ``` huffman@29985 ` 260` ``` pderiv p = e * d; ``` huffman@29985 ` 261` ``` d = r * p + s * pderiv p ``` huffman@29985 ` 262` ``` |] ==> \a. order a q = (if order a p = 0 then 0 else 1)" ``` lp15@56383 ` 263` ```by (blast intro: poly_squarefree_decomp_order) ``` huffman@29985 ` 264` huffman@29985 ` 265` ```lemma order_pderiv2: "[| pderiv p \ 0; order a p \ 0 |] ``` huffman@29985 ` 266` ``` ==> (order a (pderiv p) = n) = (order a p = Suc n)" ``` lp15@56383 ` 267` ```by (auto dest: order_pderiv) ``` huffman@29985 ` 268` huffman@29985 ` 269` ```definition ``` huffman@29985 ` 270` ``` rsquarefree :: "'a::idom poly => bool" where ``` huffman@29985 ` 271` ``` "rsquarefree p = (p \ 0 & (\a. (order a p = 0) | (order a p = 1)))" ``` huffman@29985 ` 272` huffman@29985 ` 273` ```lemma pderiv_iszero: "pderiv p = 0 \ \h. p = [:h:]" ``` huffman@29985 ` 274` ```apply (simp add: pderiv_eq_0_iff) ``` huffman@29985 ` 275` ```apply (case_tac p, auto split: if_splits) ``` huffman@29985 ` 276` ```done ``` huffman@29985 ` 277` huffman@29985 ` 278` ```lemma rsquarefree_roots: ``` huffman@29985 ` 279` ``` "rsquarefree p = (\a. ~(poly p a = 0 & poly (pderiv p) a = 0))" ``` huffman@29985 ` 280` ```apply (simp add: rsquarefree_def) ``` huffman@29985 ` 281` ```apply (case_tac "p = 0", simp, simp) ``` huffman@29985 ` 282` ```apply (case_tac "pderiv p = 0") ``` huffman@29985 ` 283` ```apply simp ``` lp15@56383 ` 284` ```apply (drule pderiv_iszero, clarsimp) ``` lp15@56383 ` 285` ```apply (metis coeff_0 coeff_pCons_0 degree_pCons_0 le0 le_antisym order_degree) ``` lp15@56383 ` 286` ```apply (force simp add: order_root order_pderiv2) ``` huffman@29985 ` 287` ```done ``` huffman@29985 ` 288` huffman@29985 ` 289` ```lemma poly_squarefree_decomp: ``` huffman@29985 ` 290` ``` assumes "pderiv p \ 0" ``` huffman@29985 ` 291` ``` and "p = q * d" ``` huffman@29985 ` 292` ``` and "pderiv p = e * d" ``` huffman@29985 ` 293` ``` and "d = r * p + s * pderiv p" ``` huffman@29985 ` 294` ``` shows "rsquarefree q & (\a. (poly q a = 0) = (poly p a = 0))" ``` huffman@29985 ` 295` ```proof - ``` huffman@29985 ` 296` ``` from `pderiv p \ 0` have "p \ 0" by auto ``` huffman@29985 ` 297` ``` with `p = q * d` have "q \ 0" by simp ``` huffman@29985 ` 298` ``` have "\a. order a q = (if order a p = 0 then 0 else 1)" ``` huffman@29985 ` 299` ``` using assms by (rule poly_squarefree_decomp_order2) ``` huffman@29985 ` 300` ``` with `p \ 0` `q \ 0` show ?thesis ``` huffman@29985 ` 301` ``` by (simp add: rsquarefree_def order_root) ``` huffman@29985 ` 302` ```qed ``` huffman@29985 ` 303` huffman@29985 ` 304` ```end ```