Chap 3 Logical Agents
Chap 3 Logical Agents
Overview
• Knowledge-based agents
• General principles of logic
• Propositional logic
• Reasoning and proof in propositional logic
Knowledge-Based Agent Capabilities
1. Represent states
2. Incorporate new perceptions
3. Update internal world representation
4. Deduce hidden world properties
The Wumpus World Example
Performance measures:
- Gold: +1000
- Death: -1000
Environment:
- Agent starts at [1,1]
- Adjacent cells to the Wumpus smell bad
- Breeze in cells adjacent to pits
- Glow in cell with gold
Actions:
- Turn left, turn right, move forward, grab, shoot
Logical Principles
- Logic: formal language to represent and derive
conclusions
- Syntax: rules for well-formed sentences
- Semantics: meaning and truth of sentences
- Example:
- Syntax: 'x + y = 4' (correct), 'x4y+=' (incorrect)
- Semantics: 'x + y = 4' is true if x=1 and y=3.
Consequence relation
7
Consequence relation in the world of
Wumpus
8
Models of the Wumpus world
9
Models of the Wumpus world
• BC = Wumpus world rules + observations
10
Models of the Wumpus world
• BC = Wumpus world rules + observations
• α1 = "[1,2] is pit-free"
11
Models of the Wumpus world
• BC = Wumpus world rules + observations
• α1 = "[1,2] is pit-free“
• BC ⊨ α1, proven through model checking
12
Models of the Wumpus world
13
Propositional Logic
Syntax
- Propositional logic = very simple logic
- A statement is an atomic statement or a complex statement
- A propositional symbol is a proposition that can be true or false
(P, Q, R, ...)
- Atomic statements: a single propositional symbol, true or false.
- Also called a literal
- Complex statements:
- If E is a statement, -E is a statement (negation)
- If E1 and E2 are statements, E1 ∧ E2 is a statement
(conjunction)
- If E1 and E2 are statements, E1 ∨ E2 is a statement (disjunction)
- If E1 and E2 are statements, E1 → E2 is a statement
(implication)
- If E1 and E2 are statements, E1 ↔ E2 is a statement
(equivalence)
14
Propositional Logic
Semantic
A model assigns a truth value (true or false) to each propositional symbol.
With 3 propositional symbols P1, P2, and P3, there are 2^3 = 8 possible
models.
The formula ¬P1 ∧ (P2 ∨ P3) = true ∧ (false ∨ true) = true ∧ true = true
demonstrates this recursive evaluation.
15
Truth tables for logical connectors:
16
Knowledge base of the Wumpus world
Knowledge Base:
- P[i,j] is true if there is a pit in [i,j]
- B[i,j] is true if there is a breeze in [i,j]
- Breeze indicates the presence of pits in adjacent squares
Rules:
- R1: ¬P[1,1]
- R2: B[1,1] ⇔ (P[1,2] ∨ P[2,1])
- R3: B[2,1] ⇔ (P[1,1] ∨ P[2,2] ∨ P[3,1])
- R4: ¬B[1,1]
- R5: B[2,1]
BC: R1 ∧ R2 ∧ R3 ∧ R4 ∧ R5
17
Knowledge base of the Wumpus world
18
Properties of Inference by Enumeration
19
Validity and satisfiability
A statement is valid if it is true in all models. We also say it is a
tautology.
Examples:
valid statements: A ∨ ¬A; A ⇒ A; ((A ∧ (A ⇒ B)) ⇒ B
Deduction Theorem:
BC ⊨ α if and only if BC ⇒ α is valid
Exercice 2 :
Show these logical deductions using the enumeration of the truth table.
a) (A ∧ (A ⇒ B)) ⊢ B
b) ¬(A ⇒ A) ⊢ B
c) (A ∧ ¬A) ⊢ B
21
Proof methods
Proof methods are of three main types:
1.Model Checking
2.Truth Table Enumeration (always exponential
in nnn)
3.Application of Inference Rules
1.Generation of new statements from existing ones
2.Proof: a sequence of applications of inference
rules
22
Logical equivalence
• Two statements are logically equivalent if and only if they are true in the same
models:
23
Example of Proof
24
Conclusion
Logical agents apply inference on a knowledge base to deduce new
information and make decisions.
• Model Checking
• Truth Table Enumeration
• Application of Inference Rules
25