Quiz 2

Nils Anders Danielsson

If you cannot access Canvas and submit your answers via email, please only give the answers (a number or a list of numbers), and no motivating arguments.

Define the integers inductively in the following way:

The idea is that non-neg(n) stands for n, and that neg-suc(n) stands for -(1 + n).

  1. (2p) Which of the following proof methods, if any, are correct? (The variable P stands for an arbitrary integer predicate.)

    1. (∀ n ∈ ℕ. P(non-neg(n))) ∧ (∀ n ∈ ℕ. P(neg-suc(n))) ⇒ ∀ i ∈ ℤ. P(i).

    2. (∀ n ∈ ℕ. P(non-neg(n)) ⇒ P(non-neg(n + 1))) ∧
      (∀ n ∈ ℕ. P(neg-suc(n)) ⇒ P(neg-suc(n + 1))) ⇒
      ∀ i ∈ ℤ. P(i)
      .

    3. (∀ n ∈ ℕ. P(non-neg(n)) ⇒ P(non-neg(n + 1))) ∧
      (∀ n ∈ ℕ. n ≥ 1 ∧ P(neg-suc(n)) ⇒ P(neg-suc(n - 1))) ⇒
      ∀ i ∈ ℤ. P(i)
      .

Let us say that we want to prove that is in bijective correspondence with Bool × ℕ. Define the function f ∈ ℤ → Bool × ℕ in the following way:

  1. (1p) Which of the following functions, if any, are inverses of f?

    1. g(true, n) = non-neg(n)
      g(false, n) = neg-suc(n)

    2. h(true, n) = non-neg(n)
      h(false, 0) = neg-suc(0)
      h(false, n + 1) = neg-suc(n)

    3. i(true, n) = non-neg(n + 1)
      i(false, 0) = non-neg(0)
      i(false, n + 1) = neg-suc(n)

Now on to alphabets, strings and languages:

  1. (1p) Which of the following statements, if any, are correct? (Σ is the alphabet {0, 1}, |w| is the length of the string w.)

    1. ε ∈ Σ*.

    2. ε ∈ Σ+.

    3. 11 ∈ Σ11.

    4. 11 ∈ Σ|11|.

  2. (1p) Which of the following statements, if any, are correct? (Σ is the alphabet {0, 1}.)

    1. Σ+ ⊆ Σ*.

    2. {ε} ⊆ ∅.

    3. {ww|w ∈ Σ*} ⊆ Σ*.

    4. {ww|w ∈ Σ*} ⊆ Σ+.