lean-ja / lean-ja/lean-by-example
intro タクティク自作例
Open
Nobody has claimed this yet.
コード例
タクティク
要調査
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
elab "my_intro" : tactic => do
let mvarId ← getMainGoal
let goalType ← getMainTarget
let Expr.forallE _ pFrom pTo _ := goalType
| throwError "Goal type is not of the form `a → b`"
let handyMvarId ← withLocalDecl `hA BinderInfo.default pFrom (fun fvar => do
-- 1. Create new `_`s with appropriate types.
let mvarId1 ← mkFreshExprMVar pTo MetavarKind.syntheticOpaque `goal
-- 2. Assign the main goal to the expression `fun hA => _`.
mvarId.assign (← mkLambdaFVars #[fvar] mvarId1)
-- just a handy way to return a handyRedMvarId for the next code
return mvarId1.mvarId!
)
modify fun _ => { goals := [handyMvarId] }
example {p q : Prop} (hq : q) : p → q := by
my_intro
exact hq
example : Nat → Nat := by
my_intro
exact 0
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
No target file or requested change is specified. Start by locating the introductory tactic material in the repository and compare its examples with the supplied snippet; completion should be defined by the issue author, including where the example belongs and how it should be checked.
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
- 25/100