0% found this document useful (0 votes)
7 views

CS488 CH 7 Propositional Logic

propositional logic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

CS488 CH 7 Propositional Logic

propositional logic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

HiLCoE

School of Computer Science and Technology


Course Title: Introduction to Artificial Intelligence (CS488)
Credit Hour: 4
Instructor: Fantahun B. (PhD) Fantishb@yahoo.Com
Office: 30#

Knowledge Representation and Reasoning


Ch-7 Propositional Logic

Mar-2023, AA
Ch-7
Knowledge Representation and Reasoning
Propositional Logic

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 2


KR and Reasoning: Propositional Logic

Agenda:
• Knowledge base agents
• The wampus worlds
• Logic in general
• Sentences in PL: Syntax and Semantics.
• Truth value of sentences: implication & truth table
• Validity and Satisfiability.
• Equivalence and Inference rules for Reasoning; proof and inference
• Pros and cons of propositional logic

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 3


KR and Reasoning: Propositional Logic
Objectives:
At the end of this chapter students will be able to:
• discuss how knowledge base agents work
• experience the wumpus world as one of environments in which
knowledge-based agents can show their worth
• explain some basic concepts in logic
• explain sentences; differentiate syntax and semantics; Explain validity and
satisfiability;
• use a inference to derive new representations from old;
• get incite on how to design agents that can form representations of a complex
world,
• identify pros and cons of Propositional Logic

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 4


KR and Reasoning: Propositional Logic

▪ Note regarding figure sequences:


▪ In chapters 1-5, Figures were sequenced according to the respective chapter
numbers.
▪ For this chapter and all the coming chapters, Figures will take a number
sequence given in the textbook chapters.

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 5


KR and Reasoning: Knowledge Based Agents
▪ Humans, know things; and what they know helps them do things.
▪ They make strong claims about how the intelligence of humans is
achieved—not by purely reflex mechanisms but by processes of reasoning
that operate on internal representations of knowledge.
▪ In AI, this approach to intelligence is embodied in knowledge-based agents.
▪ We develop logic as a general class of representations to support
knowledge-based agents.
▪ The central component of a knowledge-based agent is its knowledge base, or
KB.
▪ Knowledge base is a set of sentences in a formal language

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 6


KR and Reasoning: Knowledge Based Agents
▪ There must be a way to add new sentences to the knowledge base and a way
to query what is known.
▪ The standard names for these operations are TELL and ASK, respectively.
▪ Both operations may involve inference (deriving new sentences from old).
▪ Inference must obey the requirement that when one ASKs a question of the
KB, the answer should follow from what has been told (or TELLed) to the
KB previously.

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 7


KR and Reasoning: Knowledge Based Agents
▪ Each time the agent program is called, it does three things.
─ 1st, it TELLs the KB what it perceives.
─ 2nd it ASKs the KB what action it should perform. In the process of answering this
query, extensive reasoning may be done about the current state of the world, the
outcomes of possible action sequences, and so on.
─ 3rd, it TELLs the KB which action was chosen, and the agent executes the action.
▪ Figure 7.1 shows the outline of a knowledge-based agent program.

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 8


KR and Reasoning: Knowledge Based Agents

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 9


KR and Reasoning: Knowledge Based Agents
▪ The details of the representation language are hidden inside three functions that
implement the interface between the sensors and actuators on one side and the core
representation and reasoning system on the other.
▪ MAKE-PERCEPT-SENTENCE constructs a sentence asserting that the agent
perceived the given percept at the given time.
▪ MAKE-ACTION-QUERY constructs a sentence that asks what action should be
done at the current time. Finally,
▪ MAKE-ACTION-SENTENCE constructs a sentence asserting that the chosen
action was executed.
▪ The details of the inference mechanisms are hidden inside TELL and ASK.

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 10


KR and Reasoning: Knowledge Based Agents
▪ Declarative approach: A knowledge-based agent can be built simply by
TELLing it what it needs to know.
▪ Starting with an empty knowledge base, the agent designer can TELL
sentences one by one until the agent knows how to operate in its environment.
▪ Procedural approach: encodes desired behaviors directly as program code.
▪ In the 1970s and 1980s, advocates of the two approaches engaged in heated
debates.
▪ We now understand that a successful agent often combines both declarative
and procedural elements in its design, and that declarative knowledge can
often be compiled into more efficient procedural code.

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 11


KR and Reasoning: The Wumpus World
▪ In this section we describe an environment in which knowledge-based agents can show
their worth.
▪ The wumpus world is a cave consisting of rooms connected by passageways.
▪ Lurking somewhere in the cave is the terrible wumpus, a beast that eats anyone who
enters its room.
▪ The wumpus can be shot by an agent, but the agent has only one arrow.
▪ Some rooms contain bottomless pits that will trap anyone who wanders into these rooms
(except for the wumpus, which is too big to fall in).
▪ The only mitigating feature of this bleak environment is the possibility of finding a heap
of gold.
▪ A sample wumpus world is shown in Figure 7.2. The precise definition of the task
environment is given by the PEAS description:

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 12


KR and Reasoning: The Wumpus World
Performance measure
─ +1000 for climbing out of the cave with the gold,
─ –1000 for falling into a pit or being eaten by the wumpus,
─ –1 for each action taken and –10 for using up the arrow.
─ The game ends either when the agent dies or when the agent climbs out of the cave.
Environment
─ A 4×4 grid of rooms.
─ The agent always starts in the square labeled [1,1], facing to the right.
─ The locations of the gold and the wumpus are chosen randomly, with a uniform
distribution, from the squares other than the start square.
─ In addition, each square other than the start can be a pit, with probability 0.2.
─ Squares adjacent to wumpus are smelly
─ Squares adjacent to pit are breezy

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 13


KR and Reasoning: The Wumpus World

▪ The percepts will be given to the agent


program in the form of a list of five
symbols;
▪ for example, if there is a stench and a
breeze, but no glitter, bump, or scream,
the agent program will get
[Stench, Breeze, None, None, None].

Figure 7.2 A typical wumpus world. The agent is in the bottom left corner, facing right.
Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 14
KR and Reasoning: The Wumpus World
Actuators
▪ move Forward, TurnLeft, or TurnRight.
▪ dies if the agent enters a square containing a pit or a live wumpus.
▪ If it bumps into a wall, it does not move.
▪ Grab picks up the gold if it is in the same square as the agent.
▪ Releasing drops the gold in same square
▪ Shoot firs an arrow and kills wumpus if the agent is facing it
▪ Shoot uses up the only arrow the agent has.
▪ Climb to climb out of the cave, but only from square [1,1].

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 15


KR and Reasoning: The Wumpus World
Sensors
▪ In the square containing the wumpus and in the directly (not diagonally)
adjacent squares, the agent will perceive a Stench.
▪ In the squares adjacent to a pit, the agent will perceive a Breeze.
▪ In the square where the gold is, the agent will perceive a Glitter.
▪ When an agent walks into a wall, it will perceive a Bump.
▪ When the wumpus is killed, it emits a woeful Scream that can be perceived
anywhere in the cave.

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 16


KR and Reasoning: The Wumpus World
Wumpus world characterization
▪ Observable? No,
─ only local perception
▪ Deterministic? Yes,
─ outcomes exactly specified
▪ Episodic? No,
─ sequential at the level of actions
▪ Static? Yes,
─ Wumpus and Pits do not move
▪ Discrete? Yes
▪ Single-agent? Yes,
─ Wumpus is essentially a natural feature

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 17


KR and Reasoning: The Wumpus World
The knowledge based wumpus agent exploring the environment
▪ Let us watch a knowledge-based wumpus agent exploring the environment
shown in Figure 7.2.
▪ We use an informal knowledge representation language consisting of writing
down symbols in a grid (as in Figures 7.3 and 7.4).
▪ The agent’s initial knowledge base contains the rules of the environment, as
described previously; in particular, it knows that it is in [1,1] and that [1,1] is
a safe square; we denote that with an “A” and “OK,” respectively, in square
[1,1].
▪ The first percept is [None, None, None, None, None], from which the agent
can conclude that its neighboring squares, [1,2] and [2,1], are free of
dangers—they are OK. Figure 7.3(a) shows the agent’s state of knowledge at
this point.

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 18


KR and Reasoning: The Wumpus World
The knowledge based wumpus agent exploring the environment

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 19


KR and Reasoning: The Wumpus World
The knowledge based wumpus agent exploring the environment
▪ A cautious agent will move only into a square that it knows to be OK.
▪ Let us suppose the agent decides to move forward to [2,1]. The agent
perceives a breeze (denoted by “B”) in [2,1], so there must be a pit in a
neighboring square.
▪ The pit cannot be in [1,1], by the rules of the game, so there must be a pit in
[2,2] or [3,1] or both.
▪ The notation “P?” in Figure 7.3(b) indicates a possible pit in those squares.
▪ At this point, there is only one known square that is OK and that has not yet
been visited. So the prudent agent will turn around, go back to [1,1], and then
proceed to [1,2].

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 20


KR and Reasoning: The Wumpus World
The knowledge based wumpus agent exploring the environment
▪ The agent perceives a stench in [1,2], resulting in the state of knowledge shown in
Figure 7.4(a).
▪ The stench in [1,2] means that there must be a wumpus nearby. But the wumpus
cannot be in [1,1], by the rules of the game, and it cannot be in [2,2] (or the agent
would have detected a stench when it was in [2,1]). Therefore, the agent can infer
that the wumpus is in [1,3]. The notation W! indicates this inference.
▪ Moreover, the lack of a breeze in [1,2] implies that there is no pit in [2,2]. Yet the
agent has already inferred that there must be a pit in either [2,2] or [3,1], so this
means it must be in [3,1].
▪ This is a fairly difficult inference, because it combines knowledge gained at
different times in different places and relies on the lack of a percept to make one
crucial step.
Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 21
KR and Reasoning: The Wumpus World
The knowledge based wumpus agent exploring the environment

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 22


KR and Reasoning: The Wumpus World
The knowledge based wumpus agent exploring the environment
▪ The agent has now proved to itself that there is neither a pit nor a wumpus in
[2,2], so it is OK to move there.
▪ We do not show the agent’s state of knowledge at [2,2]; let us assume that the
agent moves to [2,3], giving us Figure 7.4(b).
▪ In [2,3], the agent detects a glitter, so it should grab the gold and then return
home.
▪ Note that in each case for which the agent draws a conclusion from the
available information, that conclusion is guaranteed to be correct if the
available information is correct.
▪ This is a fundamental property of logical reasoning.

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 23


KR and Reasoning: Logic in General
▪ Logics are formal languages for representing information such that conclusions can
be drawn.
▪ In Section 7.1, we said that KBs consist of sentences.
▪ Sentences are expressed according to the syntax of the representation language,
which specifies all the sentences that are well formed.
▪ Syntax defines the sentences in the language
▪ Semantics defines the meaning of sentences; it defines the truth of each sentence
with respect to each possible world (model).
─ For example, the semantics arithmetic specifies that the sentence “x + y =4” is true in
a world where x=2 and y=2, but false in a world where x=1 and y=1.
▪ In standard logics, every sentence must be either true or false in each possible
world—there is no “in between.”

Dec-23 Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 24


KR and Reasoning: Logic in General
Entailment
▪ Entailment means that one thing follows from another:
─ KB |= a
▪ Knowledge base KB entails sentence a if and only if a is true in all worlds
where KB is true
▪ E.g., the KB containing
─ “the Giants won" and “the Blacks won“ entails
─ “Either the Giants won or the Blacks won"
▪ E.g., x + y = 4 entails 4=x + y
▪ Entailment is a relationship between sentences (i.e., syntax) that is based on
semantics
Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 25
KR and Reasoning: Logic in General
Model
▪ Logicians typically think in terms of models, which are formally structured
worlds with respect to which truth can be evaluated.
▪ We say m is a model of a sentence a if a is true in m
▪ M(a) is the set of all models of a
M(ɑ)

▪ Then KB |= a if and only if M(KB) ⊆ M(a)


─ E.g. KB = Giants won and Blacks won and M(KB)
─ a = Giants won

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 26
KR and Reasoning: Logic in General
Entailment in wumpus world
▪ We can apply the same kind of analysis to the wumpus-world
reasoning example given in the preceding section.
▪ Consider the situation in Figure 7.3(b): the agent has detected
nothing in [1,1] and a breeze in [2,1].
▪ These percepts, combined with the agent’s knowledge of the
rules of the wumpus world, constitute the KB.
▪ The agent is interested (among other things) in whether the
adjacent squares [1,2], [2,2], and [3,1] contain pits.
▪ Each of the three squares might or might not contain a pit, 3
Boolean choices
=> 23 =8 possible models.

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 27
KR and Reasoning: Logic in General
Wumpus models

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 28
KR and Reasoning: Logic in General
Wumpus models

KB = wumpus-world rules + observations


Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 29
KR and Reasoning: Logic in General
Wumpus models

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 30
KR and Reasoning: Logic in General
Inference
▪ The preceding example not only illustrates entailment but also shows how the
definition of entailment can be applied to derive conclusions—that is, to carry out
logical inference.
▪ The inference algorithm illustrated in Figure 7.5 is called model checking, because
it enumerates all possible models to check that α is true in all models in which KB
is true, that is, M(KB) ⊆ M(α).
▪ In understanding entailment and inference, it might help to think of the set of all
consequences of KB as a haystack and of α as a needle. Entailment is like the
needle being in the haystack; inference is like finding it.
▪ This distinction is embodied in some formal notation: if an inference algorithm i
can derive α from KB, we write
which is read “α is derived from KB by i” or “i derives α from KB.”

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 31
KR and Reasoning: Logic in General
Inference
▪ Soundness: An inference algorithm that derives only entailed sentences is called sound or
truth preserving.

▪ An unsound inference procedure essentially makes things up as it goes along—it


announces the discovery of nonexistent needles.
▪ Completeness: an inference algorithm is complete if it can derive any sentence that is
entailed.

▪ For real haystacks, which are finite in extent, it seems obvious that a systematic
examination can always decide whether the needle is in the haystack.
Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 32
KR and Reasoning: Propositional Logic
Syntax
▪ Propositional logic is a simple but powerful logic.
▪ The syntax of propositional logic defines the allowable sentences.
▪ Atomic sentences consist of a single proposition symbol. Each such symbol
stands for a proposition that can be true or false.
▪ We use symbols that start with an uppercase letter and may contain other
letters or subscripts, for example: P, Q, R, B1,3, P1,1 etc.
▪ Complex sentences are constructed from simpler sentences, using
parentheses and logical connectives.

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 33
KR and Reasoning: Propositional Logic
Syntax
▪There are five connectives in common use:
─ not (negation): If P is a sentence, ⌐P is a sentence
─ and (conjunction): if P and Q are sentences, P ˄ Q is a sentence
─ or (disjunction): if P and Q are sentences, P V Q is a sentence
─ implication: if P and Q are sentences, P => Q is a sentence
─ bi-implication: if P and Q are sentences, P <=> Q is a sentence

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 34
KR and Reasoning: Propositional Logic
Semantics
▪ Each model species true/false for each proposition symbol
─ E.g. m1 = P1,2 = false, P2,2 = false, P3,1 = true
─ With these symbols, 8 possible models, can be enumerated automatically.
▪ Rules for evaluating truth with respect to a model m:
─ ⌐P is true iff P is false
─ P ^ Q is true iff P is true and Q is true
─ P V Q is true iff P is true or Q is true
─ P => Q is true iff P is false or Q is true
i.e., P => Q is false iff P is true and Q is false
─ P ⬄ Q is true iff P => Q is true and Q => P is true

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 35
KR and Reasoning: Propositional Logic
Semantics
▪ Truth table for connectives

▪ Simple recursive process evaluates an arbitrary sentence, for example, ⌐P1,2 ^ (P2,2
V P3,1) evaluated in m1 gives the following.
▪ ⌐P1,2 ^ (P2,2 V P3,1) = (not)false ^ (false V true)= true ^ true= true

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 36
KR and Reasoning: Propositional Logic
Semantics
▪ The biconditional, P ⇔ Q, is true whenever both P ⇒ Q and Q ⇒ P are true.
▪ In English, this is often written as “P if and only if Q.”
▪ Many of the rules of the wumpus world are best written using ⇔.
▪ For example, a square is breezy if a neighboring square has a pit, and a
square is breezy only if a neighboring square has a pit.
▪ So we need a biconditional,
─ B1,1 ⇔ (P1,2 ∨ P2,1) ,
─ where B1,1 means that there is a breeze in [1,1].

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 37
KR and Reasoning: Propositional Logic
A simple knowledge base
▪ Now that we have defined the semantics for propositional logic, we can
construct a knowledge base for the wumpus world.
▪ For now, we need the following symbols for each [x, y] location:
─ Px,y is true if there is a pit in [x, y].
─ Wx,y is true if there is a wumpus in [x, y], dead or alive.
─ Bx,y is true if the agent perceives a breeze in [x, y].
─ Sx,y is true if the agent perceives a stench in [x, y].

▪ The sentences we write will suffice to derive ¬P1,2 (there is no pit in [1,2]),

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 38
KR and Reasoning: Propositional Logic
A simple knowledge base
▪ There is no pit in [1,1]:
─ R1 : ¬P1,1 .
▪ ‘A square is breezy if and only if there is a pit in a neighboring square.’
─ R2 : B1,1 ⇔ (P1,2 ∨ P2,1) .
─ R3 : B2,1 ⇔ (P1,1 ∨ P2,2 ∨ P3,1) .
▪ The preceding sentences are true in all wumpus worlds.
▪ Now we include the breeze percepts for the first two squares visited in the
specific world the agent is in.
─ R4 : ¬B1,1 .
─ R5 : B2,1 .

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 39
KR and Reasoning: Propositional Logic
A simple inference procedure: enumeration a

Figure 7.9 A truth table constructed for the knowledge base given in the text. KB is true if R1 through R5 are true, which
occurs in just 3 of the 128 rows (the ones underlined in the right-hand column). In all 3 rows, P1,2 is false, so there is no pit in
[1,2]. On the other hand, there might (or might not) be a pit in [2,2].
Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 40
KR and Reasoning: Propositional Logic
A simple inference procedure
▪ Depth-first enumeration
of all models is sound and
complete
▪ Time O(2n) for n symbols;
▪ Space O(n)

Figure 7.10 A truth-table enumeration algorithm for deciding propositional entailment. (TT stands for truth table.)
PL-TRUE? returns true if a sentence holds within a model. The variable model represents a partial model—an assignment
to some of the symbols. The keyword “and” is used here as a logical operation on its two arguments, returning true or
false.
Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 41
KR and Reasoning: Propositional Logic
Logical Equivalence
▪ Two sentences α and β are logically equivalent if they are true in the same set of
models. We write this as
o α ≡ β.
▪ An alternative definition of equivalence is as follows: any two sentences α and β
are equivalent only if each of them entails the other:
o α ≡ β iff α|= β and β|= α .
▪ For example, we can easily show (using truth tables) that P ∧ Q and Q ∧ P are
logically equivalent; Figure 7.11 shows other equivalences.

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 42
KR and Reasoning: Propositional Logic
Logical equivalence

Figure 7.11 Standard logical equivalences. The symbols α, β, and γ stand for arbitrary
sentences of propositional logic.
Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 43
KR and Reasoning: Propositional Logic
Validity
▪ A sentence is valid if it is true in all models.
▪ For example, True, A V ⌐A, A ⇒ A, (A ∧ (A ⇒ B)) ⇒ B

Class work: show that (A ∧ (A ⇒ B)) ⇒ B is valid.


▪ Valid sentences are aka tautologies (they are necessarily true).
▪ Because the sentence True is true in all models, every valid sentence is logically
equivalent to True.
▪ Validity is connected to inference via the Deduction Theorem:
α |= β if and only if (α ⇒ β) is valid.
▪ Conversely, the deduction theorem states that every valid implication sentence
describes a legitimate inference.

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 44
KR and Reasoning: Propositional Logic
Satisfiability
▪ A sentence is satisfiable if it is true in, or satisfied by, some model.
o For example, the KB given earlier, (R1 ∧ R2 ∧ R3 ∧ R4 ∧ R5), is
satisfiable because there are three models in which it is true, as shown in
Figure 7.9.
o A V B,
o C
▪ A sentence is unsatisfiable if it is true in no models
o examples, A ^ ⌐A
▪ Many problems in computer science are really satisfiability problems.
o For example, all the constraint satisfaction problems in Chapter 6 ask whether
the constraints are satisfiable by some assignment.

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 45
KR and Reasoning: Propositional Logic
Satisfiability
▪ Validity and satisfiability are connected:
o α is valid iff ¬α is unsatisfiable; contrapositively,
o α is satisfiable iff ¬α is not valid.
▪ We also have the following useful result
α |= β iff (α ∧ ¬β) is unsatisfiable.
▪ Proving β from α by checking the unsatisfiability of (α ∧ ¬β) corresponds
exactly to the standard mathematical proof by refutation or proof by
contradiction.

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 46
KR and Reasoning: Propositional Logic
Proof methods

1. Application of inference rules


▪ Legitimate (sound) generation of new sentences from old
▪ Proof = a sequence of inference rule applications
2. Model checking
▪ truth table enumeration (always exponential in n)

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 47
KR and Reasoning: Propositional Logic
Inference and proofs
▪ inference rules can be applied to derive a proof
▪ Proof is a chain of conclusions that leads to the desired goal.
▪ The best-known rule is called Modus Ponens (Latin for mode that affirms) and is
written

▪ The notation means that, whenever any sentences of the form α ⇒ β and α are
given, then the sentence β can be inferred.
▪ For example, if (WumpusAhead ∧ WumpusAlive) ⇒ Shoot and (WumpusAhead
∧ WumpusAlive) are given, then Shoot can be inferred.

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 48
KR and Reasoning: Propositional Logic
Inference and proofs
▪ Another useful inference rule is And-Elimination, which says that, from a
conjunction, any of the conjuncts can be inferred:

─ For example, from (WumpusAhead ∧ WumpusAlive), WumpusAlive can be


inferred.
▪ Modus Ponens and And-Elimination are sound.
▪ These rules can then be used in any particular instances where they apply,
generating sound inferences without the need for enumerating models.

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 49
KR and Reasoning: Propositional Logic
Inference and proofs
▪ All of the logical equivalences in Figure 7.11 can be used as inference rules.
▪ For example, the equivalence for biconditional elimination yields the two
inference rules.

▪ Let us see how these inference rules and equivalences can be used in the
wumpus world.
▪ We start with the knowledge base containing R1 through R5 and show how to
prove ¬P1,2, (there is no pit in [1,2]).

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 50
KR and Reasoning: Propositional Logic
Inference and proofs
▪ First, we apply biconditional elimination to R2 to obtain
R6: (B1,1 ⇒ (P1,2 ∨ P2,1)) ∧ ((P1,2 ∨ P2,1) ⇒ B1,1) .
▪ Then we apply And-Elimination to R6 to obtain
R7: ((P1,2 ∨ P2,1) ⇒ B1,1) .
▪ Logical equivalence for contrapositives gives
R8: (¬B1,1 ⇒ ¬(P1,2 ∨ P2,1)) .
▪ Modus Ponens with R8 and the percept R4 (i.e., ¬B1,1), to obtain
R9 : ¬(P1,2 ∨ P2,1) .
▪ Finally, we apply De Morgan’s rule, giving the conclusion
R10 : ¬P1,2 ∧ ¬P2,1 .
▪ That is, neither [1,2] nor [2,1] contains a pit.
Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 51
KR and Reasoning: Propositional Logic
Inference and proofs
▪ One final property of logical systems is monotonicity, which says that
the set of entailed sentences can only increase as information is added to
the knowledge base.
▪ For any sentences α and β,
if KB |= α then KB ∧ β |= α .

Please explore more!


Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 52
KR and Reasoning: Propositional Logic
Pros and cons of PL
▪ Propositional logic is declarative: pieces of syntax correspond to facts
▪ Propositional logic allows partial/disjunctive/negated information (unlike most
data structures and databases)
▪ Propositional logic is compositional: meaning of B1,1 ^ P1;2 is derived from
meaning of B1,1 and of P1,2
▪ Meaning in propositional logic is context-independent (unlike natural language,
where meaning depends on context)
▪ Propositional logic has very limited expressive power (unlike natural language)
─ E.g., cannot say “pits cause breezes in adjacent squares“ except by writing
one sentence for each square

Dec-23
Fantahun B.(PhD) Based on AI a Modern Approach 3e&others 53

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy