let goal_to_select config pid =
  let asked, take_it =
    match config.assigns_filter, WpPropId.property_of_id pid with
      | NoAssignsProperty.IPAssigns _ ->
          "no assigns"false
      | (OnlyAssigns | WithAssigns), Property.IPAssigns _ ->
          ""true
      | OnlyAssigns, _ -> "only assigns"false
      | (NoAssigns | WithAssigns), _ -> ""true
  in
  let asked, (take_it, msg) =
    if take_it then begin
      match config.asked_prop with
      | AllProps ->
        "all",
        if not (filter_status pid)
        then false" (skipped w.r.t status)"
        else true" (selected)"
      | OnlyPreconds ->
        "main precondition",
        if not (filter_status pid) || not (filter_precond pid)
        then false" (main precondition only)"
        else true" (selected)"
      | IdProp idp ->
        (* Notice that if the user has explicitly selected a property,
         * we consider it as a goal even if it has been proved already *)

        (WpPropId.id_prop_txt idp),
        (Property.equal (WpPropId.property_of_id pid) idp, "")
      | CallPre (s_call, asked_pre) ->
        let take_it, msg = WpPropId.select_call_pre s_call asked_pre pid in 
        let pre_txt = match asked_pre with None -> "all pre "
          | Some pre -> WpPropId.id_prop_txt pre
        in
        pre_txt ^ " at stmt " ^ (string_of_int s_call.sid),
        (take_it, msg)
    | NamedProp str -> str, WpPropId.select_by_name str pid
    end
    else asked, (take_it, "")
  in
    debug "[goal_to_select] %s vs %a -> %s%s@."
        asked WpPropId.pp_id_name pid (if take_it then "select" else "ignore") msg;
    take_it