how ai works bird.pro as an example. an expert system enabled by prolog an inferencing system...

9
How AI Works Bird.pro as an example

Upload: brendan-houston

Post on 11-Jan-2016

229 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: How AI Works Bird.pro as an example. An Expert System enabled by Prolog An inferencing system enabled by Prolog, or other AI language like Lisp Information

How AI Works

Bird.pro as an example

Page 2: How AI Works Bird.pro as an example. An Expert System enabled by Prolog An inferencing system enabled by Prolog, or other AI language like Lisp Information

An Expert System enabled by Prolog

An inferencing system enabled by Prolog, or other AI language like Lisp

Information is all stored as attribute-value pairs.

The attribute is represented as a predicate, and the value as the argument to the predicate.

For example, the attribute-value pair "color-brown" is stored "color(brown)".

Page 3: How AI Works Bird.pro as an example. An Expert System enabled by Prolog An inferencing system enabled by Prolog, or other AI language like Lisp Information

What is Prolog?

Programming in LogicFrom a foundation of logical theorem

proving, originally used for research in natural language processing

Declarative programming rather than Procedural programming versus

Page 4: How AI Works Bird.pro as an example. An Expert System enabled by Prolog An inferencing system enabled by Prolog, or other AI language like Lisp Information

Procedural Programming

Specify what procedures to take Follow the specified procedures to work out the

answer E.g. To find out the average of a set of numbers,

we need to: Sum up all the numbers Count the total number of entries Divide the sum by the total number Report the answer

Corresponding to procedural knowledge

Page 5: How AI Works Bird.pro as an example. An Expert System enabled by Prolog An inferencing system enabled by Prolog, or other AI language like Lisp Information

Declarative Programming

A collection of small modular units, called predicates

Can be added and tested separatelyCorresponding to declarative knowledge

Page 6: How AI Works Bird.pro as an example. An Expert System enabled by Prolog An inferencing system enabled by Prolog, or other AI language like Lisp Information

Simple programme

Database:person(peter).

person(jane).

person(nancy).

Query: Enter:person(peter). Reply: yes.

Query: Enter: person(X). Reply: X=peter; X=jane; X=nancy

Page 7: How AI Works Bird.pro as an example. An Expert System enabled by Prolog An inferencing system enabled by Prolog, or other AI language like Lisp Information

A little more

Add:likes(peter,dog)likes(jan,cat)likes(nancy,snake)animal(dog).animal(cat).animal(snake)pet(X,Y):-person(X),animal(Y),likes(X,Y).

Test:pet(peter,dog).pet(nancy,X).pet(X,cat).

Page 8: How AI Works Bird.pro as an example. An Expert System enabled by Prolog An inferencing system enabled by Prolog, or other AI language like Lisp Information

How “bird.pro” Works

main :- identify.

identify:- retractall(known(_,_,_)), % clear stored information bird(X), write('The bird is a '),write(X),nl.identify:- write('I can''t identify that bird'),nl.

To start the process, type “main.”, the system tries to verify identity

To find out what bird it is

Write the answer if found

If not found

Page 9: How AI Works Bird.pro as an example. An Expert System enabled by Prolog An inferencing system enabled by Prolog, or other AI language like Lisp Information

bird(laysan_albatross):- family(albatross), color(white).bird(black_footed_albatross):- family(albatross), color(dark).bird(fulmar):- order(tubenose), size(medium), flight(flap_glide).bird(whistling_swan):- family(swan), voice(muffled_musical_whistle).bird(trumpeter_swan):- family(swan), voice(loud_trumpeting).

If the bird belongs to the albatross family and its color is white,Then the bird is laysan albatross