TLA+
1 program
Added 2025-10-23T10:11:33Z
Model: google/gemini-2.5-proTemp: 0.4
Evidence
Report issue
View issues
Aliases: Temporal Logic of Actions
Provenance: commit 608e29d3dc · authored 2025-10-23T12:11:33+02:00 · model google/gemini-2.5-pro
Sources mentioning this language
3 sources · pl_id:
pl/tla-2Wikipedia infobox ↗
Pulled from the
wikimedia/structured-wikipedia
snapshot — see data/raw/wikipedia_pl_facts.*.jsonl and
pl_fact.csv for the long-table provenance.
| Paradigms | action |
|---|---|
| Designed by | Hewlett-Packard · Microsoft · Leslie Lamport |
| First appeared | 2010 |
| License | MIT License |
| Implemented in | Java |
| Homepage | http://research.microsoft.com/en-us/um/people/lamport/tla/toolbox.html |
Related languages
Real programs from Software Heritage
No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)
Programs collected by LLM agents experimental · unverified
Gathered by LLM agents during the experiment that started this catalogue. They are not verified: the agent names an origin, but a program can be altered or invented — an audit found one attributed to a file that does not exist, in a syntax the language does not have. Prefer the programs archived by Software Heritage above. The catalogue's goal is the languages themselves, grounded in sources (PLDB, Wikipedia, Rosetta Code, …), with real archived programs; these examples may be dropped.
Die Hard Jug Problem Specification in TLA+
Provenance: commit 608e29d3dc · authored 2025-10-23T12:11:33+02:00 · model google/gemini-2.5-pro · Temp 0.4
----------------------------- MODULE DieHard -----------------------------
EXTENDS Integers
(*
--algorithm DieHard
variables big = 5, small = 0 ;
begin
while big # 4 do
either
big := 8 ;
or
small := 0 ;
or
small := 3 ;
or
with transfer = min(big, 3 - small) do
big := big - transfer ;
small := small + transfer ;
end with;
or
with transfer = min(small, 8 - big) do
small := small - transfer ;
big := big + transfer ;
end with;
end either;
end while;
assert big = 4;
end algorithm;
*)
\* This is the translation of the PlusCal algorithm.
\* You can see it by going to the "File" menu and choosing
\* "Translate PlusCal Algorithm". However, you will see that
\* the translation of the "with" statement is rather complicated.
\* This is because the translator has to handle the general case.
\* It is much simpler to write the TLA+ spec directly. Here is
\* a simpler version of the spec.
VARIABLES big, small
JugCapacity == 3..8 \* A hack to make TLC run faster.
TypeOK == /\ big \in 0..8
/\ small \in 0..3
Init == /\ big = 0
/\ small = 0
FillBig == /\ big' = 8
/\ small' = small
FillSmall == /\ small' = 3
/\ big' = big
EmptyBig == /\ big' = 0
/\ small' = small
EmptySmall == /\ small' = 0
/\ big' = big
SmallToBig == /\ LET transfer == min(small, 8 - big)
IN /\ big' = big + transfer
/\ small' = small - transfer
BigToSmall == /\ LET transfer == min(big, 3 - small)
IN /\ big' = big - transfer
/\ small' = small + transfer
Next == \/ FillBig
\/ FillSmall
\/ EmptyBig
\/ EmptySmall
\/ SmallToBig
\/ BigToSmall
Spec == Init /\ [][Next]_<<big, small>>
FourGallonsInBig == big = 4
=============================================================================