Logical reasoning forms the basis for a huge domain of computer science and mathematics. They help in establishing mathematical arguments, valid or invalid.
1. Propositional Logic :
A proposition is basically a declarative sentence that has a truth value. Truth value can either be true or false, but it needs to be assigned any of the two values and not be ambiguous. The purpose of using propositional logic is to analyze a statement, individually or compositely.
For example :
The following statements :
- If x is real, then x2 > 0
- What is your name?
- (a+b)2 = 100
- This statement is false.
- This statement is true.
Are not propositions because they do not have a truth value. They are ambiguous.
But the following statements :
- (a+b)2 = a2 + 2ab + b2
- If x is real, then x2 >= 0
- If x is real, then x2 < 0
- The sun rises in the east.
- The sun rises in the west.
Are all propositions because they have a specific truth value, true or false.
The branch of logic that deals with proposition is propositional logic.
2. Predicate Logic :
Predicates are properties, additional information to better express the subject of the sentence. A quantified predicate is a proposition , that is, when you assign values to a predicate with variables it can be made a proposition.
For example :
In P(x) : x>5, x is the subject or the variable and ‘>5’ is the predicate.
P(7) : 7>5 is a proposition where we are assigning values to the variable x, and it has a truth value, i.e. True.
The set of values that the variables of the predicate can assume is called the Universe or Domain of Discourse or Domain of Predicate.
Difference between Propositional Logic and Predicate Logic :
|Propositional logic is the logic that deals with a collection of declarative statements which have a truth value, true or false.||Predicate logic is an expression consisting of variables with a specified domain. It consists of objects, relations and functions between the objects.|
|It is the basic and most widely used logic. Also known as Boolean logic.||It is an extension of propositional logic covering predicates and quantification.|
|A proposition has a specific truth value, either true or false.||A predicate’s truth value depends on the variables’ value.|
|Scope analysis is not done in propositional logic.||Predicate logic helps analyze the scope of the subject over the predicate. There are three quantifiers : Universal Quantifier (∀) depicts for all, Existential Quantifier (∃) depicting there exists some and Uniqueness Quantifier (∃!) depicting exactly one.|
|Propositions are combined with Logical Operators or Logical Connectives like Negation(¬), Disjunction(∧), Conjunction(∨), Exclusive OR(⊕), Implication(⇒), Bi-Conditional or Double Implication(⇔).||Predicate Logic adds by introducing quantifiers to the existing proposition.|
|It is a more generalized representation.||It is a more specialized representation.|
|It cannot deal with sets of entities.||It can deal with set of entities with the help of quantifiers.|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.