Formalaa PDF
Formalaa PDF
Set Theory
1 Introduction
In this paper, we study abstract algebra in a formal, automated system where
proofs can be mechanically generated and verified.
Currently most efforts of formalizing algebra using general purpose theorem
provers are grounded in type theory. For example, Gunter working with HOL [1]
has shown the integers mod n to be an implementation of abstract groups [2].
Jackson has implemented computational abstract algebra in NuPRL [3, 4]. In
IMPS [5] there is a notion of little theories [6] which they use for proving theorems
about groups and rings. In Coq [7], a (constructive) algebraic hierarchy of groups,
rings, fields, etc. has been defined and a constructive proof of the Fundamental
Theorem of Algebra was formalized under it [8]. In Isabelle [9] HOL, Kammüller
and Paulson formalized group theory and proved the Sylow theorem [10]. Bailey
has formalized (part of) Galois theory in LEGO [11].
In practice, set theory, as the standard foundation for mathematics, may have
an advantage over type theory. Since there is no extensive tradition of present-
ing mathematics in a type theoretic setting, many techniques for representing
mathematical ideas in a set theoretical language have to be reconsidered for a
type theoretical language. In addition, there is much less variation among set
theories, in which the well known formulations are defined by a small collection
of axioms in the predicate calculus, and for practical purpose, are more or less
equivalent [12]. In particular, set theory can often present a convenient framework
for developing constructive mathematics using ordinary mathematical concepts.
Some theorem provers are based on set theory, like Z [13] and VDM [14], or have
a set theoretic component, like MetaPRL [15, 16] and Isabelle [17].
In this paper, we present a formalization of group theory, which is taken as
a first step in formalizing abstract algebra, in constructive set theory in Meta-
PRL. Though we have not gone as far as the work in type theory, considering
the advantage of set theory over type theory and the fact that abstract algebra
is traditionally defined in the language of set theory, we take this work as a good
start of exploring how well set theory can do in formalizing abstract algebra.
Though a classical set-theoretic treatment of abstract algebra has been developed
in Mizar [18, 19] for over a decade [20], the Mizar software only provides tools for
checking correctness of mathematical texts, in other words, Mizar helps one to
verify a proof, but not to build a proof. In our work, people can not only verify
a proof, but also build proofs by themselves.
We first specify the group axioms as a collection of inference rules, defining a
logic for groups. Then we can tell whether a given set with a binary operation is
a group or not, and derive all properties of groups from these inference rules as
well as the axioms of the set theory. The formalization of other abstract algebra
concepts, such as subgroups and homomorphisms, is based on that of the group.
We have proved many theorems of group theory in an actual formal system (the
MetaPRL system). As a verification of the method and a good illustration of
constructivity, such a machine-checked formalization plays an important role in
our implementation. In the interest of space, we only give an overview of our
formalization and sketch some proofs in this paper; more details can be found
in [21, 22].
The contributions of this paper include the following:
2
Aczel’s CZF theory is described completely explicitly with a collection of axioms,
after sets and these axioms are encoded in MetaPRL’s CZF module, we can use
them directly without referring to the type theory.
In CZF, all non-propositional elements of the set theory are sets; the num-
bers and other structures are coded in the usual manner. Sets use an extensional
equality; two sets are considered equal if they have the same elements. The fol-
lowing concepts have been formalized in MetaPRL’s CZF module: extensional
set equality s1 =s s2 , membership s1 ∈s s2 , first-order logic which includes
the restricted quantifiers ∀x ∈s s, P [x] and ∃x ∈s s, P [x], and the unrestricted
quantifiers ∀s x.P [x] and ∃s x.P [x], subset s1 ⊆ s2 , separation {x ∈s s | P [x]},
empty set {}, singleton set {s}, binary union s1 ∪ s2 , general union ∪s,
unordered pairing (s1 , s2 ), and infinity (the natural numbers) ω. The sub-
script s in the representations of s1 =s s2 , etc., means this is set theoretical
compared with those type theoretic implementations in MetaPRL’s ITT module.
Our formalization of abstract algebra is built on the basis of MetaPRL’s CZF
implementation.
3
G1, G2, and G3 must be included in the collection of axioms since they are
the most essential in defining groups (see 5-7 in the list below). In addition, since
we are working in set theory, some axioms about the well-formedness of the group
terms are needed (as number 1 describes). Furthermore, the properties of binary
operation, unary operation, etc. are usually taken for granted when working
informally on paper; in a mechanized system, they must be stated explicitly, so
axioms 2 through 4 are necessary.
1. In the CZF set theory of MetaPRL, anything that is not a proposition should
be a set: carg and eg are sets; for any sets a and b, a ∗g b and a0g are sets.
Γ ` g is a label Γ ` g is a label Γ ` a is a set Γ ` b is a set
, ,
Γ ` carg is a set Γ ` a ∗g b is a set
Γ ` g is a label Γ ` g is a label Γ ` a is a set
, .
Γ ` eg is a set Γ ` a0g is a set
2. For ∗g to be a binary operation on carg , carg has to be closed under ∗g , and
exactly one element is assigned to each possible ordered pair of elements of
carg under ∗g , i.e., for any a, b, c ∈ carg , if a = b, then a ∗g c = b ∗g c and
c ∗g a = c ∗g b.
4
6. eg is the left identity.
Γ ` g is a label Γ ` groupg Γ ` a is a set Γ ` a ∈s carg
Γ ` eg ∗g a =s a
0g
7. is the left inverse operation.
Γ ` g is a label Γ ` groupg Γ ` a is a set Γ ` a ∈s carg
Γ ` a0g ∗g a =s eg
The above rules define the axioms for groups. For any instance of a group, we
will need to verify the axioms. However, for general groups, many properties are
immediate, such as the left inverse/identity is also the right inverse/identity, and
a ∗ b = a ∗ c implies b = c given a, b, c ∈ G for any group hG, ∗i. We also proved
somewhat more complicated theorems, such as the uniqueness of the identity, the
uniqueness of the inverse operation, and the unique solutions for linear equations
a ∗ x = b and y ∗ a = b in the group hG, ∗i where a, b ∈ G.
In MetaPRL, these properties are proved in a straightforward way. The basic
idea is similar to that done by hand, but since MetaPRL is an interactive system
and provides some automated reasoning, some proofs tend to be easier. Mean-
while, since CZF in MetaPRL is not yet sufficiently automated, some extra effort
might be needed in the proofs. For illustration, we present a proof of one of the
theorems below.
Suppose we have already proved, from the axioms of groups and CZF, that
the left inverse is also the right inverse and now we want to prove the left identity
is also the right identity. First we need to add the statement of this theorem to
the Czf itt group module:
Γ ` g is a label Γ ` a is a set Γ ` groupg Γ ` a ∈s carg
.
Γ ` a ∗g eg =s a
Our idea for proving it is
a ∗g eg =s a ∗g (a0g ∗g a) =s (a ∗g a0g ) ∗g a =s eg ∗g a =s a,
where the second equation holds because of the associativity of ∗g and the third
holds because the left inverse is also the right inverse.
To prove it in the MetaPRL proof editor, we first need to replace eg with
a0g ∗g a, which can be done by a tactic setSubstT provided by MetaPRL’s CZF
theory. The usage is setSubstT (s1 =s s2 ) i, which replaces all occurrences of
the term s1 with s2 in clause i (i = 0 implies the conclusion). So we navigate to
this rule and apply the setSubstT (eg =s a0g ∗g a) 0 thenT autoT tactic.3
Two subgoals are generated. The first one,
Γ ` g is a label Γ ` a is a set Γ ` groupg Γ ` a ∈s carg
,
Γ ` eg =s a0g ∗g a
3
The autoT tactic performs “automated” proving based on repeated application of
several “basic” tactics; and the infix function thenT is a tactical used for sequencing:
the proof first applies the substitution, and then applies the autoT tactic [15].
5
is trivial since we have the axiom
Γ ` g is a label Γ ` a is a set Γ ` groupg Γ ` a ∈s carg
Γ ` a0g ∗g a =s eg
and =s is symmetric. With the use of the eqSetSymT tactic provided by MetaPRL,
this subgoal is proved.
As for the second subgoal,
Γ ` g is a label Γ ` a is a set Γ ` groupg Γ ` a ∈s carg
,
Γ ` a ∗g (a0g ∗g a) =s a
we can utilize the associativity axiom G1 by applying the tactic setSubstT (a ∗g
(a0g ∗g a) =s (a ∗g a0g ) ∗g a) 0 thenT autoT, which generates a new subgoal
Since abelg implies groupg , all the properties of groups hold for abelg .
The last condition ensures that ∗h is the induced operation on carh from carg .
We proved that if subgrouph,g , then 1) carh is closed under ∗g ; 2) eh =s eg ,
and eg ∈s carh ; 3) for all a ∈s carh , a0h =s a0g and a0g ∈s carh .
4
↔ is definitional equivalence.
6
2.4 The Power Operation
Before formalizing cyclic subgroups and cyclic groups, let us study the “power”
operation which is prerequisite for defining cyclic subgroups and cyclic groups.
Suppose hG, ∗i is a group. For any element a ∈ G, we define
|a ∗ a {z
∗ ... ∗ a} if n > 0
n
an = e if n = 0
0 0 0
| a ∗ a ∗
{z ... ∗ a} if n < 0
−n
where n is of the integer type in ITT and the induction is also the one in ITT.
From this definition, we can prove, by induction, that the power operation
has the following properties:
1. Well-formedness.
Γ ` g is a label Γ ` a is a set Γ ` n ∈ Z
Γ ` (an )g is a set
3. The power operation is functional, which means it computes equal set values
for equal base arguments.
7
Also, with the use of arithmetic rules in the ITT type theory, we can prove
Note that we are using a type theoretic existential within the construction; the
CZF implementation in MetaPRL allows this.
Now we define “h is a cyclic subgroup of g generated by a” as
cyc subgh,g,a ↔ subgrouph,g ∧a ∈s carg ∧carh =s sep(x ∈s carg |∃n ∈ Z.x =s (an )g ).
8
The last condition might look strange at the first glance. What it actually means
is the carrier is such a set that any element in it is to some integer power of a.
We proved that cycgg is equivalent to ∃a ∈s carg .cycgg,a .
A cyclic group must be abelian, which is easy to prove formally. Suppose we
want to conclude from cycgg that abelg . Since group g is cyclic, it has a generator
a and for any two elements x and y of carg , there exist m and n in Z such that
x =s (am )g and y =s (an )g . g is abelian requires
x ∗g y =s y ∗g x, i.e., (am )g ∗g (an )g =s (an )g ∗g (am )g .
We already have the result
Γ ` g is a label Γ ` groupg Γ ` a is a set
Γ ` a ∈s carg Γ ` m ∈ Z Γ ` n ∈ Z
,
Γ ` (am )g ∗g (an )g =s (am+n )g
so it turns out that we need to prove
(am+n )g =s (an+m )g ,
which is trivial by the commutativity of addition.
9
homh,g,f is functional in the sense that for any two equal mappings f and f 0 ,
homh,g,f always implies homh,g,f 0 .
To illustrate our formalization of the homomorphism, let us study a simple
example—the trivial homomorphism, which is a mapping fe from a group H into
a group G such that fe (a) = eG for all a ∈ H. Suppose H and G are represented
by labels h and g respectively. For any a, b ∈s carh , fe (a) =s fe (b) =s eg , so fe (a)
is a set, fe (a) ∈s carg , and a =s b ⇒ fe (a) =s fe (b). h is a group implies a ∗h b is
in carh , so fe (a ∗h b) =s eg , which in turn is equal to eg ∗g eg =s fe (a) ∗g fe (b).
All the conditions for homh,g,fe are satisfied; homh,g,fe holds.
Homomorphisms preserve group structure. Put differently, if f is a group
homomorphism from H into G, we might know the structure of G from that of
H. For example, f maps the identity of H to that of G; it also maps the inverse
of an element a in H to the inverse of f [a] in G. And if f is onto and H is
abelian, then G must also be abelian. In addition, if H1 is a subgroup of H, then
the image f [H1 ] of H1 under f is a subgroup of G; if G1 is a subgroup of G, then
the inverse image f −1 [G1 ] of G1 is a subgroup of H. We have proved all these
properties of homomorphisms in MetaPRL.
Once homomorphism is formalized, the formalization for isomorphism is triv-
ial since an isomorphism is a bijective homomorphism, i.e., it is a homomorphism
that is one to one and onto. We define “f : H → G is an isomorphism” as
Noticing that
10
3 Discussion of the Formalization
With these definitions, we can verify that all of the group axioms are satisfied
for klein4 , without assuming groupklein4 . For example, we can prove the axiom
G2 for klein4
Γ ` a is a set Γ ` a ∈s carklein4
.
Γ ` eklein4 ∗klein4 a =s a
First, since carklein4 is defined as {k0 } ∪ {k1 } ∪ {k2 } ∪ {k3 }, from the properties
of union and singularity, it can be proved that if a ∈s carklein4 , then a must be
equal to one of k0 , k1 , k2 , k3 . Then for each of these four cases, by definition,
11
All the other group axioms can be proved similarly for the klein4 case. Thus we
can conclude that this is a group and can make the hypothesis groupklein4 . As a
consequence, all the group theorems apply for klein4 .
3.2 Constructivity
Constructivity sometimes makes things harder, especially for work done with
machines. For example, classically, there is a theorem “any subgroup of a cyclic
group is cyclic.” The proving process for the nontrivial case (i.e., the subgroup is
other than {e} where e is the identity) is assuming G is a cyclic group generated
by a and H is a subgroup of G, then supposing m is the smallest integer in
Z+ such that am ∈ H, and then claiming and proving am generates H. One of
the problems is that in order to assume that m is the smallest natural number
such that am ∈ H we need to prove such m exists. In constructive mathematics,
the validity of such an existential statement would imply being able to actually
compute m. In a straightforward formulation like the one we have implemented,
this is not generally possible (since the group membership could be undecidable).
On the other side, constructivity sometimes has advantages. For example, we
can extract computational content from the proofs, which allows us to use our
formalism for developing guaranteed correct formal abstract algebra algorithms
by extracting them from proofs of existentials. However, algorithms extracted
naively from proofs are often inefficient. Although Caldwell [26] and Nogin [27]
demonstrate methods to address this problem, we have not explored this option
in detail in MetaPRL.
12
by allowing ourselves to use the type theoretic concepts more freely in our for-
malization. This way we might be able to come up with some natural “hybrid”
formalization where some aspects are formalized using set theoretic concepts and
some using type theoretic concepts, picking the most natural approach in every
case.
5 Acknowledgments
The authors would like to thank Aleksey Nogin. His valuable observations have
greatly improved the contents and the presentation of the paper. We also want
to thank Alexei Kopylov for discussions on the formalization.
References
1. Gordon, M., Melham, T.: Introduction to HOL: A Theorem Proving Environment
for Higher-Oder Logic. Cambridge University Press, Cambridge (1993)
2. Gunter, E.: Doing algebra in simple type theory. Technical Report MS-CIS-89-
38, Logic & Computation 09, Department of Computer and Information Science,
Moore School of Engineering, University of Pennsylvania (1989) Distributed with
the HOL system in the directory Training/studies/intmod/doingalgpaper.
3. Constable, R.L., Allen, S.F., Bromley, H.M., Cleaveland, W.R., Cremer, J.F.,
Harper, R.W., Howe, D.J., Knoblock, T.B., Mendler, N.P., Panangaden, P., Sasaki,
J.T., Smith, S.F.: Implementing Mathematics with the NuPRL Development Sys-
tem. Prentice-Hall, NJ (1986)
4. Jackson, P.B.: Exploring abstract algebra in constructive type theory. In Bundy,
A., ed.: Proceedings of the 12th International Conference on Automated Deduction.
Volume 814 of Lecture Notes in Artificial Intelligence., New York, Springer-Verlag
(1994) 590–604
5. Farmer, W.M., Guttman, J.D., Thayer, F.J.: IMPS: An interactive mathematical
proof system. Journal of Automated Reasoning 11 (1993) 213–248
13
6. Farmer, W.M., Joshua D. Guttman, F.J.T.: Little theories. In Kapur, D.,
ed.: Automated-Deduction-CADE-11. Lecture Notes in Artificial Intelligence, New
York, Springer-Verlag (1992) 567–581
7. Barras, B., Boutin, S., Cornes, C., Courant, J., Filliâtre, J.C., Giménez, E., Herbe-
lin, H., Gérard-Mohring, Saı̈bi, A., Werner, B.: The Coq Proof Assistant Reference
Manual. INRIA-Rocquencourt, CNRS and ENS Lyon. (1996)
8. Geuvers, H., Wiedijk, F., Zwanenburg, J.: A constructive proof of the fundamental
theorem of algebra without using the rationals. In Callaghan, P., Luo, Z., McKinna,
J., Pollack, R., eds.: Types for Proofs and Programs, Proceedings of the Interna-
tional Workshop TYPES 2000. Volume 2277 of Lecture Notes in Computer Science.,
Springer (2001) 96–111
9. Paulson, L., Nipkow, T.: Isabelle tutorial and user’s manual. Technical report,
University of Cambridge Computing Laboratory (1990)
10. Kammüller, F., Paulson, L.C.: A formal proof of Sylow’s first theorem – an exper-
iment in abstract algebra with Isabelle HOL. Journal of Automated Reasoning 23
(1999) 235–264
11. Bailey, A.J.: The Machine-Checked Literate Formalization of Algebra in Type
Theory. PhD thesis, University of Manchester (1998)
12. Gordon, M.J.C.: Merging HOL with set theory: preliminary experiments. Technical
Report 353, University of Cambridge Computer Laboratory (1994)
13. Spivey, J.M.: The Z Notation – A Reference Manual. 2nd edn. Prentice Hall
International Series in Computer Science (1992)
14. Jones, C.B.: Systematic Software Development using VDM. Prentice-Hall, Upper
Saddle River, NJ 07458, USA (1990)
15. Hickey, J.J.: The MetaPRL Logical Programming Environment. PhD thesis, Cornell
University, Ithaca, NY (2001)
16. Hickey, J.J., Nogin, A., Kopylov, A., et al.: (MetaPRL home page) http://metaprl.
org/.
17. Paulson, L.C.: Set theory for verification: I from foundations to functions. Journal
of Automated Reasoning 11 (1993) 353–389
18. Rudnicki, P.: An overview of the Mizar project. Notes to a talk at the workshop
on Types for Proofs and Programs (1992)
19. Trybulec, W.A., et al.: (Mizar home page) http://www.mizar.org/.
20. Trybulec, W.A.: Groups. Journal of Formalized Mathematics 2 (1990) http:
//mizar.org/JFM/Vol2/group_1.html.
21. Hickey, J.J., Aydemir, B., Bryukhov, Y., Kopylov, A., Nogin, A., Yu, X.: (A listing
of MetaPRL theories) http://metaprl.org/theories.pdf.
22. Yu, X.: Formalizing abstract algebra in constructive set theory. Master’s thesis,
California Institute of Technology (2002)
23. Myhill, J.: Constructive set theory. Journal of Symbolic Logic 40 (1975) 347–382
24. Aczel, P., Rathjen, M.: Notes on constructive set theory. Technical Report 40,
Mittag-Leffler (2000/2001)
25. Martin-Löf, P.: Intuitionistic Type Theory. Number 1 in Studies in Proof Theory,
Lecture Notes. Bibliopolis, Napoli (1984)
26. Caldwell, J.: Moving proofs-as-programs into practice. In: Proceedings of the
12th IEEE International Conference on Automated Software Engineering, IEEE
Computer Society (1997)
27. Nogin, A.: Writing constructive proofs yielding efficient extracted programs.
In Galmiche, D., ed.: Proceedings of the Workshop on Type-Theoretic Lan-
guages: Proof Search and Semantics. Volume 37 of Electronic Notes in Theoretical
Computer Science., Elsevier Science Publishers (2000) http://www.elsevier.nl/
gej-ng/31/29/23/67/22/show/Products/notes/index.htt#005.
14