Compute the maximum index M
used in a declaration.
We M
to initialize the fresh index generator used to create fresh
variable and join point names.
Recall that we variable and join points share the same namespace in our implementation.
@[inline, reducible]
Equations
Instances For
Equations
- Lean.IR.MaxIndex.instAndThenCollector = { andThen := fun a b => Lean.IR.MaxIndex.seq a (b ()) }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
Instances For
We say a variable (join point) index (aka name) is free in a function body
if there isn't a FnBody.vdecl
(Fnbody.jdecl
) binding it.
@[inline, reducible]
Instances For
Equations
- Lean.IR.FreeIndices.insertParams s ys = Array.foldl (fun s p => Lean.RBTree.insert s p.x.idx) s ys 0 (Array.size ys)
Instances For
Equations
- Lean.IR.FreeIndices.instAndThenCollector = { andThen := fun a b => Lean.IR.FreeIndices.seq a (b ()) }
Equations
Instances For
Equations
Instances For
In principle, we can check whether a function body b
contains an index i
using
b.freeIndices.contains i
, but it is more efficient to avoid the construction
of the set of freeIndices and just search whether i
occurs in b
or not.
Equations
- Lean.IR.HasIndex.visitVar w x = (w == x.idx)
Instances For
Equations
- Lean.IR.HasIndex.visitJP w x = (w == x.idx)
Instances For
Equations
- Lean.IR.HasIndex.visitArg w x = match x with | Lean.IR.Arg.var x => Lean.IR.HasIndex.visitVar w x | x => false
Instances For
Equations
- Lean.IR.HasIndex.visitArgs w xs = Array.any xs (Lean.IR.HasIndex.visitArg w) 0 (Array.size xs)
Instances For
Equations
- Lean.IR.HasIndex.visitParams w ps = Array.any ps (fun p => w == p.x.idx) 0 (Array.size ps)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.IR.Arg.hasFreeVar arg x = Lean.IR.HasIndex.visitArg x.idx arg
Instances For
Equations
- Lean.IR.Expr.hasFreeVar e x = Lean.IR.HasIndex.visitExpr x.idx e
Instances For
Equations
- Lean.IR.FnBody.hasFreeVar b x = Lean.IR.HasIndex.visitFnBody x.idx b