diff options
author | 2010-07-21 16:12:40 +0000 | |
---|---|---|
committer | 2010-07-21 16:12:40 +0000 | |
commit | b93b983a29b542d6fc0cbce6686beea57cdddfd2 (patch) | |
tree | 85d363666e8ddb7733f0c599019bbc287b78673d | |
parent | e506e9fb9164ffaeace23f6280953dd55762e75f (diff) |
Quick fix for bug #2350 (ensuring enough "red" when refine calls fix tactic).
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13301 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r-- | tactics/refine.ml | 14 | ||||
-rw-r--r-- | test-suite/bugs/closed/shouldsucceed/2350.v | 6 |
2 files changed, 19 insertions, 1 deletions
diff --git a/tactics/refine.ml b/tactics/refine.ml index 484954bcc..db89ec6e2 100644 --- a/tactics/refine.ml +++ b/tactics/refine.ml @@ -261,6 +261,16 @@ let rec compute_metamap env sigma c = match kind_of_term c with * Réalise le 3. ci-dessus *) +let ensure_products n = + let p = ref 0 in + let rec aux n = + if n = 0 then tclFAIL 0 (mt()) + else tclORELSE intro (fun gl -> incr p; tclTHEN introf (aux (n-1)) gl) in + tclORELSE + (aux n) + (* Now we know how many red are needed *) + (fun gl -> tclDO !p red_in_concl gl) + let rec tcc_aux subst (TH (c,mm,sgp) as _th) gl = let c = substl subst c in match (kind_of_term c,sgp) with @@ -339,7 +349,9 @@ let rec tcc_aux subst (TH (c,mm,sgp) as _th) gl = let fixes = array_map3 (fun f n c -> (out_name f,succ n,c)) fi ni ai in let firsts,lasts = list_chop j (Array.to_list fixes) in tclTHENS - (mutual_fix (out_name fi.(j)) (succ ni.(j)) (firsts@List.tl lasts) j) + (tclTHEN + (ensure_products (succ ni.(j))) + (mutual_fix (out_name fi.(j)) (succ ni.(j)) (firsts@List.tl lasts) j)) (List.map (function | None -> tclIDTAC | Some th -> tcc_aux subst th) sgp) diff --git a/test-suite/bugs/closed/shouldsucceed/2350.v b/test-suite/bugs/closed/shouldsucceed/2350.v new file mode 100644 index 000000000..e91f22e26 --- /dev/null +++ b/test-suite/bugs/closed/shouldsucceed/2350.v @@ -0,0 +1,6 @@ +(* Check that the fix tactic, when called from refine, reduces enough + to see the products *) + +Definition foo := forall n:nat, n=n. +Definition bar : foo. +refine (fix aux (n:nat) := _). |