HivePaaS
An open-source, self-hosted PaaS on Docker Swarm. Deploy apps, databases and functions from one VPS to a whole cluster, with SSL, backups and autoscaling built in.
Penrose diagrams as a definition in core Lean: a box is a matrix, a wire is an index, joining wires sums over it. The rules proved for every dimension and every matrix.
Developer toolsLean · JavaScriptGitHub @keithadlerOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
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.
Taken from the repository README
Loading the full README.
Read the full 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.