[Haskell-cafe] What puts False before True?
Derek Elkins
derek.a.elkins at gmail.com
Fri Jun 1 12:42:19 EDT 2007
Henning Thielemann wrote:
> On Thu, 31 May 2007, Paul Hudak wrote:
>
>> PR Stanley wrote:
>>>> I think so, too. In Boolean algebra (which predates computers, much less
>>>> C), FALSE has traditionally been associated with 0, and TRUE with 1. And
>>>> since 1 > 0, TRUE > FALSE.
>>> The question, however, still remains: why False = 0 and True 1? I
>>> appreciate that it's so in boolean algebra but why? Why not True = 0
>>> and False = 1?
>> Because if you take (&&) to be (*), and (||) to be (+), you get a
>> homomorphism between the two resulting algebras (assuming 1+1 = 1).
>
> It seems however, that if the number representations of False and True
> are flipped, then we only need to flip the interpretations of (&&) and
> (||).
> For me the choice fromEnum False == 0 && fromEnum True == 1 seems rather
> arbitrary.
It -is- arbitrary, in boolean algebra as well. not is an automorphism between
the two. However, we tend to think of 0 as associated with nothing/the empty
set and that maps naturally to {x | False}. There are intuitive reasons why
this choice was chosen, but no formal reasons. Obviously, there are pragmatic
reasons to use this choice in programming languages, e.g. many languages use 0
to represent false and non-zero or 1 to represent true and this is consistent
with that.
More information about the Haskell-Cafe
mailing list