Talk:Exclusive or

(Redirected from Talk:Exclusive disjunction)
Latest comment: 6 months ago by Alazn02 in topic ({T,F}, XOR) is an Abelian Group?

Back to basics

edit

At least in the introduction, it would be helpful (even to eggheads) to emphasize the basics. xor (exclusive disjunction) means not-equal, reminding the reader that the simplest base notion is actually equality (logical biconditional). Given that, "neq" or somesuch would be a better name, and ≠ or similar would be a better symbol, but neither is likely to change. Dang, those formal names are too long to type twice in one day.

Thunkapedia (talk) 17:19, 8 March 2022 (UTC)Reply

Properties of XOR Operation (in the Computer Science section)

edit

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

edit

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

edit

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.wiki.x.io/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

edit

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

edit

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

edit

"(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

edit

Should mention that:

X xor 1 = not(X)

X xor 0 = X

--Volibon (talk) 18:52, 14 March 2016 (UTC)Reply

arithmetic representation

edit

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"

edit

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

edit

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
It is error example. "For example, if three horses are racing, then one of the two will win the race, but not all of them." It is not 3-XOR. 3-XOR has output one, if everything 3 input have one. --Voproshatel (talk) 12:45, 18 October 2022 (UTC)Reply

Minor Edit: Linearly Seperable

edit

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)

edit

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 ..."

edit

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

edit

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

edit
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

edit

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
In case anyone's still reading, this was an example of a free choice inference for which "or" is very much one of the culprits. I think it would be WP:UNDUE to include free choice in the article at the present moment (given all the other important things that aren't mentioned) but it would belong in a future more developed version. Botterweg14 (talk) 22:01, 11 February 2021 (UTC)Reply

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

edit

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 common 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

Semi-protected edit request on 6 April 2021

edit

Under the section 'Exclusive "or" in natural language', the former should be changed to the latter:


The English example below would normally be understood in conversation as implying that Mary is not both patriotic and quixotic.

The English example below would normally be understood in conversation as implying that Mary is not both a singer and a poet.


User:Botterweg14's initial draft of this addition used "patriotic and quixotic" as the example, but when this was later changed to "singer and poet", the line above wasn't modified to match. Baitrak (talk) 16:03, 6 April 2021 (UTC)Reply

  Done RudolfRed (talk) 17:24, 6 April 2021 (UTC)Reply
@Baitrak: Just so you're aware, your account is now autoconfirmed, meaning that you can edit confirmed protected pages without needing to create an edit request anymore. Sincerely, Deauthorized. (talk) 17:30, 6 April 2021 (UTC)Reply

Mary example is error. "Mary is a singer or a poet or a dancer" is not 3-XOR. --Voproshatel (talk) 12:49, 18 October 2022 (UTC)Reply

On the expression "either – or" in mathematical texts

edit

The sentence "Mary is either a singer or a poet or both." in section Exclusive or in natural language indicates that „either – or” usually indicates an alternative. This is also what one finds in dictionaries; see e.g. [1]. In the Oxford English Dictionary, "either – or" is mentioned in the entry of "either" under "II. Expressing alternatives. 3. In correlative constructions with a conjunction, introducing the mention of alternatives." From this and the article here, my understanding is that in everyday-speech in the absence of negation, it indeed always indicates an alternative.

For me, so far this indicated that in English texts on mathematics and logic “either – or” should be read as exclusive or. I noticed that sometimes “either – or” is used when inclusive or is meant, but I always thought that in such a case the author was just careless and “either” should be deleted.

After I did indeed delete an occurrence of “either” in an article on a mathematical topic for the stated reason, another user and I had a discussion on the use of “either – or” (see User_talk:TakuyaMurata#On "either ... or"). With the discussion, I have now learned that it is not the case that “either – or” means exclusive or, or at least that this interpretation of “either – or” is not generally accepted.

My counterpart in the discussion referred me to this document in which it is unambiguously stated that "either - or" should mean inclusive or in mathematical writing: [2] I also found this article in the field of logic: [3]. Here "principle 3" indicates the same, that is, “either – or” should simply mean 'or', that is, inclusive or.

But I have not found an authoritative source on the question whether “either – or” in mathematics and logic should be interpreted as inclusive or exclusive 'or' or that it might have both meanings.

Of course, “either” by itself can have a meaning in the direction of “any”. This is, for example, the case in “in either case” or “either way” and also in “Suppose either (one) of the following conditions is satisfied”. This does by itself, however, not mean that “either – or” does not have the specific meaning of exclusive or in mathematics and logic. As stated, this is what I thought.

I also mention that my mother tongue is German, and in German we have the expression “entweder – oder”, which means exclusive or and nothing else. So, as “soit – soit” in French, this is a persistent XOR-construction.

To clarify this question and as a reference for further discussions in this topic here in Wikipedia, I would like to suggest that there should be a section in the present article on the use of “either – or” in texts on mathematics and logic. However, for this first a good source should be found. This might be complemented with statements on expressions in other languages like “soit – soit” in French and “entweder – oder” in German. Claus aus Leipzig (talk) 17:11, 19 March 2023 (UTC)Reply

({T,F}, XOR) is an Abelian Group?

edit

What is the identity element of this group? 181.209.152.189 (talk) 00:33, 17 April 2024 (UTC)Reply

T XOR F = T
F XOR F = F
Thus F is the identity element.
Alazn02 (talk) 17:46, 15 May 2024 (UTC)Reply