Upload
others
View
10
Download
0
Embed Size (px)
Citation preview
Knowledge Representation, Reasoning, Logic
and Rules Knowledge Representation
(KR),
- a knowledge base,
- an inference mechanism,
KR Schemes,
- Declarative,
- Procedural,
A Knowledge-based Agent,
KR Using Logic,
- Deductive reasoning,
- Inductive reasoning,
Propositional Logic,
- NOT, AND,
- OR, IMPLIES,
Predicate Logic,
- Arguments (or objects),
- Predicate (or assertion),
KR Using Semantic Networks,
- Graphical depiction of knowledge,
- Hierarchal relationships between
objects,
Explore: Topics based
Research Areas:
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
1. Knowledge Representation
When we use search to solve a problem we must;
– Capture the knowledge needed to formalize the
problem.
– Apply a search technique to solve problem.
– Execute the problem solution.
Most AI system are made up of 2 basic parts;
(1) a knowledge base, (2) an inference mechanism
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
1. Knowledge Representation (Cont…)
The knowledge base contains;
- facts about objects in the chosen domain and their relationships.
- focus on a specific domain or sphere of interest.
- also contain concepts, theories, practical, procedures and their
associations.
The knowledge base forms the systems’ source of intelligence;
- will be used by the inference mechanism to reason and draw
conclusions.
The inference mechanism is;
- a set of procedures that are used to examine the knowledge base in an
orderly manner.
- such as “to answer question”, “solve problems”, or “make decisions”
within the domain.
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
2. Knowledge Representation (KR) Schemes
Most vital step of AI is the role of “knowledge representation”.
In order to act intelligently, a computer must have knowledge about
the domain of interest.
In most cases, the knowledge already exists.
- maybe carried around in the heads of one or more human experts.
- or it may exist in printed form in books, articles, memos, procedures, or
whatever.
It must be organized, outlined, or otherwise arranged in systematic
order.
This process of collecting and organizing the knowledge is called;
- knowledge engineering.
- It is perhaps the most difficult and time-consuming part of any AI
software development process.@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
2. Knowledge Representation (KR) Schemes (Cont…)
KR schemes share 2 common characteristics.
First, they can be programmed with existing computer language and stored in
memory.
Second, they are designed so that the facts and other knowledge contained
within them can be used in reasoning.
Then, inference system uses;
- search and pattern matching algorithm techniques on the knowledge
base.
- to answer questions, draw conclusion, or other perform an intelligent
function.
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
2. Knowledge Representation (KR) Schemes (Cont…)
KR schemes have generally been categories as;
- (1) declarative, (2) procedural.
A declarative scheme is used;
- to represent facts, and assertions.
- include logic, sematic networks, frames and scripts.
A procedure representation scheme deals with;
- actions, results or outputs.
- includes procedures or subroutines and production rules.
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent
We previously talked about searching algorithms and KR but not
about methods of formalizing the problem.
Now we look at extended capabilities to general logical reasoning.
Here is one knowledge representation: logical expressions.
A knowledge-based agent must be able to
– Represent states, actions, etc.
– Incorporate new percepts.
– Update internal representations of the world
– Deduce hidden properties about the world
– Focus at appropriate actions.
We will
– Describe properties of languages to use for logical reasoning.
– Describe techniques for deducing new information from current information.
– Apply search to deduce (or learn) specifically needed information.
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Example)
• Performance measure– gold +1000, death -1000
– 1 or -1 per step,
• Environment– Squares adjacent to wumpus are
smelly.
– Squares adjacent to pit are breezy.
– Glitter and gold is in same square.
– Shooting kills wumpus if agent facing it.
– Shooting uses up only arrow.
– Grabbing picks up gold if in same square.
• Actuators– Left turn, right turn, forward, grab,
release, shoot.
• Sensors– Breeze, glitter, smell, bump, pit.
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Example) (Cont…)
Now we look at
• How to represent facts / beliefs (KR)
“Agent alive, so move (2,1) OK”
• How to make inferences
“No breeze in (1,2), AND pit in (3,1)”.
[ pattern matching & draw conclusion]@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Example) (Cont…)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Example) (Cont…)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Example) (Cont…)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Example) (Cont…)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Example) (Cont…)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Example) (Cont…)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Example) (Cont…)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Example) (Cont…)
Now we look at
• How to represent facts / beliefs (KR)
““Agent alive, & Reached (2,3) OK”
• How to make inferences
“No breeze in (1,2) & (2,2), so pit in (3,3)”
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
3. A Knowledge-Based Agent (Class Participation)
• Performance measure
– gold +1000, death -1000
– 1 or -1 per step,
• Environment
– .
• Actuators
– .
• Sensors
– .
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4. KR Using Logic
“ Logic is the anatomy of thought”
Oldest form of knowledge representation is logic.
It includes;
- process of reasoning + system of rules and procedures that aids in the reasoning.
Logic is considered to be;
- a subdivision of philosophy.
The general form of any logical process is illustrated as;
First, information is given, statements are made, or observations are noted.
These form the input to the logical process;
- called premises.
- The premises are used by the logical process to create the output which consists
of conclusion (called inferences).
LOGICAL
PROCESS
Figure: Using logic to reason
INPUTPREMISES
OR
FACTS
OUTPUTINFERENCES
OR
CONCLUSIONS
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4. KR Using Logic (Cont…)
There are 2 basic types of reasoning;
(1) Deductive, (2) Inductive
Both types are used in logic to make inference from premises.
(1) Deductive Reasoning:-
When general premises are used to obtain a “specific inference”, the process is
called deductive reasoning or deduction.
Reasoning moves from a “general principle” to a “specific conclusion”.
The deductive process consists of 3 parts;
- a major premise, a minor premise and a conclusion. For example;
Major Premise: I do not run when the temperature exceeds 90 degrees.
Minor Premise: Today, the temperature is 93 degrees.
Conclusion: Therefore, I will not run today.
The whole idea is to develop new knowledge from previously given knowledge. @Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4. KR Using Logic (Cont…)
(2) Inductive Reasoning:-
Inductive reasoning uses;
- a number of established facts or premises in order to draw some general
conclusion.
- Again, inductive reasoning only gives you reasonable probability.
Example:-
Premise: Faulty diodes cause electronic equipment failure.
Premise: Defective transistors cause electronic equipment failures.
Premise: Defective integrated circuits cause electronic equipment malfunction.
Conclusion: Therefore, defective semiconductor devices are a major cause of
electronic equipment failure.
The interesting thing about inductive reasoning is that;
- conclusion is never final or absolute.
- conclusion can change if new facts are discovered.
- There is always “uncertainty” in the conclusion.@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4. KR Using Logic (Class Participation)
(1) Deductive Reasoning:-
Example:-
1. Conclusion: Today, weather is
really hot.
2. Conclusion: I will take AAI
course.
3. Conclusion: I will not eat food at
dinner.
4. Conclusion: lecture of this class
is very interesting.
5. Conclusion: I will not do the
job.
(2) Inductive Reasoning:-
Example:-
1. Conclusion: Pollution in Pakistan is
increasing day by day.
2. Conclusion: leaves for office at
7:00 a.m.
3. Conclusion: The cost of food is
100Rs.
4. Conclusion: Human beings
probably all die sooner or later.
5. Conclusion: I will probably go to
the library this afternoon when my
friend goes.@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4.1 Propositional Logic
To perform reasoning using logic;
- some method must be used to convert syllogisms and the deductive or inductive reasoning
into a form suitable for manipulation by a computer.
A proposition is nothing more than a statement;
- that is either true or false.
Rules are used to determine the truth (T) or falsity (F) of the new
proposition.
In propositional logic, we use symbols such as letters of the alphabet to
represent various propositions, premises, or conclusions.
For example 1;
A = The mailman comes Monday
through Saturday.
B = Today is Sunday.
C = The postman will not come today.
For example 2;
A = all dogs are animals;.
B = all animals have four legs;
C = therefore all dogs have four legs.
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4.1 Propositional Logic (Cont…)
Some interrelated propositional logic are;
- AND , OR , NOT and IMPLIES.
CONNECTIVE SYMBOL
AND
OR
NOT
IMPLIES
Figure: Logical connectives or operators and their symbols
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4.1 Propositional Logic (Cont…)
(1) Propositional Logic :-
Example:-
A = It is raining today.
NOT A = It is not raining today.
A truth table can be used to show all possible combinations of this
connective.
This truth table shows that;
- if proposition A is true, then NOT A is false.
- if proposition A is false, then NOT A is true.
A NOT A
T
F
F
T
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4.1 Propositional Logic (Cont…)
(2) AND :-
When the AND connective is used;
- to combine two propositions, the resulting new proposition is true only if both of the
original propositions are true.
Example:-
D = The car is black.
E = The car has a six cylinder engine.
F = The car is black AND has a six cylinder engine.
F = D AND E
A truth table can be used to illustrated as;
D E F
F
F
T
T
F
T
F
T
F
F
F
T
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4.1 Propositional Logic (Cont…)
(3) OR :-
When the OR connective is used to combine proposition;
- the new proposition is true if either one or both of the original propositions are
true.
Example:-
P = The moon is a satellite.
Q = The earth is a satellite.
R = P OR Q = The moon OR the earth is a satellite.
A truth table can be used to illustrated as;
P Q R
F
F
T
T
F
T
F
T
F
T
T
T
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4.1 Propositional Logic (Cont…)
(4) IMPLIES :-
The IMPLIES connective mean that;
- if proposition A is true, then proposition B is also true. The truth of A
implies the truth of B as;
A -> B
Example:-
A = The car’s engine is defective.
B = I cannot drive today.
C = A IMPLIES B.
The truth table below illustrates the IMPLIES function.
A B C
F
F
T
T
F
T
F
T
T
T
F
T
4.1 Propositional Logic (Cont…)
(4) IMPLIES :-
Case 1:-
If A is false and B is false, C will be true. This can be stated as:
“if the car’s engine is not defective, then I can drive today.”
C= A IMPLIES B is true.
Case 2:-
If A is false and B is true, C is true.
“If the car’s engine is not defective, then I cannot drive today.”
While this doesn't make much sense, but they cannot drive today for some other reason.
Case 3:-
If A is true and C is false, then A IMPLIES B is false.
“If the car’s engine is defective, then I can drive today.
Case 4:-
Finally, It both A and B are true, then A IMPLIES B is true.
Example:-A = The car’s engine is defective.
B = I cannot drive today.@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
Q.1:- Make use-case study and develop respective cases using truth
tables with examples of ;
i) logic “NOT”
ii) logic “AND”
iii) logic “OR”
iv) logic “IMPLIES”.
Q.2:- Explore first-order logic and Second order logic;
i) Definitions,
ii) Theorem or algorithm,
iii) 3 examples each.
4.1 Propositional Logic (Quiz#2)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4.2 Predicate Logic
Predicate logic is a more sophisticated for logic;
- that uses all the same concepts and rules of propositional logic.
It gives added ability to represent knowledge in finer detail.
In predicate logic;
- a proposition or premise is divided into two parts.
- (1) Arguments (or objects) and (2) Predicate (or assertion).
The Arguments are the individuals or objects an assertion is made about.
The predicate is the assertion made about them.
In a sentence, the predicate would be the verb or part of a verb.
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4.2 Predicate Logic (Example) (Cont…)
The two are combined to create a proposition:
PREDICATE ( Individual [object] 1, Individual [object] 2)
For Example, the proposition:
The car is in the garage.
would be stated as follows:
IN (car, garage)
IN = Predicate (assertion)
car = Argument (object)
garage = Argument (object)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4.2 Predicate Logic (Example) (Cont…)
Another Example,
Proposition : John like Mary.
Predicate Calculus Express on: LIKES (John, Mary)
Other formats are also used such as:
(in car garage) or
(like John Mary)
In some cases, the proposition may have only one argument. Some
example are;
1. The door is open. 2. The tire is flat. 3. Chris is a man.
OPEN(door) FLAT(tire) MAN(Chris)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
4.2 Predicate Logic (Class Participation)
Example:-
1. Mail message larger than one
megabyte will be compressed.
2. All frogs are green.
3. Weather is really hot today.
4. Jane is Paul’s mother.
5. The sum of 2 and 3 is 5.
6. Mary has won a million.
Example:-
7. Jane is the mother of Mary.
8. Some people like their meat raw.
9. Tom is a cat.
10. Healthy people live long..
11. John is a UPitt student.
12. Some of the CS graduates graduate
with honor.
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
5. KR Using Semantic Networks
Oldest and easiest to
understand KR schemes is
the semantic network or
semantic net.
Semantic networks are
basically;
- graphical depictions of
knowledge.
- also shows hierarchal
relationships between objects.
A simple semantic network
is shown in Figure.Figure: Examples of representing knowledge in a semantic net.
School JOE
BOY
Woman
Human
Being
Key
SAM
Man
CAR VP ACME
AJAX
GOLF
Sport
Mercedes
Benz
Germany
Silver
Goes to has child
Has child
is a
plays
is a
is a
Made in
Color
owns
a
works
for
Subsidiary of
is husband of
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
5. KR Using Semantic Networks (Cont…)
Figure description:-
In Figure, circles or nodes represent objects and descriptive information about
those objects.
Objects can be any physical item such as book, car, desk, or even a person.
Nodes can also be concepts, events, or actions.
Nodes in a semantic network are also interconnected by links or arcs.
These arcs show the relationships between the various objects and descriptive
factors.
Example,
Nodes and arcs show characteristics about Sam.
- e.g., SAM is a VP works for ACME.
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
5. KR Using Semantic Networks (Cont…)Another Example,
Shows that SAM owns a car and owns many other things.
Figure: Example of adding detail to a semantic net.
SAM OWNS HOUSE
CAR
ROLEX
WATCH
VCR
STOCK
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
5. KR Using Semantic Networks (Cont…)Another Example,
Another example involves the attributes of various objects in the net.
- suppose that we want to show the ages of Sam and Kay. (Figure A).
- relationship (i.e., as “greater than”) between the ages are considered. (Figure B).
Figure: Other methods of expanding the knowledge in a semantic net.
SAM
KAY
45
42
A
AGE
AGE
MARRIED
TO
SAM
KAY
AGE
2
AGE
1
AGE
AGE
MARRIED
TO
45
42VALUE
VALUE
B
GREATER
THAN
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
Develop Nodes, arcs and values to show semantic networks
relationships of;
Daily life routine,
Family relation,
Recent degree academic cycle,
Animals, Mammals, birds,
Weather forecasting,
Make sentences & used common objects.
5. KR Using Semantic Networks (Class Participation)
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
6. Explore: Topics based Research Areas
(1) Knowledge representation and semantic annotation :-
Proposed architecture of Model Implemented results
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)
6. Explore: Topics based Research Areas
(2) Semantic Networks for Knowledge Representation in an Intelligent
Environment :-
“Send this information to group members
interested in HCI.”
“Do I know anyone who is an expert in writing
LISP code?”
Implemented resultsProposed architecture of Model
@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)