Commit 10a137a0 by Rene Thiemann

### moved lemmas and definitions from Missing_Lemmas.thy to better suitable theories

parent a621572958bd
 ... ... @@ -271,6 +271,71 @@ end context poly_mod_prime begin lemma unique_factorization_m_factor_partition: assumes l0: "l \ 0" and uf: "poly_mod.unique_factorization_m (p^l) f (lead_coeff f, mset gs)" and f: "f = f1 * f2" and cop: "coprime (lead_coeff f) p" and sf: "square_free_m f" and part: "List.partition (\gi. gi dvdm f1) gs = (gs1, gs2)" shows "poly_mod.unique_factorization_m (p^l) f1 (lead_coeff f1, mset gs1)" "poly_mod.unique_factorization_m (p^l) f2 (lead_coeff f2, mset gs2)" proof - interpret pl: poly_mod_2 "p^l" by (standard, insert m1 l0, auto) let ?I = "image_mset pl.Mp" note Mp_pow [simp] = Mp_Mp_pow_is_Mp[OF l0 m1] have [simp]: "pl.Mp x dvdm u = (x dvdm u)" for x u unfolding dvdm_def using Mp_pow[of x] by (metis poly_mod.mult_Mp(1)) have gs_split: "set gs = set gs1 \ set gs2" using part by auto from pl.unique_factorization_m_factor[OF prime uf[unfolded f] _ _ l0 refl, folded f, OF cop sf] obtain hs1 hs2 where uf': "pl.unique_factorization_m f1 (lead_coeff f1, hs1)" "pl.unique_factorization_m f2 (lead_coeff f2, hs2)" and gs_hs: "?I (mset gs) = hs1 + hs2" unfolding pl.Mf_def split by auto have gs_gs: "?I (mset gs) = ?I (mset gs1) + ?I (mset gs2)" using part by (auto, induct gs arbitrary: gs1 gs2, auto) with gs_hs have gs_hs12: "?I (mset gs1) + ?I (mset gs2) = hs1 + hs2" by auto note pl_dvdm_imp_p_dvdm = pl_dvdm_imp_p_dvdm[OF l0] note fact = pl.unique_factorization_m_imp_factorization[OF uf] have gs1: "?I (mset gs1) = {#x \# ?I (mset gs). x dvdm f1#}" using part by (auto, induct gs arbitrary: gs1 gs2, auto) also have "\ = {#x \# hs1. x dvdm f1#} + {#x \# hs2. x dvdm f1#}" unfolding gs_hs by simp also have "{#x \# hs2. x dvdm f1#} = {#}" proof (rule ccontr) assume "\ ?thesis" then obtain x where x: "x \# hs2" and dvd: "x dvdm f1" by fastforce from x gs_hs have "x \# ?I (mset gs)" by auto with fact[unfolded pl.factorization_m_def] have xx: "pl.irreducible\<^sub>d_m x" "monic x" by auto from square_free_m_prod_imp_coprime_m[OF sf[unfolded f]] have cop_h_f: "coprime_m f1 f2" by auto from pl.factorization_m_mem_dvdm[OF pl.unique_factorization_m_imp_factorization[OF uf'(2)], of x] x have "pl.dvdm x f2" by auto hence "x dvdm f2" by (rule pl_dvdm_imp_p_dvdm) from cop_h_f[unfolded coprime_m_def, rule_format, OF dvd this] have "x dvdm 1" by auto from dvdm_imp_degree_le[OF this xx(2) _ m1] have "degree x = 0" by auto with xx show False unfolding pl.irreducible\<^sub>d_m_def by auto qed also have "{#x \# hs1. x dvdm f1#} = hs1" proof (rule ccontr) assume "\ ?thesis" from filter_mset_inequality[OF this] obtain x where x: "x \# hs1" and dvd: "\ x dvdm f1" by blast from pl.factorization_m_mem_dvdm[OF pl.unique_factorization_m_imp_factorization[OF uf'(1)], of x] x dvd have "pl.dvdm x f1" by auto from pl_dvdm_imp_p_dvdm[OF this] dvd show False by auto qed finally have gs_hs1: "?I (mset gs1) = hs1" by simp with gs_hs12 have "?I (mset gs2) = hs2" by auto with uf' gs_hs1 have "pl.unique_factorization_m f1 (lead_coeff f1, ?I (mset gs1))" "pl.unique_factorization_m f2 (lead_coeff f2, ?I (mset gs2))" by auto thus "pl.unique_factorization_m f1 (lead_coeff f1, mset gs1)" "pl.unique_factorization_m f2 (lead_coeff f2, mset gs2)" unfolding pl.unique_factorization_m_def by (auto simp: pl.Mf_def image_mset.compositionality o_def) qed lemma factorization_pn_to_factorization_p: assumes fact: "poly_mod.factorization_m (p^n) C (c,fs)" and sf: "square_free_m C" and n: "n \ 0" ... ...
 ... ... @@ -19,7 +19,8 @@ imports "HOL-Computational_Algebra.Field_as_Ring" begin hide_const (open) up_ring.coeff up_ring.monom Modules.module hide_const (open) up_ring.coeff up_ring.monom Modules.module subspace Modules.module_hom subsection \Auxiliary lemmas\ ... ... @@ -1850,7 +1851,7 @@ qed lemma linear_Poly_list_of_vec: shows "(Poly \ list_of_vec) \ module_hom class_ring V (vector_space_poly.vs {v. [v^(CARD('a)) = v] (mod u)})" proof (auto simp add: module_hom_def Matrix.module_vec_def) proof (auto simp add: LinearCombinations.module_hom_def Matrix.module_vec_def) fix m1 m2::" 'a mod_ring vec" assume m1: "m1 \ mat_kernel (berlekamp_resulting_mat u)" and m2: "m2 \ mat_kernel (berlekamp_resulting_mat u)" ... ... @@ -1938,7 +1939,7 @@ qed lemma linear_Poly_list_of_vec': assumes "degree u > 0" shows "(Poly \ list_of_vec) \ module_hom R V W" proof (auto simp add: module_hom_def Matrix.module_vec_def) proof (auto simp add: LinearCombinations.module_hom_def Matrix.module_vec_def) fix m1 m2::" 'a mod_ring vec" assume m1: "m1 \ mat_kernel (berlekamp_resulting_mat u)" and m2: "m2 \ mat_kernel (berlekamp_resulting_mat u)" ... ... @@ -2042,7 +2043,7 @@ proof - hence "x \ mat_kernel (berlekamp_resulting_mat u)" using x by auto hence "[Poly (list_of_vec x) ^ CARD('a) = Poly (list_of_vec x)] (mod u)" using linear_Poly_list_of_vec unfolding module_hom_def Matrix.module_vec_def by auto unfolding LinearCombinations.module_hom_def Matrix.module_vec_def by auto } thus "[v ^ CARD('a) = v] (mod u)" using v unfolding set_berlekamp_basis_eq by auto qed ... ... @@ -2056,7 +2057,7 @@ proof (auto simp add: image_def) assume xa: "xa \ mat_kernel (berlekamp_resulting_mat u)" thus "[Poly (list_of_vec xa) ^ CARD('a) = Poly (list_of_vec xa)] (mod u)" using linear_Poly_list_of_vec unfolding module_hom_def Matrix.module_vec_def by auto unfolding LinearCombinations.module_hom_def Matrix.module_vec_def by auto show "degree (Poly (list_of_vec xa)) < degree u" proof (rule degree_Poly_list_of_vec[OF _ deg_u]) show "xa \ carrier_vec (degree u)" using xa unfolding mat_kernel_def by simp ... ... @@ -2441,7 +2442,7 @@ proof - interpret vec_VS: vectorspace class_ring "(module_vec TYPE('a mod_ring) n)" by (rule VS_Connect.vec_vs) interpret linear_map class_ring W "(module_vec TYPE('a mod_ring) n)" ?f by (intro_locales, unfold mod_hom_axioms_def module_hom_def, by (intro_locales, unfold mod_hom_axioms_def LinearCombinations.module_hom_def, auto simp add: vec_eq_iff module_vec_def mod_smult_left poly_mod_add_left) have "linear_map class_ring W (module_vec TYPE('a mod_ring) n) ?f" by (intro_locales) ... ...
 ... ... @@ -476,16 +476,6 @@ proof - finally show ?thesis using 0 by auto qed context poly_mod begin definition Dp :: "int poly \ int poly" where "Dp f = map_poly (\ a. a div m) f" lemma Dp_Mp_eq: "f = Mp f + smult m (Dp f)" by (rule poly_eqI, auto simp: Mp_coeff M_def Dp_def coeff_map_poly) end context fixes C :: "int poly" begin ... ...