Unit 4 Knowledge Representation
Unit 4 Knowledge Representation
1
Types of logic: Different types of logics are: Propositional logic and Predicate logic (First
–order Predicate Logic).
Propositional logic
- A propositional logic is a declarative sentence which can be either true or false but not
both or either.
- Propositional logic is a mathematical model that allows us to reason about the truth or
falsehood of logical expression.
- In propositional logic, there are atomic sentences and compound sentences built up from
atomic sentences using logical connectives.
Formal Logical Connectives
In logic, a logical connective (also called a logical operator) is a symbol or word used to
connect two or more sentences (of either a formal or a natural language) in a grammatically
valid way, such that the sense of the compound sentence produced depends only on the
original sentences. The most common logical connectives are binary connectives (also
called dyadic connectives) which join two sentences which can be thought of as the
function's operands. Also commonly, negation is considered to be a unary connective.
Logical connectives along with quantifiers are the two main types of logical constants used
in formal systems such as propositional logic and predicate logic.
List of Logical connectives
2
i. Atomic sentences: – Constructed from constants and propositional symbols – True, False
are atomic sentences. Light in the room is on. It rains outside are (atomic) sentences.
ii. Composite sentences: – Constructed from valid sentences via connectives eg: ( A ∧
B) ( A ∨ B ) ( A ⇒ B ) ( A ⇔ B) ( A ∨ B ) ∧ ( A ∨ ¬ B )
Propositional logic is the simplest logic. We use the symbols like P1, P2 to represent
sentences. A sentence (well-formed formula) is defined as follows
3
Limitations of Propositional logic:
o We cannot represent relations like ALL, some, or none with propositional logic.
Example:
1. All the girls are intelligent.
2. Some apples are sweet.
o Propositional logic has limited expressive power.
o In propositional logic, we cannot describe statements in terms of their properties
or logical relationships.
Tautology/Validity
Satisfiability
A sentence is satisfiable if it is true in some model
(OR)
Contradiction/Unsatisfiable
A sentence is unsatisfiable whose truth values are always false.
4
Equivalence rule:
5
or natural language statements. The propositional logic has very limited expressive power.
Consider the following sentence, which we cannot represent using PL logic.
To represent the above statements, PL logic is not sufficient, so we required some more
powerful logic, such as first-order logic.
First-Order logic:
o First-order logic is another way of knowledge representation in artificial intelligence. It is
an extension to propositional logic.
o FOL is sufficiently expressive to represent the natural language statements in a concise
way.
o First-order logic is also known as Predicate logic or First-order predicate logic. First-
order logic is a powerful language that develops information about the objects in a more
easy way and can also express the relationship between those objects.
o First-order logic (like natural language) does not only assume that the world contains facts
like propositional logic but also assumes the following things in the world:
o Objects: A, B, people, numbers, colors, wars, theories,......
o Relations: It can be unary relation such as: red, round, is adjacent, or n-any
relation such as: the sister of, brother of, has color, comes between
o Function: Father of, best friend, third inning of, end of, ......
o As a natural language, first-order logic also has two main parts:
o Syntax
o Semantics
6
Basic Elements of First-order logic:
Following are the basic elements of FOL syntax:
Variables x, y, z, a, b,....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
Atomic sentences:
o Atomic sentences are the most basic sentences of first-order logic. These sentences are
formed from a predicate symbol followed by a parenthesis with a sequence of terms.
o We can represent atomic sentences as Predicate (term1, term2, ......, term n).
Example: Ravi and Ajay are brothers: => Brothers (Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
Complex Sentences:
7
o Predicate: A predicate can be defined as a relation, which binds two atoms together in a
statement.
Consider the statement: "x is an integer.", it consists of two parts, the first part x is the
subject of the statement and second part "is an integer," is known as a predicate.
Universal Quantifier:
o For all x
o For each x
o For every x.
Example:
All man drink coffee.
Let a variable x which refers to a cat so all x can be represented in UOD as below
8
∀x man(x) → drink (x, coffee).
It will be read as: There are all x where x is a man who drink coffee.
Existential Quantifier:
Existential quantifiers are the type of quantifiers, which express that the statement within
its scope is true for at least one instance of something.
It is denoted by the logical operator ∃, which resembles as inverted E. When it is used with
a predicate variable then it is called as an existential quantifier.
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
Example:
Some boys are intelligent
9
Some Examples of FOL using quantifier:
In this question, the predicate is "respect (x, y)," where x=man, and y= parent.
Since there is every man so will use ∀, and it will be represented as follows:
∀x man(x) → respects (x, parent).
In this question, the predicate is "play (x, y)," where x= boys, and y= game. Since there
are some boys so we will use ∃, and it will be represented as:
∃x boys(x) → play (x, cricket).
10
Since there are not all students, so we will use ∀ with negation, so following
representation
forthis:
¬∀ (x) [ student(x) → like (x, Mathematics) ∧ like(x, Science)]
Existential quantification: • Often associated with English words ―someone, ―sometimes, etc. –
Syntax: – Example: Someone at university is smart: x At(x, university) Smart(x)
Switching the order of multiple universal quantifiers does not change the meaning;
For example, ―Brothers are siblings‖ can be written as ∀ x ∀ y Brother (x, y) ⇒ Sibling(x, y)
Switching the order of multiple existential quantifiers does not change the meaning.
Switching the order of a universal quantifier and an existential quantifier does change meaning.
11
# Convert the following to the language of predicate logic.
Semantics Network
12
An arcs (link) represent relationship between nodes. There are some standard relationship
types
“Is a”(instance relationship): represent class/instance relationship
“has a”(parts- subparts relationship):identify property relationship
13