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

`guard` を使ったときに、命題に名前を付けて再利用したい

Open
#1,295 1 comment 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

以下の例では dependent ite を使っているが、guard 構文を利用できないか?

def bar (x : Nat) (_ : x % 2 == 0) := x

def foo (i : Nat) (arr : Array Nat) : Option Nat := do
  let x ← arr.get? i
  if h : x % 2 == 0 then
    some (bar x h)
  else
    none

Zulip: >
dependent guard syntax?

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

Start with the dependent guard syntax question in the issue and read the linked Zulip discussion. Determine whether Lean supports naming and reusing the proposition in this example; the work is complete only when the supported syntax or an explicit limitation is documented, with any needed example identified.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.