View source with raw comments or as raw
    1% Basic Event Calculus
    2
    3%% Include the BASIC EVENT CALCULUS THEORY
    4#include 'bec_theory.incl'.
    8% If a light is turned on, it will be on:
    9initiates(turn_on, light_on, T).
   10
   11% If a light is turned on, whether it is red or green will be released
   12% from the commonsense law of inertia:
   13releases(turn_on, light_red, T).
   14releases(turn_on, light_green, T).
   15
   16% If a light is turned off, it will not be on.
   17terminates(turn_off, light_on, T).
   18
   19% After a light is turned on, it will emit red for up to two seconds
   20% and green after at least two seconds:
   21trajectory(light_on, T1, light_red, T2) :- T1 #< T2, T2 #< T1 + 1.
   22trajectory(light_on, T1, light_green, T2) :- T2 #>= T1 + 1.
   23
   24initiallyN(light_on).
   27happens(turn_on, 2).
   28happens(turn_off, 4).
   29happens(turn_on, 6).
   30
   31?- holdsAt(light_red, T).