diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..84aabc7 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,26 @@ +cff-version: 1.2.0 +message: "If you use AutomataStudio in your research or teaching, please cite it as below." +type: software +title: "AutomataStudio: An IDE for Designing, Simulating and Analysing Automata" +abstract: >- + An interactive environment for building, running and analysing automata — + finite, ω-, pushdown, Turing and transducer machines — with a grammar + workbench, steppable textbook constructions, a built-in theory reference, + and a command-line engine with Turing-machine halting proofs. +authors: + - family-names: Chaubey + given-names: Shreyan + alias: thethinkmachine +version: 2.9.0 +license: LicenseRef-PolyForm-Noncommercial-1.0.0 +repository-code: "https://github.com/thethinkmachine/AutomataStudio" +url: "https://thethinkmachine.github.io/AutomataStudio/" +keywords: + - automata theory + - formal languages + - Turing machines + - pushdown automata + - omega-automata + - context-free grammars + - simulation + - education diff --git a/README.md b/README.md index 6b2b873..558f997 100644 --- a/README.md +++ b/README.md @@ -1,226 +1,325 @@ +
-A four-tape ALU computing 11 + 6 = 17: tapes 1 and 2 hold the operands `1101`
-and `0110` — least-significant bit first, so 11 and 6 — tape 3 the opcode `+`, and
-tape 4 the result `10001`. Every row is drawn as the model actually defines it — the
-hatched cap and the `bounded left` label say this machine's tape stops at cell 0
-rather than running on, which is a fact a plain row of cells cannot show. The rows
-turn green when the run reaches its accepting state.
+Top: the divisibility DFA accepting `1100100` (100 in binary). Bottom: a four-tape
+ALU computing 11 + 6 = 17, with each tape drawn as its model defines it.
+
+
+
+**Space-time diagram** of the BB(2,4) busy beaver champion
+(`1RB2LA1RA1RA_1LB1LA3RB1RZ`), the two-state, four-symbol machine that runs longest
+before halting. It plays a few dozen steps cell by cell, then *Compute the rest* runs
+all 3,932,964 steps in about five seconds. The widened overview shows the whole run,
+and *Jump to end* lands on the halt: 2,050 non-blank cells.
### Grammars
-A grammar workbench with 25 tools in six groups — inspect, normalize, parse,
-decide, convert, and a library to start from. Among them: FIRST/FOLLOW, Chomsky
-classification, ε-removal, unit and useless-rule elimination, CNF, GNF, left
-recursion removal, left factoring, CYK, parse trees, leftmost and rightmost
-derivations, ambiguity witnesses, LL(1) tables, word generation, and conversion
-to and from the canvas.
-
-
-
-The grammar workbench. The grammar is written once in the sticky card at the top and
-then taken apart by the tools in the rail; here CYK has decided `aabb ∈ L(G)` and the
-table is scrubbed to its last step, with `S` in `T[0][3]` — the cell spanning the
-whole word — and the line underneath naming the split that put it there. CYK is
-defined on Chomsky normal form, so the conversion it ran on is shown below the table
-rather than assumed.
-
-### Getting it out
-* **Import:** JFLAP `.jff` files, including the 6.1 variable and block notation.
-* **Diagrams:** PNG and SVG, with text converted to outlines so a diagram carries
- its own type and does not depend on the reader having the fonts.
-* **Interchange:** Graphviz DOT, TikZ/LaTeX, transition tables as CSV or Markdown,
- language samples, transition coverage, batch results, workspace JSON.
-* **Code:** JavaScript, Python, Java, C, XState and SCXML, in table, switch or class
- styles — plus Jest and pytest suites.
-* **Share links:** The whole workspace compressed into a URL. Nothing reaches a
+The grammar workbench has 25 tools for inspecting, normalising, parsing, deciding and
+converting grammars. They include FIRST/FOLLOW, Chomsky classification, CNF and GNF,
+removal of ε, unit, useless and left-recursive rules, left factoring, CYK, parse trees,
+derivations, ambiguity witnesses, LL(1) tables, and conversion to and from the canvas.
+
+
+
+The grammar is checked as you type it. CYK fills its table one span at a time on
+`aabb` (using the Chomsky normal form it converted to, which is shown below the table).
+*Check ambiguity* then finds two different parse trees for `ababab`, which proves the
+grammar is ambiguous.
+
+### Import, export and sharing
+- **Import:** JFLAP `.jff` (including 6.1 blocks), XState, SCXML, and machine codes.
+- **Diagrams:** PNG and SVG, with text converted to outlines. A PNG can embed the
+ workspace, so dropping it back on the canvas resumes editing.
+- **Interchange:** Graphviz DOT, TikZ/LaTeX, CSV and Markdown transition tables, and
+ workspace JSON.
+- **Code generation:** JavaScript, Python, Java, C, XState and SCXML, with Jest and
+ pytest suites.
+- **Share links:** the whole workspace is compressed into a URL and never sent to a
server.
+- **Exercises:** sealed reference solutions with exact or bounded grading, for teaching.
+
+### StateMate (optional AI assistant)
+StateMate builds and edits machines from a prompt and answers questions about the one
+on screen. It works with Anthropic, OpenAI, Mistral AI, Google AI Studio, Cohere,
+OpenRouter, or any OpenAI-compatible local server. You supply your own key, and it is
+never written to a saved file. Every candidate machine is run on the real simulator
+before you see it, and you choose whether StateMate asks, proposes or applies changes
+automatically.
+
+
+
+One prompt, *a pushdown automaton that accepts balanced strings of ( ) and [ ]*. The
+proposal arrives as a diff with its test words already run (5/5 checks). Apply draws
+it, and `([])` is accepted. Recorded through the repository's agent bridge
+([tools/agent-bridge](tools/agent-bridge/statemate-bridge.mjs)), so the answer goes
+through the same parse, lint and verify steps as one from any provider.
+
+## Algorithms and theory
+
+The app has 34 interactive constructions from the standard textbooks (Hopcroft &
+Ullman, Sipser), and each one can be stepped through:
-### Saving
-A workspace is a `.automaton` file. `.json` is accepted on import forever. PNG
-export can additionally embed the workspace in the image: drop that image back onto
-the canvas to resume editing.
-
-### StateMate
-An optional AI assistant that builds and edits machines from a prompt, or answers
-questions about the one on screen. It runs against Anthropic, OpenAI, Mistral AI,
-Google AI Studio, Cohere, OpenRouter, or any OpenAI-compatible local server; you
-supply your own key, which is kept out of every save format. Write authority is
-yours to set — ask, propose, or auto — and every candidate is executed against the
-real simulator before it is offered. The canvas is written exactly once, at the end,
-or not at all.
-
-## Algorithms & Theory
-
-34 interactive constructions from the standard textbooks (Hopcroft–Ullman, Sipser),
-each one steppable:
-
-* **Conversions:** NFA → DFA subset construction, ε-NFA → NFA, regex → NFA, NFA →
- regex, DFA ↔ regular grammar, TM → grammar, Moore ↔ Mealy.
-* **Analysis:** DFA minimization (table-filling and visual), equivalence with a
- distinguishing string, ε-closure, dead states, computation trees.
-* **Closure constructions:** union, intersection, concatenation, star, complement,
- reversal, product.
-* **Decision procedures:** emptiness, finiteness, universality.
-* **Tables:** transition, Moore, Mealy, multi-tape.
-* **A universal Turing machine** visualizer.
-
-
-
-Subset construction on an NFA that searches for the keywords *cat*, *car* and *cab*.
-Each DFA state is a set of NFA states, and the algorithm is shown as a table plus the
-numbered steps that built it — including the reads that go nowhere and collapse to the
-dead state. `Load Result into Canvas` puts the constructed DFA on the canvas as an
-ordinary machine you can then edit, run or export.
-
-A built-in reference explains every machine in the picker and carries a Decidability
-section — decidable vs. recognizable, the decidable questions for finite automata
-and CFLs, diagonalization, reductions, Rice's theorem, and a map of what is decidable
-where.
-
-
-
-The built-in reference. One page per machine the app can build, each with what the
-model is, its formal definition, and what it can and cannot recognise; the rail lists
-them in the same groups the model picker uses. The pages are generated from the same
-registry the picker reads, and a test fails if a machine the picker offers has no
-guide — so a machine added to the app cannot quietly go undocumented.
+- **Conversions:** subset construction, ε-NFA → NFA, regex ↔ NFA, DFA ↔ regular
+ grammar, TM → grammar, Moore ↔ Mealy
+- **Analysis:** minimisation (table-filling and visual), equivalence with a
+ distinguishing word, ε-closure, dead states, computation trees
+- **Closure:** union, intersection, concatenation, star, complement, reversal, product
+- **Decision procedures:** emptiness, finiteness, universality
+- **A universal Turing machine** visualiser
+
+
+
+A built-in **reference** has a page for every machine type, covering its formal
+definition and what it can and cannot recognise. It also has sections on decidability
+(Rice's theorem, reductions, diagonalisation) and on language classes.
+
+
## Command line
-`automata` is the same engine in a terminal: run, test, trace and animate machines,
-compare and convert them, grade a class, learn a DFA from examples, and prove
-whether Turing machines halt.
+
+`automata` runs the same engine from a terminal. You can use it to run, test, trace and
+animate machines, compare and convert them, grade a class, learn a DFA from examples,
+serve machines over MCP, and prove whether Turing machines halt.
```sh
automata run machine.automaton 0110 101 # ✔ accept / ✘ reject / ? unknown
-automata play machine.automaton 0110 --history # an animated run: space pauses, arrows step
+automata play machine.automaton 0110 --history # animated run in the terminal
automata from-regex "(a|b)*abb" | automata minimize - | automata codegen - --lang py
automata grade exercise.automaton submissions/ --csv grades.csv
automata halts machines.txt --proof proofs/ # halting proofs, checkable with check-proof
```
-It ships inside the desktop app (put `resources/cli` on your `PATH`), or from a
-checkout with `npm install && npm link`. Start with `automata --help` and
-`automata help machines`; the [guide](docs/cli.md) walks through it by task, and
-the [command reference](docs/cli-reference.md) lists every option.
-
-## Desktop app
-The Windows and Linux AppImage builds update themselves: they check on startup and
-on demand from **⋯ → Check for Updates**. If a check fails it shows a code —
-[what the update error codes mean](docs/update-error-codes.md). macOS builds are not
-self-updating.
-
-## Known Issues / Roadmap
-- Regular expression derivation is refused past 120 states: state
- elimination is cubic in |Q|, so the Language panel asserts the class rather than
- deriving an expression on large machines.
-- An exported SVG inlines the whole application stylesheet, which dominates the file
- size. Narrowing that scrape to the canvas rules is the largest size win available.
-- Pushdown automata accept by final state only. A JFLAP file that accepts by
- empty stack is imported as final-state acceptance and flagged, since it may
- decide a different language.
+
+
+`automata halts` on nine machines: the BB(2), BB(2,4) and BB(5) champions halt
+(BB(5) after 47,176,870 steps), five machines are proved never to halt by five different
+methods, and the last, Antihydra, is reported as unknown: whether it halts is an open
+problem. `check-proof` then
+re-checks every proof file with code that shares nothing with the provers.
+
+It also reads and writes HOA, BA, Timbuk and JFLAP. To install it, add the desktop
+app's `resources/cli` directory to your `PATH`, or run `npm install && npm link` from a
+checkout. Read the [CLI guide](docs/cli.md) for task-by-task instructions, or the
+[command reference](docs/cli-reference.md) for every option.
+
+## Development
+
+```bash
+npm run dev # Vite dev server
+npm test # node:test suite (tests/*.test.js)
+npm run build # production web build -> dist/
+npm run electron:dev # the desktop shell against the dev server
+npm run electron:build # installers -> release/
+npm run cli -- --help # the CLI, from source
+npm run bench # engine and renderer timings vs. bench/baseline.json
+```
+
+The code is organised as follows:
+
+```
+js/ the app: plain ES modules, SVG rendering, Solid signals for derived panels
+js/machines/ one module per machine family, behind a registry (DOM-free)
+js/grammar/ the grammar workbench
+cli/ the `automata` command line
+electron/ the desktop shell
+wasm/ the label-placement kernel (AssemblyScript)
+tests/ node:test, with a DOM stub
+docs/ user documentation and media
+```
+
+[CLAUDE.md](CLAUDE.md) holds the architecture notes: the module layout, the change
+notification store, the renderer, and how to add a machine type (one row in
+`MachineTypes` and one `defineMachine` call).
+
+## Known issues
+
+- Regular-expression derivation stops at 120 states. State elimination is cubic, so
+ larger machines show the language class instead of an expression.
+- An exported SVG inlines the whole application stylesheet, which makes the file larger
+ than it needs to be.
+- Pushdown automata accept by final state only. A JFLAP file that accepts by empty
+ stack is imported as final-state acceptance and flagged.
+
+Bug reports and feature requests go to the
+[issue tracker](https://github.com/thethinkmachine/AutomataStudio/issues). If the
+desktop updater reports an error, the code is explained in
+[docs/update-error-codes.md](docs/update-error-codes.md).
## Contributing
-Pull requests are welcome. Commits must be signed off (`git commit -s`) — see
-[CONTRIBUTING.md](CONTRIBUTING.md), which explains the one legal formality and why
-the project's licensing commitments depend on it.
+
+Pull requests are welcome. Commits must be signed off (`git commit -s`).
+[CONTRIBUTING.md](CONTRIBUTING.md) explains why the licence requires it. To contribute
+machines, submit them to the
+[machine library](https://github.com/thethinkmachine/automata-library), either from
+the app's Library view or through the library's issue form.
+
+## Citation
+
+If you use AutomataStudio in your research, teaching materials or a publication,
+please cite it. GitHub's **"Cite this repository"** button (from
+[CITATION.cff](CITATION.cff)) produces APA and BibTeX, or you can copy these:
+
+```bibtex
+@software{chaubey_automatastudio_2026,
+ author = {Chaubey, Shreyan},
+ title = {{AutomataStudio}: An {IDE} for Designing, Simulating and Analysing Automata},
+ year = {2026},
+ version = {2.9.0},
+ url = {https://github.com/thethinkmachine/AutomataStudio},
+ note = {Software}
+}
+```
+
+> Chaubey, S. (2026). *AutomataStudio: An IDE for designing, simulating and analysing
+> automata* (Version 2.9.0) [Computer software].
+> https://github.com/thethinkmachine/AutomataStudio
+
+Cite the version you actually used, so that others can reproduce your results. If you
+have a paper, course or project that uses AutomataStudio, please open an issue to let
+me know.
## License
-**[PolyForm Noncommercial License 1.0.0](LICENSE)**, with a supplemental grant that
-converts each release to **AGPL-3.0-or-later** four years after it is published.
-Releases published before the license change remain available under CC BY-NC-SA 4.0
-([LICENSE-PRIOR-VERSIONS.txt](LICENSE-PRIOR-VERSIONS.txt)); that grant is irrevocable
-and is not withdrawn by the change.
\ No newline at end of file
+AutomataStudio is released under the
+**[PolyForm Noncommercial License 1.0.0](LICENSE)**. Under a supplemental grant, each
+release converts to **AGPL-3.0-or-later** four years after it is published. Academic
+research, teaching and personal use are noncommercial uses under the licence. See
+[NOTICE](NOTICE) for the required notice.
+
+Releases published before the licence change remain available under CC BY-NC-SA 4.0
+([LICENSE-PRIOR-VERSIONS.txt](LICENSE-PRIOR-VERSIONS.txt)). That grant is irrevocable.
+
+© 2026 Shreyan Chaubey
diff --git a/docs/media/blocks.webp b/docs/media/blocks.webp
new file mode 100644
index 0000000..6cb33f8
Binary files /dev/null and b/docs/media/blocks.webp differ
diff --git a/docs/media/cli.webp b/docs/media/cli.webp
new file mode 100644
index 0000000..8a6e648
Binary files /dev/null and b/docs/media/cli.webp differ
diff --git a/docs/media/grammar.webp b/docs/media/grammar.webp
new file mode 100644
index 0000000..2a86358
Binary files /dev/null and b/docs/media/grammar.webp differ
diff --git a/docs/media/spacetime.webp b/docs/media/spacetime.webp
new file mode 100644
index 0000000..0e4dccd
Binary files /dev/null and b/docs/media/spacetime.webp differ
diff --git a/docs/media/statemate.webp b/docs/media/statemate.webp
new file mode 100644
index 0000000..5bb24dc
Binary files /dev/null and b/docs/media/statemate.webp differ
diff --git a/docs/media/wizard.webp b/docs/media/wizard.webp
new file mode 100644
index 0000000..65240bf
Binary files /dev/null and b/docs/media/wizard.webp differ