Formal logic inference rules for constructing and validating proofs. Use when building deductive arguments or checking proof validity.
Install
npx skillscat add biruk741/cc-plugins/formal-logic Install via the SkillsCat registry.
SKILL.md
Formal Logic Reference
Valid Inference Rules
| Rule | Form | Natural Language |
|---|---|---|
| Modus Ponens | P, P→Q ⊢ Q | If P, and P implies Q, then Q |
| Modus Tollens | P→Q, ¬Q ⊢ ¬P | If P implies Q, and Q is false, then P is false |
| Hypothetical Syllogism | P→Q, Q→R ⊢ P→R | Chain implications |
| Disjunctive Syllogism | P∨Q, ¬P ⊢ Q | If P or Q, and not P, then Q |
| Conjunction Introduction | P, Q ⊢ P∧Q | Combine two truths |
| Conjunction Elimination | P∧Q ⊢ P | Extract from conjunction |
| Double Negation | ¬¬P ⊢ P | Remove double negative |
| Reductio ad Absurdum | (P → ⊥) ⊢ ¬P | If P leads to contradiction, P is false |
| Case Analysis | P∨Q, P→R, Q→R ⊢ R | Prove by cases |
| Process of Elimination | exactly_one(A,B,C), ¬A, ¬B ⊢ C | Eliminate impossibles |
Debugging Proof Patterns
Null Pointer Identification
P1: Error is NullPointerException at line X
P2: Line X dereferences variable V
P3: V is null iff condition C holds
P4: Evidence shows C held
─────────────────────────────────────
∴ V was null (Modus Ponens on P3, P4)
∴ V being null caused the error (Conjunction P1, P2)Root Cause by Elimination
P1: Error caused by exactly one of {A, B, C}
P2: Evidence shows A did not occur
P3: Evidence shows B did not occur
─────────────────────────────────────
∴ C caused the error (Process of Elimination)Fix Correctness
P1: Error occurs iff condition BAD holds
P2: Fix ensures condition GOOD holds
P3: GOOD → ¬BAD (mutually exclusive)
─────────────────────────────────────
∴ With fix, ¬BAD holds (Modus Ponens P2, P3)
∴ Fix prevents error (Modus Tollens on P1)Fallacies to AVOID
| Fallacy | Form | Why Invalid |
|---|---|---|
| Affirming Consequent | P→Q, Q ⊢ P | Q could have other causes |
| Denying Antecedent | P→Q, ¬P ⊢ ¬Q | Q could still be true |
| Hasty Generalization | Some X are Y ⊢ All X are Y | Sample ≠ population |
| Post Hoc | A before B ⊢ A caused B | Correlation ≠ causation |
| Appeal to Probability | X is likely ⊢ X is true | Likely ≠ certain |
Notation
| Symbol | Meaning |
|---|---|
| P, Q, R | Propositions |
| ¬ | NOT |
| ∧ | AND |
| ∨ | OR |
| → | IF...THEN |
| ⊢ | Therefore |
| ∎ | QED |
| ⊥ | Contradiction |