
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Main points of this lecture are: Knowledge, Representation, Reasoning, Types, Inference, Facts, Rule, Strategies.
Typology: Study notes
1 / 24
This page cannot be seen from the preview
Don't miss anything!
On special offer
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.
Almost all AI systems have the following components in general:
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.
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.
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:
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
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.
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
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
This example demonstrates the fact that each knowledge representation scheme has its own strengths and weaknesses.
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
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.”
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.
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
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
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.
“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.
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.
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:
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.
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)
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.
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.
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.
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.
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.
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.
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
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.
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
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.
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.
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