Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Knowledge Representation and Reasoning - Artificial Intelligence - Lecture Notes, Study notes of Artificial Intelligence

Main points of this lecture are: Knowledge, Representation, Reasoning, Types, Inference, Facts, Rule, Strategies.

Typology: Study notes

2011/2012
On special offer
30 Points
Discount

Limited-time offer


Uploaded on 10/24/2012

alia_maru
alia_maru 🇮🇳

4.5

(39)

58 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
94
Artificial Intelligence
Handouts Lectures 15 - 17
1 Knowledge Representation and Reasoning
Now that have looked at general problem solving, lets look at knowledge
representation and reasoning which are important aspects of any artificial
intelligence system and of any computer system in general. In this section we will
become familiar with classical methods of knowledge representation and reasoning
in AI.
1.1 The AI Cycle
Almost all AI systems have the following components in general:
Perception
Learning
Knowledge Representation and Reasoning
Planning
Execution
Figure 1 shows the relationship between these components.
An AI system has a perception component that allows the system to get information
from its environment. As with human perception, this may be visual, audio or other
forms of sensory information. The system must then form a meaningful and useful
representation of this information internally. This knowledge representation maybe
static or it may be coupled with a learning component that is adaptive and draws
trends from the perceived data.
Figure 1: The AI Cycle
PERCEPTION
LEARNING
KNOWLEDGE
REPRESENTATION
(KR) REASONING
PLANNING
EXECUTION
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
Discount

On special offer

Partial preview of the text

Download Knowledge Representation and Reasoning - Artificial Intelligence - Lecture Notes and more Study notes Artificial Intelligence in PDF only on Docsity!

Artificial Intelligence

Handouts Lectures 15 - 17

1 Knowledge Representation and Reasoning

Now that have looked at general problem solving, lets look at knowledge representation and reasoning which are important aspects of any artificial intelligence system and of any computer system in general. In this section we will become familiar with classical methods of knowledge representation and reasoning in AI.

1.1 The AI Cycle

Almost all AI systems have the following components in general:

  • Perception
  • Learning
  • Knowledge Representation and Reasoning
  • Planning
  • Execution

Figure 1 shows the relationship between these components.

An AI system has a perception component that allows the system to get information from its environment. As with human perception, this may be visual, audio or other forms of sensory information. The system must then form a meaningful and useful representation of this information internally. This knowledge representation maybe static or it may be coupled with a learning component that is adaptive and draws trends from the perceived data.

Figure 1: The AI Cycle

PERCEPTION

LEARNING

KNOWLEDGE REPRESENTATION (KR)

REASONING

PLANNING

EXECUTION

Knowledge representation (KR) and reasoning are closely coupled components; each is intrinsically tied to the other. A representation scheme is not meaningful on its own; it must be useful and helpful in achieve certain tasks. The same information may be represented in many different ways, depending on how you want to use that information. For example, in mathematics, if we want to solve problems about ratios, we would most likely use algebra, but we could also use simple hand drawn symbols. To say half of something, you could use 0.5x or you could draw a picture of the object with half of it colored differently. Both would convey the same information but the former is more compact and useful in complex scenarios where you want to perform reasoning on the information. It is important at this point to understand how knowledge representation and reasoning are interdependent components, and as AI system designer, you have to consider this relationship when coming up with any solution.

1.2 The dilemma

The key question when we begin to think about knowledge representation and reasoning is how to approach the problem ----should we try to emulate the human brain completely and exactly as it is? Or should we come up with something new?

Since we do not know how the KR and reasoning components are implemented in humans, even though we can see their manifestation in the form of intelligent behavior, we need a synthetic (artificial) way to model the knowledge representation and reasoning capability of humans in computers.

1.3 Knowledge and its types

Before we go any further, lets try to understand what ‘knowledge’ is. Durkin refers to it as the “Understanding of a subject area”. A well-focused subject area is referred to as a knowledge domain, for example, medical domain, engineering domain, business domain, etc..

If we analyze the various types of knowledge we use in every day life, we can broadly define knowledge to be one of the following categories:

  • Procedural knowledge: Describes how to do things, provides a set of directions of how to perform certain tasks, e.g., how to drive a car.
  • Declarative knowledge: It describes objects, rather than processes. What is known about a situation, e.g. it is sunny today, cherries are red.
  • Meta knowledge: Knowledge about knowledge, e.g., the knowledge that blood pressure is more important for diagnosing a medical condition than eye color.
  • Heuristic knowledge: Rule-of-thumb, e.g. if I start seeing shops, I am close to the market. o Heuristic knowledge is sometimes called shallow knowledge. o Heuristic knowledge is empirical as opposed to deterministic
  • Structural knowledge: Describes structures and their relationships. e.g. how the various parts of the car fit together to make a car, or knowledge structures in terms of concepts, sub concepts, and objects.

1.4.2 Graphs and Networks

Graphs and Networks allow relationships between objects/entities to be incorporated, e.g., to show family relationships, we can use a graph.

Fig 3: Family Relationships

We can also represent procedural knowledge using graphs, e.g. How to start a car?

Fig 4: Graph for procedural knowledge

1.4.3 Numbers

Numbers are an integral part of knowledge representation used by humans. Numbers translate easily to computer representation. Eventually, as we know, every representation we use gets translated to numbers in the computers internal representation.

1.4.4 An Example

In the context of the above discussion, let’s look at some ways to represent the knowledge of a family

Using a picture

Tariq

Hassan (^) Mona

Ayesha

Ali

Amina

Insert Key Turn Ignition Press Clutch Set Gear

Fig 5: Family Picture

As you can see, this kind of representation makes sense readily to humans, but if we give this picture to a computer, it would not have an easy time figuring out the relationships between the individuals, or even figuring out how many individuals are there in the picture. Computers need complex computer vision algorithms to understand pictures.

Using a graph

Fig 6: Family graph

This representation is more direct and highlights relationships.

Using a description in words

For the family above, we could say in words

  • Tariq is Mona’s Father
  • Ayesha is Mona’s Mother
  • Mona is Tariq and Ayesha’s Daughter

This example demonstrates the fact that each knowledge representation scheme has its own strengths and weaknesses.

Tariq Ayesha

Mona

Object-Attribute-Value triplets

Object-Attribute Value Triplets or OAV triplets are a type of fact composed of three parts; object, attribute and value. Such facts are used to assert a particular property of some object, e.g.

Ali’s eye color is brown.

o Object: Ali o Attribute: eye color o Value: brown

Ahmed’s son is Ali o Object: Ahmed o Attribute: son o Value: Ali

OAV Triplets are also defined as in figure below

Figure: OAV Triplets

1.7 Rules

Rules are another form of knowledge representation. Durkin defines a rule as “A knowledge structure that relates some known information to other information that can be concluded or inferred to be true.”

1.7.1 Components of a rule

A Rule consists of two components

o Antecedent or premise or the IF part o Consequent or conclusion or the THEN part

Ali (^) Brown

Object Attribute Value

Ahmed

Color Red

Object Attribute Value

Eye Color

For example, we have a rule: IF it is raining THEN I will not go to school Premise: It is raining Conclusion: I will not go to school.

1.7.2 Compound Rules

Multiple premises or antecedents may be joined using AND (conjunctions) and OR (disjunctions), e.g.

IF it is raining AND I have an umbrella THEN I will go to school.

IF it is raining OR it is snowing THEN I will not go to school

1.7.3 Types of rules

Relationship

Relationship rules are used to express a direct occurrence relationship between two events, e.g. IF you hear a loud sound THEN the silencer is not working

Recommendation

Recommendation rules offer a recommendation on the basis of some known information, e.g.

IF it is raining THEN bring an umbrella

Directive

Directive rules are like recommendations rule but they offer a specific line of action, as opposed to the ‘advice’ of a recommendation rule, e.g.

IF it is raining AND you don’t have an umbrella THEN wait for the rain to stop

Variable Rules

If the same type of rule is to be applied to multiple objects, we use variable rules, i.e. rules with variables, e.g.

If X is a Student AND X’s GPA>3. THEN place X on honor roll.

Network Operation

To infer new information from semantic networks, we can ask questions from nodes

  • Ask node vehicle: ‘How do you travel?’
    • This node looks at arc and replies: road
  • Ask node Suzuki: ‘How do you travel?’
    • This node does not have a link to travel therefore it asks other nodes linked by the IS-A link
    • Asks node Car (because of IS-A relationship)
    • Asks node Vehicle (IS-A relationship)
    • Node Vehicle Replies: road

Problems with Semantic Networks o Semantic networks are computationally expensive at run-time as we need to travers the network to answer some question. In the worst case, we may need to traverse the entire network and then discover that the requested info does not exist. o They try to model human associative memory (store information using associations), but in the human brain the number of neurons and links are in the order of 10 15. It is not practical to build such a large semantic network, hence this scheme is not feasible for this type of problems. o Semantic networks are logically inadequate as they do not have any equivalent quantifiers, e.g., for all, for some, none.

1.9 Frames

“Frames are data structures for representing stereotypical knowledge of some concept or object” according to Durkin, a frame is like a schema, as we would call it in a database design. They were developed from semantic networks and later evolved into our modern-day Classes and Objects. For example, to represent a student, we make use of the following frame:

Figure: Student Frame

Frame Name: Student

Properties: Age: 19 GPA: 4. Ranking: 1

The various components within the frame are called slots, e.g. Frame Name slot.

1.9.1 Facets

A slot in a frame can hold more that just a value, it consists of metadata and procedures also. The various aspects of a slot are called facets. They are a feature of frames that allows us to put constraints on frames. e.g. IF-NEEDED Facets are called when the data of a particular slot is needed. Similarly, IF-CHANGED Facets are when the value of a slot changes.

1.10 Logic

Just like algebra is a type of formal logic that deals with numbers, e.g. 2+4 = 6, propositional logic and predicate calculus are forms of formal logic for dealing with propositions. We will consider two basic logic representation techniques:

  • Propositional Logic
  • Predicate Calculus

1.10.1 Propositional logic

A proposition is the statement of a fact. We usually assign a symbolic variable to represent a proposition, e.g. p = It is raining q = I carry an umbrella

A proposition is a sentence whose truth values may be determined. So, each proposition has a truth value, e.g. –The proposition ‘A rectangle has four sides’ is true –The proposition ‘The world is a cube’ is false.

1.10.1.1 Compound statements

Different propositions may be logically related and we can form compound statements of propositions using logical connectives. Common logical connectives are:

∧ AND (Conjunction) ∨ OR (Disjunction) ¬ NOT (Negation) → If … then (Conditional) ⇔ If and only if (bi-conditional)

1.10.2.1 Quantifiers

Predicate calculus allows us to use quantifiers for statements. Quantifiers allow us to say things about some or all objects within some set. The logical quantifiers used in basic predicate calculus are universal and existential quantifiers.

The Universal quantifier

The symbol for the universal quantifier is ∀ It is read as “for every” or “for all” and used in formulae to assign the same truth value to all variables in the domain, e.g. in the domain of numbers, we can say that ( ∀ x) ( x + x = 2x). In words this is: for every x (where x is a number), x + x = 2x is true. Similarly, in the domain of shapes, we can say that ( ∀ x) (x = square → x = polygon), which is read in words as: every square is a polygon. In other words, for every x (where x is a shape), if x is a square, then x is a polygon (it implies that x is a polygon).

Existential quantifier

The symbol for the existential quantifier is ∃ . It is read as “there exists”, “ for some”, “for at least one”, “there is one”, and is used in formulae to say that something is true for at least one value in the domain, e.g. in the domain of persons, we can say that ( ∃ x) (Person (x) ∧ father (x, Ahmed) ). In words this reads as: there exists some person, x who is Ahmed’s father.

1.10.2.2 First order predicate logic

First order predicate logic is the simplest form of predicate logic. The main types of symbols used are

–Constants are used to name specific objects or properties, e.g. Ali, Ayesha, blue, ball.

–Predicates: A fact or proposition is divided into two parts Predicate: the assertion of the proposition Argument: the object of the proposition For example, the proposition “Ali likes bananas” can be represented in predicate logic as Likes (Ali, bananas), where Likes is the predicate and Ali and bananas are the arguments.

–Variables: Variables are used to a represent general class of objects/properties, e.g. in the predicate likes (X, Y), X and Y are variables that assume the values X=Ali and Y=bananas

–Formulae: Formulas combine predicates and quantifiers to represent information Lets us illustrate these symbols using an example

Figure : Predicate Logic Example

The predicate section outlines the known facts about the situation in the form of predicates, i.e. predicate name and its arguments. So, man(ahmed) means that ahmed is a man, hates(ahmed, chand) means that ahmed hates chand.

The formulae sections outlines formulae that use universal quantifiers and variables to define certain rules. ∀ Y (¬sister(Y,ahmed)) says that there exists no Y such that Y is the sister of ahmed, i.e. ahmed has no sister. Similarly, ∀X,Y,Z(man(X) ∧ man(Y) man(Z) ∧ father(Z,Y) ∧ father(Z,X) ⇒ brother(X,Y)) means that if there are three men, X, Y and Z, and Z is the father of both X and Y, then X and Y are bothers. This expresses the rule for the two individuals being brothers.

Reasoning

Now that we have looked at knowledge representation, we will look at mechanisms to reason on the knowledge once we have represented it using some logical scheme. Reasoning is the process of deriving logical conclusions from given facts. Durkin defines reasoning as ‘the process of working with knowledge, facts and problem solving strategies to draw conclusions’.

Throughout this section, you will notice how representing knowledge in a particular way is useful for a particular kind of reasoning.

ahmed, belal, chand and car

X, Y and Z

Y ( ¬ sister(Y,ahmed))X,Y,Z(man(X)man(Y) man(Z)father(Z,Y)father(Z,X)brother(X,Y))

man(ahmed) father(ahmed, belal) brother(ahmed, chand) owns(belal, car) tall(belal) hates(ahmed, chand) family()

Predicates

Formulae

Variables

Constants

This conclusion might be false, because there could be other reasons that she is carrying an umbrella, e.g. she might be carrying it to protect herself from the sun.

1.11.4 Analogical reasoning

Analogical reasoning works by drawing analogies between two situations, looking for similarities and differences, e.g. when you say driving a truck is just like driving a car, by analogy you know that there are some similarities in the driving mechanism, but you also know that there are certain other distinct characteristics of each.

1.11.5 Common-sense reasoning

Common-sense reasoning is an informal form of reasoning that uses rules gained through experience or what we call rules-of-thumb. It operates on heuristic knowledge and heuristic rules.

1.11.6 Non-Monotonic reasoning

Non-Monotonic reasoning is used when the facts of the case are likely to change after some time, e.g.

Rule: IF the wind blows THEN the curtains sway

When the wind stops blowing, the curtains should sway no longer. However, if we use monotonic reasoning, this would not happen. The fact that the curtains are swaying would be retained even after the wind stopped blowing. In non-monotonic reasoning, we have a ‘truth maintenance system’. It keeps track of what caused a fact to become true. If the cause is removed, that fact is removed (retracted) also.

1.11.7 Inference

Inference is the process of deriving new information from known information. In the domain of AI, the component of the system that performs inference is called an inference engine. We will look at inference within the framework of ‘logic’, which we introduced earlier

1.11.7.1 Logic

Logic, which we introduced earlier, can be viewed as a formal language. As a language, it has the following components: syntax, semantics and proof systems.

Syntax Syntax is a description of valid statements, the expressions that are legal in that language. We have already looked at the syntax of two type of logic systems called

propositional logic and predicate logic. The syntax of proposition gives us ways to use propositions, their associated truth value and logical connectives to reason.

Semantics Semantics pertain to what expressions mean, e.g. the expression ‘the cat drove the car’ is syntactically correct, but semantically non-sensible.

Proof systems A logic framework comes with a proof system, which is a way of manipulating given statements to arrive at new statements. The idea is to derive ‘new’ information from the given information.

Recall proofs in math class. You write down all you know about the situation and then try to apply all the rules you know repeatedly until you come up with the statement you were supposed to prove. Formally, a proof is a sequence of statements aiming at inferring some information. While doing a proof, you usually proceed with the following steps:

–You begin with initial statements, called premises of the proof (or knowledge base) –Use rules, i.e. apply rules to the known information –Add new statements, based on the rules that match

Repeat the above steps until you arrive at the statement you wished to prove.

1.11.7.1.1 Rules of inference

Rules of inference are logical rules that you can use to prove certain things. As you look at the rules of inference, try to figure out and convince yourself that the rules are logically sound, by looking at the associated truth tables. The rules we will use for propositional logic are:

Modus Ponens Modus Tolens And-Introduction And-Elimination

Modus ponens “Modus ponens" means "affirming method“. Note: From now on in our discussion of logic, anything that is written down in a proof is a statement that is true.

β

α

α →β

Modus- Ponens

Inference example

Now, we will do an example using the above rules. Steps 1, 2 and 3 are added initially, they are the given facts. The goal is to prove D. Steps 4-8 use the rules of inference to reach at the required goal from the given rules.

Step Formula Derivation

(^1) A ∧ B Given

2 A→C Given

(^3) (B ∧ C) →D Given

4 A 1 And-elimination

5 C 4, 2 Modus Ponens

6 B 1 And-elimination

(^7) B ∧C 5, 6 And-introduction

8 D 7, 3 Modus Ponens

Note: The numbers in the derivation reference the statements of other step numbers.

1.11.7.2 Resolution rule

The deduction mechanism we discussed above, using the four rules of inference may be used in practical systems, but is not feasible. It uses a lot of inference rules that introduce a large branch factor in the search for a proof. An alternative is approach is called resolution, a strategy used to determine the truth of an assertion, using only one resolution rule:

To see how this rule is logically correct, look at the table below: Α β Γ

F F F T F T F

F F T T F T T

F T F F T F F

F T T F T T T

T F F T T T T

T F T T T T T

T T F F T F T

T T T F T T T

You can see that the rows where the premises of the rule are true, the conclusion of the rule is true also.

To be able to use the resolution rule for proofs, the first step is to convert all given statements into the conjunctive normal form.

1.11.7.3 Conjunctive normal form

Resolution requires all sentences to be converted into a special form called conjunctive normal form (CNF). A statement in conjunctive normal form (CNF) consists of ANDs of Ors. A sentence written in CNF looks like

The outermost structure is made up of conjunctions. Inner units called clauses are made up of disjunctions. The components of a statement in CNF are clauses and literals. A clause is the disjunction of many units. The units that make up a clause are called literals. And a literal is either a variable or the negation of a variable. So you get an expression where the negations are pushed in as tightly as possible, then you have ORs, then you have ANDs. You can think of each clause as a requirement. Each clause has to be satisfied individually to satisfy the entire statement.

note D D D

A B B C D