
Show HN: MathLingua – The Language of Mathematics - CatsAreCool
http://www.mathlingua.org/
======
fspeech
Documenting mathematics rigorously is actually hard. For example see the
Formal Abstracts
([https://formalabstracts.github.io](https://formalabstracts.github.io))
project by Thomas Hales. Hales' other writings on the subject may be
informative too: [https://jiggerwit.wordpress.com/2019/06/20/an-argument-
for-c...](https://jiggerwit.wordpress.com/2019/06/20/an-argument-for-
controlled-natural-languages-in-mathematics/)

~~~
CatsAreCool
Thanks for the links. I was not aware of Thomas Hale's research even though I
searched extensively to try to find related work.

His descriptions of what he wants to attain align with what I would like, a
formalized way to describe what is known in mathematics.

He also describes how this can be used for machine learning, and area that I
am also pursuing, but my results are still in an exploratory state.

Either way, I am really glad others are looking into this area too. I think it
is something that will be very beneficial to the math community.

~~~
fspeech
This is an area of my interest too, esp. if one can find something that is
actually useful for a practicing mathematician. I mentioned Hales' project but
based on their github project progress (a postdoc of his did some exploratory
work) they seemed to have hit some road blocks, which is an example of this
problem being hard. I don't know what your background is. If you are
interested in further discussion I would be happy to p.m. over email.

~~~
CatsAreCool
I have a PhD in mathematics, I am a software engineer working at Google, and
have practical experience with programming language design and usage.

MathLingua is _not_ a Google product and is not affiliated with Google in any
way. Instead it is my own work I am exploring at the intersection of math,
computer science, language design, and natural language processing.

It would be great to chat more over email. My email can be found on my github
page [https://github.com/DominicKramer](https://github.com/DominicKramer). Let
me know if you have problems getting it.

------
CatsAreCool
Hello, this is the creator of MathLingua.

MathLingua is still in development, and the documentation still needs work.

However, I wanted to get feedback earlier rather than later to help guide
development and the writing of the docs.

Note that MathLingua is the language that powers
[https://mathlore.org](https://mathlore.org).

~~~
uryga
could you explain the usecase a bit? i skimmed the docs and don't quite get
what writing definitions and theorems in this format gets me, apart from an
automated "go to definition". what can the tooling do, or what functionality
are you planning to implement?

btw "The Language of Mathematics" sounds a bit over the top ;) how about "A
Language for Mathematics"?

~~~
CatsAreCool
Thanks for the feedback. I'll update the docs to make this more clear.

The goal is to allow the building of a system so someone could ask, for
example, "what are the known theorems that describe when a function uniformly
continuous?" or "under what conditions is a group solvable?".

To enable this, it is necessary to build a system that catalogs precise
statements of math theorems, definitions, and other statements
([https://mathlore.org](https://mathlore.org) is the start of this system that
uses MathLingua but currently only uses keywords and some structure for
searching).

This is similar to
[https://mathworld.wolfram.com](https://mathworld.wolfram.com) or the math
pages in Wikipedia except the statements are not text or LaTeX, that is hard
for a computer to understand the meaning of. Instead the MathLingua language
is used to identify math statements by meaning.

Right now the tooling can render math statements, find duplicate definitions,
and can find missing definitions. Further
[https://mathlore.org](https://mathlore.org) uses MathLingua and has some
basic searching.

Further, experimental work is also underway so that the MathLingua tooling can
expand a math statement by expanding the definition of items used in that
statement.

Yeah, I thought about using something like "A Language for Mathematics" but I
thought "The Language of Mathematics" might draw more attention :) But it is
only the title of my post on hacker news, not the title of the MathLingua
website.

~~~
uryga
thanks!

------
syats
This is an awesome effort!

Regarding a comment on possible use cases.. One component that would really
compliment this would be a programming-language specific checker of
definitions. In the documentation's example of "integer" it would be straight
forward to write in python a function that checks if a given variable is an
integer. The same can be for other definitions such as "invertible matrix" or
"set of orthonormal vectors".. other languages could provide such checks for
more symbolic stuff like "commutative ring" etc.

Once you have this in place, you can load your nice data into a (e.g.)
numpy.ndarray object, and checks would be triggered for all possible
properties. This would automatically tag your data as, e.g. "stochastic
matrix" and then you could even get suggestions of the sort of "build a time-
discrete stochastic system based on this matrix?". This is would be very
helpful for "data scientists" who are a bit far from theory.. at least I know
I would use this very often.

There is of course the issue of expressivity to be taken into account. Much of
mathematical progress involves invention of new notation, not all of which is
neatly written in "left to right English with only binary operators" (think of
commutative diagrams for example). While the language can of course be
expanded in this direction, there will be a very big temptation (and I would
guess frequent pushes from the future community) to change to more and more
general languages. In this case, please always keep in mind the very
expressive but useless notation of Russell & Whiteheads's Principia. There is
a big theory of language and expresivity, and there are also practical
examples (think of OWL or other semantic-web languages) of how to reach a
compromise that allows for enough expressivity for the use cases of interest.

------
fdej
Nice project! I'm working on something similar with
[http://fungrim.org/grim/](http://fungrim.org/grim/) and
[http://fungrim.org/](http://fungrim.org/)

~~~
fspeech
Pretty cool. Are you aware that there is a content markup part of MathML
[https://www.w3.org/TR/MathML3/chapter4.html](https://www.w3.org/TR/MathML3/chapter4.html)
? There are other efforts geared towards math authoring as well if that is
your focus，for example people have authored open textbooks using
[https://pretextbook.org](https://pretextbook.org) .

~~~
fdej
Indeed. I decided not to use MathML for various reasons:

1\. The syntax is horrible (for writing by hand).

2\. I'm more interested in computation than presentation, so something closer
to S-expressions along the lines of Mathematica feels more comfortable to me.

3\. The progress so far on defining semantics for content MathML has failed to
impress me.

Concretely, I think if you are trying to do semantic mathematics, you need an
implementation of the semantics in software, not just a hand-written spec.
Ideally this would be backed by a formal theorem proving system. So far I just
do randomized testing using symbolic evaluation and interval arithmetic. See
this writeup for more details:
[https://arxiv.org/abs/2003.06181](https://arxiv.org/abs/2003.06181)

~~~
fspeech
Thanks! The symbolic computation aspect of your paper is very interesting. I
would be very interested in checking out how conditional rewriting is
achieved. Do you have more in depth writings on the theory and mechanics of
your approach?

~~~
fdej
There is nothing in depth yet. I'm happy to discuss (here or by email).

~~~
fspeech
Cool. I have skimmed through the code base. I will email you with further
questions.

~~~
CatsAreCool
It looks like there is a lot of shared interest in this area.

fspeech, fdej, and others, what do you think of having a Google group, mailing
list, or something similar to have a communication channel for anyone that
wants to chat more?

If you are open to this (or have another suggestion) I’ll set one up and share
the link here.

If you prefer email, that’s cool too.

~~~
fdej
Sure, go ahead and set something up!

~~~
CatsAreCool
Cool. I've setup a Google Group at
[https://groups.google.com/d/forum/mathlingua-
discuss](https://groups.google.com/d/forum/mathlingua-discuss).

------
CatsAreCool
A Google Group has been created to discuss MathLingua and Mathematical
Knowledge Management at [https://groups.google.com/d/forum/mathlingua-
discuss](https://groups.google.com/d/forum/mathlingua-discuss).

Everyone is welcome to join.

------
xvilka
Is it able to transpile to Coq/Lean/Agda/etc?

~~~
CatsAreCool
It is already difficult to have a formalized math language with a level of
formality that matches that found in papers.

The goal of MathLingua, at this time, is to match such a level of formality
that is in math books and papers.

However, the syntax was designed to allow support for transpiling to a theorem
proving language to be added at a later time. It is something, in the future,
that I would like to do, if possible, but I don't have a time estimate if/when
it will be available.

~~~
xvilka
I recommend to check also Decucteam[1][2] projects, they also convert between
different formats. Even as they focus on mathematical logic mostly, it still
can be useful to check.

[1] [http://deducteam.gforge.inria.fr](http://deducteam.gforge.inria.fr)

[2] [https://github.com/Deducteam](https://github.com/Deducteam)

------
jlelonm
This is really cool!! I hope this becomes popular. Imagine having all theorems
etc indexed like this!

~~~
CatsAreCool
Thanks for the support! Yes, that is one of the goals, to make it really easy
to find what is known in mathematics and contribute to that knowledge base. I
have [https://mathlore.org](https://mathlore.org) which is a demonstration of
how such as system could work.

------
xiaodai
It's cool and all but what's wrong with Latex?

Doesn't answer the "why" question at all.

~~~
CatsAreCool
Thanks for the question. I have answered it in another question in the
comments, and I'll update the docs to make the difference more clear.

------
Vivtek
This feels like "mathematics pseudocode" and I kind of love it. Indexable math
Zettelkasten notes.

~~~
CatsAreCool
Thanks! I wasn't sure how people would feel about the syntax, and I'm glad you
like it.

------
bionhoward
Would it be possible to put the theorem name (and possibly a description) at
the top instead of buried at the bottom in a metadata block?

Theorem: “Fundamental Theorem of Calculus”

~~~
CatsAreCool
I thought of this, but couldn't find a nice way to fit this into the syntax.

That is,

    
    
      Theorem: "some text"
    

is the same as

    
    
      Theorem:
      . "some text"
    

Thus it would be hard to distinguish a named theorem with one statement

    
    
      Theorem:
      . "some name"
      . "statement 1"
    

from an un-named statement with two statements:

    
    
      Theorem:
      . "statement1"
      . "statement2"
    

So for now I'm leaving the name in the metadata section, but I'm open to
putting the title higher if I can come up with a nice way to do so.

