# Re: <OR> predicate?

Date: Mon, 27 Sep 2010 19:25:19 GMT

Message-ID: <zc6oo.1251$89.394_at_edtnps83>

On 27/09/2010 11:33 AM, Tegiri Nenashi wrote:

> On Sep 27, 11:22 am, Vadim Tropashko<vadim..._at_gmail.com> wrote:

>> On Sep 27, 10:57 am, paul c<toledobythe..._at_oohay.ac> wrote:

*>>*

*>>*

*>>*

*>>> On 26/09/2010 4:11 PM, paul c wrote:*

*>>> ...*

*>>*

*>>>> ps:There might be occasional usefulness in making what one might call*

*>>>> 'domain assertions', eg., in D&D Algebra, "there is a position called*

*>>>> 'toilet scrubber'" could be assessed from R{position}<OR> (<NOT>*

*>>>> R{position})...*

*>>*

*>>> That makes me think of a question that may not have any practical point*

*>>> except for understanding the 'A-algebra' (because it involves*

*>>> non-union-compatible relations).*

*>>*

*>>> Suppose the predicate of R{Position} is "position Position is occupied".*

*>>*

*>>> I would think one possible predicate of R<OR> (<NOT> R) would be*

*>>> something like "position Position is occupied OR unoccupied".*

*>>*

*>>> Seems that an even simpler expression, R<OR> TABLE_DEE, gives the same*

*>>> extension. Is the predicate the same? Or is there a good reason to*

*>>> think instead of the predicate as something like "position Position Exists"?*

*>>*

*>>> (I'm asking this question even though I personally have some difficulty*

*>>> reconciling parts of the A-algebra formal definitions, eg., on one hand,*

*>>> the heading of R<OR> TABLE_DEE must include the heading of TABLE_DEE*

*>>> which is the empty set (in other words, the empty set is a*

*>>> member/element of the heading and I presume being a member is not the*

*>>> same as being a subset). On the other hand, the definition of an*

*>>> A-algebra heading says that it is a set of ordered pairs. But the empty*

*>>> set is certainly not an ordered pair. I assume I must be making some*

*>>> mistake, otherwise R<OR> TABLE_DEE is not a valid expression. By*

*>>> 'valid' I mean theoretically possible. Maybe somebody can point out how*

*>>> I'm making this mistake.)*

*>>*

*>> This assertion (and any other) can be checked in QBQL; here is how:*

*>>*

*>> 1. Translate Tutorial D terms into QBQL:*

*>> TABLE_DEE = R01**>> <OR> = _at_v (former "+", seehttp://vadimtropashko.wordpress.com/relational-programming-with-qbql/...)*

*>> <NOT> = _at_' (former "'")*

*>> 2. Write your assertion in QBQL*

*>> x _at_v (x @') = x @v R01.*

*>> 3. Run the program containing this assertion.*

*>>*

*>> QBQL will iterate through all the relations in the database trying to*

*>> find counterexample. In this case it finds none.*

> > Why introduce awkward notation with the AT symbol? Wouldn't user- > defined operations with angle brackets much more elegant (and > instantly appealing to Tutorial D enthusiasts)?

Personally, I think Vadim is right to use different symbols for his algebra, which as I recall, has more fundamental ops. Although I can sympathize with the labels of the A-algebra <AND>, <OR> and <NOT> operators, one thing I don't like about them is that it's easy for a newcomer to fall into the trap of thinking that the implicit logical 'AND' of the propositions we use to interpret a relation is somehow the same <AND> that partly determines the predicate of those propositions. Likewise with <OR>, eg.,

if R1 stands for the propositions {p1,p2} and R2 for {p3} and p1, p2, p3 are all of the possible propositions,

R1 <OR> R2 could be depicted graphically, albeit casually, as:

(p1 OR p2)

**AND
**

(p1 OR p3)

**AND
**

(p2 OR p3)

If we pretend that p1, p2, p3 stand for tuples with the same heading, a casual picture of the relation's body could be:

p1

**AND
**

p2

**AND
**

p3

(This is my attempt to visualize the result of UNION which D&D define in terms of <OR> and without which we can't 'INSERT'.) But both the '<OR>' and the 'OR' have disappeared from the 'picture', even if not from the logical 'meaning'. Maybe all this shows is that a visual picture can't always retain the meaning of the logic but it does seem to be a trap that's easy to fall into, ie., there's a big different between AND and OR and <AND> and <OR>. Received on Mon Sep 27 2010 - 21:25:19 CEST