Albalib.TermSourcesubstitute f term substitutes each free variable i in term by the term f i.
substitute f term substitutes each free variable i in term by the term f i and do beta reduction in case that f i appears in a function position and is a function abstraction.
apply_nargs f n mode returns
f (Var (n-1)) ... (Var 0)
where all applications are done with mode mode.
Monadic functions