Chapter 7 Exercises

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

Exercises on Propositional Logic

Deduction

Artificial Intelligence I — LCA 12/13 Deduction 1


Exercise Three weird implications

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

4. Prove the proposition A ∧ C ∧ D using Modus Ponens only, or explain


why this is not possible.

Artificial Intelligence I — LCA 12/13 Deduction 2


Exercise Three weird implications

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

4. Prove the proposition A ∧ C ∧ D using Modus Ponens only, or explain


why this is not possible.

It is not possible to prove A ∧ C ∧ D using Modus Ponens only. This follows


from the fact that Modus Ponens is not applicable to any pair of formulas
in the knowledge base.

Artificial Intelligence I — LCA 12/13 Deduction 3


Exercise Three weird implications

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

5. Prove the proposition A ∧ C ∧ D using resolution.

Artificial Intelligence I — LCA 12/13 Deduction 4


Exercise Three weird implications
¬A→B
B→A
A→(C ∧ D)
5. Prove the proposition A ∧ C ∧ D using resolution.
Proof by refutation:
1. A ∨ B premise
2. ¬B ∨ A premise
3. ¬A ∨ C premise
4. ¬A ∨ D premise
5. ¬A ∨ ¬C ∨ ¬D negated thesis
6. A resolution 1, 2
7. C resolution 3, 6
8. D resolution 4, 6
9. ¬C ∨ ¬D resolution 5, 6
10. ¬D resolution 7, 9
11. [] resolution 8, 10

Artificial Intelligence I — LCA 12/13 Deduction 5


Exercise It rains, again

Consider the following set of propositional formulas


1.Rains→W et
2.W et→¬Rains
3 Rains

(a) Prove, via tableaux and via resolution, that the given set is inconsi-
stent.

(b) Prove, via tableaux and via resolution, that all the pairs of formulas,
are consistent.

Artificial Intelligence I — LCA 12/13 Deduction 6


Exercise It rains, again - Resolution

1.Rains→W et
2.W et→¬Rains
3 Rains

With resolution:
1.¬Rains ∨ W et
2. ¬W et ∨ ¬Rains
3. Rains
(a) The given set is inconsistent:
4. ¬Rains from 1 and 2
5. {} from 3 and 4

(b) From 1 and 2 we get ¬Rains; from 1 and 3 we get ¬W et; from 2
and 3 we get ¬W et, so no pair is inconsistent.

Artificial Intelligence I — LCA 12/13 Deduction 7


Exercise It rains, again - Tableau 1

1.Rains→W et
2.W et→¬Rains
3 Rains

R→W
W →¬R
R
¬R? W
¬W ? ¬R?
The tableau closes, hence the three formulas are inconsistent.

Artificial Intelligence I — LCA 12/13 Deduction 8


Exercise It rains, again - Tableau 2

1.Rains→W et
2.W et→¬Rains

R→W
W →¬R
¬R W
¬W ¬R ¬W ? ¬R
The tableau is open, hence the two formulas are consistent.

Artificial Intelligence I — LCA 12/13 Deduction 9


Exercise It rains, again - Tableau 3

1.Rains→W et
3 Rains

R→W
R
¬R? W
The tableau is open, hence the two formulas are consistent.

Artificial Intelligence I — LCA 12/13 Deduction 10


Exercise It rains, again - Tableau 4

2.W et→¬Rains
3 Rains

With tableaux
W →¬R
R
¬W ¬R?
The tableau is open, hence the two formulas are consistent.

Artificial Intelligence I — LCA 12/13 Deduction 11


Exercise Two tableaux
Let A, B, C be propositional symbols. Verify, using tableaux, whether or
not:
1) (A→C) ∧ (B→C) entails (A ∨ B)→C
2) (A ∨ B)→C entails (A→C) ∧ (B→C)

Artificial Intelligence I — LCA 12/13 Deduction 12


Exercise Two tableaux
Let A, B, C be propositional symbols. Verify, using tableaux, whether or
not:
1) (A→C) ∧ (B→C) entails (A ∨ B)→C
Question 1: the answer is positive.

(A→C) ∧ (B→C)
¬[(A ∨ B)→C]
(A ∨ B)
¬C
A→C
B→C
¬A C?
¬B C?
A? B?

Artificial Intelligence I — LCA 12/13 Deduction 13


Exercise Two tableaux
Let A, B, C be propositional symbols. Verify, using tableaux, whether or
not:
2) (A ∨ B)→C entails (A→C) ∧ (B→C)
Question 2: the answer is positive.

(A ∨ B)→C
¬[(A→C) ∧ (B→C)]
¬(A ∨ B) C
¬A ¬(A→C) ¬(B→C)
¬B A B
¬(A→C) ¬(B→C) ¬C? ¬C?
A B
¬C? ¬C?

Artificial Intelligence I — LCA 12/13 Deduction 14


Exercise The Climber
Given the following symbols and sentences:
C to indicate that Gianni is a climber;
F to indicate that Gianni is fit;
L to indicate that Gianni is lucky:
E to indicate that Gianni climbs mount Everest.

If Gianni is a climber and he is fit, he climbs mount Everest.


If Gianni is not lucky and he is not fit, he does not climb mount Everest.
Gianni is fit.

(a) Formalize the above sentences in propositional logic.

Artificial Intelligence I — LCA 12/13 Deduction 15


Exercise The Climber
Given the following symbols and sentences:
C to indicate that Gianni is a climber;
F to indicate that Gianni is fit;
L to indicate that Gianni is lucky:
E to indicate that Gianni climbs mount Everest.

If Gianni is a climber and he is fit, he climbs mount Everest.


If Gianni is not lucky and he is not fit, he does not climb mount Everest.
Gianni is fit.

(a)Formalize the above sentences in propositional logic.


(C ∧ F )→E
(¬L ∧ ¬F )→¬E
F

Artificial Intelligence I — LCA 12/13 Deduction 16


Exercise The Climber
(C ∧ F )→E
(¬L ∧ ¬F )→¬E
F
(b) Tell if the KB buit in (a) is consistent, and tell if some of the following
sets are models for the above sentences:
{ }; {C, L}; {L, E}; {F, C, E}; {L, F, E}.

Artificial Intelligence I — LCA 12/13 Deduction 17


Exercise The Climber
(C ∧ F )→E
(¬L ∧ ¬F )→¬E
F
(b) Tell if the KB buit in (a) is consistent, and tell if some of the following
sets are models for the above sentences:
{ }; {C, L}; {L, E}; {F, C, E}; {L, F, E}.
(b) The KB is consistent: it has at least a model, as the following check
shows.

1. { } is not a model (it models 1 and 2 but not 3);


2. {C, L} is not a model (it models 1 and 2 but not 3);
3. {L, E} is not a model (it models 1 and 2 but not 3);
4. {F, C, E} is a model;
5. {L, F, E} is a model.

Artificial Intelligence I — LCA 12/13 Deduction 18


Exercise The Climber
(C ∧ F )→E
(¬L ∧ ¬F )→¬E
F
(c) Verify, using tableaux, if it is consistent with the KB built in (a) that
Gianni climbs mount Everest.
(c) It is consistent (see figure, the tableau is complete and open);

(C ∧ F )→E
(¬L ∧ ¬F )→¬E
F
E
¬(C ∧ F ) E
¬C ¬F ? ¬(¬L ∧ ¬F ) ¬E?
¬(¬L ∧ ¬F ) ¬E? L F
L F

Artificial Intelligence I — LCA 12/13 Deduction 19


Exercise The Climber
(C ∧ F )→E
(¬L ∧ ¬F )→¬E
F
(d) Verify, using tableaux, if it is derivable from the KB built in (a) that
Gianni climbs mount Everest. In the negative case, give a formula that
added to the KB built in (a) gives a KB’ that is still consistent and makes
the derivation possible.

Artificial Intelligence I — LCA 12/13 Deduction 20


Exercise The Climber
(C ∧ F )→E
(¬L ∧ ¬F )→¬E
F
(d) It is not derivable (see figure) it becomes derivable if we add C. In fact
adding C preserves the consistency of the KB and makes the tableau to
close.
(C ∧ F )→E
(¬L ∧ ¬F )→¬E
F
¬E
¬(C ∧ F ) E?
¬C ¬F ?
¬(¬L ∧ ¬F ) ¬E
L F

Artificial Intelligence I — LCA 12/13 Deduction 21


Exercise A very long formula
Using tableaux, state if the following formula is valid, contradictory or sati-
sfiable (in the last case show a model).
((P ∨ Q) ∧ (Q→R) ∧ (R→¬P )) → (P ↔ ¬Q)

Artificial Intelligence I — LCA 12/13 Deduction 22


Exercise A very long formula
Using tableaux, state if the following formula is valid, contradictory or sati-
sfiable (in the last case show a model).
((P ∨ Q) ∧ (Q→R) ∧ (R→¬P )) → (P ↔ ¬Q)
Try validity first, as if it is valid, I have also proved that it is satisfiable and
not contradictory.

Artificial Intelligence I — LCA 12/13 Deduction 23


Exercise A very long formula
Using tableaux, state if the following formula is valid, contradictory or sati-
sfiable (in the last case show a model).
((P ∨ Q) ∧ (Q→R) ∧ (R→¬P )) → (P ↔ ¬Q)
Negate the formula and build the tableau.
P ∨Q
Q→R
R→¬P
¬(P ↔¬Q)
P ¬Q
Q ¬P
P Q P ? Q?
¬Q? R ¬Q? R
¬R? ¬P ? ¬R? ¬P ?
The formula is valid, as the tableau for its negation closes.

Artificial Intelligence I — LCA 12/13 Deduction 24


Exercise
Tell whether the propositional formula
[(A→C) ∨ (B→C)]→[(A ∧ B)→C]
a) is satisfiable
b) is valid
c) is a contraddiction.
Answer a), b, and c) using the tableau method.
Try validity first, as if it is valid, I have also proved that it is satisfiable and
not contradictory.

Artificial Intelligence I — LCA 12/13 Deduction 25


Exercise
So negate the formula: ¬{[(A→C) ∨ (B→C)]→[(A ∧ B)→C]}

[(A→C) ∨ (B→C)]
¬[(A ∧ B)→C]
A∧B
¬C
A
B
A→C B→C
¬A? C? ¬B? C?
The formula is valid, as the tableau for its negation closes.
The tableau for the negated formula closes, hence it is valid, which implies
that the formula is satisfiable, and not a contradiction.

Artificial Intelligence I — LCA 12/13 Deduction 26


Exercise
Prove, using propositional tableaux, that
{A → (B ∨ C), ¬B} entails A → C.

Negate the thesis and build the tableau.


A → (B ∨ C)
¬B
¬(A → C)
A
¬C
¬A? B∨C
B? C?
The tableau closes, hence the entailment is proved.

Artificial Intelligence I — LCA 12/13 Deduction 27


Exercise
Let A, B, C be propositional symbols. Given KB = {A→C, B→C, A ∨
B}, tell wether C can be derived from KB or not in each one of the follo-
wing cases

a. with Modus Ponens;


b. with Resolution.
In each case, if the answer is positive, show the derivation; if it is negative
motivate it.

Artificial Intelligence I — LCA 12/13 Deduction 28


Solution
Let A, B, C be propositional symbols. Given KB = {A→C, B→C, A ∨
B}, tell wether C can be derived from KB or not in each one of the follo-
wing cases

a. with Modus Ponens;

a. C cannot be derived using MP as we know that A ∨ B, but we do not


know wether A or B is true, so we cannot apply MP to A and A→C, and
we cannot apply MP to B and B→C.

Artificial Intelligence I — LCA 12/13 Deduction 29


Solution
Let A, B, C be propositional symbols. Given KB = {A→C, B→C, A ∨
B}, tell wether C can be derived from KB or not in each one of the follo-
wing cases

b. with Resolution.
b. C can be derived with Resolution
1. ¬A ∨ C
2. ¬B ∨ C
3. A∨B
4. ¬C negated thesis
5. B ∨ C from 1. and 3.
6. C from 2. and 5.
7. { } from 4. and 6.

Artificial Intelligence I — LCA 12/13 Deduction 30


Exercise
Tell whether the following propositional formulas are (a) satisfiable, (b) valid,
(c) contraddictiory.
In case (a) show a model. Use the tableau method.
HINT: Try validity first, as if the formula is valid, we have also proved that
it is satisfiable and not contradictory.

1. (P ∧ R)↔(R ∧ P )
2. (P ∨ ¬P )↔(P ∧ ¬P )
3. ¬P →(P ∧ ¬P )
4. (P ∨ Q)↔P

Artificial Intelligence I — LCA 12/13 Deduction 31


Solution 1

¬[(P ∧ R)↔(R ∧ P )]
P ∧R ¬(P ∧ R)
¬(R ∧ P ) R∧P
P R
R P
¬R? ¬P ? ¬R? ¬P ?

The tableau is closed.


(P ∧ R)↔(R ∧ P ) is valid.

Artificial Intelligence I — LCA 12/13 Deduction 32


Solution 2.1

¬[(P ∨ ¬P )↔(P ∧ ¬P )]
P ∨ ¬P ¬(P ∨ ¬P )
¬(P ∧ ¬P ) P ∧ ¬P
P ¬P ¬P
P ¬P ? P ¬P ? P?

The tableau is open.


(P ∨ ¬P )↔(P ∧ ¬P ) is not valid.

Artificial Intelligence I — LCA 12/13 Deduction 33


Solution 2.2

(P ∨ ¬P )↔(P ∧ ¬P )
P ∨ ¬P ¬(P ∨ ¬P )
P ∧ ¬P ¬(P ∧ ¬P )
P
¬P ? ¬P
P?
The tableau is closed.
(P ∨ ¬P )↔(P ∧ ¬P ) is contraditory.

Artificial Intelligence I — LCA 12/13 Deduction 34


Solution 3.1

¬[¬P →(P ∧ ¬P )]
(P ∨ Q)
P
¬(P ∧ ¬P )
¬P ? P
The tableau is open.
¬P →(P ∧ ¬P ) is not valid.

Artificial Intelligence I — LCA 12/13 Deduction 35


Solution 3.2

¬P →(P ∧ ¬P )
P (P ∧ ¬P )
P
¬P ?
The tableau is open.
¬P →(P ∧ ¬P ) is satisfied by { P}

Artificial Intelligence I — LCA 12/13 Deduction 36


Solution 4.1

¬[(P ∨ Q)↔P ]
(P ∨ Q) ¬(P ∨ Q)
P P
¬P ¬P
P? Q Q?

The tableau is open.


(P ∨ Q)↔P is not valid.

Artificial Intelligence I — LCA 12/13 Deduction 37


Solution 4.2

(P ∨ Q)↔P
(P ∨ Q) ¬(P ∨ Q)
P ¬P
P Q ¬P
¬Q

The tableau is open.


(P ∨ Q)↔P is satisfied by { P}, { P,Q}, { }.

Artificial Intelligence I — LCA 12/13 Deduction 38


Exercise
Prove, using propositional tableaux, that
{A → (B ∨ C), ¬B} entails A → C.

Artificial Intelligence I — LCA 12/13 Deduction 39


Exercise
Prove, using propositional tableaux, that
{A → (B ∨ C), ¬B} entails A → C.

Negate the thesis ¬(A → C).

A → (B ∨ C)
¬B
¬(A → C)
A
¬C
¬A? B∨C
B? C?
The tableau is closed.

Artificial Intelligence I — LCA 12/13 Deduction 40

You might also like