1. Home
  2. Explore
  3. Mathematics
  4. Introduction to Mathematical Logic

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

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 nnn, the sum of the first nnn nonnegative integers is

∑i=1ni=n(n+1)2.\sum_{i=1}^{n} i = \frac{n(n+1)}{2}.∑i=1n​i=2n(n+1)​.

A proof by mathematical induction establishes this theorem in two stages:

  1. Base case: The statement is verified for an initial value, such as n=1n=1n=1 or n=0n=0n=0, depending on the convention being used.

  2. Inductive step: It is assumed that the statement is true for an arbitrary value n=kn=kn=k. This assumption is called the induction hypothesis. The proof then shows that the statement must also be true for n=k+1n=k+1n=k+1.

When both stages are correctly established, mathematical logic justifies the conclusion that the theorem is true for every permitted value of nnn.

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 111 and 000.

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=4x+2=4x+2=4

This is a declarative-looking statement, but it is not a proposition when the value of xxx has not been specified.

  • If x=2x=2x=2, the statement is true.

  • If x=3x=3x=3, the statement is false.

The statement therefore does not have one fixed truth value until the value of xxx 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:

p, q, rp,\ q,\ rp, q, r

A propositional variable acts as a placeholder. Its truth value depends on the proposition assigned to it.

For example:

  • ppp could represent “New Delhi is the capital of India.”

  • qqq could represent “It is raining.”

  • rrr could represent “The program produces the correct output.”

Each propositional variable can take one of two truth values:

TrueorFalse.\text{True} \quad \text{or} \quad \text{False}.TrueorFalse.

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 ppp and qqq are propositions, then expressions such as the following are compound propositions:

  • ¬p\neg p¬p

  • p∧qp \land qp∧q

  • p∨qp \lor qp∨q

  • p→qp \rightarrow qp→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 ppp is written as:

¬p\neg p¬p

It means “not ppp.”

Truth Values of Negation

  • If ppp is true, then ¬p\neg p¬p is false.

  • If ppp is false, then ¬p\neg p¬p is true.

ppp

¬p\neg p¬p

True

False

False

True

Other notations for negation include:

  • ∼p\sim p∼p

  • p‾\overline{p}p​

  • 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:

p∧qp \land qp∧q

Conjunction is a binary operator because it operates on two propositions.

The compound proposition p∧qp \land qp∧q is true only when both ppp and qqq are true.

ppp

qqq

p∧qp \land qp∧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:

p∨qp \lor qp∨q

The disjunction p∨qp \lor qp∨q is true when at least one of ppp and qqq is true.

ppp

qqq

p∨qp \lor qp∨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:

    ¬p\neg p¬p
  • A binary operator operates on two propositions. Conjunction and disjunction are binary:

    p∧q,p∨qp \land q,\qquad p \lor qp∧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, ppp and qqq.

Each variable can be either true or false, so there are four possible combinations of truth values:

  1. ppp true and qqq true.

  2. ppp true and qqq false.

  3. ppp false and qqq true.

  4. ppp false and qqq 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:

24=16.2^4=16.24=16.

Equivalently, because there are 22=42^2=422=4 possible input combinations and two possible output values for each combination, the number of operators is:

222=16.2^{2^2}=16.222=16.

There are exactly 161616 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 161616 distinct operators are possible because no more than 161616 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:

p→qp \rightarrow qp→q

It is read as:

If ppp, then qqq.

Here:

  • ppp is the antecedent, hypothesis, or premise.

  • qqq is the consequent or conclusion.

The truth table for implication is:

ppp

qqq

p→qp \rightarrow qp→q

True

True

True

True

False

False

False

True

True

False

False

True

The implication is false in exactly one case:

ppp is true and qqq is false.

In every other case, p→qp \rightarrow qp→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:

  • ppp represent “John becomes prime minister.”

  • qqq represent “Good days come for the country.”

The statement is a promise. It is broken only when:

  • John does become prime minister, so ppp is true.

  • Good days do not come, so qqq is false.

This is exactly the case:

p=True,q=False.p=\text{True},\qquad q=\text{False}.p=True,q=False.

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 ppp 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→qp \rightarrow qp→q

The expression p→qp \rightarrow qp→q may be expressed in several ways:

  • If ppp, then qqq.

  • qqq follows from ppp.

  • ppp is sufficient for qqq.

  • qqq whenever ppp.

  • qqq is necessary for ppp.

  • ppp only if qqq.

These expressions have the same logical meaning, although their wording emphasizes different aspects of the relationship.

Sufficient and Necessary Conditions

The statement

p→qp \rightarrow qp→q

means that ppp is sufficient for qqq:

Whenever ppp is true, qqq must also be true.

It also means that qqq is necessary for ppp:

ppp cannot be true unless qqq is true.

The distinction is important:

  • “ppp is sufficient for qqq” corresponds to p→qp \rightarrow qp→q.

  • “qqq is necessary for ppp” also corresponds to p→qp \rightarrow qp→q.

  • “ppp is necessary for qqq” corresponds to q→pq \rightarrow pq→p.

  • “qqq is sufficient for ppp” corresponds to q→pq \rightarrow pq→p.


Example: “Only If”

Consider the statement:

The speaker will go to the pub only if it is Friday.

Let:

  • ppp represent “The speaker will go to the pub.”

  • qqq represent “It is Friday.”

The statement means:

If the speaker goes to the pub, then it must be Friday.

Therefore, its logical representation is:

p→q.p \rightarrow q.p→q.

It can also be interpreted as:

If it is not Friday, then the speaker will not go to the pub.

Symbolically:

¬q→¬p.\neg q \rightarrow \neg p.¬q→¬p.

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→qp \rightarrow qp→q, not q→pq \rightarrow pq→p.


Contrapositive and Logical Equivalence

A conditional statement is logically equivalent to its contrapositive:

p→q≡¬q→¬p.p \rightarrow q \quad \equiv \quad \neg q \rightarrow \neg p.p→q≡¬q→¬p.

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→qp \rightarrow qp→q
  • Contrapositive:

    ¬q→¬p\neg q \rightarrow \neg p¬q→¬p
  • Converse:

    q→pq \rightarrow pq→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 ppp and qqq 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:

  • ppp represent “The Earth is triangular.”

  • qqq represent “The speaker is the director of an institute.”

The premise ppp is false because the Earth is not triangular. Therefore, according to the truth table for implication:

p→qp \rightarrow qp→q

is true, regardless of whether qqq 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:

p=Trueandq=False.p=\text{True}\quad\text{and}\quad q=\text{False}.p=Trueandq=False.

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=4x+2=4x+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 161616 distinct binary logical operators for two propositional variables.

  • The conditional p→qp \rightarrow qp→q is false only when ppp is true and qqq is false.

  • In p→qp \rightarrow qp→q, ppp is sufficient for qqq, while qqq is necessary for ppp.

  • The conditional is logically equivalent to its contrapositive:

    p→q≡¬q→¬p.p \rightarrow q \equiv \neg q \rightarrow \neg p.p→q≡¬q→¬p.

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent