aboutsummaryrefslogtreecommitdiff
path: root/tactics
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2014-09-04 19:08:45 +0200
committerPierre-Marie Pédrot2014-09-04 19:09:35 +0200
commit7057e7e9ab1160fc0e176182b6e71f720784715a (patch)
tree0e5a06b63243b3cbcbbaf6129095484181002094 /tactics
parent6828b31acdf10cf7987f0e494f6f7505a15b1000 (diff)
Revert the two previous commits. I was testing in the wrong branch.
Diffstat (limited to 'tactics')
-rw-r--r--tactics/tacinterp.ml5
-rw-r--r--tactics/tactics.ml63
-rw-r--r--tactics/tactics.mli2
3 files changed, 6 insertions, 64 deletions
diff --git a/tactics/tacinterp.ml b/tactics/tacinterp.ml
index 12a8c4ae96..16e7851802 100644
--- a/tactics/tacinterp.ml
+++ b/tactics/tacinterp.ml
@@ -1928,9 +1928,8 @@ and interp_atomic ist tac : unit Proofview.tactic =
if b then Tactics.keep l gl else Tactics.clear l gl
end
| TacClearBody l ->
- Proofview.Goal.raw_enter begin fun gl ->
- let hyps = interp_hyp_list ist (Tacmach.New.pf_env gl) l in
- Tactics.clear_body hyps
+ Proofview.V82.tactic begin fun gl ->
+ Tactics.clear_body (interp_hyp_list ist (pf_env gl) l) gl
end
| TacMove (dep,id1,id2) ->
Proofview.V82.tactic begin fun gl ->
diff --git a/tactics/tactics.ml b/tactics/tactics.ml
index 353d35f6a2..932bfc5fe7 100644
--- a/tactics/tactics.ml
+++ b/tactics/tactics.ml
@@ -138,6 +138,7 @@ let introduction = Tacmach.introduction
let refine = Tacmach.refine
let convert_concl = Tacmach.convert_concl
let convert_hyp = Tacmach.convert_hyp
+let thin_body = Tacmach.thin_body
let convert_gen pb x y =
Proofview.Goal.raw_enter begin fun gl ->
@@ -1466,65 +1467,7 @@ let assumption =
let clear ids = (* avant seul dyn_clear n'echouait pas en [] *)
if List.is_empty ids then tclIDTAC else thin ids
-let on_the_bodies = function
-| [] -> assert false
-| [id] -> str " depends on the body of " ++ pr_id id
-| l -> str " depends on the bodies of " ++ pr_sequence pr_id l
-
-let check_is_type env ty msg =
- Proofview.tclEVARMAP >>= fun sigma ->
- let evdref = ref sigma in
- try
- let _ = Typing.sort_of env evdref ty in
- Proofview.V82.tclEVARS !evdref
- with e when Errors.noncritical e ->
- msg e
-
-let clear_body ids =
- Proofview.Goal.raw_enter begin fun gl ->
- let env = Proofview.Goal.env gl in
- let concl = Proofview.Goal.concl (Proofview.Goal.assume gl) in
- let ctx = named_context env in
- let map (id, body, t as decl) = match body with
- | None ->
- let () = if List.mem_f Id.equal id ids then
- errorlabstrm "" (str "Hypothesis " ++ pr_id id ++ str " is not a local definition")
- in
- decl
- | Some _ ->
- if List.mem_f Id.equal id ids then (id, None, t) else decl
- in
- let ctx = List.map map ctx in
- let filter = function
- | (id, None, _) -> Some (mkVar id)
- | _ -> None
- in
- let base_env = reset_context env in
- let env = push_named_context ctx base_env in
- let check_hyps =
- let check env (id, _, t as decl) =
- let msg _ = Tacticals.New.tclZEROMSG
- (str "Hypothesis " ++ pr_id id ++ on_the_bodies ids)
- in
- check_is_type env t msg <*> Proofview.tclUNIT (push_named decl env)
- in
- let checks = Proofview.Monad.List.fold_left check base_env (List.rev ctx) in
- Proofview.tclIGNORE checks
- in
- let check_concl =
- let msg _ = Tacticals.New.tclZEROMSG
- (str "Conclusion" ++ on_the_bodies ids)
- in
- check_is_type env concl msg
- in
- check_hyps <*> check_concl <*>
- Proofview.Refine.refine ~unsafe:true begin fun h ->
- let args = Array.of_list (List.map_filter filter ctx) in
- let (h, c) = Proofview.Refine.new_evar h env concl in
- let c = it_mkNamedLambda_or_LetIn c ctx in
- (h, mkApp (c, args))
- end
- end
+let clear_body = thin_body
let clear_wildcards ids =
Proofview.V82.tactic (tclMAP (fun (loc,id) gl ->
@@ -2015,7 +1958,7 @@ let letin_tac_gen with_eq abs ty =
sigma, term,
Tacticals.New.tclTHEN
(intro_gen (NamingMustBe (loc,heq)) (decode_hyp lastlhyp) true false)
- (clear_body [heq;id])
+ (Proofview.V82.tactic (thin_body [heq;id]))
| None ->
(Proofview.Goal.sigma gl, mkNamedLetIn id c t ccl, Proofview.tclUNIT ()) in
Tacticals.New.tclTHEN
diff --git a/tactics/tactics.mli b/tactics/tactics.mli
index 349e828a19..d7a88787b1 100644
--- a/tactics/tactics.mli
+++ b/tactics/tactics.mli
@@ -163,7 +163,7 @@ val unfold_constr : global_reference -> tactic
(** {6 Modification of the local context. } *)
val clear : Id.t list -> tactic
-val clear_body : Id.t list -> unit Proofview.tactic
+val clear_body : Id.t list -> tactic
val keep : Id.t list -> tactic
val apply_clear_request : clear_flag -> bool -> constr -> unit Proofview.tactic