Skip to content

Commit 1130fd1

Browse files
committed
wit_tactic top type is tacvalue
1 parent 384b676 commit 1130fd1

29 files changed

+174
-145
lines changed

plugins/firstorder/g_ground.mlg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ let gen_ground_tac ist taco ids bases =
6161
Proofview.Goal.enter begin fun gl ->
6262
let solver=
6363
match taco with
64-
| Some tac -> tactic_of_value ist tac
64+
| Some tac -> tactic_of_tacvalue ist tac
6565
| None-> default_solver ()
6666
in
6767
let startseq k =

plugins/ltac/extraargs.mlg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,15 @@ let pr_by_arg_tac env sigma _prc _prlc prtac opt_c =
266266
| None -> mt ()
267267
| Some t -> hov 2 (str "by" ++ spc () ++ prtac env sigma (Constrexpr.LevelLe 3) t)
268268

269+
let top_pr_by_arg_tac env sigma prc prlc _prtac opt_c =
270+
pr_by_arg_tac env sigma prc prlc (fun env _ _ t -> Pptactic.pr_tacvalue env t) opt_c
269271
}
270272

271273
ARGUMENT EXTEND by_arg_tac
272274
TYPED AS tactic option
273-
PRINTED BY { pr_by_arg_tac env sigma }
275+
PRINTED BY { top_pr_by_arg_tac env sigma }
276+
RAW_PRINTED BY { pr_by_arg_tac env sigma }
277+
GLOB_PRINTED BY { pr_by_arg_tac env sigma }
274278
| [ "by" tactic3(c) ] -> { Some c }
275279
| [ ] -> { None }
276280
END

plugins/ltac/extraargs.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ val by_arg_tac : Tacexpr.raw_tactic_expr option Procq.Entry.t
5757
val wit_by_arg_tac :
5858
(raw_tactic_expr option,
5959
glob_tactic_expr option,
60-
Geninterp.Val.t option) Genarg.genarg_type
60+
tacvalue option) Genarg.genarg_type
6161

6262
val pr_by_arg_tac :
6363
Environ.env -> Evd.evar_map ->

plugins/ltac/extratactics.mlg

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ DECLARE PLUGIN "rocq-runtime.plugins.ltac"
3131

3232
TACTIC EXTEND assert_succeeds
3333
| [ "assert_succeeds" tactic3(tac) ]
34-
-> { Internals.assert_succeeds (Tacinterp.tactic_of_value ist tac) }
34+
-> { Internals.assert_succeeds (Tacinterp.tactic_of_tacvalue ist tac) }
3535
END
3636

3737
TACTIC EXTEND replace
@@ -179,24 +179,24 @@ TACTIC EXTEND autorewrite
179179
{ auto_multi_rewrite l ( cl) }
180180
| [ "autorewrite" "with" ne_preident_list(l) clause(cl) "using" tactic(t) ] ->
181181
{
182-
auto_multi_rewrite_with (Tacinterp.tactic_of_value ist t) l cl
182+
auto_multi_rewrite_with (Tacinterp.tactic_of_tacvalue ist t) l cl
183183
}
184184
END
185185

186186
TACTIC EXTEND autorewrite_star
187187
| [ "autorewrite" "*" "with" ne_preident_list(l) clause(cl) ] ->
188188
{ auto_multi_rewrite ~conds:AllMatches l cl }
189189
| [ "autorewrite" "*" "with" ne_preident_list(l) clause(cl) "using" tactic(t) ] ->
190-
{ auto_multi_rewrite_with ~conds:AllMatches (Tacinterp.tactic_of_value ist t) l cl }
190+
{ auto_multi_rewrite_with ~conds:AllMatches (Tacinterp.tactic_of_tacvalue ist t) l cl }
191191
END
192192

193193
(**********************************************************************)
194194
(* Rewrite star *)
195195

196196
{
197197

198-
let rewrite_star ist clause orient occs c (tac : Geninterp.Val.t option) =
199-
let tac' = Option.map (fun t -> Tacinterp.tactic_of_value ist t, FirstSolved) tac in
198+
let rewrite_star ist clause orient occs c (tac : Tacexpr.tacvalue option) =
199+
let tac' = Option.map (fun t -> Tacinterp.tactic_of_tacvalue ist t, FirstSolved) tac in
200200
Internals.with_delayed_uconstr ist c
201201
(fun c -> general_rewrite ~where:clause ~l2r:orient occs ?tac:tac' ~freeze:true ~dep:true ~with_evars:true (c,NoBindings))
202202

@@ -420,12 +420,12 @@ let add_transitivity_lemma left lem =
420420
(* Vernacular syntax *)
421421

422422
TACTIC EXTEND stepl
423-
| ["stepl" constr(c) "by" tactic(tac) ] -> { step true c (Tacinterp.tactic_of_value ist tac) }
423+
| ["stepl" constr(c) "by" tactic(tac) ] -> { step true c (Tacinterp.tactic_of_tacvalue ist tac) }
424424
| ["stepl" constr(c) ] -> { step true c (Proofview.tclUNIT ()) }
425425
END
426426

427427
TACTIC EXTEND stepr
428-
| ["stepr" constr(c) "by" tactic(tac) ] -> { step false c (Tacinterp.tactic_of_value ist tac) }
428+
| ["stepr" constr(c) "by" tactic(tac) ] -> { step false c (Tacinterp.tactic_of_tacvalue ist tac) }
429429
| ["stepr" constr(c) ] -> { step false c (Proofview.tclUNIT ()) }
430430
END
431431

@@ -472,9 +472,9 @@ END
472472

473473
TACTIC EXTEND transparent_abstract
474474
| [ "transparent_abstract" tactic3(t) ] -> { Proofview.Goal.enter begin fun gl ->
475-
Abstract.tclABSTRACT ~opaque:false None (Tacinterp.tactic_of_value ist t) end; }
475+
Abstract.tclABSTRACT ~opaque:false None (Tacinterp.tactic_of_tacvalue ist t) end; }
476476
| [ "transparent_abstract" tactic3(t) "using" ident(id) ] -> { Proofview.Goal.enter begin fun gl ->
477-
Abstract.tclABSTRACT ~opaque:false (Some id) (Tacinterp.tactic_of_value ist t) end; }
477+
Abstract.tclABSTRACT ~opaque:false (Some id) (Tacinterp.tactic_of_tacvalue ist t) end; }
478478
END
479479

480480
(* ********************************************************************* *)
@@ -683,6 +683,6 @@ END
683683

684684
TACTIC EXTEND with_strategy
685685
| [ "with_strategy" strategy_level_or_var(v) "[" ne_smart_global_list(q) "]" tactic3(tac) ] -> {
686-
with_set_strategy [(v, q)] (Tacinterp.tactic_of_value ist tac)
686+
with_set_strategy [(v, q)] (Tacinterp.tactic_of_tacvalue ist tac)
687687
}
688688
END

plugins/ltac/internals.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ let with_delayed_uconstr ist c tac =
5353

5454
let replace_in_clause_maybe_by ist dir_opt c1 c2 cl tac =
5555
with_delayed_uconstr ist c1
56-
(fun c1 -> Equality.replace_in_clause_maybe_by dir_opt c1 c2 cl (Option.map (Tacinterp.tactic_of_value ist) tac))
56+
(fun c1 -> Equality.replace_in_clause_maybe_by dir_opt c1 c2 cl (Option.map (Tacinterp.tactic_of_tacvalue ist) tac))
5757

5858
let replace_term ist dir_opt c cl =
5959
with_delayed_uconstr ist c (fun c -> Equality.replace_term dir_opt c cl)
@@ -163,7 +163,7 @@ let is_const x =
163163
| _ -> Tacticals.tclFAIL (Pp.str "not a constant")
164164

165165
let unshelve ist t =
166-
Proofview.with_shelf (Tacinterp.tactic_of_value ist t) >>= fun (gls, ()) ->
166+
Proofview.with_shelf (Tacinterp.tactic_of_tacvalue ist t) >>= fun (gls, ()) ->
167167
let gls = List.map Proofview.with_empty_state gls in
168168
Proofview.Unsafe.tclGETGOALS >>= fun ogls ->
169169
Proofview.Unsafe.tclSETGOALS (gls @ ogls)

plugins/ltac/internals.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ val with_delayed_uconstr : Tacinterp.interp_sign ->
3030
closed_glob_constr -> (EConstr.constr -> unit tactic) -> unit tactic
3131
val replace_in_clause_maybe_by : Tacinterp.interp_sign -> bool option ->
3232
closed_glob_constr -> EConstr.constr ->
33-
Locus.clause -> Tacinterp.Value.t option -> unit tactic
33+
Locus.clause -> Tacexpr.tacvalue option -> unit tactic
3434
val replace_term : Tacinterp.interp_sign -> bool option -> closed_glob_constr ->
3535
Locus.clause -> unit tactic
3636

@@ -51,7 +51,7 @@ val is_constructor : EConstr.t -> unit tactic
5151
val is_proj : EConstr.t -> unit tactic
5252
val is_const : EConstr.t -> unit tactic
5353

54-
val unshelve : Tacinterp.interp_sign -> Tacinterp.Value.t -> unit tactic
54+
val unshelve : Tacinterp.interp_sign -> Tacexpr.tacvalue -> unit tactic
5555

5656
val decompose : EConstr.t list -> EConstr.t -> unit tactic
5757

plugins/ltac/pptactic.ml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ type 'a extra_genarg_printer =
9191
Environ.env -> Evd.evar_map ->
9292
(Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t) ->
9393
(Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t) ->
94-
(Environ.env -> Evd.evar_map -> entry_relative_level -> Val.t -> Pp.t) ->
94+
(Environ.env -> Evd.evar_map -> entry_relative_level -> tacvalue -> Pp.t) ->
9595
'a -> Pp.t
9696

9797
type 'a raw_extra_genarg_printer_with_level =
@@ -112,7 +112,7 @@ type 'a extra_genarg_printer_with_level =
112112
Environ.env -> Evd.evar_map ->
113113
(Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t) ->
114114
(Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t) ->
115-
(Environ.env -> Evd.evar_map -> entry_relative_level -> Val.t -> Pp.t) ->
115+
(Environ.env -> Evd.evar_map -> entry_relative_level -> tacvalue -> Pp.t) ->
116116
entry_relative_level -> 'a -> Pp.t
117117

118118
let string_of_genarg_arg (ArgumentType arg) =
@@ -1400,9 +1400,25 @@ let () =
14001400
register_basic_print0 Stdarg.wit_pre_ident str str str;
14011401
register_basic_print0 Stdarg.wit_string qstring qstring qstring
14021402

1403+
let pr_tacvalue env = function
1404+
| VFun (a,_,loc,ids,l,tac) ->
1405+
let open Pp in
1406+
let tac = if List.is_empty l then tac else CAst.make ?loc @@ Tacexpr.TacFun (l,tac) in
1407+
let pr_env env =
1408+
if Id.Map.is_empty ids then mt ()
1409+
else
1410+
cut () ++ str "where" ++
1411+
Id.Map.fold (fun id c pp ->
1412+
cut () ++ Id.print id ++ str " := " ++ pr_value ltop c ++ pp)
1413+
ids (mt ())
1414+
in
1415+
v 0 (hov 0 (pr_glob_tactic env tac) ++ pr_env env)
1416+
| VRec _ -> str "<tactic closure>"
1417+
14031418
let () =
14041419
let printer env sigma _ _ prtac = prtac env sigma in
1405-
declare_extra_genarg_pprule_with_level wit_tactic printer printer printer
1420+
let top_print env sigma _ _ _ _ = pr_tacvalue env in
1421+
declare_extra_genarg_pprule_with_level wit_tactic printer printer top_print
14061422
ltop (LevelLe 0)
14071423

14081424
let () =

plugins/ltac/pptactic.mli

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type 'a extra_genarg_printer =
4242
Environ.env -> Evd.evar_map ->
4343
(Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t) ->
4444
(Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t) ->
45-
(Environ.env -> Evd.evar_map -> entry_relative_level -> Val.t -> Pp.t) ->
45+
(Environ.env -> Evd.evar_map -> entry_relative_level -> tacvalue -> Pp.t) ->
4646
'a -> Pp.t
4747

4848
type 'a raw_extra_genarg_printer_with_level =
@@ -63,7 +63,7 @@ type 'a extra_genarg_printer_with_level =
6363
Environ.env -> Evd.evar_map ->
6464
(Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t) ->
6565
(Environ.env -> Evd.evar_map -> EConstr.constr -> Pp.t) ->
66-
(Environ.env -> Evd.evar_map -> entry_relative_level -> Val.t -> Pp.t) ->
66+
(Environ.env -> Evd.evar_map -> entry_relative_level -> tacvalue -> Pp.t) ->
6767
entry_relative_level -> 'a -> Pp.t
6868

6969
val declare_extra_genarg_pprule :
@@ -155,6 +155,8 @@ val pr_match_rule : bool -> ('a -> Pp.t) -> ('b -> Pp.t) ->
155155

156156
val pr_value : entry_relative_level -> Val.t -> Pp.t
157157

158+
val pr_tacvalue : env -> tacvalue -> Pp.t
159+
158160
val pp_ltac_call_kind : ltac_call_kind -> Pp.t
159161

160162
val ltop : entry_relative_level

plugins/ltac/tacarg.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let wit_open_constr_with_bindings = make0 "open_constr_with_bindings"
2727
let wit_bindings = make0 "bindings"
2828
let wit_quantified_hypothesis = wit_quant_hyp
2929

30-
let wit_tactic : (raw_tactic_expr, glob_tactic_expr, Val.t) genarg_type =
30+
let wit_tactic : (raw_tactic_expr, glob_tactic_expr, tacvalue) genarg_type =
3131
make0 "tactic"
3232

3333
let wit_ltac_in_term = GenConstr.create "ltac_in_term"

plugins/ltac/tacarg.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ val wit_quantified_hypothesis : quantified_hypothesis uniform_genarg_type
4242

4343
(** Generic arguments based on Ltac. *)
4444

45-
val wit_tactic : (raw_tactic_expr, glob_tactic_expr, Geninterp.Val.t) genarg_type
45+
val wit_tactic : (raw_tactic_expr, glob_tactic_expr, tacvalue) genarg_type
4646

4747
val wit_ltac_in_term : (raw_tactic_expr, Names.Id.Set.t * glob_tactic_expr) GenConstr.tag
4848

0 commit comments

Comments
 (0)