Logic in Computer Science (COMP118). Solutions for Tutorial Problems 5. 1.
Recall that a first-order sentence G over a signature S is satisfiable if, and only if,
...
Logic in Computer Science (COMP118) Solutions for Tutorial Problems 5 1. Recall that a first-order sentence G over a signature S is satisfiable if, and only if, there exists an S-structure F such that F |= G. Let R be a binary predicate symbol, Q a unary predicate symbol, and c an individual constant. (a) Show that the sentence G1 = ∀x.∀y.(R(x, y) → R(y, x)) is satisfiable. In other words, define an {R}-structure F1 such that F1 |= G1 . (b) Show that the sentence G2 = ¬∀x.∀y.(R(x, y) → R(y, x)) is satisfiable. In other words, define an {R}-structure F2 such that F2 |= G2 . (c) Show that the sentence G3 = ∀x.R(x, x) is satisfiable. In other words, define an {R}-structure F3 such that F3 |= G3 . (d) Show that the sentence (∀x.Q(x) ∧ ¬Q(c)) is not satisfiable. 2. Show that ∀x.(P (x) ∧ Q(x)) and (∀x.P (x) ∧ ∀x.Q(x)) are logically equivalent. In other words, show that • {∀x.(P (x) ∧ Q(x))} |= (∀x.P (x) ∧ ∀x.Q(x)) and • {(∀x.P (x) ∧ ∀x.Q(x))} |= ∀x.(P (x) ∧ Q(x)). 3. Show that {∀x.(P (x) ∨ Q(x))} 6|= ((∀x.P (x) ∨ ∀x.Q(x)). In other words, define a {P, Q}-structure F such that F |= ∀x.(P (x) ∨ Q(x)) and F 6|= ((∀x.P (x) ∨ ∀x.Q(x)). 4. Let S = {P, Q, c}, where P and Q are unary predicate symbols and c is a individual constant. Show that {(Q(c) ∧ ∃x.(Q(x) ∧ P (x)))} 6|= P (c) In other words, define an S-structure F such that • F |= Q(c) ∧ ∃x.(Q(x) ∧ P (x)) and
• F 6|= P (c). 5. Let P, Q, R be propositional formulas. Show that (P → (Q → R)) ≡ ((P ∧ Q) → R) Solution for 1 (a) We have to construct an {R}-structure F1 such that F1 |= ∀x.∀y.(R(x, y) → R(y, x)) Since ∀x.∀y.(R(x, y) → R(y, x)) says that R is symmetric we can take any {R}-structure in which R is interpreted as a symmetric relation. For example, F1 = (DF1 , RF1 ), where • DF1 = {0, 1}; • RF1 = {(0, 1), (1, 0)}. (b) We have to construct an {R}-structure F2 such that F2 |= ¬∀x.∀y.(R(x, y) → R(y, x)) Since ¬∀x.∀y.(R(x, y) → R(y, x)) says that R is not symmetric we can take any {R}-structure in which R is interpreted as a non-symmetric relation. For example, F2 = (DF2 , RF2 ), where • DF2 = {0, 1}; • RF2 = {(0, 1)}. (c) We have to construct an {R}-structure F3 such that F3 |= ∀x.R(x, x) Since ∀x.R(x, x) says that R is reflexive we can take any {R}structure in which R is interpreted as a reflexive relation. For example, F3 = (DF3 , RF3 ), where • DF3 = {0, 1}; • RF3 = {(0, 0), (1, 1), (0, 1)}.
(d) We have to show that for every {Q, c}-structure F: F 6|= ∀x.Q(x)∧¬Q(c). Assume for a proof by contradiction that there is a {Q, c}-structure F with F |= ∀x.Q(x) ∧ ¬Q(c). Then • F |= ∀x.Q(x); • F |= ¬Q(c). By Point 2, cF 6∈ QF and, therefore, (F, a) 6|= Q(x) for the variable assignment a defined by a(x) = cF . Hence F 6|= ∀x.Q(x) and we have derived a contradiction. Solution for 2. Let S + {P, q}. We have to show that the following two implications hold for all S-structures F: • if F |= ∀x.(P (x) ∧ Q(x)), then F |= ∀x.P (x) ∧ ∀x.Q(x); • if F |= ∀x.(P (x) ∧ ∀x.Q(x)), then F |= ∀x.(P (x) ∧ Q(x)). For Point 1, assume F |= ∀x.(P (x) ∧ Q(x)). Then for all variable assignments a: (F, a) |= P (x) ∧ Q(x) Then for all variable assignment a: (F, a) |= P (x) and (F, a) |= Q(x). Then for all variable assignments a: (F, a) |= P (x) and for all variable assignments a: (F, a) |= Q(x). By definition of |=, we obtain F |= ∀x.P (x) and F |= ∀x.Q(x), which implies F |= ∀x.P (x) ∧ ∀x.Q(x), as required. For Point 2, assume that F |= ∀x.(P (x) ∧ ∀x.Q(x)). Then F |= ∀x.P (x) and F |= ∀x.Q(x). By definition, for all variable assignments a: (F, a) |= P (x) and for all variable assignments a: (F, a) |= Q(x). Hence, for all variable assignments a: (F, a) |= P (x) and (F, a) |= P (x).
From this we obtain for all variable assignments a: (F, a) |= P (x) ∧ Q(x). But then F |= ∀x.(P (x) ∧ Q(x)), as required. Solution for 3. Define F = (DF , P F , QF ) by setting: • DF = {a, b}; • P F = {a}; • QF = {b}. Then F |= ∀x.(P (x) ∨ Q(x)), but F 6|= ∀x.P (x) and F 6|= ∀x.Q(x). Hence F 6|= (∀x.P (x) ∨ ∀x.Q(x)). Solution for 4. Define F = (DF , cF , P F , QF ) by setting: • DF = {a, b}; • cF = a; • P F = {b}; • QF = {a, b}. Then F |= Q(c) since cF = a ∈ QF , F |= ∃x.(Q(x) ∧ P (x)) since (F, a) |= Q(x) ∧ P (x) for the variable assignment a with a(x) = b. Finally, F 6|= P (c) since cF = a 6∈ P F . Solution for 5. One can show using truth tables that the only interpretation I such that I(P → (Q → R)) = 0 is given by setting I(P ) = 1, I(Q) = 1 and I(R) = 0. One can also show using truth tables that the only interpretation I such that I((P ∧ Q) → R) = 0 is exactly the same interpretation: I(P ) = 1, I(Q) = 1 and I(R) = 0. It follows that the two formulas are logically equivalent.