Let f : N → N and g : N → N be the functions defined as ∀k ∈ N
f(k) = 2k and g(k) = (k/2 if k is even, (k + 1) /2 if k is
odd).
(1) Are the functions f and g injective? surjective? bijective?
Justify your answers.
(2) Give the expressions of the functions g ◦ f and f ◦ g?
(3) Are the functions g ◦ f and f ◦ g injective? surjective?
bijective?...
Let function F(n, m) outputs n if m = 0 and F(n, m − 1) + 1
otherwise.
1. Evaluate F(10, 6).
2. Write a recursion of the running time and solve it
. 3. What does F(n, m) compute? Express it in terms of n and
m.
Consider the relation R defined on the set Z as follows: ∀m, n ∈
Z, (m, n) ∈ R if and only if m + n = 2k for some integer k. For
example, (3, 11) is in R because 3 + 11 = 14 = 2(7).
(a) Is the relation reflexive? Prove or disprove.
(b) Is the relation symmetric? Prove or disprove.
(c) Is the relation transitive? Prove or disprove.
(d) Is it an equivalence relation? Explain.
Let M be defined as follows M = (K, Σ, s, ∆, F ) for K = {q0,
q1, q2, q3, }, s = q0, Σ = {a, b, c}, F = {q0, q2, q3} and ∆ =
{(q0, abc, q0), (q0, a, q1), (q0, e, q3), (q1, bc, q1), (q1, b,
q2), (q2, a, q2), (q2, b, q3), (q3, a, q3)}.
1. (1pts) Draw the diagram of M
2. (6pts ) DRAW a diagram of an automata M0 such...
Let a < c < b, and let f be defined on [a,b]. Show that f
∈ R[a,b] if and only if f ∈ R[a, c] and f ∈ R[c, b]. Moreover,
Integral a,b f = integral a,c f + integral c,b f .
2. The Fibonacci sequence is defined as
f(n) = f(n - 1) + f(n - 2)
with f(0) = 0 and f(1) = 1.
Find f(54) by a program or maually. Note that this number must
be positive
and f(53) = 53.......73 (starting with 53 and ending with 73).
I must admit that
my three machines including a desktop are unable to find f(54)
and they
quit during computation.
The answer is f(54) = 86267571272
*/
The Java code:
public...
The curried version of let f (x,y,z) = (x,(y,z)) is
let f (x,(y,z)) = (x,(y,z))
Just f (because f is already curried)
let f x y z = (x,(y,z))
let f x y z = x (y z)
Let ∼ be the relation on P(Z) defined by A ∼ B if and only if
there is a bijection f : A → B. (a) Prove or disprove: ∼ is
reflexive. (b) Prove or disprove: ∼ is irreflexive. (c) Prove or
disprove: ∼ is symmetric. (d) Prove or disprove: ∼ is
antisymmetric. (e) Prove or disprove: ∼ is transitive. (f) Is ∼ an
equivalence relation? A partial order?