Try it
Enter a starting braid and moves in JSON, or choose an example.
Move Names and Arguments
Use short or long names in JSON strings, including arguments such as "c 2" or "i -1". JSON objects also work: {"move": "c", "shift": 2}. Moves act on the beginning of the braid unless stated otherwise.
| JSON move | Long name | Action |
|---|---|---|
"c" or "c 2" | conj | Rotate left; the default shift is one crossing. |
"x" | prefix_cancel | Remove the cancelling first pair. |
"i -1" | prefix_uncancel | Insert the pair [-1,1] at the beginning. |
"s" | stabilize | Add a strand and a positive crossing at the beginning. |
"t" | inverse_stabilize | Add a strand and a negative crossing at the beginning. |
"d" | destabilize | Remove the last strand's unique crossing, wherever it occurs. |
"r" | r3_right | Apply right R3 to the first three crossings. |
"l" | r3_left | Apply left R3 to the first three crossings. |
"m" | commute | Swap the first two crossings if their indices differ by more than one. |
start_strands sets the initial strand count; otherwise it is inferred from start_braid. Strand counts are preserved through cancellation. Optional end_strands, result_braid, and result_strands assertions are checked during replay. Both knots and links are supported.
Certificate checker
Enter a starting braid, moves, and ending braid in JSON.
API
Send a JSON object with Content-Type: application/json. Both endpoints accept the move strings and objects listed above.
Replay
POST /api/braid-certificate/replay requires start_braid and moves. Endpoint assertions are optional.
curl -X POST 'http://topology.fyi/api/braid-certificate/replay' \
-H 'Content-Type: application/json' \
-d '{"start_braid":[1,2,1],"moves":["r"]}'
{"end_braid":[2,1,2],"end_strands":3}
Add ?output=steps to include a steps array of {"step":0,"braid":[1,2,1],"strands":3} objects, starting with the initial state. The API default is output=final, which returns only the ending braid and strand count. The Try it form always requests output=steps.
Check a certificate
POST /api/braid-certificate/ also requires end_braid; end_strands is optional.
Each move object may supply result_braid and result_strands. Every supplied intermediate state must match the computed state, even when the ending braid is correct. A mismatch returns result_braid_mismatch or result_strands_mismatch at that move's step.
curl -X POST 'http://topology.fyi/api/braid-certificate/' \
-H 'Content-Type: application/json' \
-d '{"start_braid":[1,2,1],"moves":["r"],"end_braid":[2,1,2]}'
{"valid":true}
An invalid move returns its one-based step number and a stable error code and reason:
{"valid":false,"step":1,"phase":"move","code":"missing_cancelling_prefix","reason":"Expected cancelling prefix [g,-g]"}
Endpoint mismatches use phase: "end" and the number of moves (zero for an empty move list). A starting-state failure during replay uses phase: "start" and step zero. Malformed input or missing required fields returns {"valid":false,"error":"syntax error"}.
Checker decisions, including invalid moves or mismatched endpoints, return HTTP 200. Syntax errors and exceeded input limits return HTTP 400. Replay failures return HTTP 400 with either a syntax error or code, reason, and step (null for an error outside a move). Limits: 32,000 characters, 500 moves, and 2,000 starting crossings.
Move failure codes and messages are defined by the F# FailureCode type and errorInfo function in KnotSharp/BraidCertificate.fs. The Python service uses a generated copy of that catalogue.