This PR makes functions defined by well-founded recursion use an `opaque` well-founded proof by default. This reliably prevents kernel reduction of such definitions and proofs, which tends to be prohibitively slow (fixes #2171), and which regularly causes hard-to-debug kernel type-checking failures. This changes renders `unseal` ineffective for such definitions. To avoid the opaque proof, annotate the function definition with `@[semireducible]`.
12 lines
304 B
Text
12 lines
304 B
Text
def g (n : Nat) : Nat :=
|
|
if h : n = 0 then
|
|
1
|
|
else
|
|
4 + g (n - 1)
|
|
termination_by n
|
|
decreasing_by simp_wf; omega
|
|
|
|
example : g 10000 = id g (id 10000) := rfl
|
|
example : id g 10000 = id g (id 10000) := rfl
|
|
example : g 10000 + 0 = g (id 10000) + 0 := rfl
|
|
example : g 10000 = g (id 10000) := rfl
|