ChatGPT Can Convert Some Standards to Prolog, e.g. USPAP (Uniform Standards Of Professional Appraisal Practice)

This past week, I discovered that ChatGPT can do a pretty good job of converting lengthy standards into SWI-Prolog. In particular, it quickly converted the USPAP (Uniform Standards Of Professional Appraisal Practice) into Prolog. I downloaded the USPAP standard as a PDF and then fed it to ChatGPT, which provided the source code to validate whether an appraisal (e.g., an appraisal for a residence) conformed to USPAP. ChatGPT said that it can also do this in Python, but that Prolog is very significantly superior to Python as a standards language.

So, with AI, I can see a ton of work coming for Prolog programmers — after all these years. There are numerous government regulations and standards. They will need to be codified into language that is readable by non-programmers — and Prolog comes close to that (as long as the logic doesn’t become too complex, which it inevitably will from time to time). I had to review the Prolog code generated by ChatGPT and refine it. However, I was surprised that it ran with just some minor changes. A domain specialist must review the code and test it to ensure it works. I am sure that will always be the case. And somehow, they will have to hope that they can find an experienced Prolog programmer - or train a new one - a no easy task.

I plan to publish the code on GitHub, with documentation, in the next week.

By the way, the code ChatGPT generated was R with Prolog. In some cases, it generated R code that then generated Prolog, and in other cases, ChatGPT generated pure Prolog code, mostly consisting of facts and requirement rules.

4 Likes

Why R in particular? Could use Prolog (rather than R) code, to generate Prolog code :wink:

… likely involving DCG.

Hi bcraytor,

It may then be possible to transform other standards as well, not just those relating to property valuation. Examples include procedures for operating complex facilities or complicated organizational processes within companies…

Well certainly back in the 80’s and 90’s. But it is slow and there aren’t many programmers around that can handle complex Prolog. But does AI change this? Does Prolog now have advantages over other languages in certain areas? Given that AI system such as ChatGPT seem to find it far easier to convert some standards to Prolog in a reliable manner than other procedural languages, it seems that might be the case. Conditional requirements standards in appraisal can be a bit complex. Appraisals can require any combination of the Sales, Cost and Income approaches, there are different appraisal methodologies for these different approaches which diverge again on the many property types and loan types: (single family residential [ Fannie Mae/Freddie Mac, VA, FHA, …], condo, 2,3,4 unit, commercial: Multifamily (5+ unit), office, industrial, motel, hospital, … and so on. So the generated system may validate the appraisal reports configuration against all of the requirements by directly referencing the latest applicable standards ( of which USPAP is only the primary standard). It may further generate protocol instructions.

And then the question of reliability and readability. If the Prolog doesn’t get too complicated, it can be fairly easy to read by laymen, - with a little training. It is also executable, guaranteeing what you read is what you get.

As to why R - there are simply too many things that are handled better by a procedural language, noting that data management and statistical analysis is a large part of appraisal. And R has the most embedded statistical code, the exception being Python for AI (PyTorch, numpy, pandas, …). So, I would say the language base for appraisal is R, Python, Prolog with some C/C++ backend.

Note: Convolutional Neural Network models are needed for processing (e.g. ranking) property photographs, to rank according to value contribution.

Note 2: An interesting facet not described above is that USPAP allows “Jurisdictional Exceptions,” whereby State, County, and City laws can override the standard, creating “overlays” in Prolog.

Prolog has always had the advantages of being a declarative, logical and relational style. This gives structure to the program, helping to prevent AI from generating word-salad slop.

Prolog has rules/facts as a natural part of the language, easy to express and use - example: GitHub - bitlaw-jp/the-constitution-of-japan - has English translation of the constitution: The Constitution of Japan - English - Japanese Law Translation