File size: 6,036 Bytes
36d2620
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c101e3
36d2620
872d786
36d2620
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
844a4eb
36d2620
 
 
 
 
 
 
 
 
 
 
3ecc255
5c101e3
 
 
36d2620
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c101e3
36d2620
 
 
 
 
 
 
5c101e3
 
36d2620
 
 
 
 
 
 
 
1c5823d
5c101e3
36d2620
 
475137d
36d2620
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
872d786
36d2620
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c101e3
 
 
36d2620
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
---
license: mit
task_categories:
- text-generation
language:
- en
tags:
- mathematics
- group-theory
- permutations
- symbolic-reasoning
- algebra
- sequence-modeling
pretty_name: Permutation Groups Composition Dataset
size_categories:
- 10M<n<100M
---

# Permutation Groups Composition Dataset

A comprehensive collection of permutation composition datasets for various mathematical groups including symmetric, alternating, cyclic, dihedral, and special groups, with multiple sequence length variants.

## Dataset Description

This dataset contains permutation composition problems across 30 different mathematical groups with 8 different sequence length variants each, totaling 270 distinct configurations.

### Supported Groups

#### Symmetric Groups (Sn)
- **S3** to **S7**: All permutations of n elements (orders: 6, 24, 120, 720, 5040)

#### Alternating Groups (An)
- **A3** to **A7**: Even permutations of n elements (orders: 3, 12, 60, 360, 2520)

#### Cyclic Groups (Cn/Zn)
- **C3** to **C12**: Cyclic groups of order n
- **Z3** to **Z6**: Alternative notation for cyclic groups
- Orders: 3, 4, 5, 6, 7, 8, 10, 12

#### Dihedral Groups (Dn)
- **D3** to **D8**: Symmetries of regular n-gons (orders: 6, 8, 10, 12, 14, 16)

#### Special Groups
- **PSL(2,5)**: Projective special linear group (order 60)
- **F20**: Frobenius group F(5,4) (order 20)

### Length Variants

Each group is available with 8 different maximum sequence lengths:
- 2², 2³, 2⁴, 2⁵, 2⁶, 2⁷, 2⁸, 2⁹ (4, 8, 16, 32, 64, 128, 256, 512)

Each dataset consists of sequences of permutations that need to be composed to produce a target permutation. This is useful for:
- Training models on algebraic reasoning and symbolic computation
- Evaluating mathematical understanding and compositional generalization
- Benchmarking sequence models on structured mathematical tasks
- Studying group theory properties in neural networks
- Research in abstract algebra and computational mathematics

## Usage

```python
from datasets import load_dataset

# NEW: Clean API - just specify group and max_len
s5_data = load_dataset(
    "BeeGass/permutation-groups",
    name="s5",          # Just the group name
    max_len=32,         # Optional: filter sequences ≤ 32 (default: 512)
    trust_remote_code=True
)

# More examples with the clean API
c8_short = load_dataset("BeeGass/permutation-groups", name="c8", max_len=16, trust_remote_code=True)
d4_medium = load_dataset("BeeGass/permutation-groups", name="d4", max_len=64, trust_remote_code=True)
all_short = load_dataset("BeeGass/permutation-groups", name="all", max_len=32, trust_remote_code=True)

# Backwards compatibility - old style still works
s5_data = load_dataset("BeeGass/permutation-groups", name="s5_data", trust_remote_code=True)
s5_len32 = load_dataset("BeeGass/permutation-groups", name="s5_len32", trust_remote_code=True)

# Access the data
train_data = s5_data["train"]
test_data = s5_data["test"]

# Example data point
print(train_data[0])
# {'input_sequence': '23 45 12', 'target': '67'}
```

## Dataset Structure

Each example contains:
- `input_sequence`: A space-separated sequence of permutation IDs to be composed
- `target`: The ID of the resulting permutation after composition

The composition follows standard mathematical convention: for input `[p1, p2, p3]`, the result is `p3 ∘ p2 ∘ p1`.

## Available Configurations

### Efficient Loading (Recommended)
Simply specify the group name and optional `max_len` parameter:

```python
# Load any group with any max sequence length
dataset = load_dataset("BeeGass/permutation-groups", name="s5", max_len=32, trust_remote_code=True)
```

### All Groups (30 total)
| Group | Type | Order | Example Usage |
|-------|------|-------|---------------|
| S3-S7 | Symmetric | 6-5040 | `name="s5", max_len=64` |
| A3-A7 | Alternating | 3-2520 | `name="a4", max_len=32` |
| C3-C12 | Cyclic | 3-12 | `name="c8", max_len=16` |
| Z3-Z6 | Cyclic (alt) | 3-6 | `name="z5", max_len=128` |
| D3-D8 | Dihedral | 6-16 | `name="d4", max_len=256` |
| PSL25 | PSL(2,5) | 60 | `name="psl25", max_len=64` |
| F20 | Frobenius | 20 | `name="f20", max_len=32` |
| all | Combined | - | `name="all", max_len=16` |

### Legacy Configuration Names
For backwards compatibility, old-style names still work:
- `s5_data` (equivalent to `name="s5"`)
- `s5_len32` (equivalent to `name="s5", max_len=32`)
- etc.

## Dataset Features

- **Variable sequence length**: Input sequences range from 3 to maximum configured length
- **Length-specific variants**: 8 different maximum lengths for each group (2² to 2⁹)
- **Consistent formatting**: All permutations use space-separated integer IDs
- **Metadata included**: Each dataset includes a `metadata.json` file mapping IDs to permutation array forms
- **Train/test split**: 80/20 split for all configurations
- **Scaled sample sizes**: Shorter sequences have more samples for efficient training

## Understanding the Data

Each permutation is represented by a unique integer ID. The `metadata.json` file in each dataset folder provides the mapping from IDs to permutation array forms.

For example, in S3:
- ID 0 might map to `[0, 1, 2]` (identity)
- ID 1 might map to `[0, 2, 1]` (transpose elements 1 and 2)
- etc.

## Citation

If you use this dataset in your research, please cite:

```bibtex
@software{permutation_groups_dataset,
  author = {Bryan Gass},
  title = {Permutation Groups Dataset},
  year = {2024},
  publisher = {Hugging Face},
  url = {https://huggingface.co/datasets/BeeGass/permutation-groups}
}
```

## Acknowledgments

This dataset was inspired by the work of [William Merrill](https://github.com/viking-sudo-rm) and his paper ["The Illusion of State in State-Space Models"](https://arxiv.org/abs/2404.08819), which explores the computational properties of state-space models through group theory.

## License

This dataset is released under the MIT License.

## Contact

For questions or issues, please open an issue on the [GitHub repository](https://github.com/BeeGass/permutation-groups).