Zulip Chat Archive

Stream: general

Topic: Error using support when importing `data.real.basic`


Stanislas Polu (Feb 15 2022 at 14:33):

Hi, here's a minimal example showing that importing data.real.basic may cause an unexpected deep recursion error:

import algebra.big_operators.basic
import group_theory.perm.support
import data.nat.interval
import data.real.basic --delete this line and it compiles

open_locale big_operators

theorem amc12a_2012_p24
  (a :   )
  (σ : equiv.perm (finset.Ico (1 : ) 2012))
  (h₆ :  i j, i < j  (a  coe  σ) j  (a  coe  σ) i) :
   k in σ.support, (k : ) = 1341 := sorry

(h/t @Mantas Baksys)

What is the preferred process to report this as a potential bug? :pray:

Stanislas Polu (Feb 15 2022 at 14:34):

For context:

  • the original statements has additional hypothesis that require the reals.
  • this statement used to compile correctly without recursion error on older mathlib, in particular: 2fd713a76e15eebdcdfd2f94472584b3f5f2bfc7

Mantas Baksys (Feb 15 2022 at 14:37):

Note that a more minimal example (wrt imports of data.real.basic) on the import chain is the following

import group_theory.perm.support
import data.nat.interval
import data.pnat.basic --delete this line and it compiles

open_locale big_operators

theorem amc12a_2012_p24
  (a : ℕ → ℕ)
  (σ : equiv.perm (finset.Ico (1 : ℕ) 2012))
  (h₆ : ∀ i j, i < j → (a ∘ coe ∘ σ) j ≤ (a ∘ coe ∘ σ) i) :
  ∑ k in σ.support, (k : ℕ) = 1341 := sorry

Alex J. Best (Feb 15 2022 at 14:43):

Even more minimal

import data.nat.interval
import data.pnat.basic --delete this line and it compiles

#check (infer_instance : decidable_eq (finset.Ico (0 : ) 2012))

Alex J. Best (Feb 15 2022 at 14:53):

I guess lean is recursing a lot trying to unify pnat with finset.Ico 0 2012, when searching for decidable equality instances

Alex J. Best (Feb 15 2022 at 14:53):

A workaround is local attribute [-instance] pnat.decidable_eq

Alex J. Best (Feb 15 2022 at 14:55):

Alternatively marking pnat as irreducible locally also works

Gabriel Ebner (Feb 15 2022 at 14:56):

Oh wait, does this mean the α in decidable_eq α is unified with semireducible transparency because it only appears as an implicit argument after unfolding decidable_eq α?


Last updated: Dec 20 2023 at 11:08 UTC