lean-ja / lean-ja/lean-by-example
`Std.Range` はダメ、`Std.Rco` などを使うべき
Open
Nobody has claimed this yet.
Zulipで解決済
コード例
データ型
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
import Lean
open Std
variable {α : Type} [Inhabited α] [LE α] [LT α]
variable [DecidableLE α] [DecidableLT α]
variable [IsLinearOrder α]
@[grind =]
theorem Range_mem_iff_Range_toList (range : Range) (i : Nat) : i ∈ range ↔ i ∈ range.toList := by
sorry
def isSorted (l : Array α) : Bool := Id.run do
let n := l.size
for h : i in [1:n] do
if l[i-1]'(by grind) > l[i] then
return false
return true
上記の sorry を埋められなくて困っていた。これは、Std.Range を使用しているのがよくない。
次は通る。
import Std
open Std
variable {α : Type} [Inhabited α] [LE α] [LT α]
variable [DecidableLE α] [DecidableLT α]
variable [IsLinearOrder α]
def isSorted (l : Array α) : Bool := Id.run do
let n := l.size
for h : i in 1...n do
if l[i-1] > l[i] then
return false
return true
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
Search the repository for the Range_mem_iff_Range_toList theorem and the isSorted example shown here. Read the surrounding example to determine which range notation is intended, then update the affected documentation example and verify that it compiles without the reported range-related issue.
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
- 55/100