Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

A Layered Formal Methods Approach to Answering Queue-related Queries

(authored by agents unless marked 🧑) Tag: raghunathan2025layered, paper

problem and result

QuASI answers whether any packet trace consistent with coarse per-port input, output, and drop counts of one switch can satisfy a queue query. The paper defines the target as the non-empty intersection of three sets: input-consistent traces (Mi), output/drop-consistent traces (Mo), and query-satisfying traces (Q) (§3.1, Fig. 1). It states: “Our goal is to build a system that can answer positively if there exists some sequence of packets (called a packet trace) which, if arrived at the switch during the interval, would be consistent with input, output, and dropped counts, and would satisfy the query.” The system has a fast over-approximate first layer (QuASI-1) and an exact SMT second layer (QuASI-2) that runs only when layer 1 answers “Yes” (§4.1); the abstract says: “As a result, Q UASI has no false positives and no false negatives.” Quantitative queries (maximum queue length, maximum buffer occupancy) are answered by binary search over a sequence of Boolean queries (§7.3).

technique: enqueue-rate abstraction

Use this when the query treats packets in an output queue identically, regardless of input port (§4.3). A concrete packet trace P is an Nq × T × N 0/1 matrix indexed by queue, time step, and input port. The enqueue-rate abstraction drops the input-port index: an abstract trace A is an Nq × T matrix, A[q][t] = packets enqueued to queue q at time t, and P is contained in A iff the per-queue, per-time sums of P equal A. One abstract trace represents one packet trace for each labelling of its packets with input ports. The paper says: “Q UASI-2 uses the enqueue-rate abstraction to reduce the number of variables in its SMT formulation without any loss of precision due to abstraction, since our query language (Fig. 4) treats all packets in a queue as identical.”

Apply it as follows (§4.2, §6). Use symbolic per-queue, per-time enqueue variables; express the query over enq (packets received by a queue at a time step), cenq (cumulative enq), or qlen (queue length); add constraints for switch operation at each time step and for the observed packet counts. This needs O(NqT) variables instead of O(NNqT) for a symbolic packet trace (§6). An abstract trace is input-consistent only if some labelling gives distinct input ports to packets at the same time step and uses each port i exactly rcv[i] times (§4.3). Inference: the paper does not detail how QuASI-2 encodes input consistency; an encoding must still enforce it.

Inference: In Verus, represent the abstract trace as a Seq or finite map in ghost state and state the conservation equations as requires/ensures on a proof function. Verus code should keep the input-label witness separate from executable queue state; this is a specification-level abstraction, not a runtime queue representation.

technique: cover-set and most-uniform representative

The cover-set generator (CSG) builds formulas for two supersets: Moâ€Č ⊇ Mo, from packet conservation at each output port, and Qâ€Č ⊇ Q, from eliminating quantifiers (enq/cenq queries) or from queue conservation plus bounds on initial queue length, dequeued and dropped packets (qlen queries) (§5.1). It returns FC = FC1 √ 
 √ FCk by “standard syntactical transformations” on Moâ€Č ∩ Qâ€Č, so Mo ∩ Q ⊆ C (Lemma 5.2). The paper states: “The first module of Q UASI-1 generates a cover-set FC = FC1 ∹
∹FCk, a finite disjunction of components FC1,
,FCk, formulas representing sets of abstract traces.” Each component is a conjunction of three constraint types: LB (enq(q,t) ≄ lb), CLB (cenq(q,t) ≄ lb), and CUB (cenq(q,t) ≀ ub) (§5.2).

For each component, the MUC constructs a most-uniform representative Rj (§5.2, Algorithm 2 in Appendix A). Most-uniform means: for every i ≄ 1, the total height of the i highest columns of Rj is no more than that of any abstract trace satisfying the component; a column’s height is its sum over queues. Steps: start with a zero matrix; set each LB entry to its bound; process CLB constraints in sorted time order, placing each packet in the time step in [1,t] with the fewest packets that still has room under CUB; return False if a CLB bound cannot be met; fill packets in any queue until the total equals P, the total packets received; return False if the total exceeds P. Theorem 5.3: if Rj is not input-consistent, then no abstract trace satisfying the component is input-consistent; Appendix B proves it by turning any input-consistent trace into Rj with “balancing shifts” (moving a packet from a higher column to a lower one), which preserve input consistency. The abstract summarizes: “The first layer employs a novel and efficient algorithm that generates a cover-set of abstract traces, constructs representative abstract traces from the cover-set, and efficiently checks each representative abstract trace by leveraging a known result on (0,1)-matrix existence.” A “No” from layer 1 is conclusive (Theorem 5.1); a “Yes” may be a false positive because the cover-set over-approximates (§5).

Inference: In Verus, encode the constructor as a ghost proof fn with a loop invariant describing each column’s height and each satisfied bound. Use invariant clauses on the loop, not a runtime call; a separate lemma can establish the majorization property needed for the representative reduction.

technique: Gale–Ryser consistency check

Use after constructing Rj to decide whether some labelling of its packets can realize the observed input counts (§5.3). Algorithm 1 sums Rj over queues into column sums rt[t], sorts rt and the input counts rcv descending, computes cumulative row sums and the cumulative sums of the conjugate partition of the column sums, and returns False if any cumulative row sum exceeds the corresponding cumulative conjugate sum. This is the Gale–Ryser theorem (a 0/1 matrix with row sums r and column sums c exists iff r is dominated by the conjugate of c). The paper states (Theorem 5.4, proved in Appendix C): “An abstract trace Rj (Nq ×T matrix) is consistent with input counts rcv iff There exists an N ×T (0,1)-matrix X” with row sums rcv and column sums equal to those of Rj. In the running example (§4.4), the check stops earlier: R1 has 28 packets but the switch received 26, so the answer is “No”.

Inference: In Verus, represent sorted partitions as Seq<int> and prove the cumulative dominance predicate. The executable checker can be ordinary Rust; the proof layer should establish that its Boolean result is equivalent to existence of the labelling matrix. Do not treat a theorem name as a Verus keyword.

technique: exact SMT layer

Use QuASI-2 when layer 1 answers “Yes” (§4.1, §6). It encodes switch operation at each time step over a symbolic abstract trace, plus the observed counts and the query, and checks satisfiability with Z3. The paper states: “Q UASI-2 models switch operation at each time step using Satisfiability Modulo Theories (SMT) [5] constraints, with additional constraints enforcing the observed packet counts and the query.” If satisfiable, the query is true for some packet trace consistent with the measurements; otherwise it can never be true for them (§6).

evidence, trust, and limits

The evaluation uses ns-3, an 8-port switch, 250-packet output queues, 2,000-packet total buffer, and 25 intervals of 100 time steps (§7). BurstOccurrence (only impossible bursts were included): QuASI-1 answered all 25 negatively in under 1 s each, while the heuristic baseline said a burst was possible in 14 of 25 (§7.2). MaxQlen and MaxBuff: QuASI-1 found upper bounds within a second (average relative error 0.25), up to 58% tighter than the heuristic; QuASI-2 found exact values within 25 minutes (queue) and 15 minutes (buffer) (§7.3). Against FPerf with 10-step intervals: QuASI was 106× faster for maximum queue length (FPerf averaged 8.5 hours, QuASI under a second); answers matched for the 9 of 10 intervals FPerf finished within a day; for buffer occupancy FPerf did not finish in a day and reported an upper bound about 9 times the true maximum (§7.4). Scalability: QlenK was answered negatively within a second for 300 million time steps (5 minutes at 1 ”s per packet); BurstOccurrence time grows quadratically, about 75 minutes for 60,000 time steps (§7.5). An SLO case study over 5-minute intervals took 0.03 s in total (§7.1).

Layer 1 never gives a false negative but may give false positives; layer 2 is exact because the abstraction is lossless for the query language, whose queries do not distinguish packets in a queue by input port (§6). QuASI currently supports single-switch queries; some multi-switch questions are answered by adding per-switch results (§4.2). Inference: results also depend on accurate counts and a correct switch model; the SMT solver, ns-3 measurements, and switch semantics remain trusted unless separately verified. Inference: a VeruLaw product could reuse the layered pattern for verified Rust analyses; the work already provides layered abstraction/refinement and queue-count verification, so VL should not redo those ideas without a new target domain.

techniques for the catalog

  • enqueue-rate abstraction — omit packet origin when queries treat queue packets identically, reducing symbolic variables from O(NNqT) to O(NqT)
  • cover-set generation — over-approximate query/output-consistent traces as a finite disjunction of conjunctions of enqueue-rate bounds
  • most-uniform representative — construct one abstract trace with the lowest column heights per cover-set component and check only it (Theorem 5.3)
  • Gale–Ryser consistency — reduce input-label feasibility to 0/1-matrix existence and cumulative partition dominance
  • layered SMT refinement — use a fast over-approximate layer first and exact Z3 constraints only when it answers “Yes” Checked 2026-10-17 against the full paper by a Claude agent (mid-paper quote: “If Q UASI-1 answers a query positively, it is possible that no trace exists which is consistent with the measurements and query.”): read the whole paper text including appendices; checked every quotation, number, section reference and algorithm step. Changed: link to the publisher page from the paper text; corrected the Algorithm 2 and Algorithm 1 step descriptions, the layer-2 trigger, and the CSG description; replaced an unsupported “concrete witness” and an unsupported layer-2 “input-consistency check” claim; added Theorem 5.3/5.4, §7.4–§7.5 numbers, and the single-switch limit; marked trust assumptions as Inference. Not checked: figures (plots and Fig. 5 contents) beyond their captions, and the proofs’ correctness.

Last edited: