Logic Operators & Inference Rules

Building Blocks of Logical Reasoning

Back to Lecture Overview

Introduction

Logic operators and inference rules form the foundation of logical reasoning in AI systems. This topic covers the essential logical connectives and the fundamental patterns of reasoning that allow knowledge-based agents to derive new conclusions from existing knowledge.

What You'll Learn:
  • The five essential logical operators
  • Truth conditions for each operator
  • Classic inference rules and patterns
  • How to identify valid vs invalid reasoning
Why This Matters:
  • Foundation for all logical reasoning
  • Essential for building reliable AI systems
  • Critical for understanding automated theorem proving
  • Basis for more advanced reasoning techniques

Essential Logic Operators

Logic operators (also called logical connectives) combine atomic propositions to form complex logical statements.

Conjunction (AND)

P ∧ Q

Meaning: Both P and Q must be true

P Q P ∧ Q
F F F
F T F
T F F
T T T
Example: "It's raining AND it's cold"
True only when both conditions are met simultaneously.

Disjunction (OR)

P ∨ Q

Meaning: At least one of P or Q must be true

P Q P ∨ Q
F F F
F T T
T F T
T T T
Example: "I'll go by car OR by bus"
True if I use either method (or both).

Implication (IF-THEN)

P → Q

Meaning: If P is true, then Q must be true

P Q P → Q
F F T
F T T
T F F
T T T
Example: "If it rains, then the ground gets wet"
Only false when it rains but ground stays dry.

Biconditional (IF AND ONLY IF)

P ↔ Q

Meaning: P and Q have the same truth value

P Q P ↔ Q
F F T
F T F
T F F
T T T
Example: "The light is on if and only if the switch is up"
True when both are on or both are off.
¬

Negation (NOT)

¬P

Meaning: The opposite truth value of P

P ¬P
F T
T F
Example: "It is NOT raining"
True when the original statement is false.

Classic Inference Rules

Inference rules are patterns of reasoning that allow us to derive new conclusions from existing premises. These are the building blocks of logical arguments.

Modus Ponens Sound

P → Q, P
────────
∴ Q

Pattern: If P implies Q, and P is true, then Q must be true.

Example:
"If you study hard, you will pass the exam."
"You study hard."
Therefore: "You will pass the exam."

Why it's valid: The implication guarantees that when P is true, Q follows.

Modus Tollens Sound

P → Q, ¬Q
────────
∴ ¬P

Pattern: If P implies Q, and Q is false, then P must be false.

Example:
"If it's raining, the ground is wet."
"The ground is not wet."
Therefore: "It's not raining."

Why it's valid: If Q were false but P true, the implication would be violated.

Disjunctive Syllogism Sound

P ∨ Q, ¬P
────────
∴ Q

Pattern: If P or Q is true, and P is false, then Q must be true.

Example:
"I'll go by car or by bus."
"I don't go by car."
Therefore: "I go by bus."

Why it's valid: Since one of the disjuncts must be true, eliminating one forces the other.

Hypothetical Syllogism Sound

P → Q, Q → R
────────
∴ P → R

Pattern: If P implies Q and Q implies R, then P implies R.

Example:
"If you study, you learn."
"If you learn, you succeed."
Therefore: "If you study, you succeed."

Why it's valid: Implications are transitive - they chain together logically.

Affirming the Consequent Fallacy

P → Q, Q
────────
∴ P ❌

Invalid Pattern: Just because Q is true doesn't mean P caused it.

Example:
"If it's raining, the ground is wet."
"The ground is wet."
Invalid conclusion: "It's raining."
(The ground could be wet from sprinklers!)

Why it's invalid: Q can be true for reasons other than P.

Denying the Antecedent Fallacy

P → Q, ¬P
────────
∴ ¬Q ❌

Invalid Pattern: If P doesn't happen, we can't conclude about Q.

Example:
"If you study hard, you pass the exam."
"You don't study hard."
Invalid conclusion: "You won't pass the exam."
(You might still pass through luck or natural ability!)

Why it's invalid: The implication doesn't rule out other ways for Q to be true.