What is Logic?
Logic is the basis of all mathematical reasoning, and of all automated reasoning. The rules of logic specify the meaning of mathematical statements. These rules help us understand and reason with statements such as –
such that where
Which in Simple English means “There exists an integer that is not the sum of two squares”. Importance of Mathematical Logic The rules of logic give precise meaning to mathematical statements. These rules are used to distinguish between valid and invalid mathematical arguments. Apart from its importance in understanding mathematical reasoning, logic has numerous applications in Computer Science, varying from design of digital circuits, to the construction of computer programs and verification of correctness of programs.
Propositional Logic
What is a proposition? A proposition is the basic building block of logic. It is defined as a declarative sentence that is either True or False, but not both. The Truth Value of a proposition is True(denoted as T) if it is a true statement, and False(denoted as F) if it is a false statement. For Example,
1. The sun rises in the East and sets in the West. 2. 1 + 1 = 2 3. 'b' is a vowel.
All of the above sentences are propositions, where the first two are Valid(True) and the third one is Invalid(False). Some sentences that do not have a truth value or may have more than one truth value are not propositions. For Example,
1. What time is it? 2. Go out and play. 3. x + 1 = 2.
The above sentences are not propositions as the first two do not have a truth value, and the third one may be true or false. To represent propositions, propositional variables are used. By Convention, these variables are represented by small alphabets such as
Truth Table
Since we need to know the truth value of a proposition in all possible scenarios, we consider all the possible combinations of the propositions which are joined together by Logical Connectives to form the given compound proposition. This compilation of all possible scenarios in a tabular format is called a truth table. Most Common Logical Connectives-
1. Negation – If
p | ¬p |
---|---|
T | F |
F | T |
Example, The negation of “It is raining today”, is “It is not the case that is raining today” or simply “It is not raining today”.
2. Conjunction – For any two propositions
p | q | p ∧ q |
---|---|---|
T | T | T |
T | F | F |
F | T | F |
F | F | F |
Example, The conjunction of the propositions
3. Disjunction – For any two propositions
p | q | p ∨ q |
---|---|---|
T | T | T |
T | F | T |
F | T | T |
F | F | F |
Example, The disjunction of the propositions
4. Exclusive Or – For any two propositions
p | q | p ⊕ q |
---|---|---|
T | T | F |
T | F | T |
F | T | T |
F | F | F |
Example, The exclusive or of the propositions
5. Implication – For any two propositions
p | q | p → q |
---|---|---|
T | T | T |
T | F | F |
F | T | T |
F | F | T |
You might wonder that why is
"if, then "" is sufficient for "" when ""a necessary condition for is "" only if "" unless "" follows from "
Example, “If it is Friday then it is raining today” is a proposition which is of the form
6. Biconditional or Double Implication – For any two propositions
p | q | p ↔ q |
---|---|---|
T | T | T |
T | F | F |
F | T | F |
F | F | T |
Some other common ways of expressing
"is necessary and sufficient for ""if then , and conversely"" if "
Example, “It is raining today if and only if it is Friday today.” is a proposition which is of the form
1) Consider the following statements:
P: Good mobile phones are not cheap. Q: Cheap mobile phones are not good. L: P implies Q M: Q implies P N: P is equivalent to Q
Which one of the following about L, M, and N is CORRECT?(Gate 2014)
(A) Only L is TRUE.
(B) Only M is TRUE.
(C) Only N is TRUE.
(D) L, M and N are TRUE.
For solution, see GATE | GATE-CS-2014-(Set-3) | Question 11
2) Which one of the following is not equivalent to p?q (Gate 2015)
For solution, see GATE | GATE-CS-2015 (Set 1) | Question 65
References- Propositional Logic – Wikipedia Principle of Explosion – Wikipedia
Discrete Mathematics and its Applications, by Kenneth H Rosen
Read next part : Introduction to Propositional Logic – Set 2