Upload
logan-bishop
View
217
Download
2
Tags:
Embed Size (px)
Citation preview
Knowledge Representation
In which we show how to use first-order logic to represent the most important aspects of the real world.
This is a treatise of chapter 12 of Russel & Norvig: AIMA (Ed.3)
The notation for FOL will be in implicative normal form, which makes the examples executable.
Categories and Objects
The organization of objects into categories is a vital part of KR.
Important relationships are
subclass relation (AKO - a kind of) <category> AKO <category>. instance relation ( ISA - is a) <object> ISA <category>.
The upper ontology(*)
Anything
AbstractObjects GeneralizedEvents
Sets Numbers Representations Intervals Places PhysicalObjects Processes
Categories Sentences Measurements Moments Things Stuff
Times Weights Animals Agents Solid Liquid Gas
Humans
(*) This is AIMA ’s version. Other authors have other partitions.
See bus_semantics
Bus semantics% thing top node
unkn ako thing. event ako thing. set ako thing. cardinality ako number. member ako thing.amount ako thing. abstract ako thing. activity ako thing. agent ako thing. company ako agent. %% e.g. TTcontact ako thing. content ako thing. group ako thing.identity ako thing. information ako thing. list ako thing. mass ako thing. %% => stuffmeasure ako thing.meta ako thing. %% lexical object object ako thing. %% class. part ako thing. place ako thing.river ako thing. %% (water but no area) story ako thing.
study ako activity. subset ako thing.version ako abstract. accident ako activity. activation ako activity. %% start of itaddition ako abstract.address ako place. advice ako abstract. age ako year. %% (measure) agreement ako abstract. %% air ako place. %% kan bussen gå i lufta ? analysis ako abstract.animate ako agent. application ako activity. area ako measure. % …..% + (750 ako items)
CategoriesCategory is a kind of set and denotes a set of objects.
A category has a set of properties that is common to all its members.
Categories are formally represented in logic as predicates, but we will also regard categories as a special kind of objects.
We then actually introduce a restricted form of second order logic, since the the terms that occur may be predicates.
Example: Elephants and Mammals are categories.
The set denoted by Elephants is a subset of the set denoted by Mammals.
The set of properties common to Elephants is a superset of the set of properties common to Mammals.
TaxonomySubcategory relations organize categories into a taxonomy or taxonomic hierarchy.
Other names are type hierarchy or class hierarchy .
We state that a category is a subcategory of another category by using the notation for subsets
Basketball Ball
We will also use the notation
ako(basketball,ball).
Category representationsThere are two choices of representing categories in first order logic: predicates and objects. That is, we can use the predicate Basketball(b) or we can reify the category as an ”object” basketball. We could then write
member(x,basketball) or
x basketball
We will also use the notation
isa(x,basketball).
Basketball is a subset or subcategory of Ball, which is abbreviated
Basketball Ball
We will also use the notation
ako(basketball,ball).
Inheritance
Categories serve to organize and simplify the knowledge base through inheritance.
If we say that all instances of Food is edible (edible is in the property set of Food), and if we assert that Fruit is a subcategory of Food, and Apple is a subcategory of Fruit, then we know 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.
Reifying properties
An individual object may have a property.
For example, a specific ball, BB9 can be round.
In ordinary FOL, we write
Round(BB9).
As for categories, we can regard Round as higher order object, and say
BB9 has the property Round
We will also use the notation hasprop(BB9,round).
Reifying Property ValuesSome properties are determined by an attribute and a value. For example, the diameter of my basketball BB9 has diameter 9.5:
Diameter(BB9 )=9.5
We can also use the notation
has(bb9,diameter,9.5).
An alternative representation for properties , when regarded as Boolean attributes is
has(BB9,round,true).
In the same manner, we can express that a red ball has colour = red.
has(BB9,colour,red).
Logical expressions on categories An object is a member of a category
isa(bb9,basketball).
A category is a subclass of another category
ako(basketball,ball).
All members of a category have som properties
isa(X,basketball) => hasprop(X,round).
Members of a category can be recognized by some properties, for example:
hasprop(X,orange) and hasprop(X,round) and
has(X,diameter,9.5) and isa(X,ball)
=> isa(X,basketball)
A category as a whole has some properties
isa(teacher,profession).
Here, it is a fallacy to conclude that
isa(tore,teacher) and isa(teacher,profession)=>isa(tore,profession).
Category Decompositions
We can say that both Male and Female is a subclass of Animal, but we have not said that a male cannot be a female. That is expressed by
Disjoint({Male,Female})
If we know that all animals are either male or female, (they exhaust the possibilities)
Exhaustive({Male,Female},Animals).
A disjoint exhaustive decomposition is known as a partition
Partition({Male,Female},Animals).
Physical CompositionsOne object can be a part of another object.
Example, declaring direct parts
part(bucharest,romania).
part(romania,eastern_europe).
part(europe,earth).
We can make a transitive extension partof
part(Y,Z) and partof(X,Y) => partof(X,Z).
and reflexive (*)
partof(X,X).
Therefore we can conclude that partof(bucharest,earth)
(*) depending on definition
Bunch
It is also useful to define composite objects with definite parts but no particular structure. For example, we might say
”The apples in the bag weigh two pounds”
It is adviced that we don’t regard these apples as the set of (all) apples, but instead define them as a bunch of apples. For example, if the apples are Apple1,Apple2 and Apple3, then
BunchOf({Apple1,Apple2,Apple3})
Denotes the composite object with three apples as parts, not elements.
More about bunchesThe category of deodorant actually denotes the set of all deodorants in the world.A subset of this, e.g. mydeodorants is a subset of these, i.e.
ako(mydeodorants,deodorant).However, we are often interested in a set as being a composite object, with properties connected to the collected properties of the elements, likethe cardinalty of the set, weight, price etc. To make this distinction, we can use the concept "bunch". A bunch is both similar to a category and to anunstructured composite object. mydeodorants isa “bunch of “ deodorant (objects)
isa(mydeodorants,deodorant). We shall introduce the notation as a combination:
bunch(mydeodorants,deodorant).
We also allow various expressions for the bunch objects:
bunch({apple1,apple2,apple2},apple). bunch({apples,tomatoes},fruit). partof(twopoundoftomatoes,sometomatoesandbeef).
Substances and ObjectsThe real world can be seen as consisting of primitive objects (particles) and composite objects. A common characteristic is that they can be counted (individuated)
However, there are objects that cannot be individuated like
Butter, Water, Nitrogen, Wine, Grass, etc.
They are called stuff, and are denoted in English without articles or quantifiers (not ”a water”).
Typically, they can be divided without loosing their intrinsic properties. When you take a part of a substance, you still have the same substance.
isa(X,butter) and partof(Y,X)=>isa(Y,butter).
We can say that butter melts at 30 degrees centigrade
isa(X,butter) =>has(X,meltingpoint,30).
Measures, Abstracts ,Mentals In the common world, objects have height, mass, cost and so on. The values we assign for these properties are called measures.
We imagine that the universe includes abstract ”measure objects” such as length. Measure objects are given as a number of units, e.g. meters. Logically, we can combine this with unit functions
Length(L1) = Inches(1.5) = Centimeters(3.81)
Another way is to use predicates
Length(L1,1.5,inches)
Abstract concepts like ”autonomy”, ”quality” are difficult to represent without seeking artificial measurements. (e.g. IQ).
Mental concepts are beliefs, thoughts, feelings etc.
Reasoning systems for categories
Semantic networks and Description Logics are two closely related systems for reasoning with categories. Both can be described using logic.
Semantic networks provide graphical aids of visualizing the knowledge base, together with efficient algoritms for inferring properties of an object on the basis of its category membership.
Description logics provide a formal language for constructing and combining category definitions, and efficient algorithms for deciding subsets and superset relationships between categories.
Semantic Networks Example
Mammal
Person
MaleFemale
Mary John
2
HaveMother
Legs
Legs
isa isa
ako
ako
brother
sister
1
ako
Link types in semantic nets
There are 3 types of entities in a semantic nets
categories, objects and values (other than these)
Then there could be 9 different types of relations between these. They are drawn with certain conventions. Note that objects can act as values also. category category ako(C1,C2) every C1 is a.k.o. C2
category category haveatt(C1,R,C2) every C1has a R a.k.o C2
category value have(C1,R,V) every C1 has attribute value R = V
object category isa(O,C) O is a C
object object has(O1,R,O2) O1 has relation R to O2
object value has (O,R,V) O has attribute value R=V
object object partof (O1,O2) O1 is a part of O2
In addition, we have all kinds of relations between values.
value* V1 > 2*V2 +5
Further comments on link typesWe know that persons have female persons as mothers, but we cannot draw a HasMother link from Persons to FemalePersons because HasMother is a relation between a person and his or her mother, and categories do not have mothers. For this reason, we use a special notation – the double boxed link. In logic, we have given it the name haveatt,e.g.
haveatt(person,mother,femaleperson).
Compare this to
haveatt(lion,mother,lioness).
We also want to express that persons normally have two legs.As before, we must be careful not to assert that categories have legs; instead we use a single-boxed link. In logic, we have given it the name have,e.g.
have(person,legs,2).
Content of semantic netA paraphrase of the knowledge
All persons are mammals
All females are persons
All males are persons
Persons have a mother who is female
Persons have normally 2 legs
John has 1 leg
Mary isa female
John is a male
John has a sister Mary
Mary has a brother John
Logic representation
ako(person,mammal).
ako(female,person).ako(male,person).
haveatt(person,mother,female).
have(person,legs,2).
has(john,legs,1).isa(mary,female). isa(john,male).
has(john,sister,mary).has(mary,brother,john).
Inheritance and inference in semantic nets
The rules of inheritance can now be automated using our logic representation of semantic nets.
isa(X,Y) and ako(Y,Z) => isa(X,Z).
have(Y,R,V) and isa(X,Y) => has(X,R,V).
haveatt(C,R,M) and isa(X,C) and has(X,R,V) => isa(V,M).
With these definitions, we can prove that Mary has two legs, even ifthis information is not explicitly represented.
Example of inheritance
isa(X,Y)and ako(Y,Z)=>isa(X,Z)have(X,Y,Z)and isa(A1,X)=>has(A1,Y,Z)haveatt(X,Y,C) and isa(A1,X) and has(A1,Y,V) => isa(V,C).
t=>ako(person,mammal)t=>ako(female,person)t=>ako(male,person)t=>haveatt(person,mother,female)t=>have(person,legs,2)t=>isa(mary,female)t=>isa(john,male)t=>has(john,legs,1)t=>has(john,sister,mary)t=>has(mary,brother,john)
PROOF:
has(mary,legs,2) because have(person,legs,2) and isa(mary,person)
have(person,legs,2) is true
isa(mary,person) because isa(mary,female) and ako(female,person)
isa(mary,female) is true
ako(female,person) is true
Multiple inheritance in a hierarchy
An attribute of a class can be given an attribute value. This is a default value that can be redefined in any of its subclasses.
In the example, it is stated that persons normally have 2 legs, while John, who is a person, has 1 leg. Actually, there are conflicting evidence, but the ambiguity is solved by stating that the innermost definition, most specific definition takes place, i.e. John’s definition. This will be made precise later.
Multiple Inheritance
We have described a type of semantic nets that can be characterized as a hierarchy: Each category is a subclass of exactly one superclass. However, things are not that simple.
Take for instance a girl, who is both a child and a female. Such networks are called a heterarchy.
Inheritance in heterarchies is a bit more complicated.
The following semantic network is an extension of the previous example.
Example of heterarchy
Mammal
Person
MaleFemale
Mary John
2
Legs
isa
ako
ako
1
ako
Child
ako
BoyGirl
175
170
180Height
Height
Height
Legs
Alice Robertisa isa
Height100
HaveMother
omitted
What is the height ofMary,Alice,Robert and John?
Heterarchy in Logic
ako(person,mammal).ako(female,person).ako(male,person).ako(child,person).
ako(girl,female).ako(girl,child). ako(boy,male).ako(boy,child).
haveatt(person,legs,number).haveatt(person,height,centimeter).
isa(mary,female).isa(john,male).
isa(alice,girl). isa(robert,boy).
has(john,legs,1).have(person,legs,2).have(person,height,175).have(female,height,170). have(child,height,100). %% have(male,height,180). %% omitted for sake of demonstration
Inheritance results
1. Mary has legs = 2 % default inheritance from person
2. John has legs = 1 % explicitly stated
3. Mary has height = 170 % default inheritance from female
4. John has height = 175 % default inheritance from person
5. Robert has height = 100 % default inheritance from child , priority over
% inheritance from person
6. Alice has height = 100 and height=170. % contradicting values, no priority
Description LogicsDescription logics are notations that are designed to make it easier to describe definitions and properties of categories.
The most important inference task is
• subsumption checking if one category is a subset of another
• classification checking if an object belongs to a category
• consistency checking if a description is satisfiable
Small example
Bachelor = And(Unmarried,Adult,Male)
The equivalent first-order logic woul be
Bachelor(x) Unmarried(x) and Adult(x) Male(x)
Description Logic example
Example: Describe
the set of men with at least three sons who are all unempoyed and married to doctors and at most two daughters who are all professors in physics ot math departments
And(Man,AtLeast(3,Son),AtMost(2,Daughter), All(Son,And(Unemployed,Married,All(Spouse,Doctor))), All(Daughter,And(Professor,Fills(Department,Phusics,Math)))).
As the example shows, Description Logic is a kind of variable-free logic that can be translated to FOL (”exercise”)