您在這裡

Solutions to Exercises in Chapter .

16 六月, 2015 - 17:23
Available under Creative Commons-ShareAlike 4.0 International License. Download for free at http://cnx.org/contents/383d4b87-2d7b-454e-99fe-2eaa43eae8ff@20.20

Solution to Exercise 4.1.1.1

The cue "Somebody ..." suggests one person who exists; we'll call them p for "popular": ∃p :(... ). Now we need to fill in the dots with "everybody likes p", to get: ∃p :(∀x : (likes (x, p))).

Solution to Exercise 4.1.1.2

The cue "Everybody ..." suggests a universal; we'll call them j for "J. Doe": ∀j :(... ). Now we need to fill in the dots with "somebody likes j", to get: ∀j :(∃x : (likes (x, j))). Note that this formula is just like the preceding "Somebody likes everybody" example (Example 4.3), except that the quantifiers have been swapped (and different variable names were used, a superficial difference).

Solution to Exercise 4.1.1.3

"Evenness" is a straightforward translation from " An integer n is even, if it is twice some other integer k ": even (n) ≡∃k :(n =2k). Note that by this standard definition, zero is even.

There are many equivalent ways to define primality, just as there many algorithms for checking primality. One straightforward solution is noncomposite (n) ≡∀j :(∀k : ((jk = n) ⇒ (j = 1) ∨ (k = 1))). Well, this is almost expresses "prime", except that n =1 satisfes this formula. A mathematician points out that just as 0 is neither positive nor negative, 1 is neither prime nor composite; as stated this formula actually captures "noncomposite", oops. There are several ways to upgrade this to exactly capture "prime".

ASIDE: 1 is called a "unit". If we consider the domain of all integers (not just natural numbers), the idea of primality still makes sense; -17 is also prime; and -1 is also another unit. Similarly, considering the domain of "complex integers" {a, b, a + bi | aZbZ} (could be written " Z+ Zi "), then i and −i are also units. How might we generalize our defnition of prime, to work in these further interpretations?

A similar, equivalent formula to the above is noncomposite(n)\equiv \dashv Ej:(\exists k:((jk=n)\wedge (j\neq 1)\wedge (k\neq 1))).

Solution to Exercise 4.1.1.4

\forall n:(even(n)\wedge (n>2)\Rightarrow \exists p:(\exists q:(prime(p)\wedge prime(q)\wedge (p+q=n))))

Solution to Exercise 4.1.1.5

We need a new relation that combines the syntax of < and size. The result would look like less − than − size (i, a). This assumes the new relation has the obvious intended defnition.

Solution to Exercise 4.1.1.6

\forall x:(\forall y:(nhbr(x,y)\Rightarrow safe(y))\Leftrightarrow has-0(x))

Solution to Exercise 4.1.1.7

There are various solutions, but they all must capture the same idea: there exists exactly one unsafe neighbor. This solution states that in two parts:

  • There exists an unsafe neighbor, u.
  • Every unsafe neighbor is u.

Together, these two parts imply there is only one such u.
\forall x:(\exists u:(nhbr(x,u)\wedge -safe(u)\wedge \forall y:(nhbr(x,y)\Rightarrow (\dashv safe(y)\Leftrightarrow y=u)))\Leftrightarrow has-1(x))

Solution to Exercise 4.2.1.1

1

\forall x:(\phi \Rightarrow \psi )

 

2

\equiv \forall x:(\dashv \phi \vee \psi )

Defnition of ⇒

3

\equiv \forall x:(\dashv \phi) \vee \psi

Distribution of ∀ over ∨

4

\equiv \dashv \exists x:(\phi) \vee \psi

Complementation of ∃

5

\equiv \exists x:(\phi) \Rightarrow \psi

Defnition of ⇒

Solution to Exercise 4.3.1.1

In line 4, ∀Intro requires that variable being generalized, q, be arbitrary. It was introduced in line 2 by ∀Elim, so that's OK. (E.g., we could've used ∀Intro on line 3 to reintroduce the quantifer just eliminated.) But, q was free when we used ∃Elim on line 3, and this makes the variable no longer arbitrary. Line 3's choice of p may depend on q, and a variable is only arbitrary if it is free of any such constraints.

Solution to Exercise 4.4.5

  1. The relation needs to accept locations as well as numbers, so the domain is LN, where L is the set of WaterWorld locations. Alternatively, you could use {0, 1, 2, 3} instead of N, the set of all natural numbers.
  2. The difficulty is that it's possible to ask about nonsensical combinations like piratesNextTo (17, 2) and piratesNextTo (W, B). Adding isNumber?, any interpretation would be expected to satisfy, for arbitrary a and b, piratesNextTo (a, b)isNumber? (b) ∧¬isNumber? (a, b).

ASIDE: More interestingly though, imagine we did interpret piratesNextTo over the domain N only. We could then pretend that the locations, instead of being named A,...,Z, were just numbered 1,...,24. While this representation doesn't refect how we model the problem, it is legal. Exercise for the reader: Write a formula which excludes relation piratesNextTo which can't match this convention!

Solution to Exercise 4.4.16

One interpretation that satisfes this is a domain of three people Alice, Bob, Charlie, with the likes relation: {(Alice, Bob) , (Bob, Bob)}. Bob is liked by two people, so it satisfies the statement.

Here's another interpretation that is the same except for renaming, and thus not fundamentally different: a domain of three people Alyssa, Bobby, Chuck, with the likes relation: {(Chuck, Alyssa) , (Alyssa, Alyssa)}. With the substitutions [ChuckAlice] and [AlyssaBob], we see that the underlying structure is the same as before.

Here's an interpretation that is fundamentally different: a domain of three people Alice, Bob, Charlie, with the likes relation: {(Charlie, Bob) , (Alice, Bob)}. No matter how you rename, you don't get somebody liking themself, so you can see its underlying structure is truly different than the preceding interpretations.

English is fuzzy enough that it is unclear whether "one" and "two" are meant as exact counts. The above two examples each assumed they are.

ASIDE: If we change the statement slightly to add a comma: " There exists one person, who is liked by two people ", we arguably change the meaning signifcantly. The now-independent first clause arguably means there is only one person existent in total, so the overall statement must be falsel There's a quick lesson in the diference between English dependent and independent clauses.

Solution to Exercise 4.4.28

1

\forall x : (R (x) \Rightarrow S (x))

Premise

2

R (c)

Premise

3

R (c) \Rightarrow S (c)

∀Elim, line 1

4

X (c)

⇒Elim, lines 2,3