Zulip Chat Archive

Stream: general

Topic: Largest binder depth in mathlib


Mario Carneiro (Jan 19 2022 at 11:36):

I got curious about this question because metamath has a soft limit on the number of simultaneous bound variables because it uses letters of the alphabet and there are only 26 of those (notwithstanding some extensions to add primes in some user mathboxes). MM0 also has a variable limit of 55 with the current verifier design (because this bit-packs nicely), although there is an extension point in case more are needed in the future. (Technically, both metamath and MM0 support more variables than this but these are for "true" variables, that can appear in binders, rather than "local constants" which are fixed through the proof.)

Lean is a bit more binder-hungry than metamath because it uses binders for have, for example - is there some huge proof out there with 50+ variables?

Here's a metaprogram to find out:

#eval do
  env  tactic.get_env,
  (env.fold (pure (`nat, 0)) $ λ d r, do
    (n, m)  r,
    let m2 := d.value.fold 0 (λ _, max),
    pure $ if m2 > m then
      (d.to_name, m2) else
      (n, m)) >>= tactic.trace

What would you guess?

Results


Last updated: Dec 20 2023 at 11:08 UTC