Abstract
- Exclusive OR, not equal
- Returns true only when 2 inputs aren’t the same
Self-Inverse
XOR summation
Given a list of Integer (整数) , let be the XOR summation of the list of integers , and then we put into the list. Shuffle the list randomly
Now when we pick the first element or a random element from the list, we are sure it is the XOR summation of the rest of the integers
Proof using Cases and Self-inverse, Own-Inverse and Commutativity (交换律). There are 2 possible outcomes of picking a random integer from the list
- , is the XOR summation by definition
- , is an integer that is in the given list
- For to be the XOR Summation of the rest of the elements, it must fulfil the following
- We can expand the at the RHS, and we get
- We can re-arrange the RHS with commutativity, and we get
- With Self-Inverse and Own-Inverse, we can reduce the RHS to
- Since RHS is equal to LHS, is valid. Thus is the XOR summation of the rest of the elements
Practice problem: Codeforces - XOR Mixup
Own-Inverse
Chemistry with Self-Inverse
Given , we can get back by . Because based on Self-Inverse, and based on Own-Inverse
Logic Gate Implementation
The Mathematical Statement is