let subst_result env vopt p =
    if env.frame.result = None then p
    else
      let x = result env.frame in
      match vopt with
        | None -> L.forall [x] p
        | Some v -> L.subst x (M.logic_of_value v) p