Repository navigation
feat: eta-expand partial recursor apps for structures/K-like types - #15374
Conversation
|
downstream |
d414622 to
00960f8
Compare
|
changelog-language |
1cc09a5 to
683d4d3
Compare
…264) Tests for the eta-related changes planned in leanprover/lean4#14977: * corner-cases/eta-struct-major-no-whnf: structure eta on a recursor major before reducing it (leanprover/lean4#15351) * corner-cases/eta-struct-major-and: structure eta on a major in `Prop`, like `And` (leanprover/lean4#15371, leanprover/lean4#3213) * corner-cases/eta-struct-major-and-no-whnf: both together, with a non-normalizing proof as major * corner-cases/eta-unit-like-{pi,struct,proof-field,nested}: the extended unit-like criterion (leanprover/lean4#15372, leanprover/lean4#2258) * corner-cases/eta-rec-struct: eta-expansion of a structure recursor missing its major (leanprover/lean4#15374) * bugs/eta-ctor-alias: a soundness bug in a draft of leanprover/lean4#15373 and point the existing corner-cases/eta-ctor and corner-cases/eta-rule-k at leanprover/lean4#15373 and leanprover/lean4#15374. Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
|
Claude, while testing this change in con-leche, found this. Is this an issue?
|
Definitely yes ! This cannot happen on structure recursors since the recursor will always reduce once applied to a major, but the eta-expansion needs to be more fine-grained in the case of k-like inductives (e.g if the type of an appropriate |
|
To give a more detailed answer to the following sentence:
The eta-expansion only happens on recursors for k-like and structure types. For structure types, the type is either eta-expandable (e.g |
|
Rather than first eta-expand then wait for |
82637e2 to
b81b431
Compare
|
!bench |
|
Benchmark results for b81b431 against 2c2bdd9 are in. There are significant results. @arthur-adjedj
Large changes (1🟥)
Medium changes (1✅, 3🟥)
Small changes (13✅, 173🟥)
|
|
!bench |
|
Benchmark results for d979a09 against 2c2bdd9 are in. There are significant results. @arthur-adjedj
Large changes (2🟥)
Medium changes (1🟥)
Small changes (14✅, 185🟥)
|
d979a09 to
c641702
Compare
707bbe7 to
56e0c5d
Compare
…ors. This "fix" is currently needlessly expensive, as it repeats both the work of traversing the recursor's application telescope and checking that `toCtorWhenK` would be correct. TODO refactor
2f119c0 to
18e159d
Compare
|
The adaptation PR for this PR is leanprover/downstream-lean4#117. |
Conflict resolutions: * Lean/Meta/WHNF.lean: `reduceRec` is public (master) and keeps the early exits for recursors without rules or large elimination. * kernel/type_checker.cpp, Lean/Meta/ExprDefEq.lean: the recursor eta-expansion of leanprover#15374 tests structure eta with `has_eta`/`hasEta`, as the rest of the branch does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WD3k8hwfVBznY9FEMvR4xw
This PR eta-expands partial recursor applications when the major is missing and is an eta-expandable structure or of a K-like type.
Related to #14977
Second part of #12520