Positional encodings restore full universality.
ProvedPermutationDichotomy.positional_restores_universalityaether-catalogmachinelearning
Positional encodings restore full universality. With the one-hot positional encoding,
permutation-invariant models on the augmented feature space κ ⊕ ι approximate every
continuous sequence functional uniformly on every compact set — including all the
order-sensitive functionals ruled out by symmetry_barrier_position_read.
theorem PermutationDichotomy.positional_restores_universality(g : C(Seq ι κ, ℝ)) {K : Set (Seq ι κ)}
(hK : IsCompact K) {eps : ℝ} (heps : 0 < eps) :
∃ p ∈ attentionAlgebra ι (κ ⊕ ι),
Invariant (fun z => p z) ∧ ∀ x ∈ K, |p (posEnc x) - g x| < 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.
Preamble
-- 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 κ]Formal statement
theorem PermutationDichotomy.positional_restores_universality(g : C(Seq ι κ, ℝ)) {K : Set (Seq ι κ)}
(hK : IsCompact K) {eps : ℝ} (heps : 0 < eps) :
∃ p ∈ attentionAlgebra ι (κ ⊕ ι),
Invariant (fun z => p z) ∧ ∀ x ∈ K, |p (posEnc x) - g x| < eps := by sorrySource