The expert system language GALEN

The expert system language GALEN

JOURNAL OF ELECTROCARDIOLOGY, Supplemental Issue 1988, S81-S87 The Expert System Language GALEN BY R. E. JENNINGS SUMMARY GALEN is an expert syst...

699KB Sizes 11 Downloads 119 Views

JOURNAL

OF ELECTROCARDIOLOGY,

Supplemental

Issue 1988, S81-S87

The Expert System Language GALEN BY R. E. JENNINGS

SUMMARY GALEN is an expert system language based upon nonmonotonic logic and sorted higher-order quantiflcational logic. It is designed to permit the composition of expert systems for computerized electrocardiographic diagnosis. Using GALEN, a cardiologist will be able to supplement or replace the commercially available computer-assisted ECG diagnostic systems with diagnostic criteria of his or her own for research and clinical uses.

knowledged authorship, with explanations that would include mention of the criteria used and an indication of their sensitivity and specificity over the populations that were their source. To gain the widest possible use, the system would have to run efficiently on a microcomputer. Those aims continue to constrain our work. But since the earliest stage, the more purely formal aspect of the project was steadily encroached as interesting problems have arisen for the specific application. In particular, we have had to devise a suitable language for the composition of diagnostic rules, and we have had to find a confident answer to the question as to what form of color-coded model would be best suited to the purposes for which the system was being devised. The result is that we now find ourselves at a middle stage in the largerscale development of an expert system development vehicle, with the original project as a prototype system. I will outline both of the progress of the kernel ECG project itself and the shell that is simultaneously taking shape around it. I will concentrate on the features that are relevant to the cardiologic application and on the two features that distinguish it from other expert system shells. The two are connected.

Galenus (129-ca. 199) was a logician of sorts as well as a physician. His work entitled E~cryoyq A LOL~EKTLK~, or Institutio Logica (Introduction to Logic), discovered in the early 19th century is the only logic textbook that we have of his period. He wrote a much longer work, called II~~LA~oS&oa (On Demonstration), unfortunately lost sometime after the 6th century, specifically on the applications of logical techniques to medical diagnosis. It is particularly because of his major preoccupation with diagnostic reasoning that we have named our expert system language for him. Our original aim was to produce an expert system for ECG interpretation that would incorporate into its control stategies some features of recent work in conditional logic. In particular, the system would permit a measure of indefiniteness or irresolution in its conclusions through the use, in addition to text, of a color-coded model of the human heart for the expression of its output. The use to which the system would be put would be twofold: (1) as a research tool by which diagnostic criteria could be encoded and tested eficiently over large populations of patients, and (2) as a means of indirect consultation placing before a practitioner, cardiologist, or medical student, in modular form, sets of diagnostic criteria of ac-

NONMONOTONICITY

From Simon Fraser University, Burnaby, British Columbia, Canada. Written in association with M. J. Dowad. Supported by Simon Fraser University and the National Research Council of Canada Industrial Research Assistance Programme. Reprint requests to: R. E. Jennings, Institute for Applied Logic, Simon Fraser University, Burnaby, British Columbia, Canada V5A 1%

The first of these two distinguishing features is its approach to inferential logic, which dictates the way in which the expert system represents partial knowledge. In this respect, GALEN is the exact mirror image of what the standard AI approach would dictate. S81

S82

JENNINGS

It happens that the most general and elegant representation of inference is also the clearest one for this purpose. This representation has the inferrability relation symbolized by the turnstile “t” placed between symbols that may be thought of informally as sets of sentences of some (unspecified) language. Again, informally, the expression

may be understood as asserting that if all of the sentences in the (possibly infinite) set I are true, then at least one of the sentences in the (possibly infinite) set Z is true. In the classical treatment of inference, the relation k has certain so-called structural properties that are independent of the particularities of the language in which the sentences of I and 2 are expressed. One of these is called monotonicity. In particular, k is monotonic, with set inclusion both on the left and on the right. That is, we may infer from IF2 that I U aI-2 U LRfor any sets Cpand a. Human inferential practice, by contrast with the classical approach, is often nonmonotonic, inasmuch as we sometimes find ourselves unprepared to draw inferences from an expanded body of evidence that we happily drew by default in comparative ignorance of the case. Expressed differently, we sometimes make inferences that are based upon the tacit assumption that certain conditions that would defeat the inference are false. In the formal vocabulary introduced above, we permit the inference of Z from I when, strictly speaking, to be justified in inferring 2, we ought to have 2 U il. R may be thought of as representing a set of background assumptions, or theoretical presuppositions. Various researchers in artificial intelligence have wished to embody in machine reasoning a kind of inference that is closer to this human practice. In one well-known toy example, a robotic babysitter is set to “phone the baby’s parents” if the situation seems to it to require it. Among the default inferences that it is allowed to make is the inference, ceteris paribus, from the baby’s being quiet to the baby’s being all right. How do we specify verbally what these ceteris paribus riders are, or the characteristics of a baby’s silence, or the other aspects of the case that prompt us to go and look in on it? The difficulty lies partly in the fact that the inferences that we make sometimes take into account features of the situation to which we have given no verbal representation, and even of which we are unaware. An inference is an event, not merely an abstraction. Causal nexus, and not just deliberations, give rise to them. Subliminal

cues, even pheromones may well play a part. Even when we consciously draw inferences, we may draw them on the basis of connections between things that we have never committed to a rule and that even, not being novelists, we might never express adequately in language. The problem is sometimes expressed as a problem of conditional logic. In the robotic example, the robot “thinks” that the conditional If the baby is quiet, then the baby is all right is true as a rule of thumb. But we don’t want its design to be such that it infers from that rule of thumb what is patently false, that: If the baby is not breathing and is quiet, then the baby is all right. That the baby is breathing is a background assumption, not a very clever one, that the robot is tacitly assuming. What does it mean to be true as a rule of thumb? Brutally, it means to be false. More charitably, we can understand it to mean that the conditional is allowed to survive as a hypothesis even after the failure of the experiments by which we might test it, provided that the failure is of the right kind. In a standard example, we want the sentence. If I strike this match, it will ignite to be considered true even though the sentence If I soak this match overnight and strike it, it will light is false. So if the experiment of striking the match fails, but fails for the right reason, which is to say, because the ceteris paribus conditions were unfulfilled, then the failure is not allowed to count against the conditional. Here is where our approach differs from the standard one. First, it has to be pointed out that we would be poor researchers if all that we jotted down in our experimental journal was that the match did not light. Not only did the match not light, but it left a nasty smudge on the striking plate and a trace of water on the platinum surface of the striking apparatus; a little heat was registered on the phlogistometer, and so on. Those are a part of the experimental outcome, and if we did not know before hand that the match was wet, a brief perusal of our notes would provide incontrovertible evidence. This simple observation suggests a fundamentally important point. We can represent the ceteris paribus character of default reasoning either by riders on the preparation of the experiment or by hedges on its outcome. In the nonmonotonic case, we can think of there being a background assumption tacitly conjoined to the antecedent con-

GALEN:

EXPERT cyan

blue

SYSTEM

S83

LANGUAGE

ditions or of there being the negation of the assumption tacitly disjoined to the outcome. Either: r,(&c

yC?lllXV

Fig. 1. The RGB cube.

Fig. 2. Graphic display system data flow diagram. (In this figure and in the following, processes are shown as circles. Directed arrows indicate the flow of data resulting from the action initiated by a process. Data stores are shown as horizontal lines, and square boxes are for action initiators. Dashed arrows are event flags.) This figure shows the top level data flow of the graphics system. Upon startup, the model structure process (1) uses the model definition files to build a dynamic model structure. As it does so it maintains an index table of pointers into the parts of the model. A coordinate file will be used to store the XYZ values of the data points that make up the model. The user can then request display of the model structure (2) using the values in the coordinate file or position and interactively edit the model (3). It is envisaged that the user will be able to adjust the display characteristics of the model (41, such as the color intensity range, saturation, or visibility, using the parts index to access specific parts. Also, the results of the expert system diagnostics will be displayed (5) using the parts index to modify the model according to a symptoms file.

When we consider the central examples that have inspired the theory of nonmonotonic inference, they are all capable of this revision. From a purely classical viewpoint, the revision makes no difference. But if we propose to axiomatize a nonmonotonic conditional logic that reflects this feature of human inferential practice, that the revision makes a profound difference and the logics that emerge are mirror images, in a sense, that can be made mathematically precise. The differences suit the logics to different kinds of application. The standard version that sees the weakening of the conditional as due to a tacit strengthening of the antecedent will have application where some determinate output is expected from some relatively indeterminate input (the robot must “phone

Fig. 3. Create model structure. The model creation process first sets a root node (1) for the hierarchial model tree. Guided by the model definition files, the separate parts of object layers, starting from the outside with coronary veins and arteries, then exterior chamber surfaces, etc., are added to the model (2). If a part has interior parts (e.g., internal right ventricle wall) then valves, the parts are nested within the layer branch (Fig. 4). Special case parts, such as conduction pathways, are added to the side of the layer they are associated with. The patches that make up a part are added to the model and the coordinates stored in a file (4). From these raw surface coordinates control points are calculated that allow the patch to be subdivided using a b-spline approximation technique to give a smoothly curved patch surface in two recursions.

S84

JENNINGS

Fig. 4. (A) Simplified model structure showing the layering of the model parts, from left to right, and the nesting of values within the interior right ventricle. The open boxes to which the parts point hold the part attributes, bounding box values, etc. The segmented boxes off these hold the patch point information. (B) Display flow chart, which maps the logic of simple wire frame display algorithm. At the start the first outer layer is scanned to determine whether any parts have been clipped. (The outer coronary veins and arteries are permanently marked as clipped.) If any are found, then the back facing patches are drawn. If any of the clipped layers have sublayers the search “pushes down” to that layer and again looks for clipped objects. If none is found the fronts of the objects at that level are drawn. Then, if it is possible to “pop up” a level, it is done, and that layer is checked for the next occurrence of a sublayer on a previously visited part. After all of the sublayers of clipped parts of a level have been processed, the entry point for that layer is examined for special case “side” layers, which are drawn immediately before the fronts of the parts of that level are drawn. The cycle repeats until it “pops up” to the top of the model and exits.

the parents”; the conditons in which it must do so are unspecifiable.) The version that sees the weakening of the conditional as due to a tacit weakening of the consequent will have application where the input is determinate but the output is relatively indeterminate. This last we take to approximate the situation in diagnosis where such data as have been collected are perfectly determinate but the inferences to be drawn from the data are in some measure uncertain. The problems in which the former sort of inferential logic has been applied do not look promising. In the case of the robotic babysitter, it seems unlikely in the short term that any interesting degree of indeterminacy that can be written into robotic software will embody the proof theory of nonmonotonic conditional logic. The representation of indeterminate output is very much easier to arrange. We simply let an automated reasoner operate directly in the model theory of the logic. (In the case of the robot, this would amount to having the indeterminacy engineered rather than written into its makeup.) In the case of GALEN, this amounts to the provision of graphic as well as text output. As currently envisaged, the graphic output will be displayed on a three-dimensional computer model of the heart. Elements of the model

will take their spatial locations within the RGB cube generated by a 250 x 250 x 16 frame buffer (Fig. 1). Some of the rules of the knowledge base must therefore be such as to be able to orchestrate a sort of primitive animation achieved by pixel operations on the model. These can include alteration of such magnitudes as color and saturation. Since the point of such a model is to permit the expression of hypothesized outcomes that would be impossible or cumbersome to express in text, there must be a provision for the application, by means of a mouse, light pencil, or other interactive device, of labels to arbitrary parts of the model and for the storage of those labels and the required pixel operations to the portions of the model to which they apply. That, in brief summary, is our aim for the graphics portion of the system. Toward that ultimate goal, we have advanced something more than halfway. A detailed representation of the architecture of the graphics portion of the system is shown in Figures 2-5. I close this section with a second intriguing possibility. This is that, using the three-dimensional space of the RGB cube it would be possible to represent from an ECG record obtained simultaneously from 12 classical ECG leads the equivalent

GALEN: EXPERT SYSTEM LANGUAGE

Fig. 5. Interactive editing. The user is allowed to rotate the model to a desired orientation (1). When satisfied, the model points are transformed to this new position and the model structure is depth-sorted (2). If a clipping plane is set (3) to remove portions, the model is examined for bounding boxes cut by the plane (4). Patches that are cut are marked (5) and then subdivided into four component patches, which are inserted into the model and their points stored (6). These new patches are reexamined for intersection with the clipping plane, and the process is repeated. A straight edge to the resolution of the monitor is quickly reached.

Fig. 6. Rule editor screen with Sorts selected. Temporary sorts are enumerated within the quantifier. A sort specified by abstraction is specified by an expression containing a free variable.

Rule

So,,

R”l.3 ”

““I.3

sort

““IQ



Rule Label:

Th.?”

Fig. 7. Rule editor screen with Quantifiers selected.

Fig. 8. Rule editor screen with Actions selected.

S86

JENNINGS

of a direct-writing color vectorcardiograph, in the sense of Kinoshita et al., and to view the tracing in an arbitrary plane.

HIGHER-ORDER MANY-SORTED LOGIC The other distinctive feature of GALEN is its implementation of higher-order many-sorted logic, that is, of logic in which sorted quantification is permitted over higher-order objects, sets, sets of sets, functions, arrays, properties, etc. Higher-order quantificational language suggests itself for the expression of diagnostic criteria mentioning various combinations of leads, since the lead themselves seem best treated as higher-order objects, either as arrays of values or as functions. ,’ Sample ECG diagnostic criteria written 1”GI\LEN l, ,* “ECLARE SORTS l,

AR

automated

rea?.oner

Fig. 10. GALEN overview.

leadI. II, III, .3”1,a”r, .a”f. “1. v?..“3. “I, “5. “6: ,* DEFINE S”B50RTS l, subsortdef

/: Fig, 9. GALEN extract. Square brackets indicate the quantifier type “For all” or “Exactly r-2’ and corner brackets “( )” indicate the quantifier type “There exists” or “At least n.” “[ limb Ld I” is then the sorted quantifier “For all limb leads” and binds all occurrences of the declared variable “Ld” within its scope. “( {VI, V,} 1 Ld )” is the sorted quantifier “There exists at least one element of the temporary sort {VI, Vz))’ and binds all occurrences of the declared variable “Ld” within its scope.

Sorted quantifiers have many virtues for an expert system language, but chief among them is that they permit a syntax that is very close to the natural language of the expert. In computing literature it is also claimed for them that they are more efficient than unsorted quantifiers, since their use reduces a search space from a universe to a sort, but that is to overstate their case; standard quantifiers can be implemented as though they were sorted. We chose a sorted quantificational language for its naturalness and expressive succinctness. The alternative was a language requiring unmanageable Boolean expressions. For example, a diagnostic rule acting upon some feature found in three leads would require a Boolean expression involving (g”) or 220 disjuncts, each 3 conjuncts long. The notion of a sort is a pervasive feature of GALEN. It is fundamental both to the expression of rules in our language and to the manner in which the execution of the rules is controlled, for the rules themselves constitute a sort, as may any subset of them, and sortal quantifiers may be applied to them. So the language permits the expression of metarules by which rule blocks or “islands” can be created as navigational features of the knowledge base. The syntax of GALEN is best viewed through the screens of a hypothetical rule editor, listing

GALEN: EXPERT SYSTEM LANGUAGE

uncompaled GNEN hb

I

S87

standard actions. Elements of the first two element types are required constituents of a sorted quantifier. There is no rule editor yet. We can see the uncompiled syntax of GALEN in context by considering an extract that will simultaneously illustrate a sample knowledge base (Fig. 9). An essential structural feature is that the rules come last. The rules are preceded by all necessary declarations of sorts, functions, predicates, propositions, and subsorts.

SYSTEM OVERVIEW

d,ngnos,s (text)

The architecture of the prototype expert system and of the automated reasoner are illustrated in Figures 10 and 11. The multiplicity of database modules reflects the anticipated end use of the system as a consultative tool. Each database is, in effect, a separate expert system incorporating rules, strategies, diagnoses, and graphics controls as derived from the experience of a single expert.

Fig. 11. Automated reasoner overview.

REFERENCES possible elements of a rule for the selected element types. Figures 6-8 illustrate available quantifier types, primitive and other sorts, and

7 KINOSHITAS, KUMIKO S, HARUO H, SHUZO ITO:Direct-

writing colour vectorcardiograph. J Electrocardiol 10:393, 1977