Subsection 8.13.2 When We Get to Declare What’s True
When our goal is to describe the natural world, it’s hard to write logical statements that are true without exception.
However, if our goal is to prescribe the world (i.e., declare how it must be), then the logical tools that we’ve been describing may work in the same straightforward way in which they work for mathematics. This is why, throughout this course, we’ve often used examples of database integrity constraints. There we state rules that we insist must be true of data entered into our system.
Sometimes we write rules that just prevent data entry errors.
Suppose that we have a database that contains records for all the contracts that our company has ever had. Our company was founded in 1875. Each record has at least these two fields: startyear and endyear. We might have these rules (where the domain of r is the collection of records in the database):
r (startyear(r) 1875) r (endyear(r) 1875)We can assert that these claims are true without exception. If someone tries to enter a record that violates these claims, they’ll get an error message and have to fix what we assume was a data entry error.
We can also write rules that correspond to our business practices. These rules tell our employees what they must do in order to maintain the truth of the rules. We’ve already seen several examples of rules like this.
Here are some examples:
x (Employee(x) y (EmergencyContact(y, x)))
x (Employee(x) y (CurrentProjectOf(y, x)))
x (y (z (t (((Employee(x) CurrentProjectOf(y, x) CurrentProjectOf(z, x) CurrentProjectOf(t, x) ((y = z) (y = t) (z = t))))))
x, y ((Super(x) Timecard(y)) CanSign(x, y))
And of course, rule-writing isn’t limited to businesses.
Recall our rule that said that everyone may board the bus once everyone has arrived:
(x (HasArrived(x))) y (MayBoardBus(y))