paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Dynamic witnesses for static type errors (or, Ill-Typed Programs Usually Go Wrong)

静态类型错误的动态见证(或:类型不正确的程序通常确实会出错)
JFP vol.282018匹配度 2/10 · 论文主题为静态类型错误的反例见证生成与调试,属于程序分析与调试,但不涉及 LLM/Agent 与静态分析的交叉、浮点程序分析或贝叶斯程序分析,与画像核心方向仅泛泛相关。引用 2 inbox
ERIC L. SEIDEL, RANJIT JHALA, WESTLEY WEIMER
crossref: 2026-09-10

AI 速览

一句话:提出为静态类型错误合成反例见证输入,证明病态程序通常会出错,并用归约图和用户研究辅助调试。

静态类型错误是类型化函数式语言新手常遇到的障碍。本文提出动态解释方法:对类型不正确的函数体进行符号执行,合成能说明程序如何出错的反例见证输入。作者证明该方法生成通用见证:若找到见证,则对所有可居留输入类型,都存在使函数出错的值;并扩展为归约图以交互式可视化、调试见证执行。作者在含 4500 多个类型错误学生程序的两个数据集上评估:约 85% 的程序可生成见证,超过 80% 的见证得到小反例,简单启发式定位错误源准确率约 70%。用户研究显示,见证能帮助学生更好理解类型错误。

问题
静态类型错误对新手难以理解,标准错误信息往往无法说明程序为何出错。
方法
对类型不正确的函数体进行符号执行以合成反例见证输入,并构造归约图支持交互式可视化与调试;作者还证明所合成见证具有通用性。
评估
在 4500 多个学生程序上测覆盖率与定位准确率,并通过用户研究比较见证与标准错误信息对理解类型错误的影响。
原文摘要(Abstract)

Abstract Static type errors are a common stumbling block for newcomers to typed functional languages. We present a dynamic approach to explaining type errors by generating counterexample witness inputs that illustrate how an ill-typed program goes wrong. First, given an ill-typed function, we symbolically execute the body to synthesize witness values that make the program go wrong. We prove that our procedure synthesizes general witnesses in that if a witness is found, then for all inhabited input types, there exist values that can make the function go wrong. Second, we show how to extend this procedure to produce a reduction graph that can be used to interactively visualize and debug witness executions. Third, we evaluate the coverage of our approach on two data sets comprising over 4,500 ill-typed student programs. Our technique is able to generate witnesses for around 85% of the programs, our reduction graph yields small counterexamples for over 80% of the witnesses, and a simple heuristic allows us to use witnesses to locate the source of type errors with around 70% accuracy. Finally, we evaluate whether our witnesses help students understand and fix type errors, and find that students presented with our witnesses show a greater understanding of type errors than those presented with a standard error message.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot331,
  title = {Dynamic witnesses for static type errors (or, Ill-Typed Programs Usually Go Wrong)},
  author = {ERIC L. SEIDEL and RANJIT JHALA and WESTLEY WEIMER},
  journal = {Journal of Functional Programming},
  volume = {28},
  year = {2018},
  doi = {10.1017/s0956796818000126}
}