let subst_result env v_exp p = 
    match env.result with
      | None -> p
      | Some xres -> 
          match v_exp with 
            | Some v_exp -> D.subst xres (logic_of_value v_exp) p
            | None -> D.forall [xres] p