Theory
The sentence a computer can judge
Read these four sentences:
1. "2 + 3 = 5"
2. "Close the door."
3. "Is it raining?"
4. "Maths is beautiful."
Only one of them can a computer mark TRUE or FALSE with total confidence: the first. Commands, questions and opinions have no truth value.
Logic is the mathematics of sentences like the first kind, and it runs everything your code will ever decide.
Theory
Grammar for reasoning
A language has grammar so sentences make sense; reasoning has logic so arguments hold up. Just as grammar tells you "went I home" is broken even though the words are fine, logic tells you an argument is broken even when it sounds convincing. It is quality control for thinking.
Theory
Propositions: the atoms of logic
A proposition is a declarative sentence that is either true or false, but not both.
Propositions: "Delhi is the capital of India" (T), "7 is even" (F).
Not propositions: "What time is it?" (question), "Please sit down" (command), "Biryani is tasty" (opinion), "x + 1 = 5" (depends on x, so no fixed truth value).
We name propositions with letters: P, Q, R.
Quiz
Which of these is a proposition?
- "Solve question 5."
- "Every even number greater than 2 is not prime."
- "How difficult is this exam?"
- "x is greater than 10."
Show the answer
"Every even number greater than 2 is not prime."
Option B is declarative and definitely true or false (it happens to be true). A command and a question carry no truth value, and "x > 10" has no fixed truth value until x is known, the trap most students fall for. Exams love the variable-sentence distractor.
Theory
Three basic connectives
Compound statements are built from simple ones using connectives:
- NOT (negation) ¬P: flips the truth value of P
- AND (conjunction) P ∧ Q: true only when both are true
- OR (disjunction) P ∨ Q: true when at least one is true
Logic's OR is inclusive: "tea or coffee" in logic happily allows both. That single convention resolves most beginner confusion.
Think first
P = "7 is odd" (true). Q = "7 is prime" (true). R = "7 is even" (false).
Work out the truth values of: ¬R, P ∧ R, P ∨ R. Then tap.
Show the answer
¬R = T (flipping false gives true).
P ∧ R = F (AND needs both; R fails it).
P ∨ R = T (OR needs just one; P delivers).
Notice how mechanical this is: no opinions, no context, just rules applied to truth values. That mechanical nature is exactly why computers can do logic.
Theory
Two more: if-then, if-and-only-if
- Implication P → Q: "if P then Q", the language of every rule and every
ifstatement. It is false only when P happens but Q does not. - Biconditional P ↔ Q: "P if and only if Q", true exactly when P and Q have the same truth value.
Example: "If it rains, the ground gets wet" is an implication; "you pass if and only if you score 40 or more" is a biconditional.
Quiz
"If you top the exam, I will buy you a phone." You do NOT top the exam, and no phone is bought. Was the promise broken?
- Yes, no phone came
- No, the promise only covers the case of topping
- Cannot be decided
- The sentence is not a proposition
Show the answer
No, the promise only covers the case of topping
An implication P → Q is broken only when P is true and Q is false. Here P ("you top") is false, so the promise stands unbroken whatever happens. This exact idea becomes one row of the implication truth table in the next topic, where many students trip.
Watch out
The classification traps
Three sentences that fool students in exams: "x + 1 = 5" (not a proposition until x is fixed), "This statement is false" (a paradox, neither true nor false, so not a proposition), and opinions dressed as facts ("C is the best language"). When asked to classify, always give the reason: has a definite truth value, or does not.
Theory
Where you will meet this again
Every condition you will ever write, if (marks >= 40 && attendance >= 75), is P ∧ Q wearing C clothes, and databases filter with WHERE clauses built from AND, OR, NOT. The next topic, truth tables, turns today's connectives into a systematic calculation tool, and Boolean algebra later re-labels T and F as 1 and 0.
Summary
Key takeaways
- A proposition is a declarative sentence that is exactly one of true or false.
- Questions, commands, opinions, paradoxes and open sentences with variables are not propositions.
- NOT flips, AND needs both, OR (inclusive) needs at least one.
- P → Q fails only when P is true and Q is false; P ↔ Q is true when both match.
- Memory hook: no truth value, no proposition.