Skip to content

Commit 04c9c53

Browse files
ZRTMRHclaude
andcommitted
[TEST] Try open LinearAlgebraGame to allow short theorem names
Experiment to test if adding LinearAlgebraGame to open statement allows players to use inner_self_eq_zero without the full namespace prefix. Changes: - Added LinearAlgebraGame to open statement in Level02 - Updated hints and proofs to use short names This may need to be reverted if it doesn't work on the game server. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent bae4c3b commit 04c9c53

2 files changed

Lines changed: 117 additions & 89 deletions

File tree

.i18n/en/Game.pot

Lines changed: 108 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ msgid "Now let's prove a fundamental property that every linear map must satisfy
211211
"**Note:** If you see hints appearing multiple times, this is a known issue with the game framework. Simply continue with your proof - the level will work correctly despite any duplicate hints."
212212
msgstr ""
213213

214+
#: Game.Levels.InnerProductWorld.Level01
215+
msgid "For any vector `v`, `⟪v, v⟫ = 0` if and only if `v` is the zero vector.\n"
216+
"\n"
217+
"**Usage:** Use the full name `LinearAlgebraGame.inner_self_eq_zero` when applying this theorem."
218+
msgstr ""
219+
214220
#: Game.Levels.LinearMapsWorld.Level07
215221
msgid "If T is surjective, then every element of W is in the range of T."
216222
msgstr ""
@@ -412,11 +418,6 @@ msgstr ""
412418
msgid "The `constructor` tactic"
413419
msgstr ""
414420

415-
#: Game.Levels.InnerProductWorld.Level01
416-
msgid "For any vectors `v, w`, and a scalar `a`, ⟪a • v, w⟫ = a * ⟪v, w⟫. This means that scalar multiplication\n"
417-
"commutes with the inner product."
418-
msgstr ""
419-
420421
#: Game.Levels.TutorialWorld.Level05
421422
msgid "## Summary\n"
422423
"\n"
@@ -524,6 +525,13 @@ msgstr ""
524525
msgid "`normSq_eq_norm_sq` is a proof that `normSq z = ‖z‖ ^ 2`. It essentially unfolds the `normSq` definition."
525526
msgstr ""
526527

528+
#: Game.Levels.InnerProductWorld.Level01
529+
msgid "For any vectors `v, w`, and a scalar `a`, ⟪a • v, w⟫ = a * ⟪v, w⟫. This means that scalar multiplication\n"
530+
"commutes with the inner product.\n"
531+
"\n"
532+
"**Usage:** Use `InnerProductSpace_v.inner_smul_left` when applying this theorem."
533+
msgstr ""
534+
527535
#: Game.Levels.VectorSpaceWorld.Level01
528536
msgid "Vector space intro, zero scalar multiplication"
529537
msgstr ""
@@ -616,21 +624,6 @@ msgid "## Summary\n"
616624
"Click \"Leave World\" to return to the main menu."
617625
msgstr ""
618626

619-
#: Game.Levels.InnerProductWorld.Level02
620-
msgid "## The Goal\n"
621-
"In this level, we prove that the norm of a vector is zero if and only if it is the zero vector. The\n"
622-
"idea of the proof is to use the `inner_self_eq_zero` axiom, which requires cancelling out the square\n"
623-
"roots.\n"
624-
"\n"
625-
"## The `apply_fun` tactic\n"
626-
"The `apply_fun` tactic is used to apply functions to both sides of an equality. This only works in your\n"
627-
"hypotheses, not in the goal. The syntax is `apply_fun (fun x => f x) at h`. If `h : a = b` is a proof,\n"
628-
"then this will change `h` to `h : f a = f b`. This tactic can be very helpful, as squaring a square root\n"
629-
"cancels out the operation.\n"
630-
"\n"
631-
"**Note:** If you see hints appearing multiple times, this is a known issue with the game framework. Simply continue with your proof - the level will work correctly despite any duplicate hints."
632-
msgstr ""
633-
634627
#: Game.Levels.VectorSpaceWorld.Level03
635628
msgid "In any vector space V over K, multiplying a vector by -1 gives its additive inverse."
636629
msgstr ""
@@ -999,10 +992,6 @@ msgid "## Summary\n"
999992
"Essential when working with fractions, division, or expressions with denominators in fields."
1000993
msgstr ""
1001994

1002-
#: Game.Levels.InnerProductWorld.Level01
1003-
msgid "For any vectors `u, v, w`, ⟪(u + v), w⟫ = ⟪u, w⟫ + ⟪v, w⟫. That is, inner products distribute over addition"
1004-
msgstr ""
1005-
1006995
#: Game.Levels.LinearMapsWorld.Level05
1007996
msgid "The range of any linear map is a subspace of the codomain."
1008997
msgstr ""
@@ -1015,6 +1004,13 @@ msgstr ""
10151004
msgid "Inner Product World"
10161005
msgstr ""
10171006

1007+
#: Game.Levels.InnerProductWorld.Level01
1008+
msgid "For any vectors `v, w`, `⟪v, w⟫ = conj ⟪w, v⟫`. This means that the inner product commutes if you take\n"
1009+
"the conjugate.\n"
1010+
"\n"
1011+
"**Usage:** Use the full name `LinearAlgebraGame.inner_conj_symm` when applying this theorem."
1012+
msgstr ""
1013+
10181014
#: Game.Levels.LinearIndependenceSpanWorld.Level09
10191015
msgid "`ite` stands for `if then else`. If is used when creating functions. You can think of `ite P f1 f2` as\n"
10201016
"\"If P then f1 else f2\". This function gives you f1 when P is True, and f2 otherwise. This can help you\n"
@@ -1051,10 +1047,6 @@ msgstr ""
10511047
msgid "`Finset.subset_union_left` is a proof that if `a b : Finset S` are sets, then `a ⊆ a ∪ b`."
10521048
msgstr ""
10531049

1054-
#: Game.Levels.InnerProductWorld.Level01
1055-
msgid "For any vector `v`, the imaginary part of `⟪v, v⟫` is zero. Equivalently, `⟪v, v⟫` is real."
1056-
msgstr ""
1057-
10581050
#: Game.Levels.InnerProductWorld.Level08
10591051
msgid "You have proven the triangle inequality! \n"
10601052
"This key result guarantees that norm defines a 'distance' on the vector space."
@@ -1456,10 +1448,6 @@ msgid "In this level, we will learn the `unfold` and `apply` tactics. Our goal i
14561448
"**Note:** If you see hints appearing multiple times, this is a known issue with the game framework. Simply continue with your proof - the level will work correctly despite any duplicate hints."
14571449
msgstr ""
14581450

1459-
#: Game.Levels.InnerProductWorld.Level01
1460-
msgid "For any vector `v`, `⟪v, v⟫ = 0` if and only if `v` is the zero vector"
1461-
msgstr ""
1462-
14631451
#: Game.Levels.LinearMapsWorld.Level11
14641452
msgid "Linear Maps and Isomorphisms"
14651453
msgstr ""
@@ -1544,6 +1532,50 @@ msgstr ""
15441532
msgid "Zero is always in the null space of any linear map."
15451533
msgstr ""
15461534

1535+
#: Game.Levels.InnerProductWorld.Level01
1536+
msgid "The first level of this world will introduce two new ideas, the inner product and the norm.\n"
1537+
"The inner product is a way of taking two vectors, and multiplying them to get a complex number. There\n"
1538+
"are five main axioms that make such a function a valid inner product. First, any vector's inner product\n"
1539+
"with itself must be a nonnegative real number. Secondly, a vector's inner product with itself must\n"
1540+
"equal zero if and only if the vector is itself 0. The third and fourth axioms are that you can distribute\n"
1541+
"vector addition and commute vector multiplication through the first element of the product. Lastly, the\n"
1542+
"inner product has conjugate symmetry, that is that `⟪u, v⟫ = conj ⟪v, u⟫. Also, note that in any inner\n"
1543+
"product space, our field K must be a subfield of ℂ. For convenience we will assume K is equal to ℂ.\n"
1544+
"This is what allows us to commute multiplication through the inner product.\n"
1545+
"\n"
1546+
"```\n"
1547+
"-- Inner product space definition for complex vector spaces\n"
1548+
"class InnerProductSpace_v (V : Type) [AddCommGroup V] [VectorSpace ℂ V] where\n"
1549+
" inner : V → V → ℂ\n"
1550+
" inner_self_im_zero : ∀ (v : V), (inner v v).im = 0\n"
1551+
" inner_self_nonneg : ∀ (v : V), 0 ≤ (inner v v).re\n"
1552+
" inner_self_eq_zero : ∀ (v : V), inner v v = 0 ↔ v = 0\n"
1553+
" inner_add_left : ∀ (u v w : V), inner (u + v) w = inner u w + inner v w\n"
1554+
" inner_smul_left : ∀ (a : ℂ) (v w : V), inner (a • v) w = a * inner v w\n"
1555+
" inner_conj_symm : ∀ (v w : V), inner v w = conj (inner w v)\n"
1556+
"```\n"
1557+
"\n"
1558+
"Once we have the inner product, vector norms are easy to define. We simply let `‖v‖ = sqrt ⟪v, v⟫.re`,\n"
1559+
"which means that the norm of `v` is the square root of it's inner product with itself (we take `.re`)\n"
1560+
"to make sure that `⟪v, v⟫` is a real number, although we already guarantee this with the first axiom).\n"
1561+
"Note that the norm is called `norm_v`, which is what you should use if you try to `unfold`.\n"
1562+
"\n"
1563+
"```\n"
1564+
"def norm_v (v : V) : ℝ := Real.sqrt ⟪v, v⟫.re\n"
1565+
"```\n"
1566+
"\n"
1567+
"## Important: Namespace Prefix\n"
1568+
"When using inner product axioms (like `inner_self_eq_zero`, `inner_self_nonneg`, etc.) in your proofs,\n"
1569+
"you must use the full namespace prefix `LinearAlgebraGame.`. For example, write\n"
1570+
"`LinearAlgebraGame.inner_self_eq_zero v` instead of just `inner_self_eq_zero v`.\n"
1571+
"\n"
1572+
"## The Goal\n"
1573+
"This first level requires you to prove that `0 ≤ ‖v‖`. Since norm is defined as the square root of a\n"
1574+
"nonnegative real number, it is inherenetly positive.\n"
1575+
"\n"
1576+
"**Note:** If you see hints appearing multiple times, this is a known issue with the game framework. Simply continue with your proof - the level will work correctly despite any duplicate hints."
1577+
msgstr ""
1578+
15471579
#: Game.Levels.InnerProductWorld.Level03
15481580
msgid "`sq_eq_sq` is a proof that if `a` and `b` are nonnegative, `a^2 = b^2` if and only if `a = b`. If you\n"
15491581
"have hypotheses `h1 : 0 ≤ a`, `h2 : 0 ≤ b`, then `sq_eq_sq h1 h2` is a proof that `a ^ 2 = b ^ 2 ↔ a = b`."
@@ -1562,6 +1594,12 @@ msgstr ""
15621594
msgid "level completed with warnings… 🎭"
15631595
msgstr ""
15641596

1597+
#: Game.Levels.InnerProductWorld.Level01
1598+
msgid "For any vector `v` the real part of `⟪v, v⟫` is nonnegative.\n"
1599+
"\n"
1600+
"**Usage:** Use the full name `LinearAlgebraGame.inner_self_nonneg` when applying this theorem."
1601+
msgstr ""
1602+
15651603
#: Game.Levels.LinearIndependenceSpanWorld.Level05
15661604
msgid "## Summary\n"
15671605
"`have` allows you to create your own statements. It allows you to prove hypotheses which you can then\n"
@@ -1663,11 +1701,6 @@ msgstr ""
16631701
msgid "Orthogonal Decomposition"
16641702
msgstr ""
16651703

1666-
#: Game.Levels.InnerProductWorld.Level01
1667-
msgid "For any vectors `v, w`, `⟪v, w⟫ = conj ⟪w, v⟫`. This means that the inner product commutes if you take\n"
1668-
"the conjugate."
1669-
msgstr ""
1670-
16711704
#: Game.Levels.LinearIndependenceSpanWorld.Level07
16721705
msgid "`sub_eq_zero` is a proof that `a - b = 0` if and only if `a = b`."
16731706
msgstr ""
@@ -1918,6 +1951,12 @@ msgid "`add_right_cancel` is a proof that `a + b = c + b → a = c`. You can tel
19181951
"equation by `apply add_right_cancel (b := ????)`."
19191952
msgstr ""
19201953

1954+
#: Game.Levels.InnerProductWorld.Level01
1955+
msgid "For any vector `v`, the imaginary part of `⟪v, v⟫` is zero. Equivalently, `⟪v, v⟫` is real.\n"
1956+
"\n"
1957+
"**Usage:** Use the full name `LinearAlgebraGame.inner_self_im_zero` when applying this theorem."
1958+
msgstr ""
1959+
19211960
#: Game.Levels.LinearIndependenceSpanWorld.Level08
19221961
msgid "If you have some set s, where you know `h : i ∈ s`, then `sum_eq_sum_diff_singleton_add h` is a proof that\n"
19231962
"`(Finset.sum s fun x => f x) = (Finset.sum (s \\ {i}) fun x => f x) + f i`"
@@ -2079,6 +2118,25 @@ msgid "This is the \"boss level\" of the Linear Independence and Span World. Thi
20792118
"system. However, in general, try to follow your intuition without blindly following the hints."
20802119
msgstr ""
20812120

2121+
#: Game.Levels.InnerProductWorld.Level02
2122+
msgid "## The Goal\n"
2123+
"In this level, we prove that the norm of a vector is zero if and only if it is the zero vector. The\n"
2124+
"idea of the proof is to use the `inner_self_eq_zero` axiom, which requires cancelling out the square\n"
2125+
"roots.\n"
2126+
"\n"
2127+
"## Important: Namespace Prefix\n"
2128+
"When using inner product axioms in this world, you must use the full namespace prefix `LinearAlgebraGame.`.\n"
2129+
"For example, use `LinearAlgebraGame.inner_self_eq_zero` instead of just `inner_self_eq_zero`.\n"
2130+
"\n"
2131+
"## The `apply_fun` tactic\n"
2132+
"The `apply_fun` tactic is used to apply functions to both sides of an equality. This only works in your\n"
2133+
"hypotheses, not in the goal. The syntax is `apply_fun (fun x => f x) at h`. If `h : a = b` is a proof,\n"
2134+
"then this will change `h` to `h : f a = f b`. This tactic can be very helpful, as squaring a square root\n"
2135+
"cancels out the operation.\n"
2136+
"\n"
2137+
"**Note:** If you see hints appearing multiple times, this is a known issue with the game framework. Simply continue with your proof - the level will work correctly despite any duplicate hints."
2138+
msgstr ""
2139+
20822140
#: Game.Levels.VectorSpaceWorld.Level03
20832141
msgid "Scaling by -1"
20842142
msgstr ""
@@ -2141,45 +2199,6 @@ msgid "`sum_eq_sum_diff_singleton_add` is a proof that if you have some set `s`,
21412199
"`Finset.sum s (fun x => f x) = Finset.sum (s / {i}) (fun x => f x) + f i. The syntax is `sum_eq_sum_diff_singleton_add h f`."
21422200
msgstr ""
21432201

2144-
#: Game.Levels.InnerProductWorld.Level01
2145-
msgid "The first level of this world will introduce two new ideas, the inner product and the norm.\n"
2146-
"The inner product is a way of taking two vectors, and multiplying them to get a complex number. There\n"
2147-
"are five main axioms that make such a function a valid inner product. First, any vector's inner product\n"
2148-
"with itself must be a nonnegative real number. Secondly, a vector's inner product with itself must\n"
2149-
"equal zero if and only if the vector is itself 0. The third and fourth axioms are that you can distribute\n"
2150-
"vector addition and commute vector multiplication through the first element of the product. Lastly, the\n"
2151-
"inner product has conjugate symmetry, that is that `⟪u, v⟫ = conj ⟪v, u⟫. Also, note that in any inner\n"
2152-
"product space, our field K must be a subfield of ℂ. For convenience we will assume K is equal to ℂ.\n"
2153-
"This is what allows us to commute multiplication through the inner product.\n"
2154-
"\n"
2155-
"```\n"
2156-
"-- Inner product space definition for complex vector spaces\n"
2157-
"class InnerProductSpace_v (V : Type) [AddCommGroup V] [VectorSpace ℂ V] where\n"
2158-
" inner : V → V → ℂ\n"
2159-
" inner_self_im_zero : ∀ (v : V), (inner v v).im = 0\n"
2160-
" inner_self_nonneg : ∀ (v : V), 0 ≤ (inner v v).re\n"
2161-
" inner_self_eq_zero : ∀ (v : V), inner v v = 0 ↔ v = 0\n"
2162-
" inner_add_left : ∀ (u v w : V), inner (u + v) w = inner u w + inner v w\n"
2163-
" inner_smul_left : ∀ (a : ℂ) (v w : V), inner (a • v) w = a * inner v w\n"
2164-
" inner_conj_symm : ∀ (v w : V), inner v w = conj (inner w v)\n"
2165-
"```\n"
2166-
"\n"
2167-
"Once we have the inner product, vector norms are easy to define. We simply let `‖v‖ = sqrt ⟪v, v⟫.re`,\n"
2168-
"which means that the norm of `v` is the square root of it's inner product with itself (we take `.re`)\n"
2169-
"to make sure that `⟪v, v⟫` is a real number, although we already guarantee this with the first axiom).\n"
2170-
"Note that the norm is called `norm_v`, which is what you should use if you try to `unfold`.\n"
2171-
"\n"
2172-
"```\n"
2173-
"def norm_v (v : V) : ℝ := Real.sqrt ⟪v, v⟫.re\n"
2174-
"```\n"
2175-
"\n"
2176-
"## The Goal\n"
2177-
"This first level requires you to prove that `0 ≤ ‖v‖`. Since norm is defined as the square root of a\n"
2178-
"nonnegative real number, it is inherenetly positive.\n"
2179-
"\n"
2180-
"**Note:** If you see hints appearing multiple times, this is a known issue with the game framework. Simply continue with your proof - the level will work correctly despite any duplicate hints."
2181-
msgstr ""
2182-
21832202
#: Game.Levels.InnerProductWorld.Level01
21842203
msgid "`sq_nonneg` shows that squares are nonnegative."
21852204
msgstr ""
@@ -2316,10 +2335,6 @@ msgstr ""
23162335
msgid "`mul_le_mul_of_nonneg_right` allows multiplying inequalities by nonnegative values on the right."
23172336
msgstr ""
23182337

2319-
#: Game.Levels.InnerProductWorld.Level01
2320-
msgid "For any vector `v` the real part of `⟪v, v⟫` is nonnegative."
2321-
msgstr ""
2322-
23232338
#: Game.Levels.LinearIndependenceSpanWorld.Level09
23242339
msgid "## Summary\n"
23252340
"`tauto` solves goals using simple logic. It works similarly to the `simp` and `linarith` tactics, in\n"
@@ -2800,6 +2815,13 @@ msgstr ""
28002815
msgid "Linear Maps Preserve Linear Combinations"
28012816
msgstr ""
28022817

2818+
#: Game.Levels.InnerProductWorld.Level07
2819+
msgid "If `a² ≤ b²` and `b ≥ 0`, then `a ≤ b`. This is useful for converting squared inequalities\n"
2820+
"back to regular inequalities when working with norms.\n"
2821+
"\n"
2822+
"**Usage:** Use the full name `LinearAlgebraGame.le_of_sq_le_sq` when applying this theorem."
2823+
msgstr ""
2824+
28032825
#: Game.Levels.TutorialWorld.Level02
28042826
msgid "You now know the two most basic tactics in Lean! Again, you can click on `rw` on the right hand side\n"
28052827
"to see more about the tactic.\n"
@@ -2818,6 +2840,12 @@ msgid "`coe_union` is a proof that `↑(a ∪ b) = ↑a ∪ ↑b`. The `↑` mea
28182840
"theorem shows that type casting passes through unions."
28192841
msgstr ""
28202842

2843+
#: Game.Levels.InnerProductWorld.Level01
2844+
msgid "For any vectors `u, v, w`, ⟪(u + v), w⟫ = ⟪u, w⟫ + ⟪v, w⟫. That is, inner products distribute over addition.\n"
2845+
"\n"
2846+
"**Usage:** Use the full name `LinearAlgebraGame.inner_add_left` when applying this theorem."
2847+
msgstr ""
2848+
28212849
#: Game.Levels.LinearMapsWorld.Level11
28222850
msgid "In our final level, we'll introduce the concept of **isomorphisms** - the gold standard of linear maps.\n"
28232851
"\n"

Game/Levels/InnerProductWorld/Level02.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ NewTheorem Real.sq_sqrt Complex.ext LinearAlgebraGame.inner_self_nonneg LinearAl
6060
TheoremTab "ℂ"
6161

6262
variable {V : Type} [AddCommGroup V] [VectorSpace ℂ V] [InnerProductSpace_v V]
63-
open Function Set VectorSpace Real InnerProductSpace_v Complex
63+
open Function Set VectorSpace Real InnerProductSpace_v Complex LinearAlgebraGame
6464

6565
-- Helper theorem: norm squared equals real part of inner product with itself
6666
theorem norm_sq_eq (v : V) : ‖v‖^2 = ⟪v,v⟫.re := by
@@ -79,27 +79,27 @@ Statement norm_zero_v (v: V): norm_v v = 0 ↔ v = 0 := by
7979
Hint "Now, try to remove the square root"
8080
Hint (hidden := true) "Try `apply_fun (fun x => x^2) at {h}`"
8181
apply_fun (fun x => x^2) at h
82-
Hint (hidden := true) "Try `rw[sq_sqrt (LinearAlgebraGame.inner_self_nonneg v)] at {h}`"
83-
rw[sq_sqrt (LinearAlgebraGame.inner_self_nonneg v)] at h
82+
Hint (hidden := true) "Try `rw[sq_sqrt (inner_self_nonneg v)] at {h}`"
83+
rw[sq_sqrt (inner_self_nonneg v)] at h
8484
Hint (hidden := true) "Try `simp at h`"
8585
simp at h
8686

8787
Hint "Now, try to use some of the theorems we know"
88-
Hint (hidden := true) "Try `apply (LinearAlgebraGame.inner_self_eq_zero v).1`"
89-
apply (LinearAlgebraGame.inner_self_eq_zero v).1
88+
Hint (hidden := true) "Try `apply (inner_self_eq_zero v).1`"
89+
apply (inner_self_eq_zero v).1
9090
Hint (hidden := true) "Try `apply Complex.ext`"
9191
apply Complex.ext
9292
Hint (hidden := true) "Try `exact {h}`"
9393
exact h
94-
Hint (hidden := true) "Try `exact LinearAlgebraGame.inner_self_im_zero v`"
95-
exact LinearAlgebraGame.inner_self_im_zero v
94+
Hint (hidden := true) "Try `exact inner_self_im_zero v`"
95+
exact inner_self_im_zero v
9696

9797
Hint (hidden := true) "Try `intro h`"
9898
intro h
9999
Hint (hidden := true) "Try `rw [{h}]`"
100100
rw [h]
101-
Hint (hidden := true) "Try `rw [(LinearAlgebraGame.inner_self_eq_zero 0).2]`"
102-
rw [(LinearAlgebraGame.inner_self_eq_zero 0).2]
101+
Hint (hidden := true) "Try `rw [(inner_self_eq_zero 0).2]`"
102+
rw [(inner_self_eq_zero 0).2]
103103
Hint (hidden := true) "Try `simp`"
104104
simp
105105
Hint (hidden := true) "Try `rfl`"

0 commit comments

Comments
 (0)