AI Lec04 Prop Logic
AI Lec04 Prop Logic
Semester 3, 2024
Artificial Intelligence
Propositional Logic
Road Map for Today
Revision of adversarial search
Propositional logic
Syntax and semantics
Model checking
Inference rules and theorem proving
-2-
Search & Adversarial Search
Uninformed search
Informed search
Hands-on
Examples
Games and adversarial search
- Minimax search
- Alpha-beta pruning search
- Cutting off search
- Heuristic evaluation function
Knowledge and Reasoning
Humans know things and what they know (knowledge) help them do
things (reasoning).
A good chess program can defeat human masters but it does not know that a
chess board can be used for playing checker as well. It cannot decide when to
play a chess game.
The transition model for 8-puzzle problems, i.e., knowledge of what the actions
do, can be used to predict the outcomes of actions but not to deduce that two
tiles cannot occupy the same space.
Knowledge and Reasoning (cont’d)
Knowledge and reasoning
enable agents to cope with complex environments.
[E.g., how to schedule an around-world trip? Need the knowledge about “the world”.]
Regular: must be a clear mapping between the knowledge and its representation.
…
Wumpus World
Rules of the environment
-- Rooms adjacent to wumpus are smelly.
-- Rooms adjacent to pit are breezy.
-- The room containing gold is glittering.
-- A bump is perceived if hiting into a wall.
-- Scream spreads anywhere if wumpus is killed.
-- Shooting kills wumpus if you are facing it.
-- Shooting uses up the only arrow.
-- Grabbing picks up gold if in same square.
Then repeatedly:
Incorporate percepts as inputs from sensors
Determine actions
Wumpus World (cont’d)
Soundness: i is sound if
whenever KB ├i α, it is also true that KB╞ α
Completeness: i is complete if
whenever KB╞ α, it is also true that KB ├i α
Basic elements:
-- Propositional symbols (atomic sentences)
-- P, Q, R, … (start with an uppercase letter)
-- T (always true), F (always-false)
-- Connectives , , , ,
Recursive evaluation: atomic sentences and sentences formed with five connectives.
Let P refers to “He studied hard.”, Q refers to “He passed the exam.”.
The last one seems bizarre. It actually says if he passed the exam, then the implication is true even if
the premise/antecedent is false.
“Dogs love cats implies cats hate dogs” odd but logically true if cats hate dogs is always true.
R3: B2,1 (P1,1 P2,2 P3,1) Pits cause breezes in adjacent squares.
Based on these given information, we can infer α: there is no pit in [1, 2].
Truth Tables for Inference
P Q is logically equivalent to P Q .
Validity
A sentence is valid if it is true in all models.
This general form of inference rules means “if we have proof that each i is true then this is extended
to a proof that is true.”.
A chained inference (i.e. possibly using more than one rule) from to ( infers ) is written:
┣
Inference Rules
One well known inference rule is called Modus Ponens:
,
It means that if and are given, then can be inferred.
E.g., if (Hungry FoodisAvailable) Eat and Hungry FoodisAvailable are given,
then Eat can be inferred.
( ) ( )
( ) ( )
By using these rules, we can infer that there is no pit in [1, 2] (the wumpus world).
We already know that:
R1: P1,1; R2: B1,1 (P1,2 P2,1 ) ; R3: B2,1 (P1,1 P2,2 P3,1) ; R4: B1,1; R5: B2,1
,
Apply Modus Ponens to sentence R8 (with Sentence R4: B1,1 ), we get
R9: (P1,2 P2,1 )
Finding a proof can be highly efficient in practice because it can ignore irrelevant
propositions, no matter how many of them there are.
if KB ╞ α then KB ╞ α
Conclusion follow inference rules regardless of what else is in the knowledge base.
45
Resolution
Resolution inference rule:
li … lk, m1 … mn
P1,3
1. Replace P Q with (P Q) (Q P)
2. Replace P Q with P Q
3. Push innermost
Replace P with P
Replace (P Q) with P Q
Replace (P Q) with P Q
4. Distribute over
Replace P (Q R) with (P Q) (P R)
Resolution example
Logic in general
Models and entailment
Soundness and completeness
Propositional logic
Syntax and semantics
Model checking
Inferences rules and theorem proving