Knowledge Representation Using First-Order Logic
Knowledge Representation Using First-Order Logic
First-Order Logic
Chapter 8
Outline
• Using FOL
• Find Wumpus
• Sx,y (Wx,y+1 Wx,y-1 Wx+1,y Wx-1,y) (stench next to Wumpus) 16 rules
• Relations: red, round, prime, brother of, bigger than, part of,
comes between, …
• Ontological Commitment:
• What exists in the world — TRUTH
• PL : facts hold or do not hold.
• FOL : objects with relations between them that hold or do not hold
• Epistemological Commitment:
• What an agent believes about facts — BELIEF
Syntax of FOL: Basic elements
• Constant Symbols:
• Stand for objects
• e.g., KingJohn, 2, UCI,...
• Predicate Symbols
• Stand for relations
• E.g., Brother(Richard, John), greater_than(3,2)...
• Function Symbols
• Stand for functions
• E.g., Sqrt(3), LeftLegOf(John),...
Syntax of FOL: Basic elements
• Variables x, y, a, b,...
• Connectives , , , ,
• Equality =
• Quantifiers ,
Relations
Registration
RA
s-id c.id Grade Satisfaction
s-id p-id Salary Capability Jack 101 A 1
Jack Oliver High 3 Jack 102 B 2
Kim Oliver Low 1 Kim 102 A 1
Paul Jim Med 2 Paul 101 B 1
21
Terms
• Term = logical expression that refers to an object.
• Examples:
LargerThan(2,3) is false.
Brother_of(Mary,Pete) is false.
Married(Father(Richard), Mother(John)) could be true or false
• Brother_of(Pete,Brother(Pete)) is True.
It will be read as: There are some x where x is a boy who is intelligent
Complex Sentences
• We make complex sentences with connectives (just like in
propositional logic).
property
binary function
relation
objects
connectives
More Examples
• Brother(Richard, John) Brother(John, Richard)
• King(Richard) King(John)
• Allows us to make statements about all objects that have certain properties
Note that
x King(x) Person(x) is not correct!
This would imply that all objects x are Kings and are People
• Examples:
x King(x)
x Lives_in(John, Castle(x))
i Integer(i) GreaterThan(i,0)
y x Loves(x,y)
- there is someone (“y”) who is loved by everyone
In effect:
- is a conjunction over the universe of objects
- is a disjunction over the universe of objects
Thus, DeMorgan’s rules can be applied
De Morgan’s Law for Quantifiers
What is knowledge-engineering?
In this topic, we will understand the Knowledge engineering process in an electronic circuit domain,
which is already familiar. This approach is mainly suitable for creating special-purpose knowledge
base.
Following are some main steps of the knowledge-engineering process. Using these steps, we will
develop a knowledge base which will allow us to reason about digital circuit (One-bit full adder)
which is given below
1. Identify the task:
The first step of the process is to identify the task, and for the digital circuit, there are various
reasoning tasks.
Skip Ad
At the first level or highest level, we will examine the functionality of the circuit:
At the second level, we will examine the circuit structure details such as:
In the second step, we will assemble the relevant knowledge which is required for digital circuits. So
for digital circuits, we have the following required knowledge:
3. Decide on vocabulary:
The next step of the process is to select functions, predicate, and constants to represent the circuits,
terminals, signals, and gates. Firstly we will distinguish the gates from each other and from other
objects. Each gate is represented as an object which is named by a constant, such as, Gate(X1). The
functionality of each gate is determined by its type, which is taken as constants such as AND, OR,
XOR, or NOT. Circuits will be identified by a predicate: Circuit (C1).
For gate input, we will use the function In(1, X1) for denoting the first input terminal of the gate,
and for output terminal we will use Out (1, X1).
The function Arity(c, i, j) is used to denote that circuit c has i input, j output.
The connectivity between gates can be represented by predicate Connect(Out(1, X1), In(1, X1)).
We use a unary predicate On (t), which is true if the signal at a terminal is on.
4. Encode general knowledge about the domain:
To encode the general knowledge about the logic circuit, we need some following rules:
o If two terminals are connected then they have the same input signal, it can be represented as:
5. Encode a description of the problem instance:
Now we encode problem of circuit C1, firstly we categorize the circuit and its gate components. This step is easy if
ontology about the problem is already thought. This step involves the writing simple atomics sentences of instances
of concepts, which is known as ontology.
For the given circuit C1, we can encode the problem instance in atomic sentences as below:
Since in the circuit there are two XOR, two AND, and one OR gate so atomic sentences for these gates will be: