Module Logtk.DBEnv
De Bruijn environments
val empty : 'a t
Empty environment
val is_empty : 'a t -> bool
Are there bindings?
val make : int -> 'a t
Empty environment of the given size
val singleton : 'a -> 'a t
Single binding
val push : 'a t -> 'a -> 'a t
Create a new environment, when entering a scope, where the De Bruijn index 0 is bound to the given value
val push_l_same_order : 'a t -> 'a list -> 'a t
push_l_same_order env l
builds envl0 :: l1 :: … :: env
val push_none : 'a t -> 'a t
Create a new environment, when entering a scope, where the De Bruijn index 0 is bound to nothing.
val push_none_multiple : 'a t -> int -> 'a t
Call
push_none
n
times (after we've enteredn
scopes, for instances)
val pop : 'a t -> 'a t
Exit a scope, removing the top binding.
- raises Invalid_argument
if the env is empty
val size : 'a t -> int
Number of scopes (number of times
push
orpush_none
were called to produce the given environment)
val find : 'a t -> int -> 'a option
Find to which value the given De Bruijn index is bound to, or return None
val find_exn : 'a t -> int -> 'a
Unsafe version of
find
.- raises Failure
if the index is not bound within
env
val mem : _ t -> int -> bool
mem env i
returnstrue
ifffind env i
returnsSome _
rather thanNone
, ie. whether thei
-th De Bruijn variable is bound withinenv
val set : 'a t -> int -> 'a -> 'a t
Set the
n
-th variable to the given objects.- raises Invalid_argument
if the index isn't in the range
0... size-1
val num_bindings : _ t -> int
How many variables are actually bound?
val filteri : (int -> 'a -> bool) -> 'a t -> 'a t
val of_list : (int * 'a) list -> 'a t
Map indices to objects
val to_list : 'a t -> 'a option list
List of underlying elements
val to_list_i : 'a t -> (int * 'a) option list
List of underlying elements