2
(* Expected time < 1.00s *)
4
(* Let n be the number of let-in. The complexity comes from the fact
5
that each implicit arguments of f was in a larger and larger
6
context. To compute the type of "let _ := f ?Tn 0 in f ?T 0",
7
"f ?Tn 0" is substituted in the type of "f ?T 0" which is ?T. This
8
type is an evar instantiated on the n variables denoting the "f ?Ti 0".
9
One obtain "?T[1;...;n-1;f ?Tn[1;...;n-1] 0]". To compute the
10
type of "let _ := f ?Tn-1 0 in let _ := f ?Tn 0 in f ?T 0", another
11
substitution is done leading to
12
"?T[1;...;n-2;f ?Tn[1;...;n-2] 0;f ?Tn[1;...;n-2;f ?Tn[1;...;n-2] 0] 0]"
13
and so on. At the end, we get a term of exponential size *)
15
(* A way to cut the complexity could have been to remove the dependency in
16
anonymous variables in evars but this breaks intuitive behaviour
17
(see Case15.v); another approach could be to substitute lazily
18
and/or to simultaneously substitute let binders and evars *)
20
Variable P : Set -> Set.
21
Variable f : forall A : Set, A -> P A.