Está en la página 1de 51

Chapter 3:

Knowledge
Representation
a 
  
— Knowledge obtained from knowledge acquisition
process is coded and stored in the knowledge base
(KB)

— Knowledge representation means analyzing or


coding by an understandable language into a
format acceptable by computers.

— Representation language involves two main


elements: syntax and semantics.

— The syntax is concerned with the forms or rules of


writing sentences of the language, whereas the
semantics are concerned with the meaning of the
language.
a 
     
a 
     

—   

    

è roduction rules
è ogic systems
è emantic nets
è rames
è Knowledge representation languages: Kè
, KRY TON.
[
  
  !" #$%
— Ñost Common representation in KBs of ruleèbased
expert systems.

— Ñuch of the human thinking and problem solving


can be expressed in ITHEN:

roduction rule: < remise> ? <Consequent>


<ΔΠϴΘϧ> <ΔϴϘτϨϣ ΔϣΪϘϣ>

I remise THEN Consequent


[
  
   

— Example:
I
: A is true AND
B is true AND
C is false
THEN: Z
[
  
   
— roduction rules for car breakdown diagnosis:

Rule : I : car does not start AND


fuel gauge reads zero
THEN: there is no fuel
Rule 2: I : car does not start AND
fuel tank is not empty
THEN: battery is discharged/damaged AND check
battery
Rule 3: I : car does not start AND
battery is charged
THEN: check starter motor
[
  
   
— &'  
  
 

è Easy way to represent knowledge, and very similar to human


cognition and problem solving.

è implicity of coding into computer programming languages.

è Ñodularity (ΔϴϟΎμϔϧϹ΍): modification is independent and easy

— ö '  
  
 

è Difficulty to follow inference paths for large systems.


è roblems in operation for large system comprising  rules
$()* +
— ormal logic is concerned with syntax of statements
rather than their semantics. The oldest and the simplest
type of formal logic is syllogisms

Examples of syllogisms:

remise : All men are mortal


remsie : ocrates is a man
Conclusion: ocrates is mortal

remise: All X are Y


remsie: Z is X
Conclusion: Z is Y
$()* +   

— The separation of syntax from semantics is an


advantage of formal logic.

— However, Aristotelian syllogism has some


restrictions. This has led to the appearance of
symbolic logic (George Boole).

— ymbolic logic: it is a set of axioms consisting of


symbols representing both objects and classes,
and algebraic operations to manipulate symbols.
)*+,
    

— It is symbolic logic for manipulating propositions. It
deals with manipulation of logical variables which
represent propositions.

— ropositions are declarative sentences, which can


be classified as either true or false.

— A sentence whose truth value (true (T)/false ()) can


be determined is called statement or proposition.

— tatement or propositions are classified as either


closed or open.

— ropositional logic is used to represent and reason


about properties and relationships.

      
— Closed sentences whose truth is not open to questions,
whereas open sentences whose truth can not be answered
absolutely; that it is open to questions.

— ropositional logic is used to represent and reason about


properties and relationships.

ymbols of propositional calculus:

è ropositional symbols (proposition or statements about the world): , Q,


R, , T, .(uppercase letters)

è Truth symbols: True, alse



    -  
— Compound sentences are made or formed by
using logical connectives and individual
statements or symbols.

— The logical connectives are:

! AND: conjunction
OR : disjunction
 NOT : negation
? Ifthen: implication (conditional)
 If and only if (iff): equivalence

    -  
— entences of propositional logic are made
according to the following syntax:è

è Every propositional symbol and truth symbol is a


sentence.
Example: True, , Q, are sentences

è The negation of a sentence is a sentence


Example:  and  alse are sentences.

è The conjunction AND of two sentences is a


sentence:

    -  
Example: ! is a sentence.

è The disjunction OR of two sentences is a sentence:


Example:  is a sentence.

è The implication of one sentence from another is a sentence: ? Q.


is called premise or antecedent, and Q is called conclusion or
consequent.

è The equivalent of two sentences is a sentence


Example: Q  R is a sentence.

è egal sentences are called wellèformedèformulas (wffs)

è arentheses ( ) and brackets [ ] are used to group subèexpressions.


è In ( ! Q), and Q are called conjuncts, and in ( Q), and Q
are called disjuncts, and in ? Q, is called premise, and Q is
called conclusion.

    -  
— . +   
    


Ξ΋ΎΘϨϟ΍ ΔΤλ ϥΈϓ ˬϲϧΎϴΒΘγϹ΍ ϭ΃ ϲοήϔϟ΍ ϖτϨϤϟ΍ ϰϠϋ ΔϴϨΒϤϟ΍ Ξϣ΍ήΒϟ΍ è


ϥ΃ ϱ΃ ˬΎϬϨϣ ϝΪΘδϤϟ΍ ΔϴϨΒϤϟ΍ ΔϓήόϤϟ΍ ΔΤλ ϰϠϋ ςϘϓ ΪϤΘόΗ ΔϟΪΘδϤϟ΍
.Ωέ΍ϭ ήϴϏ ϲϘτϨϤϟ΍ ΄τΨϟ΍

è The truth value assigned to the propositional


sentence is called an interpretation.

è The interpretation is a mapping from the


propositional symbols into the set {T, 

    -  
— emantics:
è An interpretation of a set of propositions is the
assignment of a truth value, either T or  to each
propositional symbol.

Example: the set of propositions { , Q has four possible


interpretations for the pair ( ,Q) is {(T, T), (T, ), (,),
(,T).

è The symbol True is always assigned T, and the symbol


alse is always assigned .

è The truth evaluation of negative  is T if is , and is 


if is T.
ropositional logic emantics ± Cont.
è The truth evaluation of conjunction, !, is T only
when both the conjunct are T; otherwise is .

è The truth evaluation of disjunction, , is  only


when both the disjuncts are ; otherwise is T.

è The truth evaluation of implication, ? is only 


when the premise is T, and the conclusion is ;
otherwise is T.

è The truth evaluation of equivalence, , is T only


when both the expressions have same truth;
otherwise is .

    -  
è The truth assignment of a compound expression is
described by truth table.

Example: The truth table for the sentence !Q

ÿ ÿ!
T T Ô
T 
 T
 

    -  
Exercise: prove the following equivalences:
— ( ) 

— ( Q)  ( ? Q)

— ( ? Q)  ( ? Q) ³Contrapositive law´

— ( Q)  ( ! Q) ³De Ñorgan¶s law´

— ( ! Q)  ( Q) ³De Ñorgan¶s law´

— ( ! Q)  (Q ! ) ³Commutative law´

    -  

— ( Q)  (Q ) ³Commutative law´

— (( ! Q) ! R)  ( ! (Q ! R)) ³Associative law´

— (( Q) R)  ( (Q R)) ³Associative law´

— ( (Q ! R)  ( Q) ! ( R) ³Distributive law´

— ( ! (Q R)  ( ! Q) ( ! R) ³Distributive law´

— ? Q  ( Q)

    -  

— A tautology is compound statement that is


always true, whether its individual statements
are true or false.

— A contradiction is a compound statement that is


always false, whether its individual statements
are true or false.

— A contingent statement is neither tautology nor


contradiction.
.



 
/012 345!0 6789:; <=:>0 %
— The the propositional logic can deal only
with complete statements. That is, it cannot
examine the internal structure of a
statement.
Example: the proposition
³it rained on Tuesday´
In predicate logic can be expressed as:
weather(tuesday, rain).
D (  
— By inference rules, we can manipulate predicate
calculus expression, access their individual
components and infer new sentences.

— redicate logic allows expressions to contain


variables (capital).
Example: for all X, where X is the day of the week,
weather(X, rain) is true; that is it rains everyday.
Expressed in predicate logic as:
Ž X weather(X, rain)
D (-  
— . * ? 
 

The alphabet of the predicate calculus symbols:


è et of English letters (uppercase, lowercase)
è et of digits , , .
è The underscore, _. (no space (no blank))
è ymbols must begin with letters.
è Characters not in the in the alphabet are: % * ³´ ! @ & /

Example correct symbols:


fire2, machine_and_machine2, athe, Drill, mill, tool_of
Example nonèlegal symbols:
3jack ³ machine tools´ ab%cd tool!! *44
D (-  

— arentheses ³()´ and commas ³,´ are used


solely to construct well formed formulas
Ws or legal sentences.

— â+ 
 
D (-  
— 
 : it is a relationship between objects in the real
world, or characteristic or attribute of objects. redicates
are written in lower case letters.

— Í
 ,: start with uppercase. It designates general
class of objects or properties. Examples: Goerge, X, Y,
etc.

—  : start with lowercase letter. Examples: george,


cnc, tool. true and false are reserved words for truth
symbols.

— D   : starts with lowercase letter. Each function has


arity (number of arguments), which is the number of
elements in the domain mapped into each elements of
the coèdomain or range. Arguments of the function are
enclosed in parenthesis and are separated by commas.
D (-  
— Any sentence can be either a predicate or a
function. A function involves m  and
returns value, whereas predicates  
m

m , but can be either true or false.
Example predicates:
è parent(ahmed, maged) û true
è tool_of_machine(hss, machine) û false
Example functions:

è plus(2,3) û 5
D (-  
ymbols and terms:
— A term is either a constant, variable,
predicate or function expression
Example of terms:
cat, blue, times(2,3), mother(jane), Kate

— redicates name relationship between


objects in the world, and the number of
related objects is the arity of the predicate
D (-  
— An atomic sentence is a predicate of n arity
followed by an n terms enclosed in
parenthesis and are separated by commas.
Examples:
likes(goerge, kate), likes (X,X),
friends(bill, george), likes(X, george),
friends (father_of(david), father_of(andrew))
D (-  
— The truth values and truth symbols (true/false)
are also atomic sentences.

— ogical operators (ë!ë ëë?) are also used


to form compound sentences by combining
atomic sentences.

Quantifiers:
st order predicate logic includes variable
quantifier, Ž and , that constrain the meaning of a
sentence containing a variable.
D (-  
— The universal quantifier, Ž, indicates that the
sentence is true for all values of the variable.

— The existential quantifier, , indicates that sentence


is true for at least one value of the variable in the
domain

A quantifier is followed by variable and a sentence


such as:
Y friends(Y,peter) ( : there exists)
If exists  Y, then friends (Y, peter) is true,
Ž X likes(X, ice_cream) (Ž: for all)
entence is true for all variable X in the domain
D (-  
— The predicate calculus sentence

è Every atomic sentence is a sentence.

è If  is a sentence, then so is its negation,  .

è If  and 2 are two sentences, then so  ! 2 ,


 2 ,  ? 2 and   2 .

è If X is a variable and  is a sentence, then ŽX , X


 are sentences.
D (-  
— emantics of predicate calculus:
The semantics of predicate logic are same as that
of the propositional logic, and in addition:

è The value of the sentence: Ž X  is T if  is T


for all assignments to X; false otherwise.

è The value of the X  is T if there is an


assignment to X under which  is T; otherwise is
.
D (-  
— The variable is considered free if it is not
quantified universally or existentially

— Ground expression has no variables.

— Relationships between negation and the


universal and existential quantifier:
 ®®% Ž ® ®%
 Ž ®®% ® ®%
à)+  
— emantic nets are made of nodes (ΪϘϋ) and arcs
(directed lines ϪϬΟϮϣ ρϮτΧ ϭ΃ α΍Ϯϗ΃).

— Nodes represent an object, concept, situation, etc., and


arcs are (also called links/edges) relationships.

— emantic nets can store propositional information, and


sometimes called propositional nets.

— A semantic net can mathematically be thought as a


labeled directed graph.
à)+   -  

— Without relationships, knowledge is simply a collection of


unrelated facts. The above figure is not a semantic net,
because there are no relationships specified on links. It
is a general net.
à)+   -  
— Example semantic net: family information
à)+   -  
— ++ 
   
Certain types of relationships are very useful in wide variety of
knowledge representation situations, which make understanding
easier and faster:

è IA means ³is an instance of´. It relates an instance (a specific


member of a class) to a class of that instance.

è AKO means ³a kind of´. It relates one class to another.

è HA means ³has´. It relates a whole to a part or relates an object


or a class to an attribute of that class. or example, a car HA
engine.

è HA_Attribute means has attribute or property. or example,


HA_color, HA_shape. It relates an object or a class to the
attribute of that object or class.
à)+   -  

— ö '   +   

è There is no method to infer new knowledge from stored knowledge in the


net.
è The net can only be used to store propositional or descriptive knowledge.
è Combinatorial explosion: large net so many paths to search.
FD
+
— emantic net is an example of a shallow knowledge
structure; all knowledge is in links and nodes.

— Deep knowledge contains why? (causal knowledge)

Example:
If oil stick level is below the minimum, then add oilwhy?
If a person has a fever, then take aspirinwhy?

— Ruleèbased Expert systems contains shallow knowledge


structures (because it doesn¶t know how to break rules)

— emantic net cannot represent all types of real world


knowledge. Ñore complex knowledge requires more
complex knowledge representation structure.
FD
+ -  
— chema: it is a continually organized knowledge.

— Conceptual schema is an abstraction in which specific


objects are classified by their general properties.

— tereotypeèobjects: objects that are typical


instances...like apple with properties (color, size, shape,
taste, etc.)

— chemas have an internal knowledge structure to their


nodes whereas semantic nets don¶t.

— rames: one type of schema used in many AI


applications.

— cript is a timeèordered sequence of frames.


FD
+ -  
— emantic nets is a 2D representation of knowledge
whereas frames is a 3D?? Nodes may have structure.

— A frame is basically a group of slots and fillers that defines


a stereotypical object. lots and fillers are analogous to
fields and record values in databases.

— rame slots may hold rules, graphics, comments,


questions for used, hypothesis concerning a situation or
other frames.

— lots fillers may contain a value or ranges of values.


FD
+ -  
— lots may contain procedure. rocedural
attachments are generally of three types:è

— . Ifèneeded: procedures to be executed when a


filler value is needed, but none is initially
present, or a default value is not suitable.

— 2. Ifèadded: procedures to be executed when a


new value is to be added to a slot filler.

— 3. Ifèremoved: procedure is run when a value is


to be removed from a slot filler.
FD
+ -  

— The above procedures are executed when any change


occurs to the slots.

— A frame represents a related knowledge about narrow


subject.

— A frame system would be a mechanical or biomedical


device.

— The components of a car such as the engine, body,


brakes, etc., are related and can be represented in a
frame.
FD
+ -  
— Example frame for a car

) (attributes) D


(value)
Ñ   
 

Ñ
Ñ   
  
Ô      
  
Ô

 
 

— rame can be either specific or generic


FD
+ -  
— Example: generic frame
) (attributes) D
(value)
name ÿ   
type (car, boat, house)
(if added: procedure
ADD_ RO ORTY_type)
owner Default: government (ifèneeded):
procedure IND_OWNER)
location (home, work, mobile)
status (missing, good, poor)
underèwarranty (yes, no)
FD
+ -  
— Example: specific frame
) (attributes) D
(value)
name iat 28
manufacturer iat
Owner Ahmed sedky
Transmission manual
tatus good
underèwarranty yes
FD
+ -  

— Classification of frames by their applications:

è )   
+ : knowledge of what to expect in a
given situation.

è &  
+ : contains slots that specify action to be
performed in given situations (procedural knowledge)

è    
+ : combination of action and
situational frames, and can be used to construct cause
and effect relationships.
FD
+ -  

— Hierarchical frame systems and inheritance


are of most important benefits of using
frames, by using frames inside fillers, very
powerful knowledge representation systems
can be built.

— In the hierarchy of frames, the top frames are


more generic, and bottom frames are more
specific.
FD
+ -  
— rameèbased expert systems are very useful
for representing causal knowledge, because
their information is organized by cause and
effect, whereas ruleèbased systems lie on
nonècausal knowledge.

— imitations of frames:
è No definition for unalterable slots

También podría gustarte