36 abbreviation (in ring) restrict_extensions :: "((('a list \<times> nat) multiset) \<Rightarrow> 'a) ring set" ("\<S>") |
36 abbreviation (in ring) restrict_extensions :: "((('a list \<times> nat) multiset) \<Rightarrow> 'a) ring set" ("\<S>") |
37 where "\<S> \<equiv> law_restrict ` extensions" |
37 where "\<S> \<equiv> law_restrict ` extensions" |
38 |
38 |
39 |
39 |
40 subsection \<open>Basic Properties\<close> |
40 subsection \<open>Basic Properties\<close> |
41 |
|
42 (* ========== *) |
|
43 lemma (in field) is_ring: "ring R" |
|
44 using ring_axioms . |
|
45 (* ========== *) |
|
46 |
41 |
47 lemma law_restrict_carrier: "carrier (law_restrict R) = carrier R" |
42 lemma law_restrict_carrier: "carrier (law_restrict R) = carrier R" |
48 by (simp add: law_restrict_def ring.defs) |
43 by (simp add: law_restrict_def ring.defs) |
49 |
44 |
50 lemma law_restrict_one: "one (law_restrict R) = one R" |
45 lemma law_restrict_one: "one (law_restrict R) = one R" |
368 |
363 |
369 end |
364 end |
370 |
365 |
371 |
366 |
372 subsection \<open>Zorn\<close> |
367 subsection \<open>Zorn\<close> |
373 |
|
374 (* ========== *) |
|
375 lemma Chains_relation_of: |
|
376 assumes "C \<in> Chains (relation_of P A)" shows "C \<subseteq> A" |
|
377 using assms unfolding Chains_def relation_of_def by auto |
|
378 (* ========== *) |
|
379 |
368 |
380 lemma (in ring) exists_core_chain: |
369 lemma (in ring) exists_core_chain: |
381 assumes "C \<in> Chains (relation_of (\<lesssim>) \<S>)" obtains C' where "C' \<subseteq> extensions" and "C = law_restrict ` C'" |
370 assumes "C \<in> Chains (relation_of (\<lesssim>) \<S>)" obtains C' where "C' \<subseteq> extensions" and "C = law_restrict ` C'" |
382 using Chains_relation_of[OF assms] by (meson subset_image_iff) |
371 using Chains_relation_of[OF assms] by (meson subset_image_iff) |
383 |
372 |
643 ultimately have "eval p x = \<zero>" |
632 ultimately have "eval p x = \<zero>" |
644 using ring_hom_memE[OF eval_is_hom[OF carrier_is_subring, of x]] assms(2) by (auto, algebra) |
633 using ring_hom_memE[OF eval_is_hom[OF carrier_is_subring, of x]] assms(2) by (auto, algebra) |
645 with \<open>p \<noteq> []\<close> and \<open>x \<in> carrier R\<close> show "is_root p x" |
634 with \<open>p \<noteq> []\<close> and \<open>x \<in> carrier R\<close> show "is_root p x" |
646 unfolding is_root_def by simp |
635 unfolding is_root_def by simp |
647 qed |
636 qed |
648 |
|
649 (* MOVE TO Polynomial_Dvisibility.thy ================== *) |
|
650 lemma (in domain) associated_polynomials_imp_same_length: (* stronger than "imp_same_degree" *) |
|
651 assumes "subring K R" and "p \<in> carrier (K[X])" and "q \<in> carrier (K[X])" |
|
652 shows "p \<sim>\<^bsub>K[X]\<^esub> q \<Longrightarrow> length p = length q" |
|
653 proof - |
|
654 { fix p q |
|
655 assume p: "p \<in> carrier (K[X])" and q: "q \<in> carrier (K[X])" and "p \<sim>\<^bsub>K[X]\<^esub> q" |
|
656 have "length p \<le> length q" |
|
657 proof (cases "q = []") |
|
658 case True with \<open>p \<sim>\<^bsub>K[X]\<^esub> q\<close> have "p = []" |
|
659 unfolding associated_def True factor_def univ_poly_def by auto |
|
660 thus ?thesis |
|
661 using True by simp |
|
662 next |
|
663 case False |
|
664 from \<open>p \<sim>\<^bsub>K[X]\<^esub> q\<close> have "p divides\<^bsub>K [X]\<^esub> q" |
|
665 unfolding associated_def by simp |
|
666 hence "p divides\<^bsub>poly_ring R\<^esub> q" |
|
667 using carrier_polynomial[OF assms(1)] |
|
668 unfolding factor_def univ_poly_carrier univ_poly_mult by auto |
|
669 with \<open>q \<noteq> []\<close> have "degree p \<le> degree q" |
|
670 using pdivides_imp_degree_le[OF assms(1) p q] unfolding pdivides_def by simp |
|
671 with \<open>q \<noteq> []\<close> show ?thesis |
|
672 by (cases "p = []", auto simp add: Suc_leI le_diff_iff) |
|
673 qed |
|
674 } note aux_lemma = this |
|
675 |
|
676 interpret UP: domain "K[X]" |
|
677 using univ_poly_is_domain[OF assms(1)] . |
|
678 |
|
679 assume "p \<sim>\<^bsub>K[X]\<^esub> q" thus ?thesis |
|
680 using aux_lemma[OF assms(2-3)] aux_lemma[OF assms(3,2) UP.associated_sym] by simp |
|
681 qed |
|
682 (* ================================================= *) |
|
683 |
637 |
684 lemma (in domain) associated_polynomials_imp_same_is_root: |
638 lemma (in domain) associated_polynomials_imp_same_is_root: |
685 assumes "p \<in> carrier (poly_ring R)" and "q \<in> carrier (poly_ring R)" and "p \<sim>\<^bsub>poly_ring R\<^esub> q" |
639 assumes "p \<in> carrier (poly_ring R)" and "q \<in> carrier (poly_ring R)" and "p \<sim>\<^bsub>poly_ring R\<^esub> q" |
686 shows "is_root p x \<longleftrightarrow> is_root q x" |
640 shows "is_root p x \<longleftrightarrow> is_root q x" |
687 proof (cases "p = []") |
641 proof (cases "p = []") |
1451 using is_root_imp_pdivides[of p] roots_mem_iff_is_root[of p] is_root_def[of p a] |
1405 using is_root_imp_pdivides[of p] roots_mem_iff_is_root[of p] is_root_def[of p a] |
1452 unfolding sym[OF univ_poly_carrier] polynomial_def by auto |
1406 unfolding sym[OF univ_poly_carrier] polynomial_def by auto |
1453 with \<open>a \<in># roots p\<close> show ?thesis |
1407 with \<open>a \<in># roots p\<close> show ?thesis |
1454 using assms(3)[of a] by auto |
1408 using assms(3)[of a] by auto |
1455 qed |
1409 qed |
1456 |
|
1457 (* REPLACE th following lemmas on Divisibility.thy ============= *) |
|
1458 (* the only difference is the locale *) |
|
1459 lemma (in monoid) mult_cong_r: |
|
1460 assumes "b \<sim> b'" "a \<in> carrier G" "b \<in> carrier G" "b' \<in> carrier G" |
|
1461 shows "a \<otimes> b \<sim> a \<otimes> b'" |
|
1462 by (meson assms associated_def divides_mult_lI) |
|
1463 |
|
1464 lemma (in comm_monoid) mult_cong_l: |
|
1465 assumes "a \<sim> a'" "a \<in> carrier G" "a' \<in> carrier G" "b \<in> carrier G" |
|
1466 shows "a \<otimes> b \<sim> a' \<otimes> b" |
|
1467 using assms m_comm mult_cong_r by auto |
|
1468 (* ============================================================= *) |
|
1469 |
1410 |
1470 lemma (in field) associated_polynomials_imp_same_roots: |
1411 lemma (in field) associated_polynomials_imp_same_roots: |
1471 assumes "p \<in> carrier (poly_ring R)" "p \<noteq> []" and "q \<in> carrier (poly_ring R)" "q \<noteq> []" |
1412 assumes "p \<in> carrier (poly_ring R)" "p \<noteq> []" and "q \<in> carrier (poly_ring R)" "q \<noteq> []" |
1472 shows "roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q" |
1413 shows "roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q" |
1473 proof - |
1414 proof - |
1553 using poly_mult_degree_one_monic_imp_same_roots[OF a q] p less(1)[OF _ q] |
1494 using poly_mult_degree_one_monic_imp_same_roots[OF a q] p less(1)[OF _ q] |
1554 by (metis Suc_le_mono lessI size_add_mset) |
1495 by (metis Suc_le_mono lessI size_add_mset) |
1555 qed |
1496 qed |
1556 qed |
1497 qed |
1557 |
1498 |
1558 (* MOVE to Divisibility.thy ======== *) |
|
1559 lemma divides_irreducible_condition: |
|
1560 assumes "irreducible G r" and "a \<in> carrier G" |
|
1561 shows "a divides\<^bsub>G\<^esub> r \<Longrightarrow> a \<in> Units G \<or> a \<sim>\<^bsub>G\<^esub> r" |
|
1562 using assms unfolding irreducible_def properfactor_def associated_def |
|
1563 by (cases "r divides\<^bsub>G\<^esub> a", auto) |
|
1564 |
1499 |
1565 (* MOVE to Polynomial_Divisibility.thy ======== *) |
1500 (* MOVE to Polynomial_Divisibility.thy ======== *) |
1566 lemma (in ring) divides_pirreducible_condition: |
1501 lemma (in ring) divides_pirreducible_condition: |
1567 assumes "pirreducible K q" and "p \<in> carrier (K[X])" |
1502 assumes "pirreducible K q" and "p \<in> carrier (K[X])" |
1568 shows "p divides\<^bsub>K[X]\<^esub> q \<Longrightarrow> p \<in> Units (K[X]) \<or> p \<sim>\<^bsub>K[X]\<^esub> q" |
1503 shows "p divides\<^bsub>K[X]\<^esub> q \<Longrightarrow> p \<in> Units (K[X]) \<or> p \<sim>\<^bsub>K[X]\<^esub> q" |