Theory Termination
section ‹Termination heuristics›
text_raw ‹\label{sec:termination}›
theory Termination
imports "../Dict_Construction"
begin
text ‹
As indicated in the introduction, the newly-defined functions must be proven terminating. In
general, we cannot reuse the original termination proof, as the following example illustrates:
›
fun f :: "nat ⇒ nat" where
"f 0 = 0" |
"f (Suc n) = f n"
lemma [code]: "f x = f x" ..
text ‹
The invocation of @{theory_text ‹declassify f›} would fail, because @{const f}'s code equations
are not terminating.
Hence, in the general case where users have modified the code equations, we need to fall back
to an (automated) attempt to prove termination.
In the remainder of this section, we will illustrate the special case where the user has not
modified the code equations, i.e., the original termination proof should ``morally'' be still
applicable. For this, we will perform the dictionary construction manually.
›