Datasets:
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- theory-of-computation
|
| 7 |
+
- automata
|
| 8 |
+
- formal-languages
|
| 9 |
+
- parsing
|
| 10 |
+
- turing-machine
|
| 11 |
+
- rl-environment
|
| 12 |
+
size_categories:
|
| 13 |
+
- n<1K
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# sipser-tasks-v1
|
| 17 |
+
|
| 18 |
+
27 automata-and-formal-languages tasks for the
|
| 19 |
+
[`sipser-env`](https://app.primeintellect.ai/dashboard/environments/eltociear/sipser-env) RL
|
| 20 |
+
environment, on the topics of *Introduction to the Theory of Computation* (Sipser): DFA and NFA
|
| 21 |
+
simulation, the subset construction, DFA minimisation, regular expressions, CYK parsing of a
|
| 22 |
+
context-free grammar, and Turing machine execution.
|
| 23 |
+
|
| 24 |
+
| field | meaning |
|
| 25 |
+
|---|---|
|
| 26 |
+
| `task_id` | `sp-000` … `sp-026` |
|
| 27 |
+
| `category` | dfa / nfa / regex / cfg / tm |
|
| 28 |
+
| `prompt` | the question and the exact shape of the answer |
|
| 29 |
+
| `api_description` | the fixed machines — DFA, NFA, CFG, TM — plus the shortlex ordering rule |
|
| 30 |
+
| `expected_output` | JSON `{"rows": [...]}`, **computed by executing a reference solution** |
|
| 31 |
+
|
| 32 |
+
Categories: dfa 6, nfa 5, regex 5, cfg 6, tm 5. No dependencies — `itertools` and `re` are
|
| 33 |
+
standard library.
|
| 34 |
+
|
| 35 |
+
## Original machines, not the book's exercises
|
| 36 |
+
|
| 37 |
+
Nothing is copied. The automata, grammar and Turing machine are invented here — deliberately
|
| 38 |
+
including the grammar, because the CYK example printed in most textbooks is one and the same
|
| 39 |
+
and its parse table is all over the web. A model can recall that table; it cannot recall this
|
| 40 |
+
one.
|
| 41 |
+
|
| 42 |
+
## Why automata theory suits an executed answer key
|
| 43 |
+
|
| 44 |
+
These questions look like proofs but are almost all **decidable by simulation**. Whether a DFA
|
| 45 |
+
accepts a string, how many strings of length n it accepts, how many subsets the construction
|
| 46 |
+
reaches, whether a regular expression and an automaton describe the same language, whether a
|
| 47 |
+
grammar generates a string and with how many parse trees — each is a program, and the answer is
|
| 48 |
+
whatever the program computes.
|
| 49 |
+
|
| 50 |
+
## The trap: "how many states?" has three right answers
|
| 51 |
+
|
| 52 |
+
For the NFA here, the subset construction has **8** subsets on paper, **4** are reachable, and
|
| 53 |
+
**3** survive minimisation. All three are correct answers to differently-worded questions, and
|
| 54 |
+
an environment that was vague about which it wanted would mark correct work wrong. Every task
|
| 55 |
+
names the one it means, and one task asks for all three at once.
|
| 56 |
+
|
| 57 |
+
## A defect caught before publishing
|
| 58 |
+
|
| 59 |
+
A parse-tree-counting task asked how many trees the grammar gives to `baaba` — a string the
|
| 60 |
+
grammar **does not generate at all**, so the answer was `0` and the task taught nothing about
|
| 61 |
+
ambiguity. It now asks about `bbabb` (3 trees), `aaaab` (2) and `ba` (0), so one row
|
| 62 |
+
distinguishes ambiguous, derivable and non-generated. The builder asserts exactly that.
|
| 63 |
+
|
| 64 |
+
The two machines' languages are also cross-checked by brute force over every string up to
|
| 65 |
+
length 10, rather than being trusted from their state diagrams.
|
| 66 |
+
|
| 67 |
+
Verify with `python environments/sipser_env/build_tasks.py --verify` (27/27).
|
| 68 |
+
Source: <https://github.com/eltociear/my-molt-agent/tree/main/environments/sipser_env>
|