src/HOL/Library/Poly_Deriv.thy
 author blanchet Wed Sep 24 15:45:55 2014 +0200 (2014-09-24) changeset 58425 246985c6b20b parent 58199 5fbe474b5da8 child 58881 b9556a055632 permissions -rw-r--r--
simpler proof
 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]) ``` haftmann@58199 ` 133` ```apply (fact assms) ``` haftmann@58199 ` 134` ```apply (rule classical) ``` haftmann@58199 ` 135` ```apply (erule notE) ``` haftmann@58199 ` 136` ```unfolding not_less_eq_eq ``` haftmann@58199 ` 137` ```using assms(1) apply (rule power_le_dvd) ``` haftmann@58199 ` 138` ```apply assumption ``` haftmann@58199 ` 139` ```done ``` huffman@29985 ` 140` huffman@29985 ` 141` ```lemma lemma_order_pderiv1: ``` huffman@29985 ` 142` ``` "pderiv ([:- a, 1:] ^ Suc n * q) = [:- a, 1:] ^ Suc n * pderiv q + ``` huffman@29985 ` 143` ``` smult (of_nat (Suc n)) (q * [:- a, 1:] ^ n)" ``` huffman@29985 ` 144` ```apply (simp only: pderiv_mult pderiv_power_Suc) ``` huffman@30273 ` 145` ```apply (simp del: power_Suc of_nat_Suc add: pderiv_pCons) ``` huffman@29985 ` 146` ```done ``` huffman@29985 ` 147` huffman@29985 ` 148` ```lemma dvd_add_cancel1: ``` huffman@29985 ` 149` ``` fixes a b c :: "'a::comm_ring_1" ``` huffman@29985 ` 150` ``` shows "a dvd b + c \ a dvd b \ a dvd c" ``` haftmann@35050 ` 151` ``` by (drule (1) Rings.dvd_diff, simp) ``` huffman@29985 ` 152` lp15@56383 ` 153` ```lemma lemma_order_pderiv: ``` lp15@56383 ` 154` ``` assumes n: "0 < n" ``` lp15@56383 ` 155` ``` and pd: "pderiv p \ 0" ``` lp15@56383 ` 156` ``` and pe: "p = [:- a, 1:] ^ n * q" ``` lp15@56383 ` 157` ``` and nd: "~ [:- a, 1:] dvd q" ``` lp15@56383 ` 158` ``` shows "n = Suc (order a (pderiv p))" ``` lp15@56383 ` 159` ```using n ``` lp15@56383 ` 160` ```proof - ``` lp15@56383 ` 161` ``` have "pderiv ([:- a, 1:] ^ n * q) \ 0" ``` lp15@56383 ` 162` ``` using assms by auto ``` lp15@56383 ` 163` ``` obtain n' where "n = Suc n'" "0 < Suc n'" "pderiv ([:- a, 1:] ^ Suc n' * q) \ 0" ``` lp15@56383 ` 164` ``` using assms by (cases n) auto ``` lp15@56383 ` 165` ``` then have *: "!!k l. k dvd k * pderiv q + smult (of_nat (Suc n')) l \ k dvd l" ``` lp15@56383 ` 166` ``` by (metis dvd_add_cancel1 dvd_smult_iff dvd_triv_left of_nat_eq_0_iff old.nat.distinct(2)) ``` lp15@56383 ` 167` ``` have "n' = order a (pderiv ([:- a, 1:] ^ Suc n' * q))" ``` lp15@56383 ` 168` ``` proof (rule order_unique_lemma) ``` lp15@56383 ` 169` ``` show "[:- a, 1:] ^ n' dvd pderiv ([:- a, 1:] ^ Suc n' * q)" ``` lp15@56383 ` 170` ``` apply (subst lemma_order_pderiv1) ``` lp15@56383 ` 171` ``` apply (rule dvd_add) ``` lp15@56383 ` 172` ``` apply (metis dvdI dvd_mult2 power_Suc2) ``` lp15@56383 ` 173` ``` apply (metis dvd_smult dvd_triv_right) ``` lp15@56383 ` 174` ``` done ``` lp15@56383 ` 175` ``` next ``` lp15@56383 ` 176` ``` show "\ [:- a, 1:] ^ Suc n' dvd pderiv ([:- a, 1:] ^ Suc n' * q)" ``` lp15@56383 ` 177` ``` apply (subst lemma_order_pderiv1) ``` lp15@56383 ` 178` ``` by (metis * nd dvd_mult_cancel_right field_power_not_zero pCons_eq_0_iff power_Suc zero_neq_one) ``` lp15@56383 ` 179` ``` qed ``` lp15@56383 ` 180` ``` then show ?thesis ``` lp15@56383 ` 181` ``` by (metis `n = Suc n'` pe) ``` lp15@56383 ` 182` ```qed ``` huffman@29985 ` 183` huffman@29985 ` 184` ```lemma order_decomp: ``` huffman@29985 ` 185` ``` "p \ 0 ``` huffman@29985 ` 186` ``` ==> \q. p = [:-a, 1:] ^ (order a p) * q & ``` huffman@29985 ` 187` ``` ~([:-a, 1:] dvd q)" ``` huffman@29985 ` 188` ```apply (drule order [where a=a]) ``` lp15@56383 ` 189` ```by (metis dvdE dvd_mult_cancel_left power_Suc2) ``` huffman@29985 ` 190` huffman@29985 ` 191` ```lemma order_pderiv: "[| pderiv p \ 0; order a p \ 0 |] ``` huffman@29985 ` 192` ``` ==> (order a p = Suc (order a (pderiv p)))" ``` huffman@29985 ` 193` ```apply (case_tac "p = 0", simp) ``` huffman@29985 ` 194` ```apply (drule_tac a = a and p = p in order_decomp) ``` huffman@29985 ` 195` ```using neq0_conv ``` huffman@29985 ` 196` ```apply (blast intro: lemma_order_pderiv) ``` huffman@29985 ` 197` ```done ``` huffman@29985 ` 198` huffman@29985 ` 199` ```lemma order_mult: "p * q \ 0 \ order a (p * q) = order a p + order a q" ``` huffman@29985 ` 200` ```proof - ``` huffman@29985 ` 201` ``` def i \ "order a p" ``` huffman@29985 ` 202` ``` def j \ "order a q" ``` huffman@29985 ` 203` ``` def t \ "[:-a, 1:]" ``` huffman@29985 ` 204` ``` have t_dvd_iff: "\u. t dvd u \ poly u a = 0" ``` huffman@29985 ` 205` ``` unfolding t_def by (simp add: dvd_iff_poly_eq_0) ``` huffman@29985 ` 206` ``` assume "p * q \ 0" ``` huffman@29985 ` 207` ``` then show "order a (p * q) = i + j" ``` huffman@29985 ` 208` ``` apply clarsimp ``` huffman@29985 ` 209` ``` apply (drule order [where a=a and p=p, folded i_def t_def]) ``` huffman@29985 ` 210` ``` apply (drule order [where a=a and p=q, folded j_def t_def]) ``` huffman@29985 ` 211` ``` apply clarify ``` lp15@56383 ` 212` ``` apply (erule dvdE)+ ``` huffman@29985 ` 213` ``` apply (rule order_unique_lemma [symmetric], fold t_def) ``` lp15@56383 ` 214` ``` apply (simp_all add: power_add t_dvd_iff) ``` huffman@29985 ` 215` ``` done ``` huffman@29985 ` 216` ```qed ``` huffman@29985 ` 217` huffman@29985 ` 218` ```text{*Now justify the standard squarefree decomposition, i.e. f / gcd(f,f'). *} ``` huffman@29985 ` 219` huffman@29985 ` 220` ```lemma order_divides: "[:-a, 1:] ^ n dvd p \ p = 0 \ n \ order a p" ``` huffman@29985 ` 221` ```apply (cases "p = 0", auto) ``` huffman@29985 ` 222` ```apply (drule order_2 [where a=a and p=p]) ``` lp15@56383 ` 223` ```apply (metis not_less_eq_eq power_le_dvd) ``` huffman@29985 ` 224` ```apply (erule power_le_dvd [OF order_1]) ``` huffman@29985 ` 225` ```done ``` huffman@29985 ` 226` huffman@29985 ` 227` ```lemma poly_squarefree_decomp_order: ``` huffman@29985 ` 228` ``` assumes "pderiv p \ 0" ``` huffman@29985 ` 229` ``` and p: "p = q * d" ``` huffman@29985 ` 230` ``` and p': "pderiv p = e * d" ``` huffman@29985 ` 231` ``` and d: "d = r * p + s * pderiv p" ``` huffman@29985 ` 232` ``` shows "order a q = (if order a p = 0 then 0 else 1)" ``` huffman@29985 ` 233` ```proof (rule classical) ``` huffman@29985 ` 234` ``` assume 1: "order a q \ (if order a p = 0 then 0 else 1)" ``` huffman@29985 ` 235` ``` from `pderiv p \ 0` have "p \ 0" by auto ``` huffman@29985 ` 236` ``` with p have "order a p = order a q + order a d" ``` huffman@29985 ` 237` ``` by (simp add: order_mult) ``` huffman@29985 ` 238` ``` with 1 have "order a p \ 0" by (auto split: if_splits) ``` huffman@29985 ` 239` ``` have "order a (pderiv p) = order a e + order a d" ``` huffman@29985 ` 240` ``` using `pderiv p \ 0` `pderiv p = e * d` by (simp add: order_mult) ``` huffman@29985 ` 241` ``` have "order a p = Suc (order a (pderiv p))" ``` huffman@29985 ` 242` ``` using `pderiv p \ 0` `order a p \ 0` by (rule order_pderiv) ``` huffman@29985 ` 243` ``` have "d \ 0" using `p \ 0` `p = q * d` by simp ``` huffman@29985 ` 244` ``` have "([:-a, 1:] ^ (order a (pderiv p))) dvd d" ``` huffman@29985 ` 245` ``` apply (simp add: d) ``` huffman@29985 ` 246` ``` apply (rule dvd_add) ``` huffman@29985 ` 247` ``` apply (rule dvd_mult) ``` huffman@29985 ` 248` ``` apply (simp add: order_divides `p \ 0` ``` huffman@29985 ` 249` ``` `order a p = Suc (order a (pderiv p))`) ``` huffman@29985 ` 250` ``` apply (rule dvd_mult) ``` huffman@29985 ` 251` ``` apply (simp add: order_divides) ``` huffman@29985 ` 252` ``` done ``` huffman@29985 ` 253` ``` then have "order a (pderiv p) \ order a d" ``` huffman@29985 ` 254` ``` using `d \ 0` by (simp add: order_divides) ``` huffman@29985 ` 255` ``` show ?thesis ``` huffman@29985 ` 256` ``` using `order a p = order a q + order a d` ``` huffman@29985 ` 257` ``` using `order a (pderiv p) = order a e + order a d` ``` huffman@29985 ` 258` ``` using `order a p = Suc (order a (pderiv p))` ``` huffman@29985 ` 259` ``` using `order a (pderiv p) \ order a d` ``` huffman@29985 ` 260` ``` by auto ``` huffman@29985 ` 261` ```qed ``` huffman@29985 ` 262` huffman@29985 ` 263` ```lemma poly_squarefree_decomp_order2: "[| pderiv p \ 0; ``` huffman@29985 ` 264` ``` p = q * d; ``` huffman@29985 ` 265` ``` pderiv p = e * d; ``` huffman@29985 ` 266` ``` d = r * p + s * pderiv p ``` huffman@29985 ` 267` ``` |] ==> \a. order a q = (if order a p = 0 then 0 else 1)" ``` lp15@56383 ` 268` ```by (blast intro: poly_squarefree_decomp_order) ``` huffman@29985 ` 269` huffman@29985 ` 270` ```lemma order_pderiv2: "[| pderiv p \ 0; order a p \ 0 |] ``` huffman@29985 ` 271` ``` ==> (order a (pderiv p) = n) = (order a p = Suc n)" ``` lp15@56383 ` 272` ```by (auto dest: order_pderiv) ``` huffman@29985 ` 273` huffman@29985 ` 274` ```definition ``` huffman@29985 ` 275` ``` rsquarefree :: "'a::idom poly => bool" where ``` huffman@29985 ` 276` ``` "rsquarefree p = (p \ 0 & (\a. (order a p = 0) | (order a p = 1)))" ``` huffman@29985 ` 277` huffman@29985 ` 278` ```lemma pderiv_iszero: "pderiv p = 0 \ \h. p = [:h:]" ``` huffman@29985 ` 279` ```apply (simp add: pderiv_eq_0_iff) ``` huffman@29985 ` 280` ```apply (case_tac p, auto split: if_splits) ``` huffman@29985 ` 281` ```done ``` huffman@29985 ` 282` huffman@29985 ` 283` ```lemma rsquarefree_roots: ``` huffman@29985 ` 284` ``` "rsquarefree p = (\a. ~(poly p a = 0 & poly (pderiv p) a = 0))" ``` huffman@29985 ` 285` ```apply (simp add: rsquarefree_def) ``` huffman@29985 ` 286` ```apply (case_tac "p = 0", simp, simp) ``` huffman@29985 ` 287` ```apply (case_tac "pderiv p = 0") ``` huffman@29985 ` 288` ```apply simp ``` lp15@56383 ` 289` ```apply (drule pderiv_iszero, clarsimp) ``` lp15@56383 ` 290` ```apply (metis coeff_0 coeff_pCons_0 degree_pCons_0 le0 le_antisym order_degree) ``` lp15@56383 ` 291` ```apply (force simp add: order_root order_pderiv2) ``` huffman@29985 ` 292` ```done ``` huffman@29985 ` 293` huffman@29985 ` 294` ```lemma poly_squarefree_decomp: ``` huffman@29985 ` 295` ``` assumes "pderiv p \ 0" ``` huffman@29985 ` 296` ``` and "p = q * d" ``` huffman@29985 ` 297` ``` and "pderiv p = e * d" ``` huffman@29985 ` 298` ``` and "d = r * p + s * pderiv p" ``` huffman@29985 ` 299` ``` shows "rsquarefree q & (\a. (poly q a = 0) = (poly p a = 0))" ``` huffman@29985 ` 300` ```proof - ``` huffman@29985 ` 301` ``` from `pderiv p \ 0` have "p \ 0" by auto ``` huffman@29985 ` 302` ``` with `p = q * d` have "q \ 0" by simp ``` huffman@29985 ` 303` ``` have "\a. order a q = (if order a p = 0 then 0 else 1)" ``` huffman@29985 ` 304` ``` using assms by (rule poly_squarefree_decomp_order2) ``` huffman@29985 ` 305` ``` with `p \ 0` `q \ 0` show ?thesis ``` huffman@29985 ` 306` ``` by (simp add: rsquarefree_def order_root) ``` huffman@29985 ` 307` ```qed ``` huffman@29985 ` 308` huffman@29985 ` 309` ```end ```