# Business Rules and Logic ~ What Exactly Is a Business Rule?

**Summary:**

*Business Rules and Logic ~ What Exactly Is a Business Rule?*

I recently received a communication from an old friend (I'll call him George), "soliciting opinions" on a matter to do with logic and business rules. After I'd responded, I realized that the whole exchange could possibly be of interest to a wider audience, and so I worked it up into the present technical note.

First, here's the whole of George's communication (all formatting etc. exactly as in his original):

I'd like your opinion on a fundamental question about "rule."

Example just for illustration ...

It must be that:eachcustomer placessomeorder.Predicate? Proposition? Hybrid? Other?

I stick with my opinion so far that the closest thing in formal logic is logical implication, which can be taken to be a predicate.

But the quantification does make it interesting. Just a diversion? Could you equally say:

customer.mustplace orderThat sounds more like a predicate, but it may be just semantics (Of course).

Any insight would be appreciated.

George also added the handwritten note "Soliciting opinions!" at the bottom of the page. What follows is an edited version of my response to his solicitation.

Dear George:

Thanks for your communication "soliciting opinions" ... The following
isn't just an opinion, however -- it's meant to be **definitive** (joke) -- at
least as far as it goes. Hope you find it helpful.

I'll start with your natural-language rule:

It must be that:eachcustomer placessomeorder.

You ask whether this rule is, formally, a predicate, a proposition, a hybrid of
both, or something else entirely. (*Note:* "Formally" here is
my addition, but I assume it's what you meant.) My short answer is: It's
a proposition. My longer answer follows ...

There are at least two ways to represent the given rule using the notation of formal logic:

`1.`

`FORALL`

c( EXISTSo(places(c, o) ) )2. `FORALL`

x( IFcust(x)`THEN EXISTS`

y(order(y) AND

places(x, y) ) )

Both of these expressions are indeed propositions, a point I'll come back to later.
I'll refer to them as *Proposition 1* and *Proposition 2,* respectively.
And what we might call the *preamble* to the original natural-language formulation
--

-- simply
means the proposition in question (whichever one we choose) is required to evaluate
to **It must be that** `TRUE`

.

Now let's take a closer look at *Proposition 1:*

`FORALL`

c( EXISTSo(places(c, o) ) )

Here I'm using what's sometimes called "sorted logic,"
in which the "logic variables"^{[1]}
(

and *c*

in the example) are considered to be "sorted," or what we in the IT community
would more usually call *o**typed*. In other words, we can imagine we've
been given definitions of the form (the syntax here is based on QUEL):

`RANGE OF`

cIS CUSTOMER /* i.e.,cis of type CUSTOMER */

`RANGE OF`

oIS ORDER /* i.e.,ois of type ORDER */

*Proposition 1* thus simply states:

`For all customers`

c,there exists at least one orderosuch thatcplaceso.

The expression

) is an invocation of a predicate -- a truth-valued function, if you
prefer -- called *places*(*c,o*

;
it returns TRUE if *places*`"`

is true and *c* places *o*"
`FALSE `

otherwise.^{[2]} *Note:* *Proposition
1* is indeed a proposition rather than a more general predicate, even though it
includes the expression

as a subexpression; the effect of the quantifiers *places*(*c,o*)
```
FORALL
```

and *c* `EXISTS `

is
to *o* **bind** the variables

and
*c*

, thereby converting that
subexpression (and hence the overall expression as well) into a proposition.
I'll elaborate on this issue of the formal difference between predicates and propositions
later.*o*

Now let's turn to *Proposition 2:*

`FORALL`

x( IFcust(x)`THEN EXISTS`

y(order(y) AND

places(x, y) ) )

Here I'm using a more conventional "unsorted" logic (unsorted logic
is the kind that logicians more typically assume, but it's slightly more cumbersome
for our purposes, as will soon be obvious). In other words, instead of assuming
we have some arbitrary number of distinct "sorts" (equivalently, types
or domains), we assume there's just one "sort," called *the universe
of discourse,* that contains everything we might ever be interested in (customers,
orders, elephants, bicycles, etc. -- you name it). So we need to introduce
two new predicates --

,
which returns *cust*(*x*)`TRUE `

if and only
if

is a customer, and
*x*

, which
returns *order*(*y*)`TRUE `

if and only if

is an order. Thus, *y* *Proposition
2* states:

`For all objects`

x,ifxis a customer, then there exists at least one objectysuch thatyis an order andxplacesy.

In your communication, you say: "I stick with
my opinion so far that the closest thing [to a formal expression of your original
rule] in formal logic is [a] logical implication, which can be taken to be a predicate."
As you can see, *Proposition 2* does **include** a logical implication (IF
... THEN ...),^{[3]} but it **is
not** a logical implication; the initial quantifier is crucial. I don't have
a problem with your thinking in terms of logical implication, but to think that way
does mean you're thinking -- at least partly, albeit implicitly -- in terms of unsorted
logic, and I respectfully suggest that sorted logic would be a better basis.

As for logical implication being "taken to be a predicate": There's
some confusion here. Some implications are propositions; e.g., "IF 5 <
2 THEN Al Gore is the US president." (By the way, this proposition is
true -- not for political reasons, but because 5 < 2 is false.) Some implications
are more general predicates; e.g., "IF

is a US citizen then *z*

is allowed to vote in the US." (Note that we can't assign
a truth value to this latter implication without first assigning a value to *z*

.) Thus, you might indeed
say, as you more or less did say, that an implication is a predicate, but that statement
doesn't mean what I think you think it means. To get technical on you for a
moment:*z*

- All implications are predicates; some implications are propositions.
- All propositions are predicates; some predicates aren't propositions (see below).
To be precise, a predicate is a proposition if and only if it involves
**no free variable references**. - A variable reference is
**free**if and only if it's not**bound**(by some quantifier).

Formal definitions follow immediately.

*Formal explanation of predicates and propositions (assuming "sorted logic"):*

- A
**predicate,**

say, is a truth-valued read-only operator (also known as a truth-valued read-only function).*P* - By definition, predicate

is formulated in terms of some specified set of*P***parameters**.*Note:*As indicated earlier, parameters are usually called*variables*in logic. However, I'm concerned here (as logicians typically aren't) with the computing context specifically, and I want to avoid confusion with variables as understood in that context. - All parameters are typed. When

is invoked (or*P**instantiated*),**arguments**are substituted for the parameters; if parameter

is declared to be of type*p*

, then, in every instantiation of*T*

, the argument substituted for*P*

must also be of type*p*

.*T* - Substituting arguments for the parameters effectively converts the predicate
into a
**proposition**. We say the arguments**satisfy**the predicate if and only if that proposition is true. - A proposition can be regarded as a degenerate predicate (it's a predicate for which the corresponding set of parameters is empty).

To say it again, therefore, all propositions are predicates (though most predicates aren't propositions). So the answer to your original question is: The rule is a proposition, and therefore it's a predicate too. Note too, incidentally, that the concept of a "hybrid" proposition/predicate makes no sense.

You say: "The quantification does make it interesting,"
and ask whether it's "just a diversion." I hope it's obvious from
all of the foregoing that it's not just a diversion! The point is, formal logic
**forces** us to make the quantifiers explicit, even when they're merely implicit
in the natural-language formulation. There are many, many ways of stating the
original rule in natural language.^{[4]}
Typically, some -- probably most -- of those ways will be ambiguous (in this connection,
see the appendix to this response!). Your approach to addressing the problem
of ambiguity is, I believe, to insist that certain words (e.g., shall, must) always
be used in certain limited ways and always have certain fixed, prescribed semantics.
It seems to me, however, that such an approach will always be liable to error; you
simply *can't* just edict that such commonly used words have such prescribed
meanings and hope that the universe of pertinent people will never use them in any
other way. I might point to the case of "table" in the relational
world; I do believe SQL is the mess it is, in part (but only in part!), because we
refused in the early days to face up to a slightly unpalatable fact: the fact,
that is, that it would have been *much* better to use the precise but unfamiliar
term *relation* instead of the fuzzy term *table*. As it was, we
made the wrong decision ... and the rest, as they say, is history.

Here's how logic helps. Your rule designer might say, for example, "A
customer must place an order" -- thinking, perfectly reasonably, that this assertion
**defines** a customer (in order to be a customer in the first place, you must
place an order). The assertion *sounds* precise! But the person
trained in logic says "Aha! -- there are several different logical expressions
that could correspond to this assertion" (equivalently, "There are several
different interpretations of this assertion, all of them *prima facie* valid,
and I have no idea which one is intended"). For example:

` FORALL ` |
|||||

` /* ` |
|||||

` EXISTS ` |
|||||

```
/* there must be at least one customer who
places an order */
``` |
|||||

` EXISTS ` |
|||||

```
/* there's at least one order that every customer
places */
``` |
|||||

` FORALL ` |
|||||

` /* each customer places exactly one order */` |
|||||

` UNIQUE ` |
|||||

```
/* there's exactly one order that every customer
places */
``` |

Note my use of the quantifier `UNIQUE `

to
mean "there exists exactly one," incidentally. I've also dropped
unnecessary parentheses here and there.

The logician, then, has to ask the rule designer which of the foregoing interpretations
-- if any (the list isn't exhaustive) -- is the one intended. And the rule
designer then has to come up with a better formulation (in whatever language is being
used, be it natural language or some other vehicle). And then we iterate, and
iterate, and iterate ... until eventually we reach a formulation that states **precisely**
what's intended, nor more and no less. How much better it would be for the
rule designer to be trained in logic and to express the rule in logic in the first
place!

Yes, I know the counterarguments, but I don't agree with them.

/* Signed */ Chris Date

### Appendix:

*/ ?>To bolster my claim that natural-language formulations of business rules are often
ambiguous, I quote here a piece by Robert Graves and Alan Hodge. The piece
is included and analyzed in detail in an article by Ernest Nagel entitled "Symbolic
Notation, Haddocks' Eyes, and the Dog-Walking Ordinance," in James Newman (ed.),
*The World of Mathematics, Vol. 3,* Simon and Schuster, 1956 (republished by
Dover Publications Inc., 2000). Thanks to Lauri Pietarinen of AtBusiness Communications
Oy, Helsinki, Finland, for drawing this splendid example to my attention.

From the Minutes of a Borough Council Meeting:

Councillor Trafford took exception to the proposed notice at the entrance of South Park: "No dogs must be brought to this Park except on a lead." He pointed out that this order would not prevent an owner from releasing his pets, or pet, from a lead when once safely inside the Park.

The Chairman (Colonel Vine):What alternative wording would you propose, Councillor?

Councillor Trafford:"Dogs are not allowed in this Park without leads."

Councillor Hogg:Mr. Chairman, I object. The order should be addressed to the owners, not to the dogs.

Councillor Trafford:That is a nice point. Very well then: "Owners of dogs are not allowed in this Park unless they keep them on leads."

Councillor Hogg:Mr. Chairman, I object. Strictly speaking, this would keep me as a dog-owner from leaving my dog in the back-garden at home and walking with Mrs. Hogg across the Park.

Councillor Trafford:Mr. Chairman, I suggest that our legalistic friend be asked to redraft the notice himself.

Councillor Hogg:Mr. Chairman, since Councillor Trafford finds it so difficult to improve on my original wording, I accept. "Nobody without his dog on a lead is allowed in this Park."

Councillor Trafford:Mr. Chairman, I object. Strictly speaking, this notice would prevent me, as a citizen, who owns no dog, from walking in the Park without first acquiring one.

Councillor Hogg(with some warmth): Very simply, then: "Dogs must be led in this Park."

Councillor Trafford:Mr. Chairman, I object: This reads as if it were a general injunction to the Borough to lead their dogs into the Park.Councillor Hogg interposed a remark for which he was called to order; upon his withdrawing it, it was directed to be expunged from the Minutes.

The Chairman:Councillor Trafford, Councillor Hogg has had three tries; you have had only two ...

Councillor Trafford:"All dogs must be kept on leads in this Park."

The Chairman:I see Councillor Hogg rising quite rightly to raise another objection. May I anticipate him with another amendment: "All dogs in this Park must be kept on the lead."This draft was put to the vote and carried unanimously, with two abstentions.

#### References

[1] Actually I prefer the term *parameters,* for
reasons I'll explain later.

[2] Of course, there's no suggestion that "the system
understands" that predicate; it's just something we introduce, a kind of *deus
ex machina* if you like, that we *define,* by fiat, to have the indicated
meaning. Though -- at the risk of confusing you -- if there's a relation in
the database corresponding to that predicate, and if the tuple `<`

appears in that relation, the system does at least know that *c,o*>

is *places*(*c,o*) `TRUE`

, even though it doesn't know what the predicate

"means." *places*

[3] For the record, the logical implication `IF `

is defined to be equivalent
to *p* THEN *q* `(NOT `

.
It thus evaluates to *p*) OR *q*`FALSE `

if
and only if

is true and
*p*

is false. *q*

[4] Yes, you could "equally say" (as you suggest)

.
Though I don't know why you think this formulation "sounds more like a predicate."
Nor do I know what you mean by "it may just be semantics." **customer must place order**

*What*may be just semantics?

Copyright (c) 2003 C.J.Date

# # #

### About our Contributor:

**Spotlight**

**BRSolutions Professional Training Suite**

**All About Concepts, Policies, Rules, Decisions & Requirements**

We want to share some insights with you that will positively rock your world. They will absolutely change the way you think and go about your work. We would like to give you high-leverage opportunities to add value to your initiatives, and give you innovative new techniques for developing great business solutions.