Zulip Chat Archive

Stream: new members

Topic: bug ?


Nicolas Rolland (Nov 17 2023 at 07:43):

This code works but it crashes the whole Lean Server when typechecking the second function printHKO

x in inferred to be a String so I would expect to be able to replace it with "Hi".

Is it a bug or am I doing something wrong ?

iimport Mathlib.Data.Vector

inductive HVect : (n : Nat) -> (Vector (Type v) n) -> Type (v+1)  where
   | Nil  : HVect 0  [], simp 
   | Cons : (t : Type v) -> (x : t) -> HVect n ts, p -> HVect (n+1) t::ts, by simp [p]⟩


def printHOK (v : HVect (n+1) String::ts, p'⟩) : String :=
   match v with
   | HVect.Cons _ x _ => (x : String)


def printHKO (v : HVect (n+1) String::ts, p'⟩) : String :=
   match v with
   | HVect.Cons _ x _ => "Hi"

Mario Carneiro (Nov 17 2023 at 07:51):

no, server crashes are almost always bugs

Notification Bot (Nov 17 2023 at 07:53):

Nicolas Rolland has marked this topic as resolved.

Notification Bot (Nov 17 2023 at 07:53):

Nicolas Rolland has marked this topic as unresolved.

Mario Carneiro (Nov 17 2023 at 07:55):

this seems like a rather severe issue, it is a SIGSEGV which normally shouldn't happen even if there was a bug in the elaborator

Nicolas Rolland (Nov 17 2023 at 07:57):

I was using 4.3 rc1, testing on other version. I will open a case on github if I can reproduce on head lean+mathlib

Mario Carneiro (Nov 17 2023 at 08:11):

it reproduces on 4.3.0-rc2 released today

Mario Carneiro (Nov 17 2023 at 08:19):

it seems that the compiler had difficulty determining the arity of a constant so it threw an error, but it messed up the error payload and it crashes while trying to print the error

Nicolas Rolland (Nov 17 2023 at 09:55):

opened issue on github


Last updated: Dec 20 2023 at 11:08 UTC