Skip to content

Commit

Permalink
Moving conversion functions to the new tactic API.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppedrot committed Feb 15, 2016
1 parent 1a8c37c commit 15b28f0
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 82 deletions.
2 changes: 1 addition & 1 deletion plugins/btauto/refl_btauto.ml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ module Btauto = struct
Tacticals.New.tclTHENLIST [
Tactics.change_concl changed_gl;
Tactics.apply (Lazy.force soundness);
Proofview.V82.tactic (Tactics.normalise_vm_in_concl);
Tactics.normalise_vm_in_concl;
try_unification env
]
| _ ->
Expand Down
4 changes: 2 additions & 2 deletions plugins/firstorder/rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,6 @@ let defined_connectives=lazy
let normalize_evaluables=
onAllHypsAndConcl
(function
None->unfold_in_concl (Lazy.force defined_connectives)
None-> Proofview.V82.of_tactic (unfold_in_concl (Lazy.force defined_connectives))
| Some id ->
unfold_in_hyp (Lazy.force defined_connectives) (id,InHypTypeOnly))
Proofview.V82.of_tactic (unfold_in_hyp (Lazy.force defined_connectives) (id,InHypTypeOnly)))
4 changes: 2 additions & 2 deletions plugins/funind/functional_principles_proofs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ let prove_princ_for_struct (evd:Evd.evar_map ref) interactive_proof fun_num fnam
in
let fname = destConst (fst (decompose_app (List.hd (List.rev pte_args)))) in
tclTHENSEQ
[unfold_in_concl [(Locus.AllOccurrences, Names.EvalConstRef (fst fname))];
[Proofview.V82.of_tactic (unfold_in_concl [(Locus.AllOccurrences, Names.EvalConstRef (fst fname))]);
let do_prove =
build_proof
interactive_proof
Expand Down Expand Up @@ -1460,7 +1460,7 @@ let new_prove_with_tcc is_mes acc_inv hrec tcc_hyps eqs : tactic =
(fun g ->
if is_mes
then
unfold_in_concl [(Locus.AllOccurrences, evaluable_of_global_reference (delayed_force ltof_ref))] g
Proofview.V82.of_tactic (unfold_in_concl [(Locus.AllOccurrences, evaluable_of_global_reference (delayed_force ltof_ref))]) g
else tclIDTAC g
);
observe_tac "rew_and_finish"
Expand Down
10 changes: 5 additions & 5 deletions plugins/funind/invfun.ml
Original file line number Diff line number Diff line change
Expand Up @@ -484,15 +484,15 @@ and intros_with_rewrite_aux : tactic =
tclTHENSEQ [ Proofview.V82.of_tactic (Simple.intro id); thin [id]; intros_with_rewrite ] g
else if isVar args.(1) && (Environ.evaluable_named (destVar args.(1)) (pf_env g))
then tclTHENSEQ[
unfold_in_concl [(Locus.AllOccurrences, Names.EvalVarRef (destVar args.(1)))];
tclMAP (fun id -> tclTRY(unfold_in_hyp [(Locus.AllOccurrences, Names.EvalVarRef (destVar args.(1)))] ((destVar args.(1)),Locus.InHyp) ))
Proofview.V82.of_tactic (unfold_in_concl [(Locus.AllOccurrences, Names.EvalVarRef (destVar args.(1)))]);
tclMAP (fun id -> tclTRY(Proofview.V82.of_tactic (unfold_in_hyp [(Locus.AllOccurrences, Names.EvalVarRef (destVar args.(1)))] ((destVar args.(1)),Locus.InHyp) )))
(pf_ids_of_hyps g);
intros_with_rewrite
] g
else if isVar args.(2) && (Environ.evaluable_named (destVar args.(2)) (pf_env g))
then tclTHENSEQ[
unfold_in_concl [(Locus.AllOccurrences, Names.EvalVarRef (destVar args.(2)))];
tclMAP (fun id -> tclTRY(unfold_in_hyp [(Locus.AllOccurrences, Names.EvalVarRef (destVar args.(2)))] ((destVar args.(2)),Locus.InHyp) ))
Proofview.V82.of_tactic (unfold_in_concl [(Locus.AllOccurrences, Names.EvalVarRef (destVar args.(2)))]);
tclMAP (fun id -> tclTRY(Proofview.V82.of_tactic (unfold_in_hyp [(Locus.AllOccurrences, Names.EvalVarRef (destVar args.(2)))] ((destVar args.(2)),Locus.InHyp) )))
(pf_ids_of_hyps g);
intros_with_rewrite
] g
Expand Down Expand Up @@ -703,7 +703,7 @@ let prove_fun_complete funcs graphs schemes lemmas_types_infos i : tactic =
thin ids
]
else
unfold_in_concl [(Locus.AllOccurrences, Names.EvalConstRef (fst (destConst f)))]
Proofview.V82.of_tactic (unfold_in_concl [(Locus.AllOccurrences, Names.EvalConstRef (fst (destConst f)))])
in
(* The proof of each branche itself *)
let ind_number = ref 0 in
Expand Down
14 changes: 7 additions & 7 deletions plugins/funind/recdef.ml
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ let tclUSER tac is_mes l g =
if is_mes
then observe_tclTHENLIST (str "tclUSER2")
[
unfold_in_concl [(Locus.AllOccurrences, evaluable_of_global_reference
(delayed_force Indfun_common.ltof_ref))];
Proofview.V82.of_tactic (unfold_in_concl [(Locus.AllOccurrences, evaluable_of_global_reference
(delayed_force Indfun_common.ltof_ref))]);
tac
]
else tac
Expand Down Expand Up @@ -564,8 +564,8 @@ let rec destruct_bounds_aux infos (bound,hyple,rechyps) lbounds g =
h_intros [k;h';def];
observe_tac (str "simple_iter") (simpl_iter Locusops.onConcl);
observe_tac (str "unfold functional")
(unfold_in_concl[(Locus.OnlyOccurrences [1],
evaluable_of_global_reference infos.func)]);
(Proofview.V82.of_tactic (unfold_in_concl[(Locus.OnlyOccurrences [1],
evaluable_of_global_reference infos.func)]));
(
observe_tclTHENLIST (str "test")[
list_rewrite true
Expand Down Expand Up @@ -904,8 +904,8 @@ let make_rewrite expr_info l hp max =
(observe_tclTHENLIST (str "make_rewrite")[
simpl_iter Locusops.onConcl;
observe_tac (str "unfold functional")
(unfold_in_concl[(Locus.OnlyOccurrences [1],
evaluable_of_global_reference expr_info.func)]);
(Proofview.V82.of_tactic (unfold_in_concl[(Locus.OnlyOccurrences [1],
evaluable_of_global_reference expr_info.func)]));

(list_rewrite true
(List.map (fun e -> mkVar e,true) expr_info.eqs));
Expand Down Expand Up @@ -1425,7 +1425,7 @@ let start_equation (f:global_reference) (term_f:global_reference)
let x = n_x_id ids nargs in
observe_tac (str "start_equation") (observe_tclTHENLIST (str "start_equation") [
h_intros x;
unfold_in_concl [(Locus.AllOccurrences, evaluable_of_global_reference f)];
Proofview.V82.of_tactic (unfold_in_concl [(Locus.AllOccurrences, evaluable_of_global_reference f)]);
observe_tac (str "simplest_case")
(Proofview.V82.of_tactic (simplest_case (mkApp (terminate_constr,
Array.of_list (List.map mkVar x)))));
Expand Down
46 changes: 23 additions & 23 deletions plugins/omega/coq_omega.ml
Original file line number Diff line number Diff line change
Expand Up @@ -927,15 +927,15 @@ let rec transform p t =
transform p
(mkApp (Lazy.force coq_Zplus,
[| t1; (mkApp (Lazy.force coq_Zopp, [| t2 |])) |])) in
unfold sp_Zminus :: tac,t
Proofview.V82.of_tactic (unfold sp_Zminus) :: tac,t
| Kapp(Zsucc,[t1]) ->
let tac,t = transform p (mkApp (Lazy.force coq_Zplus,
[| t1; mk_integer one |])) in
unfold sp_Zsucc :: tac,t
Proofview.V82.of_tactic (unfold sp_Zsucc) :: tac,t
| Kapp(Zpred,[t1]) ->
let tac,t = transform p (mkApp (Lazy.force coq_Zplus,
[| t1; mk_integer negone |])) in
unfold sp_Zpred :: tac,t
Proofview.V82.of_tactic (unfold sp_Zpred) :: tac,t
| Kapp(Zmult,[t1;t2]) ->
let tac1,t1' = transform (P_APP 1 :: p) t1
and tac2,t2' = transform (P_APP 2 :: p) t2 in
Expand Down Expand Up @@ -1091,8 +1091,8 @@ let replay_history tactic_normalisation =
in
Tacticals.New.tclTHENS
(Tacticals.New.tclTHENLIST [
Proofview.V82.tactic (unfold sp_Zle);
Proofview.V82.tactic (simpl_in_concl);
unfold sp_Zle;
simpl_in_concl;
intro;
(absurd not_sup_sup) ])
[ assumption ; reflexivity ]
Expand Down Expand Up @@ -1135,10 +1135,10 @@ let replay_history tactic_normalisation =
(intros_using [id]);
(loop l) ];
Tacticals.New.tclTHENLIST [
(Proofview.V82.tactic (unfold sp_Zgt));
(Proofview.V82.tactic simpl_in_concl);
(unfold sp_Zgt);
simpl_in_concl;
reflexivity ] ];
Tacticals.New.tclTHENLIST [ Proofview.V82.tactic (unfold sp_Zgt); Proofview.V82.tactic simpl_in_concl; reflexivity ]
Tacticals.New.tclTHENLIST [ unfold sp_Zgt; simpl_in_concl; reflexivity ]
];
Tacticals.New.tclTHEN (Proofview.V82.tactic (mk_then tac)) reflexivity ]

Expand All @@ -1160,18 +1160,18 @@ let replay_history tactic_normalisation =
[mkApp (Lazy.force coq_OMEGA4,
[| dd;kk;eq2;mkVar aux1; mkVar aux2 |])]);
Proofview.V82.tactic (clear [aux1;aux2]);
Proofview.V82.tactic (unfold sp_not);
unfold sp_not;
(intros_using [aux]);
Proofview.V82.tactic (resolve_id aux);
Proofview.V82.tactic (mk_then tac);
assumption ] ;
Tacticals.New.tclTHENLIST [
Proofview.V82.tactic (unfold sp_Zgt);
Proofview.V82.tactic simpl_in_concl;
unfold sp_Zgt;
simpl_in_concl;
reflexivity ] ];
Tacticals.New.tclTHENLIST [
Proofview.V82.tactic (unfold sp_Zgt);
Proofview.V82.tactic simpl_in_concl;
unfold sp_Zgt;
simpl_in_concl;
reflexivity ] ]
| EXACT_DIVIDE (e1,k) :: l ->
let id = hyp_of_tag e1.id in
Expand Down Expand Up @@ -1208,8 +1208,8 @@ let replay_history tactic_normalisation =
(intros_using [id]);
(loop l) ];
Tacticals.New.tclTHENLIST [
Proofview.V82.tactic (unfold sp_Zgt);
Proofview.V82.tactic simpl_in_concl;
unfold sp_Zgt;
simpl_in_concl;
reflexivity ] ];
Tacticals.New.tclTHEN (Proofview.V82.tactic (mk_then tac)) reflexivity ]
| (MERGE_EQ(e3,e1,e2)) :: l ->
Expand Down Expand Up @@ -1329,12 +1329,12 @@ let replay_history tactic_normalisation =
(intros_using [id]);
(loop l) ];
Tacticals.New.tclTHENLIST [
Proofview.V82.tactic (unfold sp_Zgt);
Proofview.V82.tactic simpl_in_concl;
unfold sp_Zgt;
simpl_in_concl;
reflexivity ] ];
Tacticals.New.tclTHENLIST [
Proofview.V82.tactic (unfold sp_Zgt);
Proofview.V82.tactic simpl_in_concl;
unfold sp_Zgt;
simpl_in_concl;
reflexivity ] ]
| CONSTANT_NOT_NUL(e,k) :: l ->
Tacticals.New.tclTHEN (Proofview.V82.tactic (generalize_tac [mkVar (hyp_of_tag e)])) Equality.discrConcl
Expand All @@ -1343,9 +1343,9 @@ let replay_history tactic_normalisation =
| CONSTANT_NEG(e,k) :: l ->
Tacticals.New.tclTHENLIST [
Proofview.V82.tactic (generalize_tac [mkVar (hyp_of_tag e)]);
Proofview.V82.tactic (unfold sp_Zle);
Proofview.V82.tactic simpl_in_concl;
Proofview.V82.tactic (unfold sp_not);
unfold sp_Zle;
simpl_in_concl;
unfold sp_not;
(intros_using [aux]);
Proofview.V82.tactic (resolve_id aux);
reflexivity
Expand Down Expand Up @@ -1839,7 +1839,7 @@ let destructure_goal =
match destructurate_prop t with
| Kapp(Not,[t]) ->
(Tacticals.New.tclTHEN
(Tacticals.New.tclTHEN (Proofview.V82.tactic (unfold sp_not)) intro)
(Tacticals.New.tclTHEN (unfold sp_not) intro)
destructure_hyps)
| Kimp(a,b) -> (Tacticals.New.tclTHEN intro (loop b))
| Kapp(False,[]) -> destructure_hyps
Expand Down
2 changes: 1 addition & 1 deletion plugins/romega/refl_omega.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ let resolution env full_reified_goal systems_list =
Proofview.V82.of_tactic (Tactics.change_concl reified) >>
Proofview.V82.of_tactic (Tactics.apply (app coq_do_omega [|decompose_tactic; normalization_trace|])) >>
show_goal >>
Tactics.normalise_vm_in_concl >>
Proofview.V82.of_tactic (Tactics.normalise_vm_in_concl) >>
(*i Alternatives to the previous line:
- Normalisation without VM:
Tactics.normalise_in_concl
Expand Down
4 changes: 2 additions & 2 deletions plugins/setoid_ring/newring.ml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ let protect_red map env sigma c =
(mk_clos_but (lookup_map map c) (Esubst.subs_id 0) c);;

let protect_tac map =
Tactics.reduct_option (protect_red map,DEFAULTcast) None ;;
Proofview.V82.of_tactic (Tactics.reduct_option (protect_red map,DEFAULTcast) None);;

let protect_tac_in map id =
Tactics.reduct_option (protect_red map,DEFAULTcast) (Some(id, Locus.InHyp));;
Proofview.V82.of_tactic (Tactics.reduct_option (protect_red map,DEFAULTcast) (Some(id, Locus.InHyp)));;


(****************************************************************************)
Expand Down
2 changes: 1 addition & 1 deletion tactics/class_tactics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ and e_my_find_search db_list local_db hdc complete sigma concl =
Proofview.V82.tactic (tclTHEN
(Proofview.V82.of_tactic ((with_prods nprods poly (term,cl) (unify_e_resolve poly flags))))
(if complete then tclIDTAC else e_trivial_fail_db db_list local_db))
| Unfold_nth c -> Proofview.V82.tactic (tclWEAK_PROGRESS (unfold_in_concl [AllOccurrences,c]))
| Unfold_nth c -> Proofview.V82.tactic (tclWEAK_PROGRESS (Proofview.V82.of_tactic (unfold_in_concl [AllOccurrences,c])))
| Extern tacast -> conclPattern concl p tacast
in
let tac = Proofview.V82.of_tactic (run_hint t tac) in
Expand Down
2 changes: 1 addition & 1 deletion tactics/eauto.ml4
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ let autounfolds db occs cls gl =
let ids = Idset.filter (fun id -> List.mem id hyps) ids in
Cset.fold (fun cst -> cons (AllOccurrences, EvalConstRef cst)) csts
(Id.Set.fold (fun id -> cons (AllOccurrences, EvalVarRef id)) ids [])) db)
in unfold_option unfolds cls gl
in Proofview.V82.of_tactic (unfold_option unfolds cls) gl

let autounfold db cls gl =
let cls = concrete_clause_of (fun () -> pf_ids_of_hyps gl) cls in
Expand Down
2 changes: 1 addition & 1 deletion tactics/eqdecide.ml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ let diseqCase hyps eqonleft =
(tclTHEN (intro_using diseq)
(tclTHEN (choose_noteq eqonleft)
(tclTHEN (rewrite_and_clear (List.rev hyps))
(tclTHEN (Proofview.V82.tactic red_in_concl)
(tclTHEN (red_in_concl)
(tclTHEN (intro_using absurd)
(tclTHEN (Simple.apply (mkVar diseq))
(tclTHEN (Extratactics.injHyp absurd)
Expand Down
4 changes: 2 additions & 2 deletions tactics/equality.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1622,8 +1622,8 @@ let unfold_body x =
let hl = List.fold_right (fun (y,yval,_) cl -> (y,InHyp) :: cl) aft [] in
let xvar = mkVar x in
let rfun _ _ c = replace_term xvar xval c in
let reducth h = Proofview.V82.tactic (fun gl -> reduct_in_hyp rfun h gl) in
let reductc = Proofview.V82.tactic (fun gl -> reduct_in_concl (rfun, DEFAULTcast) gl) in
let reducth h = reduct_in_hyp rfun h in
let reductc = reduct_in_concl (rfun, DEFAULTcast) in
tclTHENLIST [tclMAP reducth hl; reductc]
end
end }
Expand Down
4 changes: 2 additions & 2 deletions tactics/rewrite.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1569,10 +1569,10 @@ let cl_rewrite_clause_newtac ?abs ?origsigma ~progress strat clause =
convert_concl_no_check newt DEFAULTcast
in
let beta_red _ sigma c = Reductionops.nf_betaiota sigma c in
let beta = Proofview.V82.tactic (Tactics.reduct_in_concl (beta_red, DEFAULTcast)) in
let beta = Tactics.reduct_in_concl (beta_red, DEFAULTcast) in
let opt_beta = match clause with
| None -> Proofview.tclUNIT ()
| Some id -> Proofview.V82.tactic (Tactics.reduct_in_hyp beta_red (id, InHyp))
| Some id -> Tactics.reduct_in_hyp beta_red (id, InHyp)
in
Proofview.Goal.nf_enter { enter = begin fun gl ->
let concl = Proofview.Goal.concl gl in
Expand Down
21 changes: 12 additions & 9 deletions tactics/tactics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ let cofix ido gl = match ido with
type tactic_reduction = env -> evar_map -> constr -> constr

let pf_reduce_decl redfun where (id,c,ty) gl =
let redfun' = Tacmach.pf_reduce redfun gl in
let redfun' = Tacmach.New.pf_apply redfun gl in
match c with
| None ->
if where == InHypValueOnly then
Expand Down Expand Up @@ -549,12 +549,15 @@ let bind_red_expr_occurrences occs nbcl redexp =
reduction function either to the conclusion or to a
certain hypothesis *)

let reduct_in_concl (redfun,sty) gl =
Proofview.V82.of_tactic (convert_concl_no_check (Tacmach.pf_reduce redfun gl (Tacmach.pf_concl gl)) sty) gl
let reduct_in_concl (redfun,sty) =
Proofview.Goal.nf_enter { enter = begin fun gl ->
convert_concl_no_check (Tacmach.New.pf_apply redfun gl (Tacmach.New.pf_concl gl)) sty
end }

let reduct_in_hyp ?(check=false) redfun (id,where) gl =
Proofview.V82.of_tactic (convert_hyp ~check
(pf_reduce_decl redfun where (Tacmach.pf_get_hyp gl id) gl)) gl
let reduct_in_hyp ?(check=false) redfun (id,where) =
Proofview.Goal.nf_enter { enter = begin fun gl ->
convert_hyp ~check (pf_reduce_decl redfun where (Tacmach.New.pf_get_hyp id gl) gl)
end }

let revert_cast (redfun,kind as r) =
if kind == DEFAULTcast then (redfun,REVERTcast) else r
Expand Down Expand Up @@ -798,7 +801,7 @@ let rec intro_then_gen name_flag move_flag force_flag dep_flag tac =
else Proofview.tclUNIT ()
end <*>
Proofview.tclORELSE
(Tacticals.New.tclTHEN (Proofview.V82.tactic hnf_in_concl)
(Tacticals.New.tclTHEN hnf_in_concl
(intro_then_gen name_flag move_flag false dep_flag tac))
begin function (e, info) -> match e with
| RefinerError IntroNeedsProduct ->
Expand Down Expand Up @@ -2728,8 +2731,8 @@ let unfold_body x gl =
let xvar = mkVar x in
let rfun _ _ c = replace_term xvar xval c in
tclTHENLIST
[tclMAP (fun h -> reduct_in_hyp rfun h) hl;
reduct_in_concl (rfun,DEFAULTcast)] gl
[tclMAP (fun h -> Proofview.V82.of_tactic (reduct_in_hyp rfun h)) hl;
Proofview.V82.of_tactic (reduct_in_concl (rfun,DEFAULTcast))] gl

(* Either unfold and clear if defined or simply clear if not a definition *)
let expand_hyp id = tclTHEN (tclTRY (unfold_body id)) (clear [id])
Expand Down

0 comments on commit 15b28f0

Please sign in to comment.