Every algorithm you write, every filter condition in a spreadsheet, and every decision tree in a data model rests on one simple idea: a statement is either true or false. Mathematical logic is the formal study of exactly that idea, and it gives data analysts the vocabulary to combine simple facts into complex, testable conditions. Before you can write a compound filter like “salary is above 50,000 AND department is Sales,” you need to understand what a statement actually is, how symbols represent it, and how truth tables let you evaluate it with certainty.
Table of Contents
- What is a statement in logic?
- Statements vs non-statements
- Why logic uses symbolic language
- The five fundamental logical connectives
- Negation (โผ)
- Conjunction (โง) and disjunction (โจ)
- Conditional (โ) and biconditional (โ)
- Truth tables: evaluating logical expressions
- Key logical identities and laws
- De Morgan’s laws
- Idempotent laws
- Law of excluded middle
- Double negation
- Why this matters for data analysis
What is a statement in logic?
In logic, a statement (also called a proposition) is a declarative sentence that has a definite truth value – it is either true or false, never both, and never neither. This is the foundation on which the rest of formal logic is built, and it is the same idea Britannica uses to define a truth-value: the truth or falsity assigned to a given statement.
Consider the sentence “Sugar is sweet.” This is a statement because it can be checked and shown to be true. Compare it with “Is sugar sweet?” – a question has no truth value because it isn’t asserting anything, it’s asking. Similarly, “Please pass the sugar” is a command (imperative), and “What a sweet mango!” is an exclamation. Neither can be labelled true or false, so neither qualifies as a statement in the logical sense.
An important nuance here is that a statement doesn’t need to have a truth value that is currently known to qualify as a proposition – it only needs to have one in principle. “There is life on a planet outside our solar system” is a perfectly valid statement even though nobody currently knows whether it’s true. What disqualifies a sentence from being a statement is not uncertainty, but the type of sentence itself: questions, commands, and exclamations are structurally incapable of being true or false, no matter how much information you gather.
Statements vs non-statements
A quick way to sort sentences is to ask: can this be marked true or false? “Delhi is the capital of India” – yes, true. “Shut the door” – no, it’s an instruction. “2 + 2 = 5” – yes, and it happens to be false, but it’s still a statement because it has a definite truth value. This distinction matters enormously once you start writing logical expressions for data filtering or validation rules, because only statements can be plugged into a logical connective.
Why logic uses symbolic language
Once you accept that statements can be true or false, the next step is to strip away their actual content and represent them with symbols like p, q, and r. This might feel unnecessarily abstract, but it’s the entire point. The Stanford Encyclopedia of Philosophy frames propositional logic as an attempt to capture how connecting words in natural language – “and,” “or,” “not,” “if…then” – behave as truth-functional operators, regardless of what the underlying sentences are actually about.
By replacing “It is raining” with p and “The match will be cancelled” with q, you can study the relationship p โ q without getting distracted by rain or cricket. This abstraction is exactly what makes logic portable to computer science: the same symbolic rules that describe “if it rains, the match is cancelled” also describe “if stock is zero, then flag as out-of-stock” in a database query. The content changes, the logical structure doesn’t.
The five fundamental logical connectives
Simple statements can be combined into compound statements using logical connectives. There are five you need to know cold, because they form the basis of every conditional statement you’ll write in a spreadsheet formula, a SQL WHERE clause, or a Python if-statement.
Negation (โผ)
Negation simply reverses the truth value of a statement. If p is “It is raining,” then โผp is “It is not raining.” If p is true, โผp is false, and vice versa.
Conjunction (โง) and disjunction (โจ)
Conjunction (AND) is true only when both component statements are true. Disjunction (OR) is true when at least one of the two statements is true. This is the same logic GeeksforGeeks uses to describe how compound propositions are built from atomic ones using connectives.
| p | q | p โง q | p โจ q |
|---|---|---|---|
| T | T | T | T |
| T | F | F | T |
| F | T | F | T |
| F | F | F | F |
Conditional (โ) and biconditional (โ)
The conditional p โ q reads as “if p, then q.” It is false in exactly one case: when p is true but q is false. In every other combination, it is considered true – including the cases where p itself is false, which often confuses beginners but is a deliberate and consistent rule in classical logic. The biconditional p โ q is true only when p and q share the same truth value, meaning both are true or both are false.
| p | q | p โ q | p โ q |
|---|---|---|---|
| T | T | T | T |
| T | F | F | F |
| F | T | T | F |
| F | F | T | T |
Truth tables: evaluating logical expressions
A truth table lists every possible combination of truth values for the component statements in an expression, along with the resulting truth value of the whole expression. For a formula with n propositional variables, you need 2โฟ rows to cover every combination, since each variable can independently be true or false.
This becomes essential once you move from simple connectives to well-formed formulas (wffs) – compound expressions built by correctly combining statements and connectives according to the syntax rules of logic. Take the formula p โง (q โจ r). To evaluate it, you first work out q โจ r for each row, then combine that result with p using conjunction.
| p | q | r | q โจ r | p โง (q โจ r) |
|---|---|---|---|---|
| T | T | T | T | T |
| T | T | F | T | T |
| T | F | T | T | T |
| T | F | F | F | F |
| F | T | T | T | F |
| F | T | F | T | F |
| F | F | T | T | F |
| F | F | F | F | F |
This step-by-step evaluation, working from the innermost brackets outward, is exactly how a computer parses a nested logical condition in code – evaluate the smallest sub-expressions first, then combine them according to operator precedence.
Key logical identities and laws
Once you’re comfortable building truth tables, the next skill is recognizing when two differently-written expressions are actually logically equivalent – meaning they produce identical truth tables. These identities let you simplify long, unwieldy logical expressions into shorter, equivalent ones, which is exactly what a data analyst does when cleaning up a bloated filter condition.
De Morgan’s laws
De Morgan’s laws describe what happens when you negate a conjunction or disjunction: โผ(EโจG) = โผEโงโผG, and โผ(EโงG) = โผEโจโผG. In plain terms, negating an OR statement flips it into an AND of the negations, and negating an AND statement flips it into an OR of the negations – the connective switches while the negation distributes across each term. This pattern, credited to logician Augustus De Morgan, is described in detail by Lumen Learning’s mathematics course materials as one of the most frequently used equivalences in logic. In data filtering terms: “NOT (region is North OR region is South)” is logically identical to “region is not North AND region is not South.”
Idempotent laws
The idempotent laws state that EโจE = E and EโงE = E. Repeating the same condition with itself, joined by AND or OR, adds nothing new – the result collapses back to the original statement. This is useful for spotting redundant conditions in a long logical expression.
Law of excluded middle
The law of excluded middle states that EโจโผE is always true – a statement is either true, or its negation is true; there’s no third option. This is one of the foundational principles of classical logic discussed extensively in open discrete mathematics resources alongside related identity and domination laws.
Double negation
Finally, double negation states that โผ(โผE) = E. Negating a negation simply returns you to the original statement – “It is not the case that it is not raining” means the same thing as “It is raining.”
Why this matters for data analysis
These identities aren’t abstract exercises confined to a textbook chapter. Every time you write a compound filter across multiple columns in a dataset, chain conditions in a pivot table, or debug a query that isn’t returning the rows you expect, you’re applying propositional logic. Knowing that โผ(A AND B) is the same as (โผA OR โผB) means you can rewrite a confusing exclusion filter into something readable, and knowing the law of excluded middle reassures you that a boolean column in your dataset can only ever be one of two things – never an undefined third state, unless your data itself is genuinely missing or null.
What do you think? If a conditional statement p โ q is considered true whenever p is false, does that match how you’d naturally interpret an “if-then” rule in everyday language, or does it feel counterintuitive? And can you think of a filter condition from a dataset you’ve worked with that could be simplified using De Morgan’s laws?
References
- https://www.britannica.com/topic/truth-value
- https://plato.stanford.edu/entries/logic-propositional/
- https://www.geeksforgeeks.org/engineering-mathematics/proposition-logic/
- https://courses.lumenlearning.com/waymakermath4libarts/chapter/demorgans-laws/
- https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/A_Spiral_Workbook_for_Discrete_Mathematics_(Kwong)/02:_Logic/2.05:_Logical_Equivalences
Leave a Reply