package lambdapi
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=920de48ec6c2c3223b6b93879bb65d07ea24aa27f7f7176b3de16e5e467b9939
sha512=135f132730825adeb084669222e68bc999de97b12378fae6abcd9f91ae13093eab29fa49c854adb28d064d52c9890c0f5c8ff9d47a9916f66fe5e0fba3479759
doc/lambdapi.core/Core/Sig_state/index.html
Module Core.Sig_state
Source
Signature state.
This module provides a record type sig_state
containing all the informations needed for scoping p_terms and printing terms, and functions on this type for manipulating it. In particular, it provides functions open_sign
, add_symbol
, add_binop
, etc. taking a sig_state
as argument and returning a new sig_state
as result. These functions call the corresponding functions of Sign
which should not be called directly but through the current module only, in order to setup the sig_state
properly.
create_sign path
creates a signature with path path
with ghost modules as dependencies.
type sig_state = {
signature : Sign.t;
(*Current signature.
*)in_scope : Term.sym Lplib.Extra.StrMap.t;
(*Symbols in scope.
*)alias_path : Common.Path.t Lplib.Extra.StrMap.t;
(*Alias to path map.
*)path_alias : string Common.Path.Map.t;
(*Path to alias map.
*)builtins : Term.sym Lplib.Extra.StrMap.t;
(*Builtins.
*)notations : Sign.notation Term.SymMap.t;
(*Notations.
*)open_paths : Common.Path.Set.t;
(*Open modules.
*)
}
State of the signature, including aliasing and accessible symbols.
val add_symbol :
sig_state ->
Term.expo ->
Term.prop ->
Term.match_strat ->
bool ->
Common.Pos.strloc ->
Term.term ->
bool list ->
Term.term option ->
sig_state * Term.sym
add_symbol ss expo prop mstrat opaq id typ impl def
generates a new signature state from ss
by creating a new symbol with expo e
, property p
, strategy st
, name x
, type a
, implicit arguments impl
and optional definition def
. This new symbol is returned too.
add_notation ss s n
maps s
notation to n
in ss
.
add_builtin ss n s
generates a new signature state from ss
by mapping the builtin n
to s
.
val add_notations_from_builtins :
Term.sym Lplib.Extra.StrMap.t ->
Sign.notation Term.SymMap.t ->
Sign.notation Term.SymMap.t
add_notations_from_builtins notmap bm
add notations for symbols mapped to the builtins "0" and "+1".
open_sign ss sign
extends the signature state ss
with every symbol of the signature sign
. This has the effect of putting these symbols in the scope when (possibly masking symbols with the same name). Builtins and notations are also handled in a similar way.
of_sign sign
creates a state from the signature sign
and open it as well as the ghost signatures.
find_sym ~prt ~prv b st qid
returns the symbol corresponding to the qualified identifier qid
. If fst qid.elt
is empty, we search for the name snd qid.elt
in the opened modules of st
. The boolean b
only indicates if the error message should mention variables, in the case where the module path is empty and the symbol is unbound. This is reported using the Fatal
exception. Term.expo.Protec
symbols from other modules are allowed in left-hand side of rewrite rules (only) iff ~prt
is true. Term.expo.Privat
symbols are allowed iff ~prv
is true
.