event module  {
  program  {
 % Green and red light percepts - on.
forall bel  (percept (green (X)), not (green (X))) do insert  (green (X)).
forall bel  (percept (red (X)), not (red (X))) do insert  (red (X)).
 % Green and red light percepts - off.
forall bel  (green (X), percept (not (green (X)))) do delete  (green (X)).
forall bel  (red (X), percept (not (red (X)))) do delete  (red (X)).
  }
}
Algorithm 5