Wednesday, October 15, 2014

Week 5

Test #1 was not too bad. The only part I didn't understand was the question where the 2 logic statements were identical, except for the order of quantifiers. I didn't know this mattered. I always assumed ∀x, ∃y was the same as ∃y, ∀x. However, I checked over the Wikipedia page on Quantifiers and it seems of course it does matter.

They used the example ∀x ∈ N, ∃y ∈ N, y = x^2 and ∃y ∈ N, ∀x ∈ N, y = x^2. The first statement is true, but the second is false. Previously, if they were written symbolically, I would have said both are true. When I write them in English, it's of course a lot easier to understand and explain why both are not true. Actually, even if you wrote them as Python/pseudo syntax with proper nesting, it would be better.

all(any(y==x**2 for y in naturalNums) for x in naturalNums)

any(all(y==x**2 for x in naturalNums) for y in naturalNums)

1 comment:

  1. Order always matters! Try to think of non-CS cases where that's true as well, kind of like you did by translating it to English, but a step further. After all, we use computer science to solve problems that don't have clear-cut solutions :)

    ReplyDelete