aboutsummaryrefslogtreecommitdiff
path: root/tactics/refine.ml
diff options
context:
space:
mode:
authorherbelin2010-07-21 16:12:40 +0000
committerherbelin2010-07-21 16:12:40 +0000
commitb93b983a29b542d6fc0cbce6686beea57cdddfd2 (patch)
tree85d363666e8ddb7733f0c599019bbc287b78673d /tactics/refine.ml
parente506e9fb9164ffaeace23f6280953dd55762e75f (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
Diffstat (limited to 'tactics/refine.ml')
-rw-r--r--tactics/refine.ml14
1 files changed, 13 insertions, 1 deletions
diff --git a/tactics/refine.ml b/tactics/refine.ml
index 484954bcc7..db89ec6e2e 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)