!7
abstract sclass Prop implements IStatement, IFieldsToList {}
static withToList record $HappensBefore$(A event1, B event2) extends Prop {}
static withToList record $HappensAtDay$(A event, B y) extends Prop {}
static withToList record $LessThan$(A x, A y) extends Prop {}
static withToList record $BiggerThanOrEqualTo$(A x, A y) extends Prop {}
// full define $LessThan(int x, int y) = x < y;
static Bool checkProposition(Prop p) {
if p is $LessThan$(int x, int y) { ret x < y; }
if p is $BiggerThanOrEqualTo$(int x, int y) {
ret not(checkProposition($LessThan$(x, y)));
}
null;
}
p-exp {
assertEqualsVerbose(true, checkProposition($LessThan$(1, 5)));
assertEqualsVerbose(false, checkProposition($LessThan$(5, 1)));
assertEqualsVerbose(null, checkProposition($LessThan$("what", "ever")));
assertEqualsVerbose(false, checkProposition($BiggerThanOrEqualTo$(1, 5)));
assertEqualsVerbose(true, checkProposition($BiggerThanOrEqualTo$(5, 1)));
assertEqualsVerbose(null, checkProposition($BiggerThanOrEqualTo$("what", "ever")));
}