perf(frontends/lean/elaborator): fix performance bottleneck

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
perf(frontends/lean/elaborator): fix performance bottleneck