anchor.diff:        //failwith "Not yet implemented"
         
   (* [readback] creates named binders and not De Bruijn *)
  -and readback (x:t) : term =
  +and readback (env:Env.env) (x:t) : term =
       match x with
       | Unit -> S.unit_const
       | Bool true -> U.exp_true_bool
       | Bool false -> U.exp_false_bool
       | Lam f ->
         let x = S.new_bv None S.tun in
  -      let body = readback (f (mkAccuVar x)) in
  +      let body = readback env (f (mkAccuVar x)) in
         U.abs [S.mk_binder x] body None
       | Construct (fv, args) -> 
  -      let args = List.map (fun x -> as_arg (readback x)) args in
  +      let args = List.map (fun x -> as_arg (readback env x)) args in
         (match args with 
          | [] -> (S.mk (Tm_fvar fv) None Range.dummyRange)
          | _ -> U.mk_app (S.mk (Tm_fvar fv) None Range.dummyRange) args)
       | Accu (Var bv, []) ->
         S.bv_to_name bv
       | Accu (Var bv, ts) ->
  -      let args = map_rev (fun x -> as_arg (readback x)) ts in
  +      let args = map_rev (fun x -> as_arg (readback env x)) ts in
         U.mk_app (S.bv_to_name bv) args
       | Accu (Type u, []) ->
         S.mk (Tm_type u) None Range.dummyRange
       | Accu (Type u, ts) ->
  -      let args = map_rev (fun x -> as_arg (readback x)) ts in
  +      let args = map_rev (fun x -> as_arg (readback env x)) ts in
         U.mk_app (S.mk (Tm_type u) None Range.dummyRange) args
       | Accu (Match (scrut, cases), ts) ->
  -      let args = map_rev (fun x -> as_arg (readback x)) ts in
  -      let head =  readback (cases scrut) in
  +      let args = map_rev (fun x -> as_arg (readback env x)) ts in
  +      let head =  readback env (cases scrut) in
         (match ts with 
          | [] -> head
          | _ -> U.mk_app head args)
  
positive.code:     | Tm_abs (x::xs, body, _) ->
        let rest = S.mk (Tm_abs(xs, body, None)) None Range.dummyRange in
        let tm = S.mk (Tm_abs([x], rest, None)) None e.pos in
        translate bs tm
  
      | Tm_app (e, [arg]) ->
        app (translate bs e) (translate bs (fst arg))
  
      | Tm_app(head, arg::args) ->
        let first = S.mk (Tm_app(head, [arg])) None Range.dummyRange in
        let tm = S.mk (Tm_app(first, args)) None e.pos in
        translate bs tm
      
      | Tm_match(scrut, branches) ->
        let rec case (scrut : t) : t = 
  
negative.code:   | [] -> cnt <= 0 
    | t :: ts -> (not (isAccu t)) && test_args ts (cnt - 1)
  
  (* Count the number of abstractions in the body of a let rec. 
     It accounts for abstractions instantiated inside the body.
     This analysis needs further refinement, for example see the let in case. 
  *)
  