0% found this document useful (0 votes)
10 views55 pages

Propositional Logic

The document discusses logical agents, focusing on knowledge-based agents that utilize a knowledge base for reasoning. It introduces the Wumpus World as a practical example, detailing its characteristics, performance measures, and the logic involved in decision-making. Additionally, it covers propositional logic, including syntax, semantics, and logical equivalences, emphasizing the importance of formal reasoning in artificial intelligence.

Uploaded by

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

Propositional Logic

The document discusses logical agents, focusing on knowledge-based agents that utilize a knowledge base for reasoning. It introduces the Wumpus World as a practical example, detailing its characteristics, performance measures, and the logic involved in decision-making. Additionally, it covers propositional logic, including syntax, semantics, and logical equivalences, emphasizing the importance of formal reasoning in artificial intelligence.

Uploaded by

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

Logical

Agents

Lecture 20- Logical Agents 1


Outlin
e
• Knowledge-based agents
• Wumpus world
• Logic in general - models and entailment
• Propositional (Boolean) logic

Lecture 20- Logical Agents 2


Logical
Agents
• Knowledge-based agents – agents that have an
explicit representation of knowledge that can be
reasoned with.

• These agents can manipulate this knowledge to


infer new things at the “knowledge level”

• Central component of a knowledge-based


agent is its knowledge base

Lecture 20- Logical Agents 3


Knowledge
bases

• Knowledge base = set of sentences in a formal language


• Declarative approach to building an agent (or other system):
• Tell it what it needs to know

• Then it can Ask itself what to do - answers should follow from


the KB
• Agents can be viewed at the knowledge level - i.e., what they
know, regardless of how implemented
• Or at the implementation level
• i.e., data structures in KB and algorithms that manipulate
them
Lecture 20- Logical Agents 4
A simple knowledge-based
agent

• The agent must be able to:


• Represent states, actions, etc.
• Incorporate new percepts
• Update internal representations of the world
• Deduce hidden properties of the world
• Deduce appropriate actions
Lecture 20- Logical Agents 5
A Wumpus
World

Lecture 20- Logical Agents 6


Wumpus World PEAS
description
• Performance measure
• gold +1000, death -1000
• -20 per forward step
• -10 per backward step cost
• -10 for using the arrow

• Environment: 4 x 4 grid of rooms


• Squares adjacent to wumpus are smelly
• Squares adjacent to pit are breezy
• Glitter if gold is in the same square
• Shooting kills wumpus if you are facing it
• Shooting uses up the only arrow
• Grabbing picks up gold if in same square
• Releasing drops the gold in same square

• Sensors: Stench, Breeze, Glitter, Bump, Scream (shot Wumpus)


• Actuators: Left turn, Right turn, Forward, Grab, Release, Shoot

Lecture 20- Logical Agents 7


Wumpus world
characterization
• Fully Observable

• Deterministic

• Episodic

• Static

• Discrete

• Single-agent?

Lecture 20- Logical Agents 8


Wumpus world
characterization
• Fully Observable No – only local perception

• Deterministic

• Episodic

• Static

• Discrete

• Single-agent?

Lecture 20- Logical Agents 9


Wumpus world
characterization
• Fully Observable No – only local perception

• Deterministic Yes – outcomes exactly specified

• Episodic

• Static

• Discrete

• Single-agent?

Lecture 20- Logical Agents 10


Wumpus world
characterization
• Fully Observable No – only local perception

• Deterministic Yes – outcomes exactly specified

• Episodic No – sequential at the level of actions

• Static

• Discrete

• Single-agent?

Lecture 20- Logical Agents 11


Wumpus world
characterization
• Fully 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

• Single-agent?

Lecture 20- Logical Agents 12


Wumpus world
characterization
• Fully 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?

Lecture 20- Logical Agents 13


Wumpus world
• characterization
Fully 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 static

Lecture 20- Logical Agents 14


Wumpus
• World
Percepts given to the agent
1. Stench
2. Breeze
3. Glitter
4. Bumb (ran into a wall)
5. Scream (wumpus has been hit by arrow)

• Principle Difficulty: agent is initially ignorant of the


configuration of the environment – going to have to
reason to figure out where the gold is without getting
killed!

Lecture 20- Logical Agents 15


Exploring the Wumpus
World Initial situation:

Agent in 1,1 and percept is


[None, None, None, None,
None]

From this the agent can infer the


neighboring squares are safe
(otherwise there would be a
breeze or a stench)

Lecture 20- Logical Agents 16


Exploring a wumpus
world

Lecture 20- Logical Agents 17


Exploring a wumpus
world

Lecture 20- Logical Agents 18


Exploring a wumpus
world

Lecture 20- Logical Agents 19


Exploring a wumpus
world

Lecture 20- Logical Agents 20


Exploring a wumpus
world

Lecture 20- Logical Agents 21


Exploring a wumpus
world

Lecture 20- Logical Agents 22


Exploring a wumpus
world

Lecture 20- Logical Agents 23


Exploring a wumpus
world

Lecture 20- Logical Agents 24


Exploring a wumpus
world

In each case where 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


Lecture 20- Logical Agents 25
Logic in
•general
Logics are formal languages for representing information such that
conclusions can be drawn

• Syntax defines how symbols can be put together to form the


sentences in the language

• Semantics define the "meaning" of sentences;


• i.e., define truth of a sentence in a world (given an interpretation)

• E.g., the language of arithmetic


• x+2 ≥ y is a sentence; x2+y > {} is not a sentence
• x+2 ≥ y is true iff the number x+2 is no less than the number y
• x+2 ≥ y is true in a world where x = 7, y = 1
• x+2 ≥ y is false in a world where x = 0, y = 6

Lecture 20- Logical Agents 26


Entailme
nt
• Entailment—the relation between a sentence and
another sentence that follows from it
• A |= B A entails B
• Under all interpretations in which A is true, B is true as
well
• Whenever A is true, B is true as well
• All models of A are models of B
• B logically follows from A

Lecture 20- Logical Agents 27


Logic

KB = wumpus world rules + observations

a1 = “[1,2] is safe”, KB |= a1, proved by model checking

AI: Chapter 7: Logical Agents 28


February 20, 2006
Logic

KB = wumpus world rules + observations

a2 = “[2,2] is safe”, KB ¬|= a2 proved by model checking

AI: Chapter 7: Logical Agents 29


February 20, 2006
Propositional logic:
Syntax
• Propositional logic is the simplest logic – illustrates basic ideas

• The proposition symbols S1, S2 etc are (atomic) sentences

• If S is a sentence, (S) is a sentence (negation, not)

• If S1 and S2 are sentences, (S1  S2) is a sentence (conjunction, and)

• If S1 and S2 are sentences, (S1  S2) is a sentence (disjunction, or)

• If S1 and S2 are sentences, (S1  S2 )  S3 is a sentence (implication,


conditional)
• S1 and S2 are known as premise or antecedents
• S3 is known as conclusion
• Implications are also known as rules or if–then statements.
• If S1 and S2 are sentences, (S1  S2) is a sentence (biconditional, if and only if)

Lecture 20- Logical Agents 28


Propositional Logic
Sentences
• If there is a pit at [1,1], there is a breeze at [1,0]
Implication rule
P11  B10
• There is a breeze at [2,2], if and only if there is a pit
in the neighborhood
Biconditional rule
B22  ( P21  P23  P12  P32 )
• There is no breeze at [2,2]
Negation rule
B22
Lecture 20- Logical Agents 29
Truth tables for
connectives

Lecture 20- Logical Agents 32


Truth tables for
connectives

John likes football and John likes baseball.


John likes football or John likes baseball.
(English or is a bit different…)

Lecture 20- Logical Agents 33


Truth tables for
connectives

John likes football and John likes baseball.


John likes football or John likes baseball.
If John likes football then John likes baseball.
(Note different from English – if John likes football
maps to false, then the sentence is true.)
(Implication seems to be if antecedent is true then I
claim the consequence is, otherwise I make no
claim.) Lecture 20- Logical Agents 32
End-Part-1

Lecture 20- Logical Agents 33


Propositional Logic

Lecture 21- Propositional 3


Logic 6
Outline
• Propositional (Boolean) logic
• Facts about Propositional Logic
• Tautologies
• Atomic Propositions
• Compound Propositions
• Precedence of Connectives
• Logical Equivalence
• Properties of Operators
• Limitations of Propositional Logic
• Converting Assertions into Logical Forms

Lecture 21- Propositional 3


Logic 7
Propositional Logic
• Propositional logic (PL) is the simplest form of logic
where all the statements are made by propositions.
• Propositions: A proposition is a
declarative statement which is either true or false.
• It is a technique of knowledge representation in logical
and mathematical form.

Lecture 21- Propositional 3


Logic 8
Basic Facts about
Propositional Logic
• Propositional logic is also called Boolean logic as it works on 0 and 1.
• In propositional logic, we use symbolic variables to represent the logic, and we
can use any symbol for a representing a proposition, such A, B, C, P, Q, R, etc.
• Propositions can be either true or false, but it cannot be both.
• Propositional logic consists of an object, relations or function, and logical
connectives.
• These connectives are also called logical operators.
• The propositions and connectives are the basic elements of the propositional
logic.
• Connectives can be said as a logical operator which connects two sentences.
• A proposition formula which is always true is called tautology, and it is also
called a valid sentence.
• A proposition formula which is always false is called Contradiction.
• Statements which are questions, commands, or opinions are not propositions
such as "Where is John", "How are you", "What is your name", are not
propositions.
Lecture 21- Propositional 3
Logic 9
Tautologies
• A sentence is a tautology if it is true for any
setting of its propositional symbols
P Q P∨Q ¬(P)  ¬ (Q) (P ∨ Q) ∨
(¬(P)  ¬
(Q))

false false false true true

false true true false true

true false true false true

true true true false true

• (P ∨ Q) ∨ (¬(P)  ¬ ( Q ) )
Le c ture 21 - 5
Is this a tautology?
•(P → Q) ∨ (Q →
P)

Lecture 21- Propositional 41


Logic
Syntax of
Propositional Logic
• The syntax of logic defines
allowable
propositional sentences knowledge
the the
for
representation.
• There are two types of Propositions:
a. Atomic Proposition:
b. Compound Propositions:

Lecture 21- Propositional 42


Logic
Syntax of
PL
Atomic Propositions
Atomic Proposition:
• Atomic propositions are the simple propositions.
• It consists of a single proposition symbol.
• These are the sentences which must be either true or false
Example:
a. 2+2 is 4, it is an atomic proposition as it is a true fact
b. "The Sun is cold" is also a proposition as it is a false fact

Lecture 21- Propositional 44


Logic
Compound
Propositions
Compound Proposition:
• Compound propositions are constructed by combining
simpler or atomic propositions
• These are constructed by using parenthesis and logical
connectives.
Example:
a. "It is raining today, and street is wet."
b. “John is a doctor, and his clinic is in London."

Lecture 21- Propositional 45


Logic
Table for
Propositional Logic
Connectives

Lecture 21- Propositional 46


Logic
Precedence
Connectives
• Just like arithmetic operators, there is a precedence order for
propositional connectors or logical operators.
• This order should be followed while evaluating a
propositional problem.
• Following is the list of the precedence order for operators:

Lecture 21- Propositional 47


Logic
Logical Equivalence
• Logical equivalence is one of the features of
propositional logic.
• Two propositions are said to be logically equivalent
if and only if the columns in the truth table are
identical to each other.

Lecture 21- Propositional 48


Logic
Logical Equivalence
• Let's take two propositions A and B, so for logical
equivalence
• Calculate truth tables for
• ¬A∨ B
• A→B

• In truth table above, we can see that column for ¬A∨


B and A→B, are identical hence A is Equivalent to B

Lecture 21- Propositional 49


Logic
Is this a Logical
P∨Q
•equivalence?
• ¬(¬(P)  ¬(Q))

Lecture 21- Propositional 50


Logic
Famous logical equivalences
• (a OR b) ≡ (b OR a) commutatitvity
• (a AND b) ≡ (b AND a) commutatitvity
• ((a AND b) AND c) ≡ (a AND (b AND c)) associativity
• ((a OR b) OR c) ≡ (a OR (b OR c)) associativity
• NOT(NOT(a)) ≡ a double-negation elimination
• (a => b) ≡ (NOT(b) => NOT(a)) contraposition
• (a => b) ≡ (NOT(a) OR b) implication elimination
• NOT(a AND b) ≡ (NOT(a) OR NOT(b)) De Morgan
• NOT(a OR b) ≡ (NOT(a) AND NOT(b)) De Morgan
• (a AND (b OR c)) ≡ ((a AND b) OR (a AND c))
distributitivity
•(a OR (b AND c)) ≡ ((a OR b ) A
Lect ure 21 -
c)) distributitivity 15
Properties of
Operators
• P𝖠 Q= Q 𝖠 P, or
• Commutativity:

• P ∨ Q = Q ∨ P.

• (P 𝖠 Q) 𝖠 R= P 𝖠 (Q 𝖠 R),
• Associativity:

• (P ∨ Q) ∨ R= P ∨ (Q ∨ R)

• P 𝖠 True = P,
• Identity element:

• P ∨ True= True.

• P𝖠 (Q ∨ R) = (P 𝖠 Q) ∨ (P 𝖠
• Distributive:

• P ∨ (Q 𝖠 R) = (P ∨ Q) 𝖠 (P
R).

∨ R).

• ¬ (P 𝖠 Q) = (¬P) ∨ (¬Q)
• DE Morgan's Law:

• ¬ (P ∨ Q) = (¬ P) 𝖠 (¬Q).
• Double-negation elimination:
• ¬ (¬P) = P. Lecture 21- Propositional 52
Logic
Limitations of
Propositional logic
• We cannot represent relations like ALL, some, or
none with propositional logic. Example:
• All the girls are intelligent.
• Some apples are sweet.
• Propositional logic has limited expressive power.
• In propositional logic, we cannot describe
statements in terms of their properties or logical
relationships.

Lecture 21- Propositional 53


Logic
Converting
Assertions into
Logical Forms
• Sentence “He has an Ace if he does not have a
Knight or a Spade”
• ¬(k ∨ s) → a
• Where k = knight, s = spade and a = Ace
• Practice: You will get a slap , unless you stop
whining
•w → s

Lecture 21- Propositional 54


Logic
End

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