Correction to Kogge (CMPUT 325 Textbook)

There are some errors and typoes in the textbook.
Some can be easily corrected but some may cause problems 
for students in understanding the material. We provide 
a list here, which will be updated from time to time.

(P.S. If you find new corrections, please let me know at 
      qizhao@cs.ualberta.ca)

-page 15:

P({0, 1, 2}) = { {}, {0}, {1}, {2}, {0,1}, {0,2}, {1,2}, {0,1,2}}

-page 24:

'(g) = g' = {(0, {(0,0),(1,3)}), (1, {(0,2),(1,1)})}

(0,0)   0       0       {(0,0),(1,3)}   0       3

-page 23 bottom
        wistful thinking => wishful thinking

-page 24 top 1/4
        There no constraints => There are no constraints

-page 40:

2.b.  ... is applied to the three arguments 2, 8 and 6.


-page 75: Figure 4.5(a)

The line ending with r) 6)) has an extra closing parenthesis.

-page 79 bottom
     "To show that it [eta conversion] is correct ..."
Comments: 
Adopting eta conversion amounts to extensionality:
if forall x. fx=gx then f=g. The justification of 
extensionality is far from obvious, because the same 
function can be computed in many ways. So one does not 
"prove" eta correct, one just adopts it.

-page 83 fig 4-14
  - An extra closing parenthesis in second line
  - a couple of typos in part b, which should start with

       -> (Lx|{Lw|[b/y](wyw)}) ...
       -> (Lx|{Lw|wbw}) ...

-page 84 bottom 2/3
 [A1/x1,...,Am/xm]E => Lx  ...x  [A1/x1,...,Am/xm]E
                         m+1   n
-page 86 bottom 2/3 (and many other places, eg 89 top 1/3, 91 
 bottom)
        s(x)=...  => s=...  
Comments: 
When talking formally about lambda calculus, one better does 
not use the "s(x)=..." convention of everyday mathematics.  
Formally, s(x)=sx (with a pair of redundant parens) 
and usually s cannot equal the same thing.

-page 87 top 1/3
    (Z_k (Lxyz|y(xyz)) 0) -> Z_k
  
-page 97 bottom 
  x + 3 = ... X ... => x + 3 = ... x ... 

-page 125 middle
   then sub2(vals, ids, body) => then eval(sub2(vals, ids, body))

-page 125 bottom
  else apply(f, a) => else apply(eval(f), a)

-page 154 middle
RAP ((f.(nil.e)) v.s) (nil.e) (RAP.c) d
    -> nil rplaca((nil.e),v) f (s e c.d)

-page 164 If expression:
      (if e1 e2 e3) is compiled to 
   e1' || (SEL) || (e2' || (JOIN)) || (e3' || (JOIN))

   In the middle,
   missing one closing parenthesis
     (LAMBDA (x y) (ADD x y)) 
   -> (LDF (LD (1.2) LD (1.1) ADD RTN))

   Letrec should be the same as Let except with a DUM in front 
   of NIL and AP being replaced by RAP.

-page 164 The example for letrec, the last two lines

    LDF (NIL LDL            ...       )
    RAP)
    
    -> 
    LDF (NIL LDC 0 CONS LDC (1 2 3) CONS LD (1.1) AP RTN)
    RAP)

-page 169-171
   The sample compilation. Throughout this example, "one" is
   a parameter, and any reference to it (e.g.,  in
   "if (eq n 0) then one ...") should be compiled to  
   LD (3.1) instead of (LDC 1).