Assignment 1

Nils Anders Danielsson

  1. (3p) [AB] Prove using induction that, for every finite alphabet Σ, ∀ n ∈ ℕ. |Σⁿ| = |Σ|ⁿ.

  2. [AB] Define a language S containing words over the alphabet Σ = {a, b} inductively in the following way:

    1. (1p) Use recursion to define two functions #a and #b ∈ S → ℕ that return the number of occurrences of a and b, respectively, in their input.

    2. (2p) Use induction to prove that ∀ w ∈ S. #a(w) = 2 #b(w).

  3. [AB] Let Σ = {0} and define f, g, h ∈ Σ* → ℕ recursively in the following way:

    1. (0.5p) Compute the values of f(00), g(00), h(00), f(000), g(000), h(000), f(0000), g(0000) and h(0000).

    2. (3.5p) Prove that ∀ n ∈ ℕ. f(0ⁿ) = 1 + n.

      Hint: First prove that ∀ n ∈ ℕ. g(0ⁿ) = 1 ∧ h(0ⁿ) = n.

(Exercises marked with [AB] are based on exercises from a previous version of this course, given by Ana Bove.)