Debian Codegraph @

plugins/ltac/taccoerce.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 Names
12 open EConstr
13 open Genarg
14 open Geninterp
15 open Tactypes
16
17 (** Coercions from highest level generic arguments to actual data used by Ltac
18 interpretation. Those functions examinate dynamic types and try to return
19 something sensible according to the object content. *)
20
21 exception CannotCoerceTo of string
22 (** Exception raised whenever a coercion failed. *)
23
24 (** Abstract application, to print ltac functions *)
25 type appl =
26 | UnnamedAppl (** For generic applications: nothing is printed *)
27 | GlbAppl of (Names.KerName.t * Val.t list) list
28 (** For calls to global constants, some may alias other. *)
29
30 type tacvalue =
31 | VFun of appl * Tacexpr.ltac_trace * Loc.t option * Val.t Id.Map.t *
32 Name.t list * Tacexpr.glob_tactic_expr
33 | VRec of Val.t Id.Map.t ref * Tacexpr.glob_tactic_expr
34
35 (** {5 High-level access to values}
36
37 The [of_*] functions cast a given argument into a value. The [to_*] do the
38 converse, and return [None] if there is a type mismatch.
39
40 *)
41
42 module Value :
43 sig
44 type t = Val.t
45
46 val of_tacvalue : tacvalue -> t
47 val to_tacvalue : t -> tacvalue option
48 val of_constr : constr -> t
49 val to_constr : t -> constr option
50 val of_uconstr : Ltac_pretype.closed_glob_constr -> t
51 val to_uconstr : t -> Ltac_pretype.closed_glob_constr option
52 val of_constr_context : Constr_matching.context -> t
53 val to_constr_context : t -> Constr_matching.context option
54 val of_int : int -> t
55 val to_int : t -> int option
56 val of_ident : Id.t -> t
57 val to_ident : t -> Id.t option
58 val to_list : t -> t list option
59 val to_option : t -> t option option
60 val to_pair : t -> (t * t) option
61 val cast : 'a typed_abstract_argument_type -> Geninterp.Val.t -> 'a
62
63 val of_constr_under_binders : Ltac_pretype.constr_under_binders -> t
64 (* No [to_constr_under_binders], use [coerce_to_constr] instead *)
65 end
66
67 (** {5 Coercion functions} *)
68
69 val coerce_to_constr_context : Value.t -> Constr_matching.context
70
71 val coerce_var_to_ident : bool -> Environ.env -> Evd.evar_map -> Value.t -> Id.t
72
73 val coerce_to_ident_not_fresh : Evd.evar_map -> Value.t -> Id.t
74
75 val coerce_to_intro_pattern : Evd.evar_map -> Value.t -> delayed_open_constr intro_pattern_expr
76
77 val coerce_to_intro_pattern_naming :
78 Evd.evar_map -> Value.t -> Namegen.intro_pattern_naming_expr
79
80 val coerce_to_hint_base : Value.t -> string
81
82 val coerce_to_int : Value.t -> int
83
84 val coerce_to_constr : Environ.env -> Value.t -> Ltac_pretype.constr_under_binders
85
86 val coerce_to_uconstr : Value.t -> Ltac_pretype.closed_glob_constr
87
88 val coerce_to_closed_constr : Environ.env -> Value.t -> constr
89
90 val coerce_to_evaluable_ref :
91 Environ.env -> Evd.evar_map -> Value.t -> Evaluable.t
92
93 val coerce_to_constr_list : Environ.env -> Value.t -> constr list
94
95 val coerce_to_intro_pattern_list :
96 ?loc:Loc.t -> Evd.evar_map -> Value.t -> Tacexpr.intro_patterns
97
98 val coerce_to_hyp : Environ.env -> Evd.evar_map -> Value.t -> Id.t
99
100 val coerce_to_hyp_list : Environ.env -> Evd.evar_map -> Value.t -> Id.t list
101
102 val coerce_to_reference : Evd.evar_map -> Value.t -> GlobRef.t
103
104 val coerce_to_quantified_hypothesis : Evd.evar_map -> Value.t -> quantified_hypothesis
105
106 val coerce_to_decl_or_quant_hyp : Evd.evar_map -> Value.t -> quantified_hypothesis
107
108 val coerce_to_int_list : Value.t -> int list
109
110 val error_ltac_variable : ?loc:Loc.t -> Id.t ->
111 (Environ.env * Evd.evar_map) option -> Value.t -> string -> 'a
112
113 val pr_value : (Environ.env * Evd.evar_map) option -> Geninterp.Val.t -> Pp.t