Discrete Mathematics — Lesson 3
Notes By Pr. El Hadiq Zouhair
1 / 15You will learn about propositional equivalences, satisfiability, and normal forms.
2 / 15| Satisfiable | Tautology | |
|---|---|---|
| Tautology | ✔ | ✔ |
| Contingency | ✔ | ✘ |
| Contradiction | ✘ | ✘ |
Two propositions $p$ and $q$ are equivalent if and only if $p \Leftrightarrow q$ is a tautology.
| Law | Equivalence 1 | Equivalence 2 |
|---|---|---|
| Identity | $p \land \top \Leftrightarrow p$ | $p \lor \bot \Leftrightarrow p$ |
| Domination | $p \lor \top \Leftrightarrow \top$ | $p \land \bot \Leftrightarrow \bot$ |
| Idempotency | $p \lor p \Leftrightarrow p$ | $p \land p \Leftrightarrow p$ |
| Double Negation | $\lnot(\lnot p) \Leftrightarrow p$ | |
| Commutativity | $p \lor q \Leftrightarrow q \lor p$ | $p \land q \Leftrightarrow q \land p$ |
| Associativity | $p \lor (q \lor r) \Leftrightarrow (p \lor q) \lor r$ | $p \land (q \land r) \Leftrightarrow (p \land q) \land r$ |
| Distributivity | $p \lor (q \land r) \Leftrightarrow (p \lor q) \land (p \lor r)$ | $p \land (q \lor r) \Leftrightarrow (p \land q) \lor (p \land r)$ |
| De Morgan's | $\lnot(p \land q) \Leftrightarrow \lnot p \lor \lnot q$ | $\lnot(p \lor q) \Leftrightarrow \lnot p \land \lnot q$ |
| Absorption | $p \lor (p \land q) \Leftrightarrow p$ | $p \land (p \lor q) \Leftrightarrow p$ |
| Negation | $p \lor \lnot p \Leftrightarrow \top$ | $p \land \lnot p \Leftrightarrow \bot$ |
Simplify: "These potatoes are sweet and salty or they are salty, spicy and (salty or spicy)."
Result: "These potatoes are salty and spicy, or salty and sweet."
6 / 15All logical operators can be expressed using basic operators ($\lnot$, $\land$, $\lor$).
| Operator | Equivalence |
|---|---|
| Conditional | $p \to q \;\Leftrightarrow\; \lnot p \lor q$ |
| Bicond. to Cond. | $(p \Leftrightarrow q) \;\Leftrightarrow\; (p \to q) \land (\lnot p \to \lnot q)$ |
| Biconditional | $(p \Leftrightarrow q) \;\Leftrightarrow\; (p \land q) \lor (\lnot p \land \lnot q)$ |
A DNF proposition is the disjunction of one or more conjunctions.
From our example: $(\textit{salty} \land \textit{spicy}) \lor (\textit{salty} \land \textit{sweet})$ is in DNF.
Translate: "You are either for me or against me" $\;\longrightarrow\; f \oplus a$
Problem: Find the logical expression that is true when exactly 2 or 3 of $\{a,b,c,d\}$ are true.
Other normal forms are also possible:
| Form | $x \oplus y$ expressed as … |
|---|---|
| DNF | $(x \land y) \lor (\lnot x \land \lnot y)$ |
| CNF | $(\lnot x \lor y) \land (x \lor \lnot y)$ |
| NAND | $(x \barwedge y) \barwedge (\lnot x \barwedge \lnot y)$ |
| NOR | $(\lnot x \downarrow y) \downarrow (x \downarrow \lnot y)$ |
Convert $(\lnot p \lor q) \land (\lnot p \lor \lnot r) \land (\lnot q \lor r)$ to DNF:
simplify_logic (SymPy) to simplify Boolean expressions automatically.| SymPy function | Replaces Wolfram |
|---|---|
not satisfiable(Not(expr)) | TautologyQ |
bool(satisfiable(expr)) | SatisfiableQ |
simplify_logic(expr) | BooleanMinimize |
to_dnf(expr, simplify=True) | BooleanConvert[…,"DNF"] |
to_cnf(expr, simplify=True) | BooleanConvert[…,"CNF"] |