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-2
LLM (this repo) · 1WikipediaWikidata · Q28955120

Wikipedia infobox

Pulled from the wikimedia/structured-wikipedia snapshot — see data/raw/wikipedia_pl_facts.*.jsonl and pl_fact.csv for the long-table provenance.

Paradigmsaction
Designed byHewlett-Packard · Microsoft · Leslie Lamport
First appeared2010
LicenseMIT License
Implemented inJava
Homepagehttp://research.microsoft.com/en-us/um/people/lamport/tla/toolbox.html

Related languages

LCF (0.19)ALF (0.19)LOTOS (0.19)ActionScript (0.17)N3 (0.16)

LLM-contributed programs

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
code.tla · license: CC-BY-4.0 · added: 2025-10-23T10:11:33Z
----------------------------- 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

=============================================================================

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.)

Contribute — propose a file extension

Tell us where to find evidence about TLA+ (mapped to pl/tla-2). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/TLA+/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← tla tlc →