Chapter Questions
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$.
Prove that times $n$ do $P$ od; times $n$ do $P$ od $=$ times $2 n$ do $P$ od.
Prove that times $m$ do times $n$ do $P$ od od $=$ times $m \times n$ do $P$ od whenever $m, n \geq 0$.
Prove that times $n \times n$ do $P$ od $=$ times $n$ do times $n$ do $P$ od od.
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.
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.
Prove that the instructionfor $i$ rbt $1 .$. n do $N L$; times $n-i$ do printspace od; times $i$ do print* ododprints an $n$-by- $n$ triangle pattern.
Prove that the instructionfor irt 1..n do $N L$; times $n-i$ do printspace od; times $i$ do print* ododprints an $n$-by- $n$ triangle pattern.
Calculate the effect of $X(3), X(4), X(5), X(6)$ and $X(7)$.
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.
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.
Draw the abbreviated environment diagram of $Z(5)$.