(Note: We may earn commissions from products/services you click on. This is at no extra cost to you.)
Table of Contents
Prolog means “logic programming”, this language aroused a great craze in the 1980s before going somewhat out of fashion. However, it remains studied in most engineering schools and master’s degrees in computer science. It is indeed a way of posing compelling problems and, for the classic programmer, both very confusing and rewarding. And to ignore this programming paradigm would be to confine oneself to the early days of computing.
Programming in Prolog is, in fact, very different from a classic imperative programming approach; it is a much more advanced language allowing to translate some of the exercise texts present here with great simplicity. It is particularly suited to symbolic calculation and reasoning. Not being typed, the freedom is very significant. It is, however, a complex language, because of this freedom, but also because correctly posing the problem is, most often, precisely the difficulty, and sometimes much more complex than to solve it (that is to say to express the algorithmic part), once the problem has been formalized. Prolog being reserved for reasoning problems, it is the representation, that is to say, the way of choosing the data structures and the relations intervening between them.
Learn something new. Click this affiliate link to register for the Data Science Certification Course Using R.
On the other hand, it is essential to understand the operating strategy of Prolog in its search for solutions in order not to declare things, which, although correct, cannot be interpreted by Prolog. This is why you have to train yourself to schematize the search tree on simple examples by putting yourself in place of Prolog. Despite these restrictions, this one is relentless, which means that by researching well, all the answers it gives to the user’s questions are explained, mainly the multiple answers.
What makes Prolog so hard is that your logic, the core reasoning behind the program you are writing, has to be near perfect upfront. This is a hard thing for the human psyche today.
Conversely, procedural languages such as those used by most programmers today let you get away with a lot of missteps in your overall designing when it is necessary to logical consistency. You can write a lot of code and compensate for the logic wrongdoings you moved inherently by adjusting other segments of your code later on. With Prolog, you are dead in the water until you get the logic right.
In other commands, in Prolog, you have to get all your reasoning right upfront. In a procedural word, you can forge ahead with much less well-defined architecture and fill in the sections later.


How long does it take to learn Prolog?
The Prolog programing language first appeared in 1972, realizing it as aged because of the atrocious C programming language. In contrast to C, which is imperative and procedural, Prolog may be a predominantly declarative programming language (with some procedural components) supported Horn clauses, a Turing-complete subset of first-order predicate logic.
Where am I able to learn Prolog?
There could be a free online version of Learn Prolog Now!, a great book for fledglings desirous to start on SWI-Prolog, one in all the few( two ?) widely-accepted major Prolog implementations, SICStus Prolog being the opposite one. Although different Prolog implementations share identical syntax and semantics, they’ll differ seriously in terms of the built-ins and libraries, so Prolog programs are generally not fully portable between implementations.
How am I able to get( SWI-) Prolog up and running on my computer?
If you’re employing a Mac as I do, then I’d highly recommend positioning Homebrew if you haven’t already. Homebrew may be a command-line package manager for Mac which performs it rather more simply and is simple to put in all types of things from and on the authority order. Then simply execute: P TAGEND
$ brew install swi-prolog
To install the swi-prolog formula( as they’re called in Homebrew ). Alternatively, you’ll attend the SWI-Prolog official website, which should contain links to downloading the official SWI-Prolog interpreter, which should be available for multiple operating systems.
I cannot/don’t want to put in SWI-Prolog on my computer. Am I still able to learn SWI-Prolog? No problem – the SWI-Prolog official website offers SWISH, a web service for experimenting with and sharing SWI-Prolog programs.
Would you recommend Prolog as a primary programming language?
Not – after all, without a minimum of a basic understanding of terms and ideas in formal (first-order) reasoning like hypothesis, predicates, logical concurrence and disjunction, ramification, and modus ponens, one would likely struggle to know even the foremost basic of Prolog curricula. Incidentally, (classical) propositional logic (and its affiliated notation) is usually educated at or near the start of most discrete math tracks – no wonder many such courses introduce Prolog programming into its curriculum.
Click this affiliate link to register for the Data Science Masters Program.
Furthermore, an honest comprehend of either recursion, or numerical induction would benefit in teaching Prolog – recursion in Prolog is extremely commonplace since there are no( imperative) looping constructs like for or while loops.
Is Prolog worth learning?
Since the Massachusetts Institute of Technology developed LSP in the 1950s, LISP has been the leading artificial intelligence language in the United States. Prolog was developed in Europe in the early 1970s as the language chosen by European artificial intelligence researchers. In addition, Japan’s fifth-generation machine plan also selected Prolog as its software development language. Douglas Partridge, a veteran scientist at the Corporate Artificial Intelligence Center of the Hughes Institute in Calabasas, California, who helped develop the internal expert system, predicted, “This is a complicated issue. Will affect the industry in the next five years.” He believes that logic programming represented by Prolog and its dialects is sneaking into the field of artificial intelligence in the United States. However, he doubts whether this language “coincides with the problem-solving method people use when developing expert systems.”
About the prolog language
(1) WHAT-type language; Prolog is a step forward from the program “How to do the Job” to “What you want to do”. The user only needs to explain what the known facts are, define the rules (describe the relationship between the objects), and then tell what the problem is to be solved (inquiry), instead of telling the computer how to do it step by step, the problem is solved through the internal mechanism of Prolog Automatic generated.
(2) Based on first-order predicate logic, it has a solid theoretical foundation and strong performance ability; Prolog has simple grammar, strong description ability, and is closer to natural language. The program is easy to write and read, and the amount of programs is negligible.
(3) Prolog automatically realizes pattern matching (unity function) and automatic backtracking. These two are the basic operations commonly used in artificial intelligence systems;
(4) The internal backtracking ability and uncertainty enable Prolog to give multiple solutions to the same problem; there are two reasons for Prolog’s delay: ①Procedural uncertainty: Prolog predicate call uses pattern matching, Top-down depth-first search automatic backtracking strategy, when the variable value does not meet the predicate, backtracking is generated, and another value of the variable is obtained, and so on until the predicate is factual; ②The uncertainty of the characteristics of the variable: Refers to the property that the variables in the predicate can be used as both input and output variables. The non-determinism of the attributes of the argument causes the diversity of questioning methods and enhances the interactive ability (conversational ability). The uncertainty of the process and the uncertainty of the variable characteristics are intelligent characteristics that traditional programming languages and another AI language, LISP, do not possess.
Learning Prolog
This article is translated from the article Why Learning Prolog Can Make You a Better Programmer. Because I am not familiar with this language, I only remember that my teacher introduced this as an artificial intelligence programming language when I was in college. Some parts of the translation may not be understood correctly.
In computer teaching courses, there is a traditional phenomenon. Whether or not you have studied one or two courses can be a watershed in judging whether a person can deeply understand computer science concepts. Although everyone seems to program in a language like Java, some compelling evidence shows that the most complex idea in computer science is class, which contains a lot of real wisdom that can help you in C or Lisp language. Provide helpful help during use.
In my alma mater, a course on Prolog became the dividing line between specious and real computational science students. The reason is that if your brain can understand a Prolog interpreter written in Prolog, then you have almost mastered any programming concept.
However, today, the schools are more interested in those market-oriented languages, such as Java and Python. It’s as if they are seeking to teach people how to program as quickly as possible (maybe they didn’t realize it, but they did it).
Little things about Prolog
Prolog is not as popular as it used to be. I think it used to be a strong competitor of the Lisp language (at least for European artificial intelligence people). However, people usually believe that learning Lisp has more advantages, even in terms of the learning experience.
But I think it is not an exaggeration to say that Prolog also has the same advantages. There are some reasons why Prolog is still of great learning value for most programmers.
Prolog is a purely functional language. It is so pure that even the only value it can return is true or false. In Prolog, any operation is related to the binding of parameters, so there is no modification and update of variables-only method calls.
This language provides a straightforward mechanism for accessing the database. In Prolog, a database is seen as a collection of information that can be viewed according to specific rules. In this way, access to external data is just treated as a logical form, and you do not need to do the necessary operations to retrieve and read data. This mode of Prolog reduces the impedance between code and data and is a good way.
Is Prolog still used?
The question and its answer are locked because the question is off-topic but has historical significance. It currently does not accept new solutions or interactions.
Many years ago, I studied Prolog at university. In my career, I have never needed to use Prolog. Am I missing something special?
As far as I know, Prolog requires an entirely different way of thinking compared to well-known programming languages.
Prolog (and pop log) is handy for AI coding. If you are not professionally/seriously engaged in AI-related work, you may not use it at all, just as non-engineers may never use MATLAB seriously.
Prolog is the first programming language taught by Uni Potsdam in Computational Linguistics, but after that, even if we are very good at it, we will not use it. Sorry. Whenever I see questions like “How to use an accumulator” or “How to get all possible answers” on StackOverflow, it makes me wonder where the actual professional users are-most things seem to be homework. Maybe Prolog’s proficiency will make you a robot that has never had a problem.
The fault detection system written in Prolog, which has been implemented somewhere in Austria (Klagenfurt?). According to the information told to me, the product is excellent and has been sold to customers. If you think this is “professional and useful”, then the answer is “yes”.
It’s worth it whether you will use the basics of Prolog in the real world or not. It is also worthwhile to understand the basic idea of the unified foundation and deal with the (trivial and inefficient) implementation. If you have a problem that can be best solved using declarative logic, you should ideally recognize this and know (if you can choose) to use the right tools for the job.
The Prolog needs a very different mentality from traditional imperative languages and a mentality that is very different from functional languages. Except for a certain point, it seems to require a lot of experience (just like anything else),
It is true that most of the content it covers has not been impressive for quite some time (search, heuristics, etc.), but it is still exciting, and IMO is something worth spending some time investing in.
Newer books specifically describe Prolog, which is better for learning the language. Still, the risk of doing so is that your brain will be transported out of your ears from somewhere in the intermediate to advanced material.
Which coding language is easiest to learn?
Suppose you are thinking about learning how to code to work as a professional software developer or build your projects. Any software development career starts with selection. From the beginning, you need to choose the programming language you want to use. This choice is most likely to reflect the entire coding career in front of you (if you strongly wish to enter the industry, of course, it is enough. Therefore, before entering the learning process, you’d better think carefully. As someone said, That way, it has nothing to do with making the right choice. This is the choice of making the right choice. Let us look at some of the most popular programming languages among beginners, try to understand their purpose, future perspectives, advantages, and disadvantages, and then choose one of them One kind.
Java
Java has always been the first choice in the enterprise and mobile fields and will continue to do so for the foreseeable future. As one of the most common programming languages in the world, today’s Java has almost been widely used in the fields of platform, technology, and economy. It is currently the most popular back-end programming language in mobile development (mainly Android), and it is very common in cloud-based solutions and many other hot technology fields such as IoT and big data.
Python
Python usually competes with Java for the name of the best programming language to learn first. It is one of the easiest to learn, easy to use, and widely accepted coding languages. According to Slashdata’s latest “State of the Developer Country” report, there are currently more than 8.4 million Python programmers worldwide. In the past few years, Python has become crazy, surpassing Java to become the world’s second most popular language (JavaScript is the leader).
JavaScript
JavaScript is the king of modern front-end development. Originally released during the “First Browser War” between Microsoft and Internet Explorer and Netscape’s Navigator in early 1996, JavaScript is now the most obvious choice for designing interactive front-end applications due to multiple advantages. A level of dynamic programming language was particularly popular in the late 2000s when the JavaScript-based runtime environment NodeJS was released. Node.js allows developers to use the same language on the server-side and the client-side, side scripting, so that dynamic web content on the server-side can be generated before it is sent to the user’s web browser.
PHP
PHP may be another good choice for you to learn your first programming language. Although PHP faces fierce competition from JavaScript and Python, PHP is still one of the most popular back-end programming languages. The popularity of PHP is gradually declining, but it is still in significant demand in 2020, as many organizations still use PHP on the back end of their websites and projects.
Most challenging programming language to learn
We usually talk about programming languages such as c, c++, Java, Python, etc. Some languages are not only difficult for most software developers but also almost incomprehensible. These languages are called esoteric programming languages (or obscure languages).
Obscure languages are not designed for normal software development. They are intended as a proof of concept or just a joke.
Here is a list of the five most difficult and obscure languages. I tried to execute the “Hello World!” program in every language, which was very interesting.
Malbolge
Ben Olmstead invented Malbolge in 1998. This obscure language is considered the most complex programming language.
It is said that the author of the Malbolge programming language has never written any programs in the language. Nearly two years after Olmstead invented the language, the hello world code in Malbolge did not appear.
This is the code snippet to print “Hello World!” in Malbolge.
This is the output:
INTERCAL
Jim Lyon and Don Woods developed INTERCAL in 1972, which is a witty and interesting programming language.
It started with the name ” programming language without pronounceable acronyms “.
INTERCAL has designed many features that make programmers feel frustrated.
For example: it uses the modifier “PLEASE”. If “PLEASE” is not frequently used in the code, the compiler can reject the code. It regards the procedure as “not polite”. If the modifier “PLEASE” is used too many times, the compiler will also reject the code as “too polite”.
This is a code snippet that prints ” Hello, World! ” in INTERCAL .
Brainfuck
Brainfuck was developed by Urban Muller in 1993. The language was invented to allow programmers to have fun.
The name itself implies that the programming language is very difficult to understand for any programmer.
The entire programming language has only eight different characters , and the language uses these eight characters to write all codes. The original compiler developed by Muller used only 296 bytes.
This is a code snippet that prints ” Hello, World! ” in Brainfuck .
COW
COW was developed by Sean Heber in 2003. After seeing its hello world code, you will understand why this language is called “COW”.
In terms of difficulty level, COW is equivalent to Brainfuck. Compared with Brainfuck, it has four more commands, that is, there are 12 commands in the entire language.
This is the code snippet for printing ” Hello, World! ” in COW .
This Output:
Whitespace
Whitespace was developed by Chris Morris and Edwin Brady at Durham University. The language was released on April Fool’s Day in 2003.
Any program written during this language relies on spaces, tabs, and newlines. Whitespace’s interpreter will ignore non-space characters and treat them as code comments.
This is the code snippet for printing ” Hello, World! ” in Whitespace. Within the code below, each space, tab, or newline character is preceded by a comment “S”, “T” or “L”.
Conclusion
Speaking of Prolog may be a logic artificial language, what’s the difference from a general functional language? Answer: it isn’t the identical thing in the least. In Prolog, the foremost basic approach is to first describe the facts (establish the connection between the item and therefore the object), and so query the link between various objects by asking the target. The system will automatically match, backtrack, and provides answer.
for example:
We use the subsequent syntax to specific a fact
handsome (ergou).
This sentence describes a fact: Ergou (ergou) is extremely handsome, and so ends with a period (.), indicating that this fact has been described and is definitely.
Then we’ll get the subsequent conclusions within the Prolog console (REPL):
?- handsome(X).
X = ergou.
?-
Which ?-is the start of our manual input, the opposite is that the return of Prolog. Those operations above are:
We first ask Prolog: Who is that the most handsome person within the world? Handsome(X).Which Xis begin with a character at the start of all uppercase letters within the Prolog where all variables.
Then Prolog replied:, X = ergou.of course it’s a second dog!
The above should be thought to be an illustration of the essential idea of Prolog. you’ll move to download the Prolog environment suitable for you, and so play with it on your own computer.

Luis Gillman
Hi, I Am Luis Gillman CA (SA), ACMA
I am a Chartered Accountant (SA) and CIMA (SA) and author of Due Diligence: A strategic and Financial Approach.
The book was published by Lexis Nexis on 2001. In 2010, I wrote the second edition. Much of this website is derived from these two books.
In addition I have published an article entitled the Link Between Due Diligence and Valautions.
Disclaimer: Whilst every effort has been made to ensure that the information published on this website is accurate, the author and owners of this website take no responsibility for any loss or damage suffered as a result of relience upon the information contained therein. Furthermore the bulk of the information is derived from information in 2018 and use therefore is at your on risk. In addition you should consult professional advice if required.