Debian Codegraph @

plugins/ltac2/tac2externals.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 open Proofview
12 open Tac2ffi
13 open Tac2val
14
15 (** Interface for defining external tactics via a high-level spec. *)
16
17 (** Type [('v,'f) spec] represents a high-level Ltac2 tactic specification. It
18 indicates how to turn a value of type ['f] into an Ltac2 tactic, which may
19 involve converting between OCaml and Ltac2 value representations, and also
20 lifting a pure function to the tactic monad. The type parameter ['v] gives
21 the type of value produced by interpreting the specification. *)
22 type (_, _) spec
23
24 (** [tac r] is the specification of a tactic (in the tactic monad sense) whose
25 return type is specified (and converted into an Ltac2 value) via [r]. *)
26 val tac :
27 'r repr ->
28 (valexpr tactic, 'r tactic) spec
29
30 (** [tac'] is similar to [tac], but only needs a conversion function. *)
31 val tac' :
32 ('r -> valexpr) ->
33 (valexpr tactic, 'r tactic) spec
34
35 (** [ret r] is the specification of a pure tactic (i.e., a tactic defined as a
36 pure OCaml value, not needing the tactic monad) whose return type is given
37 by [r] (see [tac]). *)
38 val ret :
39 'r repr ->
40 (valexpr tactic, 'r) spec
41
42 (** [ret'] is similar to [ret], but only needs a conversion function. *)
43 val ret' :
44 ('r -> valexpr) ->
45 (valexpr tactic, 'r) spec
46
47 (** [eret] is similar to [ret], but for tactics that can be implemented with a
48 pure OCaml value, provided extra arguments [env] and [sigma], computed via
49 [tclENV] and [tclEVARMAP]. *)
50 val eret :
51 'r repr ->
52 (valexpr tactic, Environ.env -> Evd.evar_map -> 'r) spec
53
54 (** [eret'] is similar to [eret], but only needs a conversion function. *)
55 val eret' :
56 ('r -> valexpr) ->
57 (valexpr tactic, Environ.env -> Evd.evar_map -> 'r) spec
58
59 (** [gret] is similar to [ret], but for tactics that can be implemented with a
60 pure OCaml value, provided the current goal [g] as extra argument. A fatal
61 error is produced when there is not exactly one goal in focus at the point
62 of using an Ltac2 value defined with this specification. Indeed, the value
63 of [g] is computed using [Goal.enter_one]. *)
64 val gret :
65 'r repr ->
66 (valexpr tactic, Goal.t -> 'r) spec
67
68 (** [gret'] is similar to [gret], but only needs a conversion function. *)
69 val gret' :
70 ('r -> valexpr) ->
71 (valexpr tactic, Goal.t -> 'r) spec
72
73 (** [r @-> s] extends the specification [s] with a closure argument whose type
74 is specified by (and converted from an Ltac2 value via) [r]. *)
75 val (@->) :
76 'a repr ->
77 ('t,'f) spec ->
78 (valexpr -> 't, 'a -> 'f) spec
79
80 (** [(@-->)] is similar to [(@->)], but only needs a conversion function. *)
81 val (@-->) :
82 (valexpr -> 'a) ->
83 ('t,'f) spec ->
84 (valexpr -> 't, 'a -> 'f) spec
85
86 (** [define tac s f] defines an external tactic [tac] by interpreting [f] with
87 the specification [s]. The [Invalid_argument] exception is raised when the
88 given [s] does not produce a "pure" tactic, that is, something that can be
89 turned into an Ltac2 value (i.e., a closure, or a pure value). *)
90 val define : Tac2expr.ml_tactic_name -> (_, 'f) spec -> 'f -> unit