Is it possible to write a recursive lambda expression in Isabelle/HOL? If so, how?
For example (a silly one):
fun thing :: "nat ⇒ nat" where
"thing x = (λx. if x=0 then x else …) x"
so instead of … I'd like to write the λ function applied to x-1.
How would I do this? Thanks in advance.
There is only one case where such things are necessary: when defining a function in a proof. I have done so, but this is far from beginner friendly, because you have to derive the simp rules by hand.
The solution is to mimic what
funis doing internally and expressing your definition in terms ofrec_nat:I cannot recommend doing that unless it is unavoidable...