Debian Codegraph @

plugins/extraction/mlutil.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 Miniml
13 open Table
14
15 (*s Utility functions over ML types with meta. *)
16
17 val reset_meta_count : unit -> unit
18 val new_meta : 'a -> ml_type
19
20 val type_subst_list : ml_type list -> ml_type -> ml_type
21 val type_subst_vect : ml_type array -> ml_type -> ml_type
22
23 val instantiation : ml_schema -> ml_type
24
25 val needs_magic : ml_type * ml_type -> bool
26 val put_magic_if : bool -> ml_ast -> ml_ast
27 val put_magic : ml_type * ml_type -> ml_ast -> ml_ast
28
29 val generalizable : ml_ast -> bool
30
31 (*s ML type environment. *)
32
33 module Mlenv : sig
34 type t
35 val empty : t
36
37 (* get the n-th more recently entered schema and instantiate it. *)
38 val get : t -> int -> ml_type
39
40 (* Adding a type in an environment, after generalizing free meta *)
41 val push_gen : t -> ml_type -> t
42
43 (* Adding a type with no [Tvar] *)
44 val push_type : t -> ml_type -> t
45
46 (* Adding a type with no [Tvar] nor [Tmeta] *)
47 val push_std_type : t -> ml_type -> t
48 end
49
50 (*s Utility functions over ML types without meta *)
51
52 val type_mem_kn : MutInd.t -> ml_type -> bool
53
54 val type_maxvar : ml_type -> int
55
56 val type_decomp : ml_type -> ml_type list * ml_type
57 val type_recomp : ml_type list * ml_type -> ml_type
58
59 val var2var' : ml_type -> ml_type
60
61 type abbrev_map = global -> ml_type option
62
63 val type_expand : abbrev_map -> ml_type -> ml_type
64 val type_simpl : ml_type -> ml_type
65 val type_to_sign : abbrev_map -> ml_type -> sign
66 val type_to_signature : abbrev_map -> ml_type -> signature
67 val type_expunge : abbrev_map -> ml_type -> ml_type
68 val type_expunge_from_sign : abbrev_map -> signature -> ml_type -> ml_type
69
70 val eq_ml_type : ml_type -> ml_type -> bool
71 val isTdummy : ml_type -> bool
72 val isMLdummy : ml_ast -> bool
73 val isKill : sign -> bool
74
75 val case_expunge : signature -> ml_ast -> ml_ident list * ml_ast
76 val term_expunge : signature -> ml_ident list * ml_ast -> ml_ast
77
78
79 (*s Special identifiers. [dummy_name] is to be used for dead code
80 and will be printed as [_] in concrete (Caml) code. *)
81
82 val anonymous_name : Id.t
83 val dummy_name : Id.t
84 val id_of_name : Name.t -> Id.t
85 val id_of_mlid : ml_ident -> Id.t
86 val tmp_id : ml_ident -> ml_ident
87
88 (*s [collect_lambda MLlam(id1,...MLlam(idn,t)...)] returns
89 the list [idn;...;id1] and the term [t]. *)
90
91 val collect_lams : ml_ast -> ml_ident list * ml_ast
92 val collect_n_lams : int -> ml_ast -> ml_ident list * ml_ast
93 val remove_n_lams : int -> ml_ast -> ml_ast
94 val nb_lams : ml_ast -> int
95 val named_lams : ml_ident list -> ml_ast -> ml_ast
96 val dummy_lams : ml_ast -> int -> ml_ast
97 val anonym_or_dummy_lams : ml_ast -> signature -> ml_ast
98
99 val eta_args_sign : int -> signature -> ml_ast list
100
101 (*s Utility functions over ML terms. *)
102
103 val mlapp : ml_ast -> ml_ast list -> ml_ast
104 val ast_map : (ml_ast -> ml_ast) -> ml_ast -> ml_ast
105 val ast_map_lift : (int -> ml_ast -> ml_ast) -> int -> ml_ast -> ml_ast
106 val ast_iter : (ml_ast -> unit) -> ml_ast -> unit
107 val ast_occurs : int -> ml_ast -> bool
108 val ast_occurs_itvl : int -> int -> ml_ast -> bool
109 val ast_lift : int -> ml_ast -> ml_ast
110 val ast_pop : ml_ast -> ml_ast
111 val ast_subst : ml_ast -> ml_ast -> ml_ast
112
113 val ast_glob_subst : ml_ast Refmap'.t -> ml_ast -> ml_ast
114
115 val dump_unused_vars : ml_ast -> ml_ast
116
117 val normalize : ml_ast -> ml_ast
118 val optimize_fix : ml_ast -> ml_ast
119 val inline : Table.t -> global -> ml_ast -> bool
120
121 val is_basic_pattern : ml_pattern -> bool
122 val has_deep_pattern : ml_branch array -> bool
123 val is_regular_match : ml_branch array -> bool
124
125 exception Impossible
126
127 (* Classification of signatures *)
128
129 type sign_kind =
130 | EmptySig
131 | NonLogicalSig (* at least a [Keep] *)
132 | SafeLogicalSig (* only [Kill Ktype] *)
133 | UnsafeLogicalSig (* No [Keep], not all [Kill Ktype] *)
134
135 val sign_kind : signature -> sign_kind
136
137 val sign_no_final_keeps : signature -> signature