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

List.attach 使用例

Open
#1,424 0 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

Zulip: How to make this recursion (?) work?

mutual
  inductive Value: Type where
  | function: ℕ → Expression → Value

  inductive Expression where
  | fun_apply: Expression → List Expression → Expression
end

def List.Exists {A} (L: List A) (P: A → Prop): Prop :=
  match L with
  | List.nil => False
  | x :: t => P x ∨ t.Exists P

def freeVariable (n: ℕ) (exp: Expression): Prop :=
  match exp with
  | Expression.fun_apply f L => freeVariable n f ∨ List.Exists L.attach (fun ⟨e, _⟩ => freeVariable n e)

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 linked Zulip discussion and the Lean snippet in the issue, focusing on List.attach and the recursive freeVariable definition. Determine how this example can be expressed correctly, then document a working List.attach usage example in the repository; done means the recursion and attached-list traversal are accepted by Lean.

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.