1-hw-222-19-answers.pdf - ICS 222 Homework 1 Please upload your solutions to Laulima by noon on Friday Answer to Exercise 1 a b = 3 β(y = 3 y The

1-hw-222-19-answers.pdf - ICS 222 Homework 1 Please upload...

This preview shows page 1 out of 7 pages.

You've reached the end of your free preview.

Want to read all 7 pages?

Unformatted text preview: ICS 222: Homework 1 Please upload your solutions to Laulima by noon on Friday Sep 20, 2019 Answer to Exercise 1 a) @ b = 3, β(y) = 3 + y The clausal form of the induction is given by: f0 = 3 f1+n = 3 + fn Trying a few instances of f starting from 0, we get: f0 = 3, f1 = 3 + 3 = 6, f2 = 3 + 6 = 9, f3 = 3 + 9 = 12, . . . Hence, we guess that fn = 3 + 3n. To prove that this function f has the inductive specification above we apply induction: claim: L3, 3 + yMn = 3 + 3n base case: L3, 3 + yM0 = 3 = 3 + 3 · 0 step case: if L3, 3 + yMn = 3 + 3n, then (IH) L3, 3 + yM1+n = 3 + L3, 3 + yMn = 3 + 3 + 3n = 3 + 3(1 + n) b) @ b = 3, β(y) = 3y The clausal form of the induction is given by: f0 = 3 f1+n = 3fn Trying few instances of f starting from 0: f0 = 3, f1 = 3 · 3 = 9, f2 = 3 · 9 = 27, f3 = 3 · 27 = 81, . . . Hence, we guess that ∀n ∈ N. fn = 3n+1 . 1 claim: L3, 3yMn = 3n+1 base case: L3, 3yM0 = 3 = 30+1 step case: if L3, 3yMn = 3n+1 , then (IH) L3, 3yM1+n = 3 · L3, 3yMn = 3 · 3n+1 = 3(1+n)+1 c) @ b = 3, β(y) = 3y The clausal form of the induction is given by: f1+n = 3fn f0 = 3 Trying few instances of f starting from 0: 33 3 f0 = 3, f1 = 33 , f2 = 33 ·, f3 = 33 , . . . Writing the powers xy in the form x ↑ y, we guess fn = 3 ↑ · · · ↑ 3 ↑ 3. | {z } n copies To prove fn has the inductive specification above we apply induction: claim: L3, 3y M = 3 ↑ · · · ↑ 3 ↑ 3 | {z } n base case: L3, 3y M0 = 3 step case: if L3, 3y Mn = 3 ↑ · · · ↑ 3 ↑ 3, then | y {z } n 3 ↑ ··· ↑ 3 ↑3 L3,3y Mn (IH) L3, 3 M1+n = 3 | = 3 {z n } In other words, fn = 3 ↑↑ n. = 3 ↑ ··· ↑ 3 ↑3 | Answer to Exercise 2 a) γ0 = 3 · 20 = 3 suggests b = 3. Towards β, note: γ1+n = 3 · 21+n = (3 · 2n ) · 2 = 2γn 2 {z 1+n } and so β(y) = 2y. Hence we conjecture that γn = L3, 2yM. L3, 2yM5 = 2 · L3, 2yM4 = 2 · (2 · L3, 2yM3 ) = 2 · (2 · (2 · L3, 2yM2 )) = 2 · (2 · (2 · (2 · L3, 2yM1 ))) = 2 · (2 · (2 · (2 · (2 · L3, 2yM0 )))) = 2 · (2 · (2 · (2 · (2 · (3))))) = 25 · 3 b) χ0 = 0(0+1) 2 = 0 suggests b = 0. Towards β, note: χ1+n = (1 + n)(n + 2) n(1 + n) 2(1 + n) = + = χn + (1 + n) 2 2 2 Note that we cannot define β on a single parameter only since χ1+n depends on χn and 1+n. Hence, we do not have an inductive specification but a recursive specification given by L0, y + 1 + nM. The evaluation of this function for n = 5 is given below: χ5 = 5 + χ4 = 5 + 4 + χ3 = 5 + 4 + 3 + χ2 = 5 + 4 + 3 + 2 + 1 + χ0 =5+4+3+2+1+0 Answer to Exercise 3 a) ℓn (m) = 2n + 3m ℓ0 (m) = 2 · 0 + 3m = 3m ℓ1+n (m) = 2(1 + n) + 3m = 2 + 2n + 3m = 2 + ℓ(n, m) Hence, we set g(m) = 3m and hn (y, m) = 2 + y and claim ℓ = Lg, hM. claim: L3m, 2 + yMn (m) = 2n + 3m base: L3m, 2 + yM0 (m) = 3m = 2 · 0 + 3m 3 step: L3m, 2 + yM1+n (m) = 2 + L3m, 2 + yMn (m) = 2 + 2n + 3m (by IH) = 2(1 + n) + 3m b) ρn = ( n−1 0 if n ≥ 1 otherwise Since the predecessor function ρ is defined to map ρ0 = 0 and ρ1+n = n, we set g = 0 and hn (y) = n and claim ρ = Lg, hM = L0, nM claim: L0, nMn = ρn base: L0, nM0 = 0 step: L0, nM1+n = n · n= c) fn (m) = m − ( m−n 0 if m ≥ n otherwise Since f0 (m) = m and f1+n (m) = ( ρ(fn , m)) 0 if m > n if m ≤ n, we set g(m) = m and hn (y, m) = ( ρ(y) 0 to claim f = Lg, hM. claim: base: f = Lg, hM · 0 = m = g(m) Lg, hM0 (m) = m − 4 if m > n otherwise step:  Lg, hM1+n (m) = hn Lg, hMn (m), m  = ( ρ(Lg, hMn (m)) 0 = ( ρ(Lg, hMn (m)) 0 = ( ρ(m − n) if m ≥ n + 1 0 otherwise = ( m − (1 + n) if m ≥ n + 1 0 otherwise if m > n otherwise if m ≥ n + 1 otherwise · (1 + n) =m− d) |n − m| = ( m − n if m ≥ n n − m otherwise · n) + (n − · m). We can write it as |n − m| = (m − Alternatively, |0 − m| = m, we hence put g(m) = m and since |(1 + n) − m| = ( we define hn (y, m) = ρ|n − m| if m > n 1 + |n − m| otherwise ( ρ(y) 1+y to claim f = Lg, hM. claim: base: f = Lg, hM Lg, hM0 (m) = |0 − m| = m = g(m) 5 if m > n otherwise (IH) step:  Lg, hM1+n (m) = hn Lg, hMn (m), m  = ( ρ(Lg, hMn (m)) 1 + Lg, hMn (m) = ( ρ(Lg, hMn (m)) 1 + Lg, hMn (m) = ( ρ(|m − n|) if m ≥ n + 1 1 + |m − n| otherwise = ( |m − (1 + n)| if m ≥ n + 1 |m − (1 + n)| otherwise if m > n otherwise if m ≥ n + 1 otherwise = |m − (1 + n)| Answer to Exercise 4 a) ϑ(0) = ϑ(1 + n) = 0 X i=0 1+n X i3 = 0 i3 i=0 = (1 + n)3 + n X i3 i=0 3 = (1 + n) + ϑ(n) So, we set g = 0, and h(n, y) = (1 + n)3 + y and define ϑ = Lg, hM b) claim: ϑ(n) = n X i=0 ϑ(n) = 6  !2 i n(1 + n) 2 2 (IH) base: ϑ(0) =  n(1 + n) 2 2 =  0(1 + 0) 2 2 =0 step: ϑ(1 + n) = n+1 X i3 i=0 = (1 + n)3 + n X i3 i=0 n(1 + n) 2 = (1 + n) + 2 3 2 4(1 + n) + n (1 + n)2 = 4 (1 + n)2 (4(1 + n) + n2 ) = 4 (1 + n)2 (n + 2)2 = 4   (1 + n)(1 + (1 + n)) 2 = 2 3   Since the base case and the step case are true, the claim is proved. 7 ...
View Full Document

  • Fall '19
  • Dusko Pavlovic

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors