State of the art optimisation passes for dependently typed languages can help erase the redundant information typical of invariant-rich data structures and programs. These automated processes do not dramatically change the structure of the data, even though more efficient representations could be available. Using Quantitative Type Theory, we demonstrate how to define an invariant-rich, typechecking time data structure packing an efficient runtime representation together with runtime irrelevant invariants. The compiler can then aggressively erase all such invariants during compilation. Unlike other approaches, the complexity of the resulting representation is entirely predictable, we do not require both representations to have the same structure, and yet we are able to seamlessly program as if we were using the high-level structure.
翻译:依附型语言的艺术优化通行证状态可以帮助消除常态丰富数据结构和程序典型的冗余信息。 这些自动化程序不会显著改变数据结构, 尽管可以提供更高效的表达方式。 我们使用量化类型理论, 演示如何定义一个富于差异性、 打字检查的时间数据结构, 将高效运行时间代表形式与运行时间无关的变量组合在一起。 然后, 编译者可以在编译过程中大力消除所有这些变量。 与其他方法不同, 由此产生的表达方式的复杂性是完全可预测的, 我们并不要求两个表达方式都具有相同的结构, 但我们能够无缝地编程, 就像我们使用高层次结构一样。