Chapter 12

Solutions to the Exercises

EXERCISE 3.1.– We can represent an interpretation as a subset of Π, with the elements of this subset being the propositional symbols that are evaluated to T in the interpretation.

There are 2ℵo subsets of Π; hence, there is an uncountably infinite number of interpretations for PL.

A more detailed proof.

Every interpretation I can be represented by the graph of the function defining it:

equ395_01.gif

There are infinitely many interpretations, take for example (l rev n.gif):

equ395_02.gif

Now if we assume that the set of all interpretations in PL is denumerable, then they can be enumerated (i rev n.gif):

equ395_03.gif

Consider the interpretation image defined as follows:

equ395_04.gif

This interpretation is different from every Ii in the list we assumed we were able to construct, at least for the couple (Pi, *).

Therefore, assuming that the set of interpretations for PL is denumerable leads to a contradiction. The set of all interpretations of PL is therefore uncountably infinite.

REMARK 12.1.– To avoid the (implicit) use of the axiom of choice, we can encode F : 0 T : 1 and define:

equ396_01.gif

REMARK 12.2.– The argument used here is the same as the argument used to prove that there are uncountably many real numbers in the interval [0,1] (which entails that r1.gif is uncountably infinite):

We assume that we can enumerate all real numbers between 0 and 1:

equ396_02.gif

But the real number:

equ396_03.gif

is not in this list (it is different from the first number at least at ie396_01.gif, from the second at least at ie396_02.gif,... from the nth at least at ie396_03.gif)

A contradiction; hence, the set of real numbers on [0, 1] is not denumerable.

EXERCISE 3.2.

a) A truth function can always be represented by its graph, a its domain and range are finite.

The following example clearly shows how to proceed (it is trivial to transform this method into an algorithm).

tabu396_01.gif

The dnf of f(P, Q, R) is:

equ397_01.gif

The justification is very simple (properties of ∧ and ∨): every other combination of literals that appears in the dnf is equivalent to F (by inspection of the truth table).

The cnf of f(P, Q, R) is:

equ397_02.gif

It is obtained because of the following equivalences:

equ397_03.gif

and:

equ397_04.gif

i.e. we take the conjunction of disjunctions for those f(P, Q, R) = F.

b) Use the equivalence ie397_01.gif and (a).

c) Use the equivalence ie397_02.gif and (a).

d) Use the equivalences ie397_03.gif and (a).

e) Use the equivalences ie397_04.gif and (c).

f) Use the equivalences ie397_05.gif and (b).

EXERCISE 3.3.– We provide a sufficient condition.

It is true if the only line with value F is the given one (see cnf, solution of exercise 3.2) or if the only line with value T is the one given (see dnf, solution of exercise 3.2).

EXERCISE 3.4.–

a)

tabu397_01.gif

equ398_01.gif

EXERCISE 3.5.–

a)

To know whether it is always F, we try to evaluate it to T:

to evaluate to T an implication, it suffices (this is not the only possibility) to fix its consequent to T.

equ398_02.gif

It thus suffices to assign F to S and not bother with the truth values of the other propositional symbols to evaluate the given formula to T. It is not always F.

To know whether it is always T, we try to evaluate it to F:

to evaluate an implication to F, the only possibility is to have its first term evaluate to T and its second term evaluate to F.

equ399_01.gif

We can evaluate it to F with the given assignments. It is not always T.

Conclusion: the given formula is neither contradictory nor a tautology.

b)

As mentioned above, to evaluate an implication to F, the only possibility is to evaluate its first term to T and its second term to F.

To evaluate the second term to F, the only possibility is:

equ399_02.gif

and the only possible assignments are:

equ399_03.gif

hence:

equ399_04.gif

With these assignments, we try to evaluate the first term to T, the only possibility is:

equ399_05.gif

With the only possible assignments for A, D, and E, we must assign C to T and F, which is impossible.

Conclusion: the given formula cannot be evaluated to F.

EXERCISE 3.6.– No, sym2.gif is not anti-symmetric (see definition 3.23):

Of course, for example:

equ400_01.gif

But formula F is (syntactically) different from formula FF.

EXERCISE 3.7.–

a)

equ400_02.gif

If we have P, any proposition implies P.

b)

equ400_03.gif

If P is false, then P implies any proposition.

(a) and (b) are called paradoxes of material implication.

EXERCISE 3.8.– As is customary (in particular in mathematics), we convene that a reasoning is correct if and only if

equ400_04.gif

REMARK 12.3.– This convention (definition) enables us to immediately propose two classes of reasonings that are trivially correct:

contradictory premises (inclusive) or tautological conclusion.

Before any translation, it is necessary to identify the synonyms and propositions that are negations of other propositions.

We propose:

S: Life has a meaning.

M: Life necessarily ends by death.

T: Life is sad.

C: Life is a cosmic joke.

A: Angst exists.

B: Life is beautiful.

enter.gifB: Life is ugly (life is not beautiful).

enter.gifM: Life goes on after death.

Most of the time we must make translation choices, but we will assume (this is not important, the important fact is to be aware of the difficulty of translation) that we all agree with the translation.

Once the translation has been made, we try (without forgetting to test the other possibilities if there is a failure) to find an interpretation that permits us to evaluate the conclusion to F and the premises to T.

If we succeed, the reasoning is incorrect and we have produced a counter example.

If we fail, the reasoning is correct.

equ401_01.gif

Therefore, with this formalization, the reasoning is incorrect.

EXERCISE 3.9.–

a)

equ402_01.gif

Incorrect reasoning. Which is “natural”: in general, when the conclusion is independent from the premises, the reasoning is incorrect, except in the case of reasonings that are trivially correct (i.e. contradictory premises and/or tautological conclusion).

b)

equ402_02.gif

As there is no other possible way of evaluating the conclusion to F and the premises to T, we conclude that the reasoning is correct.

If we had wanted to go from the premises to the conclusion (forward chaining), we would have done:

ie403_01.gif (only possibility), hence (contrapositive) ie403_02.gif (only possibility), hence (contrapositive) ie403_03.gif, hence (contrapositive) ie403_04.gif, i.e. ie403_05.gif; thus, necessarily, for all the premises to be ie403_06.gif. We conclude that the reasoning is correct.

EXERCISE 3.10.–

a)

equ403_01.gif

b)

equ403_02.gif

c)

No, for example:

ie403_07.gif: cnf (a conjunct with three literals)

ie403_08.gif: dnf (three disjuncts, each with one literal)

d) No, it suffices to apply the distributivity of ∧ w.r.t. ∨

% Note the analogy with Cartesian product:

equ403_03.gif

(i.e. 3 × 2 × 3 = 18 disjuncts)

e)

No.

Consider the wff:

equ403_04.gif

The wffs G and H below:

equ403_05.gif

equ404_01.gif

Are two cnfs of F and they are different.

EXERCISE 3.11.-

N: There is a unique norm to judge greatness in art.

M: M is a great artist.

G: G is a great artist.

P: P is considered as a great artist.

D: D is considered as a great artist.

W: W is a great artist.

K: K is a great artist.

S: S is a great artist.

The following formalization seems “natural”:

equ404_02.gif

Forward chaining: we try to evaluate the set of premises to T (in every possible way) and verify that all models of this set are also models of the conclusion.

( shows the evaluation sequence)

in (4) GF (only possibility) → in (5) DT (only possibility); in (5) KT (only possibility), hence in (3) WT; hence, in (2) PD must be evaluated to F: impossible.

As there is no other choice to evaluate the premises to T, we conclude that the premises are contradictory, and hence the reasoning is trivially correct.

Backward chaining: if we can evaluate the conclusion to F and the set of premises to T, then we refute the reasoning.

( indicates the evaluation sequence)

in (6) ie405_01.gif (1) ie405_02.gif or ie405_03.gif (5) ie405_04.gif and ie405_05.gif (only possibility) ie405_06.gif (only possibility) ie405_07.gif must be evaluated to F: impossible. Hence (of course!) the same conclusion, meaning that we cannot refute the reasoning which is correct.

EXERCISE 3.12.–

a) As we can evaluate the conclusion independently from the premises, we will be able to evaluate the conclusion to F and the premises to T. In general, the reasoning will therefore be incorrect.

Particular case: trivially correct reasonings (see exercise 3.9).

b) See proof of the following assertion exercise 3.30:

S: set of clauses, L rev C rev S, L pure

(*) S is contradictory iff S {C} is contradictory

We shall prove that a reasoning is correct by proving that the set of premises together with the negation of the conclusion is contradictory. We can use property (*) for this verification.

Example:

equ405_01.gif

Step 1: we erase C4 (T pure)

Step 2: we erase C3 (U pure)

Step 3: we erase C1 (R pure)

Step 4: we erase C1enter.gifP and enter.gifQ pure)

S is thus equivalent to ieq; hence, non-contradictory (satisfiable). The reasoning from which S was generated was therefore incorrect.

EXERCISE 3.13.– We use the following propositional symbols:

C: Someone asked the house servant the question “…”.

R: The house servant answered.

E: Someone heard the house servant (the house servant was heard).

Q: Someone saw the house servant.

T: The house servant was busy polishing cutlery.

U: The house servant was here on the day of the crime.

The reasoning can be formalized as follows:

equ406_01.gif

The reasoning is incorrect: the interpretation {Q}, i.e. Q evaluated to T and all other propositional symbols evaluated to F (see example 3.4) is a counter example.

Instead of verifying the correctness of the reasoning by using the same method as previously, we will do so in a way that is closer to the syntactic point of view of inference, similar to the inference rules used in mathematics, which will be treated in detail in section 3.3.

A major difference with the standard practice of mathematics is that we declare all the inference rules (elementary reasonings) that will be the only rules we will be allowed to use.

Inference rules:

equ406_02.gif

and (intro): ie406_01.gif

and (lelim): ie406_02.gif

and (relim): ie406_03.gif

or (intro): ie407_01.gif

contrap: ie407_02.gif

disj. syl.: ie407_03.gif

abd: ie407_04.gif % Warning: abd is not a correct rule (see definition 3.12). It is used to discover premises in abduction (see section 8.3).

a) A trivial possibility: add U to the premises.

Other possibilities (closer to the intuitive notion of an explanation)

Forward chaining:

a1) We add enter.gifQ and we deduce:

equ407_01.gif

Other possibility:

equ407_02.gif

a2) We add ie407_05.gif and (a1), we obtain U.

Backward chaining:

equ407_03.gif

a3) We add enter.gifQ and we obtain U as above.

b) There are infinitely many solutions (redundant intermediate chains that can be removed).

c) No: either the added premises are in contradiction with the existing premises, in which case the reasoning is trivially correct, or we carry out the same proof, as we did before the addition of the premises.

The key remark here is that a model of a set of formulas is a model of all the formulas in the set.

Assume ie408_01.gif and:

ie408_02.gif can be any formula, in particular, the “strange” case where ie408_03.gif (because it is impossible to evaluate the premises to T and C to F).

(*) means that there exists an interpretation image that is a model of {P1, P2, …, Pn, Q} and a counter-model of C.

But a model of {P1, P2, …, Pn, Q} is also (by definition) a model of {P1, P2, …, Pn}, and every model of {P1, P2, …, Pn} is a model of C; hence, (*) is impossible.

REMARK 12.4.– In the formal system (see definition 3.9) whose inference rules are those above, it is possible to prove the ex falso quodlibet principle: “from a contradiction we can deduce any conclusion” (see also exercise 3.26).

equ408_01.gif

EXERCISE 3.14.only if)

Trivial. By definition:

A ieq B means: every model of A is a model of B. This means that A d_arr.gif B cannot be evaluated to F, i.e.:

equ408_02.gif

if

|= A d_arr.gif B means that it is impossible to have interpretations that evaluate A to T and B to F, in other words:

equ408_03.gif

EXERCISE 3.15.–

a) Particular case of exercise 3.14.

b) ie408_04.gif

only if)

All models of ie409_01.gif are models of C (definition of ieq), hence, are counter-models of ie409_02.gif is evaluated to F, then so is ie409_03.gif is evaluated to T, then enter.gifC is evaluated to F, and so is ie409_04.gif. conclusion: ie409_05.gif is unsatisfiable.

if)

It suffices to restrict ourselves to the interpretations of ie409_07.gif that are models of ie409_08.gif.

If image is a model of ie409_01.gif, then by definition of unsatisfiability, ie409_08a.gif, hence ie409_09.gif therefore, ie409_10.gif.

EXERCISE 3.16.–

Answer: (b)

We prove so by reductio ad absurdum.

Assume A ieq B, hence:

ie409_11.gif (definition of ieq)

but ie409_12.gif (hypothesis)

thus (transitivity of ieq)

ie409_13.gif contradiction, therefore:

ie409_14.gif

EXERCISE 3.17.–

True.

The reasonings will be of the following form.

Premises: ie409_15.gif

conclusion: ie409_16.gif

where ie409_17.gif for ie409_18.gif and ie409_19.gif.

Indeed, a S is minimally unsatisfiable, ie410_01.gif is satisfiable and every model of S1 must be a counter-model of f1 (a S is unsatisfiable), i.e.:

equ410_01.gif

REMARK 12.5.– This property can be viewed as a generalization of the proof technique that consists in proving the contrapositive.

If we have proved ie410_02.gif

by proving:

ie410_03.gif unsat,

then we have also proved that

equ410_02.gif

(if enter.gifC is T, then ie410_05.gif must be F, otherwise the set would be satisfiable):

i.e.:

equ410_03.gif

or, in other words:

equ410_04.gif

EXERCISE 3.18.–

a) The ideas and remarks that will enable us to construct the interpolant are the following:

1) Each line1 of the truth table of a formula f.gif is an interpretation of f.gif (the truth table enumerates all the interpretations of f.gif). We shall mention interpretation with the same meaning as line in the truth table.

2) The interpretations of interpolant image to be constructed will, in general, be partial interpretations of {a.gif,b.gif} (except in the case in which Propset (a.gif) = Propset(b.gif)).

3) Key remark. Given an interpretation image of image, does there exist an interpretation I.gif of {a.gif, b.gif}, that is an extension of image and such that:

equ411_01.gif

As, by hypothesis, ie411_01.gif, i.e. every interpretation satisfying a.gif also satisfies b.gif, such an interpretation I does not exist.

4) We want ie411_02.gif hence, if line 1 of the truth table of a.gif evaluates a.gif to T and l contains line lC of the truth table of image, then we will evaluate line lC of image to T.

5) We want ie411_03.gif hence, if line l of the truth table of b.gif evaluates b.gif to F and contains line lC of the truth table of C, then we will evaluate line lC of C to F.

6) There cannot be any conflict between steps (4) and (5) (see remark 3).

7) For the cases in which line l evaluates a.gif to F (respectively, b.gif to T), we can arbitrarily choose to assign values T or F to line lC of image, which means that, in general, there are several possible interpolants (2n, where n is the number of lines from which we can choose).

8) Points (1)-(7) above are about the truth table of image. The method described in exercise 3.2 enables us to construct the dnf (or cnf) of image.

(1) -(8) above give the algorithm to construct image and prove its correctness at the same time.

b) Propset (a.gif) = Propset(b.gif) = Propset(image) = {A, B, C}

tabu411_01.gif

By applying the method of exercise 3.2, we obtain the 8(=23) possible interpolants:

equ412_01.gif

c) Propset(image) = {A, B, C}; Propset(image) = {B, C, D}; Propset(image) = {B, C}

tabu412_01.gif

equ412_02.gif

EXERCISE 3.19.–

Tree 1

equ413_01.gif

Tree 2

equ413_02.gif

figu413_01.gif

EXERCISE 3.20.–

a)

figu414_01.gif

Correct reasoning

The }’s, the righit.gif's, and the arrows correspond to the operations:

equ414_01.gif

of the algorithm SEMANTIC TABLEAUX (PL).

b)

figu415_01.gif

Correct reasoning

c)

figu415_02.gif

Incorrect reasoning, counter example: {¬H, ¬MW}

d)

figu416_01.gif

Incorrect reasoning, counter examples: {¬A, ¬B,C}, {¬B,C}, and {A, ¬B,C}

e)

figu417_01.gif

Incorrect reasoning, counter examples: {P, ¬Q,R, T } and {¬P,Q, ¬S, ¬T }

f)

figu418_01.gif

Incorrect reasoning, counter examples: {P,Q,R, ¬S}, {P,Q,R}, and {P,Q,R, S}

g)

figu419_01.gif

Thus, the initial formula is valid.

EXERCISE 3.21.–

a)

figu420_01.gif

The set of formulas is satisfiable, with models {¬P,R, S, ¬Q} and {Q, P, ¬R, ¬S}

b)

Although this is not necessary at all, sometimes, a preprocessing can enable us to simplify the problem under consideration. We illustrate this by applying the purity principle, i.e. the removal, in a set of clauses, of those clauses containing pure literals, since such an operation preserves the (un)satisfiability of the set (see exercise 3.30).

We must thus transform S2 into an equivalent set of clauses.

equ420_01.gif

equ421_01.gif

figu421_01.gif

The set of formulas is unsatisfiable.

EXERCISE 3.22.– We give two reasons.

1) If they were defined as functions:

– they would either be partial functions, for example:

equ421_02.gif

– or we use a trick:

equ421_03.gif

2) We would like to have, for example:

equ421_04.gif but also:

equ421_04.gif

This inference rule is clearly not a function, as it gives two distinct values for the same argument.

In general, it is impossible to consider inference rules as functions without any problem arising.

EXERCISE 3.23.– We want to prove:

If ie422_01.gif, then ie422_02.gif

PROOF.– By definition, there exists a deduction of ie422_03.gif starting from Γ

equ422_01.gif

if we add A to the hypotheses, we obtain B by MP on A and ie422_03.gif, i.e.

equ422_02.gif

EXERCISE 3.24.–

a) MP is correct: every model of A and ie422_03.gif is necessarily a model of B (otherwise B would be F, by definition of d_arr.gif).

We can easily verify that all the axiom schemas are tautologies (valid wffs). Hence, by definition of a valid wff and by induction on the number of steps in the proof, we conclude that every theorem of S1 is a valid wff.

b) Assume that there exists ie422_04.gif such that ie422_05.gif A and ie422_06.gif.

As shown in (a) above, every theorem of S1 is a valid wff. The negation of a valid wff is not a valid wff, hence it is not a theorem (contrapositive).

Therefore, such a wff A cannot exist.

c) Truth tables (semantic tableaux, the Davis and Putnam method, etc.) permit us to decide whether a wff is valid or not. As we admitted that S1 is adequate, we have a decision procedure for S1.

REMARK 12.6.– The soundness proved in (a) is not sufficient to prove (c). Indeed, the former says: if not valid then not a theorem. But if adequacy (completeness) is not guaranteed and the wff under consideration is valid, then we cannot be sure that it is a theorem of S1 (it could be a valid wff that is not captured as a theorem by the formal system).

EXERCISE 3.25.–

a)

equ423_01.gif

We can always use a theorem that was already proved. The justification is simple: we copy its proof at the beginning of the proof that uses it. The proof thus obtained respects the definition of a proof.

equ423_02.gif

b) We give two deductions, one of which uses the deduction (meta-) theorem (abbreviated as DT).

i) Without using the DT

equ423_03.gif

ii) Using the DT

equ423_04.gif

c)

equ423_05.gif

d)

equ424_01.gif

Warning: though tempting, the contrapositive cannot be used (it has not yet been proved that it is a theorem of S1).

equ424_02.gif

e) We give two deductions, one of which uses the deduction (meta-)theorem (abbreviated as DT).

i) Without using the DT

equ424_03.gif

ii) Using the DT

equ424_04.gif

f)

equ425_01.gif

Other proof:

equ425_02.gif

Another one:

equ425_03.gif

g)

equ425_04.gif

h)

equ426_01.gif

Other deduction

equ426_02.gif

i)

equ426_03.gif

EXERCISE 3.26.–

We must prove:

S1 is consistent w.r.t. negation if S1 is absolutely consistent.

only if

We prove the contrapositive. We assume that ie426_01.gif, i.e. that very wff is a theorem. in particular:

ie426_02.gif

hence, S1 is not consistent w.r.t. negation.

if

We prove the contrapositive. We thus assume that there exists A rev L such that:

ie427_01.gif

We first prove:

equ427_01.gif

Hence, as B can be replaced by any wff, we conclude that every wff is a theorem.

EXERCISE 3.27.–

a)

ie427_02.gif

b)

ie427_03.gif

c)

ie427_04.gif

d)

equ428_01.gif

e)

equ428_02.gif

f)

equ428_03.gif

g)

equ428_04.gif

h)

equ428_05.gif

EXERCISE 3.28.–

a) Yes, by verifying that:

(B2) is the same axiom schema as (A1) (in S1);

(B4) is the same axiom schema as (A2) (in S1);

and by taking remark 3.24 into account.

b)

equ429_01.gif

EXERCISE 3.29.–

a) We will say that two formal systems with the same language (or with languages that can be formally translated from one to the other) are equivalent iff they have the same set of theorems.

b) consider:

– the formal system ie429_01.gif

– a subset of axioms ie429_02.gif

– the formal system ie429_03.gif

image is independent iff ie429_04.gif x, for all x rev χ.

For example, the formal system ie429_05.gif (see (c) below), which differs from S1 only in the set of axioms, is not independent.

c) ie429_06.gif

(as ie429_07.gif see example 3.9)

d) (analogous to (b))

Consider:

– the formal system ie430_01.gif

– a subset of inference rules ie430_02.gif

– the formal system ie430_03.gif

image is independent iff there exists A rev image and lperp.gifsi, such that m_op3.gifsj A.

e) Find (it is not guaranteed that this will succeed) a property P such that:

1) the elements of a.gif/χ have property P;

2) the rules of R preserve property P;

3) the elements of χ do not have property P.

REMARK 12.7.– This technique was used to prove the independence of the famous “parallel postulate”, which led to non-Euclidean geometry.

Interpretations that are models of the other axioms of Euclidean geometry and counter-models of the parallel postulate have been found.

EXERCISE 3.30.

(R-0)

Without loss of generality, we assume that S contains a unique tautological clause T.

Let S1 = S {T}

S is unsatisfiable iff S1 is satisfiable.

if

We prove the contrapositive:

S satisfiable.

By definition, every subset of a satisfiable set is satisfiable; hence, S1 is satisfiable.

only if

We prove the contrapositive:

S1 is sat, with model, say, M.

As T is satisfied by every interpretation, it must be satisfied by M; hence, S is sat.

(R-1a) Trivial. No interpretation can make both L and ie431_01.gif T.

(R-1b) (To simplify the notation, we assume there is only one unit clause {L} and only one clause of the form equ431_01.gif. Of course, the reasoning can be repeated.

S1 = ((S {L}) ({Lc} ∪ α)) ∪ {α}

S unsat iff S1 unsat.

only if

We prove the contrapositive.

Assume S1 is sat, let M1 be a model of S1. Without loss of generality, we can assume ie431_02.gif (otherwise, it can be removed from M1 without any consequence). There exists ie431_03.gif such that ie431_04.gif (all the clauses in S1 must be evaluated to T).

ie431_05.gif is a model of S. Therefore, S is sat.

if

We prove the contrapositive:

Assume S is sat, let M be a model of S. Necessarily, ie431_06.gif (and therefore ie431_07.gif). There exists K rev α such that ie431_08.gif thus, S1 is sat.

(R2)

We assume without loss of generality that there is a unique pure literal:

equ431_02.gif

S is unsat iff S1 is unsat.

only if

We prove the contrapositive.

Assume S1 is sat, let M1 be a model of S1, ie431_09.gif (as L is pure).

ie431_10.gif is a model of S, which is therefore sat.

if

We prove the contrapositive.

S sat and ie432_01. cannot be unsat because every model of S is a model of all the clauses in S. Thus, S1 is sat.

This rule is known as the purity principle.

(R3)

equ432_01

S unsat iff (S1 unsat and S2 unsat)

only if

We prove the contrapositive.

S1 sat or S2 sat.

Without loss of generality, we assume that S1 is sat (we do not consider the case in which S2 is sat, as the proof is similar).

Let M1 be a model of ie432_02 and there exists ie432_03.

ie432_04 is a model of S. Hence S is sat.

if

We assume without loss of generality that there is only one clause containing L (say, the clause ie432_05) and only one clause containing Lc (say ie432_06).

We prove the contrapositive.

S is satisfiable, let M be a model of S. Assume ie432_07; hence, ie432_08. As M is a model of all the clauses in S, there exists a ie432_09 such that ie432_10 hence, S2 is sat, and S1 is sat or S2 is sat. Same reasoning if ie432_11.

If ie432_12 and ie432_13, there exists ie432_14, such that ie432_15 Hence S1 sat and S2 sat.

(R4)

equ432_02

equ433_01

S unsat iff S1 unsat

if

We prove the contrapositive.

S sat. As ie433_01 is sat.

only if

We prove the contrapositive.

S1 sat, let M1 be a model of S1. Of course, M1 is a model of ie433_02; hence (definition of a clause), M1 is also a model of ie433_03. Therefore, S is sat.

EXERCISE 3.31.– The answer is yes, as shown by the application of the algorithm with the strategy below.

In example 3.13, we implicitly applied the strategy “find a model as soon as possible”.

We now apply the strategy “try to find as many models as possible” (actually, in this particular case, we find all of them).

equ433_02

We thus found the following six models:

equ434_01.gif

EXERCISE 3.32.–

a) We take the following (arbitrary) order for the basic formulas:

equ434_02

O: inference nodes

b)

The interpretation that we can give of the inference nodes is as follows:

The interpretations denoted by the two branches going through an inference node falsify the clauses ie434_01 and ie434_02 (alpha and beta: disjunctions of literals). By definition of a clause, the interpretation denoted by the branch that finishes by an inference node falsifies all the literals of alpha and all the literals of beta. It therefore falsifies the resolvent of Ci and Cj (see definition 3.15).

c)

equ435_01

EXERCISE 3.33.–

equ435_02

EXERCISE 3.34.– We must prove:

If S is unsat, then ie436_01 (see section 3.7)

We give two proofs of this result.

PROOF 1.– We prove the result by induction on the number of positive literals in S.

1) equ436_01

Since S is unsatisfiable, S is necessarily of the form:

S = {L, Lc} hence, by applying the resolution rule once we obtain:

ie436_03

ii) n > 1

The idea is to apply a transformation that preserves the unsatisfiability, and strictly decreases the number of literals (to apply the induction hypothesis).

Assume S contains n + 1 literals.

Choose a literal ie436_04 that is not pure.

Consider the sets of clauses:

equ436_02

It was proved (see exercise 3.30) that:

S is unsat 1 iff S1 is unsat and S2 is unsat.

By the induction hypothesis, ie436_05 % S1 contains at most n literals.

There are two cases to consider (the second case itself leads to two cases):

a) the clauses ie436_06 do not occur in the refutation of S1.

The clauses that occur in the refutation are also in S, hence:

ie436_07.gif.

b1) the clauses C{L} occur in the refutation of S1.

In this case, ie437_01, as can be proved by generalizing the following example.

equ437_01

If we add a pure literal to the first clause:

equ437_02

b2) by repeating exactly the same reasoning for S2 with Lc instead of L, we conclude that:

equ437_03

Now for S (containing n + 1 literals) we have:

equ0001.gif

hence, by applying once the resolution rule, we obtain: ieq.

PROOF 2.– We give another proof by using theorem 3.2, and the results of exercise 3.32 (b).

By theorem 3.2, if S is unsat then there exists a closed semantic tree T for S.

First note that in a closed semantic tree, there are always inference nodes, otherwise all clauses would be positive (respectively, negative), and by applying the purity principle (see exercise 3.30), we would obtain an empty set equivalent to S, which would thus be satisfiable.

By eliminating all failure nodes from T, we obtain a closed tree T' (with strictly less nodes than T), corresponding to the set of clauses:

equ

We repeat the reasoning, but this time on S'.

As we are starting with a finite closed tree and at each step we obtain strictly smaller closed trees, we necessarily obtain a finite tree with ¬L and L (of course L denotes an arbitrary literal) as left and right branches, respectively, and the corresponding inference node is box.gif.

EXERCISE 3.35.– We must show:

equ0003.gif

We first prove that if S is unsat then ie001.gif (see the definition of operator ieq (definition 3.16)) is unsat.

The proof is trivial: every superset of an unsat set is unsat.

As we have proved the completeness of resolution for refutation, it suffices to apply rule R-0 of the Davis and Putnam method to Rn(S) (unsatisfiable set of clauses) for every n ≥ 1.

EXERCISE 3.36.– As resolution is complete for refutation, if S is unsat then box1.gif will be derived after a finite number of steps.

Given a set of clauses S, the problem is to decide whether S is sat or unsat. As S contains a finite number of literals and the application of Rc does not add any new literal, after a finite number of steps, we either generate box1.gif or we do not generate any new clause. In the latter case, we say we have saturated the set of clauses.

When the set of consequences of S has been saturated, the refutational completeness of S enables us to conclude that S is satisfiable.

An application example of this decision procedure is the detection of the satisfiability of the set of clauses (1), (2), (3) below:

equ0004.gif

EXERCISE 3.37.–

a)

equ0004.gif

b)

equ0004.gif

c)

equ0004.gif

There is no way of obtaining different clauses; hence, S is satisfiable.

d)

We give the clausal translation of each formula:

equ0004.gif

We prove that the set of clauses is unsatisfiable:

equ0004.gif

equ0004.gif

e)

i) if we did not know the resolution rule, we would probably give a proof similar to the following:

equ0004.gif

ii) By applying the resolution rule. We first translate into clausal form:

equ0012.gif

By negating the conclusion, we obtain the set of clauses 1-9 below and a refutation using resolution.

equ0013.gif

REMARK 12.8.– In (10), (11), and (12) we used the hyperresolution rule (we “compress” several resolution steps into only one).

f) We must consider the set of clauses 1-8 below, obtain all possible resolvents and reach saturation without generating image.

img001.gif

EXERCISE 3.38.– Not necessarily, the set of clauses:

img002.gif

does not contain any pure literal, but contains proper subsets that are unsatisfiable.

EXERCISE 3.39.–

a)

img003.gif

b) No. Take for example the unsatisfiable set of clauses:

img003.gif

We cannot deduce box1.gif using an input strategy, because the set does not contain any unit clause. Indeed, box1.gif can only be generated by two complementary unit clauses, one of which must belong to S (this is required by the input strategy).

EXERCISE 3.40.– No. Take the same unsatisfiable set as in exercise 3.39:

img004.gif

We cannot apply the resolution rule with a unit strategy.

EXERCISE 3.41.– Every interpretation I of S can be represented (see example 3.4, point 2.) by:

equ.gif, where equ.gif and equ.gif (see definition 3.8).

As S contains all the clauses of length n that can be formed with n propositional symbols, S contains a clause:

img008.gif

In other words, if Li is in I then ¬Li is in Cj and if ¬Li is in I then Li is in Cj.

Cj is falsified by I; hence, S is falsified by I.

This reasoning holds for all interpretations of S, which is therefore unsatisfiable.

EXERCISE 3.42.–

a) Every interpretation I of S contains (at least) p literals L1, L2,... Lp with the same sign.

By construction, S contains a clause ieq, which will of course be evaluated to F in I.

Therefore, S is unsatisfiable.

b) No.

Take as a counter example n = 2 (say {A, B}); hence, p = 2

equ.gif, which is satisfiable ieq

(We could have chosen n = 4, n = 6, …)

The explanation of the counter examples is that there could be, with the new hypothesis on p, interpretations containing only q literals of the same sign, with q < p.

EXERCISE 3.43.–

a)

We consider the propositions ieq meaning ieq.

We give the set of clauses specifying that such an injective function exists. This set must therefore be unsatisfiable.

The clauses specifying all possible images of the elements of the domain of cardinality n(Sn):

equ

The clauses specifying that the function is injective will be of the form:

equ.gif

We will thus have:

n × (n - 1) propositional symbols

n clauses of length n - 1 (*)

n × (n - 1)2 ÷ 2 clauses of length 2 (**)

The general case:

equ

b) S3 (clauses 1-9):

img017.gif

REMARK 12.9.– It is possible to prove that the minimal number of clauses necessary to refute the set of clauses specifying the pigeonhole Sn is:

img018.gif

For S3, the shortest refutation then contains 2 × 5 × 1 = 10 clauses.

The pigeonhole was used to prove that the resolution method is exponential, i.e. that there exists at least a set of clauses for which the shortest refutation is exponential in the number of clauses.

REMARK 12.10.– We sometimes specify the pigeonhole problem by translating: “If we define a function from n + 1 objects onto n objects then there exists (at least) two objects of the domain with the same image”, which translates into the tautological schema:

equ.gif

EXERCISE 3.44.–

No. We give two proofs of this result.

a)

As all clauses are of the form:

equ

with:

Pi: positive literal;

Nj: negative literal;

the interpretations I = {Pi} and J = {Nj} are models of the set of clauses that can therefore not be unsatisfiable.

b)

As the resolution is complete for refutation, we can assume without loss of generality that we are trying to detect the unsatisfiability of the set of clauses using the resolution rule.

The set does not contain any unit clause. indeed, as a unit clause contains only one literal and as a literal is either positive or negative, if the set contained a unit clause, the hypotheses would be violated.

Thus, all clauses are of the form:

equ

Without loss of generality, we reason on clauses of length 2. The application of the resolution rule to

img022.gif

produces a clause of the form:

img022.gif

Therefore, we can never obtain the complementary unit clauses that are necessary to obtain box1.gif.

The required corollary is trivial to obtain. The question is whether a set of clauses containing a positive clause (respectively, negative clause) but no negative clause (respectively, positive clause) can be unsatisfiable. The answer is no. In the first case, the interpretation

img024.gif

is a model. In the second case, the interpretation

img025.gif

is a model.

Hence the conclusion.

EXERCISE 3.45.– We use the propositional symbol:

ieq: country i is colored with color j.

Each country is colored with exactly one color:

for ieq

By transformation into clausal form (simplifying the clauses containing tautologies and applying the subsumption rule), we obtain the equivalent specification:

(Sch1) for ieq

(Sch1) could also have been obtained by translating: “country i must be colored with a color (first conjunct) and we cannot color it with more than one color (three other conjuncts)”.

The complexity of the specification of these clauses is less than 3 × N, or in other words, O(N).

Two neighboring countries cannot be colored the same way:

(Sch2) for all neighboring countries i, j: ieq

Every country has at most N - 1 neighbors, hence there are less than N2 clauses similar to the clause above. Hence, the complexity of the specification of this second part is O(N2).

The global complexity is thus O(N2).

REMARK 12.11.– In the coloring problem of example 9.19, the solution was obtained using a specification with constraints.

We could apply the formula schemata (Sch1) and (Sch2) above to specify the same map and the method of semantic tableaux (see section 3.6) to find all the models (i.e. the solutions to the problem). Of course, the solutions must be the same. It could be interesting to compare both approaches (one numerical, the other logical).

EXERCISE 3.46.–

a)

We assume that the models are represented by the set of propositional symbols that are evaluated to T in the models (form 3 in example 3.4).

Of course, the theorem does not depend on the adopted representation of models.

We note:

img030.gif

PROOF.– To derive a contradiction, we assume:

equ.gif, hence, for at least one clause ieq:

equ

There are two cases to consider (depending on the different forms of Horn clauses, see definition 3.21).

i) ieq (m = 0 corresponds to a unit positive clause)

To evaluate a clause to F, it is necessary to evaluate all of its literals to F (see definition 3.14), i.e.:

img035.gif

hence, by definition of an intersection, there exists ieq such that:

img037.gif

but then Mk is not a model of H (as it falsifies one of its clauses: Cj). Contradiction.

ii) ieq

To evaluate Cj to F:

equ

hence, by definition of an intersection, for all ieq

equ

but then the Mk’s are not models of H (as they falsify one of its clauses: Cj).

Contradiction.

b) No. Take ieq

equ

and n.gif

then img044.gif, which is not a model of H.

EXERCISE 4.1.–

a)

equ

R-4 on ieq = yields:

equ

R-4 on ieq = yields:

equ

R-3 on ieq = yields:

equ

R-4 on ieq = yields:

equ

R-5 on ieq = yields:

equ

There are no rules that can be applied, we halt.

Solution: ieq

b)

img057.gif

c)

equ

img059.gif

d)

Yes, it is always necessary. Consider the equation:

img060.gif

Clearly, ieq

If we do not apply the cycle rule, we have:

equ

i.e.:

equ

which is an infinite term.

A sufficient condition to be able to deal without the cycle rule is:

ieq and (t1 or t2) linear (a term t is linear iff all of its variables occurs at most once in t).

EXERCISE 4.2.– The possibilities of identification of the (sub)formulas corresponding to A, B, C in CD are:

1)

img065.gif

2)

img066.gif

3)

img067.gif

4)

img068.gif

There remains to compute three mgus and three direct consequences in the case in which the mgus exist, cases (3) and (4) are of course identical.

equ

We note that the only useful direct consequence is the first consequence (the others are wffs that coincide with the premises).

EXERCISE 4.4.–

– To be able to compare the rules and verify what is asked, we need to choose a same language to represent the three rules. We choose the language of clauses.

– To be able to apply the UNIFICATION algorithm (as well as the modified UNIFICATION), we consider connectives as functional symbols.

– Terms are formed from functional symbols of fixed arities ieq and ieq, which explains why we use ieq, which ordinarily denotes the empty string of symbols (i.e. the disjunction without any disjunct) in the terms representing the inference rules.

– this is a matching problem; hence, we use for R symbols that ordinarily denote variables.

– A, B, X denote literals; ieq denote clauses.

img073.gif

The solution of equation:

img074.gif

found by UNIFICATION is:

equ

The solution of equation:

img076.gif

found by modified UNIFICATION is:

equ.gif

EXERCISE 5.1.–

a)

img078.gif

equ

b)

Model:

equ

Counter-model:

Only change

equ

c)

equ

d)

equ

e)

equ

equ

f)

equ

g)

Model:

equ

Counter-model:

Change D = n.gif

h) No.

Take, for example:

img088.gif

i)

img090.gif

REMARK 12.12.– One characteristic of the equality relation is that it can be applied to (and have a meaning in) any domain of discourse.

j)

img091.gif

img091.gif

Counter-model with:

img092.gif

(take, for example, x = 3,y = 4 and z = 5)

k)

img092.gif

This formula does not have any finite model. It is a total, transitive and irreflexive relation. See also example 9.33.

We prove this by reductio ad absurdum. Assume it admits a finite model of domain:

img095.gif

also,

img096.gif

also,

img097.gif

but as D is finite (and of cardinality n), after at most n – 1 steps, we must produce (by transitivity) ieq with q = r (because aq is related to one of the ais in D, which will be reached sooner or later).

This is contradictory because ieq is irreflexive.

Therefore, this formula has no finite model.

img098.gif

1)

We can give infinitely many models for this formula by choosing:

img100.gif

For relation A, we choose any relation such that each element is in relation with exactly two other elements.

For example:

img101.gif

Which can be represented by the following graph:

img102.gif

We obtain a counter-model by adding at least a couple (an edge) to the relation (to the graph representing the relation), for example:

img103.gif

img102.gif

m)

img105.gif

with

img105.gif

meaning that for each x, the corresponding y and z are y = 2 × x and z = 2 × x + 1

The values of y and z can of course be interchanged.

m2)

This formula has no finite model. We assume a finite domain exists, with domain of discourse:

img105.gif

and derive a contradiction. By definition of a model, for all k rev D there exists i, j, i ≠ j such that:

img108.gif

Since f1.gif is not injective and D is finite:

img109.gif

To satisfy the formula (see definition 5.6), all elements of:

domain (f1.gif) range (f1.gif) must have antecedents in D = domain (f1.gif), but these potential antecedents already have values in the range (f1.gif).

It is impossible (definition of a function) to assign other values to them. The finite model hypothesis leads to a contradiction.

Therefore, this formula does not have any finite model.

A way of visualizing this reasoning is to draw the graph of function f1.gif. The elements marked with box.gif correspond to those that cannot be reached in a finite domain of discourse.

img110.gif

n) No.

equ

See example 9.31, the definition of a finite set:

The set E is finite iff all injective functions EE are also onto. See also example 9.32.

o)

Consider the interpretation ieq:

img112.gif

We verify that ieq is a model of (1) and (2) and a counter-model of (3):

1)

equ

2)

img114.gif

img115.gif

3)

img116.gif

EXERCISE 5.2.– We use the same idea as in example 5.13, i.e. we consider a formula of the form ieq and we focus on the case in which n ≥ 2. The problem is thus to find an adequate wff ieq.

There exist sets of arbitrary finite cardinalities (think for example of the finite subsets of ieq). To specify this, we must say that:

1) there exist n objects;

2) these objects are all different (so that the set is indeed of cardinality n).

1) translates into: img118.gif

Meaning that there are n objects with some property P; this is the usual method of defining sets.

2) To specify that they are different, it suffices to state that if an object xi has a property, then another object xj (ij) does not have it. Thus, it cannot be the same object.

The only remaining problem is how to choose (name) these properties. If we choose P (the same as the one used to define the set), the wff ieq would be contradictory and the implication ieq would be trivially T; similarly, if we choose only one property distinct from P (simple to verify with n = 2 and n = 3).

The solution is simple: it suffices to choose distinct properties, i.e.:

img120.gif

with ieq (i.e. all possible combinations of two objects among n).

There remains to prove (by induction) that the proposed formula is n-valid for all n rev ieq (n ≥ 2).

n = 2. It is very simple to verify (for example, using the method of semantic tableaux) that the formula img122.gif is n-valid (i.e. 2-valid).

n = N +1

We must add img123.gif together with the img124.gif formulas:

img125.gif

In branch (1) of the tree, there would be img126.gif

img128.gif together with P(x1), P(x2), …, P(xn+1), i.e. n + 2 potential constants. To work in universes of cardinality n +1 and using the induction hypothesis, we shall let xi = xn+1 (1 ≤ in). The branches of depth N + i (1 ≤ in) will all contain either QN+i(xi) and ¬QN+i(xi) or ¬QN+i(xi) and QN+i(xi) (of course, this is done under the assumption, which does not incur any loss of generality, that the tree was developed in increasing order of the variable indices) and whatever the chosen instantiation, will all be closed.

The formulas for (unbounded) arbitrary cardinalities can be obtained using the following schema:

img129.gif

thus using:

img129.gif

unary predicates Ql

with:

img131.gif

EXERCISE 5.3.– a)

img132.gif

b)

img133.gif

c)

img134.gif

d)

img135.gif

e)

img136.gif

The method continues with img137.gif, …the tree will not be closed (this will not be detected by the method).

REMARK 12.13.– If we had not renamed the variables, i.e. if instead of (3) we had written img138.gif then we could have “proved the validity” of the given formula.

f)

img139.gif

g)

img140.gif

h)

img141.gif

REMARK 12.14.– The replacement yd that was used to obtain formula 13 is correct as constant d was not used to replace any other existentially quantified variable.

i)

img142.gif

REMARK 12.15.– Here we used the fact that the semantics of FOL requires that the functions assigned to the functional symbols be total functions. Indeed, otherwise, we would not be able to replace variables by (for example) f (a). Furthermore, if (for example) f (a) is not defined then Q(f (a)) and ¬Q(f (a)) would not be contradictory (perp.gif and ¬perp.gif is not contradictory).

j) (See also section 8.3.)

By examining the tree, we notice that we could Close the tree by adding the formula img143.gif.

img144.gif

or img145.gif

img146.gif

k1) To verify the validity of the formula, we negate it.

img147.gif

k2) To try to construct a model of the formula, we do not negate it.

img148.gif

We can extract the following models from the finite open branches:

img149.gif

We can extract the following model from the infinite branch:

img150.gif

1)

img151.gif

EXERCISE 5.4.– The tableau corresponding to the given reasoning:

img152.gif

It is Clear that if:

– the cardinality of the domain of discourse is 1, i.e. a = b = c, then we obtain a closed tree (P(a), ¬P(c));

– similarly if the cardinality of the domain of discourse is 2, i.e. a = b (S(b), ¬S(a)) or a = c (P(a), ¬P(c)) or b = c (R(b), ¬R(c));

However, if the cardinality of the domain of discourse is 3, i.e. ab and ac and bc, we obtain the following model from the set of formulas (1), (2), (3), (4)".:

equ

(P(b), Q(b), Q(c), R(a) can belong to ieq or not)

It is very simple to verify that this is a counter example of the reasoning on a domain of discourse of cardinality 3. By construction, ieq is a model of the premises. About the conclusion:

– if x = a, then in ieq we have S(a): F and Q(a): T ;

– if x = b, then we have ieq S(b): T and Q(b): F ;

hence, in all cases, the conclusion is evaluated to F.

EXERCISE 5.5.–

img154.gif

EXERCISE 5.6.–

img155.gif

i.e.:

img156.gif

i.e.:

img157.gif

i.e.:

Note that img159.gif is also a model of s.gif, as s1.gif is a set of Horn clauses (see exercise 3.46).

EXERCISE 5.7.– We are here in the case of example 5.16, wherein we had to apply the method of semantic tableaux to what we called “generic formulae”.

Without loss of generality and for the sake of clarity of the proof, we write the binary resolution rule under the form:

img160.gif

To prove that the resolvent is a logical consequence of the parent clauses, we construct the tableau below.

equ475_01

It should be clear that we transformed the disjunctions of literals into binary trees (which is required by our formalization of semantic tableaux) and that:

equ475_02

The use of substitution lamda O sigma (instead of simply sigma) can be explained by the fact that possibly, ie475_01. In this case ie475_02

Similarly for the ie475_03 are variables of the parent clauses) ie475_04 ie475_05 (instead of a, any other closed term could be used). γ, which can also take into account the possible renamings of the variables of the resolvent, is thus used exclusively to close branches because of contradictions between closed literals (i.e. containing only closed terms), thus ensuring that the rules of the method of semantic tableaux are applied to formulas that are propositional (up to the syntax).

equ476_01

These are constant instances corresponding to the literals of the parent clauses whose variables are quantified universally (and as usual we chose the instances to be able to close the branches).

EXERCISE 5.8.– First we must transform the premises and the negation of the conclusion into clausal form (the labels on → refer to the rules used in the proof of theorem 5.3).

equ476_02

We rename the variables to avoid any confusion:

equ476_03

Negation of the conclusion:

equ476_04

% i.e. two clauses

To prove that the reasoning is correct, we must refute clauses 1. to 5. below:

equ476_05

equ477_01

Exercise 5.9.–

equ477_02

by replacing:

equ477_03

if we had asked the question

equ477_04

instead of we would have generated (see exercise 3.34):

Answer (h(g(c, b, f (a, c, d))))

which translates, in accordance with the interpretation that we gave to the function symbols (in particular to the constants) into: the monkey climbs on the chair after having walked from a to c starting from d, and carried the chair from c to b.

EXERCISE 5.10.–

a)

equ478_01

b)

equ478_02

REMARK 12.16.– We systematically rename the variables of the resolvents.

These are sets of clauses that belong to a decidable fragment of FOL (the clauses do not contain any functional symbol). After a while, no new clause is generated (up to a renaming of the variables) and since ie479_01 is not generated, we conclude that the set of clauses (1) to (5) is satisfiable.

EXERCISE 5.11.–

To apply the resolution rule, we must transform into clausal form: from ie479_02, after Skolemization we obtain ie479_03.

For the conclusion, ie479_04:

negation → Skolemization: ie479_05

The set of clauses to consider: ie479_06

The resolution rule cannot be applied (the unification algorithm fails with c1ash), ie479_07 cannot be obtained: the answer is therefore no.

EXERCISE 5.12.–

i) This exercise shows how to encode the axioms and the inference rule of S1 in clausal form and prove theorems using the resolution rule.

We write (A1), (A2), and (A3) in clausal form. The connectives d_arr.gif and enter are written:

i(x,y): x d_arr.gif y

n(x): enter x

1) P(i(x,i(y,x)))

2) P(i(i(x, i(y, z)), i(i(x, y), i(x, z))))

3) P(i(i(n(y), n(x)), i(i(n(y), x), y)))

The axioms are provable.

To translate MP, we say: If x is provable and ie479_10 is provable, then y is provable:

4) enterP(i(x,y)) ∨ (x) ∨ P(y)

We ask the question lperp.gif? A d_arr.gif A (see example 3.9). To better recall that A is a (meta) variable that denotes an arbitrary wff, we write lperp.gif? v d_arr.gif v (v denotes a variable).

To show that v d_arr.gif v is provable in S1 (encoded P(i(v, v))), we must generate, applying the resolution rule on 1–4 and:

equ480_01

As usual, we identify the variables in each clause with the corresponding index and rename the variables of the resolvents. We use a linear strategy.

equ480_02

ii)

We proceed by reductio ad absurdum. We assume that

A d_arr.gifA is not provable (5)

This implies that A is not provable, or that A d_arr.gif (B d_arr.gif B) is not provable (6);

and that, in turn, (A d_arr.gif (B d_arr.gif A)) d_arr.gif (C d_arr.gif C) is not provable (7)

As A, B, C are meta-variables (i.e. variables that can be replaced by arbitrary wffs), to avoid any confusion, we shall name them X, Y, Z respectively, so that

(X d_arr.gif (Y d_arr.gif X)) d_arr.gif (Z d_arr.gif Z) is not provable.

One instance is (with X ← C, Y ← C, Z ← C d_arr.gif C):

equ480_03

(*) is also an instance of (A2)

But this is a contradiction, as all the instances of an axiom are (by definition of a proof) provable.

EXERCISE 6.1.-

a)

equ481_01

ab(c, a); % the question

figu481_01

The execution does not halt.

If we consider the clause (**) instead of (*) :

1) top(a, b) →;

2) top(b, c) →;

3) ab(x, y) → top(x, y);

4) ab(u, v) → top(u, z) ab(z, v);

ab(c, a); % the question

figu482_01

X: problem impossible to solve

The program halts and answers No.

b)

1) P(a, b) →;

2) P(c, a) →;

3) P(x, y) → P(x, z) P(z, y);

P(u, b); % the question

figu482_02

Of course this problem has two solutions u = a and u = c, …but only the first one is found. To try finding all the solutions, we can swap the orders of clauses 1 and 2, or swap literals P(x, z) and P(z, y) in clause 3. In both cases, after having found both solutions, the program does not halt.

It is suggested to use the following technique:

equ483_01

Q(u, b) % the question

DIGRESSION 12.1.– When transforming programs, it is natural to wonder whether they are equivalent, and in the case of logic programing, this boils down to ask whether one program is a logical consequence of another one.

We seize this opportunity to show the usefulness of automated theorem provers (or proof assistants) for programing. We have used one of the best-known provers based on the resolution method (Prover9), which contains a tool capable of constructing finite models (Mace4).

If we let P1 stand for the initial program and P2 stand for the suggested program, we show that P1 is not a logical consequence of P2 (by exhibiting a counter-model constructed by Mace4). However, if the implication of clause 3. of the modified program is replaced by an equivalence, which yields, say, P2', then we give a proof that P1 is a logical consequence of P2'.

equ483_02

equ484_01

equ485_01

EXERCISE 6.2.– The intended meaning of the terms:

a: 0

s(x): successor of x (in n.gif)

a)

add(a, x, x) →;

add(s(x), y, s(z)) → add(x, y, z);

b)

mult(a, x, a) →;

mult(s(x), y, u) → mult(x, y, z) add(z, y, u);

c)

less(a, s(x)) →;

less(s(x), s(y)) → less(x, y);

d)

divides(x, y) → not(eq(x, 0)) division(y, x, z);

division(y, x, z) → mult(z, x, y);

% not: see section 6.3.2.

e)

prime(x) → not(eq(x, 0)) not(eq(y, 1)) less(y, x) not(divides(y, x))

% eq: see exercise 6.10

% not(eq(y, 0)) not necessary because in divides

EXERCISE 6.3.– The intended meanings of the terms:

a: 0

s(x): successor of x (in n.gif)

equ486_01

EXERCISE 6.4.–

figu486_01

The regular expression that characterizes the sequence of applications of the resolution rule with the strategy used by the interpreter PL (each application is represented by the used mgu):

equ486_02

The application of a gives the first solution, the rest of the regular expression gives the other solutions.

EXERCISE 6.5.–

a)

appendie486_01

appendie487_01

b)

equ487_01

c)

palindrome(x) → reverse(x, x);

d)

equ487_03

Other definition (program):

equ487_04

e)

equ487_05

f)

We give three definitions (programs).

i)

equ487_06

ii)

position(x, n, y): element x is at position n in list y

equ487_07

consec(u, v, x) → position(u, i, x) position(v, i + 1, x);

iii)

consec(u, v, x) → append(y, [v | z], x) append(w, [u], y);

Idea:

equ488_01

EXERCISE 6.6.– We first define the predicate partition

partition(list_ L, element_ of_ L (x), list_ of_ smaller_ elements_ than_ x_ in_ L, list_ of_ greater_ elements_ than_ x_ in_ L)

equ488_02

EXERCISE 6.7.–

equ489_01

% We identify adjacent elements:

equ489_02

% {a => b} is a constraint whose meaning is obvious. It could be replaced by a predicate similar to that of exercise 6.2 (c).

equ489_03

EXERCISE 6.9.-

a)

equ489_04

b)

equ490_01

EXERCISE 6.11.–

equ491_01

EXERCISE 8.1.– We prove properties that will permit us to simplify the answers to points (a) and (b).

We choose to represent clauses as sets of literals and recall that the sets of variables of distinct clauses are disjoint (see definition 5.10).

Property 1: let sigma denote a substitution:

image001.gif

PROOF.– By definition of a subsumption, there exists a substitution theta1 such that:

image002.gif

The application of a substitution to a clause cannot change the number of its literals (see definition 5.12); hence, by applying an arbitrary substitution sigma to theta1C and to D, the set inclusion cannot change: sigma will act in the same way on theta1C and on the corresponding subset of literals in D (as it is the same!). We can thus write:

image003.gif

there therefore exists a substitution (i.e. sigma o theta1) such that:

image004.gif

hence (definition of a subsumption):

image005.gif

We have the following immediate consequence.

Property 2: let C and D denote two clauses such that Var(D) = {y1,y2,…, yn} and let gamma be the substitution:

equ492_01

where the ai’s (1 ≤ in) are constants distinct from those in C and D (intuition: the constants occurring in C and D already have an intended meaning, and to reuse them could change this meaning),

if Cs sigmaD, then Cs gammaD

PROOF.– Trivial, by applying property 1 with gamma instead of sigma.

The following property is a property that will be very useful to answer points (a) and (b).

Property 3: let gamma be the substitution of property 2.

C ≤s D iff C ≤s gammaD

PROOF.– only if property 2

if

equ492_02

there therefore exists a substitution theta1 such that:

equ492_03

Assume Var(C) = {x1,x2,…, xm}

and ie492_01 and ti is a closed term for 1 ≤ i ≤ m because gammaD is a closed clause)

Of course, all the names of the literals (i.e. the predicate symbols) in C are in D (as ie492_02 and gamma do not act on the predicate symbols).

To prove Cs D, we must get back to D, or in other words, undo what was done by gamma.

We thus define the operation:

equ493_01

meaning: “si is the term obtained by replacing in ti constant ci by variable yi (1 ≤ in)”.

Consider the substitution:

equ493_02

and let Ω = [c1 |y1,c2 |y2...,cn | yn] (Ω is not a substitution; hence, the different notation)

By construction: Ω(gammaD) = D

and also by construction δCD.

ie493_02

As a small example of these constructions, let (as usual x, y denote variables and a, b denote constants):

equ493_03

ie493_02

hence C ≤s D.

Property 3 allows us to replace the study of Cs D by the study of Cs Df, where Df is a closed clause.

We use this property to answer the question.

a)

The clauses are disjunctions of literals with all variables quantified universally.

If Cs D, then there exists a closed substitution that transforms C into a subclause of the closed clause D.

Every model of C evaluates C to T on all elements of the domain, in particular, on the elements denoted by the closed terms that replaced the variables of C (functional symbols are associated to total functions, see definition 5.6).

Hence, every model of C is a model of D and

if C ≤s D, then C ieq D.

b)

To answer question (b) it suffices to recall the definition of a subsumption and note that there exists an algorithm (UNIFICATION) that permits us to solve sets of equations on terms.

An (inefficient!) decision procedure could be that of Figure 12.12:

We consider the input clauses, say C and D, as sets of literals:

equ494_01

D: closed clause, meaning that the occurrence test (rule 7 of algorithm unification is not necessary (see exercise 4.1 d)).

We note ie494_01, the set of literals of D whose names (predicate symbols) are the same as the name of Ki (of course, every literal name in C is a literal name in D, otherwise, the negative answer to the subsumption test is immediate).

Figure 12.1. Subsumption algorithm for clauses

Figure 12.1

EXERCISE 9.1.– As we have to prove validity, we negate the corresponding formula

equ495_01

EXERCISE 9.2.–

As we have to prove validity, we negate the corresponding formula:

equ496_01

EXERCISE 9.4.–

% The closed world:

equ496_02

% The possible positions:

equ496_03

We also give a schema of propositional formulas that permits us to get the specification in PL of the n-queens problem for all n revn.gif.

The proposition schemas Pi,j mean: a queen is at the intersection of line i and column j.

equ497_01

or the equivalent schema:

equ497_02

where the disjuncts of the schema have the following meaning:

ie497_01: queen on a square of the same line;

ie497_02: queen on a square of the same column;

ie497_03: queen on a square of the same diagonal NE-SW going through i, j;

ie497_04: queen on a square of the diagonal NW-SE going through i,j,

EXERCISE 9.6.– R is a well-founded relation, meaning that there are no infinite sequences {ai}irevn.gif such that R(a1,a0), R(a2, a1),…, R(an+1,an),...

This is explained by taking:

P m_op2.gif set of elements (⊆ D)

P(x) m_op2.gif x rev P

The formula is interpreted as follows.

Every non-empty subset of the domain [∀P(∃xP(x)…] contains an element [ ∃zP(z)…], such that there is no other element in the subset that is in relation with it [ … ∀y(P (y) d_arr.gif R(y, z)…].

b)

Connected graph

This is explained by taking

C m_op2.gif set of nodes (⊆ D)

C(x) m_op2.gif x rev C

A(x, y) m_op2.gif there is an edge from x to y

The formula is then interpreted as follows:

For every non-empty subset of nodes [ ∀C((∃xC(x)...], if x is in the subset [... C(x)...] and if when there is an edge from x to y, then y is also in this subset [... ∧ A(x, y) d_arr.gif C(y)...] and all the nodes in the graph are in this subset [... ∀zC(z)...].

c)

Non-connected graph with connected components

This is explained by taking:

C m_op2.gif set of nodes (⊆ D)

C(x) m_op2.gif x rev C

A(u, v) m_op2.gif there is an edge from u to v

The formula is then interpreted as follows.

There exists a non-empty subset of nodes of the graph [ ∀C((∃xC(x)...], which does not contain all the nodes in the graph [... ∃y... ¬C(y)... (disconnected part)], and such that if a node belongs to this subset [... C(u)...] and there is an edge from this node to another one [... A(u, v)...], then the latter is also in the subset [... C(v)... (connected part) ].

EXERCISE 10.1.–

a)

C = A un B, by definition:

equ498_01

by definition:

1) AC and BC

Let D such that:

2) AD and BD

then:

img499_01

i.e.:

img499_02

by definition:

3) D = C

From (1), (2) and (3) we conclude that C is the smallest set containing A and B.

b)

C = A u1 B, by definition:

img499_03

by definition:

4) CA and CB

Let D such that:

5) DA and DB

then:

img499_04

i.e.:

img499_05

by definition:

6) D = C

From (4), (5), and (6), we conclude that C is the greatest set contained in A and B.

c)

(For every x) we arrange in decreasing order ie500_01

By transitivity of order relations:

equ500_01

where i, j, k rev {A, B, C}

d)

similar (with min)

e)

There are two possible cases

e1) ie500_02

We verify easily that:

equ500_02

e2) ie500_03

Similar.

f)

Analogous to (e), by verifying:

equ500_03

g)

The property to verify here is:

equ500_04

which must be verified for the 6 (= 3!) possible cases:

g1) ie500_03

equ501_01

We verify for (g1)

equ501_02

h) Analogous to (g) by verifying:

equ501_03

EXERCISE 10.2.–For example:

equ501_04

EXERCISE 10.3.–

a)

Let RA × B and SB' × C

If ie501_01 then ie501_02 for every pair (x, y)

If ie501_03, then we must keep the pairs containing the z’s that are in B and in B', i.e.:

equ502_01

and regroup all these values:

equ502_02

b)

equ502_03

c)

equ502_04

d)

In classical logic: if xRy and yRx, then x = y

We can propose:

equ502_05

or:

equ502_06

e)

In classical logic: if xRy and yRz, then xRz

equ502_07

The idea is that x will be related to z at at least the same degree as x and y are related (which corresponds to min).

EXERCISE 10.4.–Yes:

ie502_01 and ie502_02 and ie502_03 not C and ie502_04 not D and ie502_05 not very D and ie502_06 not very true and ie502_07 not very true and not ie502_08 not very true and not ie502_09 not very true and not very ie502_10 not very true and not very false

The semantics:

equ502_08

EXERCISE 10.5.–

a)

equ503_01

b)

equ503_02

c)

equ503_03

d)

equ503_04

e)

equ503_05

f)

equ504_01

g)

equ504_02

h)

equ504_03

equ505_01

EXERCISE 10.6.– For the first of the translations in modal logic, it is possible to verify the soundness without translating the formula into FOL. Indeed, consider the set of the three premises and the negation of the conclusion (clauses (1) to (4) at the root of the tree).

equ505_02

We show that the other translation does not correspond to a correct reasoning, by constructing a counter example using the translation method and the method of semantic tableaux. As usual, we consider the set of premises and the negation of the conclusion.

equ506_01

In bold ie506_01, we can read a counter example of this formalization of the argument (reasoning) of the sea battle.

EXERCISE 10.7.–

a)

equ507_01

If R is total, i.e. ie507_01, we have R(X, a) (by assigning ie507_02) and we can graft the following tree:

equ507_02

b)

equ508_01

If R is Euclidean, i.e. ie508_01, then we have ie508_02 and we can also close the left-hand branch.

c)

equ508_02

If R is functional (“unique”), i.e. ie509_01,

then we have a = b (7 - 9) and the tree can be closed (8 - 10)

d)

equ509_01

If R is shift-reflexive, i.e. ie509_02, then we have ie509_03 R(a, a).

We can thus close the tree by grafting to the open branch the tree:

equ509_02

e)

equ510_01

Line 12' corresponds to R confluent (or convergent), i.e. ie510_01 ie510_02

EXERCISE 10.8.– If we keep the semantics of ie510_03 in definition 10.9:

equ510_02

EXERCISE 10.9.–

a)

The underlined formulas at time ti are those produced by the application of a rule at time tj (j < i).

equ511_01

The tree is closed, hence the formula is valid.

b)

equ511_02

The formula is not valid. counter example:

equ512_01

which could translate into: “if it will rain and the weather will be cold, that does not mean it will rain and the weather will be cold at the same time!”.

EXERCISE 10.10.– We can find representations in the literature similar to the representation below. It is explicit enough. The reader can name the instants for each group of formulas.

equ512_02

EXERCISE 10.11.– The rule corresponding to ie513_01

equ513_01

equ514_01

The underlined formulas are those that were developed in the parent node (rectangle).


1 We exclude the truth value assigned to the corresponding formula from the line.

2 This is a specification destined simply to show that a decision procedure exists, and is in no case intended to be implemented.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.32.222