Suppose I have:
A
Linear : Set
type for linear λ-calculus terms.A
reduce-once : Term → Term
function that performs a global reduction of redexes.A
size : Linear → Nat
relation that counts the number of constructors.A proof
reduce-once-halts : (t : Linear) → size (reduce-once t) < size t
.
That is, I have a proof that applying reduce-once
always decreases the size of a term. From that, one should logically be able to implement a terminating function, reduce : (t : Linear) → Sigma t IsNormalized
, that reduces the term to normal form. Since I believe this is a common situation, my question is: how is that usually formalized in Agda? How can I convince it that a function that decreases the size of its argument can be applied recursively and will eventually halt?