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

Higher-Order Approximate Relational Refinement Types for Mechanism Design and Differential Privacy

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

scope and result

HOARe² is a relational refinement type system for higher-order probabilistic programs. The paper introduces it to verify differential privacy, truthfulness, and approximate equilibria. Its abstract states: “We introduce a relational refinement type system, called HOARe2 , for verifying mechanism design and differential privacy.” (Abstract) The system has relational assertions over two runs, refinements at function types, and a polymonadic representation of approximate probabilistic computations. The authors prove soundness with respect to a denotational semantics, embed a terminating fragment of DFuzz with probabilities only over real numbers, implement an SMT-backed checker, and verify auctions and an aggregative-game mechanism (Abstract and Sections 3–6, PDF pp. 1, 4–12). Section 4 states: “For compactness, we only consider a terminating fragment of DFuzz with probabilities only over real numbers.”

technique: relational refinements for two runs

Use this when the property compares outputs from two executions: adjacent databases, truthful and deviating bids, or two related states. A refinement tx :: T | φu constrains the left value xˡ and right value xʳ; the paper’s example |xˡ − xʳ| ≤ k relates natural numbers differing by at most k (Section 2). Higher-order refinements constrain function behavior, for example a function that adds one in the left run and returns its argument in the right run (Section 3.4).

Steps: define a relation on inputs; bind the two values in a relational environment; write an assertion over left/right projections; type the expression under that environment; discharge the resulting logical obligations with the SMT checker. For truthfulness, bind the bidder’s value equally in both runs, constrain the left bid to equal the value, leave the right bid arbitrary, and require left utility ≥ right utility (Section 6.1).

Inference: In Verus, represent the relation with a ghost predicate rel(a, b) and prove a function contract from rel on inputs to rel or an inequality on outputs. Rust does not automatically execute two copies of a function, so a proof function or paired ghost model is needed.

technique: approximate probabilistic effects with a polymonad

Directly encoding differential privacy’s probability inequality in every refinement would expose exponentials and event quantifiers to the SMT solver. HOARe² instead uses Mε,δ[T] and operators unit and bind; the paper gives the bind type Mε,δ[T] → (T → Mε′,δ′[U]) → Mε+ε′,δ+δ′[U] (Section 2). The authors state: “On the other hand, the refinement types T and U remain standard relational refinements, and do not need to refer to probabilities or exponentials.” (Section 2)

Steps: annotate each random computation with ε and δ; use unit at zero privacy cost (its rule also permits larger nonnegative indices); compose computations with bind, adding costs; keep ordinary relational refinements free of probability expressions; prove the monadic typing rules sound against a lifting of relations between distributions. Lifting the equality relation is equivalent to an ε-distance bound and yields the differential-privacy type tx:T | xˡ Φ xʳu → Mε,δ[ty:U | yˡ = yʳu] (Sections 2 and 3.4).

Inference: In Verus, carry privacy budgets as ghost values and prove additive composition lemmas. A random implementation can be modeled by a spec function with a relation on distributions; Verus itself does not provide probabilistic semantics, so the distribution model and its theorems remain trusted or separately formalized.

technique: termination and partiality for recursion

Unrestricted recursion is typed in a partiality monad; the other recursion rule requires a termination guard. The paper gives two letrec rules: one requires a partial monadic result, while the other permits any result if a termination guard is satisfied (Section 3.3). The guard is not fixed by the theory: “We leave the termination guard unspecified; possible forms of enforcing the guard include sized types and syntactic criteria.” This matters because higher-order refinements make naive nontermination interpretations inconsistent with semantic subtyping (Section 2).

Steps: classify each recursive definition; put potentially nonterminating computations in the partiality monad; otherwise provide a size or syntactic guard; include the partiality monad in the relational result type when using unrestricted recursion. Section 5.3 illustrates this choice: “The algorithm terminates, but the simple guard condition implemented in our tool does not capture termination.” Inference: A Verus adaptation should state termination requirements explicitly, prove a ranking measure with decreases where required, and distinguish termination from partial correctness. This paper does not establish Verus termination rules.

technique: truthful auction proofs

For a fixed-price auction, define fixedprice b p = if b > p then v − p else 0, with value equal across runs. Type the function so the truthful left bid equals v and the right bid is arbitrary, while the price is equal; conclude uˡ ≥ uʳ (Section 6.1). The paper states: “Since the bid b is arbitrary in the second run, the two runs may take different branches.” (Section 6.1, PDF p. 10) Its asynchronous case rule handles these branches.

For random sampling, split bidders into two groups, compute each group’s revenue-maximizing fixed price, and use it for the auction in the other group. Draw the group coins, calculate utility, and take expectation. The paper’s code uses flip, repeat N flip, split, and E; its type proves expected truthful utility is at least deviating utility (Section 6.2). Steps are: model one bidder and fixed opponents; prove fixed-price truthfulness; define the random split; prove universal truthfulness for each coin realization; lift through monotonicity of expectation.

Inference: In Verus, prove deterministic utility inequalities first, then prove a ghost expectation monotonicity lemma. The random sampler, probability distributions, and real-number solver support require additional trusted models.

technique: privacy-backed approximate Nash equilibrium

For an aggregative game, each payoff depends on an agent’s action and a bounded aggregate signal. The mechanism adds Laplace noise to aggregate signals induced by reported best responses, searches for a signal whose noisy sum is close, applies deviation functions, and evaluates expected payoff. The paper lists five steps for expay (Section 6.3): compute noisy sums; find a close signal; apply deviations; compute true payoff; take expectation.

The proof gives expay a relational type in which the left best response maximizes the true payoff at each signal, the left deviation function is identity, and the right run’s expected payoff is at most α larger. The other players’ best responses are equal across runs, and their deviation functions are identity in both runs. The signal and payoff functions must also satisfy low-sensitivity conditions expressed by refinements (Section 6.3, PDF p. 11): “For the accuracy guarantee we need to show that this noise is not too large (which is the case if the signal and payoff functions satisfy certain low-sensitivity conditions captured with refinement types).” The Laplace type bounds noise by T = |xˡ − xʳ| + (1/ε) log(2/β) with probability 1 − β (Section 6.3). The randomized payoff has a monadic relational type with ε′, δ′, and α′. A separate refinement for expectation converts the lifted inequality into a real-valued utility inequality, with a new error α₂ computed from those parameters (Section 6.3).

Inference: A Verus adaptation could model the final approximate equilibrium as an inequality between expected payoffs of two executions. The probability tail bound and expectation composition are mathematical lemmas to import or prove; they are not implied by a Rust contract alone.

evidence, trust, and limits

The paper reports an SMT-backed checker using Why3 and a Coq formalization of relational soundness (Sections 3.4–3.5, PDF p. 6): “We have completed a formalization of Theorem 3.1 in the Coq proof assistant, assuming an axiomatization of probabilities and lifting.” Automation requires annotations: “All the programs presented in § 5 and § 6, as well as some additional examples from the DP literature (private histograms, sums, two level counters and IDC) were automatically type checked by the implementation, with the only help of top-level type annotations.” It verifies fixed-price and random-sampling auctions, a private counter, a dual-query mechanism, and the aggregative-game mechanism (Sections 5–6). Table 1 reports example line counts and verification times (Section 3.5); these are implementation benchmarks, not a general performance guarantee. Inference: A Rust adaptation would depend on its probability model, primitive specifications, and proof tools. An omitted relational side condition or incorrect privacy budget could invalidate the intended guarantee despite a successful proof. The paper does not evaluate Verus or agent-written Rust.

techniques for the catalog

  • relational two-run refinements: express privacy and truthfulness as assertions over paired values
  • polymonadic approximate effects: track ε and δ composition in probabilistic computations while keeping refinements ordinary
  • guarded recursion: separate partial computations from termination-checked recursion
  • relational auction proof: prove truthful utility by asynchronous branch reasoning and expectation monotonicity
  • privacy-backed equilibrium: combine Laplace sensitivity bounds with approximate payoff inequalities

Last edited: