anchor.diff:  let close_lcomp env bvs (lc:lcomp) =
       S.mk_lcomp lc.eff_name lc.res_typ lc.cflags
                  (fun () -> close_comp env bvs (lcomp_comp lc))
  +
  +let close_comp_if_refinement_t (env:env) (t:term) (x:bv) (c:comp) :comp =
  +  let t = N.normalize_refinement N.whnf_steps env t in
  +  match t.n with
  +  | Tm_refine ({ sort = { n = Tm_fvar fv } }, _) when S.fv_eq_lid fv C.unit_lid -> close_comp env [x] c
  +  | _ -> c
   
   let should_not_inline_lc (lc:lcomp) =
       lc.cflags |> BU.for_some (function SHOULD_NOT_INLINE -> true | _ -> false)
  
positive.code:             then Inl (c2, "both ml")
              else Inr "c1 not trivial, and both are not ML"
            in
            let subst_c2 e1opt reason =
              match e1opt, b with
              | Some e, Some x ->
                  Inl (SS.subst_comp [NT(x,e)] c2, reason)
              | _ -> aux()
            in
            let try_simplify () =
              let maybe_close t x c =
                let t = N.normalize_refinement N.whnf_steps env t in
                match t.n with
                | Tm_refine ({ sort = { n = Tm_fvar fv } }, _) when S.fv_eq_lid fv C.unit_lid -> close_comp env [x] c
                | _ -> c
              in
              if Option.isNone (Env.try_lookup_effect_lid env C.effect_GTot_lid) //if we're very early in prims
              then if U.is_tot_or_gtot_comp c1
                   && U.is_tot_or_gtot_comp c2
  
negative.code:                                    "Non-trivial pre-conditions very early in prims, even before we have defined the PURE monad")
                                     (Env.get_range env)
              else if U.is_total_comp c1
              then (*
                    * Helper routine to close the compuation c with c1's return type
                    * When c1's return type is of the form _:t{phi}, is is useful to know
                    *   that t{phi} is inhabited, even if c1 is inlined etc.
                    *)
                   let close (x:bv) (reason:string) (c:comp) =
                     let x = { x with sort = U.comp_result c1 } in
                     Inl (close_comp_if_refinement_t env x.sort x c, reason)
                   in
                   match e1opt, b with
                   | Some e, Some x ->
                     c2 |> SS.subst_comp [NT (x, e)] |> close x "c1 Tot"
                   | _, Some x -> c2 |> close x "c1 Tot only close"
                   | _, _ -> aux ()
              else if U.is_tot_or_gtot_comp c1
                   && U.is_tot_or_gtot_comp c2
              then Inl (S.mk_GTotal (U.comp_result c2), "both GTot")
              else aux ()
            in
            match try_simplify () with
            | Inl (c, reason) ->
  