尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Penrose diagrams in core Lean: a box is a matrix, a wire is an index, joining wires sums over it. The zig-zag, transpose, trace and sliding rules proved for every dimension and every matrix. MIT.
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗The worst part about the "linear algebra is graph theory" larp is that it's kinda true but you're using the wrong graphs. They're called Penrose diagrams. (doomslide)
Fair. So here are the right graphs, as a definition rather than a picture, with the rules people draw proved for every dimension and every matrix.
In a Penrose diagram a box is a matrix, a wire is an index, and joining two wires means summing over the
index they share. A bent wire is the identity read sideways (a cup or a cap), and a diagram with no loose
ends is a number. D a b is the syntax of diagrams with a wires in at the top and b out at the bottom,
built from boxes, wires, cups, caps and crossings by stacking (≫) and placing side by side (⊗).
eval n gives each diagram its meaning when every wire carries an index below n: the sum, over the
indices on its joined wires, of the product of its pieces. That is the whole of Penrose's convention.
Everything in Penrose.lean, for every dimension n and every matrix:
| Theorem | The rule |
|---|---|
seq_box | Two boxes joined by a wire are the matrix product. |
snake, snake' | A zig-zag pulls straight into a plain wire. |
bend_transpose | A box turned upside down by bending its wires is its transpose. |
slide | A box slides along a bend, turning into its transpose. |
loop_eval, loop_trace | Closing a diagram into a loop sums its diagonal: a box in a loop is the trace. |
loop_dim | A bare loop is the dimension. |
trace_cyclic | Boxes slide round a loop, so tr (A B) = tr (B A). |
par_box | Boxes side by side are the Kronecker product. |
cross_natural, cross_cross | Boxes pass through a crossing, and two crossings undo each other. |
chain_pow, ring_trace_pow | A row of k boxes is Aᵏ; closed into a ring it is tr (Aᵏ), the weight of the closed k-step walks in the other kind of graph. |
seq_assoc, wire_seq, seq_wire | Stacking is associative and a plain wire changes nothing, so a tall diagram means the same however it is read. |
Each rule is a statement about eval, and most proofs are one line: penrose, a tactic defined in the
file that unfolds a diagram, turns every wire into an if, collapses each sum over an index a wire pins
down, and settles the index equations that are left. The rest use a handful of summation lemmas proved in
the same file. The last four theorems evaluate diagrams for M, the matrix from the post, by
decide +kernel: its trace is 0.5, a bare loop in three dimensions is 3, bending moves the 1.8 across the
diagonal, and a ring of two boxes gives tr (M²) = 9.45.
Everything rests only on Lean's three standard axioms, and Tenet, Lean Studio's independent kernel,
re-checks all 99 declarations: 99 verified, none resting on sorry or an axiom, none rejected.
What this is not: the general theorem that any two diagrams related by planar isotopy evaluate the same (Joyal and Street's coherence theorem). The rules above are the moves that deformation is made of, each proved on its own; the general statement is a bigger project.
brew install --cask keithadler/tap/lean-studio).Penrose.lean, click the last line (#widget PenroseWidget with widgetProps) and choose the
Infoview tab.It works the same in VS Code with the Lean 4 extension. Without Lean there is a browser version of the widget, fed the numbers Lean computes.
lake build
Core Lean 4.35, no Mathlib.
Penrose.lean: the diagrams, their meaning, the proofs, the post's matrix and the widget's datawidget/Penrose.js: the widget (React, nothing beyond what the infoview provides)docs/: the browser version; scripts/build-docs.sh refreshes it from LeanMade with Lean Studio and the assistance of Claude (Anthropic).
MIT License.