Artificial Intelligence
Artificial Intelligence
Artificial Intelligence
Anurag Dixit
ARTIFICIAL INTELLIGENCE
1. Introduction
What is intelligence?
Intelligence is the computational part of the ability to achieve goals in the world.
Varying kinds and degrees of intelligence occur in people, many animals and some
machines.
Natural Intelligence
1
Artificial Intelligence Chapter1
Anurag Dixit
Dictionary: Intelligence
3. Information; news.
Fast thinking?
Knowledge?
Ability to learn?
AI helps computer scientists and engineers build more useful and user-friendly
computers,
Psychologists, linguists, and philosophers understand the principles that constitute what
we call intelligence.
2
Artificial Intelligence Chapter1
Anurag Dixit
Dictionary: Artificial Intelligence
1. Dictionary 1:
(a) The ability of a computer or other machine to perform those activities that are
normally thought to require intelligence.
(b) The branch of computer science concerned with the development of machines having
this ability.
2. Dictionary 2:
The subfield of computer science concerned with the concepts and methods of symbolic
– Alternate definitions:
Ray Kurzweil on AI �
3
Artificial Intelligence Chapter1
Anurag Dixit
intelligence.” � (or in some cases, tasks that require greater-than-human
intelligence)
John McCarthy on AI �
“It is the science and engineering of making intelligent machines, especially intelligent
computer programs.” �
“Intelligence is the computational part of the ability to achieve goals in the world.”
Operational Definition of AI
Turing test.
Cognitive Science
Logic-based AI
Rational Agents
Several Greek schools at the time of Aristotle developed various forms of logic:
Notation and rules of derivation for thoughts; they may or may not have proceeded to the
idea of mechanization Direct line through mathematics and philosophy to modern AI
Problems:
4
Artificial Intelligence Chapter1
Anurag Dixit
Require scientific theories of internal activities of the brain
Both approaches, Cognitive Science and Cognitive Neuroscience, share with AI on: the
available theories do not explain (or engender) anything resembling human-level general
intelligence.
Rational Agents
For any given class of environments and tasks, we seek the agent (or class of agents) with
the best performance
Acting Rationally
Rational behavior: doing the right thing, that which is expected to maximize goal
achievement, given the available information
Aristotle: Every art and every inquiry, and similarly every action and pursuit, is thought
to aim at some good.
5
Artificial Intelligence Chapter1
Anurag Dixit
Foundations of AI
(b) Philosophy
Rule of Reasoning
(c) Biology
(d) Linguistics
communication
(f) Psychology
(g) Economics
(h) Mathematics
6
Artificial Intelligence Chapter1
Anurag Dixit
Logic algorithm optimization
AI Prehistory
History of AI
7
Artificial Intelligence Chapter1
Anurag Dixit
Alan Newell and Herbert Simon (GPS);
EMYCIN: an ES shell
8
Artificial Intelligence Chapter1
Anurag Dixit
– distributed AI, intelligent agents, and semantic web
Possible Approaches
Like
humans Well
Rationa
Thin GPS l
k agents AI tends to
work mostly
in this area
Ac Turing Heuristi
c
test,
t Eliza systems
In the AI literature, planning refers to determining a sequence of actions you know how
to perform that will achieve a particular objective. Problem solving is finding a plan for a
task in an abstract domain. A problem is hard if you do not know how to work out an
appropriate sequence of steps and is solved once such a sequence has been found: actual
execution is irrelevant.
Unlike many areas of AI, planning shows a clear line of researchers building on each
other's work
9
Artificial Intelligence Chapter1
Anurag Dixit
I. SOME BASIC IDEAS
To avoid having to cope with the complexities of the physical world, much early work in
AI was directed toward abstract activities such as proving theorems, playing games like
chess and checkers, or solving puzzles. To illustrate the discussion in this section, we will
use the Tower of Hanoi (Hanoi), a puzzle involving three pegs, on which disks can be
placed, and a set of disks of varying size
The disks only can be moved, one at a time, between the pegs, and a disk must
never be stacked on top of a smaller one. The problem is to transport the entire stack of
disks to another peg. Reasoning about such a problem obviously requires representing
states of the world and having some way of specifying the objective, or goal. These
representations must be rich enough to embody all the aspects of the world that will be
reasoned about. In particular, since planning is about changing things, every property that
might be affected must be represented as dependent on time in some way. For Hanoi, this
requires only an ability to represent sets of disks' positions as the disks are initially, as
they are required to be eventually, and as they may be in between. A planner also needs
to represent what can be done—such as the moves that can be made, as determined by the
nature of the game or puzzle. There is a fundamental difference between an agent
executing an action, and thus affecting the world, and a planning system manipulating
representations to derive information about doing so, which we call applying an operator
10
Artificial Intelligence Chapter1
Anurag Dixit
The Propositional Calculus
The propositional calculus and, in the next subsection, the predicate calculus are first of
all languages. Using their words, phrases, and sentences, we can represent and reason
about properties and relationships in the world. The first step in describing a language is
to introduce the pieces that make it up: its set of symbols.
P, Q, R, S, '"
Propositional symbols denote propositions, or statements about the world that may be
either true or false, such as "the car is red" or "water is wet." Propositions are denoted by
uppercase letters near the end of the English alphabet Sentences in the propositional
calculus are fanned from these atomic symbols according to the following rules:
11
Artificial Intelligence Chapter1
Anurag Dixit
The equivalence of two sentences is a sentence.
In expressions of the form P A Q, P and Q are called the conjuncts. In P v Q, P and Q are
referred to as disjuncts. In an implication, P -7 Q, P is the premise or antecedent and Q,
the conclusion or consequent.
In propositional calculus sentences, the symbols ( ) and [ ] are used to group symbols nto
sub expressions and so to control their order of evaluation and meaning.
A proposition symbol corresponds to a statement about the world. For example, P may
'denote the statement "it is raining" or Q, the statement "I live in a brown house." A
proposition may be either true or false, given some state of the world. The truth value
assignment to propositional sentences is called an interpretation, an assertion about their
truth in some possible world.
Formally, an interpretation is a mapping from the propositional symbols into the set
T. F}.
or F, to each propositional symbol. The symbol true is always assigned T, and the symbol
false is assigned F.
12
Artificial Intelligence Chapter1
Anurag Dixit
Predicate Calculus
In propositional calculus, each atomic symbol (P, 0, etc.) denotes a proposition of some
complexity. There is no way to access the components of an individual assertion.
Predicate calculus provides this ability. For example, instead of letting a single
propositional symbol,
P, denote the entire sentence "it rained on Tuesday," we can create a predicate weather
that describes a relationship between a date and the weather: weather (tuesday, rain).
Through inference rules we can manipulate predicate calculus expressions, accessing
their individual components and inferring new sentences.
Predicate calculus also allows expressions to contain variables. Variables let us create
general assertions about classes of entities. For example, we could state that for all values
of X, where Xis a day of the week, the statement weather(X, rain) is true; i.e., it rains
every day. As with propositional calculus, we will first define the syntax of the language
and then discuss its semantics.
Before defining the syntax of correct expressions in the predicate calculus, we define an
alphabet and grammar for creating the symbols of the language. This corresponds to the
lexical aspect of a programming language definition. Predicate calculus symbols, like the
In this text we represent predicate calculus symbols as strings of letters and digits
beginning with a letter. Blanks and non alphanumeric characters cannot appear within the
string, although the underscore, _, may be used to improve readability.
The alphabet that makes up the symbols of the predicate calculus consists of:
1. The set of letters, both upper- and lowercase, of the English alphabet.
13
Artificial Intelligence Chapter1
Anurag Dixit
3. The underscore, _.
Symbols in the predicate calculus begin with a letter and are followed by any sequence of
these legal characters.
aR69p_z
#%@/&""
Parentheses '"( )", commas ':", and periods "." are used solely to construct well-formed
expressions and do not denote objects or relations in the world. These are called
improper symbols.
2. Constant symbols are symbol expressions having the first character lowercase.
4. Function symbols are symbol expressions having the first character lowercase.
14
Artificial Intelligence Chapter1
Anurag Dixit
Functions have an attached arity indicating the number of elements of the domain
mapped onto each element of the range.
number" for the predicate. Predicates with the same name but different arities are
considered distinct.
The truth values, true and false, are also atomic sentences.
We may combine atomic sentences using logical operators to form sentences in the
predicate calculus. These are the same logical connectives used in propositional calculus:
in the domain. First order (Section 2.2.2) predicate calculus includes two symbols, the
3 Y friends(Y, peter)
V X likes(X, ice_cream)
15
Artificial Intelligence Chapter1
Anurag Dixit
The universal quantifier, v, indicates that the sentence is true for all values of the
variable.
In the example, V X likes(X, ice_cream) is true for all values in the domain of the
definition of X. The existential quantifier, 3, indicates that the sentence is true for at least
one value in the domain. 3 Y friends(Y, peter) is true if there is at least one object,
indicated by Y that is a friend of peter.
LISP
Overview
– Interpretive language
• Why Lisp
16
Artificial Intelligence Chapter1
Anurag Dixit
– It is especially good for prototyping
– You can write new programs and extend old programs really, really
quickly in Lisp
Table of Contents
• Symbols
• Numbers
• Conses
• Lists
• Functions
• Printing
• Forms and the Top-level Loop
• Special Forms
• Binding
• Dynamic Scoping
• Arrays
• Strings
• Structures
• Setf
• Booleans and Conditionals
• Iteration
• Non-local Exits
• Funcall, Apply, and Mapcar
• Lambda
• Sorting
• Equality
• Some Useful List Functions
• Getting Started with Emacs
• Further Information
Symbols
17
Artificial Intelligence Chapter1
Anurag Dixit
A symbol is just a string of characters. There are restrictions on what you can include in a
symbol and what the first character can be, but as long as you stick to letters, digits, and
hyphens, you'll be safe. (Except that if you use only digits and possibly an initial hyphen,
LISP will think you typed an integer rather than a symbol.) Some examples of symbols:
a
b
c1
foo
bar
baaz-quux-garply
Some things you can do with symbols follow. (Things in bold after a > prompt are what
you type to the LISP interpreter, while other things are what the LISP interpreter prints
back to you. The ; is LISP's comment character: everything from a ; to the end of line is
ignored.)
t and nil
There are two special symbols, t and nil. The value of t is defined always to be t, and
the value of nil is defined always to be nil. LISP uses t and nil to represent true and
false. An example of this use is in the if statement, described more fully later:
> (if t 5 6)
5
> (if nil 5 6)
6
> (if 4 5 6)
5
keyword
The last example is odd but correct: nil means false, and anything else means true.
(Unless we have a reason to do otherwise, we use t to mean true, just for the sake of
18
Artificial Intelligence Chapter1
Anurag Dixit
clarity.) Symbols like t and nil are called self-evaluating symbols, because they evaluate
to themselves. There is a whole class of self-evaluating symbols called keywords; any
symbol whose name starts with a colon is a keyword. (See below for some uses for
keywords.) Some examples:
> :this-is-a-keyword
:THIS-IS-A-KEYWORD
> :so-is-this
:SO-IS-THIS
> :me-too
:ME-TOO
Numbers
There is no limit to the absolute value of an integer except the memory size of your
computer. Be warned that computations with bignums (as large integers are called) can
be slow. (So can computations with rationals, especially compared to the corresponding
computations with small integers or floats.)
19
Artificial Intelligence Chapter1
Anurag Dixit
Subfields of AI
The subfields of artificial intelligence can be classified in terms of their role in either
perception, reasoning, or actuation.
• Perception
– computer vision
– automated reasoning
– knowledge representation
– decision/game theory
– machine learning
• Actuation
– robotics
– softbotics
Intelligent Agents
Intelligent Agents
The primary goal of (weak) artificial intelligence is to build intelligent entities. A related
(but not a necessary) goal is to understand intelligent entities, and perhaps even to
understand and engineer human intelligence (strong AI).
20
Artificial Intelligence Chapter1
Anurag Dixit
computational processes by their autonomy—they operate without direct human
intervention. In addition, agents are reactive—they perceive their environments, and
attempt to respond in a timely manner to changing conditions—and proactive—their
behavior is goal directed, rather than simply response-driven.
21
Artificial Intelligence Chapter1
Anurag Dixit
• Deterministic vs. Nondeterministic: is the next state predictable (e.g., chess), or is there
uncertainty about state transitions (eg, backgammon)?
• Discrete vs. Continuous: can the environment be described in discrete terms (e.g.,
chess), or is the environment continuous (e.g., driving)?
• Static vs. Dynamic: is the environment static (e.g., chess), or can it change while the
agent is reasoning about its plan of action (e.g., driving)?
• Sequential vs. One-shot: does the agent need to reason about the future impact of its
immediate actions (e.g., chess), or can it treat each action independently (e.g.,
Rochambeau)?
• Single agent vs. Multiagent: can we assume the agent operating alone in its
environment, or need it explicitly reason about the actions of other agents (e.g., chess,
backgammon, Rochambeau, driving)?
An agent is a system that perceives its environment through sensors and acts upon that
environment through effectors.
22
Artificial Intelligence Chapter1
Anurag Dixit
Example: Vacuum-cleaner
Agent Function
23
Artificial Intelligence Chapter1
Anurag Dixit
Agent Classification:
(a)Table-driven agents
– have internal state, which is used to keep track of past states of the
world.
24
Artificial Intelligence Chapter1
Anurag Dixit
– base their decisions on classic axiomatic utility theory in order to act
rationally.
Rational Agent
• A rational agent is one that can take the right decision in every situation.
• Performance measure: a set of criteria/test bed for the success of the agent's
behavior.
• The performance measures should be based on the desired effect of the agent on
the environment.
Rationality
Agent Autonomy
• An agent is omniscient if it knows the actual outcome of its actions. Not possible
in practice.
• An environment can sometimes be completely known in advance.
• Exploration: sometimes an agent must perform an action to gather information (to
increase perception).
• Autonomy: the capacity to compensate for partial or incorrect prior knowledge
(usually by learning).
Environment
25
Artificial Intelligence Chapter1
Anurag Dixit
Environment
• Episodic or sequential
• Sequential - future actions depend on the previous ones.
• Episodic - individual unrelated tasks for the agent to solve.
• Static - dynamic
• Discrete - continuous
• Single agent - multi agent
• Multiple agents can be competitive or cooperative.
• "An agent is a persistent software entity dedicated to a specific purpose. " (Smith,
Cypher, and Spohrer 94 )
• "Intelligent agents are software entities that carry out some set of operations on
behalf of a user or another program with some degree of independence or
autonomy, and in so doing, employ some knowledge or representation of the
user's goals or desires." (IBM)
• "Intelligent agents continuously perform three functions: perception of dynamic
conditions in the environment; action to affect conditions in the environment; and
reasoning to interpret perceptions, solve problems, draw inferences, and
determine actions. "(Hayes-Roth 94)
Simple Agents
26
Artificial Intelligence Chapter1
Anurag Dixit
(let ((action t))
(push percept percepts)
(setq action
(lookup percepts table))
action))
• If the world is not fully observable, the agent must remember observations about
the parts of the environment it cannot currently observe.
• This usually requires an internal representation of the world (or internal state).
• Since this representation is a model of the world, we call this model-based agent.
27
Artificial Intelligence Chapter1
Anurag Dixit
Goal-Driven Agents
• The agent has a purpose and the action to be taken depends on the current state
and on what it tries to accomplish (the goal).
• In some cases the goal is easy to achieve. In others it involves planning, sifting
through a search space for possible solutions, developing a strategy.
• Utility-based agents: the agent is aware of a utility function that estimates how
close the current state is to the agent's goal.
• Choose actions so as to achieve a (given or computed) goal.
• A goal is a description of a desirable situation.
• Keeping track of the current state is often not enough − need to add goals to decide
which situations are good
• Deliberative instead of reactive.
• May have to consider long sequences of possible actions before deciding if goal is
achieved – involves consideration of the future, “what will happen if I do...?”
28
Artificial Intelligence Chapter1
Anurag Dixit
Learning Agents
Table-driven agents
• Table lookup of percept-action pairs mapping from every possible perceived state
to the optimal action for that state
• Problems
– Too big to generate and to store (Chess has about 10120 states, for
example)
– No knowledge of non-perceptual parts of the current state
– Not adaptive to changes in the environment; requires entire table to be
updated if changes occur
– Looping: Can’t make actions conditional on previous actions/states
29
Artificial Intelligence Chapter1
Anurag Dixit
• Rule-based reasoning to map from percepts to optimal action; each rule handles a
collection of perceived states
• Problems
– Still usually too big to generate and to store
– Still no knowledge of non-perceptual parts of state
– Still not adaptive to changes in the environment; requires collection of
rules to be updated if changes occur
– Still can’t make actions conditional on previous state
Utility-based agents
• When there are multiple possible alternatives, how to decide which one is best?
• A goal specifies a crude distinction between a happy and unhappy state, but often
need a more general performance measure that describes “degree of happiness.”
• Utility function U: State → Reals indicating a measure of success or happiness
when at a given state.
• Allows decisions comparing choice between conflicting goals, and choice
between likelihood of success and importance of goal (if achievement is
uncertain).
30
Artificial Intelligence Chapter1
Anurag Dixit
31
Artificial Intelligence Chapter1
Anurag Dixit
32
Artificial Intelligence Chapter1
Anurag Dixit
33