diff options
| author | Pierre-Marie Pédrot | 2014-02-04 19:38:19 +0100 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2014-02-04 19:38:19 +0100 |
| commit | 550378a5897b334ed3b9e64715e94de3893406dc (patch) | |
| tree | 44ab1773008749d53923b97810048b631a0c6651 | |
| parent | ec4ce9efc02d0f908a7f54ca47520703673e74c4 (diff) | |
The constructor tactic now returns several successes.
| -rw-r--r-- | tactics/tactics.ml | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tactics/tactics.ml b/tactics/tactics.ml index be6461de1a..b4fb6b9002 100644 --- a/tactics/tactics.ml +++ b/tactics/tactics.ml @@ -1342,8 +1342,14 @@ let one_constructor i lbind = constructor_tac false None i lbind Should be generalize in Constructor (Fun c : I -> tactic) *) +let rec tclANY tac = function +| [] -> Proofview.tclZERO (Errors.UserError ("", str "No applicable tactic.")) +| arg :: l -> + Proofview.tclOR (tac arg) (fun _ -> tclANY tac l) + let any_constructor with_evars tacopt = let t = match tacopt with None -> Proofview.tclUNIT () | Some t -> t in + let tac i = Tacticals.New.tclTHEN (constructor_tac with_evars None i NoBindings) t in Proofview.Goal.enter begin fun gl -> let cl = Proofview.Goal.concl gl in let reduce_to_quantified_ind = @@ -1354,10 +1360,7 @@ let any_constructor with_evars tacopt = let nconstr = Array.length (snd (Global.lookup_inductive mind)).mind_consnames in if Int.equal nconstr 0 then error "The type has no constructors."; - Tacticals.New.tclFIRST - (List.map - (fun i -> Tacticals.New.tclTHEN (constructor_tac with_evars None i NoBindings) t) - (List.interval 1 nconstr)) + tclANY tac (List.interval 1 nconstr) with e when Proofview.V82.catchable_exception e -> Proofview.tclZERO e end |
