how ai works bird.pro as an example. an expert system enabled by prolog an inferencing system...
TRANSCRIPT
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 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)".
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
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
Declarative Programming
A collection of small modular units, called predicates
Can be added and tested separatelyCorresponding to declarative knowledge
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
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).
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
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