lean-ja / lean-ja/lean-by-example

simp の代わりに明示的に rw を使いたくなる状況の例

Open
#1,616 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

コード例 タクティク
Dominant language
Lean
Stars
188
Forks
15
Avg merge
9h 8m
Merged PRs (30d)
6

Description

protected theorem MyNat.lt_irrefl (n : MyNat) : ¬ (n < n) := by
  intro h
  dsimp [(· < ·), MyNat.lt] at *

  rw [MyNat.le_iff_add] at *
  obtain ⟨k, hk⟩ := h
  replace hk : n + (1 + k) = n + 0 := calc
    _ = n + 1 + k := by ac_rfl
    _ = n := by rw [hk]
    _ = n + 0 := by simp

  -- 単に simp とすると n+0 → n と単純化されてしまう
  rw [MyNat.add_left_cancel_iff] at hk
  simp at hk

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No target file or test is named. First locate the relevant example or documentation entry in the repository, then compare it with the supplied Lean snippet; done should be a clear example explaining when explicit rw is preferable to simp.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.