views:

103

answers:

4

I'm just learning boolean algebra at the moment. I read that for XOR we can rearrange the expression

  1. (A + B) . ¬(A + B)

  2. = A.¬A + A.¬B + B.¬A + B.¬B

  3. = A.¬B + B.¬A

I can understand this but I'm unsure how I would proceed multiplying out an expression like

  • (A + B) . (¬A + ¬B).

If I just try and naively multiply out all the terms that will bring me to the same result as XOR but the truth table is different. What are the rules on multiplying out negated terms?

+1  A: 

You think the truth table is different?

Try evaluating it yourself.

Anon.
Doh! I'm not sure how I convinced myself that they were different. So basically it should never make any difference then if the negation applies to the whole bracketed expression or individual component(s)?
Martin Smith
Oh no, big diff. That's what DeMorgan is all about. If you move the 'not' into the parentheses, you have to invert the conjunction inside the parentheses.
Carl Smotricz
Yes I had thought that I had got myself into trouble with doing something like that earlier. I'll try and revisit that example with the help of Wolfram Alpha!
Martin Smith
+1  A: 

You need DeMorgan's Law

Chris Dodd
+3  A: 

Your first expression isn't an xor, try making this substitution:

 Z = A+B 

klochner
I don't know what good the substitution would do, but I believe you're right about the first expression not being an XOR.
Carl Smotricz
what do you get when you make the substitution in the first expression?
klochner
(It just makes the truth value more obvious)
klochner
Ah, I see... you're demonstrating that (1) is always false. Yep, that could be part of the problem.
Carl Smotricz
Well spotted. That is actually a typo in the book I'm using I think.He originally states it as (A + B) . ¬(A.B) but then proceeds to start with (A + B) . ¬(A + B) in the multiplying out example.
Martin Smith
OK. Using De Morgan (A+B). ¬(A.B) = (A+B).(¬A+¬B) and I can follow the multiplication out from there. Maybe the author quietly used De Morgan without specifying it and just took it as read the equivalence would be apparent. The book doesn't actually use the ¬ symbol but rather a continuous bar over the whole second A+B expression that I couldn't figure out how to reproduce here. Maybe I misinterpreted that as equivalent to ¬(A+B) in my attempted ASCII translation.
Martin Smith
sounds like a typo to me. \bar{(A+B)} == ¬(A+B)
klochner
Thanks. It all makes more sense now!
Martin Smith
+1  A: 

You can throw this kinda thing at Wolfram Alpha. Here's what I did:

http://www.wolframalpha.com/input/?i=truth+table+%28a+or+b%29+and+%28not+a+or+not+b%29

Please click on the link to view the results! Does that truth table look like what you thought it should, or not?

Carl Smotricz
Thanks very useful :-)
Martin Smith