anchor.diff:      match lemma_or_sq comp with
       | None -> fail "not a lemma or squashed function"
       | Some (pre, post) ->
  -    let uvs, implicits, subst =
  -       List.fold_left (fun (uvs, guard, subst) (b, aq) ->
  +    bind (
  +       fold_left (fun (b, aq) (uvs, imps, subst) ->
                  let b_t = SS.subst subst b.sort in
                  if is_unit_t b_t
                  then
                      // Simplification: if the argument is simply unit, then don't ask for it
  -                   (U.exp_unit, aq)::uvs, guard, S.NT(b, U.exp_unit)::subst
  +                   ret <| ((U.exp_unit, aq)::uvs, imps, S.NT(b, U.exp_unit)::subst)
                  else
  -                   let u, _, g_u = TcUtil.new_implicit_var "apply_lemma" (goal_type goal).pos (goal_env goal) b_t in
  -                   (u, aq)::uvs,
  -                   Env.conj_guard guard g_u,
  -                   S.NT(b, u)::subst
  +                   bind (new_uvar "apply_lemma" (goal_env goal) b_t) (fun (t, u) ->
  +                   ret <| ((t, aq)::uvs, (t, u)::imps, S.NT(b, t)::subst))
                  )
  -       ([], guard, [])
  -       bs
  -    in
  +       ([], [], [])
  +       bs)
  +    (fun (uvs, implicits, subst) ->
  +    let implicits = List.rev implicits in
       let uvs = List.rev uvs in
       let pre  = SS.subst subst pre in
       let post = SS.subst subst post in
  
positive.code:         bind (if not (istrivial (goal_env goal) (U.mk_squash U_zero pre)) //lemma preconditions are in U_zero
                then add_irrelevant_goal "apply_lemma precondition" (goal_env goal) pre goal.opts goal.label
                else ret ()) (fun _ ->
          add_goals sub_goals)))))
      ))))))
  
  let destruct_eq' (typ : typ) : option<(term * term)> =
      match U.destruct_typ_as_formula typ with
  
negative.code:                             (tts (goal_env goal) (U.mk_squash U_zero post))
                              (tts (goal_env goal) (goal_type goal))
      else
          // We solve with (), we don't care about the witness if applying a lemma
          bind (solve' goal U.exp_unit) (fun _ ->
          let is_free_uvar uv t =
  