From d6175b9980808ff91f1299ca26a9a49a117169ca Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Thu, 6 Apr 2017 17:34:23 +0200 Subject: Fix a normalization hotspot in computation of constr keys. Getting a key only needs to observe the root of a term. This hotspot was observed in HoTT. --- library/keys.ml | 4 ++-- library/keys.mli | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'library') diff --git a/library/keys.ml b/library/keys.ml index 057dc3b65..c9e325ee5 100644 --- a/library/keys.ml +++ b/library/keys.ml @@ -114,11 +114,11 @@ let inKeys : key_obj -> obj = let declare_equiv_keys ref ref' = Lib.add_anonymous_leaf (inKeys (ref,ref')) -let constr_key c = +let constr_key kind c = let open Globnames in try let rec aux k = - match kind_of_term k with + match kind k with | Const (c, _) -> KGlob (ConstRef c) | Ind (i, u) -> KGlob (IndRef i) | Construct (c,u) -> KGlob (ConstructRef c) diff --git a/library/keys.mli b/library/keys.mli index 69668590d..6abac4de4 100644 --- a/library/keys.mli +++ b/library/keys.mli @@ -16,7 +16,7 @@ val declare_equiv_keys : key -> key -> unit val equiv_keys : key -> key -> bool (** Check equivalence of keys. *) -val constr_key : Term.constr -> key option +val constr_key : ('a -> ('a, 't, 'u, 'i) Constr.kind_of_term) -> 'a -> key option (** Compute the head key of a term. *) val pr_keys : (global_reference -> Pp.std_ppcmds) -> Pp.std_ppcmds -- cgit v1.2.3