leanprover / leanprover/lean4

Goal pretty-printing doesn't respect `pp.instantiateMVars`

Open
#14,275 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P-medium
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Prerequisites
Description

When pretty-printing goals, metavariables are always instantiated in hypotheses and the goal type regardless of the setting of pp.instantiateMVars. This is bad when debugging problems with metavariables because important information might be invisible.

Context

#mathlib4 > tauto bug @ 💬

Steps to Reproduce
import Lean

open Lean Elab Tactic
elab "show_goal_type" : tactic => do
  let goal ← getMainGoal
  goal.withContext do
    logInfo m!"real goal type: {(← goal.getType)}"
    logInfo m!"ppGoal:\n{goal}"

set_option pp.instantiateMVars false

/--
info: real goal type: ?α
---
info: ppGoal:
⊢ True
-/
#guard_msgs (info) in
example : True := by
  apply id
  show_goal_type
  sorry

Expected behavior:
The setting pp.instantiateMVars is respected, showing the real type of .

Actual behavior:
The fact that the goal type is a metavariable is not visible from the goal view.

Versions

Lean 4.33.0-nightly-2026-07-03

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Contributor guide

Open the contributing guide

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.

Research direction

Start with the self-contained Lean reproducer, especially the show_goal_type tactic and goal.withContext/ppGoal output; trace the goal pretty-printing path that handles hypotheses and goal types. Done when pp.instantiateMVars false keeps the metavariable visible in the goal view and the reproducer's expected messages pass.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.