-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Mathlib.Tactic.Convert | ||
|
||
variable (a b c: Nat) | ||
|
||
|
||
-- ANCHOR: first | ||
example (f : Nat → Nat) (h : f (a + b) = 0) (hc: a + b = c) : f (c) = 0 := by | ||
-- `h` はゴールと等しくないので失敗する | ||
try exact [h] | ||
|
||
-- `h` とゴールの差分を新たなゴールにする | ||
convert h | ||
|
||
-- ゴールが `⊢ c = a + b` に変わっている | ||
show c = a + b | ||
|
||
rw [hc] | ||
-- ANCHOR_END: first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# convert | ||
|
||
needs: `import Mathlib.Tactic.Convert` | ||
|
||
ローカルコンテキストに現在のゴールに近いけれども等しくはない `h` があるとき,`exact h` としても失敗します.しかし `convert h` は成功する可能性があり,成功した場合は `h` とゴールの差分を新たなゴールとします. | ||
|
||
```lean | ||
{{#include ../Examples/Convert.lean:first}} | ||
``` |