- past of negate
In logic and mathematics, negation or not is an operation on logical values, for example, the logical value of a proposition, that sends true to false and false to true. Intuitively, the negation of a proposition holds exactly when that proposition does not hold. In grammar, nor is an adverb which acts as a coordinating conjunction.
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. So, if statement A is true, then ¬A (pronounced "not A") would therefore be false; and conversely, if ¬A is true, then A would be false.
The truth table of ¬p (also written as ~p or NOT p) is as follows:
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:
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 intuitionistic logic, however, ¬¬p is a weaker statement than p. On the other hand, the logical equivalence ¬¬¬p ⇔ ¬p remains valid.
Logical negation can be defined in terms of other logical operations. For example, ¬p can be defined as p → F, where "→" is logical implication and F is absolute falsehood. Conversely, one can define F as p & ¬p for any proposition p, where "&" is logical conjunction. The idea here is that any contradiction is false. While these ideas work in both classical and intuitionistic logic, they don't work in Brazilian logic, where contradictions are not necessarily false. But in classical logic, we get a further identity: p → q can be defined as ¬p ∨ q, where "∨" is logical disjunction.
Algebraically, logical negation corresponds to the complement in a Boolean algebra (for classical logic) or a Heyting algebra (for intuitionistic logic).
- distributivity: ~(a \equiv b) \equiv (~a \equiv b)
If there exists a0, a1, ... , an \in such that f(b1, ... , bn) = a0 ⊕ (a1 \land b1) ⊕ ... ⊕ (an \land bn), for all b1, ... , bn \in .
Another way to express this is that each variable always makes a difference in the truth-value of the operation or it never makes a difference. Negation is a linear logical operator.
If f(a1, ... , an) = ~f(~a1, ... , ~an) for all a1, ... , an \in . Negation is a self dual logical operator.
Computer scienceAs in mathematics, negation is used in computer science to construct logical statements.
if (!(r == t))
In computer science there is also bitwise negation. This takes the value given and switches all the binary 1s to 0s and 0s to 1s. 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 since this is equivalent to taking the arithmetic negative value of the number) 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 unsigned int abs(int x)