Skip to content

Latest commit

 

History

History
129 lines (86 loc) · 7.01 KB

File metadata and controls

129 lines (86 loc) · 7.01 KB

Linear Algebra Game Hint Issues Fixed - July 26, 2025

Summary

A systematic review of all hints in the Linear Algebra Game revealed multiple issues where hint suggestions did not match the actual proof code. These mismatches would cause confusion for players following the hints.

Issues Found and Fixed

1. LinearIndependenceSpanWorld Level 7 - Variable Name Mismatch

Issue: The collaborator reported that after funext, the hints referenced variable v but Lean actually introduces variable x by default.

Files Changed: Game/Levels/LinearIndependenceSpanWorld/Level07.lean

Specific Fixes:

  • Line 195: Changed hint from "Try \funext v`"to"Try `funext x`"`
  • Line 196: Changed actual code from funext v to funext x
  • Line 198: Changed hint text from "either v ∈ (s ∪ t)" to "either x ∈ (s ∪ t)"
  • Line 199: Changed hint from "Try \by_cases h : v ∈ (s ∪ t)`"to"Try `by_cases h : x ∈ (s ∪ t)`"`
  • Line 200: Changed actual code from by_cases h : v ∈ (s ∪ t) to by_cases h : x ∈ (s ∪ t)
  • Line 266: Changed hint from "Try \specialize hS v h`"to"Try `specialize hS x h`"`
  • Line 267: Changed actual code from specialize hS v h to specialize hS x h
  • Line 269: Changed hint text from "f v - g v = 0" to "f x - g x = 0"
  • Line 275: Changed hint from "rw[hf0 v hS, hg0 v hT]" to "rw[hf0 x hS, hg0 x hT]"
  • Line 278: Changed actual code from rw[hf0 v hS, hg0 v hT] to rw[hf0 x hS, hg0 x hT]
  • Line 41: Fixed typo "chang ethe goal" to "change the goal"

Root Cause: When funext is used without specifying a variable name, Lean defaults to x, not v.

2. LinearIndependenceSpanWorld Level 7 - Game Stalling Issue

Issue: The collaborator reported that the game stalls at the end when the goal should be 0 = 0.

Fix: Added missing rfl tactic at line 279 to explicitly close the 0 = 0 goal.

Reasoning: After the rewrites, the goal becomes 0 = 0 but Lean may not automatically close it in the game environment.

3. LinearIndependenceSpanWorld Level 6 - Curly Braces and Variable Name Issues

File: Game/Levels/LinearIndependenceSpanWorld/Level06.lean

Fixes:

  • Line 58: Changed hint from "Try \intros x ssg`"to"Try `intros x _ssg`"` (to match actual code using underscore)
  • Line 60: Changed hint from "Try \exact hT {x}`"to"Try `exact hT x`"` (removed incorrect curly braces)

4. LinearIndependenceSpanWorld Level 3 - Curly Braces Issues

File: Game/Levels/LinearIndependenceSpanWorld/Level03.lean

Fixes:

  • Line 55: Changed hint from "Try \obtain ⟨s, hsA, f, h1, h2⟩ := {hxA}`"to"Try `obtain ⟨s, hsA, f, h1, h2⟩ := hxA`"` (removed incorrect curly braces)
  • Line 58: Changed hint from "Try \use {s}`"to"Try `use s`"` (removed incorrect curly braces)
  • Line 62: Changed hint from "Try \exact subset_trans {hsA} {hAB}`"to"Try `exact subset_trans hsA hAB`"` (removed incorrect curly braces)

5. LinearIndependenceSpanWorld Level 9 - Curly Braces and Set Notation Issues

File: Game/Levels/LinearIndependenceSpanWorld/Level09.lean

Fixes:

  • Line 164: Changed hint from "Try \obtain ⟨sx, hsx, fx, hfx⟩ := {hx}`"to"Try `obtain ⟨sx, hsx, fx, hfx⟩ := hx`"` (removed incorrect curly braces)
  • Line 167: Changed hint text from "whether or not \w ∈ {sx}`"to"whether or not `w ∈ sx`"` (removed incorrect curly braces from explanation)
  • Line 168: Changed hint from "Try \by_cases hw : w ∈ {sx}`"to"Try `by_cases hw : w ∈ sx`"` (removed incorrect curly braces)

6. VectorSpaceWorld Level 4 - Curly Braces Issues

File: Game/Levels/VectorSpaceWorld/Level04.lean

Fixes:

  • Line 84: Changed hint from "Try \obtain ⟨w, hw⟩ := {h1}`"to"Try `obtain ⟨w, hw⟩ := h1`"` (removed incorrect curly braces)
  • Line 86: Changed hint text from "0 • {w} ∈ W" to "0 • w ∈ W" (removed incorrect curly braces from explanation)

Pattern Analysis

The issues fell into three main categories:

  1. Variable Name Mismatches: Hints assumed specific variable names that didn't match Lean's default behavior
  2. Incorrect Curly Braces: Many hints included {variable} syntax where plain variable was correct
  3. Missing Tactics: One case where a proof needed an explicit rfl to close the goal

Systematic Review Process

  1. Searched for all funext usage - found only in Level 7
  2. Searched for by_cases patterns - found variable naming issues
  3. Searched for intros patterns - found variable naming inconsistencies
  4. Searched for obtain patterns - found numerous curly brace issues
  5. Searched all hint patterns with "Try" - found additional syntax issues

Areas Not Affected

  • TutorialWorld: No funext, by_cases, or complex obtain patterns found
  • VectorSpaceWorld: Only one issue found in Level 4
  • LinearMapsWorld: No systematic review performed (not mentioned in original complaint)
  • InnerProductWorld: No systematic review performed (not mentioned in original complaint)

Recommendations

  1. Testing: All fixed levels should be play-tested to ensure hints now match code behavior
  2. Review Process: Implement automated testing to catch hint/code mismatches
  3. Variable Naming: Be explicit about variable names in tactics like funext x rather than relying on defaults
  4. Syntax Checking: Verify that hint syntax exactly matches the required code syntax

7. Additional Stalling Issues Found Through Systematic Review

After the collaborator's report, a comprehensive search revealed 3 additional levels with the same stalling pattern.

Root Cause: Proofs ending with rewrite tactics that create trivial goals (like 0 = 0, 2 + 2 = 4) but lack explicit closing tactics, causing the game to hang.

DemoWorld L01_HelloWorld.lean

Issue: Proof ended with rw [g] at line 20, directly before Conclusion Fix: Added rfl at line 21 to explicitly close the trivial goal

LinearMapsWorld Level06.lean

Issue: Proof ended with rw [hT.2 a1 v1, hT.2 a2 v2] at line 46, directly before Conclusion Fix: Added rfl at line 47 to explicitly close the trivial goal

VectorSpaceWorld Level01.lean

Issue: Proof ended with rw[zero_add] at line 227, directly before Conclusion
Fix: Added rfl at line 228 to explicitly close the trivial goal

Pattern Recognition: All stalling issues follow the same pattern - rewrites that should result in definitionally equal terms (trivial goals) but require explicit rfl tactics in the game environment.

Conclusion

Fixed 11 total issues across 9 different levels:

  • 4 stalling issues (1 reported + 3 discovered) - all requiring explicit rfl tactics
  • 5 curly brace syntax issues in hints
  • 2 variable naming mismatches in hints

The systematic review approach proved essential - the collaborator's single report led to discovering 3 additional similar issues that would have caused identical problems. These fixes should eliminate game stalling issues and significantly improve the player experience.