Mathematical Logic
An introduction to propositions, logical connectives, conditional statements, logical equivalences, satisfiability, predicates, and quantifiers.
Introduction
Have you ever wondered how computers process complex reasoning, run bug-free software, or solve intricate puzzles in milliseconds? At the heart of computer science and mathematics lies logic—the formal framework that provides precise meaning to statements and eliminates ambiguity. Without logic, establishing software security, building artificial intelligence, or constructing mathematical proofs would be impossible.
By the end of this lesson, you will be able to:
- Distinguish between propositions and non-propositions and evaluate truth values using logical connectives.
- Formulate conditional statements alongside their converse, inverse, contrapositive, and biconditional forms.
- Verify logical equivalences, tautologies, and satisfiability using truth tables and algebraic laws.
- Translate natural language sentences into formal logic using predicates and quantifiers.
The Building Blocks of Thought – Propositions and Logical Connectives
To build a rigorous logical argument, we must begin with the fundamental unit of logic: the proposition. A proposition is a declarative sentence that is either true (T) or false (F), but not both.
Consider these declarative sentences:
- "Washington, D.C., is the capital of the United States." — True proposition (T)
- "1 + 1 = 2" — True proposition (T)
- "Toronto is the capital of Canada." — False proposition (F)
- "2 + 2 = 3" — False proposition (F)
In contrast, non-declarative sentences or open expressions are not propositions:
- "What time is it?" (A question—neither true nor false)
- "Read this carefully." (A command)
- "x + 1 = 2" (Neither true nor false until a value is assigned to )
Propositional Variables and Atomic Propositions
We denote propositional variables using lowercase letters such as and . An atomic proposition is one that cannot be broken down into simpler propositions. To construct complex statements, we combine atomic propositions using logical operators (also called connectives).
The Fundamental Operators
- Negation ( or ) The negation of is the statement "It is not the case that ." It reverses the truth value of .
- Example: If is "Michael's PC runs Linux," then is "Michael's PC does not run Linux."
- Conjunction () The conjunction represents the statement " and ." It is true only when both and are true; otherwise, it is false.
- Note: In English, words like "but" function identically to "and" in logic (e.g., "The sun is shining, but it is raining").
- Disjunction () The disjunction represents " or ." Logic uses the inclusive OR: is true if at least one of or is true, and false only when both are false.
- Exclusive OR () The exclusive OR (XOR) is true when exactly one of and is true, but false when both are true or both are false.
- Example: "A student can have soup or salad with dinner" implies you can choose one, but not both.
Truth Tables and Bit Operations
A truth table displays the truth value of a compound proposition for every possible combination of truth values of its variables.
| T | T | F | T | T | F |
| T | F | F | F | T | T |
| F | T | T | F | T | T |
| F | F | T | F | F | F |
In computer logic, truth values are represented as bits: 1 for True (T) and 0 for False (F). Bitwise operations apply AND, OR, and XOR bit-by-bit across equal-length bit strings.
- Example: Bitwise
XORof01 1011and11 0001yields10 1010.
Implication and Equivalence – Conditional and Biconditional Statements
Conditional statements are the backbone of mathematical proofs and programming logic. They express that a statement holds under a specific condition.
The Conditional Statement ()
Let and be propositions. The conditional statement is read "If , then ." Here, is the hypothesis (or premise) and is the conclusion (or consequence).
Key Rule: is false only when is true and is false. In all other cases, it is true.
Think of as a campaign contract: "If I am elected (), then I will lower taxes ()."
- If the politician is elected ( is T) and lowers taxes ( is T), the promise is kept (T).
- If elected ( is T) but taxes are not lowered ( is F), the promise is broken (F).
- If the politician loses ( is F), the contract is not broken, regardless of whether taxes change (T).
Common natural language expressions for include:
- " implies " | " is sufficient for " | " whenever "
- " is necessary for " | " only if " | " unless "
Related Conditional Statements
Given a conditional statement , three related conditional statements can be formed:
- Converse:
- Inverse:
- Contrapositive:
Crucial Insight: A conditional statement and its contrapositive always share the exact same truth values. However, the converse and inverse do not necessarily match the truth value of the original statement.
Example: Consider "If it is raining, then the home team wins."
- Contrapositive: "If the home team does not win, then it is not raining." (Logically equivalent)
- Converse: "If the home team wins, then it is raining." (Not equivalent)
- Inverse: "If it is not raining, then the home team does not win." (Not equivalent)
The Biconditional Statement ()
The biconditional statement is read " if and only if " (or " iff "). It is true when and have the same truth values, and false otherwise.
Operator Precedence
To minimize parentheses in complex expressions, logical operators follow a strict order of precedence:
- Negation ()
- Conjunction ()
- Disjunction ()
- Conditional ()
- Biconditional ()
Logical Equivalences and Satisfiability – The Algebra of Truth
In mathematical arguments, replacing a complex statement with a simpler, logically equivalent statement is a essential technique.
Tautologies, Contradictions, and Contingencies
- Tautology: A compound proposition that is always true regardless of variable values (e.g., ).
- Contradiction: A compound proposition that is always false (e.g., ).
- Contingency: A compound proposition that is neither a tautology nor a contradiction (e.g., ).
Compound propositions and are logically equivalent ( or ) if is a tautology.
Key Logical Equivalence Laws
- De Morgan's Laws:
- Conditional-Disjunction Equivalence:
- Distributive Laws:
- Absorption Laws:
Proving Equivalences Without Truth Tables
Proving equivalences using truth tables requires rows for variables. For large , algebraic manipulation using established equivalences is far more efficient.
Example: Show that .
Satisfiability (SAT)
A compound proposition is satisfiable if there is at least one assignment of truth values to its variables that makes it true. If all assignments make it false, it is unsatisfiable.
Real-world applications of satisfiability include:
- -Queens Problem: Placing chess queens on an board so no two queens attack each other.
- Sudoku: Modeling grid constraints as conjunctions of propositions to allow SAT solvers to solve puzzles in under 10 milliseconds.
Expanding Logic Beyond Fixed Truths – Predicates and Quantifiers
Propositional logic cannot express assertions that apply to groups of objects, such as "Every computer connected to the network is functioning properly." To express these mathematical assertions, we use predicate logic.
Predicates and Propositional Functions
A predicate refers to a property or characteristic of a subject variable. In the statement "", is the variable subject and "is greater than 3" is the predicate.
We denote this statement as , where is the propositional function. becomes a proposition with a distinct truth value once is assigned a value:
- For : is True, while is False.
- Multivariable predicates : is True, while is False.
In computer programming, predicates define preconditions (valid input states) and postconditions (expected output states) to prove code correctness.
Quantifiers
Quantification expresses the extent to which a predicate applies over a domain of discourse (the domain).
- Universal Quantifier () States that is true for every value of in the domain. A single counterexample (an element where is false) refutes a universally quantified statement.
- Example: is False over real numbers (e.g., ), but True over positive integers.
- Existential Quantifier () States that there is at least one element in the domain for which is true.
- Example: is True over real numbers because satisfies it.
- Uniqueness Quantifier () States that there exists one and only one element in the domain such that is true.
Negating Quantified Expressions
Negating quantifiers flips the quantifier type and negates the inner predicate. These rules are known as De Morgan's Laws for Quantifiers:
| Negation | Equivalent Statement | When True? | When False? |
|---|---|---|---|
| There is an for which is false. | is true for every . | ||
| $\forall x\neg P(x)$$ | is false for every . | There is an for which is true. |
Example: Negating "All Americans eat cheeseburgers" () yields "There is an American who does not eat cheeseburgers" ().
Logic Programming (Prolog)
In AI and automated reasoning, declarative languages like Prolog use predicate logic rules and facts to answer complex database queries:
instructor(chan, math273).
enrolled(kevin, math273).
teaches(P, S) :- instructor(P, C), enrolled(S, C).
Querying ?teaches(X, kevin) leads Prolog to evaluate the logical assertions and return X = chan.
Summary
Mathematical logic forms the rigorous foundation for all formal reasoning, software development, and circuit design. By moving from basic propositional connectives to predicate logic and quantifiers, we gain the tools to eliminate ambiguity and analyze complex systems systematically.
Key Takeaways
- Propositions are declarative statements with fixed truth values (T or F).
- Connectives () combine atomic propositions into compound expressions.
- Conditional Statements () are false only when the hypothesis is true and the conclusion is false; a conditional statement is logically equivalent only to its contrapositive ().
- Logical Equivalences (such as De Morgan's Laws) allow complex propositions to be simplified algebraically without huge truth tables.
- Predicates & Quantifiers () extend propositional logic to analyze properties over specified domains, forming the basis for logic programming and automated verification.