The following integrity constraint specifies that no Manager should earn less than 50000:
Manager with
constraint
earnEnough: $ forall m/Manager x/Integer
(m salary x) ==> (x >= 50000) $
end
Please note that our example model doesn't satisfy this
constraint, because Eleonore earns only 20000. If you
use 20000 instead of 50000, the model satisfies this constraint
and adding it will be successfull.
Exercise 3.8:
Define an integrity constraint stating that no employee
is allowed to earn more money than any of her/his bosses. (The constraint
should work on each individual salary, not on the sum).
In the subdirectory RULES+CONSTRAINTS of the example directory there is a more extensive example concerning deductive rules and integrity constraints. It should be used in addition to this section of the tutorial.