-
-
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
5 changed files
with
48 additions
and
6 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
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,18 @@ | ||
import Mathlib.Tactic.Relation.Rfl | ||
|
||
-- `n ≤ n` を示すために必要 | ||
import Mathlib.Data.Nat.Basic | ||
|
||
-- ANCHOR: first | ||
inductive MyEq {α : Type u} : α → α → Prop | ||
| refl (a : α) : MyEq a a | ||
|
||
attribute [refl] MyEq.refl | ||
|
||
example (n : ℕ) : MyEq n n := by rfl | ||
-- ANCHOR_END: first | ||
|
||
-- ANCHOR: nat | ||
-- `import Mathlib.Data.Nat.Basic` が必要 | ||
example (n : Nat) : n ≤ n := by rfl | ||
-- ANCHOR_END: nat |
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 |
---|---|---|
@@ -1,9 +1,32 @@ | ||
# rfl | ||
|
||
needs: `import Mathlib.Tactic.Relation.Rfl` | ||
|
||
named after: 反射律(reflexivity) | ||
|
||
`rfl` は,定義から等しいものが等しいことを示すタクティクです. | ||
`rfl` は,`refl attribute` の付けられた定理を用いて関係の反射性を示すタクティクです. | ||
|
||
```lean | ||
{{#include ../Examples/Rfl/Rfl.lean:first}} | ||
``` | ||
|
||
`@[refl]` で登録された定理を用いるので,追加でライブラリを import することにより示すことができる命題が増えます. | ||
|
||
```lean | ||
{{#include ../Examples/Rfl/Rfl.lean:nat}} | ||
``` | ||
|
||
## 補足 | ||
|
||
実は `Mathlib.Tactic.Relation.Rfl` を import するかどうかにより,内部で呼び出されるタクティクが変わります. | ||
|
||
* `Mathlib.Tactic.Relation.Rfl` ありなら [Lean.MVarId.rfl](https://leanprover-community.github.io/mathlib4_docs//Mathlib/Tactic/Relation/Rfl.html#Lean.MVarId.rfl) が, | ||
* なしなら [Lean.MVarId.refl](https://leanprover-community.github.io/mathlib4_docs//Lean/Meta/Tactic/Refl.html#Lean.MVarId.refl) が | ||
|
||
それぞれ参照されます.後者は `@[refl]` が付けられた一般の関係の反射性にアクセスできず,等号 `=` の反射性しか使うことができません. | ||
|
||
後者の場合 `rfl` は,単に定義から等しいものが等しいことを示すタクティクになります. | ||
|
||
```lean | ||
{{#include ../Examples/Rfl.lean}} | ||
``` | ||
{{#include ../Examples/Rfl/Refl.lean}} | ||
``` |