package coq

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Translation from front abstract syntax of term to untyped terms (glob_constr)

The translation performs:

  • resolution of names :
  • check all variables are bound
  • make absolute the references to global objets
  • resolution of symbolic notations using scopes
  • insertion of implicit arguments

To interpret implicit arguments and arg scopes of recursive variables while internalizing inductive types and recursive definitions, and also projection while typing records.

the third and fourth arguments associate a list of implicit positions and scopes to identifiers declared in the rel_context of env

type var_internalization_type =
  1. | Inductive
  2. | Recursive
  3. | Method
  4. | Variable
type var_internalization_data

This collects relevant information for interning local variables:

  • their coqdoc kind (a recursive call in a inductive, fixpoint of class; or a bound variable) e.g. while typing the constructor of JMeq, "JMeq" behaves as a variable of type Inductive
  • their implicit arguments
  • their argument scopes
type internalization_env = var_internalization_data Names.Id.Map.t

A map of free variables to their implicit arguments and scopes

val empty_internalization_env : internalization_env
type ltac_sign = {
  1. ltac_vars : Names.Id.Set.t;
    (*

    Variables of Ltac which may be bound to a term

    *)
  2. ltac_bound : Names.Id.Set.t;
    (*

    Other variables of Ltac

    *)
  3. ltac_extra : Genintern.Store.t;
    (*

    Arbitrary payload

    *)
}
val empty_ltac_sign : ltac_sign
Internalization performs interpretation of global names and notations
Composing internalization with type inference (pretyping)

Main interpretation functions, using type class inference, expecting evars and pending problems to be all resolved

Main interpretation function expecting all postponed problems to be resolved, but possibly leaving evars.

Accepting unresolved evars

val interp_constr_evars : ?program_mode:bool -> Environ.env -> Evd.evar_map -> ?impls:internalization_env -> Constrexpr.constr_expr -> Evd.evar_map * EConstr.constr
val interp_casted_constr_evars : ?program_mode:bool -> Environ.env -> Evd.evar_map -> ?impls:internalization_env -> Constrexpr.constr_expr -> EConstr.types -> Evd.evar_map * EConstr.constr
val interp_type_evars : ?program_mode:bool -> Environ.env -> Evd.evar_map -> ?impls:internalization_env -> Constrexpr.constr_expr -> Evd.evar_map * EConstr.types

Accepting unresolved evars and giving back the manual implicit arguments

val interp_constr_evars_impls : ?program_mode:bool -> Environ.env -> Evd.evar_map -> ?impls:internalization_env -> Constrexpr.constr_expr -> Evd.evar_map * (EConstr.constr * Impargs.manual_implicits)
val interp_casted_constr_evars_impls : ?program_mode:bool -> Environ.env -> Evd.evar_map -> ?impls:internalization_env -> Constrexpr.constr_expr -> EConstr.types -> Evd.evar_map * (EConstr.constr * Impargs.manual_implicits)

Interprets constr patterns

val intern_constr_pattern : Environ.env -> Evd.evar_map -> ?as_type:bool -> ?ltacvars:ltac_sign -> Constrexpr.constr_pattern_expr -> Pattern.patvar list * Pattern.constr_pattern

Without typing

With typing

val intern_reference : Libnames.qualid -> Names.GlobRef.t option

Returns None if it's a syndef not bound to a name, raises an error if not existing

val intern_name_alias : Constrexpr.constr_expr -> (Names.GlobRef.t * Glob_term.glob_level list option) option

Returns None if not a reference or a syndef not bound to a name

val interp_reference : ltac_sign -> Libnames.qualid -> Glob_term.glob_constr

Expands abbreviations (syndef); raise an error if not existing

Interpret binders

Interpret contexts: returns extended env and context

Interpret named contexts: returns context

Locating references of constructions, possibly via a syntactic definition (these functions do not modify the glob file)

val locate_reference : Libnames.qualid -> Names.GlobRef.t option
val is_global : Names.Id.t -> bool

Interprets a term as the left-hand side of a notation. The returned map is guaranteed to have the same domain as the input one.

Idem but to glob_constr (weaker check of binders)

val parsing_explicit : bool ref

Globalization options

val for_grammar : ('a -> 'b) -> 'a -> 'b

Globalization leak for Grammar

val get_asymmetric_patterns : unit -> bool

Placeholder for global option, should be moved to a parameter

val check_duplicate : ?loc:Loc.t -> (Libnames.qualid * Constrexpr.constr_expr) list -> unit

Check that a list of record field definitions doesn't contain duplicates.

val interp_known_level : Evd.evar_map -> Constrexpr.sort_name_expr -> Univ.Level.t

Local universe and constraint declarations.

BEWARE the variance entry needs to be adjusted by ComInductive.variance_of_entry if the instance is extensible.

OCaml

Innovation. Community. Security.