Zulip Chat Archive

Stream: lean4

Topic: Induction fails with let binding


𝚠𝚘𝚓𝚌𝚒𝚎𝚌𝚑 𝚗𝚊𝚠𝚛𝚘𝚌𝚔𝚒 (Nov 10 2025 at 22:18):

Is this a known issue?

inductive P : Nat  Prop
  | zero : P 0
  | succ {n : Nat} : P n  P (n + 1)

example : P (n + 1)  P n := by
  let m := n + 1; rw [ (show m = n + 1 from rfl)]
  intro h
  induction h
/-
Type mismatch when assigning motive
  let m := n + 1;
  fun h => P n
has type
  let m := n + 1;
  P m → Prop
but is expected to have type
  (a : Nat) → P a → Prop
-/

Kenny Lau (Nov 10 2025 at 22:30):

you can only induct on a free variable; you're meant to use generalize to convert it to a free variable.

𝚠𝚘𝚓𝚌𝚒𝚎𝚌𝚑 𝚗𝚊𝚠𝚛𝚘𝚌𝚔𝚒 (Nov 10 2025 at 22:33):

Yeah, I know :) I was just wondering if this has been discussed before, but it seems like it has, also here.


Last updated: Dec 20 2025 at 21:32 UTC