# Is there a relationship between Computer Algebra and NLP?

My intuition is that there is some overlap between understanding language and symbolic mathematics (e.g. algebra). The rules of algebra are somewhat like grammar, and the step-by-step arguments get you something like a narrative. If one buys this premise, it might be worth training an AI to do algebra (solve for x, derive this equation, etc).

Moreover, when variables represent "real" numbers (as seen in physics, for example) algebraic equations describe the real world in an abstracted, "linear," way somewhat similar to natural language.

Finally, there are exercises in algebra, like simplifying, deriving useful equations, etcetera which edge into the realm of the subjective, yet it is still much more structured and consistent than language. It seems like this could be a stepping stone towards the ambiguities of natural language.

Can anyone speak to whether this has either (1) been explored or (2) is a totally bogus idea?

There isn't, really. Natural language is way more complex and irregular than algebra, which is far more formalised and unambiguous.

So far, in NLP, most success/progress has been made in little toy domains, which exclude most of the complexities of real life, including many ambiguities.

When you say the rules of algebra are somewhat like grammar, then that is because it is essentially a formal language, for which we can specify a grammar. There is currently no complete grammar for any human language (and I doubt there ever will be), let alone a formal one that can be processed by computer.

This was one of the reasons why the first AI boom, where a lot of over-hyped promises where made about being able to translate Russian into English automatically, failed abysmally: natural languages are more than just formal grammars of lexical items.

Stochastic approaches have gone some way towards pragmatic solutions, but when it comes to understanding language they are basically a fudge. And don't get me started on deep learning approaches to NLP.

So the only relationship is that we use the term 'grammar' for the descriptive formalisms in both cases; a formal grammar of algebra would be very different from a grammar for a human language.

This doesn't mean, however, that approaches developed in the field of NLP cannot be applied to algebra: even those which failed in NLP because they were overly limiting. To find out more about this, look for Chomsky Hierarchy -- that describes the different expressive powers of formal languages.

But I would argue that human language is outside of that, because it is not a formal language.

• Gotcha, but it sounds like you kind of agree that there is a relationship - it's just that the NLP problem is drastically harder and specifically that the hardest parts of NLP are not present in doing algebra. Mar 26, 2021 at 16:46
• @user37344 Broadly, the only relationship in my view is that we describe both phenomena with formalisms that are called 'grammar', which share a few general features. Mar 26, 2021 at 17:24
• It is possible to convert natural-language queries into statements that can be solved by computer algebra systems. Wolfram Alpha does this, for example. Oct 1, 2021 at 21:35

One of the ways to ask if this two problmes are related is to ask, could we solve math/algebra equations with NLP approaches, and the answer is yes, it's an absolutely valid idea and it was approached by many researchers.

For example in the "Deep learning for symbolic mathemathics" paper by facebook researchers, the NLP-based approach was used to solve calculus-level math.

Or in this paper authors propose a method to extract semantics from math problems in words and solve them.

In fact, even very simple approaches like a small LSTM network could work for simple strictly stated problems

• Interesting. This is actually the direction that I care more about, so I appreciate the references. Mar 26, 2021 at 16:44

A lot of natural language processing software are (in 2021) using statistical approaches.

Read The Deep Learning Revolution (by T.Sejnowski), Artificial Beings, the Conscience of a conscient machine (by J.Pitrat), Introduction to Deep Learning (by E.Charniak).

However, mixed approaches (like in RefPerSys) can also be used.

The so-called frame-based approaches can, and have been used, in NLP. From an abstract point of view, they are close to algebra. And probably are still one of the best approaches for generating natural language sentences (in written form).

Pitrat has for dozen of years taught and advocated a symbolic AI approach to NLP. You could read his French book Métaconnaissances, futur de l'IA (metaknowledge, future of AI).

Read also books like Knowledge Representation and Reasoning (Braqueman & Leveque)

You might also read (if you can read French) Nicolas Bourbaki's Théorie des Ensembles or (in English) Interactive Theorem Proving and Program Development (by Bertot & Castéran).

Symbolic AI approaches are definitely "algebra-like". In practice, they don't need powerful GPGPUs, or even don't do a lot of floating point operations.

I assume you want to process human language text available as textual files (e.g. HTML, XML, UTF8 encoded plain text, etc...). If you want to process sounds and speech (for example, an audio signal coming from a microphone), you do need much more signal processing and floating-point operations. If you want to process images (e.g. handwritten text), it is also different. In France, I would recommend Professor Mohamed Daoudi.

• This looks like good reading, but it's not clear to me that it is relevant to doing algebra. Mar 26, 2021 at 16:44
• Then please improve your question and explain, in at least one paragraph of written English, what do you mean by "doing algebra". Be aware that I am not a native English speaker. If you don't want to write that publicly, send me an email (with the URL of your question) to basile@starynkevitch.net - with several paragraphs in English, French, or Russian Mar 26, 2021 at 17:02
• @user37344 My sense is that much of computing in general depends on algebra, and that you can't do much with computational linguistics without some algebraic functions. I was likewise confused by the term "computer algebra". But it seems like basic algebra is not sufficient for NLP of any meaningful strength.
– DukeZhou
May 13, 2021 at 2:45