Back to Trending
RepositoryJavaScriptPTPortugal
AF

afonsonf/tlaplus-graph-explorer

A static web application to explore and animate a TLA+ state graph.

200stars
2forks
0issues
0views

TLA+ Graph Explorer

This is a static web application to explore and visualize a TLA+ state graph or a TLA+ trace.

The application works by parsing a dot file generated by a TLA+ specification and then having visual representations to more easily understand and go through the reachable states.

The application is written to support big dot files and not load the whole file into memory. This is achieved by reading the file in chunks and storing only the location of the node in the file. The structure to save the nodes location, in my experiments, takes around 1/10th of the dot file size.

Examples

For more examples: examples.

Example 1 - Default Configuration

Spec: https://github.com/tlaplus/Examples/tree/master/specifications/MissionariesAndCannibals.

Example 2 - Personalized state

Spec: https://github.com/afonsonf/ceph-consensus-spec.

Usage

Overview

The application is in the folder src. To run it, open the index.html file in a browser (tested in Chrome and Firefox).

The default way to represent a state is showing the pretty printed version, as shown previously in example 1.

The representation of a state can be personalized by changing the function drawState in the file tla-state.js. An example of a personalized state representation is shown in the example 2 and the source code is in examples/ceph-consensus. There are other examples in the folder examples.

To help create a personalized representation of a state, the application comes with a parser that parses a tla+ state into JavaScript structures. The parser definition is in folder expr-parser and example usage of the parser (function parseVars) can be found in the examples.

Obtain a dot file for state exploration

Using cli:

export TLA_PATH=path/to/tla
alias tlc="java -cp $TLA_PATH/tla2tools.jar tlc2.TLC"

tlc -dump dot spec.dot spec.tla
# Open the .dot file in the application in graph explorer mode (index.html)

Using the toolbox:

  • Create a model
  • Enable graph feature at:
    • Model Overview > Additional TLC Options > Features > Visualize state graph
  • Run the model
  • Open the folder of the spec in your file explorer
    • There should be a .toolbox folder with a folder for each model run
  • Open the .dot file in the application in graph explorer mode (index.html)

Obtain a trace output for trace exploration

Using the cli:

export TLA_PATH=path/to/tla
alias tlc="java -cp $TLA_PATH/tla2tools.jar tlc2.TLC"

tlc -tool spec.tla > spec.out
# Open the .out file in the application in trace mode (trace-explorer.html) 

Using the toolbox:

  • Create and run a model
  • Open the folder of the spec in your file explorer
    • There should be a .toolbox folder with a folder for each model run
  • Open the .out file in the application in trace explorer mode (trace-explorer.html)

The ideas behind this tool were inspired by TLA+ Animation Module and Runway.

Similar Projects

Discover other similar projects and AI models.

RepositoryJavaScript
react/react

The library for web and native user interfaces.

253.0k
Nov 30, 2026
RepositoryJavaScript
trekhleb/javascript-algorithms

📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings

196.8k
Jul 26, 2026
RepositoryTypeScript
morluto/rea

Reverse engineer anything with agents, from app behavior down to native binaries.

488.2k
Dec 3, 2026
RepositoryTypeScript
freeCodeCamp/freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.

459.9k
Dec 2, 2026
RepositoryPython
practical-tutorials/project-based-learning

Curated list of project-based tutorials

290.9k
Nov 30, 2026
RepositoryTypeScript
vuejs/vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core

212.6k
Oct 10, 2024
Repository
getify/You-Dont-Know-JS

A book series (2 published editions) on the JS language.

184.8k
Oct 31, 2026
RepositoryJavaScript
twbs/bootstrap

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

175.1k
Dec 1, 2026
RepositoryJavaScript
airbnb/javascript

JavaScript Style Guide

148.0k
Apr 16, 2026