Hi -- On Sat, 26 Oct 2002, Phil Tomson wrote: > In article <Pine.LNX.4.44.0210250754010.2650-100000 / candle.superlink.net>, > <dblack / candle.superlink.net> wrote: > >Hello -- > > > >On Fri, 25 Oct 2002, Rudi Cilibrasi wrote: > > > >> I am wondering if there is a good reason why Ruby does not by default > >> support, for instance, > >> true <=> false (should be +1 or -1) > >> or even > >> false <=> false (should be 0) > > > >I guess one reason is that it's not clear (to me, anyway) why true > >would be > false, or false > true. Is there ordinality to Boolean > >values? > > Actually if you want to get theoretical and mathematical there is an > ordering to boolean values in Boolean Algebra. > > Here's a definition from one of my textbooks ("Logic Synthesis and > Verification Algorithms" by Hachtel and Somenzi): > > "A complemented, distributive lattice is a Boolean Lattice or Boolean > Algebra" > > What's a lattice: > > "A lattice is a poset [partially _ordered_ set] (AXA, <=) [meaning that > the Cartesian product of the set A with itself with the result ordered by > the less-than or equal relation] in which any two elements have a meet > [greatest lower bound] and a join [least upper bound]. Consequently, all > finite lattices have a _greatest_ element, denoted by 1 [or true], and a > least element 0 [or false], where 1 [true] is an element of set A and 0 > [false] is an element of set A." > > So technically true is greater than false. We're waaaay over my head mathematically, but I'm finding this interesting enough that I'll go ahead and ask a couple of stupid questions :-) 1. Why couldn't one swap 'true' and 'false' in your square-bracket comments in the above? That is: why does true have to go with 1 and false with 0? 2. Does being the greatest and least, in a lattice, have to propagate to a direct comparison between the two elements? I'm thinking (by way of analogy) of an array: [3,1,5,4], where 5 is the greatest element in one sense, and 4 is the greatest in another sense (highest indexed). 3. Does all of this necessarily apply to Ruby? That is, does the presence of true and false in a programming language imply support for Boolean algebra? These questions are probably all OT babytalk, but I thought I'd give it a try, just out of curiosity. David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav