Lecture 6(Knowldege Representation)
Lecture 6(Knowldege Representation)
•Propositional Logic
• Predicate Logic
• Semantic Networks
• Frames
• Fuzzy Logic
Propositional Logic
• A formal method of reasoning, which represents
knowledge, allowing automated inference and
problem solving.
• Concepts are translated into symbolic
representations which closely approximate the
meaning. These symbolic structures can then be
manipulated in programs to deduce various
facts, to carry out a form of automated
reasoning.
• Propositional logic is the simplest.
• Symbols represent whole propositions (facts):
P, Q, R, S, etc..
• These are joined by logical connectives (and,
or, implication) e.g., P Q; Q R
• Given some statements in the logic we can
Propositional Logic:
Semantics
• Propositions
– Sentences and truth values
– Propositional connectives and their truth tables
• Negation: ~P
• Conjunction: P ۸ Q
• Disjunction: P ۷ Q (inclusive or)
• Implication: P → Q
• Equivalence: P ↔ Q
– Other propositional connectives
• P⊕Q (exclusive or), P↓Q (nor), P↑Q (nand),..
Propositional Logic
● Propositions are some elementary atomic
sentences. Propositions may be either true or false.
In propositional logic, a world is represented as
knowledge using a list of facts.
● Syntax of PL :
● symbol -> P | Q | R | S | ...
● atomic sentence -> TRUE | FALSE
● sentence -> atomic sentence | complex sentence
● complex sentences -> ~ sentence | (sentence ^ sentence) |
(sentence v sentence) | (sentence → sentence) |
● (sentence ↔ sentence)
f f f f t t t
f t f t t t f
t f f t f f f
t t t t f t t
Meaning of Statements
What would be the meaning of the following statement,
if some interpretation imply true to P, false to Q and
false to R ?:
((P & ~ Q) → R) ∨ Q
Assignments:
1. Find the meaning of the statement:
(~ P V Q) & R → S V (~ R & Q)
for each of the interpretations given below:
I1: P is true, Q is true, R is false, S is true.
I2: P is true, Q is false, R is true, S is true.
2. Determine whether each of the following
sentence is
(a) satisfiable (b) contradictory, or (c) valid
S1: (P & Q) V ~ (P & Q) S2: (P V Q) → (P & Q)
S3: (P & Q)→ R V~Q S4: (P V Q) & (P V ~Q) V P
S5: P →Q →~P S6: P V Q & ~P V ~Q & P
Meaning of Statements …
If the earth moves...
round the sun or the
sun moves round the earth, then
Copernicus might be a mathematician
but wasn’t an astronomer.
∴Q
P → Q, P {((P → Q) ∧ P) → Q}
● Modus Tollens
∴~ P
P → Q, ~ Q {((P → Q) ∧ ~ Q) → ~ P}
∴P → R
(P → Q) & (Q → R)
∴Q
(P V Q) ~ P
Drawbacks of PL
● Propositional logic isn’t powerful enough as a general
knowledge representation language.
● Impossible to make general statements. E.g., “all students
sit exams” or “if any student sits an exam they either pass
or fail”.
● So we need predicate logic..
Predicate Logic
• In predicate logic the basic unit is a predicate/
argument structure called an atomic sentence:
• LIKES (azad, chocolate)
• TALL (habib)
• Arguments can be any of:
• constant symbol, such as ‘azad’
• variable symbol, such as x
• function expression, e.g., FATHER_OF (hasan)
• So we can have:
• LIKES (X, chocolate)
• FRIENDS (FATHER_OF (rita), FATHER_OF (choiti))
Syntax of Predicate Logic
• These atomic sentences can be combined
using logic connectives
• LIKES (rita, hasan) TALL (hasan)
• BASKET_BALL_PLAYER (hasan) TALL (hasan)
• Sentences can also be formed using
quantifiers
• x LOVELY (x) Everything is lovely.
• x LOVELY (x) Something is lovely.
• x IN (x, garden) LOVELY (x) Everything in
the garden is lovely.
Predicate Logic: Examples ...
● All employees earning TK. 30,000 or more per year
pay taxes.
∀x ((E(x) & GE (i (x), 30000)) → T(x)
● Some employees are sick today
y ((E(y) → S(y))
● No employee earns more than the president
∀x ∀y ((E(x) & P(y)) → ~GE((i (x), i (y)))
Logic
• Can have several quantifiers, e.g.,
• x y LOVES (x, y)
• x HANDSOME (x) y LOVES (y, x)
• So we can represent things like:
• All men are mortal.
• No one likes hartal.
• Everyone taking AI will pass their exams.
• Every race has a winner.
• Sajjad likes everyone who is tall.
• Rita doesn’t like anyone who prefers arguments.
• There is something small and slimy on the table.
Logic
• There is a precise meaning to expressions in
predicate logic.
• Like in propositional logic, it is all about
determining whether something is true or false.
• x P(x) means that P(x) must be true for every
object x in the domain of interest.
• x P(x) means that P(x) must be true for at least
one object x in the domain of interest.
• So if we have a domain of interest consisting of
just two people, Hasan and Belal, and we know
that TALL(hasan) and TALL(belal) are true, we
can say that x TALL(x) is true.
Semantic Net
● An long existing notion: there are different pieces of knowledge of
world, and they are all linked together through certain semantics.
• knowledge is expressed as a collection of concepts,
represented by nodes (shown as boxes in the diagram),
connected together by relationships, represented by arcs
(shown as arrows in the diagram).
• certain arcs - particularly isa arcs - allow inheritance of
properties.
Basic Components
• Nodes studen
• Represent concepts t
IS-A
• Arcs
• Represent relations FRIEND-
hasan OF
AGE
• Labels for nodes and
arcs 21 rita
Semantic Net
● Common arcs used for representing hierarchies include isa and
has-part.
Example:
The Queen Mary is an ocean liner.
Every ocean liner is a ship
ship
IS-A
Ocean_liner
IS-A
Queen_mary
Semantic Net …..
Common arcs used for representing hierarchies include isa and
has-part.
HAS-PART
IS-A SHIP
An long
existing
notion:
there are
different
pieces of
knowledge
of world, and
they are all
linked together
through certain
semantics.
Knowledge Representation:
Semantic Net
• Advantages:
• Easy to follow hierarchy, easy to trace association, flexible
• Disadvantages:
• Meaning attached to nodes might be ambiguous
• exception handling is difficult
• difficult to program
Semantic Nets …
▪ Problems with semantic nets
▪ logical inadequacy - vagueness about what types
and tokens really mean.
▪ heuristic inadequacy – finding a specific piece of
information could be chronically inefficient.
▪ trying to establish negation is likely to lead to a
combinatorial explosion.
▪ "spreading activation" search is very inefficient,
because it is not knowledge-guided.
Frames
• Devised by Marvin Minsky, 1975.
• Incorporates certain valuable human thinking
characteristics:
• Expectations, assumptions, stereotypes. Exceptions. Fuzzy
boundaries between classes.
• The essence of this form of knowledge representation is
typicality, with exceptions, rather than definition.
• a data structure for representing a stereotyped situation
• a network of nodes and relations organized in a hierarchy
• the topmost nodes - general concepts
• the lower nodes - more specific instances
‘Toyota’
Name: Toyota Subclass of: car subclass_of
car
Slots: with
Name: Value: Restrictions: made_in:
‘Japan’.
made in Japan
“There is a particular type of Golf called a TDi, which runs on diesel,
has 4 cylinders, and has a 1.8 litre engine.”
cylinders 4
Logic