Skip to content

Commit

Permalink
コードの微修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Seasawher committed Dec 31, 2024
1 parent 273232b commit 756e21b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
7 changes: 4 additions & 3 deletions LeanByExample/Declarative/Infix.lean
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ open Lean in

/-- マクロを展開するコマンド -/
elab "#expand " t:macro_stx : command => do
let t : Syntax := match t.raw with
| .node _ _ #[t] => t
| _ => t.raw
let t : Syntax :=
match t.raw with
| .node _ _ #[t] => t
| _ => t.raw
match ← Elab.liftMacroM <| Macro.expandMacro? t with
| none => logInfo m!"Not a macro"
| some t => logInfo m!"{t}"
Expand Down
7 changes: 4 additions & 3 deletions LeanByExample/Declarative/Postfix.lean
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ open Lean in

/-- マクロを展開するコマンド -/
elab "#expand " t:macro_stx : command => do
let t : Syntax := match t.raw with
| .node _ _ #[t] => t
| _ => t.raw
let t : Syntax :=
match t.raw with
| .node _ _ #[t] => t
| _ => t.raw
match ← Elab.liftMacroM <| Macro.expandMacro? t with
| none => logInfo m!"Not a macro"
| some t => logInfo m!"{t}"
Expand Down
7 changes: 4 additions & 3 deletions LeanByExample/Declarative/Prefix.lean
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ open Lean in

/-- マクロを展開するコマンド -/
elab "#expand " t:macro_stx : command => do
let t : Syntax := match t.raw with
| .node _ _ #[t] => t
| _ => t.raw
let t : Syntax :=
match t.raw with
| .node _ _ #[t] => t
| _ => t.raw
match ← Elab.liftMacroM <| Macro.expandMacro? t with
| none => logInfo m!"Not a macro"
| some t => logInfo m!"{t}"
Expand Down
9 changes: 5 additions & 4 deletions LeanByExample/Tactic/Exists.lean
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Lean --#
example : ∃ x : Nat, 3 * x + 1 = 7 := by
exists 2

/- ## 内部処理についての補足
/- ## 舞台裏
なお Lean での存在量化の定義は次のようになっています。-/
--#--
-- Exists の定義が変わっていないことを確認する
Expand Down Expand Up @@ -41,9 +41,10 @@ open Lean in

/-- マクロを展開するコマンド -/
elab "#expand " t:macro_stx : command => do
let t : Syntax := match t.raw with
| .node _ _ #[t] => t
| _ => t.raw
let t : Syntax :=
match t.raw with
| .node _ _ #[t] => t
| _ => t.raw
match ← Elab.liftMacroM <| Macro.expandMacro? t with
| none => logInfo m!"Not a macro"
| some t => logInfo m!"{t}"
Expand Down
7 changes: 4 additions & 3 deletions LeanByExample/Tactic/ShowTerm.lean
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ open Lean in

/-- マクロを展開するコマンド -/
elab "#expand " t:macro_stx : command => do
let t : Syntax := match t.raw with
| .node _ _ #[t] => t
| _ => t.raw
let t : Syntax :=
match t.raw with
| .node _ _ #[t] => t
| _ => t.raw
match ← Elab.liftMacroM <| Macro.expandMacro? t with
| none => logInfo m!"Not a macro"
| some t => logInfo m!"{t}"
Expand Down

0 comments on commit 756e21b

Please sign in to comment.