7-Lecture1

Artificial Intelligence
Logical Agents
Chapter 7
Outline of this Chapter
•
•
•
•
•
•
•
•
Knowledge-Based Agents
Logic in general
Inference
Type of logic
Propositional (Boolean) logic
Validity & satisfiability
Inference rules for Propositional logic
An Agent for the Wumpus World
Knowledge-Based Agents
• The central component of Intelligent agents is knowledge about the world
to reach good decisions.
• A Knowledge-Based Agent is composed of:
– Inference mechanism.
– Knowledge Base (KB)
• Knowledge Base (KB) is a set of representations of facts about the world
known as Sentences.( here sentence is used as a technical term, it is related
but is not identical to the sentence of English or other language )
• The sentences are expressed in a language called knowledge
Representation Language (KRL).
• KB agent can operate by storing sentences about the world in its KB, using
the inference mechanism to infer new sentences & using them to decide
what action to take.
A simple knowledge-based agent
•
Agent gains additional knowledge about the world while interacting with its
environment.
The agent operates as follow:
1.
2.
3.
It TELLs the KB what it perceives.
It ASKs the KB what action it should perform.
It performs the chosen action.
Architecture of a KB Agent
Agents can be viewed at 3 levels:
• At the Knowledge level: the most abstract-- describes agent by saying
what it knows.
• At the Logical level: It describes how the agent knows.
• At the Implementation level: it describes how knowledge is
implemented.
i.e., data structures in KB and algorithms that manipulate them
What it knows
How it knows
How K is implemented
Knowledge level
Logical level
Implementation level
Logic in general
• Logic is a formal language for representing information such that
conclusions can be drawn
• It consists of two parts, a language and a method of reasoning. The
objective of KRL(knowledge Representation Language) is to express
knowledge in a computer adaptable manner, so that agents can perform
well.
A knowledge representation language is defined by two aspects:
• Syntax: Specifies the symbols in the language and how they can be
combined to form sentences.
• Semantic: defines the meaning of sentences;
Example:
– x ≥ y is a sentence
The semantic of the language says:
– x ≥ y is false if y is a bigger number than x, and true otherwise
• If a language has well defined syntax and semantics, then it is called a
logic
The Connection between Sentences & Facts
• Facts are part of the world– their representation must be encoded to
physically store within an agent.
• Cannot put the world inside a computer - all reasoning must operate
on representation of facts, rather than on facts themselves.
• Semantics maps sentences in logic into facts in the world.
• The property of one fact following from some other facts is mirrored by
the property of one sentence being entailed by another.
Entailment
• Entailment means that one thing follows from another:
E.g., x+y = 4 entails 4 = x+y
In mathematical notation: KB ╞ α
• Knowledge base KB entails sentence α if and only if α is true in all
worlds where KB is true
• In other words, every world where KB is true is also a world where α is
true.
E.g., the KB containing “A won” and “B won” entails“Either A won or
B won”.
Entailment is a relationship between sentences (i.e., syntax) that is based
on semantics.
Inference
• Inference- A process by which conclusions are reached
KB ├i α = sentence α can be derived from KB by procedure I
• Logical inference (inferencing or deduction) is the process of generating
new sentences based on existing sentences.
• An inference algorithm or process that drives only entailed sentences is called
Sound/ truth-preserving.
• An inferencing process is complete if it can derive all sentences that are
entailed (Have as a logical consequence).
• Notice that if we make wrong statements about our 'world' the inference is
likely to be wrong.
Type of Logic
Table bellow shows several logics as classified by their Ontological and
Epistemological commitments.
• Ontological commitments defines the entities that a language uses to
describe the world
• Epistemological commitments are the values that a sentence can have
according to the experiences of an agent.
Language
Ontological
commitment (what
exists in the world)
Epistemological
commitment (what an
agent believes)
Propositional logic
Facts
True/false/unknown
First-Order Logic
Facts,object,relations
True/false/unknown
Temporal logic
Facts,object,relations,
times
True/false/unknown
Probability
Facts
Degree of belief 0..1
Fuzzy logic
Degree of truth
Degree of belief 0..1
Propositional logic(PL): Syntax
• Propositional/Boolean logic is the simplest logic – illustrates many of the
concepts of logic.
• Sentences in Propositional logic are made of the following symbols:
– Constants: TRUE, FALSE
– Proposition Symbols: P1, P2 etc are sentences
– Round brackets: () to wrap sentences, which yields a single sentence, e.g
(P1Ú P2)
– Logical Connectives:  (and),  (or),  (implication),  (equivalence),
 (negation).
– A sentence can be formed by combining simpler sentences with one of the 5
logical connectives:
• If S is a sentence,  S is a sentence (negation)
• If S1 and S2 are sentences, S1  S2 is a sentence (conjunction: The state of being
joined together)
• If S1 and S2 are sentences, S1  S2 is a sentence (disjunction: State of being
disconnected)
• If S1 and S2 are sentences, S1  S2 is a sentence (implication:- Something that is
conditional (entailed or implied) "his resignation had political implications")
• If S1 and S2 are sentences, S1  S2 is a sentence (biconditional – iff means if and
only if )
PL Syntax example
Propositional logic: Semantics
The semantic of sentences in Propositional Logic is defined by:
• Interpreting the proposition symbols - they are considered satisfiable (true
in some model) but not valid sentences (can mean whatever you want),
• Interpreting the constants- their meaning is fixed: FALSE equals
FALSE, and TRUE equals TRUE, and
• specifying the meanings of the 5 logical connectives (their behaviour is
shown in the truth tables ).
Examples of PL sentences
• A simple language useful for showing key ideas and definitions
• User defines a set of propositional symbols, like P and Q.
• User defines the semantics of each of these symbols, e.g.:
– P means "It is hot"
– Q means "It is humid"
– R means "It is raining"
• (P ^ Q)  R
"If it is hot and humid, then it is raining“
• QP
"If it is humid, then it is hot“
• Q
"It is humid."
Validity & Satisfiability
There are three types of sentences:
•
Valid: Characteristic of sentences that are true under all possible
interpretations of the world (in all models), also called tautologies.
e.g. A A, A  A, (A  (A  B))  B
•
Satisfiable: Characteristic of sentences that are true under some
interpretations of the world
e.g., A B, C
•
Un-satisfiable: Characteristic of sentences that are false under all
interpretation of the world e.g., AA
Semantic example
Semantic example
Semantic example
Logical equivalence
• Two sentences are logically equivalent, iff true in same models: α ≡ ß iff α╞ β
and β╞ α
•
•
You can use these equivalences to modify sentences.
Inference Rules for Propositional Logic
The inferencing rules that can be used to derive new sentences in propositional logic are described below:
Modus-Ponens or Implication elimination (From an implication and the
premise of the implication, you can infer the conclusion)
 


Whenever any sentences of the form  &  are given
  can be inferred
And-Elimination (From a conjunction, you can infer any of the conjuncts )



And-Introduction (From a list of sentences, you can infer their conjunction)
12...n

1 2 ...n
Or-Introduction (From a sentence, you can infer its disjunction)
i

1 2 ...n
Inference Rules for Propositional Logic
Double-Negation Elimination (from doubly - sentence, you can infer + sentence)



Unit Resolution (From disjunction, if one is false, then you can infer the
other one is true )
 


Resolution (most difficult Because  cannot be both true and false)
 

