[Agda] Termination checker correctness proof

Altenkirch Thorsten psztxa at exmail.nottingham.ac.uk
Tue May 7 14:22:13 CEST 2013

There is certainly our old paper:


  author =       {Andreas Abel and Thorsten Altenkirch},
  title =        {A Predicative Analysis of Structural Recursion},
  journal =      {Journal of Functional Programming},
  year =         2002,
  volume =       12,
  number =       1,
  pages =        {1--41},
  month =        {January}


From: Jesper Cockx <Jesper at sikanda.be<mailto:Jesper at sikanda.be>>
Date: Tue, 7 May 2013 13:04:29 +0100
To: "agda at lists.chalmers.se<mailto:agda at lists.chalmers.se>" <agda at lists.chalmers.se<mailto:agda at lists.chalmers.se>>
Subject: [Agda] Termination checker correctness proof

Dear Agda mailing list,

I'm currently writing my master thesis on pattern matching with dependent types, and I have a question about the termination checker in Agda.

On the wiki page on termination<http://wiki.portal.chalmers.se/agda/pmwiki.php?n=ReferenceManual.TerminationChecker>, there is the following definition of the termination order:

 1.  Constructor elimination: if cons is a constructor, x < cons a1..an x b1..bn,
 2.  Application: if y<x then (ya)<x where a is a vector of terms.

but I can't find a proof why this termination order is correct, i.e. why it is well-founded. Specifically rule 2 seems suspicious because evaluating ya could give something that's not smaller than x.

A proof would certainly need the fact that data types are strictly positive, otherwise we get non-termination problems like the type Bad<http://wiki.portal.chalmers.se/agda/pmwiki.php?n=ReferenceManual.BadInHaskell>.

One way to argue correctness of the termination checker would be that pattern matching can be translated to a case tree, which can be translated to eliminators, which are terminating by some type theoretic metatheory. But I would like to have a more direct proof that doesn't use the equivalence with case trees.

Can someone give me an argument or a reference which shows that this termination order is well-founded? This would be much appreciated.

Best regards,

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment

may still contain software viruses which could damage your computer system:

you are advised to perform your own checks. Email communications with the

University of Nottingham may be monitored as permitted by UK legislation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.chalmers.se/pipermail/agda/attachments/20130507/c4e71b76/attachment.html

More information about the Agda mailing list