aboutsummaryrefslogtreecommitdiff
path: root/engine/evarutil.ml
diff options
context:
space:
mode:
authorMatthieu Sozeau2016-10-21 18:16:16 +0200
committerMatthieu Sozeau2016-10-21 18:16:16 +0200
commit517cc63a18d95c02c2d2490adb110ff712d30375 (patch)
tree22c6e527663803ceec47afc625bb1a2e5b75adad /engine/evarutil.ml
parentcef86ed6f78e2efa703bd8772a43fbeba597bbe3 (diff)
parent5609da1e08f950fab85b87b257ed343b491f1ef5 (diff)
Merge remote-tracking branch 'gforge/v8.5' into v8.6
Diffstat (limited to 'engine/evarutil.ml')
-rw-r--r--engine/evarutil.ml22
1 files changed, 22 insertions, 0 deletions
diff --git a/engine/evarutil.ml b/engine/evarutil.ml
index e45e7dc496..df170c8ddc 100644
--- a/engine/evarutil.ml
+++ b/engine/evarutil.ml
@@ -678,6 +678,28 @@ let gather_dependent_evars evm l =
(* /spiwack *)
+(** [advance sigma g] returns [Some g'] if [g'] is undefined and is
+ the current avatar of [g] (for instance [g] was changed by [clear]
+ into [g']). It returns [None] if [g] has been (partially)
+ solved. *)
+(* spiwack: [advance] is probably performance critical, and the good
+ behaviour of its definition may depend sensitively to the actual
+ definition of [Evd.find]. Currently, [Evd.find] starts looking for
+ a value in the heap of undefined variable, which is small. Hence in
+ the most common case, where [advance] is applied to an unsolved
+ goal ([advance] is used to figure if a side effect has modified the
+ goal) it terminates quickly. *)
+let rec advance sigma evk =
+ let evi = Evd.find sigma evk in
+ match evi.evar_body with
+ | Evar_empty -> Some evk
+ | Evar_defined v ->
+ if Option.default false (Store.get evi.evar_extra cleared) then
+ let (evk,_) = Term.destEvar v in
+ advance sigma evk
+ else
+ None
+
(** The following functions return the set of undefined evars
contained in the object, the defined evars being traversed.
This is roughly a combination of the previous functions and