Debian Codegraph @

pretyping/combinators.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 Environ
12 open Evd
13 open EConstr
14
15 (** [telescope env sigma ctx] turns a context [x1:A1;...;xn:An] into a
16 right-associated nested sigma-type of the right sort. It returns:
17 - the nested sigma-type [T := {x1:A1 & ... {xn-1:An-1 & ... An} ... }]
18 - the canonical tuple [(existsT _ x1 ... (existsT _ xn-1 xn) ...)]
19 inhabiting the sigma-type in the given context
20 - an instantiation of the assumptions of [ctx] with values they
21 have in the context [x:T], that is
22 [x1:=projT1 x;...;xn-1:=projT1 ... (projT2 x);xn:=projT2 ... (projT2 x)];
23 note that let-ins in the original context are preserved
24 Depending on the sorts of types, it uses either [ex], [sig] or
25 [sigT], even if we always used [sigT] above as an example.
26 *)
27
28 type telescope = {
29 telescope_type : types;
30 telescope_value : constr;
31 }
32
33 val telescope : env -> evar_map -> rel_context -> evar_map * rel_context * telescope
34
35 (** [make_iterated_tuple env sigma ~default c] encapsulates [c] (of
36 inferred type [C]) and its free variables [x1,...,xn] into a
37 right-associated nested tuple in a [sigT]-type. It returns:
38 - the nested type [{x1:A1 & ... {xn:An & ... C} ... }]
39 - the tuple [(existsT _ x1 ... (existsT _ xn c) ...)]
40 - an alternative tuple [(existsT _ x1 ... (existsT _ xn default) ...)];
41 if [default] has not the right type, it fails.
42 *)
43
44 val make_iterated_tuple : env -> evar_map -> default:constr -> constr -> types -> evar_map * telescope * constr
45
46 (** [make_selector env sigma ~pos ~special ~default c] constructs a
47 case-split on [c] (assumed of inductive type), with the [pos]-th
48 branch returning [special], and all the other branch returning
49 [default]. *)
50
51 val make_selector : env -> evar_map -> pos:int -> special:constr -> default:constr -> constr -> types -> constr