AU595155B1 - Expert system apparatus and methods - Google Patents
Expert system apparatus and methods Download PDFInfo
- Publication number
- AU595155B1 AU595155B1 AU60798/86A AU6079886A AU595155B1 AU 595155 B1 AU595155 B1 AU 595155B1 AU 60798/86 A AU60798/86 A AU 60798/86A AU 6079886 A AU6079886 A AU 6079886A AU 595155 B1 AU595155 B1 AU 595155B1
- Authority
- AU
- Australia
- Prior art keywords
- term
- value
- def
- definition
- expert
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/02—Knowledge representation; Symbolic representation
- G06N5/022—Knowledge engineering; Knowledge acquisition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
- G06N5/045—Explanation of inference; Explainable artificial intelligence [XAI]; Interpretable artificial intelligence
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Computing Systems (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Mathematical Physics (AREA)
- Medical Informatics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
I
iv COMMONWEALTH OF AUSTRALI.
I
595155 Patent Act 1952 COMPLETE SPECIFICATION
(ORIGINAL)
Class Int. Class Application No Lodged Complete Specification Lodged Accepted Published Priority Related Art a 0 0 0 Name of Applicant Address of Applicant: A 4e Actual Inventor WANG LABORATORIES INC.
One Industrial Avenue, Lowell, Massechusetts, United States of America, 01851 1-0U%-A(y\C -V 0 0 Address for Service F.B. RICE CO Patent Attorneys 29A Montague Street, BALMAIN NSW 2041 Complete Specification for the invention entitled: The following statement is a full description of this invention including the best method of performing it known to us:- To: THE COMMISSIONER OF PATENT COMMONWEALTH OF AUSTRALIA By: Registered Patent Attorney
FS
F.B. RICE CO Patent Attorneys Sydney ii; l ~tT- I-r r EXPERT SYSTEM APPARATUS AND METHODS 00.
*0e
S.
5 0 0 0@ 0
S.
0000 S S S. S S. S 5
S
Cross-references to Related Applications Background of the Invention 1. Field of the Invention The present invention relates to expert systems implemented by means of digital computers and more particularly to the knowledge base and inference engine components of expert systems, to apparatus for creating expert systems, and to apparatus and methods for creating a definitional knowledge base.
2. Description of the Pi;;r Art: Figs. 1 and 1A In recent years, expert systems have become commercially available. An expert system is a system which applies information in a given field of expertise in the same fashion as would an
II
expert in the field. Additionally, expert systems resemble humE.n experts in that they ar- able to some degree to explain themselves. Depending un its complexity, an expert system may explain why it reached a given conclusion, explain why it wants a given piece of information, and permit the user to change the value of a given piece of information and see how that affects the result. Expert systems have been built which perform tasks such as configuring large computer systems, diagnosing bacterial infections, or diagnosing why an oil drilling bit has become stuck and suggesting a remedy.
Prior-art expert systems have generally been rule-based, i.e., they have functioned by applying rules obtained by questioning an *expert about his expertise to facts provided by the user of the expert system. The rules are generally of the form If A then B In such a rule, A is termed the predicate for B, which is the conclusion. When A is true, then the conclusion may be inferred to be true. For example, one rule in a medical diagnostic system 44O might be "If the patient has a fever and runny nose, he may have the flu." According to this rule, if the symptoms are a fever and runny nose, one possible inference is the flu.
-2i*1 i Figure 1 is a block diagram of a prior-art rule-based expert system 101. System 101 has three components, command processor (CP) 103, rule inference engine (RIE) 105, and rule store (RS) 107. RS 107 contains the rules 109 for the area for which the system is an expert. RIE 105 receives problem data from the user, applies the rules in RS 107 to the data, and provides the result of its application of the rules to the problem data to the user.
CP 103 controls RIE 105 by means of inference engine commands (IEC). CP 103 produces the commands from command input provided by the user. To continue with the flu example above, a person using a medical diagnosis expert might input the command to the CP "What disease?" CP 103 would then provide an inference engine command to RIE 105, which would determine that its rules for oe diseases required symptoms. RIE 105 would then request problem data from the user, perhaps by asking "What symptoms?" The user could then input the symptoms and RIE 105 could then find a rule 109 for which the symptoms were the predicate and return the rule's conclusion as result data. For example, if the input symptoms were "fever and runny nose", expert system 101 could conclude from the rule 109 cited above that the disease might be the flu. Of course, many other ailments have those symptoms, and there would therefore be more than one rule 109 having the symptoms as part of its predicate. Depending on its sophistication, expert system 101 could simply return as results the conclusions of all rules 109 having the symptoms as part of
I
their predicate or could ask the user for more symptoms and use the new symptoms to narrow the number of rules which would apply.
In either case, expert system 101 can, at the request of the user, show what rules 109 it used to reach its conclusion.
The first prior-art expert systems 101 were custom-made and required long and close cooperation between an expert, a knowledge engineer, and computer system designers. The expert provided his expertise; the knowledge engineer reduced the expertise to rules 109 and designed RIE 105 and the representation used to store the rules 109 in RS 107. Computer system designers, finally, wrote ge the programs which implemented the knowledge engineer's design.
0 0 00 *The large inputs of professional time required to custom build expert systems 101 made them very expensive and led the makers of expert systems 101 to develop special tools, called expert system shells, for making expert systems. Figure 1A is a block diagram 0 of an expert system shell 110 for making rule-based experts. As may be seen from that figure, the expert system shell has the components of the rule-based expert of figure 1 and an additional component, rule processor (RP) 111. Rule processor 111 is used to
°S
produce rules 109 for storage in a RS 107 specific to the expert system currently being built. RIE 105 is used in expert system shell 110 to test the expert system being built as it is constructed. When ali of the rules 109 for the expert system -4- =ZNI A
I,
S
0@ S
S
S
being developed have been written and the .system has been fully tested, users of the new expert system are given access to RIE 105 and to RS 107 for the new expert.
The usefulness of expert system shells 110 depends to a considerable extent on the sophistication of RP 111. In some systems, RP 111 requires rules 109 input in special forms. Thus, these systems generally require a knowledge engineer and cannot be used by the expert himself. In other systems, RP 111 constructs its rules from examples provided by the expert, and thus does not require a knowledge engineer.
Although rule-based expert systems 101 are becoming steadily more powerful, more usable, and less expensive, their reliance on rules has certain inherent disadvantages. First, most experts do not think about their areas of expertise in terms of a set of rules.
Because they do not, a knowledge engineer or a system which constructs rules from examples must mediate between the expert and expert system shell 110. In the first case, the development of expert systems is more expensive than it would be otherwise, and in the second case, the complexity of expert system shell 110 is greater than it would be otherwise and the expert is still not completely insulated from the rules, since he must still check the rules produced by shell 110.
*A S S 55 *5 5 0S 5 00 0 *a *5* 0
S.
S
SS
.5.
S.
Second, since RS 107 is a collection of rules 109 created independently of each other, there is no guarantee that the collection of rules 109 is complete or contains no contradictory rules. If a set of rules 109 is incomplete, expert system 101 may reach no result or a wrong result; if the set of rules 109 includes contradictory rules 109, expert system 101 may again reach no result or reach a result which depends on RIE 105's internal algorithm for resolving contradictions rather than the rules.
The ability to operate with incomplete sets of rules 109 or with contradictory rules 109 is part of the power of rule-based systems 101 and is required in situations in which the expert is unable to reduce his area of expertise to clear principles. However, 'expert systems are employed in m-,ny situations where the expert can reduce his expertise to clear principles, and in these situations, the ability to deal with incomplete sets of rules 109 and contradictory rules 109 makes detection of mistakes more difficult, and when a mistake is made, makes the behavior of system 101 dependent upon RIE 105's internal algorithms rather than on the rules.
Third, rule-based expert systems 101 are difficult to modify. The behavior of a rule-based expert system depends on the totality of its rules, and it is often difficult to determine what rules must
I
1 i
E
i i I:i -4' d a a
II
1 g eq
S
SS
S
*5 .5
S
S
S. S 05 5 0 S nt s be changed if the system's behavior is to be altered because it has bugs or because the expert has changed his mind about how he would deal with a given case.
Fourth, the power and complexity of rule-based expert systems 101 are not required for many situations in which expert systems are useful. Generally speaking, that power and complexity is required where the expert cannot fully define his expertise. However, there are many situations where the layman requires the guidance of an expert but the expert can completely and easily define his expertise. In such situations, useful expert systems and expert system shells need not have the complexity inherent in rule-based expert systems and expert system shells.
One such situation is that presented by complex forms such as tax forms. In most cases, little judgment is required to fill out the form, but the form is nevertheless so involved that many people o require the help of a tax preparer. Spread sheets have made it mechanically easier to deal with the data involved in filling out a tax form and permit a user to see how a change in one value affects others, but they have not provided the kind of reasoned 0000 guidance for the user which is possible in an expert system. What Sois needed, therefore, and what is provided by the invention described herein, is an expert system shell which is easier to use than those typical of rule-based systems and expert systems which -7- 7a 7a are substantially simpler than rule-based expert systems, but which provide reasoned expert advice in situations which do not require the full power of rule-based systems.
Summary of the Invention The present invention consists in a digital computer system operable as an expert system, said computer system comprising: storage means which stores a knowledge base including hierarchically-defined terms and their definitions, each said definition defining it's respective term as a sequence of one or more elements selected from a set of values external to the knowledgebase and/or a subset of S• Sthe hierarchically-defined terms having their definitions 15 at a lower level of the hierarchy than said respective term; and processing means programmed to receive commands .o from a user of the system, t, produce inference commands in response to said commands to obtain the definition of a given term, and to compute the value of said given term from its corresponding definition by obtaining the value of any term and any external value in corresponding definition, said system employing said computed value to produce an expert response to said user.
0!11-1 ooooo *I S n -1
A-~
Sre substantdall1y s mpler than iu-l-bded pei t sstms buL wbich provide reasoned expert advice in situations which do not f bquire the full power of rule based Systems.
Summar)y of th Invention...
The present invention relates to digital data processing systems and more specifically to expert systems and expert system shells employed in digital data processing systems. Expert systems of S the present invention employ definitions instead of rules. An expert defines his area of expertise as a set of terms with a corresponding set of hierarchical definitions. The definition for a term may include terms defined at a lower level of the hierarchy, literal terms, constant values, and values obtained from sources external to the expert system. The decisions which S. the expert would reach regarding a term in the hierarchy are expressed as values of the term. The defined terms make up the *knowledge base of the expert system of the present invention. The inference engine determines what decision the expert would have made regarding a given term by computing the term's value from its S* definition. If the definition involves other terms, the values of those terms are computed from their definitions, and if the i definition or the definitions of other terms involve values obtained from external sources, those values are obtained as r -8-
A,
needed to compute the value of the given term. If the external source is a terminal, the expert system asks the person at the terminal for a value and the person inputting the value may ask why the value is needed. The inference engine determines from the definition why the value is necessary and provides that information to the person inputting the value.
Once the inference engine has determined what decision the expert would have made, the user of the expert system may ask the expert system how it came to its conclusion. The inference engine again goes to the hierarchical definition of the term and works through the definition to show how it arrived at its result.
Additionally, the user can ask the expert system to assume another value for one of the terms used in the definition of the term the user originally asked about. The inference engine then substitutes the new value for the old and determines anew what' the result is for the term the user originally asked about, thus showing how the change in value of one of the subordinate terms *affected the value of the term originally asked about.
The techniques used in the expert system of the present invention to determine why the expert system requested a given input, how the expert system arrived at a conclusion, and to change the value of a term and see the result are all applicable not only in the -9expert systems of the present invention, but also in other systems employing hierarchically-defined sets of terms.
Expert systems of the present invention are created using an expert shell of the present invention. The expert shell contains the inference engine and the definitional knowledge base just described and additionally contains a definition processor for creating the definitions in the definitional knowledge base. To use the definitional knowledge base, the user of the shell (generally the expert) inputs a define command followed by the term he wishes to define. The definition processor then requests 00:" *a description of the term, and the expert describes the term. The description indicates how the term's value is to be derived and *o* may contain other terms, constants, or a description of where an external value is to be obtained. If the description contains no further undefined terms, the definition processor creates the term's definition from the description. If the description o contains further undefined terms, the definition processor requests a description of each of the undefined terms and ee processes the description as just described. The iterations continue until no undefined terms remain. As a term is defined, the term and its definition become part of the definitional knowledge base. The definition processor further permits the expert to redefine terms, remove a term and its definition from the knowledge base, and see the definition for a term and for the I S *r terms which enter into its definition. As may be seen from the above description, the expert system shell of the present invention permits an expert to provide information in the form of definitions instead of rules, ensures that a set of definitions is consistent, and makes it easy to determine what terms a given term depends on.
The technique employed in the definition processor of the present invention to create hierarchical definitions may be employed not only in expert system shells of the present invention, but also in any system which creates hierarchical systems of definitions.
SO
It is thus an object of the invention to provide improved expert
U..
systems and expert system shells.
It is another object of the invention to provide an e>pert system having a definitional knowledge base and an inference engine which I employs the definitional knowledge base to reach conclusions.
It is a further object of the invention to provide an expert system shell for producing expert systems having a definitional U knowledge base.
Si i i-1- It is an additional object of the invention to provide apparatus and methods for creating sets of terms having hierarchical definitions.
It is yet another object of the invention to provide apparatus and methods for indicating to a user of a knowledge base having hierarchical definitions how a conclusion was reached, why certain information was requested, and how the conclusion will change if one of the terms receives a different value.
:g It is a still further object of the Invention to provide apparatus I and methods which guarantee that an expert system knowledge base Is complete and non-contradictory.
Other objects and advantages of the present Invention will be understood by those of ordinary skill in the art after referring to the detailed description of a first prototype embodiment *4 contained herein, to appendices containing the LISP code for the 0 *first prototype embodiment and a second prototype embodiment, and to the drawings, wherein: 8 0 w 0 12-.
I~ seas 900 e g.
0* 0 0 of 00 *0 0O *0 0*( 090 0eS,,
S
B.
Se Brief Description of Drawings Fig. 1 is a conceptual block diagram of a prior-art expert system.
Fig. IA is a conceptual block diagram of a prior-art expert system shell.
Figure 2 is a conceptual block diagram of the expert system shell and expert system of the present invention.
Figure 3 is a conceptual diagram of a hierarchy of definitions as used in the present invention.
Figure 4 Is a diagram of the terms and descriptions used to define the term FRAUD.
Figure 5 is a diagram of a LISP invironment.
Figure 6 is an overview of a first prototype embodiment of the present invention.
Figure 7 is a diagram of TDEF 617 of the first prototype embodiment.
-13- 'I i Figure 8 is a detailed diagram of the function DEFINE of the first prototype embodiment.
Figure 9 is a diagram of certain improvements in the second prototype embodiment.
For ease of reference to figures, the reference numbers used in the description of the preferred embodiment have three digits.
The two least-significant digits are reference numbers within a drawing; the most significant digit is the drawing number. For example, the reference number 901 refers to an item shown in figure 9.
DESCIPTION OF A PREFERRED EMBODIMENT 0
OS
The following description of a preferred embodiment first presents a conceptual overview of the expert system and expert system shell of the present invention and then presents a detailed description of a first prototype implementation of the invention. Certain improvements made in a second prototype implementation are discussed. A copy of the program for the first prototype is included in Appendix A and a copy of the program for the second prototype is included in Appendix B.
-14-
A>
-2- -In I. Conceptual Overview of the Expert System Shell and Expert System of the Present Invention: Figure 2 Figure 2 is a conceptual block diagram of expert system shell 201 and expert system 202 of the present invention. Expert system shell 201 has four components: command processor (CP) 203, definition processor (DP) 207, term store (TS) 215, and term inference engine (TIE) 219. Expert systems 202 produced using expert system shell 201 have all of these components but DP 207.
As will be explained in more detail below, CP 203 receives commands from users of shell 201 and system 202 and provides them to the other components; DP 207 processes definitions; TS 215 atores defined terms and their definitions; TIE 219 uses a term's definition from TS 215 to evaluate the term and perform other operations on it.
CP 203 converts commands from users of shell 201 and expert systems 202 into definition processor commands (DPCs) 204 and SsSinference engine commands (IECs) 217. In the prototype, DPCs 204 permit the user of shell 201 to define a term, redefine a term, undefine a defined term, view a term's definition, save a set of definitions, and restore a set of definitions. IECs 217 permit the user of shell 201 or an expert system 202 produced by shell 0 s Y 201 to determine the current value of a term, find out how expert system 202 reached that value, have expert system 202 assume a different value for a term and see how that affects the value of other terms, reset the value of any one or all of the terms, and when the determination of the current value of a term requires a value to be supplie4' irom outside the definition, to ask expert system 202 why the value is required.
Definition processor 207 defines TERMs 206. When a TERM 206 has been fully defined, TS 215 contains a defined term (DTERM) 211 corresponding to TERM 206 and a definition (DEF) 213 for DTERM 211. TERM 206 may be received either in a DPC 204 or from a description (DESC) 205 DP 207 requested from the user of expert ystem shell 201 in response to a TERM 206. DP 207 first determines whether there is already a DTERM 211 corresponding to TERM 206, whether TERM 206 is already defined. If it is, DP 207 retrieves DTERM 211 corresponding to TERM 206 from TS 215 and prepares it for use in the definition DP 207 is currently constructing. If it is not defined, DP 207 outputs a description request (DESC REQ) to the user of shell 201. The user provides a description (DESC) 205 of TERM 206 to DP 201, which then makes a 4i DEF 213 for TERM 206 using the information in DESC 205. As will be described in more detail below, DESC 205 is written in a definition language which permits the user to specify other TERMs 206, constant values, and that a value is to be obtained from -16j' outside expert system 206 for which the definition is being provided. The definition further specifies operations which may be performed on the values represented by TERM 206, constants, and external values in the definition. If DESC 205 contains TERMs 206, DP 207 treats those TERMs 206_in the manner just described.
If there is a DTERM 211 corresponding to TERM 206, DTERM 211 is used in DEF 213 being constructed; if there is not, DP 207 requests a DESC 205 defining TERM 206 and processes it as just described. The repetitive operation of DP 207 is shown in Figure 2 by arrow 208 showing how UDESC 210, which contains at least one TERM 206, is again processed by DP 207. Processing continues in this fashion until the original DESC 205 and all of the TERMs 206 in any DESCs 205 produced for TERMs 206 required to define the TERMs 206 in the original DESC 205 have been defined, i.e, have corresponding DTERMs 211 and DEFs 213 in TS 215.
*4 0 *0* The DTERMs 211 and DEFs 213 resulting from operation of DP 207 are placed in TS 215. DTERM 211 may be located in TS 215 by name.
DEF 213 corresponding to DTERM 211 is associated with DTERM 211, and may thus be used once DTERM 211 is located. Included in DEF 213 is a modified version of DESC 205 from which DEF 213 is derived.
The remaining operations specified by DPCs 204 are carried out in DP 207 and TS 215 as follows: when a TERM 206 is undefined, DP -17- 207 removes the corresponding DTERM 211 and DEF 213 from TS 215; when a TERM 206 is redefined, DP 207 removes DEF 213 corresponding to TERM 206 and requests a new DESC 205 for TERM 206. That DESC 205 is then processed in the manner just described. When a DPC requests that a TERM 206's definition be displayed, DP 207 displays the DESC 205 which was incorporated into the DEF 213-for DTERM 211 corresponding to TERM 206. Finally, the save operation saves the contents of a given TS 215 to a file for later use and the restore operation restores the contents of the file to TS 215.
Term inference engine (TIE) 219 performs operations using the DTERMs 211 and DEFs 213 in TS 215. The primary operation is the what operation, which determines the value of a DTERM 211 from its definition and external values provided by the user of expert system 202 or shell 201. TIE 219 performs the what operation in .response to an IEC 217 specifying the operation and a TERM 206 from CP 203. TIE 219 uses DTERM 211 corresponding to TERM 206 to locate DTERM 211's DEF 213 in TS 215. It then performs the operations specified in DEF 213 using the DTERMs 211, constants, and external values specified in the definition and returns the result, TRES 227, to the user of system 202 or shell 201.
The constants in DEF 213 are available for immediate use in S, calculating the value of DTERM 211; in the case of the external values, DTERM 211 contains a description of how the external value .nt -18value (EXVAL) 225 and receives EXVAL 225 from the source. In the simplest case, the source is the terminal being used by the user of system 202 or shell 201 and the-information is obtained by putting a question on the user's terminal screen and receiving his input; in more complex cases, the source may be a file or a data base.
In the case of a further DTERM 211 in DEF 213 for the DTERM 211 as it does so any DTERMs 211 in that DEF 213, and continuing thus Sbase.
until all DTERMs 211 from which the DTERM 211 whose value is being sought in the what operation is dependent have been evaluated.
*The constants, external values, and DTERMs 211 specified in each DEF 213 are dealt with in the manner just described. When all DEFs 213 have been evaluated, the value of DTERM 211 whose value is being sought is computed and returned as TRES 227.
In a preferred embodiment, EXVALs 225 which are obtained during evaluation of a given DEF 213 become part of that DEF 213's definition; thus, if the what operation is performed a second time on DTERM 211, TIE 219 will not produce any EXVAL REQs, but will simply use the stored EXVALs 225 to recompute the value of DTERM -19- 211. A preferred embodiment has two IECs 217 for modifying the stored EXVALs 225. The first, reset, simply removes all of the stored EXVALs 225 from the DEFs 213 for the DTERMs 211 specified in the reset command. Thus, when what is again performed, a new EXVAL 225 will be obtained as previously explained. The second, assume, permits a new EXVAL-225 to be provided to DEF 213 for TERM 206 specified in the assume command. When what is again performed in this case, the specified EXVAL 225 is used to derive the value of DTERM 211 for which the what operation is being performed.
If a user of shell 201 or system 202 wants to know why TIE 219 is S00asking for a given EXVAL 225, he can respond to an EXVAL REQ with the command for the why operation. In response to that command, TIE 219 outputs DESC 205 from DEF 213 for the DTERM 211 whose value was being computed when the EXVAL 225 was required, and the .e user can determine from DESC 205 why the given EXVAL 225 is important. The user can further use why to ask why any of the DTERMs 211 whose values are required to obtain the value of the DTERM 211 whose evaluation produced the EXVAL REQ are required, and TIE 219 provides the DESCs 205 for those DTERMs 211.
H S' 3. The Hierarchy of Definitions: Fig. 3 In defining any term, DP 207 produces a hierarchy of DEFs 213. If DEF 213 for the term being defined itself contains no terms, the hierarchy has only one level. If D.EF 213 for the term contains a further term, that term must be defined before the first term can be defined, and the first term is the top term in a hierarchy with two levels. If any of the DEFs 213 at the second level contains a further term, that term must be defined, and the hierarchy has three levels. The hierarchy i:hus continues to deepen until none of the DEFs 213 for the terms upon which other terms depend contains a further term, but is instead defined solely in terms of operations on constants or external values. As is clear from the above discussion, a DEF 213 is always the top DEF 213 in the hierarchy of DEFs 213 required to define the DTERM 211 which DEF 213 defines, but may at the same time be at a lower level in the hierarchy of DEFs 213 required to define some other DTERM 211.
Figure 3 is a conceptual illustration of one such hierarchy of DEFs 213. Hierarchy 305 contains DEFs 213(A) through 213(E) corresponding to DTERMS 211(A) through 211(E) belonging to set of -0 DTERMS 301. The topmost definition in hierarchy 305 is DEF 0 213(A), corresponding to DTERM 211(A). The notation OP(B,C) in DEF 213(A) indicates that DEF 213(A) specifies that the value of DTERM 211(A) is obtained by performing an operation on the values -21- 0 Pa,-: -3: I I
S
S. S
S
0 5* 5 0
S
*5 0 0@ *5 of DTERMs 211 and Similarly, DEF 213 B specifies that the value of DTERM 211(B) is obtained by performing an operation on the values of DTERMs 211(D) and Consequently, hierarchy 305 for DEF 213(A) has three levels: level 1 307, containing only DEF 213(A), level 2 309, containing-DEF 213(B) and DEF 213(C), and level 3 311, containing DEFs 213(D) and 213(E). DEFs 213(C), 213(D), and 213(E) do not define DTERMs 211 C, D, and E with other DTERMs 211, and cannot give rise to lower levels. Such DEFs 213 are termed terminal definitions 312.
In constructing hierarchy 305, DP 207 begins with TERM 206(A) corresponding to DTERM 211(A), which it receives from a DESC 205 from which a DEF 213 at a higher level is being constructed or from a define or redefine DPC 204. DP 207 then requests a DESC 205 for DTERM 211(A). DESC 205 defines DTERM 211(A) in terms of an operation on two TERMS 206, B and C. If DEF 213(B) and DEF 213(C) already exist, DP 207 can make DEF 213(A) and need go no further. If either DEF 213(B) or DEF 213(C) does not exist, DP 207 must produce those DEFs 213 before it can make DEF 213A. DP 207 thus asks for a DESC 205 for TERM 206(B) and for TERM 206(C).
In the case of TERM 206(C), DESC 205 defines TERM 206(C) only in terms of EXVAL(C) 225, and DEF 213(C) can be constructed immediately. In the case of TERM 206(B), DESC 205 defines TERM 206(B) in terms of two additional TERMs 206, D and E; consequently, DP 207 must descend another level and produce DEFs -o 'i, 1
I
-9- 213 for those TERMs 206. Again, DP 207 requests DESCs 206 for those terms. In both cases, the TERMs 206 are defined in terms of EXVALs 225, and consequently, both DEFs 213 can be constructed.
DEFs 213 for all TERMs 206 involved in the definition of TERM 206 A have now been constructed, DTERMs 211(B) through (E) corresponding to TERMs 206 through exist, DEF 213(A) can be constructed, and TERM 206(A) now has a DTERM 211(A) corresponding to it.
Because hierarchy 305 is constructed repetitively beginning with the top DEF 213 in hierarchy 305 and only TERMs 206 which have no S. corresponding DTERM 211 are defined, no DTERM 211 can have two DEFs 213 and no DEF 213 in hierarchy 305 can refer to a DEF 213 which is above it in hierarchy 305. Consequently, the DEFs 213 in 0*I* hierarchy 305 are necessarily complete and consistent with regard to DEF 213(A) in hierarchy 305 or to the top DEF 213 in any hierarchy incorporating DEF 213(A).
4. The Description Language for Descriptions 205 previously indicated, DP 207 makes DEFs 213 from descriptions (DESCs) 205. In the prototype, DESCs 205 are made using a .9 description language. The description language includes -23-
A
predefined terms specifying operations on terms, a case statement, and operations for obtaining external values.
The operations include Boolean operations, arithmetic operations, and text concatenation. The case statement is a list of boolean expression-value pairs of the form: (boolean_exp_l) value_1 (boolean_exp_n) value_n (OTHERWISE) otherwisevalue When DEF 213 containing a case statement is evaluated, the boolean experessions 1 through n are evaluated in order until one of them 0e is true. The value corresponding to the true boolean expression becomes the value of DTERM 211 defined by DEF 213. If none of the boolean expressions is true, the value corresponding to OTHERWISE becomes the value of DTERM 211.
The description language of the prototype permits specification of o0 *two classes of operations for obtaining external values. The first class, the ASK operations, obtains values from the terminal of the user of expert system 202. The first class, the ASK operations, are used to obtain external values from the terminal.
The second class, the RECORD operations, are used to obtain external values from a data base system. In both cases, the external values may be numbers, text strings, or boolean values, -24- -11 or they may select one of a set of alternative literal terms, terms which represent nothing but themselves.
ASK to obtain a numeric value has the form: ASK NUMBER "prompt_string" When the DEF 213 containing such an ASK operation is evaluated, DP 207 outputs the prompt string to the terminal and waits for a number input from the terminal. That number is then used in the evaluation of DEF 213. The prompt string may itself contain a previously-defined term, and consequently, a user's response may be made to depend on the value of a previously-evaluated term.
The ASK operations for boolean and text string values are specified in the same fashion as the ASK operation for numeric values, except that NUMBER in the above operation is replaced by YES-NO when a boolean value is sought and TEXT when a text string is sought.
ASK which selects one of a number of literal terms has the form: ASK CHOICE "prompt_string" (literal term_1 literal termn) i i Nhen the DEF 213 containing ASK CHOICE is evaluated, the prompt string is output and the user is asked to select one of the literal terms. That literal term may then be used in DEF 213 to compute the value of DTERM 211 defined by DEF 213.
The RECORD operations are generally analogous to the ASK operations, excL-t that the RECORD operation specifies how the external value is to be located in the data base and the data base supplies the value at the specified location.
5. Operation of Shell 201 and System 202: Figure 4
*O
The operation of shell 201 will be explained in detail using a hierarchy of definitions from which It may be determined whether someone has been defrauded. The legal definition of fraud requires that one party knowingly made a misrepresentation to the other party and that the other party relied on the misrepresentation to his detriment. Figure 4 shows a hierarchy of DTERMs 211 which corresponds to that legal definition.
Creation of the hierarchy of Figure 4 begins when CP 203 receives the DEFINE FRAUD command. CP 203 then passes TERM 206 FRAUD to DP «l -26definition. The expert provides the DESC 206 KNOWING MISREPRESENTATION AND DETRIMENTAL RELIANCE This DESC 206 contains two further TERMs 206 and the boolean AND operator. Thus, the value of FRAUD is to be computed by obtaining the values of the DTERMs 211 corresponding to the TERMs 206 and performing an AND operation on them.
Since the further TERMS 206 are undefined, DP 207 asks for their definitions. The expert provides the DESC 205 MISREPRESENTATION AND DEFENDANT KNEW MISREPRESENTATION s* for KNOWING MISREPRESENTATION and the DESC 205 RELIANCE BY PLAINTIFF AND LOSS BY PLAINTIFF for DETRIMENTAL RELIANCE. Again, these further TERMs 206 are undefined, so DP 207 asks for their definitions and the expert provides the definitions shown in 1 Figure 4. While DP 207 may ask for definitions in any order, a preferred embodiment defines all TERMs 206 necessary to define a given undefined TERM 206 before going on to the next undefined TERM 206.
-27- In the above example, the DESCs 205 for MISREPRESENTATION, DEFENDANTKNEWMISREPRESENTATION, RELIANCE BYPLAINTIFF, and LOSS BY_PLAINTIFF all contain only the system-defined DTERMs 211 used in the ASK YES-NO operation, so DP 207 is now able to produce DEFs 213 for all of the terms in the hierarchy. The values of all of the DTERMs 211 in the hierarchy depend ultimately on the values which the ASK YES-NO operation requests from the user of expert system 202 which employs the FRAUD definition, and thus depends ultimately on what the plaintiff says about what happened to him.
Use of the FRAUD definition hierarchy in expert system 202 begins with the WHAT FRAUD command which the user of expert system 202 inputs to CP 203. CP 203 generates a corresponding WHAT FRAUD IEC 217 for TIE 219. TIE 219 then determines the value of FRAUD by evaluating its DEF 213. In order to do that, it must evaluate the DEFs 213 for other DTERMs 211 in the hierarchy, beginning with KNOWING MISREPRESENTATION. The evaluation of KNOWING MISREPRESENTATION requires the evaluation of MISREPRESENTATION.
The evaluation of that DTERM 211 results in the execution of the NHAT YES-NO operation in its DEF 213, and TIE 219 outputs the prompt "Did he tell you anything that wasn't true?" If the user answers MISREPRESENTATION is false, KNOWING MISREPRESENTATION is false, and FRAUD is false, so TIE 219 returns TRES 227 to the user indicating that there is no fraud. If the user answers "yes", TIE 219 evaluates DEFENDANTKNEW -28- I MISREPRESENTATION, which again results in a question to the user.
Depending on the answer to the question, evaluation continues or is finished. TIE 219 proceeds in the above fashion until it has computed a value for FRAUD.
As previously mentioned, a user of expert system 202 may use the HOW user command to determine how expert system 202 arrived at its value for FRAUD. Assuming that the user answered "no" when asked "Did he tell you anything that wasn't true" (in the definition of MISREPRESENTATION), TIE 219 in the prototype will respond to HOW FRAUD by outputting *6 S f FRAUD is defined to be (KNOWINGMISREPRESENTATION AND DETRIMENTALRELIANCE) where (KNOWING MISREPRESENTATION) equals FALSE.
o..
As previously mentioned, DP 207 places DESC 205 for a DTERM 211 in the DTERM 211's DEF 213, and TIE 219 also stores the external values it receives in evaluating a DTERM 211's DEF 213 in DEF 213. In performing the HOW operation, TIE 219 first fetches and outputs DESC 205 from DEF 213 for the DTERM 211 being inquired S about and then evaluates the DTERMS 211 in DEF 213 as required to obtain the value of DTERM 211 being inquired about. The DTERMs 211 are then output together with their values. If a user wishes to inquire further, he need only repeat the HOW operation on the -29other DTERMS 211 specified in the DESC 205 output in the HOW operation.
As also previously mentioned, a user may respond to a request for an external value with the WHY command instead of a value. If a user responds in the case of the FRAUD example with WHY when TIE 219 asks "Did he tell you anything that wasn't true", TIE 219 responds with: MISREPRESENTATION is needed to determine the value of KNOWINGMISREPRESENTATION, which is defined to be MISREPRESENTATION AND SUBJECTKNEWMISREPRESENTATION a* and repeats the question.
*Ott .4 t*i i Again, the information used to respond to the WHY command comes from the DESCs 205 stored in the DEFs 213 in the hierarchy used to *4* define FRAUD. If the user wants to know more at this point, he a* can apply HOW to the DTERMs 211 mentioned in the response to the WHY command.
6 *4 6 -t S( I 6. The LISP Environment of the Prototype Embodiments: Fig. Having thus provided a conceptual overview of the structure and operation of shell 201 and system 202, the discussion proceeds to a detailed description of the implementation of the first prototype.
Both the first and second prototype embodiments are implemented in the LISP programming language and execute in the LISP environment. The LISP programming language and environment are frequently used to implement prototype and production expert V: systems and are well-known in the expert system art. The specific LISP dialect used for the prototype embodiments is COMMON LISP, 'which is described in Guy L. Steele, Jr., COMMON LISP, the to-o Language, Digital Press, 1984. Only so much of the LISP environment and language are described here as is required fdr a clear understanding of the mode of operation of the prototype embodiments.
0 !Beginning with the LISP language, the language differs from languages such as FORTRAN or PASCAL in that is is chiefly concerned with the processing of symbols, as opposed to the S° processing of data which is represented in a program by symbols.
The fundamental components of a LISP program are atoms. An atom may be a symbol, such as ABC, or a constant. The components are -31organized into programs by means of lists which may have no members or members including atoms and other lists. A list is made by enclosing its members in parentheses: (ABC) is a list with one member, the symbol ABC. Functions appear in LISP as lists in which the first symbol in the list-represents the function and the other atoms represent the function's arguments. For example, the add function is represented in LISP by the symbol and the list 2 3) specifies that the operation is to be applied to the atoms 2 and 3. Any atom or list which has a value when evaluated by a LISP interpreter is called a form. 5 and 2 3) are forms, and if the symbol ABC has a value, it is a form.
Functions are defined in LISP by means of the DEFUN function, in which the remaining items of the list define the function's name, se its arguments, and the value it returns. For example, (defun five
S
5) defines a function which takes no arguments and always returns the value Among the things LISP programs can do with symbols and lists is make them. Since a function definition is only a kind of list, a LISP program can provide a symbol to DEFUN as the name of the new a'4 symbol being created by DEFUN and then use the symbol to execute :i) the newly-created function. Symbols may either represent Ss themselves as symbols or values. Nhen a symbol is representing itself as a symbol in a LISP list, it is preceded by a mark. In -32the case of symbols representing functions, the value of the symbol is the function. However, if the function is placed in a list with its arguments and the list evaluated, the result is the value of that execution of the function. Thus, 'five represents the symbol five, while five represents the function defined by DEFUN above, and (five) represents the value of an execution of the function five, LISP programs are written and executed in a LISP environment.
That used for the prototype embodiments was made by Gold Hill Computers, Inc. for the Professional Computer manufactured by Wang Laboratories, Inc. Figure 5 is a conceptual block diagram of a typical LISP environment 501. Environment 501 has two main components, LISP interpreter 503, which evaluates LISP forms, and
S.
LISP symbol space 505, which stores LISP symbols (SYM 501) and s .00 their definitions (SYMDEF 509). DEFUN and certain other LISP functions create and define new LISP symbols or redefine previously-existing LISP symbols when they are evaluated; consequently, LISP interpreter 503 may be seen as nit only an evaluator of symbols, but also as a creator, definer, and 00. redefiner of symbols.
Operation of LISP environment 501 is as follows: when a user of LISP environment 501 types a list containing a form such as i (five), LISP interpreter 503 evaluates the form by locating the -33-
~Y~
L
symbol five in symbol space 505, determining what its SYMDEF 509 is, and then interpreting SYMDEF 509 to compute the value of five. In this case, SYMDEF 509 is the code for the function five which was created by evaluation of the DEFUN expression, and its interpretation produces the value which the interpreter returns to the user as the value of (five).
Because LISP interpreter 503 is able to create SYMs 507 and their corresponding SYMDEFs 509, store them in symbol space 505, and locate them in symbol space 505, LISP environment 501 automatically performs operations which are difficult to implement in other languages and which are essential for the operation of expert system shells and expert systems. For that reason, LISP environments 501 have been the preferred environments for the *o creation of prototype expert systems and expert system shells. As will be seen in the ensuing discussion, the prototypes of the present invention take full advantage of the symbol creation, definition, and location operations.
S.
Overview of the First Prototype Embodiment: Fig. 6 In the first prototype embodiment, the components of expert shell 201 and expert system 202 are implemented by means of LISP -34i i -ri 4 I 0 2 0110 00 00 00 0 0 *000 *0 @0 .0 0 0 000* 0 0 000@ 00 0 0 00 functions. Code for these functions is contained in Appendix 1.
Figure 6 gives an overview of that code and relates the LISP functions of the first prototype embodiment to the components of Figure 2 and the inputs and outputs of those components. Thus, the LISP functions making up CP 203 are contained in the dashed box with that label, the functions making up DP 207 are in the dashed box with that label, and those making up TIE 219.are in the dashed box vith that label. TS 215 is embodied in the first prototype by LISP symbol space 505, which stores LISP symbols and their definitions. The components of the first prototype embodiment should also be understood to include LISP interpreter 503, which executes the LISP functions making up the components, places the SYMs 507 and SYMDEFs 509 created by the components in symbol space 505, and manipulates the SYMs 507 and their SYMDEFs 509.
Beginning with EXPERT 603, EXPERT 603 performs the functions of CP 203 in the prototype. Code for EXPERT 603 may be found on page 14 of Appendix 1. As can be seen from that code, EXPERT 603 receives an input string, puts parentheses around it to produce a LISP form termed CFORM 605 in Figure 6, and performs the EVAL operation on it. When LISP interpreter 503 evaluates the form, it treats the first symbol in the form as a LISP function name and the remaining items in the form as a list of arguments for the named function.
4 SIi Expected input strings for EXPERT 603 are the commands for DP 207, namely DEFINE, REDEFINE, UNDEFINE, and the commands for TIE 219, namely WHAT, HOW, ASSUME, RESET, DEFINITION, SAVE, WHY, and RESTORE. DEFINE, REDEFINE, and UNDEFINE correspond to the DPCs 204 of Figure 2 and the remaining s-trings correspond to the IECs 217 of that figure. In the first prototype embodiment, there is no error detection in EXPERT 603; however, in a commercial embodiment, EXPERT 603 would include code for detecting and responding to improper input.
As may be seen from Figure 6, DP 207 is embodied in the first prototype by the LISP functions DEFINE, on page 1 of Appendix 1, REDEFINE, and UNDEFINE, both on page 3. When EXPERT 603 receives the DEFINE command with a TERM 206 such as FRAUD, and presents it Sto the LISP interpreter as (DEFINE FRAUD), LISP interpreter 503 Syinvokes the function DEFINE with the argument FRAUD. DEFINE requests a DESC 205 from the user and uses DESC 205 to produce the DEF 213 for FRAUD. As will be explained in greater detail below, the result of the invocation is a LISP function named FRAUD for which the DEFUN would look like the following: -36- -23- 207, (defun FRAUD (prog2 (push 'FRAUD arg-stack) (AND (KNOWING MISREPRESENTATION) 's (DETRIMENTAL RELIANCE)) .Cs (pop Arg-stack) In the course of defining FRAUD, KNOWINGMISREPRESENTATION and DETRIMENTAL_RELIANCE and the DTERMs 211 required for their definitions are all defined as LISP symbols representing LISP functions. AND is a predefined LISP function which performs the. S0s e AND operation on its arguments. The value returned by the ves function FRAUD is the result of the AND operation. it The DTERMs 211 which have been defined as LISP symbols the representing LISP functions are termed TSYMs 615 in the following discussion, and their definitions, which are the prototype's ow implementation of DEFs 213, are termed TDEFs 617. As the LISP r interpreter produces TSYMs 615 and TDEFs 617 in response to the g* o DEFINE function, it places them in symbol space 505. TDEF 617 in S o the first prototype is shown in Figure 7. As shown there, each TDEF 617 contains TFUNC 701, the LISP function represented by TSYM 615, TDESC 705, a modified copy of DESC 205 which was the source -37ii -24- 1 ~-~~u~Baus*auuule~ iY i .Il~_-ilil i; i__ I I of TSYM 615's definition, and TEXVAL 703, which EXVAL 703 specified by a user of expert 202 for contains the last TSYM 615.
0
S
*5 0000 ft S
S..
S S
S.
SO S *5
S:
S.
S.
S.
The remaining functions in DP 207 are invoked in the same fashion as DEFINE from EXPERT 603. REDEFINE first employs LISP operations which remove TFUNC 701 and TDESC 705 from TDEF 617 for TSYM 615 being redefined and then invokes DEFINE to make new values for TFUNC 701 and TDESC 705 in TDEF 617. UNDEFINE simply removes TFUNC 701 and TDESC 705 without making a new definition of TSYM 615.
Continuing with the implementation of TIE 219 in first prototype embodiment 601, when LISP interpreter 503 receives a CFORM 605 from EXPERT 603 which represents an IEC 217, it executes the function in TIE 219 specified in CFORM 605. As the functions in TIE 219 are executed, they provide forms (TFORMS 639) made from TSYMS 615 to Interpreter 505, which evaluates them and returns the results (TFORM RESULT) to the function being executed.
The functions in TIE 219 employ data structures in TIE 219, ARG-STACK 635 and TERMS-STACK 613, defined on page 1 of appendix 1, and SYM-BOUND-LIST, defined on page 12. Beginning with ARG-STACK 635, ARG-STACK 635 is used to store a TSYM 615 while the values of the TSYMs 615 with which it is defined are computed. As may be seen in the code for the procedure FRAUD above, the symbol -38- I, I a 0000 0 0 0q 00 000 00** 00* 00 00* 00*
I
00 *0 0 05* 00* FRAUD is pushed to ARG-STACK before the AND operation which defines FRAUD is executed and is popped from ARG-STACK thereafter. TERMS-STACK 613 is a stack of TSYMs 615. The stack is ordered by when a TSYM 615's TDEF 617 was created, with the first TSYM 615 to have its TDEF 617 created at the bottom and the last at the top. As will be explained in detail below, the last TSYM 615 is normally the one whose TDEF 617 is at the top of the hierarchy of definitions. SYMBOUNDLIST 637 is a list of TSYMs 615 which currently have EXVALs 225 assigned to them.
Beginning the discussion of the LISP functions in TIE 219 with WHAT function 619, that function is executed in response to the WHAT command to EXPERT 603. That command has the form WHAT DTERM 611. For FRAUD, it would be WHAT FRAUD, which EXPERT 603 turns into (WHAT FRAUD). WHAT function 619 on page 5 of Appendix 1 first uses a LISP function to determine whether its argument is a TSYM 615, and if it is, uses another LISP function which takes a symbol which is a function name as an argument and invokes the function, in this case, FRAUD. The result is the execution of TFUNC 701 in TDEF 617 for FRAUD. When that TFUNC 701 is executed, the TFUNCs 701 for MISREPRESENTATION and DETRIMENTAL RELIANCE are executed until the value of FRAUD has been determined. When a TFUNC 701 for a given TSYM 615 is executed, the TFUNCs 701 for any TSYMs 615 required to find the value of the given TSYM 615 are executed. When all of the necessary TFUNCs 701 have been -39-
I
executed, the value resulting from those executions is returned to the user of system 202 as TRES 227. If a TSYM 615 whose TFUNC 701 requires an EXVAL 225 already has such a value, the TSYM 615 is on SYM-BOUND-LIST 637 and TFUNC 701 uses TEXVAL 703 in TDEF 617 for TSYM 615; otherwise, TFUNC 701 generates an EXVAL REQ and obtains EXVAL 225 from the user. Thus, the WHAT function, together with LISP interpreter 503, operate as an inference engine for determining the value of the TSYM 615 whose definition is at the top level of the hierarchy as determined by external values.
Further, as long as a TFUNC 701 invoked as a consequence of the WHAT operation is active, Its corresponding TSYM 615 is on ARG-STACK 635.
HO function 623, on page 4 of Appendix 1, is executed In response to the HOW command, which specifies a TSYM 615. HOW function 623
S
S.takes that TSYM 615 as an argument and uses another LISP function, SYMBOL-FUNCTION with the argument TSYM 615 to obtain the list used S. with DEFUN to define TFUNC 701 corresponding to TSYM 615 and other LISP functions to obtain the third element in the third list In TFUNC 701. As may be seen from the FRAUD function above, that element is the iit -!eflning the operation by which the function's value is derived, In FRAUD, the list (AND (KNOWING MISREPRESENTATION) (DETRIMENTAL RELIANCE)). The HOW function 5 retrieves that list, uses TIE 219's DEFINITION function to display TDESC 705 for TSYM 615 used In the HOW command, and then evaluates I I r* Puts out one or more strings.
i the TSYMs 615 in the list retrieved from TFUNC 701, and outputs the results with suitable explanatory text.
The user of expert 202 may input the WHY command either to EXPERT 603 or to TIE 219 in response to an-EXVAL REQ output during evaluation of a TSYM 615. The WHY function is on page 1-4 of Appendix 1. The function may be invoked either with or without a TSYM 615 as an argument. In the first case, the function works with the TSYM 615 currently at the top of ARG-STACK 635, which is the TSYM 615 corresponding to TFUNC 701 currently being evaluated and whose evaluation produced the EXVAL REQ to which the user may be responding, and in the second case, it works with TSYM 615 provided by the user. In either case, the next step is to locate goo* the preceding TSYM 615 in ARG-STACK 635, which is the TSYM 615 corresponding to the TFUNC 701 whose evaluation led to the evaluation of the function corresponding to TSYM 615 being processed by WHY. If there is no preceding TSYM 615, the WHY command is meaningless, and a corresponding message is output to the user; if there is a preceding TSYM 615, then DEFINITION is used to output the definition for the preceding TSYM 615 together S" with suitable explanatory text.
Continuing with the DEFINITION function, whose code is on page of Appendix 1, the command to EXPERT 603 which invokes the function may have either a TSYM 615 as an argument or no -41-
I
I i argument. In the first case, TDESC 705 in TDEF 617 is output; in the second case, the TDESCs 705 for all TSYMs 615 on TERMS-STACK 613 are output.
The ASSUME function, whose code is-on page 9 of Appendix 1 is invoked with the ASSUME command, which specifies a TSYM 615 and a value. The TSYM 615 must be one whose TFUNC 701 requests an EXVAL 225. ASSUME first empties ARG-STACK 635, so that the TSYM 615 will be reevaluated before a WHY command succeeds, then sets TEXVAL 703 in TDEF 617 to the value received as an argument, and puts TSYM 615 on SYM-BOUND-LIST 613 to indicate that it has a TEXVAL 703.
The RESET function, whose code is on page 13 of Appendix 1, is invoked with the RESET command, which may or may not specify a TSYM 615. In the first case, only TEXVAL 703 in TDEF 617 corresponding to TSYM 615 is reset; in the second case, all TEXVALs 703 are reset. The RESET function first empties ARG-STACK 635 for the -easons previously described. If a TSYM 615 is specified, the RESET function unbinds TEXVAL 703 from TSYM 615, effectively removing it from TDEF 617, and removes TSYM 615 from SYM-BOUND-LIST 637. If no TSYM 615 is specified, RESET performs the above operation for every TSYM 615 on SYM-BOUND-LIST 637.
0 see 000 0 09 *6@si *00
II
S.
0 00 e g.
C i .0 0
S.
0e 00 -42-
A-
The SAVE function, whose code is on page 5, makes a file which contains a DEFINE command for each TSYM 615 followed by TDESC 705 for the TSYM 615. The DEFINE commands occur in the order in which TSYMs 615 occur in TERMS-STACK 613. SAVE works by outputting the following to the file for each TSYM 615 in TERMS-STACK 613: the string DEFINE, a string representing TSYM 615, and a string representing TDESC 705 for TSYM 615. The resulting file contains the TDESCs 705 in the order in which the DESCs 205 upon which they are based were input to DP 207.
The RESTORE function, whose code is also on page 5, restores the TSYMS 615 which were previously saved. It does so by performing a LISP load operation on the file. In the load operation, the LISP S* symbols in the file are evaluated. In this case, the result of m the evaluation is the production of the TSYMs 615 and their TDEFs 9*d f. 617 specified in the DEFINE commands in the resored file.
0b9 10. Detailed Description of DEFINE 607: Figure 8 Figure 8 shows how the DEFINE functions and functions invoked by it recursively create the hierarchy of TDEFs 617 for a given set of TSYMs 615. As previously mentioned, the manner in in which DEFINE creates the hierarchy of TDEFs 617 guarantees that each -43- 1.
TERM 206 is completely defined and that a given TERM 206 has only a single definition.
Figure 8 shows DEFINE, the major functions invoked by DEFINE, and the manner in which the data from which TSYMs 615 and TDEFs 617 are created flows between the functions, DEFINE 607 (page 1 of Appendix 1) produces DTERMs 211 from TERMs 206. When DEFINE returns DTERM 211, TSYM 615 and TDEF 617 corresponding to DTERM 211 have been created. DEFINE 607 is invoked by EXPERT 603 and RESTORE 633; additionally, it is recursively invoked by itself and by PROCESS-FUNCTION 811. EXPERT 603 provides CFORM 605 containing the DEFINE symbol and a TERM 206 to be defined; RESTORE 633 provides a CFORM 605 containing the DEFINE symbol and a TERM 206 which is a copy of a previously-saved DTERM 211 and a copy of TDESC 705 for that DTERM 211. Nhen DEFINE 607 is recursively invoked, its input is a TERM 206 which is is used in the DESC 205 of another TERM 206 being defined.
0 00 4. 0.
4 1 of.
S
S.:
I
S
I r a mm 0 am Generally speaking, TERM 206 is a single symbol; DESC 205 includes a case statement, TERM 206 may that case, DEFINE invokes CONVERT 809 to convert LISP form and then recursively invokes itself to the undefined TERMS 206 in the LISP form. Next, determines whether TERM 206 is a LISP symbol; if however, when be a list; in the list to a define each of DEFINE 607 it is not, DEFINE -44-.
_t -L.
607 simply returns TERM 206 unchanged. If it is, DEFINE 607 determines whether TERM 206 was provided by RESTORE 633; if it was, DEFINE 607 provides TERM 206 and the copy of TDESC 705 to GETDEF 805 and returns the value returned by GETDEF 805, namely a list whose element is TERM 206. If TERM 206 was not provided by RESTORE 603, DEFINE 607 determines whether there is already a TSYM 615 for TERM 206 or if TERM 206 is a literal there was no copy of TDESC 705). If either is the case, DEFINE returns a list whose element is TERM 206. If none of the other cases was true, GETDEF 805 is invoked by DEFINE 607 without a copy of TDESC 705.
GETDEF 805 (page 2 of Appendix 1) receives an undefined term (UTERM) 803 from DEFINE 607 and may also receive a copy of TDESC 705 for the term. In the first case, GETDEF obtains DESC 205 from the user; in the second case, it simply uses TDESC 705. Next it invokes CONVERT 809 to convert it to CDESC 807, which is a LISP form. Next, UTERM 803 and CDESC 807 are provided to PROCESS-FUNCTION 811, which returns TFUNC 701 for UTERM 811.
g Finally, GETDEF 805 places TSYM 615 on TERMS-STACK 613, and returns a list consisting of DTERM 211 corresponding to UTERM 803 to DEFINE 607.
CONVERT 809 (page 7 of Appendix 1) is invoked by DEFINE 607 or GETDEF 805. It receives a DESC 205 from its invoker and converts it to a LISP form, CDESC 807, which it returns to the invoker.
Returns next value of Rec which satisfies Test.
TV i, i I L(~ PROCESS-FUNCTION 811 (page 2 of Appendix 1) receives UTERM 803 and CDESC 807, passes UTERM 803 to DEFINE-FUNCTION 813, receives TFUNC 701 from DEFINE-FUNCTION 811, returns TFUNC 701 to GETDEF 805, and produces UTERML 815, which is a list of the UTERMs 803 from CDESC 807 which have not yet been defined. PROCESS-FUNCTION then invokes DEFINE 607 for each UTERM 803 on UTERML 815.
DEFINE-FUNCTION 803 (page 2 of appendix finally, creates and evaluates a DEFUN for TFUNC 701, thereby creating TFUNC 701, which it returns to PROCESS-FUNCTION 811-, which in turn returns it to GETDEF 805.
As can be seen from the above description, recursive invocations of DEFINE 607 continue until all of the TERMs 206 required to define the TERM 206 for which DEFINE was invoked have been defined; only at that point, DEFINE 606 returns DTERM 211 S. corresponding to TERM 206. Since the user of Shell 201 must define all of the TERMs 206 required to define a given TERM 206 and can give TERM 206 only a single definition, DEFINE 606 guarantees that a set of definitions for a term 206 is complete and consistent.
O 0 -46-
I
11. Prototype Embodiment 2: Figure 9 Appendix 2 contains the LISP code for prototype embodiment 2 of the present invention. As will be clear to one skilled in thr art upon examining appendix 2, prototype embodiment 2 contains many improvements over prototype embodiment 1, including a better interface to the user and more robust recovery from user errors.
Among the most important improvements included in prototype embodiment 2 are the alternate embodiments of TDEF 617 and WHAT shown in overview in Figure 9.
TDEF 901 contains TDESC 705 and tEXVAL 703 as did TDEF 617; it does not contain TFUNC 701, and contains two new fields: TFORM 903 and TTYPE 905. The change was made to eliminate a difficulty with prototype embodiment 1: namely, that the TERM 206 to be defined might correspond to some other LISP symbol already in symbol space 505. In that case, the definition produced by DEFINE 607 for TERM 206 would supersede the previously-existing definition of the o. symbol. The problem is solved in prototype embodiment 2 by replacing TFUNC 701 with TFORM 903, a LISP form which is not itself executable as a function but may be executed by an EVALUATOR function 911 in TIE 219. TTYPE 905 contains information about the kind of value returned when TFORM 905 is executed by EVALUATOR 911.
-47f
I
The remaining portion of Figure 9 shows the relationship between WHAT function 907 and EVALUATOR 911 in prototype embodiment 2.
WHAT 907 receives the WHAT CFORM 605 from EXPERT 603 as before, but instead of simply performing a LISP eval operation on TSYM 615 provided as an argument to WHAT, it provides TFORM 903 from TDEF 901 for TSYM 615 to evaluator 911, which in turn produces LISP forms to perform the operations specified in TFORM 903 and provides them to LISP interpreter 503. LISP interpreter 503 returns the results of the evaluation of the LISP forms to evaluator 911, which then makes these results into TRES 227, which it returns to WHAT 907, which in turn returns it to the user.
*0 12. Conclusion The preceding Description of a Preferred Embodiment and the appendices attached thereto have disclosed the best manner presently known to the inventors of implementing a novel expert S" shell and novel expert systems. The expert systems, though not as powerful as those produced in the prior art, have many of the most important advantages of pior-art expert systems and are particularly well-adapted to situations where what is sought from S the expert system is detailed knowledge of complicated procedures. The expert system shell is easier to use than expert system shells of the prior art and guarantees that the definitions -48making up the knowledge base of an expert system are complete and consistent.
The advantages of the expert system shell and expert systems disclosed herein stem from the fact that the knowledge base used by the expert system consists of terms defined with a hierarchy of definitions in which a given definition depends only on definitions lower than itself in the hierarchy and on external values obtained from a source external to the knowledge base. The expert system makes an inference concerning a term by requesting the user to supply one or more external values and then determining what value is produced for the term using the external values and the hierarchy of definitions. The hierarchy of definitions is produced in the expert system shell by requesting S definitions of terms used to define a given term until all of those terms are completely defined, thereby guaranteeing that the definitions from which the definition of a given term depends are complete and consistent.
While the embodiments disclosed herein were implemented in LISP, ag implementations of the invention are in no way restricted to LISP. It is further to be emphasized that the embodiments disclosed herein, though the best known to the inventors at the S- present time, are prototypes and intended to be purely exemplary.
Thus, the disclosed embodiments are to be considered in all -49respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are intended to be embraced therein.
S0.
9 o** I Appendix 1 SDEFINE Handles definition of terms for expert system (defun True (defun False (defun Yes (defun No t) nil) t) nil) (setf (setf (setf (setf (setq (setq (setq True t) False nil) Yes t) No nil) Batch-Define Terms-Stack Arg-Stack nil) nil) nil) If Term is already defined (as a function), returns eval.
If Term is a constant, returns it again.
Else calls GET-DEF to get its definition, returning eval.
(defmacro Define (Term &cptional Exp) (Define* ',Ter *(defun Define* (Term &optional Exp) (prog2 (if Exp (setq Batch-Define t)) (cond ((consp Term) (let ((Fix (Convert Term) it ready to it ready to m ',Exp)) 4
S..
5 e. 5* 4 S S
S
(cons (first Fix) (mapcar #'Define* (rest ((not (symbolp Term)) Term) (Exp (Get-Def Term Exp)) ((or (fboundp Term) Batch-Define) (list Term)) (t (Get-Def Term))) (if Exp (setq Batch-Define nil)) g cy
I
A 2J AppeCdix I1 1 ;Asks user for the definition of Term and defines it as a function.
If the definition uses terms, DEFINE* is called for each of them.
;Returns Term ready to eval.
(defun Get-Def (Term &optional (Exp (Prompt'"What is the definition of Term &aux Def) (setq Def (Convert Exp)) (if (symbolp (first Def)) (Process-Function Term Def) (Process-Constant Term Def)) (setf (get Term 'DEFINITION) Exp) (push Term Terms-Stack) (list Term) ;Processes function calls.
(defun Process-Function (Term Def) (cond ((member (first Def) '(ASK ASK* COND)) (Define-Function Term Def) (mapc #'(lambda (Define* X '(Literal))) (nth 3 Def))) ((equal (first Def) 'FIELD-OF) (Define-Function Term (FIELD-OF ,(second Def) ',(third Def))) (Define* (third Def))) ((member (first Def) '(FOR-EVERY FOR-SOME WHERE)) S (Define-Function Term Def)) ((null (rest Def)) (Define-Function Term (Define* (first Def)))) (t (Define-Function Term (cons (first Def) (mapcar #'Define* (rest Def)))) Checks compound expressions for embedded Processes constants.
(defun Process-Constant (Term Def) (Define-Function Term (first Def)) Calls DEFUN to define Term.
:(defun Define-Function (Term Def) (eval (defun ,Term (prog2 (push ',Term Arg-Stack) ,Def (pop Arg-Stack) -fAppemdix 1 2 Hi ia aa js. a «ii ;Puts up prompt and returns experssion.
(defun Prompt (&rest Args) (terpri) (dolist (Arg Args) (princ (string Arg))) (terpri) (princ (read-from-string (string-append (Remove-Commas (read-line)) ;Changes commas in Str to blanks, except when in quoted strings.
(defun Remove-Commas (Str &aux In-Quote) (do 0 I (length Str)) Str) (if In-Quote (if (equal (char Str I) (setq In-Quote nil)) (cond ((equal (char Str I) (setf (char Str I) ((equal (char Str I) (setq In-Quote t)) Redefines one or more terms.
:(defmacro Redefine (&rest Terms) (Redefine* ',Terms)) *defun Redefine* (&optional Terms &aux Not-All) (setq Arg-stack NIL) (if Terms (progn (Definition* (first Terms)) (setq Not-All t)) (setq Terms Terms-Stack)) (dolist (Term Terms) (remprop Term 'DEFINITION) (fmakunbound Term) (setq Terms-Stack (remove Term Terms-Stack)) (if Not-All (Define* Term)) Removes the definition of term.
(defmacro Undefine (Term) (Undefine* ',Term)) (defun Undefine* (Term) (setq Arg-stack NIL) •(remprop Term 'DEFINITION) (fmakunbound Term) S" (setq Terms-Stack (remove Term Terms-Stack)) (Show NL Term definition removed") Appendix 1 3 -3 q* Puts out one or more strings.
(defun Show (&rest Strs) (dolst (Str Strs) (princ Str) (defconstant NL (string Show definition of Term and the value of Uts terms.
(defmacro How (Term) (How* ',Term)) (defun How* (Term) (let ((Def (third (third (symbol-function Term)))) (Val)) (Show NL Term is defined to be" NL) (Show (get Term 'DEFINITION)) (when (and (consp Def) (not (member (first Def) '(ASK ASK* FIELD COND)))) (Show NL "where") (if (rest Def) (dolist (Subterm (rest Def)) (setq Val (eval Subterm)) (unless (equal Subterm Val) (Show NL Subterm equals (Value Val))) (if (and (eq (first Def) 'or) Val) (return)) .(if (and (eq (first Def) 'and) (not Val)) (return))).
(Show NL Def equals (eval Def)) S* Show reason Term is needed, p '*:..'(defmacro Why (&optional (Term (first Arg-Stack))) (Why* ',Term)) (defun Why* (&optional (Term (first Arg-Stack))) (let* ((Main-Term (member Term Arg-Stack)) S(Super-Term (second Main-Term))) (terpri) (cond ((null Term) (Show "Why what?")) ((null Main-Term) (Show "The value of Term is not currently being sought.")) ((null Super-Term) (Show "Because you asked for (t (Show Term is needed to determine the value of Super-Term NL "which is defined to be:" NL (get Super-Term 'DEFINITION))) 0 e 0 yr 0 f l Handles True and False values.
(defun Value (Val) (cond ((eq Val t) 'True) ((eq Val nil) 'False) (t (Make-String Val))
I
Displays value of Term (defmacro What (&rest Term) (What* ',Term)) (defun What* (Terms) (dolist (Term Terms) (if (fboundp Term) (Show NL "The value of Term is (Value (funcall Term))) (Show NL Term is not currently defined")
O
S
0
S.
0*
S
S.,
Displays the definition of Term.
(defmacro Definition (&optional Term) (defun Definition* (&optional Term) (if Term (print (get Term 'DEFINITION)) (progn (dolist (Term* Terms-Stack) (Show NL Term* (prini (get Term* 'DEFINITION (Show NL NL (length Terms-Stack (Definition* ',Term)) terms defined.") e) Saves current rule to File Saves current rule to File (defmacro Save (File) (Save* ',File)) ,(defun Save* (File) (let ((*standard-out .t* (open (string-append File :direction :output))) (dolist (Term Terms-Stack) (Show "(Define Term NL *(prinl (get Term 'DEFINITION)) (Show NL)) (close *standard-output*)) (Show NL "Rules saved to file (str ng-append File Loads previously saved rules from File.
*O*
(defmacro Restore (&optional File) (if File (load (string-append ',File (Files "RUL") 4," ;Lists all files in current directory (defun Files (&optional (Ending (mapc #'(lambda (Name) (print (pathname-name Name))) (directory (string-append Ending))) nil Returns a term as a literal (defun Literal (first Arg-Stack) ;String concatination.
(defun (&rest Strs &aux Pair) (setq Pair (string-append (Make-String (first Strs)) (Make-String (second Strs)))) (if (third Strs) (apply (cons Pair (rest (rest Strs)))) Pair Turns numbers to strings.
*..Cdefun Make-String (Val) (if (numberp Val) (let* ((Str (format nil "gD" Val)) co(Len (length Str))) (cond ((equal (subseq Str (max Len 4) 1) Len) ".ODO") (subseq Str 0 Len ((equal (subseq Str (max Len 2) 1) Len) "DO") (subseq Str 0 Len (t Str))) (string Val) Universal equality function.
Handles numbers and strings properly.
Same (Argl Arg2) (if (and (numberp Argl) (numberp Arg2)) Arl Arg2) S" (equal Argl Arg2) Opposite of Same.
(defun Different (Argl Arg2) (not (Same Argl Arg2)) 4:1 ~lst~e~6
A.
SDetermines if Val is in the range between Low and High.
(defun Between (Val Low High) (and Val Low) Val High)) Converts Def to a LISP expression.
(defun Convert (Def) (Replace Def '(FOR SOME) 0 2 'FOR-SOME) (Replace Def '(FOR EVERY) 0 2 'FOR-EVERY) (Replace Def '(FIELD OF) 1 3 'FIELD-OF) (cond ((null (rest Def)) Def) ((consp (first Def)) (Conditional Def)) ((member (first Def) '(FOR-SOME FOR-EVERY)) (Quantifier (first Def) (second Def) (rest (rest Def)))) ((equal (second Def) 'WHERE) (Quantifier (second Def) (first Def) (rest (rest Def)))) ((member (first Def) '(NOT MAX MIN ASK ASK* DISPLAY)) Def) (t (Prefix Def)) '.'.Replaces a list of two Terms at Posi, Pos2 in Def with a single Term.
e ep :defmacro Replace (Def Terms Posl Pos2 Term) (if (equal (subseq ,Def ,Posl ,Pos2) ,Terms) (setq ,Def (subst ,Term (first ,Terms) (remove (second ,Terms) ,Def) ;Handles definition of For-Some, For-Every, and Where.
4defun Quantifier (Func Rec Test) (Define* Rec) (list Func ',Rec ',(Fix-Test Test)) I Convert Def from infix notation to prefix, suitable for LISP.
(defun Prefix (Def &aux Oper) (setq Oper (second Def)) (setq Def (remove Oper Def)) (cond ((eq Oper (setq Oper 'Same)) S" ((eq Oper (setq Oper 'Different))) (cons Oper Def) f 5-7 Needed for conditionals.
(defun Otherwise t Converts a conditional expression into LISP form.
(defun Conditional (Def &aux Body) (do* ((Test (first Def) (first Lst)) (Val (second Def) (second Lst)) (Lst Def (rest (rest Lst))) (Body nil (append Body (list (list (Fix-Test Test) (Define* ((null Lst) (cond ,@Body)) ;Puts Test in a form suitable to execute (defun Fix-Test (Test) (let ((Test* (Convert Test))) (if (rest Test*) (cons (first Test*) (mapcar #'Define* (rest Test*))) (Define* (first Test*)) True if any value returned by Rec satisfies Test.
*..defun For-Some (Rec Test) (setf (get Rec 'Action) 'Read) (loop (unless (funcall Rec) (return nil)) (when (eval Test) (setf (get Rec 'Action) 'Rewind) (funcall Rec) (return t) r *m False if any value returned by Rec fails Test.
,*(defun For-Every (Rec Test) (setf (get Rec 'Action) 'Read) (loop S(unless (funcall Rec) (return t)) (unless (eval Test) (setf (get Rec 'Action) 'Rewind) (funcall Rec) (return nil) Appendix 1I-8 X Cy~nk r i
I
I J I Returns next value of Rec which satisfies Test.
If Rec returns NIL, returns NIL.
If the 'Action property of the current term is 'Rewind, Set the 'Action property of Rec to 'Rewind first.
(defun Where (Rec Test) (setf (get Rec 'Action) (get (first Arg-Stack) 'Action (loop (unless (funcall Rec) (return nil)) (if (eval Test) (return t)) 'Read)) Rests the value of Term to Val.
(defmacro Assume (Term Val) (Assume* ',Term ,Val)) (defun Assume* (Term Val) (setq Arg-stack NIL) (set Term Val) (setq Sym-bound-list (adjoin Term Sym-bound-list)) Displays multiple values.
(defmacro Display (&rest Terms) (dolist (Term ',Terms t) (Show NL "The value of (first Term) is (Value (eval Term))) *0 06°b 9*- 06 r 'eat
I.
S
*i
S.
a.
S'S.
00 a a r as A ppe, dx-- 1-9u^ i I Expert routines: Field, Ask, Reset, Expert ;Global constants (for yes/no questions) (defconstant yes-list "yes" "YES" "Yes" "true" "TRUE" "True" (defconstant no-list "no" "NO" "No" "false" "FALSE" "False")) ;Global constants for (defconstant text (defconstant number (defconstant yes-no (defconstant choice defining data types 1) 2) 3) 4) ;Global constants for How and Why questions (defconstant How-Why "HOW" "How" "why" "WHY" "Why" "wha" "WHA" "Wha")) ;Set Sym-bound-list to NIL this keeps track of all symbols that are bound (setq Sym-bound-list NIL) ;(Field-of Type Rec-sym)
I
L1
L
1
I
0 ;Check to see if there is a record bound (if (boundp Rec-sym) ;There is a record see if we already have the value (let ((A-value (assoc (first Arg-Stack) (eval Rec-sym))) (if A-value (rest A-value) ;We have the value return it (progl ;Ask for the value
SO
005
A,
I ry so Q4
IN&
o (setq A-value (ASK* Type (string-append Database Value for "field (first Arg-Stack) of record Rec-sym ;Put the value in the association list of Rec-sym (set Rec-sym (acons (first Arg-Stack) A-value (eval Rec-sym))) ;Unbind the field symbol .and take it out of Sym-bound-list ;(this was bound and put in the list by ASK* incorrectly).
(makunbound (first Arg-Stack)) (setq Sym-bound-list (remove (first Arg-Stack) Sym-bound-list)) Apopi 1 i: 1 I I ;The record is unbound produce an error (ask for substitute value) (ASK* Type (string-append WARNING: No Rec-sym record. What "is the value of (first Arg-Stack) ;(Ask Type Prompt &OPTIONAL Choice-List) (defmacro Ask (Type Prompt &OPTIONAL Choice-list) (if Choice-list (Ask* ,Type ,Prompt ',Choice-list) (Ask* ,Type ,Prompt) (defun Ask* (Type Prompt &optional Choice-list &Aux (Sym (first Arg-stack))) ;Check to see if the Symbol already has a value (if (boundp Sym) ;The Symbol has a value, so just return it (eval Sym) ;The Symbol does not have a value, so ask for one (let ((Value NIL) (Inp-String (temp-num 0)) ;Loop while we have why or how questions (loop
I
i i i 0* 0000
O
0* 0@ 0 000 @000
S
SS
S
OSSS
0e OS S OS@0 *5
S
05
S.
0 0S5 ;Put up the prompt (terpri) (princ Prompt) (princ ;If this is a choice question, display (when Type Choice) (terpri) (setq temp-num 1) (dolist (i Choice-list) (princ (princ temp-num) (princ i) (terpri) (incf temp-num) the choices.
(princ (princ "Enter number ;Allow user input (setq Inp-string (read-line)) Apdx -41 _1 r* -C LP-IYI-L--~-
I--
I
I*
;Test for why and how questions (if (and (length Inp-string) 2) (member (subseq Inp-string 0 3) How-why :TEST 'equal)) (progn (eval (read (make-string-input-stream (string-append Inp-string (terpri) (return) ;Convert entry to value dependent on the data type (case Type (1 ;String (setq Value Inp-string) (2 ;Number (setq Value (if (zerop (length Inp-String)) 0 (if (numberp (setq temp-num (Ignore-errors (read-from-string Inp-String)))) temp-num 0 (3 ;Yes-no (setq Value (if (member Inp-String Yes-list :TEST 'equal)
T
NIL
(4 ;Choice *(setq Value ,(nth (if (zerop (length Inp-String))
O
(if (numberp (setq temp-num (Ignore-errors (read-from-string Inp-String)))) temp-num 0 0 Choice-list ;Assign the entered value to the symbol. The symbol will now ;be bound so that any subsequent requests for this symbol will ;just return the value. Also add the symbol to the Sym-bound-list (setq Sym-bound-list (adjoin Sym Sym-bound-list)) (set Sym Value) i: 1 Mppell 1 X 12 7 (Record) (defun Record (&aux (sym (first Arg-stack))) (if (equal 'read (get sym 'action)) ;Read the next record from the database first determine if EOF (if (progn (terpri) (princ (string-append Reading sym record from database.")) (terpri) (princ Is there another record? (let ((Inp-string (read-line))) (if (member Inp-String Yes-list :TEST 'equal)
T
NIL
;Test passed new record read set record to nil (no fields ;retrieved yet) and return T.
(progn (set Sym NIL) (setq Sym-bound-list (adjoin Sym Sym-bound-list))
T)
;EOF unbind symbol and return NIL (progn (makunbound Sym) (setq Sym-bound-list (remove Sym Sym-bound-list))
NIL)
;Action is rewind so return NIL and unbind the record (progn (makunboud Sym) (setq Sym-bound-list (remove Sym Sym-bound-list))
NIL)
ego* (Reset &rest Syms) (defmacro Reset (&rest Syms) (Reset* ',Syms)) (defun RESET* (Syms) (setq Arg-stack NIL) (when (null Syms) (setq Syms Sym-bound-list)) (dolist (Sym Syms) (makunbound Sym) (setq Sym-bound-list (remove Sym Sym-bound-list)) Appendix 11 ,J'11 Appendix 2 The modules for the second prototype implementation are ordered in the following listing alphabetically by module name. DRIVER is the module which receives user commands.
ASK Ask routines for SOCRATES prototype ;The following functions are in this file Ask-text Translate grammar of Ask text to general Ask function Ask-number Translate grammar of Ask number to general Ask function Ask-yes-no Translate grammar of Ask yes-no to general Ask function Ask -Handles general user interaction for terms defined as "ask" ;Constants (defconstant yes-list "yes" "true" (defconstant no-list "no" "false" .I;Global constants for defining data types $.defconstant asktext 1) (defconstant asknumber 2) defconstant askyes-no 3) (defconstant askchoice 4) '*.;Global constants for How and Why and What questions "**(defconstant How-Why "why")) S* o Ask-text (defun Ask-text (&rest text-list) Of 0 (length text-list) 1) (Ask askchoice (first text-list) (rest text-list)) (Ask asktext (first text-list)) Ask-number (defun Ask-number (&rest text-list) (if (0 (length text-list) 1) (let ((Entry-text (Ask askcholce (first text-list) (rest text-list)))) (Set-Val (first Arg-stack) ((length text-list) (length (miember Entry-text text-list JTEST 'equal)))) (Ask iskn'imber (first text-list)) Ask-yes-rie) Ask-yes-no (&optional prompt) (Ask aslyes-no prompt) S 01 1 I 4
I,
Ask
I,
(defun Ask (Type Prompt &optional Choice-list &Aux (Sym (first Arg-stack)) Value) ;Check to see if the Symbol already has a -value (if (neq (setq Value (Get-Val Sym)) 'UNKNOWN) ;The Symbol has a value, so just return it (Return-Val Value) ;The Symbol does not have a value, so ask for one (let ((Inp-String (temp-num 0)) (unless Prompt (setq Prompt (string-append N11hat is the value for (string Syin) ;Loop while we have why or how questions, or invalid entry (block Entry-loop (loop Put up the prompt (terpri) (princ Prompt) (princ 11 11) If this is a choice question, displ, the choices.
(when Type askchoice) (terpri) (setq temp-num 1) (dolist (i Choice-list) (princ i) (terpri) (incf temp-num) s* a a* (princ "Enter number 11 ;Allow user input (setq Inp-strlng (read-line))
'S
.3 55 S S *555 9 56 0 5.
S.
S
Test for why and how questions (if (string-equal Inp-string "WHY") t~ AppcndIx23
CG
5.5.
00 S. S 65 S S S
S.
;Entry is "why" question (let ((Why-,;tack-ptr ;lst element in arg-stack (loop ;continue for all why and how questions (if (string-equal Inp-string "WHY") (progn (Why* (nth kWhy-stack-ptr Arg-stack)) (unless why-stack-ptr (length Arg-stack))) (incf Nhy-stack-ptr M) (eval (read (make-string-input-stream (string-append Inp-string (terpri) (setq Inp-string (read-line)) (unless (and 0 (length Inp-string) 2) (member (subseq Inp-string 0 3) How-why :TEST 'equal)) (return) ;Entry i not "why" ;Convert entry to v~iue dependent on the data type (case Type (1 ;String (if (zerop (length Inp-String)) (progn (terpri) (princ "Invalid text entry") (terpri)) (progn (setq Value Inp-string) (return-from entry-loop)) (2 ;Number (setq Value (if (zerop (length Inp-String))
NIL
(if (numberp (setq temp-num (Ignore-errors (read-from-string (Fix-Number Inp-String)) temp-num all
NIL
00 9) (if Value (return-from entry-loop) (progn (terpri) (princ "Invalid number entry") (terpri)) 0 4 Appendix 2 4
I
(3 ;Yes-no (setq Value (cond ((member Inp-String Yes-list :TEST 'string-equal)
'YES)
((member Inp-String oQ-list :TEST 'string-equal)
'NO)
(T
NIL)
(if Value (return-from entry-loop) (progn (terpri) (princ "Invalid yes/no entry") (terpri)) (4 ;Choice (setq Value (nth (if (zerop (length Inp-String)) 32000 ;set beyond end of list for NIL (if (integerp (setq temp-num (Ignore-errors (read-from-string Inp-String)))) (if temp-num 1) 32000 temp-num) 32000 Choice-list (if Value (return-from entry-loop) (if (member Inp-string Choice-list :TEST 'equal) (orogn (setq Value Inp-string) (return-from entry-loop)) (progn (terpri) (princ "Invalid choice") (terpri)) end of case ;end of if, and end of loop and block (setq Value (Return-Val Value)) (Set-Val Sym Value) 2 Converts YES and NO to T and NIL.
7 .(defun Return-Val (Value) (case Value (YES t) (NO nil) (t Value) o *o S oS -Appendix: 2 68 Converts number text entered by user to form ready for LISP.
SRemoves commas and dollar signs and makes double percision.
(defun Fix-Number (Str) (do 0 I (length Str)) (string-append Str (if (member (char Str I) (setq Str (string-append (subseq Str 0 I) (subseq Str ;CONVERT Converts between string and list forms of term definition ;Notation: Str Definition as seen by user, including commas.
Syms Symbol list made from Str. Not in prefix notation.
Def Symbol list made from Syms. In prefix notation.
(defvar Error-Msg) set by Syms-To-Def if parse error.
Returns list of all terms referenced in Def.
(defun Terms-In-Def (Def) (cond ((member Def '(YES NO NL nil)) nil) ((symbolp Def) (list Def)) ((llstp Def) (Unique-List (apply #'append (mapcar #'Terms-In-Def (rest (t see* nil) ;Returns Lst with duplicate elements removed.
(defun Unique-List (Lst &aux Set) (dolist (Elem Lst (reverse Set)) setq Set (adjoin Elem Set)) Returns list of all undefined terms referenced in Def.
Undefined-Terms-In-Def (Def) (remove-if #'Get-Def (Terms-In-Def Def)) *A
.A
onAppcndi 2 6 J. -L> Converts Str to symbol list.
(defun Str-To-Syms (Str &aux Result) (setq Result (multiple-value-list (ignore-errors (read-from-string (string-append (Fix-Commas Str) (if (second Result) (Then (setq Error-Msg "Invalid expression") nil) (first Result) Changes commas in Str to underscores, except when in quoted-strings.
(defun Fix-Commas (Str &aux In-Quote) (do 0 I (length Str)) Str) (if In-Quote (if (equal (char Str I) (setq In-Quote nil)) (cond ((equal (char Str I) (setq Str (string-append (subseq Str 0 I) (subseq Str ((equal (char Str I) (setq In-Quote t)) Sets Error-Msg to Msg and returns to nil to Parse.
I
(defun Err (&rest Msg) (setq Error-Msg (dolist (Part Msg) (setq Error-Msg (string-append (return-frcm Parse) **e Error-Msg (Make-Str Part)))) .t Converts any LISP construct '(defun Make-Str (Thing) (if'(listp Thing) (format nil "gS" Thing) (format nil "gA" Thing) into a string.
S.
5 5 f 0. 9.
S*
6S 0 0* S S S S OS A p pni 7 f Converts Sym to a form ready to display to user.
;Converts to lower case and changes dash to blank.
(defun Sym-To-Display (Sym &aux Str) (setq Str (string Sym)) (do 0 I (length Str)) Str) (cond ((and (char Str I) A) (char Str I) Z)) (setf (char Str I) (char Str I) 32))) (char Str I) (setf (char Str I) Converts Syms list to definition.
If error, sets Error-Message and returns nil.
(defun Syms-To-Def (Syms Type) (when Syms (block Parse (if (member Type '(NUMBER TEXT YES-NO STREAM)) (Try (eval Type) Syms) (Err Syms has an invalid type of Type)) ;Tries to parse Syms according to Grammar table.
;Returns result of the first successful parse or NIL.
(defun Try (Grammar Syms &aux Matches Result) S (dolist (Template Grammar) (let ((Text-Tmp (first Template)) c (Func-Tmp (rest Template))) (cond ((equal Text-Tmp 'Try) (setq Result (Try (eval (first Func-Tmp)) Syms)) (when Result (return Result))) ((setq Matches (Match Syms Text-Tmp)) (return (Fill-In Matches Func-Tmp)))
I
OO0 *0 0 0 0 ApendtiT P i 1 J I ;Returns result of filling in Func-Tmp using contents of Matches.
;Validates contents of Matches first, generating error if any fail.
;The list of validating functions is padded to allow for the template.
(defun Fill-In (Matches Func-Tmp &aux Result) (if (equal (first Func-Tmp) 'SELF) (Parse-Arg (first (rest Func-Tmp)) (first Matches)) (cons (first Func-Tmp) (if (consp Matches) (mapcar #'Parse-Arg (Pad (rest Func-Tmp) (length Matches)) Matches Returns result of Test on argument Arg.
;Test may be a function or a grmmar table.
;Generates error if fails test.
(defun Parse-Arg (Test Arg &aux Result) (if (fboundp Test) (setq Result (funcall Test Arg)) (setq Result (Try (eval Test) Arg))) (if Result Result (Err Arg is not a (Sym-To-Display Test)) Pads Lstto length Len using the last element as the pad.
Pads Lst to length Len using the last element as the pad.
(defun Pad (Lst Len) (setq Len Len (length Lst))) (if Len 0) (append Lst (make-list Len :initial-element Lst
S..
If Sym has no type, sets its type to Type.
Else, checks to see if it matches Type.
Returns either Sym or nil.
(defun Check-Type (Sym Type &aux Sym-Type) (setq Sym-Type (Get-Type Sym)) (cond ((equal Sym-Type Type) Sym) ((equal Sym-Type nil) (Set-Type Sym Type) Sym) (first (last Lst)))) nil) .5 5* S S S 55 J.k ;fw Appendix 2 9 1.
Determines if Sym is a number or a number term.
(defun Number-Or-Number-Term (Sym) (setq Sym (first Sym)) (cond ((symbolp Sym) (Check-Type Sym 'NUMBER)) ((numberp Sym) Sym) Determines if Sym is text or a text term.
(defun Text-String-Or-Text-Term (Sym) (setq Sym (first Sym)) (cond ((equal Sym 'NL) Sym) ((symbolp Sym) (Check-Type Sym 'TEXT)) ((stringp Sym) Sym) ;Determines if Sym is a yes-no term.
(defun Yes-No-Term (Sym) (setq Sym (first Sym)) (cond ((member Sym '(YES NO)) Sym) ((symbolp Sym) (Check-Type Sym 'YES-NO)) ;Determines if Sym is a stream term.
(defun Stream-Term (Sym) (when (null (rest Sym)) (setq Sym (first Sym)) (cond ((symbolp Sym) (Check-Type Sym 'STREAM)) Determines if Sym is a table term.
('*defun Table-Term (Sym) (when (null (rest Sym)) (setq Sym (first Sym)) (cond ((symbolp Sym) (Check-Type Sym 'STREAM)) ;NOTE: change to TABLE S get m Appendi r* i4 ylii ;;ii;-"I'IF-"iLYi-IIIIIII- i:;(llili~~lli~-l~ -I .jlli ir :li; i 1 Used (defun nil ;Used (defun nil Used (defun nil ;Used (defun nil 4 6 *6
C
9 9 *o r 6 Se 4 to force error when no template matches.
Valid-Number-Expression (Syms) to force error when no template matches.
Valid-Text-Expression (Syms) to force error when no template matches.
Valid-Yes-No-Expression (Syms) to force error when no template matches.
Valid-Stream-Expression (Syms) Appendix -11 -7 Cf il DEFINE Interacts with user to define a SOCRATES expert application.
(defvar Undefined-Term-List nil) ;List of terms to be defined.
Initiates the definition of a term.
(defmacro Define (&optional Term Type Str) (Define* ',Term (defun Define* (&optional Term Type Str) (block Define-Loop (if Str (Define-Term Term Type Str) (Else (if Term (Define-Term Term Type)) (loop (setq Term (first Undefined-Term-List)) (if (null Term) (return-from Define-Loop 'DONE)) (if (Get-Def Term) (pop Undefined-Term-List) (Define-Term Term) ',Type ,Str)) r ar a.
a, *04 a.
1 ;Defines Term of Type.
(defun Define-Term (Term &optional Type Str &aux Def) (setq Term-List (adjoin Term Term-List)) (unless Type (unless (setq Type (Get-Type Term)) (setq Type (Get-Name "Type of Term (Number, Text, Yes-No, Table) (unless (member Type '(NUMBER TEXT YES-NO TABLE)) (princ "Invalid type") (return-from Define-Loop 'ERROR)) (Set-Type Term Type) S(unless Str (setq Str (Get-String Type definition of Term NL (when (or (equal Str (equal Str "undefined')) (push Term Undefined-Term-List) (return-from Define-Loop 'PAUSE)) (setq Def (Syms-To-Def (Str-To-Syms Str) Type)) (when (Cycle Term Def) (setq Error-Msg "Cyclic definition") (setq Def nil))
CL
hI I h-L a
S
Its as..
I' t a. a j a Si.
'Appendix 2 12- 7 (if Def (Then (Set-Def Term Type Def) (setq Undefined-Term-List (nconc (Undefined-Terms-In-Def Def) Undefined-Term-List))) (Else (princ Error-Msg) (Define-Term Term) SRedefines a term, ignoring it type.
(defmacro Redefine (Term) (Redefine* ',Term)) (defun Redefine* (Term) (remprop Term :TERM-TYPE) (Define* Term) Prompts the user for a string.
(defun Get-String (&rest Strs) (terpri) (dolist (Str Strs) (princ Str)) (read-line) Prompts the user for a name.
(defun Get-Name (&rest Strs) (terpri) (dolist (Str Strs) (princ Str)) (read) 1 Detects a cycle of Term in Def.
(defun Cycle (Term Def) (let ((Terms (Terms-In-Def Def))) (if (member Term Terms) t (dolist (Sub-Term Terms) o (if (Cycle Term (Get-Def Sub-Term)) S' (return t)
S..
i I
I
DESCRIBE Converts Definition of a term back to external form.
;Converts Def to a string for display to the user (defun Def-To-Str (Type Def) (if Def (string-right-trim (Scan Type Def)) "undefined" Scans Grammar table to find the external template for Def.
(defun Scan (Grammar Def &aux Func) (if (atom Def) (Add-Argument Def) (dolist (Template (eval Grammar)) (cond ((equal (first Template) 'Try) (setq Result (Scan (second Template) Def)) (when Result (return Result))) ((equal (first Def) (second Template)) (return (Fill-Out (first Template) (rest (rest Template)) (rest Def)))) ;Creates external form from Pattern using Args.
.*.".(defun (let Fill-Out (Pattern Grammars Args &aux Arg Pat Gram) ((Str (Arg-Ptr 0) (Arg-End (length Args)) (Pat-Ptr 0) (Pat-End (length Pattern)) (Last-Gram (length Grammars))))
S
S
-r
S.
5e S SeeS
S
*S
S
55 5 S. S 0S (loop (setq Pat (nth Pat-Ptr Patt (setq Arg (nth Arg-Ptr Args (setq Gram (nth (min Arg-Ptr (cond ((and Arg-Ptr Arg-End) Pat-Ptr Pat-End)) (return Str)) ((equal Pat (if Arg-Ptr Arg-End) (setq Pat-Ptr Pat-End) (incf Pat-Ptr))) ern)) Last-Gram) Grammars)) Appendix 2-14 j ((equal Pat (if (listp Arg) (setq Str (string-append Str (string-right-trim (Scan Gram Arg)) (setq Str (string-append Str (Scan Gram Arg)))) (incf Arg-Ptr) (incf Pat-Ptr)) ((equal Pat (setq Str (string-append Str (Scan Gram Arg))) (incf Arg-Ptr) (incf Pat-Ptr)) ((equal Pat (setq Str (string-append Str (string-right-trim (Scan Gram Arg)) (incf Arg-Ptr) (incf Pat-Ptr)) ((equal Pat (setq Pat (nth Pat-Ptr) Pattern)) (cond ((null Pat) (if Arg-Ptr Arg-End) (return Str) (decf Pat-Ptr))) Arg-Ptr Arg-End) (setq Str (Add-Keyword Str Pat)) (decf Pat-Ptr))
J!
1 (incf Pat-Ptr (t ;literal in pattern (setq Str (Add-Keyword Str Pat)) (incf Pat-Ptr)) Adds a Keyword to Str.
Keywords are displayed in lower case.
S ****(defun Add-Keyword (Str Keyword) S (if (equal Keyword (string-append (string-right-trim Str) (string-append Str (Lower-Case (string Keyword)) *00 00 :0 000 m: 'o^ /I w i 1-J iA -I2Qsnd 9-15 j ny ;Adds an Arg to Str.
;Arguments which are not constan'Ls are displayed in upper case.
(defun Add-Argument (Str Arg) (cond ((member Arg '(RU FALSE) (Add-Keyword Arg)) ((numberp Arg) (format nil "qD 11Arg)) ((stringp Arg) (string-append (string Arg (string 11) (string-append Str (string Arg) Converts to lower case.
(defun Lower-Case (Str) (do 0 IM) I (length Str)) Str) (if (and 6- (char Str D) A) (char Str D) Z) (setf (char Str D) (char Str D) 32)) *00 0 000 Of *0 to
S..
6 so* 90 0O 0 00 S 0S 00 1'e~Ix23 bL.
Driver for SOCRATES prototype The following functions are contained in this file Socrates Sets up environment for SOCRATES, Clears the screen, puts up box and titles, sets scroll window, and handles input of commands.
Write-sbox Write a box around the perimeter of the screen.
Socrates (defvar Result) (defvar Message) Macros to make IF clauses more readable.
(defmacro Then (Arg &rest Args) (if Args (progn ,Arg ,@Args) ,Arg (defmacro else (Arg &rest Args) (if Args (progn ,Arg ,@Args) eS Arg (defun OK (&aux Input-string) .000. (let BREAK-EVENT' 'Break-Hanldler) 0 g::(Cmd) (Invalid)) (send *terminal-.lo* :set-position 0 0) (send *termlnal-io* :set-size 80 (send *terminal-io* :clear-screen) (prlnc OFFICGE KNOWLEDGE") (send *terminal-.io* :set-cursorpos (princ "Wang Expert Systems") S (Wrlte-sbox) (send *terminal-io* :set--cursorpos 21 (prlnc 11 (Copyright Wang Laboratories, (send *terminal..o* :set-position 2 2) (send *terminal-io* :set-size 76 21) (send *terminal-io* :clear-screen) 0) '1985) .5 *5 S 55 0 S 50 S OS -Annan,11"-17 I i (loop (princ (setq Input-string (read-line)) (when (string-equal Input-string "EXIT") (Exit-Driver)) (multiple-value-setq (Cmd Invalid) (ignore-errors (read-from-string (string-append Input-string (if (or Invalid (listp (first Cmd))) (princ "Invalid expression") (if (fboundp (first Cmd)) (Then (multiple-value-setq (Result Message) (ignore-errors (eval Cmd))) (if Message (princ "Command execution error"))) (princ "Unknown command"))) (terpri) (terpri) Break handler for Socrates.
(defun Break-Handler (&rest Ignore) (Exit-Driver) (break) Restores windows before exitting.
(defun Exit-Driver (send *terminal-io* :set-position 0 0) (send *terminal-io* :set-size 80 24) (send *terminal-io* :clear-screen) 0 (return 'End) e) v Displays reason for last execution error.
defun What (if Message o* o (princ Message) (Else (princ "The result of the last execution was (prlnl Result) S
S**
5 9 .NN PAT Apeni Write-sbox -Write box around terminal io window (defun Write-sbox 0) (send *terminal-io* :set-cursorpos 0 1) (send *terminal-io* :write-char (dotimes (1 78) (send *terminal io* :write-char 12)) (send *terminal-io* :write-char 13) (do MC 2 iM) i 24) 0) (send *terminal.io* :set-cursorpos 0 i) (send *terinl-i o* :write-char 8) (send *terminal-io* :set-cursorpos 79 i) (send *termina1-io* :write-char 8) (send *termina1l-io* :set-cursorpos 0 23) (send *terminal-io* :write-char 14) (dotimes (1 78) (send *terminal io* :write-char 12)) (scnd *terminal-io* :write-char 11) Clear screen.
(defun Clea- 0 (send *terminal io* :clear-screen) Appendi.X 2-19 22, EXECUTE ;-Handles execution of terms (defvar Arg-Stack) ;Stack of terms being computed.
Prints the value of Term.' (defmacro Solve (Term) (Solve* ',Term)) (defun Solve* (Term) (block Solve (setq Arg-Stack nil) (format t "q%9A 9A" Term (Display-Val (Value* Term))) Converts Val to external form.
(defun Display-Val (Val) (cond ((equal Val t)
"YES")
((null Val)
"NO")
((numberp Val) (Number-As-Text Val)) Qt Val) *.Eauae Expr and returns its value.
G .*';pfmacro Value (Expr) (Value* ,Expr)) G(defun Value* (Expr &aux Result) 0*.(cond .00,((null Expr) fe* (Prt (first Arg-Stack) "is undefined") (setq Arg-Stack nil) 000 (return-from Solve)) ((equal Expr 'NL)
ND)
((equal Expr 'YES) 00.4 t) Expr 'NO) ((symbolp Expr) 0 (setq Result (Get-Val Expr) *.s1 0 so Appcndix 2 l p I 'p (when (equal Result 'UNKNOWN) (push Expr Arg-Stack) (setq Result (Value* (Get-Def Expr))) (pop Arg-Stack) (Set-Val Expr Result)) Result) ((atom Expr) Expr) (t (eval (cons (first Expr) (mapcar #'(lambda (list 'Value (rest Expr)))) Runtime routines needed to impliment the grammar.
Routines for ASK and FIELD are in other files The following LISP builtins are also used: MAX MIN
STRING-APPEND
OR AND NOT EQUAL SSame as IF but has the test in the middle.
(defmacro Then-If (Then Test Else) (if ,Test ,Then ,Else) Returns Then expression. The Test is just for documentation.
(defmacro Otherwise-If (Then Test) Then 4 Returns Then expression.
,,,idefmacro Otherwise (Then) S Then s Same as but stops after encounters a zero.
.:.,defmacro Multiply (&rest Args) (Multiply* ',Args)) (defun Multiply* (Args &aux (Result 1.ODO)) S (dolist (Arg Args Result) (setq Result Result (eval Arg))) S (If (zerop Result) (return Result)) r* r *I.ii'/N q -Appendix 2 21 Same as but stops after encounters a zero.
(defmacro Divide (Arg &rest Args) (Divide* ',Arg (defun Divide* (Arg Args &aux Result) (setq Result (eval Arg)) (if (zerop Result) Result Result (Multiply* Args)) ,Args)) Same as on a single number.
(defmacro Negative (Num) ,Num) ;Returns Exp. Used to record use of parenthesis when displaying to user.
(defmacro Paren (Exp) ,Exp Returns tho capitalized form of Str.
(defun Capitalize (Str) (do (QI 0 I (length Str)) Str) (if (and 0= (char Str I) a) (char Str I) z)) (setf (char Str 1) (char Str 1) 32)) ;Converts Num to a text string.
:::*idefun Number-As-Text (Num) go (let* ((Str (format nil "gD" Num)) (Len (length Str))) (cond ((equal (subseq Str (max Le ~**(setq Str (subseq Str 0 L n 4) 1 Len) en n 2) 1 Len) en "1.000")
"DO")
(setq Str (subseq (Insert-Commas Str) Str 0 L
I..
0d S S
OS
9 006 S. -~S S S~ S. S 5O 0
~S
5 00 Appendix 2 22 i Inserts commas into a number string for display.
(defun Insert-Commas (Str &aux Decimal) (setq Decimal (string-search Str)) (unless Decimal (setq Decimal (length Str))) (if Decimal (length Str) 2)) (setq Str (string-append Str (do Decimal 3) I I 0) Str) (setq Str (string-append (subseq Str 0 (subseq Str Converts Boolean to the string "YES" or "NO".
(defun Yes-No-As-Text (Boolean) (if Boolean
"YES"
"NO"
Inequality operator for text strings.
(defun Not-Equal (Strl Str2) (not (equal Strl Str2)) n i~
I
exponential for integer Power.
O; emove when GCLISP supports EXP.
defun Exp (Num Power &aux (Result 1.OdO)) Power (truncate Power)) (if (minusp Power) (Exp Num Power))) (dotimes (I Power Result) (setq Result Result Num)) Rounds Num to the nearest Level.
(defun Rounded-To (Num Level) (Int Num Level Level)) Level) Removes fractional portion of Num.
Does it in two parts to avoid fixnum overflow.
*.(Iefun Int (Num &aux Top) "(setq Top (truncate Num 10000.0)) 10000.0)) Top (truncate Num Top))) Appemi 2-23 SEXPLAIN Explains How and Why.
Explains how the value of Term was determined.
(defmacro How (Term) (How* ',Term)) (defun How* (Term) (let ((Def (Def-To-Str (Get-Type Term) (Get-Def Term))) (Val (Display-Val (Get-Val Term))) (Terms (Terms-In-Def (Get-Def Term)))) (Prt NL Term has a value of Val NL) (if (equal Val 'UNKNOWN) (Prt "because it's value has not been needed yet.") (Else (Prt "because it is defined to be" NL Def) (when Terms (Prt NL "where") (dolist (Sub-Term Terms) (Prt NL Sub-Term has a value of (Display-Val (Get-Val Sub-Term))) ':.Explains why the value of Term is needed.
::defun Why* (Term) (let* ((Main-Term (member Term Arg-Stack (Super-Term (second Main-Term)) (Def (Def-To-Str (Get-Type (Terms (Terms-In-Def (Get-Def (terpri) f A Super-Term) (Get-Def Super-Term)))) Super-Term))) ((null (Prt ((null (Prt Main-Term) "The value of Term is not currently being sought.")) Super-Term) "The value of Term was requested by the user."))
S
0S (Prt "The value of Term NL "is needed to solve the value of Super-Term NL "which is defined to be:" NL Def) (when Terms (Prt NL "where") (dolist (Sub-Term Terms) (Prt NL Sub-Term has a value of (Display-Val (Get-Val Sub-Term)))
OOOS
0 Appendix 2-94 i i~;lll_ X _11 I I SGRAMMAR Rules of grammar for SOCRATES SThe following are tables which describe the grammar.
SEach table is a list.
SThe elements of the list is such that: S (first element) text template to match S (rest element) function template to fill in or function to be called SIf the text template 'Try, then the function template is used as a table.
S matches exactly one element.
matches one or more element.
means one parenthetic element.
mean that the rest of the template is optional.
means repeat previous wildcard 0 or more times, S seperated by the symbol which follows the SParses the definition of numbers.
(setq Number '(((FIELD OF Field-Number Table-Term Number-Field-Form) ((ASK S' Ask-Number Text-Form) o* IF 0000 *o Then-If Number-Form Yes-No-Form Number-Case) FOR THE For-The Number-Form Stream-Form) ((MAX max Number-Form) ((MIN Mmin Number-Form) (Try Aggregate) (Try Number-Form) Self Valid-Number-Expression) S* i
S
0 @0, ^Appnndi 2 -25 S( Parses simple arithmetic expressions.
(setq Number-Form ROUNDED TO Rounded-To Number-Form Number-Form) Number-Form Number-Form) Number-Form Number-Form) Multiply Number-Form Number-Form) I Divide Number-Form Number-Form) Exp Number-Form Number-Form) Negative Number-Form) Paren Number-Form) Self Number-Or-Number-Term) SParses rest of a number case statement.
'**setq Number-Case IF Then-If Number-Form Yes-No-Form Number-Case) IF Otherwise-If Number-Form Yes-No-Form) o* OTHERWISE) Otherwise Number-Form) Parses number aggregates.
*.:..esetq Aggregate '(((TOTAL OF EVERY Total-Every Number-Form Stream-Form) ((MAX OF EVERY Max-Every Number-Form Stream-Form) ((MIN OF EVERY Min-Every Number-Form Stream-Form) S i .((AVERAGE OF EVERY Average-Every Number-Form Stream-Form) ((PERCENTAGE OF WHERE Percentage Stream-Form Yes-No-Form) ((NUMBER OF Number-Of Stream-Form) S-Appendix 2 26 1' ;Parses number field forms.
(setq Number-Field-Form '(((DEFAULT VALUE Default-Value Number-Form) ((VALUES Values Number-Form) ((REQUEST Request Text-Form) ;Parses definitions of text.
(setq Text '(((FIELD OF Field-Text Table-Term Text-Field-Form) ((ASK Ask-Text Text-Form) IF Then-If Text-Form Yes-No-Form Text-Case) FOR THE For-The Text-Form Stream-Form) S (Try Text-Form) S Self Valid-Text-Expression) 0 Parses simple text expressions.
(setq Text-Form string-append Text-Form Text-Form) ((CAPITALIZE Capitalize Text-Form) ((NUMBER S. Number-As-Text Number-Form) ((YES-NO Yes-No-As-Text Text-Form) Self Text-String-Or-Text-Term) i s ':i :-i i. i 0000 @0 *0 0 00 0 00* 00 Appendix 2 27
I
Parses rest of a Text case statement.
IF Otherwise-If Text-Form Yes-No-Form)
OTHERWISE
Otherwise Text-Form) )o A n Parses text field forms.
(setq Text-Field-Form '(((DEFAULT VALUE Default-Value Text-Form) ((ALUES Values Text-Form) Request Text-Form) S Ales Text-F Parses definitions of yes-no definitions.
Yes-No '(((FIELD OF Field-Yes-No Table-Term Yes-No-Field-Form) S ((ASK *see Ask-Yes-No Text-Form) IF Then-If Yes-No-Form Yes-No-Form Yes-No-Case) FOR THE For-The Yes-No-Form Stream-Form) Self Valid-Yes-No-Expression)
IF
Appendix 2 28 i .3 3 Parses simple arithmetic expressions.
(setq Yes-No-Form OR OR) or Yes-No-Form Yes-No-Form) AND AND) and Yes-No-Form Yes-No-Form) ((NOT not Yes-No-Form) IS NOT equal Text-Form Text-Form) IS Not-Equal Text-Form Text-Form) Number-Form Number-Form) Number-Form Number-Form) Number-Form Number-Form) Number-Form Number-Form) Number-Form Number-Form) Number-Form Number-Form) Paren Yes-No-Form) S Self 'Yes-No-Term) 1 Parses rest of a yes-no case statement• .:.Getq Yes-No-Case IF Then-If Yes-No-Form Yes-No-Form Yes-No-Case) IF Otherwise-If Yes-No-Form Yes-No-Form) S. OTHERWISE) Otherwise Yes-No-Form) "'Parses quantifier yes-no expressions.
(setq Quantified-Form SOME For-Some Stream-Form Yes-No-Form) S ((FOR EVERY For-Every Stream-Form Yes-No-Form) ((FOR NO For-No Stream-Form Yes-No-Form) Appendix 2-29 92- J- -r SParses yes-no field forms.
(setq Yes-No-Field-Form '(((DEFAULT VALUE Default-Value Yes-No-Form) ((VALUES Values Yes-No-Form) ((REQUEST Request Text-Form) Parses definitions of streams.
(setq Stream ((Try Table) (Try Stream-Form) Self Valid-Stream-Expression) SParses definitions of tables.
*:*(setq Table '(((STORED TABLE) Stored-Table) s ((REQUESTED TABLE) Requested-Table) ((CONSTANT TABLE) 000.., ConstantTable) Parses simple streams.
(setq Stream-Form WHERE *0 Where Stream-Term Yes-No-Form) C* Self Stream-Term)
C.
e** 06 0 C J A d 3 1 0. a.: -Appendix 21W p- I I I MATCH ;-Does template matching for CONVERT.
Sees if Syms matches Tmps.
If so, returns list of symbols matched by each wildcard or T if there are no wildcards.
Otherwise, returns nil.
matches exactly one element.
matches one or more element.
means one parenthetic element.
C- mean that the rest of the template is optional.
means re~peat previous wildcard zero or more times, sepcr,'aled by the (optional) symbol which follows the Eg, 0? matches (A B +C D) (MAX matches (MAX A (B C) 0) (ASK matches (ASK A B C) (defun Match (Syms Tmps) (if (listp Syms) (let ((Matches 0) (Scanning ni (End-Of--Sym (I (End-Of--Tmp (lI (SYm.-Ptr 0) (Tmp-Ptr 0) (Mlark 0)
S.
**of goes 0.50
S
5 ength Syms)) ength Tmps))
'S
S
S
S
S
S
(loop (let ((Sym (nth Sym-Ptr Syms)) (Tmp (nth Tmp-Ptr Tmps))) (cond ((and (~Tmp-.Ptr End-Of-Tinp) (~Sym-Ptr End-Of-Sym)) (Record Mark End-.Of-.Sym) (if Matches (return Matches) (return t) ((Tmp-Ptr End-Of-Tmp) (unless Scanning (return nil)) (Record Mark End-Of-Sym) (return Matches)) ((equal Tmp 1@) (setq Tmp (nth Tmp-Ptr) Tmps)) 55 S. S 55 S S S 5 0@ ,Appendlx 2 3 S. 0 *0 0 0 00 00 Appendix 9-18 ~Th A~ (cond ((null Tinp) (if Syrn-Ptr End-Of-Sym) (incf Tmp-Ptr) (decf Tmp-Ptr)) (setq Scanning nil)) ((Find-Tnip Tmp) (Record Mark Sym-Ptr) (decf Tirp-Ptr) (incf Syni-Ptr) (setq Mark Sym-Ptr) (setq Scanning nil)) 00 0 0 00 09,, 00 00 0 00 0 000 0000 0 *000 00 00 0 0000 0 00 00 0 0000 0 00 00 6~ 00 00 00 0 000 0000 0 00 00 0 0S 0 0 00 0 00 (incf Tmp-Ptr ((equal Tmp 'D) (if Sym-Ptr End-Of--Sym) (setq Tmp-Ptr End-Of-Tmp) (incf Tmp-Ptr))) (=Sym-Ptr End-Of-Sym) (return nil)) ((equal Tmp (Record Mark Sym-Ptr) (setq Mark Sym-Ptr) (incf Sym-Ptr) (incf Tmp-Ptr) (setq Scanning 0) ((equal Tipp (Record Mark Sym-Ptr) (setq Mark Sym-Ptr) (incf Syrm-Ptr) (incf Tmp-Ptr) (setq Scanning nil)) ((equal Tmp (if (atom Sym) (return nil)) (setq Matches (append Matches (list Sym))) (incf Sym-Ptr) (incf Tmp-Ptr) (setq M~ark Syni-Ptr) (setq Scanning nil)) ((equal Tmp Sym) (Record Mark Sym-Ptr) (mcf Tmp-Ptr) (incf Syrn-Ptr) (setq Mark Sym-Ptr) (setq Scanning nil)) (Scanning (mcf Sym-Ptr)) (t (return nil)) ,App@ndlx 2-32 S. $)P AppendiX 9-19 22.
IF Adds elements of Syms between Mark and End-Of-Mark.
(defun Record (Mark End-Of-Mark) (if Mark End-Of-Mark) (setq Matches (append Matches (list (subseq Syms Mark End-Of-Mark)) Tries to find Tmp in Syms If found, sets Sym-Ptr to Else returns NIL.
starting at Sym-P-tr.
the match and returns true.
(defun Find-Tmp (Tmp &aux Sym-Ptr*) (setq Sym-Ptr* Sym-Ptr) (loop (cond ((equal (nth Sym-Ptr* Syms) Tmp) (setq Sym-Ptr Syrn-Ptr*) (return t)) Sym-Ptr* End-Of-Sym) (return nil))) (incf Sym-Ptr*) A A 55.'
S~
5
S.
S.
S.
a..
'Sib 1S S. S a. w S
A,
Ann'~nfIi~ 33
S
S S S Appendix 2 2 013 pI~inir~iarms*u~ i: l;i:)Le r_ STORE STORE Store, retrieve, and display definition of SOCRATES terms (defvar Term-List) (defvar Scroll-Size) List of current terms.
Number of lines to fit in widow.
Stores Def and Type of Term.
;Adds Term to Term-List, if not already there.
;Overrides existing definition, if present.- (defmacro Define2 (Term Type Def) (Set-Def ',Term ',Type (defun Set-Def (Term Type Def) (setf Term-List (adjoin Term Term-List)) (setf (get Term :TERM-TYPE) Type) (if Def (setf (get Term :TERM-DEF) Def) (push Term Undefined-Term-List) ;Returns definition of Term or NIL.
(defun Get-Def (Term) (get Term :TERM-DEF) Sets Type of Term.
Adds Term to Term-List if not already there.
**,(defun Set-Type (Term Type) (setf Term-List (adjoin Term Term-List)) (setf (get Term :TERM-TYPE) Type) Returns type of Term or NIL.
*"*(defun Get-Type (Term) (get Term :TERM-TYPE) Sets V41 of Term.
(defun Set-Val (Term Val) (setf (get Term :TERM-VAL) Val) 0 ,Def)) j :r "1 Appendix 2 31 91 1i e 0 0 A-ppendix 2 21 .gf ;Returns value of Term or NIL.
(defun Get-Val (Term) (get Term :TERM-VAL 'UNKNOWN) Removes Term as a definition.
;Returns T if the definition existed, else NIL.
(defmacro Forget (&optional Term) (Forget* ',Term)) (defun Forget* (&optional Term) (if Term (Then (setf Term-List (remove Term Term-List)) (setf Undefined-Term-List (remove Term Undefined-Term-List)) (remprop Term :TERM-DEF) (remprop Term :TERM-TYPE) (remprop Term :TERM-VAL)) (mapc #'Forget* Term-List) ;Returns list of terms on the Term-List which have no definition.
(defun Terms-To-Be-Defined (remove-if #'Get-Def Term-List) Displays one Term or all current terms.
(defmacro Know (&optional Term) (Know* ',Term)) (defun Know* (&optional Term) (if Term S (Show-Term-Def Term) (Else (Scroll t) (dolist (Term (reverse Term-List)) (Show-Term-Def Term)) (format t (qD termq@[sq])" S (length Term-List) 1 (length Term-List)) A ifl
S
0 Appendix 2 '1 ;Allows displays of lists to scroll.
(defun Scroll (&optional Init) (if Init (setq Scroll-Size 19) (Else (decf Scroll-Size) (when (zerop Scroll-Size) (read-char) (setq Scroll-Size 19) Lists the name of all terms with Str in their name.
(defmacro Terms (&optional Str) (Terms* ',Str)) (defun Terms* (&optional Str &aux Terms) (if Str (setq Terms (Intersect (apropos-list Str) Term-List)) (setq Terms (reverse Term-List))) (Scroll t) (dolist (Term Terms) (Scroll) (format t "cg%A" Term) Lists the name and value of all terms with a value.
Known (&aux Val) (Scroll t) (dolist (Term Term-List) (setq Val (Get-Val Term)) (unless (equal Val 'UNKNOWN) (Scroll) (format t "q%qA Term (Display-Val Val)) S; Lists definitions of all terms with Str in their name.
so (defmacro Find (Str) (Find* ',Str)) Find* (Str) (let ((Terms (Intersect (apropos-list Str) Term-List))) (Scroll t) (dolist (Term Terms) (Show-Term-Def Term) o• J/ -Appendix 2 36-
ICN
Returns the intersection of two lists.
(defun Intersect (Lstl Lst2) (remove-if #'(lambda (Elem) (not (member Elem Lstl)) Lst2) Displays definition of Tei-m.
(defun Show-Term-Def (Term &aux Def-Str) (setq Def-Str (Def-To-Str (Get-Type Term) (Get-Def Term))) (format t "q%qA Term) (Prt-Indent Def-.Str) Prints Str, indenting before each new line (defun Prt-Indent (Str &aux (Len (length Str)) (do ((Start 0 Start Chars)) (Chars 76 (send *terminal-io* :cursorpos)) Chars 71)) Start Len)) (princ (subseq Str Start Chars)) (Scroll) (when Start Chars) Len) (princ 11)) Saves external form of current definitions into Fie ".SAV stdgfmacro Save (File) (Save* ',File)) *O(ddfun Save* (File) *(let ((standard-output* (open (string-append File ".SAV) :direction :output))) (dolist (Term (reverse Term-List)) (Prt "(Define Term (Get-Type Term) NL 1 (prini (Def-To-Str (Get-Type Term) (Get-Def Term))) (Prt NLM (close *standard-output*)) NL "Definitions saved to file "(string-append File ".SAV)) :0 0 006 A~1 *0S0 S S S. S 05 S 0e 0S TlI 4 .Appendix 2 37 I ~Appendix 22 Saves internal form of current definitions into File ".DMP" (defmacro Dump (File) (Dump* ',File)) (defun Dump* (File) (let ((standard-output* (open (string-append File :direction :output))) (dolist (Term (reverse Term-List)) (Prt "(Define2 Term d (Get-Type Term) NL" (prini (Get-Def Term)) (Prt NU) (close *standard-output*)) (Prt NL "Rules dumped to file "(string-append File Loads previously saved rules from File.
(defmacro Restore (&optional File) (Restore* ,File)) (defun Restore*' (&optional File) (if File (Then (Forget*) (if (probe-file (string-append File (load (string-append File (load (string-append File ".SAV") (Else (Files ".SAV") (Files :Lists all files in current directory **idefun Files (&optional (Ending ***.(mapc #'(lambda (Name) (format t A" (pathname-name Name)) *fee (directory (string-append I*iEnding))) nil Prints multiple strings.
Recognizes NL as a new line.
(de'un Prt W&est Strs) (dolist (Str Strs) 0So (princ Str) -Appendix 2-32 101 Appcndi X2 (defconstant NL (string ;Resets attached value for one or all terms.
(defmacro Reset (&optional Term) (Reset* ',Term)) (defun Reset* (&optional Term) (if Term (Then (remprop Term :TERM-VAL) (mapc #'Reset* (Uses-Term Term))) (dolist (Term Term-List) (remprop Term :TERM-VAL) 1 ;Sets the attached value of Term.
(defmacro Assume (Term) (Assume* ',Term)) (defun Assume* (Term) (push Term Arg-Stack) (remprop Term :TERM-VAL) (mapc #'Reset* (Uses-Term Term)) (Set-Val Term (case (Get-Type Term) (Number (Ask-Number)) (Number (Ask-Text)) (Number (Ask-Yes-No)))) Arg-Stack) Displays definitions of all terms which reference Term.
."*'defmacro Uses (Term) (Uses* ',Term)) "(defun Uses- (Term) S.:::(Scroll t) (dolist (Parent-Term (Uses-Term Term)) (Show-Term-Def Parent-Term) So Returns all terms which reference Term.
(defun Uses-Term (Term) (remove nil (mapcar #'(lambda (If (member Term (Terms-Used X)) Term-List
I.)
TO L 2 '[012
I
1\Appendix 2 26 Returns list of terms used in definition of Term.
(defun Terms-Used (Term) (Terms-In-Def (Get-Def Term)) Renames Old to New and replaces every reference to Old to New.
(defmacro Rename (Old New) (Rename* ',Old ',New)) (defun Rename* (Old New) (Set-Def New (Get-Type Old) (Get-Def Old)) (Forget* Old) (dolist (Term Term-List) (setf (get Term :TERM-DEF) (subst New Old (Get-Def Term))) Replaces every reference to Old to New and deletes Old.
(defmacro Replace (Old New) (Replace* ',Old ',New)) (defun Replace* (Old New) (Forget* Old) (dolist (Term Term-List) (setf (get Term :TERM-DEF) (subst New Old (Get-Def Term))) 0 @0 @00.
00 0 00 0 000 0000 0 0000 00 0 0000 00 00 0 @000 00 0 0 00 ~yj 1 0 000 '00:.9 00 0 'A p p e md x2-410
Claims (7)
1. A digital computer system operable as an expert system, said computer system comprising: storage means which stores a knowledge base including hierarchically-defined terms and their definitions, each said definition defining it's respective term as a sequence of one or more elements selected from a set of values external to the knowledgebase and/or a subset of the hierarchically-defined terms having their definitions at a lower level of the hierarchy than said respective S term; and processing means programmed to receive commands from a user of the system, to produce inference commands ee e in response to said commands to obtain the definition of a oe *given term, and to compute the value of said given term from its corresponding definition by obtaining the value 0*SS S.of any term and any external value in corresponding definition, said system employing said computed value to produce an expert response to said user.
2. A digital computer system according to claim 1, o° wherein: the definition of a term further includes at least one see**: we**o ooooo 0 *oSoS Soo II operator for defining how the value of a term and/or an external value is to be used in the definition; and the processing means computes the value of said given term using the operator(s) in the corresponding definition.
3. A digital computer system according to any of claims 1 to 2, wherein: each definition corresponding to a term is a function definition; and the processing means computes the value of said given term .anO. by executing the function defined by the corresponding function definition. A digital computer system according to any of claims 1 to 3, wherein: the corresponding definition specifies the source of any external value used therein; and the processing means obtains the value of any external value from the specified source. .1 A digital computer system according to any of claims 1 to 4, wherein: goo* the user commands include a user command which specifies -105 the given term and to which the processing means responds by producing the computed value as the expert response.
6. A digital computer system according to any of claims 1 to 5, wherein: storage means retains any external value used to produce the computed value; and the user commands include a user command for altering one or more of the retained external values.
7. A digital computer system according to any of claims 1 to 6, wherein: the user commands include a user command specifying the given term to which the processing means responds by .1r. producing an expert response derived from the definition which shows how the current value of the given term was computed using the corresponding definition. ego
8. A digital computer asytem according to any of claims S1 to 7, comprising: interactive input/output means employed, in use, by the user of the system to receive a request for a user command, a request for an external value, and the expert response from the digital computer system and -106 .,Appendix 2 31 I to provide the user commands and the external value of the digital compuiter :iyst:mol; and the user commands include a user command provided on the input/output means in response to the request for the external value to which the processor means responds by producing an expert response from'the definition which shows why the external value is required for the computation.
9. A digit:al computer system accordinq to any of claims I to 8, wherein: the user commands include a user command for specifying a new term to which the processing means responds by receiving input from the user as required to produce a definition in the knowledge base corresponding to the new term and definitions for any undefined terms required for the corresponding definition until there are no undefined terms remaining in the corresponding definition. L digital mopte- bsystem operabie as an pert system S shell suitable for creating an expert s m as claimed in any of claims 1 to 9, comprising: said storage means fo oring said knowledge base, and S- 107 N r- d 0 i -Appendix 2 32 °sS r 107a A digital computer system operable as an expert system shell suitable for creating an expert system knowledge base whereby the digital computer system becomes operable as an expert system as claimed in claims 1-9, the digital computer system comprising: said storage means for storing said knowledge base, and said processing means, which processing means is additionally programmed to create said knowledge base stored in said storage means in response to information supplied, in use, by a creator of the system. DATED this 18th day of October 1989 WANG LABORATORIES INC Patent Attorneys for the Applicant: F.B. RICE CO. SO *o 0000 O *O S oS 00 S* f* 55 to 0 0055 0S S 00 S S 0 000 See Li
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US76686085A | 1985-08-16 | 1985-08-16 | |
US766860 | 1985-08-16 |
Publications (1)
Publication Number | Publication Date |
---|---|
AU595155B1 true AU595155B1 (en) | 1990-03-29 |
Family
ID=25077737
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
AU60798/86A Ceased AU595155B1 (en) | 1985-08-16 | 1986-07-29 | Expert system apparatus and methods |
Country Status (5)
Country | Link |
---|---|
AU (1) | AU595155B1 (en) |
CA (1) | CA1278390C (en) |
DE (1) | DE3627204C2 (en) |
FR (1) | FR2644608B1 (en) |
GB (1) | GB8617444D0 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1413958A3 (en) * | 2002-10-23 | 2010-02-10 | Siemens Aktiengesellschaft | Method and system for computer-based analysis of a technical system |
EP1413957A3 (en) * | 2002-10-23 | 2010-03-03 | Siemens Aktiengesellschaft | Method and system for computer-based analysis of a technical system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
AU3666984A (en) * | 1984-01-16 | 1985-07-25 | Itt Corp. | Context driven pattern recognition |
AU3666884A (en) * | 1984-01-16 | 1985-07-25 | Itt Corp. | Probabilistic learning element |
AU3667084A (en) * | 1984-01-16 | 1985-07-25 | Itt Corp. | Pattern recognition |
-
1986
- 1986-07-17 GB GB868617444A patent/GB8617444D0/en active Pending
- 1986-07-29 AU AU60798/86A patent/AU595155B1/en not_active Ceased
- 1986-08-11 CA CA000515640A patent/CA1278390C/en not_active Expired - Fee Related
- 1986-08-13 FR FR8611696A patent/FR2644608B1/en not_active Expired - Fee Related
- 1986-08-14 DE DE3627204A patent/DE3627204C2/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
AU3666984A (en) * | 1984-01-16 | 1985-07-25 | Itt Corp. | Context driven pattern recognition |
AU3666884A (en) * | 1984-01-16 | 1985-07-25 | Itt Corp. | Probabilistic learning element |
AU3667084A (en) * | 1984-01-16 | 1985-07-25 | Itt Corp. | Pattern recognition |
Also Published As
Publication number | Publication date |
---|---|
FR2644608B1 (en) | 1995-05-19 |
FR2644608A1 (en) | 1990-09-21 |
CA1278390C (en) | 1990-12-27 |
DE3627204A1 (en) | 1990-08-30 |
GB8617444D0 (en) | 1990-08-08 |
DE3627204C2 (en) | 1996-05-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US4916633A (en) | Expert system apparatus and methods | |
US10831449B2 (en) | Process and system for automatic generation of functional architecture documents and software design and analysis specification documents from natural language | |
US5043891A (en) | Document generation apparatus and methods | |
EP0481995B1 (en) | Expert system | |
US10303441B2 (en) | Process and system for automatic generation of functional architecture documents and software design and analysis specification documents from natural language | |
EP0436459B1 (en) | Method providing intelligent help explanation paralleling computer user activity | |
McGuinness et al. | Explaining subsumption in description logics | |
Cardone et al. | History of lambda-calculus and combinatory logic | |
Mengshoel | Knowledge validation: principles and practice | |
US12130855B2 (en) | System and method for constructing digital documents | |
Alexander | Scala cookbook | |
Kramer et al. | Tool support for requirements analysis | |
AU595155B1 (en) | Expert system apparatus and methods | |
Wang et al. | Reasoning support for Semantic Web ontology family languages using Alloy | |
Ford | Artificial intelligence and software engineering: a tutorial introduction to their relationship | |
Van Lambalgen et al. | Moschovakis’ notion of meaning as applied to linguistics | |
Nelder | How should the statistical expert system and its user see each other? | |
JP5828438B2 (en) | Autonomous knowledge system construction machine | |
Plant et al. | Using meta-knowledge within a multilevel framework for KBS development | |
JP5828437B2 (en) | Autonomous processing procedure generation and execution machine | |
Niederliński | An expert system shell for uncertain rule-and model based reasoning | |
Ludemann | Mid-term report on the Arden Syntax in a clinical event monitor | |
JP5866721B2 (en) | Artificial intelligence device | |
Verter et al. | Don't Call Us, We'll Call You: Towards Mixed-Initiative Interactive Proof Assistants for Programming Language Theory | |
JP6799731B2 (en) | Methods, computer programs and devices for computers to infer interactively |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
MK14 | Patent ceased section 143(a) (annual fees not paid) or expired |