Ways To Express Relations

There are many ways to express relations in programming, where a relation is defined herein as a (mathematical) function of 1 or more arguments (zero if you count the trivial relations "true" and "false") which returns a boolean as a result. (Some systems may allow states besides "true" and "false"--"unknown" and "contradiction" are often found; see ThreeValuedLogic). The restriction on returning booleans isn't really that much of a restriction (though it's a pain when you implement relational system); a k-ary function returning an arbitrary value can be ReFactored easily into a (k+1)-ary relation which does return a boolean.

There are many techniques that ComputerScience has come up with to express relations; each with their advantages and disadvantages:

The first technique has the advantage of always terminating (assuming the data structure used is finite), and is an excellent way of representing arbitrary facts (which is one reason that RelationalDatabases are in such wide use). Plus you get (potentially) all the other advantages of an RDBMS.

The second technique is what programmers are used to (though most programmers aren't used to expressing arbitrary functions as relations). Arbitrary functions might not halt, of course, though many programmers are skilled in the art of avoiding this situation.

The third technique is (coupled with the first) the hallmark of ConstraintProgramming and LogicProgramming systems. In general, TheoremProvingSystems may not halt, but there are important subsets (such as those based on Horn clauses) for which theorem-proving is decidable. (PrologLanguage is based on this).

I'm aware of numerous programming systems which provide two of the three (well); I'm not aware of many that provide all three.


See also DatabaseIsRepresenterOfFacts


EditText of this page (last edited January 2, 2005) or FindPage with title or text search