Skip to content

GR(1) contracts

GR1IoContract extends Pacti's assume-guarantee operations to temporal component requirements in a typed, bounded-next fragment of GR(1). It is intended for compositional analysis of component specifications. It is not a controller synthesizer or a general LTL engine.

A GR(1) contract separates environment assumptions from component guarantees. Each side is divided into three buckets:

Bucket Meaning
init formulas that hold in the initial state
inv formulas that hold at every state
liv formulas that hold infinitely often

The entries in each bucket are conjoined. Liveness entries remain separate liveness obligations: liv: ["p", "q"] denotes GF p & GF q, rather than GF(p & q).

Typed interfaces and formulas

Every interface variable has sort bool, int, or real. Assumptions may refer only to input variables, while guarantees may relate inputs and outputs. The following contract initializes an integer counter, increments it after an enabled step, and requires the threshold to recur:

from pacti.iocontract import GR1IoContract

counter = GR1IoContract.from_dict({
    "input_vars": ["enable"],
    "output_vars": ["count"],
    "variable_sorts": {"enable": "bool", "count": "int"},
    "assumptions": {},
    "guarantees": {
        "init": ["count = 0"],
        "inv": ["enable -> X(count) = count + 1"],
        "liv": ["count >= 10"],
    },
})

X(value) and next(value) refer to the next value of a variable. A bounded number of nested next operators is supported. Core formulas may use Boolean operators, comparisons, parentheses, exact decimals, and rational linear integer or real arithmetic. The outer temporal operator is supplied by the bucket. Arbitrary G, F, and U operators are not accepted inside a core formula.

Contract operations

GR(1) contracts support Pacti's composition, quotient, merge, refinement, and serialization operations. Composition connects components and hides shared internal variables. Quotient computes a contract for a missing component from a system contract and a known component. Merge conjoins compatible viewpoints without hiding connected variables. The dictionary returned by to_dict() records the interface, sorts, and formulas and can be passed to from_dict().

For refinement, candidate.refines(specification) attempts to prove that the candidate has no stronger environment assumptions and no weaker guarantees. A True result is a sound finite-certificate result. A False result is inconclusive in general: the refinement may be false, or the implemented finite support search may not find a certificate.

Composition and quotient use Context-Aided Variable Elimination (CAVE) when an internal variable must be hidden. CAVE combines the projected formula with relevant initial, invariant, and liveness context. The resulting bounds are sound for the implemented fragment, but temporal variable elimination is not exact for every GR(1) formula. In particular, Pacti does not claim completeness for arbitrary infinite traces or solve the GR(1) realizability game.

GR(1) contract operations and the CAVE workflow

Figure 1: Contract operations use refinement or relaxation CAVE to return a GR(1) contract over the desired interface.

Boolean and linear integer or real arithmetic are the validated solver scope. Solver unknown, unsupported quantifier elimination, and unexpected tactic results raise GR1SolverError when a conclusive result is required. They are not accepted as proofs.

Examples

The GR(1) Getting Started notebook composes a cooling controller with a fan actuator and eliminates their internal command. The automatic emergency-braking case study uses real and Boolean variables to compute a system contract and a quotient. The complete API reference documents the public class and solver exception.

Pacti 0.4.0 and later include GR1IoContract and require Python 3.11 or newer. The implementation is maintained in the Pacti source repository.

python -m pip install pacti
python -c "from pacti.iocontract import GR1IoContract; print(GR1IoContract.__name__)"

Reference

Yiğit Narter, Emily Zhao, and Inigo Incer. "Computing GR(1) Assume-Guarantee Contracts." arXiv:2610.37534, 2026.