theorem_proving_in_lean4 icon indicating copy to clipboard operation
theorem_proving_in_lean4 copied to clipboard

Broken proof in Induction & Recursion -> Local Recursive Decls

Open ketilwright opened this issue 1 year ago • 0 comments

This proof squiggles on add_succ succ_add


def replicate (n : Nat) (a : α) : List α :=
  loop n []
where
  loop : Nat → List α → List α
    | 0,   as => as
    | n+1, as => loop n (a::as)

theorem length_replicate (n : Nat) (a : α) : (replicate n a).length = n := by
  exact aux n []
where
  aux (n : Nat) (as : List α)
      : (replicate.loop a n as).length = n + as.length := by
    match n with
    | 0   => simp [replicate.loop]
    | n+1 => simp [replicate.loop, aux n, Nat.add_succ, Nat.succ_add]

This appears to work

| n+1 => simp [replicate.loop, aux n, Nat.succ_add_eq_add_succ]

ketilwright avatar Jan 18 '25 19:01 ketilwright