Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Feature fields, kernel constraints, nonlinearities and SO(2)/O(2) kernel bases of E(2)-steerable CNNs

Definition
SteerableE2CNN_Basic

by Xeroth · Nov 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

convolutionequivariant-networksgroup-representationsorthogonal-groupsteerable-kernels

Objects of Sections 2.1-2.6 and Appendices B, D and F of Weiler and Cesa (2019).

  1. Plane and symmetry groups. The plane is R2\mathbb{R}^2R2 with Lebesgue measure. O(2)={O∈R2×2∣O⊤O=I}\mathrm{O}(2)=\{O\in\mathbb{R}^{2\times2}\mid O^\top O=I\}O(2)={O∈R2×2∣O⊤O=I}, and G≤O(2)G\le\mathrm{O}(2)G≤O(2) is any subgroup, acting on R2\mathbb{R}^2R2 by matrix multiplication.
  2. Representations. A representation of a group GGG on Rn\mathbb{R}^nRn is a homomorphism ρ:G→GL(Rn)\rho:G\to\mathrm{GL}(\mathbb{R}^n)ρ:G→GL(Rn). It is irreducible if Rn≠0\mathbb{R}^n\neq0Rn=0 and the only ρ\rhoρ-invariant subspaces are 000 and Rn\mathbb{R}^nRn.
  3. Feature fields (eq. 1). A field f:R2→Rnf:\mathbb{R}^2\to\mathbb{R}^nf:R2→Rn of type ρ\rhoρ transforms under tg∈(R2,+)⋊Gtg\in(\mathbb{R}^2,+)\rtimes Gtg∈(R2,+)⋊G by ([Ind⁡ρ](tg)f)(x)=ρ(g) f(g−1(x−t))([\operatorname{Ind}\rho](tg)f)(x)=\rho(g)\,f(g^{-1}(x-t))([Indρ](tg)f)(x)=ρ(g)f(g−1(x−t)).
  4. Kernel constraint (eqs. 2, 3). A kernel k:R2→Rm×nk:\mathbb{R}^2\to\mathbb{R}^{m\times n}k:R2→Rm×n satisfies the constraint for output and input matrices ρout(g)\rho_{\mathrm{out}}(g)ρout​(g), ρin(g)\rho_{\mathrm{in}}(g)ρin​(g) if k(gx)=ρout(g) k(x) ρin(g)−1k(gx)=\rho_{\mathrm{out}}(g)\,k(x)\,\rho_{\mathrm{in}}(g)^{-1}k(gx)=ρout​(g)k(x)ρin​(g)−1 for all group elements ggg and all x∈R2x\in\mathbb{R}^2x∈R2. It is GGG-steerable when ggg ranges over G≤O(2)G\le\mathrm{O}(2)G≤O(2) and ρin,ρout\rho_{\mathrm{in}},\rho_{\mathrm{out}}ρin​,ρout​ are representations of GGG.
  5. Convolution (Appendix D.1). (k⋆f)(x)=∫R2k(y) f(x+y) dy(k\star f)(x)=\int_{\mathbb{R}^2}k(y)\,f(x+y)\,dy(k⋆f)(x)=∫R2​k(y)f(x+y)dy.
  6. Irrep blocks (Section 2.4). For irreps ψi\psi_iψi​ (i∈Iouti\in I_{\mathrm{out}}i∈Iout​) of dimensions did_idi​, a matrix indexed by ⨆i{1,…,di}\bigsqcup_i\{1,\dots,d_i\}⨆i​{1,…,di​} and ⨆j{1,…,dj}\bigsqcup_j\{1,\dots,d_j\}⨆j​{1,…,dj​} has blocks κij∈Rdi×dj\kappa^{ij}\in\mathbb{R}^{d_i\times d_j}κij∈Rdi​×dj​. The direct sum ⨁iψi(g)\bigoplus_i\psi_i(g)⨁i​ψi​(g) is the block-diagonal matrix.
  7. Nonlinearities (Section 2.6, Appendix D.2). ∣v∣=(∑ivi2)1/2|v|=(\sum_iv_i^2)^{1/2}∣v∣=(∑i​vi2​)1/2. The norm nonlinearity is σnorm(v)=η(∣v∣) v/∣v∣\sigma_{\mathrm{norm}}(v)=\eta(|v|)\,v/|v|σnorm​(v)=η(∣v∣)v/∣v∣. The quotient representation of a finite group GGG with subgroup HHH acts on RG/H\mathbb{R}^{G/H}RG/H by ρquot(g~)egH=eg~gH\rho_{\mathrm{quot}}(\tilde g)e_{gH}=e_{\tilde ggH}ρquot​(g~​)egH​=eg~​gH​. The regular representation of CNC_NCN​ acts on RZ/N\mathbb{R}^{\mathbb{Z}/N}RZ/N by ρreg(p~)ep=ep~+p\rho_{\mathrm{reg}}(\tilde p)e_p=e_{\tilde p+p}ρreg​(p~​)ep​=ep~​+p​. The vector field nonlinearity is σvec(f)=max⁡(f) (cos⁡θ,sin⁡θ)⊤\sigma_{\mathrm{vec}}(f)=\max(f)\,(\cos\theta,\sin\theta)^\topσvec​(f)=max(f)(cosθ,sinθ)⊤ with θ=2πarg⁡max⁡(f)/N\theta=2\pi\arg\max(f)/Nθ=2πargmax(f)/N.
  8. Rotations, reflections, polar coordinates (Appendix F.1). ψ(θ)\psi(\theta)ψ(θ) is the rotation matrix by θ\thetaθ and ξ(s)=diag(1,s)\xi(s)=\mathrm{diag}(1,s)ξ(s)=diag(1,s) for s∈{±1}s\in\{\pm1\}s∈{±1}. The element rθs∈O(2)r_\theta s\in\mathrm{O}(2)rθ​s∈O(2) is the matrix ψ(θ)ξ(s)\psi(\theta)\xi(s)ψ(θ)ξ(s), and x(r,ϕ)=(rcos⁡ϕ,rsin⁡ϕ)x(r,\phi)=(r\cos\phi,r\sin\phi)x(r,ϕ)=(rcosϕ,rsinϕ).
  9. Irreps of SO(2) and O(2) (Appendix F.2). ψ0SO(2)(rθ)=1\psi^{\mathrm{SO}(2)}_0(r_\theta)=1ψ0SO(2)​(rθ​)=1 and ψkSO(2)(rθ)=ψ(kθ)\psi^{\mathrm{SO}(2)}_k(r_\theta)=\psi(k\theta)ψkSO(2)​(rθ​)=ψ(kθ) for k≥1k\ge1k≥1. ψi,0O(2)(rθs)=si\psi^{\mathrm{O}(2)}_{i,0}(r_\theta s)=s^iψi,0O(2)​(rθ​s)=si for i∈{0,1}i\in\{0,1\}i∈{0,1}, and ψ1,kO(2)(rθs)=ψ(kθ)ξ(s)\psi^{\mathrm{O}(2)}_{1,k}(r_\theta s)=\psi(k\theta)\xi(s)ψ1,kO(2)​(rθ​s)=ψ(kθ)ξ(s) for k≥1k\ge1k≥1.
  10. Angular kernel bases (Tables 8 and 2, Appendix F.4). For each pair of irreps there is a finite list of angular functions b(ϕ)b(\phi)b(ϕ), each of one integer angular frequency μ\muμ:
  • SO(2)\mathrm{SO}(2)SO(2), ψm←ψn\psi_m\leftarrow\psi_nψm​←ψn​: [1][1][1] if m=n=0m=n=0m=n=0; [cos⁡(nϕ+γ),sin⁡(nϕ+γ)][\cos(n\phi+\gamma),\sin(n\phi+\gamma)][cos(nϕ+γ),sin(nϕ+γ)] if m=0<nm=0<nm=0<n; [cos⁡(mϕ+γ);sin⁡(mϕ+γ)][\cos(m\phi+\gamma);\sin(m\phi+\gamma)][cos(mϕ+γ);sin(mϕ+γ)] if n=0<mn=0<mn=0<m; ψ((m−sn)ϕ+γ)ξ(s)\psi((m-sn)\phi+\gamma)\xi(s)ψ((m−sn)ϕ+γ)ξ(s) if m,n>0m,n>0m,n>0. Here γ∈{0,π/2}\gamma\in\{0,\pi/2\}γ∈{0,π/2} and s∈{±1}s\in\{\pm1\}s∈{±1}.
  • O(2)\mathrm{O}(2)O(2), ψj,n→ψi,m\psi_{j,n}\to\psi_{i,m}ψj,n​→ψi,m​: [1][1][1] if m=n=0m=n=0m=n=0 and i=ji=ji=j, and nothing if m=n=0m=n=0m=n=0 and i≠ji\neq ji=j; [cos⁡(nϕ+iπ/2),sin⁡(nϕ+iπ/2)][\cos(n\phi+i\pi/2),\sin(n\phi+i\pi/2)][cos(nϕ+iπ/2),sin(nϕ+iπ/2)] if m=0<nm=0<nm=0<n; [cos⁡(mϕ+jπ/2);sin⁡(mϕ+jπ/2)][\cos(m\phi+j\pi/2);\sin(m\phi+j\pi/2)][cos(mϕ+jπ/2);sin(mϕ+jπ/2)] if n=0<mn=0<mn=0<m; ψ((m−n)ϕ)\psi((m-n)\phi)ψ((m−n)ϕ) and ψ((m+n)ϕ)ξ(−1)\psi((m+n)\phi)\xi(-1)ψ((m+n)ϕ)ξ(−1) if m,n>0m,n>0m,n>0.

Formalization Note Points of the plane are vectors Fin 2→R\mathrm{Fin}\,2\to\mathbb{R}Fin2→R, and feature vectors are functions on a finite index type. The kernel constraint is one definition, parametrised by an index set of group elements and by the matrices of the action and of the two representations. For SO(2)\mathrm{SO}(2)SO(2) the group elements are the angles θ\thetaθ, and for O(2)\mathrm{O}(2)O(2) they are the pairs (θ,s)(\theta,s)(θ,s). A label (i,k)(i,k)(i,k) of an O(2)\mathrm{O}(2)O(2) irrep carries the condition k=0k=0k=0 or i=1i=1i=1. The O(2)\mathrm{O}(2)O(2) basis for one-dimensional/two-dimensional pairs is the one derived in Appendix F.4.3, eqs. (37) and (38). In Tables 2 and 9 the trivial and sign-flip rows and columns of these cells are interchanged. At v=0v=0v=0 the norm nonlinearity takes the value 000, because Lean sets a/0=0a/0=0a/0=0. argmax is a fixed choice among the maximisers.

Definition code
import Mathlib

/-!
Weiler and Cesa, *General E(2)-Equivariant Steerable CNNs*, arXiv:1911.08251v2 (NeurIPS 2019):
feature fields and their induced transformation law (Section 2.2, eq. (1)), the kernel constraint
(Section 2.3, eq. (2)) and its irrep blocks (Section 2.4, eq. (3)), steerable convolutions
(Appendix D.1), the nonlinearities of Section 2.6 and Appendix D.2 (norm, pointwise on quotient
representations, vector field), and the real irreducible representations of SO(2) and O(2) with
the angular kernel bases derived in Appendix F (Section 2.5, Tables 2, 8, 9; eqs. (24)-(38)).
-/

open Matrix MeasureTheory

noncomputable section

namespace SteerableE2CNN

/-- Section 2.1: the plane `ℝ²`, written as coordinate vectors `Fin 2 → ℝ`, with Lebesgue
measure. -/
abbrev Plane : Type := Fin 2 → ℝ

/-- Section 2.1: the orthogonal group `O(2) = {O ∈ ℝ^{2×2} | OᵀO = id}`. -/
abbrev O2 : Type := ↥(Matrix.orthogonalGroup (Fin 2) ℝ)

/-- Section 2.1: the `2 × 2` matrix of an element `g` of a subgroup `G ≤ O(2)`, acting on the
plane by `x ↦ g x`. -/
def gMat {G : Subgroup O2} (g : G) : Matrix (Fin 2) (Fin 2) ℝ :=
  ((g : O2) : Matrix (Fin 2) (Fin 2) ℝ)

/-- Section 2.2 and Appendix B: a (real, finite-dimensional) group representation
`ρ : G → GL(ℝⁿ)`, a homomorphism into invertible matrices indexed by `n`. -/
abbrev MatRep (G : Type*) [Group G] (n : Type*) [Fintype n] [DecidableEq n] : Type _ :=
  G →* Matrix.GeneralLinearGroup n ℝ

/-- The matrix `ρ(g)` of a representation. -/
def repMat {G : Type*} [Group G] {n : Type*} [Fintype n] [DecidableEq n] (ρ : MatRep G n)
    (g : G) : Matrix n n ℝ :=
  ((ρ g : Matrix.GeneralLinearGroup n ℝ) : Matrix n n ℝ)

/-- Appendix B ("Irreducible representations"): `ρ` is irreducible if its representation space
is nonzero and has no invariant subspace other than `0` and the whole space. -/
def IsIrrep {G : Type*} [Group G] {n : Type*} [Fintype n] [DecidableEq n] (ρ : MatRep G n) :
    Prop :=
  Nonempty n ∧ ∀ W : Submodule ℝ (n → ℝ), (∀ g : G, ∀ v ∈ W, repMat ρ g *ᵥ v ∈ W) →
    W = ⊥ ∨ W = ⊤

/-- Eqs. (2) and (3): the kernel constraint `κ(g x) = ρ_out(g) κ(x) ρ_in(g)⁻¹` for all group
elements `g` and all `x ∈ ℝ²`. The group elements are indexed by `Idx`, `act g` is the matrix by
which `g` acts on the plane, and `ρout g`, `ρin g` are the matrices of the output and input
representations. -/
def KernelConstraint {Idx : Type*} {m n : Type*} [Fintype m] [DecidableEq m] [Fintype n]
    [DecidableEq n] (act : Idx → Matrix (Fin 2) (Fin 2) ℝ) (ρout : Idx → Matrix m m ℝ)
    (ρin : Idx → Matrix n n ℝ) (κ : Plane → Matrix m n ℝ) : Prop :=
  ∀ (g : Idx) (x : Plane), κ (act g *ᵥ x) = ρout g * κ x * (ρin g)⁻¹

/-- Section 2.3, eq. (2): `k : ℝ² → ℝ^{c_out × c_in}` is a `G`-steerable kernel for the input and
output field types `ρin`, `ρout` of a subgroup `G ≤ O(2)`. -/
def IsSteerable (G : Subgroup O2) {m n : Type*} [Fintype m] [DecidableEq m] [Fintype n]
    [DecidableEq n] (ρin : MatRep G n) (ρout : MatRep G m) (k : Plane → Matrix m n ℝ) : Prop :=
  KernelConstraint (fun g : G => gMat g) (repMat ρout) (repMat ρin) k

/-- Section 2.2, eq. (1): the induced representation `Ind_G^{(ℝ²,+)⋊G} ρ` acting on a feature field
`f : ℝ² → ℝ^c` of type `ρ`: `([Ind ρ](t g) f)(x) = ρ(g) f(g⁻¹(x - t))`. -/
def indAct (G : Subgroup O2) {n : Type*} [Fintype n] [DecidableEq n] (ρ : MatRep G n)
    (t : Plane) (g : G) (f : Plane → n → ℝ) : Plane → n → ℝ :=
  fun x => repMat ρ g *ᵥ f (gMat g⁻¹ *ᵥ (x - t))

/-- Appendix D.1: the convolution (correlation) of a feature field with a kernel,
`(k ⋆ f)(x) = ∫_{ℝ²} k(y) f(x + y) dy`. -/
def steerConv {m n : Type*} [Fintype m] [Fintype n] (k : Plane → Matrix m n ℝ)
    (f : Plane → n → ℝ) : Plane → m → ℝ :=
  fun x => ∫ y, k y *ᵥ f (x + y)

/-- Section 2.4: the block `κ^{ij}` of a matrix `κ` written in the irrep bases, i.e. indexed by
`Σ i, Fin (dOut i)` (output irreps `i ∈ I_out` of dimensions `dOut i`) and `Σ j, Fin (dIn j)`. -/
def kernelBlock {Iout Iin : Type*} {dOut : Iout → ℕ} {dIn : Iin → ℕ}
    (κ : Matrix (Σ i, Fin (dOut i)) (Σ j, Fin (dIn j)) ℝ) (i : Iout) (j : Iin) :
    Matrix (Fin (dOut i)) (Fin (dIn j)) ℝ :=
  Matrix.of fun a b => κ ⟨i, a⟩ ⟨j, b⟩

/-- Section 2.6 and Appendix D.2.2: the Euclidean norm `|v|` of a feature vector. -/
def eNorm {n : Type*} [Fintype n] (v : n → ℝ) : ℝ := Real.sqrt (∑ i, v i ^ 2)

/-- Section 2.6 and Appendix D.2.2: the norm nonlinearity `σ_norm(v) = η(|v|) v / |v|`. (At
`v = 0` Lean's convention `a / 0 = 0` gives `σ_norm(0) = 0`; the paper leaves this value
undefined.) -/
def normNL {n : Type*} [Fintype n] (η : ℝ → ℝ) (v : n → ℝ) : n → ℝ :=
  (η (eNorm v) / eNorm v) • v

open Classical in
/-- Section 2.6 and Appendix B: the quotient representation `ρ_quot^{G/H}` of a finite group `G`,
permuting the axes `e_{gH}` of `ℝ^{|G|/|H|}` by `ρ_quot(g̃) e_{gH} = e_{g̃gH}`. -/
def quotRep {G : Type*} [Group G] (H : Subgroup G) (g : G) : Matrix (G ⧸ H) (G ⧸ H) ℝ :=
  Matrix.of fun a b => if a = g • b then 1 else 0

/-- Appendix D.2.4: the regular representation of the cyclic group `C_N`, whose elements are the
rotations by `2πp/N`, `p ∈ ℤ/N`, acting on `ℝ^N` (axes `e_p`) by `ρ_reg(p̃) e_p = e_{p̃ + p}`. -/
def regRepCN (N : ℕ) (p : ZMod N) : Matrix (ZMod N) (ZMod N) ℝ :=
  Matrix.of fun q q' => if q = p + q' then 1 else 0

/-- Appendix D.2.4: an index `argmax f` of a maximal entry of `f ∈ ℝ^N` (a fixed choice among the
maximisers). -/
def vfArgmax (N : ℕ) [NeZero N] (v : ZMod N → ℝ) : ZMod N :=
  Classical.choose (Finset.exists_max_image Finset.univ v Finset.univ_nonempty)

/-- Appendix D.2.4: the vector field nonlinearity
`σ_vec(f) = max(f) (cos θ, sin θ)ᵀ` with `θ = 2π argmax(f) / N`. -/
def vecFieldNL (N : ℕ) [NeZero N] (v : ZMod N → ℝ) : Plane :=
  (Finset.univ.sup' Finset.univ_nonempty v) •
    ![Real.cos (2 * Real.pi * ((vfArgmax N v).val : ℝ) / N),
      Real.sin (2 * Real.pi * ((vfArgmax N v).val : ℝ) / N)]

/-- Appendix F.1: the rotation matrix `ψ(θ)`. -/
def rotMat (θ : ℝ) : Matrix (Fin 2) (Fin 2) ℝ :=
  !![Real.cos θ, -Real.sin θ; Real.sin θ, Real.cos θ]

/-- Appendix F.1: the matrix `ξ(s) = diag(1, s)`, `s ∈ ({±1}, *)`; `ξ(-1)` is the reflection along
the horizontal axis. -/
def flipMat (s : ℤˣ) : Matrix (Fin 2) (Fin 2) ℝ :=
  !![1, 0; 0, ((s : ℤ) : ℝ)]

/-- Appendix F.1: the matrix `ψ(θ) ξ(s)` of the element `g = r_θ s` of `O(2)`; it acts on polar
coordinates by `g.x(r, φ) = x(r, sφ + θ)`. Every element of `O(2)` is of this form. -/
def o2Elem (θ : ℝ) (s : ℤˣ) : Matrix (Fin 2) (Fin 2) ℝ := rotMat θ * flipMat s

/-- Section 2.5 and Appendix F.1: the point `x(r, φ) = (r cos φ, r sin φ)` with polar
coordinates `(r, φ)`. -/
def polar (r φ : ℝ) : Plane := ![r * Real.cos φ, r * Real.sin φ]

/-- Appendix F.2: the dimension of the real irrep `ψ_k` of `SO(2)` of frequency `k ∈ ℕ`
(`1` for `k = 0`, `2` otherwise). -/
def so2Dim : ℕ → ℕ
  | 0 => 1
  | _ + 1 => 2

/-- Appendix F.2: the real irreps of `SO(2)` evaluated at the rotation `r_θ`:
`ψ_0(r_θ) = 1` and `ψ_k(r_θ) = ψ(kθ)` for `k ≥ 1`. -/
def so2Irrep : (k : ℕ) → ℝ → Matrix (Fin (so2Dim k)) (Fin (so2Dim k)) ℝ
  | 0 => fun _ => 1
  | k + 1 => fun θ => rotMat (((k + 1 : ℕ) : ℝ) * θ)

/-- Table 8: the number of angular basis elements of `SO(2)`-steerable kernels from `ψ_n` to
`ψ_m`. -/
def so2BasisCard : ℕ → ℕ → ℕ
  | 0, 0 => 1
  | 0, _ + 1 => 2
  | _ + 1, 0 => 2
  | _ + 1, _ + 1 => 4

/-- Table 8 and eqs. (24), (26), (28), (29): the angular basis of `SO(2)`-steerable kernels
`κ : ℝ² → ℝ^{dim ψ_m × dim ψ_n}` for input irrep `ψ_n` and output irrep `ψ_m`:
* `m = n = 0`: `[1]` (eq. (26));
* `m = 0 < n`: `[cos(nφ + γ), sin(nφ + γ)]`, `γ ∈ {0, π/2}` (eq. (29));
* `n = 0 < m`: `[cos(mφ + γ); sin(mφ + γ)]`, `γ ∈ {0, π/2}` (eq. (28));
* `m, n > 0`: `ψ(μφ + γ) ξ(s)` with `μ = m - sn`, `γ ∈ {0, π/2}`, `s ∈ {±1}` (eq. (24)); the index
  `b ∈ {0,1,2,3}` encodes `γ = (b mod 2) π/2` and `s = 1` for `b < 2`, `s = -1` otherwise. -/
def so2Basis : (m n : ℕ) → Fin (so2BasisCard m n) → ℝ →
    Matrix (Fin (so2Dim m)) (Fin (so2Dim n)) ℝ
  | 0, 0 => fun _ _ => 1
  | 0, n + 1 => fun b φ =>
      !![Real.cos (((n + 1 : ℕ) : ℝ) * φ + ((b : ℕ) : ℝ) * (Real.pi / 2)),
        Real.sin (((n + 1 : ℕ) : ℝ) * φ + ((b : ℕ) : ℝ) * (Real.pi / 2))]
  | m + 1, 0 => fun b φ =>
      !![Real.cos (((m + 1 : ℕ) : ℝ) * φ + ((b : ℕ) : ℝ) * (Real.pi / 2));
        Real.sin (((m + 1 : ℕ) : ℝ) * φ + ((b : ℕ) : ℝ) * (Real.pi / 2))]
  | m + 1, n + 1 => fun b φ =>
      rotMat ((((m + 1 : ℕ) : ℝ) - (if (b : ℕ) < 2 then 1 else -1) * ((n + 1 : ℕ) : ℝ)) * φ
          + (((b : ℕ) % 2 : ℕ) : ℝ) * (Real.pi / 2)) *
        flipMat (if (b : ℕ) < 2 then 1 else -1)

/-- Table 8: the angular frequency `μ` of each basis element of `so2Basis m n`. -/
def so2BasisFreq : (m n : ℕ) → Fin (so2BasisCard m n) → ℤ
  | 0, 0 => fun _ => 0
  | 0, n + 1 => fun _ => (n + 1 : ℕ)
  | m + 1, 0 => fun _ => (m + 1 : ℕ)
  | m + 1, n + 1 => fun b =>
      ((m + 1 : ℕ) : ℤ) - (if (b : ℕ) < 2 then 1 else -1) * ((n + 1 : ℕ) : ℤ)

/-- Appendix F.2: a label `(i, k)` of a real irrep `ψ_{i,k}` of `O(2)`: `ψ_{0,0}` (trivial),
`ψ_{1,0}` (sign of the reflection) and `ψ_{1,k}`, `k ≥ 1` (frequency `k`). -/
structure O2IrrepLabel where
  /-- the index `i ∈ {0, 1}` -/
  i : Fin 2
  /-- the frequency `k ∈ ℕ` -/
  k : ℕ
  /-- `ψ_{0,k}` is an irrep only for `k = 0` -/
  valid : k = 0 ∨ i = 1

/-- Appendix F.2: the dimension of `ψ_{i,k}` (`1` for `k = 0`, `2` otherwise). -/
def o2Dim (l : O2IrrepLabel) : ℕ :=
  match l.k with
  | 0 => 1
  | _ + 1 => 2

/-- Appendix F.2: the real irreps of `O(2)` evaluated at `g = r_θ s`:
`ψ_{i,0}(r_θ s) = s^i` and `ψ_{1,k}(r_θ s) = ψ(kθ) ξ(s)` for `k ≥ 1`. -/
def o2Irrep : (l : O2IrrepLabel) → ℝ → ℤˣ → Matrix (Fin (o2Dim l)) (Fin (o2Dim l)) ℝ
  | ⟨i, 0, _⟩ => fun _ s => !![((s : ℤ) : ℝ) ^ (i : ℕ)]
  | ⟨_, k + 1, _⟩ => fun θ s => rotMat (((k + 1 : ℕ) : ℝ) * θ) * flipMat s

/-- Table 2 / Table 9 (as derived in eqs. (34), (35), (37), (38)): the number of angular basis
elements of `O(2)`-steerable kernels from `ψ_{j,n}` to `ψ_{i,m}`. -/
def o2BasisCard (l l' : O2IrrepLabel) : ℕ :=
  match l.k, l'.k with
  | 0, 0 => if l.i = l'.i then 1 else 0
  | 0, _ + 1 => 1
  | _ + 1, 0 => 1
  | _ + 1, _ + 1 => 2

/-- Section 2.5, Table 2, and Appendix F.4.3, eqs. (34), (35), (37), (38): the angular basis of
`O(2)`-steerable kernels for input irrep `ψ_{j,n}` and output irrep `ψ_{i,m}`, as derived in
Appendix F.4.3:
* `m = n = 0`: `[1]` if `i = j`, no element otherwise (eq. (35));
* `m = 0 < n`: `[cos(nφ + iπ/2), sin(nφ + iπ/2)]` (eq. (38));
* `n = 0 < m`: `[cos(mφ + jπ/2); sin(mφ + jπ/2)]` (eq. (37));
* `m, n > 0`: `ψ(μφ) ξ(s)` with `μ = m - sn`, `s ∈ {±1}`, i.e. `ψ((m-n)φ)` and `ψ((m+n)φ) ξ(-1)`
  (eq. (34)). -/
def o2Basis : (l l' : O2IrrepLabel) → Fin (o2BasisCard l l') → ℝ →
    Matrix (Fin (o2Dim l)) (Fin (o2Dim l')) ℝ
  | ⟨_, 0, _⟩, ⟨_, 0, _⟩ => fun _ _ => !![(1 : ℝ)]
  | ⟨i, 0, _⟩, ⟨_, n + 1, _⟩ => fun _ φ =>
      !![Real.cos (((n + 1 : ℕ) : ℝ) * φ + ((i : ℕ) : ℝ) * (Real.pi / 2)),
        Real.sin (((n + 1 : ℕ) : ℝ) * φ + ((i : ℕ) : ℝ) * (Real.pi / 2))]
  | ⟨_, m + 1, _⟩, ⟨j, 0, _⟩ => fun _ φ =>
      !![Real.cos (((m + 1 : ℕ) : ℝ) * φ + ((j : ℕ) : ℝ) * (Real.pi / 2));
        Real.sin (((m + 1 : ℕ) : ℝ) * φ + ((j : ℕ) : ℝ) * (Real.pi / 2))]
  | ⟨_, m + 1, _⟩, ⟨_, n + 1, _⟩ => fun b φ =>
      rotMat ((((m + 1 : ℕ) : ℝ) - (if (b : ℕ) = 0 then 1 else -1) * ((n + 1 : ℕ) : ℝ)) * φ) *
        flipMat (if (b : ℕ) = 0 then 1 else -1)

/-- Table 2: the angular frequency `μ` of each basis element of `o2Basis l l'`. -/
def o2BasisFreq : (l l' : O2IrrepLabel) → Fin (o2BasisCard l l') → ℤ
  | ⟨_, 0, _⟩, ⟨_, 0, _⟩ => fun _ => 0
  | ⟨_, 0, _⟩, ⟨_, n + 1, _⟩ => fun _ => (n + 1 : ℕ)
  | ⟨_, m + 1, _⟩, ⟨_, 0, _⟩ => fun _ => (m + 1 : ℕ)
  | ⟨_, m + 1, _⟩, ⟨_, n + 1, _⟩ => fun b =>
      ((m + 1 : ℕ) : ℤ) - (if (b : ℕ) = 0 then 1 else -1) * ((n + 1 : ℕ) : ℤ)

end SteerableE2CNN
Source
Weiler and Cesa, General E(2)-Equivariant Steerable CNNs, arXiv:1911.08251v2 (NeurIPS 2019), Sections 2.1-2.6 (eqs. (1)-(5), Table 2), Appendix B, Appendix D, Appendix F.1-F.4 (Tables 8, 9; eqs. (24)-(38))
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Plane. The plane is the set of real coordinate vectors x=(x0,x1)x = (x_0, x_1)x=(x0​,x1​), i.e. R2\mathbb{R}^2R2 viewed as functions {0,1}→R\{0,1\} \to \mathbb{R}{0,1}→R. It carries the standard product (Lebesgue) measure, which is used by every integral below.

O2. O(2)O(2)O(2) is the set of real 2×22\times 22×2 matrices AAA with

A⊤A=IandAA⊤=I,A^\top A = I \quad\text{and}\quad A A^\top = I,A⊤A=IandAA⊤=I,

regarded as a group under matrix multiplication. Its elements are such matrices together with the proof that they are orthogonal.

gMat. For any subgroup G≤O(2)G \le O(2)G≤O(2) and any g∈Gg \in Gg∈G, gMat⁡(g)\operatorname{gMat}(g)gMat(g) is simply the underlying real 2×22\times 22×2 matrix of ggg. Below it is written as the matrix ggg itself, acting on the plane by x↦gxx \mapsto g xx↦gx.

MatRep. Let GGG be any group and nnn any finite index set with decidable equality. A "representation" ρ\rhoρ of GGG on Rn\mathbb{R}^nRn is any group homomorphism

ρ:G→GLn(R),\rho : G \to \mathrm{GL}_n(\mathbb{R}),ρ:G→GLn​(R),

where GLn(R)\mathrm{GL}_n(\mathbb{R})GLn​(R) is the group of invertible real matrices with rows and columns indexed by nnn. No continuity is required. The index set nnn may be empty, which gives the zero-dimensional representation.

repMat. For a representation ρ\rhoρ and g∈Gg \in Gg∈G, repMat⁡(ρ,g)\operatorname{repMat}(\rho, g)repMat(ρ,g) is the underlying (invertible) real matrix ρ(g)\rho(g)ρ(g) of size n×nn \times nn×n.

IsIrrep. A representation ρ:G→GLn(R)\rho : G \to \mathrm{GL}_n(\mathbb{R})ρ:G→GLn​(R) is called irreducible exactly when both of the following hold:

  1. The index set nnn is nonempty.
  2. Let W⊆RnW \subseteq \mathbb{R}^nW⊆Rn be any real linear subspace with ρ(g)v∈W\rho(g)v \in Wρ(g)v∈W for all g∈Gg \in Gg∈G and all v∈Wv \in Wv∈W. Then W={0}W = \{0\}W={0} or W=RnW = \mathbb{R}^nW=Rn.

This is irreducibility over R\mathbb{R}R, not over C\mathbb{C}C.

KernelConstraint. The ingredients are:

  • an arbitrary index type Idx\mathrm{Idx}Idx, which may be empty;
  • finite index sets m,nm, nm,n;
  • an arbitrary function act\mathrm{act}act assigning a real 2×22\times22×2 matrix to each g∈Idxg \in \mathrm{Idx}g∈Idx;
  • arbitrary functions ρout\rho_{\mathrm{out}}ρout​ and ρin\rho_{\mathrm{in}}ρin​ assigning to each ggg a real m×mm\times mm×m and n×nn\times nn×n matrix respectively;
  • a function κ\kappaκ from R2\mathbb{R}^2R2 to real m×nm\times nm×n matrices.

None of these functions is required to be a homomorphism, invertible, continuous or measurable. The constraint holds when, for every g∈Idxg \in \mathrm{Idx}g∈Idx and every x∈R2x \in \mathbb{R}^2x∈R2,

κ(act(g) x)=ρout(g) κ(x) ρin(g)−1.\kappa(\mathrm{act}(g)\,x) = \rho_{\mathrm{out}}(g)\,\kappa(x)\,\rho_{\mathrm{in}}(g)^{-1}.κ(act(g)x)=ρout​(g)κ(x)ρin​(g)−1.

Here (⋅)−1(\cdot)^{-1}(⋅)−1 is the matrix inverse, with the convention that a non-invertible matrix's "inverse" is the zero matrix. So if ρin(g)\rho_{\mathrm{in}}(g)ρin​(g) is singular, the right-hand side is 000. If Idx\mathrm{Idx}Idx is empty, the constraint holds vacuously.

IsSteerable. Let G≤O(2)G \le O(2)G≤O(2) be a subgroup, and let ρin:G→GLn(R)\rho_{\mathrm{in}} : G \to \mathrm{GL}_n(\mathbb{R})ρin​:G→GLn​(R) and ρout:G→GLm(R)\rho_{\mathrm{out}} : G \to \mathrm{GL}_m(\mathbb{R})ρout​:G→GLm​(R) be representations. A function k:R2→Rm×nk : \mathbb{R}^2 \to \mathbb{R}^{m\times n}k:R2→Rm×n is GGG-steerable when, for all g∈Gg\in Gg∈G and all x∈R2x\in\mathbb{R}^2x∈R2,

k(gx)=ρout(g) k(x) ρin(g)−1,k(g x) = \rho_{\mathrm{out}}(g)\,k(x)\,\rho_{\mathrm{in}}(g)^{-1},k(gx)=ρout​(g)k(x)ρin​(g)−1,

where gxgxgx is the product of the 2×22\times22×2 matrix of ggg with xxx. Because the ρ(g)\rho(g)ρ(g) are invertible, the inverse here is the genuine inverse. No regularity (continuity, measurability, integrability) of kkk is required.

indAct. Let G≤O(2)G\le O(2)G≤O(2) be a subgroup and ρ:G→GLn(R)\rho : G\to\mathrm{GL}_n(\mathbb{R})ρ:G→GLn​(R) a representation. Take a translation t∈R2t\in\mathbb{R}^2t∈R2, an element g∈Gg\in Gg∈G, and an arbitrary function f:R2→Rnf:\mathbb{R}^2\to\mathbb{R}^nf:R2→Rn. Then indAct⁡(t,g,f)\operatorname{indAct}(t,g,f)indAct(t,g,f) is the function

x  ↦  ρ(g) f(g−1(x−t)).x \;\mapsto\; \rho(g)\, f\big(g^{-1}(x - t)\big).x↦ρ(g)f(g−1(x−t)).

Here g−1g^{-1}g−1 is the inverse of ggg in GGG, applied to x−tx - tx−t as a 2×22\times 22×2 matrix. This only defines the output function; nothing asserts that it is a group action.

steerConv. Let m,nm, nm,n be finite index sets, k:R2→Rm×nk : \mathbb{R}^2 \to \mathbb{R}^{m\times n}k:R2→Rm×n and f:R2→Rnf:\mathbb{R}^2\to\mathbb{R}^nf:R2→Rn. Then k⋆f:R2→Rmk\star f : \mathbb{R}^2\to\mathbb{R}^mk⋆f:R2→Rm is

(k⋆f)(x)=∫R2k(y) f(x+y) dy,(k\star f)(x) = \int_{\mathbb{R}^2} k(y)\, f(x+y)\,dy,(k⋆f)(x)=∫R2​k(y)f(x+y)dy,

a vector-valued (Bochner) integral with respect to Lebesgue measure. It is a correlation: the argument is x+yx + yx+y, not x−yx - yx−y. If the integrand y↦k(y)f(x+y)y\mapsto k(y)f(x+y)y↦k(y)f(x+y) is not integrable as a function into Rm\mathbb{R}^mRm, the value at that xxx is defined to be the zero vector.

kernelBlock. Let IoutI_{\mathrm{out}}Iout​ and IinI_{\mathrm{in}}Iin​ be arbitrary index types, with dimensions dout(i)d_{\mathrm{out}}(i)dout​(i), din(j)∈Nd_{\mathrm{in}}(j)\in\mathbb{N}din​(j)∈N. Let κ\kappaκ be a real matrix whose:

  • rows are indexed by pairs (i,a)(i,a)(i,a) with i∈Iouti\in I_{\mathrm{out}}i∈Iout​ and a∈{0,…,dout(i)−1}a\in\{0,\dots,d_{\mathrm{out}}(i)-1\}a∈{0,…,dout​(i)−1};
  • columns are indexed by pairs (j,b)(j,b)(j,b) with j∈Iinj \in I_{\mathrm{in}}j∈Iin​ and b∈{0,…,din(j)−1}b\in\{0,\dots,d_{\mathrm{in}}(j)-1\}b∈{0,…,din​(j)−1}.

The block κij\kappa^{ij}κij is the dout(i)×din(j)d_{\mathrm{out}}(i)\times d_{\mathrm{in}}(j)dout​(i)×din​(j) matrix with entries

(κij)ab=κ(i,a),(j,b).(\kappa^{ij})_{ab} = \kappa_{(i,a),(j,b)}.(κij)ab​=κ(i,a),(j,b)​.

Dimensions may be 000, giving empty blocks.

eNorm. For v∈Rnv\in\mathbb{R}^nv∈Rn with nnn a finite index set,

∣v∣=∑ivi2.|v| = \sqrt{\textstyle\sum_{i} v_i^2}.∣v∣=∑i​vi2​​.

This is 000 when nnn is empty.

normNL. For an arbitrary function η:R→R\eta:\mathbb{R}\to\mathbb{R}η:R→R and v∈Rnv\in\mathbb{R}^nv∈Rn,

σnorm(v)=η(∣v∣)∣v∣ v.\sigma_{\mathrm{norm}}(v) = \frac{\eta(|v|)}{|v|}\, v.σnorm​(v)=∣v∣η(∣v∣)​v.

Division by 000 is taken to give 000. Hence σnorm(0)=0\sigma_{\mathrm{norm}}(0) = 0σnorm​(0)=0 for every η\etaη, including those with η(0)≠0\eta(0)\ne 0η(0)=0.

quotRep. Let GGG be any group (not required to be finite), H≤GH\le GH≤G any subgroup, and g∈Gg\in Gg∈G. Then quotRep⁡(H,g)\operatorname{quotRep}(H, g)quotRep(H,g) is the real matrix with rows and columns indexed by the left cosets G/HG/HG/H (possibly infinitely many). Its entries are

quotRep⁡(H,g)a,b={1a=g⋅b,0otherwise,\operatorname{quotRep}(H,g)_{a,b} = \begin{cases}1 & a = g\cdot b,\\ 0&\text{otherwise,}\end{cases}quotRep(H,g)a,b​={10​a=g⋅b,otherwise,​

where g⋅(xH)=(gx)Hg\cdot(xH) = (gx)Hg⋅(xH)=(gx)H. Equivalently, its column at bbb is the basis vector eg⋅be_{g\cdot b}eg⋅b​. This is just a matrix-valued function of ggg; it is not packaged as a homomorphism.

regRepCN. For N∈NN\in\mathbb{N}N∈N and p∈Z/Np\in\mathbb{Z}/Np∈Z/N, regRepCN⁡(N,p)\operatorname{regRepCN}(N,p)regRepCN(N,p) is the matrix indexed by Z/N\mathbb{Z}/NZ/N with entries

regRepCN⁡(N,p)q,q′={1q=p+q′,0otherwise,\operatorname{regRepCN}(N,p)_{q,q'} = \begin{cases}1 & q = p+q',\\0&\text{otherwise,}\end{cases}regRepCN(N,p)q,q′​={10​q=p+q′,otherwise,​

so it maps eq′e_{q'}eq′​ to ep+q′e_{p+q'}ep+q′​. For N=0N = 0N=0 the index set Z/0\mathbb{Z}/0Z/0 is Z\mathbb{Z}Z itself, which is infinite.

vfArgmax. For N≥1N\ge 1N≥1 and v:Z/N→Rv:\mathbb{Z}/N\to\mathbb{R}v:Z/N→R, argmax⁡(v)\operatorname{argmax}(v)argmax(v) is some index a∈Z/Na\in\mathbb{Z}/Na∈Z/N with v(a)≥v(q)v(a) \ge v(q)v(a)≥v(q) for all qqq. When several indices attain the maximum, it is a fixed but unspecified one of them.

vecFieldNL. For N≥1N\ge1N≥1 and v:Z/N→Rv:\mathbb{Z}/N\to\mathbb{R}v:Z/N→R,

σvec(v)=(max⁡qv(q))(cos⁡θsin⁡θ)∈R2,θ=2πaN.\sigma_{\mathrm{vec}}(v) = \Big(\max_{q} v(q)\Big)\begin{pmatrix}\cos\theta\\ \sin\theta\end{pmatrix}\in\mathbb{R}^2, \qquad \theta = \frac{2\pi a}{N}.σvec​(v)=(qmax​v(q))(cosθsinθ​)∈R2,θ=N2πa​.

Here a∈{0,…,N−1}a\in\{0,\dots,N-1\}a∈{0,…,N−1} is the representative of argmax⁡(v)\operatorname{argmax}(v)argmax(v) (the unspecified choice above). The maximum may be negative, in which case the output points in direction θ+π\theta+\piθ+π.

rotMat. For θ∈R\theta\in\mathbb{R}θ∈R,

ψ(θ)=(cos⁡θ−sin⁡θsin⁡θcos⁡θ).\psi(\theta) = \begin{pmatrix}\cos\theta & -\sin\theta\\ \sin\theta&\cos\theta\end{pmatrix}.ψ(θ)=(cosθsinθ​−sinθcosθ​).

flipMat. For s∈{+1,−1}s\in\{+1,-1\}s∈{+1,−1} (the units of Z\mathbb{Z}Z),

ξ(s)=(100s).\xi(s) = \begin{pmatrix}1&0\\0&s\end{pmatrix}.ξ(s)=(10​0s​).

o2Elem. For θ∈R\theta\in\mathbb{R}θ∈R and s∈{±1}s\in\{\pm1\}s∈{±1}, this is the matrix ψ(θ) ξ(s)\psi(\theta)\,\xi(s)ψ(θ)ξ(s). Only this product is defined; nothing in this definition asserts a statement about which elements of O(2)O(2)O(2) arise this way.

polar. For any real rrr and φ\varphiφ (negative rrr allowed),

x(r,φ)=(rcos⁡φ,  rsin⁡φ)∈R2.x(r,\varphi) = (r\cos\varphi,\; r\sin\varphi)\in\mathbb{R}^2.x(r,φ)=(rcosφ,rsinφ)∈R2.

so2Dim. For k∈Nk\in\mathbb{N}k∈N, this is 111 if k=0k = 0k=0 and 222 if k≥1k\ge1k≥1.

so2Irrep. For k∈Nk\in\mathbb{N}k∈N and θ∈R\theta\in\mathbb{R}θ∈R:

  • ψ0(θ)\psi_0(\theta)ψ0​(θ) is the 1×11\times11×1 matrix [1][1][1];
  • for k≥1k\ge1k≥1, ψk(θ)=ψ(kθ)\psi_k(\theta) = \psi(k\theta)ψk​(θ)=ψ(kθ), the 2×22\times22×2 rotation matrix.

It is a function of the real number θ\thetaθ, not of a group element, and nothing here asserts that it is a homomorphism or irreducible.

so2BasisCard. For m,n∈Nm,n\in\mathbb{N}m,n∈N (with mmm the output label and nnn the input label), the value is:

  • 111 if m=n=0m=n=0m=n=0;
  • 222 if exactly one of m,nm, nm,n is 000;
  • 444 if m,n≥1m,n\ge1m,n≥1.

so2Basis. For m,n∈Nm,n\in\mathbb{N}m,n∈N, an index b∈{0,…,so2BasisCard⁡(m,n)−1}b\in\{0,\dots,\operatorname{so2BasisCard}(m,n)-1\}b∈{0,…,so2BasisCard(m,n)−1} and φ∈R\varphi\in\mathbb{R}φ∈R, this is a real matrix of size so2Dim⁡(m)×so2Dim⁡(n)\operatorname{so2Dim}(m)\times\operatorname{so2Dim}(n)so2Dim(m)×so2Dim(n), given case by case:

  • m=n=0m=n=0m=n=0: the constant 1×11\times11×1 matrix [1][1][1].
  • m=0m=0m=0, n≥1n\ge1n≥1, b∈{0,1}b\in\{0,1\}b∈{0,1}: the 1×21\times21×2 row
[cos⁡(nφ+bπ2), sin⁡(nφ+bπ2)].\big[\cos(n\varphi + b\tfrac{\pi}{2}),\ \sin(n\varphi + b\tfrac{\pi}{2})\big].[cos(nφ+b2π​), sin(nφ+b2π​)].
  • m≥1m\ge1m≥1, n=0n=0n=0, b∈{0,1}b\in\{0,1\}b∈{0,1}: the 2×12\times12×1 column
(cos⁡(mφ+bπ2)sin⁡(mφ+bπ2)).\begin{pmatrix}\cos(m\varphi + b\frac{\pi}{2})\\ \sin(m\varphi + b\frac{\pi}{2})\end{pmatrix}.(cos(mφ+b2π​)sin(mφ+b2π​)​).
  • m,n≥1m,n\ge1m,n≥1, b∈{0,1,2,3}b\in\{0,1,2,3\}b∈{0,1,2,3}: set sb=1s_b = 1sb​=1 for b<2b<2b<2 and sb=−1s_b=-1sb​=−1 for b≥2b\ge2b≥2, and γb=(b mod 2)π2\gamma_b = (b \bmod 2)\frac{\pi}{2}γb​=(bmod2)2π​. The basis element is
ψ((m−sbn)φ+γb) ξ(sb).\psi\big((m - s_b n)\varphi + \gamma_b\big)\,\xi(s_b).ψ((m−sb​n)φ+γb​)ξ(sb​).

Here φ\varphiφ is a free real argument. Nothing in this definition asserts a link to polar coordinates or to steerability.

so2BasisFreq. For the same m,n,bm, n, bm,n,b, this assigns an integer "frequency":

  • 000 if m=n=0m=n=0m=n=0;
  • nnn if m=0<nm=0<nm=0<n;
  • mmm if n=0<mn=0<mn=0<m;
  • m−sbnm - s_b nm−sb​n if m,n≥1m,n\ge1m,n≥1, with sbs_bsb​ as above. This is m−nm-nm−n for b∈{0,1}b\in\{0,1\}b∈{0,1} and m+nm+nm+n for b∈{2,3}b\in\{2,3\}b∈{2,3}.

O2IrrepLabel. A label is a pair (i,k)(i,k)(i,k) with i∈{0,1}i\in\{0,1\}i∈{0,1}, k∈Nk\in\mathbb{N}k∈N, and k=0k=0k=0 or i=1i=1i=1. The possible labels are therefore (0,0)(0,0)(0,0), (1,0)(1,0)(1,0), and (1,k)(1,k)(1,k) for k≥1k\ge1k≥1.

o2Dim. For a label (i,k)(i,k)(i,k), this is 111 if k=0k=0k=0 and 222 if k≥1k\ge1k≥1.

o2Irrep. For a label (i,k)(i,k)(i,k), θ∈R\theta\in\mathbb{R}θ∈R and s∈{±1}s\in\{\pm1\}s∈{±1}:

  • ψi,0(θ,s)\psi_{i,0}(\theta,s)ψi,0​(θ,s) is the 1×11\times11×1 matrix [si][s^i][si], which is [1][1][1] for i=0i=0i=0 and [s][s][s] for i=1i=1i=1;
  • for k≥1k\ge1k≥1,
ψ1,k(θ,s)=ψ(kθ) ξ(s).\psi_{1,k}(\theta,s) = \psi(k\theta)\,\xi(s).ψ1,k​(θ,s)=ψ(kθ)ξ(s).

It is a function of the pair (θ,s)(\theta,s)(θ,s). Nothing here asserts that it is a homomorphism or irreducible.

o2BasisCard. For an output label (i,m)(i,m)(i,m) and an input label (j,n)(j,n)(j,n), the value is:

  • 111 if m=n=0m=n=0m=n=0 and i=ji=ji=j;
  • 000 if m=n=0m=n=0m=n=0 and i≠ji\ne ji=j;
  • 111 if exactly one of m,nm,nm,n is 000;
  • 222 if m,n≥1m,n\ge1m,n≥1.

o2Basis. For an output label (i,m)(i,m)(i,m), an input label (j,n)(j,n)(j,n), an index b∈{0,…,o2BasisCard⁡−1}b\in\{0,\dots,\operatorname{o2BasisCard}-1\}b∈{0,…,o2BasisCard−1} and φ∈R\varphi\in\mathbb{R}φ∈R, this is a real matrix of size o2Dim⁡(i,m)×o2Dim⁡(j,n)\operatorname{o2Dim}(i,m)\times\operatorname{o2Dim}(j,n)o2Dim(i,m)×o2Dim(j,n), given case by case:

  • m=n=0m=n=0m=n=0: the 1×11\times11×1 matrix [1][1][1]. When i≠ji\ne ji=j there is no index bbb at all, so the basis is empty.
  • m=0<nm=0<nm=0<n: the single 1×21\times21×2 row
[cos⁡(nφ+iπ2), sin⁡(nφ+iπ2)],\big[\cos(n\varphi + i\tfrac{\pi}{2}),\ \sin(n\varphi + i\tfrac{\pi}{2})\big],[cos(nφ+i2π​), sin(nφ+i2π​)],

whose phase uses the output index iii.

  • n=0<mn=0<mn=0<m: the single 2×12\times12×1 column
(cos⁡(mφ+jπ2)sin⁡(mφ+jπ2)),\begin{pmatrix}\cos(m\varphi + j\frac{\pi}{2})\\ \sin(m\varphi + j\frac{\pi}{2})\end{pmatrix},(cos(mφ+j2π​)sin(mφ+j2π​)​),

whose phase uses the input index jjj.

  • m,n≥1m,n\ge1m,n≥1, b∈{0,1}b\in\{0,1\}b∈{0,1}: set sb=1s_b=1sb​=1 for b=0b=0b=0 and sb=−1s_b=-1sb​=−1 for b=1b=1b=1. The basis element is ψ((m−sbn)φ) ξ(sb)\psi\big((m-s_b n)\varphi\big)\,\xi(s_b)ψ((m−sb​n)φ)ξ(sb​), that is,
b=0: ψ((m−n)φ),b=1: ψ((m+n)φ) ξ(−1).b=0:\ \psi\big((m-n)\varphi\big), \qquad b=1:\ \psi\big((m+n)\varphi\big)\,\xi(-1).b=0: ψ((m−n)φ),b=1: ψ((m+n)φ)ξ(−1).

There is no phase offset in this last case. Nothing in this definition asserts a link to polar coordinates or to steerability.

o2BasisFreq. For the same labels and index, this assigns an integer frequency:

  • 000 if m=n=0m=n=0m=n=0;
  • nnn if m=0<nm=0<nm=0<n;
  • mmm if n=0<mn=0<mn=0<m;
  • m−sbnm - s_b nm−sb​n if m,n≥1m,n\ge1m,n≥1. This is m−nm-nm−n for b=0b=0b=0 and m+nm+nm+n for b=1b=1b=1.
Human review
  • Endorsed by Shuze Chen · Nov 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 24, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me