Zulip Chat Archive

Stream: new members

Topic: factorial base cases


Bo Qin (Aug 19 2025 at 14:55):

how come this gives error? math2001 exercise 6.2.7.7
math6.2.7.7.png

example {n : } (hn : 2  n) : Nat.Even (n !) := by
  induction_from_starting_point n, hn with k hk IH
  · use 1
    calc
      2 ! = 2 * 1 ! := by rw[factorial]
      _ = 2 * (1 * 0 !) := by rw[factorial]
      _ = 2 * 1 * 1 := by rw[factorial]
      _ = 2 * 1 := by ring
  · obtain x, hx := IH
    use k * x + x
    calc
      (k + 1)! = (k + 1) * k ! := by rw[factorial]
      _ = (k + 1) * (2 * x) := by rw[hx]
      _ = 2 * (k * x + x) := by ring

Aaron Liu (Aug 19 2025 at 14:57):

what's the error you get?

Bo Qin (Aug 19 2025 at 14:58):

math6.2.7.7error.png

Aaron Liu (Aug 19 2025 at 14:58):

oh it rewrote the wrong occurrence

Bo Qin (Aug 19 2025 at 14:59):

Is that a bug?

Aaron Liu (Aug 19 2025 at 15:00):

lean4#5026

Bo Qin (Aug 19 2025 at 15:01):

This one also rewrote the wrong one it seems:

math6.2.6.png

Bo Qin (Aug 19 2025 at 15:02):

What can I use instead of rw?

Bo Qin (Aug 19 2025 at 15:05):

ok I see, need to be more specific https://github.com/leanprover/lean4/issues/5026#issuecomment-2640300127


Last updated: Dec 20 2025 at 21:32 UTC