cgrand / enlivez

8 stars 0 forks source link

Better derivatives #11

Open cgrand opened 5 years ago

cgrand commented 5 years ago

According to #6, result sets are not real sets they have a. Key. However this information is not leveraged by derivatives: a change is conveyed as a retraction and an addition of tuples sharing the same key. Reporting just the addition is enough because key unicity implies that this addition is an upsetting.

Likewise retraction just need to specify the key.

This should simplify derivatives.

cgrand commented 5 years ago

Because templates are arranged in a hierarchy, each query is in fact a join between the parent query (P) and itself (Q). The negative part of the derivative should be:

D-(PQ) = P*D-(Q) + D-(P)*Q - D+(PQ)

(where + is union, - is difference, * is intersection/join) but since we have a hierarchy, D-(P) at the parent level has been taken care off, deleting the whole hierarchy. So at the current level we only care about:

D-(PQ) = P*D-(Q)