Keywords

1 Introduction

The formal verification of mathematical theorems profoundly incarnates the basic theories of artificial intelligence, have also attracted more attention from researchers [1].

Some famous mathematical theorems have been already formalized. In 2005, Gonthier and Werner have given the formal proof of the “Four-color Theorem” in Coq [2]. After six years, formal verification of “Odd Order Theorem” has been achieved by Gonthier in [3]. Hales provided formal proof of “Kepler Conjecture” in Isabelle/HOL [4]. There has a list about Formalizing 100 Theorems on the web [5], which will keep track of theorems from this list that have been formalized.

The theorem prover Coq is a tool used to verify whether the proofs of theorems are correct, and the theorem can be taken from general mathematics, protocol verification or safety programs. The Coq system is extremely powerful and expressions in reasoning and programming. Moreover, the process of proofs is built interactively in Coq with the aid of tactics [6]. There are various tactics of available in Coq, which make it become the mainstream tool in the field of interactive theorem proving in the world [7].

Topological spaces constitute a fundamental concept of general topology. There are many ways to create the definition of topological spaces [8]. During the early periods of general topology, some scholar defined the topological spaces by axioms of neighborhood systems or axioms of closure. With the development of general topology, it was revealed that the definition of topological spaces from various basic concepts is equivalent, and one of the convenient tools for exploring topological spaces is to use the axioms of open sets [9].

Being such an elementary concept in general topology, the definition of topological spaces appears in several formalization works with a variable degree of details and generality. A definition of topological spaces has been already formalized by Schepler in Coq contribution libratory based on type theory [10]. The topological spaces theory has been developed based on theorem prover Coq by Wang in [11]. Another work involved the formal description of topological spaces has been carried out by Hölzl in [12], which formalize the development process of space in the history of mathematics, including topological space, metric space and Euclidean space.

This paper presented a computer formalization of topological spaces in Coq. The formal proof of two basic examples in topological spaces is given, including indiscrete topological spaces and discrete topological spaces. The key points of our work are to realize the formal description of equivalent definitions of topological spaces, and to present the machine proof of equivalent definitions based on neighborhood system and closure.

In the paper structure, we briefly give the formalization of set theory in Sect. 2, which act as preliminaries for the formalization of topological space. Section 3 introduces the concepts of topological spaces in Coq based on the axioms of the open sets. We present the formal proof of equivalent definitions of topological spaces based on neighborhood system and closure in Sect. 4. The conclusions are given in Sect. 5.

2 Formalization of Set Theory

Set theory is the foundation of modern mathematics [13]. The author has done the work about the formalization of axiomatic set theory in [14]. A formalization of naive set theory is introduced based on the axiomatic set theory.

To make our source code more readable, some mathematical symbols are added by using the command Notation, including the quantification symbol ‘∀’ and ‘∃’, logical symbol ‘¬’, ‘\/’ and ‘/\’, symbol ‘→’and‘↔’.

Some basic logical properties are essential in our formal system. In fact, we only need the law of the excluded middle, and some other logical properties can be proved by using it [15]. We can formalize some of the frequently used logical properties as follows:

figure a

The most difference between our work and present formalization efforts in Coq with topological spaces is the type representations of sets and with members of sets. The type of sets and with members of sets is Class in our system, which can formalize as follows:

figure b

The symbols ‘∈’ and ‘{…:…}’ are two primitive constants besides the symbol ‘=’, which formalize as follows:

figure c

We admit there is no set belonging to itself in our system [14]. The formal description of the Axiom of Extent and Classification axiom-scheme in our paper is given as follows:

figure d

Now, we can introduce the definition and properties of set theory. The properties are used repeatedly in the process of proving the rest theorems. Due to space reasons, the formal code of definition and properties is not presented here, and the entire source code file of our paper is available online: https://github.com/BalanceYan/TopologicalSpaces.

3 Topological Spaces in Coq

3.1 Formalization of Topological Spaces

We can realize the definition of topological spaces from open sets, neighborhood systems, closed sets, closure, interior, bases and subbases. In this paper, we presented the definition of topological spaces through the axioms of open sets.

In mainstream mathematics [9], a topological space is defined as a pair of (X, T) where X is a set and T is a subset family of X, and (1) X, ∅ ∈ T; (2) If A, B ∈ T, then A ∩ B ∈ T; (3) If T1 ⊂ T, then ⋃T1 ∈ T. And T is a topology for X, the elements of the topology T are called open relative to T. The previous conditions are called the axioms of open sets. The formal code of topological space is as follows:

figure e

Therefore, we can draw a conclusion: The set X is always open; ∅ is always open; the intersection of any two members of T is always open; the union of the elements of any subset family of T is always open.

3.2 Basic Examples of Topological Spaces

To better understand the definition of topological spaces, we present two basic examples of topological spaces, including indiscrete topological spaces and discrete topological spaces.

The family T has only two elements X and ∅, which is the indiscrete topology for the set X; we called topological space (X, T) an indiscrete topological space. A formal description of these properties is given as follows:

figure f

The family T contains all subsets of X; it is called the discrete topology for the set X. A formal description of these properties is given as follows:

figure g

The reader can find the complete formal proof of the basic examples in the source code file. In addition, limitary complement topological space and countable complement topological space also is basic examples of topological spaces. The reader can further explore and formal proof more examples based on our formal system.

4 Equivalent Definition of Topological Space

4.1 Based on Neighborhood System

In this section, we give a brief account of the formal description of the neighborhood in topological spaces, and also an overview of the most basic properties of the neighborhood.

A set A in a topological space (X, T) is a neighborhood of a point x iff A contains an open set to which x belongs. The neighborhood system of a point is the family of all neighborhoods of the point. The formal description of these definitions is as follows:

figure h
figure i

Theorem 2 shows that the properties of the neighborhood can prove by the axioms of open sets. Theorem 3 achieved the construction of topology from the neighborhood system. Thus, the formal proof of equivalent definition of topological space was completed.

4.2 Based on Closure

We first present the definition of accumulation points, derived sets, closed sets and closure, and formal verification of the basic properties of these definitions.

A point x is an accumulation point of a subset A of a topological space (X, T) iff every neighborhood of x contains point of A other than x.

figure j

The set of all accumulation points of a set A is called the derived set, is denoted by d(A).

figure k

A subset A of a topological space (X, T) is closed if the derived set of A contained in A.

figure l

The closure of a subset A of a topological space (X, T) is the union of the set A and derived set of A, is denoted by A.

figure m
figure n

The mapping c* from the power set of X to the power set of X is called the closure operator on X, and (1) c * (∅) = ∅; (2) A ⊂ c * (A); (3) c*(A⋃B) = c * (A)⋃c * (B); (4) c * (c * (A)) ⊂ c * (A). These four conditions are called Kuratowski closure axioms.

figure o

Theorem 7 presented the construction of topology from Kuratowski closure axioms. The machine proof of equivalent definition of topological space was completed once again.

4.3 Based on Other Concepts

We can also realize the construction of topological spaces by using closed sets, interior, bases, subbases, neighborhood bases and neighborhood subbases. Take the interior, for example, the definition of the interior and the formal verification of the basic properties of the interior are first presented. Then, we set up the topological space by the properties of the interior and realize the machine proof of equivalent definition of topological spaces. Interested readers can construct topological spaces by other concepts based on our work to enhance their understanding.

5 Conclusions

Topological spaces are one of the prominent concepts of general topology. We introduced a definition of topological spaces in Coq based on set theory, which allows us to state and prove basic examples and theorems in topology spaces. We implemented the formal description of equivalent definitions of topological spaces and presented machine proof of theorems about equivalent definitions of topological spaces from neighborhood system and closure. Our code was developed under Coq 8.9.1. The complete source file is accessible at: https://github.com/BalanceYan/TopologicalSpaces.

Furthermore, we will construct topological spaces by other concepts and formalize more theorems in general topology based on present works.