 IMP SHELL HELP  INFORMATION ----- 
 
 USE UP  AND DOWN ARROW  KEYS TO MOVE  THROUGH TEXT.
 USE ESCAPE TO GO BACK TO MAIN MENU.
 
 
 The IMP Shell is a powerful expert system development environment for
 the IBM PC.  It contains all the utilities needed to develop and test
 new expert  systems,  and run  them  when  they  are  finalized.  All
 functions are menu driven and appear in windows.   IMP expert systems
 are rule based,  backwards chaining systems.   They are very fast and
 not limited by an artificially small number of rules.
 
 The IMP Shell is in the public domain and is used in many educational
 settings.  It was developed  by Daniel H. Marcellus of the Middletown
 Programming  Works,  Middletown,  N.Y.  It is completely described in
 the book:
 
      D.   Marcellus, 
      Expert   System  Programming  in   Turbo  Prolog, 
      Prentice-Hall,
      Englewood Cliffs, N.J., 1987.
 
 An expert system is a program which has captured the expertise  of an
 expert  in  some field and  can deploy that expertise  with seemingly
 intelligent behavior.   For instance  there are expert  systems to do
 all these things:
 
 
      diagnose medical problems
 
      guide the repair of complex equipment
 
      give advice about taxes and investments
 
      guide chemists in synthesizing desired chemicals
 
      interpret telemetry data from satellites
 
      control nuclear reactors and electric utility grids
 
 
 A shell makes it easy to set up an expert system by  concentrating on
 the problem at  hand  rather  than  on  the details  of  a particular
 machine reasoning system or artificial  intelligence language.   This
 shell was written entirely  in TURBO  PROLOG,  and the source code is
 provided,  although you don't need to understand anything about TURBO
 PROLOG in order to set up an expert system with this software.
 
 The IMP Shell is menu driven,  and the menu allows you  to select all
 the  activities  that  are   necessary  at  various  stages   of  the
 development of an expert system, for example:
 
 
      1.   HELP information
      2.   MAKE rules for a new expert system
      3.   INSPECT the rule set that is loaded
      4.   SAVE the rule set that is loaded
      5.   LOAD an existing rule set
      6.   RUN the presently loaded rule set
      7.   EDIT an existing rule set
      8.   PRINT an existing rule set
      9.   DOS access
      10.  END this program
 
 
 The IMP Shell uses backward reasoning.   This means that  it has  the
 proper   architecture   for   creating   good   expert   systems  for
 classification  tasks,  for troubleshooting,  and, in  general,   for
 anything that involves choosing among   alternatives.    It   is  not
 the  proper  architecture  for  applications   that   require  a well
 defined sequence  of steps  with complex reasoning   going  into  the
 application of each step.   Applications such as configuring  complex
 equipment or  estimating costs of a project are of this  sort.   They
 should be implemented with a forward chaining shell.
 
 Designing an expert system with the IMP shell consists entirely in
 collecting a set of IF - THEN rules which work together to  define a
 problem.  Here are examples of such rules.  
 
 
 The basic form of a rule is a simple implication like this:
 
 
     IF (the customer can qualify)  THEN (the bank  will loan the
     customer mortgage money).
 
 
 The  IF  part  is  called  the premise;  the THEN part is  called the
 conclusion.  With one exception (formulas), the IF and THEN parts are
 text strings which describe  some  condition that  is  being reasoned
 about.
 
 Rules can have AND's between conditions in the premise.
     
     
     IF ((it is summer)  AND (it is hot))  THEN (beer consumption
     will rise).
 
 
 Rules can have OR's between conditions in the premise:
 
     
     IF ((the car is very cheap)  OR (the car is very  old)) THEN
     (the car will  have  a simple  carburetor  rather  than fuel
     injection).
     
     
 The premise can also be a formula as in this rule:
 
     
     IF (age >  18)  THEN (person can make legal contracts  as an
     adult).
 
 
 This  is  the only  case  where a premise is  not treated  as  a text
 string.   Formulas are Boolean expressions arranged  around a central
 relational operator  which can be:  >,  <,  >=,  <=, =.  Formulas can
 include parentheses and any arrangement of the operators +, -, *, and
 /.   The variables mentioned in  formulas are  true variables, rather
 than pieces of text.   They will acquire values  during the operation
 of the expert  system.    A premise involving a formula  can not have
 any AND or OR operations in it -- just a simple formula.
 
 Any of the conditions or formulas shown that can occur in the premise
 can  have  NOT's in  front of  them  to  reverse their  meaning.  For
 example:
 
     
     IF   ((NOT(day is on weekend))  AND (student is young)) THEN
     (a curfew will be imposed).
 
 
 Another example is this:
 
     
     IF  (NOT(age < 21)) THEN (student can drink).
 
 
 A rule can be stated in positive or  negative form,  but generally it
 is more  understandable  in  positive  form  (i.e.  the form with the
 fewest NOT's.).
 
 Another  characteristic  of  rules  is  that  they  have  a certainty
 associated  with  them.   Certainties are numbers between +1  and -1.
 +1  means it is absolutely certain that what a rule says  is true. -1
 means it is absolutely certain that the  thing is not  true, 0  means
 no knowledge of  whether  it  is  true  or  not.   Other  numbers can
 indicate various gradations  as  for instance,  .5 means something is
 moderately certain to be true.  The system uses these numbers for its
 automatic reasoning processes.  You will be asked for certainties  in
 two places. When asking you for discrete pieces of information or for
 new rules,  the system  will  always ask for  an associated certainty
 along with your answer.
 
 Rules have  another characteristic  which  you  must  specify  to the
 system  when  you  define  them.    This  is  the  characteristic  of
 reversibility  or  non-reversibility.   A  rule  is  reversible if it
 still makes sense if  you imagine putting   a  NOT  in  front  of the
 entire  premise and in  front of  the entire  conclusion.  Most rules
 turn  out to be non-reversible.   You can't go  wrong if  you are not
 sure just by telling the system that the rule is non-reversible.
 
 Here is an example of a reversible rule:
 
    
     IF (car  is  a late  model)  THEN (it will have  a catalytic
     converter).
 
 
 Clearly, it's still true if you negate premise and conclusion because
 early cars didn't have catalytic converters.
 
 
 Here is an example of a non-reversible rule:
 
 
     IF (car is a late model) THEN (it will have a radio).
 
 
 If you reverse this rule, you get a statement which is not true.  Old
 cars frequently had radios too.
 
 Rules have  an  internal format which the system  will  put them into
 automatically  when  you use the dialog  that the  system provides to
 build a rule set.   In order to edit a set of rules  that you already
 have,  you will  want  to understand the internal  form.   Here is an
 example:
 
 
     IF ((it is summer)  AND (it is hot))  THEN (beer consumption
     will rise).
 
 
 Internally, this is represented as:
 
 
     imp(a,n,"beer   consumption    will    rise.","pos","it   is
     summer","pos","it is hot",0.8)
 
 
 There are eight arguments inside the parentheses.   The conclusion is
 always  in  the third position(third  argument).   The  first premise
 clause is  in  the fifth position.   If  there is  a  second  premise
 clause,  it is in the seventh position.  The number at the end is the
 certainty for the rule.   The very first argument  is  a letter  that
 indicates the type of the rule.   It can be s,  a,  o, or f meaning a
 simple rule,  or one containing an AND,  or one containing an  OR, or
 one containing  a formula in the premise.    At the places  where you
 see  pos,  these are indicators  of  whether that  particular element
 should be preceeded by a NOT or left in positive form.   Should a NOT
 have been specified,  the internal form would have shown  neg at that
 position.    The  second  argument   is  always  n   or  r  signaling
 non-reversible or reversible.
 
 Let's look at one more rule in external and in internal form.
 
 
     IF (the customer can qualify)  THEN (the bank will  loan the
     customer mortgage money).
     
     
     imp(s,n,"the   bank   will   loan   the   customer  mortgage
     money.","pos","the customer can qualify",dummy,dummy,0.9)
 
 
 When the second premise clause is not used, dummy appears in the rule
 to signal that fact.   This allows the internal format always to have
 just one form, eight arguments, whether they are all used or not.
 
 Let's now consider a simple two rule  expert system.   Its purpose is
 to reason about whether a person can get a mortgage or not.
 
 Here is the type of information you would have had to give the system
 when you were using the menu function to make rules:
 
 
     IF (the customer can qualify)  THEN (the bank  will loan the
     customer mortgage money).
     
     IF  (all_house_payments  <   .36*monthly_income)  THEN  (the
     customer can qualify).
     
     hypothesis - the customer can qualify.
     
     
 It is  necessary to  tell  the system  at least  one hypothesis.  The
 conditions that are identified as hypotheses are what the system will
 reason about automatically.  These are the things you want the system
 to find out.   You can have as many hypotheses as you want, but there
 must be rules that give the system a basis to reason about them.
 
 Here is how the system will behave when you ask it to execute  on the
 basis of this rule information.   It will ask you how much  the house
 payments are ; it will ask how much the   monthly income is.  Then it
 will do internal calculations and state its  conclusion about whether
 the  bank  will loan the mortgage  money.   It will state  it  with a
 certainty number indicating  how likely it is  that the  bank will do
 this. 
 
 Sometimes,  it is useful to define a high level variable that is used
 in a formula in  terms of  a combination  of  lower  level variables.
 Then,  the system will question you about the  lower  level variables
 rather  than the  original one as it  acquires information  to do the
 formula computation that you want.   For instance, all_house_payments
 can be  defined as  the sum of  mortgage  and  monthly  insurance and
 monthly taxes (prorated).   The  system  will  let  you  set  up such
 definitions when you make an  initial set of  rules;  or, if you know
 the internal form of the definition,  it can be done from the editor.
 The internal form for this particular definition is:
 
 
      define(all_house_payments,"mortgage + monthly_insurance +
          monthly_taxes")
 
 
 IMP Shell has an explanation capability.   At every  stage, where the
 system asks you  for something or  where it states a  conclusion, you
 have the opportumity to ask,  "why do you want to  know?" (the system
 will  explain)  or  "how  did  you  decide  that?"  (the  system will
 explain.)
 
 So we have now seen the action of a trivial two  rule  expert system.
 You have two avenues to get more information on the IMP shell.  First
 of all,  we have included an  investment advisor  expert system which
 you can run.   From the main menu follow the option  that  says  Load
 an Expert System and then choose the example system.  You can also go
 into edit mode and inspect the internal structure of all the rules in
 this example.   Incidentally,  the editor  uses  the editing commands
 used by  WORDSTAR  and by  all of  the software  marketed  by BORLAND
 International,  such as TURBO PASCAL.  When you are finished editing,
 or are finished with any other functions,  and you want to go back to
 the main menu, type the Escape Key.
 
 The other way to find out more details is to read the book  on expert
 systems and PROLOG  mentioned above where all details  of  this shell
 are discussed.
 
 
 Here are  some technical characteristics  of the IMP  shell for those
 who are prepared to appreciate them:
 
        
     The shell utilizes backwards chaining.
     
     It uses uncertainty reasoning like EMYCIN.
     
     It furnishes why and how explanations on demand.
     
     It utilizes TURBO PROLOG's development aids.
     
     Descriptive strings are the objects reasoned about.
     
     Any number of rules can be involved in an inference.
     
     A   relational  expression   is allowed as the  premise of a
     rule.   Variables  in  such  an  expression  can  themselves
     be defined in separate definition statements.
     
     A  rule  can  be  set  up  as   reversible  or  irreversible
     depending on how you intend it to be used.
     
     
