Module Synint.LF

type 'a ctx =
  1. | Empty
  2. | Dec of 'a ctx * 'a
type svar_class =
  1. | Ren
  2. | Subst
type kind =
  1. | Typ
  2. | PiKind of typ_decl * Syncom.Depend.t * Syncom.Plicity.t * kind
and typ_decl =
  1. | TypDecl of Syncom.Name.t * typ
  2. | TypDeclOpt of Syncom.Name.t
and cltyp =
  1. | MTyp of typ
  2. | PTyp of typ
  3. | STyp of svar_class * dctx

Right-hand side of the turnstile for meta-types

and ctyp =
  1. | ClTyp of cltyp * dctx
  2. | CTyp of Syncom.Id.cid_schema option

Meta-types

and ctyp_decl =
  1. | Decl of {
    1. name : Syncom.Name.t;
    2. typ : ctyp;
    3. plicity : Syncom.Plicity.t;
    4. inductivity : Syncom.Inductivity.t;
    }
  2. | DeclOpt of {
    1. name : Syncom.Name.t;
    2. plicity : Syncom.Plicity.t;
    }
and typ =
  1. | Atom of Syncom.Location.t * Syncom.Id.cid_typ * spine
  2. | PiTyp of typ_decl * Syncom.Depend.t * Syncom.Plicity.t * typ
  3. | Sigma of typ_rec
  4. | TClo of typ * sub
and head =
  1. | BVar of Syncom.Id.offset
  2. | Const of Syncom.Id.cid_term
  3. | MMVar of mm_var_inst
  4. | MPVar of mm_var_inst
  5. | MVar of cvar * sub
  6. | PVar of Syncom.Id.offset * sub
  7. | AnnH of head * typ
  8. | Proj of head * int
  9. | FVar of Syncom.Name.t
  10. | FMVar of fvarsub
  11. | FPVar of fvarsub
  12. | HClo of Syncom.Id.offset * Syncom.Id.offset * sub
  13. | HMClo of Syncom.Id.offset * mm_var_inst
and fvarsub = Syncom.Name.t * sub
and spine =
  1. | Nil
  2. | App of normal * spine
  3. | SClo of spine * sub
and sub =
  1. | Shift of Syncom.Id.offset
  2. | SVar of Syncom.Id.offset * int * sub
  3. | FSVar of Syncom.Id.offset * fvarsub
  4. | Dot of front * sub
  5. | MSVar of Syncom.Id.offset * mm_var_inst
  6. | EmptySub
  7. | Undefs
and front =
  1. | Head of head
  2. | Obj of normal
  3. | Undef
and mfront =
  1. | ClObj of dctx_hat * clobj
  2. | CObj of dctx
  3. | MV of Syncom.Id.offset
  4. | MUndef
and clobj =
  1. | MObj of normal
  2. | PObj of head
  3. | SObj of sub
and msub =
  1. | MShift of int
  2. | MDot of mfront * msub
and cvar =
  1. | Offset of Syncom.Id.offset
  2. | Inst of mm_var
and mm_var = {
  1. name : Syncom.Name.t;
  2. instantiation : iterm option Stdlib.ref;
  3. cD : mctx;
  4. mmvar_id : int;
  5. typ : ctyp;
  6. constraints : cnstr list Stdlib.ref;
  7. plicity : Syncom.Plicity.t;
  8. inductivity : Syncom.Inductivity.t;
}
and mm_var_inst' = mm_var * msub
and mm_var_inst = mm_var_inst' * sub
and iterm =
  1. | INorm of normal
  2. | IHead of head
  3. | ISub of sub
  4. | ICtx of dctx
and tvar =
  1. | TInst of typ option Stdlib.ref * dctx * kind * cnstr list Stdlib.ref
and constrnt_id = int
and constrnt =
  1. | Queued of constrnt_id
  2. | Eqn of constrnt_id * mctx * dctx * iterm * iterm
and cnstr = constrnt Stdlib.ref
and dctx =
  1. | Null
  2. | CtxVar of ctx_var
  3. | DDec of dctx * typ_decl
and ctx_var =
  1. | CtxName of Syncom.Name.t
  2. | CtxOffset of Syncom.Id.offset
  3. | CInst of mm_var_inst'
and sch_elem =
  1. | SchElem of typ_decl ctx * typ_rec
and schema =
  1. | Schema of sch_elem list
and dctx_hat = ctx_var option * Syncom.Id.offset
and typ_rec =
  1. | SigmaLast of Syncom.Name.t option * typ
  2. | SigmaElem of Syncom.Name.t * typ * typ_rec
and tuple =
  1. | Last of normal
  2. | Cons of normal * tuple
and mctx = ctyp_decl ctx
val map_plicity : (Syncom.Plicity.t -> Syncom.Plicity.t) -> normal -> normal
val proj_maybe : head -> int option -> head
val tclo : typ -> sub -> typ

Helper for forming TClo LF types, which avoids doing so if the substitution is the identity.

val mm_var_inst : mm_var -> msub -> sub -> mm_var_inst

Forms an MMVar instantiation by attaching an LF substitution and a meta-substituation to the variable.

val is_mmvar_instantiated : mm_var -> bool
val type_of_mmvar_instantiated : mm_var -> ctyp
val rename_ctyp_decl : (Syncom.Name.t -> Syncom.Name.t) -> ctyp_decl -> ctyp_decl
val head : head -> normal

Embeds a head into a normal by using an empty spine. Very useful for constructing variables as normals. Note that the normal will have a ghost location, as heads don't carry a location.

val mvar : cvar -> sub -> head
val mmvar : mm_var_inst -> head
val mpvar : mm_var_inst -> head

Assert that the contextual type declaration be a real Decl, and not a DeclOpt. Raises a violation if it is a DeclOpt.

val null_hat : dctx_hat
val loc_of_normal : normal -> Syncom.Location.t
type nclo = normal * sub
type sclo = spine * sub
type tclo = typ * sub
type trec_clo = typ_rec * sub
val blockLength : typ_rec -> int
val getType : head -> (typ_rec * sub) -> int -> typ * sub
val getIndex : typ_rec -> Syncom.Name.t -> int
val is_explicit : ctyp_decl -> bool
val name_of_ctyp_decl : ctyp_decl -> Syncom.Name.t
val variable_of_mfront : mfront -> (Syncom.Id.offset * Syncom.Id.offset option) option

Decides whether the given mfront is a variable, viz. projection of a pattern variable, metavariable, or context variable. Returns the offset of the variable, and optionally the projection offset.

val get_constraint_id : constrnt -> constrnt_id
val drop_spine : int -> spine -> spine