跳到正文
cccskills
免费在 GitHub 公开

tlaplus-model-reduction

Automatically simplify and minimize TLA+ specifications by reducing redundant state variables, merging equivalent actions, and minimizing invariants while preserving specified properties. Use when working with TLA+ specifications that need optimization, simplification, or reduction. Triggers when users ask to minimize, reduce, simplify, or optimize TLA+ specs, or when they want to remove redundancy from formal specifications while maintaining semantic equivalence.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(2)

  • SKILL.md6.1 KB
  • references/reduction_techniques.md2.5 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

TLA+ Model Reduction (Spec Minimizer)

Overview

This skill analyzes TLA+ specifications and produces minimized versions by eliminating redundancies while preserving all specified properties. The reduction process analyzes reachability, dependency relations, and property relevance to ensure semantic equivalence between the original and reduced specifications.

Workflow

Step 1: Input Analysis

Parse and understand the input TLA+ specification:

  1. Identify components:

    • State variables (VARIABLES declaration)
    • Initial state predicate (Init)
    • Next-state relation (Next)
    • Invariants (INVARIANT declarations)
    • Temporal properties (PROPERTY declarations)
    • Type invariants and constraints
  2. Extract structure:

    • List all actions (disjuncts in Next)
    • Identify action guards (enabling conditions)
    • Map variable dependencies
    • Note fairness constraints if present
  3. Understand properties:

    • Safety properties to preserve
    • Liveness properties to maintain
    • User-specified invariants

Step 2: Dependency Analysis

Build comprehensive dependency graphs:

  1. Variable dependency graph:

    • For each variable, identify which actions read/write it
    • Determine which variables are used in property specifications
    • Find derived variables (computed from others)
    • Identify unused variables
  2. Action dependency graph:

    • Map which actions enable/disable other actions
    • Identify independent vs. dependent action sequences
    • Find actions with identical effects
  3. Property dependency graph:

    • Determine which variables each property depends on
    • Identify which actions affect property satisfaction

Step 3: Identify Reduction Opportunities

Systematically find redundancies using the techniques in reduction_techniques.md:

  1. Redundant state variables:

    • Variables never referenced in actions or properties
    • Variables whose values are always derivable from others
    • Variables that remain constant after initialization
  2. Equivalent actions:

    • Actions with identical guards and effects
    • Actions that differ only syntactically
    • Actions that can be merged without changing behavior
  3. Redundant invariants:

    • Invariants implied by other invariants
    • Invariants that are always trivially true
    • Invariants not needed for property verification

Step 4: Apply Reductions Incrementally

Perform reductions one at a time, verifying correctness after each:

  1. Remove redundant variables:

    • Eliminate unused variables first (safest)
    • Remove derived variables and update references
    • Simplify expressions after variable removal
  2. Merge equivalent actions:

    • Combine actions with identical effects
    • Simplify the Next-state relation
    • Preserve action names in comments for traceability
  3. Minimize invariants:

    • Remove implied invariants
    • Keep minimal set that ensures all properties
    • Document which invariants were removed and why
  4. Simplify expressions:

    • Reduce complex boolean expressions
    • Eliminate dead code in action definitions
    • Simplify guards when possible

Step 5: Verify Semantic Equivalence

Ensure the reduced specification is equivalent to the original:

  1. Reachability preservation:

    • Verify the reduced spec reaches the same states (modulo removed variables)
    • Check that no new behaviors are introduced
    • Confirm all original behaviors are preserved
  2. Property preservation:

    • Verify all safety properties still hold
    • Confirm liveness properties are maintained
    • Check that fairness constraints are preserved
  3. Refinement relationship:

    • Establish that reduced spec refines the original
    • Define refinement mapping if variables were removed
    • Explain the correspondence between states

Step 6: Generate Output

Produce the minimized specification and justification:

  1. Minimized TLA+ specification:

    • Write the complete reduced spec
    • Use clear formatting and structure
    • Add comments explaining major changes
  2. Reduction summary:

    • List all reductions performed:
      • Variables removed (with reasons)
      • Actions merged (with justification)
      • Invariants eliminated (with explanation)
    • Quantify the reduction (e.g., "Reduced from 8 to 5 variables")
  3. Correctness justification:

    • Explain why each reduction preserves semantics
    • Describe the refinement mapping if applicable
    • Reference dependency analysis results
    • Note any assumptions made

Example Usage

User request: "Minimize this TLA+ spec while preserving the safety property"

Process:

  1. Parse the spec and identify 3 state variables, 4 actions, 2 invariants
  2. Build dependency graphs showing variable temp is only used internally
  3. Identify that Action1 and Action2 have identical effects
  4. Determine that Inv2 is implied by Inv1
  5. Remove temp, merge actions, eliminate Inv2
  6. Output reduced spec with 2 variables, 3 actions, 1 invariant
  7. Provide justification: "temp removed (derived from x and y), actions merged (identical guards and effects), Inv2 removed (implied by Inv1)"

Important Notes

  • Always preserve the original specification's semantics
  • Document all assumptions made during reduction
  • If uncertain about a reduction's correctness, keep the original form
  • Prioritize safety: when in doubt, don't reduce
  • For complex specs, consider using TLC model checker to verify equivalence
  • Maintain traceability between original and reduced specifications

References

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Applies abstract interpretation using different abstract domains (intervals, octagons, polyhedra, sign, congruence) to statically analyze program variables and infer invariants, value ranges, and relationships. Use when analyzing program properties, inferring loop invariants, detecting potential errors, or understanding variable relationships through static analysis.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

Uses abstract interpretation to automatically infer loop invariants, function preconditions, and postconditions for formal verification. Generates invariants that capture program behavior and support correctness proofs in Dafny, Isabelle, Coq, and other verification systems. Use when adding formal specifications to code, generating verification conditions, inferring contracts for functions, or discovering loop invariants for proofs.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

Performs abstract interpretation over source code to infer possible program states, variable ranges, and data properties without executing the program. Reports potential runtime errors including out-of-bounds accesses, null dereferences, type inconsistencies, division by zero, and integer overflows. Use when analyzing code for potential runtime errors, performing static analysis, checking safety properties, or verifying program behavior without execution.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

Performs abstract interpretation to produce summarized execution traces and high-level program behavior representations. Highlights key control flow paths, variable relationships, loop invariants, function summaries, and potential runtime states using abstract domains (intervals, signs, nullness, etc.). Use when analyzing program behavior, understanding execution paths, computing loop invariants, tracking variable ranges, detecting potential runtime errors, or generating program summaries without concrete execution.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

Create ACSL (ANSI/ISO C Specification Language) formal annotations for C/C++ programs. Use this skill when working with formal verification, adding function contracts (requires/ensures), loop invariants, assertions, memory safety annotations, or any ACSL specifications. Supports Frama-C verification and generates comprehensive formal specifications for C/C++ code.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

CLI-based browser automation with persistent page state using ref-based element interaction. Use when users ask to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

中文简介正在准备中。当前显示原文说明。

ArabelaTso/Skills-4-SE2582026年8月21日 更新

查看 ArabelaTso 的全部技能

报告此技能的问题