Package: tlacli
tlacli: A CLI tool for TLA+DISCLAIMER:This is not an official TLA+ tool and isn't a prototype for one. I'm not making any guarantees of backwards compatibility or non-breaking changes or whatever. It's just a script I find useful.tlacliis a tool for running the TLC model checker from the command line. You can already run TLC from the command line, anyway, usingtlc2.TLC, andtlaclionly provides a subset of the functionality. It still has a few UX improvements, though:Nicer flag UX. Arguments follow the conventional "flag" format. You can spot-check a spec with justtlacli check specfile.tla.Saner defaults. It automatically usesSpecas your temporal formula, defaults to using a worker per CPU core, gives terse output, etc.You don't have to write a config file. You can define invariants, properties, and constants as command-line flags andtlacliwill automatically build the proper config file for that run. You can also save the configuration as a template for future runs. You can also usebotha config file and flags, where the config is a template and the flags are specializations.SetupYou need Java and Python 3.7. There's no package yet; in the meantime, clone it and runpip install -e .This will be updated as I learn more about making python packages.Therequirements.txtis only needed for testing.Translating PlusCaltlacli translate specfile.tlaNOTE:By default this includes the-nocfgflag, which prevents the tool from overwritting your copy ofspecfile.cfg. Right now no other flags are supported. If you need flags, you can put them directly in the module file. See page 67 of thePlusCal manual.Model Checkingtlacli check specfile.tlaBy default, this runsspecfile.tlawith the specificationSpec. You can change the run specification with the--specflag. By default, this runs TLC with the-terseand-cleanupflags. The config file will be saved astemporary.cfg. You can change the filename with--cfg-out {name}.NOTE:Running currently creates an emptystatesdirectory.BUG:Currently you cannot pass in an absolute path for the specfile, at least on windows. You can pass in a relative path. Seethistlatools issue. This is not an issue for pluscal translation.PropertiesYou can specify invariants and properties from the command line. Use the--invariant {inv}flag and the--property {prop}flag, respectively. Both accept multiple operators.NOTE:If--invariantor--propertyare thelastflags passed in, the script will assume your specfile is an invariant! You can prevent this by adding a--.tlacli check --invariant Inv1 Inv2 -- specfile.tlaYou can also use--invand--prop, but this may change in the future.ConstantsYou can assign constants with--constant {name} {value}. Each constant must be a separate flag. You can put in sets, tuples, etc by putting{value}in quotes. Use single quotes if you want to put in strings.tlacli check --constant Max 4 --constant Threads '{1, 2}' specfile.tla
tlacli check --constant Colors '{\"red\", \"green\"}' specfile.tlaModel ValuesIf you need several model values, you can specify them all in a single--model-values {m1} {m2} ...flag.tlacli check --model_values A B C Null Server -- specfile.tlaSets of Model ValuesUse an ordinary assignment. You don't need a--model-valuesflag first.# Wrong
tlacli check --model-values m1 m2 m3 --constant ModelSet "{m1, m2, m3}" specfile.tla


# Right
tlacli check --constant ModelSet "{m1, m2, m3}" specfile.tlaSymmetry sets are not yet supported.Configuration TemplatesYou can specify a template configuration with--cfg template.cfg:tlacli check --cfg foo.cfg specfile.tlatlaclican only read things that are also expressible as flags. Currently, this means invariants, properties, specification, and (most) constants. Everything else is ignored. It's a simple text parser and may miss things formated in an unexpected way. The one guarantee: If you write a file a config with--cfg-outand later read it with--cfg, the whole config will be read properly.A template can be used in conjunction with the other flags. Currently this adds the additional flags on top of the template. The plan is that if the flags and the template conflict, the flags take priority. This will let us specialize a template.ContributingEh make a PR or somethingTestingUsepytest. This is currently broken because I need to add fixturesTODOFeaturesTranslating PlusCal (halfway done)Implement and document all the TLC options here:https://lamport.azurewebsites.net/tla/tlc-options.htmlTLC option passthroughSymmetry model setsMore post-run cleanupMaybe use fewer workers per run by defaultAdvanced config options:VIEW (chaos reigns)Operator Overrides / Constant OperatorsCONSTRAINT and ACTION-CONSTRAINTSYMMETRYExplanations on what you can and can't assign in a config file (anything that doesn't requireEXTENDS, I think)Writing on landmines and stuffActually get the package on PyPIInternalStore config if you have alotof flags you need to pass. Would be overridden by actual flags--show-cfgand--show-scriptfor debugging purposesGet rid of the horriblepkg_resourceskludge for accessing thejarOut of ScopeINIT-NEXT configTLAPS and tla2texToolbox-only features like profiling, running in the cloud, trace explorer, "evaluate constant expression"