Logic
Propositions are statements that are either true or false.
are propositions.
Conjunction
Conjunction is the && operator in C++. We write it as .
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | F |
Or
Conjunction is the || operator in C++. We write it as .
| T | T | T |
| T | F | T |
| F | T | T |
| F | F | F |
Not
!= in C++.
| T | F |
| F | T |
Conditional Proposition
Pretty much the if statement in C++
Code
if (p)
do q;Truth Table
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |
Creating New Propositions
Based on , we can make 3 new propositions:
- Converse:
- Inverse:
- Contrapositive
The contrapositive is the only statement necessarily logically equivalent to the .
Biconditional Proposition
P happens if and only if q.
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | T |
Logical Equivalence
Two propositions produce the same ouput.
Example
Is logically equivalent to ?
| p | q | ||
|---|---|---|---|
| T | T | T | F |
| T | F | F | F |
| F | T | F | F |
| F | F | F | T |
Nope.
DeMorgan’s Law
Rules
Addition
Given is true, must be true.
Modus Ponens
Given and is true, must be true.
Negating Quantifiers
Examples
: x is an accountant : x owns a Porsche
All accountants own Porches:
To negate,
is not true.