0% found this document useful (0 votes)
28 views

L2 Logic Concepts

Logic Concepts

Uploaded by

hemant singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

L2 Logic Concepts

Logic Concepts

Uploaded by

hemant singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Logic Concepts

Lecture - 2
Propositional Logic Concepts

• Logic is a study of principles used to


− distinguish correct from incorrect reasoning.
• Formally it deals with
− the notion of truth in an abstract sense and is concerned
with the principles of valid inferencing.
• A proposition in logic is a declarative statements
which are either true or false (but not both) in a
given context. For example,
− “Jack is a male”,
− "Jack loves Mary" etc.

Prof saroj Kaushik, CSE, IITD 2


Cont…
• Given some propositions to be true in a given
context,
− logic helps in inferencing new proposition, which is also
true in the same context.
• Suppose we are given a set of propositions such
as
− “It is hot today" and
− “If it is hot it will rain", then
− we can infer that
“It will rain today".

Prof saroj Kaushik, CSE, IITD 3


Well-formed formula

• Propositional Calculus (PC) is a language of


propositions basically refers
− to set of rules used to combine the propositions to form
compound propositions using logical operators often called
connectives such as Λ, V, ~, →, ↔
• Well-formed formula is defined as:
− An atom is a well-formed formula.
− If α is a well-formed formula, then ~α is a well-formed
formula.
− If α and β are well formed formulae, then (α Λ β), (α V β ),
(α → β), (α ↔ β ) are also well-formed formulae.
− A propositional expression is a well-formed formula if and
only if it can be obtained by using above conditions.

Prof saroj Kaushik, CSE, IITD 4


Truth Table
● Truth table gives us operational definitions of
important logical operators.
− By using truth table, the truth values of well-formed
formulae are calculated.
● Truth table elaborates all possible truth values of a
formula.
● The meanings of the logical operators are given by
the following truth table.

P Q ~P PΛQ PVQ P→ Q P ↔ Q
T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T
Prof saroj Kaushik, CSE, IITD 5
Equivalence Laws
Commutation
1. PΛQ ≅ Q ΛP
2. P V Q ≅ Q V P
Association
1. P Λ (Q Λ R) ≅ (P Λ Q) Λ R
2. P V (Q V R) ≅ (P V Q) V R
Double Negation
~ (~ P) ≅ P
Distributive Laws
1. P Λ ( Q V R) ≅ (P Λ Q) V (P Λ R)
2. P V ( Q Λ R) ≅ (P V Q) Λ (P V R)
De Morgan’s Laws
1. ~ (P Λ Q) ≅ ~P V~Q
2. ~ (P V Q) ≅ ~P Λ~Q
Law of Excluded Middle
P V ~P ≅ T (true)
Law of Contradiction
P Λ ~P ≅ F (false)

Prof saroj Kaushik, CSE, IITD 6


Propositional Logic - PL
● PL deals with
− the validity, satisfiability and unsatisfiability of a formula
− derivation of a new formula using equivalence laws.
● Each row of a truth table for a given formula is
called its interpretation under which a formula can
be true or false.
● A formula α is called tautology if and only
− if α is true for all interpretations.
● A formula α is also called valid if and only if
− it is a tautology.

Prof saroj Kaushik, CSE, IITD 7


Cont..
● Let α be a formula and if there exist at least one
interpretation for which α is true,
− then α is said to be consistent (satisfiable) i.e., if ∃ a model for α,
then α is said to be consistent .
● A formula α is said to be inconsistent (unsatisfiable),
if and only if
− α is always false under all interpretations.
● We can translate
− simple declarative and
− conditional (if .. then) natural language sentences into its
corresponding propositional formulae.

Prof saroj Kaushik, CSE, IITD 8


Example
● Show that " It is humid today and if it is humid then it
will rain so it will rain today" is a valid argument.
● Solution: Let us symbolize English sentences by
propositional atoms as follows:
A : It is humid
B : It will rain
● Formula corresponding to a text:
α : ((A → B) Λ A) → B
● Using truth table approach, one can see that α is true
under all four interpretations and hence is valid
argument.
Prof saroj Kaushik, CSE, IITD 9
Cont..
Truth Table for ((A → B) Λ A) → B

A B A →B=X XΛA= Y →B
Y→

T T T T T

T F F F T

F T T F T

F F T F T

Prof saroj Kaushik, CSE, IITD 10


Cont…

● Truth table method for problem solving is


− simple and straightforward and
− very good at presenting a survey of all the truth possibilities
in a given situation.
● It is an easy method to evaluate
− a consistency, inconsistency or validity of a formula, but the
size of truth table grows exponentially.
− Truth table method is good for small values of n.
● If a formula contains n atoms, then the truth table
will contain 2n entries.
Prof saroj Kaushik, CSE, IITD 11
Cont…Problem with Truth Table Approach
● A formula α : (P Λ Q Λ R) → ( Q V S) is valid can
be proved using truth table.
− A table of 16 rows is constructed and the truth values of α
are computed.
− Since the truth value of α is true under all 16
interpretations, it is valid.
● We notice that if P Λ Q Λ R is false, then α is true
because of the definition of →.
● Since P Λ Q Λ R is false for 14 entries out of 16, we
are left only with two entries to be tested for which α
is true.
− So in order to prove the validity of a formula, all the entries
in the truth table may not be relevant.

Prof saroj Kaushik, CSE, IITD 12


Other Systems
 There are other methods in which the treatment is
more of a syntactic in nature where we will be
concerned with proofs and deductions.
 These methods do not rely on any notion of truth but
only on manipulating sequence of formulae.
− Natural Deductive System
− Axiomatic System
− Semantic Tableaux Method
− Resolution Refutation Method

Prof saroj Kaushik, CSE, IITD 13


Natural deduction method - ND
● ND is based on the set of few deductive inference
rules.
● The name natural deductive system is given because
it mimics the pattern of natural reasoning.
● It has about 10 deductive inference rules.

Conventions:
− E for Elimination, I for Introducing.
− P, Pk , (1 ≤ k ≤ n) are atoms.
− αk, (1 ≤ k ≤ n) and β are formulae.

Prof saroj Kaushik, CSE, IITD 14


ND Rules
Rule 1: I-Λ
Λ (Introducing Λ)
I-Λ
Λ : If P1, P2, …, Pn then P1 Λ P2 Λ …Λ
Λ Pn
Interpretation: If we have hypothesized or proved P1, P2, … and
Pn , then their conjunction P1 Λ P2 Λ …Λ Pn is also proved or
derived.
Rule 2: E-ΛΛ ( Eliminating Λ)
E-Λ
Λ : If P1 Λ P2 Λ …Λ Λ Pn then Pi ( 1 ≤ i ≤ n)
Interpretation: If we have proved P1 Λ P2 Λ …Λ Pn , then any
Pi is also proved or derived. This rule shows that Λ can be
eliminated to yield one of its conjuncts.

Prof saroj Kaushik, CSE, IITD 15


ND Rules – cont…
Rule 3: I-V (Introducing V)
I-V : If Pi ( 1 ≤ i ≤ n) then P1V P2 V …V Pn
Interpretation: If any Pi (1≤ i ≤ n) is proved, then P1V …V Pn
is also proved.
Rule 4: E-V ( Eliminating V)
E-V : If P1 V … V Pn, P1 → P, … , Pn → P then P
Interpretation: If P1 V … V Pn, P1 → P, … , and Pn → P are
proved, then P is proved.

Prof saroj Kaushik, CSE, IITD 16


Rules – cont..

Rule 5: I- → (Introducing → )
I- → : If from α1, …, αn infer β is proved then
α1 Λ … Λαn → β is proved
Interpretation: If given α1, α2, …and αn to be proved and
from these we deduce β then α1 Λ α2 Λ… Λαn → β is also
proved.
Rule 6: E- → (Eliminating → ) - Modus Ponen
E- → : If P1 → P, P1 then P

Prof saroj Kaushik, CSE, IITD 17


Rules – cont…
Rule 7: I- ↔ (Introducing ↔ )
I- ↔ : If P1 → P2, P2 → P1 then P1 ↔ P2
Rule 8: E- ↔ (Elimination ↔ )
E- ↔ : If P1 ↔ P2 then P1 → P2 , P2 → P1
Rule 9: I- ~ (Introducing ~)
I- ~ : If from P infer P1 Λ ~ P1 is proved then
~P is proved
Rule 10: E- ~ (Eliminating ~)
E- ~ : If from ~ P infer P1 Λ ~ P1 is proved
then P is proved

Prof saroj Kaushik, CSE, IITD 18


Cont…
● If a formula β is derived / proved from a set of
premises / hypotheses { α1,…, αn },
− then one can write it as from α1, …, αn infer β .
● In natural deductive system,
− a theorem to be proved should have a form
from α1, …, αn infer β .
● Theorem infer β means that
− there are no premises and β is true under all
interpretations i.e., β is a tautology or valid.

Prof saroj Kaushik, CSE, IITD 19


Cont..
● If we assume that α → β is a premise, then we
conclude that β is proved if α is given i.e.,
− if ‘from α infer β’ is a theorem then α → β is concluded.
− The converse of this is also true.
Deduction Theorem: Infer (α1 Λ α2 Λ… Λ αn → β)
is a theorem of natural deductive system if and
only if
from α1, α2,… ,ααn infer β is a theorem.
Useful tips: To prove a formula α1 Λ α2 Λ… Λ αn →
β, it is sufficient to prove a theorem
from α1, α2, …, αn infer β.

Prof saroj Kaushik, CSE, IITD 20


Examples
Example1: Prove that PΛ(QVR) follows from PΛQ
Solution: This problem is restated in natural
deductive system as "from P ΛQ infer P Λ (Q V
R)". The formal proof is given as follows:

{Theorem} from P ΛQ infer P Λ (Q V R)


{ premise} PΛQ (1)
{ E-Λ , (1)} P (2)
{ E-Λ , (1)} Q (3)
{ I-V , (3) } QVR (4)
{ I-Λ
Λ, ( 2, 4)} P Λ (Q V R) Conclusion

Prof saroj Kaushik, CSE, IITD 21


Cont…

Example2: Prove the following theorem:


infer ((Q → P) Λ (Q → R)) → (Q → (P Λ R))
Solution:
● In order to prove

infer ((Q → P) Λ(Q → R)) → (Q → (P Λ R)),


prove a theorem
from {Q → P, Q → R} infer Q → (P Λ R).
● Further, to prove Q → (P Λ R), prove a sub theorem

from Q infer PΛ R

Prof saroj Kaushik, CSE, IITD 22


Cont..

{Theorem} from Q → P, Q → R infer Q → (P Λ R)


{ premise 1} Q→ P (1)
{ premise 2} Q → R (2)
{ sub theorem} from Q infer P Λ R (3)
{ premise } Q (3.1)
{ E- → , (1, 3.1) } P (3.2)
{E- →, (2, 3.1) } R (3.3)
{ I-Λ, (3.2,3.3) } P Λ R (3.4)
{ I- →, ( 3 )} Q → (P Λ R) Conclusion

Prof saroj Kaushik, CSE, IITD 23


Proof by Contradiction
 Proof by contradiction means that
– we make an assumption and proceed to prove a
contradiction by showing that something is both true and
false.
– Since this can not possibly happen, the assumption must
be false.
 The Rule 9 ( I- ~) and Rule 10 (E- ~) are
contradictory rules used for such proof. These rules
are restated as follows:
Rule 9 (I- ~) : If from P infer (P1 Λ ~ P1 ) is proved then ~P is
proved
Rule 10 (E- ~) : If from ~ P infer (P1 Λ ~ P1 ) is proved then
P is proved
Prof saroj Kaushik, CSE, IITD 24
Proof by Contradiction - Example
 Prove a theorem "infer P → ~~P" using contradiction
rule.
{Theorem } infer P → ~~P
{sub theorem} from P infer P (1)
{premise} P (1.1)
{sub theorem} from ~ P infer P Λ~P (1.2)
{premise} ~P (1.2.1)
{I-Λ, (1.1, 1.2.1)} P Λ~P (1.2.2)
{I- ~, (1.2)} ~~P (1.3)
{deduction theorem} P → ~~P Conclusion

Prof saroj Kaushik, CSE, IITD 25


Soundness and Completeness in
NDS
Theorem : If α is a formula in NDS, then α is a
theorem iff α is valid.
 (Soundness): if α is a theorem of NDS then α is a
valid i.e.,
infer α → |= α.
 (Completeness): if α is valid then α is a theorem
i.e., |= α → infer α.

Prof saroj Kaushik, CSE, IITD 26


Exercises
I. Draw truth tables for each of the following formulae. Which of these represent tautologies?
1. ~ (P V ~ Q)
2. (P V Q) → R
3. P V ( Q → R)
4. ~ P → (P V Q)
5. (~ P → Q) → ( R V S)
II. Which of the following pair of expressions are logical equivalent? Show by using truth table.
1. P Λ Q V R ; P Λ ( Q V R)
2. P → (Q V R) ; ~ P V Q V R
3. (P V ~Q) → R ; ~ ( P V ~ Q Λ ~ R)
III. Translate the following English sentences into corresponding propositional formulae.
1. If I go for shopping then either I buy clothes or I buy vegetables.
2. I spend money only when I buy clothes or I buy vegetables.
IV. Consider following set of sentences in English.
If Jim is a student then he is registered in a college. Jim did not register in a college. Therefore, conclude that Jim is not a
student.
Show that whether they are mutually consistent or inconsistent.

V. Prove the following theorems using deductive inference rules.


1. from P Λ Q, P → R infer R
2. from P ↔ Q, Q infer P
3. from P , Q → R , P → R infer P Λ R
4. infer ( P Λ Q) Λ (P → R) → R
5. infer (P V Q) Λ (P → S) Λ (Q → S) → (S V P V Q)
6. infer ( (Q → P) Λ (Q → R) ) → (Q → (P Λ R))".
7. infer P Λ Q ↔ Q Λ P".
8. infer (P → Q) Λ (Q → R) → (P → R)
9. infer (P V Q) Λ ( P → Q) → Q
10. from ~ ~P infer P using contradictory rule.
11. from P → Q, ~ Q infer ~ P" using contradictory rule

Prof saroj Kaushik, CSE, IITD 27

You might also like