Basics of Propositional Logic and Truth Tables
By Anjali Dubey
Logic has been called the “calculus of computer science”. It is a valid reasoning that enables you to draw a conclusion.There are various ways to provide logic. It can be done through thoughts, signals, impressions, statements etc. In computers, there is a branch of logic called propositional logic. Also known as sentential or statement logic, it is the logic which is endeavoured through sentences.
A proposition is a sentence from which a conclusion can be drawn in terms of true/false or yes/no. For example: “Is today Monday?”, “Are you wearing the red shirt?”, “Do you want to eat?”. When representing a proposition there are two parts:
A: Today is Sunday.
Where A is a propositional variable and Today is Sunday is the propositional constant.
There are two kinds of propositions:
1 - Simple Proposition: A proposition which is written in the form of a single simple sentence. For example:
It is raining today.
Milk is liquid
The sky is blue.
2 - Compound Propositions: Two or more propositions are joined with the help of connectives.
💡Connectives are connecting words like ‘and’ or ‘or’ which are used to join two or more propositions together.
Ex - a: "Harry is honest."
b: "Mike is dishonest."
a.b: "Harry is honest and Mike is dishonest."
💡A truth table is table which is used to represent all the possible combinational values of the variables in an expression. The values represented by the truth table are called ‘true values’.
Here are some other common terms associated with connectives:
1 - Conjunction(.,^) or AND- is used to combine two or more simple propositions together where the answer is ‘true’ if all the values are true and is ‘false’ even if one of the values are false.
Ex - a: "Seema is healthy"
b: "She can climb a tree"
a.b: "Seema is healthy and she can climb a tree:
2 - Disjunction(+,v) or OR: It is used to combine two or more simple propositions where the answer is true if either of the statements are ‘true’ otherwise it returns ‘false’.
Ex - a: ”Sydney is singing”
b: ”She is reading”
a+b: ”Sydney is singing or reading”
3 - Negation(-,’): As the name suggests it is used to negate or reverse the value of a proposition.
Ex - a: ”Computer is not fun”
a’: ”Computer is fun”
3 - Implication(⇒): It is applicable to the compound statement using the connective “if…….then”.
Ex - a: "It is cloudy"
b: ”It will rain”
a⇒b: ”If it is cloudy then it will rain”
It is also expressed as a⇒b = a’+b
4- Equivalence(⇔) or biconditional: It is applicable to the compound statement using the connective “if and only if”.
It is also expressed as a⇔b = a’b’+a.b
💡Tautology is the condition when the resultant column of the truth table has all true values or (1’s).
Contradiction is the condition when the resultant column of the truth table has all false or (0’s).
Logical reasoning provides the theoretical base for many areas of mathematics as well as computer science. It has many practical applications in the fields of computer science like design of computing machines, artificial intelligence, definition of data structures for programming languages etc.
Feel free to leave any suggestions or queries that you have down below in the comments!