CS532, Winter 2008 Homework #1 Solution Dr. Alan Fern, afern@cs.orst.edu January 20, 2010 Problem A: Prove that if a knowledge base entails contradictory formulas, then it entails any formula. That is, use the definition of entailment to prove the following statement. Let KB be a formula of some logic. If there exists a formula φ such that both KB |= φ and KB |= ¬φ, then KB |= φ for any formula φ. Assume that both KB |= φ and KB |= ¬φ. By the definition of entailment, it follows that any model M of KB must satisfy both φ and ¬φ. However, we know that there is no model with this property, which implies that KB has no models. By definition a formula φ0 is entailed by KB iff it is true in all of the models of KB. Since, KB has no models this definition is satisfied for any formula φ0 , and hence KB |= φ0 for any φ0 . This completes the proof. Problem B: Prove that if KB |= φ, then the formula KB → φ is logically valid (i.e. a tautology). We will prove the contrapositive. That is, if KB → φ is not valid then KB 6|= φ. If KB → φ is not valid then there is a model M in which it is false. In order for this to happen it must be the case the KB is true with respect to M and φ is false with respect to M . But this violates the definition of entailment which says that φ must be true in all models that KB is true in, proving that KB 6|= φ. Also complete the following problems from your textbook. 1 8.2 Consider a knowledge base containing just two sentences: P (a) and P (b). Does this knowledge base entail ∀ x P (x)? Explain your answer in terms of models. The knowledge base does not entail ∀ x P (x). To show this, we must give a model where P (a) and P (b) are true but where ∀ x P (x) is false. Consider a model with domain D = { A, B, C } and interpretation function such that I(a) = A I(b) = B I(P ) = A, B Here we see that both P (a) and P (b) are true in the model, but since P is not true for domain element C we have that ∀ x P (x) is not true. 8.3 Is the sentence ∃ x, y x = y valid? Explain. The answer depends on whether or not we allow our first-order models to have empty domains. Since I did not specify this clearly in the notes, I will accept either answer, of course with the correct argument. However, I would like to indicate that the standard textbook semantics of first-order logic require that all domains be non-empty. The sentence ∃ x, y x = y is valid. A sentence if valid if it is true in every model. An existentially quantified sentence is true in a model if it holds under any extended interpretation in which its variables are assigned to domain elements. In the case where we do not allow empty domains, for any model, there is an extended interpretation in which x and y are assigned to the first domain element. In such an interpretation x = y is true. In the case where we allow for empty domains, the sentence would be false in the model with an empty domain. 8.4 Write down a logical sentence such that every world in which it is true contains exactly one object. The following formula asserts that there is exactly one object ∀ x, y x = y To see this, note that if a model contains at least two objects, then there is an extended interpretation in which x and y are assigned different objects, making the sentence false. The above formula suffices if we are not allowing empty domains (which is correct); however, if you considered the possibility of empty domains, then you could have used the formula (∀ x, y x = y) ∧ (∃ y y = y) which requires that there is some object in the domain. 8.6 Represent the following sentences in first-order logic, using a consistent vocabulary (which you must define): 2 h There is a barber who shaves all men in town who do not shave themselves. ∃ x [ Barber(x) ∧ ∀ y [ (M an(y) ∧ ¬Shaves(y, y)) ⇒ Shaves(x, y) ] ] i A person born in the UK, each of whose parents is a UK citizen or a UK resident, is a UK citizen by birth. Below Citizen(y, c, r) means that y is a citizen of c for reason r. ∀x P erson(x) ∧ Born(x, U K)∧ ( ∀ y P arent(y, x) ⇒ [ ∃ r Citizen(y, U K, r) ∨ Resident(y, U K) ] ) ⇒ Citizen(x, U K, Birth) j A person born outside the UK, one of whose parents is a UK citizen by birth, is a UK citizen by descent. ∀x P erson(x) ∧ ¬Born(x, U K)∧ ( ∃ y P arent(y, x) ∧ Citizen(y, U K, Birth) ) ⇒ Citizen(x, U K, Descent) k Politicians can fool some of the people all of the time, and they can fool all of the people some of the time, but they can’t fool all of the people all of the time. (∃ y ∀ t P erson(y) ∧ F ools(x, y, t))∧ ∀ x P olitician(x) ⇒ (∃ t ∀ y P erson(y) ⇒ F ools(x, y, t))∧ ¬(∀ t ∀ y P erson(y) ⇒ F ools(x, y, t)) 8.13 Explain what is wrong with the following proposed definition of the set membership predicate ∈ (in terms of models allowed): ∀ x, s x ∈ {x|s} ∀ x, s x ∈ s ⇒ ∀y x ∈ {y|s}. These axioms are sufficient to prove set membership when x is in fact a member of a given set; they have nothing to say about cases where x is not a member. For example, it is not possible to prove that x is not a member of the empty set. Another way view the problem is to look at some of the unintended models allowed by the axioms. Consider a model with domain elements, A, {A}, and {}, where we interpret the ∈ relation as I(∈) = { < A, {A} >, < A, {} > } This model satisfies the axioms but is clearly not what we intend as A is considered to be an element of the empty set. 3 8.15 Explain what is wrong with the following proposed definition of adjacent squares in the wumpus world (in terms of models allowed): ∀x, yAdjacent([x, y], [x + 1, y]) ∧ Adjacent([x, y], [x, y + 1]). There are several problems with the proposed definition. For example, it allows one to prove Adjacent([1, 1], [1, 2]) but not Adjacent([1, 2], [1, 1]). At the very least, this shows we need an additional symmetry axiom. It does not allow one to prove that Adjacent([1, 1], [1, 3]) is false, so it needs to be written as ∀ s1, s2 ⇐⇒ . . . Finally, it does not work at the boundaries of the world, so some extra conditions must be added. 4