LISA and rule-based programming in Common Lisp - Lisp Propulsion Laboratory log

Lisp Propulsion Laboratory log

Paolo Amoroso's weblog. Main interests: Lisp, astronomy (Moon), space exploration (Apollo and early manned programs) Calendar of past entries | Related links xml

LISA and rule-based programming in Common Lisp

Saturday, August 27, 2005

Given the current interest in Domain-Specific Languages, and the fact that Common Lisp is a multi-paradigm programming language, this looks like a good opportunity to talk about the LISA production rule language for Common Lisp.

LISA (Lisp-based Intelligent Software Agents), by David Young, is one of those little gems buried into Sourceforge. Many Lispers probably never heard of it, or don't know much about it.

Back in the AI spring, Lisp was one of the main languages for developing expert systems and shells (if you wonder what happaned to expert systems after the AI winter, see what I found last March). When I started studying expert systems last fall, and looked for free systems to play with, I mostly found a few such tools that were old, designed for specialized domains, or limited to toy problems for educational purposes. I guess many of the well known systems written in Lisp were either commercial products or never released research projects.

LISA is a notable exception. Based on the efficient Rete pattern matching algorithm, it is in the tradition of, and was inspired by, OPS5, CLIPS for C and JESS for Java. Work on LISA started around 2000, so it is a relatively recent system and leverages the experience of its predecessors.

LISA is powerful and integrates well with Common Lisp. From the web site:

[...] Lisa reasons over CLOS objects without requiring changes to an application's class hierarchy. In addition, the full power of Common Lisp is available for use within productions; there is no dichotomy between Lisa's programming language and her implementation.
Also, David was kind enough to implement uncertain reasoning via Certainty Factors, a feature I and others had suggested.

The rule-based paradigm is certainly mind-stretching and worth learning. It can help solve problems in which complex logic and decisions are involved. I find this paradigm and the declarative style of rules intuitive, not to mention a "just works" feel -- but when it doesn't, debugging can be tough.

Over the past year or so, I bought from Amazon at bargain prices half a dozen used books on expert systems. They are most of the popular ones referenced in the literature on this field. Among these books, only the following ones usefully cover the practical issues of actually programming rule-based systems:

The former covers CLIPS, which has a syntax close enough to LISA's to make the code examples easy to understand and use. Although the syntax and semantics of OPS are more cumbersome, the latter book discusses a wide variety of useful rule-based programming techniques.

Except for some discussion in the latter book, and efficiency considerations discussed in both, I have not been able to find any resources that cover the practical issues of designing a knowledge base.

If you want to give LISA a try, note that building it with ASDF (system name: lisa) is possible, but a bit tricky because of the many subsystems involved. Be sure that your central registry contains these links:

lisa-debugger.asd        -> src/debugger/lisa.debugger.asd
lisa.asd                 -> lisa.asd
lisa.config.asd          -> src/config/config.asd
lisa.core.asd            -> src/2.0-core/core.asd
lisa.epilogue.asd        -> src/2.0-core/core.asd
lisa.implementations.asd -> src/implementations/implementations.asd
lisa.packages.asd        -> src/packages/packages.asd
lisa.reflect.asd         -> src/reflect/reflect.asd
lisa.rete.asd            -> src/rete/reference/rete.asd
lisa.utils.asd           -> src/utils/utils.asd

It would also be useful if you could join the lisa-users mailing list. LISA is a mature system for niche applications, and list traffic tends to be -- very -- low. So, discussions and experience from a wider user base would be valuable.

Another interesting feature of LISA is that it provides good Lisp code to study. It was developed by an experienced programmer, and it shows. Source files tend to be short and contain small functions that focus on doing just one task. Symbol names are meaningful and explain what functions and macros do. Even basic familiarity with the problem domain is enough to understand what the code does most of the time. In short, this is one of those systems in which the code makes comments mostly unnecessary.

Copyright © 2005 by Paolo Amoroso

Created with BlogMax

August 2005
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Jul  Sep
About Lisp | Practical Common Lisp (learn Lisp) | Planet Lisp (blog agregator) | Common Lisp Directory (software and resources) | Why Lisp?