kids encyclopedia robot

Negation facts for kids

Kids Encyclopedia Facts
Quick facts for kids
Negation
NOT
Venn diagram of Negation
Definition \lnot{x}
Truth table (10)
Logic gate NOT ANSI.svg
Normal forms
Disjunctive \lnot{x}
Conjunctive \lnot{x}
Zhegalkin polynomial 1 \oplus x
Post's lattices
0-preserving no
1-preserving no
Monotone no
Affine yes

In logic, negation is a basic idea that means "the opposite of" or "not true". It's also called the logical not.

Imagine you have a statement, like "The sky is blue." Negation takes this statement and turns it into "The sky is not blue." If the first statement is true, its negation is false. If the first statement is false, its negation is true.

We often write negation using symbols like \neg P, \mathord{\sim} P, or \overline{P}. The letter P here just stands for any statement. So, \neg P means "not P" or "P is not true."

What is Negation?

Negation is a way to change the truth value of a statement. If a statement is true, its negation becomes false. If a statement is false, its negation becomes true.

For example:

  • If the statement "It is raining" is true, then "It is not raining" is false.
  • If the statement "The cat is flying" is false, then "The cat is not flying" is true.

This is how negation works in classical logic, which is the most common type of logic.

Truth Table for Negation

A truth table shows all possible outcomes for a logical operation. For negation, it's very simple:

 P  \neg P
True False
False True

This table shows that if statement P is true, then \neg P (not P) is false. If P is false, then \neg P is true.

How to Write Negation

There are many ways to write or symbolize negation, depending on where you see it. Here are some common notations:

Notation Plain Text How to say it
\neg p ¬p , 7p Not p
\mathord{\sim} p ~p Not p
-p -p Not p
Np En p (This is from Polish notation)
p' p' p prime, or p complement
\overline{p} ̅p p bar, or Bar p
!p !p Bang p, or Not p

In Set theory, the symbol \setminus can mean "not in the set of." For example, U \setminus A means "all members of set U that are not members of set A."

No matter how it's written, \neg P can always be read as "it is not the case that P," or simply "not P."

Key Properties of Negation

Double Negation

In classical logic, if you negate a statement twice, you get back to the original statement. This is called double negation. For example, "It is not true that it is not raining" means the same as "It is raining." In symbols, this is written as \neg \neg P \equiv P. The symbol \equiv means "is logically the same as."

Distributing Negation (De Morgan's Laws)

De Morgan's laws show how negation works with "and" (\land) and "or" (\lor) statements.

  • If you negate "P or Q," it's the same as "not P and not Q."

\neg(P \lor Q) \equiv (\neg P \land \neg Q)

  • If you negate "P and Q," it's the same as "not P or not Q."

\neg(P \land Q) \equiv (\neg P \lor \neg Q)

These laws are very useful in logic and computer science.

Negating Quantifiers

In first-order logic, we use quantifiers like "for all" (\forall) and "there exists" (\exists). Negation changes these too:

  • Negating "for all x, P is true" (Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \neg \forall x P(x) ) is the same as "there exists an x for which P is not true" (Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \exists x \neg P(x) ).

* Example: "It is not true that all students are happy" means "Some student is not happy."

  • Negating "there exists an x for which P is true" (Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \neg \exists x P(x) ) is the same as "for all x, P is not true" (Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \forall x \neg P(x) ).

* Example: "It is not true that some birds can't fly" means "All birds can fly."

Negation in Computer Programming

Negation is very important in computer science and programming languages. It helps computers make decisions.

For example, in many programming languages like C++, Java, and JavaScript, the exclamation mark "!" means logical NOT.

if (!(r == t)) // This means "if r is NOT equal to t"
{
    // ... do something when r is not equal to t ...
}

Many languages also have a shorter way to write "not equal to," like `!=`. So, `if (r != t)` means the same thing as `if (!(r == t))`.

Computers also use bitwise negation. This changes all the 1s to 0s and 0s to 1s in a binary number. This is used in low-level programming.

Here's another example of logical negation in programming:

unsigned int abs(int x)
{
    if (!(x < 0)) // This means "if x is NOT less than 0" (so x is 0 or positive)
        return x; // Return x as is
    else
        return -x; // If x IS less than 0 (negative), return its positive version
}

This code finds the absolute value of a number. The `!(x < 0)` part is a logical negation. It means "it is not true that x is less than 0."

Sometimes, you might hear people use "!" in everyday talk, especially in computer-related slang. For example, "!voting" means "not voting," and "!clue" means "no clue" or "clueless."

Images for kids

kids search engine
Negation Facts for Kids. Kiddle Encyclopedia.