diff options
| author | Maxime Dénès | 2018-02-07 15:55:11 +0100 |
|---|---|---|
| committer | Maxime Dénès | 2018-02-07 15:55:11 +0100 |
| commit | 54c9c89bd8aac03f002549aad771337442e0279b (patch) | |
| tree | 3b33ff0b9671f25c16d2bf844a57667e5685d386 /kernel/cClosure.ml | |
| parent | b4e0aa73bd36ca32fc112ca7c660c474f0b2564a (diff) | |
| parent | 783c7d09492f64d3a00673f8d698da3bcef6c503 (diff) | |
Merge PR #6686: Kernel/checker reduction cleanups around projection unfolding
Diffstat (limited to 'kernel/cClosure.ml')
| -rw-r--r-- | kernel/cClosure.ml | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/kernel/cClosure.ml b/kernel/cClosure.ml index b1181157e1..7ed965b4ca 100644 --- a/kernel/cClosure.ml +++ b/kernel/cClosure.ml @@ -847,6 +847,14 @@ let contract_fix_vect fix = in (subs_cons(Array.init nfix make_body, env), thisbody) +let unfold_projection info p = + if red_projection info.i_flags p + then + let open Declarations in + let pb = lookup_projection p (info_env info) in + Some (Zproj (pb.proj_npars, pb.proj_arg, Projection.constant p)) + else None + (*********************************************************************) (* A machine that inspects the head of a term until it finds an atom or a subterm that may produce a redex (abstraction, @@ -865,15 +873,9 @@ let rec knh info m stk = | (None, stk') -> (m,stk')) | FCast(t,_,_) -> knh info t stk | FProj (p,c) -> - let unf = Projection.unfolded p in - if unf || red_set info.i_flags (fCONST (Projection.constant p)) then - (match try Some (lookup_projection p (info_env info)) with Not_found -> None with - | None -> (m, stk) - | Some pb -> - knh info c (Zproj (pb.Declarations.proj_npars, pb.Declarations.proj_arg, - Projection.constant p) - :: zupdate m stk)) - else (m,stk) + (match unfold_projection info p with + | None -> (m, stk) + | Some s -> knh info c (s :: zupdate m stk)) (* cases where knh stops *) | (FFlex _|FLetIn _|FConstruct _|FEvar _| |
