lean-ja / lean-ja/lean-by-example

intro タクティク自作例

Open
#1,026 2 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.