aboutsummaryrefslogtreecommitdiffhomepage
path: root/test-suite/complexity
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2006-12-12 09:40:37 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2006-12-12 09:40:37 +0000
commitac15ae397caeec618754fdb04d14f71fa954cfd4 (patch)
tree00c86014ea4359371664063f400f59316797f888 /test-suite/complexity
parent5458617d1b3c6b0a5ff846ef977d3bdaeda9fb4f (diff)
Test bug #932
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@9434 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'test-suite/complexity')
-rw-r--r--test-suite/complexity/evars_subst.v77
1 files changed, 77 insertions, 0 deletions
diff --git a/test-suite/complexity/evars_subst.v b/test-suite/complexity/evars_subst.v
new file mode 100644
index 000000000..58a09dd3f
--- /dev/null
+++ b/test-suite/complexity/evars_subst.v
@@ -0,0 +1,77 @@
+(* Bug report #932 *)
+(* Expected time < 1.00s *)
+
+(* Let n be the number of let-in. The complexity comes from the fact
+that each implicit arguments of f was in a larger and larger
+context. To compute the type of "let _ := f ?Tn 0 in f ?T 0", "f ?Tn
+0" is substituted in the type of "f ?T 0" which is ?T. This type is an
+evar instantiated on the n variables denoting the "f ?Ti 0". One
+obtain "?T[1;...;n-1;f ?Tn[1;...;n-1] 0]". To compute the type of "let
+_ := f ?Tn-1 0 in let _ := f ?Tn 0 in f ?T 0", another substitution is
+done leading to ?T[1;...;n-2;f ?Tn[1;...;n-2] 0;f ?Tn[1;...;n-2;f
+?Tn[1;...;n-2] 0] 0]" and so on. At the end, we get a term of
+exponential size *)
+
+(* A way to cut the complexity is to remove the dependency in
+ anonymous variables in evars; another approach would be to
+ substitute lazily and/or to simultaneously substitute let binders
+ and evars *)
+
+Variable P : Set -> Set.
+Variable f : forall A : Set, A -> P A.
+
+Check
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+ let _ := f _ 0 in
+
+ f _ 0.
+