It is true that first-order logic usually assumes that the domain of a formula be a nonempty set. As so often, things aren't quite so simple when formulae are evaluated on a computer. What should be done in this case, forall with an empty domain? Throw an exception? Not very convenient, since there's no reasonable way of handling exceptions thrown on the LHS. Return false? That doesn't make sense, because you can't inspect what isn't there. Return true? If it isn't false - what else?
If first-order logic does permit empty domains, it must be treated as a special case. -W On 07/01/2014, Sonata <[email protected]> wrote: > Hi, I am using the "forall" keyword on the LHS and it seems the condition > is > satisfied when there is nothing to match. e.g. "forall (MyClass(value == > "test"))" fires the rule when there is no MyClass() object in the working > memory. My workaround is add "exists (MyClass())". > > Also, same for "not (exists (MyClass(value != "test")))", but I can > understand this, as there is no MyClass() object, it doesn't exists and > hence "not" gives true. > > But for "forall", it doesnt sound right to me. I wonder if "forall" is > actually implemented as "not exists" in the engine. > > Please clarify if this is by design or a bug. Build is 5.5.0.Final > > Thank you > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/forall-is-satisfied-when-there-is-nothing-tp4027553.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
