On Tue, Sep 14, 2010 at 08:57:58PM +0200, no-re...@cfengine.com wrote:
> Seva Gluschenko Wrote:
> -------------------------------------------------------
> > first two expressions aren't exactly equivalent.
> > !Sunday.!Morning.!dev_env.!phost is equal to
> > !(Sunday|Morning|dev_env|phost).
> 
> I don't understand how those can be the same.

As Daniel said, this is De Morgan's law. To visualize it better just
take simpler expression with two operands and calculate all possible
combinations manually (S=Sunday, M=Morning):

|-------+-------+----------+---------+---------+----------|
| S     | M     | !(S . M) | !S | !M | !S . !M | !(S | M) |
|--------+------+----------+---------+---------+----------|
| False | False | True     | True    | True    | True     |
| False | True  | True     | True    | False   | False    |
| True  | False | True     | True    | False   | False    |
| True  | True  | False    | False   | False   | False    |
|-------+-------+----------+---------+---------+----------|


Back to your examples:

> 1. !(Sunday.Morning.dev_env.phost)
This yields as True when at least one operand is False.

> 2. !Sunday.!Morning.!dev_env.!phost
And this expression is True only when all operands are False.


Hope this helps.
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to