let on_context (pool,env) (where:string)
      (akind,omega) closing assigns
      (f : L.env -> assigns_kind -> F.pred -> F.pred) : t_prop
      =
    let hints = List.map L.as_hint omega.instances in
    let context = D.push where pool omega.bindings hints in
    L.push_instances where omega.instances ;
    try
      let wp = ref F.p_false in
      begin
        try
          let prop = 
            try f env akind omega.property
            with Failed -> F.p_false
          in
          let huge = 
            let m = Wp_parameters.Huge.get () in
            if m < 1 then 1 else if m > 29 then max_int else 1 lsl m
          in
          if F.huge_pred huge prop then
            (raise(Wp_error.Error("WP","Huge property"))) ;
          wp := prop ;
        with err ->
          let (source,reason) = Wp_error.protect err in
          Datalib.Collector.add_warning ~source ~reason ~severe:true
            "Abort goal generation" ;
      end ;
      (* f must be computed before, because of lazy bindings for assign goals *)
      let asgns =
        match assigns , akind with
          | Goal_assigns gref , _ -> !gref
          | Keep_assigns , a -> a
          | Clear_assigns , _ | _ , NoAssigns -> NoAssigns
          | Label_assigns l , EffectAssigns a when a.a_label = l ->
              let ze = WpModel.dzone_empty () in
              wp := D.subst a.a_effect ze (D.subst a.a_locals ze !wp) ;
              NoAssigns
          | Label_assigns l , RegionAssigns r when r.r_label = l ->
              let rec all_assigns p k = 
                if k = 0 then p else
                  let pk = region_assigns k in
                  all_assigns (F.p_and pk p) (pred k)
              in
              let p_goal = region_assigns 0 in
              let p_gdef = F.p_iff p_goal (all_assigns F.p_true r.r_effect) in
              wp := D.forall r.r_vars (F.p_implies p_gdef !wp) ;
              NoAssigns
          | Label_assigns _ , a -> a
      in
      asgns , close_property where context !wp closing 
    with err ->
      ignore (L.pop_instances where) ;
      D.kill where context ;
      raise err