Logic Programming: Prolog

Our finally language that we are learning about in CSE 262 is Prolog which falls under the logic programming paradigm. The general purpose of this language is to create a knowledge base. Prolog is popularly used in artificial intelligence and computational linguistics. Prolog is declaration in which any program is composed of set of rules and relations. A query is performed on this facts of  rules and relations to give a logical answer.

For example:

rainy(seattle).

rainy(bethlehem).

cold(seattle).

snowy(C):- rainy(C), cold(C)

Query: snowy(x)

This is a simple basic Prolog program. As you can see in the last line, we do a query for snowy(x) which will give us the output of seattle. This is because it knows that for a city to be snowy it has to be rainy and cold by the rules we have given. As a result, when a user ask the program to give the city that is snowy it processes the data and spits out the answer.

As you can see this language can be powerful and very useful in storing knowledge base. One of the domains that you see Prolog programming is medical. For example, a patient can input his/her symptoms and the system can diagnose for the possible health problems based on the given symptoms.

Advertisements

About lunur16

I am undergraduate student at Lehigh University. I am from Allentown, Pennsylvania. My intended major is Computer Engineering and possibly a minor in Business.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s