GAP Playground

Run GAP, Prover9, Mace4, and Lean 4 proofs in isolated cloud runners.

How to use this playground

Type code on the left and press Run (or ⌘/Ctrl + Enter). Your code runs in an isolated runner, and results appear on the right, usually within a minute.

⚡ Batch Execution Model: Each run executes the complete script in your editor from top to bottom in a clean, isolated cloud sandbox. All variables, functions, and theorems defined within your editor work together seamlessly. Because each run starts fresh, there is no lingering or hidden state from previous runs—so results do not depend on earlier runs (randomised searches and time limits can still change an outcome).

GAP: Like the GAP prompt, a statement ending in ; shows its value, while ;; hides it. Print(…) works too. Load packages with LoadPackage("semigroups");. Runs stop after 120 seconds. Choose LaTeX above the output to typeset GAP results automatically, plus any maths between $…$ or $$…$$.

Prover9 and Mace4: pick the tool next to the editor title. Both read the same input language (formulas(assumptions). … end_of_list., then formulas(goals). … end_of_list.). Prover9 searches for a proof; Mace4 searches for a finite model or counterexample (use assign(domain_size, 6). to fix the size).

Lean 4 + Mathlib 4: pick Lean 4 next to the editor title. Import modules like import Mathlib.Algebra.Group.Basic or import Mathlib.Tactic. Use tactics such as linarith, ring, rw, and induction, or run evaluations with #eval and #check.

Connection & Privacy settings

Use a fine-grained token limited to the target repository with Contents: read & write (dispatches runs) and Actions: read (downloads outputs).

📘 Step-by-Step for Mathematicians: How to get your own token in 1 minute

Why a token? Computations run on GitHub's cloud runners. GitHub uses tokens to verify authorization so you can execute code safely.

Option A — Shared / Department Repo
If invited as a collaborator on a shared runner repository, accept the email invitation, create a token selecting that repository, and enter its owner/name above. Collaborators with write access can change the repository and run code on its runners, so only share with people you trust and keep repository secrets empty.
Option B — Your Own GitHub Account
Fork the runner repository to your personal account, create a token selecting your fork, and enter your-username/repo-name above.
✨
Public vs. Private Repositories: If your repository is public, GitHub currently does not charge minutes for standard GitHub-hosted Linux runners, while private repositories count against your monthly allotment. GitHub's terms also limit what Actions may be used for, so read the current Actions terms before using this beyond personal use.
Generating your token in 6 easy steps:
  1. Sign in to GitHub and open the Fine-grained tokens page.
  2. Click Generate new token. Set a token name (e.g. Math Playground) and an expiration date.
  3. Under Repository access, select Only select repositories and pick your target repository.
  4. Under Permissions → Repository permissions, set:
    • Contents: Access: Read and write (sends computation requests)
    • Actions: Access: Read-only (downloads run results)
  5. Click Generate token at the bottom. Copy the token (starts with github_pat_...).
  6. Paste the repository name above and your token, then click Save settings.
🔒
How your token is handled: this page keeps it in your browser's local storage (localStorage) and sends it only to GitHub's HTTPS API. It does not send it to any other server or database.

GAP code

Output

Ready. Press Run or ⌘/Ctrl + Enter.
Output appears here.