What is prolog?
Prolog is a descriptive language because a program describes the problem rather than the steps taken to solve the problem. This allows the program to concentrate on the problem rather than the machine’s solution to the problem. The description of a problem also describes the procedures for solving the problem. Prolog is also a procedural language, when you describe the relationship between objects, you can also define an executable procedure.
The logical aspect of the language makes it possible to describe a program most simply, the procedural side of prolog makes it possible to write practical applications.
Characteristics of logic programming:
Like predicate calculus, prolog defines a way to make logical assertions and to prove theorems based on those assertions. In prolog problems are described in terms of “Facts” and “Rules”, where facts are statements that are simply true and analogous to logical assertions; Rules are similar to theorem proofs.
In prolog facts are accessed and rules are set into action by asking questions.
Prolog facts are expressed as clauses and a collection of related clauses is called a predicate, a predicate provides a consistent way of grouping similar facts. Clauses are stored in the database in the same order in which you enter them and it will retrieve this clauses in the same order, therefore the ordering of clauses in the database is as significant as the facts themselves. This order can ensure that your program executes properly.
Note that prolog contains a database very similar to a relational database, this database is where facts and rules are stored, the above description of organized facts storage is one similarity, also the database is composed of rows called instances in where facts are stored, each row contains an individual fact, an instance consists of one or more columns, called attributes, all instances in the same relation(table) have the same number of attributes each related clause has the same number of arguments, and like the columns of a table related arguments in each clause hold the same type of information.
My implementation in comparison with an implementation in a procedural(functional or imperative) language:
In any of the above mentioned conventional...