gilt bei xor auch das kommutativ gesetz, wenn ich ahbe a xor b xor c, kann ich erst a xor b rechnen und das ergebnis dann xor c?
2 Antworten
a xor b = (a and not b) or (not a and b) = (b and not a) or (not b and a) = b xor a
offensichtlich kommutativ. Sieht man auch am symmetrischen Aufbau (unter Synthese)
Exklusiv-Oder-Gatter – Wikipedia
Jetzt zu a xor b xor c:
Im Prinzip heißt es: Die Anzahl der wahren Belegungen von a,b,c muss ungerade sein.
(a xor b) xor c = (((a and not b) or (not a and b)) and not c) or (not((a and not b) or (not a and b)) and c)
a xor (b xor c) = ((b and not c) or (not b and c)) and not a) or (not((b and not c) or (not b and c)) and a) = (not a and ((b and not c) or (not b and c)) or (a and not((b and not c) or (not b and c)) = (not a and b and not c) or (not a and not b and c) or (a and (not(b and not c) and not(not b and c))
= (not c and not a and b) or (c and not a and not b) or
(a and (not b or c)) and (a and (b or not c))
= (not c and not a and b) or (c and not a and not b) or
(c and a and b) or (a and not b and not c) <-- komplexe Ausklammerung!!!
= (not c and ((not a and b) or (a and not b)) or (c and ((a and b) or (not a and not b))
= (not c and (a xor b)) or (c and (a XNOR b))
= (not c and (a xor b)) or (c and not(a xor b))
= c xor (a xor b)
Neben meiner mega-umständlichen Umformlösung hätte man es auch mit der Wahrheitstabelle machen können
(a xor b) xor c und a xor (b xor c)
kommt jedesmal dasselbe raus.