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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
|
open Names
open Declarations
open Constrexpr
type coq_expr
val interp_open_coq_expr : Environ.env -> Evd.evar_map ->
coq_expr -> EConstr.constr
val hole : coq_expr
val debug_coq_expr : coq_expr -> unit
type var
val var_of_id : Id.t -> var
val id_of_var : var -> Id.t
val var_to_string : var -> string
val inject_var : string -> var
val gVar : var -> coq_expr
val gInject : string -> coq_expr
val gType0 : coq_expr
type ty_param
val ty_param_to_string : ty_param -> string
val inject_ty_param : string -> ty_param
val gTyParam : ty_param -> coq_expr
type ty_ctr
val ty_ctr_to_string : ty_ctr -> string
val gInjectTyCtr : string -> ty_ctr
val gTyCtr : ty_ctr -> coq_expr
val tyCtrToQualid : ty_ctr -> Libnames.qualid
type arg
val gArg : ?assumName:coq_expr ->
?assumType:coq_expr ->
?assumImplicit:bool ->
?assumGeneralized:bool ->
unit -> arg
val arg_to_var : arg -> var
val str_lst_to_string : string -> string list -> string
type coq_type =
| Arrow of coq_type * coq_type
| TyCtr of ty_ctr * coq_type list
| TyParam of ty_param
val coq_type_size : coq_type -> int
val coq_type_to_string : coq_type -> string
type constructor
val constructor_to_string : constructor -> string
val gCtr : constructor -> coq_expr
val injectCtr : string -> constructor
val ty_ctr_to_ctr : ty_ctr -> constructor
val ctr_to_ty_ctr : constructor -> ty_ctr
module type Ord_ty_ctr_type = sig
type t = ty_ctr
val compare : t -> t -> int
end
module Ord_ty_ctr : Ord_ty_ctr_type
module type Ord_ctr_type = sig
type t = constructor
val compare : t -> t -> int
end
module Ord_ctr : Ord_ctr_type
val num_of_ctrs : constructor -> int
val belongs_to_inductive : constructor -> bool
type ctr_rep = constructor * coq_type
val ctr_rep_to_string : ctr_rep -> string
(* single dt_rep *)
type sdt_rep = ty_ctr * ty_param list * ctr_rep list
type dt_rep = sdt_rep list
val sdt_rep_to_string : sdt_rep -> string
val dt_rep_to_string : dt_rep -> string
(* Supertype of coq_type handling potentially dependent stuff - TODO : merge *)
type dep_type =
| DArrow of dep_type * dep_type (* Unnamed arrows *)
| DProd of (var * dep_type) * dep_type (* Binding arrows *)
| DTyParam of ty_param (* Type parameters - for simplicity *)
| DTyCtr of ty_ctr * dep_type list (* Type Constructor *)
| DCtr of constructor * dep_type list (* Type Constructor *)
| DTyVar of var (* Use of a previously captured type variable *)
| DApp of dep_type * dep_type list (* Type-level function applications *)
| DNot of dep_type (* Negation as a toplevel *)
| DHole (* For adding holes *)
module OrdDepType : sig
type t = dep_type
val compare : t -> t -> int
end
val dep_type_to_string : dep_type -> string
type dep_ctr = constructor * dep_type
val dep_ctr_to_string : dep_ctr -> string
type dep_dt = ty_ctr * ty_param list * dep_ctr list * dep_type
val dep_dt_to_string : dep_dt -> string
val constr_of_type : string -> ty_param list -> dep_type -> Constr.t
val gType : ty_param list -> dep_type -> coq_expr
val gType' : ty_param list -> dep_type -> coq_expr
val get_type : Id.t -> unit
val is_inductive : constructor -> bool
val is_inductive_dt : dep_type -> bool
val nthType : int -> dep_type -> dep_type
val dep_type_len : dep_type -> int
val dep_result_type : dep_type -> dep_type
(* option type helpers *)
val option_map : ('a -> 'b) -> 'a option -> 'b option
val (>>=) : 'a option -> ('a -> 'b option) -> 'b option
val isSome : 'a option -> bool
val cat_maybes : 'a option list -> 'a list
val foldM : ('b -> 'a -> 'b option) -> 'b option -> 'a list -> 'b option
val sequenceM : ('a -> 'b option) -> 'a list -> 'b list option
(* legacy function which fails on mutually inductive definitions *)
val sdt_rep_from_mib : mutual_inductive_body -> sdt_rep option
val qualid_to_mib : Libnames.qualid -> mutual_inductive_body
val dt_rep_from_mib : mutual_inductive_body -> dt_rep option
val coerce_reference_to_dt_rep : constr_expr -> dt_rep option
val parse_dependent_type : Constr.constr -> dep_type option
val dep_dt_from_mib : mutual_inductive_body -> dep_dt option
val coerce_reference_to_dep_dt : constr_expr -> dep_dt option
val fresh_name : string -> var
val make_up_name : unit -> var
(* Generic Combinators *)
val gApp : ?explicit:bool -> coq_expr -> coq_expr list -> coq_expr
val gFun : string list -> (var list -> coq_expr) -> coq_expr
val gRecFunIn : ?structRec:(var option) -> ?assumType:coq_expr -> string -> string list -> ((var * var list) -> coq_expr) -> (var -> coq_expr) -> coq_expr
val gLetIn : string -> coq_expr -> (var -> coq_expr) -> coq_expr
(* TODO: HOAS-ify *)
val gLetTupleIn : var -> var list -> coq_expr -> coq_expr
val gMatch : coq_expr -> ?catchAll:(coq_expr option) -> ?params:(int) -> ((constructor * string list * (var list -> coq_expr)) list) -> coq_expr
val gMatchReturn : coq_expr -> ?catchAll:(coq_expr option) -> string -> (var -> coq_expr) ->
((constructor * string list * (var list -> coq_expr)) list) -> coq_expr
val gRecord : (string * coq_expr) list -> coq_expr
val gAnnot : coq_expr -> coq_expr -> coq_expr
val gFunTyped : (string * coq_expr) list -> (var list -> coq_expr) -> coq_expr
val gFunWithArgs : arg list -> ((var list) -> coq_expr) -> coq_expr
val gRecFunInWithArgs : ?structRec:(var option) -> ?assumType:coq_expr -> string -> arg list -> ((var * var list) -> coq_expr) -> (var -> coq_expr) -> coq_expr
val gProdWithArgs : arg list -> ((var list) -> coq_expr) -> coq_expr
(* Specialized Pattern Matching *)
type matcher_pat =
| MatchCtr of constructor * matcher_pat list
| MatchU of var
| MatchParameter of ty_param (* Should become hole in pattern, so no binding *)
val matcher_pat_to_string : matcher_pat -> string
val construct_match : coq_expr -> ?catch_all:(coq_expr option) -> (matcher_pat * coq_expr) list -> coq_expr
val construct_match_with_return : coq_expr -> ?catch_all:(coq_expr option) ->
string -> (var -> coq_expr) -> (matcher_pat * coq_expr) list -> coq_expr
(* Generic List Manipulations *)
val list_nil : coq_expr
val lst_append : coq_expr -> coq_expr -> coq_expr
val lst_appends : coq_expr list -> coq_expr
val gCons : coq_expr -> coq_expr -> coq_expr
val gList : coq_expr list -> coq_expr
(* Generic String Manipulations *)
val gStr : string -> coq_expr
val emptyString : coq_expr
val str_append : coq_expr -> coq_expr -> coq_expr
val str_appends : coq_expr list -> coq_expr
val smart_paren : coq_expr -> coq_expr
(* Pair *)
val gPair : coq_expr * coq_expr -> coq_expr
val gProd : coq_expr * coq_expr -> coq_expr
val listToPairAux : (('a *'a) -> 'a) -> ('a list) -> 'a
val gTuple : coq_expr list -> coq_expr
val gTupleType : coq_expr list -> coq_expr
val dtTupleType : dep_type list -> dep_type
(* Int *)
val gInt : int -> coq_expr
val gSucc : coq_expr -> coq_expr
val maximum : coq_expr list -> coq_expr
val glt : coq_expr -> coq_expr -> coq_expr
val gle : coq_expr -> coq_expr -> coq_expr
(* Eq *)
val gEq : coq_expr -> coq_expr -> coq_expr
(* Maybe *)
val gOption : coq_expr -> coq_expr
val gNone : coq_expr -> coq_expr
val gSome : coq_expr -> coq_expr -> coq_expr
val gNone' : coq_expr
val gSome' : coq_expr -> coq_expr
(* boolean *)
val gNot : coq_expr -> coq_expr
val g_true : coq_expr
val g_false : coq_expr
val decToBool : coq_expr -> coq_expr
val decOptToBool : coq_expr -> coq_expr
val gBool : coq_expr
val gIf : coq_expr -> coq_expr -> coq_expr -> coq_expr
(* list *)
(* unit *)
val gUnit : coq_expr
val gTT : coq_expr
(* dec *)
val g_dec : coq_expr -> coq_expr
val g_decOpt : coq_expr -> coq_expr -> coq_expr
val g_dec_decOpt : coq_expr
(* checker *)
val g_checker : coq_expr -> coq_expr
(* (\* Gen combinators *\) *)
val g_forAll : coq_expr -> coq_expr -> coq_expr
val g_arbitrary : coq_expr
val g_quickCheck : coq_expr -> coq_expr
val g_show : coq_expr -> coq_expr
(* val gGen : coq_expr -> coq_expr *)
(* val returnGen : coq_expr -> coq_expr *)
(* val bindGen : coq_expr -> string -> (var -> coq_expr) -> coq_expr *)
(* val bindGenOpt : coq_expr -> string -> (var -> coq_expr) -> coq_expr *)
(* val oneof : coq_expr list -> coq_expr *)
(* val frequency : (coq_expr * coq_expr) list -> coq_expr *)
(* val backtracking : (coq_expr * coq_expr) list -> coq_expr *)
(* val uniform_backtracking : coq_expr list -> coq_expr *)
(* Recursion combinators / fold *)
val fold_ty : ('a -> coq_type -> 'a) -> (ty_ctr * coq_type list -> 'a) -> (ty_param -> 'a) -> coq_type -> 'a
val fold_ty' : ('a -> coq_type -> 'a) -> 'a -> coq_type -> 'a
val dep_fold_ty : ('a -> dep_type -> 'a) -> ('a -> var -> dep_type -> 'a) ->
(ty_ctr * dep_type list -> 'a) -> (constructor * dep_type list -> 'a) ->
(ty_param -> 'a) -> (var -> 'a) -> dep_type -> 'a
(* Generate Type Names *)
val generate_names_from_type : string -> coq_type -> string list
val fold_ty_vars : (var list -> var -> coq_type -> 'a) -> ('a -> 'a -> 'a) -> 'a -> coq_type -> var list -> 'a
(* val defineConstant : string -> coq_expr -> var
val defineTypedConstant : string -> coq_expr -> coq_expr -> var *)
val declare_class_instance
: ?global:bool -> ?priority:int
-> arg list -> string -> (var list -> coq_expr) -> (var list -> coq_expr)
-> unit
val define_new_inductive : dep_dt -> unit
val define_new_fixpoint :
(var * arg list * var * coq_expr * coq_expr) list -> unit
(* List utils *)
val list_last : 'a list -> 'a
val list_init : 'a list -> 'a list
val list_drop_every : int -> 'a list -> 'a list
val take_last : 'a list -> 'a list -> ('a list * 'a)
val list_insert_nth : 'a -> 'a list -> int -> 'a list
val sameTypeCtr : ty_ctr -> coq_type -> bool
val isBaseBranch : ty_ctr -> coq_type -> bool
val find_typeclass_bindings : string -> ty_ctr -> (bool list) list
|