Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`vcgen frames` fails on types with abbreviation

Open
#15,713 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
15/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Domain
compilers

Research direction

The failing case is the vcgen frames tactic with an abbrev type alias, reproduced by the Lean snippet in the issue body. The reporter suspects the abbrev is not reduced before it enters the hash-consing table of Sym, so the proof term fails to match. Reproduce by running the example with set_option experimental.vcgen true, then compare it with the eta-expanded variant that passes. Done means the first example compiles without the kernel application type mismatch error.

Written by the indexing model from the issue text.

Description

bug
Description

Please check the Lean Web

import Std.WP
set_option experimental.vcgen true
open Lean.Order Std.WP

abbrev S := Nat

def tick [Monad m] [MonadStateOf S m] : m Unit := pure ()

@[spec] theorem tick_spec : ⦃ fun _ => True ⦄ (tick : StateM S Unit) ⦃ fun _ _ => True ⦄ := by
  unfold tick; vcgen

def F : S → Prop := fun _ => True

@[grind .] theorem frames_F : WP.Frames meet (tick : StateM S Unit) F P :=
  WP.frames_of_conjunctive (by unfold tick F; vcgen with finish) (fun _ => meet_le_right _ _)

/-- error: (kernel) application type mismatch -/
#guard_msgs (error, substring := true) in
example : ⦃ F ⦄ (tick : StateM S Unit) ⦃ fun _ _ => True ⦄ := by
  vcgen frames | tick => F with finish

-- The same frame, eta-expanded, passes.
example : ⦃ F ⦄ (tick : StateM S Unit) ⦃ fun _ _ => True ⦄ := by
  vcgen frames | tick => fun s => F s with finish

For some reason, if abbrev is used in the program, vcgen framesblows up, unless the abbrev is eta-expanded. I guess the abbrev is not reduced properly before it goes to the hash-consing table of Sym, so later symbolic matching fails to pick up the proof of correct type.

Dominant language
Lean
Stars
9.7k
Forks
1.1k
Avg merge
20h 27m
Merged PRs (30d)
314

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from leanprover/lean4

All issues in leanprover/lean4

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.