|
Boost : |
From: Marco (mrcekets_at_[hidden])
Date: 2007-04-22 12:28:54
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 >
commutativity:
or_< T, U > == or_< U, T >
and_< T, U > == and_< U, T >
absorption:
or_< T, and_<T, U> > == T
and_< T, or_<T, U> > == T
obviously where "==" means logical equivalence not C++ data type equality.
Distibutivity shuold hold, too.
Marco
-- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk