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]`.
21 lines
478 B
Text
21 lines
478 B
Text
import Lean
|
|
|
|
@[semireducible]
|
|
def ack : Nat → Nat → Nat
|
|
| 0, y => y+1
|
|
| x+1, 0 => ack x 1
|
|
| x+1, y+1 => ack x (ack (x+1) y)
|
|
|
|
set_option maxHeartbeats 500
|
|
open Lean Meta
|
|
|
|
/-- error: (kernel) deterministic timeout -/
|
|
#guard_msgs in
|
|
run_meta do
|
|
let type ← mkEq (← mkAppM ``ack #[mkNatLit 4, mkNatLit 4]) (mkNatLit 100000)
|
|
let value ← mkEqRefl (mkNatLit 100000)
|
|
addDecl <| .thmDecl {
|
|
name := `ack_4_4
|
|
levelParams := []
|
|
type, value
|
|
}
|