Extending Daydreamer

by Erik T. Mueller
Daydreamer (Mueller, 1990) is a computer model of human daydreaming implemented using the GATE knowledge representation and reasoning package (Mueller, 1987). The knowledge base of Daydreamer consists of 252 types, 194 rules, 96 English generation templates, 83 initial facts, 44 English input phrases, and 18 episodes for daydreaming in the domain of interpersonal relations. In this paper I explain how you can add your own knowledge structures to Daydreamer.

Adding types

You can add a new type to Daydreamer by placing a definition such as the following in the dd_rep.cl source code file:

(ty$create 'ART-CRITIC '(PERSON) '(prop (first-name last-name) ()))
The general form of a Daydreamer type definition is:
(ty$create 'name '(parent1 parent2 ...) format)
where format is:
'([PROP | NIL] (slotname1 slotname2 ...) (optional-slotname1 optional-slotname2 ...))
PROP specifies that an instance of the type should be formatted as a proposition such as:
(INTENDS linked-from (SUCCEEDED-GOAL obj (BELIEVE actor AUDIENCE-MEMBER
                                                  obj (ACTIVE-GOAL obj (LOVERS actor AUDIENCE-MEMBER COMEDIAN1))))
         linked-to (SUCCEEDED-GOAL obj (BELIEVE actor AUDIENCE-MEMBER
                                                obj (POS-ATTITUDE obj COMEDIAN1)))
         seq? 'T)
while NIL specifies that an instance of the type should be formatted as a token such as:
COMEDIAN1

Adding rules

You can add a rule to Daydreamer by placing a definition such as the following in the dd_rep.cl source code file:

(define-rule Lovers-Plan (all)
  (RULE subgoal (RSEQ (ACQUAINTED ?Self ?Other)
                      (ROMANTIC-INTEREST ?Other)
                      (BELIEVE ?Other (ACTIVE-GOAL (LOVERS ?Self ?Other)))
                      (M-DATE ?Self ?Other)
                      (M-AGREE actor ?Self actor ?Other
			       obj (LOVERS ?Self ?Other)))
        goal (LOVERS ?Self ?Other)
        is 'plan-only
        plausibility 0.95))

The general form of a Daydreamer rule definition is:

(define-rule name (subset1 subset2 ...)
  (RULE subgoal subgoal-pattern
        goal goal-pattern
        plan-no-gen plan-no-gen
        delete delete-pattern1 delete-pattern2 ...
        emotion emotion1 emotion2 ...
        is 'INFERENCE-ONLY | 'PLAN-ONLY | 'ACTION-PLAN | 'GLOBAL-INFERENCE
        plausibility number))
The delete, emotion, is, and plausibility slots are optional. plan-no-gen is advice to the English generator.

By default, a rule may be employed both as a planning rule and as an inference rule. However, if the is slot of the rule is 'Inference-only, the rule may be employed only as an inference. If the is slot of the rule is 'Plan-only, the rule may be employed only as a plan.

Planning rules

When a rule functions as a planning rule, the goal slot specifies the antecedent and the subgoal slot specifies the consequent. That is, if the objective of an active goal unifies with goal-pattern, the active goal may be split into the subgoals whose objectives are specified by subgoal-pattern, instantiated with the bindings resulting from the unification with goal-pattern.

Specifically, if subgoal-pattern is of the form:

(RSEQ obj subgoal-pattern1 subgoal-pattern2 ...)
then subgoal-pattern1, subgoal-pattern2, and so on, suitably instantiated, are the subgoals.

Otherwise, subgoal-pattern, suitably instantiated, is the subgoal.

Inference rules

When a rule functions as an inference rule, the subgoal slot specifies the antecedent and the goal slot specifies the consequent. That is, whenever subgoal-pattern is shown to be true in a given context for some collection of bindings, the instantiated goal-pattern is asserted in that context and the instantiated delete-pattern1, delete-pattern2, and so on, if any, are retracted from the context.

If subgoal-pattern is of the form:

(RAND obj subgoal-pattern1 subgoal-pattern2 ...)
or
(RSEQ obj subgoal-pattern1 subgoal-pattern2 ...)
then all of subgoal-pattern1, subgoal-pattern2, and so on, must be shown to be true in the given context.

If subgoal-pattern is of the form:

(ROR obj subgoal-pattern1 subgoal-pattern2 ...)
then one of subgoal-pattern1, subgoal-pattern2, and so on, must be shown to be true in the given context.

Finally, if subgoal-pattern is of the form:

(RNOT obj subgoal-pattern1)
then subgoal-pattern1 must not be shown to be true in the given context.

RAND, ROR, and RNOT are to be distinguished from their counterparts UAND, UOR, and UNOT in GATE. A RAND, for example, is shown to be true if each of its elements matches some, possibly different, fact in the context; a UAND in the same position would require each of its elements to match the same fact in the context.

Here is a sample inference rule employed in Daydreamer:

(define-rule Neg-attitude-inf (all)
  (RULE subgoal (RAND obj (RICH actor ?Other)
                          (AT actor ?Other
                              obj ?Location)
                          (AT actor ?Self
                              obj ?Location)
                          (MTRANS actor ?Self
                                  from ?Self
                                  to ?Other
                                  obj ?Anything:NOTYPE)
                          (RNOT obj (WELL-DRESSED actor ?Self)))
       goal (BELIEVE actor ?Other
                    obj (NEG-ATTITUDE obj ?Self))
       is 'INFERENCE-ONLY
       plausibility 0.9))

Rules for actions

Inference rules are commonly used to specify the effects of actions. For example, Daydreamer employs the following inference rule for PTRANS:
(define-rule At-plan (all)
  (RULE subgoal (PTRANS actor ?Person
                        from ?Location1
                        to ?Location2
                        obj ?Person)
        goal (AT actor ?Person
                 obj ?Location2)
        delete (AT actor ?Person
                   obj ?Location1)
        initial (AT actor ?Person
                    obj ?Location1)
        plausibility 1.0))
This rule specifies that when a person performs a PTRANS, it is necessary to retract the old location (AT) of the person and assert the new one.

The above rule may also function in reverse as a planning rule: When an AT goal is present, a PTRANS subgoal may be asserted. Such action subgoals are treated similarly to other subgoals-the preconditions of the action become further subgoals to be achieved.

For example, Daydreamer employs the following rule for PTRANS:

(define-rule Ptrans-plan (all)
  (RULE subgoal (KNOW actor ?Person
                      obj ?Location2)
        goal (PTRANS actor ?Person
                     from ?Location1
                     to ?Location2
                     obj ?Free-obj)
        is 'ACTION-PLAN
        plausibility 1.0))
Once the KNOW subgoal succeeds-that is, once the person knows the location being PTRANSed to-the action is performed (asserted as an action into the appropriate context). Since it is an undesirable behavior for an action to be performed whenever its preconditions happen to be satisfied, rules whose goal is an action are not run as forward inferences.

Some rule must correspond to each possible action goal. If there are no preconditions for a given action goal, the corresponding subgoal should be:

(RTRUE)
Only one rule should apply to each action goal and each rule should contain all the necessary preconditions for any action goal to which that rule applies.

Rules for concern initiation

A new concern is initiated by an inference rule of the following form:
(define-rule name (subset1 subset2 ...)
  (RULE subgoal activation-condition
        goal (ACTIVE-GOAL obj goal-objective)
        emotion (POS-EMOTION strength emotion-strength)
                ...
        is 'INFERENCE-ONLY))
When activation-condition is shown in the context, a new concern is initiated whose top-level goal is specified by the goal slot. The emotion slot specifies motivating emotions to be instantiated and associated with the new concern.

Here is a sample rule employed in Daydreamer for initiating an EMPLOYMENT personal goal concern:

(define-rule Employment-theme (all)
  (RULE subgoal (RNOT obj (EMPLOYMENT actor ?Self))
        goal (ACTIVE-GOAL obj (EMPLOYMENT actor ?Self ?Other
                                          organization ?Organization))
        emotion (POS-EMOTION strength 0.85)
        is 'INFERENCE-ONLY
        plausibility 1.0))
Here is a sample rule employed in Daydreamer for initiating a RATIONALIZATION daydreaming goal concern:
(define-rule Rationalization-theme (all)
  (RULE subgoal (DEPENDENCY linked-from ?Failed-goal
                            linked-to (UAND obj ?Neg-emotion
                                                (UPROC proc tt'>THRESH?)))
        goal (ACTIVE-GOAL obj (RATIONALIZATION obj ?Failed-goal))
        emotion ?Neg-emotion
                (NEG-EMOTION strength 0.05)
        is 'INFERENCE-ONLY
        plausibility 1.0))

Adding generation templates

You can add new generation templates to Daydreamer by placing definitions such as the following in the dd_gen.cl source code file:

(define-gen RICH nil
  (gen-regular con stream switches context bp 'be " rich"))

(define-gen M-LOGIN nil
  (gen-regular-plus con stream switches context bp 'log " into"
		    (ob$get con 'obj)))
The generation functions are:
(gen concept stream switches context belief-path)
(gen-regular concept stream switches context belief-path verb str)
(gen-regular-plus concept stream switches context belief-path verb str plus)

Adding initial facts

You can add new initial facts to Daydreamer by placing definitions such as the following in the dd_rep.cl source code file:

; An alumni book from my college is in my mailbox.
(define-initial-fact (all always)
  (AT (MAIL contents (ALUMNI-DIR obj UCLA obname Alumni-Dir1) obname Mail1)
      (LOCATION name "outside" obname Outside)))

The general form of a Daydreamer initial fact definition is:

(define-initial-fact (subset1 subset2 ...) fact)

Adding input phrases

You can add new input phrases to Daydreamer by placing definitions such as the following in the dd_rep.cl source code file:

(define-phrase "robert redford is at ucla shooting a film."
  (AT Movie-Star2 (LOCATION name "UCLA" obname UCLA-Location)))

(define-phrase "Sylvester calls you on the phone and asks you out."
  (M-PHONE Sylvester Me)
  (MTRANS Sylvester Sylvester Me
          (BELIEVE Sylvester (ACTIVE-GOAL (LOVERS Sylvester Me)))))

Adding episodes

You can add an episode to Daydreamer by placing a definition such as the following in the dd_rep.cl source code file:

(define-episode (all) nil nil nil
  ((KNOW Me (TELNO (MALE-PERSON first-name "Rich" obname Rich1)))
   Know-Plan2 take-from-rule
   ((MTRANS (MALE-PERSON first-name "Alex" obname Alex)
            (INFO-OBJ name "the TRW credit database"
                      obname Trw-Credit-File)
            Me (TELNO Rich1))
    induce-rule (t nil)
    ((KNOW Trw-Credit-File (TELNO Rich1)))
    ((ACCESS Alex Trw-Credit-File)
     induce-rule nil
     ((M-LOGIN Alex Trw-Credit-File))))))
The general form of a Daydreamer episode definition is:
(define-episode (subset1 subset2 ...) indices plan-thresh reminding-thresh
  subgoal)
where subgoal is:
(subgoal rulename plan-no-gen subgoal subgoal ...)

References

Mueller, Erik T. (1987). GATE user's manual (2nd edition, Technical Report UCLA-AI-87-6). Artificial Intelligence Laboratory, Computer Science Department, University of California, Los Angeles. [revised text]

Mueller, Erik T. (1990). Daydreaming in humans and machines. Norwood, NJ: Ablex. [abstract]


Daydreamer home
Copyright © 1999 Erik T. Mueller (erik@signiform.com, www.signiform.com/erik). All Rights Reserved.