ワンクリックで
Create a new Spin/Promela formal verification model for a system property
npx skills add https://github.com/AI-native-Systems-Research/ai-native-storage-certus --skill tools-spin-modelこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストール
Create a new Spin/Promela formal verification model for a system property
npx skills add https://github.com/AI-native-Systems-Research/ai-native-storage-certus --skill tools-spin-modelこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストール
Add Coq 8.20 as an additional prover to an existing Creusot installation, for verification conditions that SMT solvers cannot discharge
Install the Creusot Rust verification tool
Synchronize Spin/Promela models with current source code and re-verify
Prepare an existing Cargo project to use Creusot formal verification
Measure system performance of this platform using
Create a new version of a component
| name | tools-spin-model |
| description | Create a new Spin/Promela formal verification model for a system property |
| argument-hint | [property-number or description of property to prove] |
Create a new Spin/Promela specification in modelling/spin/<name>/ to verify a concurrency property of the Certus system.
If no argument is provided, first ask the user to define the scope, then present the property menu.
Ask the user to choose the modeling scope:
The scope determines:
src/; whole system = multiple crates + apps/certus-server/)proctype per component role)Present the full property menu and ask the user to choose. The user may also describe a custom property.
System-level properties (scope: whole system recommended):
Component-level properties (scope: single component recommended):
If the user provides a number (1-11), use that property. If they provide free text, treat it as a custom property description and ask for a short kebab-case name for the subdirectory.
Determine the property and directory name.
Map selections to directory names:
ref-count-balancewrite-before-evictpromotion-atomicitypopulate-lookup-linearizabilityshutdown-orderingno-lost-extentspipeline-ring-safetystarvation-freedomeviction-fairnessactor-mailbox-orderingextent-bitmap-consistencyRead the relevant source code to understand the real synchronization protocol.
Key source files by property and scope:
Whole-system scope (read certus-server wiring + component internals):
components/dispatcher/src/lib.rs (populate, lookup, evict_for_space, batch_lookup)components/dispatcher/src/lib.rs + components/dispatcher/src/background.rscomponents/dispatcher/src/lib.rs (batch_lookup cold-path promotion, lines ~1045-1215)components/dispatcher/src/lib.rs (shutdown), components/dispatcher/src/background.rs (BackgroundWriter::shutdown), apps/certus-server/src/main.rs (shutdown sequence)components/dispatcher/src/lib.rs (prepare_store, commit_store, cancel_store, process_write_job)Single-component scope (read only the target component):
components/dispatcher/src/pipeline.rs (PipelineRing, pipelined_ssd_to_gpu_zero_copy)components/dispatcher/src/background.rs (channel + worker_loop)components/dispatcher/src/lib.rs (evict_for_space, mt.evict_lru, mt.oldest_keys)components/block-device-spdk-nvme/src/ (actor thread, command channel, completion channel)components/extent-manager/src/ (bitmap allocation, reserve_extent, publish, remove_extent)Also reference the existing model at modelling/spin/write-before-evict/write_before_evict.pml for style and conventions.
Create the subdirectory modelling/spin/<name>/.
Write the Promela specification modelling/spin/<name>/<name_underscored>.pml.
Follow these conventions (from the existing write-before-evict model):
#define parameters section (N_CLIENTS, N_KEYS, etc.) tuned small for tractable state spacemtype enums and arraysproctype for each thread role in the systeminline helpers for shared logic (like eviction)assert() statements for safety propertiesinit process that starts all proctypes, waits for completion, signals shutdown, runs final invariant checksatomic{} for operations that share a mutex in the real coded_step{} for deterministic sequences (scans)chan (even if real code uses unbounded)Scope-specific conventions:
For single component models:
if :: success :: failure fi)For whole system models:
proctype per major thread role across componentsWrite the Makefile modelling/spin/<name>/Makefile:
MODEL = <name_underscored>.pml
PAN = pan
CC = cc
CFLAGS = -O2
DEPTH = 200000
.PHONY: all safety liveness clean
all: safety
safety: $(PAN)
./$(PAN) -m$(DEPTH)
liveness: $(PAN)-live
./$(PAN)-live -a -m$(DEPTH)
$(PAN): pan.c
$(CC) $(CFLAGS) -DSAFETY -o $@ $<
$(PAN)-live: pan.c
$(CC) $(CFLAGS) -o $@ $<
pan.c: $(MODEL)
spin -a $<
clean:
rm -f $(PAN) $(PAN)-live pan.* *.trail
Write the README.md modelling/spin/<name>/README.md:
Structure (follow the pattern in modelling/spin/write-before-evict/README.md):
# <Property Name><component-name>) or Whole systemRun the verification by executing make in the new directory.
spin -t -p <file>.pml), fix the model, and re-run until it passes.Report results to the user:
/usr/local/bin/spin (see modelling/spin/write-before-evict/README.md for install instructions).