Skip to content

Commit 5397d28

Browse files
authored
Merge pull request #1072 from lean-ja/update
バージョン更新
2 parents 39be4d2 + 1b097a2 commit 5397d28

File tree

10 files changed

+38
-55
lines changed

10 files changed

+38
-55
lines changed

LeanByExample/Reference/Declarative/Class.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ set_option pp.mvars false
102102

103103
-- 返り値の型がわからないので型クラス解決ができないというエラーが出ている
104104
/--
105-
error: typeclass instance problem is stuck, it is often due to metavariables
106-
Plus Nat (List Nat) ?_
105+
error: failed to synthesize
106+
Plus Nat (List Nat) (IO ?_)
107+
Additional diagnostic information may be available using the `set_option diagnostics true` command.
107108
-/
108109
#guard_msgs in #eval 1 +ₚ [1, 2]
109110

LeanByExample/Reference/Declarative/Deriving.lean

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@ inductive Color : Type where
1111
| green
1212
| blue
1313

14-
-- 最初は `Repr` が定義されていないので `eval` できない
14+
-- 暗黙的に Repr インスタンスを生成しない
15+
set_option eval.derive.repr false
16+
17+
-- `Repr` が定義されていないので `eval` できない
1518
/--
16-
error: expression
17-
Color.red
18-
has type
19+
error: could not synthesize a 'Repr' or 'ToString' instance for type
1920
Color
20-
but instance
21-
Lean.Eval Color
22-
failed to be synthesized, this instance instructs Lean on how to display the resulting value,
23-
recall that any type implementing the `Repr` class also implements the `Lean.Eval` class
2421
-/
2522
#guard_msgs in #eval Color.red
2623

LeanByExample/Reference/Diagnostic/Eval.lean

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,17 @@ def main : IO Unit :=
2626
式の評価を行うコマンドであるため、型や関数など、評価のしようがないものを与えるとエラーになります。-/
2727

2828
-- 型は評価できない
29-
/--
30-
error: expression
31-
32-
has type
33-
Type
34-
but instance
35-
Lean.MetaEval Type
36-
failed to be synthesized, this instance instructs Lean on how to display the resulting value, recall that any type implementing the `Repr` class also implements the `Lean.MetaEval` class
37-
-/
29+
/-- error: cannot evaluate, types are not computationally relevant -/
3830
#guard_msgs in #eval Nat
3931

4032
-- 関数そのものも評価できない
4133
/--
42-
error: expression
43-
fun x => x + 1
44-
has type
34+
error: could not synthesize a 'ToExpr', 'Repr', or 'ToString' instance for type
4535
ℕ → ℕ
46-
but instance
47-
Lean.MetaEval (ℕ → ℕ)
48-
failed to be synthesized, this instance instructs Lean on how to display the resulting value, recall that any type implementing the `Repr` class also implements the `Lean.MetaEval` class
4936
-/
5037
#guard_msgs in #eval (fun x => x + 1)
5138

52-
/- 一般に、[`Repr`](../TypeClass/Repr.md) や [`ToString`](../TypeClass/ToString.md) のインスタンスでないような型の項は `#eval` に渡すことができません。-/
39+
/- 一般に、[`Repr`](../TypeClass/Repr.md) や [`ToString`](../TypeClass/ToString.md) および `ToExpr` のインスタンスでないような型の項は `#eval` に渡すことができません。-/
5340

5441
/- ## 例外処理の慣例
5542
Lean および Mathlib では、「関数ではなく定理に制約を付ける」ことが慣例です。

LeanByExample/Reference/Tactic/Exact.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
ゴールが `P` で、ローカルコンテキストに `hP : P` があるときに、`exact hP` はゴールを閉じます。`hP` がゴールの証明になっていないときには、失敗してエラーになります。-/
44
variable (P Q : Prop)
5+
set_option linter.unusedVariables false in --#
56

67
example (hP : P) (hQ : Q) : P := by
78
-- `hQ : Q` は `P` の証明ではないのでもちろん失敗する

LeanByExample/Reference/Tactic/Rw.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ example (h : a = b) (hb : a + 3 = 0) : b + 3 = 0 := by
5151
5252
また、ゴールとローカルコンテキストの仮定 `h` に対して同時に書き換えたいときは `⊢` 記号を使って `rw [hPQ] at h ⊢` のようにします。-/
5353

54-
example (h : a + 0 = a) (h1 : b + (a + 0) = b + a) (h2 : a + (a + 0) = a)
54+
example (h : a + 0 = a) (_h1 : b + (a + 0) = b + a) (_h2 : a + (a + 0) = a)
5555
: a + 0 = 0 + a := by
5656
-- ローカルコンテキストとゴールのすべてに対して書き換えを行う
5757
rw [h] at *

LeanByExample/Reference/Type/List.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ example [Foldr α β] {a₁ a₂ a₃ : α} (init : β) :
142142
/- `List.foldl` と `List.foldr` の違いは、演算が左結合的と仮定するか右結合的と仮定するか以外にも、`List.foldl` は末尾再帰(tail recursion)であるが `List.foldr` はそうでないことが挙げられます。 -/
143143

144144
/-- 自然数のリストの総和を計算する関数 -/
145-
def List.sum : List Nat → Nat
145+
def List.sum' : List Nat → Nat
146146
| [] => 0
147147
| n :: ns => n + sum ns
148148

LeanByExample/Reference/TypeClass/HAdd.lean

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ structure Colour where
1111

1212
def sample : Colour := { red := 2, blue := 4, green := 8 }
1313

14+
-- メタ変数の番号を表示しない
15+
set_option pp.mvars false
16+
1417
-- 最初は `+` 記号が定義されていないのでエラーになります。
1518
/--
1619
error: failed to synthesize
17-
HAdd Colour Colour ?m.1653
20+
HAdd Colour Colour ?_
1821
Additional diagnostic information may be available using the `set_option diagnostics true` command.
1922
-/
2023
#guard_msgs in #eval sample + sample

LeanByExample/Reference/TypeClass/Repr.lean

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Repr
33
`Repr` は、その型の項をどのように表示するかを指示する型クラスです。
44
5-
たとえば、以下のように新しく[構造体](../Declarative/Structure.md) `Point` を定義したとき、特に何も指定しなければ `Point` の項を `#eval` で表示することはできません
5+
たとえば、以下のように新しく[構造体](../Declarative/Structure.md) `Point` を定義したとき、何も指定しなくても `Point` の項を `#eval` で表示することはできますが、裏で使用しているのが `Repr` インスタンスです
66
-/
77
namespace Repr --#
88

@@ -14,19 +14,16 @@ structure Point (α : Type) : Type where
1414
-- 原点
1515
def origin : Point Nat := ⟨0, 0
1616

17+
-- Repr インスタンスを暗黙的に生成しない
18+
set_option eval.derive.repr false
19+
1720
/--
18-
error: expression
19-
origin
20-
has type
21+
error: could not synthesize a 'Repr' or 'ToString' instance for type
2122
Point Nat
22-
but instance
23-
Lean.Eval (Point Nat)
24-
failed to be synthesized, this instance instructs Lean on how to display the resulting value,
25-
recall that any type implementing the `Repr` class also implements the `Lean.Eval` class
2623
-/
2724
#guard_msgs in #eval origin
2825

29-
/- エラーメッセージが示すように、これは `Point` が型クラス `Lean.Eval` のインスタンスではないからです。エラーメッセージには、`Repr` クラスのインスタンスであれば自動的に `Lean.Eval` のインスタンスにもなることが書かれています。通常、`Lean.Eval` のインスタンスを手で登録することはなく、`Repr` インスタンスによって自動生成させます
26+
/- エラーメッセージが示すように、`Point` が型クラス `Repr` または `ToString` のインスタンスではないため `#eval` が実行できずエラーになります
3027
3128
`Repr` インスタンスの登録方法ですが、通り一遍の表示で構わなければ [`deriving`](../Declarative/Deriving.md) コマンドで Lean に自動生成させることができます。-/
3229

@@ -78,10 +75,7 @@ local instance [Repr α] : Repr (NestedList α) where
7875
#guard_msgs in #eval sample
7976
end --#
8077

81-
/- あるいは、[`ToString`](./ToString.md) クラスのインスタンスがあればそこから `Lean.Eval` クラスのインスタンスも生成されて、表示に使われるので、それを利用しても良いでしょう。-/
82-
83-
-- `ToString` クラスのインスタンスがあれば、`Lean.Eval` のインスタンスが生成できる
84-
example {α : Type} [ToString α] : Lean.Eval α := inferInstance
78+
/- また、`Repr` インスタンスがなくても [`ToString`](./ToString.md) クラスのインスタンスがあればそれが表示に使われます。-/
8579

8680
/-- `NestedList` を文字列に変換 -/
8781
partial def NestedList.toString [ToString α] : NestedList α → String

lake-manifest.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "git",
66
"subDir": null,
77
"scope": "",
8-
"rev": "2cf1030dc2ae6b3632c84a09350b675ef3e347d0",
8+
"rev": "0c8ea32a15a4f74143e4e1e107ba2c412adb90fd",
99
"name": "Cli",
1010
"manifestFile": "lake-manifest.json",
1111
"inputRev": "main",
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"subDir": null,
1717
"scope": "",
18-
"rev": "4f5a57cc09c86b605511be02ca719f1499bc550e",
18+
"rev": "97c8a350066b8a807d246b905abb690c1a15315b",
1919
"name": "«mk-exercise»",
2020
"manifestFile": "lake-manifest.json",
2121
"inputRev": "main",
@@ -25,7 +25,7 @@
2525
"type": "git",
2626
"subDir": null,
2727
"scope": "",
28-
"rev": "3500acfb8036a4e11b047ef14f52b5b1d315005b",
28+
"rev": "d1585cbcb8a970d6fd68f2b7b68a7c6f6a8e33a2",
2929
"name": "mdgen",
3030
"manifestFile": "lake-manifest.json",
3131
"inputRev": "main",
@@ -35,7 +35,7 @@
3535
"type": "git",
3636
"subDir": null,
3737
"scope": "leanprover-community",
38-
"rev": "31a10a332858d6981dbcf55d54ee51680dd75f18",
38+
"rev": "af731107d531b39cd7278c73f91c573f40340612",
3939
"name": "batteries",
4040
"manifestFile": "lake-manifest.json",
4141
"inputRev": "main",
@@ -45,7 +45,7 @@
4545
"type": "git",
4646
"subDir": null,
4747
"scope": "leanprover-community",
48-
"rev": "d6ae727639429892c372d613b31967b6ee51f78c",
48+
"rev": "303b23fbcea94ac4f96e590c1cad6618fd4f5f41",
4949
"name": "Qq",
5050
"manifestFile": "lake-manifest.json",
5151
"inputRev": "master",
@@ -55,7 +55,7 @@
5555
"type": "git",
5656
"subDir": null,
5757
"scope": "leanprover-community",
58-
"rev": "5f934891e11d70a1b86e302fdf9cecfc21e8de46",
58+
"rev": "5dfdc66e0d503631527ad90c1b5d7815c86a8662",
5959
"name": "aesop",
6060
"manifestFile": "lake-manifest.json",
6161
"inputRev": "master",
@@ -65,17 +65,17 @@
6565
"type": "git",
6666
"subDir": null,
6767
"scope": "leanprover-community",
68-
"rev": "23268f52d3505955de3c26a42032702c25cfcbf8",
68+
"rev": "1383e72b40dd62a566896a6e348ffe868801b172",
6969
"name": "proofwidgets",
7070
"manifestFile": "lake-manifest.json",
71-
"inputRev": "v0.0.44",
71+
"inputRev": "v0.0.46",
7272
"inherited": true,
7373
"configFile": "lakefile.lean"},
7474
{"url": "https://github.com/leanprover-community/import-graph",
7575
"type": "git",
7676
"subDir": null,
7777
"scope": "leanprover-community",
78-
"rev": "984d7ee170b75d6b03c0903e0b750ee2c6d1e3fb",
78+
"rev": "ac7b989cbf99169509433124ae484318e953d201",
7979
"name": "importGraph",
8080
"manifestFile": "lake-manifest.json",
8181
"inputRev": "main",
@@ -85,7 +85,7 @@
8585
"type": "git",
8686
"subDir": null,
8787
"scope": "leanprover-community",
88-
"rev": "7bedaed1ef024add1e171cc17706b012a9a37802",
88+
"rev": "86d0d0584f5cd165353e2f8a30c455cd0e168ac2",
8989
"name": "LeanSearchClient",
9090
"manifestFile": "lake-manifest.json",
9191
"inputRev": "main",
@@ -95,7 +95,7 @@
9595
"type": "git",
9696
"subDir": null,
9797
"scope": "leanprover-community",
98-
"rev": "d212dd74414e997653cd3484921f4159c955ccca",
98+
"rev": "42dc02bdbc5d0c2f395718462a76c3d87318f7fa",
9999
"name": "plausible",
100100
"manifestFile": "lake-manifest.json",
101101
"inputRev": "main",
@@ -105,7 +105,7 @@
105105
"type": "git",
106106
"subDir": null,
107107
"scope": "",
108-
"rev": "fef6aa3e68311f7ddb82e3db00441493b0e6f39a",
108+
"rev": "57f9c20e5c2160020f899520427b02d86d3ef96e",
109109
"name": "mathlib",
110110
"manifestFile": "lake-manifest.json",
111111
"inputRev": "master",

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:v4.13.0
1+
leanprover/lean4:v4.14.0-rc2

0 commit comments

Comments
 (0)