Prolog is still alive

Recently i have been dusting off my old Prolog skillset again, to try and find a modern use for it. In the past you saw Prolog in quite a few expert systems used by major companies. Is there still a use for Prolog’s rule based programming logic today?

As i started thinking about a good use for it in 2016, i identified some areas where the type of database integration and rule based development Prolog offers is still a good choice. One is in AI, where state is often based on a combination of compound rules. Another is in financial and business analysis where you can set up complex sets of facts and rules to then do data analysis.

There is also the fact that Prolog is an excellent introduction to logic student language, as evidenced by it still being referred to in the latest printing of Gersting’s seminal CS course-book “Mathematical structures for computer science”, as well as other works in the field of logic and analytics.

I would really like to try Prolog on students to see the reaction to the kind of programming it offers.

But my current project in the area was decided based on the insight about uses in the enterprise world. I have started building a Prolog framework to automatically answer questions on investments, given base data about the desired outcomes. The idea is to feed the rules engine with input data, then ask it questions to determine the best strategic descisions. So it is a data driven expert system.

To do this, i figured i had to consume raw data, to use as basis for the rules database. So i wrote a C routine to recieve events regarding financial data. These would be structured as [purchase|sale|transfer][item][buyer][seller][date][deliverydate]

I would use the C code to structure this into information for the rules database. I build it based on this input, so the rules database contains Prolog rules such as:

discount(X,Y) :-
seller(X),
commonbuyer(Y),
priorelation(X,Z)

 

and so on, meaning i can ask it questions such as:

? – discount(brake_pad,summer,purchaser1, X)
Response: Yes –
X = inhouse_supply_canada
X = external_supply_bromhouse

as in according to observed rules (based on past data), there is two valid matches for X, that satisfies X being a supplier that will give a discount for brake pads, in the summer period, if purchased by purchaser1.

An interesting small hobby project, but now i am more or less done. What it will become? I don’t know. Probably nothing but a small test.

I am however still interested in taking my concept and try to merge Prolog with business intelligence AI. If it’s doable? I don’t know. But i would like to attempt it, given time to do it.

The morale of this rant is that you should try Prolog, as it is still useful, if not only for academic reasons. And if you are a teacher in CS fields, maybe think about having an intro course on Prolog, as it is still a good way of getting hands on with practical logic and expert systems.

Material and links:

Learn Prolog

SWI

 

 

 

 

 

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>