07 Logic
07 Logic
Artificial Intelligence
Knowledge-Based Agents
AIMA Chapters 7-9
This work is licensed under a Creative Commons "Exercise Plays Vital Role Maintaining Brain Health"
Attribution-ShareAlike 4.0 International License. by A Health Blog
What is Logic?
Knowledge / Fact
Facts
Learning
Knowledge
Domain-specific content
base
Memorize percept
at time t
Record action
taken at time t
Some Types of Logic
= Symbols
Negation
Conjunction
Disjunction
Implication
Biconditional
Validity and Satisfiability
A sentence is valid if
e.g., True, A A, A A, (A (A B)) B
it is true in all models
useful to deduct new sentences.
(called a tautology)
A sentence is
unsatisfiable if it is e.g., AA
true in no models
Possible Worlds, Models and Truth Tables
A model specifies a “possible world” with the true/false
status of each proposition symbol in the knowledge base
• E.g., P is true and Q is true
• With two symbols, there are 22 = 4 possible worlds/models, and they can
be enumerated exhaustively using:
A truth table specifies the truth value of a composite sentence for each
possible assignments of truth values to its atoms. Each row is a model.
Sentence Model
Logical equivalence
Two sentences are logically equivalent iff (read if, and only if)
they are true in same models
Entailment
MichaelcanRunAMarathon or … or SarahCanRunAMarathon
Other Languages to represent Knowledge
Objects
Relations. Predicate
is/returns True or False
• x P(x)
• Example: “Everyone at SMU is smart”
x At(x,SMU) Smart(x)
Why not x At(x,SMU) Smart(x)?
• x P(x)
• Inference is complicated.
Knowledge
Prompts Text
Knowledge-Based Agents
Learned words,
grammar, facts.
Decoder-only
transformer
Large Language Models as Knowledge-based Agents
Memorize percept
at time t
Record action
taken at time t