aboutsummaryrefslogtreecommitdiff
path: root/kernel/cClosure.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2018-10-01 16:10:37 +0200
committerPierre-Marie Pédrot2018-11-20 16:11:27 +0100
commitc4ec9bd2c8a31f5eddea87bbc3f1605ca731d598 (patch)
tree200510ce0fc2b4b3bb5dc34c4f736c76c7433946 /kernel/cClosure.ml
parent2d81a99e14d32f9f79ae617986148db3a36707e7 (diff)
Use a closure for the domain argument of FProd.
The use of a term is not needed for the fast typing algorithm of the application case, so this tweak brings the best of both worlds.
Diffstat (limited to 'kernel/cClosure.ml')
-rw-r--r--kernel/cClosure.ml10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/cClosure.ml b/kernel/cClosure.ml
index 0679fc30d7..1f61bcae2e 100644
--- a/kernel/cClosure.ml
+++ b/kernel/cClosure.ml
@@ -300,7 +300,7 @@ and fterm =
| FCoFix of cofixpoint * fconstr subs
| FCaseT of case_info * constr * fconstr * constr array * fconstr subs (* predicate and branches are closures *)
| FLambda of int * (Name.t * constr) list * constr * fconstr subs
- | FProd of Name.t * constr * constr * fconstr subs
+ | FProd of Name.t * fconstr * constr * fconstr subs
| FLetIn of Name.t * fconstr * fconstr * constr * fconstr subs
| FEvar of existential * fconstr subs
| FLIFT of int * fconstr
@@ -586,10 +586,10 @@ let rec to_constr lfts v =
Term.compose_lam (List.rev tys) f
| FProd (n, t, c, e) ->
if is_subs_id e && is_lift_id lfts then
- mkProd (n, t, c)
+ mkProd (n, to_constr lfts t, c)
else
let subs' = comp_subs lfts e in
- mkProd (n, subst_constr subs' t, subst_constr (subs_lift subs') c)
+ mkProd (n, to_constr lfts t, subst_constr (subs_lift subs') c)
| FLetIn (n,b,t,f,e) ->
let subs = comp_subs (el_lift lfts) (subs_lift e) in
mkLetIn (n, to_constr lfts b,
@@ -872,7 +872,7 @@ and knht info e t stk =
| CoFix cfx -> { norm = Cstr; term = FCoFix (cfx,e) }, stk
| Lambda _ -> { norm = Cstr; term = mk_lambda e t }, stk
| Prod (n, t, c) ->
- { norm = Whnf; term = FProd (n, t, c, e) }, stk
+ { norm = Whnf; term = FProd (n, mk_clos e t, c, e) }, stk
| LetIn (n,b,t,c) ->
{ norm = Red; term = FLetIn (n, mk_clos e b, mk_clos e t, c, e) }, stk
| Evar ev -> { norm = Red; term = FEvar (ev, e) }, stk
@@ -996,7 +996,7 @@ and norm_head info tab m =
let c = mk_clos (subs_lift e) f in
mkLetIn(na, kl info tab a, kl info tab b, kl info tab c)
| FProd(na,dom,rng,e) ->
- mkProd(na, kl info tab (mk_clos e dom), kl info tab (mk_clos (subs_lift e) rng))
+ mkProd(na, kl info tab dom, kl info tab (mk_clos (subs_lift e) rng))
| FCoFix((n,(na,tys,bds)),e) ->
let ftys = Array.Fun1.map mk_clos e tys in
let fbds =