Zulip Chat Archive

Stream: lean4

Topic: compiler IR check failed at 'List.filterTR.loop._at


Lewis (Jun 22 2024 at 00:45):

How to fix the error:

compiler IR check failed at 'List.filterTR.loop._at.l0_norm._spec_3', error: unknown declaration 'Real.decidableEq'

-- Define the ℓ₀-norm (number of non-zero entries) of a vector

def l0_norm {n : } (v : Vec n) :  :=

  (Finset.univ.filter (λ i => v i  0)).card

Thanks.

Kevin Buzzard (Jun 22 2024 at 00:47):

Put noncomputable before def and then if there's an open GitHub issue about this annoying thing then give it an upvote

Bhavik Mehta (Jun 22 2024 at 00:59):

https://github.com/leanprover/lean4/issues/1785

Lewis (Jun 22 2024 at 03:49):

How to fix the Lean code? Thanks a lot.

Kim Morrison (Jun 22 2024 at 04:08):

Kevin has answered above.

Oliver (Jun 22 2024 at 04:19):

(deleted)

Lewis (Jun 22 2024 at 04:27):

Kim Morrison said:

Kevin has answered above.

Why does it stll say "compiler IR check failed at 'List.filterTR.loop._at.l0_norm._spec_3', error: unknown declaration 'Real.decidableEq'" after putting noncomputable before def? Thanks

Damiano Testa (Jun 22 2024 at 07:00):

For me, it says

function expected at
  Vec
term has type
  ?m.9

at Vec n.

Kevin Buzzard (Jun 22 2024 at 08:47):

Lewis if you're still having the problem then can you post a #mwe ?


Last updated: May 02 2025 at 03:31 UTC