jon.recoil.org

Module Flambda2_nominal.Renaming

Handling of permutations and import freshening upon all kinds of bindable names and other identifiers (e.g. constants).

We use permutations instead of substitutions because they cannot accidentally disturb the binding structure of terms. See Name_abstraction.

Unlike Name_occurrences this module does not segregate names according to where they occur (e.g. in terms or in types).

type t
val empty : t
val print : Format.formatter -> t -> unit
val is_identity : t -> bool
val has_import_map : t -> bool
val compose : second:t -> first:t -> t

Note that compose is not commutative on the permutation component. The permutation in the result of compose ~second ~first is that permutation acting initially like first then subsequently like second. second must not hold any import map.

val add_fresh_variable : t -> Flambda2_identifiers.Variable.t -> guaranteed_fresh:Flambda2_identifiers.Variable.t -> t
val add_fresh_symbol : t -> Flambda2_identifiers.Symbol.t -> guaranteed_fresh:Flambda2_identifiers.Symbol.t -> t
val add_fresh_continuation : t -> Flambda2_identifiers.Continuation.t -> guaranteed_fresh:Flambda2_identifiers.Continuation.t -> t
val add_fresh_code_id : t -> Flambda2_identifiers.Code_id.t -> guaranteed_fresh:Flambda2_identifiers.Code_id.t -> t
val apply_simple : t -> Simple.t -> Simple.t
val value_slot_is_used : t -> Flambda2_identifiers.Value_slot.t -> bool