Theoria.Term (theoria v0.1.0)

Copy Markdown View Source

Core terms for Theoria's trusted kernel.

Terms use de Bruijn indices internally. User-facing names are retained only for diagnostics and pretty-printing; binding correctness is determined by indices.

Summary

Functions

Shifts de Bruijn indices by amount at and above cutoff.

Substitutes de Bruijn variable index with replacement.

Substitutes the outermost bound variable in body with replacement.

Types

Functions

app(fun, arg)

@spec app(t(), t()) :: Theoria.Term.App.t()

arrow(domain, codomain)

@spec arrow(t(), t()) :: Theoria.Term.Forall.t()

bvar(index)

const(name)

@spec const(atom()) :: Theoria.Term.Const.t()

forall(name, domain, body)

@spec forall(atom(), t(), t()) :: Theoria.Term.Forall.t()

lam(name, domain, body)

@spec lam(atom(), t(), t()) :: Theoria.Term.Lam.t()

shift(term, amount, cutoff \\ 0)

@spec shift(t(), integer(), non_neg_integer()) :: t()

Shifts de Bruijn indices by amount at and above cutoff.

sort(level)

subst(term, index, replacement, depth \\ 0)

@spec subst(t(), non_neg_integer(), t(), non_neg_integer()) :: t()

Substitutes de Bruijn variable index with replacement.

subst_top(body, replacement)

@spec subst_top(t(), t()) :: t()

Substitutes the outermost bound variable in body with replacement.