[ refactor ] Port Yaffle's Value#3754
Conversation
3577754 to
fe23002
Compare
fe23002 to
67977e6
Compare
|
Well, it was hard to rebase but still need some care to clean up comments, logs and so on. It was hard... no much to say for now. 😅 |
6632c4a to
e747679
Compare
e9d5d1d to
495f36d
Compare
|
We've been building on a minimal slice of this PR (lineage around ca73c33) and stress-testing the new-core totality checker against deptycheck-style code: deeply indexed types, large derived generators, heavy erased proof arguments. Three findings that may be useful for the port, all with small repros; fix branches are public on our fork (haskiindahouse/Idris2). 1. False "possibly not terminating" from erased (Rig0) proof arguments. 2. …but skipping erased args naively is unsound. data Empty : Type where
step2 : (0 contra : Empty) -> Empty
step2 _ impossible
total
falseEmpty : Empty
falseEmpty = step2 falseEmpty -- accepted total with a naive skip; rejected by masterAfter testing both extremes (a blanket skip is unsound; keeping all self-edges from erased args reintroduces the 29 false positives), the rule we landed on: inside an erased argument, descend only when the argument is headed by a direct application of the function under size-change check, and keep only those self-edges (branch 3. Deep-pattern performance cliff in getSC. Happy to upstream any of this as patches once the port stabilizes; repros and branches are on the fork. |
|
@haskiindahouse please attach a link with a suggested fix to each issue from the list of your comment. As for now I was able to determine only a fix for issue 1 and a fix for issue 2. Is it correct? |
|
@GulinSS yep, correct but special for you: I've cleaned these up into two self-contained branches off ca73, so each fix is a single commit touching only the totality checker, with the unrelated perf/memoise work stripped out.
Issue 3 — the part that was out of date: totality/getsc-cliff (https://github.com/haskiindahouse/Idris2/tree/totality/getsc-cliff) (9726ce8)
Caveats, so nothing's oversold:
|
Co-authored-by: Justus Matthiesen <mail@justusmatthiesen.com>
Replace List-based tracking of erased variables with specialized VarSet type for improved performance. Changes include: - Update getErased function in Env.idr to return VarSet instead of List - Modify linear check functions to use VarSet operations throughout - Add elemNat helper for efficient natural number lookups in VarSet - Use VarSet.empty constant instead of empty lists - Apply proper weakening operations with varSetWeaken interface This improves efficiency of linearity checking by using specialized set operations instead of list traversals.
+ Cherry-picked refactor from #16 Co-authored-by: Viktor Yudov <me@spcfox.com> fix
- generalised lookup - define resolveRef as the weakening of findBound, add missing cases to substName - define underBinders, fix argument order - added underBinderz, more GenWeakenable instances - complete refactors regarding swapping inner/outer - change constructor argument representation from Scope to List Name Co-authored-by: Justus Matthiesen <mail@justusmatthiesen.com>
Now the tag is always 0
Co-authored-by: Viktor Yudov <me@spcfox.com> Co-authored-by: Denis Buzdalov <public@buzden.ru>
Co-authored-by: Viktor Yudov <me@spcfox.com>
Co-authored-by: Viktor Yudov <me@spcfox.com>
Co-authored-by: Viktor Yudov <me@spcfox.com>
26e69c7 to
fca2d1b
Compare
e13ef70 to
3006e1f
Compare
(cherry picked from commit 790425e)
3006e1f to
d8710a6
Compare
This PR tracks the ongoing effort to port Yaffle into the Idris2 codebase.
Work in progress — This PR is primarily for tracking progress. The current state is
outdated andincomplete.This PR requires the following to be merged first: #3513
PR commits will be squashed into a series of less number of commits to improve maintainability during rebases and ease review.
Squashed, origin: https://github.com/GulinSS/Idris2/tree/core-evaluate-value/all-no-compact