Theory Poly_Divisibility
section ‹The polynomial ring over a field is a Euclidean domain›
theory Poly_Divisibility
imports Poly_Ring Divisibility_Theory Poly_Ideal
begin
text ‹Over a field ‹F›, the polynomial ring ‹F[X]› is a Euclidean domain, with the polynomial
degree as Euclidean function: this is exactly the division algorithm of
‹Poly_Ring› (@{thm [source] Field.poly_divide}) packaged into the abstract
@{locale Euclidean_Domain} of ‹Divisibility_Theory›. The interpretation is
the bridge that endows ‹F[X]› --- for free --- with the whole divisibility tower: it is a
principal ideal domain and a factorial (unique factorization) domain, in which irreducible
polynomials are prime and factorizations into irreducibles exist and are unique up to the number
of factors.›
context Field
begin
text ‹The carrier-set polynomial ring satisfies the abstract Euclidean-domain interface. This
named theorem keeps the division-algorithm proof reusable by the exported sublocale below.›
theorem poly_euclidean_domain:
"Euclidean_Domain poly_carrier (⊕⇩P) (⊗⇩P) 𝟬⇩P 𝟭⇩P degree"
proof -
show "Euclidean_Domain poly_carrier (⊕⇩P) (⊗⇩P) 𝟬⇩P 𝟭⇩P degree"
proof (rule Euclidean_Domain.intro)
show "integral_domain poly_carrier (⊕⇩P) (⊗⇩P) 𝟬⇩P 𝟭⇩P"
by (rule poly_integral_domain)
next
show "Euclidean_Domain_axioms poly_carrier (⊕⇩P) (⊗⇩P) 𝟬⇩P degree"
proof
fix a b assume a: "a ∈ poly_carrier" and b: "b ∈ poly_carrier"
and anz: "a ≠ 𝟬⇩P" and bnz: "b ≠ 𝟬⇩P"
show "∃q∈poly_carrier. ∃r∈poly_carrier.
a = (b ⊗⇩P q) ⊕⇩P r ∧ (r = 𝟬⇩P ∨ degree r < degree b)"
using poly_divide[OF a b bnz] by blast
qed
qed
qed
end