Introduction to Mathematical Logic
Introduction to Mathematical Logic
What Is Mathematical Logic?
Mathematical logic is the formal study of reasoning. It provides methods for determining whether statements are true or false and whether conclusions follow correctly from assumptions.
Mathematical logic is especially important for:
Verifying the truth of mathematical statements.
Determining whether an argument constitutes a valid proof.
Combining statements using precisely defined logical operators.
Analyzing the correctness of computer programs and hardware.
Supporting automated reasoning and artificial intelligence.
Logic and Mathematical Proof
Consider the theorem:
For every nonnegative integer n, the sum of the first n nonnegative integers is
∑i=1ni=2n(n+1).
A proof by mathematical induction establishes this theorem in two stages:
Base case: The statement is verified for an initial value, such as n=1 or n=0, depending on the convention being used.
Inductive step: It is assumed that the statement is true for an arbitrary value n=k. This assumption is called the induction hypothesis. The proof then shows that the statement must also be true for n=k+1.
When both stages are correctly established, mathematical logic justifies the conclusion that the theorem is true for every permitted value of n.
The role of mathematical logic is not merely to produce individual statements. It explains why the steps of a proof are valid and how assumptions can be used to derive conclusions correctly.
Applications of Mathematical Logic
Mathematical logic has applications throughout mathematics, computer science, engineering, and artificial intelligence.
Boolean Algebra and Computer Architecture
Boolean algebra is an algebraic system in which variables generally have only two possible values: true and false, often represented as 1 and 0.
Boolean algebra forms the basis of:
Digital circuits.
Logic gates.
Computer processors.
Memory systems.
Control units and other hardware components.
Operations such as AND, OR, and NOT can be implemented directly using electronic circuits.
Program Verification and Validation
Suppose a software program is designed to perform a particular task. A simple testing strategy is to run the program on several inputs and check whether it produces the expected outputs.
This approach has a limitation: testing only examines the inputs that were selected. There may be an untested input for which the program produces an incorrect result.
For ordinary applications, limited testing may be acceptable. However, software used in critical systems must be highly reliable. Examples include software for:
Aircraft.
Medical equipment.
Industrial control systems.
Transportation systems.
Safety-critical infrastructure.
Mathematical logic supports program verification, which attempts to prove that a program satisfies its intended specification for all relevant inputs, rather than merely checking a few examples.
Hardware Verification
Mathematical logic is also used to verify hardware systems.
A motherboard may contain many small chips, circuits, and interconnected components. Hardware verification examines whether:
Components are connected correctly.
The hardware performs its intended function.
The system responds correctly to all relevant input conditions.
The implementation satisfies its design specifications.
Artificial Intelligence and PROLOG
Mathematical logic is important in artificial intelligence, particularly in systems based on symbolic reasoning.
PROLOG is a programming language used extensively in some artificial intelligence applications. Its programs are based on logical statements and rules. A PROLOG system can use those rules to infer conclusions from known facts.
Automated Theorem Proving
In automated theorem proving, computer programs are designed to determine whether mathematical statements are true and, in some cases, to construct formal proofs.
The computer uses logical rules to:
Represent assumptions.
Apply valid inference steps.
Derive conclusions.
Determine whether a statement follows from a collection of premises.
Types of Mathematical Logic
The basic form of mathematical logic is propositional logic.
Propositional logic studies propositions and the ways they can be combined using logical operators.
Predicate logic generalizes propositional logic by allowing statements about objects, properties, variables, and relationships.
The discussion begins with propositional logic because it provides the fundamental concepts used in more advanced logical systems.
Propositions
Definition of a Proposition
A proposition is a declarative statement that has exactly one truth value:
It is either true.
Or it is false.
A proposition cannot be both true and false at the same time within the same interpretation.
A proposition is a declarative statement that is unambiguously either true or false.
Examples of Propositions
The statement:
New Delhi is the capital of India.
is a proposition because it declares a fact and has a definite truth value. It is true.
The statement:
Bahubali was killed by Katappa.
is also a proposition. It is a declarative statement about characters and events, and it can be assigned a definite truth value.
The truth value of a proposition does not depend on whether the statement is currently known. It depends on whether the statement is actually true or false.
Statements That Are Not Propositions
Consider:
x+2=4
This is a declarative-looking statement, but it is not a proposition when the value of x has not been specified.
If x=2, the statement is true.
If x=3, the statement is false.
The statement therefore does not have one fixed truth value until the value of x is known. Such an expression is often called an open sentence or a predicate rather than a proposition.
A question, command, or expression of uncertainty is also generally not a proposition because it does not assert something that can be classified as true or false.
Propositional Variables
A propositional variable is a symbol that represents an arbitrary proposition. Propositional variables are commonly written using lowercase letters such as:
A propositional variable acts as a placeholder. Its truth value depends on the proposition assigned to it.
For example:
p could represent “New Delhi is the capital of India.”
q could represent “It is raining.”
r could represent “The program produces the correct output.”
Each propositional variable can take one of two truth values:
The role of a propositional variable is similar to the role of a variable in a programming language. For example, declaring an integer variable allows it to store some integer value. Similarly, declaring a propositional variable allows it to represent some proposition and store its truth value.
Compound Propositions
A compound proposition is formed by combining one or more simpler propositions using logical operators.
For example, if p and q are propositions, then expressions such as the following are compound propositions:
¬p
p∧q
p∨q
p→q
The resulting compound proposition also has one of the two possible truth values: true or false.
A truth table lists the truth value of a compound proposition for every possible combination of truth values of its component propositions.
Negation
Negation is a unary logical operator because it operates on one proposition.
The negation of p is written as:
It means “not p.”
Truth Values of Negation
If p is true, then ¬p is false.
If p is false, then ¬p is true.
p | ¬p |
|---|---|
True | False |
False | True |
Other notations for negation include:
∼p
p
p′ in some contexts
Although the notation may vary, the logical meaning is the same.
Conjunction: Logical AND
Conjunction is also called logical AND. It is written as:
Conjunction is a binary operator because it operates on two propositions.
The compound proposition p∧q is true only when both p and q are true.
p | q | p∧q |
|---|---|---|
True | True | True |
True | False | False |
False | True | False |
False | False | False |
Thus, if either proposition is false, their conjunction is false.
Disjunction: Logical OR
Disjunction is also called logical OR. It is written as:
The disjunction p∨q is true when at least one of p and q is true.
p | q | p∨q |
|---|---|---|
True | True | True |
True | False | True |
False | True | True |
False | False | False |
The OR operator used here is inclusive OR: it allows either proposition to be true, including the possibility that both are true.
Unary and Binary Operators
Logical operators are classified according to the number of propositions on which they operate.
A unary operator operates on one proposition. Negation is unary:
¬pA binary operator operates on two propositions. Conjunction and disjunction are binary:
p∧q,p∨q
Because the result of applying a logical operator is itself either true or false, logical operators produce propositions.
Number of Logical Operators on Two Propositions
Suppose a logical operator operates on two propositional variables, p and q.
Each variable can be either true or false, so there are four possible combinations of truth values:
p true and q true.
p true and q false.
p false and q true.
p false and q false.
A binary logical operator must assign either true or false to each of these four rows.
For each row, there are two possible choices for the result:
True.
False.
The choices for the four rows are independent. Therefore, the number of distinct binary logical operators is:
Equivalently, because there are 22=4 possible input combinations and two possible output values for each combination, the number of operators is:
There are exactly 16 distinct logical operators that can be defined on two propositional variables.
Different operators may be given different names, such as:
Conjunction.
Disjunction.
Exclusive OR.
Exclusive NOR.
Other named or unnamed operations.
However, no more than 16 distinct operators are possible because no more than 16 distinct truth tables can be constructed for two binary inputs.
Two operators are considered distinct when their truth tables differ in at least one row.
Conditional Statements
The Implication Operator
A conditional statement, also called an if–then statement, is written as:
It is read as:
If p, then q.
Here:
p is the antecedent, hypothesis, or premise.
q is the consequent or conclusion.
The truth table for implication is:
p | q | p→q |
|---|---|---|
True | True | True |
True | False | False |
False | True | True |
False | False | True |
The implication is false in exactly one case:
p is true and q is false.
In every other case, p→q is true.
Understanding Why an Implication Is False Only in One Case
Consider the statement:
If John becomes prime minister, then good days will come for the country.
Let:
p represent “John becomes prime minister.”
q represent “Good days come for the country.”
The statement is a promise. It is broken only when:
John does become prime minister, so p is true.
Good days do not come, so q is false.
This is exactly the case:
If John does not become prime minister, then the promise has not been put to the test. Whether good days come or not does not show that John broke this particular promise. Therefore, the conditional is treated as true when p is false.
This explains the truth table convention:
If the antecedent is true and the conclusion is false, the implication is false.
If the antecedent is false, the implication is considered true regardless of the truth value of the consequent.
In formal logic, this is sometimes called vacuous truth.
Equivalent Interpretations of p→q
The expression p→q may be expressed in several ways:
If p, then q.
q follows from p.
p is sufficient for q.
q whenever p.
q is necessary for p.
p only if q.
These expressions have the same logical meaning, although their wording emphasizes different aspects of the relationship.
Sufficient and Necessary Conditions
The statement
means that p is sufficient for q:
Whenever p is true, q must also be true.
It also means that q is necessary for p:
p cannot be true unless q is true.
The distinction is important:
“p is sufficient for q” corresponds to p→q.
“q is necessary for p” also corresponds to p→q.
“p is necessary for q” corresponds to q→p.
“q is sufficient for p” corresponds to q→p.
Example: “Only If”
Consider the statement:
The speaker will go to the pub only if it is Friday.
Let:
p represent “The speaker will go to the pub.”
q represent “It is Friday.”
The statement means:
If the speaker goes to the pub, then it must be Friday.
Therefore, its logical representation is:
It can also be interpreted as:
If it is not Friday, then the speaker will not go to the pub.
Symbolically:
Being Friday is a necessary condition for going to the pub. However, it is not a sufficient condition. The speaker might still decide not to go to the pub on a Friday because of illness, personal work, or another reason.
Thus:
Friday is necessary for going to the pub.
Friday alone does not guarantee going to the pub.
The correct representation is p→q, not q→p.
Contrapositive and Logical Equivalence
A conditional statement is logically equivalent to its contrapositive:
Logical equivalence means that the two expressions have the same truth value for every possible assignment of truth values to their variables.
For example, the two statements below are equivalent:
If the speaker goes to the pub, then it is Friday.
If it is not Friday, then the speaker does not go to the pub.
Their truth tables match row by row.
The contrapositive should not be confused with the converse:
Original conditional:
p→qContrapositive:
¬q→¬pConverse:
q→p
The original conditional and its contrapositive are logically equivalent. The converse is generally not equivalent to the original statement.
Conditional Statements Need Not Be Related in Ordinary Language
In propositional logic, the propositions p and q do not need to have a meaningful causal or semantic relationship.
For example, consider:
If the Earth is triangular, then the speaker is the director of an institute.
Let:
p represent “The Earth is triangular.”
q represent “The speaker is the director of an institute.”
The premise p is false because the Earth is not triangular. Therefore, according to the truth table for implication:
is true, regardless of whether q is true or false.
This may sound strange in ordinary language because the two statements are unrelated. However, formal propositional logic evaluates a conditional according to its truth values, not according to whether the statements have a sensible connection.
The only situation in which a conditional is false is:
Key Takeaways
Mathematical logic provides formal methods for reasoning and proving whether statements are true or false.
Logic is used in mathematical proofs, Boolean algebra, program verification, hardware verification, artificial intelligence, and automated theorem proving.
A proposition is a declarative statement with exactly one truth value.
A statement involving an unspecified variable, such as x+2=4, is not a proposition until the variable is assigned a value.
A propositional variable is a placeholder for an arbitrary proposition.
Compound propositions are formed by combining propositions with logical operators.
Negation reverses a proposition’s truth value.
Conjunction is true only when both component propositions are true.
Disjunction is true when at least one component proposition is true.
There are exactly 16 distinct binary logical operators for two propositional variables.
The conditional p→q is false only when p is true and q is false.
In p→q, p is sufficient for q, while q is necessary for p.
The conditional is logically equivalent to its contrapositive:
p→q≡¬q→¬p.

Ask anything
We've read this whole study set, so questions about it get the best answers.