Debian Codegraph @

interp/notation_ops.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 Notation_term
13 open Glob_term
14
15 (** Constr default entries *)
16
17 (* Equivalent to an entry "in constr at level 0"; used for coercion to constr *)
18 val constr_lowest_level : Constrexpr.notation_entry_level
19
20 (* Equivalent to "x constr" in a subentry, at highest level *)
21 val constr_some_level : Constrexpr.notation_entry_relative_level
22
23 (** {5 Utilities about [notation_constr]} *)
24
25 val eq_notation_constr : Id.t list * Id.t list -> notation_constr -> notation_constr -> bool
26
27 val strictly_finer_notation_constr : Id.t list * Id.t list -> notation_constr -> notation_constr -> bool
28 (** Tell if [t1] is a strict refinement of [t2]
29 (this is a partial order and returning [false] does not mean that
30 [t2] is finer than [t1]) *)
31
32 val strictly_finer_interpretation_than : interpretation -> interpretation -> bool
33 (** Tell if a notation interpretation is strictly included in another one *)
34
35 val finer_interpretation_than : _ interpretation_gen -> _ interpretation_gen -> bool
36 (** Tell if a notation interpretation is included in another one *)
37
38 (** Substitution of kernel names in interpretation data *)
39
40 val subst_interpretation :
41 Mod_subst.substitution -> interpretation -> interpretation
42
43 (** Name of the special identifier used to encode recursive notations *)
44
45 val ldots_var : Id.t
46
47 (** {5 Translation back and forth between [glob_constr] and [notation_constr]} *)
48
49 (** Translate a [glob_constr] into a notation given the list of variables
50 bound by the notation; also interpret recursive patterns *)
51
52 val notation_constr_of_glob_constr : notation_interp_env ->
53 glob_constr -> notation_constr * reversibility_status
54
55 (** Re-interpret a notation as a [glob_constr], taking care of binders *)
56
57 type 'a binder_status_fun = {
58 no : 'a -> 'a;
59 restart_prod : 'a -> 'a;
60 restart_lambda : 'a -> 'a;
61 switch_prod : 'a -> 'a;
62 switch_lambda : 'a -> 'a;
63 slide : 'a -> 'a;
64 }
65
66 val apply_cases_pattern : ?loc:Loc.t ->
67 (Id.t list * cases_pattern_disjunction) * Id.t -> glob_constr -> glob_constr
68
69 val glob_constr_of_notation_constr_with_binders : ?loc:Loc.t ->
70 ('a -> Name.t -> glob_constr option -> 'a * ((Id.t list * cases_pattern_disjunction) * Id.t) option * Name.t * Glob_term.binding_kind * glob_constr option) ->
71 ('a -> notation_constr -> glob_constr) -> ?h:'a binder_status_fun ->
72 'a -> notation_constr -> glob_constr
73
74 val glob_constr_of_notation_constr : ?loc:Loc.t -> notation_constr -> glob_constr
75
76 val pr_notation_info :
77 (Glob_term.glob_constr -> Pp.t) -> Constrexpr.notation_key -> Notation_term.notation_constr -> Pp.t
78
79 (** {5 Matching a notation pattern against a [glob_constr]} *)
80
81 (** [match_notation_constr] matches a [glob_constr] against a notation
82 interpretation; raise [No_match] if the matching fails *)
83
84 exception No_match
85
86 val match_notation_constr : print_parentheses:bool ->
87 factorize_eqns:PrintingFlags.Extern.FactorizeEqns.t ->
88 'a glob_constr_g -> vars:Id.Set.t -> interpretation ->
89 ((Id.Set.t * 'a glob_constr_g) * extended_subscopes) list *
90 ((Id.Set.t * 'a glob_constr_g list) * extended_subscopes) list *
91 ((Id.Set.t * 'a cases_pattern_disjunction_g) * extended_subscopes) list *
92 ((Id.Set.t * 'a extended_glob_local_binder_g list) * extended_subscopes) list
93
94 val match_notation_constr_cases_pattern :
95 'a cases_pattern_g -> interpretation ->
96 (('a cases_pattern_g * extended_subscopes) list *
97 ('a cases_pattern_g list * extended_subscopes) list *
98 ('a cases_pattern_g * extended_subscopes) list) *
99 (bool * int * 'a cases_pattern_g list)
100
101 val match_notation_constr_ind_pattern :
102 inductive -> 'a cases_pattern_g list -> interpretation ->
103 (('a cases_pattern_g * extended_subscopes) list *
104 ('a cases_pattern_g list * extended_subscopes) list *
105 ('a cases_pattern_g * extended_subscopes) list) *
106 (bool * int * 'a cases_pattern_g list)