1 Introduction
Sciences study both individual objects and generic ones. For example, Astronomy studies both the individual planets of the Solar system: Mercury, Venus, etc. determining their radius, mass, composition, etc., but also the motion of generic planets: Kepler’s laws, that do not just apply to the six planets known at the time of Kepler, but also to those that have been discovered after, and those that may be discovered in the future. Computer science studies both algorithms that apply to generic data, but also specific pieces of data. Mathematics mostly studies generic objects, but sometimes also specific ones, such as the number or the function .
Proof theory mostly studies generic proofs. For example, Gentzen’s cut elimination theorem for Predicate logic applies to any proof expressed in Predicate logic, those that were known at the time of Gentzen, those that have been constructed after, and those that will be constructed in the future. Much less effort is dedicated to studying the individual mathematical proofs, with a few exceptions, for example [30].
Considering the proofs that we have, instead of all those that we may build in some logic, sometimes changes the perspective. For example, consider a cut elimination theorem for a logic . The stronger the logic , the stronger the theorem. In contrast, consider a specific proof , say a proof of Fermat’s little theorem, and consider a theorem of the form: the proof can be expressed in the logic . In this case, the weaker the logic, the stronger the theorem. So, studying generic proofs leads to focus on stronger and stronger logics, while studying individual proofs, on weaker and weaker ones.
In this paper, we present a program of analyzing the formal proofs that have been developed in computerized proof systems such as Coq^{1}^{1}1coq.inria.fr, Matita^{2}^{2}2matita.cs.unibo.it, HOL Light^{3}^{3}3www.cl.cam.ac.uk/~jrh13/hollight, Isabelle/HOL^{4}^{4}4isabelle.in.tum.de, PVS^{5}^{5}5pvs.csl.sri.com, FoCaLiZe^{6}^{6}6focalize.inria.fr, etc. In particular, we want to be able to analyze in which logicsa each of these proofs can be expressed.
Such a project is largely inspired by the reverse mathematics project [19, 35]
, but has some differences. First, we do not propose to classify theorems according to the logics in which they can be proved, but to classify the proofs according to the logics in which they can be expressed. Some theorems, for example, the prime number theorem, have very different proofs, some very elementary and some very complex. Second, we focus on formal proofs, that is proofs expressed and checked in computerized proof systems. Third, our project is in some sense less ambitious, as it focuses on stronger theories than reverse mathematics. We typically address the question of the possibility to express a proof in the Calculus of constructions
[13], or in Simple type theory [12], while reverse mathematics focuses on fragments of Secondorder arithmetic.Knowing in which logics, which proof can be expressed is a fundamental question, as it is part of our understanding of these proofs. It is also a practical one, as it opens the way to interoperability between computerized proof systems. In the domain of formal proofs, we currently have Coq proofs, HOL Light proofs, etc. of various theorems. And, when we have a Coq proof of a theorem, we do not necessarily have a HOL Light proof of this theorem, and vice versa. The problem of exchanging proofs between proof systems is not just a problem of translation, as these systems cannot express the same proofs. It is primarily the problem of analyzing the logics in which these proofs can or cannot be expressed.
2 From logics to theories
2.1 Logical Frameworks
When a proof is expressed in a logic , analyzing the logics in which this proof can be expressed amounts to analyzing the ingredients of the logic
that it uses. This requires to analyze this logic into a number of ingredients, for example into a number of axioms. Set theory, for example, is naturally analyzed into a number of axioms and axiom schemes, including, for example, the axiom of choice, and this analysis permits to classify the proofs according to the axioms they use: the proof that every vector has a unique decomposition in a given basis does not use the axiom of choice, the proof that every vector space has a basis does. These ingredients of set theory are expressed in a logical framework: Predicate logic. So, analyzing a logic amounts to expressing it as a theory in a logical framework.
To express set theory, it is also possible to choose another logical framework: Constructive predicate logic and add the excluded middle as an axiom scheme. Then, we can express that the proof that every vector has a unique decomposition in a given basis does not use the excluded middle, while the proof of the BolzanoWeierstrass theorem does.
The examples of the axiom of choice and of the excluded middle show that, even in everyday mathematics, we do care about the analysis of proofs, even if this analysis is often restricted to the very specific cases of the axiom of choice and of the excluded middle.
2.2 Axioms and rewrite rules
Predicate logic is certainly the most widely used logical framework. But it also has some limitations. For example, many theories are expressed with an infinite number of axioms and eliminating axiom schemes, like in Von NeumannBernaysGödel set theory, is often cumbersome [29]. Moreover, if Simple type theory can easily be expressed in Predicate logic, expressing the Calculus of constructions, the Calculus of inductive constructions, etc. is more cumbersome.
Another logical framework is that of Pure type systems [7], where it is possible to express Simple type theory, the calculus, the system F, the Calculus of constructions, etc. and analyze these logics into sorts, axioms, and rules. This permits to classify the proofs expressed, for example, in the Calculus of constructions, into those that use the polymorphic rules and those that do not. But this logical framework also has limitations as the Calculus of inductive constructions cannot be expressed in it.
Another logical framework is the calculus, that is the calculus with dependent types [24]. Like in Predicate logic, the ingredients of a logic expressed in this framework are axioms and it is difficult to express in the calculus the logics that include a computational, or definitional, equality that identifies some terms.
So, we shall use another logical framework that is a synthesis of Predicate logic, Pure type systems and the calculus: the calculus modulo theory [14], also called the MartinLöf logical framework [31], where the ingredients of a logic are axioms and rewrite rules, like in Deduction modulo theory [17, 18]. Simple type theory can easily be expressed as a theory in the calculus modulo theory, with three rewrite rules, and the Calculus of constructions as a theory with just four rules. Moreover, the calculus modulo theory has an efficient implementation: the system Dedukti [6], whose first implementation has been presented in [8] and its most recent in [34].
3 Translating proofs expressed in the Calculus of constructions into proofs in Simple type theory
We show, in this section, how to express constructive Simple type theory and the Calculus of constructions, in the calculus modulo theory. We then discuss how this can be used to analyze if a proof, expressed in the Calculus of constructions, can be reformulated in Simple type theory or not, according to these expressions of these theories in the calculus modulo theory.
3.1 Simple type theory as a theory in the calculus modulo theory
Simple type theory can be expressed in Deduction modulo theory [16] and hence in the calculus modulo theory [4, 5].
The types of Simple type theory are expressed as terms of type type, with three constants , nat, and arrow. The type is that of propositions, the type nat that of individuals, often written , and those built with the constant arrow are the functional types. For example, the type of Simple type theory is expressed as the term of type type. Then, to each term of type type, is associated a type of the calculus modulo theory, using a constant of type and the rewrite rule
For example, to the term , is associated the type that reduces to .
The terms of Simple type theory of type are then expressed as terms of type . For example, the term of Simple type theory is expressed as the term of type .
In particular, the propositions are expressed as terms of type , using two constants and . For example, the proposition is expressed as the term . Note that, in this expression of Simple type theory in the calculus modulo theory, we do not have a quantifier for each type , but a single quantifier , that is applied to a term of type . Then, to each term of type , is associated a type of the calculus modulo theory, using a constant of type and the rewrite rules
For example, to the term , is associated the type that reduces to .
Finally, the proofs of a proposition in Simple type theory are expressed as terms of type . For example, the usual proof of the proposition is expressed as the term .
This leads to the theory presented in Figure 1.
3.2 The Calculus of constructions as a theory in the calculus modulo theory
We consider a slight extension of the Calculus of constructions with a symbol nat of type . Such an extension can be obtained just by adding a constant nat and a rule assigning it the type , a rule allowing to declare a variable of type , or an extra sort allowing to declare a variable of type [20, 21].
This logic can be expressed, in the calculus modulo theory [14], as the theory presented in Figure 2. Note that this presentation slightly differs from that of [14]: the symbol has been replaced everywhere by the term allowing to drop the rule
Then, to keep the notations similar to those of Simple type theory, the constant is written , the constant , , the constant , , the constant , , the constant , arrow, the constant , , the constant , , and the constant , . Finally, a symbol nat is added, as we consider an extension of the Calculus of constructions with such a symbol.
3.3 Comparing Simple type theory and the Calculus of constructions
Now that the theories have been formulated in the same logical framework, we can compare their expressions.
A first difference is that the symbol arrow has type
that is
in Simple type theory and
in the Calculus of constructions. This reflects the fact that this symbol is nondependent in Simple type theory and dependent in the Calculus of constructions, where, in the type , written , the type may contain a variable of type .
In the same way, the symbol is nondependent in Simple type theory, but it is dependent in the Calculus of constructions, where, in the proposition , also written , the proposition may contain a variable , that is a proof of .
In contrast, the symbol is dependent is both theories: in the expression , the proposition may always contain the variable of type .
Finally, there is an extra constant in the Calculus of constructions, with its associated rewrite rule. This symbol permits to type functions mapping proofs to terms, for example a function mapping a proof of to a term verifying the predicate .
So, the Calculus of constructions is an extension of Simple type theory, because the symbols arrow and are dependent and because it includes a symbol .
3.4 Analyzing proofs expressed in the Calculus of constructions
We can define a subset of the proofs, expressed in the Calculus of constructions, that do not use the dependency of the symbol arrow, do not use the dependency of the symbol , and do not use the symbol , where we say that a proof does not use the dependency of the symbol arrow if each time the symbol arrow is used, it is applied to two terms, the second one being a abstraction where the abstracted variable does not occur in the body of the abstraction: with not free in , and that it does not use the dependency of the symbol if each time the symbol is used, it is applied to two terms, the second being a abstraction where the abstracted variable does not occur in the body of the abstraction: with not free in .
As we shall see, many proofs expressed in the Calculus of constructions are in this subset.
3.5 Translating proofs to Simple type theory
When a proof expressed in the Calculus of constructions is in the subset , it can easily be translated to Simple type theory. All that needs to be done is to replace the terms of the form with and the terms of the form with .
If, in contrast a proof is not in the set , then it genuinely uses a feature of the Calculus of constructions that does not exist in Simple type theory and it cannot be expressed in Simple type theory. In the same way a proof expressed in ZFC, that genuinely uses the axiom of choice, cannot be expressed in ZF.
When a proof, expressed in the Calculus of constructions, is an element of the set and is translated to Simple type theory, we say that the proof and its translation are the same mathematical proof, expressed in different theories, although they are different linguistic objects. Generalizing this notion of identity of proofs across theories remains to be done.
4 An arithmetic library
The example of the translation of proofs from the Calculus of constructions to Simple type theory is a toy example, because there is no implementation of the Calculus of constructions per se. The systems Coq and Matita, for example, implement extensions of the Calculus of constructions with various features, at least inductive types and universes.
M. Boespflug and G. Burel [9] have shown how to extend the theory presented in Figure 2 to inductive types and A. Assaf [4, 5] has shown how to extend it to universes. This has permitted to express a large library of Matita proofs in Dedukti, including a proof of Fermat’s little theorem.
F. Thiré [36] has then shown that the symbol , and the dependency of the symbols arrow and could be eliminated from this library, but also that universes could be eliminated and that inductive type could be replaced by a very simple principle: an induction principle on natural numbers, that permits to prove propositions by induction and to define functions by induction.
So, we now have an evidence that Fermat’s little theorem not only has a proof in the Calculus of inductive constructions with universes, but also in constructive Simple type theory. Such a result was expected, but note that neither proving Fermat’s little theorem in Matita, that contains dependent products, inductive types, universes, etc. nor proving it in HOL Light, that contains the excluded middle, extensionality, choice, etc., provides a proof in such a weak theory.
On the more practical side, this has permited to export this library from Dedukti to HOL Light, Isabelle/HOL, HOL4, Coq, etc. [37], HOL Light, Isabelle/HOL, and HOL4 sharing a common input language: OpenTheory [28].
The size of this library is 1.5 Mo. It contains around 340 lemmas. It is checked in Dedukti in a few milliseconds.
5 Abstracting enough
5.1 Natural numbers
Both in the Calculus of inductive constructions and in Simple type theory, it is possible to prove propositions by induction and to define functions by induction. But these principles are justified in different ways.
In the Calculus of inductive constructions, the declaration of the inductive type nat comes with a recursion operator that permits to define functions by induction and, as proofs are functions, this operator permits also to build proofs by induction.
In Simple type theory, in contrast, the set of natural numbers is impredicatively defined as the intersection of all sets containing zero and closed by successor. From this definition, the induction principle can be proved. Then, this induction principle and other properties of natural numbers permit to prove the existence of functions defined by induction [25].
These details should be ignored by the arithmetic library, that should be exported to any system that contains a notion of natural number, an induction principle and a way to define functions by induction, regardless the way this induction principle is proved and this induction operator is defined there [37]. Using such an abstract definition of the natural numbers, R. Cauderlier and C. Dubois [11] have built a proof of the correctness of Eratosthenes’ sieve in the expression of FoCaLiZe in Dedukti, using definitions coming from Coq and lemmas coming from HOL Light.
5.2 Connectives and quantifiers
The same holds for the connectives and quantifiers, that are primitive neither in the Calculus of inductive constructions nor in Simple type theory. They are defined as inductive types in the Calculus of inductive constructions. They are defined from equality in Simple type theory [26, 2, 3].
But these details should be ignored by the library, that only needs to specify that should be provable when is, etc. regardless the way this connective is defined.
So, developing a library of proofs that can be exported to different proof systems gives a formal counterpart to the slogan that defining real numbers with Cauchy’s construction or with Dedekind’s is immaterial, or that defining complex numbers as ordered pairs of real numbers, as similarities, or as classes of polynomials is immaterial. Here, the notions of structure and isomorphic structures are essential, even when all the structures of a class—such as that of the complete Archimedean totally ordered fields—are isomorphic.
6 Classical and constructive logics
An important difference between logics, and proof systems implementing these logics, is that some of them are classical and others are constructive, that is the excluded middle is provable in some but not in others. For example, Simple type theory, and HOL Light, are classical and the Calculus of inductive constructions, and Matita, are constructive.
A logical framework, such as the calculus modulo theory, and its implementation Dedukti, should not make any choice on the excluded middle, but should be able to express both classical and constructive logics as theories. A possibility is to not assume the excluded middle in the framework and include it as an axiom in the definition of some theories. Then, the proofs of Simple type theory, for instance those developed in the system HOL Light, can be expressed in Dedukti using the excluded middle and just like in Section 3, we can analyze which of these proofs use the excluded middle and which do not, and translate these to another theory: constructive Simple type theory.
An alternative is to use the idea, defended for example in [23, 33, 15, 32], that the excluded middle is not a question of theory, but a question of meaning of the connectives and quantifiers. This leads to introduce two existential quantifiers: the constructive, , and the classical, , two disjunctions, etc. and deduction rules defining the meaning of these connectives and quantifiers, in such a way that is not provable, but is.
7 Future work
The arithmetic library, described in Section 4, is, of course, only the beginning of a library of proofs, that could be shared by various proof systems. Each proof in this library should be labeled with the ingredients it uses, hence the systems to which it may be exported.
Also, we now have a formal proof of Fermat’s little theorem, in constructive Simple type theory, but we should continue to transform it, to express it in weaker theories, such as predicative type theory, Heyting arithmetic, and beyond.
Acknowledgments
Many thanks to Catherine Dubois, Stéphane GrahamLengrand, Bruno Woltzenlogel Paleo, and François Thiré for very useful remarks on a first draft of this paper.
References
 [1]
 [2] P.B. Andrews (1963): A reduction of the axioms for the theory of propositional types. Fundam. Math. 52, pp. 345–350, doi:10.4064/fm523345350.
 [3] P.B. Andrews (1986): An Introduction to Mathematical Logic and Type Theory: To Truth Through Proof. Academic Press.
 [4] A. Assaf (2014): A Calculus of Constructions with explicit subtyping. In H. Herbelin, P. Letouzey & M. Sozeau, editors: Types, LIPICS 39, pp. 27–46, doi:10.4230/LIPIcs.TYPES.2014.27.
 [5] A. Assaf (2015): A framework for defining computational higherorder logics. Ph.D. thesis, École polytechnique.
 [6] A. Assaf, G. Burel, R. Cauderlier, D. Delahaye, G. Dowek, C. Dubois, F. Gilbert, P. Halmagrand, O. Hermant & R. Saillard (2016): Dedukti: a Logical Framework based on the lambdaPiCalculus Modulo Theory. Manuscript.
 [7] H. Barendregt (1992): Lambda calculi with types. In S. Abramsky, D.M. Gabbay & T.S.E. Maibaum, editors: Handbook of Logic in Computer Science, 2, Oxford University Press, pp. 117–309.
 [8] M. Boespflug (2011): Conception d’un noyau de vérification de preuves pour le lambdaPicalcul modulo. Ph.D. thesis, École polytechnique.
 [9] M. Boespflug & G. Burel (2012): CoqInE : Translating the Calculus of Inductive Constructions into the lambdaPicalculus modulo. In: Second International Workshop on Proof Exchange for Theorem Proving, pp. 44–50.
 [10] R. Cauderlier (2017): A Rewrite System for Proof Constructivization. https://who.rocq.inria.fr/Raphael.Cauderlier/constructivization.pdf.
 [11] R. Cauderlier & C. Dubois (2017): FoCaLiZe and Dedukti to the Rescue for Proof Interoperability. In M. AyalaRincón & C.A. Muñoz, editors: Interactive Theorem Proving, Lecture Notes in Computer Science 10499, Springer, pp. 131–147, doi:10.1007/1191627711.
 [12] A. Church (1940): A formulation of the simple theory of types. The Journal of Symbolic Logic 5(2), pp. 56–68, doi:10.2307/2371199.
 [13] T. Coquand & G. Huet (1988): The Calculus of Constructions. Information and Computation, pp. 95–120, doi:10.1016/08905401(88)900053.
 [14] D. Cousineau & G. Dowek (2007): Embedding Pure Type Systems in the lambdaPicalculus modulo. In S. Ronchi Della Rocca, editor: Typed lambda calculi and applications, Lecture Notes in Computer Science 4583, Springer, pp. 102–117, doi:10.1007/97835407322809.
 [15] G. Dowek (2015): On the definition of the classical connectives and quantifiers. In E.H. Haeusler, W. de Campos Sanz & B. Lopes, editors: Why is this a Proof?, Festschrift for Luiz Carlos Pereira, College Publications.
 [16] G. Dowek, Th. Hardin & C. Kirchner (2001): HOLlambdasigma: an intentional firstorder expression of higherorder logic. Mathematical Structures in Computer Science 11, pp. 1–25, doi:10.1017/S0960129500003236.

[17]
G. Dowek, Th.
Hardin & C. Kirchner (2003): Theorem
proving modulo.
Journal of Automated Reasoning
31, pp. 33–72, doi:10.1023/A:1027357912519.  [18] G. Dowek & B. Werner (2003): Proof normalization modulo. The Journal of Symbolic Logic 68(4), pp. 1289–1316, doi:10.1007/BFb0037116.
 [19] H. Friedman (1976): Systems of secondorder arithmetic with restricted induction, I, II. The Journal of Symbolic Logic 41(2), pp. 557–559.
 [20] H. Geuvers (1993): Logics and Type systems. Ph.D. thesis, Nijmegen.
 [21] H. Geuvers (1995): The Calculus of Constructions and Higher Order Logic. In Ph. de Groote, editor: The CurryHoward isomorphism, Cahiers du Centre de logique 8, Université catholique de Louvain, pp. 139–191.
 [22] F. Gilbert (2017): Automated Constructivization of Proofs. In J. Esparza & A.S. Murawski, editors: Foundations of Software Science and Computation Structures, Lecture notes in computer science 10203, Springer, pp. 480–495, doi:10.1007/978354071070723.
 [23] J.Y. Girard (1993): On the Unity of Logic. Annals of Pure and Applied Logic 59(3), pp. 201–217, doi:10.1016/01680072(93)90093S.
 [24] R. Harper, F. Honsell & G. Plotkin (1993): A framework for defining logics. Journal of the ACM 40(1), pp. 143–184, doi:10.1145/138027.138060.
 [25] L. Henkin (1960): On Mathematical Induction. The American Mathematical Monthly 67(4), pp. 323–338, doi:10.2307/2308975.
 [26] L. Henkin (1963): A theory of propositional types. Fundam. Math. 52, pp. 323–344, doi:10.4064/fm523323344. Errata Ibid., 53, 119, 1964.
 [27] B. Huffman & Kunçar (2013): Lifting and Transfer: A Modular Design for Quotients in Isabelle/HOL. In G. Gonthier & M. Norrish, editors: Certified Programs and Proofs, pp. 131–146, doi:10.1007/97833190354519.
 [28] J. Hurd (2011): The OpenTheory standard theory library. In M. Bobaru, K. Havelund, G.J. Holzmann & R. Joshi, editors: NASA Formal Methods, Lecture Notes in Computer Science 6617, Springer, pp. 177–191, doi:10.1007/354060275576.
 [29] F. Kirchner (2006): A Finite FirstOrder Theory of Classes. In Th. Altenkirch & C. McBride, editors: Types for Proofs and Programs, Lecture Notes in Computer Science, Springer, pp. 188–202.
 [30] A. Leitsch (2015): On proof mining by cutelimination. In D. Delahaye & B. Woltzenlogel Paleo, editors: All about Proofs, Proofs for All, Mathematical Logic and Foundations 55, College Publications, pp. 173–200.
 [31] B. Nordström, K. Petersson & J.M. Smith (2000): MartinLöf’s type theory. In S. Abramsky, D.M. Gabbay & T.S.E. Maibaum, editors: Handbook of Logic in Computer Science, Clarendon Press, pp. 1–37.
 [32] L.C. Pereira (2017): Personal communication.
 [33] D. Prawitz (2015): Classical versus intuitionistic logic. In E.H. Haeusler, W. de Campos Sanz & B. Lopes, editors: Why is this a Proof?, Festschrift for Luiz Carlos Pereira, College Publications.
 [34] R. Saillard (2015): Type Checking in the LambdaPiCalculus Modulo: Theory and Practice. Ph.D. thesis, École des Mines.
 [35] S.G. Simpson (2009): Subsystems of secondorder arithmetic. Cambridge University Press, doi:10.1017/CBO9780511581007.
 [36] F. Thiré (2017): Personal communication.
 [37] F. Thiré (2017): Sharing Arithmetic Proofs from Dedukti to HOL. Manuscript.
 [38] T. Zimmermann & H. Herbelin (2015): Automatic and Transparent Transfer of Theorems along Isomorphisms in the Coq Proof Assistant. Work in progress session, Conference on Intelligent Computer Mathematics, https://hal.archivesouvertes.fr/hal01152588/file/paper.pdf.
Comments
There are no comments yet.