You are on page 1of 15

Logic in Computer Science

Dr. Tathagata Ray


Associate Professor, BITS Pilani, Hyderabad Campus
rayt@hyderabad.bits-pilani.ac.in
BITS Pilani
Hyderabad Campus
Summary
Rule Name
𝜙 𝜓 And introduction
∧𝑖
𝜙∧𝜓

𝜙∧𝜓 And Elimination 1


∧ 𝑒1
𝜙
𝜙∧𝜓 And Elimination 2
∧ 𝑒2
𝜓
¬¬𝜙 Double –negation elimination
¬¬𝑒
𝜙
𝜙 Double-negation introduction
¬¬𝑖
¬¬𝜙
𝜙 𝜙 ⟶𝜓 Rule for eliminating implication
⟶𝑒
𝜓
𝜙 ⟶ 𝜓 ¬𝜓 Modus Tollens (MT)
𝑀𝑇
¬𝜙
BITS Pilani, Hyderabad Campus
Example

• Proof the validity of the following sequent


• ¬𝑝 → 𝑞, ¬𝑞 ⊢ 𝑝
• Proof
• 1.¬𝑝 → 𝑞 premise
• 2.¬𝑞 premise
• 3. ¬¬𝑝 MT 1,2
• 4. 𝑝 ¬¬𝑒 3

BITS Pilani, Hyderabad Campus


Example

• Prove the validity of the following sequent


• 𝑝 → ¬𝑞, 𝑞 ⊢ ¬𝑝
• Proof
• 1.𝑝 → ¬𝑞 premise
• 2.𝑞 premise
• 3. ¬¬𝑞 ¬¬𝑖 2
• 4.¬𝑝 MT 1,3

BITS Pilani, Hyderabad Campus


The rule implies introduction

• We can prove 𝑝 → 𝑞, ¬𝑞 ⊢ ¬𝑝 use MT.


• But it seems we can also conclude
• 𝑝 → 𝑞 ⊢ ¬𝑞 → ¬𝑝
• Now recall all the rules. None of the rule has a
conclusion with implication. So we cannot prove it with
the given set of rules so far.

BITS Pilani, Hyderabad Campus


The rule implies introduction

• Let us suppose that 𝑝 → 𝑞 is the case.


• If we temporarily assume that ¬𝑞 holds, we can use MT
to infer ¬𝑝.
• Thus assuming 𝑝 → 𝑞 we can show that ¬𝑞 → ¬𝑝.
• Proof:
• 1. 𝑝 → 𝑞 Premise
• 2. ¬𝑞 Assumption
• 3. ¬𝑝 MT 1,2
• 4. ¬𝑞 → ¬𝑝 → 𝑖 2-3
• The box demarcates the scope of the temporary
assumption.

BITS Pilani, Hyderabad Campus


The rule implies introduction

• Note that we started with ¬𝑞 as an assumption and


arrived at ¬𝑝. So we can conclude ¬𝑞 → ¬𝑝, which it
self is not dependent on the assumption ¬𝑞.

• In general → 𝑖 rule looks like as follows


𝜙
..
.
𝜓
• ⟶𝑖
𝜙⟶𝜓

BITS Pilani, Hyderabad Campus


• Prove the validity of the following sequent
• ¬𝑞 → ¬𝑝 ⊢ 𝑝 → ¬¬𝑞
• Proof:
• 1. ¬𝑞 → ¬𝑝 Premise
• 2. 𝑝 Assumption
• 3. ¬¬𝑝 ¬¬𝑖 2
• 4. ¬¬𝑞 MT 1,3
• 5. 𝑝 → ¬¬𝑞 → 𝑖 2-4

BITS Pilani, Hyderabad Campus


Example

• Prove the validity of the following sequent.


• ⊢𝑝→𝑝
• Proof
• 1. 𝑝 Assumption
• 2. 𝑝 → 𝑝 → 𝑖 1-1

• It is not necessary that 𝜙 and 𝜓 do not coincide.


• Definition: Logical formulas 𝜙 with valid sequent ⊢ 𝜙 are
theorems.

BITS Pilani, Hyderabad Campus


• Prove the theorem
• ⊢ (𝑞 ⟶ 𝑟) ⟶ ( ¬𝑞 ⟶ ¬𝑝 ⟶ 𝑝 ⟶ 𝑟 )
• Proof

BITS Pilani, Hyderabad Campus


• Prove the theorem
• ⊢ (𝑞 ⟶ 𝑟) ⟶ ( ¬𝑞 ⟶ ¬𝑝 ⟶ 𝑝 ⟶ 𝑟 )
• Proof
• 1. 𝑞 ⟶ 𝑟 assumption
• 2. ¬𝑞 ⟶ ¬𝑝 assumption
• 3. 𝑝 assumption
• 4. ¬¬𝑝 ¬¬𝑖 3
• 5. ¬¬𝑞 1 1 MT 2,4
• 6. 𝑞 ¬¬𝑒 5
• 7. 𝑟 ⟶ 𝑒 1,6
• 8. 𝑝 ⟶ 𝑟 ⟶𝑖3−7
• 9. ¬𝑞 ⟶ ¬𝑝 ⟶ 𝑝 ⟶ 𝑟 ⟶𝑖2−8
• 10. 𝑞 ⟶ 𝑟 ⟶ ¬𝑞 ⟶ ¬𝑝 ⟶ 𝑝 ⟶ 𝑟 ⟶ 𝑖 1 − 9
BITS Pilani, Hyderabad Campus
Example

• Prove the sequent


• 𝑝∧𝑞 ⟶𝑟 ⊢𝑝⟶ 𝑞 ⟶𝑟
• Proof
• 1 𝑝∧𝑞 ⟶𝑟 Premise
• 2 𝑝 𝐴𝑠𝑠𝑢𝑚𝑝𝑡𝑖𝑜𝑛
• 3 𝑞 Assumption
• 4 𝑝∧𝑞 ∧ 𝑖 2,3
• 5 r ⟶ 𝑒 1,4
• 6 𝑞⟶𝑟 ⟶𝑖3−5
• 7 𝑝⟶ 𝑞⟶𝑟 ⟶𝑖2−6

BITS Pilani, Hyderabad Campus
Example

• Prove the sequent


• 𝑝 ⟶ 𝑞 ⟶𝑟 ⊢𝑝∧𝑞 ⟶𝑟
• Proof
• 1 𝑝⟶ 𝑞⟶𝑟 Premise
• 2 𝑝∧𝑞 𝐴𝑠𝑠𝑢𝑚𝑝𝑡𝑖𝑜𝑛
• 3 𝑝 ∧ 𝑒1 2
• 4 𝑞 ∧ 𝑒2 2
• 5 𝑞⟶𝑟 ⟶ 𝑒 1,3
• 6 𝑟 ⟶ 𝑒 5,4
• 7 𝑝∧𝑞 ⟶𝑟 ⟶𝑖2−6

BITS Pilani, Hyderabad Campus
Example

• Last two examples show that both left side formula can
be proved from the right side formula and vice versa.
Hence the two formulas are equivalent.

• 𝑝 ∧ 𝑞 ⟶ 𝑟 ⊣⊢ 𝑝 ⟶ 𝑞 ⟶ 𝑟

BITS Pilani, Hyderabad Campus


Example

• Prove the theorem


• 𝑝 ⟶𝑞 ⊢𝑝∧𝑟 ⟶𝑞∧𝑟
• Proof
• 1. 𝑝 ⟶ 𝑞 Premise
• 2. 𝑝 ∧ 𝑟 Assumption
• 3. 𝑝 ∧ 𝑒1 2
• 4. 𝑟 ∧ 𝑒2 2
• 5. 𝑞 ⟶ 𝑒 1,3
• 6 𝑞∧𝑟 ∧ 𝑖 5,4
• 7 𝑝∧𝑟 ⟶𝑞∧𝑟

BITS Pilani, Hyderabad Campus

You might also like