0% found this document useful (0 votes)
13 views25 pages

Unit 3 Ai - (Knowledge Representation)

The document discusses knowledge representation and reasoning (KRR) in artificial intelligence, emphasizing its importance for AI agents to understand and interact with the real world. It outlines various types of knowledge that need representation, approaches to knowledge representation, and introduces propositional and first-order logic as methods for formalizing knowledge. Additionally, it covers Prolog programming as a declarative language for implementing logical relationships and reasoning in AI systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views25 pages

Unit 3 Ai - (Knowledge Representation)

The document discusses knowledge representation and reasoning (KRR) in artificial intelligence, emphasizing its importance for AI agents to understand and interact with the real world. It outlines various types of knowledge that need representation, approaches to knowledge representation, and introduces propositional and first-order logic as methods for formalizing knowledge. Additionally, it covers Prolog programming as a declarative language for implementing logical relationships and reasoning in AI systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

UNIT 3

KNOWLEDGE REPRESENTATION

First Order Predicate Logic – Prolog Programming – Unification – Forward Chaining- Backward
Chaining – Resolution – Knowledge Representation – Ontological Engineering- Categories and Objects
– Events – Mental Events and Mental Objects – Reasoning Systems for Categories – Reasoning with
Default Information.

Humans are best at understanding, reasoning, and interpreting knowledge. Human knows things, which is knowledge
and as per their knowledge they perform various actions in the real world. But how machines do all these things
comes under knowledge representation and reasoning. Hence we can describe Knowledge representation as
following:

o Knowledge representation and reasoning (KRR) is the part of Artificial intelligence which concerned with AI
agents thinking and how thinking contributes to intelligent behaviour of agents.
o It is responsible for representing information about the real world so that a computer can understand and can
utilize this knowledge to solve the complex real-world problems such as diagnosis a medical condition or
communicating with humans in natural language.
o It is also a way which describes how we can represent knowledge in artificial intelligence. Knowledge
representation is not just storing data into some database, but it also enables an intelligent machine to
learn from that knowledge and experiences so that it can behave intelligently like a human.

Following are the kind of knowledge which needs to be represented in AI systems:

o Object: All the facts about objects in our world domain. E.g., Guitars contains strings, trumpets are brass
instruments.
o Events: Events are the actions which occur in our world.
o Performance: It describe behavior which involves knowledge about how to do things.
o Meta-knowledge: It is knowledge about what we know.
o Facts: Facts are the truths about the real world and what we represent.
o Knowledge-Base: The central component of the knowledge-based agents is the knowledge base. It is
represented as KB. The Knowledgebase is a group of the Sentences (Here, sentences are used as a technical
term and not identical with the English language).

The relation between knowledge and intelligence:

Knowledge of real-worlds plays a vital role in intelligence and same for creating artificial intelligence. Knowledge
plays an important role in demonstrating intelligent behaviour in AI agents. An agent is only able to accurately act on
some input when he has some knowledge or experience about that input.
Let's suppose if you met some person who is speaking in a language which you don't know, then how you will able to
act on that. The same thing applies to the intelligent behaviour of the agents.

As we can see in below diagram, there is one decision maker which act by sensing the environment and using
knowledge. But if the knowledge part will not present then, it cannot display intelligent behaviour.

Approaches to knowledge representation:

There are mainly four approaches to knowledge representation, which are givenbelow:

1. Simple relational knowledge:

o It is the simplest way of storing facts which uses the relational method, and each fact about a set of the object
is set out systematically in columns.
o This approach of knowledge representation is famous in database systems where the relationship between
different entities is represented.
o This approach has little opportunity for inference.

Example: The following is the simple relational knowledge representation.

Player Weight Age

Player1 65 23

Player2 58 18

Player3 75 24
2. Inheritable knowledge:

o In the inheritable knowledge approach, all data must be stored into a hierarchy of classes.
o All classes should be arranged in a generalized form or a hierarchal manner.
o In this approach, we apply inheritance property.
o Elements inherit values from other members of a class.
o This approach contains inheritable knowledge which shows a relation between instance and class, and it is
called instance relation.
o Every individual frame can represent the collection of attributes and its value.
o In this approach, objects and values are represented in Boxed nodes.
o We use Arrows which point from objects to their values.

Example:

3. Inferential knowledge:

o Inferential knowledge approach represents knowledge in the form of formal logics.


o This approach can be used to derive more facts.
o It guaranteed correctness.
o Example: Let's suppose there are two statements:

a. Marcus is a man

b. All men are mortal


Then it can represent as;
man(Marcus)
∀x = man (x) ----------> mortal (x)s

4. Procedural knowledge:
o Procedural knowledge approach uses small programs and codes which describes how to do specific things,
and how to proceed.
o In this approach, one important rule is used which is If-Then rule.
o In this knowledge, we can use various coding languages such as LISP language and Prolog language.
o We can easily represent heuristic or domain-specific knowledge using this approach.

o But it is not necessary that we can represent all cases in this approach.
o Propositional logic is also called Boolean logic as it works on 0 and 1.
o 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.
o Propositions can be either true or false, but it cannot be both.
o Propositional logic consists of an object, relations or function, and logical connectives.
o These connectives are also called logical operators.
o The propositions and connectives are the basic elements of the propositional logic.
o Connectives can be said as a logical operator which connects two sentences.
o A proposition formula which is always true is called tautology, and it is also called a valid sentence.
o A proposition formula which is always false is called Contradiction.
o A proposition formula which has both true and false values is called
o Statements which are questions, commands, or opinions are not propositions such as "Where is Rohini",
"How are you", "What is your name", are not propositions.

Syntax of propositional logic:

The syntax of propositional logic defines the allowable sentences for the knowledge representation. There are two
types of Propositions:

a. Atomic Propositions

b. Compound propositions

o 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:

1. a) 2+2 is 4, it is an atomic proposition as it is a true fact.


2. b) "The Sun is cold" is also a proposition as it is a false fact.
o Compound proposition: Compound propositions are constructed by combining simpler or atomic
propositions, using parenthesis and logical connectives.

Example:

1. a) "It is raining today, and street is wet."


2. b) "Ankit is a doctor, and his clinic is in Mumbai."
Logical Connectives:

Logical connectives are used to connect two simpler propositions or representing a sentence logically. We can create
compound propositions with the help of logical connectives. There are mainly five connectives, which are given as
follows:

1. Negation: A sentence such as ¬ P is called negation of P. A literal can be either Positive literal or negative
literal.
2. Conjunction: A sentence which has ∧ connective such as, P ∧ Q is called a conjunction.
Example: Rohan is intelligent and hardworking. It can be written as,
P= Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q.
3. Disjunction: A sentence which has ∨ connective, such as P ∨ Q. is called disjunction, where P and Q are the
propositions.
Example: "Ritika is a doctor or Engineer",
Here P= Ritika is Doctor. Q= Ritika is Doctor, so we can write it as P ∨ Q.
4. Implication: A sentence such as P → Q, is called an implication. Implications are also known as if-then rules.
It can be represented as
If it is raining, then the street is wet.
Let P= It is raining, and Q= Street is wet, so it is represented as P → Q
5. Biconditional: A sentence such as P⇔ Q is a Biconditional sentence, example If I am breathing, then I
am alive
P= I am breathing, Q= I am alive, it can be represented as P ⇔ Q.

Propositional logic in Artificial intelligence

Propositional logic (PL) is the simplest form of logic where all the statements are made by 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.

Example:

1. a) It is Sunday.
2. b) The Sun rises from West (False proposition)
3. c) 3+3= 7(False proposition)
4. d) 5 is a prime number.

Following are some basic facts about propositional logic:

First-Order Logic in Artificial intelligence

In the topic of Propositional logic, we have seen that how to represent statements using propositional logic. But
unfortunately, in propositional logic, we can only represent the facts, which are either true or false. PL is not
sufficient to represent the complex sentences or natural language statements. The propositional logic has very limited
expressive power. Consider the following sentence, which we cannot represent using PL logic.

o "Some humans are intelligent", or


o "Sachin likes cricket."

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, squares, pits, wumpus, ......
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:

a. Syntax

b. Semantics

Syntax of First-Order logic:

The syntax of FOL determines which collection of symbols is a logical expression in first-order logic. The basic
syntactic elements of first-order logic are symbols. We write statements in short-hand notation in FOL.
Basic Elements of First-order logic:

Following are the basic elements of FOL syntax:

Constant 1, 2, A, John, Mumbai, cat,....

Variables x, y, z, a, b,....

Predicates Brother, Father, >,....

Function sqrt, LeftLegOf, ....

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:

o Complex sentences are made by combining atomic sentences using connectives.

First-order logic statements can be divided into two parts:

o Subject: Subject is the main part of the statement.


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.
Quantifiers in First-order logic:
o A quantifier is a language element which generates quantification, and quantification specifies the quantity of
specimen in the universe of discourse.
o These are the symbols that permit to determine or identify the range and scope of the variable in the logical
expression. There are two types of quantifier:

a. Universal Quantifier, (for all, everyone, everything)

b. Existential quantifier, (for some, at least one).

Universal Quantifier:

Universal quantifier is a symbol of logical representation, which specifies that the statement within its range is true
for everything or every instance of a particular thing.

The Universal quantifier is represented by a symbol ∀, which resembles an inverted A.

Note: In universal quantifier we use implication "→".

If x is a variable, then ∀x is read as:

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:
∀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.

Note: In Existential quantifier we always use AND or Conjunction symbol (∧).

If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:

o There exists a 'x.'


o For some 'x.'
o For at least one 'x.'

Example:

Some boys are intelligent.


∃x: boys(x) ∧ intelligent(x)

It will be read as: There are some x where x is a boy who is intelligent.

Points to remember:
o The main connective for universal quantifier ∀ is implication →.
o The main connective for existential quantifier ∃ is and ∧.

Properties of Quantifiers:
o In universal quantifier, ∀x∀y is similar to ∀y∀x.
o In Existential quantifier, ∃x∃y is similar to ∃y∃x.
o ∃x∀y is not similar to ∀y∃x.

Some Examples of FOL using quantifier:

1. All birds fly.


In this question the predicate is "fly(bird)."

∀x bird(x) →fly(x).
And since there are all birds who fly so it will be represented as follows.

2. Every man respects his parent.

Since there is every man so will use ∀, and it will be represented as follows:
In this question, the predicate is "respect(x, y)," where x=man, and y= parent.

∀x man(x) → respects (x, parent).

3. Some boys play cricket.

use ∃, and it will be represented as:


In this question, the predicate is "play(x, y)," where x= boys, and y= game. Since there are some boys so we will

∃x boys(x) → play(x, cricket).


4. Not all students like both Mathematics and Science.

Since there are not all students, so we will use ∀ with negation, so following representation for this:
In this question, the predicate is "like(x, y)," where x= student, and y= subject.

¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].

Prolog Programming

o Prolog stands for programming in logic. Prolog is a declarative language, which means that a program
consists of data based on the facts and rules (Logical relationship) rather than computing how to find a
solution. A logical relationship describes the relationships which hold for the given application.
o To obtain the solution, the user asks a question rather than running a program. When a user asks a question,
then to determine the answer, the run time system searches through the database of facts and rules.
o Prolog features are 'Logical variable', which means that they behave like uniform data structure, a
backtracking strategy to search for proofs, a pattern-matching facility, mathematical variable, and input and
out are interchangeable.
o To deduce the answer, there will be more than one way. In such case, the run time system will be asked to
find another solution. To generate another solution, use the backtracking strategy. Prolog is a weakly typed
language with static scope rules and dynamic type checking.
o In artificial intelligence applications, prolog is used. The artificial intelligence applications can be automated
reasoning systems, natural language interfaces, and expert systems. The expert system consists of an interface
engine and a database of facts. The prolog's run time system provides the service of an interface engine.
o A basic logic programming environment has no literal values. An identifier with upper case letters and other
identifiers denote variables. Identifiers that start with lower-case letters denote data values. The basic Prolog
elements are typeless. The most implementations of prolog have been enhanced to include integer value,
characters, and operations. The Mechanism of prolog describes the tuples and lists.

Syntax and Basic Fields:


In prolog, we declare some facts. These facts constitute the Knowledge Base of the system. We can query
against the Knowledge Base. We get output as affirmative if our query is already in the knowledge Base or
it is implied by Knowledge Base, otherwise we get output as negative. So, Knowledge Base can be
considered similar to database, against which we can query. Prolog facts are expressed in definite pattern.
Facts contain entities and their relation. Entities are written within the parenthesis separated by comma (, ).
Their relation is expressed at the start and outside the parenthesis. Every fact/rule ends with a dot (.). So, a
typical prolog fact goes as follows:
Format: relation (entity1, entity2, .... k’th entity).
Example:
friends (Seeta, Geeta).
singer(Sonu).
Odd_number(7).

Explanation:
These facts can be interpreted as:
Seeta and Geeta are friends.
Sonu is a singer.
7 is an odd number.
*Key Features :
1. Unification : The basic idea is, can the given terms be made to represent the same structure.
2. Backtracking : When a task fails, prolog traces backwards and tries to satisfy previous task.
3. Recursion: Recursion is the basis for any search in program.
Running queries :
A typical prolog query can be asked as :
Query 1: ?- singer(sonu).
Output: Yes.

Explanation : As our knowledge base contains the above fact, so output was 'Yes', otherwise it would have
been 'No'.

Query 2: ?- odd_number(7).
Output: No.

Explanation: As our knowledge base does not contain the above fact, so output was 'No'.

Advantages :
1. Easy to build database. Doesn’t need a lot of programming effort.
2. Pattern matching is easy. Search is recursion based.
3. It has built in list handling. Makes it easier to play with any algorithm involving lists.
Disadvantages :
1. LISP (another logic programming language) dominates over prolog with respect to I/O features.
2. Sometimes input and output is not easy.
Applications:
Prolog is highly used in artificial intelligence(AI). Prolog is also used for pattern matching over natural
language parse trees.

The applications of prolog are as follows:

o Specification Language
o Robot Planning
o Natural language understanding
o Machine Learning
o Problem Solving
o Intelligent Database retrieval
o Expert System
o Automated Reasoning

In Prolog, the program contains a sequence of one or more clauses. The clauses can run over many lines.
Using a dot character, a clause can be terminated. The clauses are of two types: facts and rules.

Facts, Rules and Queries

Symbols

Prolog expressions are comprised of the following truth-functional symbols, which have the same interpretation as in
the predicate calculus.

English Predicate Calculus PROLOG

and ^ ,

or v ;

if --> :-

not ~ not

Variables and Names

Variables begin with an uppercase letter. Predicate names, function names, and the names for objects must begin with
a lowercase letter. Rules for forming names are the same as for the predicate calculus.
mother_of
male
female
greater_than
socrates

Facts

A fact is a predicate expression that makes a declarative statement about the problem domain. Whenever a variable
occurs in a Prolog expression, it is assumed to be universally quantified. Note that all Prolog sentences must end
with a period.
likes(john, susie). /* John likes Susie */
likes(X, susie). /* Everyone likes Susie */
likes(john, Y). /* John likes everybody */
likes(john, Y), likes(Y, john). /* John likes everybody and everybody likes John */
likes(john, susie); likes(john,mary). /* John likes Susie or John likes Mary */
not(likes(john,pizza)). /* John does not like pizza */
likes(john,susie) :- likes(john,mary)./* John likes Susie if John likes Mary.

Rules

A rule is a predicate expression that uses logical implication (:-) to describe a relationship among facts. Thus a Prolog
rule takes the form
left_hand_side :- right_hand_side .

This sentence is interpreted as: left_hand_side if right_hand_side. The left_hand_side is restricted to a single,
positive, literal, which means it must consist of a positive atomic expression. It cannot be negated and it cannot
contain logical connectives.

This notation is known as a Horn clause. In Horn clause logic, the left hand side of the clause is the conclusion, and
must be a single positive literal. The right hand side contains the premises. The Horn clause calculus is equivalent to
the first-order predicate calculus.

Examples of valid rules:

friends(X,Y) :- likes(X,Y),likes(Y,X). /* X and Y are friends if they like each other */


hates(X,Y) :- not(likes(X,Y)). /* X hates Y if X does not like Y. */
enemies(X,Y) :- not(likes(X,Y)),not(likes(Y,X)). /* X and Y are enemies if they don't like each other */

Examples of invalid rules:

left_of(X,Y) :- right_of(Y,X) /* Missing a period */


likes(X,Y),likes(Y,X) :- friends(X,Y). /* LHS is not a single literal */
not(likes(X,Y)) :- hates(X,Y). /* LHS cannot be negated */

Queries

The Prolog interpreter responds to queries about the facts and rules represented in its database. The database is
assumed to represent what is true about a particular problem domain. In making a query you are asking Prolog
whether it can prove that your query is true. If so, it answers "yes" and displays any variable bindings that it made in
coming up with the answer. If it fails to prove the query true, it answers "No".

Whenever you run the Prolog interpreter, it will prompt you with ?-. For example, suppose our database consists of
the following facts about a fictitious family.
father_of(joe,paul).
father_of(joe,mary).
mother_of(jane,paul).
mother_of(jane,mary).
male(paul).
male(joe).
female(mary).
female(jane).

We get the following results when we make queries about this database. (I've added comments, enclosed in /*..*/, to
interpret each query.)

| ?- ['family.pl'].
compiling /home/ram/public_html/cpsc352/prolog/family.pl for byte code...
/home/ram/public_html/cpsc352/prolog/family.pl compiled, 9 lines read - 999 bytes written, 94

(10 ms) yes


| ?- listing.

mother_of(jane, paul).
mother_of(jane, mary).

male(paul).
male(joe).

female(mary).
female(jane).

father_of(joe, paul).
father_of(joe, mary).

(10 ms) yes


| ?- father_of(joe,paul).

true ?

yes
| ?- father_of(paul,mary).

no
| ?- father_of(X,mary).

X = joe

yes
| ?-

Closed World Assumption. The Prolog interpreter assumes that the database is a closed world -- that is, if it cannot
prove something is true, it assumes that it is false. This is also known as negation as failure -- that is, something is
false if PROLOG cannot prove it true given the facts and rules in its database. In this case, in may well be (in the real
world), that Paul is the father of Mary, but since this cannot be proved given the current family database, Prolog
concludes that it is false. So PROLOG assumes that its database contains complete knowledge of the domain it is
being asked about.

Prolog's Proof Procedure

In responding to queries, the Prolog interpreter uses a backtracking search, similar to the one we study in Chapter 3
of Luger. To see how this works, let's add the following rules to our database:
parent_of(X,Y) :- father_of(X,Y). /* Rule #1 */
parent_of(X,Y) :- mother_of(X,Y). /* Rule #2 */

And let's trace how PROLOG would process the query. Suppose the facts and rules of this database are arranged in
the order in which they were input.

?- parent_of(jane,mary).
parent_of(jane,mary) /* Prolog starts here and searches for a matching fact or rule. */

parent_of(X,Y) /* Prolog unifies the query with the rule #1 using {jane/X, mary/Y}, giving
parent_of(jane,mary) :- father_of(jane,mary) */

father_of(jane,mary) /* Prolog replaces LHS with RHS and searches. */


/* This fails to match father_of(joe,paul) and father_of(joe,mary), so this FAILS. */
/* Prolog BACKTRACKS to the other rule #2 and unifies with {jane/X, mary/Y}, so it matches parent_of(jane,mary)
:- mother_of(jane,mary) */
mother_of(jane,mary) /* Prolog replaces LHS with RHS and searches. */

YES. /* Prolog finds a match with a literal and so succeeds.

Unification

Resolution in FOL
Resolution is a theorem proving technique that proceeds by building refutation proofs, i.e., proofs by
contradictions. It was invented by a Mathematician John Alan Robinson in the year 1965.

Resolution is used, if there are various statements given, and we need to prove a conclusion from those
statements. Unification is a key concept in proofs by resolutions. Resolution is a single inference rule
which can efficiently operate on the conjunctive normal form or clausal form.

Clause: Disjunction of literals (an atomic sentence) is called a clause. It is also known as a unit clause.

Conjunctive Normal Form: A sentence represented as a conjunction of clauses is said to be conjunctive


normal form or CNF.
Steps for Resolution

1. Conversion of facts into first-order logic.


2. Convert FOL statements into CNF
3. Negate the statement which needs to prove (proof by contradiction)
4. Draw resolution graph (unification).

To better understand all the above steps, we will take an example in which we will
apply resolution.

Example
a. John likes all kind of food.
b. Apple and vegetable are food
c. Anything anyone eats and not killed is food.
d. Anil eats peanuts and still alive
e. Harry eats everything that Anil eats. Prove by resolution that:
f. John likes peanuts.

Step-1: Conversion of Facts into FOL

In the first step we will convert all the given statements into its first order logic.

Eliminate all implication (→) and rewrite


1. ∀x ¬ food(x) V likes(John, x)
2. food(Apple) Λ food(vegetables)
3. ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y)
4. eats (Anil, Peanuts) Λ alive(Anil)
5. ∀x ¬ eats(Anil, x) V eats(Harry, x)
6. ∀x¬ [¬ killed(x) ] V alive(x)
7. ∀x ¬ alive(x) V ¬ killed(x)
8. likes(John, Peanuts).
Move negation (¬)inwards and rewrite
1. ∀x ¬ food(x) V likes(John, x)
2. food(Apple) Λ food(vegetables)
3. ∀x ∀y ¬ eats(x, y) V killed(x) V food(y)
4. eats (Anil, Peanuts) Λ alive(Anil)
5. ∀x ¬ eats(Anil, x) V eats(Harry, x)
6. ∀x ¬killed(x) ] V alive(x)
7. ∀x ¬ alive(x) V ¬ killed(x)
8. likes(John, Peanuts).

Rename variables or standardize variables


1. ∀x ¬ food(x) V likes(John, x)
2. food(Apple) Λ food(vegetables)
3. ∀y ∀z ¬ eats(y, z) V killed(y) V food(z)
4. eats (Anil, Peanuts) Λ alive(Anil)
5. ∀w¬ eats(Anil, w) V eats(Harry, w)
6. ∀g ¬killed(g) ] V alive(g)
7. ∀k ¬ alive(k) V ¬ killed(k)
8. likes(John, Peanuts).

Eliminate existential instantiation quantifier by elimination. In this step, we will eliminate


existential quantifier ∃, and this process is known as Skolemization. But in this example problem
o

since there is no existential quantifier so all the statements will remain same in this step.

o Drop Universal quantifiers. In this step we will drop all universal quantifier since all the
statements are not implicitly quantified so we don't need it.

1. ¬ food(x) V likes(John, x)
2. food(Apple)
3. food(vegetables)
4. ¬ eats(y, z) V killed(y) V food(z)
5. eats (Anil, Peanuts)
6. alive(Anil)
7. ¬ eats(Anil, w) V eats(Harry, w)
8. killed(g) V alive(g)
9. ¬ alive(k) V ¬ killed(k)
10. likes(John, Peanuts).

o Distribute conjunction 𝖠 over disjunction ¬.This step will not make any change in
this problem.
Step-3: Negate the statement to be proved

In this statement, we will apply negation to the conclusion statements, which will be
written as ¬likes(John, Peanuts)

Step-4: Draw Resolution graph

o Now in this step, we will solve the problem by resolution tree using substitution. For
the above problem, it will be given as follows:

Explanation of Resolution graph

o In the first step of resolution graph, ¬likes(John, Peanuts), and likes(John, x) get resolved
(canceled) by substitution of {Peanuts/x}, and we are left with ¬ food(Peanuts)

o In the second step of the resolution graph, ¬ food (Peanuts), and food(z) get resolved
(canceled) by substitution of { Peanuts/z}, and we are left with ¬ eats(y, Peanuts) V
killed(y).

o In the third step of the resolution graph, ¬ eats(y, Peanuts) and eats (Anil, Peanuts)
get resolved by substitution {Anil/y}, and we are left with Killed(Anil).

o In the fourth step of the resolution graph, Killed(Anil) and ¬ killed(k) get resolve by
substitution {Anil/k}, and we are left with ¬ alive(Anil).

Figure 3.12

o In the last step of the resolution graph ¬ alive(Anil) and alive(Anil) get resolved.

Difference between Predicate Logic and Propositional Logic


S. No. Predicate logic Propositional logic
1. Predicate logic is a generalization of A preposition is a declarative statement
propositional logic that allows us to that’s either TRUE or FALSE (but not
express and infer arguments in infinite both).
models.
2. Predicate logic (also called predicate Propositional logic is an axiomatization
calculus and first-order logic) is an of Boolean logic. Propositional logic is
extension of propositional logic to decidable, for example by the method
formulas involving terms and of truth table.
predicates. The full predicate logic is
undecidable
3. Predicate logic have variables Propositional logic has variables.
Parameters are all constant.
4. A predicate is a logical statement that Propositional logic deals solely with
depends on one or more variables (not propositions and logical connectives.
necessarily Boolean variables)
5. Predicate logic there are objects, Proposition logic is represented in
properties, functions (relations) are terms of Boolean variables and logical
involved. connectives.
6. In predicate logic, we symbolize In propositional logic, we use letters to
subject and predicate separately. symbolize entire propositions.
Logicians often use lowercase letters to Propositions are statements of the form
symbolize subjects (or objects) and “x is y” where x is a subject and y is a
upper case letter to symbolize predicate.
predicates.
7. Predicate logic uses quantifies such as Prepositional logic has not qualifiers.
universal quantifier (“”), the
existential quantifier (“”).
8. Example Example
Everything is a green as “x Green(x)” Everything is a green as “G”
or or
“Something is blue as “ x Blue(x)”. “Something is blue as “B(x)”.
KNOWLEDGE REPRESENTATION ONTOLOGICAL ENGINEERING
Concepts such as Events, Time, Physical Objects, and Beliefs— that occur in many different
domains. Representing these abstract concepts is sometimes called ontological engineering.

Figure 3.13 The upper ontology of the world, showing the topics to be
covered later in the chapter. Each link indicates that the lower concept is a
specialization of the upper one. Specializations are not necessarily disjoint;
a human is both an animal and an agent, for example.

The general framework of concepts is called an upper ontology because of the convention of drawing
graphs with the general concepts at the top and the more specific concepts below them, as in Figure

Categories and Objects

The organization of objects into categories is a vital part of knowledge representation. Although
interaction with the world takes place at the level of individual objects, much reasoning takes place at the
level of categories.

For example, a shopper would normally have the goal of buying a basketball, rather than a
particular basketball such as BB9 There are two choices for representing categories in first-order logic:
predicates and objects. That is, we can use the predicate Basketball (b), or we can reify1 the category as an
object, Basketballs.
We could then say Member(b, Basketballs ), which we will abbreviate as b∈ Basketballs, to say

Basketballs ⊂ Balls, to say that Basketballs is a subcategory of Balls. Categories serve to organize and
that b is a member of the category of basketballs. We say Subset(Basketballs, Balls), abbreviated as

simplify the knowledge base through inheritance. If we say that all instances of the category Food are
edible, and if we assert that Fruit is a subclass of Food and Apples is a subclass of Fruit, then we can infer
that every apple is edible. We say that the individual apples inherit the property of edibility, in this case
from their membership in the Food category. First-order logic makes it easy to state facts about
categories, either by relating objects to categories or by quantifying over their members. Here are some
types of facts, with examples of each:

BB9 ∈ Basketballs
• An object is a member of a category.

• A category is a subclass of another category. Basketballs ⊂ Balls


• All members of a category have some properties.

(x∈ Basketballs) ⇒ Spherical (x)

• Members of a category can be recognized by some properties.


Orange(x) 𝖠 Round (x) 𝖠 Diameter(x)=9.5 𝖠 x∈ Balls ⇒ x∈
Basketballs
• A category as a whole has some properties.

Dogs ∈ Domesticated Species

Notice that because Dogs is a category and is a member of Domesticated Species, the latter
must be a category of categories. Categories can also be defined by providing necessary and
sufficient conditions for membership. For example, a bachelor is an unmarried adult male:

x∈ Bachelors ⇔ Unmarried(x) 𝖠 x∈ Adults 𝖠 x∈ Males

Physical Composition

We use the general PartOf relation to say that one thing is part of another. Objects can be
grouped into part of hierarchies, reminiscent of the Subset hierarchy:

PartOf (Bucharest, Romania)


PartOf(Romania,EasternEurope)
PartOf(EasternEurope, Europe) PartOf (Europe,
Earth)
The PartOf relation is transitive and reflexive; that is, PartOf (x, y)
𝖠PartOf (y, z) ⇒PartOf (x, z)

PartOf (x, x)

Therefore, we can conclude PartOf (Bucharest, Earth).For example, if the apples are Apple1, Apple2, and
Apple3, then
BunchOf ({Apple1,Apple2,Apple3})

denotes the composite object with the three apples as parts (not elements). We can define
BunchOf in terms of the PartOf relation. Obviously, each element of s is part of

BunchOf (s): ∀x x∈ s ⇒PartOf (x, BunchOf (s)) Furthermore, BunchOf (s) is the smallest
object satisfying this condition. In other words, BunchOf (s) must be part of any object that
has all the elements of s as parts:

∀y [∀x x∈ s ⇒PartOf (x, y)] ⇒PartOf (BunchOf (s), y)


Measurements

In both scientific and commonsense theories of the world, objects have height, mass, cost, and
so on. The values that we assign for these properties are called measures.
Length(L1)=Inches(1.5)=Centimeters(3.81)

Conversion between units is done by equating multiples of one unit to another:


Centimeters(2.54 ×d)=Inches(d)

Similar axioms can be written for pounds and kilograms, seconds and days, and dollars and
cents. Measures can be used to describe objects as follows:

Diameter (Basketball12)=Inches(9.5) ListPrice(Basketball12)=$(19)

d∈ Days ⇒ Duration(d)=Hours(24)

Time Intervals

Event calculus opens us up to the possibility of talking about time, and time intervals. We
will consider two kinds of time intervals: moments and extended intervals. The distinction is
that only moments have zero duration:

Partition({Moments,ExtendedIntervals}, Intervals ) i∈Moments⇔Duration(i)=Seconds(0)

The functions Begin and End pick out the earliest and latest moments in an interval, and the
function Time delivers the point on the time scale for a moment.
The function Duration gives the difference between the end time and the start time.

Interval (i) ⇒Duration(i)=(Time(End(i)) − Time(Begin(i)))


Time(Begin(AD1900))=Seconds(0)

Time(Begin(AD2001))=Seconds(3187324800)

Time(End(AD2001))=Seconds(3218860800)

Duration(AD2001)=Seconds(31536000)

Two intervals Meet if the end time of the first equals the start time of the second. The
complete set of interval relations, as proposed by Allen (1983), is shown graphically in
Figure
12.2 and logically below:

Meet(i,j) ⇔ End(i)=Begin(j)

Before(i,j) ⇔ End(i) < Begin(j)

After (j,i) ⇔ Before(i, j)

During(i,j) ⇔ Begin(j) < Begin(i) < End(i) < End(j)


Overlap(i,j) ⇔ Begin(i) < Begin(j) < End(i) <
End(j) Begins(i,j) ⇔ Begin(i) = Begin(j)

Finishes(i,j) ⇔ End(i) = End(j)

Equals(i,j) ⇔ Begin(i) = Begin(j) 𝖠 End(i) = End(j)

Figure 3.14 Predicates on time intervals

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