# Boolean Equivalents - Basic Identities

• July 28th, 2012, 05:49 PM
pict3000
Boolean Equivalents - Basic Identities
I'm looking at a table meant to help me simplify condition code, but I'm not exactly sure what these statements mean. I understand the first one: !!x (double-arrow) x. No problem. A double-negative equals a positive (or "true"). But the rest of the equivalencies are not making sense to me yet. Like this one:
x || false (double-arrow) x
Does that read like this: "a variable named "x" OR a false result of an expression is the same thing as that variable named "x"? If that is in fact how that reads, then I don't see how that is equivalent to "x". I'm having the same problem understanding:
x && true (double-arrow) x
and;
x || true (double-arrow) true
and so on...

Maybe this first-time poster just needs a nap. But please explain, anyway.
• July 28th, 2012, 06:47 PM
Norm
Re: Boolean Equivalents - Basic Identities
Quote:

x && true (double-arrow) x
Not sure what that is supposed to say. The part following true is confusing.
What is the definition for x?
What does (double-arrow) mean?
No one would code: !!x
• July 28th, 2012, 07:09 PM
Zaphod_b
Re: Boolean Equivalents - Basic Identities
Quote:

Originally Posted by pict3000
...
x || false (double-arrow) x
Does that read like this: "a variable named "x" OR a false result of an expression is the same thing as that variable named "x"? ....

Symbolic logic loses a little when we are confined to non-symbolic text, but I'm think your double arrow means what you said.

I'll use .OR. to represent a logical operation between boolean variables

So, I'll try it like this...

Suppose x is a boolean variable. It can only take on one of two possible values: True, False. Mathematicians are more likely to call the value 1 and 0, respectively and they define certain operation in terms of 1s and 0s, but we can use True and False if we want to.

Try it in the following logical equation.
1. Let x = False.
Then x .OR. False ==> False .OR. False ==> False

2. Let x = True.
Then x .OR. False ==> True .OR. False ==> True

3. Therefore x .OR. false ==> x

I'm using ==> as an indication that an expression on the left implies a result given on the right.

Hardware guys know this without even thinking about it. If one input of an OR gate is tied low (logic 0 or False), then if you apply a logic 1 (True) to the other input, the output is 1 (True). If you apply a logic 1 (True) to the other input, the output is 1. In other words, if one input is tied low, the output is equal to the other input.

Try it again with .AND.

Quote:

Originally Posted by Norm
No one would code: !!x

Maybe you wouldn't code that in Java, but if the subject is symbolic logic, it's not uncommon to see expressions like that during various kind of manipulations.

It's also used in C90 programming where there are no Boolean variables, and !!x is very useful in certain situations, but that's another story...

Note that C program statement (C++ too), if x is some kind of numerical data type, !!x is not a boolean algebraic expression, it has an arithmetic value of zero or 1 depending on whether the numerical value of x is equal to zero or not equal to zero.)

Cheers!

Z
• July 28th, 2012, 07:15 PM
pict3000
Re: Boolean Equivalents - Basic Identities
Norm,

This is right out of an intro to Java textbook. This reference table is titled Basic Identities of Boolean Logic. These statements are meant to show a simplified equivalent (right side of the double arrow) to the condition statement on the left side of the double arrow. The double arrow is the symbol for "equivalent". I don't have a double arrow on my keyboard, so I wrote it out. I'm not following the logic of these "equivalent" statements, though.

Does that clarify at all?
• July 28th, 2012, 07:18 PM
Norm
Re: Boolean Equivalents - Basic Identities
Would the double arrow look like this: <==>
• July 28th, 2012, 07:55 PM
pict3000
Re: Boolean Equivalents - Basic Identities
The book shows a solid line between the arrow points. It means "the same thing as" (equivalent). I take it that's what your symbol means, too.
• July 28th, 2012, 08:06 PM
pict3000
Re: Boolean Equivalents - Basic Identities
...and yes, it look very much like your example - only with a solid line between the arrow points.
• July 28th, 2012, 08:44 PM
pict3000
Re: Boolean Equivalents - Basic Identities
Thank you, Zaphod_b!

Great explanation!
• July 28th, 2012, 09:02 PM
pbrockway2
Re: Boolean Equivalents - Basic Identities
Richard Feynman tells a story somewhere about having a cousin who was baffled by some problem in maths - a calculation of some sort. He thought that the calculation was quite straight forward and told his cousin what the answer was, but his cousin objected: "No, I have to solve it with algebra!". Feynman expresses some dissatisfaction with algebra if it acts to obscure the calculation.

Consider the following rules of algebra (the sort of thing Feynman's cousin might have found confusing). And think about what they mean:

Code :

```x = -(-x) x = x + 0 x.1 = x```

It is reasonable to say that these rules express the fact that the left and right hand side have the same value, whatever the value of x might be. They are valid identities of algebra but, it must be admitted, they are pretty useless aids to calculation.

-----

Your book is saying something similar about thinking and the rules of logic. Variables and other expressions, like the letters and expressions of algebra, have values. And it is possible to find pairs of things that always have the same value whatever the value of x may be.

Code :

```x <-> !!x x <-> x || false x && true <-> x x || true <-> true```

If you don't think these identities always hold, come up with a value of x that makes the two sides of the "equation" have different values.

-----

The algebra examples were chosen to mimic the logic ones. (With true and false playing the role of one and zero) But we notice a couple of differences. First the logical x can only have two values which makes the rules of logic rather easy to check. And secondly the last of the logic rules has no straight forward counterpart in arithmetic.

I'm inclined to agree with Feynman: these rules of logic add little to our ability of to perform boolean calculations. (They are, however, convenient symbolic shortcuts to help us reason about such calculations). So try and understand why they are true, but don't get too hung up over them: they are not expressing profound truths about reasoning.

 slow :(
• July 28th, 2012, 09:26 PM
pict3000
Re: Boolean Equivalents - Basic Identities