From e9d9c0e5394de0fc831f392bb64908a5724e688d Mon Sep 17 00:00:00 2001 From: herbelin Date: Tue, 12 Dec 2006 10:34:05 +0000 Subject: Backtrack sur suppression des vars anonymes des contextes d'evars (echec Case15.v et CasesDep.v pas anormal) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@9437 85f007b7-540e-0410-9357-904b9bb8a0f7 --- test-suite/complexity/evars_subst.v | 54 +++++++++++-------------------------- 1 file changed, 15 insertions(+), 39 deletions(-) (limited to 'test-suite/complexity') diff --git a/test-suite/complexity/evars_subst.v b/test-suite/complexity/evars_subst.v index 58a09dd3f..d79d9f0e0 100644 --- a/test-suite/complexity/evars_subst.v +++ b/test-suite/complexity/evars_subst.v @@ -2,51 +2,26 @@ (* 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 *) + 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 could have been to remove the dependency in + anonymous variables in evars but this breaks intuitive behaviour + (see Case15.v); another approach could 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 @@ -54,6 +29,7 @@ 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 -- cgit v1.2.3