Jump to content

Talk:Exclusive or

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Pciszek (talk | contribs) at 14:44, 6 June 2020 (What is the system symbolic logic notation used on this page called?: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Properties of XOR Operation (in the Computer Science section)

I think the computer science section should mention some of the common properties of the XOR operation as it applies to binary calculations.

e.g., where A and B are two arbitrary binary digits (0 or 1)

   if XOR(A,B) = C, then XOR(B,A) = C; commutativity
   if XOR( XOR(A,B), C ) = D, then XOR( A, XOR(B, C) ) = D; associativity    
   and XOR(A,A) = 0 and if XOR(A,B) = C, then XOR(A,C) = B and XOR(C,B) = A; a binary string is its own inverse (logic)

That is to say, the XOR operation is commutative (it doesn't matter what order the operands are passed to the function), is associative (it doesn't matter how multiple operands are grouped), and binary strings passed to it are their own inverses with respect to XOR.

I'll add this into the page sometime in the next week or two, unless someone objects. Let me know of any flaws/improvements! Jthechemist (talk) 23:21, 13 May 2010 (UTC)[reply]

There's an inherent assumption that XOR of 3 or more bits is parity (chained XOR), instead of the English description of exclusive 'just one is true'. Not sure if this should be added to the article in case someone comes across both conventions. 73.181.82.26 (talk) 08:49, 29 September 2015 (UTC)[reply]
I've never seen "just one true" called XOR. That operation is not associative, so it can't be computed one pair at a time, among other reasons for being less used. Mentioning it here would require a reliable source. —David Eppstein (talk) 15:40, 29 September 2015 (UTC)[reply]

Proof unhelpful

I propose dropping the proof of ¬(p^q) ^ (pvq) because it is easy to prove it exhaustively using the truth table. Much easier than to follow the first step of the provided proof.

Sweavo (talk) 12:35, 7 January 2011 (UTC)[reply]

XOR Swap

The page for XOR Swap does not indicate the following sentence: "using the XOR swap algorithm; however this is regarded as more of a curiosity and not encouraged in practice." "In practice" seems to be an opinion of the author of that statement and doesn't follow from the body of knowledge (nor it is cited). Revenge by someone couldn't answer it on an interview question? :) Freakdog (talk) 02:45, 10 September 2011 (UTC)[reply]

If this is the algorithm I'm thinking of, it's because it used to be patented (especially for graphics work but even then it might have applied). XOR is fine, but subtraction is the version that's questionable thanks to assumptions in how C or C++ handles values on that specific implementation.
https://en.wikipedia.org/wiki/XOR_swap_algorithm#Reasons_for_avoidance_in_practice
A=A XOR B
B=A XOR B
A=A XOR B
73.181.82.26 (talk) 08:42, 29 September 2015 (UTC)[reply]

Distributivity over Exclusive Or

xor is communicative and associative. false xor p is p, for any formula p. p xor p is false for any formula p. Thus (if xor is distributive over itself):

p xor (q xor r)
is (p xor q) xor (p xor r)
is (p xor q xor p xor r)
is (p xor p xor q xor r)
is (false xor (q xor r))
is (q xor r).

p xor (q xor r) is NOT (q xor r).
Proof by Counter Example:

p := true
q := false
r := true

p xor (q xor r) is true xor (false xor true) is true xor true is false.
q xor r is true.

xor is NOT distributive over itself. --Xor logician (talk) 04:45, 14 September 2011 (UTC)[reply]

Didn't really know where to put this... the article says XOR isn't distributive over any binary operator, but it is distributive over logical AND, isn't it? --87.183.89.195 (talk) 16:01, 17 May 2012 (UTC)[reply]

The other way around: and distributes over xor. Thanks for catching this. —David Eppstein (talk) 16:53, 17 May 2012 (UTC)[reply]

3-ary XOR

If I were to say "you can have cake or pie or chocolate", I'm implying that you can't have all three. How do I represent that? XOR disallows you to have 2 desserts at the same time, but technically allows you to have all 3. What logical operation can be used to match my linguistic intentions (you can only have 1 of 3 desserts)? Jigen III (talk) 23:56, 26 January 2015 (UTC)[reply]

I put this together, pretty confident it's sufficient but there might be a simpler way to do it. '!' is the negating operator, '&&' is AND, '||' is OR.
(a || b || c) && ( !(a || b) || !(b || c) || !(a || c) ) ODawg97 (talk) 04:00, 29 May 2015 (UTC)[reply]
How about (a ⊕ b ⊕ c) ∧ ¬(a ∧ b ∧ c)? I derived that from looking at the Venn diagram of a ⊕ b ⊕ c: . The part ∧ ¬(a ∧ b ∧ c) excludes the center of the diagram and corresponds to the "you can't have all three" restriction. --Jhertel (talk) 09:59, 29 May 2015 (UTC)[reply]
Thanks both of you. For sets, is this acceptable?: A∪B∪C - A∩B - A∩C - B∩C
The three minuses subtracts the region A∩B∩C three times; is that a problem? Jigen III (talk) 11:58, 22 July 2015 (UTC)[reply]
You could also use binary with 3 inputs. There's an alternative extension of 2-input XOR to 3+ bits, where only 1 may be true. The reason that XOR is normally defined as parity is because it is consistent with how chaining of AND gates and OR gates works. If you take 2 2-input OR gates, and tie the output of one to the input of the other, you get true if any of the 3 remaining inputs are true. This seems to be related to how comparisons work (Less, equal, greater as 3 bits for all 8 combinations, or as a ternary result of a comparison) 73.181.82.26 (talk) 08:47, 29 September 2015 (UTC)[reply]

Dumb Waiter

"(Note: If the waiter intends that choosing neither tea nor coffee is an option i.e. ordering nothing, the appropriate operator is NAND: p NAND q.)[dubious – discuss]"

I don't think this is accurate, even if coffee AND tea is disallowed. The customer *may* order coffee XOR tea. The customer *must* order coffee NAND tea. The fact that the may construction was used just beforehand makes this confusing, if the reader assumes that construction is how the waiter is expressing themself once more. Samineru (talk) 21:16, 4 January 2016 (UTC)[reply]

Something is missing

Should mention that:

X xor 1 = not(X)

X xor 0 = X

--Volibon (talk) 18:52, 14 March 2016 (UTC)[reply]

arithmetic representation

In some cases, we want to use arithmetic representation for logic express. For the case of exclusive or, we have

xor(a,b)=a+b-2*a*b;

Jackzhp (talk) 05:53, 15 April 2016 (UTC)[reply]

"exclusive or" vs. "exclusive-or"

The term appears both hyphenated and not in the article. Should the article be consistent here? If so, which is it? — Preceding unsigned comment added by 147.210.246.189 (talk) 12:35, 5 July 2016 (UTC)[reply]

This sentence: "If all we know about some disjunction is that it is true overall, we cannot be sure that either of its disjuncts is true" is false. We know for certain one or both disjuncts is true if OR or XOR evaluates to true. Changed to "...we cannot be sure which of its disjuncts is true", which is in fact the case. — Preceding unsigned comment added by Bholleman (talkcontribs) 04:44, 2 January 2017 (UTC)[reply]

Example Given

In the section "Equivalences, elimination, and introduction" the example, "For example, if two horses are racing, then one of the two will win the race, but not both of them." This doesn't strike me as analogous to xor logic (but on the right track). Basically, it's more like "if two horses are in a race, then one of them will one if they are proven different, but neither will win if they are equivalent." I almost just edited directly without talk being confident (in terms of logic) about the change and it being minor, but then realized that I've had a super long day and am super ineloquent. Can someone reword my example and edit maybe? Most notable is I'm poorly representing "equivalent" vs "unequivalent" as "faster" vs "same speed" and the phrasing is a mess. 2001:558:6012:51:31C7:8365:79FA:2F43 (talk) 06:07, 16 December 2016 (UTC)[reply]

Fast post-thought, even better is describing that if one wins, then the race is deemed resolved with a winner, vs neither win, the race is deemed resolved with no winner (the actual output here is "do we have a winner?" rather than the horse that won)... I'm tired. You get the idea here. Someone with some language skills bail me out please and make Wikipedia better one sentence change at a time. 2001:558:6012:51:31C7:8365:79FA:2F43 (talk) 06:14, 16 December 2016 (UTC)[reply]

Minor Edit: Linearly Seperable

Apparently my account isn't active enough to be able to edit semi-protected pages. I propose linking Linearly Separable, because it's specific to Neural Nets which creates a domain-specific definition. DazzleNovak (talk) 20:05, 16 February 2017 (UTC)[reply]

Bitwise Operation Section- Slight Clarification (Minor Edit Suggestion)

The Computer Science section, subsection "Bitwise operation", currently contains the following sentence (as of Thurs, June 15 2017):

As noted above, since exclusive disjunction is identical to addition modulo 2, the bitwise exclusive disjunction of two n-bit strings is identical to the standard vector of addition in the vector space .

More accurately, I believe it should say:

As noted above, since exclusive disjunction of 2 bits is identical to addition modulo 2, the bitwise exclusive disjunction of two n-bit strings is identical to the standard vector of addition in the vector space .

Or perhaps even:

As noted above, since exclusive disjunction of two 1-bit numbers is identical to addition modulo 2, the bitwise exclusive disjunction of two n-bit strings is identical to the standard vector of addition in the vector space .

I realize that the second part of the sentence in the current article (somewhat) implies my suggested addition, but if one only reads the first part of the current version's sentence alone, it is ambiguous and technically incorrect for most pairs of multi-bit numbers. Thoughts? Too minor to stress about?

P.S I would have made the edit myself (maybe) but the page is semi-protected, and I am a very beginner wiki-newbie. Actually now that I think about it, that's probably for the best :P Sorry if I butchered any syntax or etiquette for this talk entry!

--BetaDuck (talk) 07:51, 15 June 2017 (UTC)[reply]

Spanish "... o ..." vs "o ... o ..."

It is wrong that "... o ..." always is exclusive. It can be. But most often it is used in an inclusive way. On the other hand, "o ... o ..." is always used as exclusive (like "either ... or ..." in English). At least, this is how it is used in Spain. Mamue81 (talk)

Yes, I think this is how it is used in all Spanish speaking countries. Why is Spanish even mentioned? I don't see how Spanish disjunctions function differently from the English ones. "o"="or", "o...o"="either...or". --92.214.199.65 (talk) 19:59, 5 May 2018 (UTC)[reply]
I don't think it is true that there are no sentences where the "or" is inclusive, at least in Spanish. For instance, in the sentence "you can have a discount in your cinema ticket if you are underage or disabled", both given possibilities might occur and the person would still have the ticket discount. --Benjavalero (talk) 09:21, 18 November 2019 (UTC)[reply]

English section vs. Latin

The English usage section is rather inconclusive and unsatisfying. It would be much better to mention languages which have a word specifically meaning "exclusive or", like aut in Latin, as seen in such quotes or proverbs as Aut vincere aut mori "Conquer or die!" and Aut Caesar aut nullus "Caesar or nobody!" (In such sentences, the first aut is added for rhetorical emphasis, but the basic meaning would be the same even if it were omitted...) -- AnonMoos (talk) 02:10, 22 April 2018 (UTC)[reply]

Semi-protected edit request on 8 August 2018

2405:205:4227:1961:B1DA:B0D2:486E:4113 (talk) 16:59, 8 August 2018 (UTC)[reply]
 Not done: it's not clear what changes you want to be made. Please mention the specific changes in a "change X to Y" format and provide a reliable source if appropriate. LittlePuppers (talk) 17:56, 8 August 2018 (UTC)[reply]

Disjunction: Waiter v Tennis Example

Please remove this part: "Even so, there is good reason to suppose that this sort of sentence is not disjunctive at all. If all we know about some disjunction is that it is true overall, we cannot be sure which of its disjuncts is true. For example, if a woman has been told that her friend is either at the snack bar or on the tennis court, she cannot validly infer that he is on the tennis court. But if her waiter tells her that she may have coffee or she may have tea, she can validly infer that she may have tea. Nothing classically thought of as a disjunction has this property. This is so even given that she might reasonably take her waiter as having denied her the possibility of having both coffee and tea."

The differences between the two examples have nothing to do with or. It's the fact that the conditional "may" is used. If a woman has been told that her friend may either be at the snack bar or may be on the tennis court, she can infer that he may be on the tennis court. Myfirstnameisdanger (talk) 19:46, 7 August 2019 (UTC)[reply]

 Done Implicit consensus since no one has objected and the citation needed tag. --Trialpears (talk) 23:25, 13 August 2019 (UTC)[reply]

What is the system symbolic logic notation used on this page called?

The system of symbolic logic notation used on this page, with right angle thingies for negation, Vees for "OR", and carats for "AND" is not the only one. What is it called? Is it the most common notation? If not, what is the most notation? If I wanted to write out a statement of logic on a sign or a T-shirt and have it be recognized by as many geeks as possible, which system of notation should I use? Pciszek (talk) 14:44, 6 June 2020 (UTC)[reply]