Spintronics investigates the coupled transport and collective excitations of electron spin alongside charge, lattice, orbital, and electromagnetic degrees of freedom. From a formal-methods perspective, many of its foundational results—Moriya symmetry constraints on the Dzyaloshinskii–Moriya interaction (DMI), the distinct time-reversal signatures of spin Hall versus anomalous Hall conductivity, the hidden conservation law at the persistent spin helix (PSH), and truncation orders in spin-wave theory—are decidable algebraic and symmetry invariants.
Weyl encodes these physical laws directly into the operator type Op_𝔄[γ; q; ρ; h; S] @ ε of its core calculus , enforcing symmetry selection rules, dimensional consistency, Hermiticity, and truncation-remainder propagation before any numerical kernel is generated.
1. Physical Background & Type-System Alignment
In conventional symbolic or numerical workflows, anti-unitary time reversal , spatial inversion , polar/axial vector parity, spin-group representations, and Hermiticity live only in hand derivations. In Weyl, a single given declaration assigns a fundamental field its full physical identity (e.g., S : spin-S on sites(Λ) automatically carries the algebra, axial-vector character, -odd and -even parities, and dimension ), and compound expressions inherit their types homomorphically:
| Quantity | Symbol | Parity | Parity | Character | Weyl Static Check & Typical Diagnostic |
|---|---|---|---|---|---|
| Crystal momentum | Odd () | Odd () | Polar vector | E0510 (product must be dimensionless) | |
| Spin operator | Even () | Odd () | Axial vector | E0521 (forbids adding polar and axial vectors) | |
| DMI vector | Odd () (bond center) | Even () | Axial vector | E0530 (inferred as Zero under bond inversion) | |
| Spin current | Odd () | Even () | Pseudotensor | E0301 (unsymmetrized is non-Hermitian) | |
| Spin Hall conductivity | Even () | Even () | Response tensor | Onsager transpose & point-group selection rules | |
| Unit magnetization | Even () | Odd () | Axial vector | refinement constraint |
Types as Physical Laws
Any quantity forbidden by declared symmetries receives the singleton type Zero in Weyl. Zero is sound: once the type checker verifies via character inner products that an observable transforms without the trivial irrep, it vanishes identically. Unforbidden quantities are marked allowed and passed to the exact kernel or numerical estimator.
2. Spin-Group Selection Rules
This part runs in the current compiler. A symmetry element acts on declared fibers, spin and real space, plus one antilinear bit; momentum transforms with the space part and flips under antilinear elements. A spin group is written by its generators [R_spin ‖ R_space] and closed as an explicit finite group. "Time reversal" is one element, [𝒯_s C₂⊥ ‖ 𝒯_r]: a declaration such as [𝒯_s ‖ E], which would flip spins without being antilinear, is rejected with E0520.
Expectation values and response tensors are declared together with the state they are taken in, and a claim about a component is decided from the invariant subspace of the tensor, computed exactly by averaging over the group:
model d-wave altermagnet on the square lattice
units ℏ = 1
given Λ : square lattice (lattice constant a : length)
given t, t_J : energy
given 𝒢 : spin group generated by [E ‖ mmm], [C₂⊥ ‖ C₄z], [𝒯_s C₂⊥ ‖ 𝒯_r], spin rotations about z
given ρ : equilibrium state invariant under 𝒢
given M : magnetization in ρ
given σ_ij : charge conductivity, response of electric current to electric field in ρ
given σˢ_ij : z-spin conductivity, response of z-spin current to electric field in ρ
define ε(k) ≔ − 2 t (cos(k_x a) + cos(k_y a))
define J(k) ≔ 2 t_J (cos(k_x a) − cos(k_y a))
define Δ(k) ≔ 2 J(k)
claim Δ : B₁g of 4/mmm
claim Δ(k) = 0 on k_x = ± k_y
claim M_z = 0
claim σ_[xy] = 0
claim σ_(xy) = 0
claim σ_xy = 0
claim σˢ_xx − σˢ_yy : allowed$ weylc check examples/altermagnet_selection.weyl
ok: `examples/altermagnet_selection.weyl` passed all static checksA response tensor is not an equal-time expectation value. An antilinear element maps to (Onsager), which constrains a single tensor only when and are the same kind of observable. So the antisymmetric charge conductivity σ_[xy] is removed by the effective time reversal, while the spin conductivity is not constrained by it and σˢ_xx − σˢ_yy survives: the -wave spin-splitter response of an altermagnet. Each accepted claim has a rejected counterpart:
error[E0530]: `M_z` is claimed allowed, but `𝒢` forces it to vanish
error[E0530]: `σˢ_xx − σˢ_yy` is not forced to vanish by `𝒢`
error[E0520]: `Δ` transforms as B1g of 4/mmm, not as A1g of 4/mmmReplacing [C₂⊥ ‖ C₄z] by [E ‖ C₄z] turns the group into that of a ferromagnet: M_z = 0 is then rejected and the -wave spin conductivity is forbidden. The quantities that can be declared today are magnetization, electric polarization, orbital moment, charge conductivity and spin conductivity; point groups are the subgroups of (hexagonal and trigonal groups are not covered). Sections 3–7 below describe designs that the compiler does not yet accept.
3. Rashba–Dresselhaus SOC & the Persistent Spin Helix Draft
In two-dimensional electron gases and heterostructure interfaces lacking spatial inversion symmetry, structural inversion asymmetry (SIA) induces Rashba SOC while bulk inversion asymmetry (BIA) induces linear Dresselhaus SOC:
Because is a -odd, -odd polar vector and is a -even, -odd axial vector, every bilinear term is -even and -odd. Declaring spatial inversion invariance on a model containing immediately raises E0520 during type checking.
At the fine-tuned point , rotating to the and axes (, ) collapses the SOC into a momentum shift along a single spin axis:
This produces an exact emergent Persistent Spin Helix (PSH) symmetry generated by , which commutes with and suppresses Dyakonov–Perel spin relaxation:
model 2DEG with Rashba and Dresselhaus spin-orbit coupling
units ℏ = 1
given k : wavevector in ℝ²
given m : mass
given α_R, β_D : energy · length
given c_{kσ} : fermion, σ ∈ {↑, ↓}
given 𝒯 : time reversal -- anti-unitary: (k, σ) ↦ (−k, −σ)
given 𝒫 : spatial inversion -- unitary: (k, σ) ↦ (−k, +σ)
define H_kin ≔ Σ_k (|k|² / (2 m)) Σ_σ c†_{kσ} c_{kσ}
define H_R ≔ α_R Σ_k Σ_{σσ′} (k_x σʸ − k_y σˣ)_{σσ′} c†_{kσ} c_{kσ′}
define H_D ≔ β_D Σ_k Σ_{σσ′} (k_x σˣ − k_y σʸ)_{σσ′} c†_{kσ} c_{kσ′}
define H ≔ H_kin + H_R + H_D
claim H : Hermitian, invariant under 𝒯
claim H_R, H_D : 𝒯-even, 𝒫-odd -- adding `invariant under 𝒫` triggers E0520
-- Persistent Spin Helix (α_R = β_D): rotated spin basis {+, −} of σ₊ = (σˣ + σʸ)/√2
define Q₀ ≔ 4 m α_R · (e_x − e_y) / √2
define Q_PSH ≔ Σ_k c†_{k + Q₀, +} c_{k, −}
claim [H, Q_PSH] = 0 at α_R = β_D -- discharged by the exact symbolic kernelStatic Detection of Symmetry Violations
If a contributor accidentally adds claim H : invariant under 𝒫 to the program above, weylc check pinpoints k_x σʸ as -odd (polar coupled to axial) and halts with E0520—with zero matrix construction or diagonalization.
4. Dzyaloshinskii-Moriya Interaction & Chiral Magnetic Textures Draft
In magnetic insulators and heavy-metal/ferromagnet bilayers, broken inversion symmetry plus SOC generates the antisymmetric Dzyaloshinskii–Moriya interaction (DMI), competing with symmetric Heisenberg exchange and anisotropy to stabilize spin spirals and magnetic Skyrmions:
Moriya's selection rules reduce directly to point-group representation checks at the bond midpoint . When is an inversion center, the bond-exchanging operation flips the sign of , forcing . By the same symmetry reasoning, a mirror plane bisecting the bond perpendicularly constrains the DMI vector to lie within the plane (), whereas a mirror plane containing the bond forces , which yields the interfacial Néel DMI .
In the continuum limit, a 2D texture carries the quantized Skyrmion topological charge:
Because naive finite differences break integer quantization on a lattice, Weyl models via the Berg–Lüscher spherical solid-angle discretization over oriented triangular plaquettes:
model Interfacial chiral magnet with Néel DMI and Skyrmion charge
given Λ : triangular lattice (periodic L × L)
given S : spin-S on sites(Λ)
given J, D, K : energy
given 𝒢 : point group C_{6v} -- vertical mirrors m_∥ present, inversion 𝒫 broken
define r̂_{ij} ≔ (r_j − r_i) / |r_j − r_i|
define D_{ij} ≔ D · (ê_z × r̂_{ij}) -- obeys m_∥ constraint: D_{ij} ⊥ mirror plane
define H_mag ≔ − J Σ_{⟨i,j⟩} S_i · S_j + Σ_{⟨i,j⟩} D_{ij} · (S_i × S_j) − K Σ_i (Sᶻ_i)²
claim H_mag : Hermitian, local, invariant under 𝒢
claim D_{ij} = 0 when 𝒫_{O_{ij}} ∈ 𝒢 -- Moriya's first rule discharged statically
-- Berg–Lüscher topological charge on normalized classical spins m_i ∈ S²
given m : unit axial vector on sites(Λ)
define Ω_{ijk} ≔ 2 atan2(m_i · (m_j × m_k), 1 + m_i · m_j + m_j · m_k + m_k · m_i)
define Q_sky ≔ (1 / (4 π)) Σ_{△_{ijk} ∈ faces(Λ)} Ω_{ijk}
claim Q_sky : integer -- quantized topological invariant under PBC5. Spin Current, Kubo Formula & Intrinsic Spin Hall Conductivity Draft
In the spin Hall effect (SHE), a longitudinal electric field drives a transverse spin current even in -invariant materials. Unlike charge current, the conventional symmetrized spin current is not conserved in the presence of SOC; its continuity equation acquires a spin-torque source :
where is the torque-dipole density defining the conserved Shi–Zhang–Xiao–Niu spin current. In the DC linear-response limit (), the intrinsic spin Hall conductivity is given by the Kubo formula in terms of the spin Berry curvature :
Because both and are -even, is allowed under time-reversal symmetry (in contrast to the -odd anomalous Hall conductivity ). When integrating over a discrete Brillouin-zone mesh, the result should carry a source recording the mesh, written Epi{BZ-Grid(N_k)} below.
define v_i ≔ ∂H / ∂k_i
define Jˣ_z ≔ (1 / 2) {v_x, sᶻ} -- anticommutator ensures Jˣ_z : Hermitian
define τᶻ ≔ − i [sᶻ, H] -- spin torque operator (nonzero ⇒ sᶻ not conserved)
claim Jˣ_z : Hermitian, 𝒯-even, 𝒫-odd
claim σˢ_xy : allowed under 𝒯 -- not forbidden by time-reversal symmetry
define Ω_{n,xy}^z(k) ≔ − 2 Im Σ_{m ≠ n} ⟨u_{nk} | Jˣ_z | u_{mk}⟩ ⟨u_{mk} | v_y | u_{nk}⟩ / (ε_{nk} − ε_{mk})²
estimate σˢ_xy from − (e / ℏ) ∫_{BZ(N_k)} (d²k / (2π)²) Σ_n f(ε_{nk}) Ω_{n,xy}^z(k)
-- inferred type: Scalar[conductance] @ (Exact, Epi{BZ-Grid(N_k)})
require uncertainty of σˢ_xy < 10⁻⁴
otherwise refine N_k by adaptive_berry_meshSeparating Truncation from Epistemic Uncertainty
Brillouin-zone quadrature introduces no perturbative series truncation, so the truncation component of its tag is the zero ideal and the source component is the grid quadrature. Near small SOC-induced avoided crossings where spikes, the require check may fail; the otherwise branch then refines the local mesh. The numerical estimate never becomes Exact.
6. Holstein-Primakoff Magnon Expansion & Error-Lattice Truncation Draft
To derive collective spin-wave (magnon) excitations around an ordered magnetic state, one maps spin operators to local bosons () via the Holstein–Primakoff (HP) transformation and expands in the small parameter :
In hand calculations, mixed truncation orders between quartic magnon–magnon interactions () and weak exchange couplings () are notoriously error-prone. Weyl's error tags record truncation remainders as monomial ideals stored by their minimal generators: linear spin-wave theory (LSWT) retains the quadratic Bogoliubov–de Gennes Hamiltonian under the tag Trunc(O(1/S)), while interacting magnon theory (Dyson–Maleev or quartic self-energy expansions) includes scattering under Trunc(O(1/S²)). In multivariate expansions over , products propagate remainders conservatively via , avoiding silent rounding to coarse boxes.
In honeycomb or kagome ferromagnets, next-nearest-neighbor DMI maps under HP to complex magnon hopping —a bosonic Haldane model with nonzero magnon Chern numbers and a magnon thermal Hall conductivity:
model Honeycomb ferromagnet with NNN DMI (topological magnon insulator)
given Λ : honeycomb lattice (sublattices A, B)
given S : large spin parameter -- expansion variable ε_S ≔ 1 / S
given a_i : boson on sites(Λ)
given J, D : energy
-- Holstein-Primakoff expansion with exact 1/S Dickson-basis truncation
expand S⁺_i ≔ √(2 S) √(1 − a†_i a_i / (2 S)) a_i to Trunc(O(1/S²))
define Sᶻ_i ≔ S − a†_i a_i
define H_spin ≔ − J Σ_{⟨i,j⟩} S_i · S_j + D Σ_{⟨⟨i,j⟩⟩} ν_{ij} (Sˣ_i Sʸ_j − Sʸ_i Sˣ_j)
expand H_LSWT ≔ bosonic expansion of H_spin to Trunc(O(1/S)) -- quadratic BdG H₂
expand H_int ≔ bosonic expansion of H_spin to Trunc(O(1/S²)) -- includes quartic H₄ scattering
claim H_LSWT : Hermitian, conserves N_magnon
define C_n ≔ (1 / (2 π)) ∫_{BZ} Ω_{n,xy}(k) d²k
estimate κ_xy(T) from H_LSWT by bosonic_thermal_hall(T)7. Spin-Transfer Torque & LLG Dynamics Lowering Draft
For device-scale micromagnetics and current-driven domain-wall or Skyrmion motion, magnetization dynamics follows the Landau–Lifshitz–Gilbert–Slonczewski (LLGS) equation with adiabatic and non-adiabatic spin-transfer torque (STT) terms:
where the effective field is obtained variationally from the exchange, DMI, and anisotropy functional, is the spin-drift velocity, is Gilbert damping, and is the non-adiabaticity parameter.
Weyl lowers verified spintronic models through its four-layer IR (HIR → SIR → KIR → TIR). At the HIR and SIR layers, the compiler symbolically differentiates to derive and verifies norm preservation (). Validated stencil loops and RK4 or implicit-midpoint integrators then descend from TIR into MLIR linalg/vector dialects and compile via LLVM AOT into vectorized native libraries. Alongside this path, an isolated ED referee cross-checks small-cluster quantum spin dynamics and magnon dispersions via compare ... with exact diagonalization, while ensuring that floating-point referee data never leaks back into symbolic derivations.
// Vectorized LLGS RHS kernel lowered from Weyl TIR to MLIR/LLVM AOT
pub unsafe extern "C" fn llgs_rhs_kernel(
m: *const [f64; 3],
h_eff: *const [f64; 3],
u_grad_m: *const [f64; 3],
dm_dt: *mut [f64; 3],
n_sites: usize,
gamma: f64, alpha: f64, beta: f64,
) {
let inv = 1.0 / (1.0 + alpha * alpha);
for i in 0..n_sites {
let mi = *m.add(i);
let hi = *h_eff.add(i);
let ug = *u_grad_m.add(i);
let prec = cross(mi, hi); // m × H_eff
let damp = cross(mi, prec); // m × (m × H_eff)
let stt_ad = scale(-1.0, ug); // −(u·∇)m
let stt_na = scale(beta, cross(mi, ug)); // β m × (u·∇)m
// Explicit Landau-Lifshitz form preserves |m| = 1 invariant
*dm_dt.add(i) = combine_llgs(mi, prec, damp, stt_ad, stt_na, gamma, alpha, inv);
}
}Running weylc performs static symmetry/type checking, ED referee validation, and—on the Draft LLVM AOT path—MLIR compilation. The check half works today; the build invocation below is the planned interface (as noted in Cranelift JIT, LLVM AOT & FFI, there is no weylc build subcommand yet):
$ weylc check spintronics_psh_dmi.weyl
[ok] H_R, H_D : Op[Even; 0; 𝒯-even ∧ 𝒫-odd; Herm; local] @ (Exact, ∅)
[ok] [H, Q_PSH] = 0 : verified by exact symbolic kernel at α_R = β_D
[ok] Moriya rule : D_{ij} inferred as Zero under 𝒫_{O_{ij}} ∈ 𝒢
[ok] H_int (HP) : bosonic expansion tagged Trunc(O(1/S²)) (Dickson basis: {S⁻²})
[ok] σˢ_xy : allowed under 𝒯, uncertainty < 10⁻⁴ @ Epi{BZ-Grid(256×256)}
$ weylc build spintronics_llgs.weyl --target mlir-llvm --verify-ed L=4x4 # planned CLI, not yet implemented
[ok] ED referee : max |Δω_magnon| = 2.41e-5 (consistent with Trunc(O(1/S²)))
[ok] AOT kernel : emitted target/llgs_rhs_kernel.so (AVX-512 vectorized)