You are on page 1of 55

CS 228 : Logic in Computer Science

Krishna. S

1/18
Basic Rules So Far

I ∧i, ∧e1 , ∧e2 (and introduction and elimination)


I ¬¬e, ¬¬i (double negation elimination and introduction)
I MP (Modus Ponens)
I → i (Implies Introduction : remember opening boxes)
I ∨i1 , ∨i2 , ∨e (Or introduction and elimination)

2/18
The Copy Rule

I ` p → (q → p)

1. true premise
2.

3/18
The Copy Rule

I ` p → (q → p)

1. true premise
2. p assumption
3.

3/18
The Copy Rule

I ` p → (q → p)

1. true premise
2. p assumption
3. q assumption
4.

3/18
The Copy Rule

I ` p → (q → p)

1. true premise
2. p assumption
3. q assumption
4. p copy 2
5.

3/18
The Copy Rule

I ` p → (q → p)

1. true premise
2. p assumption
3. q assumption
4. p copy 2
5. q→p → i 3-4
6.

3/18
The Copy Rule

I ` p → (q → p)

1. true premise
2. p assumption
3. q assumption
4. p copy 2
5. q→p → i 3-4
6. p → (q → p) → i 2-5

3/18
The Rules of Single Negation

I We have seen ¬¬e and ¬¬i, the elimination and introduction of


double negation.

4/18
The Rules of Single Negation

I We have seen ¬¬e and ¬¬i, the elimination and introduction of


double negation.
I How about introducing and eliminating single negations?

4/18
The Rules of Single Negation

I We have seen ¬¬e and ¬¬i, the elimination and introduction of


double negation.
I How about introducing and eliminating single negations?
I We use the notion of contradictions, an expression of the form
ϕ ∧ ¬ϕ, where ϕ is any propositional logic formula.

4/18
The Rules of Single Negation

I We have seen ¬¬e and ¬¬i, the elimination and introduction of


double negation.
I How about introducing and eliminating single negations?
I We use the notion of contradictions, an expression of the form
ϕ ∧ ¬ϕ, where ϕ is any propositional logic formula.
I Any two contradictions are equivalent : p ∧ ¬p is equivalent to
¬r ∧ r . Contradictions denoted by ⊥.

4/18
The Rules of Single Negation

I We have seen ¬¬e and ¬¬i, the elimination and introduction of


double negation.
I How about introducing and eliminating single negations?
I We use the notion of contradictions, an expression of the form
ϕ ∧ ¬ϕ, where ϕ is any propositional logic formula.
I Any two contradictions are equivalent : p ∧ ¬p is equivalent to
¬r ∧ r . Contradictions denoted by ⊥.
I ⊥ → ϕ for any formula ϕ.

4/18
Rules with ⊥

The ⊥ elimination rule ⊥e


ψ

The ⊥ introduction rule ⊥i


ϕ ¬ϕ

5/18
An Example

I ¬p ∨ q ` p → q

1. ¬p ∨ q premise
2.

6/18
An Example

I ¬p ∨ q ` p → q

1. ¬p ∨ q premise
2. ¬p ∨ e (1)
3.

6/18
An Example

I ¬p ∨ q ` p → q

1. ¬p ∨ q premise
2. ¬p ∨ e (1)
3. p assumption
4.

6/18
An Example

I ¬p ∨ q ` p → q

1. ¬p ∨ q premise
2. ¬p ∨ e (1)
3. p assumption
4. ⊥ ⊥i 2,3
5.

6/18
An Example

I ¬p ∨ q ` p → q

1. ¬p ∨ q premise
2. ¬p ∨ e (1)
3. p assumption
4. ⊥ ⊥i 2,3
5. q ⊥e 4
6.

6/18
An Example

I ¬p ∨ q ` p → q

1. ¬p ∨ q premise
2. ¬p ∨ e (1)
3. p assumption
4. ⊥ ⊥i 2,3
5. q ⊥e 4
6. p→q → i 3-5
7. q ∨ e (2)
8.

6/18
An Example

I ¬p ∨ q ` p → q

1. ¬p ∨ q premise
2. ¬p ∨ e (1)
3. p assumption
4. ⊥ ⊥i 2,3
5. q ⊥e 4
6. p→q → i 3-5
7. q ∨ e (2)
8. p assumption
9.

6/18
An Example

I ¬p ∨ q ` p → q

1. ¬p ∨ q premise
2. ¬p ∨ e (1)
3. p assumption
4. ⊥ ⊥i 2,3
5. q ⊥e 4
6. p→q → i 3-5
7. q ∨ e (2)
8. p assumption
9. q copy 7
10. p→q → i 8-9
11. p→q ∨e 1, 2-6, 7-10

6/18
Introducing Negations (PBC)

I In the course of a proof, if you assume ϕ (by opening a box) and


obtain ⊥ in the box, then we conclude ¬ϕ
I This rule is denoted ¬i and is read as ¬ introduction.
I Also known as Proof By Contradiction

7/18
An Example

I p → ¬p ` ¬p

1. p → ¬p premise
2.

8/18
An Example

I p → ¬p ` ¬p

1. p → ¬p premise
2. p assumption
3.

8/18
An Example

I p → ¬p ` ¬p

1. p → ¬p premise
2. p assumption
3. ¬p MP 1,2
4.

8/18
An Example

I p → ¬p ` ¬p

1. p → ¬p premise
2. p assumption
3. ¬p MP 1,2
4. ⊥ ⊥i 2,3
5. ¬p ¬i 2-4

8/18
The Last One

Law of the Excluded Middle (LEM)

ϕ ∨ ¬ϕ

9/18
Summary of Basic Rules

I ∧i, ∧e1 , ∧e2 ,


I ¬¬e
I MP
I →i
I ∨i1 , ∨i2 , ∨e
I Copy, ¬i or PBC
I ⊥e, ⊥i

10/18
Derived Rules

I MT (derive using MP, ⊥i and ¬i)


I ¬¬i (derive using ⊥i and ¬i)
I LEM (derive using ∨i1 , ⊥i, ¬i, ∨i2 , ¬¬e)

11/18
The Proofs So Far

I So far, the “proof” we have seen is purely syntactic, no true/false


meanings were attached

12/18
The Proofs So Far

I So far, the “proof” we have seen is purely syntactic, no true/false


meanings were attached
I Intuitively, p → q ` ¬p ∨ q makes sense because you think
semantically. However, we never used any semantics so far.

12/18
The Proofs So Far

I So far, the “proof” we have seen is purely syntactic, no true/false


meanings were attached
I Intuitively, p → q ` ¬p ∨ q makes sense because you think
semantically. However, we never used any semantics so far.
I Now we show that whatever can be proved makes sense
semantically too.

12/18
Semantics

I Each propositional variable is assigned values true/false. Truth


tables for each of the operators ∨, ∧, ¬, → to determine truth
values of complex formulae.

13/18
Semantics

I Each propositional variable is assigned values true/false. Truth


tables for each of the operators ∨, ∧, ¬, → to determine truth
values of complex formulae.
I ϕ1 , . . . , ϕn |= ψ iff whenever ϕ1 , . . . , ϕn evaluate to true, so does
ψ. |= is read as semantically entails
I Recall `, and compare with |=

13/18
Semantics

I Each propositional variable is assigned values true/false. Truth


tables for each of the operators ∨, ∧, ¬, → to determine truth
values of complex formulae.
I ϕ1 , . . . , ϕn |= ψ iff whenever ϕ1 , . . . , ϕn evaluate to true, so does
ψ. |= is read as semantically entails
I Recall `, and compare with |=
I Formulae ϕ and ψ are provably equivalent iff ϕ ` ψ and ψ ` ϕ

13/18
Semantics

I Each propositional variable is assigned values true/false. Truth


tables for each of the operators ∨, ∧, ¬, → to determine truth
values of complex formulae.
I ϕ1 , . . . , ϕn |= ψ iff whenever ϕ1 , . . . , ϕn evaluate to true, so does
ψ. |= is read as semantically entails
I Recall `, and compare with |=
I Formulae ϕ and ψ are provably equivalent iff ϕ ` ψ and ψ ` ϕ
I Formulae ϕ and ψ are semantically equivalent iff ϕ |= ψ and
ψ |= ϕ

13/18
Soundness of Propositional Logic

ϕ1 , . . . , ϕn ` ψ ⇒ ϕ1 , . . . , ϕn |= ψ

Whenever ψ can be proved from ϕ1 , . . . , ϕn , then ψ evaluates to true


whenever ϕ1 , . . . , ϕn evauate to true

14/18
Soundness

I Assume ϕ1 , . . . , ϕn ` ψ.

15/18
Soundness

I Assume ϕ1 , . . . , ϕn ` ψ.
I There is some proof (of length k lines) that yields ψ. Induct on k .

15/18
Soundness

I Assume ϕ1 , . . . , ϕn ` ψ.
I There is some proof (of length k lines) that yields ψ. Induct on k .
I When k = 1, there is only one line in the proof, say ϕ, which is
the premise. Then we have ϕ ` ϕ, since ϕ is given. But then we
also have ϕ |= ϕ.

15/18
Soundness

I Assume ϕ1 , . . . , ϕn ` ψ.
I There is some proof (of length k lines) that yields ψ. Induct on k .
I When k = 1, there is only one line in the proof, say ϕ, which is
the premise. Then we have ϕ ` ϕ, since ϕ is given. But then we
also have ϕ |= ϕ.
I Assume that whenever ϕ1 , . . . , ϕn ` ψ using a proof of length
6 k − 1, we have ϕ1 , . . . , ϕn |= ψ.

15/18
Soundness

I Assume ϕ1 , . . . , ϕn ` ψ.
I There is some proof (of length k lines) that yields ψ. Induct on k .
I When k = 1, there is only one line in the proof, say ϕ, which is
the premise. Then we have ϕ ` ϕ, since ϕ is given. But then we
also have ϕ |= ϕ.
I Assume that whenever ϕ1 , . . . , ϕn ` ψ using a proof of length
6 k − 1, we have ϕ1 , . . . , ϕn |= ψ.
I Consider now a proof with k lines.

15/18
Soundness : Case ∧i

I How did we arrive at ψ? Which proof rule gave ψ as the last line?

16/18
Soundness : Case ∧i

I How did we arrive at ψ? Which proof rule gave ψ as the last line?
I Assume ψ was obtained using ∧i. Then ψ is of the form ψ1 ∧ ψ2 .

16/18
Soundness : Case ∧i

I How did we arrive at ψ? Which proof rule gave ψ as the last line?
I Assume ψ was obtained using ∧i. Then ψ is of the form ψ1 ∧ ψ2 .
I ψ1 and ψ2 were proved earlier, say in lines k1 , k2 < k .

16/18
Soundness : Case ∧i

I How did we arrive at ψ? Which proof rule gave ψ as the last line?
I Assume ψ was obtained using ∧i. Then ψ is of the form ψ1 ∧ ψ2 .
I ψ1 and ψ2 were proved earlier, say in lines k1 , k2 < k .
I We have the shorter proofs ϕ1 , . . . , ϕn ` ψ1 and ϕ1 , . . . , ϕn ` ψ2

16/18
Soundness : Case ∧i

I How did we arrive at ψ? Which proof rule gave ψ as the last line?
I Assume ψ was obtained using ∧i. Then ψ is of the form ψ1 ∧ ψ2 .
I ψ1 and ψ2 were proved earlier, say in lines k1 , k2 < k .
I We have the shorter proofs ϕ1 , . . . , ϕn ` ψ1 and ϕ1 , . . . , ϕn ` ψ2
I By inductive hypothesis, we have ϕ1 , . . . , ϕn |= ψ1 and
ϕ1 , . . . , ϕn |= ψ2 . By semantics, we have ϕ1 , . . . , ϕn |= ψ1 ∧ ψ2 .

16/18
Soundness : Case → i

I Assume ψ was obtained using → i. Then ψ is of the form


ψ1 → ψ2 .

17/18
Soundness : Case → i

I Assume ψ was obtained using → i. Then ψ is of the form


ψ1 → ψ2 .
I A box starting with ψ1 was opened at some line k1 < k .

17/18
Soundness : Case → i

I Assume ψ was obtained using → i. Then ψ is of the form


ψ1 → ψ2 .
I A box starting with ψ1 was opened at some line k1 < k .
I The last line in the box was ψ2 .

17/18
Soundness : Case → i

I Assume ψ was obtained using → i. Then ψ is of the form


ψ1 → ψ2 .
I A box starting with ψ1 was opened at some line k1 < k .
I The last line in the box was ψ2 .
I The line just after the box was ψ.

17/18
Soundness : Case → i

I Assume ψ was obtained using → i. Then ψ is of the form


ψ1 → ψ2 .
I A box starting with ψ1 was opened at some line k1 < k .
I The last line in the box was ψ2 .
I The line just after the box was ψ.
I Consider adding ψ1 in the premises along with ϕ1 , . . . , ϕn . Then
we will get a proof ϕ1 , . . . , ϕn , ψ1 ` ψ2 , of length k − 1. By
inductive hypothesis, ϕ1 , . . . , ϕn , ψ1 |= ψ2 . By semantics, this is
same as ϕ1 , . . . , ϕn |= ψ1 → ψ2

17/18
Soundness : Case → i

I Assume ψ was obtained using → i. Then ψ is of the form


ψ1 → ψ2 .
I A box starting with ψ1 was opened at some line k1 < k .
I The last line in the box was ψ2 .
I The line just after the box was ψ.
I Consider adding ψ1 in the premises along with ϕ1 , . . . , ϕn . Then
we will get a proof ϕ1 , . . . , ϕn , ψ1 ` ψ2 , of length k − 1. By
inductive hypothesis, ϕ1 , . . . , ϕn , ψ1 |= ψ2 . By semantics, this is
same as ϕ1 , . . . , ϕn |= ψ1 → ψ2
I The equivalence of ϕ1 , . . . , ϕn ` ψ1 → ψ2 and ϕ1 , . . . , ϕn , ψ1 ` ψ2
gives the proof.

17/18
Soundness : Other cases

Do this as homework

18/18

You might also like