simp fails to rewrite inside Array.filterMap since respectTransparency.types (#13895): processCongrHypothesis Array.filterMap_congr failed
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 20/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- compilers
Research direction
Reproduce the snippet on the failing nightly and with set_option backward.isDefEq.respectTransparency.types false, then enable trace.Meta.Tactic.simp.congr to confirm processCongrHypothesis Array.filterMap_congr failed. Read Array.filterMap_congr and the processCongrHypothesis/withSimpMetaConfig path where isDefEq runs at implicit transparency after #13895. Check the dependent stop := as.size trigger; done means the example closes with simp and the simp tests pass.
Written by the indexing model from the issue text.
Description
Prerequisites
- Checked that the issue exists in the latest version of Lean 4 (nightly-2026-11-20).
Description
Since v4.33.0, simp no longer rewrites a subterm inside Array.filterMap in the example below and leaves the goal unsolved. It works on v4.32.2. It also works on newer versions with set_option backward.isDefEq.respectTransparency.types false. The regression is still present on v4.37.0-rc1 and on nightly-2026-11-20 (commit 82bff16a3463).
Steps to Reproduce
inductive V where | int (n : Int) | bor (l : Nat) (c : V)
def entry? : V → Option (Option (Nat × V))
| .bor l c => some (some (l, c))
| _ => none
def coll (f : V → Option α) (v : V) : Array α :=
match f v with
| some x => #[x]
| none => match v with
| .bor _ c => coll f c
| _ => #[]
example (n : Int) : (coll entry? (.int n)).filterMap id = #[] := by simp [coll, entry?]
Expected behavior: the goal is closed, as on v4.32.2.
Actual behavior: the goal is left unsolved:
⊢ Array.filterMap id (coll entry? (V.int n)) 0 0 = #[]
With set_option trace.Meta.Tactic.simp.congr true, the trace shows:
processCongrHypothesis Array.filterMap_congr failed
Versions
Fails: v4.33.1, v4.34.1, v4.35.0, v4.36.0, v4.37.0-rc1, 4.38.0-nightly-2026-11-20 (commit 82bff16a3463).
Passes: v4.32.2, and every version above with set_option backward.isDefEq.respectTransparency.types false.
Analysis
Array.filterMap_congr is unchanged between v4.32.2 and v4.36.0. The equation lemmas of coll do fire (coll.eq_2, entry?.match_1.eq_2 show in trace.Meta.Tactic.simp.rewrite), but the rewritten array is not accepted back into the filterMap congruence. We suspect the isDefEq m val check in processCongrHypothesis (withSimpMetaConfig, now at implicit transparency for metavariable types after #13895) rejects the instantiation. A plausible trigger is the default argument stop := as.size, whose type depends on the array being rewritten: with an explicit non-dependent stop the behaviour differs. We have not confirmed this.
Smaller variants that pass on all versions: a non-recursive coll, a coll without the inner match, and if instead of match. The failure seems to need a structurally recursive definition whose equation lemma has a nested match.
Impact
About 30 simp proofs in one project hit this. The workaround, unfold before simp plus per-proof cleanup, changes the proof structure, so we would prefer a fix in simp.
Filed by Claude Code (AI agent) on behalf of the reporter.
- Dominant language
- Lean
- Stars
- 10.3k
- Forks
- 1.1k
- Avg merge
- 19h 8m
- Merged PRs (30d)
- 421
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from leanprover/lean4
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16681 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
leanprover/lean4#16305 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
leanprover/lean4#16299 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16257 ·
Maintainers usually reply within 1 day
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
leanprover/lean4#15683 ·
Maintainers usually reply within 1 day
All issues in leanprover/lean4
Similar issues
-
bug fixed form parser medium priority tokenizer
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
swc-project/swc-next-issues#817 ·
-
Magma mode: div:=, mod:= and the other keyword assignments (join:=, meet:=, diff:=, sdiff:=, and:=, or:=, xor:=) are refusedPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
sagemathinc/sagebrush#1683 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
microts: a model local that every branch assigns raises unused_assignments in the generated RustOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
pocket-stack/pocketjs#756 ·