Documente Academic
Documente Profesional
Documente Cultură
Principles and
Programming,
Fourth Edition
3
Objectives
• Examine earlier expert systems which have given
rise to today’s knowledge-based systems
• Explore the applications of expert systems in use
today
• Examine the structure of a rule-based expert
system
• Learn the difference between procedural and
nonprocedural paradigms
• What are the characteristics of artificial neural
systems
4
What is an expert system?
5
Fig 1.1 Areas of Artificial
Intelligence
6
Expert system technology
may include:
• Special expert system languages – CLIPS
• Programs
7
Expert System Main Components
8
Figure 1.2 Basic Functions
of Expert Systems
9
Problem Domain vs. Knowledge
Domain
• An expert’s knowledge is specific to one problem
domain – medicine, finance, science,
engineering, etc.
• The expert’s knowledge about solving specific
problems is called the knowledge domain.
• The problem domain is always a superset of the
knowledge domain.
10
Figure 1.3 Problem and
Knowledge Domain Relationship
11
Advantages of Expert Systems
• Increased availability
• Reduced cost
• Reduced danger
• Performance
• Multiple expertise
• Increased reliability
12
Advantages Continued
• Explanation
• Fast response
• Intelligent tutor
• Intelligent database
13
Representing the Knowledge
14
Knowledge Engineering
15
Development of an Expert System
16
The Role of AI
17
Uncertainty
18
Limitations of Expert Systems
19
Early Expert Systems
20
Table 1.3 Broad Classes
of Expert Systems
21
Problems with Algorithmic
Solutions
• Conventional computer programs generally solve
problems having algorithmic solutions.
22
Considerations for Building
Expert Systems
• Can the problem be solved effectively by
conventional programming?
• Is there a need and a desire for an expert system?
• Is there at least one human expert who is willing
to cooperate?
• Can the expert explain the knowledge to the
knowledge engineer can understand it.
• Is the problem-solving knowledge mainly
heuristic and uncertain?
23
Languages, Shells, and Tools
24
Expert systems Vs
conventional programs I
25
Expert systems Vs
conventional programs II
26
Expert systems Vs
conventional programs III
27
Elements of an Expert System
28
Elements Continued
29
Production Rules
30
Figure 1.6 Structure of a
Rule-Based Expert System
31
Rule-Based ES
32
Example Rules
33
Inference Engine Cycle
34
Foundation of Expert Systems
35
General Methods of Inferencing
36
Production Systems
37
Post Production System
40
Rete Algorithm
• Markov: too inefficient to be used with many rules
• Functions like a net – holding a lot of information.
• Much faster response times and rule firings can occur
compared to a large group of IF-THEN rules which
would have to be checked one-by-one in conventional
program.
• Takes advantage of temporal redundancy and structural
similarity.
• Looks only for changes in matches (ignores static data)
• Drawback is high memory space requirements.
41
Procedural Paradigms
42
Figure 1.8 Procedural
Languages
43
Imperative Programming
45
Nonprocedural Paradigms
46
Figure 1.9 Nonprocedural
Languages
47
What are Expert Systems?
48
Artificial Neural Systems
49
ANS Characteristics
51
Advantages of ANS
52
Disadvantage of ANS
53
Figure 1.10 Neuron
Processing Element
54
Sigmoid Function
55
Figure 1.11 A
Back-Propagation Net
56
Figure 1.12 Hopfield
Artificial Neural Net
57
MACIE
58
Summary
59
Summary Continued
60
Chapter 2:
The Representation of
Knowledge
Objectives
62
Objectives Continued
63
Objectives Continued
64
What is the study of logic?
65
Why is Logic Important
66
The Goal of Expert Systems
67
Knowledge in Expert Systems
68
Definitions of Knowledge
a)
(1) the fact or condition of knowing something with familiarity
gained through experience or association (2)acquaintance with or
understanding of a science, art, or technique
b)
(1) the fact or condition of being aware of something
(2) the range of one's information or understanding
69
Epistemology
70
Categories of Epistemology
•Philosophy •A priori
•A posteriori •Procedural
•Declarative •Tacit
71
A Priori Knowledge
72
A Posteriori Knowledge
• Also called “empirical knowledge”
• “That which follows”
• Derived from the senses
• Now always reliable
• Deniable on the basis of new knowledge w/o
the necessity of contradiction
• E.g., 100 coin flips give only 39 heads – what
can you conclude?
73
Procedural Knowledge
• Fix a watch
• Install a window
• Brush your teeth
• Ride a bicycle
74
Declarative Knowledge
75
Tacit Knowledge
• Unconscious knowledge
76
Knowledge in Rule-Based
Systems
• Knowledge is part of a hierarchy.
77
Knowledge in Rule-Based Systems II
78
Expert Systems vs. ANS
• Expert systems
o Draw inferences using facts
o Separate data from noise
o Transform data into information
o Transform information into knowledge
79
Metaknowledge
Metaknowledge is knowledge about knowledge
and expertise.
Most successful expert systems are restricted to as
small a domain as possible.
In an expert system, an ontology is the
metaknowledge that describes everything known
about the problem domain.
Wisdom is the metaknowledge of determining the
best goals of life and how to obtain them.
80
Figure 2.2 The Pyramid
of Knowledge
81
Knowledge Representation Methods
82
Production Rules
• Frequently used to formulate the knowledge in
expert systems.
• A formal variation is Backus-Naur form (BNF)
– metalanguage for the definition of language
syntax
– a grammar is a complete, unambiguous set of
production rules for a specific language
– a parse tree is a graphic representation of a
sentence in that language
– provides only a syntactic description of the
language 83
• not all sentences make sense
Example: Production Rules
84
Example: Parse Tree
of a Sentence
85
86
87
Advantages and Disadvantages of
Production Rules
Advantages:
• simple and easy to understand
• straightforward implementation
• formal foundations for some variants
Disadvantages:
• simple implementations are very inefficient
• some types of knowledge are not easily expressed
in such rules
• large sets of rules become difficult to understand
and maintain
88
Semantic Nets
• A classic representation technique for propositional
information (sometimes called propositional net)
• Propositions – a form of declarative knowledge, stating
facts (true/false)
• Propositions are called “atoms” – cannot be further
subdivided.
• Semantic nets consist of nodes (objects, concepts,
situations) and arcs or links (relationships between them).
• For nodes
– Labels indicate the name
– Nodes can be instances (individual objects) or classes (generic
nodes)
89
Links-Semantic Nets
92
93
94
95
96
97
Object-Attribute-Value Triple
98
99
Problems with Semantic Nets
Disadvantages of semantic nets could be classified as:
• Expressiveness
– no internal structure of nodes
– relationships between multiple nodes
– no easy way to represent heuristic information
– extensions are possible, but cumbersome
– best suited for binary relationships
• Efficiency
– may result in large sets of nodes and links
– search may lead to combinatorial explosion
• especially for queries with negative results
• Usability
– lack of standards for link types
– naming of nodes
• classes, instances
100
101
102
103
104
105
106
107
Schemata
109
Frames (Cont.)
110
Frames (Cont.)
111
Simple Frame Example
112
Figure 2.8 A Car Frame
113
Frame Structure
114
Slots
115
Usage of Frame
116
Restaurant Frame Example
117
Generic RESTAURANT Frame
Specialization-of: Business-Establishment
Types:
range: Generic Restaurant Frame
(Cafeteria, Fast-Food, Seat-Yourself, Wait-To-Be-Seated)
default: Seat-Yourself
if-needed: IF plastic-orange-counter THEN Fast-Food,
IF stack-of-trays THEN Cafeteria,
IF wait-for-waitress-sign or reservations-made THEN Wait-To-Be-Seated,
OTHERWISE Seat-Yourself.
Location:
range: an ADDRESS
if-needed: (Look at the MENU)
Name:
if-needed: (Look at the MENU)
Food-Style:
range: (Burgers, Chinese, American, Seafood, French)
default: American
if-added: (Update Alternatives of Restaurant)
Times-of-Operation:
range: a Time-of-Day
default: open evenings except Mondays
Payment-Form:
range: (Cash, CreditCard, Check, Washing-Dishes-Script)
Event-Sequence:
default: Eat-at-Restaurant Script
Alternatives:
range: all restaurants with same Foodstyle 118
if-needed: (Find all Restaurants with the same Foodstyle) [Rogers 1999]
Restaurant Script
EAT-AT-RESTAURANT Script
120
Frame Problems
• it is tempting to use frames as definitions of
concepts
– not appropriate because there may be valid
instances of a concept that do not fit the
stereotype
– exceptions can be used to overcome this
• can get very messy
• inheritance
– not all properties of a class stereotype should
be propagated to subclasses
– alteration of slots can have unintended 121
Logic and Sets
122
Forms of Logic
123
Venn Diagrams
124
Figure 2.13 Venn Diagrams
125
Propositional Logic
127
Figure 2.14 Intersecting Sets
128
Boolean Logic
129
Features of Propositional Logic
130
Features Continued
132
Truth Tables
133
Predicate Logic
134
Universal Quantifier
136
PROLOG and Semantic Nets
137
PROLOG Continued
140
Objectives
141
Objectives
142
Trees
143
Trees
145
Graphs
146
Graphs
• A circuit (cycle) is a path through the graph beginning
and ending with the same node.
• Acyclic graphs have no cycles.
• Connected graphs have links to all the nodes.
• Digraphs are graphs with directed links.
• Lattice is a directed acyclic graph.
• A Degenerate tree is a tree with only a single path from
the root to its one leaf.
147
Figure 3.2 Simple Graphs
148
Making Decisions
149
Binary Decision Trees
• Every question takes us down one level in the
tree.
• A binary decision tree having N nodes:
– All leaves will be answers.
– All internal nodes are questions.
– There will be a maximum of 2N answers for N
questions.
• Decision trees can be self learning.
• Decision trees can be translated into production
rules.
150
Decision Tree Example
151
State and Problem Spaces
152
Finite State Machine
153
Using FSM to Solve Problems
155
156
AND-OR Trees and Goals
157
158
159
Types of Logic
Deduction – reasoning where conclusions must
follow from premises (general to specific)
Induction – inference is from the specific case to the
general
Intuition – no proven theory-Recognizing a
pattern(unconsciously) ANN
Heuristics – rules of thumb based on experience
Generate and test – trial and error – often used to
reach efficiency.
160
Types of Logic
Abduction – reasoning back from a true condition
to the premises that may have caused the condition
Default – absence of specific knowledge
Autoepistemic – self-knowledge…The color of the
sky as it appears to you.
Nonmonotonic – New evidence may invalidate
previous knowledge
Analogy – inferring conclusions based on
similarities with other situations ANN
Commonsense knowledge – A combination of all
based on our experience
161
Deductive Logic
162
Syllogisms vs. Rules
• Syllogism:
– All basketball players are tall.
– Jason is a basketball player.
Jason is tall.
• IF-THEN rule:
IF All basketball players are tall and
Jason is a basketball player
THEN Jason is tall.
163
Categorical Syllogism
Premises and conclusions are defined using
categorical statements of the form:
164
Categorical Syllogisms
165
Categorical Syllogisms
166
Proving the Validity of Syllogistic
Arguments Using Venn Diagrams
1. If a class is empty, it is shaded.
2. Universal statements, A and E are always drawn
before particular ones.
3. If a class has at least one member, mark it with an *.
4. If a statement does not specify in which of two
adjacent classes an object exists, place an * on the
line between the classes.
5. If an area has been shaded, no * can be put in it.
167
Proving the Validity of Syllogistic
Arguments Using Venn Diagrams
Invalid
168
Valid
Proving the Validity of Syllogistic
Arguments Using Venn Diagrams
Valid
169
Rules of Inference
170
Direct Reasoning
Modus Ponens
171
Truth Table Modus Ponens
172
Some Rules of Inference
(Modus Ponens)
173
Rules of Inference
174
The Modus Meanings
175
The Conditional and Its Variants
176
Requirements of a Formal System
1. An alphabet of symbols
2. A set of finite strings of these symbols, the
wffs.
3. Axioms, the definitions of the system.
4. Rules of inference, which enable a wff to be
deduced as the conclusion of a finite set of
other wffs – axioms or other theorems of the
logic system.
177
Requirements of a FS Continued
178
Logic Systems
A logic system consists of four parts:
• Alphabet: a set of basic symbols from which more
complex sentences are made.
• Syntax: a set of rules or operators for constructing
expressions (sentences).
• Semantics: for defining the meaning of the
sentences
• Inference rules: for constructing semantically
equivalent but syntactically different sentences
179
WFF and Wang’s Propositional
Theorem Proofer
• Well Formed Formula for Propositional Calculus
• Wang’s Propositional Theorem Proofer
180
Predicate Logic
182
Predicate Logic
Terms:
• Constant symbols: symbols, expressions, or entities
which do not change during execution (e.g., true /
false)
• Variable symbols: represent entities that can change
during execution
• Function symbols: represent functions which
process input values on a predefined list of
parameters and obtain resulting values
183
Predicate Logic
Predicates:
• Predicate symbols: represent true/false-type
relations between objects. Objects are represented
by constant symbols.
184
Predicate Logic
Connectives:
• Conjunction
• Disjunction
• Negation
• Implication
• Equivalence
… (same as for propositional calculus)
185
Predicate Logic
Quantifiers:
• valid for variable symbols
• Existential quantifier: “There exists at least one
value for x from its domain.”
• Universal quantifier: “For all x in its domain.”
186
First-Order Logic
• First-order logic allows quantified variables to refer
to objects, but not to predicates or functions.
• For applying an inference to a set of predicate
expressions, the system has to process matches of
expressions.
• The process of matching is called unification.
187
PROLOG
Programming in Logic
188
PROLOG: Horn Clauses
189
PROLOG: Facts
190
Knowledge Representation
191
PROLOG: Architecture
192
Family Example: Facts
193
Family Example: Rules
194
PROLOG Sample Dialogue
195
PROLOG Sample Inference
196
PROLOG Sample Inference
197
Shallow and Causal Reasoning
200
Backward Chaining
201
Some Characteristics of
Forward and Backward Chaining
202
Figure 3.14 Types of Inference
203
Metaknowledge
204
Chapter 4:
Reasoning Under
Uncertainty
Objectives
207
10/11/2019
How to Expert Systems Deal with
Uncertainty?
• Expert systems provide an advantage when
dealing with uncertainty as compared to decision
trees.
• With decision trees, all the facts must be known
to arrive at an outcome.
• Probability theory is devoted to dealing with
theories of uncertainty.
• There are many theories of probability – each
with advantages and disadvantages.
208
10/11/2019
What is Uncertainty?
211
10/11/2019
Errors Related to
Hypothesis
• Many types of errors contribute to uncertainty.
212
10/11/2019
Errors Related to
Measurement
• Errors of precision – how well the truth is known
• Errors of accuracy – whether something is true or
not
• Unreliability stems from faulty measurement of
data – results in erratic data.
• Random fluctuations – termed random error
• Systematic errors result from bias
213
10/11/2019
Errors in Induction
• Where deduction proceeds from general to
specific, induction proceeds from specific to
general.
• Inductive arguments can never be proven correct
(except in mathematical induction).
• Expert systems may consist of both deductive
and inductive rules based on heuristic
information.
• When rules are based on heuristics, there will be
uncertainty.
214
10/11/2019
Deductive and Inductive Reasoning
about Populations and Samples
215
10/11/2019
Types of Errors
216
10/11/2019
Examples of Common Types of
Errors
217
10/11/2019
Classical Probability
218
10/11/2019
Deterministic vs.
Nondeterministic Systems
• When repeated trials give the exact same results,
the system is deterministic.
• Otherwise, the system is nondeterministic.
• Nondeterministic does not necessarily mean
random – could just be more than one way to
meet one of the goals given the same input.
219
10/11/2019
Three Axioms of Formal
Theory of Probability
220
10/11/2019
Experimental and Subjective
Probabilities
• Experimental probability defines the probability
of an event, as the limit of a frequency
distribution:
221
Compound Probabilities
• Compound probabilities can be expressed by:
222
Additive Law
223
10/11/2019
Conditional Probabilities
• The probability of an event A occurring, given
that event B has already occurred is called
conditional probability:
224
Sample Space of Intersecting Events
225
10/11/2019
Advantages and Disadvantages of
Probabilities
• Advantages:
– formal foundation
– reflection of reality (posteriori)
• Disadvantages:
– may be inappropriate
• the future is not always similar to the past
– inexact or incorrect
• especially for subjective probabilities
– Ignorance
• probabilities must be assigned even if no information is available
– assigns an equal amount of probability to all such items
– non-local reasoning
• requires the consideration of all available evidence, not only from the rules
currently under consideration
– no compositionality
• complex statements with conditional dependencies can not be decomposed
into independent parts 226
10/11/2019
Bayes’ Theorem
• This is the inverse of conditional probability.
• Find the probability of an earlier event given
that a later one occurred.
227
Hypothetical Reasoning
Backward Induction
• Bayes’ Theorem is commonly used for decision tree
analysis of business and social sciences.
• especially useful in diagnostic systems
• medicine, computer help systems
• inverse or a posteriori probability
• inverse to conditional probability of an earlier
event given that a later one occurred
• PROSPECTOR (expert system) achieved great fame as
the first expert system to discover a valuable
molybdenum deposit worth $100,000,000.
228
10/11/2019
Bayes’ Rule for Multiple
Events
Multiple hypotheses Hi, multiple events E1,
…, En
P(Hi|E1, E2, …, En) =
(P(E1, E2, …, En|Hi) * P(Hi)) / P(E1,
E2, …, En)
or
P(Hi|E1, E2, …, En)=
(P(E1|Hi) * P(E2|Hi) * …* P(En|Hi) *
P(Hi)) /
229
Advantages and Disadvantages
of Bayesian Reasoning
Advantages:
• sound theoretical foundation
• well-defined semantics for decision making
Disadvantages:
• requires large amounts of probability data
• subjective evidence may not be reliable
• independence of evidences assumption often not
valid
• relationship between hypothesis and evidence is
reduced to a number
• explanations for the user difficult
• high computational overhead
230
Temporal Reasoning
231
10/11/2019
Markov Chain Process
232
10/11/2019
Markov Chain Characteristics
233
10/11/2019
State Diagram
Interpretation of a Transition Matrix
234
10/11/2019
The Odds of Belief
P 0.95
odds 19 to 1
1 P 1 0.95
237
10/11/2019
Sufficiency and Necessity
• The likelihood of sufficiency, LS, is calculated as:
238
Relationship Among Likelihood Ratio,
Hypothesis, and Evidence
239
10/11/2019
Relationship Among Likelihood of
Necessity, Hypothesis, and Evidence
240
10/11/2019
Uncertainty in Inference
Chains
241
10/11/2019
Intersection of H and e
242
10/11/2019
Piecewise Linear Interpolation Function for
Partial Evidence in PROSPECTOR
243
10/11/2019
Combination of Evidence
245
10/11/2019
Types of Belief
246
10/11/2019
Figure 4.20 Relative Meaning of Some
Terms Used to Describe Evidence
247
10/11/2019
Propagation of
Probabilities
• The chapter examines the classic expert system
PROSPECTOR to illustrate how concepts of
probability are used in a real system.
249
10/11/2019
Summary
250
10/11/2019
Chapter 5:
Inexact Reasoning
Objectives
252
4/4/2011
Uncertainty and Rules
253
4/4/2011
Figure 5.1 Major Uncertainties in
Rule-Based Expert Systems
254
4/4/2011
Figure 5.2 Uncertainties in Individual
Rules
255
4/4/2011
Figure 5.3 Uncertainty Associated with
the Compatibilities of Rules
256
4/4/2011
Figure 5.4 Uncertainty Associated
with Conflict Resolution
257
4/4/2011
Goal of Knowledge Engineer
258
4/4/2011
Verification vs. Validation
260
4/4/2011
Sources of Uncertainty
261
4/4/2011
Uncertainty in Conflict
Resolution
There is uncertainty in conflict resolution with
regard to priority of firing and may depend on a
number of factors, including:
Explicit priority rules
Implicit priority of rules
Specificity of patterns
Recency of facts matching patterns
Ordering of patterns
Lexicographic
Means-Ends Analysis
Ordering that rules are entered
262
4/4/2011
Uncertainty
263
4/4/2011
Uncertainty
265
4/4/2011
Difficulties with Bayesian Method
266
4/4/2011
Belief and Disbelief
267
4/4/2011
Belief and Disbelief
268
4/4/2011
Likelihood of Belief / Disbelief
269
4/4/2011
Measures of Belief and Disbelief
• measure of belief
– degree to which hypothesis H is
supported by evidence E
– MB(H,E) = 1 if P(H) =1
(P(H|E) - P(H)) / (1- P(H)) otherwise
• measure of disbelief
– degree to which doubt in hypothesis H is
supported by evidence E
– MB(H,E) = 1 if P(H) =0
270
4/4/2011
Certainty Factor
271
4/4/2011
Certainty Factor
• certainty factor CF
– ranges between -1 (denial of the hypothesis H) and +1
(confirmation of H)
– allows the ranking of hypotheses
273
4/4/2011
Combining Certainty Factors
Ranges
measure of belief 0 ≤ MB ≤ 1
measure of disbelief 0 ≤ MD ≤ 1
certainty factor -1 ≤ CF ≤ +1
275
4/4/2011
Threshold Values
277
4/4/2011
Dempster-Shafer Theory
278
4/4/2011
Dempster-Shafer
279
4/4/2011
Dempster-Shafer
280
4/4/2011
Dempster-Shafer
281
4/4/2011
Dempster-Shafer
282
4/4/2011
Dempster-Shafer
284
4/4/2011
Dempster-Shafer
285
4/4/2011
Dempster-Shafer
286
4/4/2011
Dempster-Shafer
3. Combining Evidence
Dempster’s rule combines mass to produce a
new mass that represents the consensus of the
original, possibly conflicting evidence
The lower bound is called the support; the
upper bound is called the plausibility; the belief
measure is the total belief of a set and all its
subsets.
287
4/4/2011
Dempster-Shafer
291
4/4/2011
Fuzzy Set Operations
292
4/4/2011
Fuzzy Set Operations
293
Fuzzy Relations
294
4/4/2011
Fuzzy Relations
295
4/4/2011
Table 5.7 Some Applications of
Fuzzy Theory
296
4/4/2011
Table 5.8 Some Fuzzy Terms of
Natural Language
297
4/4/2011
Linguistic Variables
298
4/4/2011
Extension Principle
299
4/4/2011
Fuzzy Logic
300
4/4/2011
Possibility and Probability
and Fuzzy Logic
• In fuzzy logic, possibility refers to allowed
values.
301
4/4/2011
Translation Rules
302
4/4/2011
State of Uncertainty
Commercial Applications
• There are two mountains – logic and uncertainty
• Expert systems are built on the mountain of logic
and must reach valid conclusions given a set of
premises – valid conclusions given that –
– The rules were written correctly
– The facts upon which the inference engine
generates valid conclusions are true facts
• Today, fuzzy logic and Bayesian theory are most
often used for uncertainty.
303
4/4/2011
Summary
305
4/4/2011
Chapter 6:
Design of Expert
Systems
Stages:
1. Feasibility Study – see if the project is feasible
2. Rapid Prototype – demonstrate ideas / impress
3. Refined System – verification by knowledge
engineers
4. Field Testable – system tested by selected users
2. Knowledge Definition
3. Knowledge Design
5. Knowledge Verification
The objective here is to determine the
correctness, completeness, and
consistency of the system.
• Formal tests
• Test Analysis
6. System Evaluation
• Example #2:
(infix) (y2 – y1) / (x2 – x1) > 0
(prefix) (> ( / ( - y2 y1 ) (- x2 x1 ) ) 0)
• Example:
(format nil “Name: %-15s Age: %3d” “Bob Green”
35)
Produces the results:
“Name: Bob green Age: 35”
%-m.Nx
(defrule get-name
=>
(printout t “What is your name? “
(bind ?response (readline))
(assert (user’s-name ?response)))
(test <predicate-function>)
Example:
(test (> ?value 1))
Symbols Strings
Lexemes Integers
Floats Numbers
Instance-names Values
Approaches:
1. Embed the control knowledge directly into the rules.
Example:
Detection rules would include rules indicating when
the isolation phase should be entered. Each group of
rules would be given a pattern indicating in which
phase it would be applicable.
• Example:
CLIPS> (focus DETECTION)
TRUE
CLIPS> (run)
Guidelines:
– Place the most specific pattern toward the front of the
LHS of a rule.
– Patterns matching against facts frequently
added/removed from fact list should be placed toward
the end of the LHS of a rule.
– Patterns that will match very few facts in the fact list
should be placed near the front of the rule.
halt function
General format:
(if <predicate-expression>
then <expression>+
[else <expression>+])
General format:
(while <predicate-expression> [do]
<expression>*)
General format:
(loop-for-count <range-spec> [do] <expression*)
General format:
(progn$ <list-spec> (expression>*)
<list-spec> can be :
<multifield-expression> - body is executed once for each
field
<list-variable> - field of current iteration is retrieved by
referencing variable. Special variable is created by
appending –index to <list-variable> - index of
current iteration
General format:
(break)
The break function terminates the execution of
the while, loop-for-count, or progn$ function in
which it is immediately contained. It causes
early termination of a loop when a specified
condition has been met.
General format:
(assert (phrase halt))
The halt function can be used on the RHS of a
rule to stop execution of rules on the agenda.
When called, no further actions will be executed
from the RHS of the rule being fired and control
returns to the top-level prompt.
General format:
(return [<expression>])
Global-variable = ?*<symbol>
• General formats:
(defgeneric <defgeneric-name>
[<optional-comment>])
system batch
dribble-on/off random
sort apropos
string-to-field
General format:
(definstances <definstances name> [active]
[<optional comment>]
<instance-definition>*)
• Definitions:
– Subclass – class that inherits directly/indirectly from
another class
– Superclass – class from which subclass inherits
• A single-inheritance class hierarchy is one in
which each class has only one direct superclass.
• A multiple-inheritance hierarchy (COOL) is
where a class may have more than one direct
superclass.
General format:
(object <attribute-constraint>*)
2. message-duplicate-instance
3. active-duplicate-instance
4. active-message-modify-instance
Specifying:
– Single inheritance – a single class specified in the is-a
attribute
– Multiple inheritance – specify more than one class in
the is-a attribute
Problem Statement:
The problem to be solved is an example of a
simple monitoring system – well suited for
forward chaining rule-based languages.
– Input consists of sensor values read during program
cycles.
– Inference occurs until all possible conclusions can be
derived from the input data are reached.
Knowledge Definitions:
Control of Execution:
Determine the phases of the monitoring process –
Detecting a Trend:
Issue Warnings:
The final phase is the warning phase.
– Sensors having entered red line regions will have their
associated devices shut off.
– Sensors staying w/in guard line region for a number of
cycles will have their devices shut off.
– Sensors in guard line region and did not have their
devices shut off will have a warning issued