Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of...

85
Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1 / 23

Transcript of Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of...

Page 1: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Propositional LogicExercises

Mario Alviano

University of Calabria, Italy

A.Y. 2017/2018

1 / 23

Page 2: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Outline

1 Understanding

2 Tautologies, contradictions, satisfiability, etc.

3 Normal Forms

4 Modelling

5 Reduction to Satisfiability

2 / 23

Page 3: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Outline

1 Understanding

2 Tautologies, contradictions, satisfiability, etc.

3 Normal Forms

4 Modelling

5 Reduction to Satisfiability

3 / 23

Page 4: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridge

You note that after cube 25 comes cube 27You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?

You have never seen cube 42Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 5: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0

The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridge

You note that after cube 25 comes cube 27You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?

You have never seen cube 42Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 6: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2

You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridge

You note that after cube 25 comes cube 27You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?

You have never seen cube 42Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 7: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridge

You note that after cube 25 comes cube 27You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?

You have never seen cube 42Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 8: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridge

You note that after cube 25 comes cube 27You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?

You have never seen cube 42Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 9: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridgeYou note that after cube 25 comes cube 27

You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?

You have never seen cube 42Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 10: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridgeYou note that after cube 25 comes cube 27You conclude that there is no cube 26

Perhaps, it may be an exception! (I really don’t know)3 Reached cube 31, someone asks you where is cube 42?

You have never seen cube 42Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 11: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridgeYou note that after cube 25 comes cube 27You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?

You have never seen cube 42Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 12: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridgeYou note that after cube 25 comes cube 27You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?

You have never seen cube 42Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 13: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridgeYou note that after cube 25 comes cube 27You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?You have never seen cube 42

Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 14: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridgeYou note that after cube 25 comes cube 27You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?You have never seen cube 42Still you can provide an answer

Cube 42 is north of here (or there is no cube 42!)

4 / 23

Page 15: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (1)

Deduction, induction, or abduction?

1 You are walking on the bridge at Unical for the first time,South to North direction

You see a cube with a sign 0The next one has a sign 1, and then one with sign 2You conclude that cubes are associated to increasingnatural numbers, where 0 is associated to the south-mostcube

2 You are still walking on the bridgeYou note that after cube 25 comes cube 27You conclude that there is no cube 26Perhaps, it may be an exception! (I really don’t know)

3 Reached cube 31, someone asks you where is cube 42?You have never seen cube 42Still you can provide an answerCube 42 is north of here (or there is no cube 42!)

4 / 23

Page 16: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (2)

You push the on/offbutton, but no lightturns on

You buy a package ofBeloCafe and obtainbad coffeeThen, you buy apackage of Guglielmoand obtain good coffee

5 / 23

Page 17: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (2)

You push the on/offbutton, but no lightturns on

You buy a package ofBeloCafe and obtainbad coffeeThen, you buy apackage of Guglielmoand obtain good coffee

5 / 23

Page 18: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Mode of reasoning (2)

You push the on/offbutton, but no lightturns on

You buy a package ofBeloCafe and obtainbad coffeeThen, you buy apackage of Guglielmoand obtain good coffee

5 / 23

Page 19: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (1)

L→ S

Sentences associated to propositions

L has librettoS is student

If one has a libretto then they1 is a student

L S L→ Sdoesn’t have libretto is no student

OK!

has libretto is no student

NO!

doesn’t have libretto is student

OK!

has libretto is student

OK!

1

Amazing British English stuff: Singular they!

6 / 23

Page 20: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (1)

L→ S

Sentences associated to propositions

L has librettoS is student

If one has a libretto then they1 is a student

L S L→ Sdoesn’t have libretto is no student

OK!

has libretto is no student

NO!

doesn’t have libretto is student

OK!

has libretto is student

OK!

1

Amazing British English stuff: Singular they!

6 / 23

Page 21: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (1)

L→ S

Sentences associated to propositions

L has librettoS is student

If one has a libretto then they1 is a student

L S L→ Sdoesn’t have libretto is no student

OK!

has libretto is no student

NO!

doesn’t have libretto is student

OK!

has libretto is student

OK!

1Amazing British English stuff: Singular they!6 / 23

Page 22: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (1)

L→ S

Sentences associated to propositions

L has librettoS is student

If one has a libretto then they1 is a student

L S L→ Sdoesn’t have libretto is no student

OK!

has libretto is no student

NO!

doesn’t have libretto is student

OK!

has libretto is student

OK!

1Amazing British English stuff: Singular they!6 / 23

Page 23: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (1)

L→ S

Sentences associated to propositions

L has librettoS is student

If one has a libretto then they1 is a student

L S L→ Sdoesn’t have libretto is no student OK!

has libretto is no student

NO!

doesn’t have libretto is student

OK!

has libretto is student

OK!

1Amazing British English stuff: Singular they!6 / 23

Page 24: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (1)

L→ S

Sentences associated to propositions

L has librettoS is student

If one has a libretto then they1 is a student

L S L→ Sdoesn’t have libretto is no student OK!

has libretto is no student NO!doesn’t have libretto is student

OK!

has libretto is student

OK!

1Amazing British English stuff: Singular they!6 / 23

Page 25: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (1)

L→ S

Sentences associated to propositions

L has librettoS is student

If one has a libretto then they1 is a student

L S L→ Sdoesn’t have libretto is no student OK!

has libretto is no student NO!doesn’t have libretto is student OK!

has libretto is student

OK!

1Amazing British English stuff: Singular they!6 / 23

Page 26: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (1)

L→ S

Sentences associated to propositions

L has librettoS is student

If one has a libretto then they1 is a student

L S L→ Sdoesn’t have libretto is no student OK!

has libretto is no student NO!doesn’t have libretto is student OK!

has libretto is student OK!1Amazing British English stuff: Singular they!

6 / 23

Page 27: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (2)

Exercise

Which formula represents the following proposition?

Students are exactly those who have a libretto

L S

L↔ S

doesn’t have libretto is no student

OK!

has libretto is no student

NO!

doesn’t have libretto is student

NO!

has libretto is student

OK!

7 / 23

Page 28: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (2)

Exercise

Which formula represents the following proposition?

Students are exactly those who have a libretto

L S

L↔ S

doesn’t have libretto is no student OK!has libretto is no student

NO!

doesn’t have libretto is student

NO!

has libretto is student

OK!

7 / 23

Page 29: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (2)

Exercise

Which formula represents the following proposition?

Students are exactly those who have a libretto

L S

L↔ S

doesn’t have libretto is no student OK!has libretto is no student NO!

doesn’t have libretto is student

NO!

has libretto is student

OK!

7 / 23

Page 30: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (2)

Exercise

Which formula represents the following proposition?

Students are exactly those who have a libretto

L S

L↔ S

doesn’t have libretto is no student OK!has libretto is no student NO!

doesn’t have libretto is student NO!has libretto is student

OK!

7 / 23

Page 31: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (2)

Exercise

Which formula represents the following proposition?

Students are exactly those who have a libretto

L S

L↔ S

doesn’t have libretto is no student OK!has libretto is no student NO!

doesn’t have libretto is student NO!has libretto is student OK!

7 / 23

Page 32: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Implication (2)

Exercise

Which formula represents the following proposition?

Students are exactly those who have a libretto

L S L↔ Sdoesn’t have libretto is no student OK!

has libretto is no student NO!doesn’t have libretto is student NO!

has libretto is student OK!

7 / 23

Page 33: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Eliminate parentheses

Exercise 1.1 from Logica a Informatica

1 ((A ∧ B)→ (¬C))

2 (A→ (B → (¬C)))

3 ((A ∧ B) ∨ (C → C))

4 (¬(A ∨ ((¬B)→ C)))

5 (A→ (B ∨ (C → D)))

6 (¬((¬(¬(¬A))) ∧ ⊥))7 (A→ (B ∧ ((¬C) ∨ D)))

Where to place parentheses in the following one?

A→ B → C

8 / 23

Page 34: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Eliminate parentheses

Exercise 1.1 from Logica a Informatica

1 ((A ∧ B)→ (¬C))

2 (A→ (B → (¬C)))

3 ((A ∧ B) ∨ (C → C))

4 (¬(A ∨ ((¬B)→ C)))

5 (A→ (B ∨ (C → D)))

6 (¬((¬(¬(¬A))) ∧ ⊥))7 (A→ (B ∧ ((¬C) ∨ D)))

Where to place parentheses in the following one?

A→ B → C

8 / 23

Page 35: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Eliminate parentheses

Exercise 1.1 from Logica a Informatica

1 ((A ∧ B)→ (¬C))

2 (A→ (B → (¬C)))

3 ((A ∧ B) ∨ (C → C))

4 (¬(A ∨ ((¬B)→ C)))

5 (A→ (B ∨ (C → D)))

6 (¬((¬(¬(¬A))) ∧ ⊥))7 (A→ (B ∧ ((¬C) ∨ D)))

Where to place parentheses in the following one?

A→ B → C

8 / 23

Page 36: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Eliminate parentheses

Exercise 1.1 from Logica a Informatica

1 ((A ∧ B)→ (¬C))

2 (A→ (B → (¬C)))

3 ((A ∧ B) ∨ (C → C))

4 (¬(A ∨ ((¬B)→ C)))

5 (A→ (B ∨ (C → D)))

6 (¬((¬(¬(¬A))) ∧ ⊥))7 (A→ (B ∧ ((¬C) ∨ D)))

Where to place parentheses in the following one?

A→ B → C

8 / 23

Page 37: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Eliminate parentheses

Exercise 1.1 from Logica a Informatica

1 ((A ∧ B)→ (¬C))

2 (A→ (B → (¬C)))

3 ((A ∧ B) ∨ (C → C))

4 (¬(A ∨ ((¬B)→ C)))

5 (A→ (B ∨ (C → D)))

6 (¬((¬(¬(¬A))) ∧ ⊥))7 (A→ (B ∧ ((¬C) ∨ D)))

Where to place parentheses in the following one?

A→ B → C

8 / 23

Page 38: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Eliminate parentheses

Exercise 1.1 from Logica a Informatica

1 ((A ∧ B)→ (¬C))

2 (A→ (B → (¬C)))

3 ((A ∧ B) ∨ (C → C))

4 (¬(A ∨ ((¬B)→ C)))

5 (A→ (B ∨ (C → D)))

6 (¬((¬(¬(¬A))) ∧ ⊥))

7 (A→ (B ∧ ((¬C) ∨ D)))

Where to place parentheses in the following one?

A→ B → C

8 / 23

Page 39: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Eliminate parentheses

Exercise 1.1 from Logica a Informatica

1 ((A ∧ B)→ (¬C))

2 (A→ (B → (¬C)))

3 ((A ∧ B) ∨ (C → C))

4 (¬(A ∨ ((¬B)→ C)))

5 (A→ (B ∨ (C → D)))

6 (¬((¬(¬(¬A))) ∧ ⊥))7 (A→ (B ∧ ((¬C) ∨ D)))

Where to place parentheses in the following one?

A→ B → C

8 / 23

Page 40: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Understanding: Eliminate parentheses

Exercise 1.1 from Logica a Informatica

1 ((A ∧ B)→ (¬C))

2 (A→ (B → (¬C)))

3 ((A ∧ B) ∨ (C → C))

4 (¬(A ∨ ((¬B)→ C)))

5 (A→ (B ∨ (C → D)))

6 (¬((¬(¬(¬A))) ∧ ⊥))7 (A→ (B ∧ ((¬C) ∨ D)))

Where to place parentheses in the following one?

A→ B → C

8 / 23

Page 41: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Outline

1 Understanding

2 Tautologies, contradictions, satisfiability, etc.

3 Normal Forms

4 Modelling

5 Reduction to Satisfiability

9 / 23

Page 42: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Tautologies and contradictions

Exercise 1.3 from Logica a Informatica

Decide whether the following formulas are tautologies orcontradictions:

1 (A→ (B → C))→ ((A→ B)→ (A→ C))

2 ¬(A→ ¬A)3 A ∨ ¬A4 ⊥ → A5 ¬A→ (A→ B)

6 (A ∧ B) ∧ (¬B ∨ C)

7 A ∨ B → A ∧ B8 (A→ C)→ ((B → C)→ (A ∨ B → C))

9 (A→ B)→ ((B → ¬C)→ ¬A)

Which of these formulas are satisfiable?

10 / 23

Page 43: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Tautologies and contradictions

Exercise 1.3 from Logica a Informatica

Decide whether the following formulas are tautologies orcontradictions:

1 (A→ (B → C))→ ((A→ B)→ (A→ C))

2 ¬(A→ ¬A)

3 A ∨ ¬A4 ⊥ → A5 ¬A→ (A→ B)

6 (A ∧ B) ∧ (¬B ∨ C)

7 A ∨ B → A ∧ B8 (A→ C)→ ((B → C)→ (A ∨ B → C))

9 (A→ B)→ ((B → ¬C)→ ¬A)

Which of these formulas are satisfiable?

10 / 23

Page 44: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Tautologies and contradictions

Exercise 1.3 from Logica a Informatica

Decide whether the following formulas are tautologies orcontradictions:

1 (A→ (B → C))→ ((A→ B)→ (A→ C))

2 ¬(A→ ¬A)3 A ∨ ¬A

4 ⊥ → A5 ¬A→ (A→ B)

6 (A ∧ B) ∧ (¬B ∨ C)

7 A ∨ B → A ∧ B8 (A→ C)→ ((B → C)→ (A ∨ B → C))

9 (A→ B)→ ((B → ¬C)→ ¬A)

Which of these formulas are satisfiable?

10 / 23

Page 45: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Tautologies and contradictions

Exercise 1.3 from Logica a Informatica

Decide whether the following formulas are tautologies orcontradictions:

1 (A→ (B → C))→ ((A→ B)→ (A→ C))

2 ¬(A→ ¬A)3 A ∨ ¬A4 ⊥ → A

5 ¬A→ (A→ B)

6 (A ∧ B) ∧ (¬B ∨ C)

7 A ∨ B → A ∧ B8 (A→ C)→ ((B → C)→ (A ∨ B → C))

9 (A→ B)→ ((B → ¬C)→ ¬A)

Which of these formulas are satisfiable?

10 / 23

Page 46: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Tautologies and contradictions

Exercise 1.3 from Logica a Informatica

Decide whether the following formulas are tautologies orcontradictions:

1 (A→ (B → C))→ ((A→ B)→ (A→ C))

2 ¬(A→ ¬A)3 A ∨ ¬A4 ⊥ → A5 ¬A→ (A→ B)

6 (A ∧ B) ∧ (¬B ∨ C)

7 A ∨ B → A ∧ B8 (A→ C)→ ((B → C)→ (A ∨ B → C))

9 (A→ B)→ ((B → ¬C)→ ¬A)

Which of these formulas are satisfiable?

10 / 23

Page 47: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Tautologies and contradictions

Exercise 1.3 from Logica a Informatica

Decide whether the following formulas are tautologies orcontradictions:

1 (A→ (B → C))→ ((A→ B)→ (A→ C))

2 ¬(A→ ¬A)3 A ∨ ¬A4 ⊥ → A5 ¬A→ (A→ B)

6 (A ∧ B) ∧ (¬B ∨ C)

7 A ∨ B → A ∧ B8 (A→ C)→ ((B → C)→ (A ∨ B → C))

9 (A→ B)→ ((B → ¬C)→ ¬A)

Which of these formulas are satisfiable?

10 / 23

Page 48: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Tautologies and contradictions

Exercise 1.3 from Logica a Informatica

Decide whether the following formulas are tautologies orcontradictions:

1 (A→ (B → C))→ ((A→ B)→ (A→ C))

2 ¬(A→ ¬A)3 A ∨ ¬A4 ⊥ → A5 ¬A→ (A→ B)

6 (A ∧ B) ∧ (¬B ∨ C)

7 A ∨ B → A ∧ B

8 (A→ C)→ ((B → C)→ (A ∨ B → C))

9 (A→ B)→ ((B → ¬C)→ ¬A)

Which of these formulas are satisfiable?

10 / 23

Page 49: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Tautologies and contradictions

Exercise 1.3 from Logica a Informatica

Decide whether the following formulas are tautologies orcontradictions:

1 (A→ (B → C))→ ((A→ B)→ (A→ C))

2 ¬(A→ ¬A)3 A ∨ ¬A4 ⊥ → A5 ¬A→ (A→ B)

6 (A ∧ B) ∧ (¬B ∨ C)

7 A ∨ B → A ∧ B8 (A→ C)→ ((B → C)→ (A ∨ B → C))

9 (A→ B)→ ((B → ¬C)→ ¬A)

Which of these formulas are satisfiable?

10 / 23

Page 50: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Tautologies and contradictions

Exercise 1.3 from Logica a Informatica

Decide whether the following formulas are tautologies orcontradictions:

1 (A→ (B → C))→ ((A→ B)→ (A→ C))

2 ¬(A→ ¬A)3 A ∨ ¬A4 ⊥ → A5 ¬A→ (A→ B)

6 (A ∧ B) ∧ (¬B ∨ C)

7 A ∨ B → A ∧ B8 (A→ C)→ ((B → C)→ (A ∨ B → C))

9 (A→ B)→ ((B → ¬C)→ ¬A)

Which of these formulas are satisfiable?

10 / 23

Page 51: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Tautologies and contradictions

Exercise 1.3 from Logica a Informatica

Decide whether the following formulas are tautologies orcontradictions:

1 (A→ (B → C))→ ((A→ B)→ (A→ C))

2 ¬(A→ ¬A)3 A ∨ ¬A4 ⊥ → A5 ¬A→ (A→ B)

6 (A ∧ B) ∧ (¬B ∨ C)

7 A ∨ B → A ∧ B8 (A→ C)→ ((B → C)→ (A ∨ B → C))

9 (A→ B)→ ((B → ¬C)→ ¬A)

Which of these formulas are satisfiable?10 / 23

Page 52: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Satisfiability

Similar to Exercise 1.4 from Logica a Informatica

Decide whether the following formula is satisfiable:

(A1 ∨ A2) ∧ (¬A2 ∨ ¬A3) ∧ (A3 ∨ A4) ∧ (¬A4 ∨ A5)

2-CNFs formulas, also known as Krom formulas,can be solved in linear time!

11 / 23

Page 53: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Satisfiability

Similar to Exercise 1.4 from Logica a Informatica

Decide whether the following formula is satisfiable:

(A1 ∨ A2) ∧ (¬A2 ∨ ¬A3) ∧ (A3 ∨ A4) ∧ (¬A4 ∨ A5)

2-CNFs formulas, also known as Krom formulas,can be solved in linear time!

11 / 23

Page 54: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (1)

Exercise 1.8 from Logica a Informatica

Prove the following claims:1 ⊥ ∨ B ≡ B

2 ¬⊥ ∧ B ≡ B3 A |= A4 A |= B and B |= C implies A |= C5 |= A→ B implies A ∧ B ≡ A and A ∨ B ≡ B6 |= A implies A ∧ B ≡ B7 |= A implies ¬A ∨ B ≡ B8 If A |= B and A |= ¬B then |= ¬A9 If A |= C and B |= C then A ∨ B |= C

What are A, B and C?

12 / 23

Page 55: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (1)

Exercise 1.8 from Logica a Informatica

Prove the following claims:1 ⊥ ∨ B ≡ B2 ¬⊥ ∧ B ≡ B

3 A |= A4 A |= B and B |= C implies A |= C5 |= A→ B implies A ∧ B ≡ A and A ∨ B ≡ B6 |= A implies A ∧ B ≡ B7 |= A implies ¬A ∨ B ≡ B8 If A |= B and A |= ¬B then |= ¬A9 If A |= C and B |= C then A ∨ B |= C

What are A, B and C?

12 / 23

Page 56: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (1)

Exercise 1.8 from Logica a Informatica

Prove the following claims:1 ⊥ ∨ B ≡ B2 ¬⊥ ∧ B ≡ B3 A |= A

4 A |= B and B |= C implies A |= C5 |= A→ B implies A ∧ B ≡ A and A ∨ B ≡ B6 |= A implies A ∧ B ≡ B7 |= A implies ¬A ∨ B ≡ B8 If A |= B and A |= ¬B then |= ¬A9 If A |= C and B |= C then A ∨ B |= C

What are A, B and C?

12 / 23

Page 57: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (1)

Exercise 1.8 from Logica a Informatica

Prove the following claims:1 ⊥ ∨ B ≡ B2 ¬⊥ ∧ B ≡ B3 A |= A4 A |= B and B |= C implies A |= C

5 |= A→ B implies A ∧ B ≡ A and A ∨ B ≡ B6 |= A implies A ∧ B ≡ B7 |= A implies ¬A ∨ B ≡ B8 If A |= B and A |= ¬B then |= ¬A9 If A |= C and B |= C then A ∨ B |= C

What are A, B and C?

12 / 23

Page 58: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (1)

Exercise 1.8 from Logica a Informatica

Prove the following claims:1 ⊥ ∨ B ≡ B2 ¬⊥ ∧ B ≡ B3 A |= A4 A |= B and B |= C implies A |= C5 |= A→ B implies A ∧ B ≡ A and A ∨ B ≡ B

6 |= A implies A ∧ B ≡ B7 |= A implies ¬A ∨ B ≡ B8 If A |= B and A |= ¬B then |= ¬A9 If A |= C and B |= C then A ∨ B |= C

What are A, B and C?

12 / 23

Page 59: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (1)

Exercise 1.8 from Logica a Informatica

Prove the following claims:1 ⊥ ∨ B ≡ B2 ¬⊥ ∧ B ≡ B3 A |= A4 A |= B and B |= C implies A |= C5 |= A→ B implies A ∧ B ≡ A and A ∨ B ≡ B6 |= A implies A ∧ B ≡ B

7 |= A implies ¬A ∨ B ≡ B8 If A |= B and A |= ¬B then |= ¬A9 If A |= C and B |= C then A ∨ B |= C

What are A, B and C?

12 / 23

Page 60: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (1)

Exercise 1.8 from Logica a Informatica

Prove the following claims:1 ⊥ ∨ B ≡ B2 ¬⊥ ∧ B ≡ B3 A |= A4 A |= B and B |= C implies A |= C5 |= A→ B implies A ∧ B ≡ A and A ∨ B ≡ B6 |= A implies A ∧ B ≡ B7 |= A implies ¬A ∨ B ≡ B

8 If A |= B and A |= ¬B then |= ¬A9 If A |= C and B |= C then A ∨ B |= C

What are A, B and C?

12 / 23

Page 61: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (1)

Exercise 1.8 from Logica a Informatica

Prove the following claims:1 ⊥ ∨ B ≡ B2 ¬⊥ ∧ B ≡ B3 A |= A4 A |= B and B |= C implies A |= C5 |= A→ B implies A ∧ B ≡ A and A ∨ B ≡ B6 |= A implies A ∧ B ≡ B7 |= A implies ¬A ∨ B ≡ B8 If A |= B and A |= ¬B then |= ¬A

9 If A |= C and B |= C then A ∨ B |= C

What are A, B and C?

12 / 23

Page 62: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (1)

Exercise 1.8 from Logica a Informatica

Prove the following claims:1 ⊥ ∨ B ≡ B2 ¬⊥ ∧ B ≡ B3 A |= A4 A |= B and B |= C implies A |= C5 |= A→ B implies A ∧ B ≡ A and A ∨ B ≡ B6 |= A implies A ∧ B ≡ B7 |= A implies ¬A ∨ B ≡ B8 If A |= B and A |= ¬B then |= ¬A9 If A |= C and B |= C then A ∨ B |= C

What are A, B and C?

12 / 23

Page 63: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (1)

Exercise 1.8 from Logica a Informatica

Prove the following claims:1 ⊥ ∨ B ≡ B2 ¬⊥ ∧ B ≡ B3 A |= A4 A |= B and B |= C implies A |= C5 |= A→ B implies A ∧ B ≡ A and A ∨ B ≡ B6 |= A implies A ∧ B ≡ B7 |= A implies ¬A ∨ B ≡ B8 If A |= B and A |= ¬B then |= ¬A9 If A |= C and B |= C then A ∨ B |= C

What are A, B and C?

12 / 23

Page 64: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (2)

Exercise 1.9 from Logica a Informatica

Check whether the following claims hold or not:1 If A |= B then ¬A |= ¬B

2 If A |= B and A ∧ B |= C then A |= C3 If A ∨ B |= A ∧ B then A ≡ B

13 / 23

Page 65: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (2)

Exercise 1.9 from Logica a Informatica

Check whether the following claims hold or not:1 If A |= B then ¬A |= ¬B2 If A |= B and A ∧ B |= C then A |= C

3 If A ∨ B |= A ∧ B then A ≡ B

13 / 23

Page 66: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Equivalences and consequences (2)

Exercise 1.9 from Logica a Informatica

Check whether the following claims hold or not:1 If A |= B then ¬A |= ¬B2 If A |= B and A ∧ B |= C then A |= C3 If A ∨ B |= A ∧ B then A ≡ B

13 / 23

Page 67: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Outline

1 Understanding

2 Tautologies, contradictions, satisfiability, etc.

3 Normal Forms

4 Modelling

5 Reduction to Satisfiability

14 / 23

Page 68: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Normal Forms

Exercise 1.13 from Logica a Informatica

Find equivalent formulas in CNF for1 (A→ B)→ (B → ¬C)

2 ¬(A→ (B → ¬C)) ∧ D3 ¬(A ∧ B ∧ (C → D))

4 ¬(A↔ B)

Now find equivalent formulas in DNF!

15 / 23

Page 69: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Normal Forms

Exercise 1.13 from Logica a Informatica

Find equivalent formulas in CNF for1 (A→ B)→ (B → ¬C)

2 ¬(A→ (B → ¬C)) ∧ D

3 ¬(A ∧ B ∧ (C → D))

4 ¬(A↔ B)

Now find equivalent formulas in DNF!

15 / 23

Page 70: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Normal Forms

Exercise 1.13 from Logica a Informatica

Find equivalent formulas in CNF for1 (A→ B)→ (B → ¬C)

2 ¬(A→ (B → ¬C)) ∧ D3 ¬(A ∧ B ∧ (C → D))

4 ¬(A↔ B)

Now find equivalent formulas in DNF!

15 / 23

Page 71: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Normal Forms

Exercise 1.13 from Logica a Informatica

Find equivalent formulas in CNF for1 (A→ B)→ (B → ¬C)

2 ¬(A→ (B → ¬C)) ∧ D3 ¬(A ∧ B ∧ (C → D))

4 ¬(A↔ B)

Now find equivalent formulas in DNF!

15 / 23

Page 72: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Normal Forms

Exercise 1.13 from Logica a Informatica

Find equivalent formulas in CNF for1 (A→ B)→ (B → ¬C)

2 ¬(A→ (B → ¬C)) ∧ D3 ¬(A ∧ B ∧ (C → D))

4 ¬(A↔ B)

Now find equivalent formulas in DNF!

15 / 23

Page 73: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Outline

1 Understanding

2 Tautologies, contradictions, satisfiability, etc.

3 Normal Forms

4 Modelling

5 Reduction to Satisfiability

16 / 23

Page 74: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Find the formula! (1)

Similar to Exercise 1.10 from Logica a Informatica

Find φ such that

A B φ

0 0 10 1 11 0 01 1 0

Using only→ and ⊥?

17 / 23

Page 75: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Find the formula! (1)

Similar to Exercise 1.10 from Logica a Informatica

Find φ such that

A B φ

0 0 10 1 11 0 01 1 0

Using only→ and ⊥?

17 / 23

Page 76: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Find the formula! (2)

Similar to Exercise 1.13 from Logica a Informatica

Find φ such that

A B φ

0 0 10 1 01 0 01 1 0

Using only ∨ and ¬?

18 / 23

Page 77: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Find the formula! (2)

Similar to Exercise 1.13 from Logica a Informatica

Find φ such that

A B φ

0 0 10 1 01 0 01 1 0

Using only ∨ and ¬?

18 / 23

Page 78: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Find the formula in CNF and DNF!

Similar to Exercise 1.17 from Logica a Informatica

Find φs (one in CNF and one in DNF) such that

A B C φ

0 0 0 10 0 1 00 1 0 10 1 1 01 0 0 01 0 1 11 1 0 11 1 1 0

19 / 23

Page 79: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Modelling dinner

Dinner constraints

Available dishes:1 Farfalle al salmone2 Risotto agli asparagi3 Tagliatelle ai funghi4 Filetto di manzo5 Spigola grigliata6 Trancia di pesce spada

We can choose 7 white or 8 red wineWe must choose exactly one primo, one secondo and onedrinkDo not eat fish after mushroomsChoose white wine if fish is involved

Goal: Write a set of wffs the models of which correspond toadmissible dinner choices

20 / 23

Page 80: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Outline

1 Understanding

2 Tautologies, contradictions, satisfiability, etc.

3 Normal Forms

4 Modelling

5 Reduction to Satisfiability

21 / 23

Page 81: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Reduction to SAT

Reformulate the following questions such that they can bedecided using a SAT algorithm:

1 Is (P ∨ (¬P → Q))↔ (P ∨Q) valid?

2 Does P → Q follow from ¬Q → ¬P?3 Is P ↔ Q ∧ P a contradiction?4 Is P ↔ P ∨ ⊥ a tautology?

22 / 23

Page 82: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Reduction to SAT

Reformulate the following questions such that they can bedecided using a SAT algorithm:

1 Is (P ∨ (¬P → Q))↔ (P ∨Q) valid?2 Does P → Q follow from ¬Q → ¬P?

3 Is P ↔ Q ∧ P a contradiction?4 Is P ↔ P ∨ ⊥ a tautology?

22 / 23

Page 83: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Reduction to SAT

Reformulate the following questions such that they can bedecided using a SAT algorithm:

1 Is (P ∨ (¬P → Q))↔ (P ∨Q) valid?2 Does P → Q follow from ¬Q → ¬P?3 Is P ↔ Q ∧ P a contradiction?

4 Is P ↔ P ∨ ⊥ a tautology?

22 / 23

Page 84: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

Reduction to SAT

Reformulate the following questions such that they can bedecided using a SAT algorithm:

1 Is (P ∨ (¬P → Q))↔ (P ∨Q) valid?2 Does P → Q follow from ¬Q → ¬P?3 Is P ↔ Q ∧ P a contradiction?4 Is P ↔ P ∨ ⊥ a tautology?

22 / 23

Page 85: Propositional Logic Exercises€¦ · Propositional Logic Exercises Mario Alviano University of Calabria, Italy A.Y. 2017/2018 1/23

END OF THELECTURE

23 / 23