A practical formalization of monadic equational reasoning in dependent-type theory

被引:0
|
作者
Affeldt, Reynald [1 ]
Garrigue, Jacques [2 ]
Saikawa, Takafumi [2 ]
机构
[1] Natl Inst Adv Ind Sci & Technol, Digital Architecture Res Ctr, Tokyo, Japan
[2] Nagoya Univ, Grad Sch Math, Nagoya, Japan
关键词
D O I
10.1017/S0956796824000157
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
One can perform equational reasoning about computational effects with a purely functional programming language thanks to monads. Even though equational reasoning for effectful programs is desirable, it is not yet mainstream. This is partly because it is difficult to maintain pencil-and-paper proofs of large examples. We propose a formalization of a hierarchy of effects using monads in the Coq proof assistant that makes monadic equational reasoning practical. Our main idea is to formalize the hierarchy of effects and algebraic laws as interfaces like it is done when formalizing hierarchy of algebras in dependent-type theory. Thanks to this approach, we clearly separate equational laws from models. We can then take advantage of the sophisticated rewriting capabilities of Coq and build libraries of lemmas to achieve concise proofs of programs. We can also use the resulting framework to leverage on Coq's mathematical theories and formalize models of monads. In this article, we explain how we formalize a rich hierarchy of effects (nondeterminism, state, probability, etc.), how we mechanize examples of monadic equational reasoning from the literature, and how we apply our framework to the design of equational laws for a subset of ML with references.
引用
收藏
页数:40
相关论文
共 50 条
  • [1] Towards a Practical Library for Monadic Equational Reasoning in Coq
    Saito, Ayumu
    Affeldt, Reynald
    MATHEMATICS OF PROGRAM CONSTRUCTION (MPC 2022, 2022, 13544 : 151 - 177
  • [2] Just do It: Simple Monadic Equational Reasoning
    Gibbons, Jeremy
    Hinze, Ralf
    ACM SIGPLAN NOTICES, 2011, 46 (09) : 2 - 14
  • [3] Just do It: Simple Monadic Equational Reasoning
    Gibbons, Jeremy
    Hinze, Ralf
    ICFP 11 - PROCEEDINGS OF THE 2011 ACM SIGPLAN: INTERNATIONAL CONFERENCE ON FUNCTIONAL PROGRAMMING, 2011, : 2 - 14
  • [4] A Hierarchy of Monadic Effects for Program Verification Using Equational Reasoning
    Affeldt, Reynald
    Nowak, David
    Saikawa, Takafumi
    MATHEMATICS OF PROGRAM CONSTRUCTION, 2019, 11825 : 226 - 254
  • [5] Algorithmic Dependent-Type Theory of Situated Information and Context Assessments
    Loukanova, Roussanka
    19TH INTERNATIONAL SYMPOSIUM ON DISTRIBUTED COMPUTING AND ARTIFICIAL INTELLIGENCE, 2023, 583 : 31 - 41
  • [6] THE FORMALIZATION OF PRACTICAL REASONING: PROBLEMS AND PROSPECTS
    Thomason, Richmond H.
    JOURNAL OF APPLIED LOGICS-IFCOLOG JOURNAL OF LOGICS AND THEIR APPLICATIONS, 2014, 1 (02): : 47 - 76
  • [7] A THEORY OF PRACTICAL REASONING
    AUDI, R
    AMERICAN PHILOSOPHICAL QUARTERLY, 1982, 19 (01) : 25 - 39
  • [8] Practical Shape: A Theory of Practical Reasoning
    Russell, Devlin
    UTILITAS, 2020, 32 (02) : 253 - 256
  • [9] Practical Shape: A Theory of Practical Reasoning
    Price, A. W.
    MIND, 2020, 129 (513) : 314 - 323
  • [10] Practical Shape: A Theory of Practical Reasoning
    Swanton, Christine
    PHILOSOPHICAL QUARTERLY, 2020, 70 (279): : 421 - 423