package lambdapi

  1. Overview
  2. Docs

Module Core.SignSource

Signature for symbols.

Sourcetype ind_data = {
  1. ind_cons : Term.sym list;
    (*

    Constructors.

    *)
  2. ind_prop : Term.sym;
    (*

    Induction principle.

    *)
  3. ind_nb_params : int;
    (*

    Number of parameters.

    *)
  4. ind_nb_types : int;
    (*

    Number of mutually defined types.

    *)
  5. ind_nb_cons : int;
    (*

    Number of constructors.

    *)
}

Data associated to inductive types.

Sourcetype sym_data = {
  1. rules : Term.rule list;
  2. nota : float Term.notation option;
}

Rules and notation added to an external symbol.

Sourcetype dep_data = {
  1. dep_symbols : sym_data Lplib.Extra.StrMap.t;
  2. dep_open : bool;
}

Data associated to a dependency.

Representation of a signature, that is, what is introduced by a module/file. Signatures must be created with the functions create or read below only.

Sourceval mem : t -> string -> bool

mem sign name checks whether a symbol named name exists in sign.

Sourceval find : t -> string -> Term.sym

find sign name finds the symbol named name in signature sign if it exists, and raises the Not_found exception otherwise.

loaded stores the signatures of the known (already compiled or currently being compiled) modules. The current module is stored in loaded so that the symbols that it contains can be qualified with the name of the module. This behavior was inherited from previous versions of Dedukti.

Sourceval find_qualified : Common.Path.t -> string -> Term.sym

find_qualified path name returns the symbol identified by path and name in the known modules (already compiled or currently being compiled)

Sourcemodule Ghost : sig ... end

Signature for symbols introduced by Lambdapi and not the user (e.g. unification/coercion rules, strings) and always loaded.

Sourceval create : Common.Path.t -> t

create path creates a new signature with path path and the ghost module as dependency.

Sourceval loading : Common.Path.t list Timed.ref

loading contains the modules that are being processed. They are stored in a stack due to dependencies. Note that the topmost element corresponds to the current module. If a module appears twice in the stack, then there is a circular dependency.

Sourceval current_path : unit -> Common.Path.t

current_path () returns the current signature path.

unlink sign removes references to external symbols (and thus signatures) in the signature sign. This function is used to minimize the size of object files, by preventing a recursive inclusion of all the dependencies. Note however that unlink processes sign in place, which means that the signature is invalidated in the process.

Sourceval add_symbol_callback : (path:Common.Path.t -> Term.sym -> unit) ref

add_symbol_callback is used to index symbols in the document currently edited in Spl mode

Sourceval add_rules_callback : (path:Common.Path.t -> Term.sym -> Term.rule list -> unit) ref

add_rules_callback is used to index rules in the document currently edited in Spl mode

Sourceval add_symbol : t -> Term.expo -> Term.prop -> Term.match_strat -> bool -> Common.Pos.strloc -> Common.Pos.popt -> Term.term -> bool list -> Term.sym

add_symbol sign expo prop mstrat opaq name pos typ impl notation adds in the signature sign a symbol with name name, exposition expo, property prop, matching strategy strat, opacity opaq, type typ, implicit arguments impl, no notation, no definition and no rules. name should not already be used in sign. pos is the position of the declaration (without its definition). The created symbol is returned.

Sourceval strip_private : t -> unit

strip_private sign removes private symbols from signature sign.

Sourceval write : t -> string -> unit
Sourceval read : string -> t
Sourceval add_rules : t -> Term.sym -> Term.rule list -> unit

add_rules sign s rs adds the new rules rs to the symbol s. When the rules do not correspond to a symbol of signature sign, they are stored in its dependencies. /!\ does not update the decision tree or the critical pairs.

Sourceval add_rule : t -> Term.sym_rule -> unit

add_rule sign s r adds the new rule r to the symbol s. When the rule does not correspond to a symbol of signature sign, it is stored in its dependencies. /!\ does not update the decision tree or the critical pairs.

Sourceval add_notation : t -> Term.sym -> float Term.notation -> unit

add_notation sign sym nota changes the notation of s to n in the signature sign.

Sourceval add_builtin : t -> string -> Term.sym -> unit

add_builtin sign name sym binds the builtin name to sym in the signature sign. The previous binding, if any, is discarded.

Sourceval add_inductive : t -> Term.sym -> Term.sym list -> Term.sym -> int -> int -> unit

add_inductive sign ind_sym ind_cons ind_prop ind_prop_args add to sign the inductive type ind_sym with constructors ind_cons, induction principle ind_prop with ind_prop_args arguments.

Sourceval iterate : (t -> unit) -> t -> unit

iterate f sign applies f on sign and its dependencies recursively.

Sourceval dependencies : t -> (Common.Path.t * t) list

dependencies sign returns an association list containing (the transitive closure of) the dependencies of the signature sign. Note that the order of the list gives one possible loading order for the signatures. Note also that sign itself appears at the end of the list.