let add_goal env pid pn wp =
    on_context env "add_goal" wp Keep_opened Clear_assigns
      (fun env _assigns p ->
         if F.is_false p then p else
           match predicate env pn with
             | Result g ->
                 F.p_and g p
             | Warning(source,reason) ->
                 Datalib.Collector.add_warning ~severe:true ~source ~reason
                   "Goal %a can not be translated"
                   WpAnnot.pp_id pid ;
                 F.p_false)