tag:blogger.com,1999:blog-47112119105594141802024-03-13T13:09:13.354-07:00Prolog Basics Tutorial Unknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-4711211910559414180.post-26378591285733809702015-06-04T03:33:00.001-07:002015-06-04T03:33:44.484-07:00calculations in prolog<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<span style="font-size: large;">The following are the programs which can perform different arithmetic operations in Prolog </span></div>
<br />
<b><u> To Sum Numbers.</u></b><br />
<br />
sum:-<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('Type your First Number '),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>read(X),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('Type Your 2nd Number '),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>read(Y),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>S is X+Y,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('The Sum of your numbers is = '),write(S),nl.<br />
<br />
<b><u>To Subtract Numbers</u></b><br />
<b><u><br /></u></b>
<b><u><br /></u></b>
sub:-<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('Type your first Number '),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>read(X),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('Type your 2nd Number '),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>read(Y),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>D is X-Y,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('When we subtract your Numbers we get ='),write(D),nl.<br />
<br />
<u><b>To Divide Numbers</b></u><br />
<br />
divide:-<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('Type your First Number '),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>read(X),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('Type Your 2nd Number '),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>read(Y),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Di is X/Y,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('when we divide your numbers we get = '),write(Di),nl.<br />
<br />
<b><u>To Multiply Numbers </u></b><br />
<br />
multiply:-<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('Type your First Number '),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>read(X),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('Type Your 2nd Number '),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>read(Y),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>M is X*Y,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>write('The Multiply your numbers we get = '),write(M),nl.<br />
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4711211910559414180.post-83654935185410730182015-06-04T01:20:00.003-07:002015-06-04T01:20:47.027-07:00Prolog Family Tree <div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: white; color: navy; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; margin: 10px 0px; padding: 0px;">
Establishing Facts</h2>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Prolog programs are text files. This means that we can write them in a text editor like Notepad. Launch Notepad a file to your area as <strong style="margin: 0px; padding: 0px;">family tree.pl </strong>You will have to make sure that you select <strong style="margin: 0px; padding: 0px;">All Files </strong>in the save dialog.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Type up the following facts for the family tree program.</div>
<code style="background: rgb(248, 244, 241); border: 1px dashed rgb(215, 195, 195); display: block; font-family: 'Lucida Console', 'courier new', monospace; font-size: 13px; font-stretch: normal; margin: 4px 8px; overflow: auto; padding: 8px;">/* Family Tree Program */<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />/* facts */<br style="margin: 0px; padding: 0px;" />male(jack).<br style="margin: 0px; padding: 0px;" />male(bill).<br style="margin: 0px; padding: 0px;" />male(john).<br style="margin: 0px; padding: 0px;" />female(dorothy).<br style="margin: 0px; padding: 0px;" />female(evelyn).<br style="margin: 0px; padding: 0px;" />female(grace).<br style="margin: 0px; padding: 0px;" />female(liz).<br style="margin: 0px; padding: 0px;" />parent(dorothy, evelyn).<br style="margin: 0px; padding: 0px;" />parent(jack, evelyn).<br style="margin: 0px; padding: 0px;" />parent(jack, grace).<br style="margin: 0px; padding: 0px;" />parent(bill, liz).<br style="margin: 0px; padding: 0px;" />parent(evelyn, liz).<br style="margin: 0px; padding: 0px;" />parent(bill, john).<br style="margin: 0px; padding: 0px;" />parent(evelyn, john).</code><br />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
The lines which begin and end with asterisks and forward slashes are comments - these are ignored when the program is run. All names must be in lower case - Prolog uses upper case for unknown information. All statements in Prolog end with a full stop.</div>
<h2 style="background-color: white; color: navy; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; margin: 10px 0px; padding: 0px;">
Establishing Rules</h2>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Your program will need some rules if it is going to be used to make decisions. Add the following lines to the bottom of your program.</div>
<code style="background: rgb(248, 244, 241); border: 1px dashed rgb(215, 195, 195); display: block; font-family: 'Lucida Console', 'courier new', monospace; font-size: 13px; font-stretch: normal; margin: 4px 8px; overflow: auto; padding: 8px;">/* rules */<br style="margin: 0px; padding: 0px;" />mother(M,X):-<br style="margin: 0px; padding: 0px;" />parent(M,X),<br style="margin: 0px; padding: 0px;" />female(M).<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />father(F,X):-<br style="margin: 0px; padding: 0px;" />parent(F,X),<br style="margin: 0px; padding: 0px;" />male(F).</code><br />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
The first rule states that M is the mother of X if M is a parent of X and M is female. The father rule works in a similar way.</div>
<h2 style="background-color: white; color: navy; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; margin: 10px 0px; padding: 0px;">
Testing The Program</h2>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Save your program. Launch Prolog.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Click on File, Consult and select the program that you have saved.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
We will start by getting our program to find out who the parents of evelyn are. Type the following line in the Prolog window.</div>
<code style="background: rgb(248, 244, 241); border: 1px dashed rgb(215, 195, 195); display: block; font-family: 'Lucida Console', 'courier new', monospace; font-size: 13px; font-stretch: normal; margin: 4px 8px; overflow: auto; padding: 8px;">mother(X, evelyn).</code><br />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
In our statement, X stands for the information that we don't know. You should be given the answer X = dorothy. Press enter and type the following</div>
<code style="background: rgb(248, 244, 241); border: 1px dashed rgb(215, 195, 195); display: block; font-family: 'Lucida Console', 'courier new', monospace; font-size: 13px; font-stretch: normal; margin: 4px 8px; overflow: auto; padding: 8px;">father(X, evelyn).</code><br />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
You should get the answer X = jack. Use the program to find out the following.</div>
<ol style="background-color: white; color: #202040; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin: 5px 20px; padding: 0px 20px;">
<li style="margin: 2px 0px 0px; padding: 0px;">The father of liz</li>
<li style="margin: 2px 0px 0px; padding: 0px;">The mother of john</li>
<li style="margin: 2px 0px 0px; padding: 0px;">The father of grace</li>
</ol>
<h2 style="background-color: white; color: navy; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; margin: 10px 0px; padding: 0px;">
Adding More Rules</h2>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Return to your program and add the following rules.</div>
<code style="background: rgb(248, 244, 241); border: 1px dashed rgb(215, 195, 195); display: block; font-family: 'Lucida Console', 'courier new', monospace; font-size: 13px; font-stretch: normal; margin: 4px 8px; overflow: auto; padding: 8px;">grandparent(G, X):-<br style="margin: 0px; padding: 0px;" />parent(G,P),<br style="margin: 0px; padding: 0px;" />parent(P,X).<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />sister(S,X):-<br style="margin: 0px; padding: 0px;" />parent(Z,X),<br style="margin: 0px; padding: 0px;" />parent(Z,S),<br style="margin: 0px; padding: 0px;" />female(S),<br style="margin: 0px; padding: 0px;" />not(S=X).</code><br />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
To get your program to use the new rules, first save your program. Now click on File and Reload Modified Files.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Type in the following</div>
<code style="background: rgb(248, 244, 241); border: 1px dashed rgb(215, 195, 195); display: block; font-family: 'Lucida Console', 'courier new', monospace; font-size: 13px; font-stretch: normal; margin: 4px 8px; overflow: auto; padding: 8px;">brother(X, liz).</code><br />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
You should get the answer X = john.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Now type in the following</div>
<code style="background: rgb(248, 244, 241); border: 1px dashed rgb(215, 195, 195); display: block; font-family: 'Lucida Console', 'courier new', monospace; font-size: 13px; font-stretch: normal; margin: 4px 8px; overflow: auto; padding: 8px;">grandparent(X, liz).</code><br />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
After the first answer, press the semi-colon key. You should get the second possible answer.</div>
<h2 style="background-color: white; color: navy; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; margin: 10px 0px; padding: 0px;">
Using The Anonymous Variable</h2>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
We can get our program to answer vaguer questions than the ones we have been putting. Suppose we want to find out who all the mothers in the system are. Type the following</div>
<code style="background: rgb(248, 244, 241); border: 1px dashed rgb(215, 195, 195); display: block; font-family: 'Lucida Console', 'courier new', monospace; font-size: 13px; font-stretch: normal; margin: 4px 8px; overflow: auto; padding: 8px;">mother(X, _).</code><br />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
The underscore in Prolog is called the <strong style="margin: 0px; padding: 0px;">anonymous variable</strong>. This query should return all of the mothers in the system. Press the semi-colon after each answer.</div>
<h2 style="background-color: white; color: navy; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; margin: 10px 0px; padding: 0px;">
Creating A User Interface</h2>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Expert systems can be made easier to use by creating an interface for the queries that you wish to run. Add the following to the bottom of your program.</div>
<code style="background: rgb(248, 244, 241); border: 1px dashed rgb(215, 195, 195); display: block; font-family: 'Lucida Console', 'courier new', monospace; font-size: 13px; font-stretch: normal; margin: 4px 8px; overflow: auto; padding: 8px;">findMother:-<br style="margin: 0px; padding: 0px;" />write('Whose mother do you want to find? '),<br style="margin: 0px; padding: 0px;" />read(Name),<br style="margin: 0px; padding: 0px;" />mother(X,Name),<br style="margin: 0px; padding: 0px;" />write('The mother of '), write(Name), write(' is '), write(X), nl.</code><br />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
To use this, type <strong style="margin: 0px; padding: 0px;">findMother</strong>. at the prompt. The program should help you with questions. Remember to place a full stop at the end of any line that you enter at the prompt.</div>
<h2 style="background-color: white; color: navy; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; margin: 10px 0px; padding: 0px;">
Extending The Program</h2>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Using the information above, try to write some new rules for your program to find the brother, grandfather, grandmother of a person.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px; margin-bottom: 8px; margin-top: 6px; padding: 0px; text-align: justify; width: 674px;">
Write interfaces for all standard queries in the system.</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4711211910559414180.post-66713467404056971972015-06-04T01:17:00.001-07:002015-06-04T01:18:16.717-07:00 Prolog Variables <div dir="ltr" style="text-align: left;" trbidi="on">
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 6.72pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="color: blue; font-family: Arial;"><span style="font-size: large;">Variables
always start with an upper case alphabetic character or an underscore.</span></span></div>
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 5.76pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><br /></span></div>
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 5.76pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-family: Arial;"><span style="font-size: large;">Other than the first character they can
be made up of any mixture of letters, digits, and underscores.</span></span></div>
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 2.16pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-family: Arial;"><span style="font-size: large;"> </span></span></div>
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 6.24pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;"> e.g.</span><span style="font-family: Eurostile;"> </span><span style="font-family: 'Courier New';">X,
ABC, _89two5, _</span><span style="font-family: 'Courier New';">very_long_variable</span></span></div>
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 1.92pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<br />
<!--[endif]--></div>
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 5.76pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-family: Arial;"><br /></span></div>
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 5.76pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;">There are </span><span style="color: blue; font-family: Arial;">no “types”</span><span style="font-family: Arial;"> for
variables (or constants) – a variable can take any value.</span></span></div>
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 5.76pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-family: Arial;"><br /></span></div>
<div style="direction: ltr; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 5.76pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;">All </span><span style="font-family: Arial;">Prolog</span><span style="font-family: Arial;"> variables have a “</span><span style="color: blue; font-family: Arial;">local</span><span style="font-family: Arial;">”
scope:</span></span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 4.32pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
</div>
<div class="O1" style="direction: ltr; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 4.8pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;">they
only keep the same value within a clause; the same variable used outside of a
clause does not inherit the value (this would be a “global” scope). </span></span></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4711211910559414180.post-39574957625829303772015-06-04T01:09:00.000-07:002015-06-04T01:19:39.294-07:00Prolog Basics <div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: white; color: navy; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; margin: 10px 0px; padding: 0px;">
Introudction To Prolog : Uses of Prolog </h2>
<div>
<br /></div>
<div style="text-align: left;">
<span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.38in;">Programming
languages are of two kinds:</span><br />
<span style="font-family: Arial; font-size: large; font-weight: bold; line-height: 90%; text-indent: -0.31in;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Arial; font-size: large; font-weight: bold; line-height: 90%; text-indent: -0.31in;">Procedural</span><span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.31in;">
(e.g BASIC, </span><span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.31in;">ForTran</span><span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.31in;">,
C++, Pascal, Java);</span><br />
<span style="font-family: Arial; font-size: large; font-weight: bold; line-height: 90%; text-indent: -0.31in;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Arial; font-size: large; font-weight: bold; line-height: 90%; text-indent: -0.31in;">Declarative</span><span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.31in;">
(e.g LISP, Prolog, ML).</span></div>
<div style="text-align: left;">
<div style="text-indent: -29.7600002288818px;">
<span style="font-family: Arial; font-size: large;"><span style="line-height: 21.6000003814697px;"><br /></span></span></div>
<span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.38in;">In
procedural programming, we tell the computer </span><span style="font-family: Arial; font-size: large; font-weight: bold; line-height: 90%; text-indent: -0.38in;">how</span><span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.38in;">
to solve a problem.</span></div>
<div style="text-align: left;">
<div style="text-indent: -36.4799995422363px;">
<span style="font-family: Arial; font-size: large;"><span style="line-height: 21.6000003814697px;"><br /></span></span></div>
<span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.38in;">In
declarative programming, we tell the computer </span><span style="font-family: Arial; font-size: large; font-weight: bold; line-height: 90%; text-indent: -0.38in;">what</span><span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.38in;"> problem we want solved.</span><br />
<br />
<span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.38in;">Note : (However,
in Prolog, we are often forced to give clues as to the solution method).</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<h2 style="background-color: white; color: navy; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; margin: 10px 0px; padding: 0px;">
Uses of Prolog</h2>
</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Arial; font-size: large; line-height: 90%; text-indent: -0.38in;">Good
at</span></div>
<div style="text-align: left;">
<div style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 6.72pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;"><br /></span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;">–<span style="font-family: Arial;">Grammars and Language processing,</span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;">–<span style="font-family: Arial;">Knowledge representation and reasoning,</span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;">–<span style="font-family: Arial;">Unification, </span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;">–<span style="font-family: Arial;">Pattern matching,</span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;">–<span style="font-family: Arial;">Planning and Search.</span></span></div>
<div class="O2" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 1.25in; margin-top: 4.8pt; text-indent: -0.25in; unicode-bidi: embed; vertical-align: baseline;">
<span style="background-color: black; color: white; font-size: large;"><br /></span></div>
<div class="O2" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 1.25in; margin-top: 4.8pt; text-indent: -0.25in; unicode-bidi: embed; vertical-align: baseline;">
<span style="background-color: black; color: white; font-size: large;">•<span style="font-family: Arial;">i.e. </span><span style="font-family: Arial;">Prolog</span><span style="font-family: Arial;"> is good at Symbolic AI.</span></span></div>
<div style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 6.72pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><br /></span></div>
<div style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 6.72pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;">Poor
at:</span></span></div>
<div style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 6.72pt; text-indent: -0.38in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;"><br /></span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;">–<span style="font-family: Arial;">Representing complex data structures,</span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;">–<span style="font-family: Arial;">Input/Output</span><span style="font-family: Arial;">
(interfaces).</span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;"><br /></span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;"><br /></span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;"><br /></span></span></div>
<div class="O1" style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.81in; margin-top: 5.76pt; text-indent: -0.31in; unicode-bidi: embed; vertical-align: baseline;">
<span style="font-size: large;"><span style="font-family: Arial;"><br /></span></span></div>
</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4711211910559414180.post-77805349667932567702015-06-03T23:48:00.000-07:002015-06-03T23:48:24.511-07:00Installing Prolog on Windows<div dir="ltr" style="text-align: left;" trbidi="on">
<ol style="background-color: white; font-family: arial, sans-serif; font-size: 13.3333330154419px; line-height: 16.6666660308838px;">
<li>Open your favourite web browser (Internet Explorer, Mozilla Firefox etc). In the address bar type:<br /><br /><a href="http://www.swi-prolog.org/" rel="nofollow" style="color: rgb(177, 40, 116) !important; text-decoration: none;">http://www.swi-prolog.org</a><br /><br />(or simply click on this link), to visit the homepage of the SWI-Prolog Project.<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239743723486/Home/egcl13prologworkshop/files/install1.png" /><br /></li>
<li>On the navigation menu at the left hand side of the screen, click on <b>Download</b> and in the page that will appear, click on <b>Stable Release</b>.<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239743770916/Home/egcl13prologworkshop/files/install2.png" /><br /><br />This page shows all the current available SWI-Prolog stable releases for a variety of platforms and operating systems. Since the lab PCs have MS Windows XP as their operating system, we will download and install the <b>SWI-Prolog XPCE for MS-Windows XP</b> release.<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239743808649/Home/egcl13prologworkshop/files/install3.png" /><br /></li>
<li>In the dialog box that pops up, click on <b>Save</b> and save the file on your desktop<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239743849909/Home/egcl13prologworkshop/files/install4.png" /><br /><br />(in the <b>Save as...</b> window that pops up, click on <b>Desktop</b> and then click on <b>Save</b>).<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239743907101/Home/egcl13prologworkshop/files/install5.png" /><br /></li>
<li>When the download is complete click on the <b>Run</b> Button (alternatively double click on the <b>w32pl5654.exe</b> file on your desktop.<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239743929407/Home/egcl13prologworkshop/files/install6.png" /><br /></li>
<li>If you are running Internet Explorer, you will be prompted with a security question ("The publisher could not be verified. Are you sure you want to run this software?"). Select <b>Run</b>.<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239744137985/Home/egcl13prologworkshop/files/install7.png" /><br /></li>
<li>The SWI-Prolog Installer will ask you to accept the GNU general Public Licese. Read it (if you wish) and click on <b>I Agree</b>.<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239744184831/Home/egcl13prologworkshop/files/install8.png" /><br /></li>
<li>In the following window select the <b>Typical Installation</b> (the default selection) and click on <b>Next</b>.</li>
<li>The Installer will now prompt for the installation directory: in the <b>Destination folder</b> line change the <b>c:</b> directory to your M: drive letter (usually <b>m:</b>).<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239744203491/Home/egcl13prologworkshop/files/install9.png" /><br /></li>
<li>Accept the next dialog box as-is and click on <b>Install</b>. The Installer will install SWI-Prolog to your system.<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239744237244/Home/egcl13prologworkshop/files/install10.png" /><br /></li>
<li>During installation, the installer might output an error message ("Could not write registry to register filetypes..."), in which you should just click <b>OK</b>.<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239744255774/Home/egcl13prologworkshop/files/install12.png" /><br /><br />When the installation is complete, click on <b>Finished</b> to close the installer and complete the installation.<br /><br /><img src="https://sites.google.com/site/kakiachatsiousworkshops/_/rsrc/1239744273049/Home/egcl13prologworkshop/files/install13.png" /><br /></li>
<li>The installer will now ask if you would like to view the <b>Readme</b> file. Click on <b>Yes</b> if you wish to view the readme andon <b>No</b> if otherwise. The <i>Readme</i> file is also available via the <b>Help menu</b> within SWI-Prolog or in the following path: <i>M:\Program Files\pl\doc\windows.html</i>.</li>
</ol>
</div>
Unknownnoreply@blogger.com0