model

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model[S any] struct {
	// Key returns a dedup key. Two states with the same key are the same state.
	Key func(S) string
	// Successors returns every enabled action from s. An empty result means s
	// is terminal.
	Successors func(S) []S
	// Quiescent reports whether a terminal state is a legal stopping point.
	// A terminal state that is not quiescent is a deadlock.
	Quiescent func(S) bool
	// CheckTerminal validates one terminal state. Return an error to fail.
	CheckTerminal func(S) error
}

Model describes one state machine to explore. S is the concrete state type, so every call below is a direct call.

type Report

type Report struct {
	Explored  int
	Terminals int
}

Report is what one exploration produced.

func Explore

func Explore[S any](m Model[S], init S) (Report, error)

Explore walks every reachable state once and validates every terminal. It returns on the first terminal that fails, matching the t.Fatalf the hand-written drivers used.

Jump to

Keyboard shortcuts

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