Metamath

Last updated
Metamath
Developer(s) Norman Megill
Initial release0.07 in June 2005;18 years ago (2005-06)
Stable release
0.198 [1]   OOjs UI icon edit-ltr-progressive.svg / 7 August 2021;2 years ago (7 August 2021)
Repository
Written in ANSI C
Operating system Linux, Windows, macOS
Type Computer-assisted proof checking
License GNU General Public License (Creative Commons Public Domain Dedication for databases)
Website metamath.org

Metamath is a formal language and an associated computer program (a proof assistant) for archiving and verifying mathematical proofs. [2] Several databases of proved theorems have been developed using Metamath covering standard results in logic, set theory, number theory, algebra, topology and analysis, among others. [3]

Contents

As of September 2023, the set of proved theorems using Metamath includes 74 [4] of the 100 theorems of the "Formalizing 100 Theorems" challenge, [5] making it fifth after Isabelle, HOL Light, Coq, and Lean. There are at least 19 proof verifiers that use the Metamath format. [6] The Metamath website provides a database of formalized theorems which can be browsed interactively. [7]

Metamath language

The Metamath language is a metalanguage for formal systems. The Metamath language has no specific logic embedded in it. Instead, it can be regarded as a way to prove that inference rules (asserted as axioms or proven later) can be applied. The largest database of proved theorems follows conventional first-order logic and ZFC set theory. [8]

The Metamath language design (employed to state the definitions, axioms, inference rules and theorems) is focused on simplicity; it contains only a handful[ clarification needed ] of keywords. Proofs are checked using an algorithm based on variable substitution. The algorithm also has optional provisos for what variables must remain distinct after a substitution is made. [9]

Language basics

The set of symbols that can be used for constructing formulas is declared using $c (constant symbols) and $v (variable symbols) statements; for example:

$( Declare the constant symbols we will use $)     $c 0 + = -> ( ) term wff |- $. $( Declare the metavariables we will use $)     $v t r s P Q $. 

The grammar for formulas is specified using a combination of $f (floating (variable-type) hypotheses) and $a (axiomatic assertion) statements; for example:

$( Specify properties of the metavariables $)     tt $f term t $.     tr $f term r $.     ts $f term s $.     wp $f wff P $.     wq $f wff Q $. $( Define "wff" (part 1) $)     weq $a wff t = r $. $( Define "wff" (part 2) $)     wim $a wff ( P -> Q ) $. 

Axioms and rules of inference are specified with $a statements along with ${ and $} for block scoping and optional $e (essential hypotheses) statements; for example:

$( State axiom a1 $)     a1 $a |- ( t = r -> ( t = s -> r = s ) ) $. $( State axiom a2 $)     a2 $a |- ( t + 0 ) = t $.     ${        min $e |- P $.        maj $e |- ( P -> Q ) $. $( Define the modus ponens inference rule $)        mp  $a |- Q $.     $} 

Using one construct, $a statements, to capture syntactic rules, axiom schemas, and rules of inference is intended to provide a level of flexibility similar to higher order logical frameworks without a dependency on a complex type system.

Proofs

Theorems (and derived rules of inference) are written with $p statements; for example:

$( Prove a theorem $)     th1 $p |- t = t $=   $( Here is its proof: $)        tt tze tpl tt weq tt tt weq tt a2 tt tze tpl        tt weq tt tze tpl tt weq tt tt weq wim tt a2        tt tze tpl tt tt a1 mp mp      $. 

Note the inclusion of the proof in the $p statement. It abbreviates the following detailed proof:

tt$ftermttze$aterm01,2tpl$aterm(t+0)3,1weq$awff(t+0)=t1,1weq$awfft=t1a2$a|-(t+0)=t1,2tpl$aterm(t+0)7,1weq$awff(t+0)=t1,2tpl$aterm(t+0)9,1weq$awff(t+0)=t1,1weq$awfft=t10,11wim$awff((t+0)=t->t=t)1a2$a|-(t+0)=t1,2tpl$aterm(t+0)14,1,1a1$a|-((t+0)=t->((t+0)=t->t=t))8,12,13,15mp$a|-((t+0)=t->t=t)4,5,6,16mp$a|-t=t

The "essential" form of the proof elides syntactic details, leaving a more conventional presentation:

a2$a|-(t+0)=ta2$a|-(t+0)=ta1$a|-((t+0)=t->((t+0)=t->t=t))2,3mp$a|-((t+0)=t->t=t)1,4mp$a|-t=t

Substitution

A step-by-step proof Proofstep.gif
A step-by-step proof

All Metamath proof steps use a single substitution rule, which is just the simple replacement of a variable with an expression and not the proper substitution described in works on predicate calculus. Proper substitution, in Metamath databases that support it, is a derived construct instead of one built into the Metamath language itself.

The substitution rule makes no assumption about the logic system in use and only requires that the substitutions of variables are correctly done.

Here is a detailed example of how this algorithm works. Steps 1 and 2 of the theorem 2p2e4 in the Metamath Proof Explorer (set.mm) are depicted left. Let's explain how Metamath uses its substitution algorithm to check that step 2 is the logical consequence of step 1 when you use the theorem opreq2i. Step 2 states that ( 2 + 2 ) = ( 2 + ( 1 + 1 ) ). It is the conclusion of the theorem opreq2i. The theorem opreq2i states that if A = B, then (C F A) = (C F B). This theorem would never appear under this cryptic form in a textbook but its literate formulation is banal: when two quantities are equal, one can replace one by the other in an operation. To check the proof Metamath attempts to unify (C F A) = (C F B) with ( 2 + 2 ) = ( 2 + ( 1 + 1 ) ). There is only one way to do so: unifying C with 2, F with +, A with 2 and B with ( 1 + 1 ). So now Metamath uses the premise of opreq2i. This premise states that A = B. As a consequence of its previous computation, Metamath knows that A should be substituted by 2 and B by ( 1 + 1 ). The premise A = B becomes 2=( 1 + 1 ) and thus step 1 is therefore generated. In its turn step 1 is unified with df-2. df-2 is the definition of the number 2 and states that 2 = ( 1 + 1 ). Here the unification is simply a matter of constants and is straightforward (no problem of variables to substitute). So the verification is finished and these two steps of the proof of 2p2e4 are correct.

When Metamath unifies ( 2 + 2 ) with B it has to check that the syntactical rules are respected. In fact B has the type class thus Metamath has to check that ( 2 + 2 ) is also typed class.

Metamath proof checker

The Metamath program is the original program created to manipulate databases written using the Metamath language. It has a text (command line) interface and is written in C. It can read a Metamath database into memory, verify the proofs of a database, modify the database (in particular by adding proofs), and write them back out to storage.

It has a prove command that enables users to enter a proof, along with mechanisms to search for existing proofs.

The Metamath program can convert statements to HTML or TeX notation; for example, it can output the modus ponens axiom from set.mm as:

Many other programs can process Metamath databases, in particular, there are at least 19 proof verifiers for databases that use the Metamath format. [10]

Metamath databases

The Metamath website hosts several databases that store theorems derived from various axiomatic systems. Most databases (.mm files) have an associated interface, called an "Explorer", which allows one to navigate the statements and proofs interactively on the website, in a user-friendly way. Most databases use a Hilbert system of formal deduction though this is not a requirement.

Metamath Proof Explorer

Metamath Proof Explorer
Metamath-theorem-avril1-indexed.png
A proof of the Metamath Proof Explorer
Type of site
Online encyclopedia
HeadquartersUSA
OwnerNorman Megill
Created byNorman Megill
URL us.metamath.org/mpeuni/mmset.html
CommercialNo
RegistrationNo

The Metamath Proof Explorer (recorded in set.mm) is the main and by far the largest database, with over 23,000 proofs in its main part as of July 2019. It is based on classical first-order logic and ZFC set theory (with the addition of Tarski-Grothendieck set theory when needed, for example in category theory). The database has been maintained for over thirty years (the first proofs in set.mm are dated September 1992). The database contains developments, among other fields, of set theory (ordinals and cardinals, recursion, equivalents of the axiom of choice, the continuum hypothesis...), the construction of the real and complex number systems, order theory, graph theory, abstract algebra, linear algebra, general topology, real and complex analysis, Hilbert spaces, number theory, and elementary geometry. This database was first created by Norman Megill, but as of 2019-10-04 there have been 48 contributors (including Norman Megill). [11]

The Metamath Proof Explorer references many text books that can be used in conjunction with Metamath. [12] Thus, people interested in studying mathematics can use Metamath in connection with these books and verify that the proved assertions match the literature.

Intuitionistic Logic Explorer

This database develops mathematics from a constructive point of view, starting with the axioms of intuitionistic logic and continuing with axiom systems of constructive set theory.

New Foundations Explorer

This database develops mathematics from Quine's New Foundations set theory.

Higher-Order Logic Explorer

This database starts with higher-order logic and derives equivalents to axioms of first-order logic and of ZFC set theory.

Databases without explorers

The Metamath website hosts a few other databases which are not associated with explorers but are nonetheless noteworthy. The database peano.mm written by Robert Solovay formalizes Peano arithmetic. The database nat.mm [13] formalizes natural deduction. The database miu.mm formalizes the MU puzzle based on the formal system MIU presented in Gödel, Escher, Bach .

Older explorers

The Metamath website also hosts a few older databases which are not maintained anymore, such as the "Hilbert Space Explorer", which presents theorems pertaining to Hilbert space theory which have now been merged into the Metamath Proof Explorer, and the "Quantum Logic Explorer", which develops quantum logic starting with the theory of orthomodular lattices.

Natural deduction

Because Metamath has a very generic concept of what a proof is (namely a tree of formulas connected by inference rules) and no specific logic is embedded in the software, Metamath can be used with species of logic as different as Hilbert-style logics or sequents-based logics or even with lambda calculus.

However, Metamath provides no direct support for natural deduction systems. As noted earlier, the database nat.mm formalizes natural deduction. The Metamath Proof Explorer (with its database set.mm) instead uses a set of conventions that allow the use of natural deduction approaches within a Hilbert-style logic.

Other works connected to Metamath

Proof checkers

Using the design ideas implemented in Metamath, Raph Levien has implemented very small proof checker, mmverify.py, at only 500 lines of Python code.

Ghilbert is a similar though more elaborate language based on mmverify.py. [14] Levien would like to implement a system where several people could collaborate and his work is emphasizing modularity and connection between small theories.

Using Levien’s seminal work, many other implementations of the Metamath design principles have been implemented for a broad variety of languages. Juha Arpiainen has implemented his own proof checker in Common Lisp called Bourbaki [15] and Marnix Klooster has coded a proof checker in Haskell called Hmm. [16]

Although they all use the overall Metamath approach to formal system checker coding, they also implement new concepts of their own.

Editors

Mel O'Cat designed a system called Mmj2, which provides a graphic user interface for proof entry. [17] The initial aim of Mel O'Cat was to allow the user to enter the proofs by simply typing the formulas and letting Mmj2 find the appropriate inference rules to connect them. In Metamath on the contrary you may only enter the theorems names. You may not enter the formulas directly. Mmj2 has also the possibility to enter the proof forward or backward (Metamath only allows to enter proof backward). Moreover Mmj2 has a real grammar parser (unlike Metamath). This technical difference brings more comfort to the user. In particular Metamath sometimes hesitates between several formulas it analyzes (most of them being meaningless) and asks the user to choose. In Mmj2 this limitation no longer exists.

There is also a project by William Hale to add a graphical user interface to Metamath called Mmide. [18] Paul Chapman in its turn is working on a new proof browser, which has highlighting that allows you to see the referenced theorem before and after the substitution was made.

Milpgame is a proof assistant and a checker (it shows a message only something gone wrong) with a graphic user interface for the Metamath language(set.mm), written by Filip Cernatescu, it is an open source(MIT License) Java application (cross-platform application: Window, Linux, Mac OS). User can enter the demonstration(proof) in two modes : forward and backward relative to the statement to prove. Milpgame checks if a statement is well formed (has a syntactic verifier). It can save unfinished proofs without the use of dummylink theorem. The demonstration is shown as tree, the statements are shown using html definitions (defined in typesetting chapter). Milpgame is distributed as Java .jar(JRE version 6 update 24 written in NetBeans IDE).

See also

Related Research Articles

An axiom, postulate, or assumption is a statement that is taken to be true, to serve as a premise or starting point for further reasoning and arguments. The word comes from the Ancient Greek word ἀξίωμα (axíōma), meaning 'that which is thought worthy or fit' or 'that which commends itself as evident'.

Automated theorem proving is a subfield of automated reasoning and mathematical logic dealing with proving mathematical theorems by computer programs. Automated reasoning over mathematical proof was a major impetus for the development of computer science.

First-order logic—also known as predicate logic, quantificational logic, and first-order predicate calculus—is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantified variables over non-logical objects, and allows the use of sentences that contain variables, so that rather than propositions such as "Socrates is a man", one can have expressions in the form "there exists x such that x is Socrates and x is a man", where "there exists" is a quantifier, while x is a variable. This distinguishes it from propositional logic, which does not use quantifiers or relations; in this sense, propositional logic is the foundation of first-order logic.

Propositional calculus is a branch of logic. It is also called propositional logic, statement logic, sentential calculus, sentential logic, or sometimes zeroth-order logic. It deals with propositions and relations between propositions, including the construction of arguments based on them. Compound propositions are formed by connecting propositions by logical connectives. Propositions that contain no logical connectives are called atomic propositions.

Mathematical logic is the study of formal logic within mathematics. Major subareas include model theory, proof theory, set theory, and recursion theory. Research in mathematical logic commonly addresses the mathematical properties of formal systems of logic such as their expressive or deductive power. However, it can also include uses of logic to characterize correct mathematical reasoning or to establish foundations of mathematics.

In logic and deductive reasoning, an argument is sound if it is both valid in form and its premises are true. Soundness has a related meaning in mathematical logic, wherein a formal system of logic is sound if and only if every well-formed formula that can be proven in the system is logically valid with respect to the logical semantics of the system.

<span class="mw-page-title-main">Theorem</span> In mathematics, a statement that has been proved

In mathematics, a theorem is a statement that has been proved, or can be proved. The proof of a theorem is a logical argument that uses the inference rules of a deductive system to establish that the theorem is a logical consequence of the axioms and previously proved theorems.

Gödel's incompleteness theorems are two theorems of mathematical logic that are concerned with the limits of provability in formal axiomatic theories. These results, published by Kurt Gödel in 1931, are important both in mathematical logic and in the philosophy of mathematics. The theorems are widely, but not universally, interpreted as showing that Hilbert's program to find a complete and consistent set of axioms for all mathematics is impossible.

In classical deductive logic, a consistent theory is one that does not lead to a logical contradiction. The lack of contradiction can be defined in either semantic or syntactic terms. The semantic definition states that a theory is consistent if it has a model, i.e., there exists an interpretation under which all formulas in the theory are true. This is the sense used in traditional Aristotelian logic, although in contemporary mathematical logic the term satisfiable is used instead. The syntactic definition states a theory is consistent if there is no formula such that both and its negation are elements of the set of consequences of . Let be a set of closed sentences and the set of closed sentences provable from under some formal deductive system. The set of axioms is consistent when there is no formula such that and .

In mathematics, Hilbert's second problem was posed by David Hilbert in 1900 as one of his 23 problems. It asks for a proof that arithmetic is consistent – free of any internal contradictions. Hilbert stated that the axioms he considered for arithmetic were the ones given in Hilbert (1900), which include a second order completeness axiom.

Proof theory is a major branch of mathematical logic and theoretical computer science within which proofs are treated as formal mathematical objects, facilitating their analysis by mathematical techniques. Proofs are typically presented as inductively-defined data structures such as lists, boxed lists, or trees, which are constructed according to the axioms and rules of inference of a given logical system. Consequently, proof theory is syntactic in nature, in contrast to model theory, which is semantic in nature.

<span class="mw-page-title-main">Metamathematics</span> Study of mathematics itself

Metamathematics is the study of mathematics itself using mathematical methods. This study produces metatheories, which are mathematical theories about other mathematical theories. Emphasis on metamathematics owes itself to David Hilbert's attempt to secure the foundations of mathematics in the early part of the 20th century. Metamathematics provides "a rigorous mathematical technique for investigating a great variety of foundation problems for mathematics and logic". An important feature of metamathematics is its emphasis on differentiating between reasoning from inside a system and from outside a system. An informal illustration of this is categorizing the proposition "2+2=4" as belonging to mathematics while categorizing the proposition "'2+2=4' is valid" as belonging to metamathematics.

In mathematics and logic, an axiomatic system is any set of primitive notions and axioms to logically derive theorems. A theory is a consistent, relatively-self-contained body of knowledge which usually contains an axiomatic system and all its derived theorems. An axiomatic system that is completely described is a special kind of formal system. A formal theory is an axiomatic system that describes a set of sentences that is closed under logical implication. A formal proof is a complete rendition of a mathematical proof within a formal system.

A formal system is an abstract structure and formalization of an axiomatic system used for inferring theorems from axioms by a set of inference rules.

In mathematics, Hilbert's program, formulated by German mathematician David Hilbert in the early 1920s, was a proposed solution to the foundational crisis of mathematics, when early attempts to clarify the foundations of mathematics were found to suffer from paradoxes and inconsistencies. As a solution, Hilbert proposed to ground all existing theories to a finite, complete set of axioms, and provide a proof that these axioms were consistent. Hilbert proposed that the consistency of more complicated systems, such as real analysis, could be proven in terms of simpler systems. Ultimately, the consistency of all of mathematics could be reduced to basic arithmetic.

In mathematical logic, a proof calculus or a proof system is built to prove statements.

Condensed detachment is a method of finding the most general possible conclusion given two formal logical statements. It was developed by the Irish logician Carew Meredith in the 1950s and inspired by the work of Łukasiewicz.

Tarski–Grothendieck set theory is an axiomatic set theory. It is a non-conservative extension of Zermelo–Fraenkel set theory (ZFC) and is distinguished from other axiomatic set theories by the inclusion of Tarski's axiom, which states that for each set there is a Grothendieck universe it belongs to. Tarski's axiom implies the existence of inaccessible cardinals, providing a richer ontology than ZFC. For example, adding this axiom supports category theory.

In logic, especially mathematical logic, a Hilbert system, sometimes called Hilbert calculus, Hilbert-style deductive system or Hilbert–Ackermann system, is a type of system of formal deduction attributed to Gottlob Frege and David Hilbert. These deductive systems are most often studied for first-order logic, but are of interest for other logics as well.

In mathematical logic, a judgment or assertion is a statement or enunciation in a metalanguage. For example, typical judgments in first-order logic would be that a string is a well-formed formula, or that a proposition is true. Similarly, a judgment may assert the occurrence of a free variable in an expression of the object language, or the provability of a proposition. In general, a judgment may be any inductively definable assertion in the metatheory.

References

  1. "Release 0.198". 8 August 2021. Retrieved 27 July 2022.
  2. Megill, Norman; Wheeler, David A. (2019-06-02). Metamath: A Computer Language for Mathematical Proofs (Second ed.). Morrisville, North Carolina, US: Lulu Press. p. 248. ISBN   978-0-359-70223-7.
  3. Megill, Norman. "What is Metamath?". Metamath Home Page.
  4. Metamath 100.
  5. "Formalizing 100 Theorems".
  6. Megill, Norman. "Known Metamath proof verifiers" . Retrieved 8 October 2022.
  7. "TOC of Theorem List - Metamath Proof Explorer". us.metamath.org. Retrieved 2023-09-04.
  8. Wiedijk, Freek. "The Seventeen Provers of the World" (PDF). pp. 103–105. Retrieved 14 October 2023.
  9. Megill, Norman. "How Proofs Work". Metamath Proof Explorer Home Page.
  10. Megill, Norman. "Known Metamath proof verifiers" . Retrieved 8 October 2022.
  11. Wheeler, David A. "Metamath set.mm contributions viewed with Gource through 2019-10-04". YouTube . Archived from the original on 2021-12-19.
  12. Megill, Norman. "Reading suggestions". Metamath.
  13. Liné, Frédéric. "Natural deduction based Metamath system". Archived from the original on 2012-12-28.
  14. Levien, Raph. "Ghilbert".
  15. Arpiainen, Juha. "Presentation of Bourbaki". Archived from the original on 2012-12-28.
  16. Klooster, Marnix. "Presentation of Hmm". Archived from the original on 2012-04-02.
  17. O'Cat, Mel. "Presentation of mmj2". Archived from the original on December 19, 2013.
  18. Hale, William. "Presentation of mmide". Archived from the original on 2012-12-28.