[Haskell-cafe] What puts False before True?
Steve Schafer
steve at fenestra.com
Thu May 31 23:37:25 EDT 2007
On Fri, 01 Jun 2007 03:33:41 +0100, you wrote:
>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?
There is a correspondence between a Boolean algebra and an algebraic
ring. If we identify 0 with FALSE and 1 with TRUE, then that
correspondence leads to a natural identification of addition with
EXCLUSIVE OR, and multiplication with AND:
0 + 0 = 0 FALSE XOR FALSE = FALSE
0 + 1 = 1 FALSE XOR TRUE = TRUE
1 + 0 = 1 TRUE XOR FALSE = TRUE
1 + 1 = 0 TRUE XOR TRUE = FALSE (carry is ignored)
0 * 0 = 0 FALSE AND FALSE = FALSE
0 * 1 = 0 FALSE AND TRUE = FALSE
1 * 0 = 0 TRUE AND FALSE = FALSE
1 * 1 = 1 TRUE AND TRUE = TRUE
>A Boolean value denotees veracity whereas an ordered value concerns
>magnitude (priority), indeed, order!!
It is frequently desirable to enumerate things, even when those things
don't have a well-defined order. In such cases, we have to impose an
order, perhaps arbitrarily. Within a given programming context, it
doesn't matter what we choose for our enumeration order, but it's
generally best to go along with whatever de facto standard there is, if
for no other reason than to avoid going insane.
Steve Schafer
Fenestra Technologies Corp.
http://www.fenestra.com/
More information about the Haskell-Cafe
mailing list