lean4-htt/tests/elab/sym_proj_issue.lean
Leonardo de Moura 8ebd294673
fix: kernel projection panic in Sym.simp match reduction (#13635)
This PR fixes a `Sym.simp` panic ("unexpected kernel projection term
during simplification") that triggered when matcher iota-reduction
exposed kernel `Expr.proj` terms via struct-eta. For example, a `do`
block with a `for` loop whose state is a tuple, where `Sym.simp`
unfolds the equational lemma and then descends into a destructuring
match.
2026-05-05 03:20:20 +00:00

19 lines
370 B
Text

import Lean
set_option linter.unusedVariables false in
def loopy : Option Nat := do
let mut x : Nat := 0
let mut y : Nat := 0
let mut ok : Bool := false
for _ in [:1] do
x := x + 1
y := y + 1
ok := true
return x
/-- warning: declaration uses `sorry` -/
#guard_msgs in
example : loopy = some 0 := by
sym =>
simp [loopy.eq_1]
sorry