Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#test コマンドを紹介する #1222

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions LeanByExample/Diagnostic/Test.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/- # \#test
`#test` コマンドは、Plausible ライブラリで定義されているもので、与えられた命題が成り立つかどうか、具体例をランダムに生成してチェックすることで検証します。[`plausible`](#{root}/Tactic/Plausible.md) タクティクと同様の機能を持ちます。
-/
import Plausible

-- 命題 `P : Prop` に対して、`#test P` で `P` が成り立つかどうかを検証する
#test ∀ (n : Nat), n + 0 = n

-- 反例が見つからなければ「反例が見つからない」と教えてくれる
/-- info: Unable to find a counter-example -/
#guard_msgs in
#test ∀ (n : Nat), n + n = 2 * n
2 changes: 2 additions & 0 deletions LeanByExample/Tactic/Plausible.lean
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ warning: declaration uses 'sorry'
example (a : Nat) : a ≠ a → a ≤ 1 := by
plausible

/- 同様の機能を持つコマンドとして [`#test`](#{root}/Diagnostic/Test.md) コマンドがあります。-/

/- ## 引数
引数として、オプションを渡すことができます。

Expand Down
1 change: 1 addition & 0 deletions booksrc/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [#print: 中身を見る](./Diagnostic/Print.md)
- [#reduce: 式を簡約する](./Diagnostic/Reduce.md)
- [#synth: 型クラスの検査](./Diagnostic/Synth.md)
- [#test: プロパティベーステスト](./Diagnostic/Test.md)
- [#time: 実行時間計測](./Diagnostic/Time.md)
- [#version: バージョン表示](./Diagnostic/Version.md)
- [#whnf: 式を弱頭正規形に](./Diagnostic/Whnf.md)
Expand Down
Loading