question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TLA+ Toolbox should have a REPL

See original GitHub issue

From my own experiences with Alloy, a REPL is really nice. It makes learning the language easier, as you don’t have to add anything to your core spec to explore. It makes it possible to query information about a given trace to learn more about it. Andrew Helwer cites a REPL as a key advantage of Runway.

This has been discussed before. Here were some alternatives raised:

  • Using “Evaluate Constant Expression”: This only works on the initial state of a behavior. It takes time to run. It does not (easily) allow defining new operators without using let, which is awkward. No history of expressions.
  • Using multiple ASSUME: Limitations covered by Chris Newcombe here.
  • Using Error Traces: Evaluated at every step of the trace, cluttery, specifically only for debugging while specs fail.

Lamport asked for specific scenarios for where a REPL would be useful. Here are some I’ve run into:

  • I’m not sure a particular part of the language works. Can I do CHOOSE x \in A, b \in Y? With a REPL, I can test that quickly and see it does not work.
  • I’m not sure what a particular logical expression does. Is \E foo \in F: \A bar \in B what I want? With a REPL, I can try a few different logical expressions and see what I want.
  • A spec is failing and I don’t understand why. I could use Error Traces, but I don’t know what I’m looking for yet. I want be able to take the state one step before the error and try several different expressions to see if I can figure out what it is I don’t know.
  • I want to use some debugging operators that shouldn’t be part of the spec.

I think all of these could be resolved with a REPL that would allow the following:

  1. Load at the initial state of a spec, or a given state of a failing behavior
  2. Definition of new operators and actions
  3. Evaluation of arbitrary expressions, including with the new operators and actions
  4. Fast (May be untenable if requires heavy TLC refactors)

To make this simpler, the REPL should not be able to change the trace. If x = 1 and x' = 2, x' = 3 would be FALSE. This means that you cannot use the REPL to test a change to a spec. You can only use it to explore information about an existing spec.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:34 (34 by maintainers)

github_iconTop GitHub Comments

5reactions
will62794commented, Jan 15, 2018

I was aware of this Github issue before I created my Python based REPL. I figured that my tool would contain a subset of the functionality that would eventually be desired in a full-fledged TLA+ REPL (one that had more explicit support from TLC and closer integration with the Toolbox). I wanted something to use before this Github issue was completed, so I worked around the existing limitations of TLC. I imagine my tool could serve as a reasonable testing ground for ideas/features that we might want to add in to a full REPL. It could also let people play around with it and see if they find such a tool useful, even if it is a bit primitive.

0reactions
lemmycommented, Nov 19, 2020

The REPL could be optimized by writing a dedicated SpecProcessor that does not eagerly evaluate expressions. The current implementation of the REPL evaluates the expressions twice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Current and Future Tools for Interactive TLA+
The REPL is a prototype. It doesn't have syntax highlighting. We hear that it can extend and instantiate user-written modules, but it's not ......
Read more >
TLA+ REPL
Hello,. For anyone who might be interested, I created a simple version of a TLA+ REPL using Python and the TLC model checker,...
Read more >
The TLA Toolbox - Leslie Lamport
The TLA Toolbox is an IDE (integrated development environment) for the TLA+ tools. You can use it to: Create and edit your specs,...
Read more >
Re: [tlaplus] Some user feedback - Mail Thread Index
Why do I have to do > some Java-specific stuff to use it; shouldn't their Java ... TLA+ needs to put the command-line...
Read more >
TLA+ REPL - Load custom modules - Asciinema
tla tlc2 markus@avocado:~/src/TLA/_specs/CommunityModules/modules(master)$ alias tlcrepl='java -cp /opt/toolbox/tla2tools.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found