Boolean Operations
A Little Propositonal Calculus This is foundational to the rules of logic. This is the algebra of booean objects. We will learn both the mathematical and Python notations.
The prefix unary operator \(\sim\) Boolean functions are defined via truth-tables, which we show here. You can prove theorems about boolean relations by using truth-tables.
This is negation.
\(P\) | \(\sim P\) |
---|---|
T | F |
F | T |
The infix binary operator \(\vee\)
\(P\) | \(Q\) | \(P\vee Q\) |
---|---|---|
T | T | T |
T | F | T |
F | T | T |
F | F | F |
The infix binary operator \(\wedge\)
\(P\) | \(Q\) | \(P\wedge Q\) |
---|---|---|
T | T | T |
T | F | F |
F | T | F |
F | F | F |
This is implication, or if-then
\(P\) | \(Q\) | \(P\implies Q\) |
---|---|---|
T | T | T |
T | F | F |
F | T | F |
F | F | F |
\(P\) | \(Q\) | \((\sim P)\vee Q\) |
---|---|---|
T | T | T |
T | F | F |
F | T | F |
F | F | F |
An expression in boolean objects and operators is called a predicate. All predicates evaluate to true or false, depending on the truth or falsity of the boolean objects making them up.
An expression is a tautology if it is always true. Here is a tautology.
Data Structures: Sequences
Lists
Tuples