Giter VIP home page Giter VIP logo

tla-bin's Introduction

tla-bin

tla-bin is a wrapper around https://github.com/tlaplus/tlaplus that provides command line binaries for pcal, tlc, tlatex and sany, making automation around TLA+ easy. Also provides a binary that starts the TLA+ REPL.

Installation

$ git clone https://github.com/pmer/tla-bin.git
$ cd tla-bin
$ ./download_or_update_tla.sh
$ sudo ./install.sh

The download_or_update_tla.sh script takes an optional --nightly argument. If passed, it will download the nightly CI build of TLA+ rather than the latest release.

The install.sh script takes an optional location argument. By default, binaries and the tla jar file are installed below /usr/local.

Usage

pcal, the PlusCal โ†’ TLA+ translator

$ pcal Euclid.tla
pcal.trans Version 1.11 of 31 December 2020
Labels added.
Parsing completed.
Translation completed.
New file Euclid.tla written.
New file Euclid.cfg written.

tlc, the TLA+ model checker

$ tlc Euclid.tla
TLC2 Version 2.16 of 31 December 2020 (rev: cdddf55)
Running breadth-first search Model-Checking with fp 70 and seed -2731419115466680819 with 1 worker on 2 cores with 444MB heap and 64MB offheap memory [pid: 1039] (Linux 4.19.0-18-amd64 amd64, Debian 11.0.12 x86_64, MSBDiskFPSet, DiskStateQueue).
Parsing file /home/pdm/tla-bin/tla/MC.tla
Parsing file /home/pdm/tla-bin/tla/Euclid.tla
Labels added.
Parsing file /tmp/TLC.tla
Parsing file /tmp/Integers.tla
Parsing file /home/pdm/tla-bin/GCD.tla
Parsing file /tmp/Naturals.tla
Parsing file /tmp/Sequences.tla
Parsing file /tmp/FiniteSets.tla
Semantic processing of module Naturals
Semantic processing of module Integers
Semantic processing of module PaulGCD
Semantic processing of module Sequences
Semantic processing of module FiniteSets
Semantic processing of module TLC
Semantic processing of module PaulEuclid
Semantic processing of module MC
Starting... (2021-11-28 16:13:57)
Computing initial states...
Finished computing initial states: 1 distinct state generated at 2021-11-28 16:13:57.
Model checking completed. No error has been found.
  Estimates of the probability that TLC did not check all reachable states
  because two distinct states had the same fingerprint:
  calculated (optimistic):  val = 2.7E-19
6 states generated, 5 distinct states found, 0 states left on queue.
The depth of the complete state graph search is 5.
The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1).
Finished in 01s at (2021-11-28 16:13:57)

sany, the TLA+ static analyzer

$ sany Euclid.tla

****** SANY2 Version 2.1 created 24 February 2014

Parsing file /home/pdm/tla-bin/Euclid.tla
Labels added.
Parsing file /tmp/Integers.tla
Parsing file /home/pdm/tla-bin/GCD.tla
Parsing file /tmp/TLC.tla
Parsing file /tmp/Naturals.tla
Parsing file /tmp/Sequences.tla
Parsing file /tmp/FiniteSets.tla
Semantic processing of module Naturals
Semantic processing of module Integers
Semantic processing of module GCD
Semantic processing of module Sequences
Semantic processing of module FiniteSets
Semantic processing of module TLC
Semantic processing of module Euclid

tlatex, the TLA+ pretty printer

$ tlatex Euclid.tla
tla2tex.TLA Version 1.0 created  12 Apr 2013
looking for file: Euclid
looking for file: Euclid.log
looking for file: Euclid
TLATeX dvi output written on Euclid.dvi.
Total execution time: 0.38 seconds

tlarepl, the TLA+ REPL

(Requires TLA+ version 1.8.0 or higher, which as of November 2021 is only found in nightly builds.)

$ tlarepl
Welcome to the TLA+ REPL!
TLC2 Version 2.16 of Day Month 20??
Enter a constant-level TLA+ expression.
(tla+)

tla-bin's People

Contributors

ajdavis avatar danielmai avatar fpotargent avatar heidihoward avatar owickstrom avatar pmer avatar shammellee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tla-bin's Issues

Unable to run tlc

Hi,
I am trying to run the model checker from command line. It gives error on the cfg file. Can you please help with this?

Best

* Add statements after this line.
* CONSTANT definitions
CONSTANT
F <- 1
* CONSTANT definitions
CONSTANT
N <- 4
* CONSTANT definitions
CONSTANT
INPUT <- <<1,1,1,1>>
* CONSTANT definitions
CONSTANT
MAXROUND <- 10
* SPECIFICATION definition
SPECIFICATION
Spec
* INVARIANT definition
INVARIANT
Agreement
* PROPERTY definition
PROPERTY
BaitProgress
PROPERTY
MinorityReport
PROPERTY
Progress

tlatex error

When running tlatex example.tla, got

Exception in thread "main" tla2tex.TLA2TexException: TLATeX unrecoverable error: -- Trying to run the command `latex example.tex' produced the following error
    Cannot run program "latex": error=2, No such file or directory.
	at tla2tex.Debug.ReportError(Debug.java:26)
	at tla2tex.ExecuteCommand.executeCommand(ExecuteCommand.java:34)
	at tla2tex.LaTeXOutput.RunLaTeX(LaTeXOutput.java:483)
	at tla2tex.TLA.runTranslation(TLA.java:246)
	at tla2tex.TLA.main(TLA.java:150)
` ``

sany: return non-zero exit code if there are errors

I've noticed that the sany script always returns 0 error code even if there are e.g. parse errors in the input file. E.g. I would like it to return a non-zero code to use it in the test suite of a transpiler targeting TLA+ I'm working on. By the way, thank you for tla-bin!

Exception when running TLC

Hey, working on some tooling/automation for my TLA+ workflow!

Super grateful for finding this repo. You might chalk this up to my ignorance with Java but when I run the TLC binary I get this error (traceback elided):

TLC2 Version 2.13 of 18 July 2018
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSource
	at tlc2.TLC.main(TLC.java:210)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)

Suggestion: Add TraceExplorer command

Based on the "Trace Exploration through Command Line" function, adding a Trace Explorer command might be pretty handy.

Having read @will62794's tlaplus_animation repo, especially aliases.sh and get_tlatools.sh, one would add a new trace command to tla-bin/bin by:

  • Copying tla-bin/bin/tlc to a tla-bin/bin/trace file;
  • Changing line 9 of this trace file from ...tla2tools.jar tlc2.TLC to ...tla2tools.jar:tla2tools.jar:CommunityModules-202112291842.jar tlc2.TraceExplorer (or to wherever the latest Community Modules jar file can be downloaded from).

It would require an updated Community Modules jar file, so it'd be necessary to add that to tla-bin/download_or_update_tla.sh.

Maybe I am missing a step? Maybe trace is not necessary, given an alternative command?

Thanks

pcal command fails if no pcal code found

SUMMARY
tlc depends on pcal successfully running and generating the .cfg file. However, if the input file is just tla+ and does not contain the pluscal comment block, pcal fails.

EXPECTED
I'd expect pcal to succeed and generate the .cfg file even if no pluscal code is found.

REPRO

git clone https://github.com/tlaplus/Examples.git examples
cd examples/specifications/N-Queens
pcal Queens

ERROR A

ls
QueensPluscal.tla  QueensPluscal.toolbox  Queens.tla  Queens.toolbox  README  states

pcal Queens
pcal.trans Version 1.9 of 10 July 2019

Unrecoverable error:
 -- Beginning of algorithm string --algorithm not found..

This seems ok, except that I'd like to run tlc on this, too:

ERROR B

tlc Queens

TLC2 Version 2.14 of 10 July 2019 (rev: 0cae24f)
Running breadth-first search Model-Checking with fp 36 and seed 408714217296578281 with 1 worker on 8 cores with 7134MB heap and 64MB offheap memory [pid: 19015] (Linux 4.15.0-96-generic amd64, Ubuntu 11.0.6 x86_64, MSBDiskFPSet, DiskStateQueue).
Error: TLC threw an unexpected exception.
This was probably caused by an error in the spec or model.
See the User Output or TLC Console for clues to what happened.
The exception was a tlc2.tool.ConfigFileException
: TLC encountered the following error when trying to read the configuration file Queens.cfg:
File not found.
Finished in 00s at (2020-04-16 13:56:29)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.