DOC PREVIEW
CUNY CISC 3160 - Study Notes

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Bobby GagliardiYesX=susieBobby Gagliardi Prolog is a Declarative Language used mainly for Artificial Intelligence because the language makes the task of manipulation of symbols and inference about these symbols easier. Unlike imperative or object oriented languages, Prolog processes a set of rules and then runs queries on those rules during runtime. Instead of writing lines of code, which are executed in a linear fashion, a programmer would a create database and Prolog search this database in a depth first fashion. A simple database is as follows, likes(george, kate). likes(george,susie). likes(susie,wine). likes(george,wine). likes(kate,gin). likes(kate,susie). After the data is processed into prolog’s knowledge base a query can be done. For example a question like “Does Kate likes Susie?” ?-likes(kate,susie). Yes Prolog returns true because the statement likes(kate,susie) is present in the date base.The question, “What does George like?” is asked in prolog by using a variable. ?- likes(george,X). X=kate ; X=susie ; X=wine ; no Prolog searches its database and returns what X can be unified with, thus returning Kate, Susie and wine. But when prolog searches the database further it returns no or false. According to its knowledge George only likes Kate, Susie, and wine. The limitation on Prolog’s knowledge forces any further inquiries to return the value false. For example, ?- likes(george,beer) no Prolog doesn’t know weather or not George likes beer therefore, Prolog returns no by default. These examples illustrate the closed world assumption or negation as false. Prolog assumes anything is false who opposite is not provably true. The interpreter looks for the predicate likes(george,beer) or some rule that could establish likes(george,beer) failing to do so indicates that it is false. The programmer can place the rule “Under what conditions does some one like beer?” by placing a series of logical predicates into the database. likes(X,beer) :- Likes (X, wine), likes (X, Susie).This is read, “Anyone likes beer, if they also like wine and Susie.” Prolog can also add this predicate into the database from the command line by using the built in function Assert. ?- assert(likes(george,beer)) :- likes(george,beer). yes Prolog returns true because George was previously defined as liking both wine and Susie; Prolog is also adding the predicate likes(george,beer) into its knowledge base. Prolog’s strength lies in its ability to create new rules and connect these rules to existing predicates based on the knowledge defined in Prolog’s database of facts. Prolog is an ideal Artificial Intelligence language because it automatically unifies assumptions between separate data. This is very useful for almost all popular aspects of today’s use of Artificial Intelligence. Prolog is most commonly used as a database for expert systems because the language allows an easy declaration of rules and use of control structures, which manipulate those rules. As previously shown, Prolog can easily add new rules to its existing database this feature enables programs to use genetic algorithms, which simulates learning. The simulation of learning allows computers to offer challenging play to human opponents in a variety of games and allows programs to make decisions under unsure or complex situations. Prolog supports Artificial Intelligence because it solves problems without having step-by-step instructions for a problem. A Prolog program asks the user “what do you want” and because of Prologsrecursive nature it is able to find the solution by repeating a step of problems with different inputs. The following is an example of a program that finds that answer to a query by recursion. is_digesting(X,Y) :- just_ate(X,Y). is_digesting(X,Y) :- just_ate(X,Z), is_digesting(Z,Y). just_ate(mosquito,blood(john)). just_ate(frog,mosquito). just_ate(stork,frog). The query yields yes -? is_digesting(stork,mosquito). Yes This tells us it that X is digesting Y if X just ate Y, By unifying X with stork and Y with mosquito it obtains the following goal: just_ate(stork,mosquito). Because the knowledge base doesn't contain the information that the stork just ate the mosquito, so this attempt fails. Prolog then tries next tries to make use of the second rule. By unifying X with stork and Y with mosquito it obtains the following goals:just_ate(stork,Z), is_digesting(Z,mosquito). That is, to show is_digesting(stork, mosquito), Prolog needs to find a value for Z such that, firstly, just_ate(stork,Z). And secondly, is_digesting(Z,mosquito). And there is such a value for Z, namely frog. It is immediate that just_ate(stork,frog). Will succeed, for this fact is listed in the knowledge base. And deducing is_digesting(frog,mosquito). And since is_digesting(frog,mosquito) can be unified with just_ate(frog,mosquito) which is in the database. It returns true because the terminating clause is_digesting(X,Y) :- just_ate(X,Y) has been met. In conclusion, Prologs “Artificial Intelligence” lies with its ability to unify or bind words together in a recursive fashion. This intelligence is similar to a person’s ability to associate the same reaction to similar stimuli therefore Prolog can be said to be exhibiting Artificial Intelligence.Bibliography: George F Luger, Artificial Intelligence 4th edition, Pearson Education limited


View Full Document

CUNY CISC 3160 - Study Notes

Download Study Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Study Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?