src/HOL/Library/Univ_Poly.thy
changeset 32960 69916a850301
parent 32456 341c83339aeb
child 35028 108662d50512
equal deleted inserted replaced
32959:23a8c5ac35f8 32960:69916a850301
     1 (*  Title:       Univ_Poly.thy
     1 (*  Title:      HOL/Library/Univ_Poly.thy
     2     Author:      Amine Chaieb
     2     Author:     Amine Chaieb
     3 *)
     3 *)
     4 
     4 
     5 header {* Univariate Polynomials *}
     5 header {* Univariate Polynomials *}
     6 
     6 
     7 theory Univ_Poly
     7 theory Univ_Poly
   203   {fix h
   203   {fix h
   204     from Cons.hyps[rule_format, of x]
   204     from Cons.hyps[rule_format, of x]
   205     obtain q r where qr: "x#xs = [r] +++ [- a, 1] *** q" by blast
   205     obtain q r where qr: "x#xs = [r] +++ [- a, 1] *** q" by blast
   206     have "h#x#xs = [a*r + h] +++ [-a, 1] *** (r#q)"
   206     have "h#x#xs = [a*r + h] +++ [-a, 1] *** (r#q)"
   207       using qr by(cases q, simp_all add: algebra_simps diff_def[symmetric]
   207       using qr by(cases q, simp_all add: algebra_simps diff_def[symmetric]
   208 	minus_mult_left[symmetric] right_minus)
   208         minus_mult_left[symmetric] right_minus)
   209     hence "\<exists>q r. h#x#xs = [r] +++ [-a, 1] *** q" by blast}
   209     hence "\<exists>q r. h#x#xs = [r] +++ [-a, 1] *** q" by blast}
   210   thus ?case by blast
   210   thus ?case by blast
   211 qed
   211 qed
   212 
   212 
   213 lemma (in comm_ring_1) poly_linear_rem: "\<exists>q r. h#t = [r] +++ [-a, 1] *** q"
   213 lemma (in comm_ring_1) poly_linear_rem: "\<exists>q r. h#t = [r] +++ [-a, 1] *** q"
   218 proof-
   218 proof-
   219   {assume p: "p = []" hence ?thesis by simp}
   219   {assume p: "p = []" hence ?thesis by simp}
   220   moreover
   220   moreover
   221   {fix x xs assume p: "p = x#xs"
   221   {fix x xs assume p: "p = x#xs"
   222     {fix q assume "p = [-a, 1] *** q" hence "poly p a = 0"
   222     {fix q assume "p = [-a, 1] *** q" hence "poly p a = 0"
   223 	by (simp add: poly_add poly_cmult minus_mult_left[symmetric])}
   223         by (simp add: poly_add poly_cmult minus_mult_left[symmetric])}
   224     moreover
   224     moreover
   225     {assume p0: "poly p a = 0"
   225     {assume p0: "poly p a = 0"
   226       from poly_linear_rem[of x xs a] obtain q r
   226       from poly_linear_rem[of x xs a] obtain q r
   227       where qr: "x#xs = [r] +++ [- a, 1] *** q" by blast
   227       where qr: "x#xs = [r] +++ [- a, 1] *** q" by blast
   228       have "r = 0" using p0 by (simp only: p qr poly_mult poly_add) simp
   228       have "r = 0" using p0 by (simp only: p qr poly_mult poly_add) simp
   699   show ?thesis
   699   show ?thesis
   700 apply (case_tac "?poly p = ?poly []", auto)
   700 apply (case_tac "?poly p = ?poly []", auto)
   701 apply (simp add: divides_def fun_eq poly_mult)
   701 apply (simp add: divides_def fun_eq poly_mult)
   702 apply (rule_tac x = "[]" in exI)
   702 apply (rule_tac x = "[]" in exI)
   703 apply (auto dest!: order2 [where a=a]
   703 apply (auto dest!: order2 [where a=a]
   704 	    intro: poly_exp_divides simp del: pexp_Suc)
   704             intro: poly_exp_divides simp del: pexp_Suc)
   705 done
   705 done
   706 qed
   706 qed
   707 
   707 
   708 lemma (in idom_char_0) order_decomp:
   708 lemma (in idom_char_0) order_decomp:
   709      "poly p \<noteq> poly []
   709      "poly p \<noteq> poly []