Skip to content

V21: Add formalization variable explanation lint check#47

Merged
ImChong merged 1 commit intomainfrom
claude/nice-ride-kOIOp
Apr 26, 2026
Merged

V21: Add formalization variable explanation lint check#47
ImChong merged 1 commit intomainfrom
claude/nice-ride-kOIOp

Conversation

@ImChong
Copy link
Copy Markdown
Owner

@ImChong ImChong commented Apr 26, 2026

Summary

Adds automated validation to ensure that formula variables in wiki/formalizations/ pages have corresponding physical meaning explanations in the document body. This is part of the V21 execution phase for improving semantic consistency in formalization documentation.

Key Changes

  • New lint rule formalization_unexplained_vars in scripts/lint_wiki.py:

    • Extracts single uppercase Latin letters from display formulas ($$...$$) in formalization pages
    • Excludes function call patterns (e.g., R(s,a,s')) using negative lookahead (?![A-Za-z_(])
    • Validates each variable against 7 heuristic patterns for physical meaning explanations:
      • List items with colons (e.g., - $X$: meaning)
      • Inline colon definitions (e.g., $X$: meaning)
      • Table rows containing the variable
      • Verb-based explanations (是/为/表示/代表/denote/etc.)
      • "其中"/"where" clauses
      • Mathematical definitions (=, \in, \succeq, \succ, \equiv, \triangleq)
      • Bold paragraph context
  • Documentation fixes in 6 formalization pages to satisfy the new rule:

    • bellman-equation.md: Clarified $R$ as immediate reward scalar
    • control-lyapunov-function.md: Added $A, B$ matrix definitions
    • ekf.md: Comprehensive matrix explanations ($A, B, C, Q, R, P, K, I$)
    • hjb.md: Added variable definitions for LQR special case
    • lqr.md: Explained $x, u, A, B$ in linear system model
    • tsid-formulation.md: Defined $S$ as actuation selection matrix
  • Updated V21 checklist to mark the "自动化背链一致性 Lint" item as complete

Implementation Details

The variable extraction uses regex (?<![A-Za-z\\_^{])([A-Z])(?![A-Za-z_(]) to identify candidate variables while avoiding:

  • Multi-letter identifiers
  • Subscripts/superscripts
  • Function calls like R(s,a,s')

Pattern matching is case-insensitive and multiline-aware to handle various documentation styles. Variables are reported with their containing file path for easy remediation.

https://claude.ai/code/session_01EuF6h7rZ7irF6ACREZ8iXs

- scripts/lint_wiki.py 新增 formalization_unexplained_vars 检查:从 $$...$$ 显示公式抽取单字母拉丁大写变量,验证正文是否给出物理含义解释
- 启发式覆盖列表项/表格行/动词解释/其中子句/等式定义等 7 类模式,并用负向预查排除 R(s,a,s') 这类函数调用形式
- 同步补齐 6 个被命中页面的变量含义:bellman-equation、control-lyapunov-function、ekf、hjb、lqr、tsid-formulation
- make lint 0 errors,eval_search_quality 通过率 37/37 (100%)
- V21 checklist P0 第二项已勾选
@ImChong ImChong merged commit f3aebd9 into main Apr 26, 2026
3 checks passed
@ImChong ImChong deleted the claude/nice-ride-kOIOp branch April 26, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants