lean4-htt/tests/lean/run/issue4540.lean
Joachim Breitner 50a009f811
fix: recursion over predicates: add some whnf sprinkles (#5136)
This fixes #4540.

---------

Co-authored-by: Richard Kiss <him@richardkiss.com>
2024-08-29 16:55:54 +00:00

14 lines
580 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

variable {α : Type}
variable (r : αα → Prop)
/-- `SymmGen r` is the symmetric relation generated by `r`. -/
inductive SymmGen : αα → Prop
| rel : ∀ x y, r x y → SymmGen x y
| symm : ∀ x y, SymmGen x y → SymmGen y x
def MyRel : Nat → Nat → Prop := SymmGen fun x y => y = x + 2
theorem preserve_add' {a : Nat} : ∀ {x y : Nat}, MyRel x y → MyRel (x + a) (y + a)
| _, _, SymmGen.rel _ _ h => SymmGen.rel _ _ (by rw [h, Nat.add_right_comm])
| _, _, SymmGen.symm _ _ h => SymmGen.symm _ _ (preserve_add' h)
termination_by structural _ _ r => r