Mikan
Safe HaskellNone
LanguageHaskell2010

Mikan.Termination.Termination

Description

Termination checker, based on "A Predicative Analysis of Structural Recursion" by Andreas Abel and Thorsten Altenkirch (JFP'01), and "The Size-Change Principle for Program Termination" by Chin Soon Lee, Neil Jones, and Amir Ben-Amram (POPL'01).

Synopsis

Documentation

data Terminates cinfo Source #

Result of running the termination checker.

Constructors

Terminates

Termination proved without considering guardedness.

TerminatesNot cinfo

Termination could not be proven, witnessed by the supplied problematic call path.

terminates :: (Monoid cinfo, ?cutoff :: CutOff) => CallGraph cinfo -> Terminates cinfo Source #

terminates cs checks if the functions represented by cs terminate. The call graph cs should have one entry (Call) per recursive function application.

The termination criterion is taken from Jones et al. In the completed call graph, each idempotent call-matrix from a function to itself must have a decreasing argument. Idempotency is wrt. matrix multiplication.

This criterion is strictly more liberal than searching for a lexicographic order (and easier to implement, but harder to justify).

terminatesFilter Source #

Arguments

:: (Monoid cinfo, ?cutoff :: CutOff) 
=> (Node -> Bool)

Only consider calls whose source and target satisfy this predicate.

-> CallGraph cinfo

Callgraph augmented with cinfo.

-> Terminates cinfo

A bad call path of type cinfo, if termination could not be proven.

While no counterexample to termination is found, complete the given call graph step-by-step.

terminationCounterexample Source #

Arguments

:: (?cutoff :: CutOff) 
=> (Node -> Bool)

Only consider calls whose source and target satisfy this predicate.

-> CallGraph cinfo

Callgraph augmented with cinfo.

-> Terminates cinfo

A bad call path of type cinfo, if termination could not be proven.

Does the given callgraph contain a counterexample to termination?

idempotentEndos :: (?cutoff :: CutOff) => CallGraph cinfo -> [CallMatrixAug cinfo] Source #

Get all idempotent call-matrixes of loops in the call graph.