
Part Seven
How Expert Systems Are Implemented
(Part Seven)
Shuoping Ma, Department of Computer Science, Tsinghua University
Section Seven
Expert System Tools
Xiaoming: I have gained some understanding of expert systems through your introduction. If I want to build an expert system, how should I implement it? What tools can I use?
Dr. Ai: Early expert systems were implemented using general-purpose programming languages. Notable early expert systems like DENDRAL and MYCIN were implemented in LISP. Due to the characteristics of LISP, it long dominated artificial intelligence programming and is known as the artificial intelligence programming language. PROLOG, with its automatic reasoning capabilities, was also widely used for building expert systems and other AI systems. There were also expert systems built using FORTRAN and C languages. However, due to the complexity of expert systems, while they can be constructed using general-purpose programming languages, it is often tedious, labor-intensive, and difficult to modify.
A characteristic of expert systems is the separation of the knowledge base from other parts of the system. The knowledge base is closely related to the problem domain, while the inference engine and other components are independent of specific domains and are more general. Therefore, some expert system tools were developed to facilitate the rapid construction of expert systems.
By utilizing previously developed expert systems, the rules describing domain knowledge can be “excavated” from the original system, retaining only the knowledge representation methods and domain-independent inference engine, resulting in an expert system tool. Such tools are called skeleton tools because they retain the main architecture and knowledge representation methods of the original system.
The earliest expert system tool, EMYCIN (Empty MYCIN), is a typical skeleton expert system tool. Its name indicates that it is derived from the famous expert system MYCIN. EMYCIN is suitable for consulting systems that require basic data and can provide explanations and analyses, especially suitable for diagnostic deductive problems. These problems typically have a large amount of input data, and their possible solution space can be enumerated in advance.
In EMYCIN, a backward depth-first control strategy is used, providing a specialized rule language to represent domain knowledge. The basic rule form is:
(IF
When the rule’s condition is true, it combines the condition with an action; otherwise, it combines with another action, and a number between -1 and +1 can represent the confidence level of the action under that condition, which is the rule’s confidence. For instance, a rule for identifying bacterial categories can be expressed as follows:
PREMISE: [AND (SAME CONTEXT SITE BLOOD)
(NOTDEFINITE CONTEXT IDENT)
(SAME CONTEXT STAIN GRAMNEG)
(SAME CONTEXT MORPH ROD)
(SAME CONTEXT BURN T)]
ACTION: (CONCLUDE CONTEXT IDENT PSEUDOMONAS TALLY 0.4)
This means:
If the culture site is blood,
the bacterial category is uncertain,
the stain is Gram-negative,
the morphology is rod-shaped,
and the patient has severe burns,
Then, with insufficient evidence (confidence level 0.4), it suggests that the bacterial category is Pseudomonas.
Xiaoming: This seems a bit complicated.
Dr. Ai: It mainly involves a lot of medical diagnostic knowledge; just having a general understanding of its meaning is enough. This rule is selected from the MYCIN knowledge base.
EMYCIN also provides a good user interface. When users find a question from the system unclear, they can use the Why command to ask the system why such a question was posed. For conclusions made by the system, they can use the How command to inquire how the conclusion was reached. This is extremely important for diagnostic systems, as users can avoid blindly following the strategies provided by the system.
Additionally, EMYCIN offers valuable tracking and debugging programs, accompanied by a test example library, greatly assisting users in developing systems.
Skeleton expert system tools are characterized by their ease of use; users simply need to express specific domain knowledge according to the tool’s required format, which effectively increases the efficiency of constructing expert systems. However, they lack flexibility; apart from the knowledge base, users find it difficult to alter any other aspects of the system. This is a drawback of skeleton expert system tools.
Another type of expert system tool is the language tool, which provides users with the basic mechanisms needed to construct expert systems. Besides the knowledge base, users can also utilize the basic mechanisms provided by the system to construct specific inference engines as needed. This type is more flexible and has a broader application range, but it is also more complex to use and requires a higher level of expertise from users. OPS5 is a typical language tool; it is based on production systems and integrates general control and representation mechanisms, providing users with the essential functions needed to build expert systems. In OPS5, no meanings or relationships of symbols are predefined; all meanings and relationships can be defined by users, and the reasoning mechanisms and control strategies are treated as knowledge, allowing users to influence the reasoning process through rules. The benefit of this approach is that constructing systems is more flexible and convenient, although it increases the difficulty of building expert systems. However, it is much easier than building an expert system from scratch using a programming language.
OPS5 executes its operations through the following loop:
(1) Matching. Determine which rules satisfy the conditions.
(2) Conflict resolution. Select a rule that satisfies the condition; if no rule satisfies it, execution stops.
(3) Execution. Execute the actions of the selected rule.
(4) Loop. Go back to step one.
This is just a simple outline of the control structure; the specific solving strategy depends on the production system defined by the user using OPS5.
In OPS5, there is a comprehensive database called the working memory, composed of a set of invariant symbolic structures. For instance, to represent “the substance named H2SO4 is colorless and acidic,” it can be written as:
(MATERIAL ‘NAME H2SO4 ‘COLOR COLORLESS ‘CLASS ACID)
Rules in OPS5 can represent domain knowledge as well as control knowledge, with the general form being:
(P
For example, a rule for coordinating overall actions can be expressed as follows, with specific meanings explained following the semicolon; the semicolon and the text after it are comments.
(P COORDINATE-A ; if there is a goal
(GOAL
‘NAME COORDINATE ; coordinate system task
‘STATUS ACTIVE ; in an active state
-(TASK-ORDER)) ; order not yet determined
→
(MAKE GOAL ; then create a sub-goal
‘NAME ORDER-TASKS ; determine the required order
‘STATUS ACTIVE) ; make it active
(MODIFY1 ; and modify the coordination goal
‘STATUS PENDING)) ; change its status to pending
Xiaoming: This seems more complex than the previous EMYCIN.
Dr. Ai: OPS5 is indeed a bit more complex, but as long as you can understand the comments after the semicolon, that should be sufficient.
OPS5 provides a conventional interactive programming environment, very similar to a typical LISP system, allowing users to track or interrupt program execution to check the system status or change the system during execution. To facilitate debugging when establishing larger systems, OPS5 allows users to call corresponding functions by rule names to check why a certain rule expected to be called was not invoked, and users can view specific elements in the database when the system enters an incorrect state. If the issue is due to an incorrect rule, users can modify the rule and continue running.
OPS5 is implemented in LISP, and later a C version, OPS83, was released to improve system execution speed.
Dr. Ai concluded: We have briefly introduced two typical expert system tools. EMYCIN is a skeleton expert system tool, while OPS5 is a language expert system tool. Each tool has its characteristics. The advantage of skeleton tools is ease of use, but they lack generality and flexibility. Conversely, language tools are more complex to use but are more flexible and have a certain degree of generality. The functional generality and ease of use are contradictory; language tools must consider various issues that may arise in developing expert systems to maintain their broad applicability, making them more challenging to use and harder for users to grasp. Representing specific domain knowledge is also more difficult than with skeleton tools, and they often do not perform as well as skeleton tools in user interaction and result explanation.
Xiaoming’s Study Notes
To facilitate the construction of expert systems, several expert system development tools have been created. Common expert system development tools fall into two categories. One is the skeleton tool, which is derived from mature expert systems by “excavating” the parts related to specific tasks, retaining the inference mechanisms and knowledge representation methods. EMYCIN is a typical skeleton tool derived from the expert system MYCIN. The characteristic of this type of expert system tool is its simplicity and ease of use; users only need to provide relevant task knowledge according to requirements, but it lacks flexibility. The other is the language tool, which provides users with the basic mechanisms needed to construct expert systems. Besides the knowledge base, users can also utilize the basic mechanisms provided by the system to construct specific inference engines as needed. The advantages are flexibility and a wide range of applications, but the disadvantage is that it is more complex to use and requires a higher level of expertise from users. OPS5 is a typical language tool.
To Be Continued

Scan to Follow Us
WeChat ID|airadiance
(Click “Read the Original” to view the errata and obtain the PPT)