chapter 4 logic-oriented representation formalisms stand 20.12.00

42
Chapter 4 Logic- Oriented Representati on Formalisms Stand 20.12.0

Post on 19-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Chapter 4Logic-Oriented Representation

FormalismsStand 20.12.00

- 2 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Recommended References

• This chapter is not intended to provide a complete introduction into knowledge representation formalisms. It will rather be a sketch and a presentation of the terminology.

• For a rigorous approach we recommend:– S. Russel, P. Norvik: Artificial Intelligence - A modern

approach. Prentice-Hall International 1995– Michael M. Richter: Prinzipien der künstlichen Intelligenz. (In

German) Teubner Verlag, 2. Edition 1992

- 3 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Preliminary Remarks (1)

• This section introduces the basic terms of logic oriented knowledge formalism methods

• It is, however, not intended as a complete introduction into the field

• A principle familiarity with the field is assumed as a prerequisite and we will rather provide the special terminology which will be used

• Some emphasis is put on constraints and issues which play a role for internet representations.

- 4 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Preliminary Remarks (2)

• The role of a formal representation is threefold:– To define precisely the syntactically allowed strings of

symbols– To obtain an unambiguous interpretation (semantics) of the

represented syntax– To allow the performance of meaningful operations like

deductive inferences.

• The occurrence of different formalisms is a consequence of the fact that different contents and demands for the operators ask for conceptionally different representation methods.

- 5 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Preliminary Remarks (3)

• In all classical logic oriented representations we have only two truth values true and false (T, F or 1,0).

• This is different in several generalizations, in particular in fuzzy logic where truth values between 0 and 1 are allowed in order to express „partial truth“.

• Knowledge may be, however, incomplete. This leads to the distinction between closed and open worlds. There are various ways to deal with this which we will discuss later.

- 6 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Attribute-Value Representations

• Attributes A1,..., An are intended to represent properties of

objects. Attributes have domains (types): T1, ..., Tn (standard

or user defined).• Values of attributes : a1T1 ,..., anTn

• If the set of attributes is fixed: • An attribute-value vector is an n-ary vector:

F = (a1 ,..., an) T1 x ... x Tn

• Representation of unknown values: Use e.g. a special symbol “unknown”; ai Ti {unknown} or a typed

variable.• If the set of attributes is variable :

• An object is represented as a set: F = {A1=a1 ,..., An=an}

with a1T1 ,..., anTn

- 7 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Object-Oriented Representations

• Aggregation of attributes belonging together to object descriptions, i.e. each object is described by a fixed set of attributes

• an object is an independent unit

• relations exist between objects• each object belongs to an object class

• object classes are arranged in an inheritance hierarchy

• subclass inherits properties of the superclass (e.g., attributes)

- 8 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Objects and Classes

• Object:

An object describes a certain entity of the domain by a finite set of properties. Each property is represented by attribute-value pairs.

• Object Class:

An object class describes the structure of objects by defining a finite set of attributes and respective types.

• Object Instance:

An object instance (object) of a certain class assigns concrete values to the attributes.

- 9 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Relations between Objects

• Relations between objects are important

• Most important relations:

– taxonomic relation: “a-kind-of” relation expresses a

abstraction/refinement relation between objects of the

domain.

Example: Hotel a-kind-of House

– compositional relation: “is-part-of” relation expresses

the composition of objects from sub-objects.

Example: Room is-part-of Hotel

- 10 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Fuzzy Sets

• Fuzzy sets are generalizations of ordinary („crisp“) sets.• Suppose U is some (ordinary) set.• A fuzzy subset X of U is defined by a function

µX : U [0,1]

• Notation: X f U

• For y in U µX (y) is called the degree of membership of y to X and µX is the membership function of X.

• Example: X = Young_Customer, µX (Bill) = 0.5 if Bill is of age 32

• This is easily generalized to n-ary relations

- 11 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Rough Sets

• Suppose a universe U is given. Rough sets deal with situations where it is not clear whether an element x of U belongs to a subset or not. This can be due to several reasons, e.g.,– the description of x is incomplete or possibly erroneous– the description of the subset is incomplete or imprecise.

• Def.: A rough subset of U is a pair

P = (Pl, Pu), Pl, Pu U.

Pl is called the lower and Pu is called the upper approximation of P.

• Terminology: x is surely in P if x Pl,, x is surely not in P if not x Pu.

- 12 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Notation for Predicate Logic (1)

• Definition (primitive symbols):

– Logical symbols:

– Function symbols: f, g,... f1, g1,...

– Predicate symbols: p, q, ... p1, q1,...

– Variables: X,Y,Z,... X1,Y1,Z1,...

• Definition (terms, ground terms)

(i) Variables and 0-place function symbols are terms.

(ii) If t1,...,tn are terms and if f is an n-ary function symbol (n>0), then

f(t1,...,tn) is a term.

(iii) All terms are obtained from (i) by iteration using (ii).

(iv) Terms without variables are called ground terms

- 13 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Notation for Predicate Logic (2)

• Definition (formula, atomic formula, ground formula):

(i) If P is an n-ary predicate symbol and if t1,...,tn are terms

then P(tn,...,tn) is an atomic formula; each atomic formula is a formula.

(ii) If and are formula then are also formulas;

If x is a variable, then xx are formulas.

(iii) All formulas are obtained from (i) by iteration using (ii).

(iv) Ground formulas are formulas without variables.

- 14 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Variables and Substitutions

• If we have a variable x in a formula without quantifiers a substitution is a replacement of the variable by a term t; it is a ground substitution if t is ground. The formula obtained by replacing all variables by a ground substitution is called an instance.

• Variables in formulas can be interpreted twofold, assuming implicitly that– the variable is universally quantified (x , i.e., true for all instances);

this is usually the case when the formula is an entry in a knowledge base;

– the variable is existentially quantified (x , i.e., true for some instance); this is usually the case when the formula is used as a query where one asks for which instances the formula is true.

- 15 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Rules (1)

Logical rules are of the form: 12nThe k are the preconditions of the rule and is the conclusion.

There are two ways to use a rule:• If all preconditions are true then we can conclude that the

conclusion is true (forward application).• In order to establish the truth of the conclusion it suffices to

establish the truth of all preconditions (backward application).• A rule-based system has usually other entries besides rules.

Typically it contains facts, i.e., atomic ground formulas.• A typical query is of the form -? P (x1,...,xn) which asks for

instances which can be derived using the facts and the rules.

- 16 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Rules (2)

• Generalization : is some action.

• Semantics: The truth of the preconditions allows to carry out the action.

• Typical actions are changes of the knowledge base: Adding, removing, or modifying entries (e.g., facts)

• Such rules can meaningfully be applied only in the forward mode.

• Such actions are central elements of planning systems where the goal is to find sequences of actions leading to a certain desired result.

- 17 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Actions• An action changes a situation and its description has to

describe this change.• A situation description sit is a set of ground atomic

formulas.• The application of an action A consists of two lists of

ground atomic formulas:– The delete list DEL– The add list ADD

• The new situation sit’ from applying A to sit is

sit’ = (sit / DEL) ADD• In simple cases the preconditions can also be described

as lists of ground atomic formulas.

- 18 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Constraints (1)• n-ary relations between objects are n-ary constraints.• Constraints can be described in many ways, e.g., by

formulas in predicate logic or by enumeration.• The constraint satisfaction problem (CSP) presents

constraints with variables and asks for a substitution with objects such that the constraints are satisfied.

• Formally: CSP = (C, Var, Dom) where C is a set of constraints, Var are the variables in C and Dom is the list of domains for the variables.

• Hard constraints are mandatory conditions.• Weak constraints are optional. If one introduces priorities

or weights of relevance for constraints one obtains an optimization problem.

- 19 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Constraints (2)

• There are two main strategies for solving a CSP:• (1) Constructive method: Start with some values for

some variables, extend this to other variables as long as possible; if this is no longer possible make backtracking and choose other values.

• (2) Destructive method: Allow all values in the first place and remove successively undesired values.

• These two methods have their counterpart for weak constraints: One can start with most hard constraints and proceed to weaker ones as long as this is consistent or start with all constraints and remove the weak most step by step until consistency is reached.

- 20 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

• For a CSP = (C, Var, Dom) a set of correctabel constraints is a triple (C‘, S, M) where(i) C‘ is a subset of C; the constraints in C‘ are called correctabel and

those in C‘‘ = C / C‘ are called uncorrectable,(ii) S is the set of substitutions for the variables which satisfy all

constraints in C‘‘,(iii) M is a mapping M : S Sol, where Sol is the set of

solutions for the CSP which does not change the variables in C‘‘.

• The CSP (C‘‘, Var, Dom) is the skeleton of (C, Var, Dom).• This offers the possibility to split the constraint propagation

into two phases: First satisfy the skeleton and then solve the whole CSP by applying the modifications M.

Correctible Constraints

- 21 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Presentation of CSP’s

• The usual presentation of a CSP is non-incremental,i.e., in one step.

• An incremental presentation gives the CSP step by step, i.e., in form of sequence of the constraints.

• The solution process can then start with partial solutions for the incompletely presented CSP.

• In special situations the problem solver can influence the sequence in which the constraints are presented. Then the two processes of completing the problem presentation and the solving of the problem can be interleaved.

- 22 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Weak Constraints

level 1level 2level 3...

Constraint on the samelevel have the same degreeof importance.Each level on a higher degreeis more important than all constraints of lower degrees.

HierarchiesPoint evaluationsEach constraint has aninteger associated to it.These values are addedup: Higher values meanhigher importance.

Fuzzy constraintsValues for the variablesmay satisfy a constraintto some degree (a real number between 0 and 1).Higher degrees mean better fulfillment.

- 23 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

How Hard are Hard Constraints Really ?• Hard constraints are presented by the user: They have to

be satisfied.

• If confronted with the unsatisfiability of the CSP the user may be willing to regard it under special circumstances as a weak constraint. This is due to the fact the constraint is not an absolute necessity but rather the consequence of some decision. This decision is part of the context in which the decision took place.

• A factual context is a consequence of the laws of logic, physics etc.

• A normative context is a consequence of decisions.

• Hard constraints based on factual contexts cannot be withdrawn; if they are based on normative context they may be changed into weak constraints.

- 24 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Constraints and Rules

• In a rule

12none can regard the preconditions as (hard) constraints. The constraints result from – factual contexts are called factual preconditions– normative contexts are called normative preconditions.

• This reflects the differences between– possible and impossible (factual)– allowed and forbidden (normative)

• This is the topic of deontic logic.

- 25 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Remarks on Optimization (1)

• The task of optimization is to find maximal (minimal) elements in partially ordered sets U. If the set is not totally ordered then a maximal element is not necessarily a global optimum, i.e., larger then every other element.

• This typically occurs when we deal with attribute value vectors(a1 ,..., an) T1 x ... x Tn, where each Ti is partially ordered

• Here U T1 x ... x Tn is the set of legal products, each of which is described by (a1 ,..., an)

• The orderings on the Ti are called local preferences and the ordering on U is the global preference

• Multi criteria optimization problem: find global optimum by optimizing the local preferences.

• Optimization problems resulting from CSP‘s with weak constraints are such multi-criteria optimization problems.

- 26 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Remarks on Optimization (2)

• Instead of looking for the global optimum one tries to find a Pareto-optimum (a1 ,..., an) which is defined as:

If any ai Ti is replaced in a by some c Ti, ai < c, then the result is no longer in U.

• Expressed differently: In a Pareto-optimum the increase of some local preference leads necessarily to the decrease of some other local preference (otherwise not in U).

• The optimization problem in CSP‘ is to find a Pareto- optimum.

- 27 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Ontologies (1)

• Basic idea: To represent knowledge about a domain independent from the intended use. Such ontologies are called generic.

• Restriction: Task ontologies for special applications like diagnosis, planning, ...

• Recommended literature:– B. Bachmann: A solution for the semantic unification problem to

reuse knowledge-based systems. Infix Verlag, Reihe DISKI Nr. 162, 1997

– R.J. Brachmann: The future of knowledge representation. Proc. AAAI 1990, S. 1082-1092.

– T.Gruber: A translation approach to portable ontology specifications. Knowledge Acquisition 43(1995), S. 907-928

- 28 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Ontologies (2)

• Syntax of ontologies: As in predicate logic• Additions (not principle extensions):

– Types (possibly structured)– Identifier – etc

• An ontology is a logical theory represented in its syntax, the entries are called logical axioms.

- 29 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Ontologies (3)

• Example:

identifier is the name of a unary relation (class), or of an n-place relation or of a function. Possible axioms:– x1,...,xn identifier(x1,...,xn) (x1,...,xn)

– x1,...,xn identifier(x1,...,xn) (x1,...,xn)

• The first form describes a necessary and the second form a necessary and sufficient condition. is some expression in which identifier does not occur.

- 30 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Task Ontologies

• Example domain: Technical devices. • Tasks:

– Fault diagnosis:• Failure probabilities, financial value of components,

reachability of components (for test purposes),...– Design:

• Functional units, compatibility of components, constraints for design parameter,...

– Electronic sale:• Replacement of parts, price of components, additional

parts,...

- 31 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Knowledge Interchange Formats

• They are intended to reuse knowledge bases which are syntactically written in different individual ways by different programmers (in analogy to rtf for different word processors).

• Each knowledge should be translated into the interchange format and each base in the interchange format should be transformed backwards.

• For predicate logic this is possible because its syntax is unambiguously defined.

• There exist different such formats.

- 32 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Representation of the Syntax of Predicate Logic• Principle: Each expression is build up from primitive

elements in a unique way using constructors. Constructors have a certain arity.

• These properties must be shared by each form of representation.

• It can be achieved in various ways, e.g., by using brackets or by representation in tree form.

• Examples

P

t1tn

Two formulas

n terms

f

t1 tn

n terms

- 33 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

XML (1)

• XML (Extensible Markup Language) is an extension of the WWW language HTML. In XML semiformal and formal documents can be represented.

• XML is a universal exchange format for WWW-documents. • For our purposes the particular aspects of XML for declarative

and logical descriptions are of interest.• Literatur:

– E.R. Harold: XML Bible. IDG World Wide Books, S.Mateo, USA 1999.

– H. Boley: Beziehung zwischen Logikprogrammierung und XML. 14. Workshop Logische Programmierung, GMD Report 90 (ed.F.Bry et al) 1999, S. 19-34.

- 34 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

XML (2)

• Principle structure of a HTML-document:– <tag> Text </tag>

• Intention:– <tag> : Bracket „(„– </tag> : Bracket „)“– Text: Some string which can again include iterated pairs of

the form <tag> Text </tag>.

• This is a semiformal document:– The tag-structure is formal (it has a tree representation)– The texts are informal; they have no formal interpretation

(at least not in HTML).

- 35 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

XML (3)

• Tags can be enriched by attributes of the form ai = vi: • <tag a1 = v1 ... an = vn > .... </tag>• For „tag“ one can substitute different strings

(„annotated bracket symbols“)• Representation in hypertext form is possible:

<tag1><tag2> ... </tag2>

</tag1>

- 36 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

XML(4)

• Document-Typ-Definitions (DTD‘s) allow the systematic introduction of definitions for (iterated) tags.

• Theoretically DTD‘s correspond to context free grammars, i.e., they describe certain formal languages.

• In particular, predicate logic, horn logic, and attribute value representations can be represented.

- 37 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

XML (5)• In HTML each tag-expression is interpreted as a

command. • The different strings (tag-symbols) represent different

forms of commands. In HTML these commands are only related to forms of representations for the included text.

• Example:The command <i> means italic (= italic text).The text between <i> and </i> is e.g. interpreted, depending on the font and the size of the letters used, in italic.

• In XML such possibilities are extended by other structural elements which are described by DTD‘s.

- 38 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

XML (6)• Example from logic:

var: variable; const: constant; func: function symbol; rel: predicate symbol; term: term; atomf : atomic formula.

• A suitable DTD can describe atomic formulas such that the following is a correct expression:

<atomf><rel>owns </rel><term>

<func> father_of </func><const> bill </const>

</term><var> car </var>

</atomf>

Informal:The father of Bill owns a car.

predicate logic:owns(father_of(bill), car)

- 39 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

XML (7)• The structural elements of XML allow the syntactic representation of

powerful expressions in order to represent knowledge. • XML does not allow to represent the semantics of expressions.• Inference mechanisms for logical deduction are not in XML.• XML allows, however, queries by which some simple inferences can

be simulated, e.g. in the query language XQL:– For the query //tag all elements of the form <tag>...</tag> are

returned– For the query //tag[@a=v] all elements of the form

<tag...a=v...>...</tag> are returned – In order to answer such queries one needs to go inside of an

iterate tag expression. This can be regarded as an inference process because in cannot be obtained by a single substitution.

- 40 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Representation of Real World Things

• Objects of the real world do often not have a natural representation in the formalisms discussed so far. One would rather prefer e.g.– pictures, videos, sound etc.

• In order to treat them formally (a demand from the suppliers side) a translation into a formalism would be necessary. In general such a translation is presently not possible.

• The way out offered here is to mix formal and informal elements in such a way that the demand of the customer can be satisfied (see chapters 9 and 10). A formal product description can, e.g., be enriched by some picture which is formally redundant.

- 41 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Agents

• Agents are a means to perform actions in a distributed way.

• Agents have an inner structure and can communicate with each other using messages.

• Agents can be organized in multi-agent systems which gives rise to the following tasks:– Modeling the individual agents– Distribution of the overall task in tasks for the agents and

assignments of the tasks to the agents– A control structure for the communication between agents.

• Applications are in chapter 14.

- 42 - (c) 2000 Dr. Ralph Bergmann and Prof. Dr. Michael M. Richter, Universität Kaiserslautern

Summary

• A short repetition of representation formalisms has been given including attributes, predicate logic, object orientation; rules and constraints have been mentioned.

• An extension of the classical view is given by fuzzy sets.• Some aspects of constraints have been discussed.• The role of ontologies was emphasized.• XML was discussed as a possible interchange format

for the internet.