Buddhist philosophy represented in Prolog

Although it can be very handy, when we convert philosophical texts into algebra and propositional logic, there are some hard limitations, and not just the loss of tone and dialogue. What about modularly representing causality, being or not being, before and after, or qualities of things? Those can only be contained to a single string of a statement, but actually contain further logical info to be extracted.

How can we most simply represent the statements below, without losing any logical information?

ignorance causes despair.
birth is suffering.
whatever arises goes away.

A conforming resolution is to represent each of those things as facts, represented here in Prologā€™s syntax, which is a language used to store info and then make logical inferences and solve proofs:

causes(ignorance, despair).
suffering(birth).
ā€˜goes awayā€™(X) :- arises(X).

verb(subject, object)
is object(subject)

I think this flexible format comes closest to being able to represent anything that the original text represents, and it still supports typical logic (not, and, if, iff).

Longer explanation of Prolog

Prolog (Programming in Logic) is a programming language different from the usual ones people mention as it focuses on (predictably) logic and storing info. Its code is essentially a readable database (knowledgebase) of facts formatted like this:

conditions(contact, feelings).  % contact is a condition for feelings
conditions(feelings, desire).
says(noble_truth(suffering), [suffering(birth), suffering(death)]). % embeded predicates, a list

Given those facts, you can make queries like

conditions(X, feelings).

which is like asking ā€œX is a condition for what?ā€, and it would reply with X=contact. If it conditioned anything else, then you could keep asking it for what else it conditions, but it stops here.

It also supports creating rules or functions which will generalize behavior, like when goes_away(X) :- arises(X) meant ā€œX goes away if X arisesā€.

So if we had the fact arises(feelings), then we could query goes_away(feelings) and it would respond true without first manually defining that feelings go away because our defined rule related goes_away with arises.

As a result of this format, this language can easily do some things very strongly like solve constraint satisfaction problems such as sudoku or parse grammar.

This does not have to be in just English, and there are ways to work in both the original language and the translated language simultaneously, such as with some kind of structure like this: conditions(en_pl(feelings, vedana), en_pl(desire, taį¹‡ha)). And the logic should probably be based off of the original text even if its shown in a translated language (unless you want to show how translated text logically lines up with the original?). That could even be extended to compare the logic of the parallels between ancient languages.


I converted AN8.66 to Prolog here: https://swish.swi-prolog.org/p/AN8.66.pl. This showcases a lot of features and potential from a relatively simple sutta.

Hereā€™s two examples of how Prolog could manage a hierarchical knowledgebase such as for sectioning off particular canons, editions, books, suttas, or lines so they are logically independent and their facts donā€™t overlap/intersect: https://swish.swi-prolog.org/p/SN22.59.pl

I have seen Prolog used in philosophy and general problem solving, but I could not find many mentions of it used with Buddhist philosophy (only from Mitsuyuki Shimizu), so thatā€™s why Iā€™m bringing up its potential relationship.

At this point, thereā€™s two possible uses:

Using this freely when discussing a particular sutta when necessary as a syntactical format for representing data and then running queries on that as a means of showcase or proof;

Or, generating a knowledgebase of the the Buddhist canons with the ability to browse specific suttas, exclude certain sections of knowledge (e.g. select MA/patton, MN30:3.1-7.5/sujato, and Dt2.1/unarada together), and use queries to reach deeper logical implications or conflicts that we canā€™t manage with just remembering. Generating this Prolog definitely can be aided with AI, maybe even JIT upon request, but it does have problems. Namely that thereā€™s different interpretations of a text and many ways to do the same logically equivalent thing in programming.

It could also keep track of location as a side-effect as discussed recently. Even correlating themes, topics, or types of proofs with particular cities the Buddha stayed at, which likely also correlates to the beliefs of the students / non-Buddhists from that area which the Buddha would address.

That sort of project and its purpose isnā€™t primary and doesnā€™t solve primary problems. Reading the texts is good. This would aid just some philosophical problems for some students who want it. Itā€™d also serve as a search, even allowing you to search for types of proofs such as what the thread on LEMs has been discussing. Some people use AI itself in a similar way by querying philosophical questions, but this app would be more reliable as each supporting statement can be traced directly to the lines of text it came from, so I hope it wouldnā€™t support laziness but encourage learning. Do you think that sort of project would be useful? Is a similar proof-solving logic language better for the job? Iā€™m willing to set up and work on such a project.

2 Likes