KnowledgeRepresentation PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Logic in general

• Logics are formal languages for representing information


such that conclusions can be drawn
• Syntax defines the sentences in the language
Propositional • Semantics define the "meaning" of sentences;
– i.e., define truth of a sentence in a world

Logic • E.g., the language of arithmetic


– x+2 ≥ y is a sentence;
– x2+y > {} is not a sentence

Knowledge bases Propositional Logic Concepts


• Knowledge base = set of sentences in a formal language
 Logic is a study of principles used to
− distinguish correct from incorrect reasoning.
• Declarative approach to building an agent (or other system):
–Tell it what it needs to know
 A proposition in logic is a declarative statements which is
either true or false (but not both) in a given context.
• Then it can Ask itself what to do
– answers should follow from the KB
For example,
− “It is hot today”,
− " It is humid " etc.

1
Propositional Logic Concepts Simple & Compound Propositions

 Given some propositions to be true in a given context, • Fast foods tend to be unhealthy.
− logic helps in inferencing new proposition, which is also true in • Parakeets are colorful birds.
the same context.

• If fast foods tend to be unhealthy, then you shouldn’t eat them.


 Suppose we are given a set of propositions such as
− “It is hot today" and • Parakeets are colorful birds, and colorful birds are good to have
− “If it is hot it will rain", then at home.
− we can infer that
− “It will rain today".

Wumpus World Reasoning in the Wumpus World


• Wumpus can be shot, only 1 arrow
– Shoot: arrow goes forward • Agent has initial ignorance about the configuration
– Agent knows his/her initial location
• Bottomless pits and pot of gold
– Agent knows the rules of the environment

• Agent can move forward, turn left or


• Goal is to explore environment, make inferences (reasoning) to
turn right
try to find the gold.
• Sensors:
– Stench inside and next to wumpus
– Breeze next to pit • Random instantiations of this problem used to test agent reasoning
– Glitter in square with gold and decision algorithms
– Bump when agent moves into a wall
– Scream from wumpus when it is killed (applications? “intelligent agents” in computer games)

2
Exploring the Wumpus World Exploring the Wumpus World

The KB initially contains the rules of the environment.


[2,1] = breeze , B21

[1,1] The first percept is [none, none,none,none,none], indicates that there is a pit in [2,2] or [3,1],

move to safe cell e.g. 2,1 return to [1,1] to try next safe cell

Exploring the Wumpus World Well-formed formula


− An atom is a well-formed formula.
• Some atomic propositions: − If  is a well-formed formula, then  is a well-formed
S12 = There is a stench in cell (1,2)
B34 = There is a breeze in cell (3,4)
formula.
W22 = The Wumpus is in cell (2,2)
V11 = We have visited cell (1,1) − If  and  are well formed formulae, then (  ), ( V  ),
OK11 = Cell (1,1) is safe. (  ), (   ) are also well-formed formulae.
Etc

− It is a finite sequence of symbols from a given alphabet that is


part of formal language.

3
Propositional Logic Propositional Logic
• A simple language useful for showing key ideas and definitions
• Logical constants: true, false • User defines a set of propositional symbols, like P and Q.
• Propositional symbols: P, Q, S, ... (atomic sentences) • User defines the semantics of each propositional symbol:
• Wrapping parentheses: ( … ) • P means “It is hot.”
• Sentences are combined by connectives: • Q means “It is humid.”
 ...and [conjunction] • R means “It is raining.”
• (P  Q)  R
 ...or [disjunction]
• “If it is hot and humid, then it is raining”
...implies [implication / conditional] • QP
 ..is equivalent [biconditional] • “If it is humid, then it is hot”

 ...not [negation]
• Literal: atomic sentence or negated atomic sentence

Truth tables
Truth tables II
The five logical connectives:

A complex sentence:

4
Models of complex sentences Inference rules
• Logical inference is used to create new sentences that logically
follow from a given set of predicate calculus sentences (KB).

• An inference rule is sound if every sentence X produced by an


inference rule operating on a KB logically follows from the KB.
(That is, the inference rule does not create any contradictions)

Sound rules of inference Sound rules of inference


• Here are some examples of sound rules of inference RULE PREMISE CONCLUSION

– A rule is sound if its conclusion is true whenever the premise is true Modus Ponens A, A  B B

• Following rules can be shown to be sound using a truth table From an implication and the premise of the implication, you can
RULE PREMISE CONCLUSION infer the conclusion.
Modus Ponens A, A  B B
And Introduction A, B AB
And Elimination AB A
Double Negation A A
Unit Resolution A  B, B A
Resolution A  B, B  C AC

5
Sound rules of inference Sound rules of inference
RULE PREMISE CONCLUSION RULE PREMISE CONCLUSION
And Introduction A, B AB And Elimination AB A

From a list of sentences, one can infer their conjunction From a conjunction, one can infer any of the conjuncts.

Sound rules of inference Sound rules of inference


RULE PREMISE CONCLUSION RULE PREMISE CONCLUSION
Double Negation A A Resolution A  B, B  C AC

Unit Resolution A  B, B A B can’t be both true an false, one of the other disjuncts must be
true in one of the premises. Or equivalently, implicative is
From a disjunction, if one of the disjuncts is false, then one can transitive.
infer the other one is true.
A  B, B  C A  C

6
Exploring the Wumpus World
After the third move
• Some atomic propositions:
S12 = There is a stench in cell (1,2)
• We can prove that the
B34 = There is a breeze in cell (3,4) Wumpus is in (1,3) using
W22 = The Wumpus is in cell (2,2) the four rules given.
V11 = We have visited cell (1,1)
OK11 = Cell (1,1) is safe.
etc
• Some rules:
(R1) S11  W11   W12   W21
(R2)  S21  W11   W21   W22   W31
(R3)  S12  W11   W12   W22   W13
(R4) S12  W13  W12  W22  W11
Etc

Proving W13 Proving W13


• Apply MP with S11 and R1: • Apply MP with S11 and R1:
 W11   W12   W21  W11   W12   W21
• Apply And-Elimination to this, yielding 3 sentences: • Apply And-Elimination to this, yielding 3 sentences:
 W11,  W12,  W21  W11,  W12,  W21
• Apply MP to  S21 and R2, then apply And-elimination:
 W22,  W21,  W31
• Apply MP to S12 and R4 to obtain:
W13  W12  W22  W11
• Apply Unit resolution on (W13  W12  W22  W11) and W11:
W13  W12  W22
• Apply Unit Resolution with (W13  W12  W22) and W22:
W13  W12
• Apply Unit Resolution with (W13  W12) and W12:
W13

7
Limitations of Propositional Logic Formal Languages and Commitments
Language Ontological Epistemological
• number of propositions Commitment Commitment
– since everything has to be spelled out explicitly, the number of rules is (“what is”) (“what can be known”)
immense Propositional Logic facts true, false, unknown
• Can’t directly talk about properties of individuals or relations
between individuals (e.g., “Bill is tall”) First-order Logic facts, objects, true, false, unknown
relations
• dealing with change (monotonicity) Temporal Logic facts, objects, true, false, unknown
– even in very simple worlds, there is change relations, times
– the agent’s position changes
– time-dependent propositions and rules can be used Probability Theory facts degree of belief
• even more propositions and rules ∈ [0,1]

Fuzzy Logic facts with degree of known interval value


truth ∈ [0,1]

Beyond Propositional Logic


• Propositional logic not expressive enough
– In Wumpus world we needed to explicitly write every
case of Breeze & Pit relation
– Facts = propositions
– “All squares next to pits are breezy”

• First order logic

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