Understanding the Possibilities Offered by Logic Programming
Thursday, October 3, 2019 at 07:52AM
Charlie in Digital Financial Reporting

SWI-Prolog is an interesting tool.  The book Simply Logical helps you understand how to use SWI-Prolog.  The book makes use of an online application SWISH to demonstrate SWI-Prolog and logic programming.

SWISH is an online, collaborative tool for learning about and using logic programming.  This resource, Using SWISH to realise interactive web based tutorials for logic based languages, is also incredibly helpful in appreciating SWISH and SWI-Prolog.

Here is a basic, quick and easy explanation of how to use SWISH.  But before you walk though the explanation, click on the image below and just look at the graphic which will help you see what you are doing:

The steps are the following: First, click on this URL to open up an example. Second, copy and paste the query "houses(Houses)" into the query window as shown, and then press the blue "Run" button in the lower right hand corner.

Notice the table that appears.

Don't misinterpret what you are observing!  This is NOT about getting accountants to write the ugly looking syntax on the LEFT.  This is about creating a rock-solid and crystal-clear logical model of a financial report so that programmers can do what appear to be magical things like the table that appears on the RIGHT.

If a financial report has no high-level logical model that is explained in terms a business professional can understand, then you are STUCK USING THE UGLY LOW-LEVEL XBRL TECHNICAL SYNTAX!!!  It is really that simple and straight forward.

Yes, some accountants will learn the low-level logic programming.  Maybe some auditors also.  But this will be a small portion of accountants and auditors.  A few people create the tools; millions of accountants use the tools.

This is about helping professional accountants and auditors to understand that for software engineers to do a good job, they need something like the four clear logical models that I use to describe a financial report.

It is incredibly dumb for each regulator to invent their own implementation of XBRL.  Proof of this is that the SEC cannot seem to get XBRL-based reports to be of the required quality, each regulator impementation is slightly different, and no one is really very pleased with the software that they are provided to create XBRL-based reports.

This is the problem the OMG Standard Business Report Model (SBRM) is trying to solve. SBRM provides the needed logical conceptulization of a business report and allows for standard metadata (like this) to be created and then leveraged.  All this is explained here.

Also, I am NOT SAYING that SWI-Prolog is the right logic programming language.  As I understand it (a) prolog is backward chaining which is limited and we need forward chaining or forward AND backward chaining; (b) DATALOG is a safer version of PROLOG; (c) other alternatives exist such as answer set programming and Logtalk or CLIPS or even in other languages.

++++++++++++++++++++++++++++

Prolog Crash Course

Prolog Video Tutorial

Prolog Cheat Sheet

FinTech Examples

Prolog in One Video (1 hour)

Prolog Tutorial

Logic programming podcast

Article originally appeared on XBRL-based structured digital financial reporting (http://xbrl.squarespace.com/).
See website for complete article licensing information.