B-Method

1 program Added 2025-11-12T11:49:07Z Model: google/gemini-2.5-proTemp: 0.4 Evidence Report issue View issues
Aliases: AMN, Abstract Machine Notation
Provenance: commit 4bd1956c0a · authored 2025-11-12T12:49:07+01:00 · model google/gemini-2.5-pro

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

B Method (0.80)ASN.1 (0.28)SAM76 (0.28)AsmL (0.26)Caml (0.24)

LLM-contributed programs

Cruise Control System Specification in B

Provenance: commit 4bd1956c0a · authored 2025-11-12T12:49:07+01:00 · model google/gemini-2.5-pro · Temp 0.4
code.mch · license: Eclipse Public License 2.0 · added: 2025-11-12T11:49:07Z
MACHINE Cruise_finite1
/* A simple cruise controller */
SETS
  BUTTONS = {off, on, resume, brake, gas, acc}
CONSTANTS
  max_speed, min_speed
PROPERTIES
  max_speed = 120 & min_speed = 30 & max_speed > min_speed
VARIABLES
  speed, active, mem
INVARIANT
  speed : NATURAL &
  active : BOOL &
  mem : NATURAL &
  (active = TRUE => speed >= min_speed & speed <= max_speed) &
  mem >= min_speed & mem <= max_speed
INITIALISATION
  speed := 0 || active := FALSE || mem := min_speed
OPERATIONS
  press(button) = PRE button : BUTTONS THEN
    CHOICE
      button = off THEN active := FALSE
    OR
      button = on & active = FALSE & speed >= min_speed & speed <= max_speed THEN
        active := TRUE || mem := speed
    OR
      button = resume & active = FALSE & mem >= min_speed & mem <= max_speed THEN
        active := TRUE || speed := mem
    OR
      button = brake THEN
        active := FALSE
    OR
      button = gas & active = TRUE & speed < max_speed THEN
        speed := speed + 1
    OR
      button = acc & active = TRUE & speed < max_speed THEN
        speed := speed + 1 || mem := speed
    OR
      button : {on, resume, gas, acc} & /* no change of state */
      skip
    END
  END;

  time_step(s_change) = PRE s_change : -1..1 THEN
     IF active = FALSE & speed > 0 & s_change < 1 THEN
        speed := speed - 1
     ELSIF active = TRUE & speed+s_change >= min_speed & speed+s_change <= max_speed THEN
        speed := speed + s_change
     END
  END
END

Contribute — propose a file extension

Tell us where to find evidence about B-Method (mapped to pl/b_method). 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/B-Method/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← b-line B-Prolog →