[Paper Review] On dependent types and intuitionism in programming mathematics
This paper advocates for using Agda—a language with dependent types and support for intuitionistic logic—as a superior tool for provable programming in mathematics. It demonstrates through a case study of the DoCon-A library that dependent types enable machine-checked proofs of algebraic structures, overcoming limitations of traditional languages like Haskell in expressing value-dependent types and ensuring correctness through type-level invariants.
It is discussed a practical possibility of a provable programming of mathematics basing on intuitionism and the dependent types feature of a programming language.The principles of constructive mathematics and provable programming are illustrated with examples taken from algebra. The discourse follows the experience in designing in Agda a computer algebra library DoCon-A, which deals with generic algebraic structures and also provides the needed machine-checked proofs. This paper is a revised translation of a certain paper published in Russian in 2014.
Motivation & Objective
- To investigate the feasibility of implementing a machine-checked computer algebra system using intuitionistic logic and dependent types.
- To address the limitations of generic programming languages like Haskell in expressing value-dependent mathematical domains (e.g., ℤ/(m) where m is a runtime value).
- To demonstrate that Agda’s dependent type system enables richer mathematical expressiveness and ensures correctness through type-level specifications.
- To show that formal proofs in mathematics can be systematically developed and verified using interactive theorem proving in Agda.
- To compare the effectiveness of human-guided proof construction versus automated theorem proving in dependent type systems.
Proposed method
- Designing and implementing the DoCon-A library in Agda to support generic algebraic structures such as groups, rings, and fields using type classes and dependent types.
- Using Agda’s dependent function types to encode mathematical structures where types depend on values (e.g., ℤ/(p) for prime p), enabling compile-time verification of correctness conditions.
- Applying constructive logic principles to define mathematical objects and proofs as computational artifacts, ensuring that every proof corresponds to a valid computation.
- Employing Agda’s proof language with explicit proof terms (e.g., using PE.refl, ≡begin_, ≡[ ]_, ≡end) to structure and verify equalities step-by-step.
- Leveraging Agda’s support for inductive proofs and lemmas (e.g., rev-append) to formalize complex mathematical properties like list reversal being an involution.
- Integrating proof search heuristics and interactive proof construction to manage the complexity of formal proofs, especially in cases requiring non-trivial lemmas.
Experimental results
Research questions
- RQ1Can dependent types in Agda effectively express value-dependent mathematical domains such as ℤ/(m) where m is a runtime parameter?
- RQ2How does the use of intuitionistic logic and dependent types improve the reliability and expressiveness of computer algebra systems compared to traditional functional languages?
- RQ3To what extent can automatic theorem provers assist in constructing formal proofs in dependent type systems, especially in complex proof steps?
- RQ4What are the practical challenges in developing a large-scale, machine-checked computer algebra library using Agda?
- RQ5How does the integration of proofs into the type system reduce the risk of logical errors in mathematical software?
Key findings
- Agda’s dependent type system allows for the precise encoding of mathematical structures where types depend on values, such as ℤ/(p) for prime p, enabling compile-time verification of correctness conditions.
- The DoCon-A library successfully implements generic algebraic structures (e.g., groups, rings) with machine-checked proofs, demonstrating the feasibility of provable programming in mathematics.
- Proofs in Agda are expressed as first-class values, and the use of explicit proof terms (e.g., via PE.refl and ≡begin_ ≡end) enables readable, modular, and verifiable formal proofs.
- The construction of non-trivial lemmas (e.g., rev-append) is a major bottleneck for automatic provers, but remains tractable with human guidance, highlighting the current limits of automation.
- Automatic provers assist in only about one-third of the proof effort, primarily in simplification and normalization steps, while the majority of proof invention remains human-guided.
- The integration of proofs into the type system significantly reduces the risk of logical errors, as incorrect implementations are ruled out at compile time through type checking.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.