Theory Distinguished_Quotients
theory Distinguished_Quotients
imports Main
begin
section βΉDistinguished Algebraic QuotientsβΊ
text βΉ
We define quotient groups and quotient rings modulo distinguished normal subgroups and ideals,
respectively, leading to the construction of a field as a commutative ring with 1 modulo a
maximal ideal.
βΊ
class distinguished_subset =
fixes distinguished_subset :: "'a set" ("π©")
hide_const distinguished_subset
subsection βΉQuotient groupsβΊ
subsubsection βΉClass definitionsβΊ
text βΉHere we set up subclasses of @{class group_add} with a distinguished subgroup.βΊ
class group_add_with_distinguished_subgroup = group_add + distinguished_subset +
assumes distset_nonempty: "π© β {}"
and distset_diff_closed:
"g β π© βΉ h β π© βΉ g - h β π©"
begin
lemma distset_zero_closed : "0 β π©"
proof-
from distset_nonempty obtain g::'a where "g β π©" by fast
hence "g - g β π©" using distset_diff_closed by fast
thus ?thesis by simp
qed
lemma distset_uminus_closed: "a β π© βΉ -a β π©"
using distset_zero_closed distset_diff_closed by force
lemma distset_add_closed:
"a β π© βΉ b β π© βΉ a + b β π©"
using distset_uminus_closed[of b] distset_diff_closed[of a "-b"] by simp
lemma distset_uminus_plus_closed:
"a β π© βΉ b β π© βΉ -a + b β π©"
using distset_uminus_closed distset_add_closed by simp
lemma distset_lcoset_closed1:
"a β π© βΉ -a + b β π© βΉ b β π©"
using add.assoc[of a "-a" b] distset_add_closed by fastforce
lemma distset_lcoset_closed2:
"b β π© βΉ -a + b β π© βΉ a β π©"
proof-
assume ab: "b β π©" "-a + b β π©"
from ab(2) obtain z where z: "z β π©" "-a + b = z" by fast
from z(2) have "a = -(z - b)" using add.assoc[of "-a" b "-b"] by simp
with ab(1) z(1) show "a β π©" using distset_diff_closed by simp
qed
lemma reflp_lcosetrel: "- x + x β π©"
using distset_zero_closed by simp
lemma symp_lcosetrel: "- a + b β π© βΉ - b + a β π©"
using distset_uminus_closed by (fastforce simp add: minus_add)
lemma transp_lcosetrel:
"-x + z β π©" if "-x + y β π©" and "-y + z β π©"
proof-
from that obtain a a' :: 'a
where "a β π©" "-x + y = a" "a' β π©" "-y + z = a'" by fast
thus ?thesis using add.assoc[of a "-y" z] distset_add_closed by fastforce
qed
end
class group_add_with_distinguished_normal_subgroup = group_add_with_distinguished_subgroup +
assumes distset_normal: "((+) g) ` π© = (Ξ»x. x + g) ` π©"
class ab_group_add_with_distinguished_subgroup =
ab_group_add + group_add_with_distinguished_subgroup
begin
subclass group_add_with_distinguished_normal_subgroup
proof (unfold_locales, rule distset_nonempty, rule distset_diff_closed)
show "βg. ((+) g) ` π© = (Ξ»x. x + g) ` π©" by (force simp add: add.commute)
qed
end
subsubsection βΉThe quotient group typeβΊ
text βΉ
Here we define a quotient type relative to the left-coset relation, and instantiate it as a
@{class group_add}.
βΊ
quotient_type (overloaded) 'a coset_by_dist_sbgrp =
"'a::group_add_with_distinguished_subgroup" / "Ξ»g h :: 'a. -g + h β (π©::'a set)"
morphisms distinguished_quotient_coset_rep distinguished_quotient_coset
proof (rule equivpI)
show "reflp (Ξ»g h :: 'a. -g + h β π©)" using reflp_lcosetrel by (fast intro: reflpI)
show "symp (Ξ»g h :: 'a. -g + h β π©)" using symp_lcosetrel by (fast intro: sympI)
show "transp (Ξ»g h :: 'a. -g + h β π©)" using transp_lcosetrel
by (fast intro: transpI)
qed
lemmas distinguished_quotient_coset_rep_inverse =
Quotient_abs_rep[OF Quotient_coset_by_dist_sbgrp]
and coset_by_dist_sbgrp_eq_iff =
Quotient_rel_rep[OF Quotient_coset_by_dist_sbgrp]
and distinguished_quotient_coset_eqI =
Quotient_rel_abs[OF Quotient_coset_by_dist_sbgrp]
and eq_to_distinguished_quotient_cosetI =
Quotient_rel_abs2[OF Quotient_coset_by_dist_sbgrp]
lemma coset_coset_by_dist_sbgrp_cases
[case_names coset, cases type: coset_by_dist_sbgrp]:
"(βy. z = distinguished_quotient_coset y βΉ P) βΉ P"
by (induct z) auto
lemmas distinguished_quotient_coset_eq_iff = coset_by_dist_sbgrp.abs_eq_iff
lemma distinguished_quotient_coset_rep_coset_equiv:
"- distinguished_quotient_coset_rep (distinguished_quotient_coset r) + r β π©"
using Quotient_rep_abs[OF Quotient_coset_by_dist_sbgrp]
by (simp add: distset_zero_closed)
instantiation coset_by_dist_sbgrp ::
(group_add_with_distinguished_normal_subgroup) group_add
begin
lift_definition zero_coset_by_dist_sbgrp :: "'a coset_by_dist_sbgrp"
is "0::'a" .
lemmas zero_distinguished_quotient [simp] = zero_coset_by_dist_sbgrp.abs_eq[symmetric]
lemma zero_distinguished_quotient_eq_iffs:
"(distinguished_quotient_coset x = 0) = (x β π©)"
"(X = 0) = (distinguished_quotient_coset_rep X β π©)"
proof-
have "distinguished_quotient_coset x = 0 βΉ x β π©"
proof transfer
fix x::'a show "- x + 0 β π© βΉ x β π©"
using distset_uminus_closed[of "-x"] by simp
qed
moreover have "x β π© βΉ distinguished_quotient_coset x = 0"
by transfer (simp add: distset_uminus_closed)
ultimately show "(distinguished_quotient_coset x = 0) = (x β π©)" by fast
have "distinguished_quotient_coset_rep 0 β π©"
using distinguished_quotient_coset_rep_coset_equiv[of "0::'a"] distset_uminus_closed
by fastforce
moreover have "distinguished_quotient_coset_rep X β π© βΉ X = 0"
using eq_to_distinguished_quotient_cosetI[of X 0] by (simp add: distset_uminus_closed)
ultimately show "(X = 0) = (distinguished_quotient_coset_rep X β π©)" by fast
qed
lift_definition plus_coset_by_dist_sbgrp ::
"'a coset_by_dist_sbgrp β 'a coset_by_dist_sbgrp β
'a coset_by_dist_sbgrp"
is "Ξ»x y::'a. x + y"
proof-
fix w x y z :: 'a assume wx: "-w+x β π©" and yz: "-y+z β π©"
from this obtain a1 a2
where a1: "a1 β π©" "-w + x = a1"
and a2: "a2 β π©" "-y + z = a2"
by fast
from a1(1) obtain a3 where a3: "a3 β π©" "-y + a1 = a3 + -y" using distset_normal by fast
from a1(2) a2(2) a3(2) have "-(w + y) + (x + z) = a3 + a2"
using minus_add add.assoc[of "-y + -w" x z] add.assoc[of "-y" "-w" x] add.assoc[of a3 "-y" z]
by simp
with a2(1) a3(1) show "-(w + y) + (x + z) β π©" using distset_add_closed by simp
qed
lemmas plus_coset_by_dist_sbgrp [simp] = plus_coset_by_dist_sbgrp.abs_eq
lift_definition uminus_coset_by_dist_sbgrp ::
"'a coset_by_dist_sbgrp β 'a coset_by_dist_sbgrp"
is "Ξ»x::'a. -x"
proof-
fix x y :: 'a assume xy: "-x + y β π©"
from this obtain a where a: "a β π©" "-x + y = a" by fast
from a(1) obtain a' where a': "a'βπ©" "a + -y = -y + a'" using distset_normal by fast
from a(2) a'(2) have "- (-x) + -y = -(- y + a') + -y"
using add.assoc[of "-x" y "-y"] by simp
hence "- (-x) + -y = -a'" by (simp add: minus_add)
with a'(1) show "- (-x) + -y β π©" using distset_uminus_closed by simp
qed
lemmas uminus_coset_by_dist_sbgrp [simp] =
uminus_coset_by_dist_sbgrp.abs_eq
lift_definition minus_coset_by_dist_sbgrp ::
"'a coset_by_dist_sbgrp β 'a coset_by_dist_sbgrp β
'a coset_by_dist_sbgrp"
is "Ξ»x y::'a. x - y"
proof-
fix w x y z :: 'a assume wx: "-w + x β π©" and yz: "-y + z β π©"
from this obtain a1 a2
where a1: "a1 β π©" "x = w + a1"
and a2: "a2 β π©" "z = y + a2"
by simp
from a1(1) obtain a3 where a3: "a3 β π©" "y + a1 = a3 + y" using distset_normal by auto
from a2(1) obtain a4 where a4: "a4 β π©" "y + a2 = a4 + y" using distset_normal by auto
from a3(2) a4(2) a1(2) a2(2) have "x - z = w - y + a3 + y - y - a4"
using add.assoc[of "w - y" y a1] add.assoc[of "w - y" a3 y]
add.assoc[of "w - y + a3" y "-y"]
by (simp add: algebra_simps)
hence "x - z = (w - y) + (a3 - a4)"
using add.assoc[of "w - y + a3" y "-y"] add.assoc[of "w - y" a3 "-a4"] by simp
hence "-(w - y) + (x - z) = a3 - a4"
using add.assoc[of "-(w - y)" "w - y" "a3 - a4", symmetric]
left_minus[of "w - y"]
by simp
with a3(1) a4(1) show "-(w - y) + (x - z) β π©" using distset_diff_closed by auto
qed
lemmas minus_coset_by_dist_sbgrp [simp] = minus_coset_by_dist_sbgrp.abs_eq
instance proof
fix x y z :: "'a coset_by_dist_sbgrp"
show "x + y + z = x + (y + z)" by transfer (simp add: distset_zero_closed algebra_simps)
show " 0 + x = x" by transfer (simp add: distset_zero_closed)
show " x + 0 = x" by transfer (simp add: distset_zero_closed)
show "-x + x = 0" by transfer (simp add: distset_zero_closed)
show "x + - y = x - y" by transfer (simp add: distset_zero_closed algebra_simps)
qed
end
instance coset_by_dist_sbgrp ::
(ab_group_add_with_distinguished_subgroup) ab_group_add
proof
show "βx y :: 'a coset_by_dist_sbgrp. x + y = y + x"
by transfer (simp add: distset_zero_closed)
qed auto
subsection βΉQuotient ringsβΊ
subsubsection βΉClass definitionsβΊ
text βΉNow we set up subclasses of @{class ring} with a distinguished ideal.βΊ
class ring_with_distinguished_ideal = ring + ab_group_add_with_distinguished_subgroup +
assumes distset_leftideal : "a β π© βΉ r * a β π©"
and distset_rightideal: "a β π© βΉ a * r β π©"
class ring_1_with_distinguished_ideal = ring_1 + ring_with_distinguished_ideal +
assumes distset_no1: "1βπ©"
subsubsection βΉThe quotient ring typeβΊ
text βΉ
We just reuse the @{typ "'a coset_by_dist_sbgrp"} type to define a quotient ring, and
instantiate it as a @{class ring}.
βΊ
type_synonym 'a distinguished_quotient_ring = "'a coset_by_dist_sbgrp"
instantiation coset_by_dist_sbgrp :: (ring_with_distinguished_ideal) ring
begin
lift_definition times_coset_by_dist_sbgrp ::
"'a distinguished_quotient_ring β 'a distinguished_quotient_ring β
'a distinguished_quotient_ring"
is "Ξ»x y::'a. x * y"
proof-
fix w x y z :: 'a assume wx: "-w + x β π©" and yz: "-y + z β π©"
from this obtain a1 a2
where a1: "a1 β π©" "-w + x = a1"
and a2: "a2 β π©" "-y + z = a2"
by fast
from a1(2) a2(2) have "-(w * y) + (x * z) = w * a2 + a1 * z"
by (simp add: algebra_simps)
with a1(1) a2(1) show "-(w * y) + (x * z) β π©"
using distset_leftideal[of _ w] distset_rightideal[of _ z] distset_add_closed by auto
qed
lemmas times_coset_by_dist_sbgrp [simp] = times_coset_by_dist_sbgrp.abs_eq
instance proof
fix x y z :: "'a distinguished_quotient_ring"
show "x * y * z = x * (y * z)" by transfer (simp add: distset_zero_closed algebra_simps)
show "(x + y) * z = x * z + y * z" by transfer (simp add: distset_zero_closed algebra_simps)
show "x * (y + z) = x * y + x * z" by transfer (simp add: distset_zero_closed algebra_simps)
qed
end
instantiation coset_by_dist_sbgrp :: (ring_1_with_distinguished_ideal) ring_1
begin
lift_definition one_coset_by_dist_sbgrp :: "'a distinguished_quotient_ring"
is "1::'a" .
lemmas one_coset_by_dist_sbgrp [simp] = one_coset_by_dist_sbgrp.abs_eq[symmetric]
instance proof
show "(0::'a distinguished_quotient_ring) β (1::'a distinguished_quotient_ring)"
proof transfer qed (simp add: distset_no1)
next
fix x :: "'a distinguished_quotient_ring"
show "1 * x = x" by transfer (simp add: distset_zero_closed algebra_simps)
show "x * 1 = x" by transfer (simp add: distset_zero_closed algebra_simps)
qed
end
subsection βΉQuotients of commutative ringsβΊ
text βΉ
For a commutative ring, the quotient modulo a prime ideal is an integral domain, and the quotient
modulo a maximal ideal is a field.
βΊ
subsubsection βΉClass definitionsβΊ
class comm_ring_with_distinguished_ideal = comm_ring + ab_group_add_with_distinguished_subgroup +
assumes distset_ideal : "a β π© βΉ r * a β π©"
begin
subclass ring_with_distinguished_ideal
using distset_ideal by unfold_locales (auto simp add: mult.commute)
definition distideal_extension :: "'a β 'a set"
where "distideal_extension a β‘ {x. βr z. z β π© β§ x = r * a + z}"
lemma distideal_extension: "π© β distideal_extension a"
unfolding distideal_extension_def
proof clarify
fix x assume "xβπ©"
hence "xβπ© β§ x = 0*a + x" by simp
thus "βr z. z β π© β§ x = r*a + z" by fast
qed
lemma distideal_extension_diff_closed:
"r β distideal_extension a βΉ s β distideal_extension a βΉ
r - s β distideal_extension a"
unfolding distideal_extension_def
proof clarify
fix r r' z z'
assume "z β π©" "z' β π©"
moreover have "r * a + z - (r' * a + z') = (r - r') * a + (z - z')"
by (simp add: algebra_simps)
ultimately show
"βr'' z''. z'' β π© β§ r * a + z - (r' * a + z') = r'' * a + z''"
using distset_diff_closed by fast
qed
lemma distideal_extension_ideal:
"x β distideal_extension a βΉ r * x β distideal_extension a"
unfolding distideal_extension_def
proof clarify
fix s r z assume "z β π©"
thus "βr' z'. z' β π© β§ s * (r * a + z) = r' * a + z'"
using distset_ideal by (fastforce simp add: algebra_simps)
qed
end
class comm_ring_1_with_distinguished_ideal = ring_1 + comm_ring_with_distinguished_ideal +
assumes distset_no1:
"1βπ©"
begin
subclass ring_1_with_distinguished_ideal using distset_no1 by unfold_locales
lemma distideal_extension_by: "a β distideal_extension a"
unfolding distideal_extension_def
proof
have "0 β π© β§ a = 1 * a + 0" using distset_zero_closed by simp
thus "βr z. z β π© β§ a = r * a + z" by fastforce
qed
end
class comm_ring_1_with_distinguished_pideal = comm_ring_1_with_distinguished_ideal +
assumes distset_pideal: "r * s β π© βΉ r β π© β¨ s β π©"
class comm_ring_1_with_distinguished_maxideal = comm_ring_1_with_distinguished_ideal +
assumes distset_maxideal:
"β¦
π© β I; 1βI;
βr s. r β I β§ s β I βΆ r - s β I;
βa r. a β I βΆ r * a β I
β§ βΉ I = π©"
begin
lemma distset_maxideal_vs_distideal_extension:
"1 β distideal_extension a βΉ distideal_extension a = π©"
using distideal_extension distideal_extension_diff_closed distideal_extension_ideal
distset_maxideal
by force
subclass comm_ring_1_with_distinguished_pideal
proof
fix a b :: 'a
assume ab: "a * b β π©"
have "Β¬ (a β π© β§ b β π©)"
proof clarify
assume a: "a β π©" and b: "b β π©"
define I where "I β‘ distideal_extension b"
have "1 β I"
unfolding distideal_extension_def I_def
proof clarify
fix r z assume rz: "z β π©" "1 = r * b + z"
from rz(2) have "a = r * (a * b) + a * z" using mult_1_right by (simp add: algebra_simps)
moreover from ab rz(1) have "r * (a * b) β π©" and "a * z β π©"
using distset_ideal by auto
ultimately show False using a distset_add_closed by fastforce
qed
with I_def b show False
using distset_maxideal_vs_distideal_extension distideal_extension_by by fast
qed
thus "a β π© β¨ b β π©" by fast
qed
end
subsubsection βΉInstances and instantiationsβΊ
instance coset_by_dist_sbgrp :: (comm_ring_with_distinguished_ideal) comm_ring
proof
fix x y :: "'a distinguished_quotient_ring"
show "x * y = y * x" by transfer (simp add: distset_zero_closed algebra_simps)
qed (simp add: algebra_simps)
instance coset_by_dist_sbgrp :: (comm_ring_1_with_distinguished_ideal) comm_ring_1
by standard (auto simp add: algebra_simps)
instance coset_by_dist_sbgrp :: (comm_ring_1_with_distinguished_pideal) idom
proof (standard, transfer)
fix a b :: 'a show
"-a + 0 β π© βΉ -b + 0 β π© βΉ
-(a * b) + 0 β π©"
using distset_pideal distset_uminus_closed by fastforce
qed
lemma inverse_in_quotient_mod_maxideal:
"βy. -(y * x) + 1 β π©" if "x β π©"
for x :: "'a::comm_ring_1_with_distinguished_maxideal"
proof-
from that have "1 β distideal_extension x βΉ False"
using distset_uminus_closed distset_maxideal_vs_distideal_extension distideal_extension_by
by auto
from this obtain y z where yz: "z β π©" "1 = y * x + z"
using distideal_extension_def by fast
from yz(2) have "- (y * x) + 1 = z" by (simp add: algebra_simps)
with yz(1) show "βy. -(y * x) + 1 β π©" by fast
qed
instantiation coset_by_dist_sbgrp :: (comm_ring_1_with_distinguished_maxideal) field
begin
lift_definition inverse_coset_by_dist_sbgrp ::
"'a distinguished_quotient_ring β 'a distinguished_quotient_ring"
is "Ξ»x::'a. if xβπ© then 0 else (SOME y::'a. -(y*x) + 1 β π©)"
proof-
fix x x' :: 'a
assume xx': "-x + x' β π©"
define ix ix'
where "ix β‘ if x β π© then 0 else (SOME y::'a. -(y * x ) + 1 β π©)"
and "ix' β‘ if x' β π© then 0 else (SOME y::'a. -(y * x') + 1 β π©)"
show "-ix + ix' β π©"
proof (cases "xβπ©")
case True with xx' ix_def ix'_def show ?thesis
using distset_lcoset_closed1[of x] distset_zero_closed by auto
next
case False
with xx' have "x' β π©" using distset_lcoset_closed2 by fast
with ix_def ix'_def False have "-((-ix + ix') * x) + ix' * (x + - x') β π©"
using someI_ex[OF inverse_in_quotient_mod_maxideal]
distset_uminus_plus_closed[of "-(ix * x) + 1" "-(ix' * x') + 1"]
by (force simp add: algebra_simps)
moreover have "ix' * (x + -x') β π©"
using distset_uminus_closed[OF xx'] distset_ideal by auto
ultimately have "(-ix + ix') * x β π©" using distset_lcoset_closed2 by force
with False show ?thesis using distset_pideal by fast
qed
qed
lemma inverse_coset_by_dist_sbgrp_eq0 [simp]:
"x β π© βΉ inverse (distinguished_quotient_coset x) = 0"
by transfer (simp add: distset_zero_closed)
lemma coset_by_dist_sbgrp_inverse_rep:
"x β π© βΉ -(y * x) + 1 β π© βΉ
inverse (distinguished_quotient_coset x) = distinguished_quotient_coset y"
proof transfer
fix x y :: 'a
assume xy: "x β π©" "-(y * x) + 1 β π©"
define z :: 'a where "z β‘ (SOME y. - (y * x) + 1 β π©)"
with xy have "(-z + y) * x β π©"
using someI_ex[OF inverse_in_quotient_mod_maxideal]
distset_diff_closed[of "-(z * x) + 1" "-(y * x) + 1"]
by (fastforce simp add: algebra_simps)
with xy(1) show "- (if x β π© then 0 else z) + y β π©"
using distset_pideal by auto
qed
definition divide_coset_by_dist_sbgrp_def [simp]:
"x div y = (x::'a distinguished_quotient_ring) * inverse y"
lemma coset_by_dist_sbgrp_divide_rep:
"y β π© βΉ -(z * y) + 1 β π© βΉ
distinguished_quotient_coset x div distinguished_quotient_coset y
= distinguished_quotient_coset (x * z)"
by (simp add: coset_by_dist_sbgrp_inverse_rep)
instance proof
show "inverse (0::'a distinguished_quotient_ring) = 0"
by transfer (simp add: distset_zero_closed)
next
fix x :: "'a distinguished_quotient_ring"
show "x β 0 βΉ inverse x * x = 1"
proof transfer
fix a::'a
assume "-a + 0 β π©"
moreover define ia
where "ia β‘ if a β π© then 0 else (SOME b. - (b * a) + 1 β π©)"
ultimately show "-(ia * a) + 1 β π©"
using distset_uminus_closed someI_ex[OF inverse_in_quotient_mod_maxideal] by auto
qed
qed (rule divide_coset_by_dist_sbgrp_def)
end
end