lean-ja / lean-by-example

コード例で学ぶ Lean 言語
https://lean-ja.github.io/lean-by-example/
MIT License
51 stars 7 forks source link

generalizing 構文 #1066

Closed Seasawher closed 3 weeks ago

Seasawher commented 3 weeks ago
namespace Hidden

def even (n : Nat) := n % 2 = 0

example (n m : Nat) (h : even (n + m)) (hm : even m) : even n := by
  generalize hx : n + m = x at h
  induction x

  case zero => simp_all

  case succ n' ih =>
    guard_hyp ih : n + m = n' → even n' → even n
    sorry

example (n m : Nat) (h : even (n + m)) (hm : even m) : even n := by
  generalize hx : n + m = x at h
  induction x generalizing n m

  case zero => simp_all
  case succ x ih =>
    sorry

end Hidden
Seasawher commented 3 weeks ago

resolve by 853e812682f32431fd1a087d58be1cc2baa622b2