1 AI Intro
1 AI Intro
1 AI Intro
Introduction to AI
• Overview of AI
• AI vs. HI
• Views of AI
• History of AI
• Programming Paradigms
Intelligence
• Intelligence is the capability of
observing, learning, remembering &
reasoning.
• AI attempts to develop intelligent agents.
• The wheel is round. (Or, all wheels I have seen are round)
–using inductive reasoning we can infer the general proposition: All
wheels are round.
• The bird flies. (Or, all birds I have seen could fly)
–using inductive reasoning we can infer the general proposition: All
birds can fly.
5
Artificial Intelligence
• The concern of AI is to develop computer based
system that behave like human and emulate the
reasoning power of humans
• in order to do tasks that require human intelligence.
• Traditional paradigms:
Programs = data structure + control
• AI programming paradigms:
Programs = knowledge structure + inference
Introducing to Prolog for Constructing KB
• It is a declarative language, which is Used in AI applications such as NLP,
automated reasoning systems, expert systems, …
• Prolog is based on facts, rules, queries, constants and variables.
– Facts and rules make up the knowledgebase.
– Constants and variables are used to construct facts, rules and queries.
– Queries drive the search processes
Syntax:
• Prolog files are with extension .pl. Each statement (fact , rules, queries, …)
ends with full stop“.” Variables starts with capital letters (e.g. X, Book,
Food, …) and constants (facts) are written in small letters (e.g. sam, chips,
…). The knowledgebase contains: Facts and Rules (to combine facts to
increase knowledge and reasoning ability of the system):
male(sam).
male(john). facts
female(tutu).
child(sam,john).
child(tutu,john).
son(X,Y):- male(X),child(X,Y). %X is a son of Y if X is male and X is a child of
Y
• Can you add rules for Daughter, Father, Mother, Grandfather, Uncle?
Logical connectives
Syntax Example:
PL/FOL Prolog PL/FOL Prolog
^ , Hot ^ wet → humid humid : - hot, wet.
( humid v cool) → pleasant : not(humid); cool.
pleasant
V ;
likes(ted,chips) → likes(yared, chips) : - not
Likes(yared, chips) (likes (ted,chips)).
→ :-
female(X) ^ child(X,Y) daughter(X,Y):- female(X) ^
→ daughter(X,Y) child(X,Y) .
not
male(X) ^ child(X,Y) son(X,Y):- male(X),
→ son(X,Y) child(X,Y).
Example
Consider the following facts and rules about food
composition Sam likes.
• Sam likes chips.
• Macaroni contains cheese.
• Lasagna contains cheese.
• Lasagna contains meat.
• There is Chinese noodles.
• Sam likes Chinese foods.
• Sam likes all foods that contain cheese and
meat.
Example
• To express Example in Prolog we must:
1.Identify the entities (or actual objects), mentioned in the
description
2.Identify the types of properties that things can have, as well
as the relations that can hold between these things
3.Figure out which properties/relations hold for which entities
Query:
1.Is Sam likes chips? ?- likes(sam, X).
?- likes(sam,chips). X = lasagna ;
2.What are some of the X = noodles ;
foods Sam likes? X = chips ;
?- likes(sam,X). No
• Prolog introductory notes:
http://boklm.eu/prolog/page_0.html 27