Files
lean-pl-tutorials/tutorial-01-basics/05-advanced-tactics.md

1.3 KiB
Raw Blame History

Unit 5 — Advanced Tactics

Tutorial 1: Lean 4 Fundamentals · ← Back to README

Goals

  • Prove properties by induction with induction
  • Use simp, ring, omega for automation
  • Use rcases and obtain for case analysis
  • Work with Nat arithmetic proofs

Sources

Exercises

open Nat

-- 5.1 — Induction on naturals
theorem add_assoc (a b c : Nat) : (a + b) + c = a + (b + c) := by
  sorry

theorem add_comm (a b : Nat) : a + b = b + a := by
  sorry

theorem mul_comm (a b : Nat) : a * b = b * a := by
  sorry

theorem zero_mul (n : Nat) : 0 * n = 0 := by
  sorry

-- 5.2 — Induction on lists
theorem reverse_reverse (xs : List α) : xs.reverse.reverse = xs := by
  sorry

theorem length_append (xs ys : List α) : (xs ++ ys).length = xs.length + ys.length := by
  sorry

theorem map_id (xs : List α) : xs.map id = xs := by
  sorry

-- 5.3 — Using `simp` and `ring`
theorem square_sum (a b : Nat) : (a + b) ^ 2 = a ^ 2 + 2 * a * b + b ^ 2 := by
  sorry

Previous: Unit 4 · Next: Unit 6 — Structures and Type Classes