diff options
Diffstat (limited to 'pretyping')
| -rw-r--r-- | pretyping/termops.ml | 6 | ||||
| -rw-r--r-- | pretyping/termops.mli | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/pretyping/termops.ml b/pretyping/termops.ml index fec2a92549..7f77bcdba7 100644 --- a/pretyping/termops.ml +++ b/pretyping/termops.ml @@ -313,6 +313,12 @@ let occur_var_in_decl env hyp (_,c,typ) = occur_var env hyp (body_of_type typ) || occur_var env hyp body +(* Tests that t is a subterm of c *) +let occur_term t c = + let eq_constr_fail c = if eq_constr t c then raise Occur + in let rec occur_rec c = eq_constr_fail c; iter_constr occur_rec c + in try occur_rec c; false with Occur -> true + (* returns the list of free debruijn indices in a term *) let free_rels m = diff --git a/pretyping/termops.mli b/pretyping/termops.mli index c45b1b016c..ebcd93a348 100644 --- a/pretyping/termops.mli +++ b/pretyping/termops.mli @@ -67,6 +67,7 @@ val occur_var : env -> identifier -> types -> bool val occur_var_in_decl : env -> identifier -> 'a * types option * types -> bool +val occur_term : constr -> constr -> bool val free_rels : constr -> Intset.t (* Substitution of metavariables *) |
