Proving termination is of practicial significance to the programmer. Windows was known for crashing so often that serious programmers or computer scientists would not touch it. One of the reasons was that device drivers would go into an infinite loop. This problem has been sorted out thanks to formal methods that could automatically detect such problems.
Think of a while loop? How do you know that it terminates? Or maybe it doesnt? โฆ The technique that we learn now in order to show termination of ARSs will also apply to showing termination of loops in general.
The basic idea to prove termination of an ARS
Find a measure function
Why does this prove termination?
Recall our examples, listed for convenience again below.
Examples:
A is the set of finite lists (aka words) over
A is the set of multisets over
Langton's Ant is an example of an interesting ARS that is not termintating. But it nevertheless reaches some kind of stability that, even though not a normal form in the technical sense, has some resemblance with it. A point worth thinking about.
Def: Let
Fact: If an ARS has a measure function, then it is terminating.
We have seen examples of how to use measure functions to prove termination.
What about the converse? Can we always find a measure function if the ARS is terminating?
Let us look at the following example. Working out some reductions (eg write down all reductions starting from
Example: Let
Baader, Nipkow. Term Rewriting and All That. 1999
โโโโโโ Chapter
โโ 2.3 termination
Count the number of letters. More formally, you can implement a function
Count the number of "a"s. More formally, you can implement a function
Add the two measure functions above. More formally, define
Leaving this as an exercise for now, will see a simpler solution later when we learned about lexicographic orderings. โฉ๏ธ
Answer: