Mathematical Logic
Lecture 07
Lecture 07
In an island, there are two kinds of people: knights and knaves. Knights always tell the truth while knives always lie. In the picture below, three of the island people are shown and we do not know whether they are knights or knaves.
Knights & Knaves | (c) Brilliant.org
Is Channing a Knight or a Knave? (Knights and Knaves Problem from Brilliant.org)
The Franciscan monk Celestine N. Bittle was among the first to describe logic as "the science of correct thinking" [1]. Furthermore, Walicki [2] adds that logical thinking has something to do with the correct argumentation or correct reasoning.
Logic is one of the most fundamental branches of Philosophy, and is also the foundation of mathematical reasoning. It may have come from the Greek word "logos" which means "reason". It is now defined as the study of truth and reason.
"Contrariwise," continued Tweedledee,
"If it was so, it might be,
and if it were so, it would be;
but as it isn't, it ain't.
That's logic!"
Formal logic is a branch of logic that deals with the abstract study of propositions[3]. It very closely resembles mathematical language for being the "precise logic". (There is also another branch called informal logic which deals more on "everyday" reasoning.)
In simpler words, formal logic studies statements in a black-and-white manner where there is a clear separation between truth and falsity. Just like what we did with the Knights and Knaves problem above, we will be evaluating the truth value of statements.
A proposition is a statement that has a well-defined truth value of either true or false. We are clear with our condition of being "well-defined". That is, a proposition needs to be precise, unambiguous, and distinct in whether it is true or false. For example, the statement
"Two is an even number,"
qualifies as a proposition. However, the statement
"The girl is beautiful,"
does not because this is vague and the truth value is not necessarily clearly determined.
The following are also not propositions:
"Are you hungry?"
"Get a piece of paper."
Take note that all propositions are declarative statements, but not all declarative statements are propositions. Also, note that it is not necessary for a statement to be true to be considered a proposition. All that is needed is it has to be either true or false. For example, the statement "4 + 1 = 6" is a proposition regardless being false.
There is also another class of statements that are seemingly self-contradictory but have no truth value. These are called paradoxes. In this class we will not be dealing with paradoxes but if you want to read more about them, especially the famous Russell's paradox, watch this video.
For convenience, we will use a technique called symbolic logic. That means we will use symbols and notations to shorten our writing of propositions and their truth values.
We will use capital letters such as P, Q, and R to denote propositions. We will use the symbol T to mean "true" and F to mean "false". Also, the symbol "≡" denotes logical equivalence which we will define later. So, to say the proposition P is true, we write
P ≡ T
and to say Q is false, we write
Q ≡ F
It is possible to combine two or more propositions. For example:
P: It is raining.
Q: I am hungry.
Then we can say:
"It is raining AND I am hungry."
This is called a compound proposition. The word "AND" which connects the two propositions is called a logical operator or a connective. There are five basic connectives that we will study: NOT, AND, OR, IF...THEN, and IF AND ONLY IF.
So the statement "It is raining and I am hungry" can be symbolically written as
P ∧ Q
Exercise. Write the compound propositions symbolically.
P : "Kaku is blue."
Q : "Kura is red."
R : "White is Kaki."
White is not Kaki.
Kura is red and Kaku is blue.
If Kaku is blue, then white is Kaki.
White is not Kaki or Kaku is not blue.
If Kura is not red, then either Kaku is blue or white is not Kaki.
Exercise. Using the same statements as above, interpret the following:
P → ¬Q
R ↔ ¬(P ∨ Q)
(P ∨ Q) ∧ (R ∨ ¬Q)
Compounding propositions has effects to the truth value. Applying connectives on one or more propositions results to another proposition that has its own truth values. That is why connectives are also called logical operators.
Under the NOT (¬) operator, a true proposition becomes false, while a false proposition becomes true.
For example, the statement "one is odd" is true so that the negation "one is not odd" is false. Also, the statement "zero is a positive number" is false but "zero is not a positive number" is true.
Under the AND (∧) operator, the compound proposition is true if and only if both propositions are true and false if at least one of them is false.
For example, the statement "one is odd and two is positive" is true because both "one is odd" and "two is positive" are true. However, "one is odd and zero is positive" is false because "zero is positive" is false.
Under the OR (∨) operator, the compound proposition is true if at least one of the propositions is true and false if and only if both are false.
The conditional proposition P → Q under the IF...THEN operator is true if and only if either Q is true or both P and Q are false. It is false if and only if P is true but Q is false. Here, P is called the condition, hypothesis, or premise while Q is called the conclusion.
The biconditional proposition P ↔ Q under the IF AND ONLY IF operator is true if and only if both P and Q are true, or when both of them are false.
Using the definitions from above, it is possible to evaluate the truth values of compound logical propositions through a truth table. In a truth table, we obtain the truth value of a compound proposition under all possible combinations of truth values of the underlying component propositions. Let us take the following example:
Example. Construct a truth table for P → ¬Q.
First, we write a table of all combinations of truth values for P and Q.
Next, we add another column for ¬Q. By the definition of negation, if Q is true, then ¬Q is false. Otherwise, if Q is false, then ¬Q is true. Hence, we have:
Finally, we evaluate P → ¬Q:
There is also a rule for the order of evaluating logical operators much like PEMDAS in arithmetic: parenthesis, negation, and then ∨, ∧, →, or ↔. Since logic is a very critical part of mathematical language, we do not wish to be vague in expressing our symbols. We make use of parentheses and other grouping techniques to clearly signify which operations to evaluate first. For example, P ∨ Q ∧ R and P → Q ∨ R are invalid symbolisms of compound logical propositions.
Exercise. Write out the truth table for the following propositions:
¬P ∨ ¬Q
¬(P ∧ Q)
¬(P ∨ Q) → (¬P ∧ Q) --- compare the results with ¬P
P ∨ (Q ∧ R)
Some propositions mean the same thing as others. These are called equivalent logical propositions. Two propositions are logically equivalent if and only if they have the same truth values. For example, ¬P ∨ ¬Q and ¬(P ∧ Q) from the last exercise are logically equivalent. Also, ¬(P ∨ Q) → (¬P ∧ Q) is logically equivalent with ¬P. We use the symbol ≡ to denote logical equivalence between two propositions. Hence,
¬P ∨ ¬Q ≡ ¬(P ∧ Q)
¬(P ∨ Q) → (¬P ∧ Q) ≡ ¬P
One possible way to prove logical equivalence is to use truth tables. If the columns under these propositions have exactly identical truth values, then they are verified to be logically equivalent.
Exercise. Prove that P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R).
Proof.
Exercise. Prove the following logical equivalences using truth tables.
¬P ∨ ¬Q ≡ ¬(P ∧ Q)
¬P ∧ ¬Q ≡ ¬(P ∨ Q)
P → Q ≡ ¬P ∨ Q
Logical equivalence has three basic properties:
Logical equivalence is reflexive. That means any proposition is logically equivalent to itself. In other words, P ≡ P for any proposition P.
Logical equivalence is symmetric. That means if P is logically equivalent to Q, then Q is also logically equivalent to P. In other words, if P ≡ Q then Q ≡ P.
Logical equivalence is transitive. That means that if P is logically equivalent to Q, and Q is logically equivalent to R, then P is logically equivalent to R. In other words, if P ≡ Q and Q ≡ R, then P ≡ R.
Exercise. Using truth tables,
Prove that P ∨ ¬P is always true.
Prove that P ∧ ¬P is always false.
A proposition which is always true is called a tautology, and is usually denoted as T. A statement which is always false is called a fallacy and is denoted F. For example, P ∨ ¬P ≡ T and P ∧ ¬P ≡ F.
Some logical equivalences are considered basic that they can be used to prove more complicated ones. These logical equivalences are called logical identities.
Identity laws
P ∨ F ≡ P
P ∧ T ≡ P
Domination laws
P ∧ F ≡ F
P ∨ T ≡ T
Complement laws
P ∨ ¬P ≡ T
P ∧ ¬P ≡ F
Idempotent laws
P ∨ P ≡ P
P ∧ P ≡ P
Implication
P → Q ≡ ¬P ∨ Q
Double negation law
¬(¬P) ≡ P
Associative laws
P ∨ (Q ∨ R) ≡ (P ∨ Q) ∨ R
P ∧ (Q ∧ R) ≡ (P ∧ Q) ∧ R
Commutative laws
P ∨ Q ≡ Q ∨ P
P ∧ Q ≡ Q ∧ P
Distributive laws
P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R)
P ∧ (Q ∨ R) ≡ (P ∧ Q) ∨ (P ∧ R)
De Morgan's laws
¬P ∨ ¬Q ≡ ¬(P ∧ Q)
¬P ∧ ¬Q ≡ ¬(P ∨ Q)
Contraposition
P → Q ≡ ¬Q → ¬P
Double implication
P ↔ Q ≡ (P → Q) ∧ (Q → P)
As an alternative to truth tables, these logical identities can be used to prove logical equivalences.
Example. Use logical identities to prove that
P ∧ ¬Q ≡ P ∧ (Q → ¬P).
Proof.
In proving logical equivalences using logical identities, the standard process is:
Choose either side of the equivalence as a starting proposition to be your given. (Tip: it is usually easier to start with the more complicated side.)
Use any applicable logical identity.
The last statement should be the other side of the logical equivalence.
What we have given here are just some of the vast number of proven logical identities. For more identities (which you are allowed to use in class), you can read here[4].
Exercise. Prove the following using logical identities.
¬(P ∨ (¬P ∧ Q)) ≡ P ∧ (Q → ¬P)
(P ∧ Q) → (P ∨ Q) ≡ T
Quantifiers are critical to mathematical logic. They are words, expressions, or phrases that indicate the number of elements that a statement or proposition pertains to[5]. There are two types of quantifiers: existential quantifiers and universal quantifiers.
Existential quantifiers assert the existence of something. Examples of existential quantifiers are some, there exists, and at least one. Universal quantifiers are quantifiers assert that every element of a given set satisfy a particular statement. Examples of universal quantifiers are none, no, all, and every.
The existential quantifiers some, there exists, and at least one are logically synonymous. A proposition with an existential quantifier is true if at least one element satisfies the statement. For example, the following are true:
"Some engineers are girls."
"There exists an egg-laying mammal."
"At least one volcano is in the Philippines."
"Some integers are negative."
"There exists an even prime number."
"At least one even number is divisible by three."
Note that existential quantifiers require only at least one element to satisfy the statement in order for the proposition to be true. It could be more: it could be two, or three, or more, or even all elements, as long as it is not zero. For example, "some integers are divisible by one" is logically true, and in fact, all of them are divisible by one.
However, a proposition with existential quantifiers is false when no element satisfies the statement. For example, the following are false:
"Some humans live in Mercury."
"There exists flying turtles."
"At least one planet is also a star."
"Some negative integers are greater than zero."
"There exists an odd number that is divisible by two."
"At least one factor of 16 is an odd number."
The examples above are positive existential quantifiers. Negative existential quantifiers are generally of the form "some are not".
Propositions with universal quantifiers, on the other hand, are true if and only if all elements satisfy (for positive universal quantifiers every, all, each) or all elements do not satisfy (for negative universal quantifiers no and none) the statement. For example the following are true:
"All oceans in the world are salty."
"Every fish can swim."
"No snake has wings."
"All integers are rational numbers."
"Every even number is divisible by two."
"No irrational number is a repeating decimal."
Propositions with universal quantifiers if there is at least one element that fails to satisfy the statement. For example, the following are false:
"All countries in the world are ruled by kings."
"Every fish is swimming in the sea."
"No snake can swim."
"All rational numbers are integers."
"Every number is either positive or negative."
"No even number is divisible by three."
So we can classify quantifiers into four:
Since positive universal quantifiers are false when at least one element fails to satisfy the statement, the negation of positive universal quantifiers are negative existential quantifiers.
This implies that conversely, the negation of negative existential quantifiers are positive universal quantifiers.
Since positive existential quantifiers are false when no element satisfies the statement, the negation of positive existential quantifiers are negative universal quantifiers.
This implies that conversely, the negation of negative universal quantifiers are positive existential quantifiers.
Exercise. The following propositions are false. Negate them to make them true.
All cars are powered by petrol.
Some multiples of 5 have a ones digit of 3.
Some even numbers are not multiples of 2.
No planet in the Solar System has a moon.
[1] Bittle, F. C. N. (2018). The Science of Correct Thinking: Logic. Pickle Partners Publishing.
[2] Walicki, M. (2016). Introduction To Mathematical Logic (Extended Edition). World Scientific Publishing Company.
[3] Hughes, G.E. and Schagrin, Morton L.. "Formal logic". Encyclopedia Britannica, 2 Nov. 2018, https://www.britannica.com/topic/formal-logic. Accessed 10 September 2021.
[4] Toida, S. (2013). Identities. https://www.cs.odu.edu/~toida/nerzic/content/logic/prop_logic/identities/identities.html.
What is logic? What are propositions?
What are the five logical operators?
What are truth tables and how are they used?
What is logical equivalence? How are they proven?
What are the four types of quantifiers? Construct a chart that shows the negative relationships between these quantifiers.