Boost logo

Boost :

From: Paul Giaccone (paulg_at_[hidden])
Date: 2007-04-23 05:11:04


Marco wrote:
> On Sun, 22 Apr 2007 12:31:44 +0200, Larry Evans
> <cppljevans_at_[hidden]> wrote:
>
>
>> Actually, I think and_ and or_ are the meet and join of
>> a lattice:
>>
>> http://en.wikipedia.org/wiki/Lattice_%28order%29
>>
>> where:
>>
>> proto::_
>> is the top element
>> proto::not_<proto::_>
>> is the bottom element
>>
>> However, I'm not sure about this since I don't know
>> if the and_ and or_ operations are associative
>> and commutative, which is one of the requirements
>> for a lattic (I think).
>>
>
> Well, the last word is up to the author's library, however I'd be
> surprised if the following relations were not valid:
>
> associativity:
> or_< T1, or_<T2, T3> > == or_< T1, T2, T3 > == or_< or_<T1, T2,>, T3 >
> and_< T1, and_<T2, T3> > == and_< T1, T2, T3 > == and_< and_<T1, T2,>, T3 >
>

Excuse my mathematical pedantry and going off topic. The operations or_
and and_ are binary, not ternary. Each of the middle expressions is, by
definition (that is, mathematical consensus), equal to at least one of
the corresponding outer terms. One or both of the equalities in each of
the above relations is therefore tautologous (that is, always true).

The only requirement for associativity is:

        or_< T1, or_<T2, T3> > == or_< or_<T1, T2,>, T3 >
        and_< T1, and_<T2, T3> > == and_< and_<T1, T2,>, T3 >


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk