Re: Love or hate, or? domains with cardinality two

From: Nicola <nvitacolonna_at_gmail.com>
Date: Wed, 11 Nov 2015 19:36:33 +0100
Message-ID: <n201rh$1doj$1_at_adenine.netfront.net>


On 2015-11-10 18:21:54 +0000, Gene Wirchenko said:
>

>>> And what obvious difficulties?
>> 
>> If you think there aren't any, show me a straightforward solution (of
>> course, what is difficult and what is not is largely subjective!).

>
> I have not claimed that there were none.
>
> You are the one who made the claim that they were obvious. Prove
> your claim.

On the Employee(id, dept, mgr : boolean) schema, the constraint by which at any time each department has one and only one manager may be formalized as follows:

  forall x (Department(x) -> (exists y (Employee(x, y, true)   and
  forall w,z (Employee(x, w, z) and w <> y -> z = false))))

This is not the most straightforward constraint (especially if you have to implement it in SQL), and other solutions may result in constraints that are simpler to enforce in practice (e.g., using a different schema a property equivalent to the second conjunct may be enforced through a primary key constraint).

Of course, if you reject the constraint as invalid to begin with, this whole point is void.

Nicola

Received on Wed Nov 11 2015 - 19:36:33 CET

Original text of this message