🧪 Practical: Interactive Propositional Logic Demos
🎯 What You'll Do
- Build and explore truth tables interactively
- Evaluate propositional formulas under custom assignments
- Practice with connectives and precedence
1. Truth Table Generator
Enter a propositional formula using variables (P, Q, R, S) and connectives. The tool will generate the complete truth table.
Syntax: Use P, Q, R, S for variables. Connectives: ¬ (NOT), ∧ (AND), ∨ (OR), → (IMPLIES), ↔ (IFF)
You can also use: ! for ¬, & for ∧, | for ∨, -> for →, <-> for ↔
Click "Generate Truth Table" to see the result.
2. Formula Evaluator
Set specific truth values for variables and evaluate a formula step by step.
Set Variable Values:
Click "Evaluate" to see the step-by-step evaluation.
3. Equivalence Checker
Enter two formulas and check if they are logically equivalent (have the same truth table).
Click "Check Equivalence" to compare the two formulas.
4. Practice Exercises
Use the tools above to solve these exercises:
Exercise 1: Truth Table Classification
Generate truth tables for each formula and classify as tautology, contradiction, or contingency:
- P ∨ ¬P
- P ∧ ¬P
- (P → Q) ↔ (¬Q → ¬P)
- P → (Q → P)
- (P → Q) → (¬P → ¬Q)
Exercise 2: Equivalence Verification
Use the equivalence checker to verify:
- ¬(P ∧ Q) ≡ ¬P ∨ ¬Q (De Morgan's)
- P → Q ≡ ¬P ∨ Q (Material Implication)
- P ↔ Q ≡ (P → Q) ∧ (Q → P)
- P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R) (Distribution)
Exercise 3: SAT Counting
For each formula, count the number of satisfying assignments using the truth table:
- (P ∨ Q) ∧ (¬P ∨ R) — how many of the 8 assignments satisfy it?
- (P → Q) ∧ (Q → R) ∧ (R → P) — how many satisfying assignments?
- P ↔ Q ↔ R — how many?
5. Quick Reference: Connective Symbols
| Connective | Symbol | Keyboard Shortcut | Meaning |
|---|---|---|---|
| NOT | ¬ | ! | Negation |
| AND | ∧ | & | Conjunction |
| OR | ∨ | | | Disjunction |
| IMPLIES | → | -> | Implication |
| IFF | ↔ | <-> | Biconditional |