Saturday, October 22, 2011

Topic 2: Programming Languages. Part 4

Logic programming
    The idea of using mathematical logic as a programming language was proposed by Robert Kowalski in England in the early 70s of the twentieth century. Logic programming emerged mainly due to advances in automatic theorem proving.
    The main purpose of mathematical logic is to provide a system of formal notation for display purposes. One part of mathematical logic is a logic expression. Logic - a part of mathematical logic that studies the statements that are considered by their logical values - truth and falsity - and logical operations on them. The basic element of logic statements are statements and operations on them. In the logic expression is only affirmative sentences that may be true or false, not both; simultaneously. Each such statement is called affirmative sentence. In the logic expression is used five basic logical operations: negation, conjunction (logical multiplication), disjunction (logical addition), the conclusion (implication) equivalence.
    Logic programming - a record task language of mathematical logic as a set of statements, relations between the statements and rules of inference of some other expression. As a result of the problem, written in terms of logic programming, checked for fairness worded statements. Logic programming is far different from algorithmic programming languages. The compiled program does not describe the procedure for solving and logical domain model that includes some facts concerning the properties of the domain and relations between objects in this area, as well as rules of inference of new properties and relationships with the already defined.
    The basic idea of logic programming were first successfully implemented in the form of programming language Prolog. Language Prolog program consists of the set of statements, each of which is either a fact or rule and a statement of purpose. The rule specifies how the solution associated with the given facts, or as much as possible from the set of facts to bring this solution. Programming language Prolog includes the following stages:
  • announcement of facts about objects and relations between them;
  • define rules of interaction of objects and relations between them;
  • formulating questions about objects and relations between them.
    Thus, the program logic programming language Prolog is very similar to the hypothesis of a certain subject area, and question - to the theorem to be proved. Unlike procedural programming language Prolog program does not work consistently on the steps because it does not specifies no action. The content of Prolog programs - a collection of facts and relationships between them. Therefore, programming in Prolog is to transfer information and set your computer next time him with questions about possible conclusions from this information. And another possibility: logical program can use to find any information that can be logically derived from this program. Search for an object that is specified in relation to other objects is very important property of logic programs.

No comments:

Post a Comment