lean-ja / lean-ja/lean-by-example
with_unfolding_all の使用例
Open
Nobody has claimed this yet.
コード例
メタプログラミング
メモ
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
Zulip: decide that can see through irreducible
import Mathlib.Algebra.Group.Nat
structure A where
n : ℕ
deriving DecidableEq
instance : LE A where le x y := x.n ≤ y.n
instance : DecidableRel (@LE.le A _) := by
intro x y
exact x.n.decLe y.n
@[irreducible] def sqr (x : A) : A := ⟨x.n ^ 2⟩
example : sqr (⟨3⟩ : A) ≤ ⟨9⟩ := by native_decide -- Works, but is native_decide
example : sqr (⟨3⟩ : A) ≤ ⟨9⟩ := by decide -- Fails
example : sqr (⟨3⟩ : A) ≤ ⟨9⟩ := by rfl -- Fails
-- Answer
example : sqr (⟨3⟩ : A) ≤ ⟨9⟩ := by with_unfolding_all decide
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 supplies a complete Lean example demonstrating with_unfolding_all with an irreducible definition, but it names no destination file or test. First inspect the repository’s existing example organization, then add the example in the appropriate location and verify that it renders and checks successfully.
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
- Mostly clear
- Newbie friendliness
- 45/100