PROLOG

Complete summary of PROLOG. Features of PROLOG. Brief info on PROLOG data types, structure and primary components. Short note on file extension.

PROLOG is a logical programming language. The PROLOG programming language is the most extensively used in the logic programming paradigm. PROLOG is a declarative language, which implies that rather than computing how to find a solution, a programme is made up of data based on facts and rules (logical connection). A logical relationship is a description of the relationships that exist for a certain application.

Features of PROLOG:

  • PROLOG is a declarative programming language.
  • It employs predicate calculus terminology.
  • PROLOG is a natural handler of lists and recursions.
  • This language has a built-in inference engine as well as automated backtracking.
  • PROLOG has built-in parallelism.
  • Unification: The main concept is to see if the phrases can be combined to reflect the same structure.
  • For problems requiring inference, PROLOG allows for very efficient coding.

PROLOG Data Types:

Between a pair of single quotes, a character is encapsulated.

  1. Integer: An integer between -32768 and 32767 that is a full number.
  1. Real: A peculiar character that is either positive or negative, followed by numbers.
  1. String: A collection of characters encased in a pair of double-quotes. Strings can have up to 255 characters in them.
  1. Symbol: A combination of letters (A to Z or a to z), numerals (0 to 9) and the underscore(_) character.
  1. Variables: A variable is a symbol that can have multiple values assigned to it at different stages of the program’s execution.
  1. Reserved terms: PROLOG features a few reserved words that should not be substituted for user-defined names.
  2. Arithmetic Operators: The basic arithmetic operators in PROLOG are +, -, *, and /.
  1. Relational Operators: PROLOG utilises the relational operators,=, =>, >=, >=. A relational operator in PROLOG can be either goal or subgoal. The relational operator (=) resembles an assignment operator in appearance.

Structure of PROLOG:

domains

/*…domain statements…*/

predicates

/*…predicate statements…*/

goal

/*…subgoall, subgoal, etc… */

clauses

/* …clauses (rules and facts)…*/

The three primary components of a PROLOG programme are:

Clauses:

This section contains all of the program’s information and regulations. The same-named facts and rules must be grouped together. A procedure is a set of sentences that define a predicate. The user is requested to write in a goal following a goal during execution. PROLOG begins searching for a solution for the input goal at the top of the clauses section, going through each fact and rule one by one in search of a probable match.

Predicates:

One or more clauses make up a predicate. Clauses belonging to the same predicate must be in order. A predicate can be declared as – in general.

predicate_name (arg1, arg2, arg3,…, argn)

There is no need for parenthesis if there are no arguments. Only the predicate name is required; it starts with a lowercase letter and is followed by a string of letters, numbers, and the underscore(_) character. The length of a predicate name is limited to 250 characters.

Domains:

Even while PROLOG uses the same domains as in-built domains, a user can choose problem-related meaningful names for domains. User-defined domain names are commonly used, but the PROLOG system does not recognise them. As a result, the user provides information about these user-defined domains in the domains section.

The applications of PROLOG are as follows:

  • Specification Language
  • Robot Planning
  • Natural language understanding
  • Machine Learning
  • Problem Solving
  • Intelligent Database retrieval
  • Expert System
  • Automated Reasoning

Disadvantages:

  • In general, LISP offers superior I/O capabilities than PROLOG.
  • Graphics are not supported by PROLOG in general. Turbo PROLOG, which was just released, is an exception.
  • The sequence in which rules are entered has a significant impact on PROLOG’s efficiency. The order of LISP functions has a negligible impact on the efficiency of the language.
  • PROLOG and LISP can be combined. Certain AI applications are better suited to LISP, whereas others are better suited to PROLOG. The best configuration may be a hybrid system that combines and combines the two languages. This combination may be done in two different ways.

File extension:

On systems whose extensions have global significance, such as MS-Windows, tradition calls for .pl, but conflicts with Perl compel the usage of another extension. On such systems,.pro is a popular option. The alternative extension is kept in the HKEY CURRENT USER/Software/SWI/PROLOG/fileExtension or HKEY LOCAL MACHINE/Software/SWI/PROLOG/fileExtension registry keys on MS-Windows. Without explicitly defining the extension, all versions of SWI-PROLOG load files with the extension .pl as well as the registered alternative extension.

Extension .pl, .pro, .P:

  • A .PL file includes Perl source code, which is a programming language that is compiled and executed with the help of a Perl interpreter. Variables, actions, functions, and comments are all included in the Perl programme code.
  • Adobe Proto, a now-defunct Adobe Touch programme, generates a .PRO file, which is a website or mobile application mockup. It includes one or more UI layouts for a webpage or mobile app, each of which may have interactive features. CSS, WebKit, and jQuery are all supported by .PRO files.
  • Picture files made by Pascal are stored in .P files.The extension is used by MATLAB to store binary-runtime files within the programme.

Conclusion:

A logic programming language is PROLOG. It is crucial in the field of artificial intelligence. PROLOG, unlike many other programming languages, is primarily intended as a declarative language. PROLOG expresses logic as a set of relations (called as Facts and Rules). The reasoning being applied is at the heart of PROLOGue. Running a query across these relations is used for formulation or computation.

faq

Frequently asked questions

Get answers to the most common queries related to the BANK Examination Preparation.

What does PROLOG stand for?

Ans. Programming in logic.

State the features of PROLOG language.

Ans. It consists of intelligent, expert and Natural Language systems.

 

Why is PROLOG known as Procedural Language?

Ans. Procedures are referred to as predicates in Prolog. The following are the two reasons why it is referred...Read full