| 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 Names |
| 12 | open Libnames |
| 13 | open Tacexpr |
| 14 | open Geninterp |
| 15 | |
| 16 | (** This module centralizes the various ways of registering tactics. *) |
| 17 | |
| 18 | (** {5 Tactic naming} *) |
| 19 | |
| 20 | val push_tactic : Nametab.visibility -> full_path -> ltac_constant -> unit |
| 21 | val locate_tactic : qualid -> ltac_constant |
| 22 | val locate_extended_all_tactic : qualid -> ltac_constant list |
| 23 | val exists_tactic : full_path -> bool |
| 24 | val path_of_tactic : ltac_constant -> full_path |
| 25 | val shortest_qualid_of_tactic : ltac_constant -> qualid |
| 26 | |
| 27 | (** {5 Tactic notations} *) |
| 28 | |
| 29 | type alias = KerName.t |
| 30 | (** Type of tactic alias, used in the [TacAlias] node. *) |
| 31 | |
| 32 | type alias_tactic = |
| 33 | { alias_args: Id.t list; |
| 34 | alias_body: glob_tactic_expr; |
| 35 | alias_deprecation: Deprecation.t option; |
| 36 | } |
| 37 | (** Contents of a tactic notation *) |
| 38 | |
| 39 | val register_alias : alias -> alias_tactic -> unit |
| 40 | (** Register a tactic alias. *) |
| 41 | |
| 42 | val interp_alias : alias -> alias_tactic |
| 43 | (** Recover the body of an alias. Raises an anomaly if it does not exist. *) |
| 44 | |
| 45 | val check_alias : alias -> bool |
| 46 | (** Returns [true] if an alias is defined, false otherwise. *) |
| 47 | |
| 48 | (** {5 Rocq tactic definitions} *) |
| 49 | |
| 50 | val register_ltac : bool -> bool -> ?deprecation:Deprecation.t -> Id.t -> |
| 51 | glob_tactic_expr -> unit |
| 52 | (** Register a new Ltac with the given name and body. |
| 53 | |
| 54 | The first boolean indicates whether this is done from ML side, rather than |
| 55 | Rocq side. If the second boolean flag is set to true, then this is a local |
| 56 | definition. It also puts the Ltac name in the nametab, so that it can be |
| 57 | used unqualified. *) |
| 58 | |
| 59 | val redefine_ltac : Libobject.locality -> KerName.t -> glob_tactic_expr -> unit |
| 60 | (** Replace a Ltac with the given name and body. *) |
| 61 | |
| 62 | val interp_ltac : KerName.t -> glob_tactic_expr |
| 63 | (** Find a user-defined tactic by name. Raise [Not_found] if it is absent. *) |
| 64 | |
| 65 | val is_ltac_for_ml_tactic : KerName.t -> bool |
| 66 | (** Whether the tactic is defined from ML-side *) |
| 67 | |
| 68 | val tac_deprecation : KerName.t -> Deprecation.t option |
| 69 | (** The tactic deprecation notice, if any *) |
| 70 | |
| 71 | type ltac_entry = { |
| 72 | tac_for_ml : bool; |
| 73 | (** Whether the tactic is defined from ML-side *) |
| 74 | tac_body : glob_tactic_expr; |
| 75 | (** The current body of the tactic *) |
| 76 | tac_redef : ModPath.t list; |
| 77 | (** List of modules redefining the tactic in reverse chronological order *) |
| 78 | tac_deprecation : Deprecation.t option; |
| 79 | (** Deprecation notice to be printed when the tactic is used *) |
| 80 | } |
| 81 | |
| 82 | val ltac_entries : unit -> ltac_entry KerName.Map.t |
| 83 | (** Low-level access to all Ltac entries currently defined. *) |
| 84 | |
| 85 | (** {5 ML tactic extensions} *) |
| 86 | |
| 87 | type ml_tactic = |
| 88 | Val.t list -> Geninterp.interp_sign -> unit Proofview.tactic |
| 89 | (** Type of external tactics, used by [TacML]. *) |
| 90 | |
| 91 | val register_ml_tactic : ?overwrite:bool -> ml_tactic_name -> ml_tactic array -> unit |
| 92 | (** Register an external tactic. *) |
| 93 | |
| 94 | val interp_ml_tactic : ml_tactic_entry -> ml_tactic |
| 95 | (** Get the named tactic. Raises a user error if it does not exist. *) |