FACTOID # 6: Michigan is ranked 22nd in land area, but since 41.27% of the state is composed of water, it jumps to 11th place in total area.
 
 Home   Encyclopedia   Statistics   States A-Z   Flags   Maps   FAQ   About 
   
 
WHAT'S NEW
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Exclusive disjunction

Exclusive disjunction, also known as exclusive or and symbolized by XOR or EOR, is a logical operation on two operands that results in a logical value of true if and only if one of the operands, but not both, has a value of true. In mathematics, a finitary boolean function is a function of the form f : Bk → B, where B = {0, 1} is a boolean domain and where k is a nonnegative integer. ... In logic and mathematics, a logical value, also called a truth value, is a value indicating to what extent a proposition is true. ...

Contents

XOR Logic Gate Symbol Remark: Accidentially uploaded the symbol for XNOR here first. ... XOR Logic Gate Symbol Remark: Accidentially uploaded the symbol for XNOR here first. ... A logic gate performs a logical operation on one or more logic inputs and produces a single logic output. ...

[edit]

Definition

In many natural languages, English included, the interpretation of the word "or" requires a certain amount of care. The exclusive disjunction of a pair of propositions, (p, q), means that p is true or q is true, but not both. For example, the normal intention of a statement like "You can follow the rules or be disqualified" is to stipulate that exactly one of the conditions can be true. In logic, however, the default meaning of the word "or" is the inclusive disjunction, which signifies that at least one of the alternatives is true. Other languages, such as Latin, may have different words for these different types of "or". The English language is a West Germanic language that originates in England. ... OR logic gate. ... Latin is an ancient Indo-European language originally spoken in Latium, the region immediately surrounding Rome. ...


Exclusive disjunction is an operation on two logical values, typically the values of two propositions, that produces a value of true just in case exactly one of its operands is true. In mathematics, a finitary boolean function is a function of the form f : Bk → B, where B = {0, 1} is a boolean domain and where k is a nonnegative integer. ... In logic and mathematics, a logical value, also called a truth value, is a value indicating to what extent a proposition is true. ... Proposition is a term used in logic to describe the content of assertions. ...


The truth table of p XOR q (also written as p + q, p ⊕ q, or p ≠ q) is as follows: Truth tables are a type of mathematical table used in logic to determine whether an expression is true or whether an argument is valid. ...

Exclusive Disjunction
p q p XOR q
F F F
F T T
T F T
T T F

The following equivalents can then be deduced:

begin{matrix} p + q & = & (p land lnot q) & lor & (lnot p land q)   & = & (p lor q) & land & (lnot p lor lnot q)   & = & (p lor q) & land & lnot (p land q) end{matrix}

Generalized or n-ary XOR is true when the number of 1-bits is odd.

[edit]

Alternative symbols

The symbol used for exclusive disjunction varies from one field of application to the next, and even depends on the properties being emphaisized in a given context of discussion. In addition to the abbreviation "XOR", any of the following symbols may also be seen:

  • A plus sign (+). This makes sense mathematically because exclusive disjunction corresponds to addition modulo 2, which has the following addition table, clearly isomorphic to the one above:
Addition Modulo 2
p q p + q
0 0 0
0 1 1
1 0 1
1 1 0
  • The use of the plus sign has the added advantage that all of the ordinary algebraic properties of mathematical rings and fields can be used without further ado. However, the plus sign is also used for Inclusive disjunction in some notation systems.
  • A plus sign that is modified in some way, such as being encircled (⊕). This usage faces the objection that this same symbol is already used in mathematics for the direct sum of algebraic structures.
  • An inclusive disjunction symbol (∨) that is modified in some way, such as being underlined () or with dot above (dotvee).
  • In several programming languages, such as C, C++ and Java, a caret (^) is used to denote the bitwise XOR operator. This is not used outside of programming contexts because it is too easily confused with other uses of the caret.
  • The symbol Image:xor.png.
  • In IEC symbology, an exclusive or is marked "=1".
[edit]

3 + 2 with apples, a popular choice in textbooks Addition is the basic operation of arithmetic. ... Modular arithmetic (sometimes called modulo arithmetic) is a system of arithmetic for integers, where numbers wrap around after they reach a certain value — the modulus. ... In mathematics, an isomorphism (in Greek isos = equal and morphe = shape) is a kind of mapping between objects, devised by Eilhard Mitscherlich, which shows a relation between two properties or operations. ... In mathematics, a ring is an algebraic structure in which addition and multiplication are defined and have properties listed below. ... In abstract algebra, a field is an algebraic structure in which the operations of addition, subtraction, multiplication and division (except division by zero) may be performed, and the same rules hold which are familiar from the arithmetic of ordinary numbers. ... In abstract algebra, the direct sum is a construction which combines several vector spaces (or groups, or abelian groups, or modules) into a new, bigger one. ... A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer. ... Wikibooks has a book on the topic of C Programming The C programming language (often, just C) is a general-purpose, procedural, imperative computer programming language developed in the early 1970s by Dennis Ritchie for use on the Unix operating system. ... C++ (generally pronounced /si plʌs plʌs/) is a general-purpose, high-level programming language with low-level facilities. ... Java is an object-oriented programming language developed by James Gosling and colleagues at Sun Microsystems in the early 1990s. ... Image File history File links Xor. ...

Equivalent expressions

The exclusive disjunction p + q! can be expressed in terms of the conjunction (∧), the disjunction (∨), and the negation (¬) as follows:

begin{matrix} p + q & = & (p land lnot q) lor (lnot p land q) end{matrix}

The exclusive disjunction p + q! can also be expressed in the following way:

begin{matrix} p + q & = & lnot (p land q) land (p lor q) end{matrix}

This representation of XOR may be found useful when constructing a circuit or network, because it has only one ¬ operation and small number of ∧ and ∨ operations. The proof of this identity is given below:

begin{matrix} p + q & = & (p land lnot q) & lor & (lnot p land q)  & = & ((p land lnot q) lor lnot p) & and & ((p land lnot q) lor q)  & = & ((p lor lnot q) land (lnot q lor lnot p)) & land & ((p lor q) land (lnot q lor q))  & = & (lnot p lor lnot q) & land & (p lor q)  & = & lnot (p land q) & land & (p lor q) end{matrix}

It is sometimes useful to write p XOR q in the following way:

begin{matrix} p + q & = & lnot ((p land q) lor (lnot p land lnot q)) end{matrix}

This equivalence can be established by applying De Morgan's laws twice to the fourth line of the above proof. note that demorgans laws are also a big part in circut design. ...

[edit]

Associativity and commutativity

In view of the isomorphism between addition modulo 2 and exclusive disjunction, it is clear that XOR is both an associative and a commutative operation. Thus parentheses may be omitted in successive operations and the order of terms makes no difference to the result. For example, we have the following equations: In mathematics, an isomorphism (in Greek isos = equal and morphe = shape) is a kind of mapping between objects, devised by Eilhard Mitscherlich, which shows a relation between two properties or operations. ... In mathematics, associativity is a property that a binary operation can have. ... In mathematics, especially abstract algebra, a binary operation * on a set S is commutative if x * y = y * x for all x and y in S. Otherwise * is noncommutative. ...

begin{matrix} p + q & = & q + p   (p + q) + r & = & p + (q + r) & = & p + q + r end{matrix}
[edit]

Properties

This section uses the following symbols:

begin{matrix} 0 & = & mbox{false}  1 & = & mbox{true}  lnot p & = & mbox{not} p  p + q & = & p mbox{xor} q  p land q & = & p mbox{and} q  p lor q & = & p mbox{or}  q end{matrix}

The following equations follow from logical axioms:

begin{matrix} p + 0 & = & p  p + 1 & = & lnot p  p + p & = & 0  p + lnot p & = & 1   p + q & = & q + p  p + q + p & = & q  p + (q + r) & = & (p + q) + r  p + q & = & lnot p + lnot q  lnot (p + q) & = & lnot p + q & = & p + lnot q   p + (lnot p land q) & = & p lor q  p + (p land lnot q) & = & p land q  p + (p lor q) & = & lnot p land q  lnot p + (p lor lnot q) & = & p lor q  p land (p + lnot q) & = & p land q  p lor (p + q) & = & p lor q end{matrix}
[edit]

Bitwise operation

Exclusive disjunction is often used for bitwise operations. Examples:

  • 1 xor 1 = 0
  • 1 xor 0 = 1
  • 1110 xor 1001 = 0111 (this is equivalent to addition without carry)

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 (Z/2Z)^n. The term carry may refer to: A violation whilst dribbling in the game of basketball. ... In mathematics, a vector space (or linear space) is a collection of objects (known as vectors) which may be scaled and added; all linear combinations of vectors are themselves vectors. ...

[edit]

Computer science

In computer science, exclusive disjunction has several uses:

  • It tells whether two bits are unequal.
  • It is an optional bit-flipper (the deciding input chooses whether to invert the data input).
  • It tells whether there are an odd number of 1 bits (A ⊕ B ⊕ C ⊕ D ⊕ E is true iff an odd number of the variables are true).

On some computer architectures, it is more efficient to store a zero in a register by xor-ing the register with itself (bits xor-ed with themselves are always zero) instead of loading and storing the value zero. In simple threshold activated neural networks, modelling the 'xor' function requires a second layer because 'xor' is not a linearly-separable function. Negation (i. ... In mathematics, the parity of an object refers to whether is is even or odd. ... IFF, Iff or iff can stand for: Interchange File Format - a computer file format introduced by Electronic Arts Identification, friend or foe - a radio based identification system utilizing transponders iff - the mathematics concept if and only if International Flavors and Fragrances - a company producing flavors and fragrances International Freedom Foundation... In computer science, efficiency is used to describe several desirable properties of an algorithm or other construct, besides clean design, functionality, etc. ... Simplified view of an artificial neural network A neural network is a system of interconnecting neurons in a network working together to produce an output function. ...


Exclusive-or is sometimes used as a simple mixing function in cryptography, for example, with one-time pad or Feistel network systems. The German Lorenz cipher machine, used in World War II for encryption of very high-level general staff messages Cryptography (or cryptology; derived from Greek κρυπτός kryptós hidden, and γράφειν gráfein to write) is the study of message secrecy. ... Excerpt from a one-time pad. ... In cryptography, a Feistel cipher is a block cipher with a particular structure, named after IBM cryptographer Horst Feistel; it is also commonly known as a Feistel network. ...


XOR is used in RAID 3–6 for creating parity information. For example, RAID can "back up" bytes 10011100 and 01101100 from two (or more) hard drives by XORing (11110000) and writing to an another drive. Under this method, if any one of the four hard drives are lost, the lost byte can be re-created by XORing bytes from the remaining drives. If the drive containing 01101100 is lost, 10011100 and 11110000 can be XORed to recover the lost byte. In computing, a redundant array of inexpensive disks, also later known as redundant array of independent disks (commonly abbreviated RAID) is a system which uses multiple hard drives to share or replicate data among the drives. ...


XOR is also used to detect an overflow in the result of a signed binary arithmetic operation. If the leftmost retained bit of the result is not the same as the infinite number of digits to the left, then that means overflow occurred. XORing those two bits will give a "one" if there is an overflow.


XOR can be used to swap two numeric variables in computers, using the XOR swap algorithm; however this is regarded as more of a curiosity and not encouraged in practice. It has been suggested that this article or section be merged with swap (computer science). ... Wikisource has original text related to this article: Xor swap algorithm In computer programming, the xor swap is an algorithm which uses the exclusive disjunction (XOR) operation to swap distinct values of variables having the same data type without using a temporary variable. ...


In C/C++ the bitwise operator XOR is represented by the ' ^ ' character.

[edit]

See also

[edit]

Logical operators

[edit]

AND Logic Gate In logic and mathematics, logical conjunction (usual symbol and) is a two-place logical operation that results in a value of true if both of its operands are true, otherwise a value of false. ... OR logic gate. ... XNOR Logic Gate Symbol Logical equality is a logical operator that corresponds to equality in boolean algebra and to the logical biconditional in propositional calculus. ... In logical calculus of mathematics, the logical conditional (also known as the material implication, sometimes material conditional) is a binary logical operator connecting two statements, if p then q where p is a hypothesis (or antecedent) and q is a conclusion (or consequent). ... NAND Logic Gate The Sheffer stroke, |, is the negation of the conjunction operator. ... NOR Logic Gate The logical NOR or joint denial is a boolean logic operator which produces a result that is the inverse of logical or. ... Negation (i. ...

Related topics


 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m