verification

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package verification runs the TLA+ models of a repository with a pinned TLC, as Formal models in the contract defines (COR-104-T8). The repository owns its models, their mapping to its code, and their expected outcomes. This package owns the tool and the record.

Its rules:

  • The jar holds the SHA-256 that the suite pins before Java starts, from the URL or from a local jar. On 2026-11-02, the pinned URL of TLC v1.8.0 served other bytes. Changed bytes never prove a model
  • A run writes the record only when each check gives its expected outcome, and no input changed during the run
  • CheckRecord reads only the suite, the inputs, and the record. So just check needs no Java and no network
  • The caller gives the whole environment of Java, which extensionrepo.NewOwnedRun builds. The analyzer callerenv refuses os.Environ in this package

Index

Constants

View Source
const (
	SuiteFile  = "verification/tlc.json"
	RecordFile = "verification/tlc-record.json"
)

SuiteFile and RecordFile are the suite and the record of a repository, from its root.

Variables

This section is empty.

Functions

func CheckRecord

func CheckRecord(root string) []string

CheckRecord reports each problem of the record of root, which just check runs. It reads only the suite, its inputs, and the record, and starts no program. A repository without a suite has no problem.

Types

type Check

type Check struct {
	Name      string `json:"name"`
	Model     string `json:"model"`
	Config    string `json:"config"`
	Violation string `json:"violation,omitempty"`
}

Check is one model and one configuration, from the root. Violation names the invariant that TLC must find violated, or is empty when TLC must explore every state with no error.

type Options

type Options struct {
	// Root is the absolute root of the repository.
	Root string
	// Dir is the absolute folder of the run. It keeps the jar, the log of
	// each program, and the states of TLC.
	Dir string
	// Jar is a local jar to use in place of the URL, or empty.
	Jar string
	// Env is the whole environment of each program of the run.
	Env []string
}

Options are the folders and the environment of one run.

type Record

type Record struct {
	Version int               `json:"version"`
	Java    string            `json:"java"`
	SHA256  string            `json:"tlc_sha256"`
	Inputs  map[string]string `json:"inputs"`
	Results []Result          `json:"results"`
}

Record is the outcome of each check of the suite, with the pins and the SHA-256 of each input. just check reads it.

type Result

type Result struct {
	Name      string `json:"name"`
	Exit      int    `json:"exit"`
	Violation string `json:"violation,omitempty"`
	Distinct  int    `json:"distinct,omitempty"`
	Depth     int    `json:"depth,omitempty"`
}

Result is the outcome of one check. A complete exploration gives the distinct states and the depth of the graph, which no rerun changes. A violation gives only its invariant, because TLC can stop at another state.

func Run

func Run(o Options) ([]Result, error)

Run checks each model of the suite of the repository, then writes the record. It returns the results, or an error and no record.

type Suite

type Suite struct {
	Java   string  `json:"java"`
	URL    string  `json:"tlc_url"`
	SHA256 string  `json:"tlc_sha256"`
	Checks []Check `json:"checks"`
}

Suite pins Java and TLC, and lists the checks of a repository. Java is the tool of mise, such as java@temurin-21.0.13+9.0.LTS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL