33
Theory and Algorithms Slide 1.1 Propositional calculus (I) Natural deduction Rafael Ramirez [email protected] Trimester 1, Oct 2003

Propositionalcalculus(I) - dtic.upf.edurramirez/TA/l01.pdf · Slide 1.2 Ex 1 If the train arrives late and there are no taxis at the station, then John is late for his meeting

  • Upload
    vomien

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Theory and Algorithms

Slide 1.1

Propositional calculus (I)Natural deduction

R a f a e l R a m i r e z

[email protected] 1, O c t 2003

Symbolic arguments

Slide 1.2

Ex 1 If the train arrives late and there are no taxis at the station, thenJohn is late for his meeting. John is not late for his meeting.The train did arrive late. Therefore, there were taxis at the sta-tion.

Ex 2 If it is raining and Jane does not have her umbrella with her,then she will get wet. Jane is not wet. It is raining. Therefore,Jane has her umbrella with her.

Both are instances of a symbolic argument of the following type:

� If p and not q, then r. Not r. p. Therefore, q.

Declarative sentences

Slide 1.3

We use only declarative sentences:

Examples

1. The sum of the numbers 3 and 5 equals 8.2. Jane reacted violently to Jack’s accusations.3. Every even number is the sum of two prime numbers.4. All Martians like pepperoni on their pizza.5. Albert Camus etait un ecrivain francais.

Not of this type

— Could you please pass me the salt?— Ready, steady, go!— May fortune come your way.

Syntax

Slide 1.4

Atomic [or indecomposable] sentences like p � q ������� composed using

� : negation, denoted � p (not p)�

: disjunction, denoted p�

q (at least one of p or q)�

: conjunction, denoted p�

q (both p and q)

� : implication, denoted p � q (if p, then q)p is the premise of p � q and q its conclusion

We also use the constant � (denoting a contradiction)

Brackets may be used. Convention (to avoid too many brackets):� binds more tightly then

�and

�, and

both�

and�

bind more tightly than �

Natural deduction

Slide 1.5

Aim

to infer formulas from other formulas using a collection ofproof rules

Such a case is denoted as

φ1 � φ2 ��������� φn�

ψ

where φ1 ��������� φn are called premises and ψ a conclusion

An expression φ1 ��������� φn�

ψ is called sequent.

A sequent is valid if a proof of it may be found using the given proofrules.

The basic rules of natural deduction

Slide 1.6

�:

φ ψφ � ψ

� �i � φ � ψ

φ� �

e1 � φ � ψψ

� �e2 �

�:

φφ � ψ

� �i1 � ψ

φ � ψ� �

i2 �

φ � ψφ...χ

ψ...χ

χ� �

e �

� :

φ...ψ

φ � ψ� � i � φ φ � ψ

ψ� � e � � :

�φ

� � e �

� :

φ...

�� φ

� � i � φ � φ�

� � e � � � :� � φ

φ� � � e �

Some useful derived rules

Slide 1.7

φ � ψ � ψ� φ

�MT � φ

� � φ� � � i �

� φ...

�φ

�RAA � φ � � φ

�LEM �

MT = modus tollensRAA = reductio ad absurdumLEM = law of excluded middle (Latin name: tertium non datur)

Notice: ( � e), from the previous slide, is also called modus ponens.

The rules for conjunction

Slide 1.8

� �introduction

φ ψφ � ψ

� �i �

� �elimination

φ � ψφ

� �e1 � φ � ψ

ψ� �

e2 �

Example 1: p�

q � r�

q�

r

1 p�

q premise2 r premise3 q (

�e2) for 1

4 q�

r (�

i) for 3,2

..conjunction..

Slide 1.9

Example 2:�p�

q � �r� s

�t

�q�

s

1�p�

q � �r premise

2 s�

t premise3 p

�q (

�e1) for 1

4 q (�

e2) for 35 s (

�e1) for 2

6 q�

s (�

i) for 4,5

The rules for double negation

Slide 1.10

� � � introductionφ

� � φ� � � i �

� � � elimination� � φ

φ� � � e �

Example 1: p � � � �q�

r � � � � p�

r

1 p premise2 � � �

q�

r � premise3 � � p ( � � i) for 14 q

�r ( � � e) for 2

5 r (�

e2) for 46 � � p

�r (

�i) for 3,5

The rule for eliminating implication

Slide 1.11

� � elimination (modus ponens)φ φ � ψ

ψ� � e �

Example: p � p � q � p � �q � r � �

r

1 p � �q � r � premise

2 p � q premise3 p premise4 q � r ( � e) for 1,35 q ( � e) for 2,36 r ( � e) for 4,5

..eliminating implication..

Slide 1.12

� � elimination (modus tollens)φ � ψ � ψ

� φ�MT �

Example 1: p � �q � r � � p � � r

� � q

1 p � �q � r � premise

2 p premise3 � r premise4 q � r ( � e) for 1,25 � q (MT) for 4,3

..eliminating implication..

Slide 1.13

Example 2: � p � q � � q�

p

1 � p � q premise2 � q premise3 � � p (MT) for 1,24 p ( � � e) for 3

Example 3: p � � q � q� � p

1 p � � q premise2 q premise3 � � q ( � � i) for 24 � p (MT) for 1,3

The rule for introducing implication

Slide 1.14

� � introduction

φ...ψ

φ � ψ� � i �

This rule is more complicate - it requires to use boxes with tempo-rary assumptions:

� to prove φ � ψ we make a temporary assumption φ and thenprove ψ

The assumption is valid only in this local proof, hence we use boxesto prevent the use of assumptions out of their context.

..introducing implication..

Slide 1.15

Example 1: � q � � p�

p � � � q

1 � q � � p premise234

p assumption� � p ( � � i) for 2� � q (MT) for 1,3

5 p � � � q ( � i) for 2-4

Example 2:�

p � p

1 p assumption2 p � p ( � i) for 1-1

Logical formulas φ such that�

φ holds are called theorems.

..introducing implication..

Slide 1.16

Example 3:� �

q � r � � � � � q � � p � � �p � r � �

1 q � r assumption2 � q � � p assumption3 p assumption4 � � p ( � � i) for 35 � � q (MT) for 2,46 q ( � � e) for 57 r ( � e) for 1,68 p � r ( � i) for 3-79

� � q � � p � � �p � r � ( � i) for 2-8

10�q � r � � � � � q � � p � � �

p � r � � ( � i) for 1-9

Sequents vs theorems

Slide 1.17

The example above show that one may transform a proof

φ1 � φ2 ��������� φn�

ψ

into a proof of a theorem�

φ1� �

φ2� � ����� � �

φn� ψ � ����� � �

..introducing implication..

Slide 1.18

Example 4: p�

q � r� �

p � �q � r �

1 p�

q � r premise2 p assumption3 q assumption4 p

�q (

�i) for 2,3

5 r ( � e) for 1,46 q � r ( � i) for 3-57 p � �

q � r � ( � i) for 2-6

1 p � �q � r � premise

2 p�

q assumption3 p (

�e1) for 2

4 q (�

e2) for 25 q � r ( � e) for 1,36 r ( � e) for 5,47 p

�q � r ( � i) for 2-6

The rules for disjunction

Slide 1.19

� �introduction:

φφ � ψ

� �i1 � ψ

φ � ψ� �

i2 �

� �elimination:

φ � ψφ...χ

ψ...χ

χ� �

e �

Example: commutativity of

Slide 1.20

Example 1: p�

q�

q�

p

1 p�

q premise2 p assumption3 q

�p (

�i2) for 2

4 q assumption5 q

�p (

�i1) for 4

6 q�

p (�

e) for 1,2-3,4-5

Example: monotonicity of implication

Slide 1.21

Example 2: q � r�

p�

q � p�

r

1 q � r premise2 p

�q assumption

3 p assumption4 p

�r (

�i1) for 3

5 q assumption6 r ( � e) for 1,57 p

�r (

�i2) for 6

8 p�

r (�

e) for 2,3-4,5-79 p

�q � p

�r ( � i) for 2-8

Example: distributivity of over

Slide 1.22

Example 3: p� �

q�

r � � �p�

q � � �p�

r �1 p

� �q�

r � premise2 p (

�e1) for 1

3 q�

r (�

e2) for 14 q assumption5 p

�q (

�i) for 2,4

6�p�

q � � �p�

r � (�

i1) for 57 r assumption8 p

�r (

�i) for 2,7

9�p�

q � � �p�

r � (�

i1) for 89

�p�

q � � �p�

r � (�

e) for 3,4-6,7-9

Copy rule

Slide 1.23

Copy rule

� repeat a formula that already appeared in the proof andit is visible in the current point

Notice: It is not allowed to use a formula from a previously opened box which

was already closed in the current point.

Example:�

p � �q � p �

1 p assumption2 q assumption3 p copy of 14 q � p ( � i) for 2-35 p � �

q � p � ( � i) for 1-4

The rules for negation

Slide 1.24

� Contradictions are expressions of the form φ � � φ or � φ � φ� All contradictions are equivalent (one may derive one from the

other); their equivalence class is denoted by �

Moreover, any formula may be derived from such a contradiction:

The sequent p� � p

�q is valid.

Example:

p: The moon is made of green cheese.

q: I like pepperoni on my pizza.

..rules for negation..

Slide 1.25

Rules� � elimination:

φ � φ�

� � e � � :�φ

�� e �

� � introduction:

φ...�� φ

� � i �

..rules for negation..

Slide 1.26

Example 1: � p�

q�

p � q

1 � p�

q premise2 � p assumption3 p assumption4 � ( � e) for 3,25 q ( � e) for 46 p � q ( � i) for 3-57 q assumption8 p assumption9 q copy of 7

10 p � q ( � i) for 8-911 p � q (

�e) for 1,2-6,7-10

..rules for negation..

Slide 1.27

Example 2: p� � q � r� � r� p

�q

1 p� � q � r premise

2 � r premise3 p premise4 � q assumption5 p

� � q (�

i) for 3,46 r ( � e) for 1,57 � ( � e) for 6,28 � � q ( � i) for 4-79 q ( � � e) for 8

Derived rules: 1. Modus tollens

Slide 1.28

Modus tollens:φ � ψ � ψ

� φ�MT �

1 φ � ψ premise2 � ψ premise3 φ assumption4 ψ ( � e) for 1,35 � ( � e) for 4,28 � φ ( � i) for 3-5

Derived rules: 2. ( � � i)

Slide 1.29

� � introduction:φ

� � φ� � � i �

1 φ premise2 � φ assumption3 � ( � e) for 1,24 � � φ ( � i) for 2-3

Derived rules: 3. Reductio ad absurdum

Slide 1.30

Reductio ad absurdum:

� φ...�φ

�RAA �

1 � φ2 ... given proof of � from � φ3 �4 � � φ ( � i) for 1-35 φ ( � � e) for 4

Derived rules: 4. Law of excluded middle

Slide 1.31

Law of excluded middle: φ � � φ�LEM �

1 � �φ � � φ � assumption

2 φ assumption3 φ � � φ (

�i1) for 2

4 � ( � e) for 3,15 � φ ( � i) for 2-46 φ � � φ (

�i2) for 5

7 � ( � e) for 6,18 � � �

φ � � φ � ( � i) for 1-79 φ � � φ ( � � e) for 8

Provable equivalent formulas

Slide 1.32

Two propositional formulas φ and ψ are provably equivalent iffφ

�ψ and ψ

�φ

Examples� �

p�

q � � � � p� � q

� �p�

q � � � � p� � q

p � q� � � q � � p

p � q� � � p

�q

p�

q � r� �

p � �q � r �

Classical vs intuitionistic logic

Slide 1.33

Intuitionistic logic is “constructive” and do not use (RAA), (LEM)or

� � � e � . Example:

� Theorem: There exist irrational numbers a and b such that ab

is rational.

Classical (not intuitionistic) proof:

Take b � 2. By (LEM), either bb is rational or not.— if bb is rational we are done (take a � b);

— if bb is irrational, than take a � 22.

Note: An intuitionistic proof will require to know which variant inthe disjunction is true, having a proof of it.