Types are representations: an operator's type is its content under the symmetry group. Write lattice models, symmetries, and perturbation series in paper notation; broken symmetry, wrong physics, and missing remainders fail at compile time.
1model Z₂ toric code with a rough boundary2 3given Λ : square lattice on a cylinder (circumference L, height W)4given ∂Λ : boundary of Λ at y = 0 with dangling edges d_i5given σ : qubit on edges(Λ)6given J : positive integer7given x, κ₁, κ₂ : small parameter8 9define A_v ≔ ∏_{l ∋ v} σˣ_l for v ∈ vertices(Λ)10define B_p ≔ ∏_{l ∈ ∂p} σᶻ_l for p ∈ plaquettes(Λ)11define P_i ≔ σᶻ_{d_i} σᶻ_{h_i} σᶻ_{d_{i+1}} for i ∈ cells(∂Λ)12 13define H₀ ≔ − J Σ_v A_v − J Σ_p B_p − Σ_i P_i14define V ≔ − x Σ_i σˣ_{d_i} − κ₁ Σ_i σᶻ_{d_i} − κ₂ Σ_i σᶻ_{h_i}15define H ≔ H₀ + V16 17claim H : Hermitian, local18claim ∂Λ condenses {1, e} at x = 0, κ₁ = 0, κ₂ = 019 20expand H_eff ≔ pCUT of H around H₀21 to O(x¹⁵) at κ₁ = κ₂ = 0, to total order 10 in (x, κ₁, κ₂) otherwise22estimate (x_c, zν) from Δ by dlog-Padé in x$ weylc explain examples/toric_boundary.weyl J : positive integer, exactA : Hermitian operator, support {h@(-1,0), d, h, u}, exactB : Hermitian operator, support {h, u, h@(0,1), u@(1,0)}, exactP : Hermitian operator, support {d, h, d@(1,0)}, exactH₀ : Hermitian operator, support {h@(-1,0), d, h, u, ...}, exactH : Hermitian operator, support {h@(-1,0), d, h, u, ...}, exactH_eff : Hermitian operator, support {h@(-1,0), d, h, u, ...}, + O(x^15)e₀ : power series in (x) + O(x^15)ω : power series in (x) + O(x^15)Δ : power series in (x) + O(x^15)x_c : real number ± σ (extrapolated: Epi{PadeSpread(dlog-Padé)})zν : real number ± σ (extrapolated: Epi{PadeSpread(dlog-Padé)})Declare how the symmetry group acts on modes: invariance is decided exactly, symmetry-breaking terms are reported by irrep, and H_eff is given as reduced coefficients on the invariant basis.
Exact values, truncated series (+ O(I)), and extrapolations (± σ) stay distinct in the type system.
Coefficients and expansions come solely from the Rust kernel; LLMs only submit schedules and rewrites over MCP with offline replay.
A one-line gauge ℤ₂ model and an explicit microscopic Hamiltonian are both valid and checked equal in normal form.