Why hasn't logic programming caught on?

As time goes by, it appears more and more like functional programming is having more of an effect on other programming languages. We're starting on Prolog in my AI class, and it seems like there are some things there that would make programming in non-AI fields easier. My question is this: why hasn't logic programming caught on in the same way?

In this topic, it seems that a general consensus was reached that logic programming is useful but must be proven as such. Is there a reason why it's not seen as useful?

Update : Perhaps I should be a bit more clear. I'm not really asking about Prolog. I can see why it wouldn't be a good idea to choose Prolog for most real-world applications.

To give an example of more what I'm talking about, consider list comprehensions/map/filter in Python. These are clearly influenced by functional languages. Why is it that languages such as Python haven't also picked up on these kinds of things from logic programming languages like they have functional languages?


When you learn about logic-programming in Computer Science classes using Prolog, the main point is not to make you a proficient Prolog programmer, but rather to open up your mind to alternate forms of programming techniques (data-structures/algorithms) that you'd not have considered before.

To illustrate my point when I started studying Computer Science my engineering school used to require all students to write their software programs in Pascal, but since I graduated I've never used Pascal even once. But the skills I learned by picking the right data-structures and algorithms I am still using every single day.

Pascal is not showing up on my resume as a language I know, but it has been instrumental in my training as a software engineer. Its usefulness cannot only be measured by the number of line of Pascal code currently in production.

When you'll develop software you'll realize that, even though you are not writing a single line of Prolog code, you are at times re-using techniques that you may have first learned in these "useless" Prolog or AI classes you attended.

Evaluating the usefulness of a technology (specific programming language, specific software tool/application) is not simply a matter of evaluating its actual level of use, but rather its influence.

If you look at the influence logic-programming has had in the field of expert systems, computer games AI, air traffic control, and probably quite a number of other fields (suggestions anybody?) I don't think it can be said logic-programming has not caught on...


I spent about 4 years of my programming career working on a rule based "Expert System" for provisioning and configuring hardware for telephone exchanges based on customer requirements.

It was very successful, and as far as I know is still in daily use more than 10 years later. But finding programmers who could understand how it worked was a greater task than developing the system itself.

I think this is why the approach has not taken off, because few people have the necessary mindset for logic based programming compared to the number of people that can understand the concepts of procedural and functional programming.

Logic programming languages provide a mechanism for feeding facts and rules of inference into an "inference engine" which is then set in motion to apply the rules to the given facts in order to produce new facts. A particular logic language stands or falls on the strength of it's particular inference engine.

Prolog's inference engine has a very naive implementation and is very inefficient. The same problem could be solved more efficiently in most procedural languages just by writing a lot of if statements in a loop.

The language we chose for our "Configurator" was DEC's RuleWorks which is a refinement of the more widely known OPS5 language. This has an inference engine based on the Rete Algorithm which makes it far more efficient than the procedural approach.

Since DEC got swallowed by Compaq which got swallowed by HP, RuleWorks has become open source and be obtained from this web page.

It's a shame there is not more interest in such techniques because they can be very effective for solving a variety of otherwise intractable problems.


My impression of plain Prolog is that it's a toy language. That's not to say that logic programming can't be useful. For example, in Twelf it's possible to declare semantics for a simple programming language quite easily and have the declarations act as an interpreter. I've also heard some good things about λProlog.

The problem I think in trying to use a logic programming language as a general purpose language is that some tasks just don't fit the concept very well. I think that logic programming features need to be incorporated into a language that also has imperative and functional constructs. There is at least one such language: Oz, but I've yet to try it out.

Edit: There's one idea I've wanted to try for some time: Feed a relational database to Prolog as atoms and use it to do queries instead of SQL. I've a feeling it would be a great improvement over SQL.

链接地址: http://www.djcxy.com/p/79404.html

上一篇: 如何学习多种

下一篇: 为什么没有抓住逻辑编程?