23. Sum over an append

EasyProofFree10 points

total adds up a list of numbers. Prove that the total of xs ++ ys is the total of xs plus the total of ys.

Solution.lean
1def total : List Nat → Nat
2 | [] => 0
3 | x :: xs => x + total xs
4theorem solution (xs ys : List Nat) : total (xs ++ ys) = total xs + total ys := by
given
Loading editor…

Where you start. Everything above ⊢ may be assumed; the line below it is what you must prove.

xs ys:List Nat
⊢total (xs ++ ys) = total xs + total ys
ReadyLn 1, Col 1Lean 4
Draft saved in this browser