package rocq-runtime
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=051f7bf702ff0a3b370449728921e5a95e18bc2b31b8eb949d48422888c98af4
doc/rocq-runtime.engine/Termops/index.html
Module TermopsSource
This file defines various utilities for term manipulation that are not needed in the kernel.
val push_rel_assum :
(Names.Name.t EConstr.binder_annot * EConstr.types) ->
Environ.env ->
Environ.envabout contexts
val push_rels_assum :
(Names.Name.t Constr.binder_annot * Constr.types) list ->
Environ.env ->
Environ.envval push_named_rec_types :
(Names.Name.t Constr.binder_annot array * Constr.types array * 'a) ->
Environ.env ->
Environ.envAssociates the contents of an identifier in a rel_context. Raise Not_found if there is no such identifier.
Functions that build argument lists matching a block of binders or a context. rel_vect n m builds |Rel (n+m);...;Rel(n+1)|
Prod/Lambda/LetIn destructors on econstr
val it_mkProd :
EConstr.types ->
(Names.Name.t EConstr.binder_annot * EConstr.types) list ->
EConstr.typesval it_mkLambda :
EConstr.constr ->
(Names.Name.t EConstr.binder_annot * EConstr.types) list ->
EConstr.constrval it_mkNamedProd_or_LetIn :
Evd.evar_map ->
EConstr.types ->
EConstr.named_context ->
EConstr.typesval it_mkNamedLambda_or_LetIn :
Evd.evar_map ->
EConstr.constr ->
EConstr.named_context ->
EConstr.constrProd/Lambda/LetIn destructors on constr
Generic iterators on constr
val map_constr_with_binders_left_to_right :
Environ.env ->
Evd.evar_map ->
(EConstr.rel_declaration -> 'a -> 'a) ->
('a -> EConstr.constr -> EConstr.constr) ->
'a ->
EConstr.constr ->
EConstr.constrval map_constr_with_full_binders :
Environ.env ->
Evd.evar_map ->
(EConstr.rel_declaration -> 'a -> 'a) ->
('a -> EConstr.constr -> EConstr.constr) ->
'a ->
EConstr.constr ->
EConstr.constrval fold_constr_with_full_binders :
Environ.env ->
Evd.evar_map ->
(EConstr.rel_declaration -> 'a -> 'a) ->
('a -> 'b -> EConstr.constr -> 'b) ->
'a ->
'b ->
EConstr.constr ->
'boccur checks
val occur_var_indirectly :
Environ.env ->
Evd.evar_map ->
Names.Id.t ->
EConstr.constr ->
Names.GlobRef.t optionval occur_var_in_decl :
Environ.env ->
Evd.evar_map ->
Names.Id.t ->
EConstr.named_declaration ->
boolval occur_vars_in_decl :
Environ.env ->
Evd.evar_map ->
Names.Id.Set.t ->
EConstr.named_declaration ->
boolAs occur_var but assume the identifier not to be a section variable
val free_rels_and_unqualified_refs :
Evd.evar_map ->
EConstr.constr ->
Int.Set.t * Names.Id.Set.tdependent m t tests whether m is a subterm of t
for visible vars only
Type assignment for metavariables
pop c lifts by -1 the positive indexes in c
...
Substitution of an arbitrary large term. Uses equality modulo reduction of let
val replace_term_gen :
Evd.evar_map ->
(Evd.evar_map -> int -> EConstr.constr -> bool) ->
int ->
EConstr.constr ->
EConstr.constr ->
EConstr.constrreplace_term_gen eq arity e c replaces matching subterms according to eq by e in c. If arity is non-zero applications of larger length are handled atomically.
subst_term d c replaces d by Rel 1 in c
val replace_term :
Evd.evar_map ->
EConstr.constr ->
EConstr.constr ->
EConstr.constr ->
EConstr.constrreplace_term d e c replaces d by e in c
Alternative term equalities
val compare_constr_univ :
Environ.env ->
Evd.evar_map ->
(Conversion.conv_pb -> EConstr.constr -> EConstr.constr -> bool) ->
Conversion.conv_pb ->
EConstr.constr ->
EConstr.constr ->
boolval constr_cmp :
Environ.env ->
Evd.evar_map ->
Conversion.conv_pb ->
EConstr.constr ->
EConstr.constr ->
boolprod_applist forall (x1:B1;...;xn:Bn), B a1...an
val prod_applist_decls :
Evd.evar_map ->
int ->
EConstr.constr ->
EConstr.constr list ->
EConstr.constrIn prod_applist_decls n c args, c is supposed to have the form ∀Γ.c with Γ of length m and possibly with let-ins; it returns c with the assumptions of Γ instantiated by args and the local definitions of Γ expanded. Note that n counts both let-ins and prods, while the length of args only counts prods. In other words, varying n changes how many trailing let-ins are expanded.
Remove recursively the casts around a term i.e. strip_outer_cast (Cast (Cast ... (Cast c, t) ... )) is c.
nb_lam $ x_1:T_1...x_n:T_nc $ where $ c $ is not an abstraction gives $ n $ (casts are ignored)
Similar to nb_lam, but gives the number of products instead
Similar to nb_prod, but zeta-contracts let-in on the way
Get the last arg of a constr intended to be an application
val adjust_app_list_size :
EConstr.constr ->
EConstr.constr list ->
EConstr.constr ->
EConstr.constr list ->
EConstr.constr * EConstr.constr list * EConstr.constr * EConstr.constr listval adjust_app_array_size :
EConstr.constr ->
EConstr.constr array ->
EConstr.constr ->
EConstr.constr array ->
EConstr.constr * EConstr.constr array * EConstr.constr * EConstr.constr arrayname contexts
Set of local names
val process_rel_context :
(EConstr.rel_declaration -> Environ.env -> Environ.env) ->
Environ.env ->
Environ.envother signature iterators
val assums_of_rel_context :
('c, 't, 'r) Context.Rel.pt ->
((Names.Name.t, 'r) Context.pbinder_annot * 't) listval map_rel_context_with_binders :
(int -> 'c -> 'c) ->
('c, 'c, 'r) Context.Rel.pt ->
('c, 'c, 'r) Context.Rel.ptval map_rel_context_in_env :
(Environ.env -> Constr.constr -> Constr.constr) ->
Environ.env ->
Constr.rel_context ->
Constr.rel_contextval fold_named_context_both_sides :
('a -> Constr.named_declaration -> Constr.named_declaration list -> 'a) ->
Constr.named_context ->
init:'a ->
'aval compact_named_context :
Evd.evar_map ->
EConstr.named_context ->
EConstr.compacted_contextval map_rel_decl :
('r1 -> 'r2) ->
('a -> 'b) ->
('a, 'a, 'r1) Context.Rel.Declaration.pt ->
('b, 'b, 'r2) Context.Rel.Declaration.ptval map_named_decl :
('r1 -> 'r2) ->
('a -> 'b) ->
('a, 'a, 'r1) Context.Named.Declaration.pt ->
('b, 'b, 'r2) Context.Named.Declaration.ptval global_vars_set_of_decl :
Environ.env ->
Evd.evar_map ->
EConstr.named_declaration ->
Names.Id.Set.tval global_app_of_constr :
Evd.evar_map ->
EConstr.constr ->
(Names.GlobRef.t * EConstr.EInstance.t) * EConstr.constr optionval dependency_closure :
Environ.env ->
Evd.evar_map ->
EConstr.named_context ->
Names.Id.Set.t ->
Names.Id.t listGives an ordered list of hypotheses, closed by dependencies, containing a given set
Test if an identifier is the basename of a global reference
val global_of_constr :
Evd.evar_map ->
EConstr.constr ->
Names.GlobRef.t * EConstr.EInstance.tDebug pretty-printers
val pr_evar_map_filter :
?with_univs:bool ->
(Evar.t -> Evd.any_evar_info -> bool) ->
Environ.env ->
Evd.evar_map ->
Pp.tNOTE: to print terms you always want to use functions in Printer, not these ones which are for very special cases.