Propositional Logic
What's a proposition?
Proposition:
a statement or assertion that expresses a judgment or opinion. (Google.com)
Proposition:
a declarative sentence (that is, a sentence that declares a fact) that is either true or false, but not both.
Some propositions
- George is a lecturer
- Honolulu is the capital of Hawaii
- The temperature outside is 90 degrees
What isn't a proposition?
- Watch this screencast
- How much time is left in this screencast?
- x > 5
- This statement is false
Propositional Variables
- We typically use the letters p, q, r, s ...
- Each value can either be true or false (T/F)
- We'll see what this has to do with computers later
Compound Propositions
- Each of the letters are "atoms"
- Make more "interesting" propositions with atoms and logical operators.
Logical Operators
Negation
Negation:
If p is a proposition, then ¬p is the opposite of the truth value of p.
Disjunction:
Let p and q be propositions. The disjunction p v q is equivalent to logical OR. The disjunction is false if both p and q are false and true otherwise.
Conjunction:
Let p and q be propositions. The conjunction p Λ q is equivalent to logical AND. The conjunction is true if both p and q are true and false otherwise.
Exclusive Or:
Let p and q be propositions. The Exclusive Or of p and q is p ⊕ q and is equivalent to logical XOR. Exclusive or is true if either p or q are true but not both.
Conditionals
Conditional:
Let p and q be propositions. The conditional statement p → q is the proposition "if p then q". The conditional is false when p is true and q is false and true otherwise.
Converse:
Let p and q be propositions. The converse of the proposition p → q is q → p.
Inverse:
Let p and q be propositions. The inverse of the proposition p → q is ¬p → ¬q.
Contrapositive:
Let p and q be propositions. The contrapositive of the proposition p → q is ¬q → ¬p.
Equivalence:
A conditional statement is equivalent to its contrapositive. The converse of a conditional statement is equivalent to the inverse.
Biconditional:
Let p and q be propositions. The biconditional statement p ↔ q is the proposition "p if and only if q". The conditional is true when p and q have the same truth value and false otherwise.
Truth Tables
// One Truth Variable
p
--
T
F
// Two truth variables
p | q
-----
T | T
T | F
F | T
F | F
// Three variables
p | q | r
---------
T | T | T
T | T | F
T | F | T
T | F | F
F | T | T
F | T | F
F | F | T
F | F | F
The number of rows is 2^n
Logic and Bit Operations
Computers use binary
- 1's and 0's (T and F)
- A chain of 1's and 0's are a bitstring
- Bitstrings are typically split into groups of 4 (Hexadecimal)
- Read 1.2 to see some applications
ics141-propositional-logic
By George Lee
ics141-propositional-logic
A presentation on logics.
- 1,291