Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

i've a doubt about using Prolog for my grad school research. Recently, i've presented a small part of my research work which is discussed about logic and prolog in a conference. I got a comment from an audience that questioned me "why i chose prolog". He said that prolog is an outdated languages (popular usage around '80s) and people are rarely talk about prolog now. Is there any risk if i use prolog in my research study because of its old-fashioned language? or maybe i should prolog as only a part of my study. This is confusing me as i know that prolog is still be using in academia now..

share|improve this question

migrated from stackoverflow.com Jul 19 '11 at 0:42

This question came from our site for professional and enthusiast programmers.

4  
I'm sure that you've read a multitude of papers by researchers doing work in your field. What are they using? I don't know what you study, but if you know that it's the right tool for the task, and you've weighed costs/benefits against alternatives, then take what the critic said with a grain of salt. –  jonsca Jul 17 '11 at 4:18

10 Answers 10

An alternative for Prolog could be Lisp. (I don't know Lisp so cannot comment)

The answers to my question and if you search SO on [prolog] tags may give you an idea on it's currency and who/where is using it. It may be a relatively old language, but it is very far from dead yet.

As to "why i chose prolog": (apart from maybe Lisp) I don't know of another declarative model based language. As far as I know it's still the only language out there that 'solves problems' instead of executing solutions.

See this for a melding of Prolog and C++.

[edit] As Eduardo Rdm points out, it's "horses for courses", you should pick the right tool for your problem, and that may require you to learn something of the tools he mentions and what else is out there.

share|improve this answer
2  
Lisp is even more old-fashioned, in that more modern languages with its prime features (except homoiconicity) have hit the mainstream in the last two decades: Python, Ruby, Scala, you name it. If you're looking for declarative languages, check out Haskell. –  larsmans Jul 18 '11 at 7:03
2  
Prolog, of course, is homoiconic, too. asserta(do_it(A) :- A). –  pillmuncher Jul 19 '11 at 2:01

Prolog is still a very useful language especially for AI. It's very useful for rapid development but can be slow at times. That why for many real world AI applications people spend the time to code it up in C/C++. Definitely for a research context Prolog is the way to go. Since it is a logic based language (everything is essentially in CNF) it has many advantages for certain specific types of projects and is unique from many other languages making it very appropriate for a research environment.

share|improve this answer

I've used Prolog extensively for my PhD dissertation, and I am also using it currently for a couple of papers I am working on. Why? Because it fitted in perfectly. I needed a general-purpose rule-based knowledge representation language - And Prolog is still the most ubiquitous language for these needs. When the tool serves the purpose, these questions don't arise. I got a lot of comments on a recent paper I tried to publish, that dealt with a search technique for free-form models. "Why Prolog?" was not one of them, because it was obvious from the text and examples that it was a good choice.

If Prolog gives you an edge in your research, state it clearly, and no-one will question you - The Academia is not a high-tech company, and implementation details are not a real issue. If you're not sure yourself why you use it, I agree with the other replies that there are more contemporary alternatives.

share|improve this answer

Do not take each and every peer review comment as token value.

To reduce controversiality you might note that your system is a "proof-of-concept" system which is the main purpose of research anyway.

Using a current mature Prolog system will give you a more stable implementation than using one of the mentioned languages. While those languages are itself very stable, their libraries (or your own code) needed to provide Prolog's functionality will incur a lot of instability. I have seen lots of research projects particularly in compiler construction that effectively emulated with much less diligence and principle Prolog's unification and backtracking mechanisms. Oh, and I have seen lot's of libraries that do it wrong.

Don't expect to see many papers on how a project failed or did things wrong. Research is more about success. The last paper I am aware of about a bug incurred by using another language to implement Prolog's unification algorithm is Peter Norvig's Correcting a widespread error in unification algorithms of 1991. Don't say the paper is old or that this problem is specific to LISP - this bug reappears every now and then, as this discussion illustrates.

You may refer to this thread for some uses of Prolog - the most popular in terms of media coverage is clearly IBM's Watson. It uses SICStus Prolog in the language analysis part. So you have "seen" Prolog running on Jeopardy.

share|improve this answer

go read the visual prolog webpages, they tell you that their prolog is used in scheduling for all sorts of businesses. Yes while its an "old" language, its code is proovably correct since its based on maths concepts. as stated above its a quick concept to code language. cant remember what the stats are but you can write things in a few lines of prolog code, that would take many more in other languages. Its also "good" for finding solutions when you want all the answers and dont know the recipe for getting them.

share|improve this answer
    
There's a probably equal amount of businesses running on Fortran and Ada, and a lot more on COBOL. –  larsmans Jul 18 '11 at 7:06

It would be helpful and interesting to know more about the OP's intended application. Prolog is itself the focus of some research and development projects, esp. extensions like constraint programming, but I have the impression glow123 has a wider topic in mind.

The cited comment (from an audience member at a talk, not a "reviewer") was actually a question, why choose Prolog? (coupled with an observation that Prolog used to be popular in the 80s) That is a good question to put to a graduate student embarking on their thesis or dissertation work. Prolog and logic programming generally are powerful tools for some computing tasks, and not so much for others.

Strengths

For applications that "search" for solutions, a useful aspect of Prolog is backtracking. This framework would take a lot of time to reimplement in a procedural language.

For natural language processing (NLP) a useful feature of most Prologs is DCG (declarative clause grammars), which saves time in simple applications. For an elaborate application, see this note about IBM's Watson and the Jeopardy Challenge.

Weaknesses

As a declarative language Prolog is not the easiest way to implement algorithms that are expressly procedural, such as matrix factorization. That said, many Prologs allow calling external code for specific tasks of that kind, and the resulting combination of Prolog with procedural languages can be very effective on large-scale problems.

Pure Prolog lacks features like global variables and "object-orientation" that many programmers would find difficult to live without. Paulo Moura's Logtalk makes up for much of those omissions using a variety of Prolog compilers as backends, but if programmers find it hard to imagine how ISO standard Prolog gets along without them, that might be a sign Prolog is not the language for them.

share|improve this answer
    
Thanks for the correction of "reviewer". –  false Jul 18 '11 at 19:14
    
Concerning ISO Prolog: There is a big difference between a single source implementation as Logtalk currently is, and an actual ISO standard backed by many implementations both commercial and free. So far, Prolog's standardization process uncovered many inconsistencies and false but frequently held beliefs about the language. That takes time and effort. This process can be accelerated by sticking to the existing standards first. Take syntax conformity as an example. –  false Jul 18 '11 at 20:03
    
@false: Perhaps it is a bit ironic that Paulo Moura must know as much as anyone about inconsistencies of Logtalk supported Prolog compilers in order to provide Logtalk compatibility! –  hardmath Jul 18 '11 at 22:42
    
There is still lots of things left. Compared to other programming languages, Prolog is pretty special in that even very frequently used predicates still show differences or inconsistencies. This is due to the many different modes, aliasing and the absence of a static typing system. As an example consider length/2 of the Prolog prologue. –  false Jul 18 '11 at 23:46
    
@false: One of the strengths of Prolog is the ability to freely extend the language with custom operators as well as predicates, which was one of the rationales for using it as an enabling technology in Japan's 5th Gen. Computer Project. Of course topics like adding static type checking have been studied and implemented, showing that this particular innovation can improve performance and conserve compiled code size by analysis of what modes are really needed for a given goal. Not sure what specially about length/2 illustrates your point. –  hardmath Jul 19 '11 at 16:12

Prolog is still being used in some areas of research. The university were I work teaches it and has a group of researchers building systems in it; so does my alma mater.

Be sure to check out the "new" constraint logic programming language CHR. It's under active development since the early 90s (like Python, Perl), most implementations are based on Prolog (one is included in SICStus and SWI), it has an annual summer school, conferences dedicated to it and it's much more elegant than ordinary Prolog for many purposes. It also has a Java implementation for your write-once, run-everywhere demo apps.

share|improve this answer

In my opinion, Prolog is just starting to get interesting, as more serious freely available implementations (for example, SWI and YAP) are becoming available. In the not so distant past, serious Prolog systems cost several thousands of dollars, whereas you can easily try out quite good free implementations today. Consider also how much implementations have improved just in the last few years: From constraint solvers to more efficiency, additional libraries for semantic web applications and new virtual machine architectures, corrigenda and additions to the ISO standard etc. Looking for example at the download statistics of SWI, the Wikipedia edits for "Prolog", the blog entries for "Prolog" on Google blogsearch, the IRC chat #prolog on irc.freenode.org, the stackoverflow questions for "Prolog", the university courses teaching Prolog all around the world, the recent addition of a decent Prolog mode in GNU Emacs, the development of Prolog interfaces for several other languages like Perl and Python, new books on natural language processing using Prolog, and several other measures, I find it hard to argue that Prolog has ever been more "popular" than it is now.

share|improve this answer

It looks to me that the question is somehow similar in spirit to the following other questions:

Why (not) logic programming?

Why is Prolog good for AI programming?

Is Prolog professionally useful?

In academia the relationship of Prolog to mathematical logic is also of great interest. But one can do mathematical logic without a computer, just paper and pencil. To get an impression what is going on in mathematical logic one might like to visit:

Mathematical Logic around the World
http://world.logic.at/

When you see the term "Horn Clause" or somesuch, it is evident that it is related to Prolog. But since Prolog allows extensions in various directions, the connection is very broad.

Best Regards

share|improve this answer

Currently logic programming can be done by using description language such as OWL (Web Ontology Language) and one of many inference engines.

Clear advantage is that it's fairly easy to use it within other languages (like Java, C, and you can use specialized triplestore database.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.