Equivariant universality: the exact converse of the symmetry barrier.
ProvedPermutationDichotomy.equivariant_uniform_universalEquivariant universality: the exact converse of the symmetry barrier.
A Γ-invariant attention model, queried through the marked encoding, uniformly approximates
every continuous Γ-equivariant sequence-to-sequence map on every compact domain — and the
resulting head family is itself exactly Γ-equivariant.
Together with symmetry_barrier_position_read (no invariant model can approximate a
non-equivariant target) and positional_restores_universality (positional encodings remove the
restriction), this pins down the expressive power of symmetric attention: it is precisely the
equivariant continuous maps.
theorem PermutationDichotomy.equivariant_uniform_universal(act : Γ →* Equiv.Perm ι) (F : Seq ι κ → Seq ι κ)
(hFc : ∀ i a, Continuous fun x => F x i a) (hFe : EquivariantUnder act F)
{K : Set (Seq ι κ)} (hK : IsCompact K) {eps : ℝ} (heps : 0 < eps) :
∃ P : κ → C(Seq ι (κ ⊕ Unit), ℝ),
(∀ a, P a ∈ attentionAlgebra ι (κ ⊕ Unit)) ∧
(∀ a, InvariantUnder act (fun z => P a z)) ∧
(∀ (a : κ) (g : Γ) (i : ι) (x : Seq ι κ),
P a (markAt i (permAct (act g) x)) = P a (markAt (act g i) x)) ∧
(∀ x ∈ K, ∀ i a, |P a (markAt i x) - F x i a| < eps) := by sorry
Formalization Note Transplanted verbatim from the Aether Catalog source MachineLearning/TransformerUniversality/PermutationDichotomy.lean; the statement is byte-identical to the source declaration, elaborated with autoImplicit disabled in the platform environment.
-- Thm stub generated from MachineLearning/TransformerUniversality/PermutationDichotomy.lean
import Mathlib
import Definitions.Def_MachineLearning_TransformerUniversality_PermutationDichotomy
/-!
# The symmetry dichotomy for attention architectures
`Catalog/MachineLearning/TransformerUniversality/ContinuousUniversality.lean` proves that the
subalgebra generated by linear-attention readouts is uniformly dense in the continuous
functionals of a sequence, and
`Catalog/MachineLearning/TransformerUniversality/PositionalSymmetry.lean` shows that additive
positional encodings destroy permutation symmetry. Neither file answers the question those two
results pose together:
> *exactly which* sequence functionals can a symmetric (positional-encoding-free) attention
> architecture approximate, and does positional encoding really restore everything?
This file answers both, and does so at the natural level of generality: an arbitrary **finite
group of token symmetries**, presented as a homomorphism `act : Γ →* Equiv.Perm ι`. Taking
`Γ = Equiv.Perm ι` with `act = id` recovers the fully permutation-symmetric (absolute-position
free) transformer; taking `Γ` cyclic recovers relative/shift-equivariant attention.
Write `Seq ι κ = ι → κ → ℝ` for length-`ι` sequences of `κ`-dimensional features and let
`permAct σ x = x ∘ σ` be the token-permutation action. The architecture class is the
`ℝ`-subalgebra `attentionAlgebra` generated by the linear attention readouts (a readout with
uniform softmax weights is literally a uniform-attention head, see
`softmaxHeadRead_zero_scores`), and the *symmetric* class is its subset of `Γ`-invariant
elements.
Main results.
* `group_uniform_universal` — **positive half**: on every compact `Γ`-saturated set of
sequences, every `Γ`-invariant continuous functional is uniformly approximated by a
`Γ`-invariant element of `attentionAlgebra`. The proof runs Stone–Weierstrass and then
averages the approximant over `Γ`, which needs the algebra to be stable under the action
(`attentionAlgebra_compPerm_mem`). `symmetric_uniform_universal` and
`shift_uniform_universal` are the full-symmetric and cyclic-shift specializations.
* `invariant_defect_lower_bound`, `symmetric_class_closed_under_uniform_limits`,
`orbit_barrier_lower`, `orbit_barrier_attained` — **negative half**: the invariant class is
uniformly closed and the optimal invariant error on an orbit is *exactly* half the orbit
oscillation. `symmetry_barrier_position_read` makes this concrete: no model invariant under
a permutation that moves position `i₀` reads position `i₀` to accuracy better than `1/2`.
* `positional_restores_universality`, `positional_seq2seq_universality` — **the repair**: with
the one-hot positional encoding `posEnc`, *fully permutation-invariant* models on the
augmented feature space `κ ⊕ ι` approximate every continuous functional, and every continuous
sequence-to-sequence map, uniformly on compacta. The mechanism is an explicit invariant
continuous decoder `decodeSeq` inverting `posEnc`.
* `equivariant_uniform_universal` — **exact converse**: through the marked-token encoding,
`Γ`-invariant attention models uniformly approximate every continuous `Γ`-equivariant
sequence-to-sequence map, and the resulting head family is itself exactly equivariant. So
the expressive power of symmetric attention is *precisely* the equivariant continuous maps.
-/
open scoped BigOperators
open PermutationDichotomy
variable {ι κ : Type*}
variable {Γ : Type*} [Group Γ]
variable {ι κ : Type*} [Fintype ι] [Fintype κ]
variable {ι κ : Type*} [Fintype ι] [Fintype κ]
variable {ι κ : Type*} [Fintype ι] [Fintype κ] {Γ : Type*} [Group Γ] [Fintype Γ]
variable {ι κ : Type*} [Fintype ι] [Fintype κ] {Γ : Type*} [Group Γ] [Fintype Γ]
variable [DecidableEq ι]
variable {ι κ : Type*}
variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ]
variable {ι κ : Type*} [DecidableEq ι]
variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ]
variable {Γ : Type*} [Group Γ] [Fintype Γ]theorem PermutationDichotomy.equivariant_uniform_universal(act : Γ →* Equiv.Perm ι) (F : Seq ι κ → Seq ι κ)
(hFc : ∀ i a, Continuous fun x => F x i a) (hFe : EquivariantUnder act F)
{K : Set (Seq ι κ)} (hK : IsCompact K) {eps : ℝ} (heps : 0 < eps) :
∃ P : κ → C(Seq ι (κ ⊕ Unit), ℝ),
(∀ a, P a ∈ attentionAlgebra ι (κ ⊕ Unit)) ∧
(∀ a, InvariantUnder act (fun z => P a z)) ∧
(∀ (a : κ) (g : Γ) (i : ι) (x : Seq ι κ),
P a (markAt i (permAct (act g) x)) = P a (markAt (act g i) x)) ∧
(∀ x ∈ K, ∀ i a, |P a (markAt i x) - F x i a| < eps) := by sorry