Introduction to Mathematical Logic


Introduction to Mathematical Logic

Anna
Hello everyone, and welcome to our introduction to mathematical logic. Today we’ll ask what logic is, why it matters, and how propositional logic lets us build and analyze statements using logical operators.

Corey
At a high level, mathematical logic is the science of reasoning. It gives us ways to verify whether a statement—especially a mathematical statement—is true or false, and it helps us determine whether an argument or proof is valid.

Anna
A useful example is the theorem that the sum of the first n numbers is n times n plus 1, divided by 2. In symbols, that is n(n + 1)/2. The statement is true, and one way to prove it is mathematical induction.

Corey
The induction proof has two essential parts. First, we show that the statement is true for the starting value, described here as n equals 1. Then we assume it is true for an arbitrary value n equals k and use that assumption to show it is true for n equals k plus 1.

Anna
Once both parts are established—the base case and the step from k to k plus 1—we conclude that the theorem is true. Mathematical logic explains why those statements together form a valid proof rather than merely a collection of observations.

Corey
And logic has applications far beyond textbook proofs. It is used in Boolean algebra, which forms a basis for computer architecture, and in program verification and validation.

Anna
Suppose we write software for a particular task. A basic approach is to run it on many inputs and check whether the outputs are correct. But that cannot guarantee correctness, because there may be a bad input we never tested.

Corey
That limitation is especially serious in critical applications, such as software used in an airplane. In those settings, we want the program to perform its intended actions correctly and robustly, not merely to work on the examples we happened to try.

Anna
That is the goal of program verification and validation, a major area of computer science. Mathematical logic is used to reason about whether a program performs its intended task.

Corey
The same idea applies to hardware verification. If a motherboard contains many embedded chips and units, logic can help us verify whether those components have been integrated correctly and whether the hardware performs the required task.

Anna
Mathematical logic also appears in artificial intelligence. The programming language PROLOG, used extensively in AI applications, is based on mathematical logic.

Corey
And in automated theorem proving, we write computer programs that try to determine whether a statement is true or false by proving it. So logic supports both human reasoning and computer-based reasoning.

Anna
There are different types of mathematical logic. The basic form is propositional logic, and predicate logic is a generalization of propositional logic. We’ll begin with propositions.

Corey
Informally, a proposition is a declarative statement that is either true or false. It cannot have both truth values simultaneously.

Anna
For example, “New Delhi is the capital of India” is a proposition. It declares something about New Delhi, and the statement has one definite truth value: it is either true or false.

Corey
“Bahubali was killed by Katappa” is another example of a proposition in the context given. It is a declarative statement and, according to the events of the film, it is true.

Anna
Now compare those with “x plus 2 equals 4.” That expression looks declarative, but x has not been assigned a value. Depending on x, the statement can be true or false, so as presented it is not a proposition.

Corey
Next we introduce propositional variables. They are usually written with lowercase letters such as p, q, and r, and they act as placeholders for arbitrary propositions.

Anna
Their truth values depend on the propositions assigned to them. It is similar to declaring an integer variable in a programming language: an integer variable can store an integer, while a propositional variable can represent a proposition whose value is true or false.

Corey
A compound proposition is formed by combining propositions with logical operators. The simplest example is negation, which is a unary operator because it acts on one proposition.

Anna
If p is true, then not p is false. If p is false, then not p is true. The notation used in the lecture represents negation with a specific symbol, although other books may use a tilde, such as ~p, or a bar over p.

Corey
The conjunction operator is logical AND, usually written as p conjunction q. It is binary because it operates on two propositions. The conjunction is true only when both p and q are true; if either one is false, the conjunction is false.

Anna
Disjunction is logical OR. It is also binary, and it is true when at least one of p or q is true. It is false only when both p and q are false.

Corey
These are called logical operators because they operate on propositional variables. In two-valued logic, the result of applying an operator is always either true or false.

Anna
Here is a useful counting question: how many distinct logical operators can be defined on two propositional variables, p and q?

Corey
Every operator on p and q is determined by its truth table. There are four possible input combinations: true-true, true-false, false-true, and false-false.

Anna
For each of those four rows, the operator’s output can independently be either true or false. Therefore the number of possible truth tables is 2 multiplied by 2 multiplied by 2 multiplied by 2, which is 16.

Corey
So there are exactly 16 distinct logical operators on two propositional variables. We can give those operators different names—such as conjunction, disjunction, XOR, or exclusive NOR—but we cannot create more than 16 distinct operators because there are only 16 possible truth tables.

Anna
Now let’s discuss the conditional operator, written p implies q, and often expressed in English as “if p, then q.” Its truth table is true in three cases and false only when p is true and q is false.

Corey
The unusual part is that p implies q is true when p is false, regardless of q. Consider a candidate named John who promises, “If I become prime minister, then good days will come for the country.”

Anna
John breaks that promise only if he becomes prime minister but good days do not come. That is the case p true and q false. If John never becomes prime minister, then the promise has not been broken, whether or not good days come, so the conditional is treated as true.

Corey
The conditional can also be read as “q follows from p” or “p is sufficient for q.” In other words, once p is ensured, q is the conclusion we can reach.

Anna
There are two phrases that often confuse students: “q is necessary for p” and “p only if q.” Both represent p implies q. The key is that q must hold whenever p holds, but q does not have to be enough by itself to guarantee p.

Corey
To see why, p implies q is logically equivalent to not q implies not p. Both expressions have the same truth table. This is the contrapositive relationship: if q is necessary for p, then the absence of q rules out p.

Anna
Take the statement, “I will go to the pub only if it is Friday.” Let p mean “I will go to the pub,” and q mean “it is Friday.” The statement says that if I go to the pub, then it must be Friday, so it is represented by p implies q.

Corey
Equivalently, if it is not Friday, then I will not go to the pub: not q implies not p. Friday is necessary for going to the pub, but it is not sufficient, because even on a Friday I might be ill or have personal work and decide not to go.

Anna
That is why the statement is not q implies p. That version would say, “If it is Friday, then I will go to the pub,” which is stronger and is not what the original sentence means.

Corey
In a conditional p implies q, p is called the hypothesis, antecedent, or premise. The q part is called the conclusion or consequence.

Anna
Finally, the premise and conclusion do not need to be related in an everyday English sense. For example, “If the Earth is triangular, then Dr. Ashish is the director of IIIT Bangalore” is logically true in the given discussion because the premise is false.

Corey
The truth or falsity of the conclusion does not change that result. Since p is false, the conditional p implies q is true according to its truth table, even if q itself is false. In mathematical logic, p and q are simply propositions whose logical values determine the compound statement.

Anna
So we’ve introduced mathematical logic and its applications, defined propositions and propositional variables, and seen how compound propositions are built.

Corey
We also covered negation, conjunction, disjunction, and the conditional operator, including the 16 possible binary logical operators and the meanings of “necessary,” “sufficient,” and “only if.” That gives us the foundation for continuing our study of propositional logic.

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