lean-ja / lean-ja/lean-by-example
`[computed_field]` 属性とは何か
Open
Nobody has claimed this yet.
属性
要調査
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
Name の定義に出現する:
inductive Name where
/-- The "anonymous" name. -/
| anonymous : Name
/--
A string name. The name `Lean.Meta.run` is represented at
-/
| str (pre : Name) (str : String)
/--
A numerical name. This kind of name is used, for example, to create hierarchical names for
free variables and metavariables. The identifier `_uniq.231` is represented as
-/
| num (pre : Name) (i : Nat)
with
/-- A hash function for names, which is stored inside the name itself as a
computed field. -/
@[computed_field] hash : Name → UInt64
| .anonymous => .ofNatCore 1723 (by decide)
| .str p s => mixHash p.hash s.hash
| .num p v => mixHash p.hash (dite (LT.lt v UInt64.size) (fun h => UInt64.ofNatCore v h) (fun _ => UInt64.ofNatCore 17 (by 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
Start with the Name definition and its @[computed_field] hash declaration shown in the issue, then determine what Lean's computed_field attribute means and why it is used there. Done means adding a clear explanation of the attribute and its role in this example to the appropriate project documentation.
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
- 30/100