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

And を分解できる `and_constructor` と withMainContext

Open
#1,076 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 "step_3" : tactic => do
  let mvarId ← getMainGoal
  let goalType : Q(Prop) ← getMainTarget

  -- ゴールの状態が a ∧ b という形になっている(And _ _ の形)ことを確認して、
  -- a と b に相当するものを取り出す
  let ~q($a ∧ $b) := goalType
    | throwError "Goal type is not of the form `a ∧ b`"

  let mvarId1 ← mkFreshExprMVarQ q($a) (userName := `left)
  let mvarId2 ← mkFreshExprMVarQ q($b) (userName := `right)

  mvarId.assign q(And.intro $mvarId1 $mvarId2)
  modify fun _ => { goals := [mvarId1.mvarId!, mvarId2.mvarId!] }

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

The issue provides a Lean tactic snippet that manually decomposes an And goal and mentions and_constructor and withMainContext. Start by locating the corresponding Lean example or documentation entry; clarify the intended change and consider the work done only when the requested explanation or example is specified and added.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 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.