anchor.diff:                  let _ = match env.letrecs with | [] -> () | _ -> failwith "Impossible" in
                   let bs, envbody, g, _ = tc_binders env bs in
                   let envbody, _ = Env.clear_expected_typ envbody in
  -                Some t, bs, [], None, None, envbody, body, g
  +                Some t, bs, [], None, envbody, body, g
   
                 (* CK: add this case since the type may be f:(a -> M b wp){φ}, in which case I drop the refinement *)
                 (* NS: 07/21 dropping the refinement is not sound; we need to check that f validates phi. See Bug #284 *)
                 | Tm_refine (b, _) ->
  -                let _, bs, bs', copt, tacopt, env, body, g = as_function_typ norm b.sort in
  -                Some t, bs, bs', copt, tacopt, env, body, g
  +                let _, bs, bs', copt, env, body, g = as_function_typ norm b.sort in
  +                Some t, bs, bs', copt, env, body, g
   
                 | Tm_arrow(bs_expected, c_expected) ->
                   let bs_expected, c_expected = SS.open_comp bs_expected c_expected in
  
positive.code:           (match topt with | None -> "None" | Some t -> Print.term_to_string t)
            (if env.top_level then "true" else "false");
  
      let tfun_opt, bs, letrec_binders, c_opt, tacopt, envbody, body, g = expected_function_typ env topt body in
      let body, cbody, guard_body = tc_term ({envbody with top_level=false; use_eq=use_eq}) body in
  
      let guard_body =  //we don't abstract over subtyping constraints; so solve them now
          Rel.solve_deferred_constraints envbody guard_body in
  
      if Env.debug env <| Options.Other "Implicits"
      then BU.print2 "Introduced %s implicits in body of abstraction\nAfter solving constraints, cbody is %s\n"
          (string_of_int <| List.length guard_body.implicits)
          (Print.comp_to_string <| cbody.comp());
  
      let body, cbody, guard = check_expected_effect ({envbody with use_eq=use_eq}) c_opt (body, cbody.comp()) in
      let guard = Rel.conj_guard guard_body guard in
  //    let guard = match tacopt with
  //                | None -> guard
  //                | Some tac -> Rel.map_guard guard (Common.mk_by_tactic tac) in
      let guard = if env.top_level || not(Env.should_verify env)
                  then Rel.discharge_guard envbody (Rel.conj_guard g guard)
                  else let guard = Rel.close_guard env (bs@letrec_binders) (Rel.conj_guard g guard) in
  
negative.code:                 let envbody, bs, g, c = check_actuals_against_formals env bs bs_expected in
                  let envbody, letrecs = if Env.should_verify env then mk_letrec_env envbody bs c else envbody, [] in
                  let envbody = Env.set_expected_typ envbody (U.comp_result c) in
                  Some t, bs, letrecs, Some c, envbody, body, g
  
                | _ -> (* expected type is not a function;
                          try normalizing it first;
                          otherwise synthesize a type and check it against the given type *)
                  if not norm
                  then as_function_typ true (N.unfold_whnf env t)
                  else let _, bs, _, c_opt, envbody, body, g = expected_function_typ env None body in
                        Some t, bs, [], c_opt, envbody, body, g in
            as_function_typ false t
      in
  
  