Module 1 DSGT
Module 1 DSGT
LOGIC
Propositional logic in Artificial intelligence
• Propositional logic (PL) is the simplest form of logic where all the statements
are made by propositions. A proposition is a declarative statement which is
either true or false. It is a technique of knowledge representation in logical
and mathematical form.
• Example:
• a) It is Sunday.
• b) The Sun rises from West (False proposition)
• c) 3+3= 7(False proposition)
• d) 5 is a prime number.
Following are some basic facts about propositional logic
• Propositional logic is also called Boolean logic as it works on 0 and 1.
• In propositional logic, we use symbolic variables to represent the logic, and we can
use any symbol for a representing a proposition, such A, B, C, P, Q, R, etc.
• Propositions can be either true or false, but it cannot be both.
• Propositional logic consists of an object, relations or function, and logical
connectives.
• These connectives are also called logical operators.
• The propositions and connectives are the basic elements of the propositional logic.
• Connectives can be said as a logical operator which connects two sentences.
• A proposition formula which is always true is called tautology, and it is also called a
valid sentence.
• A proposition formula which is always false is called Contradiction.
• A proposition formula which has both true and false values is called contingency
• Statements which are questions, commands, or opinions are not propositions such
as "Where is Rohini", "How are you", "What is your name", are not propositions.
Syntax of propositional logic:
• The syntax of propositional logic defines the allowable sentences for the
knowledge representation. There are two types of Propositions:
• Atomic Propositions
• Compound propositions
• Example:
1.a) "It is raining today, and street is wet."
2.b) "Ankit is a doctor, and his clinic is in Mumbai
Logical Connectives:
T F
F T
2: Conjunction: A sentence which has ∧ connective such as, P ∧ Q is called a conjunction.
Example: Rohan is intelligent and hardworking. It can be written as,
P= Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q .
• It means Anding of two statements. If p, q are two statements, then "p and q"
is a compound statement, denoted by p ∧ q and referred as the conjunction of
p and q. The conjunction of p and q is true only when both p and q are true.
Otherwise, it is false.
p q p∧q
T T T
T F F
F T F
F F F
Disjunction:
A sentence which has ∨ connective, such as P ∨ Q. is called disjunction, where P and Q are
the propositions.
E.G: "Ritika is a doctor or Engineer",
Here P= Ritika is Doctor. Q= Ritika is Doctor, so we can write it as P ∨ Q.
• It means Oring of two statements. If p, q are two statements, then "p or q" is a
compound statement, denoted by p ∨ q and referred to as the disjunction of p
and q. The disjunction of p and q is true whenever at least one of the two
statements is true, and it is false only when both p and q are false.
p q p∨q
T T T
T F T
F T T
F F F
Implication: A sentence such as P → Q, is called an implication. Implications are also known as if-then
rules. It can be represented as
E.G If it is raining, then the street is wet.
Let P= It is raining, and Q= Street is wet, so it is represented as P → Q
• An implication p⟶q is the proposition "if p, then q." It is false if p is true and q
is false. The rest cases are true.
p q p⟶q
T T T
T F F
F T T
F F T
Bi-conditional: A sentence such as P⇔ Q is a Biconditional sentence,
E.G If I am breathing, then I am alive.
P= I am breathing, Q= I am alive, it can be represented as P ⇔ Q.
T T T
T F F
F T F
F F T
Tautologies , Contradiction and Contingency:
• 1:Tautologies
• A proposition P is a tautology if it is true under all circumstances. It means it
contains the only T in the final column of its truth table.
• Example: Prove that the statement (p⟶q) ↔(∼q⟶∼p) is a tautology
• Solution: Make the truth table of the above statement:
p q p→q ~q ~p ~q⟶∼p (p→q)⟷(
~q⟶~p)
T T T F F T T
T F F T F F T
F T T F T T T
F F T T T T T
• 2: Contradiction:
• A statement that is always false is known as a contradiction.
• Example: Show that the statement p ∧∼p is a contradiction.
• Solution:
p ∼p p ∧∼p
T F F
F T F
• 3: Contingency:
• A statement that can be either true or false depending on the truth values of its
variables is called a contingency.
•
p q p →q p∧q (p →q)⟶ (p∧q )
T T T T T
T F F F T
F T T F F
F F T F F
Inverse, Converse, and Contra-positive
• If there is a conditional statement x → y, then
• The converse statement will be y → x
• The inverse statement will be ∼x → ∼y
• The contrapositive statement will be ∼y → ∼x
• Consider p: You stay in Mumbai
• q= You visit Hotel Taj Land.
• Determine converse, inverse and contrapositive of p →q. i.e If you stay in
Mumbai, you visit Hotel Taj Land.
• 1: converse ( q → p): “ If you visit Hotel Taj Land you stay in Mumbai”.
• 2: contrapositive( ∼q → ∼p): “If you do not visit Hotel Taj Land, then you do
not stay in Mumbai”.
• 3:inverse (∼p → ∼q): “If you do not visit stay in Mumbai, then you will not
visit Hotel Taj Land ”.
Following is the summarized table for Propositional Logic
Connectives:
Truth Table
• Idempotent Law: In the idempotent law, we only use a single statement. According to this law, if
we combine two same statements with the symbol ∧(and) and ∨(or), then the resultant statement will be the
statement itself. Suppose there is a compound statement P. The following notation is used to indicate the
idempotent law:
1. P ∨ P = P
2. P ∧ P = P
3. The truth table for this law is described as follows:
P P P∨P P∧P
T T T T
F F F F
Commutative Laws:
The two statements are used to show the commutative law. According to this law, if we combine two
statements with the symbol ∧(and) or ∨(or), then the resultant statement will be the same even if we
change the position of the statements. Suppose there are two statements, P and Q. The proposition of
these statements will be false when both statements P and Q are false. In all the other cases, it will be true.
The following notation is used to indicate the commutative law:
P∨Q=Q∨P
P∧Q=Q∧P
• The truth table for these notations is described as follows:
P Q P∨Q Q∨P
T T T T
T F T T
F T T T
F F F F
Associative Law:
The three statements are used to show the associative law. According to this law, if we combine three
statements with the help of brackets by the symbol ∧(and) or ∨(or), then the resultant statement will be the same even if we
change the order of brackets. That means this law is independent of grouping or association. Suppose there are three
statements P, Q and R. The proposition of these statements will be false when P, Q and R are false. In all the other cases, it
will be true. The following notation is used to indicate the associative law:
P ∨ (Q ∨ R) = (P ∨ Q) ∨ R
P ∧ (Q ∧ R) = (P ∧ Q) ∧ R
T T T T T T T
T T F T T T T
T F T T T T T
T F F T F T T
F T T T T T T
F T F T T T T
F F T F T T T
Distributive Law:
The three statements are used to show the distributive law. According to this
law, if we combine a statement by the ∨(OR) symbol with the two other statements which are
joined with the symbol ∧(AND), then the resultant statement will be the same even if we are
separately combining the statements with the symbol ∨(OR) and combining the joined
statements with ∧(AND). Suppose there are three statements P, Q and R. The following notation
is used to indicate the distributive law:
P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R)
P ∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R)
P Q R Q∧R P∨(Q ∧R) P∨Q P∨R (P ∨ Q) ∧ (P ∨ R)
T T T T T T T T
T T F F T T T T
T F T F T T T T
T F F F T T T T
F T T T T T T T
F T F F F T F F
F F T F F F T F
F F F F F F F F
Identity Law:
A single statement is used to show the identity law. According to this law, if we combine a statement and a True
value with the symbol ∨(or), then it will generate the True value. If we combine a statement and a False value with the symbol
∧(and), then it will generate the statement itself. Similarly, we will do this with the opposite symbols. That means if we
combine a statement and a True value with the symbol ∧(and), then it will generate the statement itself, and if we combine a
statement and a False value with the symbol ∨(or), then it will generate the False value. Suppose there is a compound
statement P, a true value T and a false value F. The following notation is used to indicate the identity law:
P ∨ T = T and P ∨ F = P
P ∧ T = P and P ∧ F = F
T T F T T
F T F T F
Complement Law:
A Single statement is used in the complement law. According to this law, if we combine a statement with its complement
statement with the symbol ∨(or), then it will generate the True value, and if we combine these statements with the symbol
∧(and), then it will generate the False value. If we negate a true value, then it will generate a false value, and if we negate a
false value, then it will generate the true value.
P ∨ ¬P = T and P ∧ ¬P = F
¬T = F and ¬F = T
T F T F F T T F
F T T F F T T F
Double Negation Law or Involution Law
A single statement is used to show the double negation law. According to this law, if we do the
negation of a negated statement, then the resultant statement will be the statement itself.
Suppose there is a statement P and a negate statement ¬P. The following notation is used to
indicate the Double negation law:
¬(¬P) ?=P
• The truth table for these notations is described as follows:
P ¬P ¬(¬P)
T F T
F T F
De Morgan's Law:
The two statements are used to show De Morgan's law. According to this law, if we combine two
statements with the symbol ∧(AND) and then do the negation of these combined statements,
then the resultant statement will be the same even if we combine the negation of both
statements separately with the symbol ∨(OR). Suppose there are two compound statements, P
and Q. The following notation is used to indicate De Morgan's Law:
¬(P ∧ Q) = ¬P ∨ ¬Q
¬(P ∨ Q) = ¬P ∧ ¬Q
• The truth table for these notations is described as follows:
P Q ¬P ¬Q P∧Q ¬(P ∧ Q) ¬ P ∨ ¬Q
T T F F T F F
T F F T F T T
F T T F F T T
F F T T F T T
Absorption Law:
The two statements are used to show the absorption law. According to this law, if we combine a statement P by
∨(OR) symbol with the same statement P and one other statement Q, which are joined with the symbol ∧(AND),
then the resultant statement will be the first statement P. The same result will be generated if we interchange the
symbols. Suppose there are two compound statements, P and Q. The following notation is used to indicate the
Absorption Law:
P ∨ (P ∧ Q) = P
P ∧ (P ∨ Q) = P
T T T T T T
T F F T T T
F T F T F F
F F F F F F
Predicate Logic
• A predicate is an expression of one or more variables defined on some specific
domain. A predicate with variables can be made a proposition by either
assigning a value to the variable or by quantifying the variable.
• E.g 1: The Ball’s color is Red
• a= The Ball’s color is Red ( Proposition Logic)
• Color ( Ball’s , Red) (Predicate logic)
1: Universal Quantifiers
2: Existential Quantifiers
• 1: Universal Quantifiers: The quantifier “All” is called Universal Quantifier and it is denoted by ‘∀’.
Or
Universal quantifier states that the statements within its scope are true for every value of the specific
variable.
• Example − "Man is mortal" can be transformed into the propositional form ∀xP(x)
• where P(x) is the predicate which denotes x is mortal
• 2: Existential Quantifiers: The quantifier “Some ” is called Existential
Quantifier and it is denoted by ‘∃’.
or
Existential quantifier states that the statements within its scope are true for
some values of the specific variable.
• The symbol ∃ represents the following phrases have same meaning.
• There exists, There is at least and There is an.
• ∃xP(x) is read as for some values of x, P(x) is true.
The above form is valid. It does not matter what propositions are substituted for the
variables. This type of form is known as the valid argument form. From the above
definition, if a valid argument form consists
Rules of Inference
• We can construct a more complicated valid argument with the help of using
simple arguments, which work as the building blocks. If we are talking about the
usage of arguments, then there are some simple arguments that have been
established as valid and very important. These types of arguments are known as
the Rules of inference. There are various types of Rules of inference, which are
described as follows:
1. Modus Ponens
• Suppose there are two premises, P and P → Q. Now, we will derive Q with the
help of Modules Ponens like this :
P→Q
P
____________
∴Q
• Example:
• Suppose P → Q = "If we have a bank account, then we can take advantage of this
new policy."
• P = "We have a bank account.“
• Therefore, Q = "We can take advantage of this new policy."
2. Modus Tollens
• Suppose there are two premises, P → Q and ¬Q. Now, we will derive ¬P with
the help of Modules Tollens like this:
P→Q
¬Q
____________
∴ ¬P
• Example:
• Suppose P → Q = "If we have a bank account, then we can take advantage of
this new policy."
• ¬Q = "We cannot take advantage of this new policy."
• Therefore, ¬P = "We don't have a bank account."
3. Hypothetical Syllogism
• Suppose there are two premises, P → Q and Q → R. Now, we will derive P → R
with the help of Hypothetical Syllogism like this:
P→Q
Q→R
____________
∴P→R
• Example:
• Suppose P → Q = "If my friends comes to meet me, I will not go to office."
• Q → R = "If I will not go to office, I won't require to do office work."
Therefore, P → R = "If my friends come to meet me, I won't require to do office
work."
4. Disjunction Syllogism
• Suppose there are two premises ¬P and P ∨ Q. Now, we will derive Q with the
help of Disjunction Syllogism like this:
¬P
P∨Q
____________
∴Q
Suppose ¬P = "Harry birthday cake is not strawberry flavored.“
• P ∨ Q = "The birthday cake is either red velvet flavored or mixed fruit flavored."
• Therefore, Q = "The birthday cake is mixed fruit flavored."
5. Addition
• Suppose there is a premise P. Now, we will derive P ∨ Q with the help of Addition
like this:
P
____________
∴P∨Q
• Example:
• Suppose P be the proposition, "Harry is a hard working employee" is true
• Here Q has the proposition, "Harry is a bad employee".
• Therefore, "Either Harry is a hard working employee Or Harry is a bad
employee".
6. Simplification:
• Suppose there is a premise P ∧ Q. Now, we will derive P with the help of
Simplification like this:
P∧Q
____________
∴P
• Example:
• Suppose P ∧ Q = "Harry is a hard working employee, and he is the best
employee in the office".
• Therefore, "Harry is a hard working employee".
7. Conjunction
• Suppose there are two premises P and Q. Now, we will derive P ∧ Q with the help of
conjunction like this:
P
Q
____________
∴P∧Q
• Example:
• Suppose P = "Harry is a hard working employee".
• Suppose Q = "Harry is the best employee in the office".
• Therefore, "Harry is a hard working employee and Harry is the best employee in the
office".
•
8. Resolution
• Suppose there are two premises P ∨ Q and ¬P ∨ R. Now, we will derive Q ∨ R
with the help of a resolution like this:
1.P ∨ Q
2.¬ P ∨ R
3.____________
4.∴ Q ∨ R
• Example:
• Suppose PV Q = "If my friends comes to meet me, I will not go to office".
• ¬ P ∨ R = "If my friends did not come to met me, I won't require to do office
work".
• Therefore, Q ∨ R = "Either I will not go to office or I won't require to do office
work".
9. Constructive Dilemma
• Suppose there are two premises (P → Q) ∧ (R → S) and P ∨ R. Now, we will
derive Q ∨ S with the help of a constructive dilemma like this:
1.(P → Q) ∧ (R → S)
2.P ∨ R
3.____________
4.∴ Q ∨ S
• Example:
• Suppose P → Q = "If my friend will come to meet me, I will not go to office".
• R → S = "If my relatives will come, I will tell my employees that I will come".
• P ∨ R = "Either my friends will comes to meet me or my relatives will come".
• Therefore, Q ∨ S = "Either I will not go to office or I will tell my employees that I
will come".
10. Destructive Dilemma
• Suppose there are two premises (P → Q) ∧ (R → S) and ¬Q ∨ ¬S. Now, we will derive
¬P ∨ ¬R with the help of a Destructive dilemma like this:
1.(P → Q) ∧ (R → S)
2.¬Q ∨ ¬S
3.____________
4.∴ ¬P ∨ ¬R
• Example:
• Suppose P → Q = "If my fiancé comes to meet me, I will not go to office".
• R → S = "If my relatives come, I will tell my employees that I will come".
• ¬Q ∨ ¬S = "Either I will go to office or I will tell my employees that I will not come".
• Therefore, ¬P ∨ ¬R = "Either my fiancé will not come to meet me or my relatives will
not come".
Rules of Inference with Quantifiers
• There are some other rules of inference with quantifier statements, which are
described as follows:
• 1. Universal Instantiation
• Suppose there is a premise ∀x P(x). Now, we will derive P(c) with the help of Universal
Instantiation like this:
1.∀x P(x)
2.____________
3.∴ P(c), for any c
• 2. Universal Generalization
• Suppose there is a premise P(c) for any arbitrary c. Now, we will derive ∀x P(x) with
the help of a Universal generalization like this:
1.P(c) for any arbitrary c
2.____________
3.∴ ∀x P(x)
• 3. Existential Instantiation
• Suppose there is a premise ∃x P(x). Now, we will derive P(c) for some element c
with the help of Existential Instantiation like this:
1.∃x P(x)
2.____________
3.∴ P(c), for some element c
• 4. Existential Generalization
• Suppose there is a premise P(c) for some element c. Now, we will derive ∃x P(x)
with the help of Existential generalization like this:
1.P(c) for some element c
2.____________
3.∴ ∃x P(x)
Mathematical Induction
• Mathematical induction is a concept in mathematics that is used to prove
various mathematical statements and theorems. The principle of
mathematical induction is sometimes referred to as PMI. It is a technique that
is used to prove the basic theorems in mathematics which involve the solution
up to n finite natural terms.
• OR
• Mathematical Induction is one of the fundamental methods of writing proofs
and it is used to prove a given statement about any well-organized set.
Generally, it is used for proving results or establishing statements that are
formulated in terms of n, where n is a natural number. Suppose P(n) is a
statement for n natural number then it can be proved using the Principle of
Mathematical Induction, Firstly we will prove for P(1) then let P(k) is true then
prove for P(k+1). If P(k+1) holds true then we say that P(n) is true by the
principle of mathematical induction.
Principle of Mathematical Induction Statement
Any statement P(n) which is for “n” natural number can be proved using the Principle of
Mathematical Induction by following the below steps,
• Step 1: Verify if the statement is true for trivial cases (n = 1) i.e. check if P(1) is
true.
• Step 2: Assume that the statement is true for n = k for some k ≥ 1 i.e. P(k) is
true.
• Step 3: If the truth of P(k) implies the truth of P(k + 1), then the statement P(n)
is true for all n ≥ 1.
• The image added below contains all the steps of Mathematical Induction
• The first statement is the fact and if it is not possible for all P(n) to
hold true at n = 1 then these statements are true for some other
values of n say n = 2, n = 3, and others.
1. Basis: n=1
• 1={(1)(1+1)}/2
• 1={(1)(2)}/2
• 1=2/2
• 1=1
• Therefore, L.H.S=R.H.S
2. Induction Put n=k & Assume its true
1+2+3+….+k={k(k+1)}/2 say equation 1
3. Put n=k+1, show its true
1+2+3+….+(k+1)={(k+1)(k+1+1)}/2
1+2+3+….+k+(k+1)={(k+1)(k+1+1)}/2
Put equation 1
k(k+1)/2+(k+1)= )={(k+1)(k+1+1)}/2
• 2(k(k+1)/2)+(k+1)2 ={(k+1)(k+1+1)2}/2
• K(k+1)+2(k+1)=(k+1)(k+2)
• Take (k+1) common
• (k+1)(k+2)=(k+1)(k+2)
• Hence Proved
EX :1+2+2^2+….+2^n = 2^n+1-1 , where n>=0
Solution:
Let P(n): n3 + 2n is divisible by 3 be the given statement.
• We cannot represent relations like ALL, some, or none with propositional logic.
Example:
• All the girls are intelligent.
• Some apples are sweet.
• Propositional logic has limited expressive power.
• In propositional logic, we cannot describe statements in terms of their
properties or logical relationships.