[Mulgara-dev] Re: Bug list and versions
Andrae Muys
andrae at netymon.com
Mon Nov 13 18:48:48 CST 2006
On 14/11/2006, at 9:51 AM, Life is hard, and then you die wrote:
>> On 11/13/06, Life is hard, and then you die <ronald at innovation.ch>
>> wrote:
> The real thing is more complicated and has multiple terms being OR'd
> together. Each OR term has a different set of AND'd terms, concluding
> with a <mulgara:is> clause. I.e. EXPRESSION_A is really something like
>
> (constr_1a and constr_1b and constr_1c and $t <mulgara:is> '0') or
> (constr_2a and constr_2b and $t <mulgara:is> '1') or
> (constr_3a and constr_3b and constr_3c and constr_3d and $t
> <mulgara:is> '2') or
> ...
>
> $t occurs only in the <mulgara:is> clause, nowhere else. The purpose
> of that <mulgara:is> clause is to know which of the OR terms matched
> (and there may be multiple of them).
>
> Now, in the above example, the second clause is a degenerate form that
> was being generated in certain corner cases (I'm dealing with this
> case specially now).
And the problem isn't the $t in any case. In the degenerate case you
sent us, it's the $b being present in only one of the arguments to
the disjunction that is triggering the bug.
> you get one line for every matching $b, just as expected. So it's just
> in the context of an OR that things don't work. I understood OR to be
> a set-theoretic union, so it shouldn't matter if I do one query with
> 3 OR terms, or 3 queries each with only one of the OR terms.
OR is not strictly speaking a set-theoretic union, but a disjunction.
So given the following tuples:
A $a $b B $a $b
1 5 2 6
2 7
the actual semantics are not tabular, but logical:
A = { {a->1, b->5} } implies (a==1) ^ (b==5) -> #t
B = { {a->2, b->6}, {a->2, b->7} } implies ((a==2) ^ (b==6)) v
((a==2) ^ (b==7)) -> #t
and consequently
A or B |- ((a==1) ^ (b==5)) v ((a==2) ^ (b==6)) v ((a==2) ^ (b==7)) -
> #t
which in sets-of-bindingsets notation is
{ {a->1, b->5}, {a->2, b->6}, {a->2, b->7} }
and in tabular format is:
A or B $a $b
1 5
2 6
2 7
Given
C = { {a->2, c->8} }
A or C |- ((a==1) ^ (b==5) v ((a==2) ^ (c==8))
ie. { {a->1, b->5}, {a->2, c->8} }
which in tabular format is:
A or C $a $b $c
1 5 -
2 - 8
So you are right, disjunction is isomorphic with set-theoretic union,
and indeed when the propositions represented by the various tuples
are or'ed the result is the set-theoretic union of their variable
bindings; but the interface to that result is via a tabular form.
Consequently we have these "binding-doesn't-exist"/"don't
care"/"variable unbound" (whatever you want to call it) values
turning up in the mapping from the logical proposition to the table.
These values are not NULL's, rather they are DONTCARE's - they
literally indicate that the truth value of that term in the sum-of-
products form is independent of that variable.
> The problem is that this won't work well if there are 10 terms....
Nope it won't. So it's probably important that we get this bug
fixed :). Just be aware that avoiding UNBOUND's is good practice
(even if not always possible).
Andrae
--
Andrae Muys
andrae at netymon.com
Principal Mulgara Consultant
Netymon Pty Ltd
More information about the Mulgara-dev
mailing list