Module Context.Rel
Representation of contexts that can capture anonymous as well as non-anonymous variables. Individual declarations are then designated by de Bruijn indexes.
module Declaration : sig ... endtype ('constr, 'types) pt= ('constr, 'types) Declaration.pt listRel-context is represented as a list of declarations. Inner-most declarations are at the beginning of the list. Outer-most declarations are at the end of the list.
val empty : ('c, 't) ptempty rel-context
val add : ('c, 't) Declaration.pt -> ('c, 't) pt -> ('c, 't) ptReturn a new rel-context enriched by with a given inner-most declaration.
val length : ('c, 't) pt -> intReturn the number of local declarations in a given rel-context.
val equal : ('c -> 'c -> bool) -> ('c, 'c) pt -> ('c, 'c) pt -> boolCheck whether given two rel-contexts are equal.
val nhyps : ('c, 't) pt -> intReturn the number of local assumptions in a given rel-context.
val lookup : int -> ('c, 't) pt -> ('c, 't) Declaration.ptReturn a declaration designated by a given de Bruijn index.
- raises Not_found
if the designated de Bruijn index outside the range.
val map_with_binders : (int -> 'c -> 'c) -> ('c, 'c) pt -> ('c, 'c) ptMap all terms in a given rel-context taking into account the position of the binder in the context starting at 1.
val iter : ('c -> unit) -> ('c, 'c) pt -> unitPerform a given action on every declaration in a given rel-context.
val fold_inside : ('a -> ('c, 't) Declaration.pt -> 'a) -> init:'a -> ('c, 't) pt -> 'aReduce all terms in a given rel-context to a single value. Innermost declarations are processed first.
val fold_outside : (('c, 't) Declaration.pt -> 'a -> 'a) -> ('c, 't) pt -> init:'a -> 'aReduce all terms in a given rel-context to a single value. Outermost declarations are processed first.
val to_tags : ('c, 't) pt -> bool listMap a given rel-context to a list where each local assumption is mapped to
trueand each local definition is mapped tofalse. The resulting list is in reverse order compared to the order of declarations in the context.
val drop_bodies : ('c, 't) pt -> ('c, 't) ptTurn all
LocalDefintoLocalAssum, leaveLocalAssumunchanged.
val instance : (int -> 'r) -> int -> ('c, 't) pt -> 'r arrayinstance mk n Γbuilds an instanceargssuch thatΓ,Δ ⊢ args:Γwith n = |Δ| and with the local definitions ofΓskipped inargswheremkis used to build the corresponding variables. Example: forx:T, y:=c, z:Uandn=2, it givesmk 5, mk 3.
val instance_list : (int -> 'r) -> int -> ('c, 't) pt -> 'r listinstance_listis likeinstancebut returning a list.