diff options
| author | Maxime Dénès | 2020-09-02 21:49:42 +0200 |
|---|---|---|
| committer | Maxime Dénès | 2020-09-02 22:26:14 +0200 |
| commit | 4e0f9f5638df5ea6061ee82e1c8314054f72c903 (patch) | |
| tree | 5b1547bf7a4acf50c7b7975796822f9d3e6f9914 | |
| parent | cd37a10f9cf5746edf16611d7f833e0e8cf2c5f8 (diff) | |
More efficient data structure for allowed evars
| -rw-r--r-- | pretyping/evarsolve.ml | 17 | ||||
| -rw-r--r-- | pretyping/unification.ml | 2 |
2 files changed, 8 insertions, 11 deletions
diff --git a/pretyping/evarsolve.ml b/pretyping/evarsolve.ml index 09e49f3253..4d5715a391 100644 --- a/pretyping/evarsolve.ml +++ b/pretyping/evarsolve.ml @@ -29,27 +29,24 @@ module AllowedEvars = struct type t = | AllowAll - | AllowFun of (Evar.t -> bool) + | AllowFun of (Evar.t -> bool) * Evar.Set.t let mem allowed evk = match allowed with | AllowAll -> true - | AllowFun f -> f evk + | AllowFun (f,except) -> f evk && not (Evar.Set.mem evk except) - let remove evk allowed = - let allowed = match allowed with - | AllowAll -> fun evk' -> not (Evar.equal evk evk') - | AllowFun f -> fun evk' -> not (Evar.equal evk evk') && f evk' - in - AllowFun allowed + let remove evk = function + | AllowAll -> AllowFun ((fun _ -> true), Evar.Set.singleton evk) + | AllowFun (f,except) -> AllowFun (f, Evar.Set.add evk except) let all = AllowAll let except evars = - AllowFun (fun evk -> not (Evar.Set.mem evk evars)) + AllowFun ((fun _ -> true), evars) let from_pred f = - AllowFun f + AllowFun (f, Evar.Set.empty) end diff --git a/pretyping/unification.ml b/pretyping/unification.ml index 746a237b24..207a03d80f 100644 --- a/pretyping/unification.ml +++ b/pretyping/unification.ml @@ -417,7 +417,7 @@ let default_no_delta_unify_flags ts = let allow_new_evars sigma = let undefined = Evd.undefined_map sigma in - AllowedEvars.except @@ Evar.Map.domain undefined + AllowedEvars.from_pred (fun evk -> not (Evar.Map.mem evk undefined)) (* Default flags for looking for subterms in elimination tactics *) (* Not used in practice at the current date, to the exception of *) |
