Worked Examples
Step-by-step solutions showing the reasoning process.
1Worked Example
Problem
Evaluate:
(P ∨ Q) ∧ ¬P where P = true, Q = false1
Identify the main connective. The main operator is ∧ (AND), connecting (P ∨ Q) and ¬P.
2
Evaluate P ∨ Q: true ∨ false = true
3
Evaluate ¬P: ¬true = false
4
Combine: true ∧ false = false
⚠
Watch Out!
Don't evaluate left-to-right! Identify the main connective and work from inside out.
2Worked Example
Problem
A programmer writes:
How is this interpreted?
if (x > 0 && y > 0 || z == 0)How is this interpreted?
1
In most languages, && has higher precedence than ||.
2
So it parses as:
(x > 0 && y > 0) || z == 03
In logic:
(P ∧ Q) ∨ R — "Either both x,y positive OR z is zero"⚠
Watch Out!
Always use parentheses to make intent explicit! Don't rely on precedence rules.
3Worked Example
Problem
Translate: "A student passes if they score ≥60 or do extra credit, but not if caught cheating."
1
Define variables: P = score ≥60, E = extra credit, C = cheating, Pass = passes
2
"Score ≥60 or extra credit" →
P ∨ E3
"But not if cheating" → AND NOT cheating →
∧ ¬C4
Final:
Pass ↔ (P ∨ E) ∧ ¬C⚠
Watch Out!
"But" often signals an exception via negation. "X but not Y" = X ∧ ¬Y
✦Tip
When solving logic problems: (1) Find main connective, (2) Work inside-out, (3) Test with values, (4) When stuck, build a truth table.