Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

Commit 1166951

Browse files
committed
翻訳完了
1 parent b58f488 commit 1166951

File tree

3 files changed

+78
-4
lines changed

3 files changed

+78
-4
lines changed

GLOSSARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@
298298
| choice node | |
299299
| cumulative | |
300300
| impredicativity, predicativity | |
301+
| inhabited | |
301302
| no confusion | |
302303
| out, semi-out | |
303304
| packed array | System Verilogという言語にこの名前の文法要素がある? |

Manual/Language/Classes/BasicClasses.lean

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,70 @@ open Verso.Genre.Manual
2121
tag := "basic-classes"
2222
%%%
2323

24+
:::comment
2425
Many Lean type classes exist in order to allow built-in notations such as addition or array indexing to be overloaded.
2526

27+
:::
28+
29+
Lean の型クラスの多くは、加算や配列インデックスのような組み込み記法をオーバーロードできるようにするために存在します。
30+
31+
:::comment
2632
# Boolean Equality Tests
2733

34+
:::
35+
36+
# 真偽値上の等価性のテスト(Boolean Equality Tests)
37+
2838
{docstring BEq}
2939

3040
{docstring Hashable}
3141

3242
{docstring LawfulBEq}
3343

44+
:::comment
3445
# Ordering
3546

47+
:::
48+
49+
# 順序(Ordering)
50+
3651
{docstring Ord}
3752

3853
{docstring LT}
3954

4055
{docstring LE}
4156

57+
:::comment
4258
# Decidability
4359

60+
:::
61+
62+
# 決定可能性(Decidability)
63+
4464
{docstring Decidable}
4565

4666
{docstring DecidableRel}
4767

4868
{docstring DecidableEq}
4969

70+
:::comment
5071
# Inhabited Types
5172

73+
:::
74+
75+
# inhabited な型(Inhabited Types)
76+
5277
{docstring Inhabited}
5378

5479
{docstring Nonempty}
5580

81+
:::comment
5682
# Visible Representations
5783

84+
:::
85+
86+
# 表現の可視化(Visible Representations)
87+
5888
:::planned 135
5989

6090
* How to write a correct {name}`Repr` instance
@@ -67,8 +97,13 @@ Many Lean type classes exist in order to allow built-in notations such as additi
6797

6898
{docstring ToString}
6999

100+
:::comment
70101
# Arithmetic and Bitwise Operators
71102

103+
:::
104+
105+
# 算術・ビット演算子(Arithmetic and Bitwise Operators)
106+
72107
{docstring Zero}
73108

74109
{docstring NeZero}
@@ -119,14 +154,24 @@ Many Lean type classes exist in order to allow built-in notations such as additi
119154

120155
{docstring HXor}
121156

157+
:::comment
122158
# Append
123159

160+
:::
161+
162+
# 結合(Append)
163+
124164
{docstring HAppend}
125165

126166
{docstring Append}
127167

168+
:::comment
128169
# Data Lookups
129170

171+
:::
172+
173+
# データの検索(Data Lookups)
174+
130175
{docstring GetElem}
131176

132177
{docstring GetElem?}

Manual/Language/Classes/DerivingHandlers.lean

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,46 @@ def derivableClassList : DirectiveExpander
4343
/-
4444
#doc (Manual) "Deriving Handlers" =>
4545
-/
46-
#doc (Manual) "ハンドラの導出(Deriving Handlers)" =>
46+
#doc (Manual) "導出ハンドラ(Deriving Handlers)" =>
4747
%%%
4848
tag := "deriving-handlers"
4949
%%%
5050

51+
:::comment
5152
Instance deriving uses a table of {deftech}_deriving handlers_ that maps type class names to metaprograms that derive instances for them.
5253
Deriving handlers may be added to the table using {lean}`registerDerivingHandler`, which should be called in an {keywordOf Lean.Parser.Command.initialize}`initialize` block.
5354
Each deriving handler should have the type {lean}`Array Name → CommandElabM Bool`.
5455
When a user requests that an instance of a class be derived, its registered handlers are called one at a time.
5556
They are provided with all of the names in the mutual block for which the instance is to be derived, and should either correctly derive an instance and return {lean}`true` or have no effect and return {lean}`false`.
5657
When a handler returns {lean}`true`, no further handlers are called.
5758

59+
:::
60+
61+
インスタンスの導出は {deftech}_導出ハンドラ_ (deriving handler)のテーブルを使用し、型クラス名をインスタンスを導出するメタプログラムにマッピングします。導出ハンドラは {lean}`registerDerivingHandler` を使用してテーブルに追加することができます。これは {keywordOf Lean.Parser.Command.initialize}`initialize` ブロック内で呼び出す必要があります。それぞれの導出ハンドラは {lean}`Array Name → CommandElabM Bool` 型を持つ必要があります。ユーザがクラスのインスタンス導出を要求すると、登録されているハンドラが1つずつ呼び出されます。これらのハンドラにはインスタンスを導出させる相互ブロック内のすべての名前が提供され、正しくインスタンスを導出した場合は {lean}`true` を、そうでない場合は何もせずに {lean}`false` を返します。ハンドラが {lean}`true` を返すと、それ以降のハンドラは呼び出されません。
62+
63+
:::comment
5864
Lean includes deriving handlers for the following classes:
65+
:::
66+
67+
Lean には以下のクラスの導出ハンドラがあります:
68+
5969
:::derivableClassList
6070
:::
6171

6272
{docstring Lean.Elab.registerDerivingHandler}
6373

6474

65-
::::keepEnv
66-
:::example "Deriving Handlers"
75+
:::::keepEnv
76+
:::comment
77+
::example "Deriving Handlers"
78+
:::
79+
::::example "導出ハンドラ"
80+
:::comment
6781
Instances of the {name}`IsEnum` class demonstrate that a type is a finite enumeration by providing a bijection between the type and a suitably-sized {name}`Fin`:
82+
:::
83+
84+
{name}`IsEnum` クラスのインスタンスは型に対して適切なサイズの {name}`Fin` との間に全単射を提供することによって型が有限に列挙されることを示します:
85+
6886
```lean
6987
class IsEnum (α : Type) where
7088
size : Nat
@@ -74,8 +92,13 @@ class IsEnum (α : Type) where
7492
from_to_id : ∀ (x : α), fromIdx (toIdx x) = x
7593
```
7694

95+
:::comment
7796
For inductive types that are trivial enumerations, where no constructor expects any parameters, instances of this class are quite repetitive.
7897
The instance for `Bool` is typical:
98+
:::
99+
100+
帰納型は自明な列挙であり、コンストラクタがパラメータを期待しない帰納型ではこのクラスのインスタンスにおいては非常に繰り返しが多いコードになります。 `Bool` のインスタンスが典型的です:
101+
79102
```lean
80103
instance : IsEnum Bool where
81104
size := 2
@@ -93,7 +116,12 @@ instance : IsEnum Bool where
93116
| true => rfl
94117
```
95118

119+
:::comment
96120
The deriving handler programmatically constructs each pattern case, by analogy to the {lean}`IsEnum Bool` implementation:
121+
:::
122+
123+
導出ハンドラは {lean}`IsEnum Bool` の実装をなぞるようにそれぞれのパターンのケースをプログラムで構築します:
124+
97125
```lean
98126
open Lean Elab Parser Term Command
99127

@@ -132,5 +160,5 @@ def deriveIsEnum (declNames : Array Name) : CommandElabM Bool := do
132160
initialize
133161
registerDerivingHandler ``IsEnum deriveIsEnum
134162
```
135-
:::
136163
::::
164+
:::::

0 commit comments

Comments
 (0)