Saturday, 2 February 2019

Introduction to prolog


Prolog is a declarative programming language. It is mainly developed for AI (Artificial intelligence) programming.

A prolog application maintains number of rules and facts, and derive the solution using the specified rules and facts.

How to specify the facts?
You can specify the facts like below.

greater(10, 6)
Above statement says 10 is greater than 6

bigger(Elephant, Ant)
Above statement says Elephant is bigger than Ant.

What are the three basic constructs in Prolog?
a.   Facts
b.   Rules
c.    Queries

How a Prolog program looks like?
A prolog program is a set of clauses, where each clause is either a fact (or) rule (A rule define the relationship between two objects).

For example, a rule can be something like below.
a.   Person ‘x’ is taller than person ‘y’, if person x’s height is more than person y’s height.
b.   A person is eligible to vote, if his age is > 18.
c.    Two persons are brothers, if they are male and their parents are same



Previous                                                 Next                                                 Home

No comments:

Post a Comment