Skip to content

The Mathlingua Language

Mathlingua is a declarative language designed to precisely and concisely describe statements of mathematical definitions, axioms, theorems, and conjectures, such that anyone familiar with reading and writing mathematical literature can easily learn to read and write Mathlingua text.

What does it look like?

To get a feel for the language, the following is a definition of a prime integer:

Describes: p
extends: 'p is \integer'
. 'p != 1'
. not:
  . exists: a, b
    where: 'a, b is \integer'
    . 'a != 1'
    . 'b != 1'
    . 'p = a * b'
. called: "prime natural number"

and the following is an example of a theorem:

given: p, a, b
. 'p is \prime.integer'
. 'a, b is \integer'
if: 'p \divides/ a * b'
. oneOf:
  . 'p \divides/ a'
  . 'p \divides/ b'
. called: "Euclid's Lemma"
. "Suppose $a$ and $n$ are coprime.  Then by {{\bezouts.lemma}}
   there exists $r$ and $s$ such that {{r,s is \integer}}
     rn + sa = 1
   Next, multiply by $b$ to obtain
     rnb + sab = b
   and notice $n | rnb$ and, since $n | ab$, that $n | sab$.
   Hence $n$ divides $rnb + sab = b$."

The above is the source code for the items that are rendered as:

Describes: \(p\)
extends: \(p\) is integer
· \(p \neq 1\)
· not:
  . exists: \(a, b\)
    where: \(a, b\) is integer
    . \(a \neq 1\)
    . \(b \neq 1\)
    . \(p = ab\)
· called: prime natural number


Euclid's Lemma Theorem:
given: \(p, a, b\)
· \(p\) is prime integer
· \(a, b\) is integer
if: \(p | ab\)
· oneOf:
  · \(p | a\)
  · \(p | b\)
Suppose \(a\) and \(n\) are coprime. Then by Bezout's Lemma
there exists \(r\) and \(s\) such that \(r\), \(s\) is integer
$$ rn + sa = 1 $$ Next, multiply by \(b\) to obtain
$$ rnb + sab = b $$ and notice \(n | rnb\) and, since \(n | ab\), that \(n | sab\). Hence
\(n\) divides \(rnb + sab = b\). \(\square\)

Note that the name \prime.integer uses the . character to specify that the prime being described is a prime integer. For a prime element in an arbitrary commutative algebra, a different definition would be created, perhaps called \prime.element:of{A} that specifies that A must be a \commutative.algebra.

Next, the definition describes how a prime integer is related to an integer by stating that it extends an integer. That is, a prime integer is an integer with additional properties.

Although not shown here, Mathlingua also allows one to describe that something can be viewed as something else, perhaps through a morphism.

Further, not only is the precise mathematical statement of the definition and theorem expressed, but further information, such as what the items are called, is encoded.

Although not shown here, Mathlingua allows for describing a much larger assortment of knowledge associated with a mathematical item, such as how a symbol or expression is written (i.e. a \divides/ b is written as \(a | b\)), the item's history, discoverer(s), importance, informal description, references, relationship to other mathematical concepts, etc. in not only English but in any other written language.

The purpose of Mathlingua is to express all information associated with a mathematical definition, axiom, conjecture, or theorem.

Last note that the proof of the theorem is be written in LaTeX where the {{...}} syntax is used to reference definitions. That is, the definition and theorem statements are required to be written in Mathlingua, but the proof can be written in LaTeX.

What is the purpose of the language?

The Mathlingua language is designed to create Mathlore, a knowledgebase of all mathematical knowledge in a format that is easy for math enthusiasts to read and write, where automatic checks of the knwledgebase can be performed that verify, for example:

  • no definition or symbol is used that is not specified in the knowledgebase
  • no duplicate definitions occur
  • no definition is used incorrectly (i.e. the inputs to any definition used are of the correct count and type)
  • no statement is ambiguous (i.e. text such as \(a * b\) where the meaning of \(*\) cannot be determined is not allowed)

In progess

This document and Mathlingua are still progress. Check back often for the addition of information including, but not limited to, why Mathlingua is needed when LaTeX, MathML, etc. (as well as theorem provers like Lean, Coq, etc.) already exist, how does Mathlingua improve the mathematics ecosystem, how does Mathlingua relate to Large Language Models, and much more.