Skip to content

Commit

Permalink
zify を紹介する
Browse files Browse the repository at this point in the history
Fixes #1193
  • Loading branch information
Seasawher committed Dec 16, 2024
1 parent 703625b commit 0fe4627
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions LeanByExample/Reference/Tactic/Zify.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/- # zify
`zify` タクティクは、自然数 `Nat` についての命題を整数 `Int` についての命題に変換します。
-/
import Mathlib.Tactic.Zify -- `zify` タクティクを使うのに必要
import Mathlib.Tactic.GCongr

example (x : Nat) (h : x ≥ 5) : 153 * x := by
-- 仮定とゴールを整数の不等式に変換する
zify at h ⊢

-- 整数についての命題に変換した
guard_hyp h : x ≥ (5 : Int)
guard_target = (15 : Int) ≤ 3 * ↑x

calc
(15 : Int) = 3 * 5 := by rfl
_ ≤ 3 * ↑x := by gcongr; decide
1 change: 1 addition & 0 deletions booksrc/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
- [unfold: 定義に展開](./Reference/Tactic/Unfold.md)
- [with_reducible: 透過度指定](./Reference/Tactic/WithReducible.md)
- [wlog: 一般性を失わずに特殊化](./Reference/Tactic/Wlog.md)
- [zify: 整数にキャストする](./Reference/Tactic/Zify.md)

# 第2部: チュートリアル

Expand Down

0 comments on commit 0fe4627

Please sign in to comment.