lean-ja / lean-ja/lean-by-example
`simp [*] at ..` は条件付きの書き換えが(部分的に)できる
Open
Nobody has claimed this yet.
コード例
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
/-- 整数をイメージした何か -/
opaque MyInt : Type
variable [LE MyInt] [Zero MyInt]
/-- `x ≤ 0` という前提の下では `0 ≤ x` と `x = 0` は同値 -/
@[simp]
axiom MyInt.le_zero_implies {x : MyInt} (le : x ≤ 0) : 0 ≤ x ↔ x = 0
example (x : MyInt) (le : x ≤ 0) (ge : 0 ≤ x) : x = 0 := by
-- `simp at *` は「前提条件を満たしたときの書き換え」ができない
fail_if_success simp at *
-- discharger の指定が必要
simp (disch := assumption) at *
assumption
example (x : MyInt) (le : x ≤ 0) (ge : 0 ≤ x) : x = 0 := by
-- `simp_all` はローカルコンテキストを自動で引数に拾ってくれる
simp_all only [MyInt.le_zero_implies]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue provides Lean examples using simp at *, simp (disch := assumption) at *, and simp_all, but names no repository file or test. First locate the relevant example or documentation entry, then clarify the intended explanation of conditional rewriting and verify that the documented examples accurately show the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100