leanprover / leanprover/lean4

Dependent if rewrite causes dependent goal to dissapear, giving kernel declaration has metavars

Open
#2,035 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Prerequisites
  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.
Description

dependent if rewrite causes dependent goal to dissapear

Steps to Reproduce
variable {α : Type} [LT α] {c : α} [∀ m : α, Decidable (m=c)]

theorem c_lt {a : α} (hab : a = c) : c < a := sorry

def id_of_c_lt (m : α) : c < m → α := fun _ => m

theorem minimal_error (M m : α) (hm : c < m) (m_eq_M : m = M) (M_eq_c : M = c)
  (H : id_of_c_lt M (c_lt M_eq_c) = c) :
  (if h : m = c then id_of_c_lt m (c_lt h) else m) = c :=
by
  rw [dif_pos]
  . simp only [m_eq_M]
    rw [m_eq_M] at hm --useless rewrite of an assumption makes the hc case disappear
    exact H

example due to Sacha Huriot @kisarablue

Expected behavior: a second (probably unprovable goal remains

Actual behavior: (kernel) declaration has metavariables 'minimal_error'

Reproduces how often: 100%

Versions

latest nightly (1-12)

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 minimal_error theorem and reproduce the behavior around rw [m_eq_M] at hm. Investigate the dependent-if rewrite and kernel declaration handling; done means the reproduced case no longer leaves an undeclared metavariable, or the remaining goal is reported as expected.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.