Zulip Chat Archive

Stream: general

Topic: tactic state: vm check failed


Eric Rodriguez (Feb 10 2022 at 17:48):

consider this mwe:

trying to view the tactic state, you get a weird error, but the proof seems to compile (I haven't checked it with trepplein or anything yet.

image.png

Gabriel Ebner (Feb 10 2022 at 17:49):

Does this look like https://github.com/leanprover-community/lean/issues/673 ?

Eric Rodriguez (Feb 10 2022 at 17:49):

yep, precisely like it

Eric Rodriguez (Feb 10 2022 at 17:50):

although the mwes look fairly different, and there's no sorry like in Mario's example

Kevin Buzzard (Feb 10 2022 at 17:55):

oh man, you were going to get a point for that (new error that nobody saw before), but Mario gets it instead

Gabriel Ebner (Feb 10 2022 at 18:07):

Is the workaround of switching to plain text mode acceptable for you? I'm not sure I want to spend time debugging this in Lean 3.

Mario Carneiro (Feb 10 2022 at 18:10):

the sorry is so that it works without mathlib

Mario Carneiro (Feb 10 2022 at 18:11):

I like your MWE better than mine though, since it doesn't involve well founded recursion

Eric Rodriguez (Feb 10 2022 at 18:17):

oh it's fine, just thought I would post it; I'm happy there was a workaround! this doesn't happen if you simp only the term, though, which is worth knowing

Mario Carneiro (Feb 10 2022 at 19:53):

Minimized as far as possible within lean:

open tactic tagged_format
#eval do
  --                                vvvvv-- zoom in to this subexpr
  e  tactic.to_expr ``(have this : sorry, from sorry, true),
  ts  tactic.read,
  compose (group $ compose (group $ compose _have_this $ compose _colon m) _sorry) _true
     pure (tactic_state.pp_tagged ts e),
  nest _ (compose (compose (compose (compose _nl m) _comma) _space) _from_sorry)  pure m,
  tag ([coord], _sorry_expr) _sorry  pure m,
  tactic.trace e,
  -- case on coord causes VM bug
  match coord with
  | expr.coord.app_arg := pure ()
  | _ := pure ()
  end

Mario Carneiro (Feb 10 2022 at 19:55):

that is, it appears tactic_state.pp_tagged does not know how to express the subexpression coordinate corresponding to the type of a have or suffices expression

Mario Carneiro (Feb 10 2022 at 20:07):

It also seems pretty sketchy that the lean inductive expr.coord has 9 constructors but the corresponding C++ type has 11 constructors, with the two extra being mvar_type, local_const_type which sound like they shouldn't be escaping but should probably exist in the lean type anyway

Mario Carneiro (Feb 10 2022 at 20:51):

Turns out the only use of those constructors was in pp output for have statements, so... I just removed them and it worked

Mario Carneiro (Feb 10 2022 at 20:51):

lean#682

Yaël Dillies (Feb 10 2022 at 20:55):

Always nice when the fix is to delete code.

Mario Carneiro (Feb 10 2022 at 21:00):

TIL that suffices doesn't actually leave any trace in the term, unlike have, so when you print it back you get a lambda

Mario Carneiro (Feb 10 2022 at 21:01):

I was looking for a pp_suffices in the code but there isn't any

Mario Carneiro (Feb 10 2022 at 21:02):

#check have x : true, from trivial, trivial
-- have x : true, from trivial, trivial : true

#check suffices x : true, from trivial, trivial
-- (λ (x : true), trivial) trivial : true

Alex J. Best (Feb 11 2022 at 07:13):

I remember there being some trace in the term before, it's how i implemented https://github.com/leanprover-community/mathlib/blob/8c60a9270b26c63b1492845d39cd8258418fa64a/src/tactic/lint/misc.lean#L407 did that now change, or is it just not printed?

Mario Carneiro (Feb 11 2022 at 07:33):

hm, you are not wrong... it looks like there is an annotation but it is in a different place than have

#eval do
  e  tactic.to_expr ``(have x:bool, from bool.ff, bool.tt),
  tactic.trace e.to_raw_fmt
-- (app [macro annotation (lam x default (const bool []) [macro annotation (const bool.tt [])])] (const bool.ff []))
#eval do
  e  tactic.to_expr ``(suffices x:bool, from bool.ff, bool.tt),
  tactic.trace e.to_raw_fmt
-- [macro annotation (app (lam x default (const bool []) (const bool.ff [])) (const bool.tt []))]

Last updated: Dec 20 2023 at 11:08 UTC