Summary: We generalize from having a mass of propositional variables to representing the same information with relations. This prompts a few changes in notation and rules of inference.
We have been using propositions to represent our problem. This is not entirely natural; for instance the only way the rules recognize that locations a and b are near each other is because there are several axioms involving A-has-2 and B-unsafe, in just the right way to result in our idea of the concept "neigbhor". In fact, we had no way of mentioning about the location a directly; we only had propositions which dealt with its properties (whether or not it neighbored exactly two pirates, etc.).
If writing a program about WaterWorld, our program should of course reflect our conception of the problem, and as it stands, our conception corresponds to having many many boolean variables named A-has-2, B-unsafe, etc. Even worse, the rules would be encodings of the hundreds of axioms. A long enouration of the axioms is probably not how you think of the rules -- when explaining the game to your friend, you probably say "if a location contains a 2, then two of its neighbors are pirates". (Rather than droning on for half an hour about how "if location a contains a two, then either location bis unsafe or ...".) And the current rules only pertained to a fixed-size board; inventing a new game played on a 50x50 grid would require a whole new set of rules! -- clearly not how we humans conceptualize the game!
Relations are the way we'll improve this situation
Note that encoding this information lets us play on different size boards: we can have one rule, saying that if location a has zero, then any neighboring location is safe. Thus the exact details of the neighbor relation might change from game to game as we play on different boards (just as which locations are contain pirates changes from game to game).
...Which brings us to the next question: how to express the notion "location a is safe"?
Again, we'll use a relation, but this time one which only takes one input: safe(a) is true if and only if ("iff") location a is safe.
For a particular game of WaterWorld we are given a set of locations and we are given a binary relation to be used as neighbor.
[flesh out:] We like relations better because it helps separate the rules from the data (from the particular board).
How shall we encode concepts such as "location a has 3 dangerous neighbors", using relations?
A good first guess might be to say we have a function which returns the number of pirates next to a given location. That is, "piratesNear(a) = 3". However, "piratesNear" doesn't qualify as a relation -- why not?
To work around this, we could propose a binary relation along the lines of "piratesNear(a, 3) = true". This is better, but it requires our domain to be not only board locations, but also numbers (and, our axioms might suddenly need to include many axioms just about numbers, and other relations such as ">"
Okay, the third time's the charm: we can implement concepts like "a neighbors three pirates" as shows3(a) being true. We'll have a seperate relation shows2; presumably shows2(a) is false on any board where shows3(a) is true.
For the domain of types-of-vegetables, the relation yummy is a useful one to know, when cooking. In case you weren't sure, yummy(brussel sprouts) = false, and yummy(carrots) = true.
Supose we had a second relation, yucky. Is it conceivable that we could model a vegetable that's neither yucky nor yummy, using these relations? Sure! (Iceburg Lettuce is an example, even.) In fact, we could even have a vegetable which is both yummy and yucky -- radishes, perhaps!)
Unary relations correspond to subsets of the domain -- e.g., the set of yummy vegetables. Or, for instance, knowing the relation hasPirate is the same as knowing the set P = {locations containing pirates}. We might say the relation hasPirate is an "indicator function" for the set P -- given any location "loc", you can find out whether it's in P by knowing whether or not hasPirate(loc). (And vice versa, of course -- if you know exactly what's in the set P, you can predict what hasPirate will answer for any input.) Same concept, different representations.
A relation with a whole website devoted to it is "has starred in a movie with". We'll call this relation hasStarredWith; the relevant domain is people. Some sample points in this relation:
A binary relation is equivalent to a set of pairs --
You might have objected to the idea of the unary relation yummy, since different people have different tastes. How could you model this, with a binary relation?
We can use the binary relation thinksIsYummy: In particular, thinksIsYummy(ian, brusselSprouts) = false, but thinksIsYummy(phokion, brusselSprouts ) = true,
Ternary relations
Note that propositions can be modeled by 0-ary relations.
connectives follow the same rules as in propositional logic
Proofs otherwise unchanged. Note that we might express our rules as "for any locations x and y, we have the following axiom: shows3(x), neighbor(x y) → ¬ safe(y)" Really, note that there's something else going on here: x and y are symbols which can represent any location: they are variables, whose value can be any element of the domain.
..
..
..
..