Negation
Encyclopedia : N : NE : NEG : Negation
In logic and mathematics, negation is an operation on logical values, for example, the logical value of a proposition, that sends true to false and false to true.
Definition
Logical negation is an operation on one logical value, typically the value of a proposition, that produces a value of true when its operand is false and a value of false when its operand is true.
The truth table for NOT p (also written as ~p or ¬p) is as follows:
| p | ¬p |
|---|---|
| F | T |
| T | F |
The logical negation of a proposition p is notated in different ways in various contexts of discussion and fields of application. Among these variants are the following:
| Notation | Vocalization |
|---|---|
| [\bar] | bar p |
| [p'\!] | p prime, p complement |
| [!p\!] | bang p |
No matter how it is notated or symbolized, the logical negation ¬p is read as "it is not the case that p", or usually more simply as "not p".
- Within a system of classical logic, double negation, that is, the negation of the negation of a propostion p, is logically equivalent to the initial proposition p. Expressed in symbolic terms, ¬(¬p) ⇔ p.
- Within a system of intuitionistic logic, however, ¬¬p is a weaker statement than p. On the other hand, the logical equivalence ¬¬¬p ⇔ ¬p remains valid.
Algebraically, logical negation corresponds to the complement in a Boolean algebra (for classical logic) or a Heyting algebra (for intuitionistic logic).
Computer science
As in mathematics, negation is used in computer science to construct logical statements.
if (!(r == t))
The ! signifies logical NOT in C and languages with a C-inspired syntax such as C++, Java, JavaScript, and Perl. "NOT" is the operator used in ALGOL 60, BASIC, and languages with an ALGOL-inpsired syntax such as Pascal, Ada, and Eiffel.
In computer science there is also bitwise negation. This takes the value given and switches all the binary 1's to 0's and 0's to 1's. See bitwise operation. This is often used to create ones' complement or "~" in C or C++ and two's complement (just simplified to "-" or the negative sign) as it basically creates the opposite (negative value equivalent) or mathematical complement of the value (where both values are added together they create a whole).
Take the following for example:
Say we wanted to get the absolute (positive equivalent) value of a given integer to following would work as the "-" changes it from negative to positive (we know it is negative because it is true that "x < 0")
unsigned int abs(int x)
To demonstrate logical negation:
unsigned int abs(int x)
Inverting the condition and reversing the outcomes produces code that is logically equivalent to the original code, i.e. will have identical results for any input. (Note that depending on the compiler used, the actual instructions performed by the computer may differ.)
Similarly, the following is equivalent on two's complement machines:
unsigned int abs(int x)
However, since this relies on the binary representation of integers, it will not work on machines that do not use a two's-complement representation for negative numbers.
References
- Horn, L., A Natural History of Negation, Stanford 2001.
- von Wright, G.H., "On the Logic of Negation", Commentationes Physico-Mathematicae, vol. 22, 1953–1959.
See also
External links
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
