let goal_to_select config pid =
  let asked, take_it =
    match config.assigns_filter, 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 (proved pid) then false" (proved)"
        else true" (not proved)"
    | 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 *)

        (id_prop_txt idp),
      (Property.equal (property_of_id pid) idp, "")
    | NamedProp str ->
        str,
        if List.mem str (user_prop_names pid)
        then true" (asked named prop)" else false""
      end
    else asked, (take_it, "")
  in
    Wp_parameters.debug ~level:3 "[goal_to_select] %s vs %a -> %s%s@."
        asked pp_id pid (if take_it then "select" else "ignore") msg;
    take_it