KING'S IT WORLD
please register to watch content in detail
THANKS
ADMIN KINGSIT WORLD

KING'S IT WORLD


 
HomeHome  CalendarCalendar  GalleryGallery  FAQFAQ  SearchSearch  UsergroupsUsergroups  RegisterRegister  Log inLog in  
Search
 
 

Display results as :
 
Rechercher Advanced Search
kings it world text ad
KINGSITWORLD CALENDAR
Follow me on G+
KINGSITWORLD WEATHER
Latest topics
» QURAN MAJEED KE TAFSEER
Mon Aug 20, 2012 2:59 am by YOUSUFHALI

» PHY301 CIRCUIT THEORY REFERENCE BOOK
Wed Jul 25, 2012 11:36 am by shabbir1915

» MTH202 ASSIGNMENT NO 3 SOLUVED
Mon Jun 11, 2012 9:51 am by jaffarhussain

» Retrieve the DTC In the Jewel Module of 1995 Ford
Thu May 31, 2012 11:51 am by obd2tool

» How you can Obvious the Check Engine Light on the
Thu May 31, 2012 11:43 am by obd2tool

» send free sms and send free sms update on facebook
Tue May 15, 2012 8:33 pm by rizwan269

» United Bank Limited (UBL) - Fee Deposit
Thu May 10, 2012 3:33 pm by irumnaz

» PHOTO MIXER SOFTWARE
Fri Apr 20, 2012 10:02 am by sacredwkb

» Entrepreneurship Survey
Thu Mar 08, 2012 2:20 pm by Admin

» Fall 2011 Semester Result Announced
Thu Mar 08, 2012 2:19 pm by Admin

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
kings it world text ad
Social bookmarking
Social bookmarking Digg  Social bookmarking Delicious  Social bookmarking Reddit  Social bookmarking Stumbleupon  Social bookmarking Slashdot  Social bookmarking Furl  Social bookmarking Yahoo  Social bookmarking Google  Social bookmarking Blinklist  Social bookmarking Blogmarks  Social bookmarking Technorati  

Bookmark and share the address of KING'S IT WORLD on your social bookmarking website
visitors counter
Powered by website analytics technology.
Keywords
assignment mth301 SPRING final quran quiz cs101 MKT621 MCM301 cs401 2010 FALL 2011 mgt502 STA301 MTH202 papers mth302 cs403 paper midterm term CS302 solved cs605 MTH101
kings it world text ad
FLAG COUNTER
free counters
LIVE TRAFFIC

Share | 
 

 cs508 3rd assignment solution fal 2010

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin


Scorpio
Posts : 638
Points : 2155
Reputation : 19
Join date : 2010-05-15
Age : 29
Location : islamabad

PostSubject: cs508 3rd assignment solution fal 2010   Thu Jan 06, 2011 12:53 pm

Q1: (a) How to define the list in PROLOG Language; also differentiate between facts and patterns? [3]
Answer:

PROLOG Language:

Basically prolog language is based on predicate logics which use to said as it is closed to the world of assumptions and predictions, it use to cover up knowledge and data base control in the language it does not support any distinction between input and output usually PROLOG, since they add the possibility to have a structure that does not have a predefined number of such elements.

Welcome to the Prolog book. This book can serve as a textbook or tutorial for anyone who wants to learn the Prolog programming language. No prior programming experience is required. Some basic knowledge of logic can come in handy. For those new to the subject, a short introduction to logic is given, but this is not required reading.
The first chapters of the book (under Basics) describe the central syntax and features of the language. The next section, Programming, explores additional concepts that are useful when programming in Prolog. The chapters under Basics and Programming are meant to be read in order.




list in PROLOG Language:

According to the List it is basically a structure of the form [t1;t2;::::::::::::::::;tn] where every ti is a prolog term. The first term t1 is called the head of the list. The remaining part of the list, [t2; : : : ; tn] is called the tail. The empty list is denoted by [].


Difference between facts and patterns

A fact is basically presently what it appears to be , a fact. A fact in everyday language is often a proposition like "It is sunny today'' or "It is summer.''
In Prolog such facts could be represented as follows:
'It is sunny today '.
'It is summer'.
A fact is analogous to a base case in a proof. It is a piece of information that is known and is a special case of a rule. Facts are also known as unconditional Horn Clauses. The general case of a Horn clause is:
P if Q1 and Q2 . . . and Qn
where a fact is simply P with no conditional statements Q1, Q2 . . . .
Facts are used to represent unchanging information about objects and their relationships.
Only facts in the PROLOG database can be used for problem solving.
Patterns:

Consider the following sentence : 'All men are mortal' We can express this thing in Prolog by :
mortal(X) :- human(X).
The clause can be read as 'X is mortal if X is human'.





(b): Why this symbol “|” is used in PROLOG language? [3]

Answer:

The following vertical bar ‘|’ is used in prolog language to separate the head and tail of a list.
Example:
[1 | [2, 3] ]
[1, 2, 3 | [ ] ]




(c): Write down the two types of Constant that can be defined in PROLOG language with example? [4]

Answer:
There are two types of constants in Prolog
• atoms
• numbers.
Atoms:

Well there are four types of atom


a) Alphanumeric atoms - alphabetic character sequence starting with a lower case letter. Examples: apple a1 apple_cart
b) An atom is a general-purpose name with no inherent meaning. Examples of atoms include x, blue, 'Taco', and 'some atom'.
c) Quoted atoms - sequence of characters surrounded by single quotes. Examples: ‘Apple’ ‘hello world’
d) Symbolic atoms - sequence of symbolic characters. Examples: & < > * - + >>
e) Special atoms. Examples: ! ; [ ] {}

Numbers
Numbers can be floats or integers.
Well the numbers include integers and floating point numbers. Examples: 0 1 9821 -10 1.3 -1.3E102.



Q2: Write down the drawbacks of PROLOG language. [5]

Answer:
Welcome to the Prolog book. This book can serve as a textbook or tutorial for anyone who wants to learn the Prolog programming language. No prior programming experience is required. Some basic knowledge of logic can come in handy. For those new to the subject, a short introduction to logic is given, but this is not required reading.
The first chapters of the book (under Basics) describe the central syntax and features of the language. The next section, Programming, explores additional concepts that are useful when programming in Prolog. The chapters under Basics and Programming are meant to be read in order.
The section Built-in Predicates deals with the functions available in many Prolog compilers. These and other chapters can be read in any order.
Prolog is a logical and a declarative programming language. The name itself, Prolog, is short for PROgramming in LOGic. Prolog's heritage includes the research on theorem provers and other automated deduction systems developed in the 1960s and 1970s.
Programming in Prolog is very different from programming in a traditional procedural language like Pascal where as prolog is the major example of a fourth generation programming language supporting the declarative programming paradigm.
Prolog consists of a series of rules and facts. A program is run by presenting some query and seeing if this can be proved against these known rules and facts. A programming language is a formal language for some form of problem solving. It is to be distinguished from design languages such as hardware description languages, and other descriptive languages such as document description languages (e.g. SGML and HTML) or grammars.


Well Prolog is a declarative programming language where we only specify what we need rather than how to do it. It has a simple concise syntax with built-in tree formation and backtracking which generates readable code which is easy to maintain.





Back to top Go down
View user profile
 
cs508 3rd assignment solution fal 2010
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Mercredi 10 mars 2010 : l'horoscope
» Astrometric Solution for HD 196885 Ab
» A Boutique and an assignment against me.
» Pathfinder Testbed
» New Baby, New Assignment, Old Dress

Permissions in this forum:You cannot reply to topics in this forum
KING'S IT WORLD :: EDUCATION :: ASSIGNMENTS-
Jump to: