-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathlifting.mli
More file actions
104 lines (86 loc) · 2.76 KB
/
lifting.mli
File metadata and controls
104 lines (86 loc) · 2.76 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
(*
* Datatypes for promotions and lifting
*)
open Constr
open Environ
open Evd
open Promotion
open Stateutils
(* --- Datatypes --- *)
(*
* A lifting is an ornamental promotion between types and a direction,
* This is a convenience configuration for lifting functions and proofs,
* which wraps the promotion with extra useful information.
*)
type lifting =
{
orn : promotion;
is_fwd : bool;
}
(* --- Initialization --- *)
(*
* Initialize a lifting for a cached equivalence, given (in order):
* 1) an environment
* 2) an evar_map
* 3) the old type
* 4) the new type
*)
val initialize_lifting_cached :
env -> evar_map -> types -> types -> lifting state
(*
* Initialize a lifting for a user-supplied equivalence, given (in order):
* 1) an environment
* 2) an evar_map
* 3) the old and new types
* 4) the old and new user-supplied equivalence functions
* 5) a boolean flag if it is a custom kind of equivalence
*)
val initialize_lifting_provided :
env -> evar_map -> types * types -> constr * constr -> bool -> lifting state
(* --- Control structures --- *)
(*
* These two functions determine what function to use to go back to
* an old type or get to a new type when lifting
*)
val lift_back : lifting -> types
val lift_to : lifting -> types
(* Other control structures *)
val directional : lifting -> 'a -> 'a -> 'a
val map_directional : ('a -> 'b) -> ('a -> 'b) -> lifting -> 'a -> 'b
val map_forward : ('a -> 'a) -> lifting -> 'a -> 'a
val map_backward : ('a -> 'a) -> lifting -> 'a -> 'a
(* --- Information retrieval --- *)
(*
* Given the type of an ornamental promotion function, get the types
* that the function maps between, including all of their arguments.
* It is up to the client to adjust the offsets appropriately.
*)
val promotion_type_to_types : types -> (types * types)
(*
* Determine whether a type is the type we are ornamenting from
* (A in forward direction, B in backward direction) using unification.
* We optimize this in liftconfig.ml depending on the kind of ornament.
*)
val e_is_from :
env ->
types -> (* eta-expanded A or B, depending on direction *)
types -> (* type we are checking *)
evar_map ->
((constr list) option) state
(* --- Directionality --- *)
(*
* Flip the direction of a lifting
*)
val flip_dir : lifting -> lifting
(*
* Apply a function twice, once in each direction.
* Compose the result into a tuple.
*)
val twice_directional : (lifting -> 'a) -> lifting -> ('a * 'a)
(* --- Indexing for algebraic ornaments --- *)
(*
* Insert/remove the index at the appropriate offset.
* Raise NotAlgebraic if not an algebraic ornament.
*)
val index : lifting -> constr -> constr list -> constr list
val deindex : lifting -> constr list -> constr list