-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsigmautils.mli
84 lines (70 loc) · 1.43 KB
/
sigmautils.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
(*
* Utilities for sigma types
*)
open Constr
(* --- Constants --- *)
val sigT : types
val existT : types
val sigT_rect : types
val projT1 : types
val projT2 : types
(* --- Representations --- *)
(*
* An application of existT
*)
type existT_app =
{
index_type : types;
packer : types;
index : types;
unpacked : types;
}
(*
* Convert between a term and an existT_app
*)
val pack_existT : existT_app -> types
val dest_existT : types -> existT_app
(*
* An application of sigT
*)
type sigT_app =
{
index_type : types;
packer : types;
}
(*
* Convert between a term and a sigT_app
*)
val pack_sigT : sigT_app -> types
val dest_sigT : types -> sigT_app
(*
* Build the eta-expansion of a term known to have a sigma type.
*)
val eta_sigT : constr -> types -> constr
(*
* An application of sigT_rect
*)
type sigT_elim =
{
to_elim : sigT_app;
packed_type : types;
unpacked : types;
arg : types;
}
(*
* Convert between a term and a sigT_elim
*)
val elim_sigT : sigT_elim -> types
val dest_sigT_elim : types -> sigT_elim
(*
* Left projection of a sigma type given a sigma type and term of that type
*)
val project_index : sigT_app -> types -> types
(*
* Right projection of a sigma type given a sigma type and term of that type
*)
val project_value : sigT_app -> types -> types
(*
* Both projections in an (index, value) tuple
*)
val projections : sigT_app -> types -> (types * types)