MCPcopy Create free account
hub / github.com/argumentcomputer/ix / mk_lambda

Method mk_lambda

crates/kernel/src/lctx.rs:139–147  ·  view source on GitHub ↗

Abstract `body` over `fvars` and wrap it in a chain of `Lam` (or `Let` for `LDecl` entries) binders, innermost-first. The result has all of the listed fvars replaced by de Bruijn indices (`fvars[0]` becomes the outermost binder, `fvars[n-1]` the innermost). This is the inverse of the binder-opening pattern used during type checking: open with [`NameGenerator::fresh`], recurse, close back here so

(
    &self,
    intern: &mut InternTable<M>,
    fvars: &[FVarId],
    body: &KExpr<M>,
  )

Source from the content-addressed store, hash-verified

137 ///
138 /// Mirrors `Lean.LocalContext.mkLambda`.
139 pub fn mk_lambda(
140 &self,
141 intern: &mut InternTable<M>,
142 fvars: &[FVarId],
143 body: &KExpr<M>,
144 ) -> KExpr<M> {
145 let abstracted = abstract_fvars(intern, body, fvars);
146 self.wrap_binders(intern, fvars, abstracted, /* as_lambda */ true)
147 }
148
149 /// Abstract `body` over `fvars` and wrap it in a chain of `All` (or `Let`
150 /// for `LDecl` entries) binders, innermost-first.

Callers

nothing calls this directly

Calls 2

abstract_fvarsFunction · 0.85
wrap_bindersMethod · 0.80

Tested by

no test coverage detected