A grammatical puzzle that remained unsolved for 2.5 thousand years has finally been solved by a researcher whose elegant solution is based on the interpretation of a single Sanskrit word, reports Vice.

This unlocked the “language machine” – an early version of what we today call an algorithm – developed by the ancient Indian linguist Pāṇini, and adapt his influential work into software for generating grammatically correct Sanskrit phrases.

Rishi Rajpopat, a Sanskrit scholar, solved this puzzle while defending his PhD thesis at the University of Cambridge.

Rajpopat’s dissertation outlines his solution to the problem posed by Pāṇini’s masterpiece, the Aṣṭādhyāyī, a grammar guide to Sanskrit, one of the most influential languages in history.

In this text, Pāṇini developed a system that could generate grammatically correct Sanskrit words and phrases from their component parts, such as stem words and suffixes. Pāṇini limited this algorithm to 4,000 grammatical rules relating to the basics of Sanskrit mechanics. The systematic nature of Aṣṭādhyāyī is similar to the approach used in modern programming languages.

The Aṣṭādhyāyī is an outstanding achievement, but scholars have struggled for centuries to resolve the conflicts that arise when Pāṇini’s two rules contradict each other.

Pāṇini foresaw this problem and included in his work a sutra (rule) called “1.4.2” which states: “Vipratiṣedhe paraṁ kāryam”. The central word ‘paraṁ’ roughly means ‘that which comes after’. This instruction has long been interpreted to mean that, in the event of a conflict of rules, the one later in the sequence recorded in the Aṣṭādhyāyī takes precedence.

However, this view often leads to grammatically incorrect results, a problem that has vexed researchers for a long time.

In his thesis, Rajpopat argued that the rule labeled “1.4.2” had been misread for generations due to confusion in the interpretation of the word “paraṁ”. He believes that the word suggests a lateral description of a word or phrase that is read from left to right; therefore, “the one that comes after” refers to the word “on the right.”

In this much simpler framework, rule conflicts must favor the rule that applies to the word on the right as opposed to the rule that occurs later in the broader Aṣṭādhyāyī order. This solution almost always results in grammatically correct Sanskrit phrases, suggesting that this may have been Pāṇini’s original intention when he wrote rule “1.4.2”.

With this discovery, Pāṇini’s famous “language machine” could be turned into software that could generate millions of grammatically correct Sanskrit phrases.