The rules of mathematical logic specify methods of reasoning mathematical statements. Greek philosopher, Aristotle, was the pioneer of logical reasoning. Logical reasoning provides the theoretical base for many areas of mathematics and consequently computer science. It has many practical applications in computer science like design of computing machines, artificial intelligence, definition of data structures for programming languages etc.
Propositional Logic is concerned with statements to which the truth values, “true” and “false”, can be assigned. The purpose is to analyze these statements either individually or in a composite manner.
A proposition is a collection of declarative statements that has either a truth value "true” or a truth value "false". A propositional consists of propositional variables and connectives. We denote the propositional variables by capital letters (A, B, etc). The connectives connect the propositional variables.
Some examples of Propositions are given below −
The following is not a Proposition −
"A is less than 2". It is because unless we give a specific value of A, we cannot say whether the statement is true or false.
In propositional logic generally we use five connectives which are −
OR ($\lor$)
AND ($\land$)
Negation/ NOT ($\lnot$)
Implication / if-then ($\rightarrow$)
If and only if ($\Leftrightarrow$).
OR ($\lor$) − The OR operation of two propositions A and B (written as $A \lor B$) is true if at least any of the propositional variable A or B is true.
The truth table is as follows −
A | B | A ∨ B |
---|---|---|
True | True | True |
True | False | True |
False | True | True |
False | False | False |
AND ($\land$) − The AND operation of two propositions A and B (written as $A \land B$) is true if both the propositional variable A and B is true.
The truth table is as follows −
A | B | A ∧ B |
---|---|---|
True | True | True |
True | False | False |
False | True | False |
False | False | False |
Negation ($\lnot$) − The negation of a proposition A (written as $\lnot A$) is false when A is true and is true when A is false.
The truth table is as follows −
A | ¬ A |
---|---|
True | False |
False | True |
Implication / if-then ($\rightarrow$) − An implication $A \rightarrow B$ is the proposition “if A, then B”. It is false if A is true and B is false. The rest cases are true.
The truth table is as follows −
A | B | A → B |
---|---|---|
True | True | True |
True | False | False |
False | True | True |
False | False | True |
If and only if ($ \Leftrightarrow $) − $A \Leftrightarrow B$ is bi-conditional logical connective which is true when p and q are same, i.e. both are false or both are true.
The truth table is as follows −
A | B | A ⇔ B |
---|---|---|
True | True | True |
True | False | False |
False | True | False |
False | False | True |
A Tautology is a formula which is always true for every value of its propositional variables.
Example − Prove $\lbrack (A \rightarrow B) \land A \rbrack \rightarrow B$ is a tautology
The truth table is as follows −
A | B | A → B | (A → B) ∧ A | [( A → B ) ∧ A] → B |
---|---|---|---|---|
True | True | True | True | True |
True | False | False | False | True |
False | True | True | False | True |
False | False | True | False | True |
As we can see every value of $\lbrack (A \rightarrow B) \land A \rbrack \rightarrow B$ is "True", it is a tautology.
A Contradiction is a formula which is always false for every value of its propositional variables.
Example − Prove $(A \lor B) \land \lbrack ( \lnot A) \land (\lnot B) \rbrack$ is a contradiction
The truth table is as follows −
A | B | A ∨ B | ¬ A | ¬ B | (¬ A) ∧ ( ¬ B) | (A ∨ B) ∧ [( ¬ A) ∧ (¬ B)] |
---|---|---|---|---|---|---|
True | True | True | False | False | False | False |
True | False | True | False | True | False | False |
False | True | True | True | False | False | False |
False | False | False | True | True | True | False |
As we can see every value of $(A \lor B) \land \lbrack ( \lnot A) \land (\lnot B) \rbrack$ is “False”, it is a contradiction.
A Contingency is a formula which has both some true and some false values for every value of its propositional variables.
Example − Prove $(A \lor B) \land (\lnot A)$ a contingency
The truth table is as follows −
A | B | A ∨ B | ¬ A | (A ∨ B) ∧ (¬ A) |
---|---|---|---|---|
True | True | True | False | False |
True | False | True | False | False |
False | True | True | True | True |
False | False | False | True | False |
As we can see every value of $(A \lor B) \land (\lnot A)$ has both “True” and “False”, it is a contingency.
Two statements X and Y are logically equivalent if any of the following two conditions hold −
The truth tables of each statement have the same truth values.
The bi-conditional statement $X \Leftrightarrow Y$ is a tautology.
Example − Prove $\lnot (A \lor B) and \lbrack (\lnot A) \land (\lnot B) \rbrack$ are equivalent
A | B | A ∨ B | ¬ (A ∨ B) | ¬ A | ¬ B | [(¬ A) ∧ (¬ B)] |
---|---|---|---|---|---|---|
True | True | True | False | False | False | False |
True | False | True | False | False | True | False |
False | True | True | False | True | False | False |
False | False | False | True | True | True | True |
Here, we can see the truth values of $\lnot (A \lor B) and \lbrack (\lnot A) \land (\lnot B) \rbrack$ are same, hence the statements are equivalent.
A | B | ¬ (A ∨ B ) | [(¬ A) ∧ (¬ B)] | [¬ (A ∨ B)] ⇔ [(¬ A ) ∧ (¬ B)] |
---|---|---|---|---|
True | True | False | False | True |
True | False | False | False | True |
False | True | False | False | True |
False | False | True | True | True |
As $\lbrack \lnot (A \lor B) \rbrack \Leftrightarrow \lbrack (\lnot A ) \land (\lnot B) \rbrack$ is a tautology, the statements are equivalent.
Implication / if-then $(\rightarrow)$ is also called a conditional statement. It has two parts −
As mentioned earlier, it is denoted as $p \rightarrow q$.
Example of Conditional Statement − “If you do your homework, you will not be punished.” Here, "you do your homework" is the hypothesis, p, and "you will not be punished" is the conclusion, q.
Inverse − An inverse of the conditional statement is the negation of both the hypothesis and the conclusion. If the statement is “If p, then q”, the inverse will be “If not p, then not q”. Thus the inverse of $p \rightarrow q$ is $ \lnot p \rightarrow \lnot q$.
Example − The inverse of “If you do your homework, you will not be punished” is “If you do not do your homework, you will be punished.”
Converse − The converse of the conditional statement is computed by interchanging the hypothesis and the conclusion. If the statement is “If p, then q”, the converse will be “If q, then p”. The converse of $p \rightarrow q$ is $q \rightarrow p$.
Example − The converse of "If you do your homework, you will not be punished" is "If you will not be punished, you do your homework”.
Contra-positive − The contra-positive of the conditional is computed by interchanging the hypothesis and the conclusion of the inverse statement. If the statement is “If p, then q”, the contra-positive will be “If not q, then not p”. The contra-positive of $p \rightarrow q$ is $\lnot q \rightarrow \lnot p$.
Example − The Contra-positive of " If you do your homework, you will not be punished” is "If you are punished, you did not do your homework”.
Duality principle states that for any true statement, the dual statement obtained by interchanging unions into intersections (and vice versa) and interchanging Universal set into Null set (and vice versa) is also true. If dual of any statement is the statement itself, it is said self-dual statement.
Example − The dual of $(A \cap B ) \cup C$ is $(A \cup B) \cap C$
We can convert any proposition in two normal forms −
A compound statement is in conjunctive normal form if it is obtained by operating AND among variables (negation of variables included) connected with ORs. In terms of set operations, it is a compound statement obtained by Intersection among variables connected with Unions.
Examples
$(A \lor B) \land (A \lor C) \land (B \lor C \lor D)$
$(P \cup Q) \cap (Q \cup R)$
A compound statement is in disjunctive normal form if it is obtained by operating OR among variables (negation of variables included) connected with ANDs. In terms of set operations, it is a compound statement obtained by Union among variables connected with Intersections.
Examples
$(A \land B) \lor (A \land C) \lor (B \land C \land D)$
$(P \cap Q) \cup (Q \cap R)$