Debian Codegraph @

tactics/ind_tables.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 Constr
13
14 (** This module provides support for registering inductive scheme builders,
15 declaring schemes and generating schemes on demand *)
16
17 (** A scheme is either a "mutual scheme_kind" or an "individual scheme_kind" *)
18
19 type mutual
20 type individual
21 type 'a scheme_kind
22
23 type handle
24
25 val push_handle : handle -> unit Proofview.tactic
26
27 type scheme_dependency =
28 | SchemeMutualDep of MutInd.t * mutual scheme_kind
29 | SchemeIndividualDep of inductive * individual scheme_kind
30
31 type mutual_scheme_object_function =
32 Environ.env -> handle -> MutInd.t -> constr array Evd.in_ustate
33 type individual_scheme_object_function =
34 Environ.env -> handle -> inductive -> constr Evd.in_ustate
35
36 (** Main functions to register a scheme builder. Note these functions
37 are not safe to be used by plugins as their effects won't be undone
38 on backtracking.
39
40 In [declare_X_scheme_object key ?suff ?deps f], [key] is the name
41 of the scheme kind. It must be unique across the Rocq process's
42 lifetime. It is used to generate [scheme_kind] in a marshal-stable
43 way and as the scheme name in Register Scheme.
44
45 [suff] defaults to [key], generated schemes which aren't given an
46 explicit name will be named "ind_suff" where "ind" is the
47 inductive's name.
48 *)
49
50 val declare_mutual_scheme_object : string ->
51 ?suff:string ->
52 ?deps:(Environ.env -> MutInd.t -> scheme_dependency list) ->
53 mutual_scheme_object_function -> mutual scheme_kind
54
55 val declare_individual_scheme_object : string ->
56 ?suff:string ->
57 ?deps:(Environ.env -> inductive -> scheme_dependency list) ->
58 individual_scheme_object_function ->
59 individual scheme_kind
60
61 val is_declared_scheme_object : string -> bool
62 (** Is the string used as the name of a [scheme_kind]? *)
63
64 val scheme_kind_name : _ scheme_kind -> string
65 (** Name of a [scheme_kind]. Can be used to register with DeclareScheme. *)
66
67 (** Force generation of a (mutually) scheme with possibly user-level names *)
68
69 val define_individual_scheme : ?loc:Loc.t -> individual scheme_kind ->
70 Id.t option -> inductive -> unit
71
72 module Locmap : sig
73 type t
74
75 val default : Loc.t option -> t
76 val make
77 : ?default:Loc.t (* The default is the loc of the first inductive, if passed *)
78 -> Names.MutInd.t
79 -> Loc.t option list (* order must match the one of the inductives block *)
80 -> t
81 val lookup : locmap:t -> Names.inductive -> Loc.t option
82 end
83
84 val define_mutual_scheme : ?locmap:Locmap.t -> mutual scheme_kind ->
85 (int * Id.t) list -> MutInd.t -> unit
86
87 (** Main function to retrieve a scheme in the cache *)
88 val find_scheme : 'a scheme_kind -> inductive -> GlobRef.t option Proofview.tactic
89
90 (** Generates the scheme if not found *)
91 val force_find_scheme : 'a scheme_kind -> inductive -> GlobRef.t Proofview.tactic
92
93 (** Like [find_scheme] but does not generate a constant on the fly *)
94 val lookup_scheme : 'a scheme_kind -> inductive -> GlobRef.t option
95
96 (** To be used by scheme-generating functions when looking for a subscheme. *)
97 val local_lookup_scheme : handle -> 'a scheme_kind -> inductive -> GlobRef.t option
98
99 val pr_scheme_kind : 'a scheme_kind -> Pp.t
100
101 val declare_definition_scheme :
102 (univs:UState.named_universes_entry
103 -> role:Evd.side_effect_role
104 -> name:Id.t
105 -> effs:Evd.side_effects
106 -> Constr.t
107 -> Constant.t * Evd.side_effects) ref
108
109 val register_definition_scheme :
110 (internal:bool
111 -> name:Id.t
112 -> const:Constant.t
113 -> univs:UState.named_universes_entry
114 -> ?loc:Loc.t
115 -> unit
116 -> unit) ref