TY - GEN
T1 - How to Safely Use Extensionality in Liquid Haskell
AU - Vazou, Niki
AU - Greenberg, Michael
N1 - Publisher Copyright:
© 2022 Copyright held by the owner/author(s). Publication rights licensed to ACM.
PY - 2022/9/6
Y1 - 2022/9/6
N2 - Refinement type checkers are a powerful way to reason about functional programs. For example, one can prove properties of a slow, specification implementation and port the proofs to an optimized pure implementation that behaves the same. But to reason about higher-order programs, we must reason about equalities between functions: we need a consistent encoding of functional extensionality. A natural but naive phrasing of the functional extensionality axiom (funext) is inconsistent in refinement type systems with semantic subtyping and polymorphism: if we assume funext, then we can prove false. We demonstrate the inconsistency and develop a new approach to equality in Liquid Haskell: we define a propositional equality in a library we call PEq. Using PEq avoids the inconsistency while proving useful equalities at higher types; we demonstrate its use in several case studies. We validate PEq by building a model and developing its metatheory. Additionally, we prove metaproperties of PEq inside Liquid Haskell itself using an unnamed folklore technique, which we dub ‘classy induction’.
AB - Refinement type checkers are a powerful way to reason about functional programs. For example, one can prove properties of a slow, specification implementation and port the proofs to an optimized pure implementation that behaves the same. But to reason about higher-order programs, we must reason about equalities between functions: we need a consistent encoding of functional extensionality. A natural but naive phrasing of the functional extensionality axiom (funext) is inconsistent in refinement type systems with semantic subtyping and polymorphism: if we assume funext, then we can prove false. We demonstrate the inconsistency and develop a new approach to equality in Liquid Haskell: we define a propositional equality in a library we call PEq. Using PEq avoids the inconsistency while proving useful equalities at higher types; we demonstrate its use in several case studies. We validate PEq by building a model and developing its metatheory. Additionally, we prove metaproperties of PEq inside Liquid Haskell itself using an unnamed folklore technique, which we dub ‘classy induction’.
KW - function equality
KW - functional extensionality
KW - refinement types
UR - https://www.scopus.com/pages/publications/105042678053
UR - https://www.scopus.com/pages/publications/105042678053#tab=citedBy
U2 - 10.1145/3546189.3549919
DO - 10.1145/3546189.3549919
M3 - Conference contribution
AN - SCOPUS:105042678053
T3 - Haskell 2022 - Proceedings of the 15th ACM SIGPLAN International Symposium on Haskell, Co-located with ICFP 2022
SP - 13
EP - 26
BT - Haskell 2022 - Proceedings of the 15th ACM SIGPLAN International Symposium on Haskell, Co-located with ICFP 2022
A2 - Polikarpova, Nadia
T2 - 15th ACM SIGPLAN International Symposium on Haskell, Haskell 2022
Y2 - 15 September 2022 through 16 September 2022
ER -