The Forum for Discussion about The Third Manifesto and Related Matters

Please or Register to create posts and topics.

Unifying small and great divide

Looking at the small and great divide in DTATRM with the modification on page 181 to switch the per and the operands, I believe that they can be unified to one operation.

  1. Small divide to find the suppliers that supply all purple parts:

WITH ( P WHERE COLOR = COLOR('Purple') )AS PP:

SP { S#, P# } DIVIDEBY PP { P# } PER ( S { S# } )

which can be implemented as

WITH ( P WHERE COLOR = COLOR('Purple') )AS PP,

( S { S# } JOIN PP { P# } )AS QQ,

( QQ MINUS SP { S#, P# } )AS RR: //(a)

S { S# } MINUS RR { S# }

 

2. Great divide to find the suppliers that supply all red parts for a project

WITH ( PJ JOIN ( P WHERE COLOR = COLOR('Red') ) AS RPJ:

SP { S#, P# } DIVIDEBY RPJ { P#, J# } PER ( S { S# } , J { J# } )

which can be implemented as:

( S { S# } JOIN J { J# } )MINUS ( ( S { S# } JOIN RPJ { P#, J# } )MINUS ( SP { S#, P# }JOIN RPJ { P#, J# } ) ) { S#, J# }

which can be rewritten as:

WITH ( S { S# } JOIN J { J# } ) AS SJ,

( S { S# } JOIN RPJ { P#, J# } ) AS QQ, //(b)

(QQ MINUS ( SP { S#, P# }JOIN RPJ { P#, J# } )) AS RR,

SJ {S#, J#} MINUS RR{S#, J#}

Now I observe that in the small divide:

( QQ MINUS SP { S#, P# } )AS RR: //(a)

can just as well be written:

( QQ MINUS (SP { S#, P# } JOIN PP{P#} )AS RR: //(a)

and in the great divide

( S { S# } JOIN RPJ { P#, J# } ) AS QQ, //(b)

can just as well be written:

( SJ { S#, J# } JOIN RPJ { P#, J# } ) AS QQ, //(b)

 

So, we have it complete that

A DIVIDEBY B PER C

is implemented as

WITH ( C JOIN B ) AS QQ,

( QQ MINUS (A JOIN B) )AS RR:

C MINUS RR

Where for the small divide example A = SP, B=PP and C=S

and for the great divide example A = SP, B=RPJ and C=SJ

Is that correct?