lean-ja / lean-by-example

コード例で学ぶ Lean 言語
https://lean-ja.github.io/lean-by-example/
MIT License
15 stars 5 forks source link

rw はローカル変数の展開は行わない #338

Open Seasawher opened 1 week ago

Seasawher commented 1 week ago
def smallNat : {x : Nat // x < 5 } := by
  let n := 2
  have h : n < 5 := by
    -- rw はローカル変数の展開は行わない
    fail_if_success rw [n]

    -- dsimp で展開できる
    dsimp [n]

    -- あとは 2 < 5 を示せばよいだけ
    show 2 < 5
    decide

  exact ⟨n, h⟩