End of Lesson
End of Lesson
In symbolic logic, we have five main logical operators — Negation, Conjunction, Disjunction, Implication, and Biconditional. These operators allow us to build any kind of compound statement from simple ones.
Negation is the simplest logical operator. If we have a statement p, its negation is simply "not p."
Let p = "It is raining." Then ~p = "It is not raining."
The statement p and its negation ~p are always opposites: one must be true, the other must be false.
Negation is denoted by ~ or sometimes by a bar over the statement. In our course, we will use ~p to mean "not p".
Negation is called a unary operator because it acts on a single statement. It flips its truth value. If p is true, ~p is false. If p is false, ~p is true.
p = true if user is logged in.
if (p = true) print "Hello User"
if (~p = true) print "User is not logged in."
In this coding example, we use negation to create opposite conditions.
Negation is everywhere in reasoning: whenever someone denies, rejects, or flips the truth of a statement, they are using negation.
A truth table is a table that explains all the possible combinations a statement can have. A single statement can have two possible states, true or false. So a truth table with a single variable will always only have two rows. The number of rows expand with more variables which we will see in next lessons.
Click on a cell to change its value to true or false. Press the submit button when you think you have gotten it right.
| p | ~p |
|---|---|
| F | |
| T |