lean4-htt/tests/lean/run/issue7408.lean
Joachim Breitner c797525d2a
fix: WellFounded preprocessing: use dsimp (#7409)
This PR allows the use of `dsimp` during preprocessing of well-founded
definitions. This fixes regressions when using `if-then-else` without
giving a name to the condition, but where the condition is needed for
the termination proof, in cases where that subexpression is reachable
only by dsimp, but not by simp (e.g. inside a dependent let)

Also fixes some preprocessing lemmas to not be bad simp lemmas (with
lambdas on the LHS, due to dot notation and unfortunate argument order)

This fixes #7408.
2025-03-09 22:19:16 +00:00

13 lines
357 B
Text

def computeFuel (mass : Nat) : Nat :=
let rec go acc cur :=
let n := cur / 3 - 2
if n = 0 then acc + cur else go (acc + cur) n
termination_by cur
go 0 mass - mass
def computeFuel' (mass : Nat) : Nat :=
let rec go acc cur :=
letI n := cur / 3 - 2
if n = 0 then acc + cur else go (acc + cur) n
termination_by cur
go 0 mass - mass