arXiv:2610.36795cs.LOOct 2026

Manuscript Offprint

arXiv:2610.36795

An Algebra of Transformers

Yong Wang, Zhiyan Wang, Hexiao Kang

Contents

1 Introduction 1

2 Preliminaries 3
2.1 Multiset 3
2.2 Equational Logic 4
2.3 Pomset Labelled Transition System 5

3 Basic Algebra for Transformers 8
3.1 Axiomatic System 8
3.2 Operational Semantics 11
3.3 Soundness and Completeness 11

4 Algebra of Parallelism for Transformers 13
4.1 Operational Semantics 13
4.2 Axiomatic System 13
4.3 Soundness and Completeness 16

5 Recursion 18
5.1 Operational Semantics 19
5.2 Axiomatic System 19
5.3 Soundness and Completeness 20

6 Abstraction 21
6.1 Silent Step 21
6.1.1 Operational Semantics 21
6.1.2 Axiomatic System 23
6.1.3 Soundness and Completeness 23
6.2 Abstraction 24
6.2.1 Operational Semantics 25
6.2.2 Axiomatic System 25
6.2.3 Soundness and Completeness 26

i

7 Application 29
7.1 Verification of a Transformer for Most-Recent Induction ..... 29
7.1.1 A Transformer Construction of the Most-Recent Induction ..... 29
7.1.2 Algebraic Representation ..... 30
7.1.3 Verification of the Most-Recent Induction Transformer ..... 32
7.2 Verification of a Transformer for Dyck-1 ..... 33
7.2.1 A Transformer Construction for Dyck-1 ..... 33
7.2.2 Algebraic Representation ..... 35
7.2.3 Verification of the Dyck-1 Transformer ..... 37
7.3 Verification of a Transformer for Dyck-1-2 ..... 38
7.3.1 A Transformer Construction of Dyck-1-2 ..... 38
7.3.2 Algebraic Representation ..... 40
7.3.3 Verification of the Dyck-1-2 Transformer ..... 44

ii