We introduce a novel variant of logical relations that maps types not merely to partial equivalence relations on values, as is commonly done, but rather to a proof-relevant generalisation thereof, namely setoids. The objects of a setoid establish that values inhabit semantic types, whilst its morphisms are understood as proofs of semantic equivalence. The transition to proof-relevance solves two well-known problems caused by the use of existential quantification over future worlds in traditional Kripke logical relations: failure of admissibility, and spurious functional dependencies. We illustrate the novel format with two applications: a direct-style validation of Pitts and Stark's equivalences for "new" and a denotational semantics for a region-based effect system that supports type abstraction in the sense that only externally visible effects need to be tracked; non-observable internal modifications, such as the reorganisation of a search tree or lazy initialisation, can count as 'pure' or 'read only'. This 'fictional purity' allows clients of a module soundly to validate more effect-based program equivalences than would be possible with traditional effect systems.
Syntax and SemanticsWe will interpret effect-refined types over a somewhat generic, untyped denotational model for stateful computations in the category of predomains (ω-cpos). We also introduce a meta-language [24], providing concrete syntax for functions in the model. We omit the standard details of interpreting CBV programming languages via such a metalanguage, or proofs of adequacy, relating the operationally induced observational (in)equivalence to (in)equality in the model. Denotational model We assume predomains V and H modelling values and heaps, respectively. As much of the metatheory does not rely on the finer details of how these predomains are defined, we axiomatise the properties we use. Firstly, we assume the existence of a set of (concrete) locations L and for each h ∈ H a finite set dom(h) ⊆ L. We also assume a constant ∅ ∈ H, the empty heap.where l ∈ L and h ′ ∈ H. These three operations are continuous, in particular, h ≤ h ′ ⇒ dom(h) ⊆ dom(h ′ ) and the following axioms hold:then dom(h ′ ) = dom(h)∪{l} and l dom(h) and h ′ (l) = v. Given V this abstract datatype can be implemented in a number of ways, e.g., as finite maps. We define the domain of computations C to be partial continuous functions from H to H × V, the bottom element being the everywhere undefined function.We assume that V embeds tuples of values, i.e., if v 1 , . . . , v n ∈ V then (v 1 , . . . , v n ) ∈ V and it is possible to tell whether a value is of that form and in this case to retrieve the components. We also assume that V embeds continuous functions f : V → C, i.e., if f is such a function then fun( f ) ∈ V and, finally, locations are also values, i.e. if l ∈ L then loc(l) ∈ V and one can tell whether a value is a location or a function. A canonical example of such a V is the least solution to the predomain equation with C = H ⇁ H×V and V ≃ int(Z) + fun(V → C...