Skip to main content
QUICK REVIEW

[Paper Review] Flexible Coinduction in Agda

Luca Ciccone, Dagnino, Francesco|arXiv (Cornell University)|Feb 14, 2020
Logic, programming, and type systemsComputer Science7 references2 citations
TL;DR

This paper presents a methodology for implementing generalized inference systems with corules in Agda, enabling formal verification of coinductive predicates that escape standard induction and coinduction. It introduces a two-tiered type system—using inductive and coinductive records alongside a parametric Step type—and proves a bounded coinduction principle to ensure correctness, demonstrating the approach on temporal logic operators like 'eventually' and 'infinitely often'.

ABSTRACT

Many properties of communication protocols stem from the combination of safety and liveness properties. Characterizing such combined properties by means of a single inference system is difficult because of the fundamentally different techniques (coinduction and induction, respectively) usually involved in defining and proving them. In this paper we show that Generalized Inference Systems allow for simple and insightful characterizations of (at least some of) these combined inductive/coinductive properties for dependent session types. In particular, we illustrate the role of corules in characterizing weak termination (the property of protocols that can always eventually terminate), fair compliance (the property of interactions that can always be extended to reach client satisfaction) and also fair subtyping, a liveness-preserving refinement relation for session types.

Motivation & Objective

  • To address the limitation of standard induction and coinduction in handling predicates defined by generalized inference systems with corules.
  • To develop a systematic Agda-based methodology for encoding such systems and proving their correctness.
  • To demonstrate the approach on temporal logic operators, showing its applicability to real-world verification tasks in concurrent systems.
  • To provide reusable guidelines for implementing complex coinductive predicates in Agda, especially those involving infinite structures and non-trivial reasoning.

Proposed method

  • Define a coinductive record to represent the intended interpretation of an inference system with corules (Gen(I, Ico)).
  • Use an inductive type to represent the inductive interpretation of the extended system (Ind(I ∪ Ico)).
  • Introduce a non-recursive parametric type 'Step' to express rule application relative to a given specification, enabling consistency checks.
  • Prove a bounded coinduction principle using the Step type to ensure completeness of the inference system.
  • Leverage Agda’s type system and features like with-clauses and absurd case handling to manage pattern matching on colists and equality reasoning.
  • Apply the framework to formalize temporal operators such as 'eventually', 'always', and 'infinitely often' as case studies.

Experimental results

Research questions

  • RQ1How can generalized inference systems with corules be formally encoded in Agda when standard coinduction fails?
  • RQ2What is a principled way to define and verify correctness of coinductive predicates that require infinite-depth reasoning?
  • RQ3How can bounded coinduction be formalized and proven in Agda to ensure completeness for such systems?
  • RQ4To what extent can the methodology scale to multi-argument predicates and complex data structures like colists?
  • RQ5Can temporal logic operators be effectively modeled and verified using this framework?

Key findings

  • The proposed methodology successfully encodes predicates such as 'maxElem' and 'infinitely often' that are not captured by standard inductive or coinductive interpretations.
  • The use of a parametric 'Step' type enables precise control over rule application and supports the formalization of the bounded coinduction principle.
  • The bounded coinduction principle is proven within Agda using the Step type, providing a canonical technique for verifying completeness.
  • Pattern matching on colists requires careful handling of thunks and absurd cases, which is managed via with-clauses and auxiliary equality proofs.
  • The framework scales to multi-argument predicates, though the complexity increases with the number of existential variables across colists.
  • The approach demonstrates that Agda can faithfully represent hand-written inference system schemes, enabling machine-checked proofs of complex coinductive properties.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.