Zulip Chat Archive

Stream: general

Topic: Equation compiler error


Seul Baek (Mar 02 2019 at 22:39):

def foo : bool → nat → unit
| tt 0     := ()
| tt m     := ()
| ff 0     := ()
| ff (m+1) := foo ff m

For some reason Lean thinks the second case is unnecessary and gives an equation compiler error. If I remove the case, however, it correctly reports that I'm missing the case foo tt (nat.succ _). I wonder what's going on here?

Kenny Lau (Mar 02 2019 at 22:41):

equation compiler error, equation #2 has not been used in the compilation (possible solution: delete equation)

Kenny Lau (Mar 02 2019 at 22:42):

(lawyer mode) they didn't say delete equation 2 :P

Kevin Buzzard (Mar 02 2019 at 22:42):

rofl

Kenny Lau (Mar 02 2019 at 22:42):

(lawyer mode) I deleted equation 1 and it worked, so the error message isn't lying

Chris Hughes (Mar 02 2019 at 22:42):

I think it was used

def foo : bool  nat  bool
| tt 0     := ff
| tt m     := tt
| ff 0     := ff
| ff (m+1) := foo ff m

#eval foo tt 1

Dan Velleman (Dec 12 2021 at 21:58):

I am trying to use a match statement in the definition of a tactic. If I have more than 5 cases in the match, I get the error message "equation compiler failed, maximum number of steps (2048) exceeded." Is there a limit of 5 cases in a match?

Yakov Pechersky (Dec 12 2021 at 22:23):

(deleted)

Eric Wieser (Dec 13 2021 at 00:05):

It sounds like each of your cases is rather complex

Dan Velleman (Dec 13 2021 at 01:15):

They're just pattern matching on an expression.

Dan Velleman (Dec 13 2021 at 01:20):

I have a workaround: a smaller number of cases, and each case calls a function with a few cases. But I'm surprised that I had to resort to that.

Eric Wieser (Dec 13 2021 at 08:43):

Without a #mwe or at least a link to a github repo with failing code, I doubt anyone can diagnose further.


Last updated: Dec 20 2023 at 11:08 UTC