!7

abstract sclass Prop implements IStatement, IFieldsToList {}

static withToList record $HappensBefore$<A, B>(A event1, B event2) extends Prop {}
static withToList record $HappensAtDay$<A, B>(A event, B y) extends Prop {}
static withToList record $LessThan$<A, B>(A x, A y) extends Prop {}

// we can fully define a statement on primitive values
// full define $LessThan(int x, int y) = x < y;

// we can output a variable
// full define $LessThan(int x, var y) = y := any int bigger than x;

/*
  Event 1 happens before event 2 :=
    vars {event 1, event 2, X, Y}
    Event 1 happens at day X.
    Event 2 happens at day Y.
    X < Y.
*/

static Bool checkProposition(Prop p) {
  if p is $LessThan$(int x, int y) ret x < y;
  null;
}

p-exp {
  assertEqualsVerbose(true, checkProposition($LessThan$(1, 5)));
  assertEqualsVerbose(false, checkProposition($LessThan$(5, 1)));
  assertEqualsVerbose(null, checkProposition($LessThan$("what", "ever")));
}