Skip to content

variable 解説に theorem/def の変数取り込み差分と include の実例を追加#2325

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-variable-command-behavior
Draft

variable 解説に theorem/def の変数取り込み差分と include の実例を追加#2325
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-variable-command-behavior

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

variable の外側宣言が theoremdef で同様に取り込まれるように見える一方、実際は基準が異なるため混乱が起きていました。theorem は statement 基準、def は本体での使用も含むことを、失敗例と修正例で明示しました。

  • 変更内容: variable ページの挙動説明を補強

    • LeanByExample/Declarative/Variable.leantheorem / def の取り込み基準の違いを説明する節を追加
    • theorem で証明中のみ使う外側変数は自動取り込みされない点を明記
    • include n を使って theorem 側で明示的に取り込むパターンを追加
  • 変更内容: 挙動をそのまま再現できる最小例を追加

    • #guard_msgsunknown identifier 'n' を検証する失敗例
    • 同じ文脈で def が通る対比例
    • include n 後に theorem が通る成功例
variable (n : Nat)

#guard_msgs in
theorem foo (m : Nat) : m = m := by
  have : n = n := by rfl
  rfl

def foo' (m : Nat) : m = m := by
  have : n = n := by rfl
  rfl

include n
theorem foo_included (m : Nat) : m = m := by
  have : n = n := by rfl
  rfl

Copilot AI changed the title [WIP] Fix variable command behavior in def and theorem variable 解説に theorem/def の変数取り込み差分と include の実例を追加 May 19, 2026
Copilot AI requested a review from Seasawher May 19, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

variableコマンドの挙動がdefとtheoremでは異なる

3 participants