lean4-htt/tests/lean/reduceArity.lean
Henrik Böving 26f6bc67ee
feat: lambda pure conversion in LCNF (#12272)
This PR shifts the conversion from LCNF mono to lambda pure into the
LCNF impure phase. This is preparatory work for the upcoming refactor of
IR into LCNF impure.

The LCNF impure phase differs from the other LCNF phases in two crucial
ways:
1. I decided to have `Decl.type` be the result type as opposed to an
arrows from the parameter types to the result type. This is done because
impure does not have a notion of arrows anymore so keeping them around
for this one particular purpose would be slightly odd.
2. In order to avoid cluttering up the olean size LCNF impure saves only
the signature persistently to the disk. This is possible because we no
longer have inlining/specialization at this point of compilation so all
we need is typing information (and potentially other environment
extensions) to guide our analyses.
2026-02-03 10:24:59 +00:00

14 lines
360 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Lean
open Lean Compiler LCNF
@[noinline] def double (x : Nat) := x + x
set_option pp.funBinderTypes true
set_option trace.Compiler.saveMono true in
def g (n : Nat) (a b : α) (f : αα) :=
match n with
| 0 => a
| n+1 => f (g n a b f)
set_option trace.Compiler.saveMono true in
def h (n : Nat) (a : Nat) :=
g n a a double + g a n n double