You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The unsafe implementation of Option.attach sometimes causes lean to instantly crash. I however suspect that this is a wider problem that would also affect List.attach and others. This is most likely a bug in the compiler where it doesn't expect such a type mismatch (even if α and { x : α // p x } have compatible representations).
After a bit of debugging, the cause of the issue seems to be that lean::csimp_fn::reduce_cases_cnstr (in library/compiler/csimp.cpp) gets called with major = PUnit.unit and I_val = Subtype while it expects major to be a constructor application of I_val. A solution to this problem might be to check whether major actually is a constructor of Subtype and not something else and otherwise don't do the optimization step.
From this insight, a simpler example is:
example : Nat :=
Subtype.casesOn (unsafeCast () : { x : Unit // x = x }) (fun a b => 0)
Prerequisites
Please put an X between the brackets as you perform the following steps:
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
The unsafe implementation of
Option.attach
sometimes causes lean to instantly crash. I however suspect that this is a wider problem that would also affectList.attach
and others. This is most likely a bug in the compiler where it doesn't expect such a type mismatch (even ifα
and{ x : α // p x }
have compatible representations).Steps to Reproduce
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: