• Home
  • Textbooks
  • Programming from First Principles (Prentice-Hall International series in computer science)
  • PROOF BY INDUCTION

Programming from First Principles (Prentice-Hall International series in computer science)

Richard Bornat

Chapter 7

PROOF BY INDUCTION - all with Video Answers

Educators


Chapter Questions

Problem 1

Prove that the program times $m$ do $P$ od; times $n$ do $P$ od is equivalent to the program times $m+n$ do $P$ od whenever $m \geq 0$ and $n \geq 0$.

Check back soon!
02:38

Problem 2

Prove that times $n$ do $P$ od; times $n$ do $P$ od $=$ times $2 n$ do $P$ od.

Harshita Goel
Harshita Goel
Numerade Educator
02:01

Problem 3

Prove that times $m$ do times $n$ do $P$ od od $=$ times $m \times n$ do $P$ od whenever $m, n \geq 0$.

Colin O'Haire
Colin O'Haire
Numerade Educator
02:38

Problem 4

Prove that times $n \times n$ do $P$ od $=$ times $n$ do times $n$ do $P$ od od.

Harshita Goel
Harshita Goel
Numerade Educator
04:28

Problem 5

Write the improved proposition suggested above, and write out the steps in the improved proof that $A(k)$ prints a $k$-by- $k$ triangle pattern.

Sheryl Ezze
Sheryl Ezze
Numerade Educator
01:27

Problem 6

Prove that the instruction for $i$ rt $1 . . n$ do $N L$; times $i$ do print* od od prints an $n$-by- $n$ triangle pattern.

Linh Vu
Linh Vu
Numerade Educator

Problem 7

Prove that the instruction
for $i$ rbt $1 .$. n do $N L$; times $n-i$ do printspace od; times $i$ do print* od
od
prints an $n$-by- $n$ triangle pattern.

Check back soon!
02:09

Problem 8

Prove that the instruction
for irt 1..n do $N L$; times $n-i$ do printspace od; times $i$ do print* od
od
prints an $n$-by- $n$ triangle pattern.

Dilip Paruchuri
Dilip Paruchuri
Numerade Educator
01:01

Problem 9

Calculate the effect of $X(3), X(4), X(5), X(6)$ and $X(7)$.

Angela Guo
Angela Guo
Numerade Educator

Problem 10

Given the definition
$\operatorname{def} Y(n)=N L ;$ for i rt $1 . . n$ do $Y(i-1)$; print* od enddef prove that $Y(k)$, when $k \geq 1$, prints a $2^n$-line pattern in which alternate lines are blank.

Check back soon!
00:13

Problem 11

Figure 7.3 is abbreviated. It doesn't show the environments created by for-dos as boxes. It only shows a complete description of one execution of $X(0), X(1)$ and $X(2)$. Draw the complete diagram.

Ashley High
Ashley High
Numerade Educator
09:14

Problem 12

Draw the abbreviated environment diagram of $Z(5)$.

Anthony Ramos
Anthony Ramos
Numerade Educator