# How The Logic Programming Can Be Constructed?

#### It was 1974, and R. Kowalski came up with the scientific notations used to represent knowledge; this representation was called Logic Programming.

Logic Programming is used to represent knowledge. Logic Programming is based on the automatic theorem. Logic programming is used for computing. Logic Programming is based on the Prolog programming paradigm.

Programming languages such as CHIP and Godel is based on logic programming. The CHIP and Godel can be used to solve complex computational problems. Logic programming is simple and versatile. Logic programming uses mathematical theorems to build its framework. Logic programming also uses concepts given by computer scientists that emerged from the domain of automated reasoning.

Prolog is used to develop programs that can process natural language. But Logic Programming can also be used to develop applications that can process natural language. Applications in the domain of molecular biology, VLSI design, etc, are developed using logic programming. Logic programming can be broadly divided into three parts – theory, programming, and applications.

## Declarative Interpretation

Logic is used to do computation. Programs developed in logic can be interpreted in two ways – first, declarative interpretation, and second, procedural interpretation.

Declarative Interpretation deals with the interpretation of the logic program in an attempt to find the answer to the question What is to be computed? Declarative interpretation finds the meaning.

Procedural Interpretation deals with the interpretation of the logic program in an attempt to find the answer to the question How the computation should take place? Procedural interpretation finds a method.

Both the Declarative Interpretation and Procedural Interpretation bear a close relationship with each other. Declarative interpretation is used to understand the procedural interpretation; because of this logic, programming becomes a ,formal language.

Logic programming uses declarative interpretation, and the programs developed using declarative interpretation are termed declarative programming. Declarative programs are developed using specifications. These programs contain logical conclusions. The conclusion is derived using a computational mechanism.

Declarative programs are easy to understand, build and make changes if required. In addition, declarative programming can be used to develop executable codes also known as executable specifications.

Since the logic programs are interpreted procedurally and declaratively, it is suitable to represent knowledge and act as a formal language. Logic programing is also used in the domain of artificial intelligence.

## Logic Programming

Logic Programming is mainly constructed on formal logic. The instructions in logic programming are written in the logical form to represent facts and rules. In logic programming, instructions are written using clauses.

A logic program consists of atomic formulae and definite clauses. These atomic formulae and definite clauses are used to categorize the program into logical compartments and control compartments. The solution to the problem is written in the logical compartment. The control compartments are used to write alternative paths that can be used to run a logic program. Thus an algorithm written in logic programming consists of two parts first, the logic part, and second, the Control part. The Logic part is responsible to provide the logic of the program and the Control part is responsible to provide strategies that are used to prove theorems.

To solve a specific problem in logic programming, Horn clauses are used. Horn clauses are used to interpret procedures. The logic program consists of Horn clauses and backward reasoning. Thus a complete logic program consists of declarative knowledge and procedural knowledge.

Logic programming can be used to represent cause and effect relationships. The logic program can be used to represent calculus. Logic programs can also represent predicates; these predicates are known as abducible predicates. To solve a particular problem, abducible predicates are used. The problems that are solved in logic programming can be either observational or goals. Logic programming is also used to solve fault diagnosis problems, planning problems, problems that deal with natural language, and problems that fall within the domain of machine learning.

In logic programming, metalevel programming can be done. The metalogic can be used to represent natural language. The natural language representation in metalogic can be done at the object level and at the metalevel. Metalogic of logic programming can be used to represent inference rules. Metalogic is used to represent metaprograms. These metaprograms can be used to manipulate databases or other theories.

Logic programming also allows constraint predicates to be set. Constraint predicates are created using Horn clauses. Thus logic program consists of constraints that has a number of clauses. Constraints in logic programming are evaluated for their satisfiability factors. Constraints in logic programming are reduced to satisfiable constraints. Logic programming consisting of constraints has its application in the domain of civil engineering, aerospace control, electrical engineering, etc.

Logic programming can also be combined with concurrent programming. Concurrent programming with logic programming also uses Horn clauses. Concurrent programming clauses are used in the logic program, and these clauses are executed in parallel. Concurrent programming with logic programming is used to do message passing.

Logic programs can contain both constraints and concurrent programming. Constraints are used to manage concurrency in logic programming. A set of controls are used to manage concurrency.

Logic programming is also used in machine learning. When logic programming is used in machine learning, then it is known as Inductive logic programming. When logic programming is combined with machine learning, then it is called logic programing with probabilistic induction.

Logic programming can also be combined with linear logic; when this is done, then the expressive power of logic programming considerably increases. Using linear logic with logic programming can determine state change.

Logic programming can also use concepts of Object-Oriented Programming. When logic programming inherits the concept of Object-Oriented Programming, then it is called F-logic.

Logic programming is used to represent relations. The relation in logic programming is given by “C:- D” which means if D then A. For example, if C represents “living being” and D represents “animal” then “C:- D” will be interpreted as If animal, then it is a living being.

## Conclusion

A program constitutes a set of instructions. These instructions undergo a change in state as and when they are executed. This logic is used in most programming. But these programming languages are not able to represent relations that exist between two entities. To represent the relation between entities using formal language than it is called logic programming. Prolog is one of the most common programming languages which belongs to the family of logic programming.