Reading a certificate

certify returns a certificate. Every certificate is read in the same way, and a few fields depend on the problem. This page shows both.

The code on this page uses the three certificates of How a certificate works, on the running example of Systems and problems, named here after what they certify:

template = QuadraticTemplate()
graph = common_graph(system)

lyapunov = certify(template, graph, StabilityProblem(system);
                   optimizer = Clarabel.Optimizer)
barrier = certify(template, graph, SafetyProblem(system, S0, Su);
                  optimizer = Clarabel.Optimizer)
# Clarabel's chordal decomposition fails on optimal control.
optimizer = () -> Clarabel.Optimizer(chordal_decomposition_enable = false)
controller = certify(template, graph, OptimalControlProblem(controlled, Q, R);
                     optimizer)

Every certificate

Feasible or not

Check is_feasible first:

is_feasible(lyapunov), is_feasible(barrier), is_feasible(controller)
(true, true, true)

An infeasible result means that no certificate was found with this template on this graph, not that the property fails: another template or another graph may still certify it. status gives the solver's termination status, for diagnosis.

The node functions and the common certificate

AccessorReturns
functions(c)the node functions $V_s$, one per node
c(x)the common certificate $V$ at the state x
get_graph(c)the graph of the certificate
get_template(c)the template of its node functions
get_problem(c)the problem it certifies
status(c)the termination status of the solver

node_value(get_problem(c), V, x) evaluates a node function V at the state x, whatever the problem: a node function is a SetProg set, not a callable. Calling the certificate at a state evaluates its common certificate (see How a certificate works):

Certificate$V(x)$
stabilitythe common Lyapunov function
safetythe common barrier function, negative on $X_0$ and positive on $X_u$
optimal controlan upper bound on the worst-case cost $J_\phi(x)$ of the policy
x = [1.0, 0.0]
lyapunov(x), barrier(x), controller(x)
(2.581104842558121, -0.5835930570743593, 2.447366870940475)

Tight edges

An edge is tight when its edge inequality is active, with zero slack. edge_slacks measures every edge, and tight_edges lists those whose slack is at most atol, $10^{-4}$ by default:

edge_slacks(lyapunov), edge_slacks(barrier), edge_slacks(controller)
([3.1421326140425204e-8, 1.6689684349599025e-6], [-1.453343093657869e-11, -2.1172147368631045e-10], [0.00038975229081689156, 0.00037226872418558464])

Both edges are tight for stability and for safety. For the controller, both slacks exceed atol, so neither edge counts as tight. Tight edges are what Refining the graph reads to grow the graph.

Tolerances for stability

certify stops within rtol of the smallest rate, so the slacks of a stability certificate are of that order. Read them with an atol at least ten times rtol. The defaults, rtol = 1e-6 and atol = 1e-4, satisfy it, and a certificate computed with a coarser rtol needs a larger atol.

Stability

The rate, smallest or given

c.rate is the rate $\gamma$, an upper bound on the joint spectral radius. certify finds the smallest one by bisection, up to the relative precision rtol. Given a rate, it only checks that rate, and is_feasible says whether it is certified: a feasible rate below one proves stability.

at(rate) = certify(template, graph, StabilityProblem(system);
                   optimizer = Clarabel.Optimizer, rate)
lyapunov.rate, is_feasible(at(0.95)), is_feasible(at(1.0))
(0.9586944580078125, false, true)

A lower bound, and exactness

The tight edges also bound the joint spectral radius from below:

  • jsr_lower_bound is the largest $\rho(A_w)^{1/|w|}$ over the words $w$ read along the cycles of tight edges.
  • is_jsr_exact holds when every node has at most one tight outgoing edge and the tight edges contain a cycle: the rate is then the joint spectral radius (Ninite and Jungers, 2026; Thm. 4). false means unknown.
  • optimality_gap is 0 when is_jsr_exact holds, and the rate minus the lower bound otherwise.
jsr_lower_bound(lyapunov), is_jsr_exact(lyapunov), optimality_gap(lyapunov)
(0.8001574042773703, false, 0.15853705373044225)

The joint spectral radius of the running example therefore lies between $0.80$ and $0.959$. Another template or another graph may lower the rate: see Choosing a template and Choosing a graph.

The dual certificate

dual(c) gives a certificate on the dual graph, for the transposed system, at the same rate, without solving anything: see Duality.

A complete example: Bound the joint spectral radius of my system.

Safety

c.margin is the margin $\varepsilon$ by which the barriers separate $X_0$ from $X_u$, positive when safety is certified:

barrier.margin
0.28238630378043267

c.initial_multipliers and c.unsafe_multipliers hold the multipliers of the S-procedure for the two sets, one entry per node. With the piecewise quadratic template, each entry holds one multiplier per cone. With the polyhedral templates, which need none, each entry is nothing.

A complete example: Prove my system safe.

Optimal control

c.gains holds the gains $K_s$, one per node:

controller.gains
1-element Vector{Matrix{Float64}}:
 [-0.14285646166407995 -0.5160743432311196]

simulate(c, x0, modes) runs the closed loop of the policy of the certificate, which applies at each state the gain of the node whose function is smallest there, and simulate(c, x0, n) runs it along $n$ random modes. The inputs it applies along four modes:

trajectory = simulate(controller, [1.0, 1.0], [1, 2, 2, 1])
inputs(trajectory)
4-element Vector{Vector{Float64}}:
 [-0.6589308048951995]
 [-0.7143676383430481]
 [-0.06245586711833694]
 [-0.05084435800039741]

A complete example: Design a controller robust to switching.