Introduction
Refinement types [41 ] extend a host language with logical predicates that constrain the values inhabiting types. For instance, the type { x : I n t ∣ x ≠ 0 } \{x:\mathrm{Int} \mid x \ne0\} { x : Int ∣ x = 0 } refines the type of integers, allowing us to statically forbid division by zero. Such systems have been integrated into practical languages, including Haskell (Liquid Haskell) [67 ] , Scala (Stainless) [34 ] , and Rust (Flux) [43 ] . Unlike most foundational type theories, refinement type systems were developed primarily as engineering artifacts: their design was driven by the goal of verifying existing programs with minimal disruption to the underlying language, often accepting a degree of “soundiness” [46 ] in return for practicability.
Despite their practical success, the metatheory of refinement types remains only partially understood. Over the last decade practical refinement type systems have accumulated several features that interact in non-trivial ways at the semantic level, and potentially lead to inconsistencies if not handled with care. For example, 1) subtyping combined with 2) unrefined equality (i.e. an SMT-style equality that we describe in Section 2.1.2) and function extensionality has led to inconsistencies in both Liquid Haskell and F* [49 ] . Additionally, 3) impredicative polymorphism combined with some classes of 4) non-strictly positive inductive definitions as supported in Liquid Haskell can be shown to be inconsistent in standard type-theoretic settings [21 ] .
The desire to prevent inconsistency has led to several formalizations of refinement type systems. For example, Swamy et al. [64 ] prove normalization for a model of F*, but their calculus has no impredicative polymorphism. Hamza et al. [34 ] prove normalization for a model of Stainless which lacks subtyping. Ghalayini and Krishnaswami [30 ] construct a model for a system with explicit refinement types, but do not consider inductive types. Finally, Borkowski et al. [14 ] prove type soundness for a model of Liquid Haskell without higher-order unrefined equalities. As a result, there is currently no single semantic account that combines the four key features of refinement types. If we truly want to understand refinement types and prove their soundness, we need a semantic model that supports all of these features simultaneously.
Nevertheless, discovering such a semantic model is challenging. The set-theoretic semantics given by Ghalayini and Krishnaswami [30 ] , which interprets each refined type as a subset of the interpretation of its erased type, does not extend to impredicative polymorphism, which has no set-theoretic model in classical set theory [57 ] ; subtyping and unrefined equality further constrain how a model can interpret refined types, as we discuss in § 2.4 . Second, modeling the non-strictly-positive inductive types of Liquid Haskell is not straightforward, as they do not have a direct analogue in type theory.
In this paper we present a model based on partial equivalence relations (PERs) over a Scott domain. In broad strokes, our model follows much of the standard structure of PER models: types are interpreted as PERs over the domain and terms as well-defined elements of these PERs [48 ] . Thus, the semantic counterpart of typing is membership in the domain of the PER, and equality is interpreted as the PER itself. The subtyping relation is interpreted as inclusions between PERs, so no cast operations are needed. We will show that the notion of unrefined equality used in refinements may also be modelled by the unrefined PER interpreting a type. Finally, the PERs offer enough structure to model impredicative polymorphism in the usual manner, viz. as set-theoretic intersection over the set of all PERs.
The realizability model that we designed interprets the key features of refinement type systems and is deliberately elementary so that it can serve as a reference model against which candidate features are checked before they are implemented. Concretely, our contributions are:
A model of refinement types as they are, not as they are convenient to model. We isolate four features of practical refinement type systems (implicit subtyping, SMT-style unrefined equality, impredicative polymorphism, and non-standard inductive types) whose interaction is precisely what has caused soundness bugs in real systems, and we model their combination without simplifying any of them away. No existing formalization supports all four (§ 2.3 ).
Modeling unrefined equality. Every type receives a refined interpretation as a PER, included in an unrefined interpretation as a CUPER over a Scott domain (§ 4 to § 7 ). This model explains how the SMT-style equality interacts with higher-order refined terms. So, our model does not merely avoid the extensionality inconsistencies of Liquid Haskell and F ∗ F^{*} F ∗ , it explains them: they validate refined equalities that cannot coexist with unrefined equality (Section 2.1.2).
Consistency of positive and stratified inductive types under impredicativity (§ 8 and corollary 2). The model shows that positive and stratified types are consistent in a refined setting even with impredicative polymorphism. Our techniques are not specific to refinement types: they can be adapted to any type theory that admits a realizability model, for example MLTT. Ours is moreover the first denotational semantics of stratified indexed types, previously accounted for only by normalization or step-indexing arguments [34 , 40 ] . The interpretation of an inductive type is an initial algebra: folding and unfolding form an isomorphism, and the eliminator may expose the recursive arguments, in contrast to Mendler-style weakly initial algebras . So, both positive and stratified types share a single, uniform introduction and elimination discipline (§ 8 ). The message is constructive: positive and stratified indexed types are a straightforward addition to refinement systems.
The rest of the paper is structured as follows. In § 2 we present the key features of the system, compare them with existing formalizations, and explain why they require a semantic treatment beyond set-theoretic models. § 5 to § 8 develop the formal construction of the model CIRT and prove consistency. Finally, we present related works and conclude.
Every theorem in this paper is accompanied by a detailed proof in the supplementary material.
Refinement types: Syntax & Semantics
We start (§ 2.1 ) by presenting the key ingredients of practical refinement type systems that are relevant for the semantic development of this paper. Next (§ 2.3 ), we describe how these features are formalized in the literature and summarize their respective limitations. Finally (§ 2.4 ), we derive from these features the requirements that guide the design of our model.
Core Features of refinement type systems
A refinement type { x : τ ∣ ϕ } \{x:\tau\mid\phi\} { x : τ ∣ ϕ } consists of a base type τ \tau τ , a proposition ϕ \phi ϕ that constrains the values inhabiting τ \tau τ as the ones satisfying ϕ \phi ϕ . The language of propositions ϕ \phi ϕ includes boolean-valued expressions of the host language, equality predicates over terms (including equality that may not be decidable), and closure under standard logical connectives. Refinements are not restricted to base types, but may also appear throughout the type structure, for example in (dependent) function types, polymorphic types, and inductive types.
A key aspect of refinement type systems is that refinements act as an annotation layer over an existing language: they enrich static checking while leaving the operational semantics unchanged. This design enables deployment without runtime overhead, and further ensures that the behaviour of a program does not depend on refinement annotations. We call the independence of program behavior from verification annotations the annotation-independence property.
Refinement type systems are extended with several orthogonal mechanisms that interact in non-trivial ways at the semantic level. Next, we present the four main ingredients that appear in practical systems and that are relevant for the semantic issues studied in this paper.
2.1.1 Subtyping. A refinement that arbitrarily constrains the elements of a type may be naturally regarded as a subtype of another type; for example, positive integers are integers. This allows a term to be used at a less-refined or unrefined type without requiring explicit casts. Semantically, subtyping expresses inclusion between the meanings of types: every value inhabiting a subtype must also inhabit its supertype. Importantly, subtyping is implicit , meaning that, as presented in the rule Tm-Sub below, no type casts are required to use a term at a supertype. Function types, in turn, satisfy the standard contravariant/covariant subtyping rule Sub-Fun [18 , 19 ] .
Γ ⊢ t : τ Γ ⊢ τ ⪯ σ Γ ⊢ t : σ \frac{\Gamma\vdash t:\tau\qquad\Gamma\vdash\tau\preceq\sigma}{\Gamma\vdash t:\sigma} Γ ⊢ t : σ Γ ⊢ t : τ Γ ⊢ τ ⪯ σ
Γ ⊢ σ ⪯ τ Γ ⊢ ρ ⪯ π Γ ⊢ τ → ρ ⪯ σ → π \frac{\Gamma\vdash\sigma\preceq\tau\qquad\Gamma\vdash\rho\preceq\pi}{\Gamma\vdash\tau\to\rho\preceq\sigma\to\pi} Γ ⊢ τ → ρ ⪯ σ → π Γ ⊢ σ ⪯ τ Γ ⊢ ρ ⪯ π
2.1.2 Unrefined equality. Refinements often use equality as an unrefined relation on terms, including terms of function type. This reflects the view of the SMT solver, which operates on a representation of these unrefined terms, and derives equalities without refined type information [68 ] .
This notion of unrefined equality is the cause of many subtle soundness questions. For example, function extensionality was introduced in both Liquid Haskell [66 ] and F* [49 ] and later shown to be inconsistent. The inconsistency arises from the interaction between unrefined equality and subtyping: in a typed setting, equality is indexed by type and extensionality can be formulated so as to be harmless; with unrefined equality, the same axiom has greater force and Vazou and Greenberg [66 ] showed that admitting it leads to a proof of false.
2.1.3 Parametric Polymorphism. Most refinement type systems are built on top of languages that have parametric polymorphism, such as Haskell or Scala. We model such languages through impredicative type quantification à la System F [31 , 58 ] . Thus, a quantified type has the same kind as the types over which it quantifies. For example, the type ∀ X : T y . X \forall\mathsf{X}:\mathsf{Ty}.\mathsf{X} ∀ X : Ty . X itself has kind T y \mathsf{Ty} Ty , and may therefore be instantiated with arbitrary types of kind T y \mathsf{Ty} Ty , including itself. predicative polymorphism, where the quantified type lives at a strictly higher level than the types it quantifies over, in a stratified hierarchy [44 ] .
Refinement types should interact smoothly with polymorphism: it should be possible to refine type variables, instantiate them with arbitrary types, and quantify over indexed type families.
Non-standard Inductive Types
To preserve consistency, general recursion must be excluded from a system of refinement types. However, simply replacing it with some flavour of structural recursion does not suffice, as it is well-known that recursive type definitions can also be used to encode general recursion [36 , 54 ] . The canonical counterexample is:
data Bad where MkBad :: (Bad → Void) → Bad
where Void is the empty type. This type enables encoding self-application and yields a contradiction:
bad :: Bad → Void worst :: Void
bad (MkBad f) = f (MkBad f) worst = bad (MkBad bad)
This term is a typed instance of Curry’s paradox; that admitting such negative datatypes breaks normalisation—and hence consistency—in the second-order λ \lambda λ -calculus is due to Mendler [53 ] . While this code is totally valid Haskell, it is rightfully rejected by Liquid Haskell, which aims to construct a consistent refinement type system. However, strict positivity is too strong a restriction: positive types and stratified negative types could be admitted without compromising consistency.
Positive types allow the inductive type to occur negatively, provided that each negative occurrence is itself under a negative function arrow; a canonical example is Hofmann’s routine type [12 , 39 ] :
data Rou where Over :: Rou; Next :: ((Rou → [Nat]) → [Nat]) → Rou
While it is not immediately obvious, the class of positive types can also lead to inconsistencies in dependently typed systems built on CIC [21 ] . In contrast, our denotational model proves that they are harmless in a refinement type system.
Stratified types , introduced by Jacob-Rao et al. [40 ] and also used by Hamza et al. [34 ] , are indexed inductive types whose recursive occurrences appear at ‘strictly smaller indices’ both in positive and negative positions, ensuring well-foundedness. As an example, consider the shallow embedding of the simply-typed lambda calculus (STLC) in Liquid Haskell (from [25 , 26 ] ) where the data types Typ and Val, respectively, embed types and values of STLC:
data Typ = TIota | TArr Typ Typ
data Val where {-@ stratified Val @-}
{-@ VIota :: Int → Ix Val TIota @-}
VIota :: Int → Val
{-@ VArr :: t:Typ → u:Typ → (Ix Val t → Ix Val u) → Ix Val (TArr t u) @-}
VArr :: Typ → Typ → (Val → Val → Val) → Val
The type Typ contains the base type (TIota) and the function type (TArr). The family Val is indexed by such types; intuitively, Val t contains exactly the values of object-language type t. The Ix annotation is Liquid Haskell’s notation for attaching such an index to a datatype.
Ignoring the refinement annotations, Val can be viewed as the solution of the recursive domain equation of the untyped λ \lambda λ -calculus, which is sufficiently expressive to encode general recursion. The refinement annotations, however, equip values with a type index. A value indexed by TIota must be constructed using VIota, whereas a value indexed by TArr t u must be constructed using VArr. The recursive occurrences of Val appearing in the argument of VArr are indexed by t and u, which are strict subcomponents of the result index TArr t u. Consequently, recursive occurrences only appear at smaller indices, allowing the family Val to be interpreted by induction on the structure of the index rather than as an arbitrary recursive domain equation. The stratified Val annotation enables the stratification checker to verify the well-formedness of the type: as explained in § 9 , it checks that the indices of the recursive occurrences are indeed strictly smaller than the index of the result type, and accepts the definition of Val \operatorname{Val} Val .
Existing formalizations
We give a high-level overview of existing formalizations of refinement type systems, and the extent to which they model the features described in § 2.1 . Table 1 summarizes the four formalizations that we discuss: μ F ⋆ \mu F^\star μ F ⋆ [64 ] that models F ⋆ F^\star F ⋆ , System FR [34 ] that models Stainless, λ R F \lambda_{RF} λ R F [14 ] that models Liquid Haskell, and explicit refinement types [30 ] that models a system with explicit refinement types. For each system we indicate the extent to which it supports the four features of refinement types, and the semantics used to model them.
Table 1. High level comparison of the formalizations of refinement type systems of: μ F ⋆ \mu F^\star μ F ⋆ [64 ] , System FR [34 ] , λ R F \lambda_{RF} λ R F [14 ] , and explicit refinement types [30 ] .
Subtyping. Many formal models of refinement types, such as explicit refinement types and System FR, do not include explicit subtyping. Instead they rely on a reflection rule:
Γ ⊢ t : τ Γ ⊢ ϕ ( t ) o k Γ ⊢ t : { x : τ ∣ ϕ } T m - R e f l \frac{\Gamma\vdash t\!:\!\tau\qquad\Gamma\vdash\phi(t)\ \mathit{ok}}{\Gamma\vdash t\!:\!\{x\!:\!\tau\mid\phi\}}
\quad\mathsf{Tm\text{-}Refl} Γ ⊢ t : { x : τ ∣ ϕ } Γ ⊢ t : τ Γ ⊢ ϕ ( t ) ok Tm - Refl
Subtyping is then implicitly possible, as whenever ϕ \phi ϕ implies ψ \psi ψ , any term Γ ⊢ t : { x : τ ∣ ϕ } \Gamma\vdash t\!:\!\{x\!:\!\tau\mid\phi\} Γ ⊢ t : { x : τ ∣ ϕ } is also a term of type Γ ⊢ t : { x : τ ∣ ψ } \Gamma\vdash t\!:\!\{x\!:\!\tau\mid\psi\} Γ ⊢ t : { x : τ ∣ ψ } . However, this is not equivalent to the explicit formulation. To see why, suppose we have a free variable f : I n t → { x : I n t ∣ x ≥ 0 } f\!:\!\mathrm{Int} \to\{x\!:\!\mathrm{Int} \mid x \ge0\} f : Int → { x : Int ∣ x ≥ 0 } which we wish to use as a function of type { x : I n t ∣ x ≥ 0 } → I n t \{x\!:\!\mathrm{Int} \mid x \ge0\} \to\mathrm{Int} { x : Int ∣ x ≥ 0 } → Int . This cannot be derived from reflection alone, as refinement information cannot flow through type formers. The eta-expansion λ x . f ⋅ x \lambda x.\,f \mathbin{\cdot} x λ x . f ⋅ x does have this type, a technique that goes back to Barendregt et al. [11 ] , but it is a different term from f f f . Explicit subtyping, as presented in section 2.1.1, is instead designed with specific rules for each type former, e.g. contravariance on the domain of the function.
Equality. Most systems, including those of λ R F \lambda_{RF} λ R F and μ F ⋆ \mu F^\star μ F ⋆ , restrict equality to base types, such as I n t \mathrm{Int} Int . This is sound as the refined equality coincides with the unrefined one on base types. However, it is too restrictive, as it rules out equalities between higher-order terms entirely.
In System FR equality is reduction-based , so that t ≡ u t \equiv u t ≡ u if and only if t t t and u u u reduce to a common value. This is untyped and by consequence also unrefined, but too fine-grained. For example, reduction almost always uses weak head normal form, and natural equalities at higher-order types do not hold, e.g. making { x : U n i t ∣ λ y . 1 + 2 ≡ λ y . 3 } → ⊥ \{x\!:\!\mathrm{Unit} \mid\lambda y.\,1+2 \equiv\lambda y.\,3\} \to\bot { x : Unit ∣ λ y . 1 + 2 ≡ λ y . 3 } → ⊥ inhabited. Unfortunately, such equalities arise naturally in refinement types when encoding the equivalence of terminating functional programs.
In explicit refinement types equality is the typed β η \beta\eta β η -equality of the underlying simply-typed terms; Ghalayini and Krishnaswami [30 ] already suggest moving to a semantics based on partial equivalence relations, which our model also uses.
Polymorphism. λ R F \lambda_{RF} λ R F allows the refinement of type variables, but they can only be instantiated with base types. Similarly, the calculus of System FR includes indexed types, but quantification ranges only over fully applied types. As the system of μ F ⋆ \mu F^\star μ F ⋆ is dependent, they only have predicative polymorphism: ∀ x : T y . I n t \forall x\!:\!\mathrm{Ty}.\,\mathrm{Int} ∀ x : Ty . Int is only a type at the strictly higher level than T y \mathrm{Ty} Ty , and hence it cannot be instantiated with itself. Finally, in explicit refinement types there is no polymorphism.
Inductive types. In System FR they have step-indexed inductive types, which are similar to stratified types in the sense of Jacob-Rao et al. [40 ] , but they do not have a direct analogue of positive types. In the rest of the systems there are no inductive types at all, so no direct analogue of either positive or stratified types.
Design requirements for a realizability model
The simplest models of type theories are set-theoretic: types are interpreted as sets and terms as elements of these sets [37 ] . The core features described above impose three requirements on the design of our model.
The first requirement is support for impredicative polymorphism. Set-theoretic models of impredicative polymorphism cannot exist because of size issues [57 ] , at least not within classical logic [55 ] . So our model interprets types as PERs over a fixed domain: these form a set, so type quantification can be interpreted as an intersection over them.
The second requirement is that subtyping be interpreted as inclusion. It fails in models that interpret each function type as the set of all functions between the interpretations of its domain and codomain: in such a model, subtyping between function types requires cast operations . For example, type I n t → I n t \mathrm{Int} \to\mathrm{Int} Int → Int is interpreted as the set of total functional relations R ⊆ Z × Z R \subseteq\mathbb{Z} \times\mathbb{Z} R ⊆ Z × Z . Computationally, this type is a subtype of { x : I n t ∣ x ≥ 0 } → I n t \{x\!:\!\mathrm{Int} \mid x \ge0\} \to\mathrm{Int} { x : Int ∣ x ≥ 0 } → Int . However, the latter is interpreted as the set of total functional relations R ⊆ N × Z R \subseteq\mathbb{N} \times\mathbb{Z} R ⊆ N × Z . The first set is not a subset of the second, as it contains pairs ⟨ n , m ⟩ \langle n,m\rangle ⟨ n , m ⟩ with n < 0 n < 0 n < 0 . To pass from one to the other we must cast , discarding the offending pairs. This example exhibits the general principle of coercive subtyping , which interprets each subtyping judgment as such a cast inserted at every use of subsumption [19 ] . This is unfortunate on two counts. First, the denotation of a term comes to depend not on the term alone but on the shape of its typing derivation; this is the classical coherence problem , and well-definedness can be recovered only by a theorem showing that all derivations of a judgment agree [16 , 59 ] . Second, and more seriously for us, the cast genuinely removes elements , so that the meaning of a term comes to depend on the refinements appearing in its type, and annotation-independence is lost. Interpreting subtyping as inclusion requires no casts [18 , 28 , 48 ] . This is the case in the subset model of refinement types [51 ] , where a refined type is a subset of its underlying type; our model has the same structure, with PERs in place of raw sets.
The third requirement is that the meaning of a term not depend on the refinements in its type, so that unrefined equality can observe its behavior outside them. Unrefined equality cannot be modeled in the presence of the cast operations described above: a cast removes elements from the interpretation of a functional term, and there is no way to recover them to check whether two terms are equal on their unrefined domain.
Our approach: PERs over a Scott domain
To meet these requirements, we use a model based on partial equivalence relations (PERs) over a Scott domain D \mathcal{D} D . Our terms are interpreted as elements of D \mathcal{D} D and types are interpreted as PERs over D \mathcal{D} D , so that the semantic counterpart of typing is membership in a PER rather than membership in a set, and the equality is interpreted by the relation described by the PER itself. The subtyping relation is interpreted as set inclusion between PERs, so no cast operations are needed and annotation independence holds by construction. The unrefined equality can be modeled by carefully designing the unrefined PERs so that two terms are related by unrefined equality exactly when they are identified by the unrefined interpretation of their type. Finally, the PERs offer enough structure to model impredicative polymorphism as set-theoretic intersection over the set of all PERs.
Background
This section collects the domain-theoretic preliminaries on which our model rests. We follow the standard accounts of Davey and Priestley [23 ] , Abramsky and Jung [5 ] , Gunter [33 ] , Amadio and Curien [8 ] , and Streicher [63 ] , to which we refer the reader for proofs.
Definition 1 (PER). A partial equivalence relation (PER) over a set A A A is a symmetric and transitive relation over A A A , in other words it is a set S ⊆ A × A S \subseteq A \times A S ⊆ A × A such that (i) if ⟨ a , b ⟩ ∈ S \langle a,b\rangle\in S ⟨ a , b ⟩ ∈ S then ⟨ b , a ⟩ ∈ S \langle b,a\rangle\in S ⟨ b , a ⟩ ∈ S , and (ii) if ⟨ a , b ⟩ ∈ S \langle a,b\rangle\in S ⟨ a , b ⟩ ∈ S and ⟨ b , c ⟩ ∈ S \langle b,c\rangle\in S ⟨ b , c ⟩ ∈ S then ⟨ a , c ⟩ ∈ S \langle a,c\rangle\in S ⟨ a , c ⟩ ∈ S .
Definition 2 (Domain of a PER). Given a PER S S S over A A A , its domain is the set of elements of A A A which are related to themselves, i.e. dom ( S ) = { a ∈ A ∣ ⟨ a , a ⟩ ∈ S } \operatorname{dom}(S) = \{a \in A \mid\langle a,a\rangle\in S\} dom ( S ) = { a ∈ A ∣ ⟨ a , a ⟩ ∈ S } .
Definition 3 (Diagonal PER). The diagonal PER of any set A A A is given by Δ ( A ) = { ⟨ a , a ⟩ ∣ a ∈ A } \Delta(A) = \{\langle a,a\rangle\mid a \in A\} Δ ( A ) = {⟨ a , a ⟩ ∣ a ∈ A } .
We will use the notation P E R ( A ) \mathcal{P\!E\!R}(A) P E R ( A ) to denote the set of PERs over A A A . The PER structure will be used to model types, following a long line of work that interprets types as partial equivalence relations over a domain or a combinatory algebra [1 , 7 , 20 ] : the domain of a PER gives us the membership information, while the relation itself gives us the equality relation. While the definition of a PER does not give us reflexivity, it satisfies a weaker property that we call partial reflexivity: if ⟨ a , b ⟩ ∈ S \langle a,b\rangle\in S ⟨ a , b ⟩ ∈ S then ⟨ a , a ⟩ ∈ S \langle a,a\rangle\in S ⟨ a , a ⟩ ∈ S .
Definition 4 (Pointed PER). Let A A A be a set with a distinguished element ⊥ ∈ A \bot\in A ⊥ ∈ A . A pointed PER over A A A is a PER S ∈ P E R ( A ) S \in\mathcal{P\!E\!R}(A) S ∈ P E R ( A ) such that ⟨ ⊥ , ⊥ ⟩ ∈ S \langle\bot,\bot\rangle\in S ⟨ ⊥ , ⊥ ⟩ ∈ S
The point will be used to model a nonterminating element, in the manner of Amadio [7 ] .
Theorem 3.1 (Knaster-Tarski fixed point theorem). Let ( L , ≤ ) (L,\leq) ( L , ≤ ) be a complete lattice and f : L → L f : L \to L f : L → L be a monotone function. Then the set of fixed points of f f f forms a complete lattice, and in particular there is a least fixed point lfp f = ⨆ { x ∈ L ∣ f ( x ) ≤ x } \operatorname{lfp} f = \bigsqcup\{x \in L \mid f(x) \leq x\} lfp f = ⨆ { x ∈ L ∣ f ( x ) ≤ x } and a greatest fixed point \operatorname{gfp} f = \bigsqcap\{x \in L \mid x \leq f(x)\} [65 ] .
Definition 5 (Scott domain). A Scott domain is a complete partial order that is moreover ω \omega ω -algebraic and bounded-complete. It is ω \omega ω -algebraic when every element is the directed least upper bound of the countably many compact elements below it—an element c c c is compact just if c ≤ ⨆ X c \leq\bigsqcup X c ≤ ⨆ X for a directed X X X implies c ≤ x c \leq x c ≤ x for some x ∈ X x \in X x ∈ X . It is bounded-complete when every subset that has an upper bound has a least upper bound [5 , 33 , 61 ] .
Definition 6 (Chain of projections). A chain of projections on a Scott domain D D D is an increasing family of continuous functions ( π n ) n ∈ N (\pi_n)_{n \in\mathbb{N}} ( π n ) n ∈ N , where each π n : D → D \pi_n : D \to D π n : D → D is idempotent and below the identity, with π 0 \pi_0 π 0 the constant function ⊥ \bot ⊥ , and which moreover satisfies ⨆ n π n = id \bigsqcup_n \pi_n = \operatorname{id} ⨆ n π n = id .
Given an element d ∈ D d \in D d ∈ D we define the n n n -th approximation of d d d to be d n ≔ π n ( d ) d_n \coloneqq\pi_n(d) d n : = π n ( d ) .
In the rest of this section D D D is a Scott domain equipped with a chain of projections. To model types we restrict attention to PERs that interact well with this order- and approximation structure, in the manner of the ideal and realizability models of MacQueen et al. [48 ] , Abadi and Plotkin [1 ] , and Amadio [7 ] . The uniformity condition below is the analogue for PERs of the uniform ideals.
Definition 7 (Complete, uniform, and pointed PERs).
A PER S ⊆ D × D S \subseteq D \times D S ⊆ D × D over a domain D D D is complete whenever every directed subset { ⟨ a i , b i ⟩ } i ∈ I ⊆ S \{\langle a_i,b_i\rangle\}_{i\in I} \subseteq S {⟨ a i , b i ⟩ } i ∈ I ⊆ S (with respect to the product order on D × D D \times D D × D ) has a least upper bound ⟨ ⨆ i ∈ I a i , ⨆ i ∈ I b i ⟩ \langle\bigsqcup_{i\in I} a_i,\bigsqcup_{i\in I} b_i\rangle ⟨ ⨆ i ∈ I a i , ⨆ i ∈ I b i ⟩ in S S S .
A PER S ⊆ D × D S \subseteq D \times D S ⊆ D × D over a domain D D D is uniform whenever for every ⟨ a , b ⟩ ∈ S \langle a,b\rangle\in S ⟨ a , b ⟩ ∈ S and every n ∈ N n \in\mathbb{N} n ∈ N we have ⟨ π n ( a ) , π n ( b ) ⟩ ∈ S \langle\pi_n(a),\pi_n(b)\rangle\in S ⟨ π n ( a ) , π n ( b )⟩ ∈ S .
In this paper, a CUPER is a pointed, complete, and uniform PER. We write C U P E R ( D ) \mathcal{CUPER}(D) C UP E R ( D ) for the collection of such PERs over a domain D D D .
Completeness asks that a type be closed under the directed least upper bounds of D × D D \times D D × D , so that the limits along which recursive computations converge remain within it and least fixed points can be interpreted there [7 ] . Uniformity asks instead that membership be stable under approximation: a related pair remains related at every stage π n \pi_n π n . In the presence of completeness, an element then belongs to a type exactly when all of its approximations do.
Recursive and inductive types will be interpreted as fixed points (§ 8 ). We adapt the contractive construction of Amadio [7 ] : because ⨆ n π n = i d \bigsqcup_n \pi_n = id ⨆ n π n = i d , a CUPER is determined by its approximations, and a contractive operator—one that sharpens agreement by one approximation per unfolding—has a unique fixed point.
Definition 8 (Approximation of a relation). The n n n -th approximation of a relation A ⊆ D × D A \subseteq D \times D A ⊆ D × D is its pairwise image under the n n n -th projection, A n ≜ { ⟨ π n ( v ) , π n ( w ) ⟩ ∣ ⟨ v , w ⟩ ∈ A } A_n \triangleq\{\langle\pi_n(v),\pi_n(w)\rangle\mid\langle v,w\rangle\in A\} A n ≜ {⟨ π n ( v ) , π n ( w )⟩ ∣ ⟨ v , w ⟩ ∈ A } .
Lemma 3.2 (Restriction). Let S S S be a CUPER over D D D and write D n ≜ π n ( D ) D_n \triangleq\pi_n(D) D n ≜ π n ( D ) . Then S n = S ∩ ( D n × D n ) S_n = S \cap(D_n \times D_n) S n = S ∩ ( D n × D n ) . Consequently each S n S_n S n is a pointed PER, and S j ⊆ S n S_j \subseteq S_n S j ⊆ S n whenever j ≤ n j \le n j ≤ n .
Lemma 3.3 (A CUPER is determined by its approximations). If A A A and B B B are CUPERs over D D D with A n = B n A_n = B_n A n = B n for all n n n , then A = B A = B A = B .
Definition 9 (Non-expansive and contractive operators). An operator Φ : C U P E R ( D ) → C U P E R ( D ) \Phi: \mathcal{CUPER}(D) \to\mathcal{CUPER}(D) Φ : C UP E R ( D ) → C UP E R ( D ) is non-expansive when A n = B n A_n = B_n A n = B n implies Φ ( A ) n = Φ ( B ) n \Phi(A)_n = \Phi(B)_n Φ ( A ) n = Φ ( B ) n for all n n n , and contractive when A n = B n A_n = B_n A n = B n implies Φ ( A ) n + 1 = Φ ( B ) n + 1 \Phi(A)_{n+1} = \Phi(B)_{n+1} Φ ( A ) n + 1 = Φ ( B ) n + 1 for all n n n .
Lemma 3.4 (Contractive fixed point). Every contractive operator Φ : C U P E R ( D ) → C U P E R ( D ) \Phi: \mathcal{CUPER}(D) \to\mathcal{CUPER}(D) Φ : C UP E R ( D ) → C UP E R ( D ) has a unique fixed point.
Overview of the model
The basis of our model is a Scott domain D D D , over which we will define PERs.
Definition 10. We take D D D to be the solution to the recursive domain equation
D ≅ [ D → D ] ⊕ ( D × D ) ⊕ N ⊥ ⊕ 1 ⊥ ⊕ 2 ⊥ ⊕ L ⊥ D \cong[D \to D] \oplus(D \times D) \oplus\mathbb{N}_{\perp} \oplus\mathbf{1}_{\perp} \oplus\mathbf{2}_{\perp} \oplus\mathcal{L}_{\perp} D ≅ [ D → D ] ⊕ ( D × D ) ⊕ N ⊥ ⊕ 1 ⊥ ⊕ 2 ⊥ ⊕ L ⊥ where [ D → D ] [D \to D] [ D → D ] is the domain of continuous functions, ⊕ \oplus ⊕ is the coalesced sum, × \times × is the cartesian product, and N ⊥ \mathbb{N}_{\perp} N ⊥ , 1 ⊥ \mathbf{1}_{\perp} 1 ⊥ , 2 ⊥ \mathbf{2}_{\perp} 2 ⊥ , L ⊥ \mathcal{L}_{\perp} L ⊥ are the flat domains of natural numbers, the unit, booleans, and labels.
As usual, this domain is obtained as the bilimit of the ω \omega ω -chain D i D_i D i given by
D 0 = { ⊥ } D_0 = \{\perp\} D 0 = { ⊥ }
D n + 1 = [ D n → D n ] ⊕ ( D n × D n ) ⊕ N ⊕ 1 ⊕ 2 ⊕ L ⊕ { ⊥ } D_{n+1} = [D_n \to D_n] \oplus(D_n \times D_n) \oplus\mathbb{N} \oplus\mathbf{1} \oplus\mathbf{2} \oplus\mathcal{L} \oplus\{\perp\} D n + 1 = [ D n → D n ] ⊕ ( D n × D n ) ⊕ N ⊕ 1 ⊕ 2 ⊕ L ⊕ { ⊥ }
along the embedding-projection pairs i n , m : [ D n → D m ] i_{n,m} : [D_n \to D_m] i n , m : [ D n → D m ] and j n , m : [ D m → D n ] j_{n,m} : [D_m \to D_n] j n , m : [ D m → D n ] satisfying j a ∘ i a = i d j_a \circ i_a = id j a ∘ i a = i d and i a ∘ j a ≤ i d i_a \circ j_a \le id i a ∘ j a ≤ i d [61 , 62 , 63 ] . Each constructor thus carries an embedding-retraction pair, e.g. i → : [ [ D → D ] → D ] i_{\to} : [[D \to D] \to D] i → : [[ D → D ] → D ] and r → : [ D → [ D → D ] ] r_{\to} : [D \to[D \to D]] r → : [ D → [ D → D ]] , satisfying r → ∘ i → = i d r_{\to} \circ i_{\to} = id r → ∘ i → = i d and i → ∘ r → ≤ i d i_{\to} \circ r_{\to} \le id i → ∘ r → ≤ i d , and similarly for products, N ⊥ \mathbb{N}_{\perp} N ⊥ , 1 ⊥ \mathbf{1}_{\perp} 1 ⊥ , 2 ⊥ \mathbf{2}_{\perp} 2 ⊥ , and L ⊥ \mathcal{L}_{\perp} L ⊥ . The projections of definition 6 are π n = i n ∘ j n \pi_n = i_n \circ j_n π n = i n ∘ j n , so that the n n n -th approximation of d ∈ D d \in D d ∈ D is d n = i n ( j n ( d ) ) d_n = i_n(j_n(d)) d n = i n ( j n ( d )) . They form a chain of projections on D D D : in particular ⨆ n π n = i d \bigsqcup_n \pi_n = id ⨆ n π n = i d , which follows from the minimal invariance of D D D [56 ] , namely that i d id i d is the least fixed point of e ↦ F ( e , e ) e \mapsto F(e,e) e ↦ F ( e , e ) , for F F F the functor of the domain equation.
A central feature of our model is that every type is equipped with two semantics:
The refined semantics , which interprets types as PERs over D \mathcal{D} D and respects refinements.
The unrefined semantics , which interprets types as CUPERs over D \mathcal{D} D , ignoring refinements.
Following Amadio [7 ] , the distinguished bottom element will account for non-termination and general recursive types that are present in the unrefined semantics.
The two semantics will be related by inclusion: the refined interpretation of each type will be included in its unrefined interpretation. This reflects the intuition that refinements only add logical information without changing the underlying computation. Several constructions in the model, notably function types and equality predicates, rely on the interaction between these two layers.
Since types may be indexed by terms, kinds cannot be interpreted merely as syntactic classifications. Instead, kinds will be interpreted set-theoretically as collections of PER-valued functions respecting the PER structure of their arguments. Context interpretations therefore store both term-level information and type-level information together with projections connecting the refined and unrefined worlds.
Basic system
We start by presenting the syntax of (§ 5.1 ) and semantics (§ 5.2 ) of the basis of the CIRT calculus, which is a dependent version of System F [10 , 47 ] . We prove the soundness of our semantics (Theorem 5.6 ) and consistency of the system (Corollary 2 ). Later we extend this core calculus with refinements (§ 7 ) and indexed types (§ 8 ). All theorems are stated once and proved for the complete calculus.
Syntax
Figure 1 presents the typing rules for the kinds, contexts, types, and terms of the basic system.
Kinds comprise just one base kind T y \mathsf{Ty} Ty , which classifies types. Their presence will become useful in section 7, where they are extended to include indexed kinds for types indexed by terms.
Contexts are built by extension with term variables x : τ x\mathbin{:}\tau x : τ and type variables x : κ x\mathbin{:}\kappa x : κ .
Types are constructed from type variables, base types (naturals and booleans), dependent functions, and System-F style impredicative quantification. The dependent functions are only allowed to abstract over term variables. In this section none of our base types truly exercise dependence, but we will add refinements and indexed types in sections 6 and 7.
Terms include variables, λ \lambda λ -abstraction and application, type abstraction and application, and base terms for naturals and booleans. We omit the operations on base types (arithmetic, comparisons, conditionals): they can be added as constants interpreted by continuous functions that map related arguments to related results, in both the refined and the unrefined interpretation of their type (as will be required by Theorem 5.6 ). In the application rules, u [ t / x ] u\ [t/x] u [ t / x ] denotes the capture avoiding substitution of t t t for x x x in u u u , as is usual in dependently-typed systems. Note that the terms are Curry-style terms, and do not contain type annotations.
Semantics
As mentioned in § 4 , every type has two interpretations: the unrefined semantics ⟦ – ⟧ \llbracket\text{--}\rrbracket [ [ – ] ] interprets types as CUPERs over D \mathcal{D} D , forgetting refinements. In contrast, the refined semantics ⟦ – ⟧ \llbracket\text{--}\rrbracket [ [ – ] ] interprets types as PERs over D \mathcal{D} D , retaining the logical information needed by refinements and indexed types. Both are defined by mutual induction on typing derivations. In summary:
Contexts are interpreted as PERs over refined or unrefined environments.
Kinds are interpreted as dependent PERs families in ⟦ – ⟧ \llbracket\text{--}\rrbracket [ [ – ] ] and as the constant CUPER family in ⟦ – ⟧ \llbracket\text{--}\rrbracket [ [ – ] ] .
Basic system
Figure 1. Typing rules of basic CIRT.
Types are interpreted as context-indexed PERs in ⟦ − ⟧ \llbracket- \rrbracket [ [ − ] ] and context-indexed CUPERs in ⌊ ⌊ − ⌋ ⌋ \lfloor\lfloor- \rfloor\rfloor ⌊⌊ − ⌋⌋ . Terms have only one interpretation, viz. as elements of D \mathcal{D} D . It is defined (in § 6.0.4 ) by induction on the raw syntax of Curry-style terms and is denoted by ( ( − ) ) (( - )) (( − )) . Concretely, for each context Γ \Gamma Γ such that t t t is typed, the interpretation of t t t has the following signature:
( ( t ) ) ( − ) : ( ( ⊢ Γ c t x ) ) → D ((t))(-) : ((\vdash\Gamma\ \mathrm{ctx})) \to\mathcal{D} (( t )) ( − ) : (( ⊢ Γ ctx )) → D
where ( ( ⊢ Γ c t x ) ) ((\vdash\Gamma\ \mathrm{ctx})) (( ⊢ Γ ctx )) is the set of runtime environments determined by Γ \Gamma Γ , which only contain values:
( ( ⊢ ⋅ c t x ) ) ≜ 1 , ( ( ⊢ Γ , x : τ c t x ) ) ≜ ( ( ⊢ Γ c t x ) ) × D , ( ( ⊢ Γ , x : κ c t x ) ) ≜ ( ( ⊢ Γ c t x ) ) ((\vdash\cdot\ \mathrm{ctx})) \triangleq1,\qquad((\vdash\Gamma, x:\tau\ \mathrm{ctx})) \triangleq((\vdash\Gamma\ \mathrm{ctx})) \times\mathcal{D},\qquad((\vdash\Gamma, x:\kappa\ \mathrm{ctx})) \triangleq((\vdash\Gamma\ \mathrm{ctx})) (( ⊢ ⋅ ctx )) ≜ 1 , (( ⊢ Γ , x : τ ctx )) ≜ (( ⊢ Γ ctx )) × D , (( ⊢ Γ , x : κ ctx )) ≜ (( ⊢ Γ ctx ))
Notation: In the rest of the paper, we use the ∥ ∥ \Vert\Vert ∥∥ delimiter to mark the definitions of interpretations. We keep this carrier separate because terms are Curry-style: their raw denotation is independent of typing derivations. Later we will equip runtime environments with a PER ∥ Γ ∥ ( − ) \Vert\Gamma\Vert(-) ∥Γ∥ ( − ) , which we use to state type soundness: for any r , r ′ ∈ ( ( ⊢ Γ c t x ) ) r,r' \in((\vdash\Gamma\ \mathrm{ctx})) r , r ′ ∈ (( ⊢ Γ ctx )) ,
Γ ⊢ t : τ , γ ∈ dom ( ⌊ ⌊ ⊢ Γ c t x ⌋ ⌋ ) , ⟨ r , r ′ ⟩ ∈ ∥ Γ ∥ ( γ ) ⟹ ⟨ ( ( t ) ) ( r ) , ( ( t ) ) ( r ′ ) ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : T y ⌋ ⌋ ( γ ) . \Gamma\vdash t:\tau,\quad\gamma\in\operatorname{dom}(\lfloor\lfloor\vdash\Gamma\ \mathrm{ctx}\rfloor\rfloor),\quad\langle r,r'\rangle\in\Vert\Gamma\Vert(\gamma)\quad\Longrightarrow\quad\langle((t))(r),((t))(r')\rangle\in\lfloor\lfloor\Gamma\vdash\tau:\mathrm{Ty}\rfloor\rfloor(\gamma). Γ ⊢ t : τ , γ ∈ dom (⌊⌊ ⊢ Γ ctx ⌋⌋) , ⟨ r , r ′ ⟩ ∈ ∥Γ∥ ( γ ) ⟹ ⟨(( t )) ( r ) , (( t )) ( r ′ )⟩ ∈ ⌊⌊ Γ ⊢ τ : Ty ⌋⌋ ( γ ) .
Thus the two type semantics constrain the same ‘runtime’ computations.
This distinction also appears in contexts. The unrefined context semantics keeps type-variable assignments, but does not store term-variable values. This reflects that unrefined type interpretation erases term dependency. The refined context semantics keeps term assignments, since refinements and indexed types may depend on them.
Contexts
In the (un)refined semantics contexts are interpreted as PERs over environments . The empty context is interpreted as the diagonal PER on the empty environment, i.e. the singleton:
\left\llbracket\cdot\vdash\cdot\ \mathrm{ctx}\right\rrbracket\triangleq\Delta(\mathbb{1}) \qquad\left\llbracket\cdot\vdash\cdot\ \mathrm{ctx}\right\rrbracket\triangleq\Delta(\mathbb{1})
Context extension by a term variable is interpreted as the usual dependent sum in the refined interpretation, whereas it is silently dropped in the unrefined one:
\left\llbracket\vdash\Gamma, x:T_{\tau}\ \mathrm{ctx}\right\rrbracket\triangleq\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket
\left\llbracket\vdash\Gamma, x:T_{\tau}\ \mathrm{ctx}\right\rrbracket\triangleq\left\{\left\langle\left\langle\gamma,v\right\rangle,\left\langle\delta,w\right\rangle\right\rangle\mathrel{\middle|} \left\langle\gamma,\delta\right\rangle\in\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket,\ \left\langle v,w\right\rangle\in\left\llbracket\Gamma\vdash\tau:\mathrm{Ty}\right\rrbracket(\gamma)\right\}
This distinction captures the fact that the computational behaviour of this calculus is actually not dependent at all and that the refinement types exercise dependence only on the logical level.
Finally, extending a context with a type variable in the unrefined semantics simply stores an environment compatible with the interpretation of the kind.
\left\llbracket\vdash\Gamma, X:\kappa\ \mathrm{ctx}\right\rrbracket\triangleq\left\{\left\langle\left\langle\gamma,P\right\rangle,\left\langle\delta,P\right\rangle\right\rangle\mathrel{\middle|} \left\langle\gamma,\delta\right\rangle\in\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket,\ P \in\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(\gamma)\right\}
The refined semantics must also determine the compatible unrefined environment. Thus, a type-variable extension stores both a refined kind element and an unrefined over-approximation of the same type variable; the former belongs to the refined interpretation of the kind, while the latter belongs to the unrefined one.
\left\llbracket\vdash\Gamma, X:\kappa\ \mathrm{ctx}\right\rrbracket\triangleq\left\{\left\langle\left\langle\gamma,\left\langle P,P_{\bot}\right\rangle\right\rangle,\left\langle\delta,\left\langle P,P_{\bot}\right\rangle\right\rangle\right\rangle\mathrel{\middle|} \begin{aligned} &\left\langle\gamma,\delta\right\rangle\in\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket,\ P \in\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(\gamma),\\ &P_{\bot} \in\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(\iota_{\Gamma}(\gamma)),\ \pi_{\Gamma;\kappa}(\gamma,P) \subseteq P_{\bot}\end{aligned}\right\}
The function ι Γ ( − ) \iota_{\Gamma}(-) ι Γ ( − ) is a context projection operation, which maps each refined environment to its unrefined version. Given a context ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx it is defined by induction on Γ \Gamma Γ as follows:
\iota_{\Gamma}(-):\operatorname{dom}\left(\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket\right)\to\operatorname{dom}\left(\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket\right)
ι ⋅ ( ⋆ ) ≜ ⋆ ι Γ , x : T τ ( ⟨ γ , v ⟩ ) ≜ ι Γ ( γ ) ι Γ , X : κ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) ≜ ⟨ ι Γ ( γ ) , P ⊥ ⟩ \iota_{\cdot}(\star)\triangleq\star\qquad\iota_{\Gamma,x:T_{\tau}}\left(\left\langle\gamma,v\right\rangle\right)\triangleq\iota_{\Gamma}(\gamma) \qquad\iota_{\Gamma,X:\kappa}\left(\left\langle\gamma,\left\langle P,P_{\bot}\right\rangle\right\rangle\right)\triangleq\left\langle\iota_{\Gamma}(\gamma),P_{\bot}\right\rangle ι ⋅ ( ⋆ ) ≜ ⋆ ι Γ , x : T τ ( ⟨ γ , v ⟩ ) ≜ ι Γ ( γ ) ι Γ , X : κ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) ≜ ⟨ ι Γ ( γ ) , P ⊥ ⟩
The empty context is projected to the empty context; values are removed; and a (refined, unrefined) pair of PERs is mapped to the unrefined PER. It satisfies the expected compatibility condition:
\left\langle\gamma,\delta\right\rangle\in\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket\Longrightarrow\left\langle\iota_{\Gamma}(\gamma),\iota_{\Gamma}(\delta)\right\rangle\in\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket.
Definition 11 (Type projection). The companion type projection π Γ ; κ ( − , − ) \pi_{\Gamma;\kappa}(-,-) π Γ ; κ ( − , − ) extracts the underlying relation on D D D from a refined type interpretation, so that it can be compared with an unrefined interpretation. In the basic system there is only the kind T y \mathrm{Ty} Ty , so the projection is just the identity:
\pi_{\Gamma;\kappa}(-,-):(\gamma:\operatorname{dom}(\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket))\to\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(\gamma)\to\mathcal{P}(D\times D)
π Γ ; T y ( γ , P ) ≜ P \pi_{\Gamma;\mathrm{Ty}}(\gamma,P)\triangleq P π Γ ; Ty ( γ , P ) ≜ P For the base kind T y \mathrm{Ty} Ty the projection is the identity, so its value is in fact a PER.
Kinds
Kinds are interpreted as families of PERs in the refined semantics and as constant families of CUPERs in the unrefined semantics. Since D \mathcal{D} D is a set, the PERs over it form a set P & R ( D ) \mathcal{P\&R}(\mathcal{D}) P & R ( D ) , which is a complete lattice under inclusion, and the CUPERs form a subset C U P & R ( D ) \mathcal{CUP\&R}(\mathcal{D}) C UP & R ( D ) of it.
The semantics of kinds takes as argument an environment and returns the set of all possible interpretations of types of that kind in that context:
\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(-):\operatorname{dom}\left(\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket\right)\to\mathrm{Set}
\qquad
\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(-):\operatorname{dom}\left(\left\llbracket\vdash\Gamma\ \mathrm{ctx}\right\rrbracket\right)\to\mathrm{Set}
For the base kind this is just all PERs and CUPERs respectively:
\left\llbracket\Gamma\vdash\mathrm{Ty}:\mathrm{Kd}\right\rrbracket(\gamma)\triangleq\mathcal{P\&R}(\mathcal{D})
\qquad
\left\llbracket\Gamma\vdash\mathrm{Ty}:\mathrm{Kd}\right\rrbracket(\gamma)\triangleq\mathcal{CUP\&R}(\mathcal{D})
The PERs and CUPERs are meant to be a notion of equality between realizers. We can show that this semantics respects this notion of equality, mapping related environments to related kinds:
Theorem 5.1 (Kinds respect PERs). Let Γ ⊢ Γ c t x \Gamma\vdash\Gamma\ \mathrm{ctx} Γ ⊢ Γ ctx and Γ ⊢ κ : K d \Gamma\vdash\kappa\colon\mathrm{Kd} Γ ⊢ κ : Kd . Then:
(i) Refined: If ⟨ γ , δ ⟩ ∈ ⟦ ⊢ Γ c t x ⟧ \langle\gamma,\delta\rangle\in\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket ⟨ γ , δ ⟩ ∈ [ [ ⊢ Γ ctx ] ] , then ⟦ Γ ⊢ κ : K d ⟧ ( γ ) = ⟦ Γ ⊢ κ : K d ⟧ ( δ ) \llbracket\Gamma\vdash\kappa\colon\mathrm{Kd}\rrbracket(\gamma)=\llbracket\Gamma\vdash\kappa\colon\mathrm{Kd}\rrbracket(\delta) [ [ Γ ⊢ κ : Kd ] ] ( γ ) = [ [ Γ ⊢ κ : Kd ] ] ( δ ) .
(ii) Unrefined: If ⟨ γ , δ ⟩ ∈ ⌊ ⌊ ⊢ Γ c t x ⌋ ⌋ \langle\gamma,\delta\rangle\in\lfloor\!\lfloor\vdash\Gamma\ \mathrm{ctx}\rfloor\!\rfloor ⟨ γ , δ ⟩ ∈ ⌊ ⌊ ⊢ Γ ctx ⌋ ⌋ , then ⌊ ⌊ Γ ⊢ κ : K d ⌋ ⌋ ( γ ) = ⌊ ⌊ Γ ⊢ κ : K d ⌋ ⌋ ( δ ) \lfloor\!\lfloor\Gamma\vdash\kappa\colon\mathrm{Kd}\rfloor\!\rfloor(\gamma)=\lfloor\!\lfloor\Gamma\vdash\kappa\colon\mathrm{Kd}\rfloor\!\rfloor(\delta) ⌊ ⌊ Γ ⊢ κ : Kd ⌋ ⌋ ( γ ) = ⌊ ⌊ Γ ⊢ κ : Kd ⌋ ⌋ ( δ ) .
One of our goals is to prove that the refined interpretation of types is included in the unrefined one, but we first define how we relate them. The type projection of definition 11 maps a refined interpretation at a kind to the relation over D \mathcal{D} D that it determines. Since C U P E R ( D ) \mathcal{CUPER}(\mathcal{D}) C UP E R ( D ) are relations over D \mathcal{D} D , this lets us ask whether a refined interpretation is included in an unrefined one.
Types
Types. Types are interpreted as dependent functions or sections over those families: they map environments to an element of the appropriate kind:
⟦ Γ ⊢ τ : κ ⟧ ( − ) : ( γ : dom ( ⟦ ⊢ Γ c t x ⟧ ) ) → ⟦ Γ ⊢ κ : K d ⟧ ( γ ) \llbracket\Gamma\vdash\tau\colon\kappa\rrbracket(-)\colon(\gamma:\operatorname{dom}(\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket))\to\llbracket\Gamma\vdash\kappa\colon\mathrm{Kd}\rrbracket(\gamma) [ [ Γ ⊢ τ : κ ] ] ( − ) : ( γ : dom ( [ [ ⊢ Γ ctx ] ] )) → [ [ Γ ⊢ κ : Kd ] ] ( γ )
⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( − ) : ( γ : dom ( ⌊ ⌊ ⊢ Γ c t x ⌋ ⌋ ) ) → ⌊ ⌊ Γ ⊢ κ : K d ⌋ ⌋ ( γ ) \lfloor\!\lfloor\Gamma\vdash\tau\colon\kappa\rfloor\!\rfloor(-)\colon(\gamma:\operatorname{dom}(\lfloor\!\lfloor\vdash\Gamma\ \mathrm{ctx}\rfloor\!\rfloor))\to\lfloor\!\lfloor\Gamma\vdash\kappa\colon\mathrm{Kd}\rfloor\!\rfloor(\gamma) ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( − ) : ( γ : dom (⌊ ⌊ ⊢ Γ ctx ⌋ ⌋)) → ⌊ ⌊ Γ ⊢ κ : Kd ⌋ ⌋ ( γ )
Base types are interpreted as the PERs over D \mathcal{D} D that relate exactly the elements of D \mathcal{D} D that correspond to the values of the type.
⟦ Γ ⊢ N a t : T y ⟧ ( γ ) ≜ { ⟨ i N ( n ) , i N ( n ) ⟩ ∣ n ∈ N } ⟦ Γ ⊢ B o o l : T y ⟧ ( γ ) ≜ { ⟨ i 2 ( b ) , i 2 ( b ) ⟩ ∣ b ∈ 2 } \llbracket\Gamma\vdash\mathrm{Nat}\colon\mathrm{Ty}\rrbracket(\gamma)\mathrel{\triangleq}\{\langle i_{\mathbb{N}}(n),i_{\mathbb{N}}(n)\rangle\mid n\in\mathbb{N}\}
\qquad
\llbracket\Gamma\vdash\mathrm{Bool}\colon\mathrm{Ty}\rrbracket(\gamma)\mathrel{\triangleq}\{\langle i_{2}(b),i_{2}(b)\rangle\mid b\in2\} [ [ Γ ⊢ Nat : Ty ] ] ( γ ) ≜ {⟨ i N ( n ) , i N ( n )⟩ ∣ n ∈ N } [ [ Γ ⊢ Bool : Ty ] ] ( γ ) ≜ {⟨ i 2 ( b ) , i 2 ( b )⟩ ∣ b ∈ 2 }
where B \mathcal{B} B ranges over the base sets N \mathbb{N} N , 1 1 1 , 2 2 2 , and L \mathcal{L} L , and i B ( v ) i_{\mathcal{B}}(v) i B ( v ) denotes the continuous embedding of v ∈ B v\in\mathcal{B} v ∈ B into the domain D \mathcal{D} D (per definition 10).
The unrefined interpretation extends the basic PERs by adding the pair ⟨ ⊥ , ⊥ ⟩ \langle\perp,\perp\rangle ⟨ ⊥ , ⊥ ⟩ :
⌊ ⌊ Γ ⊢ N a t : T y ⌋ ⌋ ( γ ) ≜ { ⟨ i N ( n ) , i N ( n ) ⟩ ∣ n ∈ N } ∪ { ⟨ ⊥ , ⊥ ⟩ } \lfloor\!\lfloor\Gamma\vdash\mathrm{Nat}\colon\mathrm{Ty}\rfloor\!\rfloor(\gamma)\mathrel{\triangleq}\{\langle i_{\mathbb{N}}(n),i_{\mathbb{N}}(n)\rangle\mid n\in\mathbb{N}\}\cup\{\langle\perp,\perp\rangle\} ⌊ ⌊ Γ ⊢ Nat : Ty ⌋ ⌋ ( γ ) ≜ {⟨ i N ( n ) , i N ( n )⟩ ∣ n ∈ N } ∪ {⟨ ⊥ , ⊥ ⟩}
⌊ ⌊ Γ ⊢ B o o l : T y ⌋ ⌋ ( γ ) ≜ { ⟨ i 2 ( b ) , i 2 ( b ) ⟩ ∣ b ∈ 2 } ∪ { ⟨ ⊥ , ⊥ ⟩ } \lfloor\!\lfloor\Gamma\vdash\mathrm{Bool}\colon\mathrm{Ty}\rfloor\!\rfloor(\gamma)\mathrel{\triangleq}\{\langle i_{2}(b),i_{2}(b)\rangle\mid b\in2\}\cup\{\langle\perp,\perp\rangle\} ⌊ ⌊ Γ ⊢ Bool : Ty ⌋ ⌋ ( γ ) ≜ {⟨ i 2 ( b ) , i 2 ( b )⟩ ∣ b ∈ 2 } ∪ {⟨ ⊥ , ⊥ ⟩}
Since basic types are flat domains in the domain equation that describes D \mathcal{D} D , adding the pair ⟨ ⊥ , ⊥ ⟩ \langle\perp,\perp\rangle ⟨ ⊥ , ⊥ ⟩ is enough to obtain pointedness, completeness and uniformity.
Function types have a more interesting interpretation, as they relate functions that are ‘extensionally’ equal, i.e. map related arguments to related outputs. In the unrefined case:
⌊ ⌊ Γ ⊢ ( x : τ ) → σ : T y ⌋ ⌋ ( γ ) ≜ { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : T y ⌋ ⌋ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⌊ ⌊ Γ , x : τ ⊢ σ : T y ⌋ ⌋ ( γ ) } \lfloor\!\lfloor\Gamma\vdash(x\colon\tau)\to\sigma\colon\mathrm{Ty}\rfloor\!\rfloor(\gamma)\mathrel{\triangleq}\{\langle f,g\rangle\mid\forall\langle v,w\rangle\in\lfloor\!\lfloor\Gamma\vdash\tau\colon\mathrm{Ty}\rfloor\!\rfloor(\gamma).\langle f\mathbin{\cdot}v,g\mathbin{\cdot}w\rangle\in\lfloor\!\lfloor\Gamma,x\colon\tau\vdash\sigma\colon\mathrm{Ty}\rfloor\!\rfloor(\gamma)\} ⌊ ⌊ Γ ⊢ ( x : τ ) → σ : Ty ⌋ ⌋ ( γ ) ≜ {⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : Ty ⌋ ⌋ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⌊ ⌊ Γ , x : τ ⊢ σ : Ty ⌋ ⌋ ( γ )}
One would naïvely expect the refined interpretation to mimic the unrefined one, replacing ⌊ ⌊ − ⌋ ⌋ \lfloor\!\lfloor-\rfloor\!\rfloor ⌊ ⌊ − ⌋ ⌋ with ⟦ − ⟧ \llbracket-\rrbracket [ [ − ] ] . However, this would equate functions whose domains have been restricted by refinements. If the refined function PER ignored the unrefined behavior, it would be impossible to prove that the refined interpretation is included in the unrefined one (per theorem 5.4), as it would equate functions that are not related in the unrefined interpretation. Hence, we impose in the refined interpretation the extra condition ( i i ) (ii) ( ii ) below that ensures compatibility with the unrefined interpretation:
⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( γ ) ≜ { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ⟨ γ , v ⟩ ) ( i ) ∧ ∀ ⟨ v 1 , w 1 ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( i Γ ( γ ) ) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( i Γ ( γ ) ) ( i i ) } \llbracket\Gamma\vdash(x\colon\tau)\to\sigma\colon\mathrm{Ty}\rrbracket(\gamma)
\mathrel{\triangleq}
\{\langle f,g\rangle\mid
\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau\colon\mathrm{Ty}\rrbracket(\gamma).\langle f\mathbin{\cdot}v,g\mathbin{\cdot}w\rangle\in\llbracket\Gamma,x\colon\tau\vdash\sigma\colon\mathrm{Ty}\rrbracket(\langle\gamma,v\rangle)\ (i)
\land
\forall\langle v_1,w_1\rangle\in\llbracket\Gamma\vdash\tau\colon\mathrm{Ty}\rrbracket(i_{\Gamma}(\gamma)).\langle f\mathbin{\cdot}v_1,g\mathbin{\cdot}w_1\rangle\in\llbracket\Gamma,x\colon\tau\vdash\sigma\colon\mathrm{Ty}\rrbracket(i_{\Gamma}(\gamma))\ (ii)
\} [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( γ ) ≜ {⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] (⟨ γ , v ⟩) ( i ) ∧ ∀ ⟨ v 1 , w 1 ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( i Γ ( γ )) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( i Γ ( γ )) ( ii )}
The unrefined relatedness condition also excludes semantic functions that do not correspond to any term that is well typed in the underlying type system. For example consider a function that returns values of different types depending on the input. Concretely f ( 0 ) = 0 f(0)=0 f ( 0 ) = 0 and f ( n ) = t r u e f(n)=\mathrm{true} f ( n ) = true for n ≥ 1 n\geq1 n ≥ 1 . f f f is not in the refined interpretation of the type { x : N a t ∣ x ≥ 1 } → B o o l \{x\colon\mathrm{Nat}\mid x\geq1\}\to\mathrm{Bool} { x : Nat ∣ x ≥ 1 } → Bool even though it satisfies the refined condition because it violates the unrefined relatedness condition.
Type Quantification. Impredicative type quantification is interpreted by intersection over all candidates in the interpretation of the quantified kind. In the unrefined case, when κ = T y \kappa= \mathrm{Ty} κ = Ty , it is defined to be the intersection over all CUPERs.
⌊ ⌊ Γ ⊢ ∀ x : κ . τ : T y ⌋ ⌋ ( γ ) ≜ { ⟨ v , w ⟩ | ∀ P ∈ ⌊ ⌊ Γ ⊢ κ : K d ⌋ ⌋ ( γ ) . ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ , x : κ κ ⊢ τ : T y ⌋ ⌋ ( ⟨ γ , P ⟩ ) } \left\lfloor\!\left\lfloor\Gamma\vdash\forall x\!:\!\kappa.\ \tau\!:\!\mathrm{Ty}\right\rfloor\!\right\rfloor(\gamma) \triangleq\left\{\langle v,w\rangle\mathrel{\middle|} \forall P \in\left\lfloor\!\left\lfloor\Gamma\vdash\kappa\!:\!\mathrm{Kd}\right\rfloor\!\right\rfloor(\gamma).\ \langle v,w\rangle\in\left\lfloor\!\left\lfloor\Gamma,x\!:\!_{\kappa}\kappa\vdash\tau\!:\!\mathrm{Ty}\right\rfloor\!\right\rfloor(\langle\gamma,P\rangle)\right\} ⌊ ⌊ Γ ⊢ ∀ x : κ . τ : Ty ⌋ ⌋ ( γ ) ≜ { ⟨ v , w ⟩ ∀ P ∈ ⌊ ⌊ Γ ⊢ κ : Kd ⌋ ⌋ ( γ ) . ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ , x : κ κ ⊢ τ : Ty ⌋ ⌋ (⟨ γ , P ⟩) }
For example, in the unrefined interpretation, an element belongs to the polymorphic identity type ∀ x : T y . x → x \forall x\!:\!\mathrm{Ty}.\ x \to x ∀ x : Ty . x → x exactly when it behaves as an identity function (or one of its approximations π n ( i d ) \pi_n(id) π n ( i d ) ) for every CUPER chosen as the interpretation of x x x .
The refined interpretation follows the all-PER reading of System F [58 ] , but adds a compatibility constraint between the refined candidates and their unrefined over-approximations.
⟦ Γ ⊢ ∀ x : κ . τ : T y ⟧ ( γ ) ≜ { ⟨ v , w ⟩ | ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) , ∀ P ⊥ ∈ ⌊ ⌊ Γ ⊢ κ : K d ⌋ ⌋ ( ι Γ ( γ ) ) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) } \llbracket\Gamma\vdash\forall x\!:\!\kappa.\ \tau\!:\!\mathrm{Ty}\rrbracket(\gamma) \triangleq\left\{\langle v,w\rangle\mathrel{\middle|} \begin{aligned} &\forall P \in\llbracket\Gamma\vdash\kappa\!:\!\mathrm{Kd}\rrbracket(\gamma),\ \forall P_{\perp} \in\left\lfloor\!\left\lfloor\Gamma\vdash\kappa\!:\!\mathrm{Kd}\right\rfloor\!\right\rfloor(\iota_{\Gamma}(\gamma))\\ &\pi_{\Gamma;\kappa}(\gamma,P) \subseteq P_{\perp} \Rightarrow\langle v,w\rangle\in\llbracket\Gamma,x\!:\!_{\kappa}\kappa\vdash\tau\!:\!\mathrm{Ty}\rrbracket(\langle\gamma,\langle P,P_{\perp}\rangle\rangle)\end{aligned}\right\} [ [ Γ ⊢ ∀ x : κ . τ : Ty ] ] ( γ ) ≜ { ⟨ v , w ⟩ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) , ∀ P ⊥ ∈ ⌊ ⌊ Γ ⊢ κ : Kd ⌋ ⌋ ( ι Γ ( γ )) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ [ [ Γ , x : κ κ ⊢ τ : Ty ] ] (⟨ γ , ⟨ P , P ⊥ ⟩⟩) }
Type variables are interpreted by lookup in the context interpretation; while in the refined semantics the refined component is projected:
⟦ Γ ⊢ x : κ ⟧ ( γ ) ≜ P where γ ( x ) = ⟨ P , P ⊥ ⟩ ⌊ ⌊ Γ ⊢ x : κ ⌋ ⌋ ( γ ) ≜ P where γ ( x ) = P \llbracket\Gamma\vdash x\!:\!\kappa\rrbracket(\gamma) \triangleq P \quad\text{where } \gamma(x)=\langle P,P_{\perp}\rangle
\qquad
\left\lfloor\!\left\lfloor\Gamma\vdash x\!:\!\kappa\right\rfloor\!\right\rfloor(\gamma) \triangleq P \quad\text{where } \gamma(x)=P [ [ Γ ⊢ x : κ ] ] ( γ ) ≜ P where γ ( x ) = ⟨ P , P ⊥ ⟩ ⌊ ⌊ Γ ⊢ x : κ ⌋ ⌋ ( γ ) ≜ P where γ ( x ) = P
In both semantics, the interpretation of types belongs to the interpretation of their kind:
Theorem 5.2 (Type interpretation is well-formed). Let ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx , Γ ⊢ κ : K d \Gamma\vdash\kappa\!:\!\mathrm{Kd} Γ ⊢ κ : Kd , Γ ⊢ τ : κ \Gamma\vdash\tau\!:\!\kappa Γ ⊢ τ : κ be well-formed context, kind, and type judgments then:
(i) Refined: If γ ∈ dom ( ⟦ ⊢ Γ c t x ⟧ ) \gamma\in\operatorname{dom}(\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket) γ ∈ dom ( [ [ ⊢ Γ ctx ] ] ) , then ⟦ Γ ⊢ τ : κ ⟧ ( γ ) ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) \llbracket\Gamma\vdash\tau\!:\!\kappa\rrbracket(\gamma) \in\llbracket\Gamma\vdash\kappa\!:\!\mathrm{Kd}\rrbracket(\gamma) [ [ Γ ⊢ τ : κ ] ] ( γ ) ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) .
(ii) Unrefined: If γ ∈ dom ( ⌊ ⌊ ⊢ Γ c t x ⌋ ⌋ ) \gamma\in\operatorname{dom}(\left\lfloor\!\left\lfloor\vdash\Gamma\ \mathrm{ctx}\right\rfloor\!\right\rfloor) γ ∈ dom ( ⌊ ⌊ ⊢ Γ ctx ⌋ ⌋ ) , then ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( γ ) ∈ ⌊ ⌊ Γ ⊢ κ : K d ⌋ ⌋ ( γ ) \left\lfloor\!\left\lfloor\Gamma\vdash\tau\!:\!\kappa\right\rfloor\!\right\rfloor(\gamma) \in\left\lfloor\!\left\lfloor\Gamma\vdash\kappa\!:\!\mathrm{Kd}\right\rfloor\!\right\rfloor(\gamma) ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( γ ) ∈ ⌊ ⌊ Γ ⊢ κ : Kd ⌋ ⌋ ( γ ) .
Following the same reasoning behind Theorem 5.1, the semantics respects the notion of equality, since equal contexts map to equal interpretations of types.
Theorem 5.3 (Types respect PERs). Let ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx , Γ ⊢ κ : K d \Gamma\vdash\kappa\!:\!\mathrm{Kd} Γ ⊢ κ : Kd , Γ ⊢ τ : κ \Gamma\vdash\tau\!:\!\kappa Γ ⊢ τ : κ be well-formed context, kind, and type judgments, then:
(i) Refined: If ⟨ γ , δ ⟩ ∈ ⟦ ⊢ Γ c t x ⟧ \langle\gamma,\delta\rangle\in\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket ⟨ γ , δ ⟩ ∈ [ [ ⊢ Γ ctx ] ] , then ⟦ Γ ⊢ τ : κ ⟧ ( γ ) = ⟦ Γ ⊢ τ : κ ⟧ ( δ ) \llbracket\Gamma\vdash\tau\!:\!\kappa\rrbracket(\gamma)=\llbracket\Gamma\vdash\tau\!:\!\kappa\rrbracket(\delta) [ [ Γ ⊢ τ : κ ] ] ( γ ) = [ [ Γ ⊢ τ : κ ] ] ( δ ) .
(ii) Unrefined: If ⟨ γ , δ ⟩ ∈ ⌊ ⌊ ⊢ Γ c t x ⌋ ⌋ \langle\gamma,\delta\rangle\in\left\lfloor\!\left\lfloor\vdash\Gamma\ \mathrm{ctx}\right\rfloor\!\right\rfloor ⟨ γ , δ ⟩ ∈ ⌊ ⌊ ⊢ Γ ctx ⌋ ⌋ , then ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( γ ) = ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( δ ) \left\lfloor\!\left\lfloor\Gamma\vdash\tau\!:\!\kappa\right\rfloor\!\right\rfloor(\gamma)=\left\lfloor\!\left\lfloor\Gamma\vdash\tau\!:\!\kappa\right\rfloor\!\right\rfloor(\delta) ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( γ ) = ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( δ ) .
Last, we prove that indeed the refined interpretation of types is included in the unrefined one, since in general kinds are interpreted as families of PERs, where the type projection operation is used to relate the two interpretations.
Theorem 5.4 (Refined interpretation included in unrefined interpretation). Let ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx , Γ ⊢ τ : κ \Gamma\vdash\tau\!:\!\kappa Γ ⊢ τ : κ be well-formed context and type judgments, and γ ∈ dom ( ⟦ ⊢ Γ c t x ⟧ ) \gamma\in\operatorname{dom}(\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket) γ ∈ dom ( [ [ ⊢ Γ ctx ] ] ) , then
π Γ ; κ ( γ , ⟦ Γ ⊢ τ : κ ⟧ ( γ ) ) ⊆ ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( ι Γ ( γ ) ) \pi_{\Gamma;\kappa}\left(\gamma,\llbracket\Gamma\vdash\tau\!:\!\kappa\rrbracket(\gamma)\right) \subseteq\left\lfloor\!\left\lfloor\Gamma\vdash\tau\!:\!\kappa\right\rfloor\!\right\rfloor(\iota_{\Gamma}(\gamma)) π Γ ; κ ( γ , [ [ Γ ⊢ τ : κ ] ] ( γ ) ) ⊆ ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( ι Γ ( γ ))
As a corollary, unrefined equality is invariant under replacement by refined-equal representatives. In other words, although the unrefined interpretation of a type may relate more pairs than the refined interpretation, the unrefined equality test is well-defined on refined equivalence classes. This follows from the inclusion above and symmetry and transitivity of the unrefined PER.
Corollary 1 (Unrefined equality respects refined equality). Let ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx be a well-formed context, let Γ ⊢ τ : T y \Gamma\vdash\tau\!:\!\mathrm{Ty} Γ ⊢ τ : Ty be a well-formed type, and let γ ∈ dom ( ⟦ ⊢ Γ c t x ⟧ ) \gamma\in\operatorname{dom}(\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket) γ ∈ dom ( [ [ ⊢ Γ ctx ] ] ) . If ⟨ v , v ′ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle v,v'\rangle\in\llbracket\Gamma\vdash\tau\!:\!\mathrm{Ty}\rrbracket(\gamma) ⟨ v , v ′ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) and ⟨ w , w ′ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle w,w'\rangle\in\llbracket\Gamma\vdash\tau\!:\!\mathrm{Ty}\rrbracket(\gamma) ⟨ w , w ′ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) , then
⟨ v , w ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : T y ⌋ ⌋ ( ι Γ ( γ ) ) ⟺ ⟨ v ′ , w ′ ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : T y ⌋ ⌋ ( ι Γ ( γ ) ) . \langle v,w\rangle\in\left\lfloor\!\left\lfloor\Gamma\vdash\tau\!:\!\mathrm{Ty}\right\rfloor\!\right\rfloor(\iota_{\Gamma}(\gamma)) \Longleftrightarrow\langle v',w'\rangle\in\left\lfloor\!\left\lfloor\Gamma\vdash\tau\!:\!\mathrm{Ty}\right\rfloor\!\right\rfloor(\iota_{\Gamma}(\gamma)). ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : Ty ⌋ ⌋ ( ι Γ ( γ )) ⟺ ⟨ v ′ , w ′ ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : Ty ⌋ ⌋ ( ι Γ ( γ )) .
Terms
Terms are interpreted directly as elements of D \mathcal{D} D . The interpretation is defined on raw terms rather than on typing derivations and depends only on the assignment of term variables. Type assignments are therefore erased via a runtime projection. This exemplifies the fact that the semantics is annotation independent as neither typing judgment, derivation nor type annotations can influence the interpretation of terms.
To begin, we define a function that projects away all the type assignments from a context interpretation, keeping only the term assignments.
Definition 12 (Runtime Projection). Let ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx . We define runtime projection from refined environments into runtime environments by induction on Γ \Gamma Γ :
ρ Γ ( − ) : dom ( ⟦ ⊢ Γ c t x ⟧ ) → ( ⊢ Γ c t x ) \rho_{\Gamma}(-) : \operatorname{dom}(\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket) \to(\vdash\Gamma\ \mathrm{ctx}) ρ Γ ( − ) : dom ( [ [ ⊢ Γ ctx ] ] ) → ( ⊢ Γ ctx ) ρ ⋅ ( ⋆ ) ≔ ⋆ ρ Γ , x : τ ( ⟨ γ , v ⟩ ) ≔ ⟨ ρ Γ ( γ ) , v ⟩ ρ Γ , x : κ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) ≔ ρ Γ ( γ ) \begin{aligned}
\rho_{\cdot}(\star) &\coloneqq\star\\
\rho_{\Gamma,x:\tau}(\langle\gamma,v\rangle) &\coloneqq\langle\rho_{\Gamma}(\gamma),v\rangle\\
\rho_{\Gamma,x:\kappa}(\langle\gamma,\langle P,P_{\perp}\rangle\rangle) &\coloneqq\rho_{\Gamma}(\gamma)
\end{aligned} ρ ⋅ ( ⋆ ) ρ Γ , x : τ (⟨ γ , v ⟩) ρ Γ , x : κ (⟨ γ , ⟨ P , P ⊥ ⟩⟩) : = ⋆ : = ⟨ ρ Γ ( γ ) , v ⟩ : = ρ Γ ( γ )
This projection discards type assignments, as types are erased at runtime.
Literals are then interpreted as their canonical embeddings into D \mathcal{D} D .
⟦ n ⟧ ( γ ) ≔ i N ( n ) ⟦ b ⟧ ( γ ) ≔ i 2 ( b ) \begin{aligned}
\llbracket n\rrbracket(\gamma) &\coloneqq i_{\mathbb{N}}(n) \\
\llbracket b\rrbracket(\gamma) &\coloneqq i_{2}(b)
\end{aligned} [ [ n ] ] ( γ ) [ [ b ] ] ( γ ) : = i N ( n ) : = i 2 ( b )
Variables are interpreted by projection from the runtime environment, λ \lambda λ -abstractions as the embedding of continuous functions, and application as application in D \mathcal{D} D :
⟦ x ⟧ ( γ ) ≔ γ ( x ) ⟦ λ x . t ⟧ ( γ ) ≔ i → ( v ↦ ⟦ t ⟧ ( ⟨ γ , v ⟩ ) ) ⟦ t ⋅ u ⟧ ( γ ) ≔ ⟦ t ⟧ ( γ ) ⋅ ⟦ u ⟧ ( γ ) \begin{aligned}
\llbracket x\rrbracket(\gamma) &\coloneqq\gamma(x) \\
\llbracket\lambda x.t\rrbracket(\gamma) &\coloneqq i_{\to}\left(v\mapsto\llbracket t\rrbracket(\langle\gamma,v\rangle)\right) \\
\llbracket t\mathbin{\cdot}u\rrbracket(\gamma) &\coloneqq\llbracket t\rrbracket(\gamma)\mathbin{\cdot}\llbracket u\rrbracket(\gamma)
\end{aligned} [ [ x ] ] ( γ ) [ [ λ x . t ] ] ( γ ) [ [ t ⋅ u ] ] ( γ ) : = γ ( x ) : = i → ( v ↦ [ [ t ] ] (⟨ γ , v ⟩) ) : = [ [ t ] ] ( γ ) ⋅ [ [ u ] ] ( γ )
Type abstraction and application have no computational content, so they are ignored:
⟦ Λ x . t ⟧ ( γ ) ≔ ⟦ t ⟧ ( γ ) ⟦ t τ ⟧ ( γ ) ≔ ⟦ t ⟧ ( γ ) \begin{aligned}
\llbracket\Lambda x.t\rrbracket(\gamma) &\coloneqq\llbracket t\rrbracket(\gamma) \\
\llbracket t\ \tau\rrbracket(\gamma) &\coloneqq\llbracket t\rrbracket(\gamma)
\end{aligned} [ [ Λ x . t ] ] ( γ ) [ [ t τ ] ] ( γ ) : = [ [ t ] ] ( γ ) : = [ [ t ] ] ( γ )
As usual we prove that the semantics is PER-respecting. In particular, the interpretation of a term should not distinguish between related contexts. For the unrefined semantics, the context interpretation ⌊ ⌊ ⊢ Γ c t x ⌋ ⌋ \lfloor\!\lfloor\vdash\Gamma\ \mathrm{ctx}\rfloor\!\rfloor ⌊ ⌊ ⊢ Γ ctx ⌋ ⌋ only contains the erased type-level environment. It does not contain the runtime environment used by ⟦ − ⟧ \llbracket-\rrbracket [ [ − ] ] . We therefore need to define ∥ Γ ∥ ( γ ) \left\| \Gamma\right\|(\gamma) ∥ Γ ∥ ( γ ) as the PER on ( ⊢ Γ c t x ) (\vdash\Gamma\ \mathrm{ctx}) ( ⊢ Γ ctx ) induced by the unrefined types in Γ \Gamma Γ .
Definition 13 (Unrefined runtime assignment). Let ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx . The unrefined runtime assignment over γ ∈ dom ( ⌊ ⌊ ⊢ Γ c t x ⌋ ⌋ ) \gamma\in\operatorname{dom}(\lfloor\!\lfloor\vdash\Gamma\ \mathrm{ctx}\rfloor\!\rfloor) γ ∈ dom (⌊ ⌊ ⊢ Γ ctx ⌋ ⌋) is a PER on ( ⊢ Γ c t x ) (\vdash\Gamma\ \mathrm{ctx}) ( ⊢ Γ ctx ) , defined as ∥ Γ ∥ ( γ ) \left\|\Gamma\right\|(\gamma) ∥ Γ ∥ ( γ ) :
∥ Γ ∥ ( − ) : dom ( ⌊ ⌊ ⊢ Γ c t x ⌋ ⌋ ) → P E R ( ( ⊢ Γ c t x ) ) \left\|\Gamma\right\|(-) : \operatorname{dom}(\lfloor\!\lfloor\vdash\Gamma\ \mathrm{ctx}\rfloor\!\rfloor)\to\mathcal{P}\mathcal{E}\mathcal{R}((\vdash\Gamma\ \mathrm{ctx})) ∥ Γ ∥ ( − ) : dom (⌊ ⌊ ⊢ Γ ctx ⌋ ⌋) → P E R (( ⊢ Γ ctx )) ∥ ⋅ ∥ ( ⋆ ) ≔ Δ \left\|\cdot\right\|(\star)\coloneqq\Delta ∥ ⋅ ∥ ( ⋆ ) : = Δ ∥ Γ , x : τ ∥ ( γ ) ≔ { ⟨ ⟨ r , v ⟩ , ⟨ r ′ , w ⟩ ⟩ | ⟨ r , r ′ ⟩ ∈ ∥ Γ ∥ ( γ ) , ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : T y ⌋ ⌋ ( γ ) } \left\|\Gamma,x:\tau\right\|(\gamma)\coloneqq\left\{\left\langle\langle r,v\rangle,\langle r',w\rangle\right\rangle\mathrel{\middle|}\langle r,r'\rangle\in\left\|\Gamma\right\|(\gamma),\ \langle v,w\rangle\in\lfloor\!\lfloor\Gamma\vdash\tau:\mathrm{Ty}\rfloor\!\rfloor(\gamma)\right\} ∥ Γ , x : τ ∥ ( γ ) : = { ⟨ ⟨ r , v ⟩ , ⟨ r ′ , w ⟩ ⟩ ⟨ r , r ′ ⟩ ∈ ∥ Γ ∥ ( γ ) , ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : Ty ⌋ ⌋ ( γ ) } ∥ Γ , x : κ ∥ ( ⟨ γ , P ⟩ ) ≔ ∥ Γ ∥ ( γ ) \left\|\Gamma,x:\kappa\right\|(\langle\gamma,P\rangle)\coloneqq\left\|\Gamma\right\|(\gamma) ∥ Γ , x : κ ∥ (⟨ γ , P ⟩) : = ∥ Γ ∥ ( γ )
Related refined runtime projections are related by the unrefined runtime assignment relation.
Lemma 5.5 (Refined context runtime projection is unrefined context runtime-related). Let ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx . If ⟨ γ , δ ⟩ ∈ ⟦ ⊢ Γ c t x ⟧ \langle\gamma,\delta\rangle\in\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket ⟨ γ , δ ⟩ ∈ [ [ ⊢ Γ ctx ] ] , then ⟨ ρ Γ ( γ ) , ρ Γ ( δ ) ⟩ ∈ ∥ Γ ∥ ( ι Γ ( γ ) ) \langle\rho_{\Gamma}(\gamma),\rho_{\Gamma}(\delta)\rangle\in\left\|\Gamma\right\|(\iota_{\Gamma}(\gamma)) ⟨ ρ Γ ( γ ) , ρ Γ ( δ )⟩ ∈ ∥ Γ ∥ ( ι Γ ( γ )) .
We are now ready to state that both the refined and unrefined term semantics are PER-respecting.
Theorem 5.6 (Semantics is PER-respecting (terms)). Let ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx and Γ ⊢ t : τ \Gamma\vdash t:\tau Γ ⊢ t : τ . Then:
Refined: If ⟨ γ , δ ⟩ ∈ ⟦ ⊢ Γ c t x ⟧ \langle\gamma,\delta\rangle\in\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket ⟨ γ , δ ⟩ ∈ [ [ ⊢ Γ ctx ] ] , then ⟨ ⟦ t ⟧ ( γ ) , ⟦ t ⟧ ( δ ) ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle\llbracket t\rrbracket(\gamma),\llbracket t\rrbracket(\delta)\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨ [ [ t ] ] ( γ ) , [ [ t ] ] ( δ )⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) .
Unrefined: If γ ∈ dom ( ⌊ ⌊ ⊢ Γ c t x ⌋ ⌋ ) \gamma\in\operatorname{dom}(\lfloor\!\lfloor\vdash\Gamma\ \mathrm{ctx}\rfloor\!\rfloor) γ ∈ dom (⌊ ⌊ ⊢ Γ ctx ⌋ ⌋) ; ⟨ δ , ϵ ⟩ ∈ ∥ Γ ∥ ( γ ) \langle\delta,\epsilon\rangle\in\left\|\Gamma\right\|(\gamma) ⟨ δ , ϵ ⟩ ∈ ∥ Γ ∥ ( γ ) , then ⟨ ⟦ t ⟧ ( δ ) , ⟦ t ⟧ ( ϵ ) ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : T y ⌋ ⌋ ( γ ) \langle\llbracket t\rrbracket(\delta),\llbracket t\rrbracket(\epsilon)\rangle\in\lfloor\!\lfloor\Gamma\vdash\tau:\mathrm{Ty}\rfloor\!\rfloor(\gamma) ⟨ [ [ t ] ] ( δ ) , [ [ t ] ] ( ϵ )⟩ ∈ ⌊ ⌊ Γ ⊢ τ : Ty ⌋ ⌋ ( γ ) .
Consistency of the syntax then is a corollary of Theorem 5.6 (i). We represent false as the type ∀ x : T y . x \forall x:\mathrm{Ty}.x ∀ x : Ty . x as from Tm-TyApp it can be used to inhabit every other type.
Corollary 2 (Relative consistency). There is no term t t t such that ⊢ t : ∀ x : T y . x \vdash t:\forall x:\mathrm{Ty}.x ⊢ t : ∀ x : Ty . x is derivable.
We show that the type is not inhabited as it would imply the existence of an element of ∅ \varnothing ∅ .
Propositions
Γ ⊢ ϕ p r p Γ ⊢ ψ p r p Γ ⊢ ϕ ∧ ψ p r p P r o p - A n d Γ ⊢ ϕ p r p Γ ⊢ ¬ ϕ p r p P r o p - N o t Γ ⊢ t : τ Γ ⊢ u : τ Γ ⊢ t ≡ τ u p r p P r o p - E q \begin{aligned}
&\frac{\Gamma\vdash\phi\ \mathrm{prp}\qquad\Gamma\vdash\psi\ \mathrm{prp}}{\Gamma\vdash\phi\land\psi\ \mathrm{prp}}\ \mathrm{Prop\text{-}And}
\qquad
\frac{\Gamma\vdash\phi\ \mathrm{prp}}{\Gamma\vdash\neg\phi\ \mathrm{prp}}\ \mathrm{Prop\text{-}Not}
\qquad
\frac{\Gamma\vdash t:\tau\qquad\Gamma\vdash u:\tau}{\Gamma\vdash t \equiv_{\tau} u\ \mathrm{prp}}\ \mathrm{Prop\text{-}Eq}
\end{aligned} Γ ⊢ ϕ ∧ ψ prp Γ ⊢ ϕ prp Γ ⊢ ψ prp Prop - And Γ ⊢ ¬ ϕ prp Γ ⊢ ϕ prp Prop - Not Γ ⊢ t ≡ τ u prp Γ ⊢ t : τ Γ ⊢ u : τ Prop - Eq
Types continued
Γ ⊢ τ : T y Γ , x : T τ ⊢ ϕ p r p Γ ⊢ { x : τ ∣ ϕ } : T y T y - R e f \frac{\Gamma\vdash\tau:\mathrm{Ty}\qquad\Gamma,x:T\tau\vdash\phi\ \mathrm{prp}}{\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty}}\ \mathrm{Ty\text{-}Ref} Γ ⊢ { x : τ ∣ ϕ } : Ty Γ ⊢ τ : Ty Γ , x : T τ ⊢ ϕ prp Ty - Ref
Terms continued
Γ ⊢ t : τ Γ ⊢ t : { x : τ ∣ x ≡ τ t } T m - R e f l Γ ⊢ t : τ Γ ⊢ τ ⪯ σ Γ ⊢ σ : T y Γ ⊢ t : σ T m - S u b \begin{aligned}
&\frac{\Gamma\vdash t:\tau}{\Gamma\vdash t:\{x:\tau\mid x\equiv_{\tau}t\}}\ \mathrm{Tm\text{-}Refl}
\qquad
\frac{\Gamma\vdash t:\tau\qquad\Gamma\vdash\tau\preceq\sigma\qquad\Gamma\vdash\sigma:\mathrm{Ty}}{\Gamma\vdash t:\sigma}\ \mathrm{Tm\text{-}Sub}
\end{aligned} Γ ⊢ t : { x : τ ∣ x ≡ τ t } Γ ⊢ t : τ Tm - Refl Γ ⊢ t : σ Γ ⊢ t : τ Γ ⊢ τ ⪯ σ Γ ⊢ σ : Ty Tm - Sub
Subtyping
Γ ⊢ τ ⪯ { x : τ ∣ t t ≡ B o o l t t } S u b - T o p Γ , x : T τ ⊨ ϕ ⟹ ψ Γ ⊢ { x : τ ∣ ϕ } ⪯ { x : τ ∣ ψ } S u b - I m p l Γ ⊢ σ ⪯ τ Γ , x : T σ ⊢ ρ ⪯ π Γ ⊢ ( x : τ ) → ρ ⪯ ( x : σ ) → π S u b - F u n Γ ⊢ τ ⪯ σ Γ ⊢ { x : τ ∣ ϕ } ⪯ { x : σ ∣ ϕ } S u b - R e f i n e Γ ⊢ τ ⪯ τ S u b - R e f l Γ ⊢ { x : { y : τ ∣ ψ } ∣ ϕ } ⪯ { y : τ ∣ ψ ∧ ϕ [ y / x ] } S u b - F l a t Γ ⊢ { x : τ ∣ ϕ } ⪯ τ S u b - F o r g e t Γ , x : K κ ⊢ τ ⪯ σ Γ ⊢ ∀ x : κ . τ ⪯ ∀ x : κ . σ S u b - A l l Γ ⊢ τ ⪯ σ Γ ⊢ σ : T y Γ ⊢ σ ⪯ ρ Γ ⊢ τ ⪯ ρ S u b - T r a n s \begin{aligned}
&\frac{\Gamma\vdash\tau\preceq\{x:\tau\mid tt\equiv_{\mathrm{Bool}}tt\}}{}\ \mathrm{Sub\text{-}Top}
\qquad
\frac{\Gamma,x:T\tau\models\phi\Longrightarrow\psi}{\Gamma\vdash\{x:\tau\mid\phi\}\preceq\{x:\tau\mid\psi\}}\ \mathrm{Sub\text{-}Impl}\\
&\frac{\Gamma\vdash\sigma\preceq\tau\qquad\Gamma,x:T\sigma\vdash\rho\preceq\pi}{\Gamma\vdash(x:\tau)\to\rho\preceq(x:\sigma)\to\pi}\ \mathrm{Sub\text{-}Fun}
\qquad
\frac{\Gamma\vdash\tau\preceq\sigma}{\Gamma\vdash\{x:\tau\mid\phi\}\preceq\{x:\sigma\mid\phi\}}\ \mathrm{Sub\text{-}Refine}\\
&\frac{}{\Gamma\vdash\tau\preceq\tau}\ \mathrm{Sub\text{-}Refl}
\qquad
\frac{}{\Gamma\vdash\{x:\{y:\tau\mid\psi\}\mid\phi\}\preceq\{y:\tau\mid\psi\land\phi[y/x]\}}\ \mathrm{Sub\text{-}Flat}\\
&\frac{}{\Gamma\vdash\{x:\tau\mid\phi\}\preceq\tau}\ \mathrm{Sub\text{-}Forget}
\qquad
\frac{\Gamma,x:K\kappa\vdash\tau\preceq\sigma}{\Gamma\vdash\forall x:\kappa.\tau\preceq\forall x:\kappa.\sigma}\ \mathrm{Sub\text{-}All}\\
&\frac{\Gamma\vdash\tau\preceq\sigma\qquad\Gamma\vdash\sigma:\mathrm{Ty}\qquad\Gamma\vdash\sigma\preceq\rho}{\Gamma\vdash\tau\preceq\rho}\ \mathrm{Sub\text{-}Trans}
\end{aligned} Γ ⊢ τ ⪯ { x : τ ∣ tt ≡ Bool tt } Sub - Top Γ ⊢ { x : τ ∣ ϕ } ⪯ { x : τ ∣ ψ } Γ , x : T τ ⊨ ϕ ⟹ ψ Sub - Impl Γ ⊢ ( x : τ ) → ρ ⪯ ( x : σ ) → π Γ ⊢ σ ⪯ τ Γ , x : T σ ⊢ ρ ⪯ π Sub - Fun Γ ⊢ { x : τ ∣ ϕ } ⪯ { x : σ ∣ ϕ } Γ ⊢ τ ⪯ σ Sub - Refine Γ ⊢ τ ⪯ τ Sub - Refl Γ ⊢ { x : { y : τ ∣ ψ } ∣ ϕ } ⪯ { y : τ ∣ ψ ∧ ϕ [ y / x ]} Sub - Flat Γ ⊢ { x : τ ∣ ϕ } ⪯ τ Sub - Forget Γ ⊢ ∀ x : κ . τ ⪯ ∀ x : κ . σ Γ , x : K κ ⊢ τ ⪯ σ Sub - All Γ ⊢ τ ⪯ ρ Γ ⊢ τ ⪯ σ Γ ⊢ σ : Ty Γ ⊢ σ ⪯ ρ Sub - Trans
Refinement types
In this section we extend CIRT with refinement types. The extension includes a proposition judgment together with reflection and subtyping rules and an SMT validity judgment. § 7.1 presents the syntax of the calculus and § 7.2 presents the semantics.
Syntax
Figure 2 extends the syntax of CIRT with refinement types. It shows only the new rules.
Figure 2. Typing rules of refined CIRT.
Propositions form the syntax of refinements. They are built from term equality (at any type) and the standard boolean connectives. Since propositions form a separate layer on top of the programming language their semantics are not required to be continuous. This permits forming equalities between terms at any type (using rule Prop-Eq). Any boolean-valued term of the language can be embedded as a proposition by equating it to t t tt tt .
This propositional logic is interpreted classically: a proposition is meant to denote either t t tt tt or f f ff f f . We can therefore define all of propositional logic from conjunction and negation, with the other connectives being defined in terms of those.
Types , of the previous section, are extended by the refinement type { x : τ ∣ ϕ } \{x:\tau\mid\phi\} { x : τ ∣ ϕ } , which can be thought of as the subset of elements of τ \tau τ satisfying ϕ \phi ϕ .
Terms. Refinements add two new typing rules on terms: reflection and subtyping . Reflection (via rule Tm-Refl) asserts that a term satisfies the proposition that it is equal to itself. This is the strongest proposition a term can satisfy and is therefore to increase the precision of type checking [42 ] . Subtyping (via rule Tm-Sub) allows us to use a term at a ‘larger’ type.
Subtyping and SMT. The judgment Γ ⊨ ϕ \Gamma\models\phi Γ ⊨ ϕ models the discharge of propositions by an SMT solver. It is used to give meaning to the Sub-Impl rule, which, following the subtyping rules of [41 ] , reduces subtyping to implication between propositions. In addition, subtyping is reflexive and transitive, a refinement type is a subtype of the type it refines, and any term of any type satisfies the trivial proposition. Function types are contravariant in their argument and covariant in their result, and type quantification is covariant in its body. Finally, nested refinements can get flattened by taking the conjunction of their propositions or propagate subtyping through the refinement type constructor.
Semantics
The semantics extends the core model with interpretations for propositions, refinement types, and the new typing and subtyping rules.
Propositions have semantics only at the refined level; from the unrefined point of view they are just annotations. The interpretation of a proposition maps refined environments to a boolean value:
⟦ Γ ⊢ ϕ p r p ⟧ ( − ) : dom ( ⟦ ⊢ Γ c t x ⟧ ) → 2 \llbracket\Gamma\vdash\phi\ \mathrm{prp} \rrbracket(-) : \operatorname{dom}\left(\llbracket\vdash\Gamma\ \mathrm{ctx} \rrbracket\right) \to2 [ [ Γ ⊢ ϕ prp ] ] ( − ) : dom ( [ [ ⊢ Γ ctx ] ] ) → 2
Equality is interpreted by checking whether the unrefined interpretation equates the two terms at their type. As explained in Section 2.1.2 the notion of equality cannot depend on the refined interpretation of types and Corollary 1 shows that this unrefined equality test is invariant under refined-equal replacement. Taking this into account, the interpretation of equality is true when the unrefined interpretations of the two terms are related by the unrefined interpretation of their type:
⟦ Γ ⊢ t ≡ τ u p r p ⟧ ( γ ) ≜ t t ⟺ ⟨ ⟦ t ⟧ ( ρ Γ ( γ ) ) , ⟦ u ⟧ ( ρ Γ ( γ ) ) ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) \llbracket\Gamma\vdash t \equiv_{\tau} u\ \mathrm{prp} \rrbracket(\gamma) \triangleq\mathrm{tt} \Longleftrightarrow\langle\llbracket t \rrbracket(\rho_{\Gamma}(\gamma)),\llbracket u \rrbracket(\rho_{\Gamma}(\gamma))\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\iota_{\Gamma}(\gamma)) [ [ Γ ⊢ t ≡ τ u prp ] ] ( γ ) ≜ tt ⟺ ⟨ [ [ t ] ] ( ρ Γ ( γ )) , [ [ u ] ] ( ρ Γ ( γ ))⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ ))
The remaining connectives are interpreted as expected: conjunction returns the interpretation of the right conjunct when the left conjunct is true and f f \mathrm{ff} ff otherwise; negation is boolean negation.
⟦ Γ ⊢ ϕ ∧ ψ p r p ⟧ ( γ ) ≜ ⟦ Γ ⊢ ϕ p r p ⟧ ( γ ) ∧ ⟦ Γ ⊢ ψ p r p ⟧ ( γ ) \llbracket\Gamma\vdash\phi\land\psi\ \mathrm{prp} \rrbracket(\gamma) \triangleq\llbracket\Gamma\vdash\phi\ \mathrm{prp} \rrbracket(\gamma) \land\llbracket\Gamma\vdash\psi\ \mathrm{prp} \rrbracket(\gamma) [ [ Γ ⊢ ϕ ∧ ψ prp ] ] ( γ ) ≜ [ [ Γ ⊢ ϕ prp ] ] ( γ ) ∧ [ [ Γ ⊢ ψ prp ] ] ( γ )
⟦ Γ ⊢ ¬ ϕ p r p ⟧ ( γ ) ≜ ¬ ⟦ Γ ⊢ ϕ p r p ⟧ ( γ ) \llbracket\Gamma\vdash\neg\phi\ \mathrm{prp} \rrbracket(\gamma) \triangleq\neg\llbracket\Gamma\vdash\phi\ \mathrm{prp} \rrbracket(\gamma) [ [ Γ ⊢ ¬ ϕ prp ] ] ( γ ) ≜ ¬ [ [ Γ ⊢ ϕ prp ] ] ( γ )
As before, the interpretation of propositions respects PERs.
Theorem 6.1 (PER-Respecting Propositions). Let ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx and Γ ⊢ ϕ p r p \Gamma\vdash\phi\ \mathrm{prp} Γ ⊢ ϕ prp . If ⟨ γ , δ ⟩ ∈ ⟦ ⊢ Γ c t x ⟧ \langle\gamma,\delta\rangle\in\llbracket\vdash\Gamma\ \mathrm{ctx} \rrbracket ⟨ γ , δ ⟩ ∈ [ [ ⊢ Γ ctx ] ] , then
⟦ Γ ⊢ ϕ p r p ⟧ ( γ ) = ⟦ Γ ⊢ ϕ p r p ⟧ ( δ ) \llbracket\Gamma\vdash\phi\ \mathrm{prp} \rrbracket(\gamma) = \llbracket\Gamma\vdash\phi\ \mathrm{prp} \rrbracket(\delta) [ [ Γ ⊢ ϕ prp ] ] ( γ ) = [ [ Γ ⊢ ϕ prp ] ] ( δ )
Refinement types. Refinement types carry no meaning in the unrefined semantics:
⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) ≜ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty} \rrbracket(\gamma) \triangleq\llbracket\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma) [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) ≜ [ [ Γ ⊢ τ : Ty ] ] ( γ )
In the refined semantics { x : τ ∣ ϕ } \{x:\tau\mid\phi\} { x : τ ∣ ϕ } is the subset of the interpretation of τ \tau τ that satisfies ϕ \phi ϕ . By Theorem 6.1 propositions do not distinguish related environments and either component can be used:
⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) ≜ { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ∣ ⟦ Γ , x : τ ⊢ ϕ p r p ⟧ ( ⟨ γ , v ⟩ ) = t t } \llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty} \rrbracket(\gamma) \triangleq\left\{\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma)\mid\llbracket\Gamma,x:\tau\vdash\phi\ \mathrm{prp} \rrbracket\left(\langle\gamma,v\rangle\right)=\mathrm{tt}\right\} [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) ≜ { ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) ∣ [ [ Γ , x : τ ⊢ ϕ prp ] ] ( ⟨ γ , v ⟩ ) = tt }
Subtyping. We keep the behaviour of the SMT judgment abstract and require the following soundness condition: if a proposition is well-formed and valid then it is true in all environments.
Assumption 1 (SMT soundness). If ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx , Γ ⊢ ϕ p r p \Gamma\vdash\phi\ \mathrm{prp} Γ ⊢ ϕ prp , and Γ ⊨ ϕ \Gamma\models\phi Γ ⊨ ϕ , then ∀ γ ∈ dom ( ⟦ ⊢ Γ c t x ⟧ ) \forall\gamma\in\operatorname{dom}(\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket) ∀ γ ∈ dom ( [ [ ⊢ Γ ctx ] ] ) ,
{ { Γ ⊢ ϕ p r p } } ( γ ) = t t \{\!\{\Gamma\vdash\phi\ \mathrm{prp}\}\!\}(\gamma) = \mathrm{tt} { { Γ ⊢ ϕ prp } } ( γ ) = tt
Subtyping judgments are interpreted in the refined semantics as proofs of subset inclusion between the two interpretations of types. Since the unrefined semantics ignores refinements a subtype is equal to its supertype with respect to the unrefined semantics:
Theorem 6.2 (Subtyping semantics). If ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx , Γ ⊢ τ : T y \Gamma\vdash\tau\!:\!\mathrm{Ty} Γ ⊢ τ : Ty , Γ ⊢ σ : T y \Gamma\vdash\sigma\!:\!\mathrm{Ty} Γ ⊢ σ : Ty , and Γ ⊢ τ ⪯ σ \Gamma\vdash\tau\preceq\sigma Γ ⊢ τ ⪯ σ then:
(i) Refined: If γ ∈ dom ( ⟦ ⊢ Γ c t x ⟧ ) \gamma\in\operatorname{dom}(\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket) γ ∈ dom ( [ [ ⊢ Γ ctx ] ] ) then ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ⊆ ⟦ Γ ⊢ σ : T y ⟧ ( γ ) \llbracket\Gamma\vdash\tau\!:\!\mathrm{Ty}\rrbracket(\gamma) \subseteq\llbracket\Gamma\vdash\sigma\!:\!\mathrm{Ty}\rrbracket(\gamma) [ [ Γ ⊢ τ : Ty ] ] ( γ ) ⊆ [ [ Γ ⊢ σ : Ty ] ] ( γ ) .
(ii) Unrefined: If γ ∈ dom ( ⌊ ⌊ ⊢ Γ c t x ⌋ ⌋ ) \gamma\in\operatorname{dom}(\lfloor\!\lfloor\vdash\Gamma\ \mathrm{ctx}\rfloor\!\rfloor) γ ∈ dom (⌊ ⌊ ⊢ Γ ctx ⌋ ⌋) then ⌊ ⌊ Γ ⊢ τ : T y ⌋ ⌋ ( γ ) = ⌊ ⌊ Γ ⊢ σ : T y ⌋ ⌋ ( γ ) \lfloor\!\lfloor\Gamma\vdash\tau\!:\!\mathrm{Ty}\rfloor\!\rfloor(\gamma) = \lfloor\!\lfloor\Gamma\vdash\sigma\!:\!\mathrm{Ty}\rfloor\!\rfloor(\gamma) ⌊ ⌊ Γ ⊢ τ : Ty ⌋ ⌋ ( γ ) = ⌊ ⌊ Γ ⊢ σ : Ty ⌋ ⌋ ( γ ) .
Terms. The interpretation of terms is unchanged since no new term formers are introduced, and the proof of Theorem 5.6 covers the new typing rules.
Inductive types
Finally, we extend the calculus of Section 6 with inductive types. We add kinds for inductive type constructors and formation rules for inductive types, reflecting index dependence.
The central question of our design is which recursive occurrences of an inductive type should be allowed so that its semantic interpretation remains well defined. Strict positivity is the familiar discipline from dependent type theory: a datatype such as lists is accepted because recursive occurrences appear only on the right of the function type. Refinement systems also use two broader patterns. Positive inductive types allow non-strictly-positive shapes whose overall variance is still covariant. Stratified inductive types allow recursive occurrences at smaller indices, even in negative positions.
Strictly positive inductive types admit an elegant canonical syntactic presentation in terms of W-types, which capture constructions generated by strictly positive signatures. However, positive and stratified inductive types allow more general shapes that are not reducible to standard strictly positive signatures. For this reason inductive types will be presented via a general axiom schema.
Section 7.1 presents the syntax of indexed kinds, positive and stratified inductive types, and the typing rules for introduction and elimination, in particular both positive and stratified types use a single general introduction rule and elimination schema. Section 7.2 presents the semantics of indexed kinds and inductive types and prove that the semantics of the eliminator is well defined and satisfies the semantics of the typing rules.
Syntax
Figure 3 extends the syntax of CIRT with inductive types. We only show the new rules.
Figure 3. Typing rules of inductive CIRT. Where stratifiable K ; m ; t s ( Γ , Δ , Θ , τ ) ≜ strat Γ ; Θ ; K ; m ; t s ( Δ , τ ) \operatorname{stratifiable}_{K;m;ts}(\Gamma,\Delta,\Theta,\tau) \triangleq\operatorname{strat}_{\Gamma;\Theta;K;m;ts}(\Delta,\tau) stratifiable K ; m ; t s ( Γ , Δ , Θ , τ ) ≜ strat Γ ; Θ ; K ; m ; t s ( Δ , τ ) .
Kinds. Since in our calculus inductive types are indexed (e.g. the Val type of Section 2.1.4), rule Kd-Fun extends kinds with term indexed kinds, the function space is dependent in the same way as the function space of terms.
Inductive types. There are two syntactic disciplines to form inductive types: positive as in rule Ty-IndPos and stratified as in rule Ty-IndStrat. Syntactically, an inductive type K K K is defined in the form μ K ⟨ ν ⟩ { C l j ( y : σ j ) → K t ⃗ k } \mu K^{\langle\nu\rangle}\left\{\mathop{\mathrm{C}}\nolimits_{l}^{j}(y\!:\!\sigma^{j}) \to K\ \vec{t}^{\,k}\right\} μ K ⟨ ν ⟩ { C l j ( y : σ j ) → K t k } , where ν \nu ν is either + + + or m m m for positive and stratified inductive types respectively. K K K is a type operator taking k k k arguments, called the indices of the inductive type. Each type is defined as a collection of l l l constructors and each constructor is specified by a typing signature which is a, possibly nullary if j = 0 j = 0 j = 0 , dependent function returning the inductive type being defined fully applied to some concrete indices; the argument of the function can be any type, including types that contain the inductive type being defined. Both rules at the premises have a predicate (pol and strat) that ensures the well-formedness of the inductive type and are defined next.
Positive inductive types are those where every occurrence of the type constructor appears under an even number of function domains. Universal quantification is also treated as variance-flipping binder, since it can capture occurrences of the type constructors.
Example 1 (Hofmann’s Routine). As an example of a positive inductive type, Hofmann’s Routine (from § 2.2 ) is defined in CIRT, to be of kind Ty, as follows:
Rou ≜ μ R ⟨ + ⟩ { Over : R , Next : ( ( R → ListNat ) → ListNat ) → R } . \operatorname{Rou} \triangleq\mu R^{\langle+ \rangle}\{\,\operatorname{Over}:R,\ \operatorname{Next}:((R \to\operatorname{ListNat}) \to\operatorname{ListNat}) \to R\,\}. Rou ≜ μ R ⟨ + ⟩ { Over : R , Next : (( R → ListNat ) → ListNat ) → R } .
The recursive occurrence of R R R in the argument of Next appears to the left of two function arrows, so its polarity is positive.
Formally, the variance of a specific type constructor in a type is captured by a polarity lattice.
Definition 14 (Polarity lattice). Polarities are elements of a lattice with four elements ± \pm ± denoting both positive and negative occurrences, + + + denoting only positive occurrences, − - − denoting only negative occurrences, and ∘ \circ ∘ denoting no occurrences. The Hasse diagram (Figure 4 ) uniquely defines the ordering (≤ \le ≤ ), join (⊔ \sqcup ⊔ ) and complement (p ˉ \bar{p} p ˉ ) operations on polarities.
Figure 4. Polarity lattice.
The polarity of a type constructor, is next defined as an element of the polarity lattice.
Definition 15 (Polarity assignment). The polarity of a type constructor K K K in a type τ \tau τ or kind κ \kappa κ is an element of the polarity lattice, defined by structural induction on the type or kind.
pol K ( B ) ≔ ∘ pol K ( ( x : τ ) → σ ) ≔ pol K ( τ ) ‾ ⊔ pol K ( σ ) pol K ( K ) ≔ + pol K ( { x : τ ∣ ϕ } ) ≔ pol K ( τ ) ‾ pol K ( τ t − k ) ≔ pol K ( τ ) pol K ( ∀ x : κ . τ ) ≔ pol K ( κ ) ‾ ⊔ pol K ( τ ) pol K ( T y ) ≔ ∘ pol K ( ( x : τ ) → κ ) ≔ pol K ( τ ) ‾ ⊔ pol K ( κ ) \begin{aligned}
\operatorname{pol}_{K}(\mathcal{B}) &\coloneqq\circ&
\operatorname{pol}_{K}((x\!:\!\tau)\mathbin{\to}\sigma) &\coloneqq\overline{\operatorname{pol}_{K}(\tau)}\sqcup\operatorname{pol}_{K}(\sigma) \\
\operatorname{pol}_{K}(K) &\coloneqq+ &
\operatorname{pol}_{K}(\{x\!:\!\tau\mid\phi\}) &\coloneqq\overline{\operatorname{pol}_{K}(\tau)} \\
\operatorname{pol}_{K}(\tau\ t^{-k}) &\coloneqq\operatorname{pol}_{K}(\tau) &
\operatorname{pol}_{K}(\forall x\!:\!\kappa.\tau) &\coloneqq\overline{\operatorname{pol}_{K}(\kappa)}\sqcup\operatorname{pol}_{K}(\tau) \\
\operatorname{pol}_{K}(\mathsf{Ty}) &\coloneqq\circ&
\operatorname{pol}_{K}((x\!:\!\tau)\mathbin{\to}\kappa) &\coloneqq\overline{\operatorname{pol}_{K}(\tau)}\sqcup\operatorname{pol}_{K}(\kappa)
\end{aligned} pol K ( B ) pol K ( K ) pol K ( τ t − k ) pol K ( Ty ) : = ∘ : = + : = pol K ( τ ) : = ∘ pol K (( x : τ ) → σ ) pol K ({ x : τ ∣ ϕ }) pol K ( ∀ x : κ . τ ) pol K (( x : τ ) → κ ) : = pol K ( τ ) ⊔ pol K ( σ ) : = pol K ( τ ) : = pol K ( κ ) ⊔ pol K ( τ ) : = pol K ( τ ) ⊔ pol K ( κ ) pol K ( μ L ⟨ + ⟩ { C : ( y : σ ‾ i ) → L ⋅ t i − k } ) ≔ ⨆ i , j pol K ( σ i , j ) \operatorname{pol}_{K}\left(\mu L^{\langle+\rangle}\left\{C\!:\!(y\!:\!\overline{\sigma}^{\,i})\mathbin{\to}L\cdot t_{i}^{-k}\right\}\right)\coloneqq\mathop{\bigsqcup}_{i,j}\operatorname{pol}_{K}(\sigma_{i,j}) pol K ( μ L ⟨ + ⟩ { C : ( y : σ i ) → L ⋅ t i − k } ) : = ⨆ i , j pol K ( σ i , j ) pol K ( μ L ⟨ m ⟩ { C : ( y : σ ‾ i ) → L ⋅ t i − k } ) ≔ { ∘ if ∀ i , j . pol K ( σ i , j ) = ∘ ± otherwise \operatorname{pol}_{K}\left(\mu L^{\langle m\rangle}\left\{C\!:\!(y\!:\!\overline{\sigma}^{\,i})\mathbin{\to}L\cdot t_{i}^{-k}\right\}\right)\coloneqq
\begin{cases}
\circ& \text{if }\forall i,j.\operatorname{pol}_{K}(\sigma_{i,j})=\circ\\
\pm& \text{otherwise}
\end{cases} pol K ( μ L ⟨ m ⟩ { C : ( y : σ i ) → L ⋅ t i − k } ) : = { ∘ ± if ∀ i , j . pol K ( σ i , j ) = ∘ otherwise
We say that the occurrence of constructor K K K in a type is positive if pol K ( τ ) ≤ + \operatorname{pol}_{K}(\tau)\leq+ pol K ( τ ) ≤ + and negative if pol K ( τ ) ≤ − \operatorname{pol}_{K}(\tau)\leq- pol K ( τ ) ≤ − . The definitions extend naturally to kinds.
To assign the polarity of a type in an inductive declaration, when the type is positive we can simply collect the polarities of the type constructor in each of the constructor argument types.
When the type is stratified, we require that the type constructor does not appear in any of the argument, not even in positive positions. This is because stratified types, by self reference in negative positions, can move a syntactically positive occurrence into a semantically negative position.
Stratified inductive types permit negative occurrences of the inductive type by enforcing the syntactic discipline of stratification [40 ] . Concretely, given a natural number metric on the indices of the inductive type we define a structural order on terms. Now each recursive occurrence of the inductive type in each of the constructor arguments must be indexed by terms that are strictly smaller than the indices of the constructor return type. This ensures that the stratified types are well-founded as they are generated bottom-up from the well-founded order on the indices.
Example 2 (Stratified indexed types). The indexed value type from § 2.2 is a stratified type operator V a l : ( x : T y p ) → T y \mathrm{Val}:(x\!:\!\mathrm{Typ})\mathbin{\to}\mathrm{Ty} Val : ( x : Typ ) → Ty , where Typ is the inductive type of object-language simple types. The CIRT declaration is the following:
V a l ≔ μ V ⟨ m ⟩ { V I o t a : N a t → V T I o t a , V A r r : ( t : T y p ) → ( u : T y p ) → ( V t → V u ) → V ( T A r r t u ) } \mathrm{Val}\coloneqq\mu V^{\langle m\rangle}\{ \mathrm{VIota}:\mathrm{Nat}\mathbin{\to}V\ \mathrm{TIota},\ \mathrm{VArr}:(t\!:\!\mathrm{Typ})\mathbin{\to}(u\!:\!\mathrm{Typ})\mathbin{\to}(V\ t\mathbin{\to}V\ u)\mathbin{\to}V\ (\mathrm{TArr}\ t\ u)\} Val : = μ V ⟨ m ⟩ { VIota : Nat → V TIota , VArr : ( t : Typ ) → ( u : Typ ) → ( V t → V u ) → V ( TArr t u )} The function argument of VArr contains two recursive occurrences, one of them, V t V\ t V t , in a negative position, but both occurrences are indexed by the subcomponents t t t and u u u of the result index TArr t t t u u u . Taking the metric m m m to be the size of Typ, both recursive indices are strictly smaller than the result index, so Val is well defined.
More formally, given a natural number metric on the indices, the stratification predicate checks that all recursive occurrences of the inductive type in a type are indexed by terms that are strictly smaller than the indices of the type being defined.
Definition 16 (Stratification predicate). The stratification of a type constructor K K K in a type τ \tau τ or kind κ \kappa κ is defined as a predicate by structural induction on the type or kind.
strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , B ) ≜ t t \operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,B) \triangleq\mathsf{tt} strat Γ ; Θ ; K ; m ; t S ( Δ , B ) ≜ tt strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , τ u ⃗ k ) ≜ strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , τ ) where τ ≠ K \operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,\tau\ \vec{u}^{\,k}) \triangleq\operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,\tau)\quad\text{where }\tau\ne K strat Γ ; Θ ; K ; m ; t S ( Δ , τ u k ) ≜ strat Γ ; Θ ; K ; m ; t S ( Δ , τ ) where τ = K strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , ( x : τ ) → σ ) ≜ strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , τ ) ∧ strat Γ ; Θ ; K ; m ; t ⃗ S ( ( Δ , x : τ ) , σ ) \operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,(\mathord{x:\tau})\to\sigma) \triangleq\operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,\tau)\land\operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}((\Delta,x:\tau),\sigma) strat Γ ; Θ ; K ; m ; t S ( Δ , ( x : τ ) → σ ) ≜ strat Γ ; Θ ; K ; m ; t S ( Δ , τ ) ∧ strat Γ ; Θ ; K ; m ; t S (( Δ , x : τ ) , σ ) strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , { x : τ ∣ ϕ } ) ≜ strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , τ ) \operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,\{x:\tau\mid\phi\}) \triangleq\operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,\tau) strat Γ ; Θ ; K ; m ; t S ( Δ , { x : τ ∣ ϕ }) ≜ strat Γ ; Θ ; K ; m ; t S ( Δ , τ ) strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , ∀ x : κ . τ ) ≜ strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , κ ) ∧ strat Γ ; Θ ; K ; m ; t ⃗ S ( ( Δ , x : κ ) , τ ) \operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,\forall x:\kappa.\tau) \triangleq\operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,\kappa)\land\operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}((\Delta,x:\kappa),\tau) strat Γ ; Θ ; K ; m ; t S ( Δ , ∀ x : κ . τ ) ≜ strat Γ ; Θ ; K ; m ; t S ( Δ , κ ) ∧ strat Γ ; Θ ; K ; m ; t S (( Δ , x : κ ) , τ ) strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , T y ) ≜ t t \operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,\mathsf{Ty}) \triangleq\mathsf{tt} strat Γ ; Θ ; K ; m ; t S ( Δ , Ty ) ≜ tt strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , ( x : τ ) → κ ) ≜ strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , τ ) ∧ strat Γ ; Θ ; K ; m ; t ⃗ S ( ( Δ , x : τ ) , κ ) \operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,(\mathord{x:\tau})\to\kappa) \triangleq\operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}(\Delta,\tau)\land\operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}((\Delta,x:\tau),\kappa) strat Γ ; Θ ; K ; m ; t S ( Δ , ( x : τ ) → κ ) ≜ strat Γ ; Θ ; K ; m ; t S ( Δ , τ ) ∧ strat Γ ; Θ ; K ; m ; t S (( Δ , x : τ ) , κ )
When the type is an inductive type, we check that all the constructor argument types are stratified with respect to the metric.
strat Γ ; Θ ; K ; m ; t ⃗ S ( Δ , μ L ⟨ m ⟩ { C : ( y : σ ) → L ⋅ t ⃗ i , j − k } ) ≜ ⋀ i , j strat Γ ; Θ ; K ; m ; t ⃗ S ( ( Δ , L : κ τ → T y ) , σ i , j ) \operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}\left(\Delta,\mu L^{\langle m\rangle}\left\{C:(y:\sigma)\to L\cdot\vec{t}_{i,j}^{\,-k}\right\}\right)\triangleq\bigwedge_{i,j}\operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}_{S}}\left((\Delta,L:\kappa^{\tau}\to\mathsf{Ty}),\sigma_{i,j}\right) strat Γ ; Θ ; K ; m ; t S ( Δ , μ L ⟨ m ⟩ { C : ( y : σ ) → L ⋅ t i , j − k } ) ≜ i , j ⋀ strat Γ ; Θ ; K ; m ; t S ( ( Δ , L : κ τ → Ty ) , σ i , j )
The interesting case is when the type is a recursive occurrence of the type being defined:
strat Γ ; Θ ; K ; m ; t ⃗ − k ( Δ , K u ⃗ − j ) \operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}^{\,-k}}(\Delta,K\ \vec{u}^{\,-j}) strat Γ ; Θ ; K ; m ; t − k ( Δ , K u − j )
≜ { j = k , ∀ γ ∈ dom ( ⟦ ⊢ Γ c t x ⟧ ) , ∀ ⟨ γ , δ ⟩ ∈ dom ( ⟦ ⊢ Γ , Δ c t x ⟧ ) , ∀ ⟨ γ , ϵ ⟩ ∈ dom ( ⟦ ⊢ Γ , Θ c t x ⟧ ) , r N ( ( m ⃗ ) ( ρ Γ ( γ ) ) ⋅ ( u ⃗ ) ( ρ Γ , Δ ( ⟨ γ , δ ⟩ ) ) ) k < r N ( ( m ⃗ ) ( ρ Γ ( γ ) ) ⋅ ( t ⃗ ) ( ρ Γ , Θ ( ⟨ γ , ϵ ⟩ ) ) ) k \triangleq
\left\{
\begin{aligned}
&j=k,\ \forall\gamma\in\operatorname{dom}(\llbracket\vdash\Gamma\ \mathsf{ctx}\rrbracket),\ \forall\langle\gamma,\delta\rangle\in\operatorname{dom}(\llbracket\vdash\Gamma,\Delta\ \mathsf{ctx}\rrbracket),\ \forall\langle\gamma,\epsilon\rangle\in\operatorname{dom}(\llbracket\vdash\Gamma,\Theta\ \mathsf{ctx}\rrbracket),\\
&r_{\mathbb{N}}\left((\vec{m})(\rho_{\Gamma}(\gamma))\cdot(\vec{u})(\rho_{\Gamma,\Delta}(\langle\gamma,\delta\rangle))\right)^{k}
<r_{\mathbb{N}}\left((\vec{m})(\rho_{\Gamma}(\gamma))\cdot(\vec{t})(\rho_{\Gamma,\Theta}(\langle\gamma,\epsilon\rangle))\right)^{k}
\end{aligned}
\right. ≜ { j = k , ∀ γ ∈ dom ( [ [ ⊢ Γ ctx ] ] ) , ∀ ⟨ γ , δ ⟩ ∈ dom ( [ [ ⊢ Γ , Δ ctx ] ] ) , ∀ ⟨ γ , ϵ ⟩ ∈ dom ( [ [ ⊢ Γ , Θ ctx ] ] ) , r N ( ( m ) ( ρ Γ ( γ )) ⋅ ( u ) ( ρ Γ , Δ (⟨ γ , δ ⟩)) ) k < r N ( ( m ) ( ρ Γ ( γ )) ⋅ ( t ) ( ρ Γ , Θ (⟨ γ , ϵ ⟩)) ) k
A recursive occurrence of a type constructor K K K in a type τ \tau τ is stratified with respect to a sequence of indices t ⃗ − k \vec{t}^{\,-k} t − k if strat Γ ; Θ ; K ; m ; t ⃗ − k ( Δ , τ ) \operatorname{strat}_{\Gamma;\Theta;K;m;\vec{t}^{\,-k}}(\Delta,\tau) strat Γ ; Θ ; K ; m ; t − k ( Δ , τ ) holds and the definition extends naturally to kinds.
While the condition requires checking the stratification predicate for all environments, in practice it can be checked syntactically by ensuring that the indices of the recursive occurrences are syntactically smaller than those of the constructor return type, just as structural termination is checked.
Introduction and elimination , are neutral with respect to the formation discipline, as they are semantically justified by the fixed point construction of inductive types. Thus, the same introduction and elimination rules apply to both positive and stratified inductive types; the formation discipline is handled entirely by the corresponding type formation rule.
The introduction rule Tm-Intro simply unfolds the inductive type in the constructor types. The elimination rule Tm-Elim instead is more complicated: it takes a target type ρ \rho ρ where the inductive type is eliminated, and a case c i c_i c i for each constructor K i K_i K i of the inductive type. Each case c i c_i c i has access both to the unfolding of the constructor arguments σ j [ D / K ] \sigma_j[D/K] σ j [ D / K ] and to the inductive hypothesis for each strictly positive occurrence of the inductive type in the constructor arguments El K , ρ ( z j , σ j ) \operatorname{El}_{K,\rho}(z_j,\sigma_j) El K , ρ ( z j , σ j ) . Introducing the inductive hypothesis in strictly positive positions corresponds to the permitted recursive calls of structurally recursive functions over inductive types with pattern matching [2 ] .
Definition 17 (Inductive hypothesis). Given a type constructor K K K and a type τ \tau τ , the inductive hypothesis El K , ρ ( u , τ ) \operatorname{El}_{K,\rho}(u,\tau) El K , ρ ( u , τ ) is defined by structural induction over τ \tau τ .
El K , ρ ( u , t ⃗ − n ) ≜ U n i t El K , ρ ( u , K t ⃗ − k ) ≜ ρ [ t ⃗ − k / x ⃗ − k ] [ u / y ] El K , ρ ( u , B ) ≜ U n i t El K , ρ ( u , x : τ → σ ) ≜ x : τ → El K , ρ ( u x , σ ) El K , ρ ( u , { x : τ ∣ ϕ } ) ≜ El K , ρ ( u , τ ) El K , ρ ( u , ∀ x : κ . τ ) ≜ ∀ x : κ . El K , ρ ( u x , τ ) \begin{aligned}
\operatorname{El}_{K,\rho}(u,\vec{t}^{\,-n})&\triangleq\mathsf{Unit}
&
\operatorname{El}_{K,\rho}(u,K\ \vec{t}^{\,-k})&\triangleq\rho[\vec{t}^{\,-k}/\vec{x}^{\,-k}][u/y]\\
\operatorname{El}_{K,\rho}(u,B)&\triangleq\mathsf{Unit}
&
\operatorname{El}_{K,\rho}(u,x:\tau\to\sigma)&\triangleq x:\tau\to\operatorname{El}_{K,\rho}(u\ x,\sigma)\\
\operatorname{El}_{K,\rho}(u,\{x:\tau\mid\phi\})&\triangleq\operatorname{El}_{K,\rho}(u,\tau)
&
\operatorname{El}_{K,\rho}(u,\forall x:\kappa.\tau)&\triangleq\forall x:\kappa.\operatorname{El}_{K,\rho}(u\ x,\tau)
\end{aligned} El K , ρ ( u , t − n ) El K , ρ ( u , B ) El K , ρ ( u , { x : τ ∣ ϕ }) ≜ Unit ≜ Unit ≜ El K , ρ ( u , τ ) El K , ρ ( u , K t − k ) El K , ρ ( u , x : τ → σ ) El K , ρ ( u , ∀ x : κ . τ ) ≜ ρ [ t − k / x − k ] [ u / y ] ≜ x : τ → El K , ρ ( u x , σ ) ≜ ∀ x : κ . El K , ρ ( u x , τ ) where unit can be encoded as U n i t ≜ { x : B o o l ∣ x ≡ t t } \mathsf{Unit}\triangleq\{x:\mathsf{Bool}\mid x\equiv\mathsf{tt}\} Unit ≜ { x : Bool ∣ x ≡ tt } and ⋆ ≜ t t \star\triangleq\mathsf{tt} ⋆ ≜ tt
Next, we exemplify the elimination rule with the types defined in examples 1 and 2.
Example 3 (Eliminating Hofmann’s Routine). For the routine type Rou, an eliminator into a target type ρ \rho ρ depending on r : R o u r : \mathrm{Rou} r : Rou has the shape elim R o u ( c O v e r , c N e x t ) : ( r : R o u ) → ρ ( r ) \operatorname{elim}_{\mathrm{Rou}}(c_{\mathrm{Over}},c_{\mathrm{Next}}) : (r:\mathrm{Rou}) \to\rho(r) elim Rou ( c Over , c Next ) : ( r : Rou ) → ρ ( r ) . The two cases correspond to the two constructors:
c O v e r : ρ ( O v e r R o u ) c_{\mathrm{Over}} : \rho(\mathrm{Over}_{\mathrm{Rou}}) c Over : ρ ( Over Rou )
c N e x t : g : ( ( R o u → L i s t N a t ) → L i s t N a t ) → h g : ( ( R o u → L i s t N a t ) → U n i t ) → ρ ( N e x t R o u g ) c_{\mathrm{Next}} : g:((\mathrm{Rou} \to\mathrm{ListNat}) \to\mathrm{ListNat}) \to h_g:((\mathrm{Rou} \to\mathrm{ListNat}) \to\mathrm{Unit}) \to\rho(\mathrm{Next}_{\mathrm{Rou}}\ g) c Next : g : (( Rou → ListNat ) → ListNat ) → h g : (( Rou → ListNat ) → Unit ) → ρ ( Next Rou g ) .
The recursive occurrence of R in the constructor argument is positive but not strictly positive, so the h g h_g h g carries no information. Using this we can write all the structurally recursive functions (all the functions except “extract”) in Hofmann [39 ] ’s original presentation of the Routine type.
Example 4 (Eliminating indexed values). For the stratified type Val, an eliminator into a target type ρ ( t , v ) \rho(t,v) ρ ( t , v ) depending on an index t : T y p t : \mathrm{Typ} t : Typ and a value v : V a l t v : \mathrm{Val}\ t v : Val t has the shape elim V a l ( c I , c A ) : ( t : T y p ) → ( v : V a l t ) → ρ ( t , v ) \operatorname{elim}_{\mathrm{Val}}(c_I,c_A) : (t:\mathrm{Typ}) \to(v:\mathrm{Val}\ t) \to\rho(t,v) elim Val ( c I , c A ) : ( t : Typ ) → ( v : Val t ) → ρ ( t , v ) . The base case proves the target for values built by VIota while the arrow case receives a function argument together with the induction hypothesis generated for its codomain:
c I : ( n : N a t ) → U n i t → ρ ( T I o t a , V I o t a V a l n ) c_I : (n:\mathrm{Nat}) \to\mathrm{Unit} \to\rho(\mathrm{TIota},\mathrm{VIotaVal}\ n) c I : ( n : Nat ) → Unit → ρ ( TIota , VIotaVal n )
c A : ( t : T y p ) → ( u : T y p ) → ( f : ( V a l t → V a l u ) ) → U n i t → U n i t → ( ( x : V a l t ) → ρ ( u , f x ) ) → ρ ( T A r r t u , V A r r V a l t u f ) c_A : (t:\mathrm{Typ}) \to(u:\mathrm{Typ}) \to(f:(\mathrm{Val}\ t \to\mathrm{Val}\ u)) \to\mathrm{Unit} \to\mathrm{Unit} \to((x:\mathrm{Val}\ t) \to\rho(u,f\ x)) \to\rho(\mathrm{TArr}\ t\ u,\mathrm{VArrVal}\ t\ u\ f) c A : ( t : Typ ) → ( u : Typ ) → ( f : ( Val t → Val u )) → Unit → Unit → (( x : Val t ) → ρ ( u , f x )) → ρ ( TArr t u , VArrVal t u f )
Thus, to eliminate a function value, the case for VArr may use the induction hypothesis on every result f x f\ x f x at the smaller index u u u .
Subtyping is extended with the rule Sub-Ix, which allows equal indices to be substituted in the type of an inductive datatype. Uniform parametric datatypes do not require any additional subtyping rules, since they can be encoded using universal and existential quantification [32 ] . Since the encoding is expressed entirely using existing type formers, subtyping for parametric datatypes is inherited from the subtyping rules of the basic type formers, without requiring any datatype-specific subtyping rule.
Semantics
The semantics of inductive types extends both interpretations with indexed type operators. The unrefined semantics forgets the indices and uses a guarded fixed point construction, while the refined semantics keeps the indices and justifies positive and stratified declarations by separate fixed point arguments.
Type operators and application
The unrefined interpretation of kinds just ignores all the index information, since the unrefined semantics ignores every term dependency:
⟦ Γ ⊢ ( x : τ ) → κ : K d ⟧ ( γ ) ≜ ⟦ Γ , x : T τ ⊢ κ : K d ⟧ ( γ ) \llbracket\Gamma\vdash(x:\tau) \to\kappa:\mathrm{Kd} \rrbracket(\gamma) \triangleq\llbracket\Gamma,x:T\tau\vdash\kappa:\mathrm{Kd} \rrbracket(\gamma) [ [ Γ ⊢ ( x : τ ) → κ : Kd ] ] ( γ ) ≜ [ [ Γ , x : T τ ⊢ κ : Kd ] ] ( γ )
⟦ Γ ⊢ σ t : κ [ t / x ] ⟧ ( γ ) ≜ ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( γ ) \llbracket\Gamma\vdash\sigma\ t:\kappa\ [t/x] \rrbracket(\gamma) \triangleq\llbracket\Gamma\vdash\sigma:(x:\tau) \to\kappa\rrbracket(\gamma) [ [ Γ ⊢ σ t : κ [ t / x ] ] ] ( γ ) ≜ [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( γ )
These definitions make ⟦ Γ ⊢ κ : K d ⟧ ( γ ) = C U P E R ( D ) \llbracket\Gamma\vdash\kappa:\mathrm{Kd} \rrbracket(\gamma)=\mathcal{C}\mathcal{U}\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D}) [ [ Γ ⊢ κ : Kd ] ] ( γ ) = C UP E R ( D ) for all kinds κ \kappa κ .
Instead, in the refined semantics, function kinds are interpreted as set-theoretic functions, which take as arguments as many elements of D \mathcal{D} D as the arity of the kind and return an element of P E R ( D ) \mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D}) P E R ( D ) ; as a side condition, the function respects the signature given by the kind and respects the equivalence relation of the domain of the function.
⟦ Γ ⊢ ( x : τ ) → κ : K d ⟧ ( γ ) ≜ { f ∣ f ∈ D → ( D → ) arity ( κ ) P E R ( D ) ∀ v ∈ dom ( ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ) f ( v ) ∈ ⟦ Γ , x : τ ⊢ κ : K d ⟧ ( ⟨ γ , v ⟩ ) ∀ ⟨ v , w ⟩ ∈ ( ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ) 2 ∩ dom ( ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ) 2 f ( v ) = f ( w ) } \begin{aligned}
\llbracket\Gamma\vdash(x:\tau) \to\kappa:\mathrm{Kd} \rrbracket(\gamma)
\triangleq\biggl\{ f \,\bigg|\, & f \in\mathcal{D} \to(\mathcal{D} \to)^{\operatorname{arity}(\kappa)}\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D}) \\
& \forall v \in\operatorname{dom}\left(\llbracket\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma)\right)\ f(v) \in\llbracket\Gamma,x:\tau\vdash\kappa:\mathrm{Kd} \rrbracket(\langle\gamma,v\rangle) \\
& \forall\langle v,w\rangle\in\left(\llbracket\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma)\right)^2 \cap\operatorname{dom}\left(\llbracket\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma)\right)^2\ f(v)=f(w) \biggr\}
\end{aligned} [ [ Γ ⊢ ( x : τ ) → κ : Kd ] ] ( γ ) ≜ { f f ∈ D → ( D → ) arity ( κ ) P E R ( D ) ∀ v ∈ dom ( [ [ Γ ⊢ τ : Ty ] ] ( γ ) ) f ( v ) ∈ [ [ Γ , x : τ ⊢ κ : Kd ] ] (⟨ γ , v ⟩) ∀ ⟨ v , w ⟩ ∈ ( [ [ Γ ⊢ τ : Ty ] ] ( γ ) ) 2 ∩ dom ( [ [ Γ ⊢ τ : Ty ] ] ( γ ) ) 2 f ( v ) = f ( w ) }
where the arity of a kind is defined as
arity ( T y ) ≔ 0 and arity ( ( x : τ ) → κ ) ≔ 1 + arity ( κ ) . \operatorname{arity}(\mathrm{Ty}) \coloneqq0 \quad\text{and}\quad\operatorname{arity}((x\colon\tau)\to\kappa) \coloneqq1+\operatorname{arity}(\kappa). arity ( Ty ) : = 0 and arity (( x : τ ) → κ ) : = 1 + arity ( κ ) .
One might wonder why the semantics of the function kind is not defined directly as functions v ∈ dom ( ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ) → ⟦ Γ , x : T τ ⊢ κ : K d ⟧ ( ⟨ γ , v ⟩ ) v \in\operatorname{dom}(\llbracket\Gamma\vdash\tau\colon\mathrm{Ty}\rrbracket(\gamma)) \to\llbracket\Gamma,x\colon T\tau\vdash\kappa\colon\mathrm{Kd}\rrbracket(\langle\gamma,v\rangle) v ∈ dom ( [ [ Γ ⊢ τ : Ty ] ] ( γ )) → [ [ Γ , x : T τ ⊢ κ : Kd ] ] (⟨ γ , v ⟩) . But, since set theoretically functions are defined as sets of pairs, the interpretation of kinds cannot be related by set-theoretic subsets. Conditions (i) and (ii) allow us to define the interpretation of function kinds as a direct definition, while not constraining the domain to be exactly dom ( ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ) \operatorname{dom}(\llbracket\Gamma\vdash\tau\colon\mathrm{Ty}\rrbracket(\gamma)) dom ( [ [ Γ ⊢ τ : Ty ] ] ( γ )) . Condition (iii) ensures that the interpretation of indexed types cannot distinguish between related, hence equal, terms; as inductive types can witness equalities between them. As an example, the subtyping rule Sub-Ix allows substitution of equal indices in the type of an inductive type.
Application instead can be interpreted as set-theoretic application; the side condition in the definition of the interpretation of function kinds ensures that the application is well-defined.
⟦ Γ ⊢ σ t : κ [ t / x ] ⟧ ( γ ) ≔ ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( γ ) ( ( ( t ) ) ( ρ Γ ( γ ) ) ) \llbracket\Gamma\vdash\sigma\ t\colon\kappa\ [t/x]\rrbracket(\gamma) \coloneqq\llbracket\Gamma\vdash\sigma\colon(x\colon\tau)\to\kappa\rrbracket(\gamma)\left(((t))(\rho_\Gamma(\gamma))\right) [ [ Γ ⊢ σ t : κ [ t / x ] ] ] ( γ ) : = [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( γ ) ( (( t )) ( ρ Γ ( γ )) )
Extending type projections. Indexed kinds are the reason type projections (Definition 11) are required, so that we can check if the refined interpretation of a type in ⟦ Γ ⊢ ( x : τ ) → κ : K d ⟧ ( γ ) \llbracket\Gamma\vdash(x\colon\tau)\to\kappa\colon\mathrm{Kd}\rrbracket(\gamma) [ [ Γ ⊢ ( x : τ ) → κ : Kd ] ] ( γ ) (which is a function) is a subset of the unrefined interpretation of a type in ⌈ ⌈ Γ ⊢ ( x : τ ) → κ : K d ⌉ ⌉ ( γ ) \lceil\!\lceil\Gamma\vdash(x\colon\tau)\to\kappa\colon\mathrm{Kd}\rceil\!\rceil(\gamma) ⌈ ⌈ Γ ⊢ ( x : τ ) → κ : Kd ⌉ ⌉ ( γ ) (which is a CUPER). Thus instead of looking directly at the function for comparison we look at its image, since kinds can be defined outside the interpretation of the argument, we cannot take the simple set-theoretic image, but we need to take the image of the function restricted to the domain of the interpretation of the domain type. More formally:
Definition 11 - Extended (Type projection). The definition of type projection is extended to indexed kinds as follows: π Γ ; ( x : τ ) → κ ( γ , f ) ≔ ⋃ { π Γ , x : T τ ; κ ( ⟨ γ , v ⟩ , f ⋅ v ) ∣ v ∈ dom ( ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ) } \pi_{\Gamma;(x\colon\tau)\to\kappa}(\gamma,f) \coloneqq\bigcup\{\pi_{\Gamma,x\colon T\tau;\kappa}(\langle\gamma,v\rangle,f\cdot v)\mid v\in\operatorname{dom}(\llbracket\Gamma\vdash\tau\colon\mathrm{Ty}\rrbracket(\gamma))\} π Γ ; ( x : τ ) → κ ( γ , f ) : = ⋃ { π Γ , x : T τ ; κ (⟨ γ , v ⟩ , f ⋅ v ) ∣ v ∈ dom ( [ [ Γ ⊢ τ : Ty ] ] ( γ ))} .
Unrefined inductive types
In the unrefined semantics inductive types are interpreted as fixed-point of a contractive operator on CUPERs. The operator acts on the n n n -th approximations (per definition 8) and the determinacy of a CUPER by its approximations (lemma 3.3) then yields its fixed point. We show that the unrefined interpretation of a type with a free type variable is either contractive (definition 9) or the identity function, which is sufficient for the existence of a fixed point.
Theorem 7.1 (Unrefined type semantics is contractive or identity). Let Γ , x : κ , Δ ⊢ τ : μ \Gamma,x\colon\kappa,\Delta\mathrel{\vdash}\tau\colon\mu Γ , x : κ , Δ ⊢ τ : μ be a well-formed context and Γ , x : κ , Δ ⊢ τ : μ \Gamma,x\colon\kappa,\Delta\mathrel{\vdash}\tau\colon\mu Γ , x : κ , Δ ⊢ τ : μ a well-formed type. For every interpretation ⟨ ⟨ γ , P ⟩ ⟩ ∈ dom ( ⟦ Γ , x : κ , Δ ⊢ τ : μ ⟧ ) \langle\!\langle\gamma,P\rangle\!\rangle\in\operatorname{dom}(\llbracket\Gamma,x\colon\kappa,\Delta\mathrel{\vdash}\tau\colon\mu\rrbracket) ⟨ ⟨ γ , P ⟩ ⟩ ∈ dom ( [ [ Γ , x : κ , Δ ⊢ τ : μ ] ] ) , the following operator, which varies the interpretation assigned to x x x , is either contractive or the identity function:
⟦ Γ , x : κ , Δ ⊢ τ : μ ⟧ : ( ⟨ ⟨ γ , − , δ ⟩ ⟩ ) : C U P E R ( D ) → C U P E R ( D ) \llbracket\Gamma,x\colon\kappa,\Delta\vdash\tau\colon\mu\rrbracket\colon(\langle\!\langle\gamma,-,\delta\rangle\!\rangle)\colon\mathcal{CUPER}(\mathcal{D})\to\mathcal{CUPER}(\mathcal{D}) [ [ Γ , x : κ , Δ ⊢ τ : μ ] ] : (⟨ ⟨ γ , − , δ ⟩ ⟩) : C UP E R ( D ) → C UP E R ( D )
Because each contractive operator has a unique fixed point (Lemma 3.4); when the operator is the identity, every CUPER is a fixed point. In either case a fixed point exists.
The unrefined semantics of inductive types are defined as the fixed point of all the constructors:
⟦ Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ j ‾ ) → K ⋅ τ i k ‾ : τ k ‾ → T y } ⟧ ( γ ) ≔ fix X F ⊥ ( X ) \llbracket\Gamma\vdash\mu K^{\langle v\rangle}\left\{C\colon(\overline{y\colon\sigma^{j}})\to K\cdot\overline{\tau_{i}^{k}}\colon\overline{\tau^{k}}\to\mathrm{Ty}\right\}\rrbracket(\gamma)\coloneqq\operatorname{fix}_{X}\mathcal{F}_{\perp}(X) [ [ Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ j ) → K ⋅ τ i k : τ k → Ty } ] ] ( γ ) : = fix X F ⊥ ( X )
where,
F ⊥ ( X ) ≔ ⋃ i { ⟨ ⟨ C i , v j ‾ ⟩ , ⟨ C i , w j ‾ ⟩ ⟩ | ⟨ v j , w j ⟩ ∈ ⟦ Γ , K : τ k ‾ → T y , x : σ j ‾ ⊢ τ k ‾ ⟧ ( γ , X ) } ∪ { ⟨ ⊥ , ⊥ ⟩ } . \mathcal{F}_{\perp}(X)\coloneqq\bigcup_{i}\left\{\left\langle\!\left\langle C_i,\overline{v^{j}}\right\rangle,\left\langle C_i,\overline{w^{j}}\right\rangle\right\rangle\middle|\langle v_j,w_j\rangle\in\llbracket\Gamma,K\colon\overline{\tau^{k}}\to\mathrm{Ty},x\colon\overline{\sigma^{j}}\vdash\overline{\tau^{k}}\rrbracket(\gamma,X)\right\}\cup\{\langle\perp,\perp\rangle\}. F ⊥ ( X ) : = i ⋃ { ⟨ ⟨ C i , v j ⟩ , ⟨ C i , w j ⟩ ⟩ ⟨ v j , w j ⟩ ∈ [ [ Γ , K : τ k → Ty , x : σ j ⊢ τ k ] ] ( γ , X ) } ∪ {⟨ ⊥ , ⊥ ⟩} .
From Theorem 7.1 each element of the union is either contractive or the identity function, and in either case non-expansive. Products and tagged unions act on approximations componentwise and are therefore non-expansive—( A × B ) n (A\times B)_n ( A × B ) n is determined by A n A_n A n and B n B_n B n —while tagging a component by a constructor is contractive, as its ( n + 1 ) (n+1) ( n + 1 ) -st approximation depends only on the n n n -th approximation of the component. Every branch of F ⊥ \mathcal{F}_{\perp} F ⊥ tags its arguments by a constructor C i C_i C i , so each branch is contractive; taking the componentwise product of the arguments and the union over constructors then preserves contractivity. Hence the F ⊥ \mathcal{F}_{\perp} F ⊥ operator is contractive, and by Lemma 3.4 it has a unique fixed point—so the fixed point fix X F ⊥ ( X ) \operatorname{fix}_{X}\mathcal{F}_{\perp}(X) fix X F ⊥ ( X ) defined above is well-posed.
Refined inductive types
The refined semantics instead uses more traditional techniques from the semantics of inductive types: for positive inductive types the type operator is monotone and the Knaster-Tarski theorem yields a least fixed point; for stratified inductive types the well-founded order over the indices yields a unique, hence least, fixed point by a bottom-up construction. These arguments discharge the new induction cases of theorem 5.2. For least to be meaningful we order the semantics of types by the pointwise lift of PER inclusion and the semantics of kinds by inclusion.
Definition 19 (Lattice structure of types). Given ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx and Γ ⊢ κ : K d \Gamma\vdash\kappa\mathbin{:}\mathrm{Kd} Γ ⊢ κ : Kd , we define the following order on P , Q ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) P,Q \in\llbracket\Gamma\vdash\kappa\mathbin{:}\mathrm{Kd}\rrbracket(\gamma) P , Q ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) :
For κ = T y \kappa=\mathrm{Ty} κ = Ty , P ≤ Q P \leq Q P ≤ Q if P ⊆ Q P \subseteq Q P ⊆ Q .
For κ = ( x : τ ) → μ \kappa=(x\mathbin{:}\tau)\to\mu κ = ( x : τ ) → μ , P ≤ Q P \leq Q P ≤ Q if for all v ∈ dom ( ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ) v \in\operatorname{dom}(\llbracket\Gamma\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)) v ∈ dom ( [ [ Γ ⊢ τ : Ty ] ] ( γ )) , P ⋅ v ≤ Q ⋅ v P\mathbin{\cdot}v \leq Q\mathbin{\cdot}v P ⋅ v ≤ Q ⋅ v .
This order is a complete lattice: meets are intersections, and the join of A A A and B B B is the least PER containing A ∪ B A\cup B A ∪ B , which exists because PERs are closed under intersection and D × D D\times D D × D is the top PER; the pointwise lift of a complete lattice is again a complete lattice. Here we identify functions that agree on the domain of the interpretation of the domain type, as only that restriction is ever used. Each inductive type is then interpreted as the least fixed point of the operator F \mathcal{F} F , which unfolds a candidate interpretation X X X into the union of all the possible constructor assignments.
⟦ Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( γ ) ≜ lfp X F ( X ) \llbracket\Gamma\vdash\mu K^{\langle v\rangle}\left\{C:(\overline{y\mathbin{:}\sigma})\to K\mathbin{\cdot}\overline{t}^{\,k}_{i}\right\}\mathord{:}\overline{\tau}^{\,k}\to\mathrm{Ty}\rrbracket(\gamma) \triangleq\operatorname{lfp}_{X}\mathcal{F}(X) [ [ Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ ) → K ⋅ t i k } : τ k → Ty ] ] ( γ ) ≜ lfp X F ( X )
where,
D ≜ μ K ⟨ v ⟩ { C : ( y : σ ‾ ) → K ⋅ t ‾ i k } ; K d D ≜ τ ‾ k → T y D \triangleq\mu K^{\langle v\rangle}\left\{C:(\overline{y\mathbin{:}\sigma})\to K\mathbin{\cdot}\overline{t}^{\,k}_{i}\right\};\qquad\mathrm{Kd}_{D}\triangleq\overline{\tau}^{\,k}\to\mathrm{Ty} D ≜ μ K ⟨ v ⟩ { C : ( y : σ ) → K ⋅ t i k } ; Kd D ≜ τ k → Ty
s σ ≜ ⟦ Γ , K : K d D , x : σ ‾ j − 1 ⊢ σ j : T y ⟧ ; s D ≜ ⟦ Γ ⊢ D : K d D ⟧ ; s τ ≜ ⟦ Γ , x : τ ‾ k − 1 ⊢ τ k : T y ⟧ s_{\sigma}\triangleq\llbracket\Gamma,K\mathbin{:}K_{\mathrm{d}D},\overline{x\mathbin{:}\sigma}^{\,j-1}\vdash\sigma_{j}\mathbin{:}\mathrm{Ty}\rrbracket;\qquad s_{D}\triangleq\llbracket\Gamma\vdash D\mathbin{:}\mathrm{Kd}_{D}\rrbracket;\qquad s_{\tau}\triangleq\llbracket\Gamma,\overline{x\mathbin{:}\tau}^{\,k-1}\vdash\tau_{k}\mathbin{:}\mathrm{Ty}\rrbracket s σ ≜ [ [ Γ , K : K d D , x : σ j − 1 ⊢ σ j : Ty ] ] ; s D ≜ [ [ Γ ⊢ D : Kd D ] ] ; s τ ≜ [ [ Γ , x : τ k − 1 ⊢ τ k : Ty ] ]
F ( X ) ≜ q ‾ k ↦ ⋃ i { ⟨ ⟨ C i , v ‾ j ⟩ , ⟨ C i , w ‾ j ⟩ ⟩ ∣ ⟨ v ‾ j , w ‾ j ⟩ ∈ s σ [ ⟨ ⟨ γ , ⟨ X , s D [ ι Γ ( γ ) ] ⟩ ⟩ , v ‾ j − 1 ⟩ ] , ⟨ q k , ( t k ) ⟩ ⟨ ⟨ ρ Γ ( γ ) , v ‾ j − 1 ⟩ ⟩ ∈ s τ [ ι Γ ( γ ) ] } \mathcal{F}(X)\triangleq\overline{q}^{\,k}\mapsto\bigcup_{i}\{\langle\langle C_{i},\overline{v}^{\,j}\rangle,\langle C_{i},\overline{w}^{\,j}\rangle\rangle\ |\ \langle\overline{v}^{\,j},\overline{w}^{\,j}\rangle\in s_{\sigma}[\langle\langle\gamma,\langle X,s_{D}[\iota_{\Gamma}(\gamma)]\rangle\rangle,\overline{v}^{\,j-1}\rangle],\ \langle q_{k},(t_{k})\rangle\langle\langle\rho_{\Gamma}(\gamma),\overline{v}^{\,j-1}\rangle\rangle\in s_{\tau}[\iota_{\Gamma}(\gamma)]\} F ( X ) ≜ q k ↦ i ⋃ {⟨⟨ C i , v j ⟩ , ⟨ C i , w j ⟩⟩ ∣ ⟨ v j , w j ⟩ ∈ s σ [⟨⟨ γ , ⟨ X , s D [ ι Γ ( γ )]⟩⟩ , v j − 1 ⟩] , ⟨ q k , ( t k )⟩ ⟨⟨ ρ Γ ( γ ) , v j − 1 ⟩⟩ ∈ s τ [ ι Γ ( γ )]}
In F ( X ) \mathcal{F}(X) F ( X ) the first condition relates the constructor arguments at their declared types, with the candidate X X X interpreting the recursive occurrences of the type; the second requires the input indices to be related to the values of the constructor’s index terms. The environment used in F ( X ) \mathcal{F}(X) F ( X ) is well formed only when X X X is included in s D s_{D} s D , in the sense required of type variables in contexts, so the least fixed point is taken in the sublattice of such X X X . This is again a complete lattice, and F \mathcal{F} F preserves it. Importantly, F \mathcal{F} F has a least fixed point, both for positive and stratified types, as we show next.
Positive refined inductive types. For positive inductive types the fixed point exists by the Knaster-Tarski (theorem 3.1), so it suffices to show that F \mathcal{F} F is monotone. Since kinds may quantify over types indexed by the type being defined, we show that the semantics of kinds is (anti-)monotone; there the order is plain set-theoretic inclusion, as kinds are interpreted as sets of set-theoretic functions.
Lemma 7.2 ((Anti-)Monotonicity of types). Let Δ ≜ Γ , K : μ , x : σ ‾ i \Delta\triangleq\Gamma,K\mathbin{:}\mu,\overline{x\mathbin{:}\sigma}^{\,i} Δ ≜ Γ , K : μ , x : σ i , where x i x_i x i can bind both type and term variables, and let ⊢ Δ c t x \vdash\Delta\ \mathrm{ctx} ⊢ Δ ctx , Δ ⊢ μ : K d \Delta\vdash\mu\mathbin{:}\mathrm{Kd} Δ ⊢ μ : Kd , and Δ ⊢ τ : μ \Delta\vdash\tau\mathbin{:}\mu Δ ⊢ τ : μ be well-formed judgments. Given two context interpretations ⟨ ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ , v ‾ i ⟩ \langle\langle\gamma,\langle P,P_{\perp}\rangle\rangle,\overline{v}^{\,i}\rangle ⟨⟨ γ , ⟨ P , P ⊥ ⟩⟩ , v i ⟩ , ⟨ ⟨ γ , ⟨ Q , P ⊥ ⟩ ⟩ , v ‾ i ⟩ ∈ dom ( ⟦ Δ ⊢ c t x ⟧ ) \langle\langle\gamma,\langle Q,P_{\perp}\rangle\rangle,\overline{v}^{\,i}\rangle\in\operatorname{dom}(\llbracket\Delta\vdash\mathrm{ctx}\rrbracket) ⟨⟨ γ , ⟨ Q , P ⊥ ⟩⟩ , v i ⟩ ∈ dom ( [ [ Δ ⊢ ctx ] ] ) that differ only in the assignment of K K K , with P ≤ Q P\leq Q P ≤ Q , then
(i) If pol K ( τ ) ≤ + \operatorname{pol}_{K}(\tau)\leq+ pol K ( τ ) ≤ + , then ⟦ Δ ⊢ τ : μ ⟧ ( ⟨ ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ , v ‾ i ⟩ ) ≤ ⟦ Δ ⊢ τ : μ ⟧ ( ⟨ ⟨ γ , ⟨ Q , P ⊥ ⟩ ⟩ , v ‾ i ⟩ ) \llbracket\Delta\vdash\tau\mathbin{:}\mu\rrbracket\left(\langle\langle\gamma,\langle P,P_{\perp}\rangle\rangle,\overline{v}^{\,i}\rangle\right)\leq\llbracket\Delta\vdash\tau\mathbin{:}\mu\rrbracket\left(\langle\langle\gamma,\langle Q,P_{\perp}\rangle\rangle,\overline{v}^{\,i}\rangle\right) [ [ Δ ⊢ τ : μ ] ] ( ⟨⟨ γ , ⟨ P , P ⊥ ⟩⟩ , v i ⟩ ) ≤ [ [ Δ ⊢ τ : μ ] ] ( ⟨⟨ γ , ⟨ Q , P ⊥ ⟩⟩ , v i ⟩ ) ; and
(ii) If pol K ( τ ) ≤ − \operatorname{pol}_{K}(\tau)\leq- pol K ( τ ) ≤ − , then ⟦ Δ ⊢ τ : μ ⟧ ( ⟨ ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ , v ‾ i ⟩ ) ≥ ⟦ Δ ⊢ τ : μ ⟧ ( ⟨ ⟨ γ , ⟨ Q , P ⊥ ⟩ ⟩ , v ‾ i ⟩ ) \llbracket\Delta\vdash\tau\mathbin{:}\mu\rrbracket\left(\langle\langle\gamma,\langle P,P_{\perp}\rangle\rangle,\overline{v}^{\,i}\rangle\right)\geq\llbracket\Delta\vdash\tau\mathbin{:}\mu\rrbracket\left(\langle\langle\gamma,\langle Q,P_{\perp}\rangle\rangle,\overline{v}^{\,i}\rangle\right) [ [ Δ ⊢ τ : μ ] ] ( ⟨⟨ γ , ⟨ P , P ⊥ ⟩⟩ , v i ⟩ ) ≥ [ [ Δ ⊢ τ : μ ] ] ( ⟨⟨ γ , ⟨ Q , P ⊥ ⟩⟩ , v i ⟩ ) .
The semantics of kinds satisfy a similar property, with set inclusion instead of the order on types. Since F \mathcal{F} F only builds tuples out of the interpretations of the constructor argument types, in which K K K occurs positively, it is monotone by lemma 7.2, and by theorem 3.1 it has a least fixed point.
Stratified refined inductive types. For stratified inductive types the metric m m m over the indices justifies a bottom-up construction. The stratification condition ensures that the interpretation at an index v ‾ k \overline{v}^{k} v k instantiates every recursive occurrence of the type constructor only at indices w ‾ k \overline{w}^{k} w k with m ( w ‾ k ) < m ( v ‾ k ) m(\overline{w}^{k}) < m(\overline{v}^{k}) m ( w k ) < m ( v k ) , and hence depends only on interpretations at strictly m m m -smaller indices. The semantics is therefore defined by well-founded recursion on the order induced by m m m , which yields a unique solution of the fixed-point equation, hence it is also the least.
7.2.4 Introduction and elimination. The introduction simply constructs a pair of the constructor tag and the tuple of the arguments while the elimination interpretation is the least fixed point of semantic case analysis:
( ( C ( i ) μ K ⟨ v ⟩ { C : ( y : σ ‾ ) → K ⋅ t ‾ i k ) ( γ ) ) = ^ i → ( v ‾ j ↦ ⟨ C i , v ‾ j ⟩ ) \left(\left(C(i)_{\mu K^{\langle v\rangle}\{C:(\overline{y:\sigma})\to K\cdot\overline{t}^{k}_{i}}\right)(\gamma)\right) \hat{=} i\to\left(\overline{v}^{j}\mapsto\langle C_{i},\overline{v}^{j}\rangle\right) ( ( C ( i ) μ K ⟨ v ⟩ { C : ( y : σ ) → K ⋅ t i k ) ( γ ) ) = ^ i → ( v j ↦ ⟨ C i , v j ⟩ )
( ( elim μ K ⟨ v ⟩ { C : ( y : σ ‾ ) → K ⋅ t ‾ i k ( c ‾ i ) ) ( γ ) ) = ^ i → ( lfp r v ‾ k , w ‾ ↦ { ( c ‾ i ) ( γ ) ⋅ q ‾ j ⋅ tmEl K ; r ( σ , ⟨ γ , q ‾ j − 1 ⟩ , q ‾ i j ) if w ‾ = ⟨ C i , q ‾ j ⟩ ⊥ otherwise ) \left(\left(\operatorname{elim}_{\mu K^{\langle v\rangle}\{C:(\overline{y:\sigma})\to K\cdot\overline{t}^{k}_{i}}\left(\overline{c}^{i}\right)\right)(\gamma)\right)\hat{=}i\to\left(\operatorname{lfp}_{r}\overline{v}^{k},\overline{w}\mapsto\begin{cases}(\overline{c}_{i})(\gamma)\cdot\overline{q}^{j}\cdot\operatorname{tmEl}_{K;r}(\sigma,\langle\gamma,\overline{q}^{j-1}\rangle,\overline{q}^{j}_{i}) & \text{if }\overline{w}=\langle C_{i},\overline{q}^{j}\rangle\\ \bot& \text{otherwise}\end{cases}\right) ( ( elim μ K ⟨ v ⟩ { C : ( y : σ ) → K ⋅ t i k ( c i ) ) ( γ ) ) = ^ i → ( lfp r v k , w ↦ { ( c i ) ( γ ) ⋅ q j ⋅ tmEl K ; r ( σ , ⟨ γ , q j − 1 ⟩ , q i j ) ⊥ if w = ⟨ C i , q j ⟩ otherwise )
Where the semantics of the actual recursive calls follow the same pattern as the typing rules for the eliminator. Namely, the semantics is inductively defined on the type of the constructor argument by invoking r r r on all the strictly positive recursive occurrences of the type constructor:
Definition 20 (Semantics of recursive calls). Given a type constructor K K K , a type τ \tau τ , the interpretation of the motive r r r , an environment γ \gamma γ recording the interpretations of the preceding constructor arguments, and the current argument v v v , the semantics of the recursive calls is defined as follows:
tmEl K ; r ( B , γ , v ) ≜ ⋆ tmEl K ; r ( K ⋅ t ‾ k , γ , v ) ≜ r ⋅ ( ( t ‾ ) ) ( γ ) ⋅ v \operatorname{tmEl}_{K;r}(B,\gamma,v)\triangleq\star\qquad\operatorname{tmEl}_{K;r}(K\cdot\overline{t}^{k},\gamma,v)\triangleq r\cdot((\overline{t}))(\gamma)\cdot v tmEl K ; r ( B , γ , v ) ≜ ⋆ tmEl K ; r ( K ⋅ t k , γ , v ) ≜ r ⋅ (( t )) ( γ ) ⋅ v
tmEl K ; r ( τ ⋅ t ‾ , γ , v ) ≜ ⋆ tmEl K ; r ( { x : τ ∣ ϕ } , γ , v ) ≜ tmEl K ; r ( τ , γ , v ) \operatorname{tmEl}_{K;r}(\tau\cdot\overline{t},\gamma,v)\triangleq\star\qquad\operatorname{tmEl}_{K;r}(\{x:\tau\mid\phi\},\gamma,v)\triangleq\operatorname{tmEl}_{K;r}(\tau,\gamma,v) tmEl K ; r ( τ ⋅ t , γ , v ) ≜ ⋆ tmEl K ; r ({ x : τ ∣ ϕ } , γ , v ) ≜ tmEl K ; r ( τ , γ , v )
tmEl K ; r ( ∀ x : κ . τ , γ , v ) ≜ tmEl K ; r ( τ , γ , v ) \operatorname{tmEl}_{K;r}(\forall x:\kappa.\tau,\gamma,v)\triangleq\operatorname{tmEl}_{K;r}(\tau,\gamma,v) tmEl K ; r ( ∀ x : κ . τ , γ , v ) ≜ tmEl K ; r ( τ , γ , v )
tmEl K ; r ( x : τ → σ , γ , v ) ≜ i → ( w ↦ tmEl K ; r ( σ , ⟨ γ , w ⟩ , v ⋅ w ) ) \operatorname{tmEl}_{K;r}(x:\tau\to\sigma,\gamma,v)\triangleq i\to(w\mapsto\operatorname{tmEl}_{K;r}(\sigma,\langle\gamma,w\rangle,v\cdot w)) tmEl K ; r ( x : τ → σ , γ , v ) ≜ i → ( w ↦ tmEl K ; r ( σ , ⟨ γ , w ⟩ , v ⋅ w ))
Notice that the whole construction branches over the syntax of the type in the first argument and it does not depend on the semantics.
We proved that the eliminator is PER-respecting and it realizes the type of the inductive hypotheses. For the refined semantics we prove the following stronger statement that ensures that the eliminator works for any under approximation P P P of the inductive type: if the realizers r r r and r ′ r' r ′ map related indices and P P P -related values to related results (hypothesis (i)) and are moreover related at the unrefined type of the eliminator (hypothesis (ii)), then the recursive-call packages computed by tmEl \operatorname{tmEl} tmEl inhabit the corresponding inductive-hypothesis types EI. The generality in P P P is forced on us: the refined interpretation of the inductive type is defined as a fixed point, so while proving the eliminator correct the inductive type is only available up to an approximation.
Lemma 7.3 (Refined semantics is PER-respecting (eliminator)). Let D ≜ μ K ⟨ v ⟩ { C : ( y : σ ‾ j ) → K ⋅ t ‾ i k } D\triangleq\mu K^{\langle v\rangle}\left\{C:(\overline{y:\sigma}^{j})\to K\cdot\overline{t}^{k}_{i}\right\} D ≜ μ K ⟨ v ⟩ { C : ( y : σ j ) → K ⋅ t i k } , Δ ( i ) ≜ K κ ( x : τ ‾ k ‾ ) → T y \Delta(i)\triangleq K_{\kappa}(\overline{x:\overline{\tau}^{k}})\to\mathsf{Ty} Δ ( i ) ≜ K κ ( x : τ k ) → Ty , y : σ ‾ i \overline{y:\sigma}^{i} y : σ i and P ⊥ ( γ ) ≜ ⟦ Γ ⊢ D : ( x : τ ‾ k ‾ ) → T y ⟧ ( γ ) P_{\perp}(\gamma)\triangleq\llbracket\Gamma\vdash D:(\overline{x:\overline{\tau}^{k}})\to\mathsf{Ty}\rrbracket(\gamma) P ⊥ ( γ ) ≜ [ [ Γ ⊢ D : ( x : τ k ) → Ty ] ] ( γ ) . Assume the following judgments are well-formed: Γ \Gamma Γ , Δ ( j ) \Delta(j) Δ ( j ) ctx and Γ \Gamma Γ , x : τ ‾ k ‾ \overline{x:\overline{\tau}^{k}} x : τ k , y : D ‾ k ⊢ ρ : T y y:\overline{D}^{k}\vdash\rho:\mathsf{Ty} y : D k ⊢ ρ : Ty . Given an under approximation of D D D : P ≤ ⟦ Γ ⊢ D : ( x : τ ‾ k ‾ ) → T y ⟧ ( γ ) P\leq\llbracket\Gamma\vdash D:(\overline{x:\overline{\tau}^{k}})\to\mathsf{Ty}\rrbracket(\gamma) P ≤ [ [ Γ ⊢ D : ( x : τ k ) → Ty ] ] ( γ ) , in two related context interpretations ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ ⟩ , v ‾ j − 1 ⟩ \langle\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle\rangle,\overline{v}^{j-1}\rangle ⟨⟨ γ , ⟨ P , P ⊥ ( γ )⟩⟩ , v j − 1 ⟩ , ⟨ ⟨ δ , ⟨ P , P ⊥ ( δ ) ⟩ ⟩ , w ‾ j − 1 ⟩ ∈ ⟦ Γ , Δ ( j − 1 ) c t x ⟧ \langle\langle\delta,\langle P,P_{\perp}(\delta)\rangle\rangle,\overline{w}^{j-1}\rangle\in\llbracket\Gamma,\Delta(j-1)\mathrel{\mathrm{ctx}}\rrbracket ⟨⟨ δ , ⟨ P , P ⊥ ( δ )⟩⟩ , w j − 1 ⟩ ∈ [ [ Γ , Δ ( j − 1 ) ctx ] ] and r r r and r ′ r' r ′ related realizers for the restricted P P P , i.e. (i) ∀ ⟨ t , t ′ ⟩ ∈ ⟦ Γ , x : τ ‾ k ‾ ⊢ t : τ ‾ i k ⟧ ⟨ γ , v ‾ k − 1 ⟩ ∀ ⟨ v , w ⟩ ∈ P ⋅ t ‾ k , ⟨ r ⋅ t ‾ k ⋅ v , r ′ ⋅ t ‾ k ⋅ w ⟩ ∈ ⟦ Γ , x : τ ‾ k ‾ , y : D ‾ k ⊢ ρ : T y ⟧ ( ⟨ ⟨ γ , v ‾ k ⟩ , v ⟩ ) \forall\langle t,t'\rangle\in\llbracket\Gamma,\overline{x:\overline{\tau}^{k}}\vdash t:\overline{\tau}^{k}_{i}\rrbracket_{\langle\gamma,\overline{v}^{k-1}\rangle}\ \forall\langle v,w\rangle\in P\cdot\overline{t}^{k},\ \langle r\cdot\overline{t}^{k}\cdot v,r'\cdot\overline{t}^{k}\cdot w\rangle\in\llbracket\Gamma,\overline{x:\overline{\tau}^{k}},y:\overline{D}^{k}\vdash\rho:\mathsf{Ty}\rrbracket(\langle\langle\gamma,\overline{v}^{k}\rangle,v\rangle) ∀ ⟨ t , t ′ ⟩ ∈ [ [ Γ , x : τ k ⊢ t : τ i k ] ] ⟨ γ , v k − 1 ⟩ ∀ ⟨ v , w ⟩ ∈ P ⋅ t k , ⟨ r ⋅ t k ⋅ v , r ′ ⋅ t k ⋅ w ⟩ ∈ [ [ Γ , x : τ k , y : D k ⊢ ρ : Ty ] ] (⟨⟨ γ , v k ⟩ , v ⟩) , and
(ii) ⟨ r , r ′ ⟩ ∈ ⟦ Γ ⊢ ( x : τ ˉ k ) → D ⋅ x ˉ k → ρ : T y ⟧ ( ι Γ ( γ ) ) \langle r, r' \rangle\in\llbracket\Gamma\vdash(x:\bar{\tau}^{k}) \to D \cdot\bar{x}^{k} \to\rho:\mathrm{Ty} \rrbracket(\iota_{\Gamma}(\gamma)) ⟨ r , r ′ ⟩ ∈ [ [ Γ ⊢ ( x : τ ˉ k ) → D ⋅ x ˉ k → ρ : Ty ] ] ( ι Γ ( γ ))
and some term Γ , Δ ( j − 1 ) ⊢ m : σ j \Gamma, \Delta(j-1) \vdash m:\sigma_j Γ , Δ ( j − 1 ) ⊢ m : σ j , then the restricted eliminators realize the type of the induction hypothesis over argument m m m :
⟨ tmEl K ; r ( σ j , γ ρ , ( ( m ) ) ( γ ρ ) ) , tmEl K ; r ′ ( σ j , δ ρ , ( ( m ) ) ( δ ρ ) ) ⟩ ∈ ⟦ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , σ j ) : T y ⟧ ( ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ ⟩ , v ˉ j − 1 ⟩ ) \left\langle
\begin{aligned}
&\operatorname{tmEl}_{K;r}(\sigma_j,\gamma_{\rho},((m))(\gamma_{\rho})),\\
&\operatorname{tmEl}_{K;r'}(\sigma_j,\delta_{\rho},((m))(\delta_{\rho}))
\end{aligned}
\right\rangle\in\llbracket\Gamma,\Delta(j-1) \vdash\operatorname{El}_{K;\rho}(m,\sigma_j):\mathrm{Ty} \rrbracket\left(\left\langle\left\langle\gamma,\left\langle P,P_{\perp}(\gamma)\right\rangle\right\rangle,\bar{v}^{j-1}\right\rangle\right) ⟨ tmEl K ; r ( σ j , γ ρ , (( m )) ( γ ρ )) , tmEl K ; r ′ ( σ j , δ ρ , (( m )) ( δ ρ )) ⟩ ∈ [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , σ j ) : Ty ] ] ( ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ ⟩ , v ˉ j − 1 ⟩ )
where γ ρ ≜ ρ Γ , Δ ( j − 1 ) ( ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ ⟩ , v ˉ j − 1 ⟩ ) \gamma_{\rho} \triangleq\rho_{\Gamma,\Delta(j-1)}\left(\left\langle\left\langle\gamma,\left\langle P,P_{\perp}(\gamma)\right\rangle\right\rangle,\bar{v}^{j-1}\right\rangle\right) γ ρ ≜ ρ Γ , Δ ( j − 1 ) ( ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ ⟩ , v ˉ j − 1 ⟩ ) and δ ρ ≜ ρ Γ , Δ ( j − 1 ) ( ⟨ ⟨ δ , ⟨ P , P ⊥ ( δ ) ⟩ ⟩ , w ˉ j − 1 ⟩ ) \delta_{\rho} \triangleq\rho_{\Gamma,\Delta(j-1)}\left(\left\langle\left\langle\delta,\left\langle P,P_{\perp}(\delta)\right\rangle\right\rangle,\bar{w}^{j-1}\right\rangle\right) δ ρ ≜ ρ Γ , Δ ( j − 1 ) ( ⟨ ⟨ δ , ⟨ P , P ⊥ ( δ ) ⟩ ⟩ , w ˉ j − 1 ⟩ ) .
The same holds for the unrefined interpretation, but there the stronger statement is unnecessary: every unrefined type interpretation is pointed and complete, so it contains the least fixed point.
In the refined case completeness is not for free, so we argue differently, depending on the formation discipline. For positive types, write T T T for the refined interpretation of the inductive type, i.e. the least fixed point of the operator F F F , and let P ≤ T P \leq T P ≤ T be the restriction of T T T to the pairs on which the eliminator respects the typing of the motive. We show that P P P is a pre-fixed point of F F F , so that T ≤ P T \leq P T ≤ P , and hence P = T P = T P = T . The inclusion F ( P ) ≤ P F(P) \leq P F ( P ) ≤ P amounts to two conditions: membership in T T T , which holds as F ( P ) ≤ F ( T ) = T F(P) \leq F(T) = T F ( P ) ≤ F ( T ) = T by monotonicity of F F F ; and Lemma 7.3 .
For stratified types F F F need not be monotone; instead we define a family of truncations P ( n ) P(n) P ( n ) , where P ( n ) P(n) P ( n ) agrees with T T T at all indices of stratum smaller than n n n and is empty elsewhere. By Lemma 7.3 and induction on n n n , we show that the eliminator respects the typing of the motive on each P ( n ) P(n) P ( n ) .
This completes the treatment of inductive types. As for refinement types, the statements of the theorems of § 5 are unchanged, and their proofs are extended with the cases for the rules of Figure 3 . Hence soundness (Theorem 5.6 ) and consistency (Corollary 2 ) hold for the complete CIRT calculus, with refinement types, subtyping, and both positive and stratified inductive types.
Compiling indexed types
We implemented the positive and stratified inductive types of CIRT in Liquid Haskell and use it to compile the examples of § 2.2 . To permit positive types, we simply relaxed the existing strictly positivity check. The encoding of stratified inductive types is more involved, as Liquid Haskell does not have a direct support of indexed inductive types. Yet, following the technique of data propositions [14 ] , stratified types can compile to ordinary inductive types, by encoding the index information in the refinement logic, via an uninterpreted function.
Finally, we implemented a stratification condition that ensures that the well-formedness condition of the declaration is satisfied.
Stratification is checked when a datatype is declared as stratified. For example, the Val type of § 2.2 needs to be declared as stratified, otherwise the positivity check of Liquid Haskell would reject it. Yet, this implementation is direct: in Liquid Haskell, it required ∼ 400 \sim400 ∼ 400 lines of code, thus we believe that it can be easily adapted to other refinement type systems.
Related work
Models of refinement type systems. Refinement types were introduced by Freeman and Pfenning [27 ] as a discipline for carving out subsets of ML datatypes. Stating properties of data by predicates over unindexed types, as refinement types do, has a long history in logic-enriched type theories [6 , 29 ] . In Sections 2.1 and 2.2 we already discussed in detail what is and what is not captured by existing formalisations of refinement type systems. Other works, such as [15 ] , build on [34 ] by reintroducing a subtyping judgment, validating its necessity. However, they establish only a partial correctness result relative to termination and do not guarantee consistency. Lepigre [45 ] gives a classical realizability model of a second-order language with impredicative polymorphism and an equality type on untyped terms, interpreted as observational equivalence of programs rather than by the unrefined interpretation of a type; it has neither subtyping nor inductive types. Closest to ours in spirit is the work of Economou et al. [24 ] , who likewise give an elementary domain-theoretic denotational semantics for a refinement type system with subtyping and use it to derive logical consistency. Their system, however, belongs to the index-refinement tradition of Dependent ML and liquid types [60 ] : it supports neither impredicative polymorphism nor the non-standard inductive types that are our central concern. The view of refinements as an annotation layer over an unrefined language is made precise by Melliès and Zeilberger [51 ] , who axiomatise a refinement type system as a functor from a category of refined typing derivations down to its unrefined base. Our dual-layer model—refined PERs sitting above a layer of CUPERs that models computation—is a semantic instance of this picture: a type denotes a PER over D \mathcal{D} D included in a CUPER over D \mathcal{D} D , a term denotes an element of D \mathcal{D} D preserving both relations, and annotation independence is its concrete manifestation. Methodologically, our interpretation of types as PERs follows the recipe of Harper [35 ] for constructing type systems over an operational semantics, with the closed terms replaced by the elements of D \mathcal{D} D .
Models of System F. Interpreting types as PERs over a universal domain is a standard technique of realizability [1 , 7 , 17 ] . We build on the model of System F with general inductive types given by Amadio [7 ] , which interprets types as CUPERs over a domain and itself descends from the ideal model of MacQueen et al. [48 ] . Those models solve recursive type equations by a Banach [9 ] contraction on a metric of relations; we adapt the same contractive argument to the minimal-invariant projections of the domain [56 ] , avoiding the metric. Birkedal et al. [13 ] obtain recursive types in admissible PERs from parametricity instead.
Stratified inductive types. Jacob-Rao et al. [40 ] introduce stratified types as a way to circumvent the absence of large elimination in Tores. Their system omits impredicative polymorphism, subtyping, and refinement types, and instead supports general recursive types via Mendler [52 ] -style recursion. Their development also includes a normalization proof. Our work can be seen as extending this setting with impredicative polymorphism and refinement structure. The strategy of relaxing syntactic strict positivity in an impredicative setting goes back to Matthes [50 ] , who replaces positivity with a monotonicity witness while retaining strong normalization for System F extended with fixed-point types. Sized types [3 ] index an inductive type by an ordinal that bounds the height of its elements, in order to check termination. Sizes form a dedicated kind, the operator must be monotone, and types do not depend on terms. Abel [4 ] notes that the size-indexed approximants remain well defined for a non-monotone operator, but does not study the metatheory of that case.
Dependent type theory. In contrast to refinement types, standard dependent type theories, such as the Calculus of Inductive Constructions enforce strict positivity requirements for inductive definitions. This restriction is fundamentally necessary in standard type theory to preserve logical consistency, particularly when combined with impredicative polymorphism, as demonstrated by the Coquand and Paulin [21 ] paradox. Furthermore, systems with large elimination allow for the construction of power sets from inductive types, making non-strictly positive definitions inherently dangerous. Our PER-based semantics demonstrates that, in a refinement setting without large elimination, this strict requirement can be safely relaxed.
Conclusion & Future Work
We presented a semantic model for refinement type systems based on partial equivalence relations over a Scott domain. The model accounts for all subtyping, unrefined equality, impredicative polymorphism, and non-standard inductive types, and comes with PER-respecting interpretations. This realizability model shows that the core refinement type calculus is consistent, even in the presence of positive and stratified inductive types. These two inductive type schemes are currently permitted by Liquid Haskell and we believe that the same design can guide future extensions of more expressive type systems.
Our refinements express total correctness: a term of a refined type terminates and satisfies its predicate. Refined types are therefore ordinary PERs and need not contain a bottom element, whose presence under lazy evaluation makes the refinement logic inconsistent [67 ] . Partial correctness and quotient types would require a different model, in both cases because equality is unrefined. Partial correctness requires the refined semantics of types to be complete [22 ] , which is not the case in general. Quotient types [38 ] identify more elements than unrefined equality does, which contradicts Theorem 5.4 .
Our proofs are not mechanically verified. A complete mechanization would require formalizing the underlying domain theory, the PER/CUPER constructions, and the semantic interpretation of the inductive types introduced in this work. While mechanized developments of syntactic metatheory are more common, mechanizations of semantic models at a comparable level of expressiveness remain an active research field. Developing the semantic infrastructure and carrying out the corresponding soundness proofs would constitute a substantial project in its own right.
Acknowledgments
We would like to thank the anonymous reviewers for their valuable feedback and suggestions. This work was funded by the Excellence Seal María de Maeztu Grant (CEX2024-001471-M funded by MICIU/AEI/10.13039/501100011033) and the ERC Grant CRETE (GA 101039196). Views and opinions expressed are however those of the authors only and do not necessarily reflect those of the European Union or the European Research Council; neither of which can be held responsible for them.
Disclosure of Use of AI in Research
No AI tools were used to conduct the research presented in this work.
References
Compilation examples
The example of simply typed lambda calculus values (§ 2.2 ) can be compiled to the following non indexed type
data Val where
{-@ VIota :: Int → {v:Val | prop v = TIota} @-}
VIota :: Int → Val
{-@ VArr :: t:Typ → u:Typ → ({v: Val | prop v = t} → {v: Val | prop v = u})
→ {v: Val | prop v = TArr t u} @-}
VArr :: Typ → Typ → (Val → Val) → Val
Elimination examples
Negative inductive types are still inconsistent
If the type declaration of Bad (§ 2.2 ) were allowed, where ⊥ \bot ⊥ is an empty type:
B a d : T y ≔ μ B { M k B a d : ( B → ⊥ ) → B } . \mathit{Bad} : \mathit{Ty} \coloneqq\mu B\{\mathit{MkBad}:(B \to\bot) \to B\}. Bad : Ty : = μ B { MkBad : ( B → ⊥ ) → B } .
The eliminator for Bad would have type
e l i m B a d ( c M k B a d ) : ( b : B a d ) → ρ ( b ) , \mathit{elim}_{\mathit{Bad}}(c_{\mathit{MkBad}}) : (b:\mathit{Bad}) \to\rho(b), elim Bad ( c MkBad ) : ( b : Bad ) → ρ ( b ) ,
where
c M k B a d : ( f : B a d → ⊥ ) → ( B a d → U n i t ) → ρ ( M k B a d f ) c_{\mathit{MkBad}} : (f:\mathit{Bad} \to\bot) \to(\mathit{Bad} \to\mathit{Unit}) \to\rho(\mathit{MkBad}\ f) c MkBad : ( f : Bad → ⊥ ) → ( Bad → Unit ) → ρ ( MkBad f )
We can show that Bad must be empty: instantiating the motive at the constant type ρ ( b ) ≔ B a d → ⊥ \rho(b) \coloneqq\mathit{Bad} \to\bot ρ ( b ) : = Bad → ⊥ , the eliminator has type B a d → B a d → ⊥ \mathit{Bad} \to\mathit{Bad} \to\bot Bad → Bad → ⊥ , and diagonalizing gives
n o t B a d : B a d → ⊥ ≔ λ b . e l i m B a d ( λ f g . f ) b b \mathit{notBad} : \mathit{Bad} \to\bot\coloneqq\lambda b.\,\mathit{elim}_{\mathit{Bad}}(\lambda f\,g.\,f)\ b\ b notBad : Bad → ⊥ : = λb . elim Bad ( λ f g . f ) b b
But, at the same time, show that it is inhabited
b a d : B a d ≔ M k B a d n o t B a d \mathit{bad} : \mathit{Bad} \coloneqq\mathit{MkBad}\ \mathit{notBad} bad : Bad : = MkBad notBad
Hence, deriving a contradiction.
c o n t r a : ⊥ ≔ n o t B a d b a d \mathit{contra} : \bot\coloneqq\mathit{notBad}\ \mathit{bad} contra : ⊥ : = notBad bad
The inconsistency arises because the eliminator exposes recursive occurrences of Bad directly. Mendler-style recursion, by contrast, hides those occurrences, preventing such self-application arguments and preserving normalization even for datatypes that are not positive.
Using Hofmann’s routine
We can use Hofmann’s routine type that we defined in CIRT in Example 3 to define the structural recursive definition of the unfold and br function from [12 ] :
u n f o l d : R o u → ( R o u → L i s t N a t ) → L i s t N a t ≔ e l i m R o u ( λ k . k O v e r , λ f g . f ) \mathit{unfold} : \mathit{Rou} \to(\mathit{Rou} \to\mathit{ListNat}) \to\mathit{ListNat} \coloneqq\mathit{elim}_{\mathit{Rou}}(\lambda k.\,k\ \mathit{Over},\lambda f\,g.\,f) unfold : Rou → ( Rou → ListNat ) → ListNat : = elim Rou ( λk . k Over , λ f g . f )
T r e e N a t : T y ≔ μ T ( + ) { L e a f : N a t → T , N o d e : T → N a t → T → T } , \mathit{TreeNat} : \mathit{Ty} \coloneqq\mu T^{(+)}\{\mathit{Leaf}:\mathit{Nat} \to T,\mathit{Node}:T \to\mathit{Nat} \to T \to T\}, TreeNat : Ty : = μ T ( + ) { Leaf : Nat → T , Node : T → Nat → T → T } ,
b r : T r e e N a t → R o u → R o u \mathit{br} : \mathit{TreeNat} \to\mathit{Rou} \to\mathit{Rou} br : TreeNat → Rou → Rou
≔ e l i m T r e e N a t ( λ n r . λ c . N e x t ( λ k . C o n s n ( u n f o l d c k ) ) , λ t l n t r r 1 r 2 r 3 . λ c . N e x t ( λ k . C o n s n ( u n f o l d c ( k ∘ r 1 ∘ r 3 ) ) ) ) \coloneqq\mathit{elim}_{\mathit{TreeNat}}\left(\lambda n\,r.\,\lambda c.\,\mathit{Next}(\lambda k.\,\mathit{Cons}\ n\ (\mathit{unfold}\ c\ k)),\lambda t_l\,n\,t_r\,r_1\,r_2\,r_3.\,\lambda c.\,\mathit{Next}(\lambda k.\,\mathit{Cons}\ n\ (\mathit{unfold}\ c\ (k \circ r_1 \circ r_3)))\right) : = elim TreeNat ( λn r . λ c . Next ( λk . Cons n ( unfold c k )) , λ t l n t r r 1 r 2 r 3 . λ c . Next ( λk . Cons n ( unfold c ( k ∘ r 1 ∘ r 3 ))) )
where the motive is the constant type R o u → R o u \mathit{Rou} \to\mathit{Rou} Rou → Rou , so that the induction hypotheses r 1 , r 3 : R o u → R o u r_1,r_3 : \mathit{Rou} \to\mathit{Rou} r 1 , r 3 : Rou → Rou for the two subtrees can be composed with the continuation k k k (r 2 : U n i t r_2 : \mathit{Unit} r 2 : Unit is the trivial hypothesis for the Nat argument).
The extract function is non structural, but by allowing non-structural recursion in CIRT, we can define it as follows:
extract : Rou → ListNat ≜ elim Rou ( Nil , λ f g . f extract ) \operatorname{extract} : \operatorname{Rou} \to\operatorname{ListNat} \triangleq\operatorname{elim}_{\operatorname{Rou}}(\operatorname{Nil}, \lambda f\,g.\,f\ \operatorname{extract}) extract : Rou → ListNat ≜ elim Rou ( Nil , λ f g . f extract )
Finally, we can define breadthfirst and complete Hofmann’s program:
breadthfirst : TreeNat → ListNat ≜ λ t . extract ( br t Over ) \operatorname{breadthfirst} : \operatorname{TreeNat} \to\operatorname{ListNat} \triangleq\lambda t.\,\operatorname{extract}(\operatorname{br}\ t\ \operatorname{Over}) breadthfirst : TreeNat → ListNat ≜ λ t . extract ( br t Over )
Weakening, substitution and narrowing
We use the notation Γ ⊢ J \Gamma\vdash J Γ ⊢ J to mean any of the judgments Γ ⊢ κ : K d \Gamma\vdash\kappa:\mathrm{Kd} Γ ⊢ κ : Kd , Γ ⊢ τ : κ \Gamma\vdash\tau:\kappa Γ ⊢ τ : κ , Γ ⊢ t : τ \Gamma\vdash t:\tau Γ ⊢ t : τ , Γ ⊢ ϕ p r p \Gamma\vdash\phi\ \mathrm{prp} Γ ⊢ ϕ prp , Γ ⊢ τ ⪯ σ \Gamma\vdash\tau\preceq\sigma Γ ⊢ τ ⪯ σ .
As usual, we have weakening and substitution lemmas for the syntactic judgments, which are proved by induction on the derivation. The weakening lemma is used in the proof of the substitution lemma.
Lemma C.1 (Weakening). Let Γ , x : T τ , Δ \Gamma, x:\mathrm{T}\tau, \Delta Γ , x : T τ , Δ (resp. Γ , x : K κ , Δ \Gamma, x:\mathrm{K}\kappa, \Delta Γ , x : K κ , Δ ) be a well-formed context, with x x x fresh. If Γ , Δ ⊢ J \Gamma, \Delta\vdash J Γ , Δ ⊢ J is derivable, then so is the corresponding judgment over the enlarged context Γ , x : T τ , Δ ⊢ J \Gamma, x:\mathrm{T}\tau, \Delta\vdash J Γ , x : T τ , Δ ⊢ J (resp. Γ , x : K κ , Δ ⊢ J \Gamma, x:\mathrm{K}\kappa, \Delta\vdash J Γ , x : K κ , Δ ⊢ J ).
Proof. By induction on the derivation. Every rule is closed under inserting an unused binding: extend Δ \Delta Δ every time a rule introduces a binder. □
Lemma C.2 (Syntactic substitution). Let Γ ⊢ t : τ \Gamma\vdash t:\tau Γ ⊢ t : τ (resp. Γ ⊢ τ : κ \Gamma\vdash\tau:\kappa Γ ⊢ τ : κ ). If the judgment Γ , x : T τ , Δ ⊢ J \Gamma, x:\mathrm{T}\tau, \Delta\vdash J Γ , x : T τ , Δ ⊢ J (resp. Γ , x : K κ , Δ ⊢ J \Gamma, x:\mathrm{K}\kappa, \Delta\vdash J Γ , x : K κ , Δ ⊢ J ) is derivable, then so is the judgment obtained by applying the substitution [ t / x ] [t/x] [ t / x ] (resp. [ τ / x ] [\tau/x] [ τ / x ] ) to all its components, Γ , Δ [ t / x ] ⊢ J [ t / x ] \Gamma, \Delta[t/x] \vdash J [t/x] Γ , Δ [ t / x ] ⊢ J [ t / x ] (resp. Γ , Δ [ τ / x ] ⊢ J [ τ / x ] \Gamma, \Delta[\tau/x] \vdash J [\tau/x] Γ , Δ [ τ / x ] ⊢ J [ τ / x ] ).
Proof. By induction on the derivation. In the variable case for x x x the use of x x x is replaced by the assumed derivation of Γ ⊢ t : τ \Gamma\vdash t:\tau Γ ⊢ t : τ (resp. Γ ⊢ τ : κ \Gamma\vdash\tau:\kappa Γ ⊢ τ : κ ), weakened by Lemma C.1. The remaining rules commute with the substitution, which distributes over every former and passes under binders. □
Terms are interpreted by induction on their raw syntax, so substitution of a term commutes with the interpretation independently of any typing derivation.
Lemma C.3 (Term substitution). For all terms t t t , u u u , every variable x x x and every runtime assignment γ \gamma γ defined on the free variables of t t t and of u u u other than x x x ,
( ( u [ t / x ] ) ) ( γ ) = ( ( u ) ) ( ⟨ γ , ( ( t ) ) ( γ ) ⟩ ) . \left(\!\left(u [t/x]\right)\!\right)(\gamma) = \left(\!\left(u\right)\!\right)\left(\left\langle\gamma,\left(\!\left(t\right)\!\right)(\gamma)\right\rangle\right). ( ( u [ t / x ] ) ) ( γ ) = ( ( u ) ) ( ⟨ γ , ( ( t ) ) ( γ ) ⟩ ) . Proof. By induction on the raw syntax of u u u . □
The four semantic substitution lemmas below all assert that extending an environment by the denotation of the substituted term or type coincides with first performing the substitution syntactically.
Lemma C.4 (Semantic substitution: term into a kind, refined). If ⊢ Γ , x : T σ , Δ c t x \vdash\Gamma, x:\mathrm{T}\sigma, \Delta\ \mathrm{ctx} ⊢ Γ , x : T σ , Δ ctx and Γ , x : T σ , Δ ⊢ κ : K d \Gamma, x:\mathrm{T}\sigma, \Delta\vdash\kappa:\mathrm{Kd} Γ , x : T σ , Δ ⊢ κ : Kd , then for every ⟨ ⟨ γ , ( ( t ) ) ( ρ Γ ( γ ) ) ⟩ , δ ⟩ ∈ dom ( [ [ ⊢ Γ , x : T σ , Δ c t x ] ] ) \left\langle\left\langle\gamma,\left(\!\left(t\right)\!\right)(\rho_\Gamma(\gamma))\right\rangle,\delta\right\rangle\in\operatorname{dom}\left(\left[\!\left[\vdash\Gamma, x:\mathrm{T}\sigma, \Delta\ \mathrm{ctx}\right]\!\right]\right) ⟨ ⟨ γ , ( ( t ) ) ( ρ Γ ( γ )) ⟩ , δ ⟩ ∈ dom ( [ [ ⊢ Γ , x : T σ , Δ ctx ] ] ) ,
[ [ Γ , x : T σ , Δ ⊢ κ : K d ] ] ( ⟨ ⟨ γ , ( ( t ) ) ( ρ Γ ( γ ) ) ⟩ , δ ⟩ ) = [ [ Γ , Δ [ t / x ] ⊢ κ [ t / x ] : K d ] ] ( ⟨ γ , δ ⟩ ) . \left[\!\left[\Gamma, x:\mathrm{T}\sigma, \Delta\vdash\kappa:\mathrm{Kd}\right]\!\right]\left(\left\langle\left\langle\gamma,\left(\!\left(t\right)\!\right)(\rho_\Gamma(\gamma))\right\rangle,\delta\right\rangle\right) = \left[\!\left[\Gamma, \Delta[t/x] \vdash\kappa[t/x]:\mathrm{Kd}\right]\!\right]\left(\left\langle\gamma,\delta\right\rangle\right). [ [ Γ , x : T σ , Δ ⊢ κ : Kd ] ] ( ⟨ ⟨ γ , ( ( t ) ) ( ρ Γ ( γ )) ⟩ , δ ⟩ ) = [ [ Γ , Δ [ t / x ] ⊢ κ [ t / x ] : Kd ] ] ( ⟨ γ , δ ⟩ ) .
Lemma C.5 (Semantic substitution: term into a type, refined). If ⊢ Γ , x : T σ , Δ c t x \vdash\Gamma, x:\mathrm{T}\sigma, \Delta\ \mathrm{ctx} ⊢ Γ , x : T σ , Δ ctx and Γ , x : T σ , Δ ⊢ ρ : κ \Gamma, x:\mathrm{T}\sigma, \Delta\vdash\rho:\kappa Γ , x : T σ , Δ ⊢ ρ : κ , then for every ⟨ ⟨ γ , ( ( t ) ) ( ρ Γ ( γ ) ) ⟩ , δ ⟩ ∈ dom ( [ [ ⊢ Γ , x : T σ , Δ c t x ] ] ) \left\langle\left\langle\gamma,\left(\!\left(t\right)\!\right)(\rho_\Gamma(\gamma))\right\rangle,\delta\right\rangle\in\operatorname{dom}\left(\left[\!\left[\vdash\Gamma, x:\mathrm{T}\sigma, \Delta\ \mathrm{ctx}\right]\!\right]\right) ⟨ ⟨ γ , ( ( t ) ) ( ρ Γ ( γ )) ⟩ , δ ⟩ ∈ dom ( [ [ ⊢ Γ , x : T σ , Δ ctx ] ] ) ,
[ [ Γ , x : T σ , Δ ⊢ ρ : κ ] ] ( ⟨ ⟨ γ , ( ( t ) ) ( ρ Γ ( γ ) ) ⟩ , δ ⟩ ) = [ [ Γ , Δ [ t / x ] ⊢ ρ [ t / x ] : κ [ t / x ] ] ] ( ⟨ γ , δ ⟩ ) . \begin{aligned}
\left[\!\left[\Gamma, x:\mathrm{T}\sigma, \Delta\vdash\rho:\kappa\right]\!\right]\left(\left\langle\left\langle\gamma,\left(\!\left(t\right)\!\right)(\rho_\Gamma(\gamma))\right\rangle,\delta\right\rangle\right) \\
= \left[\!\left[\Gamma, \Delta[t/x] \vdash\rho[t/x]:\kappa[t/x]\right]\!\right]\left(\left\langle\gamma,\delta\right\rangle\right).
\end{aligned} [ [ Γ , x : T σ , Δ ⊢ ρ : κ ] ] ( ⟨ ⟨ γ , ( ( t ) ) ( ρ Γ ( γ )) ⟩ , δ ⟩ ) = [ [ Γ , Δ [ t / x ] ⊢ ρ [ t / x ] : κ [ t / x ] ] ] ( ⟨ γ , δ ⟩ ) .
Lemma C.6 (Semantic substitution: type into a kind, refined). If ⊢ Γ , x : κ , Δ c t x \vdash\Gamma, x:\kappa, \Delta\ \mathrm{ctx} ⊢ Γ , x : κ , Δ ctx and Γ , x : κ , Δ ⊢ σ : K d \Gamma, x:\kappa, \Delta\vdash\sigma:K d Γ , x : κ , Δ ⊢ σ : K d , then for every ⟨ ⟨ γ , ⟨ ⟦ Γ ⊢ τ : κ ⟧ ( γ ) , ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( ι Γ ( γ ) ) ⟩ ⟩ , δ ⟩ ∈ dom ( ⟦ ⊢ Γ , x : κ , Δ c t x ⟧ ) \langle\langle\gamma,\langle\llbracket\Gamma\vdash\tau:\kappa\rrbracket(\gamma),\lfloor\lfloor\Gamma\vdash\tau:\kappa\rfloor\rfloor(\iota_{\Gamma}(\gamma))\rangle\rangle,\delta\rangle\in\operatorname{dom}(\llbracket\vdash\Gamma,x:\kappa,\Delta\ \mathrm{ctx}\rrbracket) ⟨⟨ γ , ⟨ [ [ Γ ⊢ τ : κ ] ] ( γ ) , ⌊⌊ Γ ⊢ τ : κ ⌋⌋ ( ι Γ ( γ ))⟩⟩ , δ ⟩ ∈ dom ( [ [ ⊢ Γ , x : κ , Δ ctx ] ] ) ,
⟦ Γ , x : κ , Δ ⊢ σ : K d ⟧ ( ⟨ ⟨ γ , ⟨ ⟦ Γ ⊢ τ : κ ⟧ ( γ ) , ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( ι Γ ( γ ) ) ⟩ ⟩ , δ ⟩ ) = ⟦ Γ , Δ [ τ / x ] ⊢ σ [ τ / x ] : K d ⟧ ( ⟨ γ , δ ⟩ ) . \llbracket\Gamma,x:\kappa,\Delta\vdash\sigma:K d\rrbracket(\langle\langle\gamma,\langle\llbracket\Gamma\vdash\tau:\kappa\rrbracket(\gamma),\lfloor\lfloor\Gamma\vdash\tau:\kappa\rfloor\rfloor(\iota_{\Gamma}(\gamma))\rangle\rangle,\delta\rangle)
=
\llbracket\Gamma,\Delta[\tau/x]\vdash\sigma[\tau/x]:K d\rrbracket(\langle\gamma,\delta\rangle). [ [ Γ , x : κ , Δ ⊢ σ : K d ] ] (⟨⟨ γ , ⟨ [ [ Γ ⊢ τ : κ ] ] ( γ ) , ⌊⌊ Γ ⊢ τ : κ ⌋⌋ ( ι Γ ( γ ))⟩⟩ , δ ⟩) = [ [ Γ , Δ [ τ / x ] ⊢ σ [ τ / x ] : K d ] ] (⟨ γ , δ ⟩) .
Lemma C.7 (Semantic substitution: type into a type, refined). If ⊢ Γ , x : κ , Δ c t x \vdash\Gamma,x:\kappa,\Delta\ \mathrm{ctx} ⊢ Γ , x : κ , Δ ctx and Γ , x : κ , Δ ⊢ σ : μ \Gamma,x:\kappa,\Delta\vdash\sigma:\mu Γ , x : κ , Δ ⊢ σ : μ , then for every ⟨ ⟨ γ , ⟨ ⟦ Γ ⊢ τ : κ ⟧ ( γ ) , ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( ι Γ ( γ ) ) ⟩ ⟩ , δ ⟩ ∈ dom ( ⟦ ⊢ Γ , x : κ , Δ c t x ⟧ ) \langle\langle\gamma,\langle\llbracket\Gamma\vdash\tau:\kappa\rrbracket(\gamma),\lfloor\lfloor\Gamma\vdash\tau:\kappa\rfloor\rfloor(\iota_{\Gamma}(\gamma))\rangle\rangle,\delta\rangle\in\operatorname{dom}(\llbracket\vdash\Gamma,x:\kappa,\Delta\ \mathrm{ctx}\rrbracket) ⟨⟨ γ , ⟨ [ [ Γ ⊢ τ : κ ] ] ( γ ) , ⌊⌊ Γ ⊢ τ : κ ⌋⌋ ( ι Γ ( γ ))⟩⟩ , δ ⟩ ∈ dom ( [ [ ⊢ Γ , x : κ , Δ ctx ] ] ) ,
⟦ Γ , x : κ , Δ ⊢ σ : μ ⟧ ( ⟨ ⟨ γ , ⟨ ⟦ Γ ⊢ τ : κ ⟧ ( γ ) , ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( ι Γ ( γ ) ) ⟩ ⟩ , δ ⟩ ) = ⟦ Γ , Δ [ τ / x ] ⊢ σ [ τ / x ] : μ [ τ / x ] ⟧ ( ⟨ γ , δ ⟩ ) . \llbracket\Gamma,x:\kappa,\Delta\vdash\sigma:\mu\rrbracket(\langle\langle\gamma,\langle\llbracket\Gamma\vdash\tau:\kappa\rrbracket(\gamma),\lfloor\lfloor\Gamma\vdash\tau:\kappa\rfloor\rfloor(\iota_{\Gamma}(\gamma))\rangle\rangle,\delta\rangle)
=
\llbracket\Gamma,\Delta[\tau/x]\vdash\sigma[\tau/x]:\mu[\tau/x]\rrbracket(\langle\gamma,\delta\rangle). [ [ Γ , x : κ , Δ ⊢ σ : μ ] ] (⟨⟨ γ , ⟨ [ [ Γ ⊢ τ : κ ] ] ( γ ) , ⌊⌊ Γ ⊢ τ : κ ⌋⌋ ( ι Γ ( γ ))⟩⟩ , δ ⟩) = [ [ Γ , Δ [ τ / x ] ⊢ σ [ τ / x ] : μ [ τ / x ] ] ] (⟨ γ , δ ⟩) .
In the unrefined semantics substitution into a kind, and substitution of a term, are degenerate: the unrefined interpretation of every kind is C U P E R ( D ) \mathsf{CUPER}(D) CUPER ( D ) and that of a type never inspects the term assignment.
Lemma C.8 (Semantic substitution: type into a type, unrefined). If ⊢ Γ , x : κ , Δ c t x \vdash\Gamma,x:\kappa,\Delta\ \mathrm{ctx} ⊢ Γ , x : κ , Δ ctx and Γ , x : κ , Δ ⊢ σ : μ \Gamma,x:\kappa,\Delta\vdash\sigma:\mu Γ , x : κ , Δ ⊢ σ : μ , then for every ⟨ ⟨ γ , ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( ι Γ ( γ ) ) ⟩ , δ ⟩ ∈ dom ( ⌊ ⌊ ⊢ Γ , x : κ , Δ c t x ⌋ ⌋ ) \langle\langle\gamma,\lfloor\lfloor\Gamma\vdash\tau:\kappa\rfloor\rfloor(\iota_{\Gamma}(\gamma))\rangle,\delta\rangle\in\operatorname{dom}(\lfloor\lfloor\vdash\Gamma,x:\kappa,\Delta\ \mathrm{ctx}\rfloor\rfloor) ⟨⟨ γ , ⌊⌊ Γ ⊢ τ : κ ⌋⌋ ( ι Γ ( γ ))⟩ , δ ⟩ ∈ dom (⌊⌊ ⊢ Γ , x : κ , Δ ctx ⌋⌋) ,
⌊ ⌊ Γ , x : κ , Δ ⊢ σ : μ ⌋ ⌋ ( ⟨ ⟨ γ , ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( ι Γ ( γ ) ) ⟩ , δ ⟩ ) = ⌊ ⌊ Γ , Δ [ τ / x ] ⊢ σ [ τ / x ] : μ [ τ / x ] ⌋ ⌋ ( ⟨ γ , δ ⟩ ) . \lfloor\lfloor\Gamma,x:\kappa,\Delta\vdash\sigma:\mu\rfloor\rfloor(\langle\langle\gamma,\lfloor\lfloor\Gamma\vdash\tau:\kappa\rfloor\rfloor(\iota_{\Gamma}(\gamma))\rangle,\delta\rangle)
=
\lfloor\lfloor\Gamma,\Delta[\tau/x]\vdash\sigma[\tau/x]:\mu[\tau/x]\rfloor\rfloor(\langle\gamma,\delta\rangle). ⌊⌊ Γ , x : κ , Δ ⊢ σ : μ ⌋⌋ (⟨⟨ γ , ⌊⌊ Γ ⊢ τ : κ ⌋⌋ ( ι Γ ( γ ))⟩ , δ ⟩) = ⌊⌊ Γ , Δ [ τ / x ] ⊢ σ [ τ / x ] : μ [ τ / x ]⌋⌋ (⟨ γ , δ ⟩) .
Lemma C.9 (Semantic substitution: term into a proposition). If ⊢ Γ , x : σ , Δ c t x \vdash\Gamma,x:\sigma,\Delta\ \mathrm{ctx} ⊢ Γ , x : σ , Δ ctx and Γ , x : σ , Δ ⊢ ϕ p r p \Gamma,x:\sigma,\Delta\vdash\phi\ \mathrm{prp} Γ , x : σ , Δ ⊢ ϕ prp , then for every ⟨ ⟨ γ , ( ( t ) ) ( ρ Γ ( γ ) ) ⟩ , δ ⟩ ∈ dom ( ⟦ ⊢ Γ , x : σ , Δ c t x ⟧ ) \langle\langle\gamma,((t))(\rho_{\Gamma}(\gamma))\rangle,\delta\rangle\in\operatorname{dom}(\llbracket\vdash\Gamma,x:\sigma,\Delta\ \mathrm{ctx}\rrbracket) ⟨⟨ γ , (( t )) ( ρ Γ ( γ ))⟩ , δ ⟩ ∈ dom ( [ [ ⊢ Γ , x : σ , Δ ctx ] ] ) ,
{ { Γ , x : σ , Δ ⊢ ϕ p r p } } ( ⟨ ⟨ γ , ( ( t ) ) ( ρ Γ ( γ ) ) ⟩ , δ ⟩ ) = { { Γ , Δ [ t / x ] ⊢ ϕ [ t / x ] p r p } } ( ⟨ γ , δ ⟩ ) . \{\!\{\Gamma,x:\sigma,\Delta\vdash\phi\ \mathrm{prp}\}\!\}(\langle\langle\gamma,((t))(\rho_{\Gamma}(\gamma))\rangle,\delta\rangle)
=
\{\!\{\Gamma,\Delta[t/x]\vdash\phi[t/x]\ \mathrm{prp}\}\!\}(\langle\gamma,\delta\rangle). { { Γ , x : σ , Δ ⊢ ϕ prp } } (⟨⟨ γ , (( t )) ( ρ Γ ( γ ))⟩ , δ ⟩) = { { Γ , Δ [ t / x ] ⊢ ϕ [ t / x ] prp } } (⟨ γ , δ ⟩) .
Lemma C.10 (Semantic substitution: type into a proposition). If ⊢ Γ , x : κ , Δ c t x \vdash\Gamma,x:\kappa,\Delta\ \mathrm{ctx} ⊢ Γ , x : κ , Δ ctx and Γ , x : κ , Δ ⊢ ϕ p r p \Gamma,x:\kappa,\Delta\vdash\phi\ \mathrm{prp} Γ , x : κ , Δ ⊢ ϕ prp , then for every ⟨ ⟨ γ , ⟨ ⟦ Γ ⊢ τ : κ ⟧ ( γ ) , ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( ι Γ ( γ ) ) ⟩ ⟩ , δ ⟩ ∈ dom ( ⟦ ⊢ Γ , x : κ , Δ c t x ⟧ ) \langle\langle\gamma,\langle\llbracket\Gamma\vdash\tau:\kappa\rrbracket(\gamma),\lfloor\lfloor\Gamma\vdash\tau:\kappa\rfloor\rfloor(\iota_{\Gamma}(\gamma))\rangle\rangle,\delta\rangle\in\operatorname{dom}(\llbracket\vdash\Gamma,x:\kappa,\Delta\ \mathrm{ctx}\rrbracket) ⟨⟨ γ , ⟨ [ [ Γ ⊢ τ : κ ] ] ( γ ) , ⌊⌊ Γ ⊢ τ : κ ⌋⌋ ( ι Γ ( γ ))⟩⟩ , δ ⟩ ∈ dom ( [ [ ⊢ Γ , x : κ , Δ ctx ] ] ) ,
{ { Γ , x : κ , Δ ⊢ ϕ p r p } } ( ⟨ ⟨ γ , ⟨ ⟦ Γ ⊢ τ : κ ⟧ ( γ ) , ⌊ ⌊ Γ ⊢ τ : κ ⌋ ⌋ ( ι Γ ( γ ) ) ⟩ ⟩ , δ ⟩ ) = { { Γ , Δ [ τ / x ] ⊢ ϕ [ τ / x ] p r p } } ( ⟨ γ , δ ⟩ ) . \{\!\{\Gamma,x:\kappa,\Delta\vdash\phi\ \mathrm{prp}\}\!\}(\langle\langle\gamma,\langle\llbracket\Gamma\vdash\tau:\kappa\rrbracket(\gamma),\lfloor\lfloor\Gamma\vdash\tau:\kappa\rfloor\rfloor(\iota_{\Gamma}(\gamma))\rangle\rangle,\delta\rangle)
=
\{\!\{\Gamma,\Delta[\tau/x]\vdash\phi[\tau/x]\ \mathrm{prp}\}\!\}(\langle\gamma,\delta\rangle). { { Γ , x : κ , Δ ⊢ ϕ prp } } (⟨⟨ γ , ⟨ [ [ Γ ⊢ τ : κ ] ] ( γ ) , ⌊⌊ Γ ⊢ τ : κ ⌋⌋ ( ι Γ ( γ ))⟩⟩ , δ ⟩) = { { Γ , Δ [ τ / x ] ⊢ ϕ [ τ / x ] prp } } (⟨ γ , δ ⟩) .
Proof of Lemmas C.4 to C.10. The statements are proved by induction on the derivation of the substituted judgment, the cases that reach a term are discharged by Lemma C.3. The right-hand sides are well-formed by Lemma C.2. □
Lemma C.11 (Syntactic narrowing). Let Γ ⊢ τ ⪯ σ \Gamma\vdash\tau\preceq\sigma Γ ⊢ τ ⪯ σ and Γ ⊢ τ : T y \Gamma\vdash\tau:\mathrm{Ty} Γ ⊢ τ : Ty . If Γ , x : T σ , Δ ⊢ J \Gamma,x:T\sigma,\Delta\vdash J Γ , x : T σ , Δ ⊢ J is derivable, then so is Γ , x : T τ , Δ ⊢ J \Gamma,x:T\tau,\Delta\vdash J Γ , x : T τ , Δ ⊢ J .
Proof. By induction on the derivation. Apply the Tm-Sub and Lemma C.1 in the Tm-Var case. □
Lemma C.12 (Semantic narrowing). Let Γ ⊢ τ ⪯ σ \Gamma\vdash\tau\preceq\sigma Γ ⊢ τ ⪯ σ , and suppose both Γ , x : T τ , Δ ⊢ J \Gamma,x:T\tau,\Delta\vdash J Γ , x : T τ , Δ ⊢ J and Γ , x : T σ , Δ ⊢ J \Gamma,x:T\sigma,\Delta\vdash J Γ , x : T σ , Δ ⊢ J are derivable.
(i) Refined: If J J J is a kind or type judgment and γ ∈ dom ( ⟦ ⊢ Γ , x : T τ , Δ c t x ⟧ ) \gamma\in\operatorname{dom}(\llbracket\vdash\Gamma,x:T\tau,\Delta\ \mathrm{ctx}\rrbracket) γ ∈ dom ( [ [ ⊢ Γ , x : T τ , Δ ctx ] ] ) and γ ∈ dom ( ⟦ ⊢ Γ , x : T σ , Δ c t x ⟧ ) \gamma\in\operatorname{dom}(\llbracket\vdash\Gamma,x:T\sigma,\Delta\ \mathrm{ctx}\rrbracket) γ ∈ dom ( [ [ ⊢ Γ , x : T σ , Δ ctx ] ] ) , then
⟦ Γ , x : T τ , Δ ⊢ J ⟧ ( γ ) = ⟦ Γ , x : T σ , Δ ⊢ J ⟧ ( γ ) . \llbracket\Gamma,x:T\tau,\Delta\vdash J\rrbracket(\gamma)
=
\llbracket\Gamma,x:T\sigma,\Delta\vdash J\rrbracket(\gamma). [ [ Γ , x : T τ , Δ ⊢ J ] ] ( γ ) = [ [ Γ , x : T σ , Δ ⊢ J ] ] ( γ ) . (ii) Unrefined: If J J J is a kind or type judgment and γ ∈ dom ( ⌊ ⌊ ⊢ Γ , x : T τ , Δ c t x ⌋ ⌋ ) \gamma\in\operatorname{dom}(\lfloor\lfloor\vdash\Gamma,x:T\tau,\Delta\ \mathrm{ctx}\rfloor\rfloor) γ ∈ dom (⌊⌊ ⊢ Γ , x : T τ , Δ ctx ⌋⌋) and γ ∈ dom ( ⌊ ⌊ ⊢ Γ , x : T σ , Δ c t x ⌋ ⌋ ) \gamma\in\operatorname{dom}(\lfloor\lfloor\vdash\Gamma,x:T\sigma,\Delta\ \mathrm{ctx}\rfloor\rfloor) γ ∈ dom (⌊⌊ ⊢ Γ , x : T σ , Δ ctx ⌋⌋) , then
⌊ ⌊ Γ , x : T τ , Δ ⊢ J ⌋ ⌋ ( γ ) = ⌊ ⌊ Γ , x : T σ , Δ ⊢ J ⌋ ⌋ ( γ ) , \lfloor\lfloor\Gamma,x:T\tau,\Delta\vdash J\rfloor\rfloor(\gamma)
=
\lfloor\lfloor\Gamma,x:T\sigma,\Delta\vdash J\rfloor\rfloor(\gamma), ⌊⌊ Γ , x : T τ , Δ ⊢ J ⌋⌋ ( γ ) = ⌊⌊ Γ , x : T σ , Δ ⊢ J ⌋⌋ ( γ ) ,
(iii) Propositions: If γ ∈ dom ( ⟦ ⊢ Γ , x : τ , Δ c t x ⟧ ) \gamma\in\operatorname{dom}(\llbracket\vdash\Gamma, x:\tau, \Delta\ \mathrm{ctx}\rrbracket) γ ∈ dom ( [ [ ⊢ Γ , x : τ , Δ ctx ] ] ) and γ ∈ dom ( ⟦ ⊢ Γ , x : σ , Δ c t x ⟧ ) \gamma\in\operatorname{dom}(\llbracket\vdash\Gamma, x:\sigma, \Delta\ \mathrm{ctx}\rrbracket) γ ∈ dom ( [ [ ⊢ Γ , x : σ , Δ ctx ] ] ) , then { { Γ , x : τ , Δ ⊢ ϕ p r p } } ( γ ) = { { Γ , x : σ , Δ ⊢ ϕ p r p } } ( γ ) \{\{\Gamma, x:\tau, \Delta\vdash\phi\ \mathrm{prp}\}\}(\gamma) = \{\{\Gamma, x:\sigma, \Delta\vdash\phi\ \mathrm{prp}\}\}(\gamma) {{ Γ , x : τ , Δ ⊢ ϕ prp }} ( γ ) = {{ Γ , x : σ , Δ ⊢ ϕ prp }} ( γ ) .
Proof. By structural induction on J J J . By Lemma C.11 the two derivations differ only by Tm-Sub steps inserted at occurrences of x x x ; every kind, type, and proposition formation node is shared, and no such node inspects the type annotation of a context entry. The projections ι − ( − ) \iota_{-}(-) ι − ( − ) and ρ − ( − ) \rho_{-}(-) ρ − ( − ) either drop the entry for x x x or forward its value without reading its annotation, and terms enter the interpretations only through ⟦ − ⟧ \llbracket- \rrbracket [ [ − ] ] , which is defined on raw syntax and depends only on ρ − ( − ) \rho_{-}(-) ρ − ( − ) ; hence the inserted Tm-Sub steps are invisible to the semantics. □ \square □
Domain theory
Definition 21 (Complete lattice). A complete lattice is a partially ordered set ( L , ≤ ) (L, \leq) ( L , ≤ ) such that every subset S ⊆ L S \subseteq L S ⊆ L has a least upper bound ⨆ S \bigsqcup S ⨆ S and a greatest lower bound \bigsqcap S in $L.
Definition 22 (Complete partial order). A complete partial order (CPO) is a partially ordered set ( P , ≤ ) (P, \leq) ( P , ≤ ) such that every directed subset D ⊆ P D \subseteq P D ⊆ P has a least upper bound ⨆ D \bigsqcup D ⨆ D in P P P .
A CPO is pointed if it has a least element ⊥ ∈ P \bot\in P ⊥ ∈ P .
Definition 23 (Monotone function). Given two partially ordered sets ( P , ≤ P ) (P, \leq_P) ( P , ≤ P ) and ( Q , ≤ Q ) (Q, \leq_Q) ( Q , ≤ Q ) , a function f : P → Q f:P \to Q f : P → Q is monotone if for all p 1 , p 2 ∈ P p_1,p_2 \in P p 1 , p 2 ∈ P , if p 1 ≤ P p 2 p_1 \leq_P p_2 p 1 ≤ P p 2 then f ( p 1 ) ≤ Q f ( p 2 ) f(p_1) \leq_Q f(p_2) f ( p 1 ) ≤ Q f ( p 2 ) .
Definition 24 (Continuous function). Given two complete partial orders ( P , ≤ P ) (P, \leq_P) ( P , ≤ P ) and ( Q , ≤ Q ) (Q, \leq_Q) ( Q , ≤ Q ) , a monotone f : P → Q f:P \to Q f : P → Q is continuous if for every directed subset D ⊆ P D \subseteq P D ⊆ P , f ( ⨆ D ) = ⨆ f ( D ) f(\bigsqcup D) = \bigsqcup f(D) f ( ⨆ D ) = ⨆ f ( D ) .
Lemma D.1 (Projection of tagged tuples). For every n n n there exists n j ≤ n n_j \leq n n j ≤ n such that
π n + 1 ( ⟨ C , v ‾ j m ⟩ ) = ⟨ π n ( C ) , π n j ( v ‾ j m ) ⟩ \pi_{n+1}(\langle C, \overline{v}^{\,m}_j\rangle) = \langle\pi_n(C), \pi_{n_j}(\overline{v}^{\,m}_j)\rangle π n + 1 (⟨ C , v j m ⟩) = ⟨ π n ( C ) , π n j ( v j m )⟩
Supporting lemmas
The equivalent theorem to Lemma 7.2 for kinds.
Lemma E.1 ((Anti-)Monotonicity of kinds). Let Δ ≜ Γ , K : K μ , x : σ ‾ i \Delta\triangleq\Gamma, K:K_\mu, x:\overline{\sigma}^{\,i} Δ ≜ Γ , K : K μ , x : σ i , where x i x_i x i can bind both type and term variables; given two context interpretations different only on the assignment of K K K ⟨ ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ , v ‾ i ⟩ \langle\langle\gamma,\langle P,P_\bot\rangle\rangle,\overline{v}^{\,i}\rangle ⟨⟨ γ , ⟨ P , P ⊥ ⟩⟩ , v i ⟩ , ⟨ ⟨ γ , ⟨ Q , P ⊥ ⟩ ⟩ , v ‾ i ⟩ ∈ dom ( ⟦ ⊢ Δ c t x ⟧ ) \langle\langle\gamma,\langle Q,P_\bot\rangle\rangle,\overline{v}^{\,i}\rangle\in\operatorname{dom}(\llbracket\vdash\Delta\ \mathrm{ctx}\rrbracket) ⟨⟨ γ , ⟨ Q , P ⊥ ⟩⟩ , v i ⟩ ∈ dom ( [ [ ⊢ Δ ctx ] ] ) , where P ≤ Q P \leq Q P ≤ Q . Let ⊢ Δ c t x \vdash\Delta\ \mathrm{ctx} ⊢ Δ ctx and Δ ⊢ κ : K d \Delta\vdash\kappa:\mathrm{Kd} Δ ⊢ κ : Kd be well-formed judgments, then
(i) If pol K ( κ ) ≤ + \operatorname{pol}_K(\kappa) \leq+ pol K ( κ ) ≤ + , then ⟦ Δ ⊢ κ : K d ⟧ ( ⟨ ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ , v ‾ i ⟩ ) ⊆ ⟦ Δ ⊢ κ : K d ⟧ ( ⟨ ⟨ γ , ⟨ Q , P ⊥ ⟩ ⟩ , v ‾ i ⟩ ) \llbracket\Delta\vdash\kappa:\mathrm{Kd}\rrbracket(\langle\langle\gamma,\langle P,P_\bot\rangle\rangle,\overline{v}^{\,i}\rangle) \subseteq\llbracket\Delta\vdash\kappa:\mathrm{Kd}\rrbracket(\langle\langle\gamma,\langle Q,P_\bot\rangle\rangle,\overline{v}^{\,i}\rangle) [ [ Δ ⊢ κ : Kd ] ] (⟨⟨ γ , ⟨ P , P ⊥ ⟩⟩ , v i ⟩) ⊆ [ [ Δ ⊢ κ : Kd ] ] (⟨⟨ γ , ⟨ Q , P ⊥ ⟩⟩ , v i ⟩) ,
(ii) If pol K ( κ ) ≤ − \operatorname{pol}_K(\kappa) \leq- pol K ( κ ) ≤ − , then ⟦ Δ ⊢ κ : K d ⟧ ( ⟨ ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ , v ‾ i ⟩ ) ⊇ ⟦ Δ ⊢ κ : K d ⟧ ( ⟨ ⟨ γ , ⟨ Q , P ⊥ ⟩ ⟩ , v ‾ i ⟩ ) \llbracket\Delta\vdash\kappa:\mathrm{Kd}\rrbracket(\langle\langle\gamma,\langle P,P_\bot\rangle\rangle,\overline{v}^{\,i}\rangle) \supseteq\llbracket\Delta\vdash\kappa:\mathrm{Kd}\rrbracket(\langle\langle\gamma,\langle Q,P_\bot\rangle\rangle,\overline{v}^{\,i}\rangle) [ [ Δ ⊢ κ : Kd ] ] (⟨⟨ γ , ⟨ P , P ⊥ ⟩⟩ , v i ⟩) ⊇ [ [ Δ ⊢ κ : Kd ] ] (⟨⟨ γ , ⟨ Q , P ⊥ ⟩⟩ , v i ⟩) .
The following is the analogue of Lemma 7.3 for the unrefined semantics; as discussed in § 8.2 , a less general statement suffices here, since no under-approximation of the inductive type is needed.
Lemma E.2 (Unrefined semantics is PER-respecting (Eliminator)). Let D ≜ μ K ν { C : ( y : σ j ) → K ⋅ t j k } D \triangleq\mu K^{\nu}\left\{C:(y:\sigma^j)\to K \cdot t^k_j\right\} D ≜ μ K ν { C : ( y : σ j ) → K ⋅ t j k } , Δ ( i ) ≜ K : K κ ( x : τ k ) → T y \Delta(i) \triangleq K:K_{\kappa}(x:\tau^k)\to\mathrm{Ty} Δ ( i ) ≜ K : K κ ( x : τ k ) → Ty , y : σ i y:\sigma^i y : σ i and P ⊥ ( γ ) ≜ ⟦ Γ ⊢ D : ( x : τ k ) → T y ⟧ ( ι Γ ( γ ) ) P_{\bot}(\gamma) \triangleq\llbracket\Gamma\vdash D:(x:\tau^k)\to\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)) P ⊥ ( γ ) ≜ [ [ Γ ⊢ D : ( x : τ k ) → Ty ] ] ( ι Γ ( γ )) . If the following judgments are well-formed: ⊢ Γ \vdash\Gamma ⊢ Γ , Δ ( j ) c t x \Delta(j)\ \mathrm{ctx} Δ ( j ) ctx and Γ , x : τ k , y : D ⊢ x k + ρ : T y \Gamma, x:\tau^k, y:D \vdash x^k + \rho:\mathrm{Ty} Γ , x : τ k , y : D ⊢ x k + ρ : Ty . Given two related context interpretations ⟨ ⟨ γ , P ⊥ ( γ ) ⟩ , ϵ ⟩ \langle\langle\gamma,P_{\bot}(\gamma)\rangle,\epsilon\rangle ⟨⟨ γ , P ⊥ ( γ )⟩ , ϵ ⟩ , ⟨ ⟨ δ , P ⊥ ( δ ) ⟩ , θ ⟩ ∈ ⟦ Γ , Δ ( j − 1 ) c t x ⟧ \langle\langle\delta,P_{\bot}(\delta)\rangle,\theta\rangle\in\llbracket\Gamma,\Delta(j-1)\ \mathrm{ctx}\rrbracket ⟨⟨ δ , P ⊥ ( δ )⟩ , θ ⟩ ∈ [ [ Γ , Δ ( j − 1 ) ctx ] ] , two related realizers of the eliminator ⟨ r , r ′ ⟩ ∈ ⟦ Γ ⊢ D : ( x : τ k ) → D ⊢ ρ : T y ⟧ \langle r,r'\rangle\in\llbracket\Gamma\vdash D:(x:\tau^k)\to D \vdash\rho:\mathrm{Ty}\rrbracket ⟨ r , r ′ ⟩ ∈ [ [ Γ ⊢ D : ( x : τ k ) → D ⊢ ρ : Ty ] ] and some term Γ , Δ ( j − 1 ) + m : σ j \Gamma,\Delta(j-1)+m:\sigma_j Γ , Δ ( j − 1 ) + m : σ j , then the eliminators realize induction hypothesis over argument m m m :
⟨ t m E l K : r ( σ j , γ ρ , ( m ) ( γ ) ) , t m E l K : r ′ ( σ j , δ ρ , ( m ) ( δ ρ ) ) ⟩ ∈ ⟦ Γ , Δ ( j − 1 ) ⊢ E l K ; ρ ( m , σ j ) : T y ⟧ ( ⟨ ⟨ γ , P ⊥ ( γ ) ⟩ , ϵ ⟩ ) \left\langle
\begin{array}{l}
\mathrm{tmEl}_{K:r}(\sigma_j,\gamma_{\rho},(m)(\gamma)),\\
\mathrm{tmEl}_{K:r'}(\sigma_j,\delta_{\rho},(m)(\delta_{\rho}))
\end{array}
\right\rangle\in\llbracket\Gamma,\Delta(j-1)\vdash\mathrm{El}_{K;\rho}(m,\sigma_j):\mathrm{Ty}\rrbracket(\langle\langle\gamma,P_{\bot}(\gamma)\rangle,\epsilon\rangle) ⟨ tmEl K : r ( σ j , γ ρ , ( m ) ( γ )) , tmEl K : r ′ ( σ j , δ ρ , ( m ) ( δ ρ )) ⟩ ∈ [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , σ j ) : Ty ] ] (⟨⟨ γ , P ⊥ ( γ )⟩ , ϵ ⟩) Where ⟨ γ ρ , δ ρ ⟩ ∈ ⟦ Γ , Δ ( j − 1 ) ⟧ ( ⟨ ⟨ γ , P ⊥ ( γ ) ⟩ , ϵ ⟩ ) \langle\gamma_{\rho},\delta_{\rho}\rangle\in\llbracket\Gamma,\Delta(j-1)\rrbracket(\langle\langle\gamma,P_{\bot}(\gamma)\rangle,\epsilon\rangle) ⟨ γ ρ , δ ρ ⟩ ∈ [ [ Γ , Δ ( j − 1 ) ] ] (⟨⟨ γ , P ⊥ ( γ )⟩ , ϵ ⟩)
Main Proofs
The unrefined statements (Theorem 5.1 (ii), Theorem 5.2 (ii), Theorem 5.3 (ii), Theorem 5.6 (ii), Theorem 6.2 (ii), Theorem 7.1 , and Lemma E.2 ) never mention the refined interpretations and are proved by mutual induction on typing derivations. Monotonicity (Lemmas E.1 and 7.2 ) and Theorem 5.4 , together with Corollary 1 and Lemma 5.5 , follow by induction on derivations, using only the statements above. These lemmas are statements about the refined interpretations but consume only their definitions, never the refined statements below; the definitions themselves are given by induction on derivations, simultaneously with Theorem 7.1 and Lemma 7.2 , which justify the fixed points taken in the interpretation of inductive types at strictly smaller derivations. Finally, the refined statements (Theorem 5.1 (i), Theorem 5.2 (i), Theorem 5.3 (i), Theorem 5.6 (i), Theorem 6.2 (i), Theorem 6.1 , and Lemma 7.3 ) are proved by one further mutual induction on typing derivations; in particular, a refined statement may invoke its unrefined counterpart at the same judgment.
Proof of Lemma 3.2 . If ⟨ π n ( a ) , π n ( b ) ⟩ ∈ S n \langle\pi_n(a), \pi_n(b)\rangle\in S_n ⟨ π n ( a ) , π n ( b )⟩ ∈ S n with ⟨ a , b ⟩ ∈ S \langle a, b\rangle\in S ⟨ a , b ⟩ ∈ S , then ⟨ π n ( a ) , π n ( b ) ⟩ ∈ S \langle\pi_n(a), \pi_n(b)\rangle\in S ⟨ π n ( a ) , π n ( b )⟩ ∈ S by uniformity, and π n ( a ) , π n ( b ) ∈ D n \pi_n(a), \pi_n(b) \in D_n π n ( a ) , π n ( b ) ∈ D n . Conversely, if ⟨ x , y ⟩ ∈ S \langle x, y\rangle\in S ⟨ x , y ⟩ ∈ S with x , y ∈ D n x, y \in D_n x , y ∈ D n then x = π n ( x ) x = \pi_n(x) x = π n ( x ) and y = π n ( y ) y = \pi_n(y) y = π n ( y ) , so ⟨ x , y ⟩ ∈ S n \langle x, y\rangle\in S_n ⟨ x , y ⟩ ∈ S n . For the inclusion, D j ⊆ D n D_j \subseteq D_n D j ⊆ D n when j ≤ n j \le n j ≤ n because π n ∘ π j = π j \pi_n \circ\pi_j = \pi_j π n ∘ π j = π j , whence S ∩ ( D j × D j ) ⊆ S ∩ ( D n × D n ) S \cap(D_j \times D_j) \subseteq S \cap(D_n \times D_n) S ∩ ( D j × D j ) ⊆ S ∩ ( D n × D n ) . □
Proof of Lemma 3.3 . Let ⟨ a , b ⟩ ∈ A \langle a, b\rangle\in A ⟨ a , b ⟩ ∈ A . By uniformity and lemma 3.2, ⟨ π n ( a ) , π n ( b ) ⟩ ∈ A n = B n ⊆ B \langle\pi_n(a), \pi_n(b)\rangle\in A_n = B_n \subseteq B ⟨ π n ( a ) , π n ( b )⟩ ∈ A n = B n ⊆ B for every n n n . The family { ⟨ π n ( a ) , π n ( b ) ⟩ } n \{\langle\pi_n(a), \pi_n(b)\rangle\}_n {⟨ π n ( a ) , π n ( b )⟩ } n is directed with least upper bound ⟨ a , b ⟩ \langle a, b\rangle ⟨ a , b ⟩ , since ⨆ n π n = i d \bigsqcup_n \pi_n = id ⨆ n π n = i d ; by completeness of B B B , ⟨ a , b ⟩ ∈ B \langle a, b\rangle\in B ⟨ a , b ⟩ ∈ B . Hence A ⊆ B A \subseteq B A ⊆ B , and symmetrically B ⊆ A B \subseteq A B ⊆ A . □
Proof of Lemma 3.4 . Uniqueness. Suppose Φ ( R ) = R \Phi(R) = R Φ ( R ) = R and Φ ( S ) = S \Phi(S) = S Φ ( S ) = S . We show R n = S n R_n = S_n R n = S n by induction on n n n . Since π 0 \pi_0 π 0 is the constant map ⊥ \bot ⊥ , both approximations equal { ⟨ ⊥ , ⊥ ⟩ } \{\langle\bot, \bot\rangle\} {⟨ ⊥ , ⊥ ⟩} at n = 0 n = 0 n = 0 ; and if R n = S n R_n = S_n R n = S n then contractivity gives R n + 1 = Φ ( R ) n + 1 = Φ ( S ) n + 1 = S n + 1 R_{n+1} = \Phi(R)_{n+1} = \Phi(S)_{n+1} = S_{n+1} R n + 1 = Φ ( R ) n + 1 = Φ ( S ) n + 1 = S n + 1 . By lemma 3.3, R = S R = S R = S .
Existence. Put R 0 ≜ D × D R^0 \triangleq D \times D R 0 ≜ D × D and R k + 1 ≜ Φ ( R k ) R^{k+1} \triangleq\Phi(R^k) R k + 1 ≜ Φ ( R k ) ; each R k R^k R k is a CUPER. Using contractivity, a routine induction shows the iterates stabilise, ( R m ) k = ( R k ) k (R^m)_k = (R^k)_k ( R m ) k = ( R k ) k whenever m ≥ k m \ge k m ≥ k , the base case holding because all CUPERs agree at level 0. Writing R n ≜ ( R n ) n R_n \triangleq(R^n)_n R n ≜ ( R n ) n for the stabilised level-n n n data—not yet known to coincide with the approximation ( R ) n (R)_n ( R ) n of the limit R R R defined below—the family is increasing and coherent, ( R n + 1 ) n = R n (R_{n+1})_n = R_n ( R n + 1 ) n = R n , by lemma 3.2 and stabilisation. Define
R ≜ { ⟨ a , b ⟩ ∈ D × D ∣ ∀ n . ⟨ π n ( a ) , π n ( b ) ⟩ ∈ R n } . R \triangleq\{\langle a,b\rangle\in D \times D \mid\forall n.\ \langle\pi_n(a), \pi_n(b)\rangle\in R_n\}. R ≜ {⟨ a , b ⟩ ∈ D × D ∣ ∀ n . ⟨ π n ( a ) , π n ( b )⟩ ∈ R n } .
Then R R R is a CUPER: symmetry and transitivity hold because each R n = R n ∩ ( D n × D n ) R_n = R^n \cap(D_n \times D_n) R n = R n ∩ ( D n × D n ) is a PER (lemma 3.2); pointedness is immediate, and uniformity follows from the monotonicity R j ⊆ R n R_j \subseteq R_n R j ⊆ R n (j ≤ n j \le n j ≤ n ); and for completeness, if { ⟨ a i , b i ⟩ } i ⊆ R \{\langle a_i, b_i\rangle\}_i \subseteq R {⟨ a i , b i ⟩ } i ⊆ R is directed with least upper bound ⟨ a , b ⟩ \langle a, b\rangle ⟨ a , b ⟩ , then continuity of each π n \pi_n π n makes ⟨ π n ( a ) , π n ( b ) ⟩ \langle\pi_n(a), \pi_n(b)\rangle ⟨ π n ( a ) , π n ( b )⟩ the least upper bound of the directed family { ⟨ π n ( a i ) , π n ( b i ) ⟩ } i ⊆ R n \{\langle\pi_n(a_i), \pi_n(b_i)\rangle\}_i \subseteq R_n {⟨ π n ( a i ) , π n ( b i )⟩ } i ⊆ R n ; since R n = R n ∩ ( D n × D n ) R_n = R^n \cap(D_n \times D_n) R n = R n ∩ ( D n × D n ) is closed under directed least upper bounds—R n R^n R n being complete and D n × D n D_n \times D_n D n × D n Scott-closed—this bound lies in R n R_n R n , so ⟨ a , b ⟩ ∈ R \langle a, b\rangle\in R ⟨ a , b ⟩ ∈ R . Moreover ( R ) n = R n (R)_n = R_n ( R ) n = R n : the inclusion ( R ) n ⊆ R n (R)_n \subseteq R_n ( R ) n ⊆ R n is immediate, and conversely, given ⟨ x , y ⟩ ∈ R n ⊆ D n × D n \langle x, y\rangle\in R_n \subseteq D_n \times D_n ⟨ x , y ⟩ ∈ R n ⊆ D n × D n , coherence and monotonicity give ⟨ π m ( x ) , π m ( y ) ⟩ ∈ R m \langle\pi_m(x), \pi_m(y)\rangle\in R_m ⟨ π m ( x ) , π m ( y )⟩ ∈ R m for every m m m , so ⟨ x , y ⟩ ∈ R \langle x, y\rangle\in R ⟨ x , y ⟩ ∈ R since π n ( x ) = x \pi_n(x) = x π n ( x ) = x and y = π n ( y ) y = \pi_n(y) y = π n ( y ) , this places ⟨ x , y ⟩ \langle x, y\rangle ⟨ x , y ⟩ in ( R ) n (R)_n ( R ) n . Finally R R R is a fixed point: R R R and R n R^n R n share the n n n -th approximation R n R_n R n , so contractivity gives Φ ( R ) n + 1 = Φ ( R n ) n + 1 = ( R n + 1 ) n + 1 = R n + 1 \Phi(R)_{n+1} = \Phi(R^n)_{n+1} = (R^{n+1})_{n+1} = R_{n+1} Φ ( R ) n + 1 = Φ ( R n ) n + 1 = ( R n + 1 ) n + 1 = R n + 1 , while Φ ( R ) 0 = { ⟨ ⊥ , ⊥ ⟩ } = R 0 \Phi(R)_0 = \{\langle\bot, \bot\rangle\} = R_0 Φ ( R ) 0 = {⟨ ⊥ , ⊥ ⟩} = R 0 ; hence Φ ( R ) = R \Phi(R) = R Φ ( R ) = R by lemma 3.3. □
Proof of Lemma D.1 . In the limit, π n + 1 ⟨ a , b ⟩ = ⟨ π n ( a ) , π n ( b ) ⟩ \pi_{n+1}\langle a, b\rangle= \langle\pi_n(a), \pi_n(b)\rangle π n + 1 ⟨ a , b ⟩ = ⟨ π n ( a ) , π n ( b )⟩ hence we can apply the identity recursively inside the nested pairs. □
Proof of Theorem 5.1 (i). By induction on the structure of Γ ⊢ κ : K d \Gamma\vdash\kappa\mathbin{:}\mathrm{Kd} Γ ⊢ κ : Kd .
⟦ Γ ⊢ T y : K d ⟧ ( γ ) = P E R ( D ) = ⟦ Γ ⊢ T y : K d ⟧ ( δ ) \llbracket\Gamma\vdash\mathsf{Ty:Kd} \rrbracket(\gamma)=\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D})=\llbracket\Gamma\vdash\mathsf{Ty:Kd}\rrbracket(\delta) [ [ Γ ⊢ Ty : Kd ] ] ( γ ) = P E R ( D ) = [ [ Γ ⊢ Ty : Kd ] ] ( δ )
⟦ Γ ⊢ ( x : τ ) → κ : K d ⟧ ( γ ) = { f | f ∈ D → ( D → ) arity ( κ ) P E R ( D ) ∀ v ∈ dom ( ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ) f ( v ) ∈ ⟦ Γ , x : τ ⊢ κ : K d ⟧ ( ⟨ γ , v ⟩ ) ∀ ⟨ v , w ⟩ ∈ ( ⟦ Γ ⊢ τ : T y ⟧ ( I τ ( γ ) ) ∩ dom ( ( ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ) 2 ) ) f ( v ) = f ( w ) } \begin{aligned}
\llbracket\Gamma\vdash(x:\tau)\to\kappa:\mathsf{Kd}\rrbracket(\gamma) \\
&=\left\{f\ \middle|\begin{array}{l}
f\in\mathcal{D}\to(\mathcal{D}\to)^{\operatorname{arity}(\kappa)}\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D})\\
\forall v\in\operatorname{dom}(\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\gamma))\ f(v)\in\llbracket\Gamma,x:\tau\vdash\kappa:\mathsf{Kd}\rrbracket(\langle\gamma,v\rangle)\\
\forall\langle v,w\rangle\in(\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(I_{\tau}(\gamma))\cap\operatorname{dom}((\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\gamma))^2))\ f(v)=f(w)
\end{array}\right\}
\end{aligned} [ [ Γ ⊢ ( x : τ ) → κ : Kd ] ] ( γ ) = ⎩ ⎨ ⎧ f f ∈ D → ( D → ) arity ( κ ) P E R ( D ) ∀ v ∈ dom ( [ [ Γ ⊢ τ : Ty ] ] ( γ )) f ( v ) ∈ [ [ Γ , x : τ ⊢ κ : Kd ] ] (⟨ γ , v ⟩) ∀ ⟨ v , w ⟩ ∈ ( [ [ Γ ⊢ τ : Ty ] ] ( I τ ( γ )) ∩ dom (( [ [ Γ ⊢ τ : Ty ] ] ( γ ) ) 2 )) f ( v ) = f ( w ) ⎭ ⎬ ⎫
By I. H. and Theorem 5.3
= { f | f ∈ D → ( D → ) arity ( κ ) P E R ( D ) ∀ v ∈ dom ( ⟦ Γ ⊢ τ : T y ⟧ ( δ ) ) f ( v ) ∈ ⟦ Γ , x : τ ⊢ κ : K d ⟧ ( ⟨ δ , v ⟩ ) ∀ ⟨ v , w ⟩ ∈ ( ⟦ Γ ⊢ τ : T y ⟧ ( I τ ( δ ) ) ∩ dom ( ( ⟦ Γ ⊢ τ : T y ⟧ ( δ ) ) 2 ) ) f ( v ) = f ( w ) } = ⟦ Γ ⊢ ( x : τ ) → κ : K d ⟧ ( δ ) \begin{aligned}
=\left\{f\ \middle|\begin{array}{l}
f\in\mathcal{D}\to(\mathcal{D}\to)^{\operatorname{arity}(\kappa)}\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D})\\
\forall v\in\operatorname{dom}(\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\delta))\ f(v)\in\llbracket\Gamma,x:\tau\vdash\kappa:\mathsf{Kd}\rrbracket(\langle\delta,v\rangle)\\
\forall\langle v,w\rangle\in(\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(I_{\tau}(\delta))\cap\operatorname{dom}((\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\delta))^2))\ f(v)=f(w)
\end{array}\right\} \\
&=\llbracket\Gamma\vdash(x:\tau)\to\kappa:\mathsf{Kd}\rrbracket(\delta)
\end{aligned} = ⎩ ⎨ ⎧ f f ∈ D → ( D → ) arity ( κ ) P E R ( D ) ∀ v ∈ dom ( [ [ Γ ⊢ τ : Ty ] ] ( δ )) f ( v ) ∈ [ [ Γ , x : τ ⊢ κ : Kd ] ] (⟨ δ , v ⟩) ∀ ⟨ v , w ⟩ ∈ ( [ [ Γ ⊢ τ : Ty ] ] ( I τ ( δ )) ∩ dom (( [ [ Γ ⊢ τ : Ty ] ] ( δ ) ) 2 )) f ( v ) = f ( w ) ⎭ ⎬ ⎫ = [ [ Γ ⊢ ( x : τ ) → κ : Kd ] ] ( δ )
Proof of Theorem 5.1 (ii). By induction on the structure of Γ ⊢ κ : K d \Gamma\vdash\kappa:\mathsf{Kd} Γ ⊢ κ : Kd .
⟦ Γ ⊢ T y : K d ⟧ ( γ ) = C U P E R ( D ) = ⟦ Γ ⊢ T y : K d ⟧ ( δ ) \llbracket\Gamma\vdash\mathsf{Ty:Kd}\rrbracket(\gamma)=\mathcal{C}\mathcal{U}\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D})=\llbracket\Gamma\vdash\mathsf{Ty:Kd}\rrbracket(\delta) [ [ Γ ⊢ Ty : Kd ] ] ( γ ) = C UP E R ( D ) = [ [ Γ ⊢ Ty : Kd ] ] ( δ )
⟦ Γ ⊢ ( x : τ ) → κ : K d ⟧ ( γ ) = ⟦ Γ , x : τ ⊢ κ : K d ⟧ ( γ ) \begin{aligned}
\llbracket\Gamma\vdash(x:\tau)\to\kappa:\mathsf{Kd}\rrbracket(\gamma) \\
&=\llbracket\Gamma,x:\tau\vdash\kappa:\mathsf{Kd}\rrbracket(\gamma)
\end{aligned} [ [ Γ ⊢ ( x : τ ) → κ : Kd ] ] ( γ ) = [ [ Γ , x : τ ⊢ κ : Kd ] ] ( γ )
By I. H.
= ⟦ Γ , x : τ ⊢ κ : K d ⟧ ( δ ) = ⟦ Γ ⊢ ( x : τ ) → κ : K d ⟧ ( δ ) \begin{aligned}
=\llbracket\Gamma,x:\tau\vdash\kappa:\mathsf{Kd}\rrbracket(\delta) \\
&=\llbracket\Gamma\vdash(x:\tau)\to\kappa:\mathsf{Kd}\rrbracket(\delta)
\end{aligned} = [ [ Γ , x : τ ⊢ κ : Kd ] ] ( δ ) = [ [ Γ ⊢ ( x : τ ) → κ : Kd ] ] ( δ )
Proof of Theorem 5.2 (i). By induction on the structure of Γ ⊢ τ : κ \Gamma\vdash\tau:\kappa Γ ⊢ τ : κ .
⟦ Γ ⊢ B : κ ⟧ ( γ ) = { ⟨ i B ( v ) , i B ( v ) ⟩ ∣ v ∈ B } ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) = P E R ( D ) \llbracket\Gamma\vdash B:\kappa\rrbracket(\gamma)=\{\langle i_B(v),i_B(v)\rangle\mid v\in\mathcal{B}\}\in\llbracket\Gamma\vdash\kappa:\mathsf{Kd}\rrbracket(\gamma)=\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D}) [ [ Γ ⊢ B : κ ] ] ( γ ) = {⟨ i B ( v ) , i B ( v )⟩ ∣ v ∈ B } ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) = P E R ( D )
The diagonal relation over a subset of D \mathcal{D} D is a PER.
⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( γ ) = { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ⟨ γ , v ⟩ ) ∀ ⟨ v 1 , w 1 ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( I τ ( γ ) ) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( I τ ( γ ) ) } \begin{aligned}
\llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathsf{Ty}\rrbracket(\gamma) \\
&=\left\{\langle f,g\rangle\ \middle|\begin{array}{l}
\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\gamma).\ \langle f\mathbin{\cdot}v,g\mathbin{\cdot}w\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathsf{Ty}\rrbracket(\langle\gamma,v\rangle)\\
\forall\langle v_1,w_1\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(I_{\tau}(\gamma)).\ \langle f\mathbin{\cdot}v_1,g\mathbin{\cdot}w_1\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathsf{Ty}\rrbracket(I_{\tau}(\gamma))
\end{array}\right\}
\end{aligned} [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( γ ) = { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] (⟨ γ , v ⟩) ∀ ⟨ v 1 , w 1 ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( I τ ( γ )) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( I τ ( γ )) }
∈ ⟦ Γ ⊢ T y : K d ⟧ ( γ ) = P E R ( D ) \in\llbracket\Gamma\vdash\mathsf{Ty}:\mathsf{Kd}\rrbracket(\gamma)=\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D}) ∈ [ [ Γ ⊢ Ty : Kd ] ] ( γ ) = P E R ( D )
It is not enough to show that each of the two defining conditions determines a PER on its own, since neither is in general closed under symmetry by itself. Instead, we show directly that the whole set is a PER.
(1) Symmetry: Fix ⟨ f , g ⟩ \langle f,g\rangle ⟨ f , g ⟩ in the set. We must show that ⟨ g , f ⟩ \langle g,f\rangle ⟨ g , f ⟩ satisfies the defining condition for every ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\gamma) ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) and ⟨ v 1 , w 1 ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( I τ ( γ ) ) \langle v_1,w_1\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(I_{\tau}(\gamma)) ⟨ v 1 , w 1 ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( I τ ( γ )) . By symmetry of the domain PERs, ⟨ w , v ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle w,v\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\gamma) ⟨ w , v ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) and ⟨ w 1 , v 1 ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( I τ ( γ ) ) \langle w_1,v_1\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(I_{\tau}(\gamma)) ⟨ w 1 , v 1 ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( I τ ( γ )) . Instantiating the assumption for ⟨ f , g ⟩ \langle f,g\rangle ⟨ f , g ⟩ at these swapped arguments gives
⟨ f ⋅ w , g ⋅ v ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ⟨ γ , w ⟩ ) \langle f\mathbin{\cdot}w,g\mathbin{\cdot}v\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathsf{Ty}\rrbracket(\langle\gamma,w\rangle) ⟨ f ⋅ w , g ⋅ v ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] (⟨ γ , w ⟩)
and
⟨ f ⋅ w ⊥ , g ⋅ v ⊥ ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : T y ⟧ ( ι Γ ( γ ) ) . \langle f \mathbin{\cdot} w_{\perp},g \mathbin{\cdot} v_{\perp}\rangle\in\llbracket\Gamma,x:T_{\tau}\vdash\sigma:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)). ⟨ f ⋅ w ⊥ , g ⋅ v ⊥ ⟩ ∈ [ [ Γ , x : T τ ⊢ σ : Ty ] ] ( ι Γ ( γ )) .
By symmetry of these PERs we obtain the same pairs in the opposite order. Finally, ⟨ ⟨ γ , w ⟩ , ⟨ γ , v ⟩ ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : c t x ⟧ \langle\langle\gamma,w\rangle,\langle\gamma,v\rangle\rangle\in\llbracket\Gamma,x:T_{\tau}\vdash\sigma:\mathrm{ctx}\rrbracket ⟨⟨ γ , w ⟩ , ⟨ γ , v ⟩⟩ ∈ [ [ Γ , x : T τ ⊢ σ : ctx ] ] , so Theorem 5.3 (i) transports the refined codomain relation from [ ⟨ γ , w ⟩ ] [\langle\gamma,w\rangle] [⟨ γ , w ⟩] to [ ⟨ γ , v ⟩ ] [\langle\gamma,v\rangle] [⟨ γ , v ⟩] . Hence ⟨ g , f ⟩ \langle g,f\rangle ⟨ g , f ⟩ is in the set.
(2) Transitivity: Fix ⟨ f , g ⟩ \langle f,g\rangle ⟨ f , g ⟩ and ⟨ g , h ⟩ \langle g,h\rangle ⟨ g , h ⟩ in the set. We again fix arbitrary ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) and ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) \langle v_{\perp},w_{\perp}\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)) ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) . By partial reflexivity, ⟨ v , v ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle v,v\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨ v , v ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) and ⟨ v ⊥ , v ⊥ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) \langle v_{\perp},v_{\perp}\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)) ⟨ v ⊥ , v ⊥ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) . Instantiating the first assumption at these reflexive pairs gives
⟨ f ⋅ v , g ⋅ v ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : T y ⟧ ( ⟨ γ , v ⟩ ) \langle f\mathbin{\cdot}v,g\mathbin{\cdot}v\rangle\in\llbracket\Gamma,x:T_{\tau}\vdash\sigma:\mathrm{Ty}\rrbracket(\langle\gamma,v\rangle) ⟨ f ⋅ v , g ⋅ v ⟩ ∈ [ [ Γ , x : T τ ⊢ σ : Ty ] ] (⟨ γ , v ⟩)
and
⟨ f ⋅ v ⊥ , g ⋅ v ⊥ ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : T y ⟧ ( ι Γ ( γ ) ) . \langle f\mathbin{\cdot}v_{\perp},g\mathbin{\cdot}v_{\perp}\rangle\in\llbracket\Gamma,x:T_{\tau}\vdash\sigma:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)). ⟨ f ⋅ v ⊥ , g ⋅ v ⊥ ⟩ ∈ [ [ Γ , x : T τ ⊢ σ : Ty ] ] ( ι Γ ( γ )) .
Instantiating the second assumption at ⟨ v , w ⟩ \langle v,w\rangle ⟨ v , w ⟩ and ⟨ v ⊥ , w ⊥ ⟩ \langle v_{\perp},w_{\perp}\rangle ⟨ v ⊥ , w ⊥ ⟩ gives the corresponding pairs from g g g to h h h . Transitivity of the codomain PERs therefore yields
⟨ f ⋅ v , h ⋅ w ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : T y ⟧ ( ⟨ γ , v ⟩ ) \langle f\mathbin{\cdot}v,h\mathbin{\cdot}w\rangle\in\llbracket\Gamma,x:T_{\tau}\vdash\sigma:\mathrm{Ty}\rrbracket(\langle\gamma,v\rangle) ⟨ f ⋅ v , h ⋅ w ⟩ ∈ [ [ Γ , x : T τ ⊢ σ : Ty ] ] (⟨ γ , v ⟩)
and
⟨ f ⋅ v ⊥ , h ⋅ w ⊥ ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : T y ⟧ ( ι Γ ( γ ) ) . \langle f\mathbin{\cdot}v_{\perp},h\mathbin{\cdot}w_{\perp}\rangle\in\llbracket\Gamma,x:T_{\tau}\vdash\sigma:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)). ⟨ f ⋅ v ⊥ , h ⋅ w ⊥ ⟩ ∈ [ [ Γ , x : T τ ⊢ σ : Ty ] ] ( ι Γ ( γ )) .
Hence ⟨ f , h ⟩ \langle f,h\rangle ⟨ f , h ⟩ is in the set.
⟦ Γ ⊢ ∀ x : κ . τ : T y ⟧ ( γ ) = { ⟨ v , w ⟩ | ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) , ∀ P ⊥ ∈ ⟦ Γ ⊢ κ : K d ⟧ ( ι Γ ( γ ) ) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) } ∈ ⟦ Γ ⊢ T y : K d ⟧ ( γ ) = P E R ( D ) \llbracket\Gamma\vdash\forall x:\kappa.\tau:\mathrm{Ty}\rrbracket(\gamma)
=
\left\{\langle v,w\rangle\mathrel{\middle|} \begin{array}{l}
\forall P\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma),\ \forall P_{\perp}\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\iota_{\Gamma}(\gamma))\\
\pi_{\Gamma;\kappa}(\gamma,P)\subseteq P_{\perp}\Rightarrow\langle v,w\rangle\in\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket(\langle\gamma,\langle P,P_{\perp}\rangle\rangle)
\end{array}\right\}
\in\llbracket\Gamma\vdash\mathrm{Ty}:\mathrm{Kd}\rrbracket(\gamma)=\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D}) [ [ Γ ⊢ ∀ x : κ . τ : Ty ] ] ( γ ) = { ⟨ v , w ⟩ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) , ∀ P ⊥ ∈ [ [ Γ ⊢ κ : Kd ] ] ( ι Γ ( γ )) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , ⟨ P , P ⊥ ⟩⟩) } ∈ [ [ Γ ⊢ Ty : Kd ] ] ( γ ) = P E R ( D )
Since PERs are closed under intersection, it suffices to show that for each fixed P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) P\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma) P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) and P ⊥ ∈ ⟦ Γ ⊢ κ : K d ⟧ ( ι Γ ( γ ) ) P_{\perp}\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\iota_{\Gamma}(\gamma)) P ⊥ ∈ [ [ Γ ⊢ κ : Kd ] ] ( ι Γ ( γ )) the set
{ ⟨ v , w ⟩ | π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) } \left\{\langle v,w\rangle\mathrel{\middle|} \pi_{\Gamma;\kappa}(\gamma,P)\subseteq P_{\perp}\Rightarrow\langle v,w\rangle\in\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket(\langle\gamma,\langle P,P_{\perp}\rangle\rangle)\right\} { ⟨ v , w ⟩ π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , ⟨ P , P ⊥ ⟩⟩) }
is a PER. If π Γ ; κ ( γ , P ) ⊈ P ⊥ \pi_{\Gamma;\kappa}(\gamma,P)\not\subseteq P_{\perp} π Γ ; κ ( γ , P ) ⊆ P ⊥ the implication holds vacuously for every pair, so the set is all of D × D \mathcal{D}\times\mathcal{D} D × D , which is trivially a PER. Otherwise the set equals ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) \llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket(\langle\gamma,\langle P,P_{\perp}\rangle\rangle) [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , ⟨ P , P ⊥ ⟩⟩) , which we show is a PER.
(1) Symmetry: Fix ⟨ v , w ⟩ \langle v,w\rangle ⟨ v , w ⟩ in the set, by I. H. and symmetry of PERs we have ⟨ w , v ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) \langle w,v\rangle\in\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket(\langle\gamma,\langle P,P_{\perp}\rangle\rangle) ⟨ w , v ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , ⟨ P , P ⊥ ⟩⟩) thus ⟨ w , v ⟩ \langle w,v\rangle ⟨ w , v ⟩ is in the set.
(2) Transitivity: Fix ⟨ v , w ⟩ \langle v,w\rangle ⟨ v , w ⟩ and ⟨ w , q ⟩ \langle w,q\rangle ⟨ w , q ⟩ in the set, by I. H. and transitivity of PERs we have ⟨ v , q ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) \langle v,q\rangle\in\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket(\langle\gamma,\langle P,P_{\perp}\rangle\rangle) ⟨ v , q ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , ⟨ P , P ⊥ ⟩⟩) thus ⟨ v , q ⟩ \langle v,q\rangle ⟨ v , q ⟩ is in the set.
⟦ Γ ⊢ x : κ ⟧ ( γ ) = γ ( x ) 1 ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) \llbracket\Gamma\vdash x:\kappa\rrbracket(\gamma)=\gamma(x)_1\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma) [ [ Γ ⊢ x : κ ] ] ( γ ) = γ ( x ) 1 ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ )
by assumption.
⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) = { ⟨ v , w ⟩ | ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ⟦ Γ , x : T τ ⊢ ϕ p r p ⟧ ( ⟨ γ , v ⟩ ) = t t } ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) = P E R ( D ) \llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty}\rrbracket(\gamma)
=
\left\{\langle v,w\rangle\mathrel{\middle|} \begin{array}{l}
\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma)\\
\llbracket\Gamma,x:T_{\tau}\vdash\phi\ \mathrm{prp}\rrbracket(\langle\gamma,v\rangle)=\mathrm{tt}
\end{array}\right\}
\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma)=\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D}) [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) = { ⟨ v , w ⟩ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) [ [ Γ , x : T τ ⊢ ϕ prp ] ] (⟨ γ , v ⟩) = tt } ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) = P E R ( D )
we show that it is a PER (1) Symmetry: Fix ⟨ v , w ⟩ \langle v,w\rangle ⟨ v , w ⟩ in the set, by I. H. and symmetry of PERs we have ⟨ w , v ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle w,v\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨ w , v ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) and by Theorem 6.1 we have { { Γ , x : T τ ⊢ ϕ p r p } } ( ⟨ γ , w ⟩ ) = t t \{\{\Gamma,x:T\tau\vdash\phi\ \mathrm{prp}\}\}(\langle\gamma,w\rangle)=\mathrm{tt} {{ Γ , x : T τ ⊢ ϕ prp }} (⟨ γ , w ⟩) = tt thus ⟨ w , v ⟩ \langle w,v\rangle ⟨ w , v ⟩ is in the set.
(2) Transitivity: Fix ⟨ v , w ⟩ \langle v,w\rangle ⟨ v , w ⟩ and ⟨ w , q ⟩ \langle w,q\rangle ⟨ w , q ⟩ in the set, by I. H. and transitivity of PERs we have ⟨ v , q ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle v,q\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨ v , q ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) and thus ⟨ v , q ⟩ \langle v,q\rangle ⟨ v , q ⟩ is in the set.
⟦ Γ ⊢ σ t : κ [ t / x ] ⟧ ( γ ) = ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( γ ) ( ( ( t ) ) ( ρ Γ ( γ ) ) ) ∈ ⟦ Γ ⊢ κ [ t / x ] : K d ⟧ ( γ ) \llbracket\Gamma\vdash\sigma\ t:\kappa[t/x]\rrbracket(\gamma)=\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\gamma)(((t))(\rho_\Gamma(\gamma)))\in\llbracket\Gamma\vdash\kappa[t/x]:\mathrm{Kd}\rrbracket(\gamma) [ [ Γ ⊢ σ t : κ [ t / x ] ] ] ( γ ) = [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( γ ) ((( t )) ( ρ Γ ( γ ))) ∈ [ [ Γ ⊢ κ [ t / x ] : Kd ] ] ( γ )
by I. H. f = ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( γ ) ∈ ⟦ Γ ⊢ ( x : τ ) → κ : K d ⟧ ( γ ) f=\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\gamma)\in\llbracket\Gamma\vdash(x:\tau)\to\kappa:\mathrm{Kd}\rrbracket(\gamma) f = [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( γ ) ∈ [ [ Γ ⊢ ( x : τ ) → κ : Kd ] ] ( γ ) thus f ( ( ( t ) ) ( ρ Γ ( γ ) ) ) ∈ ⟦ Γ , x : T τ ⊢ κ : K d ⟧ ( ⟨ γ , ( ( t ) ) ( ρ Γ ( γ ) ) ⟩ ) f(((t))(\rho_\Gamma(\gamma)))\in\llbracket\Gamma,x:T\tau\vdash\kappa:\mathrm{Kd}\rrbracket(\langle\gamma,((t))(\rho_\Gamma(\gamma))\rangle) f ((( t )) ( ρ Γ ( γ ))) ∈ [ [ Γ , x : T τ ⊢ κ : Kd ] ] (⟨ γ , (( t )) ( ρ Γ ( γ ))⟩) by Lemma C.4 = ⟦ Γ ⊢ κ [ t / x ] : K d ⟧ ( γ ) =\llbracket\Gamma\vdash\kappa[t/x]:\mathrm{Kd}\rrbracket(\gamma) = [ [ Γ ⊢ κ [ t / x ] : Kd ] ] ( γ ) .
\begin{aligned}
\llbracket\Gamma\vdash\mu K\left\langle\nu\right\rangle_i^k\ C:(y:\sigma^j)\to K\cdot t_i^k:\mathrm{Ty}\rrbracket(\gamma) \\
&=\operatorname{lfp}_{X}(q_i^k\mapsto\bigcup\{\langle\langle C_i^j\rangle,\langle C_i^j\rangle_{\langle v_j,w_j\rangle}\rangle\mathrel{\middle|}\langle q_k,((t_k))(\langle\rho_\Gamma(\gamma),\bar v^j\rangle)\rangle\in\llbracket\Gamma,x:T\tau^{k-1}\vdash\tau_k:\mathrm{Ty}\rrbracket(\iota_\Gamma(\gamma))\})
\end{aligned}
∈ ⟦ Γ ⊢ τ ˉ k → T y : K d ⟧ ( γ ) \in\llbracket\Gamma\vdash\bar\tau^k\to\mathrm{Ty}:\mathrm{Kd}\rrbracket(\gamma) ∈ [ [ Γ ⊢ τ ˉ k → Ty : Kd ] ] ( γ )
First, for the shared part of the two rules, we show that if X ∈ ⟦ Γ ⊢ τ ˉ k → T y : K d ⟧ ( γ ) X\in\llbracket\Gamma\vdash\bar\tau^k\to\mathrm{Ty}:\mathrm{Kd}\rrbracket(\gamma) X ∈ [ [ Γ ⊢ τ ˉ k → Ty : Kd ] ] ( γ ) lies below the unrefined interpretation of the declaration, so that the environment in α \alpha α is well formed, then α ∈ ⟦ Γ ⊢ τ ˉ k → T y : K d ⟧ ( γ ) \alpha\in\llbracket\Gamma\vdash\bar\tau^k\to\mathrm{Ty}:\mathrm{Kd}\rrbracket(\gamma) α ∈ [ [ Γ ⊢ τ ˉ k → Ty : Kd ] ] ( γ ) ; we have to show two things: Fixed ⟨ q ˉ k , n ˉ k ⟩ ∈ ⟦ Γ ⊢ τ ˉ k : T y ⟧ ( ι Γ ( γ ) ) \langle\bar q^k,\bar n^k\rangle\in\llbracket\Gamma\vdash\bar\tau^k:\mathrm{Ty}\rrbracket(\iota_\Gamma(\gamma)) ⟨ q ˉ k , n ˉ k ⟩ ∈ [ [ Γ ⊢ τ ˉ k : Ty ] ] ( ι Γ ( γ )) we show that:
– Fixed q ˉ k ∈ dom ( ⟦ Γ ⊢ τ ˉ k : T y ⟧ ( γ ) ) \bar q^k\in\operatorname{dom}(\llbracket\Gamma\vdash\bar\tau^k:\mathrm{Ty}\rrbracket(\gamma)) q ˉ k ∈ dom ( [ [ Γ ⊢ τ ˉ k : Ty ] ] ( γ )) , α ( q ˉ k ) \alpha(\bar q^k) α ( q ˉ k ) is a PER, since it is the union of disjoint C i C_i C i we just need to show that each C i C_i C i is a PER, by Theorem 5.3 (i) the semantics is invariant under related contexts and hence it is a PER.
– Fixed ⟨ q ˉ k , n ˉ k ⟩ ∈ ⟦ Γ ⊢ τ ˉ k : T y ⟧ ( ι Γ ( γ ) ) ∩ dom ( ⟦ Γ ⊢ τ ˉ k : T y ⟧ ( γ ) ) 2 \langle\bar q^k,\bar n^k\rangle\in\llbracket\Gamma\vdash\bar\tau^k:\mathrm{Ty}\rrbracket(\iota_\Gamma(\gamma))\cap\operatorname{dom}(\llbracket\Gamma\vdash\bar\tau^k:\mathrm{Ty}\rrbracket(\gamma))^2 ⟨ q ˉ k , n ˉ k ⟩ ∈ [ [ Γ ⊢ τ ˉ k : Ty ] ] ( ι Γ ( γ )) ∩ dom ( [ [ Γ ⊢ τ ˉ k : Ty ] ] ( γ ) ) 2 we show that α ( q ˉ k ) = α ( n ˉ k ) \alpha(\bar q^k)=\alpha(\bar n^k) α ( q ˉ k ) = α ( n ˉ k ) ; it follows that ⟨ q ˉ k , n ˉ k ⟩ ∈ ⟦ Γ ⊢ τ ˉ k : T y ⟧ ( ι Γ ( γ ) ) \langle\bar q^k,\bar n^k\rangle\in\llbracket\Gamma\vdash\bar\tau^k:\mathrm{Ty}\rrbracket(\iota_\Gamma(\gamma)) ⟨ q ˉ k , n ˉ k ⟩ ∈ [ [ Γ ⊢ τ ˉ k : Ty ] ] ( ι Γ ( γ )) hence either ∀ k ⟨ q k , ( ( t k ) ) ( ⟨ ρ Γ ( γ ) , v ˉ j ⟩ ) ⟩ ∈ ⟦ Γ , x : T τ k − 1 ⊢ τ k : T y ⟧ ( ι Γ ( γ ) ) \forall k\ \langle q_k,((t_k))(\langle\rho_\Gamma(\gamma),\bar v^j\rangle)\rangle\in\llbracket\Gamma,x:T\tau^{k-1}\vdash\tau_k:\mathrm{Ty}\rrbracket(\iota_\Gamma(\gamma)) ∀ k ⟨ q k , (( t k )) (⟨ ρ Γ ( γ ) , v ˉ j ⟩)⟩ ∈ [ [ Γ , x : T τ k − 1 ⊢ τ k : Ty ] ] ( ι Γ ( γ )) thus by transitivity of the PERs ⟨ n k , ( ( t k ) ) ( ⟨ ρ Γ ( γ ) , v ˉ j ⟩ ) ⟩ ∈ ⟦ Γ , x : T τ k − 1 ⊢ τ k : T y ⟧ ( ι Γ ( γ ) ) \langle n_k,((t_k))(\langle\rho_\Gamma(\gamma),\bar v^j\rangle)\rangle\in\llbracket\Gamma,x:T\tau^{k-1}\vdash\tau_k:\mathrm{Ty}\rrbracket(\iota_\Gamma(\gamma)) ⟨ n k , (( t k )) (⟨ ρ Γ ( γ ) , v ˉ j ⟩)⟩ ∈ [ [ Γ , x : T τ k − 1 ⊢ τ k : Ty ] ] ( ι Γ ( γ )) and hence the corresponding C i C_i C i are equal, as the semantics of each σ j \sigma_j σ j does not depend on q k q_k q k ; or if ∃ k ⟨ q k , ( ( t k ) ) ( ⟨ ρ Γ ( γ ) , v ˉ j ⟩ ) ⟩ ∉ ⟦ Γ , x : T τ k − 1 ⊢ τ k : T y ⟧ ( ι Γ ( γ ) ) \exists k\ \langle q_k,((t_k))(\langle\rho_\Gamma(\gamma),\bar v^j\rangle)\rangle\notin\llbracket\Gamma,x:T\tau^{k-1}\vdash\tau_k:\mathrm{Ty}\rrbracket(\iota_\Gamma(\gamma)) ∃ k ⟨ q k , (( t k )) (⟨ ρ Γ ( γ ) , v ˉ j ⟩)⟩ ∈ / [ [ Γ , x : T τ k − 1 ⊢ τ k : Ty ] ] ( ι Γ ( γ )) then by transitivity of the PERs ⟨ n k , ( ( t k ) ) ( ⟨ ρ Γ ( γ ) , v ˉ j ⟩ ) ⟩ ∉ ⟦ Γ , x : T τ k − 1 ⊢ τ k : T y ⟧ ( ι Γ ( γ ) ) \langle n_k,((t_k))(\langle\rho_\Gamma(\gamma),\bar v^j\rangle)\rangle\notin\llbracket\Gamma,x:T\tau^{k-1}\vdash\tau_k:\mathrm{Ty}\rrbracket(\iota_\Gamma(\gamma)) ⟨ n k , (( t k )) (⟨ ρ Γ ( γ ) , v ˉ j ⟩)⟩ ∈ / [ [ Γ , x : T τ k − 1 ⊢ τ k : Ty ] ] ( ι Γ ( γ )) and hence the corresponding sets C i C_i C i are empty and hence equal.
Now given this we can show that the least fixed point of α \alpha α exists, we consider the two cases separately:
– Ty-IndPos By assumption ∀ l , j . pol K ( τ l , j ) ≤ + \forall l,j.\ \operatorname{pol}_K(\tau_{l,j})\leq+ ∀ l , j . pol K ( τ l , j ) ≤ + and by Lemma 7.2 each ⟦ Γ , K : K k → T y , x : T σ j − 1 ⊢ σ j : T y ⟧ ( ⟨ ⟨ γ , ⟨ X , … ⟩ ⟩ , v ˉ j − 1 ⟩ ) \llbracket\Gamma,K:K^k\to\mathrm{Ty},x:T\sigma^{j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\langle\langle\gamma,\langle X,\ldots\rangle\rangle,\bar v^{j-1}\rangle) [ [ Γ , K : K k → Ty , x : T σ j − 1 ⊢ σ j : Ty ] ] (⟨⟨ γ , ⟨ X , … ⟩⟩ , v ˉ j − 1 ⟩) is monotone in X X X , thus α \alpha α is monotone on such X X X , which form a complete lattice, and by Theorem 3.1 the least fixpoint of α \alpha α exists.
– Ty-IndStrat By assumption each self reference in τ i , j \tau_{i,j} τ i , j is on a strictly smaller index with respect to the stratification function m m m , hence we can give the alternative definition of the functional
F r e c ( v ˉ k ) = ( α ( 1 + n ) ( q ˉ k ↦ ∅ ) ) ( v ˉ k ) where n = d e f r N ( ( m ) ( ρ Γ ( γ ) ) ⋅ v ˉ k ) \mathcal{F}_{\mathrm{rec}}(\bar v^k)=\left(\alpha^{(1+n)}(\bar q^k\mapsto\varnothing)\right)(\bar v^k)\quad\text{where }n\mathrel{\overset{\mathrm{def}}{=}}r_{\mathbb N}\left((m)(\rho_\Gamma(\gamma))\cdot\bar v^k\right) F rec ( v ˉ k ) = ( α ( 1 + n ) ( q ˉ k ↦ ∅ ) ) ( v ˉ k ) where n = def r N ( ( m ) ( ρ Γ ( γ )) ⋅ v ˉ k )
where α ( n ) \alpha^{(n)} α ( n ) is the n n n -fold composition of α \alpha α .
Since all the recursive occurrences are on strictly smaller indices, this is well defined. This follows from the fact that fixed v k ∈ dom ( ⟦ Γ , x : T τ ˉ k − 1 ⊢ T y ⟧ ( ⟨ γ , v ˉ k − 1 ⟩ ) v_k\in\operatorname{dom}(\llbracket\Gamma,x:T\bar\tau^{k-1}\vdash\mathrm{Ty}\rrbracket(\langle\gamma,\bar v^{k-1}\rangle) v k ∈ dom ( [ [ Γ , x : T τ ˉ k − 1 ⊢ Ty ] ] (⟨ γ , v ˉ k − 1 ⟩) Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ j ‾ ) → K ⋅ t ‾ j − k ; z ‾ − k → T y } ( γ ) ⋅ v ‾ − k \Gamma\vdash\mu K^{\langle v\rangle}\left\{C:(\overline{y:\sigma^{j}})\to K\cdot\overline{t}^{-k}_{j};\overline{z}^{-k}\to\mathrm{Ty}\right\}(\gamma)\cdot\overline{v}^{-k} Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ j ) → K ⋅ t j − k ; z − k → Ty } ( γ ) ⋅ v − k cannot depend on any recursive occurrences of w ‾ − k \overline{w}^{-k} w − k where r N ( ( ( m ) ) ( ρ Γ ( γ ) ) ⋅ w ‾ − k ) ≥ r N ( ( ( m ) ) ( ρ Γ ( γ ) ) ⋅ v ‾ − k ) r_{\mathbb{N}}((\!(m)\!) (\rho_{\Gamma}(\gamma))\cdot\overline{w}^{-k})\ge r_{\mathbb{N}}((\!(m)\!) (\rho_{\Gamma}(\gamma))\cdot\overline{v}^{-k}) r N (( ( m ) ) ( ρ Γ ( γ )) ⋅ w − k ) ≥ r N (( ( m ) ) ( ρ Γ ( γ )) ⋅ v − k ) by the assumption of the stratification condition.
This definition is stable, meaning that forall q ‾ k ∈ dom ( ⟦ Γ , x : τ ‾ k − 1 ⊢ T y : T y ⟧ ( ⟨ γ , v ‾ k − 1 ⟩ ) ) \overline{q}^{k}\in\operatorname{dom}(\llbracket\Gamma,x:\overline{\tau}^{k-1}\vdash\mathrm{Ty}:\mathrm{Ty}\rrbracket(\langle\gamma,\overline{v}^{k-1}\rangle)) q k ∈ dom ( [ [ Γ , x : τ k − 1 ⊢ Ty : Ty ] ] (⟨ γ , v k − 1 ⟩)) where n = r N ( ( ( m ) ) ( ρ Γ ( γ ) ) ⋅ q ‾ k ) ( α ( 1 + n ) ( q ‾ k ↦ ∅ ) ) ( q ‾ k ) = ( α ( 1 + m ) ( q ‾ k ↦ ∅ ) ) ( q ‾ k ) n=r_{\mathbb{N}}((\!(m)\!) (\rho_{\Gamma}(\gamma))\cdot\overline{q}^{k})(\alpha^{(1+n)}(\overline{q}^{k}\mapsto\emptyset))(\overline{q}^{k})=(\alpha^{(1+m)}(\overline{q}^{k}\mapsto\emptyset))(\overline{q}^{k}) n = r N (( ( m ) ) ( ρ Γ ( γ )) ⋅ q k ) ( α ( 1 + n ) ( q k ↦ ∅ )) ( q k ) = ( α ( 1 + m ) ( q k ↦ ∅ )) ( q k ) for all m ≥ n m\ge n m ≥ n . By strong induction on n n n : n = 0 n=0 n = 0 then there are no recursive occurrences and hence the definition is stable by definition as the argument to α \alpha α does not matter. For n > 0 n>0 n > 0 the semantics depends only on the recursive occurrences of strictly smaller indices, for which by the I. H. the definition is stable, hence the whole definition is stable.
Now we show that it is a fixed point, hence F r e c = α ( F r e c ) \mathcal{F}_{rec}=\alpha(\mathcal{F}_{rec}) F r ec = α ( F r ec ) ; fixed v ‾ k ∈ dom ( ⟦ Γ , x : τ ‾ k − 1 ⊢ T y : T y ⟧ ( ⟨ γ , v ‾ k − 1 ⟩ ) ) \overline{v}_{k}\in\operatorname{dom}(\llbracket\Gamma,x:\overline{\tau}^{k-1}\vdash\mathrm{Ty}:\mathrm{Ty}\rrbracket(\langle\gamma,\overline{v}^{k-1}\rangle)) v k ∈ dom ( [ [ Γ , x : τ k − 1 ⊢ Ty : Ty ] ] (⟨ γ , v k − 1 ⟩)) and let n ≜ r N ( ( ( m ) ) ( ρ Γ ( γ ) ) ⋅ v ‾ k ) n\triangleq r_{\mathbb{N}}((\!(m)\!) (\rho_{\Gamma}(\gamma))\cdot\overline{v}^{k}) n ≜ r N (( ( m ) ) ( ρ Γ ( γ )) ⋅ v k ) we have
F r e c ( v ‾ k ) = ( α ( 1 + n ) ( q ‾ k ↦ ∅ ) ) ( v ‾ k ) By stability = ( α ( 2 + n ) ( q ‾ k ↦ ∅ ) ) ( v ‾ k ) = α ( F r e c ) ( v ‾ k ) \begin{aligned}
\mathcal{F}_{rec}(\overline{v}^{k})\\
&=(\alpha^{(1+n)}(\overline{q}^{k}\mapsto\emptyset))(\overline{v}^{k})\\
&\qquad\text{By stability}\\
&=(\alpha^{(2+n)}(\overline{q}^{k}\mapsto\emptyset))(\overline{v}^{k})\\
&=\alpha(\mathcal{F}_{rec})(\overline{v}^{k})
\end{aligned} F r ec ( v k ) = ( α ( 1 + n ) ( q k ↦ ∅ )) ( v k ) By stability = ( α ( 2 + n ) ( q k ↦ ∅ )) ( v k ) = α ( F r ec ) ( v k )
Finally we show that it is unique and hence trivially the least fixed point. Let G G G be another fixed point of α \alpha α thus G = α ( G ) G=\alpha(G) G = α ( G ) , fixed v ‾ k ∈ dom ( ⟦ Γ , x : τ ‾ k − 1 ⊢ T y : T y ⟧ ( ⟨ γ , v ‾ k − 1 ⟩ ) ) \overline{v}_{k}\in\operatorname{dom}(\llbracket\Gamma,x:\overline{\tau}^{k-1}\vdash\mathrm{Ty}:\mathrm{Ty}\rrbracket(\langle\gamma,\overline{v}^{k-1}\rangle)) v k ∈ dom ( [ [ Γ , x : τ k − 1 ⊢ Ty : Ty ] ] (⟨ γ , v k − 1 ⟩)) and let n ≜ r N ( ( ( m ) ) ( ρ Γ ( γ ) ) ⋅ v ‾ k ) n\triangleq r_{\mathbb{N}}((\!(m)\!) (\rho_{\Gamma}(\gamma))\cdot\overline{v}^{k}) n ≜ r N (( ( m ) ) ( ρ Γ ( γ )) ⋅ v k ) by induction on n n n : if n = 0 n=0 n = 0 then
F r e c ( v ‾ k ) = α ( q ‾ k ↦ ∅ ) ( v ‾ k ) since there are no recursive occurrences does not depend on the argument = α ( G ) ( v ‾ k ) since G is a fixed point of α = G ( v ‾ k ) \begin{aligned}
\mathcal{F}_{rec}(\overline{v}^{k})\\
&=\alpha(\overline{q}^{k}\mapsto\emptyset)(\overline{v}^{k})\\
&\qquad\text{since there are no recursive occurrences}\\
&\qquad\text{does not depend on the argument}\\
&=\alpha(G)(\overline{v}^{k})\\
&\qquad\text{since }G\text{ is a fixed point of }\alpha\\
&=G(\overline{v}^{k})
\end{aligned} F r ec ( v k ) = α ( q k ↦ ∅ ) ( v k ) since there are no recursive occurrences does not depend on the argument = α ( G ) ( v k ) since G is a fixed point of α = G ( v k )
if n > 0 n>0 n > 0 then
F r e c ( v ‾ k ) = ( α ( 2 + n ) ( q ‾ k ↦ ∅ ) ) ( v ‾ k ) By I. H. = ( α ( G ) ) ( v ‾ k ) since G is a fixed point of α = G ( v ‾ k ) \begin{aligned}
\mathcal{F}_{rec}(\overline{v}^{k})\\
&=(\alpha^{(2+n)}(\overline{q}^{k}\mapsto\emptyset))(\overline{v}^{k})\\
&\qquad\text{By I. H.}\\
&=(\alpha(G))(\overline{v}^{k})\\
&\qquad\text{since }G\text{ is a fixed point of }\alpha\\
&=G(\overline{v}^{k})
\end{aligned} F r ec ( v k ) = ( α ( 2 + n ) ( q k ↦ ∅ )) ( v k ) By I. H. = ( α ( G )) ( v k ) since G is a fixed point of α = G ( v k )
Note that the proof does not rely on the fact that α \alpha α is monotone but only on the uniqueness of the fixed point.
Proof of Theorem 5.2 (ii). By induction on the structure of Γ ⊢ τ : κ \Gamma\vdash\tau:\kappa Γ ⊢ τ : κ .
⟦ Γ ⊢ B : K ⟧ ( γ ) = { ⟨ i B ( v ) , i B ( v ) ⟩ ∣ v ∈ B } ∪ { ⟨ ⊥ , ⊥ ⟩ } ∈ ⟦ Γ ⊢ T y : K d ⟧ ( γ ) = C U P E R ( D ) \llbracket\Gamma\vdash\mathcal{B}:\mathcal{K} \rrbracket(\gamma)=\{\langle i_{\mathcal{B}}(v),i_{\mathcal{B}}(v)\rangle\mid v\in\mathcal{B}\}\cup\{\langle\bot,\bot\rangle\}\in\llbracket\Gamma\vdash\mathrm{Ty}:\mathrm{Kd}\rrbracket(\gamma)=\mathit{CUPER}(\mathcal{D}) [ [ Γ ⊢ B : K ] ] ( γ ) = {⟨ i B ( v ) , i B ( v )⟩ ∣ v ∈ B } ∪ {⟨ ⊥ , ⊥ ⟩} ∈ [ [ Γ ⊢ Ty : Kd ] ] ( γ ) = CUPER ( D )
The diagonal relation over a subset of D \mathcal{D} D is a PER. Since ⟨ ⊥ , ⊥ ⟩ \langle\bot,\bot\rangle ⟨ ⊥ , ⊥ ⟩ is in the set, it is clearly pointed, and since B \mathcal{B} B is a flat domain, completeness and uniformity follow.
⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( γ ) = \llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\gamma)= [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( γ ) =
{ ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) } \{\langle f,g\rangle\mid\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\gamma)\} {⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ )}
∈ ⟦ Γ ⊢ T y : K d ⟧ ( γ ) = C U P E R ( D ) \in\llbracket\Gamma\vdash\mathrm{Ty}:\mathrm{Kd}\rrbracket(\gamma)=\mathit{CUPER}(\mathcal{D}) ∈ [ [ Γ ⊢ Ty : Kd ] ] ( γ ) = CUPER ( D )
Since CUPERs are closed under intersection we just show that fixed ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) the set is a CUPER.
(1) Symmetry: Fix ⟨ f , g ⟩ \langle f,g\rangle ⟨ f , g ⟩ in the set, we have ⟨ g ⋅ v , f ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) \langle g\cdot v,f\cdot w\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\gamma) ⟨ g ⋅ v , f ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ ) by I. H. and symmetry of CUPERs thus ⟨ g , f ⟩ \langle g,f\rangle ⟨ g , f ⟩ is in the set.
(2) Transitivity: Fix ⟨ f , g ⟩ \langle f,g\rangle ⟨ f , g ⟩ and ⟨ g , h ⟩ \langle g,h\rangle ⟨ g , h ⟩ in the set by I. H. and transitivity of CUPERs we have ⟨ f ⋅ v , h ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) \langle f\cdot v,h\cdot w\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\gamma) ⟨ f ⋅ v , h ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ ) thus ⟨ f , h ⟩ \langle f,h\rangle ⟨ f , h ⟩ is in the set.
(3) Pointedness: By I. Hs. ⟨ ⊥ , ⊥ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle\bot,\bot\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨ ⊥ , ⊥ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) , and ⟨ ⊥ , ⊥ ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) \langle\bot,\bot\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\gamma) ⟨ ⊥ , ⊥ ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ ) . Since ⊥ ⋅ v = ⊥ \bot\cdot v=\bot ⊥ ⋅ v = ⊥ we have ⟨ ⊥ , ⊥ ⟩ \langle\bot,\bot\rangle ⟨ ⊥ , ⊥ ⟩ is in the set.
(4) Completeness: Let { ⟨ f i , g i ⟩ } i ∈ I \{\langle f_i,g_i\rangle\}_{i\in I} {⟨ f i , g i ⟩ } i ∈ I be a directed subset of the set. Fix ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . By the definition of the set, for every i ∈ I i\in I i ∈ I by I. H. ⟨ f i ⋅ v , g i ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) \langle f_i\cdot v,g_i\cdot w\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\gamma) ⟨ f i ⋅ v , g i ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ ) , since application is continuous, ⟨ ( ⨆ i ∈ I f i ) ⋅ v , ( ⨆ i ∈ I g i ) ⋅ w ⟩ = ⨆ i ∈ I ⟨ f i ⋅ v , g i ⋅ w ⟩ \langle(\bigsqcup_{i\in I}f_i)\cdot v,(\bigsqcup_{i\in I}g_i)\cdot w\rangle=\bigsqcup_{i\in I}\langle f_i\cdot v,g_i\cdot w\rangle ⟨( ⨆ i ∈ I f i ) ⋅ v , ( ⨆ i ∈ I g i ) ⋅ w ⟩ = ⨆ i ∈ I ⟨ f i ⋅ v , g i ⋅ w ⟩ . By I. H. ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) \llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\gamma) [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ ) is complete, hence the lub pair is in the relation, so ⟨ ⨆ i ∈ I f i , ⨆ i ∈ I g i ⟩ \langle\bigsqcup_{i\in I}f_i,\bigsqcup_{i\in I}g_i\rangle ⟨ ⨆ i ∈ I f i , ⨆ i ∈ I g i ⟩ is in the set.
(5) Uniformity: Let ⟨ f , g ⟩ \langle f,g\rangle ⟨ f , g ⟩ be in the set, and fix an arbitrary ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . By I. H. the domain PER is uniform, so ⟨ π n ( v ) , π n ( w ) ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle\pi_n(v),\pi_n(w)\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨ π n ( v ) , π n ( w )⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) , hence ⟨ f ⋅ π n ( v ) , g ⋅ π n ( w ) ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) \langle f\cdot\pi_n(v),g\cdot\pi_n(w)\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\gamma) ⟨ f ⋅ π n ( v ) , g ⋅ π n ( w )⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ ) . By I. H. the codomain PER is uniform as well, so ⟨ π n ( f ⋅ π n ( v ) ) , π n ( g ⋅ π n ( w ) ) ⟩ \langle\pi_n(f\cdot\pi_n(v)),\pi_n(g\cdot\pi_n(w))\rangle ⟨ π n ( f ⋅ π n ( v )) , π n ( g ⋅ π n ( w ))⟩ is in it. The projections of the bilimit satisfy π n + 1 ( f ) ⋅ v = π n ( f ⋅ π n ( v ) ) \pi_{n+1}(f)\cdot v=\pi_n(f\cdot\pi_n(v)) π n + 1 ( f ) ⋅ v = π n ( f ⋅ π n ( v )) , hence ⟨ π n + 1 ( f ) ⋅ v , π n + 1 ( g ) ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) \langle\pi_{n+1}(f)\cdot v,\pi_{n+1}(g)\cdot w\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\gamma) ⟨ π n + 1 ( f ) ⋅ v , π n + 1 ( g ) ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ ) . Since ⟨ v , w ⟩ \langle v,w\rangle ⟨ v , w ⟩ was arbitrary, ⟨ π n + 1 ( f ) , π n + 1 ( g ) ⟩ \langle\pi_{n+1}(f),\pi_{n+1}(g)\rangle ⟨ π n + 1 ( f ) , π n + 1 ( g )⟩ is in the set; for n = 0 n=0 n = 0 we have π 0 ( f ) = ⊥ = π 0 ( g ) \pi_0(f)=\bot=\pi_0(g) π 0 ( f ) = ⊥ = π 0 ( g ) and the claim follows from pointedness.
⟦ Γ ⊢ ∀ x : κ . τ : T y ⟧ ( γ ) = { ⟨ v , w ⟩ ∣ ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) . ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , P ⟩ ) } \begin{aligned}
\llbracket\Gamma\vdash\forall x:\kappa.\tau:\mathrm{Ty}\rrbracket(\gamma) \\
&=\{\langle v,w\rangle\mid\forall P\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma).\ \langle v,w\rangle\in\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket(\langle\gamma,P\rangle)\}
\end{aligned} [ [ Γ ⊢ ∀ x : κ . τ : Ty ] ] ( γ ) = {⟨ v , w ⟩ ∣ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) . ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , P ⟩)}
∈ ⟦ Γ ⊢ T y : K d ⟧ ( γ ) = C U P E R ( D ) \in\llbracket\Gamma\vdash\mathrm{Ty}:\mathrm{Kd}\rrbracket(\gamma)=\mathit{CUPER}(\mathcal{D}) ∈ [ [ Γ ⊢ Ty : Kd ] ] ( γ ) = CUPER ( D )
Since CUPERs are closed under intersection we just show that fixed P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) P\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma) P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) the set is a CUPER, by I. H. each ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , P ⟩ ) \llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket(\langle\gamma,P\rangle) [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , P ⟩) is a CUPER.
⟦ Γ ⊢ x : κ ⟧ ( γ ) = γ ( x ) ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) \llbracket\Gamma\vdash x:\kappa\rrbracket(\gamma)=\gamma(x)\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma) [ [ Γ ⊢ x : κ ] ] ( γ ) = γ ( x ) ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ )
by assumption.
⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) = ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ∈ ⟦ Γ ⊢ T y : K d ⟧ ( γ ) = C U P E R ( D ) \llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty}\rrbracket(\gamma)=\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma)\in\llbracket\Gamma\vdash\mathrm{Ty}:\mathrm{Kd}\rrbracket(\gamma)=\mathit{CUPER}(\mathcal{D}) [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) = [ [ Γ ⊢ τ : Ty ] ] ( γ ) ∈ [ [ Γ ⊢ Ty : Kd ] ] ( γ ) = CUPER ( D )
By I. H. ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) [ [ Γ ⊢ τ : Ty ] ] ( γ ) is a CUPER.
⟦ Γ ⊢ σ t : κ [ t / x ] ⟧ ( γ ) = ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( γ ) ∈ ⟦ Γ ⊢ κ [ t / x ] : K d ⟧ ( γ ) \llbracket\Gamma\vdash\sigma\ t:\kappa\ [t/x]\rrbracket(\gamma)=\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\gamma)\in\llbracket\Gamma\vdash\kappa\ [t/x]:\mathrm{Kd}\rrbracket(\gamma) [ [ Γ ⊢ σ t : κ [ t / x ] ] ] ( γ ) = [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( γ ) ∈ [ [ Γ ⊢ κ [ t / x ] : Kd ] ] ( γ )
By I. H. ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( γ ) ∈ ⟦ Γ ⊢ ( x : τ ) → κ : K d ⟧ ( γ ) = ⟦ Γ , x : T τ ⊢ κ : K d ⟧ ( γ ) = ⟦ Γ ⊢ κ [ t / x ] : K d ⟧ ( γ ) = C U P E R ( D ) \llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\gamma)\in\llbracket\Gamma\vdash(x:\tau)\to\kappa:\mathrm{Kd}\rrbracket(\gamma)=\llbracket\Gamma,x:T_\tau\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma)=\llbracket\Gamma\vdash\kappa[t/x]:\mathrm{Kd}\rrbracket(\gamma)=\mathit{CUPER}(\mathcal{D}) [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( γ ) ∈ [ [ Γ ⊢ ( x : τ ) → κ : Kd ] ] ( γ ) = [ [ Γ , x : T τ ⊢ κ : Kd ] ] ( γ ) = [ [ Γ ⊢ κ [ t / x ] : Kd ] ] ( γ ) = CUPER ( D ) .
⟦ Γ ⊢ μ K ⟨ { C : ( y : σ j ) → K ⋅ t i k } i k : T y ⟧ ( γ ) = fix X ( ⋃ i { ⟨ ⟨ C i , v ˉ j ⟩ , ⟨ C i , w ˉ j ⟩ ⟩ ∣ ⟨ v j , w j ⟩ ∈ ⟦ Γ , K : κ k → T y , x : τ σ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , X ⟩ ) } ∪ { ⟨ ⊥ , ⊥ ⟩ } ) ) \llbracket\Gamma\vdash\mu K\left\langle\left\{C:(y:\sigma^j)\to K\cdot t^k_i\right\}_{i}^{k}:T_y\rrbracket(\gamma)
= \operatorname{fix}_X\left(\bigcup_i\left\{\left\langle\left\langle C_i,\bar v^j\right\rangle,\left\langle C_i,\bar w^j\right\rangle\right\rangle\mid\left\langle v_j,w_j\right\rangle\in\llbracket\Gamma,K:\kappa^k\to\mathrm{Ty},x:\tau^{\sigma^j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\langle\gamma,X\rangle)\right\}\cup\{\langle\bot,\bot\rangle\}\right)\right) [ [ Γ ⊢ μ K ⟨ { C : ( y : σ j ) → K ⋅ t i k } i k : T y ] ] ( γ ) = fix X ( i ⋃ { ⟨ ⟨ C i , v ˉ j ⟩ , ⟨ C i , w ˉ j ⟩ ⟩ ∣ ⟨ v j , w j ⟩ ∈ [ [ Γ , K : κ k → Ty , x : τ σ j − 1 ⊢ σ j : Ty ] ] (⟨ γ , X ⟩) } ∪ {⟨ ⊥ , ⊥ ⟩} ) )
∈ ⟦ Γ ⊢ τ k → T y : K d ⟧ ( γ ) = C U P E R ( D ) \in\llbracket\Gamma\vdash\tau^k\to\mathrm{Ty}:\mathrm{Kd}\rrbracket(\gamma)=\mathit{CUPER}(\mathcal{D}) ∈ [ [ Γ ⊢ τ k → Ty : Kd ] ] ( γ ) = CUPER ( D ) .
First, we show that if X ∈ C U P E R ( D ) X\in\mathit{CUPER}(\mathcal{D}) X ∈ CUPER ( D ) then α ∈ C U P E R ( D ) \alpha\in\mathit{CUPER}(\mathcal{D}) α ∈ CUPER ( D ) , since α \alpha α is the union of disjoint C i C_i C i we just need to show that each C i C_i C i is a CUPER.
(1) Symmetry: Fix ⟨ ⟨ C i , v ˉ j ⟩ , ⟨ C i , w ˉ j ⟩ ⟩ \langle\langle C_i,\bar v^j\rangle,\langle C_i,\bar w^j\rangle\rangle ⟨⟨ C i , v ˉ j ⟩ , ⟨ C i , w ˉ j ⟩⟩ in the set, then ⟨ v j , w j ⟩ ∈ ⟦ Γ , K : κ k → T y , x : τ σ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , X ⟩ ) \langle v_j,w_j\rangle\in\llbracket\Gamma,K:\kappa^k\to\mathrm{Ty},x:\tau^{\sigma^j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\langle\gamma,X\rangle) ⟨ v j , w j ⟩ ∈ [ [ Γ , K : κ k → Ty , x : τ σ j − 1 ⊢ σ j : Ty ] ] (⟨ γ , X ⟩) by definition. By I. H., symmetry of this PER gives ⟨ w j , v j ⟩ ∈ ⟦ Γ , K : κ k → T y , x : τ σ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , X ⟩ ) \langle w_j,v_j\rangle\in\llbracket\Gamma,K:\kappa^k\to\mathrm{Ty},x:\tau^{\sigma^j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\langle\gamma,X\rangle) ⟨ w j , v j ⟩ ∈ [ [ Γ , K : κ k → Ty , x : τ σ j − 1 ⊢ σ j : Ty ] ] (⟨ γ , X ⟩) , hence ⟨ ⟨ C i , w ˉ j ⟩ , ⟨ C i , v ˉ j ⟩ ⟩ \langle\langle C_i,\bar w^j\rangle,\langle C_i,\bar v^j\rangle\rangle ⟨⟨ C i , w ˉ j ⟩ , ⟨ C i , v ˉ j ⟩⟩ in the set.
(2) Transitivity: Fix ⟨ ⟨ C i , v ˉ j ⟩ , ⟨ C i , w ˉ j ⟩ ⟩ \langle\langle C_i,\bar v^j\rangle,\langle C_i,\bar w^j\rangle\rangle ⟨⟨ C i , v ˉ j ⟩ , ⟨ C i , w ˉ j ⟩⟩ in the set and ⟨ ⟨ C i , w ˉ j ⟩ , ⟨ C i , q ˉ j ⟩ ⟩ \langle\langle C_i,\bar w^j\rangle,\langle C_i,\bar q^j\rangle\rangle ⟨⟨ C i , w ˉ j ⟩ , ⟨ C i , q ˉ j ⟩⟩ in the set, then ⟨ v j , w j ⟩ \langle v_j,w_j\rangle ⟨ v j , w j ⟩ and ⟨ w j , q j ⟩ \langle w_j,q_j\rangle ⟨ w j , q j ⟩ are in ⟦ Γ , K : κ k → T y , x : τ σ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , X ⟩ ) \llbracket\Gamma,K:\kappa^k\to\mathrm{Ty},x:\tau^{\sigma^j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\langle\gamma,X\rangle) [ [ Γ , K : κ k → Ty , x : τ σ j − 1 ⊢ σ j : Ty ] ] (⟨ γ , X ⟩) . By I. H., transitivity gives ⟨ v j , q j ⟩ ∈ ⟦ Γ , K : κ k → T y , x : τ σ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , X ⟩ ) \langle v_j,q_j\rangle\in\llbracket\Gamma,K:\kappa^k\to\mathrm{Ty},x:\tau^{\sigma^j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\langle\gamma,X\rangle) ⟨ v j , q j ⟩ ∈ [ [ Γ , K : κ k → Ty , x : τ σ j − 1 ⊢ σ j : Ty ] ] (⟨ γ , X ⟩) , hence ⟨ ⟨ C i , v ˉ j ⟩ , ⟨ C i , q ˉ j ⟩ ⟩ \langle\langle C_i,\bar v^j\rangle,\langle C_i,\bar q^j\rangle\rangle ⟨⟨ C i , v ˉ j ⟩ , ⟨ C i , q ˉ j ⟩⟩ is in the set.
(3) Pointedness: ⟨ ⊥ , ⊥ ⟩ \langle\bot,\bot\rangle ⟨ ⊥ , ⊥ ⟩ in the set by definition.
(4) Completeness: Let { ⟨ a k , b k ⟩ } k ∈ I \{\langle a_k,b_k\rangle\}_{k\in I} {⟨ a k , b k ⟩ } k ∈ I be directed, then for each k k k , a k , b k a_k,b_k a k , b k are built from v j k , w j k v_j^k,w_j^k v j k , w j k with ⟨ v j k , w j k ⟩ ∈ ⟦ Γ , K : κ k → T y , x : τ σ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , X ⟩ ) \langle v_j^k,w_j^k\rangle\in\llbracket\Gamma,K:\kappa^k\to\mathrm{Ty},x:\tau^{\sigma^j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\langle\gamma,X\rangle) ⟨ v j k , w j k ⟩ ∈ [ [ Γ , K : κ k → Ty , x : τ σ j − 1 ⊢ σ j : Ty ] ] (⟨ γ , X ⟩) by I. H.. Since this PER is complete and pairing is continuous, we get closure under lubs, hence ⟨ ⨆ k a k , ⨆ k b k ⟩ \langle\bigsqcup_k a_k,\bigsqcup_k b_k\rangle ⟨ ⨆ k a k , ⨆ k b k ⟩ is in the set.
(5) Uniformity: Let ⟨ a , b ⟩ \langle a,b\rangle ⟨ a , b ⟩ in the set, then ⟨ v j , w j ⟩ ∈ ⟦ Γ , K : κ k → T y , x : τ σ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , X ⟩ ) \langle v_j,w_j\rangle\in\llbracket\Gamma,K:\kappa^k\to\mathrm{Ty},x:\tau^{\sigma^j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\langle\gamma,X\rangle) ⟨ v j , w j ⟩ ∈ [ [ Γ , K : κ k → Ty , x : τ σ j − 1 ⊢ σ j : Ty ] ] (⟨ γ , X ⟩) by definition. By I. H. and uniformity of this PER, ⟨ π n ( v j ) , π n ( w j ) ⟩ ∈ ⟦ Γ , K : κ k → T y , x : τ σ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , X ⟩ ) \langle\pi_n(v_j),\pi_n(w_j)\rangle\in\llbracket\Gamma,K:\kappa^k\to\mathrm{Ty},x:\tau^{\sigma^j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\langle\gamma,X\rangle) ⟨ π n ( v j ) , π n ( w j )⟩ ∈ [ [ Γ , K : κ k → Ty , x : τ σ j − 1 ⊢ σ j : Ty ] ] (⟨ γ , X ⟩) . By compatibility of constructors with projection, this gives ⟨ π n ( a ) , π n ( b ) ⟩ \langle\pi_n(a),\pi_n(b)\rangle ⟨ π n ( a ) , π n ( b )⟩ in the set.
By Theorem 7.1 , each field interpretation is non-expansive in X X X , by Lemma D.1 , agreement at level n n n of the fields yields agreement at level n + 1 n+1 n + 1 of the corresponding constructor summand. Hence α \alpha α is contractive and by Lemma 3.4 the fixed point exists and is unique.
Proof of Theorem 5.3 (i). By induction on the structure of Γ ⊢ τ : κ \Gamma\vdash\tau:\kappa Γ ⊢ τ : κ .
⟦ Γ ⊢ B : κ ⟧ ( γ ) = { ⟨ i B ( v ) , i B ( v ) ⟩ ∣ v ∈ B } = ⟦ Γ ⊢ B : κ ⟧ ( δ ) \llbracket\Gamma\vdash B:\kappa\rrbracket(\gamma)=\{\langle i_B(v),i_B(v)\rangle\mid v\in B\}=\llbracket\Gamma\vdash B:\kappa\rrbracket(\delta) [ [ Γ ⊢ B : κ ] ] ( γ ) = {⟨ i B ( v ) , i B ( v )⟩ ∣ v ∈ B } = [ [ Γ ⊢ B : κ ] ] ( δ )
⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( γ ) = { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : T y ⟧ ( ⟨ γ , v ⟩ ) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : T y ⟧ ( ι Γ ( γ ) ) } \llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\gamma)
=
\left\{\langle f,g\rangle\middle|
\begin{aligned}
&\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x:T_\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\langle\gamma,v\rangle)\\
&\forall\langle v_\bot,w_\bot\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_\Gamma(\gamma)).\ \langle f\cdot v_\bot,g\cdot w_\bot\rangle\in\llbracket\Gamma,x:T_\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\iota_\Gamma(\gamma))
\end{aligned}
\right\} [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( γ ) = { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : T τ ⊢ σ : Ty ] ] (⟨ γ , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ Γ , x : T τ ⊢ σ : Ty ] ] ( ι Γ ( γ )) }
By I. H. and Theorem 5.3 (ii)
= { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( δ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : T y ⟧ ( ⟨ δ , v ⟩ ) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( δ ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : T y ⟧ ( ι Γ ( δ ) ) } = ⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( δ ) =
\left\{\langle f,g\rangle\middle|
\begin{aligned}
&\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\delta).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x:T_\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\langle\delta,v\rangle)\\
&\forall\langle v_\bot,w_\bot\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_\Gamma(\delta)).\ \langle f\cdot v_\bot,g\cdot w_\bot\rangle\in\llbracket\Gamma,x:T_\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\iota_\Gamma(\delta))
\end{aligned}
\right\}
=\llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\delta) = { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( δ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : T τ ⊢ σ : Ty ] ] (⟨ δ , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( δ )) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ Γ , x : T τ ⊢ σ : Ty ] ] ( ι Γ ( δ )) } = [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( δ )
⟦ Γ ⊢ ∀ x : κ . τ : T y ⟧ ( γ ) = { ⟨ v , w ⟩ | ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) , ∀ P l ∈ ⟦ Γ ⊢ κ : K d ⟧ ( l Γ ( γ ) ) π Γ : κ ( γ , P ) ⊆ P l ⇒ ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P l ⟩ ⟩ ) } \llbracket\Gamma\vdash\forall x:\kappa.\ \tau:\mathrm{Ty}\rrbracket(\gamma)
=
\left\{\langle v,w\rangle\,\middle|\, \begin{array}{l}
\forall P\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma),\ \forall P_l\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(l_\Gamma(\gamma))\\
\pi_\Gamma:\kappa(\gamma,P)\subseteq P_l\Rightarrow\langle v,w\rangle\in
\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket
(\langle\gamma,\langle P,P_l\rangle\rangle)
\end{array}\right\} [ [ Γ ⊢ ∀ x : κ . τ : Ty ] ] ( γ ) = { ⟨ v , w ⟩ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) , ∀ P l ∈ [ [ Γ ⊢ κ : Kd ] ] ( l Γ ( γ )) π Γ : κ ( γ , P ) ⊆ P l ⇒ ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , ⟨ P , P l ⟩⟩) }
By I. H., Theorem 5.1 (i) and Theorem 5.1 (ii)
= { ⟨ v , w ⟩ | ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( δ ) , ∀ P l ∈ ⟦ Γ ⊢ κ : K d ⟧ ( l Γ ( δ ) ) π Γ : κ ( δ , P ) ⊆ P l ⇒ ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ δ , ⟨ P , P l ⟩ ⟩ ) } = ⟦ Γ ⊢ ∀ x : κ . τ : T y ⟧ ( δ ) \begin{aligned}
=
\left\{\langle v,w\rangle\,\middle|\, \begin{array}{l}
\forall P\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\delta),\ \forall P_l\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(l_\Gamma(\delta))\\
\pi_\Gamma:\kappa(\delta,P)\subseteq P_l\Rightarrow\langle v,w\rangle\in
\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket
(\langle\delta,\langle P,P_l\rangle\rangle)
\end{array}\right\} \\
&=\llbracket\Gamma\vdash\forall x:\kappa.\ \tau:\mathrm{Ty}\rrbracket(\delta)
\end{aligned} = { ⟨ v , w ⟩ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( δ ) , ∀ P l ∈ [ [ Γ ⊢ κ : Kd ] ] ( l Γ ( δ )) π Γ : κ ( δ , P ) ⊆ P l ⇒ ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ δ , ⟨ P , P l ⟩⟩) } = [ [ Γ ⊢ ∀ x : κ . τ : Ty ] ] ( δ )
⟦ Γ ⊢ x : κ ⟧ ( γ ) = γ ( x ) 1 = ⟦ Γ ⊢ x : κ ⟧ ( δ ) \llbracket\Gamma\vdash x:\kappa\rrbracket(\gamma)=\gamma(x)_1=\llbracket\Gamma\vdash x:\kappa\rrbracket(\delta) [ [ Γ ⊢ x : κ ] ] ( γ ) = γ ( x ) 1 = [ [ Γ ⊢ x : κ ] ] ( δ )
⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) = { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ∣ { Γ , x : τ ⊢ ϕ p r p } ( ⟨ γ , v ⟩ ) = t } \begin{aligned}
\llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty}\rrbracket(\gamma) \\
&=\{\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma)\mid\{\Gamma,x:\tau\vdash\phi\ \mathrm{prp}\}(\langle\gamma,v\rangle)=t\}
\end{aligned} [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) = {⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) ∣ { Γ , x : τ ⊢ ϕ prp } (⟨ γ , v ⟩) = t }
By I. H. and Theorem 6.1
= { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( δ ) ∣ { Γ , x : τ ⊢ ϕ p r p } ( ⟨ δ , v ⟩ ) = t } = ⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( δ ) \begin{aligned}
=\{\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\delta)\mid\{\Gamma,x:\tau\vdash\phi\ \mathrm{prp}\}(\langle\delta,v\rangle)=t\} \\
&=\llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty}\rrbracket(\delta)
\end{aligned} = {⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( δ ) ∣ { Γ , x : τ ⊢ ϕ prp } (⟨ δ , v ⟩) = t } = [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( δ )
⟦ Γ ⊢ σ t : κ [ t / x ] ⟧ ( γ ) = ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( γ ) ( ( t ) ( ρ Γ ( γ ) ) ) \begin{aligned}
\llbracket\Gamma\vdash\sigma\ t:\kappa\ [t/x]\rrbracket(\gamma) \\
&=\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\gamma)((t)(\rho_\Gamma(\gamma)))
\end{aligned} [ [ Γ ⊢ σ t : κ [ t / x ] ] ] ( γ ) = [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( γ ) (( t ) ( ρ Γ ( γ )))
By I. H.
= ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( δ ) ( ( t ) ( ρ Γ ( δ ) ) ) =\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\delta)((t)(\rho_\Gamma(\delta))) = [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( δ ) (( t ) ( ρ Γ ( δ )))
By Theorem 5.6 (i) ⟨ ( t ) ( ρ Γ ( γ ) ) , ( t ) ( ρ Γ ( δ ) ) ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle(t)(\rho_\Gamma(\gamma)),(t)(\rho_\Gamma(\delta))\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ⟨( t ) ( ρ Γ ( γ )) , ( t ) ( ρ Γ ( δ ))⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ )
By Theorem 5.4 ⟨ ( t ) ( ρ Γ ( γ ) ) , ( t ) ( ρ Γ ( δ ) ) ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( l Γ ( γ ) ) \langle(t)(\rho_\Gamma(\gamma)),(t)(\rho_\Gamma(\delta))\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(l_\Gamma(\gamma)) ⟨( t ) ( ρ Γ ( γ )) , ( t ) ( ρ Γ ( δ ))⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( l Γ ( γ ))
By ⟦ Γ ⊢ ( x : τ ) → κ ⟧ ( γ ) \llbracket\Gamma\vdash(x:\tau)\to\kappa\rrbracket(\gamma) [ [ Γ ⊢ ( x : τ ) → κ ] ] ( γ ) respecting
⟦ Γ ⊢ τ : T y ⟧ ( l Γ ( γ ) ) ∩ dom ( ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ) 2 = ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( δ ) ( ( t ) ( ρ Γ ( δ ) ) ) = ⟦ Γ ⊢ σ t : κ [ t / x ] ⟧ ( δ ) \begin{aligned}
\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(l_\Gamma(\gamma))\cap\operatorname{dom}\left(\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma)\right)^2 \\
&=\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\delta)((t)(\rho_\Gamma(\delta))) \\
&=\llbracket\Gamma\vdash\sigma\ t:\kappa\ [t/x]\rrbracket(\delta)
\end{aligned} [ [ Γ ⊢ τ : Ty ] ] ( l Γ ( γ )) ∩ dom ( [ [ Γ ⊢ τ : Ty ] ] ( γ ) ) 2 = [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( δ ) (( t ) ( ρ Γ ( δ ))) = [ [ Γ ⊢ σ t : κ [ t / x ] ] ] ( δ )
⟦ Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ j ) → K ⋅ τ i − k t ‾ } : τ ‾ k → T y ⟧ ( γ ) = lfp X ( q ‾ k ↦ ⋃ { ⟨ ⟨ c i , v ‾ ⟩ , ⟨ c i , w ‾ ⟩ ⟩ | ⋯ } ) \begin{aligned}
\llbracket\Gamma\vdash\mu K^{\langle v\rangle}
\left\{C:(y:\sigma^j)\to K\cdot\frac{\tau_i^{-k}}{\overline{t}}\right\}:\overline{\tau}^{\,k}\to\mathrm{Ty}\rrbracket(\gamma) \\
&=\operatorname{lfp}_{X}\left(\overline{q}^{\,k}\mapsto\bigcup
\left\{\left\langle\langle c_i,\overline{v}\rangle,\langle c_i,\overline{w}\rangle\right\rangle
\middle|\cdots\right\}\right)
\end{aligned} [ [ Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ j ) → K ⋅ t τ i − k } : τ k → Ty ] ] ( γ ) = lfp X ( q k ↦ ⋃ { ⟨ ⟨ c i , v ⟩ , ⟨ c i , w ⟩ ⟩ ∣ ⋯ } )
By I. H., Theorem 5.1 (ii), and Theorem 5.6 (i)
= lfp X ( q ‾ k ↦ ⋃ { ⟨ ⟨ c i , v ‾ ⟩ , ⟨ c i , w ‾ ⟩ ⟩ | ⋯ } ) = ⟦ Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ j ) → K ⋅ τ i − k t ‾ } : τ ‾ k → T y ⟧ ( δ ) \begin{aligned}
=\operatorname{lfp}_{X}\left(\overline{q}^{\,k}\mapsto\bigcup
\left\{\left\langle\langle c_i,\overline{v}\rangle,\langle c_i,\overline{w}\rangle\right\rangle
\middle|\cdots\right\}\right) \\
&=\llbracket\Gamma\vdash\mu K^{\langle v\rangle}
\left\{C:(y:\sigma^j)\to K\cdot\frac{\tau_i^{-k}}{\overline{t}}\right\}:\overline{\tau}^{\,k}\to\mathrm{Ty}\rrbracket(\delta)
\end{aligned} = lfp X ( q k ↦ ⋃ { ⟨ ⟨ c i , v ⟩ , ⟨ c i , w ⟩ ⟩ ∣ ⋯ } ) = [ [ Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ j ) → K ⋅ t τ i − k } : τ k → Ty ] ] ( δ )
Proof of Theorem 5.3 (ii). By induction on the structure of Γ ⊢ τ : κ \Gamma\vdash\tau:\kappa Γ ⊢ τ : κ .
⟦ Γ ⊢ B : κ ⟧ ( γ ) = { ι B ( v ) , ι B ( v ) ∣ v ∈ B } ∪ { ⟨ ⊥ , ⊥ ⟩ } = ⟦ Γ ⊢ B : κ ⟧ ( δ ) \llbracket\Gamma\vdash B:\kappa\rrbracket(\gamma)=\{\iota_B(v),\iota_B(v)\mid v\in B\}\cup\{\langle\perp,\perp\rangle\}=\llbracket\Gamma\vdash B:\kappa\rrbracket(\delta) [ [ Γ ⊢ B : κ ] ] ( γ ) = { ι B ( v ) , ι B ( v ) ∣ v ∈ B } ∪ {⟨ ⊥ , ⊥ ⟩} = [ [ Γ ⊢ B : κ ] ] ( δ )
⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( γ ) = { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) } By I. H. = { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( δ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( δ ) } = ⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( δ ) \begin{aligned}
\llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathsf{Ty}\rrbracket(\gamma)
&=\{\langle f,g\rangle\mid\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\gamma).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathsf{Ty}\rrbracket(\gamma)\}\\
&\qquad\text{By I. H.}\\
&=\{\langle f,g\rangle\mid\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\delta).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathsf{Ty}\rrbracket(\delta)\}\\
&=\llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathsf{Ty}\rrbracket(\delta)
\end{aligned} [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( γ ) = {⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ )} By I. H. = {⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( δ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( δ )} = [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( δ )
⟦ Γ ⊢ ∀ κ : κ . τ : T y ⟧ ( γ ) = { ⟨ v , w ⟩ ∣ ∀ P ∈ ⟦ Γ ⊢ κ : K ⟧ ( γ ) . ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , P ⟩ ) } By I. H. and xref‘Theorem 5.1 (ii)‘ = { ⟨ v , w ⟩ ∣ ∀ P ∈ ⟦ Γ ⊢ κ : K ⟧ ( δ ) . ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ δ , P ⟩ ) } = ⟦ Γ ⊢ ∀ κ : κ . τ : T y ⟧ ( δ ) \begin{aligned}
\llbracket\Gamma\vdash\forall\kappa:\kappa.\tau:\mathsf{Ty}\rrbracket(\gamma)
&=\{\langle v,w\rangle\mid\forall P\in\llbracket\Gamma\vdash\kappa:\mathsf{K}\rrbracket(\gamma).\ \langle v,w\rangle\in\llbracket\Gamma,x:\kappa\vdash\tau:\mathsf{Ty}\rrbracket(\langle\gamma,P\rangle)\}\\
&\qquad\text{By I. H. and {xref}`Theorem 5.1 (ii)`}\\
&=\{\langle v,w\rangle\mid\forall P\in\llbracket\Gamma\vdash\kappa:\mathsf{K}\rrbracket(\delta).\ \langle v,w\rangle\in\llbracket\Gamma,x:\kappa\vdash\tau:\mathsf{Ty}\rrbracket(\langle\delta,P\rangle)\}\\
&=\llbracket\Gamma\vdash\forall\kappa:\kappa.\tau:\mathsf{Ty}\rrbracket(\delta)
\end{aligned} [ [ Γ ⊢ ∀ κ : κ . τ : Ty ] ] ( γ ) = {⟨ v , w ⟩ ∣ ∀ P ∈ [ [ Γ ⊢ κ : K ] ] ( γ ) . ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , P ⟩)} By I. H. and xref ‘Theorem 5.1 (ii)‘ = {⟨ v , w ⟩ ∣ ∀ P ∈ [ [ Γ ⊢ κ : K ] ] ( δ ) . ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ δ , P ⟩)} = [ [ Γ ⊢ ∀ κ : κ . τ : Ty ] ] ( δ )
⟦ Γ ⊢ x : κ ⟧ ( γ ) = γ ( x ) = δ ( x ) = ⟦ Γ ⊢ x : κ ⟧ ( δ ) \llbracket\Gamma\vdash x:\kappa\rrbracket(\gamma)=\gamma(x)=\delta(x)=\llbracket\Gamma\vdash x:\kappa\rrbracket(\delta) [ [ Γ ⊢ x : κ ] ] ( γ ) = γ ( x ) = δ ( x ) = [ [ Γ ⊢ x : κ ] ] ( δ )
⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) = ⟦ Γ ⊢ τ : T y ⟧ ( γ ) By I. H. = ⟦ Γ ⊢ τ : T y ⟧ ( δ ) = ⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( δ ) \begin{aligned}
\llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathsf{Ty}\rrbracket(\gamma)
&=\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\gamma)\\
&\qquad\text{By I. H.}\\
&=\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\delta)\\
&=\llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathsf{Ty}\rrbracket(\delta)
\end{aligned} [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) = [ [ Γ ⊢ τ : Ty ] ] ( γ ) By I. H. = [ [ Γ ⊢ τ : Ty ] ] ( δ ) = [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( δ )
⟦ Γ ⊢ σ t : κ [ t / x ] ⟧ ( γ ) = ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( γ ) By xref‘Theorem 5.1 (ii)‘ = ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( δ ) = ⟦ Γ ⊢ σ t : κ [ t / x ] ⟧ ( δ ) \begin{aligned}
\llbracket\Gamma\vdash\sigma\ t:\kappa\ [t/x]\rrbracket(\gamma)
&=\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\gamma)\\
&\qquad\text{By {xref}`Theorem 5.1 (ii)`}\\
&=\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\delta)\\
&=\llbracket\Gamma\vdash\sigma\ t:\kappa\ [t/x]\rrbracket(\delta)
\end{aligned} [ [ Γ ⊢ σ t : κ [ t / x ] ] ] ( γ ) = [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( γ ) By xref ‘Theorem 5.1 (ii)‘ = [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( δ ) = [ [ Γ ⊢ σ t : κ [ t / x ] ] ] ( δ )
⟦ Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ j ‾ ) → K ⋅ t i k ‾ : τ k ‾ → T y } ⟧ ( γ ) = fix X ( ⋃ i { ⟨ ⟨ c i , v ‾ j ⟩ , ⟨ c i , w ‾ j ⟩ ⟩ ∣ ⟨ v ‾ j , w ‾ j ⟩ ∈ ⟦ Γ , K : τ ‾ k → T y , x ‾ τ ‾ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , X ⟩ ) } ∪ { ⟨ ⊥ , ⊥ ⟩ } ) By I. H. = fix X ( ⋃ i { ⟨ ⟨ c i , v ‾ j ⟩ , ⟨ c i , w ‾ j ⟩ ⟩ ∣ ⟨ v ‾ j , w ‾ j ⟩ ∈ ⟦ Γ , K : τ ‾ k → T y , x ‾ τ ‾ j − 1 ⊢ σ j : T y ⟧ ( ⟨ δ , X ⟩ ) } ∪ { ⟨ ⊥ , ⊥ ⟩ } ) = ⟦ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y ‾ : σ j ) → K ⋅ t i − k } : τ − k → T y ⟧ ( δ ) \begin{aligned}
\llbracket\Gamma\vdash\mu K^{\langle v\rangle}\left\{C:(\overline{y:\sigma^{j}})\to K\cdot\overline{t^{k}_{i}}:\overline{\tau^{k}}\to\mathsf{Ty}\right\}\rrbracket(\gamma)
&=\operatorname{fix}_{X}\left(\bigcup_i\left\{\left\langle\langle c_i,\overline{v}^{\,j}\rangle,\langle c_i,\overline{w}^{\,j}\rangle\right\rangle\mid\langle\overline{v}^{\,j},\overline{w}^{\,j}\rangle\in\llbracket\Gamma,K:\overline{\tau}^{\,k}\to\mathsf{Ty},\overline{x}^{\,\overline{\tau}^{\,j-1}}\vdash\sigma_j:\mathsf{Ty}\rrbracket(\langle\gamma,X\rangle)\right\}\cup\{\langle\perp,\perp\rangle\}\right)\\
&\qquad\text{By I. H.}\\
&=\operatorname{fix}_{X}\left(\bigcup_i\left\{\left\langle\langle c_i,\overline{v}^{\,j}\rangle,\langle c_i,\overline{w}^{\,j}\rangle\right\rangle\mid\langle\overline{v}^{\,j},\overline{w}^{\,j}\rangle\in\llbracket\Gamma,K:\overline{\tau}^{\,k}\to\mathsf{Ty},\overline{x}^{\,\overline{\tau}^{\,j-1}}\vdash\sigma_j:\mathsf{Ty}\rrbracket(\langle\delta,X\rangle)\right\}\cup\{\langle\perp,\perp\rangle\}\right) \\
&= \llbracket\Gamma\vdash\mu K^{\langle\nu\rangle}\left\{C:(\overline{y}:\sigma^{j})\to K\cdot t_i^{-k}\right\}:\tau^{-k}\to\mathrm{Ty}\rrbracket(\delta)
\end{aligned} [ [ Γ ⊢ μ K ⟨ v ⟩ { C : ( y : σ j ) → K ⋅ t i k : τ k → Ty } ] ] ( γ ) = fix X ( i ⋃ { ⟨ ⟨ c i , v j ⟩ , ⟨ c i , w j ⟩ ⟩ ∣ ⟨ v j , w j ⟩ ∈ [ [ Γ , K : τ k → Ty , x τ j − 1 ⊢ σ j : Ty ] ] (⟨ γ , X ⟩) } ∪ {⟨ ⊥ , ⊥ ⟩} ) By I. H. = fix X ( i ⋃ { ⟨ ⟨ c i , v j ⟩ , ⟨ c i , w j ⟩ ⟩ ∣ ⟨ v j , w j ⟩ ∈ [ [ Γ , K : τ k → Ty , x τ j − 1 ⊢ σ j : Ty ] ] (⟨ δ , X ⟩) } ∪ {⟨ ⊥ , ⊥ ⟩} ) = [ [ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i − k } : τ − k → Ty ] ] ( δ )
Proof of Theorem 5.4 . By induction on the structure of Γ ⊢ τ : κ \Gamma\vdash\tau:\kappa Γ ⊢ τ : κ .
⟦ Γ ⊢ B : κ ⟧ ( γ ) = { ⟨ i B ( v ) , i B ( v ) ⟩ ∣ v ∈ B } ⊆ { ⟨ i B ( v ) , i B ( v ) ⟩ ∣ v ∈ B } ∪ { ⟨ ⊥ , ⊥ ⟩ } = ⟦ Γ ⊢ B : κ ⟧ ( ι Γ ( γ ) ) \llbracket\Gamma\vdash B:\kappa\rrbracket(\gamma)
= \left\{\langle i_{\mathcal{B}}(v),i_{\mathcal{B}}(v)\rangle\mid v\in\mathcal{B}\right\}
\subseteq\left\{\langle i_{\mathcal{B}}(v),i_{\mathcal{B}}(v)\rangle\mid v\in\mathcal{B}\right\}\cup\{\langle\perp,\perp\rangle\}
= \llbracket\Gamma\vdash B:\kappa\rrbracket(\iota_{\Gamma}(\gamma)) [ [ Γ ⊢ B : κ ] ] ( γ ) = { ⟨ i B ( v ) , i B ( v )⟩ ∣ v ∈ B } ⊆ { ⟨ i B ( v ) , i B ( v )⟩ ∣ v ∈ B } ∪ {⟨ ⊥ , ⊥ ⟩} = [ [ Γ ⊢ B : κ ] ] ( ι Γ ( γ ))
⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( γ ) = { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ⟨ γ , v ⟩ ) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ι Γ ( γ ) ) } \llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\gamma)
= \left\{\langle f,g\rangle\ \middle|\
\begin{aligned}
&\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\langle\gamma,v\rangle)\\
&\forall\langle v_{\perp},w_{\perp}\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)).\ \langle f\cdot v_{\perp},g\cdot w_{\perp}\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma))
\end{aligned}
\right\} [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( γ ) = { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] (⟨ γ , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( ι Γ ( γ )) }
⊆ { ⟨ f , g ⟩ | ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ι Γ ( γ ) ) } \subseteq\left\{\langle f,g\rangle\ \middle|\ \forall\langle v_{\perp},w_{\perp}\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)).\ \langle f\cdot v_{\perp},g\cdot w_{\perp}\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma))\right\} ⊆ { ⟨ f , g ⟩ ∣ ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( ι Γ ( γ )) }
Dropping the first conjunct
= ⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( ι Γ ( γ ) ) = \llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)) = [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( ι Γ ( γ ))
⟦ Γ ⊢ ∀ x : κ . τ : T y ⟧ ( γ ) = { ⟨ v , w ⟩ | ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) , ∀ P ⊥ ∈ ⟦ Γ ⊢ κ : K d ⟧ ( ι Γ ( γ ) ) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) } \llbracket\Gamma\vdash\forall x:\kappa.\tau:\mathrm{Ty}\rrbracket(\gamma)
= \left\{\langle v,w\rangle\ \middle|\
\begin{aligned}
&\forall P\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma),\ \forall P_{\perp}\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\iota_{\Gamma}(\gamma))\\
&\pi_{\Gamma;\kappa}(\gamma,P)\subseteq P_{\perp}\Rightarrow\langle v,w\rangle\in\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket(\langle\gamma,\langle P,P_{\perp}\rangle\rangle)
\end{aligned}
\right\} [ [ Γ ⊢ ∀ x : κ . τ : Ty ] ] ( γ ) = { ⟨ v , w ⟩ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) , ∀ P ⊥ ∈ [ [ Γ ⊢ κ : Kd ] ] ( ι Γ ( γ )) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , ⟨ P , P ⊥ ⟩⟩) }
Instantiating at the constant empty-relation element P ∅ ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) P_{\varnothing}\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma) P ∅ ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) , for which π Γ ; κ ( γ , P ∅ ) = ∅ ⊆ P ⊥ \pi_{\Gamma;\kappa}(\gamma,P_{\varnothing})=\varnothing\subseteq P_{\perp} π Γ ; κ ( γ , P ∅ ) = ∅ ⊆ P ⊥ holds for every P ⊥ P_{\perp} P ⊥ , and applying I. H.
⊆ { ⟨ v , w ⟩ | ∀ P ⊥ ∈ ⟦ Γ ⊢ κ : K d ⟧ ( ι Γ ( γ ) ) . ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ ι Γ ( γ ) , P ⊥ ⟩ ) } = ⟦ Γ ⊢ ∀ x : κ . τ : T y ⟧ ( ι Γ ( γ ) ) \subseteq\left\{\langle v,w\rangle\ \middle|\ \forall P_{\perp}\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\iota_{\Gamma}(\gamma)).\ \langle v,w\rangle\in\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket(\langle\iota_{\Gamma}(\gamma),P_{\perp}\rangle)\right\}
= \llbracket\Gamma\vdash\forall x:\kappa.\tau:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)) ⊆ { ⟨ v , w ⟩ ∣ ∀ P ⊥ ∈ [ [ Γ ⊢ κ : Kd ] ] ( ι Γ ( γ )) . ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ ι Γ ( γ ) , P ⊥ ⟩) } = [ [ Γ ⊢ ∀ x : κ . τ : Ty ] ] ( ι Γ ( γ ))
π Γ ; κ ( γ , ⟦ Γ ⊢ x : κ ⟧ ( γ ) ) = π Γ ; κ ( γ , γ ( x ) 1 ) ⊆ γ ( x ) 2 By assumption = ι Γ ( γ ) ( x ) = ⟦ Γ ⊢ x : κ ⟧ ( ι Γ ( γ ) ) \begin{aligned}
\pi_{\Gamma;\kappa}(\gamma,\llbracket\Gamma\vdash x:\kappa\rrbracket(\gamma))
&=\pi_{\Gamma;\kappa}(\gamma,\gamma(x)_1)\\
&\subseteq\gamma(x)_2 && \text{By assumption}\\
&=\iota_{\Gamma}(\gamma)(x)\\
&=\llbracket\Gamma\vdash x:\kappa\rrbracket(\iota_{\Gamma}(\gamma))
\end{aligned} π Γ ; κ ( γ , [ [ Γ ⊢ x : κ ] ] ( γ )) = π Γ ; κ ( γ , γ ( x ) 1 ) ⊆ γ ( x ) 2 = ι Γ ( γ ) ( x ) = [ [ Γ ⊢ x : κ ] ] ( ι Γ ( γ )) By assumption
⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) = { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) | ⟦ Γ , x : τ ⊢ ϕ p r p ⟧ ( ⟨ γ , v ⟩ ) = t t } ⊆ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty}\rrbracket(\gamma)
= \left\{\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma)\ \middle|\ \llbracket\Gamma,x:\tau\vdash\phi\ \mathrm{prp}\rrbracket(\langle\gamma,v\rangle)=\mathrm{tt}\right\}
\subseteq\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) = { ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) ∣ [ [ Γ , x : τ ⊢ ϕ prp ] ] (⟨ γ , v ⟩) = tt } ⊆ [ [ Γ ⊢ τ : Ty ] ] ( γ )
By I. H.
⊆ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) = ⟦ Γ ⊢ { x : ι ∣ ϕ } : T y ⟧ ( ι Γ ( γ ) ) \begin{aligned}
\subseteq\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)) \\
&= \llbracket\Gamma\vdash\{x:\iota\mid\phi\}:Ty \rrbracket(\iota_{\Gamma}(\gamma))
\end{aligned} ⊆ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) = [ [ Γ ⊢ { x : ι ∣ ϕ } : T y ] ] ( ι Γ ( γ ))
π Γ ; κ [ t / x ] ( γ , ⟦ Γ ⊢ σ t : κ [ t / x ] ⟧ ( γ ) ) = π Γ ; κ [ t / x ] ( γ , ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( γ ) ( ( ( t ) ) ( ρ Γ ( γ ) ) ) ) \begin{aligned}
\pi_{\Gamma;\kappa[t/x]} \left(\gamma,\llbracket\Gamma\vdash\sigma\ t:\kappa[t/x]\rrbracket(\gamma)\right) \\
&= \pi_{\Gamma;\kappa[t/x]} \left(\gamma,\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\gamma)\left(((t))(\rho_{\Gamma}(\gamma))\right)\right)
\end{aligned} π Γ ; κ [ t / x ] ( γ , [ [ Γ ⊢ σ t : κ [ t / x ] ] ] ( γ ) ) = π Γ ; κ [ t / x ] ( γ , [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( γ ) ( (( t )) ( ρ Γ ( γ )) ) )
⊆ π Γ ; ( x : τ ) → κ ( γ , ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( γ ) ) \subseteq\pi_{\Gamma;(x:\tau)\to\kappa}\left(\gamma,\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\gamma)\right) ⊆ π Γ ; ( x : τ ) → κ ( γ , [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( γ ) )
By I. H.
⊆ ⟦ Γ ⊢ σ : ( x : τ ) → κ ⟧ ( ι Γ ( γ ) ) = ⟦ Γ ⊢ σ t : κ [ t / x ] ⟧ ( ι Γ ( γ ) ) \begin{aligned}
\subseteq\llbracket\Gamma\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\iota_{\Gamma}(\gamma)) \\
&= \llbracket\Gamma\vdash\sigma\ t:\kappa[t/x]\rrbracket(\iota_{\Gamma}(\gamma))
\end{aligned} ⊆ [ [ Γ ⊢ σ : ( x : τ ) → κ ] ] ( ι Γ ( γ )) = [ [ Γ ⊢ σ t : κ [ t / x ] ] ] ( ι Γ ( γ ))
⟦ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( γ ) = lfp X ( ⋃ i q k ↦ ∪ { ⟨ C i j , ⟨ C i j , w j ⟩ ⟩ ∣ ⟨ q k , ( ( t k ) ) ( ⟨ ρ Γ ( γ ) , v j ⟩ ) ⟩ ∈ ⟦ Γ , K : k → T y , x : τ i − 1 k ⊢ σ j : τ j ⟧ ( γ , X ) } ) \begin{aligned}
\llbracket\Gamma\vdash\mu K^{\langle\nu\rangle}
\left\{C:(\underline{y:\sigma^{j}})\to K\cdot\underline{t}^{k}_{i}\right\}:\underline{\tau}^{k}\to Ty\rrbracket(\gamma) \\
&= \operatorname{lfp}_{X}\left(\bigcup_{i}^{q^{k}\mapsto\cup}
\left\{\left\langle C_{i}^{j},\left\langle C_{i}^{j},w_{j}\right\rangle\right\rangle
\mid\left\langle q_{k},((t_{k}))\left(\left\langle\rho_{\Gamma}(\gamma),v_{j}\right\rangle\right)\right\rangle
\in\llbracket\Gamma,K:k\to Ty,x:\tau^{k}_{i-1}\vdash\sigma_{j}:\tau_{j}\rrbracket(\gamma,X)\right\}\right)
\end{aligned} [ [ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → T y ] ] ( γ ) = lfp X i ⋃ q k ↦ ∪ { ⟨ C i j , ⟨ C i j , w j ⟩ ⟩ ∣ ⟨ q k , (( t k )) ( ⟨ ρ Γ ( γ ) , v j ⟩ ) ⟩ ∈ [ [ Γ , K : k → T y , x : τ i − 1 k ⊢ σ j : τ j ] ] ( γ , X ) }
⟦ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( ι Γ ( γ ) ) = fix X ( ⋃ i { ⟨ C i j , ⟨ C i j , w j ⟩ ⟩ ∣ ⟨ v j , w j ⟩ ∈ ⟦ Γ , K : k → T y , x : τ i − 1 k ⊢ σ j : τ j ⟧ ( γ , X ) } ∪ { ⟨ ⊥ , ⊥ ⟩ } ) \begin{aligned}
\llbracket\Gamma\vdash\mu K^{\langle\nu\rangle}
\left\{C:(\underline{y:\sigma^{j}})\to K\cdot\underline{t}^{k}_{i}\right\}:\underline{\tau}^{k}\to Ty\rrbracket(\iota_{\Gamma}(\gamma)) \\
&= \operatorname{fix}_{X}\left(\bigcup_{i}
\left\{\left\langle C_{i}^{j},\left\langle C_{i}^{j},w_{j}\right\rangle\right\rangle
\mid\left\langle v_{j},w_{j}\right\rangle\in
\llbracket\Gamma,K:k\to Ty,x:\tau^{k}_{i-1}\vdash\sigma_{j}:\tau_{j}\rrbracket(\gamma,X)\right\}\cup\{\langle\bot,\bot\rangle\}\right)
\end{aligned} [ [ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → T y ] ] ( ι Γ ( γ )) = fix X ( i ⋃ { ⟨ C i j , ⟨ C i j , w j ⟩ ⟩ ∣ ⟨ v j , w j ⟩ ∈ [ [ Γ , K : k → T y , x : τ i − 1 k ⊢ σ j : τ j ] ] ( γ , X ) } ∪ {⟨ ⊥ , ⊥ ⟩} )
First we observe that if
π Γ ; τ ‾ k → T y ( γ , X ) ⊆ ⟦ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( ι Γ ( γ ) ) \pi_{\Gamma;\underline{\tau}^{k}\to Ty}(\gamma,X)
\subseteq
\llbracket\Gamma\vdash\mu K^{\langle\nu\rangle}
\left\{C:(\underline{y:\sigma^{j}})\to K\cdot\underline{t}^{k}_{i}\right\}:\underline{\tau}^{k}\to Ty\rrbracket(\iota_{\Gamma}(\gamma)) π Γ ; τ k → T y ( γ , X ) ⊆ [ [ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → T y ] ] ( ι Γ ( γ ))
then by I. Hs..
π Γ ; τ ‾ k → T y ( γ , α ( X ) ) ⊆ ⟦ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( ι Γ ( γ ) ) \pi_{\Gamma;\underline{\tau}^{k}\to Ty}(\gamma,\alpha(X))
\subseteq
\llbracket\Gamma\vdash\mu K^{\langle\nu\rangle}
\left\{C:(\underline{y:\sigma^{j}})\to K\cdot\underline{t}^{k}_{i}\right\}:\underline{\tau}^{k}\to Ty\rrbracket(\iota_{\Gamma}(\gamma)) π Γ ; τ k → T y ( γ , α ( X )) ⊆ [ [ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → T y ] ] ( ι Γ ( γ ))
Now we proceed by cases on the formation rule:
– Ty-IndPos: Since α \alpha α is a monotone operator we can apply the pre-fixed point induction principle, by definition:
π Γ ; τ ‾ k → T y ( γ , q k ↦ ⟦ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( ι Γ ( γ ) ) ) \pi_{\Gamma;\underline{\tau}^{k}\to Ty}
\left(\gamma,q^{k}\mapsto
\llbracket\Gamma\vdash\mu K^{\langle\nu\rangle}
\left\{C:(\underline{y:\sigma^{j}})\to K\cdot\underline{t}^{k}_{i}\right\}:\underline{\tau}^{k}\to Ty\rrbracket(\iota_{\Gamma}(\gamma))\right) π Γ ; τ k → T y ( γ , q k ↦ [ [ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → T y ] ] ( ι Γ ( γ )) )
⊆ ⟦ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( ι Γ ( γ ) ) \subseteq
\llbracket\Gamma\vdash\mu K^{\langle\nu\rangle}
\left\{C:(\underline{y:\sigma^{j}})\to K\cdot\underline{t}^{k}_{i}\right\}:\underline{\tau}^{k}\to Ty\rrbracket(\iota_{\Gamma}(\gamma)) ⊆ [ [ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → T y ] ] ( ι Γ ( γ ))
From the previous observation,
α ( q k ↦ ⟦ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( ι Γ ( γ ) ) ) \alpha\left(q^{k}\mapsto
\llbracket\Gamma\vdash\mu K^{\langle\nu\rangle}
\left\{C:(\underline{y:\sigma^{j}})\to K\cdot\underline{t}^{k}_{i}\right\}:\underline{\tau}^{k}\to Ty\rrbracket(\iota_{\Gamma}(\gamma))\right) α ( q k ↦ [ [ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → T y ] ] ( ι Γ ( γ )) )
⊆ ⟦ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( ι Γ ( γ ) ) \subseteq
\llbracket\Gamma\vdash\mu K^{\langle\nu\rangle}
\left\{C:(\underline{y:\sigma^{j}})\to K\cdot\underline{t}^{k}_{i}\right\}:\underline{\tau}^{k}\to Ty\rrbracket(\iota_{\Gamma}(\gamma)) ⊆ [ [ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → T y ] ] ( ι Γ ( γ ))
Since the least fixed point is bounded above by any pre-fixed point, it follows that
π Γ ; τ ‾ k → T y ( γ , lfp X ( α ) ) ⊆ ⟦ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( ι Γ ( γ ) ) \pi_{\Gamma;\underline{\tau}^{k}\to Ty}
\left(\gamma,\operatorname{lfp}_{X}(\alpha)\right)
\subseteq
\llbracket\Gamma\vdash\mu K^{\langle\nu\rangle}
\left\{C:(\underline{y:\sigma^{j}})\to K\cdot\underline{t}^{k}_{i}\right\}:\underline{\tau}^{k}\to Ty\rrbracket(\iota_{\Gamma}(\gamma)) π Γ ; τ k → T y ( γ , lfp X ( α ) ) ⊆ [ [ Γ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → T y ] ] ( ι Γ ( γ ))
– Ty-IndStrat: Instead here since we lack monotonicity, we will show it by subdividing the construction by the stratification index
P ( n ) ≜ q k ↦ { ⟦ Γ ⊢ D : σ ‾ k → T y ⟧ ( γ ) ⋅ q k if n > r N ( ( ( m ) ) ( ρ Γ ( γ ) ) ⋅ q k ) , ∅ otherwise. P(n)\triangleq q^{k}\mapsto
\begin{cases}
\llbracket\Gamma\vdash D:\underline{\sigma}^{k}\to Ty\rrbracket(\gamma)\cdot q^{k}
& \text{if } n>r_{N}\left(((m))(\rho_{\Gamma}(\gamma))\cdot q^{k}\right),\\
\varnothing
& \text{otherwise.}
\end{cases} P ( n ) ≜ q k ↦ { [ [ Γ ⊢ D : σ k → T y ] ] ( γ ) ⋅ q k ∅ if n > r N ( (( m )) ( ρ Γ ( γ )) ⋅ q k ) , otherwise.
Clearly ∀ n ∈ N . P ( n ) ≤ ⟦ Γ ⊢ D : τ ⃗ k → T y ⟧ ( γ ) \forall n \in\mathbb{N}.\ P(n) \le\llbracket\Gamma\vdash D:\vec{\tau}^{k} \to\mathsf{Ty} \rrbracket(\gamma) ∀ n ∈ N . P ( n ) ≤ [ [ Γ ⊢ D : τ k → Ty ] ] ( γ ) . By induction on n n n that ∀ n ∈ N . π Γ ; τ k → T y ( γ , P ( n ) ) ⊆ ⟦ Γ ⊢ D : τ ⃗ k → T y ⟧ ( ι Γ ( γ ) ) \forall n \in\mathbb{N}.\ \pi_{\Gamma;\tau^{k}\to\mathsf{Ty}}(\gamma,P(n)) \subseteq\llbracket\Gamma\vdash D:\vec{\tau}^{k} \to\mathsf{Ty} \rrbracket(\iota_{\Gamma}(\gamma)) ∀ n ∈ N . π Γ ; τ k → Ty ( γ , P ( n )) ⊆ [ [ Γ ⊢ D : τ k → Ty ] ] ( ι Γ ( γ )) . Since each P ( n ) = α ( P ( n − 1 ) ) P(n)=\alpha(P(n-1)) P ( n ) = α ( P ( n − 1 )) for n > 0 n>0 n > 0 , the inductive case follows from the previous observation. The base case is trivial since P ( 0 ) = ∅ P(0)=\varnothing P ( 0 ) = ∅ .
Proof of Corollary 1. From Theorem 5.4 ⟨ v , v ′ ⟩ , ⟨ w , w ′ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) \langle v,v'\rangle,\langle w,w'\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty} \rrbracket(\iota_{\Gamma}(\gamma)) ⟨ v , v ′ ⟩ , ⟨ w , w ′ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) (i) ( ⇒ ) (\Rightarrow) ( ⇒ ) By transitivity and symmetry ⟨ v ′ , w ′ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) \langle v',w'\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty} \rrbracket(\iota_{\Gamma}(\gamma)) ⟨ v ′ , w ′ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) . (ii) ( ⇐ ) (\Leftarrow) ( ⇐ ) By transitivity and symmetry ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) \langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty} \rrbracket(\iota_{\Gamma}(\gamma)) ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) .
Proof of Theorem 5.6 (i). By induction on the structure of Γ ⊢ t : τ \Gamma\vdash t:\tau Γ ⊢ t : τ .
⟨ ( ( b ) ) ( ρ Γ ( γ ) ) , ( ( b ) ) ( ρ Γ ( δ ) ) ⟩ = ⟨ i B ( b ) , i B ( b ) ⟩ ∈ { ⟨ i B ( b ) , i B ( b ) ⟩ ∣ b ∈ B } = ⟦ Γ ⊢ B : T y ⟧ ( γ ) \begin{aligned}
\langle((b))(\rho_{\Gamma}(\gamma)),((b))(\rho_{\Gamma}(\delta))\rangle
&=\langle i_{\mathcal{B}}(b),i_{\mathcal{B}}(b)\rangle\\
&\in\{\langle i_{\mathcal{B}}(b),i_{\mathcal{B}}(b)\rangle\mid b\in\mathcal{B}\}\\
&=\llbracket\Gamma\vdash\mathcal{B}:\mathsf{Ty}\rrbracket(\gamma)
\end{aligned} ⟨(( b )) ( ρ Γ ( γ )) , (( b )) ( ρ Γ ( δ ))⟩ = ⟨ i B ( b ) , i B ( b )⟩ ∈ {⟨ i B ( b ) , i B ( b )⟩ ∣ b ∈ B } = [ [ Γ ⊢ B : Ty ] ] ( γ )
⟨ ( ( x ) ) ( ρ Γ ( γ ) ) , ( ( x ) ) ( ρ Γ ( δ ) ) ⟩ = ⟨ γ ( x ) , δ ( x ) ⟩ By assumption ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \begin{aligned}
\langle((x))(\rho_{\Gamma}(\gamma)),((x))(\rho_{\Gamma}(\delta))\rangle
&=\langle\gamma(x),\delta(x)\rangle\\
&\text{By assumption}\\
&\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\gamma)
\end{aligned} ⟨(( x )) ( ρ Γ ( γ )) , (( x )) ( ρ Γ ( δ ))⟩ = ⟨ γ ( x ) , δ ( x )⟩ By assumption ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ )
⟨ ( ( λ x . t ) ) ( ρ Γ ( γ ) ) , ( ( λ x . t ) ) ( ρ Γ ( δ ) ) ⟩ = ⟨ i → ( v ↦ ( ( t ) ) ( ⟨ ρ Γ ( γ ) , v ⟩ ) ) , i → ( v ↦ ( ( t ) ) ( ⟨ ρ Γ ( δ ) , v ⟩ ) ) ⟩ \begin{aligned}
\langle((\lambda x.t))(\rho_{\Gamma}(\gamma)),((\lambda x.t))(\rho_{\Gamma}(\delta))\rangle
={}&\langle i_{\to}(v\mapsto((t))(\langle\rho_{\Gamma}(\gamma),v\rangle)),\\
&\qquad i_{\to}(v\mapsto((t))(\langle\rho_{\Gamma}(\delta),v\rangle))\rangle
\end{aligned} ⟨(( λ x . t )) ( ρ Γ ( γ )) , (( λ x . t )) ( ρ Γ ( δ ))⟩ = ⟨ i → ( v ↦ (( t )) (⟨ ρ Γ ( γ ) , v ⟩)) , i → ( v ↦ (( t )) (⟨ ρ Γ ( δ ) , v ⟩))⟩
We need to show
⟨ f , g ⟩ ∈ ⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( γ ) \langle f,g\rangle\in\llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathsf{Ty}\rrbracket(\gamma) ⟨ f , g ⟩ ∈ [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( γ )
⟺ { ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ⟨ γ , v ⟩ ) (i) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ι Γ ( γ ) ) (ii) \begin{aligned}
\iff\ &\left\{
\begin{aligned}
&\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\gamma).\ \langle f\mathbin{\cdot}v,g\mathbin{\cdot}w\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathsf{Ty}\rrbracket(\langle\gamma,v\rangle) &&\text{(i)}\\
&\forall\langle v_{\bot},w_{\bot}\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\iota_{\Gamma}(\gamma)).\ \langle f\mathbin{\cdot}v_{\bot},g\mathbin{\cdot}w_{\bot}\rangle\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathsf{Ty}\rrbracket(\iota_{\Gamma}(\gamma)) &&\text{(ii)}
\end{aligned}
\right.
\end{aligned} ⟺ { ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] (⟨ γ , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( ι Γ ( γ )) (i) (ii)
It is enough to show that fixed arbitrary ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\gamma) ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) and ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) \langle v_{\bot},w_{\bot}\rangle\in\llbracket\Gamma\vdash\tau:\mathsf{Ty}\rrbracket(\iota_{\Gamma}(\gamma)) ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) the conditions (i) and (ii) hold. We show them separately.
(i)
⟨ i → ( v ↦ ( ( t ) ) ( ⟨ ρ Γ ( γ ) , v ⟩ ) ) ⋅ v , i → ( v ↦ ( ( t ) ) ( ⟨ ρ Γ ( δ ) , v ⟩ ) ) ⋅ w ⟩ = ⟨ ( ( t ) ) ( ⟨ ρ Γ ( γ ) , v ⟩ ) , ( ( t ) ) ( ⟨ ρ Γ ( δ ) , w ⟩ ) ⟩ By I. H. ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ⟨ γ , v ⟩ ) \begin{aligned}
&\langle i_{\to}(v\mapsto((t))(\langle\rho_{\Gamma}(\gamma),v\rangle))\mathbin{\cdot}v,\ i_{\to}(v\mapsto((t))(\langle\rho_{\Gamma}(\delta),v\rangle))\mathbin{\cdot}w\rangle\\
&=\langle((t))(\langle\rho_{\Gamma}(\gamma),v\rangle),((t))(\langle\rho_{\Gamma}(\delta),w\rangle)\rangle\\
&\text{By I. H.}\\
&\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathsf{Ty}\rrbracket(\langle\gamma,v\rangle)
\end{aligned} ⟨ i → ( v ↦ (( t )) (⟨ ρ Γ ( γ ) , v ⟩)) ⋅ v , i → ( v ↦ (( t )) (⟨ ρ Γ ( δ ) , v ⟩)) ⋅ w ⟩ = ⟨(( t )) (⟨ ρ Γ ( γ ) , v ⟩) , (( t )) (⟨ ρ Γ ( δ ) , w ⟩)⟩ By I. H. ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] (⟨ γ , v ⟩)
(ii)
⟨ i → ( v ↦ ( ( t ) ) ( ⟨ ρ Γ ( γ ) , v ⟩ ) ) ⋅ v ⊥ , i → ( v ↦ ( ( t ) ) ( ⟨ ρ Γ ( δ ) , v ⟩ ) ) ⋅ w ⊥ ⟩ = ⟨ ( ( t ) ) ( ⟨ ρ Γ ( γ ) , v ⊥ ⟩ ) , ( ( t ) ) ( ⟨ ρ Γ ( δ ) , w ⊥ ⟩ ) ⟩ By xref‘Theorem 5.6 (ii)‘ and xref‘Lemma 5.5‘ \begin{aligned}
&\langle i_{\to}(v\mapsto((t))(\langle\rho_{\Gamma}(\gamma),v\rangle))\mathbin{\cdot}v_{\bot},\ i_{\to}(v\mapsto((t))(\langle\rho_{\Gamma}(\delta),v\rangle))\mathbin{\cdot}w_{\bot}\rangle\\
&=\langle((t))(\langle\rho_{\Gamma}(\gamma),v_{\bot}\rangle),((t))(\langle\rho_{\Gamma}(\delta),w_{\bot}\rangle)\rangle\\
&\text{By {xref}`Theorem 5.6 (ii)` and {xref}`Lemma 5.5`}
\end{aligned} ⟨ i → ( v ↦ (( t )) (⟨ ρ Γ ( γ ) , v ⟩)) ⋅ v ⊥ , i → ( v ↦ (( t )) (⟨ ρ Γ ( δ ) , v ⟩)) ⋅ w ⊥ ⟩ = ⟨(( t )) (⟨ ρ Γ ( γ ) , v ⊥ ⟩) , (( t )) (⟨ ρ Γ ( δ ) , w ⊥ ⟩)⟩ By xref ‘Theorem 5.6 (ii)‘ and xref ‘Lemma 5.5‘
∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ι Γ ( γ ) ) \in\llbracket\Gamma, x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)) ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( ι Γ ( γ ))
⟨ ⟦ ( t ⋅ u ) ⟧ ( ρ Γ ( γ ) ) , ⟦ ( t ⋅ u ) ⟧ ( ρ Γ ( δ ) ) ⟩ = ⟨ ⟦ t ⟧ ( ρ Γ ( γ ) ) ⋅ ⟦ u ⟧ ( ρ Γ ( γ ) ) , ⟦ t ⟧ ( ρ Γ ( δ ) ) ⋅ ⟦ u ⟧ ( ρ Γ ( δ ) ) ⟩ \begin{aligned}
\left\langle\llbracket(t \mathbin{\cdot} u)\rrbracket(\rho_{\Gamma}(\gamma)),\llbracket(t \mathbin{\cdot} u)\rrbracket(\rho_{\Gamma}(\delta))\right\rangle\\
&= \left\langle\llbracket t\rrbracket(\rho_{\Gamma}(\gamma)) \mathbin{\cdot} \llbracket u\rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t\rrbracket(\rho_{\Gamma}(\delta)) \mathbin{\cdot} \llbracket u\rrbracket(\rho_{\Gamma}(\delta))\right\rangle
\end{aligned} ⟨ [ [ ( t ⋅ u ) ] ] ( ρ Γ ( γ )) , [ [ ( t ⋅ u ) ] ] ( ρ Γ ( δ )) ⟩ = ⟨ [ [ t ] ] ( ρ Γ ( γ )) ⋅ [ [ u ] ] ( ρ Γ ( γ )) , [ [ t ] ] ( ρ Γ ( δ )) ⋅ [ [ u ] ] ( ρ Γ ( δ )) ⟩
We need to show
∈ ⟦ Γ ⊢ σ [ u / x ] : T y ⟧ ( γ ) \in\llbracket\Gamma\vdash\sigma[u/x]:\mathrm{Ty}\rrbracket(\gamma) ∈ [ [ Γ ⊢ σ [ u / x ] : Ty ] ] ( γ )
By I. H. applied to u u u and t t t we have, respectively,
⟨ ⟦ u ⟧ ( ρ Γ ( γ ) ) , ⟦ u ⟧ ( ρ Γ ( δ ) ) ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) , and \left\langle\llbracket u\rrbracket(\rho_{\Gamma}(\gamma)),\llbracket u\rrbracket(\rho_{\Gamma}(\delta))\right\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma),\quad\text{and} ⟨ [ [ u ] ] ( ρ Γ ( γ )) , [ [ u ] ] ( ρ Γ ( δ )) ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) , and
⟨ ⟦ t ⟧ ( ρ Γ ( γ ) ) , ⟦ t ⟧ ( ρ Γ ( δ ) ) ⟩ ∈ ⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( γ ) = { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ⟨ γ , v ⟩ ) (i) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ι Γ ( γ ) ) (ii) } \begin{aligned}
\left\langle\llbracket t\rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t\rrbracket(\rho_{\Gamma}(\delta))\right\rangle
\in\llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\gamma) \\
&= \left\{
\left\langle f,g\right\rangle\mathrel{\middle|}
\begin{aligned}
&\forall\left\langle v,w\right\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma).\
\left\langle f\mathbin{\cdot}v,g\mathbin{\cdot}w\right\rangle
\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\left\langle\gamma,v\right\rangle)\ \text{(i)}\\
&\forall\left\langle v_{\perp},w_{\perp}\right\rangle\in
\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma)).\
\left\langle f\mathbin{\cdot}v_{\perp},g\mathbin{\cdot}w_{\perp}\right\rangle
\in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma))\ \text{(ii)}
\end{aligned}
\right\}
\end{aligned} ⟨ [ [ t ] ] ( ρ Γ ( γ )) , [ [ t ] ] ( ρ Γ ( δ )) ⟩ ∈ [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( γ ) = { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( ⟨ γ , v ⟩ ) (i) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( ι Γ ( γ )) (ii) }
Finally, we can show
⟨ ⟦ t ⟧ ( ρ Γ ( γ ) ) ⋅ ⟦ u ⟧ ( ρ Γ ( γ ) ) , ⟦ t ⟧ ( ρ Γ ( δ ) ) ⋅ ⟦ u ⟧ ( ρ Γ ( δ ) ) ⟩ \left\langle\llbracket t\rrbracket(\rho_{\Gamma}(\gamma))\mathbin{\cdot}\llbracket u\rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t\rrbracket(\rho_{\Gamma}(\delta))\mathbin{\cdot}\llbracket u\rrbracket(\rho_{\Gamma}(\delta))\right\rangle ⟨ [ [ t ] ] ( ρ Γ ( γ )) ⋅ [ [ u ] ] ( ρ Γ ( γ )) , [ [ t ] ] ( ρ Γ ( δ )) ⋅ [ [ u ] ] ( ρ Γ ( δ )) ⟩
By (i)
∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( ⟨ γ , ⟦ u ⟧ ( ρ Γ ( γ ) ) ⟩ ) \in\llbracket\Gamma,x:\tau\vdash\sigma:\mathrm{Ty}\rrbracket
\left(\left\langle\gamma,\llbracket u\rrbracket(\rho_{\Gamma}(\gamma))\right\rangle\right) ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( ⟨ γ , [ [ u ] ] ( ρ Γ ( γ )) ⟩ )
By Lemma C.5
= ⟦ Γ ⊢ σ [ u / x ] : T y ⟧ ( γ ) = \llbracket\Gamma\vdash\sigma[u/x]:\mathrm{Ty}\rrbracket(\gamma) = [ [ Γ ⊢ σ [ u / x ] : Ty ] ] ( γ )
⟨ ⟦ Λ x . t ⟧ ( ρ Γ ( γ ) ) , ⟦ Λ x . t ⟧ ( ρ Γ ( δ ) ) ⟩ = ⟨ ⟦ t ⟧ ( ρ Γ ( γ ) ) , ⟦ t ⟧ ( ρ Γ ( δ ) ) ⟩ \begin{aligned}
\left\langle\llbracket\Lambda x.t\rrbracket(\rho_{\Gamma}(\gamma)),\llbracket\Lambda x.t\rrbracket(\rho_{\Gamma}(\delta))\right\rangle\\
&= \left\langle\llbracket t\rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t\rrbracket(\rho_{\Gamma}(\delta))\right\rangle
\end{aligned} ⟨ [ [ Λ x . t ] ] ( ρ Γ ( γ )) , [ [ Λ x . t ] ] ( ρ Γ ( δ )) ⟩ = ⟨ [ [ t ] ] ( ρ Γ ( γ )) , [ [ t ] ] ( ρ Γ ( δ )) ⟩
We need to show
∈ ⟦ Γ ⊢ ∀ x : κ . τ : T y ⟧ ( γ ) = { ⟨ v , w ⟩ | ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) , ∀ P ⊥ ∈ ⟦ Γ ⊢ κ : K d ⟧ ( ι Γ ( γ ) ) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) } \begin{aligned}
\in\llbracket\Gamma\vdash\forall x:\kappa.\tau:\mathrm{Ty}\rrbracket(\gamma) \\
&= \left\{
\left\langle v,w\right\rangle\mathrel{\middle|}
\begin{aligned}
&\forall P\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma),\ \forall P_{\perp}\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\iota_{\Gamma}(\gamma))\\
&\pi_{\Gamma;\kappa}(\gamma,P)\subseteq P_{\perp}\Rightarrow
\left\langle v,w\right\rangle\in
\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket
\left(\left\langle\gamma,\left\langle P,P_{\perp}\right\rangle\right\rangle\right)
\end{aligned}
\right\}
\end{aligned} ∈ [ [ Γ ⊢ ∀ x : κ . τ : Ty ] ] ( γ ) = { ⟨ v , w ⟩ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) , ∀ P ⊥ ∈ [ [ Γ ⊢ κ : Kd ] ] ( ι Γ ( γ )) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) }
It is enough to show that for arbitrary fixed P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) P\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\gamma) P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) and P ⊥ ∈ ⟦ Γ ⊢ κ : K d ⟧ ( ι Γ ( γ ) ) P_{\perp}\in\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\rrbracket(\iota_{\Gamma}(\gamma)) P ⊥ ∈ [ [ Γ ⊢ κ : Kd ] ] ( ι Γ ( γ )) with π Γ ; κ ( γ , P ) ⊆ P ⊥ \pi_{\Gamma;\kappa}(\gamma,P)\subseteq P_{\perp} π Γ ; κ ( γ , P ) ⊆ P ⊥ the pair belongs to the body interpretation, which is exactly the I. H. for t t t in the extended context.
⟨ ⟦ t ⟧ ( ρ Γ ( γ ) ) , ⟦ t ⟧ ( ρ Γ ( δ ) ) ⟩ \left\langle\llbracket t\rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t\rrbracket(\rho_{\Gamma}(\delta))\right\rangle ⟨ [ [ t ] ] ( ρ Γ ( γ )) , [ [ t ] ] ( ρ Γ ( δ )) ⟩
By I. H.
∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) \in\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\rrbracket
\left(\left\langle\gamma,\left\langle P,P_{\perp}\right\rangle\right\rangle\right) ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ )
⟨ ⟦ t τ ⟧ ( ρ Γ ( γ ) ) , ⟦ t τ ⟧ ( ρ Γ ( δ ) ) ⟩ = ⟨ ⟦ t ⟧ ( ρ Γ ( γ ) ) , ⟦ t ⟧ ( ρ Γ ( δ ) ) ⟩ \begin{aligned}
\left\langle\llbracket t\ \tau\rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t\ \tau\rrbracket(\rho_{\Gamma}(\delta))\right\rangle\\
&= \left\langle\llbracket t\rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t\rrbracket(\rho_{\Gamma}(\delta))\right\rangle
\end{aligned} ⟨ [ [ t τ ] ] ( ρ Γ ( γ )) , [ [ t τ ] ] ( ρ Γ ( δ )) ⟩ = ⟨ [ [ t ] ] ( ρ Γ ( γ )) , [ [ t ] ] ( ρ Γ ( δ )) ⟩
We need to show
∈ ⟦ Γ ⊢ σ [ τ / x ] : T y ⟧ ( γ ) \in\llbracket\Gamma\vdash\sigma[\tau/x]:\mathrm{Ty}\rrbracket(\gamma) ∈ [ [ Γ ⊢ σ [ τ / x ] : Ty ] ] ( γ )
By I. H. we have
\begin{aligned}
\left\langle\llbracket t \rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t \rrbracket(\rho_{\Gamma}(\delta))\right\rangle
\in\left\llbracket\Gamma\vdash\forall x:\kappa.\ \sigma:\mathrm{Ty}\right\rrbracket(\gamma) \\
&=
\left\{
\left\langle v,w\right\rangle
\mathrel{\middle|}
\begin{array}{l}
\forall P \in\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(\gamma),\ \forall P_{\perp}\in\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(\iota_{\Gamma}(\gamma))\\
\pi_{\Gamma;\kappa}(\gamma,P)\subseteq P_{\perp}\Rightarrow\left\langle v,w\right\rangle\in\left\llbracket\Gamma,x:\kappa\vdash\sigma:\mathrm{Ty}\right\rrbracket\left(\left\langle\gamma,\left\langle P,P_{\perp}\right\rangle\right\rangle\right)
\end{array}
\right\}.
\end{aligned}
The interpretations of the type argument τ \tau τ form a valid index: by Theorem 5.2 (i) \left\llbracket\Gamma\vdash\tau:\kappa\right\rrbracket(\gamma)\in\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(\gamma) , by Theorem 5.2 (ii) \left\llbrbracket\Gamma\vdash\tau:\kappa\right\rrbracket(\iota_{\Gamma}(\gamma))\in\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(\iota_{\Gamma}(\gamma)) , and by Theorem 5.4 \pi_{\Gamma;\kappa}\left(\gamma,\left\llbracket\Gamma\vdash\tau:\kappa\right\rrbracket(\gamma)\right)\subseteq\left\llbracket\Gamma\vdash\tau:\kappa\right\rrbracket(\iota_{\Gamma}(\gamma)) . Instantiating the universal quantifier at \left\llbracket\Gamma\vdash\tau:\kappa\right\rrbracket(\gamma) and \left\llbracket\Gamma\vdash\tau:\kappa\right\rrbracket(\iota_{\Gamma}(\gamma)) , whose implication premise holds, gives
\left\langle\llbracket t \rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t \rrbracket(\rho_{\Gamma}(\delta))\right\rangle
\in
\left\llbracket\Gamma,x:\kappa\vdash\sigma:\mathrm{Ty}\right\rrbracket
\left(\left\langle\gamma,\left\langle\left\llbracket\Gamma\vdash\tau:\kappa\right\rrbracket(\gamma),\left\llbracket\Gamma\vdash\tau:\kappa\right\rrbracket(\iota_{\Gamma}(\gamma))\right\rangle\right\rangle\right)
By Lemma C.7
=
\left\llbracket\Gamma\vdash\sigma[\tau/x]:\mathrm{Ty}\right\rrbracket(\gamma)
Tm-Refl By I. H. the pair lies in \left\llbracket\Gamma\vdash\tau:\mathrm{Ty}\right\rrbracket(\gamma) . Write v t ≜ ⟦ t ⟧ ( ρ Γ ( γ ) ) v_t\mathrel{\triangleq}\llbracket t\rrbracket(\rho_{\Gamma}(\gamma)) v t ≜ [ [ t ] ] ( ρ Γ ( γ )) for its first component. Partial reflexivity gives \left\langle v_t,v_t\right\rangle\in\left\llbracket\Gamma\vdash\tau:\mathrm{Ty}\right\rrbracket(\gamma) , and by Theorem 5.4 \left\langle v_t,v_t\right\rangle\in\left\llbracket\Gamma\vdash\tau:\mathrm{Ty}\right\rrbracket(\iota_{\Gamma}(\gamma)) ; since t t t does not mention x x x , this is exactly { { Γ , x : τ ⊢ x ≡ τ t p r p } } ( ⟨ γ , v t ⟩ ) = t t \left\{\!\left\{\Gamma,x:\tau\vdash x\equiv_{\tau}t\ \mathrm{prp}\right\}\!\right\}(\left\langle\gamma,v_t\right\rangle)=\mathrm{tt} { { Γ , x : τ ⊢ x ≡ τ t prp } } ( ⟨ γ , v t ⟩ ) = tt . Hence the pair, whose first component is v t v_t v t , satisfies the refinement predicate, so
\begin{aligned}
\left\langle\llbracket t \rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t \rrbracket(\rho_{\Gamma}(\delta))\right\rangle
\in
\left\{
\left\langle v,w\right\rangle\in\left\llbracket\Gamma\vdash\tau:\mathrm{Ty}\right\rrbracket(\gamma)
\mathrel{\middle|}
\left\{\!\left\{\Gamma,x:\tau\vdash x\equiv_{\tau}t\ \mathrm{prp}\right\}\!\right\}(\left\langle\gamma,v\right\rangle)=\mathrm{tt}
\right\} \\
&=
\left\llbracket\Gamma\vdash\{x:\tau\mid x\equiv_{\tau}t\}:\mathrm{Ty}\right\rrbracket(\gamma)
\end{aligned}
⟨ ⟦ t ⟧ ( ρ Γ ( γ ) ) , ⟦ t ⟧ ( ρ Γ ( δ ) ) ⟩ \left\langle\llbracket t \rrbracket(\rho_{\Gamma}(\gamma)),\llbracket t \rrbracket(\rho_{\Gamma}(\delta))\right\rangle ⟨ [ [ t ] ] ( ρ Γ ( γ )) , [ [ t ] ] ( ρ Γ ( δ )) ⟩
By I. H.
\in\left\llbracket\Gamma\vdash\tau:\mathrm{Ty}\right\rrbracket(\gamma)
By Theorem 6.2 (i)
\subseteq\left\llbracket\Gamma\vdash\sigma:\mathrm{Ty}\right\rrbracket(\gamma)
⟦ C ( i ) D ⟧ ( ρ Γ ( γ ) ) = i ↦ ( v ‾ j ↦ ⟨ C i , v ‾ j ⟩ ) , \llbracket C(i)_{D}\rrbracket(\rho_{\Gamma}(\gamma))=i\mapsto\left(\overline{v}^{\,j}\mapsto\left\langle C_{i},\overline{v}^{\,j}\right\rangle\right), [ [ C ( i ) D ] ] ( ρ Γ ( γ )) = i ↦ ( v j ↦ ⟨ C i , v j ⟩ ) ,
so the two components of the required pair coincide. Since the type is a function type, it suffices to fix related arguments
\left\langle v_j,w_j\right\rangle\in
\left\llbracket\Gamma,x:\tau^{j-1}\sigma[D/K]^{j-1}\vdash\sigma_j[D/K]:\mathrm{Ty}\right\rrbracket
\left(\left\langle\gamma,\overline{v}^{\,j-1}\right\rangle\right)
and show that the application lands in the codomain,
\left\langle\left\langle C_i,\overline{v}^{\,j}\right\rangle,\left\langle C_i,\overline{w}^{\,j}\right\rangle\right\rangle
\in
\left\llbracket\Gamma,x:\tau^{j}\sigma[D/K]^{j}\vdash D\cdot t^{k}:\mathrm{Ty}\right\rrbracket
\left(\left\langle\gamma,\overline{v}^{\,j}\right\rangle\right).
The interpretation of the function type also imposes the analogous condition on unrefined-related arguments; this is precisely Theorem 5.6 (ii) applied to C ( i ) D C(i)_{D} C ( i ) D , so we are left with the refined condition above. Let F F F be the operator defining the refined interpretation of D D D . As that interpretation is a fixed point of F F F , the codomain above equals
F\left(\left\llbracket\Gamma\vdash D:\overline{\tau}^{\,k}\to\mathrm{Ty}\right\rrbracket(\gamma)\right)\cdot
\llbracket t\rrbracket\left(\left\langle\rho_{\Gamma}(\gamma),\overline{v}^{\,j}\right\rangle\right)^{k},
whose i i i -th disjunct is
\left\{\left\langle\left\langle C_i,\bar{\sigma}^i\right\rangle,\left\langle C_i,\bar{w}^i\right\rangle\right\rangle\middle|\left\langle v_j,w_j\right\rangle\in\left\llbracket\Gamma,K:\kappa^k\to\mathsf{Ty},x:\bar{\sigma}^{j-1}\vdash\sigma_j:\mathsf{Ty}\right\rrbracket\left(\left\langle\left\langle\left\llbracket\Gamma\vdash D:\tau^k\to\mathsf{Ty}\right\rrbracket(\gamma),\left\lfloor\left\lfloor\Gamma\vdash D:\tau^k\to\mathsf{Ty}\right\rfloor\right\rfloor(\iota_\Gamma(\gamma))\right\rangle,v^{j-1}\right\rangle\right),\right.
⟨ q k , ( ( t k ) ) ( ⟨ ρ Γ ( γ ) , v j ⟩ ) ⟩ ∈ ⌊ ⌊ Γ , x : τ k − 1 ⊢ τ k : T y ⌋ ⌋ ( ι Γ ( γ ) ) } (1) \left.\left\langle q_k,\left((t_k)\right)\left(\left\langle\rho_\Gamma(\gamma),v^j\right\rangle\right)\right\rangle\in\left\lfloor\left\lfloor\Gamma,x:\tau^{k-1}\vdash\tau_k:\mathsf{Ty}\right\rfloor\right\rfloor(\iota_\Gamma(\gamma))\right\} \tag*{(1)} ⟨ q k , ( ( t k ) ) ( ⟨ ρ Γ ( γ ) , v j ⟩ ) ⟩ ∈ ⌊ ⌊ Γ , x : τ k − 1 ⊢ τ k : Ty ⌋ ⌋ ( ι Γ ( γ )) } (1)
The required pair lies in this disjunct. Condition (ii) holds: its two sides coincide, and the common index denotation lies in the interpretation of the corresponding index type, so partial reflexivity relates it to itself. For condition (i), each argument pair satisfies, by assumption,
⟨ v j , w j ⟩ \left\langle v_j,w_j\right\rangle ⟨ v j , w j ⟩
by assumption
\in\left\llbracket\Gamma,x:\bar{\tau}\left[D/K\right]^{j-1}\vdash\sigma_j\left[D/K\right]:\mathsf{Ty}\right\rrbracket\left(\left\langle\gamma,v^{j-1}\right\rangle\right)
By Lemma C.7
=\left\llbracket\Gamma,K:\kappa^k\to\mathsf{Ty},x:\bar{\sigma}^{j-1}\vdash\sigma_j:\mathsf{Ty}\right\rrbracket\left(\left\langle\left\langle\gamma,\left\langle\left\llbracket\Gamma\vdash D:\tau^k\to\mathsf{Ty}\right\rrbracket(\gamma),\left\lfloor\left\lfloor\Gamma\vdash D:\tau^k\to\mathsf{Ty}\right\rfloor\right\rfloor(\iota_\Gamma(\gamma))\right\rangle\right\rangle,v^{j-1}\right\rangle\right)
which is condition (i). Hence both conditions hold, the pair lies in the disjunct, and therefore in the codomain.
D ≜ μ K ⟨ ν ⟩ { C : ( y ˉ : σ ˉ j ) → K ⋅ t ˉ − i k } D\mathrel{\triangleq}\mu K\left\langle\nu\right\rangle\left\{C:\left(\bar{y}:\bar{\sigma}^{j}\right)\to K\cdot\bar{t}^{\,k}_{-i}\right\} D ≜ μ K ⟨ ν ⟩ { C : ( y ˉ : σ ˉ j ) → K ⋅ t ˉ − i k }
e ( v , r ) ≜ { ( ( c i ) ) ( ρ Γ ( γ ) ) ⋅ q ˉ j ⋅ tmEl K ; r ( σ , ⟨ ρ Γ ( γ ) , q ˉ j − 1 ⟩ , q j ) if v = ⟨ C i , q ˉ j ⟩ ⊥ otherwise e(v,r)\mathrel{\triangleq}
\begin{cases}
\left((c_i)\right)(\rho_\Gamma(\gamma))\cdot\bar{q}^{\,j}\cdot\operatorname{tmEl}_{K;r}\left(\sigma,\left\langle\rho_\Gamma(\gamma),\bar{q}^{\,j-1}\right\rangle,q_j\right) & \text{if }v=\left\langle C_i,\bar{q}^{\,j}\right\rangle\\
\perp& \text{otherwise}
\end{cases} e ( v , r ) ≜ { ( ( c i ) ) ( ρ Γ ( γ )) ⋅ q ˉ j ⋅ tmEl K ; r ( σ , ⟨ ρ Γ ( γ ) , q ˉ j − 1 ⟩ , q j ) ⊥ if v = ⟨ C i , q ˉ j ⟩ otherwise
⟨ ⟨ ( elim D ( c i ) ) ( ρ Γ ( γ ) ) , ( elim D ( c i ) ) ( ρ Γ ( δ ) ) ⟩ ⟩ = ⟨ ⟨ lfp r ( ν ˉ k , w ↦ e ( w , r ) ) , lfp r ′ ( ν ˉ k , w ↦ e ( w , r ′ ) ) ⟩ ⟩ \begin{aligned}
\left\langle\left\langle\left(\operatorname{elim}_D(c_i)\right)(\rho_\Gamma(\gamma)),\left(\operatorname{elim}_D(c_i)\right)(\rho_\Gamma(\delta))\right\rangle\right\rangle\\
&=\left\langle\left\langle\operatorname{lfp}_{r}\left(\bar{\nu}^{\,k},w\mapsto e(w,r)\right),\operatorname{lfp}_{r'}\left(\bar{\nu}^{\,k},w\mapsto e(w,r')\right)\right\rangle\right\rangle
\end{aligned} ⟨ ⟨ ( elim D ( c i ) ) ( ρ Γ ( γ )) , ( elim D ( c i ) ) ( ρ Γ ( δ )) ⟩ ⟩ = ⟨ ⟨ lfp r ( ν ˉ k , w ↦ e ( w , r ) ) , lfp r ′ ( ν ˉ k , w ↦ e ( w , r ′ ) ) ⟩ ⟩
≜ ⟨ r , r ′ ⟩ \triangleq\left\langle r,r'\right\rangle ≜ ⟨ r , r ′ ⟩
This pair exists and is an element of D \mathcal{D} D as it is the least fixed point of continuous operators in D \mathcal{D} D . We name the two components r r r and r ′ r' r ′ .
What we need to show is that this pair lies in
\left\llbracket\Gamma\vdash\left(x:\bar{\tau}^{\,k}\right)\to\left(y:D\cdot\bar{x}^{\,k}\right)\to\rho:\mathsf{Ty}\right\rrbracket(\gamma)
We distinguish two cases based on whether the type is stratified or positive: – Positive case:
We define the collection of all those elements of the domain for which the property holds.
P\mathrel{\triangleq}\bar{q}^{\,k}\mapsto\left\{\left\langle v,w\right\rangle\middle|\left\langle v,w\right\rangle\in\left\llbracket\Gamma\vdash D:\bar{\sigma}^{\,k}\to\mathsf{Ty}\right\rrbracket(\gamma)\cdot\bar{q}^{\,k}\ \land\ \left\langle e(v,r),e(w,r')\right\rangle\in\left\llbracket\Gamma,x:\bar{\tau}^{\,k},z:D\cdot\bar{x}^{\,k}\vdash\rho:\mathsf{Ty}\right\rrbracket\left(\left\langle\left\langle\gamma,\bar{q}^{\,k}\right\rangle,v\right\rangle\right)\right\}
The goal is to show that P=\left\llbracket\Gamma\vdash D:\bar{\sigma}^{\,k}\to\mathsf{Ty}\right\rrbracket(\gamma) .
By definition we already have P\leq\left\llbracket\Gamma\vdash D:\bar{\sigma}^{\,k}\to\mathsf{Ty}\right\rrbracket(\gamma) , we need to show the other inclusion; since \left\llbracket\Gamma\vdash D:\bar{\sigma}^{\,k}\to\mathsf{Ty}\right\rrbracket(\gamma) is defined as the least fixed point of F \mathcal{F} F , it is enough to show that P ≥ F ( P ) P\geq\mathcal{F}(P) P ≥ F ( P ) , i.e. that P P P is a pre-fixed point of F \mathcal{F} F .
\begin{aligned}
\mathcal{F}(P) \\
&=\bar{q}^{\,k}\mapsto\bigcup\left\{\left\langle\left\langle C_i,\bar{\sigma}^{\,j}\right\rangle,\left\langle C_i,\bar{w}^{\,j}\right\rangle\right\rangle\middle|\left\langle v_j,w_j\right\rangle\in\left\llbracket\Gamma,K:\kappa^k\to\mathsf{Ty},x:\bar{\sigma}^{j-1}\vdash\sigma_j:\mathsf{Ty}\right\rrbracket\left(\left\langle\left\langle P,\left\llbracket\mu K\left\langle\nu\right\rangle\left\{C:\left(\bar{y}:\bar{\sigma}^{\,j}\right)\to K\cdot\bar{t}^{\,k}\right\}\right\rrbracket(\iota_\Gamma(\gamma))\right\rangle,\bar{q}^{\,j-1}\right\rangle\right),\left\langle q_k,\left((t_k)\right)\left(\left\langle\rho_\Gamma(\gamma),\bar{v}^{\,j}\right\rangle\right)\right\rangle\in\left\lfloor\left\lfloor\Gamma,x:\bar{\tau}^{\,k-1}\vdash\tau_k:\mathsf{Ty}\right\rfloor\right\rfloor(\iota_\Gamma(\gamma))\right\}
\end{aligned}
Before continuing, note that by Definition 19 the order on type operators compares them pointwise, but only at indices in the refined domain dom ( ⟦ Γ , x : τ ‾ k − 1 ⊢ τ k : T y ⟧ ( ⟨ γ , q ‾ k − 1 ⟩ ) ) \operatorname{dom}(\llbracket\Gamma, x:\overline{\tau}^{k-1} \vdash\tau_k:\mathrm{Ty}\rrbracket(\langle\gamma,\overline{q}^{k-1}\rangle)) dom ( [ [ Γ , x : τ k − 1 ⊢ τ k : Ty ] ] (⟨ γ , q k − 1 ⟩)) . Fixed arbitrary q k ∈ ⟦ Γ , x : τ ‾ k − 1 ⊢ τ k : T y ⟧ ( ⟨ γ , q ‾ k − 1 ⟩ ) q_k \in\llbracket\Gamma, x:\overline{\tau}^{k-1} \vdash\tau_k:\mathrm{Ty}\rrbracket(\langle\gamma,\overline{q}^{k-1}\rangle) q k ∈ [ [ Γ , x : τ k − 1 ⊢ τ k : Ty ] ] (⟨ γ , q k − 1 ⟩) , we need to show that if ⟨ ⟨ C i , v ‾ j ⟩ , ⟨ C i , w ‾ j ⟩ ⟩ ∈ F ( P ) ⋅ q ‾ k \langle\langle C_i,\overline{v}^{j}\rangle,\langle C_i,\overline{w}^{j}\rangle\rangle\in\mathcal{F}(P)\cdot\overline{q}^{k} ⟨⟨ C i , v j ⟩ , ⟨ C i , w j ⟩⟩ ∈ F ( P ) ⋅ q k , then ⟨ ⟨ C i , v ‾ j ⟩ , ⟨ C i , w ‾ j ⟩ ⟩ ∈ P ⋅ q ‾ k \langle\langle C_i,\overline{v}^{j}\rangle,\langle C_i,\overline{w}^{j}\rangle\rangle\in P\cdot\overline{q}^{k} ⟨⟨ C i , v j ⟩ , ⟨ C i , w j ⟩⟩ ∈ P ⋅ q k .
To do this it is enough to show that
⟨ e ( ⟨ C i , v ‾ j ⟩ , r ) , e ( ⟨ C i , w ‾ j ⟩ , r ′ ) ⟩ = ⟨ ( c i ) ( ρ Γ ( γ ) ) ⋅ q ‾ j ⋅ tmEl K ; r ( σ , ⟨ ρ Γ ( γ ) , q ‾ j − 1 ⟩ , q j ) , ( c i ) ( ρ Γ ( δ ) ) ⋅ q ‾ j ⋅ tmEl K ; r ′ ( σ , ⟨ ρ Γ ( δ ) , q ‾ j − 1 ⟩ , q j ) ⟩ \begin{aligned}
\left\langle e(\langle C_i,\overline{v}^{j}\rangle,r),e(\langle C_i,\overline{w}^{j}\rangle,r')\right\rangle\\
&=
\left\langle
\begin{array}{l}
(c_i)(\rho_{\Gamma}(\gamma))\cdot\overline{q}^{j}\cdot\operatorname{tmEl}_{K;r}\left(\sigma,\langle\rho_{\Gamma}(\gamma),\overline{q}^{j-1}\rangle,q_j\right),\\
(c_i)(\rho_{\Gamma}(\delta))\cdot\overline{q}^{j}\cdot\operatorname{tmEl}_{K;r'}\left(\sigma,\langle\rho_{\Gamma}(\delta),\overline{q}^{j-1}\rangle,q_j\right)
\end{array}
\right\rangle
\end{aligned} ⟨ e (⟨ C i , v j ⟩ , r ) , e (⟨ C i , w j ⟩ , r ′ ) ⟩ = ⟨ ( c i ) ( ρ Γ ( γ )) ⋅ q j ⋅ tmEl K ; r ( σ , ⟨ ρ Γ ( γ ) , q j − 1 ⟩ , q j ) , ( c i ) ( ρ Γ ( δ )) ⋅ q j ⋅ tmEl K ; r ′ ( σ , ⟨ ρ Γ ( δ ) , q j − 1 ⟩ , q j ) ⟩
∈ ⟦ Γ , x : τ ‾ k , z : τ D k ⊢ ρ : T y ⟧ ( ⟨ ⟨ γ , q ‾ k ⟩ , ⟨ C i , v ‾ j ⟩ ⟩ ) . \in\llbracket\Gamma,x:\overline{\tau}^{k},z:\tau_D^{k}\vdash\rho:\mathrm{Ty}\rrbracket\left(\langle\langle\gamma,\overline{q}^{k}\rangle,\langle C_i,\overline{v}^{j}\rangle\rangle\right). ∈ [ [ Γ , x : τ k , z : τ D k ⊢ ρ : Ty ] ] ( ⟨⟨ γ , q k ⟩ , ⟨ C i , v j ⟩⟩ ) .
We apply Lemma 7.3 to each mention of tmEl with the approximant P P P , which is below ⟦ Γ ⊢ D : ( x : τ ‾ k ) → T y ⟧ ( γ ) \llbracket\Gamma\vdash D:(x:\overline{\tau}^{k})\to\mathrm{Ty}\rrbracket(\gamma) [ [ Γ ⊢ D : ( x : τ k ) → Ty ] ] ( γ ) , by F \mathcal{F} F being monotonic it follows that F ( P ) ≤ F ( ⟦ Γ ⊢ D : ( x : τ ‾ k ) → T y ⟧ ( γ ) ) \mathcal{F}(P)\leq\mathcal{F}(\llbracket\Gamma\vdash D:(x:\overline{\tau}^{k})\to\mathrm{Ty}\rrbracket(\gamma)) F ( P ) ≤ F ( [ [ Γ ⊢ D : ( x : τ k ) → Ty ] ] ( γ )) , thus by I. H. on c i c_i c i we have that the pair is in the interpretation of the type, as required.
Since P P P is therefore a pre-fixed point of F \mathcal{F} F , the least fixed point ⟦ Γ ⊢ D : ( x : τ ‾ k ) → T y ⟧ ( γ ) \llbracket\Gamma\vdash D:(x:\overline{\tau}^{k})\to\mathrm{Ty}\rrbracket(\gamma) [ [ Γ ⊢ D : ( x : τ k ) → Ty ] ] ( γ ) is below P P P , giving the equality.
– Stratified case: We prove it by induction on the metric. We define the n n n -th approximation of the type as:
P ( n ) ≜ q ‾ k ↦ { ⟦ Γ ⊢ D : σ ‾ k → T y ⟧ ( γ ) ⋅ q ‾ k if n > r N ( ( ( m ) ) ( ρ Γ ( γ ) ) ⋅ q ‾ k ) ∅ otherwise P(n)\triangleq\overline{q}^{k}\mapsto
\begin{cases}
\llbracket\Gamma\vdash D:\overline{\sigma}^{k}\to\mathrm{Ty}\rrbracket(\gamma)\cdot\overline{q}^{k} & \text{if } n>r_{\mathbb{N}}(((m))(\rho_{\Gamma}(\gamma))\cdot\overline{q}^{k})\\
\varnothing& \text{otherwise}
\end{cases} P ( n ) ≜ q k ↦ { [ [ Γ ⊢ D : σ k → Ty ] ] ( γ ) ⋅ q k ∅ if n > r N ((( m )) ( ρ Γ ( γ )) ⋅ q k ) otherwise
Clearly ∀ n ∈ N . P ( n ) ≤ ⟦ Γ ⊢ D : σ ‾ k → T y ⟧ ( γ ) \forall n\in\mathbb{N}.\ P(n)\leq\llbracket\Gamma\vdash D:\overline{\sigma}^{k}\to\mathrm{Ty}\rrbracket(\gamma) ∀ n ∈ N . P ( n ) ≤ [ [ Γ ⊢ D : σ k → Ty ] ] ( γ ) . As in the positive case, by Definition 19 it suffices to range over refined-domain indices, where the motive interpretation is defined. We show that ∀ n ∈ N \forall n\in\mathbb{N} ∀ n ∈ N
∀ q k ∈ ⟦ Γ , x : τ ‾ k − 1 ⊢ τ k : T y ⟧ ( ⟨ γ , q ‾ k − 1 ⟩ ) \forall q_k\in\llbracket\Gamma,x:\overline{\tau}^{k-1}\vdash\tau_k:\mathrm{Ty}\rrbracket(\langle\gamma,\overline{q}^{k-1}\rangle) ∀ q k ∈ [ [ Γ , x : τ k − 1 ⊢ τ k : Ty ] ] (⟨ γ , q k − 1 ⟩)
∀ ⟨ v , w ⟩ ∈ P ( n ) ⋅ q ‾ k . \forall\langle v,w\rangle\in P(n)\cdot\overline{q}^{k}. ∀ ⟨ v , w ⟩ ∈ P ( n ) ⋅ q k .
⟨ e ( v , r ) , e ( w , r ′ ) ⟩ ∈ ⟦ Γ , x : τ ‾ k , z : τ D k ⊢ ρ : T y ⟧ ( ⟨ ⟨ γ , q ‾ k ⟩ , v ⟩ ) \langle e(v,r),e(w,r')\rangle\in\llbracket\Gamma,x:\overline{\tau}^{k},z:\tau_D^{k}\vdash\rho:\mathrm{Ty}\rrbracket(\langle\langle\gamma,\overline{q}^{k}\rangle,v\rangle) ⟨ e ( v , r ) , e ( w , r ′ )⟩ ∈ [ [ Γ , x : τ k , z : τ D k ⊢ ρ : Ty ] ] (⟨⟨ γ , q k ⟩ , v ⟩)
By induction over n n n :
n = 0 n=0 n = 0 is trivial, since P ( 0 ) P(0) P ( 0 ) is empty.
n = m + 1 n=m+1 n = m + 1 : Let ⟨ v , w ⟩ = ⟨ ⟨ C i , v ‾ j ⟩ , ⟨ C i , w ‾ j ⟩ ⟩ \langle v,w\rangle=\langle\langle C_i,\overline{v}^{j}\rangle,\langle C_i,\overline{w}^{j}\rangle\rangle ⟨ v , w ⟩ = ⟨⟨ C i , v j ⟩ , ⟨ C i , w j ⟩⟩ . We can show
⟨ e ( ⟨ C i , v ‾ j ⟩ , r ) , e ( ⟨ C i , w ‾ j ⟩ , r ′ ) ⟩ = ⟨ ( c i ) ( ρ Γ ( γ ) ) ⋅ q ‾ j ⋅ tmEl K ; r ( σ , ⟨ ρ Γ ( γ ) , q ‾ j − 1 ⟩ , q j ) , ( c i ) ( ρ Γ ( δ ) ) ⋅ q ‾ j ⋅ tmEl K ; r ′ ( σ , ⟨ ρ Γ ( δ ) , q ‾ j − 1 ⟩ , q j ) ⟩ \begin{aligned}
\left\langle e(\langle C_i,\overline{v}^{j}\rangle,r),e(\langle C_i,\overline{w}^{j}\rangle,r')\right\rangle\\
&=
\left\langle
\begin{array}{l}
(c_i)(\rho_{\Gamma}(\gamma))\cdot\overline{q}^{j}\cdot\operatorname{tmEl}_{K;r}\left(\sigma,\langle\rho_{\Gamma}(\gamma),\overline{q}^{j-1}\rangle,q_j\right),\\
(c_i)(\rho_{\Gamma}(\delta))\cdot\overline{q}^{j}\cdot\operatorname{tmEl}_{K;r'}\left(\sigma,\langle\rho_{\Gamma}(\delta),\overline{q}^{j-1}\rangle,q_j\right)
\end{array}
\right\rangle
\end{aligned} ⟨ e (⟨ C i , v j ⟩ , r ) , e (⟨ C i , w j ⟩ , r ′ ) ⟩ = ⟨ ( c i ) ( ρ Γ ( γ )) ⋅ q j ⋅ tmEl K ; r ( σ , ⟨ ρ Γ ( γ ) , q j − 1 ⟩ , q j ) , ( c i ) ( ρ Γ ( δ )) ⋅ q j ⋅ tmEl K ; r ′ ( σ , ⟨ ρ Γ ( δ ) , q j − 1 ⟩ , q j ) ⟩
∈ ⟦ Γ , x : τ ‾ k , z : τ D k ⊢ ρ : T y ⟧ ( ⟨ ⟨ γ , q ‾ k ⟩ , ⟨ C i , v ‾ j ⟩ ⟩ ) . \in\llbracket\Gamma,x:\overline{\tau}^{k},z:\tau_D^{k}\vdash\rho:\mathrm{Ty}\rrbracket\left(\langle\langle\gamma,\overline{q}^{k}\rangle,\langle C_i,\overline{v}^{j}\rangle\rangle\right). ∈ [ [ Γ , x : τ k , z : τ D k ⊢ ρ : Ty ] ] ( ⟨⟨ γ , q k ⟩ , ⟨ C i , v j ⟩⟩ ) .
We apply Lemma 7.3 to each mention of tmEl with the approximant P ( m ) P(m) P ( m ) , which is below ⟦ Γ ⊢ D : ( x : τ ‾ k ) → T y ⟧ ( γ ) \llbracket\Gamma\vdash D:(x:\overline{\tau}^{k})\to\mathrm{Ty}\rrbracket(\gamma) [ [ Γ ⊢ D : ( x : τ k ) → Ty ] ] ( γ ) and by the I. H. they satisfy the required property, thus by I. H. on c i c_i c i we have that the pair is in the interpretation of the type, as required.
Proof of Lemma 5.5. By induction on the structure of ⊢ Γ c t x \vdash\Gamma\ \mathrm{ctx} ⊢ Γ ctx .
⟨ ρ ⋅ ( ⋆ ) , ρ ⋅ ( ⋆ ) ⟩ = ⟨ ⋆ , ⋆ ⟩ ∈ ⟦ ⊢ ⋅ c t x ⟧ ( ι ⋅ ( ⋆ ) ) \langle\rho_{\cdot}(\star),\rho_{\cdot}(\star)\rangle
= \langle\star,\star\rangle
\in\llbracket\vdash\cdot\ \mathrm{ctx}\rrbracket(\iota_{\cdot}(\star)) ⟨ ρ ⋅ ( ⋆ ) , ρ ⋅ ( ⋆ )⟩ = ⟨ ⋆ , ⋆ ⟩ ∈ [ [ ⊢ ⋅ ctx ] ] ( ι ⋅ ( ⋆ ))
⟨ ρ Γ , x : T τ ( γ , v ) , ρ Γ , x : T τ ( δ , w ) ⟩ = ⟨ ρ Γ ( γ ) , v , ρ Γ ( δ ) , w ⟩ \langle\rho_{\Gamma,x:T\tau}(\gamma,v),\rho_{\Gamma,x:T\tau}(\delta,w)\rangle
= \langle\rho_{\Gamma}(\gamma),v,\rho_{\Gamma}(\delta),w\rangle ⟨ ρ Γ , x : T τ ( γ , v ) , ρ Γ , x : T τ ( δ , w )⟩ = ⟨ ρ Γ ( γ ) , v , ρ Γ ( δ ) , w ⟩
By I. H. and Theorem 5.4
∈ ⟦ ⊢ Γ c t x ⟧ ( ι Γ ( γ ) ) × ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) = ⟦ ⊢ Γ , x : T τ c t x ⟧ ( ι Γ , x : T τ ( γ , v ) ) \in\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket(\iota_{\Gamma}(\gamma)) \times\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma))
= \llbracket\vdash\Gamma,x:T\tau\ \mathrm{ctx}\rrbracket(\iota_{\Gamma,x:T\tau}(\gamma,v)) ∈ [ [ ⊢ Γ ctx ] ] ( ι Γ ( γ )) × [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) = [ [ ⊢ Γ , x : T τ ctx ] ] ( ι Γ , x : T τ ( γ , v ))
⟨ ρ Γ , x : K κ ( γ , P ) , ρ Γ , x : K κ ( δ , Q ) ⟩ = ⟨ ρ Γ ( γ ) , ρ Γ ( δ ) ⟩ \langle\rho_{\Gamma,x:K\kappa}(\gamma,P),\rho_{\Gamma,x:K\kappa}(\delta,Q)\rangle
= \langle\rho_{\Gamma}(\gamma),\rho_{\Gamma}(\delta)\rangle ⟨ ρ Γ , x : K κ ( γ , P ) , ρ Γ , x : K κ ( δ , Q )⟩ = ⟨ ρ Γ ( γ ) , ρ Γ ( δ )⟩
By I. H.
∈ ⟦ ⊢ Γ c t x ⟧ ( ι Γ ( γ ) ) = ⟦ ⊢ Γ , x : K κ c t x ⟧ ( ι Γ , x : K κ ( γ , P ) ) \in\llbracket\vdash\Gamma\ \mathrm{ctx}\rrbracket(\iota_{\Gamma}(\gamma))
= \llbracket\vdash\Gamma,x:K\kappa\ \mathrm{ctx}\rrbracket(\iota_{\Gamma,x:K\kappa}(\gamma,P)) ∈ [ [ ⊢ Γ ctx ] ] ( ι Γ ( γ )) = [ [ ⊢ Γ , x : K κ ctx ] ] ( ι Γ , x : K κ ( γ , P ))
Proof of Theorem 5.6 (ii). By induction on the structure of Γ ⊢ t : τ \Gamma\vdash t:\tau Γ ⊢ t : τ .
⟨ ( ( b ) ) ( δ ) , ( ( b ) ) ( ϵ ) ⟩ = ⟨ i B ( b ) , i B ( b ) ⟩ \langle((b))(\delta),((b))(\epsilon)\rangle
= \langle i_{\mathbb{B}}(b),i_{\mathbb{B}}(b)\rangle ⟨(( b )) ( δ ) , (( b )) ( ϵ )⟩ = ⟨ i B ( b ) , i B ( b )⟩
∈ { ⟨ i B ( b ) , i B ( b ) ⟩ ∣ b ∈ B } ∪ { ⟨ ⊥ , ⊥ ⟩ } = ⟦ Γ ⊢ B : T y ⟧ ( γ ) \in\{\langle i_{\mathbb{B}}(b),i_{\mathbb{B}}(b)\rangle\mid b\in\mathbb{B}\}\cup\{\langle\perp,\perp\rangle\}
= \llbracket\Gamma\vdash\mathbb{B}:\mathrm{Ty}\rrbracket(\gamma) ∈ {⟨ i B ( b ) , i B ( b )⟩ ∣ b ∈ B } ∪ {⟨ ⊥ , ⊥ ⟩} = [ [ Γ ⊢ B : Ty ] ] ( γ )
⟨ ( ( x ) ) ( δ ) , ( ( x ) ) ( ϵ ) ⟩ = ⟨ δ ( x ) , ϵ ( x ) ⟩ \langle((x))(\delta),((x))(\epsilon)\rangle
= \langle\delta(x),\epsilon(x)\rangle ⟨(( x )) ( δ ) , (( x )) ( ϵ )⟩ = ⟨ δ ( x ) , ϵ ( x )⟩
By assumption
∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ )
⟨ ( ( λ x . t ) ) ( δ ) , ( ( λ x . t ) ) ( ϵ ) ⟩ = ⟨ i → ( v ↦ ( ( t ) ) ( ⟨ δ , v ⟩ ) ) , i → ( v ↦ ( ( t ) ) ( ⟨ ϵ , v ⟩ ) ) ⟩ \langle((\lambda x.t))(\delta),((\lambda x.t))(\epsilon)\rangle
= \langle i_{\to}(v\mapsto((t))(\langle\delta,v\rangle)),i_{\to}(v\mapsto((t))(\langle\epsilon,v\rangle))\rangle ⟨(( λ x . t )) ( δ ) , (( λ x . t )) ( ϵ )⟩ = ⟨ i → ( v ↦ (( t )) (⟨ δ , v ⟩)) , i → ( v ↦ (( t )) (⟨ ϵ , v ⟩))⟩
We need to show
∈ ⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( γ ) = { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : T τ ⊢ σ : T y ⟧ ( γ ) } \in\llbracket\Gamma\vdash(x:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\gamma)
= \{\langle f,g\rangle\mid\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x:T\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\gamma)\} ∈ [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( γ ) = {⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : T τ ⊢ σ : Ty ] ] ( γ )}
Fix arbitrary ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle v,w\rangle\in\llbracket\Gamma\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . Hence
⟨ i → ( v ↦ ( ( t ) ) ( ⟨ δ , v ⟩ ) ) ⋅ v , i → ( v ↦ ( ( t ) ) ( ⟨ ϵ , v ⟩ ) ) ⋅ w ⟩ = ⟨ ( ( t ) ) ( ⟨ δ , v ⟩ ) , ( ( t ) ) ( ⟨ ϵ , w ⟩ ) ⟩ \begin{aligned}
\langle i\to(v\mapsto((t))(\langle\delta,v\rangle))\cdot v,\ i\to(v\mapsto((t))(\langle\epsilon,v\rangle))\cdot w\rangle
&= \langle((t))(\langle\delta,v\rangle),\ ((t))(\langle\epsilon,w\rangle)\rangle
\end{aligned} ⟨ i → ( v ↦ (( t )) (⟨ δ , v ⟩)) ⋅ v , i → ( v ↦ (( t )) (⟨ ϵ , v ⟩)) ⋅ w ⟩ = ⟨(( t )) (⟨ δ , v ⟩) , (( t )) (⟨ ϵ , w ⟩)⟩
By I. H.
∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) \in\llbracket\Gamma,x\mathbin{:}\tau\vdash\sigma\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ )
⟨ ( ( t ⋅ u ) ) ( δ ) , ( ( t ⋅ u ) ) ( ϵ ) ⟩ = ⟨ ( ( t ) ) ( δ ) ⋅ ( ( u ) ) ( δ ) , ( ( t ) ) ( ϵ ) ⋅ ( ( u ) ) ( ϵ ) ⟩ \begin{aligned}
\langle((t\cdot u))(\delta),\ ((t\cdot u))(\epsilon)\rangle
&= \langle((t))(\delta)\cdot((u))(\delta),\ ((t))(\epsilon)\cdot((u))(\epsilon)\rangle
\end{aligned} ⟨(( t ⋅ u )) ( δ ) , (( t ⋅ u )) ( ϵ )⟩ = ⟨(( t )) ( δ ) ⋅ (( u )) ( δ ) , (( t )) ( ϵ ) ⋅ (( u )) ( ϵ )⟩
We need to show
∈ ⟦ Γ ⊢ σ [ u / x ] : T y ⟧ ( γ ) \in\llbracket\Gamma\vdash\sigma[u/x]\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) ∈ [ [ Γ ⊢ σ [ u / x ] : Ty ] ] ( γ )
By the I. H. applied to u u u and t t t we have, respectively,
⟨ ( ( u ) ) ( δ ) , ( ( u ) ) ( ϵ ) ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \langle((u))(\delta),\ ((u))(\epsilon)\rangle\in\llbracket\Gamma\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) ⟨(( u )) ( δ ) , (( u )) ( ϵ )⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ )
and
⟨ ( ( t ) ) ( δ ) , ( ( t ) ) ( ϵ ) ⟩ ∈ ⟦ Γ ⊢ ( x : τ ) → σ : T y ⟧ ( γ ) = { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) } . \begin{aligned}
\langle((t))(\delta),\ ((t))(\epsilon)\rangle
&\in\llbracket\Gamma\vdash(x\mathbin{:}\tau)\to\sigma\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)\\
&= \{\langle f,g\rangle\mid\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket(\gamma).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x\mathbin{:}\tau\vdash\sigma\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)\}.
\end{aligned} ⟨(( t )) ( δ ) , (( t )) ( ϵ )⟩ ∈ [ [ Γ ⊢ ( x : τ ) → σ : Ty ] ] ( γ ) = {⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ )} .
Instantiating the universal quantifier with the argument pair gives
⟨ ( ( t ) ) ( δ ) ⋅ ( ( u ) ) ( δ ) , ( ( t ) ) ( ϵ ) ⋅ ( ( u ) ) ( ϵ ) ⟩ ∈ ⟦ Γ , x : τ ⊢ σ : T y ⟧ ( γ ) \begin{aligned}
\langle((t))(\delta)\cdot((u))(\delta),\ ((t))(\epsilon)\cdot((u))(\epsilon)\rangle
&\in\llbracket\Gamma,x\mathbin{:}\tau\vdash\sigma\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)
\end{aligned} ⟨(( t )) ( δ ) ⋅ (( u )) ( δ ) , (( t )) ( ϵ ) ⋅ (( u )) ( ϵ )⟩ ∈ [ [ Γ , x : τ ⊢ σ : Ty ] ] ( γ )
By noticing that the unrefined semantics of types is independent of terms
= ⟦ Γ ⊢ σ [ u / x ] : T y ⟧ ( γ ) = \llbracket\Gamma\vdash\sigma[u/x]\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) = [ [ Γ ⊢ σ [ u / x ] : Ty ] ] ( γ )
⟨ ( ( Λ x . t ) ) ( δ ) , ( ( Λ x . t ) ) ( ϵ ) ⟩ = ⟨ ( ( t ) ) ( δ ) , ( ( t ) ) ( ϵ ) ⟩ \begin{aligned}
\langle((\Lambda x.t))(\delta),\ ((\Lambda x.t))(\epsilon)\rangle
&= \langle((t))(\delta),\ ((t))(\epsilon)\rangle
\end{aligned} ⟨(( Λ x . t )) ( δ ) , (( Λ x . t )) ( ϵ )⟩ = ⟨(( t )) ( δ ) , (( t )) ( ϵ )⟩
We need to show
∈ ⟦ Γ ⊢ ∀ x : κ . τ : T y ⟧ ( γ ) \in\llbracket\Gamma\vdash\forall x\mathbin{:}\kappa.\ \tau\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) ∈ [ [ Γ ⊢ ∀ x : κ . τ : Ty ] ] ( γ )
= { ⟨ v , w ⟩ ∣ ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) . ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , P ⟩ ) } \begin{aligned}
&= \{\langle v,w\rangle\mid\forall P\in\llbracket\Gamma\vdash\kappa\mathbin{:}\mathrm{Kd}\rrbracket(\gamma).\ \langle v,w\rangle\in\llbracket\Gamma,x\mathbin{:}\kappa\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket(\langle\gamma,P\rangle)\}
\end{aligned} = {⟨ v , w ⟩ ∣ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) . ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , P ⟩)}
For arbitrary fixed P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) P\in\llbracket\Gamma\vdash\kappa\mathbin{:}\mathrm{Kd}\rrbracket(\gamma) P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) .
⟨ ( ( t ) ) ( δ ) , ( ( t ) ) ( ϵ ) ⟩ \langle((t))(\delta),\ ((t))(\epsilon)\rangle ⟨(( t )) ( δ ) , (( t )) ( ϵ )⟩
By I. H.
∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , P ⟩ ) \in\llbracket\Gamma,x\mathbin{:}\kappa\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket(\langle\gamma,P\rangle) ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , P ⟩)
⟨ ( ( t τ ) ) ( δ ) , ( ( t τ ) ) ( ϵ ) ⟩ = ⟨ ( ( t ) ) ( δ ) , ( ( t ) ) ( ϵ ) ⟩ \begin{aligned}
\langle((t\ \tau))(\delta),\ ((t\ \tau))(\epsilon)\rangle
&= \langle((t))(\delta),\ ((t))(\epsilon)\rangle
\end{aligned} ⟨(( t τ )) ( δ ) , (( t τ )) ( ϵ )⟩ = ⟨(( t )) ( δ ) , (( t )) ( ϵ )⟩
We need to show
∈ ⟦ Γ ⊢ σ [ τ / x ] : T y ⟧ ( γ ) \in\llbracket\Gamma\vdash\sigma[\tau/x]\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) ∈ [ [ Γ ⊢ σ [ τ / x ] : Ty ] ] ( γ )
By the I. H. we have
⟨ ( ( t ) ) ( δ ) , ( ( t ) ) ( ϵ ) ⟩ ∈ ⟦ Γ ⊢ ∀ x : κ . σ : T y ⟧ ( γ ) = { ⟨ v , w ⟩ ∣ ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) . ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ σ : T y ⟧ ( ⟨ γ , P ⟩ ) . } \begin{aligned}
\langle((t))(\delta), ((t))(\epsilon) \rangle
\in\llbracket\Gamma\vdash\forall x:\kappa.\ \sigma:\mathrm{Ty} \rrbracket(\gamma) \\
&= \{ \langle v,w\rangle\mid\forall P \in\llbracket\Gamma\vdash\kappa:\mathrm{Kd} \rrbracket(\gamma).\ \langle v,w\rangle\in\llbracket\Gamma,x:\kappa\vdash\sigma:\mathrm{Ty}\rrbracket(\langle\gamma,P\rangle). \}
\end{aligned} ⟨(( t )) ( δ ) , (( t )) ( ϵ )⟩ ∈ [ [ Γ ⊢ ∀ x : κ . σ : Ty ] ] ( γ ) = {⟨ v , w ⟩ ∣ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) . ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ σ : Ty ] ] (⟨ γ , P ⟩) . }
By Theorem 5.2 (ii), the unrefined interpretation of the type argument is a valid index. Instantiating the universal quantifier at ⟦ Γ ⊢ τ : κ ⟧ ( γ ) \llbracket\Gamma\vdash\tau:\kappa\rrbracket(\gamma) [ [ Γ ⊢ τ : κ ] ] ( γ ) gives
⟨ ( ( t ) ) ( δ ) , ( ( t ) ) ( ϵ ) ⟩ \langle((t))(\delta), ((t))(\epsilon) \rangle ⟨(( t )) ( δ ) , (( t )) ( ϵ )⟩
∈ ⟦ Γ , x : κ ⊢ σ : T y ⟧ ( ⟨ γ , ⟦ Γ ⊢ τ : κ ⟧ ( γ ) ⟩ ) \in\llbracket\Gamma,x:\kappa\vdash\sigma:\mathrm{Ty}\rrbracket(\langle\gamma,\llbracket\Gamma\vdash\tau:\kappa\rrbracket(\gamma)\rangle) ∈ [ [ Γ , x : κ ⊢ σ : Ty ] ] (⟨ γ , [ [ Γ ⊢ τ : κ ] ] ( γ )⟩)
By Lemma C.8
= ⟦ Γ ⊢ σ [ τ / x ] : T y ⟧ ( γ ) = \llbracket\Gamma\vdash\sigma[\tau/x]:\mathrm{Ty}\rrbracket(\gamma) = [ [ Γ ⊢ σ [ τ / x ] : Ty ] ] ( γ )
⟨ ( ( t ) ) ( δ ) , ( ( t ) ) ( ϵ ) ⟩ \langle((t))(\delta), ((t))(\epsilon) \rangle ⟨(( t )) ( δ ) , (( t )) ( ϵ )⟩
By the I. H.
∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) = ⟦ Γ ⊢ { x : τ ∣ x ≡ τ t } : T y ⟧ ( γ ) \begin{aligned}
\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) \\
&= \llbracket\Gamma\vdash\{x:\tau\mid x\equiv_{\tau}t\}:\mathrm{Ty}\rrbracket(\gamma)
\end{aligned} ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) = [ [ Γ ⊢ { x : τ ∣ x ≡ τ t } : Ty ] ] ( γ )
⟨ ( ( t ) ) ( δ ) , ( ( t ) ) ( ϵ ) ⟩ \langle((t))(\delta), ((t))(\epsilon) \rangle ⟨(( t )) ( δ ) , (( t )) ( ϵ )⟩
By the I. H.
∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ )
By Theorem 6.2 (ii)
= ⟦ Γ ⊢ σ : T y ⟧ ( γ ) = \llbracket\Gamma\vdash\sigma:\mathrm{Ty}\rrbracket(\gamma) = [ [ Γ ⊢ σ : Ty ] ] ( γ )
( ( C ( i ) D ) ) ( δ ) = i ↦ ( v j ‾ ↦ ⟨ C i , v j ‾ ⟩ ) , ((C(i)_{D}))(\delta)=i\mapsto\left(\overline{v^{j}}\mapsto\langle C_{i},\overline{v^{j}}\rangle\right), (( C ( i ) D )) ( δ ) = i ↦ ( v j ↦ ⟨ C i , v j ⟩ ) ,
so the two components of the required pair coincide. Since the type is a function type, it suffices to fix related arguments
⟨ v j , w j ⟩ ∈ ⟦ Γ , x : τ σ [ D / K ] j − 1 ⊢ σ j [ D / K ] : T y ⟧ ( γ ) \langle v_{j},w_{j}\rangle\in\llbracket\Gamma,x:\tau\ \sigma[D/K]^{j-1}\vdash\sigma_{j}[D/K]:\mathrm{Ty}\rrbracket(\gamma) ⟨ v j , w j ⟩ ∈ [ [ Γ , x : τ σ [ D / K ] j − 1 ⊢ σ j [ D / K ] : Ty ] ] ( γ )
and show that the application lands in the codomain,
⟨ ⟨ C i , v j ‾ ⟩ , ⟨ C i , w j ‾ ⟩ ⟩ ∈ ⟦ Γ , x : τ σ [ D / K ] j − 1 ⊢ D ⋅ t k ‾ : T y ⟧ ( γ ) . \langle\langle C_{i},\overline{v^{j}}\rangle,\langle C_{i},\overline{w^{j}}\rangle\rangle\in\llbracket\Gamma,x:\tau\ \sigma[D/K]^{j-1}\vdash D\cdot\overline{t^{k}}:\mathrm{Ty}\rrbracket(\gamma). ⟨⟨ C i , v j ⟩ , ⟨ C i , w j ⟩⟩ ∈ [ [ Γ , x : τ σ [ D / K ] j − 1 ⊢ D ⋅ t k : Ty ] ] ( γ ) .
Let F \mathcal{F} F be the operator defining the unrefined interpretation of D D D . As that interpretation is a fixed point of F \mathcal{F} F , the codomain above equals
F ( ⟦ Γ ⊢ D : τ k ‾ → T y ⟧ ( γ ) ) \mathcal{F}(\llbracket\Gamma\vdash D:\overline{\tau^{k}}\to\mathrm{Ty}\rrbracket(\gamma)) F ( [ [ Γ ⊢ D : τ k → Ty ] ] ( γ ))
whose i i i -th disjunct is
{ ⟨ ⟨ C i , v j ‾ ⟩ , ⟨ C i , w j ‾ ⟩ ⟩ ∣ ⟨ v j , w j ⟩ ∈ ⟦ Γ , K : τ k ‾ → T y , x : τ ‾ σ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , ⟦ Γ ⊢ D : τ k ‾ → T y ⟧ ( γ ) ⟩ ) } \{\langle\langle C_{i},\overline{v^{j}}\rangle,\langle C_{i},\overline{w^{j}}\rangle\rangle\mid\langle v_{j},w_{j}\rangle\in\llbracket\Gamma,K:\overline{\tau^{k}}\to\mathrm{Ty},x:\overline{\tau}^{\sigma^{j-1}}\vdash\sigma_{j}:\mathrm{Ty}\rrbracket(\langle\gamma,\llbracket\Gamma\vdash D:\overline{\tau^{k}}\to\mathrm{Ty}\rrbracket(\gamma)\rangle)\} {⟨⟨ C i , v j ⟩ , ⟨ C i , w j ⟩⟩ ∣ ⟨ v j , w j ⟩ ∈ [ [ Γ , K : τ k → Ty , x : τ σ j − 1 ⊢ σ j : Ty ] ] (⟨ γ , [ [ Γ ⊢ D : τ k → Ty ] ] ( γ )⟩)}
Each argument pair satisfies, by assumption,
⟨ v j , w j ⟩ \langle v_{j},w_{j}\rangle ⟨ v j , w j ⟩
by assumption ∈ ⟦ Γ , x : σ [ D / K ] j − 1 ⊢ σ j [ D / K ] : T y ⟧ ( γ ) \in\llbracket\Gamma, x:\sigma[D/K]^{j-1} \vdash\sigma_j[D/K]:\mathrm{Ty}\rrbracket(\gamma) ∈ [ [ Γ , x : σ [ D / K ] j − 1 ⊢ σ j [ D / K ] : Ty ] ] ( γ )
By Lemma C.8
= ⟦ Γ , K : τ k → T y , x : σ ‾ j − 1 ⊢ σ j : T y ⟧ ( ⟨ γ , ⟦ Γ ⊢ D : τ k → T y ⟧ ( γ ) ⟩ ) = \llbracket\Gamma, K:\tau^k \to\mathrm{Ty}, x:\overline{\sigma}^{j-1} \vdash\sigma_j:\mathrm{Ty}\rrbracket\left(\left\langle\gamma,\llbracket\Gamma\vdash D:\tau^k \to\mathrm{Ty}\rrbracket(\gamma)\right\rangle\right) = [ [ Γ , K : τ k → Ty , x : σ j − 1 ⊢ σ j : Ty ] ] ( ⟨ γ , [ [ Γ ⊢ D : τ k → Ty ] ] ( γ ) ⟩ )
Hence the pair lies in the disjunct, and therefore in the codomain.
D ≜ μ K ⟨ ν ⟩ C : ( y : σ j ) → K ⋅ t i k D \triangleq\mu K\langle\nu\rangle\qquad C:(y:\sigma^j)\to K\cdot t_i^k D ≜ μ K ⟨ ν ⟩ C : ( y : σ j ) → K ⋅ t i k
e ( v , r ) ≜ { ( ( c i ) ) ( δ ) ⋅ q ‾ j ⋅ tmEl K ; r ( σ , ⟨ δ , q ‾ j − 1 ⟩ , q j ) if v = ⟨ C i , q ‾ j ⟩ ⊥ otherwise e(v,r)\triangleq
\begin{cases}
\left((c_i)\right)(\delta)\cdot\overline{q}^{\,j}\cdot\operatorname{tmEl}_{K;r}\left(\sigma,\left\langle\delta,\overline{q}^{\,j-1}\right\rangle,q_j\right) & \text{if }v=\langle C_i,\overline{q}^{\,j}\rangle\\
\bot& \text{otherwise}
\end{cases} e ( v , r ) ≜ { ( ( c i ) ) ( δ ) ⋅ q j ⋅ tmEl K ; r ( σ , ⟨ δ , q j − 1 ⟩ , q j ) ⊥ if v = ⟨ C i , q j ⟩ otherwise
⟨ ( ( elim D ( c i ) ) ) ( δ ) , ( ( elim D ( c i ) ) ) ( ϵ ) ⟩ = ⟨ i ↦ ( lfp ν ‾ k , w ↦ e ( w , r ) ) , i ↦ ( lfp ν ‾ k , w ↦ e ( w , r ′ ) ) ⟩ \left\langle\left((\operatorname{elim}_{D}(c^i))\right)(\delta),\left((\operatorname{elim}_{D}(c^i))\right)(\epsilon)\right\rangle
=
\left\langle i\mapsto\left(\operatorname{lfp}_{\overline{\nu}^{\,k}},w\mapsto e(w,r)\right),i\mapsto\left(\operatorname{lfp}_{\overline{\nu}^{\,k}},w\mapsto e(w,r')\right)\right\rangle ⟨ ( ( elim D ( c i )) ) ( δ ) , ( ( elim D ( c i )) ) ( ϵ ) ⟩ = ⟨ i ↦ ( lfp ν k , w ↦ e ( w , r ) ) , i ↦ ( lfp ν k , w ↦ e ( w , r ′ ) ) ⟩
≜ ⟨ r , r ′ ⟩ \triangleq\langle r,r'\rangle ≜ ⟨ r , r ′ ⟩
This pair exists and is an element of D \mathcal{D} D as it is the least fixed point of continuous operators in D \mathcal{D} D . We name the two components r r r and r ′ r' r ′ . What we need to show is that this pair lies in
⟦ Γ ⊢ ( x : τ ‾ k ) → ( y : D ⋅ x ‾ k ) → ρ : T y ⟧ ( γ ) \llbracket\Gamma\vdash(x:\overline{\tau}^{\,k})\to(y:D\cdot\overline{x}^{\,k})\to\rho:\mathrm{Ty}\rrbracket(\gamma) [ [ Γ ⊢ ( x : τ k ) → ( y : D ⋅ x k ) → ρ : Ty ] ] ( γ )
By Lemma E.2, and the fact that all unrefined types are complete the least fixed point of the operator defining the eliminator semantics is contained in the unrefined interpretation of the type of the eliminator.
Proof of Corollary 2. Now suppose by contradiction that there exists a closed term t t t such that ⋅ ⊢ t : ∀ x : T y . x \cdot\vdash t:\forall x:\mathrm{Ty}.x ⋅ ⊢ t : ∀ x : Ty . x , then:
⟨ ( ( t ) ) ( ⋆ ) , ( ( t ) ) ( ⋆ ) ⟩ \left\langle((t))(\star),((t))(\star)\right\rangle ⟨ (( t )) ( ⋆ ) , (( t )) ( ⋆ ) ⟩
By Theorem 5.6 (i)
∈ ⟦ ⋅ ⊢ ∀ x : T y . x : T y ⟧ ( ⋆ ) = { ⟨ v , w ⟩ | ∀ P ∈ ⟦ ⋅ ⊢ T y : K d ⟧ ( ⋆ ) , ∀ P ⊥ ∈ ⟦ ⋅ ⊢ T y : K d ⟧ ( ⋆ ) π ⋅ , T y ( ⋆ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ ⟦ ⋅ , x : K T y ⊢ x : T y ⟧ ( ⟨ ⋆ , ⟨ P , P ⊥ ⟩ ⟩ ) } = { ⟨ v , w ⟩ | ∀ P ∈ P E R ( D ) , ∀ P ⊥ ∈ C U P E R ( D ) P ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ P } \begin{aligned}
\in\llbracket\cdot\vdash\forall x:\mathrm{Ty}.x:\mathrm{Ty}\rrbracket(\star) \\
&=
\left\{\langle v,w\rangle\ \middle|\ \begin{array}{l}
\forall P\in\llbracket\cdot\vdash\mathrm{Ty}:\mathrm{Kd}\rrbracket(\star),\ \forall P_{\perp}\in\llbracket\cdot\vdash\mathrm{Ty}:\mathrm{Kd}\rrbracket(\star)\\
\pi_{\cdot,\mathrm{Ty}}(\star,P)\subseteq P_{\perp}\Rightarrow\langle v,w\rangle\in\llbracket\cdot,x:\mathrm{KTy}\vdash x:\mathrm{Ty}\rrbracket(\langle\star,\langle P,P_{\perp}\rangle\rangle)
\end{array}\right\} \\
&=
\left\{\langle v,w\rangle\ \middle|\ \begin{array}{l}
\forall P\in\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D}),\ \forall P_{\perp}\in\mathcal{C}\mathcal{U}\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D})\\
P\subseteq P_{\perp}\Rightarrow\langle v,w\rangle\in P
\end{array}\right\}
\end{aligned} ∈ [ [ ⋅ ⊢ ∀ x : Ty . x : Ty ] ] ( ⋆ ) = { ⟨ v , w ⟩ ∀ P ∈ [ [ ⋅ ⊢ Ty : Kd ] ] ( ⋆ ) , ∀ P ⊥ ∈ [ [ ⋅ ⊢ Ty : Kd ] ] ( ⋆ ) π ⋅ , Ty ( ⋆ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ [ [ ⋅ , x : KTy ⊢ x : Ty ] ] (⟨ ⋆ , ⟨ P , P ⊥ ⟩⟩) } = { ⟨ v , w ⟩ ∀ P ∈ P E R ( D ) , ∀ P ⊥ ∈ C UP E R ( D ) P ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ P }
Instantiating at P = ∅ ∈ P E R ( D ) P=\varnothing\in\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D}) P = ∅ ∈ P E R ( D ) and P ⊥ = { ⟨ ⊥ , ⊥ ⟩ } ∈ C U P E R ( D ) P_{\perp}=\{\langle\bot,\bot\rangle\}\in\mathcal{C}\mathcal{U}\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D}) P ⊥ = {⟨ ⊥ , ⊥ ⟩} ∈ C UP E R ( D ) , for which ∅ ⊆ { ⟨ ⊥ , ⊥ ⟩ } \varnothing\subseteq\{\langle\bot,\bot\rangle\} ∅ ⊆ {⟨ ⊥ , ⊥ ⟩} , any ⟨ v , w ⟩ \langle v,w\rangle ⟨ v , w ⟩ in the set above would have to satisfy ⟨ v , w ⟩ ∈ ∅ \langle v,w\rangle\in\varnothing ⟨ v , w ⟩ ∈ ∅ , which is impossible. Hence ⟦ ⋅ ⊢ ∀ x : T y . x : T y ⟧ ( ⋆ ) = ∅ \llbracket\cdot\vdash\forall x:\mathrm{Ty}.x:\mathrm{Ty}\rrbracket(\star)=\varnothing [ [ ⋅ ⊢ ∀ x : Ty . x : Ty ] ] ( ⋆ ) = ∅ , contradicting ⟨ ( ( t ) ) ( ⋆ ) , ( ( t ) ) ( ⋆ ) ⟩ \langle((t))(\star),((t))(\star)\rangle ⟨(( t )) ( ⋆ ) , (( t )) ( ⋆ )⟩ being an element of it.
Proof of Theorem 6.1. We proceed by induction on the structure of Γ ⊢ ϕ p r p \Gamma\vdash\phi\ \mathrm{prp} Γ ⊢ ϕ prp .
{ { Γ ⊢ t ≡ τ u p r p } } ( γ ) = { t t if ⟨ ( ( t ) ) ( ρ Γ ( γ ) ) , ( ( u ) ) ( ρ Γ ( γ ) ) ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( γ ) ) f f otherwise \{\{\Gamma\vdash t\equiv_{\tau}u\ \mathrm{prp}\}\}(\gamma)
=
\begin{cases}
\mathrm{tt} & \text{if }\langle((t))(\rho_{\Gamma}(\gamma)),((u))(\rho_{\Gamma}(\gamma))\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\gamma))\\
\mathrm{ff} & \text{otherwise}
\end{cases} {{ Γ ⊢ t ≡ τ u prp }} ( γ ) = { tt ff if ⟨(( t )) ( ρ Γ ( γ )) , (( u )) ( ρ Γ ( γ ))⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( γ )) otherwise
By Theorem 5.6 (i) and Corollary 1
⟦ Γ ⊢ t ≡ τ u p r p ⟧ ( γ ) = { t t if ⟨ ( ⟨ t ⟩ ( ρ Γ ( δ ) ) ) , ( ⟨ u ⟩ ( ρ Γ ( δ ) ) ) ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( ι Γ ( δ ) ) f f otherwise = ⟦ Γ ⊢ t ≡ τ u p r p ⟧ ( δ ) \begin{aligned}
\llbracket\Gamma\vdash t \equiv_{\tau} u\ \mathrm{prp}\rrbracket(\gamma)
&=
\begin{cases}
\mathit{tt} & \text{if }\left\langle\left(\left\langle t\right\rangle(\rho_{\Gamma}(\delta))\right),\left(\left\langle u\right\rangle(\rho_{\Gamma}(\delta))\right)\right\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\iota_{\Gamma}(\delta))\\
\mathit{ff} & \text{otherwise}
\end{cases}\\
&=\llbracket\Gamma\vdash t \equiv_{\tau} u\ \mathrm{prp}\rrbracket(\delta)
\end{aligned} [ [ Γ ⊢ t ≡ τ u prp ] ] ( γ ) = { tt ff if ⟨ ( ⟨ t ⟩ ( ρ Γ ( δ )) ) , ( ⟨ u ⟩ ( ρ Γ ( δ )) ) ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( ι Γ ( δ )) otherwise = [ [ Γ ⊢ t ≡ τ u prp ] ] ( δ )
⟦ Γ ⊢ ϕ ∧ ψ p r p ⟧ ( γ ) = { ⟦ Γ ⊢ ψ p r p ⟧ ( γ ) if ⟦ Γ ⊢ ϕ p r p ⟧ ( γ ) = t t f f otherwise \llbracket\Gamma\vdash\phi\wedge\psi\ \mathrm{prp}\rrbracket(\gamma)
=
\begin{cases}
\llbracket\Gamma\vdash\psi\ \mathrm{prp}\rrbracket(\gamma) & \text{if }\llbracket\Gamma\vdash\phi\ \mathrm{prp}\rrbracket(\gamma)=\mathit{tt}\\
\mathit{ff} & \text{otherwise}
\end{cases} [ [ Γ ⊢ ϕ ∧ ψ prp ] ] ( γ ) = { [ [ Γ ⊢ ψ prp ] ] ( γ ) ff if [ [ Γ ⊢ ϕ prp ] ] ( γ ) = tt otherwise
By I. H.
⟦ Γ ⊢ ϕ ∧ ψ p r p ⟧ ( δ ) = { ⟦ Γ ⊢ ψ p r p ⟧ ( δ ) if ⟦ Γ ⊢ ϕ p r p ⟧ ( δ ) = t t f f otherwise = ⟦ Γ ⊢ ϕ ∧ ψ p r p ⟧ ( δ ) \begin{aligned}
\llbracket\Gamma\vdash\phi\wedge\psi\ \mathrm{prp}\rrbracket(\delta)
=
\begin{cases}
\llbracket\Gamma\vdash\psi\ \mathrm{prp}\rrbracket(\delta) & \text{if }\llbracket\Gamma\vdash\phi\ \mathrm{prp}\rrbracket(\delta)=\mathit{tt}\\
\mathit{ff} & \text{otherwise}
\end{cases} \\
&=\llbracket\Gamma\vdash\phi\wedge\psi\ \mathrm{prp}\rrbracket(\delta)
\end{aligned} [ [ Γ ⊢ ϕ ∧ ψ prp ] ] ( δ ) = { [ [ Γ ⊢ ψ prp ] ] ( δ ) ff if [ [ Γ ⊢ ϕ prp ] ] ( δ ) = tt otherwise = [ [ Γ ⊢ ϕ ∧ ψ prp ] ] ( δ )
⟦ Γ ⊢ ¬ ϕ p r p ⟧ ( γ ) = { f f if ⟦ Γ ⊢ ϕ p r p ⟧ ( γ ) = t t t t otherwise \llbracket\Gamma\vdash\neg\phi\ \mathrm{prp}\rrbracket(\gamma)
=
\begin{cases}
\mathit{ff} & \text{if }\llbracket\Gamma\vdash\phi\ \mathrm{prp}\rrbracket(\gamma)=\mathit{tt}\\
\mathit{tt} & \text{otherwise}
\end{cases} [ [ Γ ⊢ ¬ ϕ prp ] ] ( γ ) = { ff tt if [ [ Γ ⊢ ϕ prp ] ] ( γ ) = tt otherwise
By I. H.
⟦ Γ ⊢ ¬ ϕ p r p ⟧ ( δ ) = { f f if ⟦ Γ ⊢ ϕ p r p ⟧ ( δ ) = t t t t otherwise = ⟦ Γ ⊢ ¬ ϕ p r p ⟧ ( δ ) \begin{aligned}
\llbracket\Gamma\vdash\neg\phi\ \mathrm{prp}\rrbracket(\delta)
=
\begin{cases}
\mathit{ff} & \text{if }\llbracket\Gamma\vdash\phi\ \mathrm{prp}\rrbracket(\delta)=\mathit{tt}\\
\mathit{tt} & \text{otherwise}
\end{cases} \\
&=\llbracket\Gamma\vdash\neg\phi\ \mathrm{prp}\rrbracket(\delta)
\end{aligned} [ [ Γ ⊢ ¬ ϕ prp ] ] ( δ ) = { ff tt if [ [ Γ ⊢ ϕ prp ] ] ( δ ) = tt otherwise = [ [ Γ ⊢ ¬ ϕ prp ] ] ( δ )
Proof of Theorem 6.2 (i). By structural induction on the derivation of Γ ⊢ τ ⪯ σ \Gamma\vdash\tau\preceq\sigma Γ ⊢ τ ⪯ σ :
⟦ Γ ⊢ τ : T y ⟧ ( γ ) = ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \begin{aligned}
\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma) \\
&=\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma)
\end{aligned} [ [ Γ ⊢ τ : Ty ] ] ( γ ) = [ [ Γ ⊢ τ : Ty ] ] ( γ )
⟦ Γ ⊢ τ : T y ⟧ ( γ ) = { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ∣ ⟦ Γ , x : τ ⊢ t t ≡ B o o l t t p r p ⟧ ( ⟨ γ , v ⟩ ) } = ⟦ Γ ⊢ { x : τ ∣ t t ≡ B o o l t t } : T y ⟧ ( γ ) \begin{aligned}
\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma)
&=\{\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma)\mid\llbracket\Gamma,x:\tau\vdash\mathit{tt}\equiv_{\mathrm{Bool}}\mathit{tt}\ \mathrm{prp}\rrbracket(\langle\gamma,v\rangle)\}\\
&=\llbracket\Gamma\vdash\{x:\tau\mid\mathit{tt}\equiv_{\mathrm{Bool}}\mathit{tt}\}:\mathrm{Ty}\rrbracket(\gamma)
\end{aligned} [ [ Γ ⊢ τ : Ty ] ] ( γ ) = {⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) ∣ [ [ Γ , x : τ ⊢ tt ≡ Bool tt prp ] ] (⟨ γ , v ⟩)} = [ [ Γ ⊢ { x : τ ∣ tt ≡ Bool tt } : Ty ] ] ( γ )
⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) = { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ∣ ⟦ Γ , x : τ ⊢ ϕ p r p ⟧ ( ⟨ γ , v ⟩ ) } by Assumption 1 ⊆ { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ∣ ⟦ Γ , x : τ ⊢ ψ p r p ⟧ ( ⟨ γ , v ⟩ ) } = ⟦ Γ ⊢ { x : τ ∣ ψ } : T y ⟧ ( γ ) \begin{aligned}
\llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty}\rrbracket(\gamma)
&=\{\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma)\mid\llbracket\Gamma,x:\tau\vdash\phi\ \mathrm{prp}\rrbracket(\langle\gamma,v\rangle)\}\\
&\text{by Assumption 1}\\
&\subseteq\{\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty}\rrbracket(\gamma)\mid\llbracket\Gamma,x:\tau\vdash\psi\ \mathrm{prp}\rrbracket(\langle\gamma,v\rangle)\}\\
&=\llbracket\Gamma\vdash\{x:\tau\mid\psi\}:\mathrm{Ty}\rrbracket(\gamma)
\end{aligned} [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) = {⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) ∣ [ [ Γ , x : τ ⊢ ϕ prp ] ] (⟨ γ , v ⟩)} by Assumption 1 ⊆ {⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) ∣ [ [ Γ , x : τ ⊢ ψ prp ] ] (⟨ γ , v ⟩)} = [ [ Γ ⊢ { x : τ ∣ ψ } : Ty ] ] ( γ )
⟦ Γ ⊢ ( x : τ ) → ρ : T y ⟧ ( γ ) = { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ ρ : T y ⟧ ( ⟨ γ , v ⟩ ) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ ⟦ Γ ⊢ τ : T y ⟧ ⟧ ( ι Γ ( γ ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ ⟦ Γ , x : τ ⊢ ρ : T y ⟧ ⟧ ( ι Γ ( γ ) ) } \llbracket\Gamma\vdash(x\mathbin{:}\tau) \to\rho\mathbin{:}\mathrm{Ty} \rrbracket(\gamma)
= \left\{ \langle f,g\rangle\mathrel{\middle|} \begin{array}{l}
\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket(\gamma).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x\mathbin{:}\tau\vdash\rho\mathbin{:}\mathrm{Ty}\rrbracket(\langle\gamma,v\rangle)\\
\forall\langle v_{\perp},w_{\perp}\rangle\in\llbracket\!\llbracket\Gamma\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket\!\rrbracket(\iota_{\Gamma}(\gamma)).\ \langle f\cdot v_{\perp},g\cdot w_{\perp}\rangle\in\llbracket\!\llbracket\Gamma,x\mathbin{:}\tau\vdash\rho\mathbin{:}\mathrm{Ty}\rrbracket\!\rrbracket(\iota_{\Gamma}(\gamma))
\end{array}\right\} [ [ Γ ⊢ ( x : τ ) → ρ : Ty ] ] ( γ ) = { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ ρ : Ty ] ] (⟨ γ , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ [ [ Γ ⊢ τ : Ty ] ] ] ] ( ι Γ ( γ )) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ [ [ Γ , x : τ ⊢ ρ : Ty ] ] ] ] ( ι Γ ( γ )) }
By I. H. and Theorem 6.2 (ii)
⊆ { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ σ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : τ ⊢ ρ : T y ⟧ ( ⟨ γ , v ⟩ ) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ ⟦ Γ ⊢ σ : T y ⟧ ⟧ ( ι Γ ( γ ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ ⟦ Γ , x : τ ⊢ ρ : T y ⟧ ⟧ ( ι Γ ( γ ) ) } \subseteq\left\{ \langle f,g\rangle\mathrel{\middle|} \begin{array}{l}
\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\sigma\mathbin{:}\mathrm{Ty}\rrbracket(\gamma).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x\mathbin{:}\tau\vdash\rho\mathbin{:}\mathrm{Ty}\rrbracket(\langle\gamma,v\rangle)\\
\forall\langle v_{\perp},w_{\perp}\rangle\in\llbracket\!\llbracket\Gamma\vdash\sigma\mathbin{:}\mathrm{Ty}\rrbracket\!\rrbracket(\iota_{\Gamma}(\gamma)).\ \langle f\cdot v_{\perp},g\cdot w_{\perp}\rangle\in\llbracket\!\llbracket\Gamma,x\mathbin{:}\tau\vdash\rho\mathbin{:}\mathrm{Ty}\rrbracket\!\rrbracket(\iota_{\Gamma}(\gamma))
\end{array}\right\} ⊆ { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ σ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : τ ⊢ ρ : Ty ] ] (⟨ γ , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ [ [ Γ ⊢ σ : Ty ] ] ] ] ( ι Γ ( γ )) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ [ [ Γ , x : τ ⊢ ρ : Ty ] ] ] ] ( ι Γ ( γ )) }
By I. H. and Lemma C.12
⊆ { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ σ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Γ , x : σ ⊢ π : T y ⟧ ( ⟨ γ , v ⟩ ) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ ⟦ Γ ⊢ σ : T y ⟧ ⟧ ( ι Γ ( γ ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ ⟦ Γ , x : σ ⊢ π : T y ⟧ ⟧ ( ι Γ ( γ ) ) } = ⟦ Γ ⊢ ( x : σ ) → π : T y ⟧ ( γ ) \subseteq\left\{ \langle f,g\rangle\mathrel{\middle|} \begin{array}{l}
\forall\langle v,w\rangle\in\llbracket\Gamma\vdash\sigma\mathbin{:}\mathrm{Ty}\rrbracket(\gamma).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Gamma,x\mathbin{:}\sigma\vdash\pi\mathbin{:}\mathrm{Ty}\rrbracket(\langle\gamma,v\rangle)\\
\forall\langle v_{\perp},w_{\perp}\rangle\in\llbracket\!\llbracket\Gamma\vdash\sigma\mathbin{:}\mathrm{Ty}\rrbracket\!\rrbracket(\iota_{\Gamma}(\gamma)).\ \langle f\cdot v_{\perp},g\cdot w_{\perp}\rangle\in\llbracket\!\llbracket\Gamma,x\mathbin{:}\sigma\vdash\pi\mathbin{:}\mathrm{Ty}\rrbracket\!\rrbracket(\iota_{\Gamma}(\gamma))
\end{array}\right\}
= \llbracket\Gamma\vdash(x\mathbin{:}\sigma)\to\pi\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) ⊆ { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Γ ⊢ σ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Γ , x : σ ⊢ π : Ty ] ] (⟨ γ , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ [ [ Γ ⊢ σ : Ty ] ] ] ] ( ι Γ ( γ )) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ [ [ Γ , x : σ ⊢ π : Ty ] ] ] ] ( ι Γ ( γ )) } = [ [ Γ ⊢ ( x : σ ) → π : Ty ] ] ( γ )
⟦ Γ ⊢ { x : { y : τ ∣ ψ } ∣ ϕ } : T y ⟧ ( γ ) = { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ { y : τ ∣ ψ } : T y ⟧ ( γ ) | { Γ , x : { y : τ ∣ ψ } ⊢ ϕ p r p } ( ⟨ γ , v ⟩ ) } = { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) | { Γ , x : { y : τ ∣ ψ } ⊢ ϕ p r p } ( ⟨ γ , v ⟩ ) (i) { Γ , y : τ ⊢ ψ p r p } ( ⟨ γ , v ⟩ ) (ii) } \begin{aligned}
\llbracket\Gamma\vdash\{x\mathbin{:}\{y\mathbin{:}\tau\mid\psi\}\mid\phi\}\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)
= \left\{ \langle v,w\rangle\in\llbracket\Gamma\vdash\{y\mathbin{:}\tau\mid\psi\}\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)\mathrel{\middle|} \{\Gamma,x\mathbin{:}\{y\mathbin{:}\tau\mid\psi\}\vdash\phi\ \mathrm{prp}\}(\langle\gamma,v\rangle)\right\} \\
&= \left\{ \langle v,w\rangle\in\llbracket\Gamma\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)\mathrel{\middle|} \begin{array}{l}
\{\Gamma,x\mathbin{:}\{y\mathbin{:}\tau\mid\psi\}\vdash\phi\ \mathrm{prp}\}(\langle\gamma,v\rangle)\quad\text{(i)}\\
\{\Gamma,y\mathbin{:}\tau\vdash\psi\ \mathrm{prp}\}(\langle\gamma,v\rangle)\quad\text{(ii)}
\end{array}\right\}
\end{aligned} [ [ Γ ⊢ { x : { y : τ ∣ ψ } ∣ ϕ } : Ty ] ] ( γ ) = { ⟨ v , w ⟩ ∈ [ [ Γ ⊢ { y : τ ∣ ψ } : Ty ] ] ( γ ) { Γ , x : { y : τ ∣ ψ } ⊢ ϕ prp } (⟨ γ , v ⟩) } = { ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) { Γ , x : { y : τ ∣ ψ } ⊢ ϕ prp } (⟨ γ , v ⟩) (i) { Γ , y : τ ⊢ ψ prp } (⟨ γ , v ⟩) (ii) }
By Lemma C.9 , the well-formedness hypothesis on the right-hand type, and the definition of ∧ \land ∧
if (ii) holds then the value is in dom (⟦ Γ ⊢ { y : τ ∣ ψ } : T y ⟧ ( γ ) \llbracket\Gamma\vdash\{y\mathbin{:}\tau\mid\psi\}\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) [ [ Γ ⊢ { y : τ ∣ ψ } : Ty ] ] ( γ ) )
= { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) | { Γ , y : τ ⊢ ψ ∧ ϕ [ y / x ] p r p } ( ⟨ γ , v ⟩ ) } = ⟦ Γ ⊢ { y : τ ∣ ψ ∧ ϕ [ y / x ] } : T y ⟧ ( γ ) = \left\{ \langle v,w\rangle\in\llbracket\Gamma\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)\mathrel{\middle|} \{\Gamma,y\mathbin{:}\tau\vdash\psi\land\phi[y/x]\ \mathrm{prp}\}(\langle\gamma,v\rangle)\right\}
= \llbracket\Gamma\vdash\{y\mathbin{:}\tau\mid\psi\land\phi[y/x]\}\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) = { ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) { Γ , y : τ ⊢ ψ ∧ ϕ [ y / x ] prp } (⟨ γ , v ⟩) } = [ [ Γ ⊢ { y : τ ∣ ψ ∧ ϕ [ y / x ]} : Ty ] ] ( γ )
⟦ Γ ⊢ τ ⋅ t ˉ k : T y ⟧ ( γ ) = ⟦ Γ ⊢ τ : σ k → T y ⟧ ( γ ) ⋅ ( ( t ) ) ( ρ Γ ( γ ) ) k \llbracket\Gamma\vdash\tau\cdot\bar{t}^{k}\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)
= \llbracket\Gamma\vdash\tau\mathbin{:}\sigma^{k}\to\mathrm{Ty}\rrbracket(\gamma)\cdot((t))(\rho_{\Gamma}(\gamma))^{k} [ [ Γ ⊢ τ ⋅ t ˉ k : Ty ] ] ( γ ) = [ [ Γ ⊢ τ : σ k → Ty ] ] ( γ ) ⋅ (( t )) ( ρ Γ ( γ ) ) k
By Theorem 5.6 (i) ( ( t k ) ) ( ρ Γ ( γ ) ) , ( ( u k ) ) ( ρ Γ ( γ ) ) ∈ dom ( ⟦ Γ ⊢ τ k : T y ⟧ ( γ ) ) ((t_{k}))(\rho_{\Gamma}(\gamma)),((u_{k}))(\rho_{\Gamma}(\gamma))\in\operatorname{dom}(\llbracket\Gamma\vdash\tau_{k}\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)) (( t k )) ( ρ Γ ( γ )) , (( u k )) ( ρ Γ ( γ )) ∈ dom ( [ [ Γ ⊢ τ k : Ty ] ] ( γ ))
By Assumption 1 ⟨ ( ( t k ) ) ( ρ Γ ( γ ) ) , ( ( u k ) ) ( ρ Γ ( γ ) ) ⟩ ∈ ⟦ ⟦ Γ ⊢ τ k : T y ⟧ ⟧ ( ι Γ ( γ ) ) \langle((t_{k}))(\rho_{\Gamma}(\gamma)),((u_{k}))(\rho_{\Gamma}(\gamma))\rangle\in\llbracket\!\llbracket\Gamma\vdash\tau_{k}\mathbin{:}\mathrm{Ty}\rrbracket\!\rrbracket(\iota_{\Gamma}(\gamma)) ⟨(( t k )) ( ρ Γ ( γ )) , (( u k )) ( ρ Γ ( γ ))⟩ ∈ [ [ [ [ Γ ⊢ τ k : Ty ] ] ] ] ( ι Γ ( γ )) ,
Theorem 5.4 , and kind being invariant under related arguments
= ⟦ Γ ⊢ τ : σ k → T y ⟧ ( γ ) ⋅ ( ( u ) ) ( ρ Γ ( γ ) ) k = ⟦ Γ ⊢ τ ⋅ u ˉ k : T y ⟧ ( γ ) = \llbracket\Gamma\vdash\tau\mathbin{:}\sigma^{k}\to\mathrm{Ty}\rrbracket(\gamma)\cdot((u))(\rho_{\Gamma}(\gamma))^{k}
= \llbracket\Gamma\vdash\tau\cdot\bar{u}^{k}\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) = [ [ Γ ⊢ τ : σ k → Ty ] ] ( γ ) ⋅ (( u )) ( ρ Γ ( γ ) ) k = [ [ Γ ⊢ τ ⋅ u ˉ k : Ty ] ] ( γ )
⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) = { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) | { Γ , x : τ ⊢ ϕ p r p } ( ⟨ γ , v ⟩ ) } \llbracket\Gamma\vdash\{x\mathbin{:}\tau\mid\phi\}\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)
= \left\{ \langle v,w\rangle\in\llbracket\Gamma\vdash\tau\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)\mathrel{\middle|} \{\Gamma,x\mathbin{:}\tau\vdash\phi\ \mathrm{prp}\}(\langle\gamma,v\rangle)\right\} [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) = { ⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) { Γ , x : τ ⊢ ϕ prp } (⟨ γ , v ⟩) }
By I. H. and Lemma C.12 (iii)
⊆ { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ σ : T y ⟧ ( γ ) | { Γ , x : σ ⊢ ϕ p r p } ( ⟨ γ , v ⟩ ) } = ⟦ Γ ⊢ { x : σ ∣ ϕ } : T y ⟧ ( γ ) \subseteq\left\{ \langle v,w\rangle\in\llbracket\Gamma\vdash\sigma\mathbin{:}\mathrm{Ty}\rrbracket(\gamma)\mathrel{\middle|} \{\Gamma,x\mathbin{:}\sigma\vdash\phi\ \mathrm{prp}\}(\langle\gamma,v\rangle)\right\}
= \llbracket\Gamma\vdash\{x\mathbin{:}\sigma\mid\phi\}\mathbin{:}\mathrm{Ty}\rrbracket(\gamma) ⊆ { ⟨ v , w ⟩ ∈ [ [ Γ ⊢ σ : Ty ] ] ( γ ) { Γ , x : σ ⊢ ϕ prp } (⟨ γ , v ⟩) } = [ [ Γ ⊢ { x : σ ∣ ϕ } : Ty ] ] ( γ )
⟦ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) = { ⟨ v , w ⟩ ∈ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) ∣ ⟦ Γ , x : τ ⊢ ϕ p r p ⟧ ( ⟨ γ , v ⟩ ) } ⊆ ⟦ Γ ⊢ τ : T y ⟧ ( γ ) \llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty} \rrbracket(\gamma)
= \{\langle v,w\rangle\in\llbracket\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma) \mid\llbracket\Gamma,x:\tau\vdash\phi\ \mathrm{prp} \rrbracket(\langle\gamma,v\rangle)\}
\subseteq\llbracket\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma) [ [ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) = {⟨ v , w ⟩ ∈ [ [ Γ ⊢ τ : Ty ] ] ( γ ) ∣ [ [ Γ , x : τ ⊢ ϕ prp ] ] (⟨ γ , v ⟩)} ⊆ [ [ Γ ⊢ τ : Ty ] ] ( γ )
⟦ Γ ⊢ τ : T y ⟧ ( γ ) \llbracket\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma) [ [ Γ ⊢ τ : Ty ] ] ( γ )
By I. H. on the first premise, which is well-formed by the second
⊆ ⟦ Γ ⊢ σ : T y ⟧ ( γ ) \subseteq\llbracket\Gamma\vdash\sigma:\mathrm{Ty} \rrbracket(\gamma) ⊆ [ [ Γ ⊢ σ : Ty ] ] ( γ )
By I. H. on the third premise
⊆ ⟦ Γ ⊢ ρ : T y ⟧ ( γ ) \subseteq\llbracket\Gamma\vdash\rho:\mathrm{Ty} \rrbracket(\gamma) ⊆ [ [ Γ ⊢ ρ : Ty ] ] ( γ )
⟦ Γ ⊢ ∀ x : κ . τ : T y ⟧ ( γ ) = { ⟨ v , w ⟩ | ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) , ∀ P ⊥ ∈ ⌊ ⌊ Γ ⊢ κ : K d ⟧ ( ι Γ ( γ ) ) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) } \begin{aligned}
\llbracket\Gamma\vdash\forall x:\kappa.\,\tau:\mathrm{Ty} \rrbracket(\gamma) \\
&= \left\{\langle v,w\rangle\,\middle|\, \begin{array}{l}
\forall P \in\llbracket\Gamma\vdash\kappa:\mathrm{Kd} \rrbracket(\gamma),\ \forall P_{\perp} \in\lfloor\!\lfloor\Gamma\vdash\kappa:\mathrm{Kd} \rrbracket(\iota_{\Gamma}(\gamma))\\
\pi_{\Gamma;\kappa}(\gamma,P) \subseteq P_{\perp} \Rightarrow\langle v,w\rangle\in\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty} \rrbracket(\langle\gamma,\langle P,P_{\perp}\rangle\rangle)
\end{array}\right\}
\end{aligned} [ [ Γ ⊢ ∀ x : κ . τ : Ty ] ] ( γ ) = { ⟨ v , w ⟩ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) , ∀ P ⊥ ∈ ⌊ ⌊ Γ ⊢ κ : Kd ] ] ( ι Γ ( γ )) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ τ : Ty ] ] (⟨ γ , ⟨ P , P ⊥ ⟩⟩) }
The conditions on P P P and P ⊥ P_{\perp} P ⊥ are those of ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ∈ dom ( ⟦ Γ , x : κ c t x ⟧ ) \langle\gamma,\langle P,P_{\perp}\rangle\rangle\in\operatorname{dom}(\llbracket\Gamma,x:\kappa\ \mathrm{ctx} \rrbracket) ⟨ γ , ⟨ P , P ⊥ ⟩⟩ ∈ dom ( [ [ Γ , x : κ ctx ] ] ) , so by I. H.
⊆ { ⟨ v , w ⟩ | ∀ P ∈ ⟦ Γ ⊢ κ : K d ⟧ ( γ ) , ∀ P ⊥ ∈ ⌊ ⌊ Γ ⊢ κ : K d ⟧ ( ι Γ ( γ ) ) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ ⟦ Γ , x : κ ⊢ σ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ⟩ ⟩ ) } = ⟦ Γ ⊢ ∀ x : κ . σ : T y ⟧ ( γ ) \begin{aligned}
\subseteq\left\{\langle v,w\rangle\,\middle|\, \begin{array}{l}
\forall P \in\llbracket\Gamma\vdash\kappa:\mathrm{Kd} \rrbracket(\gamma),\ \forall P_{\perp} \in\lfloor\!\lfloor\Gamma\vdash\kappa:\mathrm{Kd} \rrbracket(\iota_{\Gamma}(\gamma))\\
\pi_{\Gamma;\kappa}(\gamma,P) \subseteq P_{\perp} \Rightarrow\langle v,w\rangle\in\llbracket\Gamma,x:\kappa\vdash\sigma:\mathrm{Ty} \rrbracket(\langle\gamma,\langle P,P_{\perp}\rangle\rangle)
\end{array}\right\} \\
&= \llbracket\Gamma\vdash\forall x:\kappa.\,\sigma:\mathrm{Ty} \rrbracket(\gamma)
\end{aligned} ⊆ { ⟨ v , w ⟩ ∀ P ∈ [ [ Γ ⊢ κ : Kd ] ] ( γ ) , ∀ P ⊥ ∈ ⌊ ⌊ Γ ⊢ κ : Kd ] ] ( ι Γ ( γ )) π Γ ; κ ( γ , P ) ⊆ P ⊥ ⇒ ⟨ v , w ⟩ ∈ [ [ Γ , x : κ ⊢ σ : Ty ] ] (⟨ γ , ⟨ P , P ⊥ ⟩⟩) } = [ [ Γ ⊢ ∀ x : κ . σ : Ty ] ] ( γ )
Proof of Theorem 6.2 (ii). By structural induction on the derivation of Γ ⊢ τ ⪯ σ \Gamma\vdash\tau\preceq\sigma Γ ⊢ τ ⪯ σ :
⌊ ⌊ Γ ⊢ τ : T y ⟧ ( γ ) = ⌊ ⌊ Γ ⊢ τ : T y ⟧ ( γ ) \lfloor\!\lfloor\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma)
= \lfloor\!\lfloor\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma) ⌊ ⌊ Γ ⊢ τ : Ty ] ] ( γ ) = ⌊ ⌊ Γ ⊢ τ : Ty ] ] ( γ )
⌊ ⌊ Γ ⊢ τ : T y ⟧ ( γ ) = ⌊ ⌊ Γ ⊢ { x : τ ∣ t t ≡ B o o l t t } : T y ⟧ ( γ ) \lfloor\!\lfloor\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma)
= \lfloor\!\lfloor\Gamma\vdash\{x:\tau\mid\mathrm{tt} \equiv_{\mathrm{Bool}} \mathrm{tt}\}:\mathrm{Ty} \rrbracket(\gamma) ⌊ ⌊ Γ ⊢ τ : Ty ] ] ( γ ) = ⌊ ⌊ Γ ⊢ { x : τ ∣ tt ≡ Bool tt } : Ty ] ] ( γ )
⌊ ⌊ Γ ⊢ { x : τ ∣ ϕ } : T y ⟧ ( γ ) = ⌊ ⌊ Γ ⊢ τ : T y ⟧ ( γ ) = ⌊ ⌊ Γ ⊢ { x : τ ∣ ψ } : T y ⟧ ( γ ) \lfloor\!\lfloor\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty} \rrbracket(\gamma)
= \lfloor\!\lfloor\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma)
= \lfloor\!\lfloor\Gamma\vdash\{x:\tau\mid\psi\}:\mathrm{Ty} \rrbracket(\gamma) ⌊ ⌊ Γ ⊢ { x : τ ∣ ϕ } : Ty ] ] ( γ ) = ⌊ ⌊ Γ ⊢ τ : Ty ] ] ( γ ) = ⌊ ⌊ Γ ⊢ { x : τ ∣ ψ } : Ty ] ] ( γ )
⌊ ⌊ Γ ⊢ ( x : τ ) → ρ : T y ⟧ ( γ ) = { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⌊ ⌊ Γ , x : τ ⊢ ρ : T y ⟧ ( γ ) } \lfloor\!\lfloor\Gamma\vdash(x:\tau)\to\rho:\mathrm{Ty} \rrbracket(\gamma)
= \{\langle f,g\rangle\mid\forall\langle v,w\rangle\in\lfloor\!\lfloor\Gamma\vdash\tau:\mathrm{Ty} \rrbracket(\gamma).\ \langle f\mathbin{\cdot}v,g\mathbin{\cdot}w\rangle\in\lfloor\!\lfloor\Gamma,x:\tau\vdash\rho:\mathrm{Ty} \rrbracket(\gamma)\} ⌊ ⌊ Γ ⊢ ( x : τ ) → ρ : Ty ] ] ( γ ) = {⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ ⊢ τ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⌊ ⌊ Γ , x : τ ⊢ ρ : Ty ] ] ( γ )}
By I. H. on the first premise and Lemma C.12 (ii)
⌊ ⌊ Γ , x : τ ⊢ ρ : T y ⟧ ( γ ) = ⌊ ⌊ Γ , x : σ ⊢ ρ : T y ⟧ ( γ ) = { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ ⊢ σ : T y ⟧ ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⌊ ⌊ Γ , x : σ ⊢ ρ : T y ⟧ ( γ ) } \begin{aligned}
\lfloor\!\lfloor\Gamma,x:\tau\vdash\rho:\mathrm{Ty} \rrbracket(\gamma)
= \lfloor\!\lfloor\Gamma,x:\sigma\vdash\rho:\mathrm{Ty} \rrbracket(\gamma) \\
&= \{\langle f,g\rangle\mid\forall\langle v,w\rangle\in\lfloor\!\lfloor\Gamma\vdash\sigma:\mathrm{Ty} \rrbracket(\gamma).\ \langle f\mathbin{\cdot}v,g\mathbin{\cdot}w\rangle\in\lfloor\!\lfloor\Gamma,x:\sigma\vdash\rho:\mathrm{Ty} \rrbracket(\gamma)\}
\end{aligned} ⌊ ⌊ Γ , x : τ ⊢ ρ : Ty ] ] ( γ ) = ⌊ ⌊ Γ , x : σ ⊢ ρ : Ty ] ] ( γ ) = {⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⌊ ⌊ Γ ⊢ σ : Ty ] ] ( γ ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⌊ ⌊ Γ , x : σ ⊢ ρ : Ty ] ] ( γ )}
By I. H. on the second premise
= \left\{\langle f,g\rangle\mathrel{\big|} \forall\langle v,w\rangle\in\left\llbracket\Gamma\vdash\sigma:\mathrm{Ty}\right\rrbracket(\gamma) .\ \langle f\cdot v,g\cdot w\rangle\in\left\llbracket\Gamma,x:\sigma\vdash\pi:\mathrm{Ty}\right\rrbracket(\gamma) \right\}
\\
= \left\llbracket\Gamma\vdash(x:\sigma)\to\pi:\mathrm{Ty}\right\rrbracket(\gamma)
\left\llbracket\Gamma\vdash\{x:\{y:\tau\mid\psi\}\mid\phi\}:\mathrm{Ty}\right\rrbracket(\gamma)
\\
= \left\llbracket\Gamma\vdash\{y:\tau\mid\psi\}:\mathrm{Ty}\right\rrbracket(\gamma)
\\
= \left\llbracket\Gamma\vdash\tau:\mathrm{Ty}\right\rrbracket(\gamma)
\\
= \left\llbracket\Gamma\vdash\{y:\tau\mid\psi\land\phi[y/x]\}:\mathrm{Ty}\right\rrbracket(\gamma)
\left\llbracket\Gamma\vdash\tau\cdot\bar{t}^{k}:\mathrm{Ty}\right\rrbracket(\gamma)
\\
= \left\llbracket\Gamma\vdash\tau:\bar{\sigma}^{k}\to\mathrm{Ty}\right\rrbracket(\gamma)
\\
= \left\llbracket\Gamma\vdash\tau\cdot\bar{u}^{k}:\mathrm{Ty}\right\rrbracket(\gamma)
\left\llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty}\right\rrbracket(\gamma)
\\
= \left\llbracket\Gamma\vdash\tau:\mathrm{Ty}\right\rrbracket(\gamma)
By I. H.
= \left\llbracket\Gamma\vdash\sigma:\mathrm{Ty}\right\rrbracket(\gamma)
\\
= \left\llbracket\Gamma\vdash\{x:\sigma\mid\phi\}:\mathrm{Ty}\right\rrbracket(\gamma)
\left\llbracket\Gamma\vdash\{x:\tau\mid\phi\}:\mathrm{Ty}\right\rrbracket(\gamma)
\\
= \left\llbracket\Gamma\vdash\tau:\mathrm{Ty}\right\rrbracket(\gamma)
\left\llbracket\Gamma\vdash\tau:\mathrm{Ty}\right\rrbracket(\gamma)
By I. H. on the first premise, which is well-formed by the second
= \left\llbracket\Gamma\vdash\sigma:\mathrm{Ty}\right\rrbracket(\gamma)
By I. H. on the third premise
= \left\llbracket\Gamma\vdash\rho:\mathrm{Ty}\right\rrbracket(\gamma)
\left\llbracket\Gamma\vdash\forall x:\kappa.\,\tau:\mathrm{Ty}\right\rrbracket(\gamma)
\\
= \left\{\langle v,w\rangle\mathrel{\big|} \forall P\in\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(\gamma).\ \langle v,w\rangle\in\left\llbracket\Gamma,x:\kappa\vdash\tau:\mathrm{Ty}\right\rrbracket(\langle\gamma,P\rangle)\right\}
By I. H. at each \langle\gamma,P\rangle\in\operatorname{dom}\left(\left\llbracket\vdash\Gamma,x:\kappa\ \mathrm{ctx}\right\rrbracket\right)
= \left\{\langle v,w\rangle\mathrel{\big|} \forall P\in\left\llbracket\Gamma\vdash\kappa:\mathrm{Kd}\right\rrbracket(\gamma).\ \langle v,w\rangle\in\left\llbracket\Gamma,x:\kappa\vdash\sigma:\mathrm{Ty}\right\rrbracket(\langle\gamma,P\rangle)\right\}
\\
= \left\llbracket\Gamma\vdash\forall x:\kappa.\,\sigma:\mathrm{Ty}\right\rrbracket(\gamma)
Proof of Theorem 7.1. We abbreviate Θ ≜ Γ , x : κ , Δ \Theta\triangleq\Gamma,x:\kappa,\Delta Θ ≜ Γ , x : κ , Δ and ϵ ( X ) ≜ ⟨ ⟨ γ , X ⟩ , δ ⟩ \epsilon(X)\triangleq\langle\langle\gamma,X\rangle,\delta\rangle ϵ ( X ) ≜ ⟨⟨ γ , X ⟩ , δ ⟩ . By induction on the derivation of Θ ⊢ τ : μ \Theta\vdash\tau:\mu Θ ⊢ τ : μ .
⟦ Θ ⊢ B : T y ⟧ ( ϵ ( A ) ) = { ⟨ i B ( b ) , i B ( b ) ⟩ ∣ b ∈ B } ∪ { ⟨ ⊥ , ⊥ ⟩ } = ⟦ Θ ⊢ B : T y ⟧ ( ϵ ( B ) ) \llbracket\Theta\vdash B:\mathrm{Ty} \rrbracket(\epsilon(A))=\{\langle i_B(b),i_B(b)\rangle\mid b\in B\}\cup\{\langle\bot,\bot\rangle\}=\llbracket\Theta\vdash B:\mathrm{Ty}\rrbracket(\epsilon(B)) [ [ Θ ⊢ B : Ty ] ] ( ϵ ( A )) = {⟨ i B ( b ) , i B ( b )⟩ ∣ b ∈ B } ∪ {⟨ ⊥ , ⊥ ⟩} = [ [ Θ ⊢ B : Ty ] ] ( ϵ ( B ))
The operator is contractive as it is constant.
Ty-Var: ⟦ Θ ⊢ y : T y ⟧ ( ϵ ( A ) ) = ϵ ( A ) ( y ) \llbracket\Theta\vdash y:\mathrm{Ty}\rrbracket(\epsilon(A))=\epsilon(A)(y) [ [ Θ ⊢ y : Ty ] ] ( ϵ ( A )) = ϵ ( A ) ( y ) and ⟦ Θ ⊢ y : T y ⟧ ( ϵ ( B ) ) = ϵ ( B ) ( y ) \llbracket\Theta\vdash y:\mathrm{Ty}\rrbracket(\epsilon(B))=\epsilon(B)(y) [ [ Θ ⊢ y : Ty ] ] ( ϵ ( B )) = ϵ ( B ) ( y ) , if x = y x=y x = y then the operator is the identity, otherwise it is constant and hence contractive.
⟦ Θ ⊢ ( y : τ ) → σ : T y ⟧ ( ϵ ( C ) ) = { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Θ ⊢ τ : T y ⟧ ( ϵ ( C ) ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Θ , y : τ ⊢ σ : T y ⟧ ( ϵ ( C ) ) } \llbracket\Theta\vdash(y:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\epsilon(C))
=\{\langle f,g\rangle\mid\forall\langle v,w\rangle\in\llbracket\Theta\vdash\tau:\mathrm{Ty}\rrbracket(\epsilon(C)).\langle f\mathbin{\cdot}v,g\mathbin{\cdot}w\rangle\in\llbracket\Theta,y:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\epsilon(C))\} [ [ Θ ⊢ ( y : τ ) → σ : Ty ] ] ( ϵ ( C )) = {⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ [ [ Θ ⊢ τ : Ty ] ] ( ϵ ( C )) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Θ , y : τ ⊢ σ : Ty ] ] ( ϵ ( C ))}
Let ⟨ f , g ⟩ ∈ ⟦ Θ ⊢ ( y : τ ) → σ : T y ⟧ ( ϵ ( A ) ) \langle f,g\rangle\in\llbracket\Theta\vdash(y:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\epsilon(A)) ⟨ f , g ⟩ ∈ [ [ Θ ⊢ ( y : τ ) → σ : Ty ] ] ( ϵ ( A )) ; we show that ⟨ π n + 1 ( f ) , π n + 1 ( g ) ⟩ ∈ ⟦ Θ ⊢ ( y : τ ) → σ : T y ⟧ ( ϵ ( B ) ) \langle\pi_{n+1}(f),\pi_{n+1}(g)\rangle\in\llbracket\Theta\vdash(y:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\epsilon(B)) ⟨ π n + 1 ( f ) , π n + 1 ( g )⟩ ∈ [ [ Θ ⊢ ( y : τ ) → σ : Ty ] ] ( ϵ ( B )) .
⟨ v , w ⟩ ∈ ⟦ Θ ⊢ τ : T y ⟧ ( ϵ ( B ) ) \langle v,w\rangle\in\llbracket\Theta\vdash\tau:\mathrm{Ty}\rrbracket(\epsilon(B)) ⟨ v , w ⟩ ∈ [ [ Θ ⊢ τ : Ty ] ] ( ϵ ( B ))
By the I. H. they agree at least up to level n n n
⇒ ⟨ π n ( v ) , π n ( w ) ⟩ ∈ ⟦ Θ ⊢ τ : T y ⟧ ( ϵ ( A ) ) ⇒ ⟨ f ⋅ π n ( v ) , g ⋅ π n ( w ) ⟩ ∈ ⟦ Θ , y : τ ⊢ σ : T y ⟧ ( ϵ ( A ) ) \begin{aligned}
\Rightarrow\langle\pi_n(v),\pi_n(w)\rangle\in\llbracket\Theta\vdash\tau:\mathrm{Ty}\rrbracket(\epsilon(A)) \\
&\Rightarrow\langle f\mathbin{\cdot}\pi_n(v),g\mathbin{\cdot}\pi_n(w)\rangle\in\llbracket\Theta,y:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\epsilon(A))
\end{aligned} ⇒ ⟨ π n ( v ) , π n ( w )⟩ ∈ [ [ Θ ⊢ τ : Ty ] ] ( ϵ ( A )) ⇒ ⟨ f ⋅ π n ( v ) , g ⋅ π n ( w )⟩ ∈ [ [ Θ , y : τ ⊢ σ : Ty ] ] ( ϵ ( A ))
By the I. H. they agree at least up to level n n n
⇒ ⟨ π n ( f ⋅ π n ( v ) ) , π n ( g ⋅ π n ( w ) ) ⟩ ∈ ⟦ Θ , y : τ ⊢ σ : T y ⟧ ( ϵ ( B ) ) \Rightarrow\langle\pi_n(f\mathbin{\cdot}\pi_n(v)),\pi_n(g\mathbin{\cdot}\pi_n(w))\rangle\in\llbracket\Theta,y:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\epsilon(B)) ⇒ ⟨ π n ( f ⋅ π n ( v )) , π n ( g ⋅ π n ( w ))⟩ ∈ [ [ Θ , y : τ ⊢ σ : Ty ] ] ( ϵ ( B ))
By the fact that π n + 1 ( f ) ⋅ v = π n ( f ⋅ π n ( v ) ) \pi_{n+1}(f)\mathbin{\cdot}v=\pi_n(f\mathbin{\cdot}\pi_n(v)) π n + 1 ( f ) ⋅ v = π n ( f ⋅ π n ( v )) in the bilimit
⇒ ⟨ π n ( f ⋅ π n ( v ) ) , π n ( g ⋅ π n ( w ) ) ⟩ ∈ ⟦ Θ , y : τ ⊢ σ : T y ⟧ ( ϵ ( B ) ) ⇒ ⟨ π n + 1 ( f ) ⋅ v , π n + 1 ( g ) ⋅ w ⟩ ∈ ⟦ Θ , y : τ ⊢ σ : T y ⟧ ( ϵ ( B ) ) ⇒ ⟨ π n + 1 ( f ) , π n + 1 ( g ) ⟩ ∈ ⟦ Θ ⊢ ( y : τ ) → σ : T y ⟧ ( ϵ ( B ) ) \begin{aligned}
\Rightarrow\langle\pi_n(f\mathbin{\cdot}\pi_n(v)),\pi_n(g\mathbin{\cdot}\pi_n(w))\rangle\in\llbracket\Theta,y:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\epsilon(B)) \\
&\Rightarrow\langle\pi_{n+1}(f)\mathbin{\cdot}v,\pi_{n+1}(g)\mathbin{\cdot}w\rangle\in\llbracket\Theta,y:\tau\vdash\sigma:\mathrm{Ty}\rrbracket(\epsilon(B)) \\
&\Rightarrow\langle\pi_{n+1}(f),\pi_{n+1}(g)\rangle\in\llbracket\Theta\vdash(y:\tau)\to\sigma:\mathrm{Ty}\rrbracket(\epsilon(B))
\end{aligned} ⇒ ⟨ π n ( f ⋅ π n ( v )) , π n ( g ⋅ π n ( w ))⟩ ∈ [ [ Θ , y : τ ⊢ σ : Ty ] ] ( ϵ ( B )) ⇒ ⟨ π n + 1 ( f ) ⋅ v , π n + 1 ( g ) ⋅ w ⟩ ∈ [ [ Θ , y : τ ⊢ σ : Ty ] ] ( ϵ ( B )) ⇒ ⟨ π n + 1 ( f ) , π n + 1 ( g )⟩ ∈ [ [ Θ ⊢ ( y : τ ) → σ : Ty ] ] ( ϵ ( B ))
The other direction is symmetric. Hence the operator is contractive.
⟦ Θ ⊢ ∀ y : ν . τ : T y ⟧ ( ϵ ( C ) ) = { ⟨ v , w ⟩ ∣ ∀ P ∈ ⟦ Θ ⊢ ν : K d ⟧ ( ϵ ) . ⟨ v , w ⟩ ∈ ⟦ Θ , y : ν ⊢ τ : T y ⟧ ( ⟨ ϵ ( C ) , P ⟩ ) } \llbracket\Theta\vdash\forall y:\nu.\tau:\mathrm{Ty}\rrbracket(\epsilon(C))
=\{\langle v,w\rangle\mid\forall P\in\llbracket\Theta\vdash\nu:\mathrm{Kd}\rrbracket(\epsilon).\langle v,w\rangle\in\llbracket\Theta,y:\nu\vdash\tau:\mathrm{Ty}\rrbracket(\langle\epsilon(C),P\rangle)\} [ [ Θ ⊢ ∀ y : ν . τ : Ty ] ] ( ϵ ( C )) = {⟨ v , w ⟩ ∣ ∀ P ∈ [ [ Θ ⊢ ν : Kd ] ] ( ϵ ) . ⟨ v , w ⟩ ∈ [ [ Θ , y : ν ⊢ τ : Ty ] ] (⟨ ϵ ( C ) , P ⟩)}
We can apply the I. H. on each instance of the body operator; the alternative that holds depends only on the derivation of τ \tau τ , so it is the same for every P P P . If every instance is the identity, then the whole operator is the identity. Otherwise every instance is contractive. Hence for every P P P the corresponding body interpretations agree at level n + 1 n+1 n + 1 .
⟦ Θ ⊢ { y : τ ∣ ϕ } : T y ⟧ ( ϵ ( C ) ) = ⟦ Θ ⊢ τ : T y ⟧ ( ϵ ( C ) ) \llbracket\Theta\vdash\{y:\tau\mid\phi\}:\mathrm{Ty}\rrbracket(\epsilon(C))=\llbracket\Theta\vdash\tau:\mathrm{Ty}\rrbracket(\epsilon(C)) [ [ Θ ⊢ { y : τ ∣ ϕ } : Ty ] ] ( ϵ ( C )) = [ [ Θ ⊢ τ : Ty ] ] ( ϵ ( C ))
By the I. H. the operator is either the identity or contractive.
⟦ Θ ⊢ τ ⋅ t : κ [ t / y ] ⟧ ( ϵ ( C ) ) = ⟦ Θ ⊢ σ : ( x : τ ) → κ ⟧ ( ϵ ( C ) ) \llbracket\Theta\vdash\tau\mathbin{\cdot}t:\kappa[t/y]\rrbracket(\epsilon(C))=\llbracket\Theta\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\epsilon(C)) [ [ Θ ⊢ τ ⋅ t : κ [ t / y ] ] ] ( ϵ ( C )) = [ [ Θ ⊢ σ : ( x : τ ) → κ ] ] ( ϵ ( C ))
By the I. H. the operator is either the identity or contractive.
⟦ Θ ⊢ μ K ⟨ ν ⟩ C : ( y : σ ‾ j ) → K ⋅ t ‾ i k → T y ⟧ ( ϵ ( C ) ) = fix X ( ⋃ i { ⟨ ⟨ C i , σ ‾ j ⟩ , ⟨ C i , w ‾ j ⟩ ⟩ ∣ ⟨ v j , w j ⟩ ∈ ⟦ Θ , K : τ ‾ k → T y , x : σ ‾ j − 1 ⊢ σ : T y ⟧ ( ⟨ ϵ ( C ) , X ⟩ ) } ∪ { ⟨ ⊥ , ⊥ ⟩ } ) \begin{aligned}
\llbracket\Theta\vdash\mu K^{\langle\nu\rangle}C:(y:\overline{\sigma}^{j})\to K\mathbin{\cdot}\overline{t}^{k}_{i}\to\mathrm{Ty}\rrbracket(\epsilon(C)) \\
&=\operatorname{fix}X\left(\bigcup_i\left\{\left\langle\langle C_i,\overline{\sigma}^{j}\rangle,\langle C_i,\overline{w}^{j}\rangle\right\rangle\mid\langle v_j,w_j\rangle\in\llbracket\Theta,K:\overline{\tau}^{k}\to\mathrm{Ty},x:\overline{\sigma}^{j-1}\vdash\sigma:\mathrm{Ty}\rrbracket(\langle\epsilon(C),X\rangle)\right\}\cup\{\langle\bot,\bot\rangle\}\right)
\end{aligned} [ [ Θ ⊢ μ K ⟨ ν ⟩ C : ( y : σ j ) → K ⋅ t i k → Ty ] ] ( ϵ ( C )) = fix X ( i ⋃ { ⟨ ⟨ C i , σ j ⟩ , ⟨ C i , w j ⟩ ⟩ ∣ ⟨ v j , w j ⟩ ∈ [ [ Θ , K : τ k → Ty , x : σ j − 1 ⊢ σ : Ty ] ] (⟨ ϵ ( C ) , X ⟩) } ∪ {⟨ ⊥ , ⊥ ⟩} )
Let Φ C ( X ) \Phi_C(X) Φ C ( X ) denote the operator under the fixed point computed in ϵ ( C ) \epsilon(C) ϵ ( C ) . We first show that if A n = B n A_n = B_n A n = B n and X n = Y n X_n = Y_n X n = Y n then Φ A ( X ) n + 1 = Φ B ( Y ) n + 1 \Phi_A(X)_{n+1} = \Phi_B(Y)_{n+1} Φ A ( X ) n + 1 = Φ B ( Y ) n + 1 : let ⟨ ⟨ C i , v j ‾ ⟩ , ⟨ C i , w j ‾ ⟩ ⟩ ∈ Φ A ( X ) \langle\langle C_i,\overline{v_j}\rangle,\langle C_i,\overline{w_j}\rangle\rangle\in\Phi_A(X) ⟨⟨ C i , v j ⟩ , ⟨ C i , w j ⟩⟩ ∈ Φ A ( X ) , we show that its ⟨ π n + 1 ( ⟨ C i , v j ‾ ⟩ ) , π n + 1 ( ⟨ C i , w j ‾ ⟩ ) ⟩ \langle\pi_{n+1}(\langle C_i,\overline{v_j}\rangle),\pi_{n+1}(\langle C_i,\overline{w_j}\rangle)\rangle ⟨ π n + 1 (⟨ C i , v j ⟩) , π n + 1 (⟨ C i , w j ⟩)⟩ is in Φ B ( Y ) \Phi_B(Y) Φ B ( Y ) .
⟨ v j , w j ⟩ ∈ ⟦ Θ , K : τ ‾ k → T y , x : σ ‾ j − 1 ⊢ σ j : T y ⟧ ( ⟨ ϵ ( A ) , X ⟩ ) \langle v_j,w_j\rangle\in\llbracket\Theta,K:\overline{\tau}^{k}\to\mathsf{Ty},x:\overline{\sigma}^{j-1}\vdash\sigma_j:\mathsf{Ty}\rrbracket(\langle\epsilon(A),X\rangle) ⟨ v j , w j ⟩ ∈ [ [ Θ , K : τ k → Ty , x : σ j − 1 ⊢ σ j : Ty ] ] (⟨ ϵ ( A ) , X ⟩)
By the I. H., applied once for x x x and once for K K K , they agree at least up to level n n n
⟹ ⟨ π n ( v j ) , π n ( w j ) ⟩ ∈ ⟦ Θ , K : τ ‾ k → T y , x : σ ‾ j − 1 ⊢ σ j : T y ⟧ ( ⟨ ϵ ( B ) , Y ⟩ ) \Longrightarrow\langle\pi_n(v_j),\pi_n(w_j)\rangle\in\llbracket\Theta,K:\overline{\tau}^{k}\to\mathsf{Ty},x:\overline{\sigma}^{j-1}\vdash\sigma_j:\mathsf{Ty}\rrbracket(\langle\epsilon(B),Y\rangle) ⟹ ⟨ π n ( v j ) , π n ( w j )⟩ ∈ [ [ Θ , K : τ k → Ty , x : σ j − 1 ⊢ σ j : Ty ] ] (⟨ ϵ ( B ) , Y ⟩)
By Lemma D.1 and the fact that π n ( a ) = π n ( b ) \pi_n(a)=\pi_n(b) π n ( a ) = π n ( b ) implies π m ( a ) = π m ( b ) \pi_m(a)=\pi_m(b) π m ( a ) = π m ( b ) for m ≤ n m\le n m ≤ n
⟹ ⟨ π n + 1 ( ⟨ C i , v j ‾ ⟩ ) , π n + 1 ( ⟨ C i , w j ‾ ⟩ ) ⟩ ∈ Φ B ( Y ) \Longrightarrow\langle\pi_{n+1}(\langle C_i,\overline{v_j}\rangle),\pi_{n+1}(\langle C_i,\overline{w_j}\rangle)\rangle\in\Phi_B(Y) ⟹ ⟨ π n + 1 (⟨ C i , v j ⟩) , π n + 1 (⟨ C i , w j ⟩)⟩ ∈ Φ B ( Y )
The other direction is symmetric. Hence if A n = B n A_n = B_n A n = B n and X n = Y n X_n = Y_n X n = Y n then Φ A ( X ) n + 1 = Φ B ( Y ) n + 1 \Phi_A(X)_{n+1} = \Phi_B(Y)_{n+1} Φ A ( X ) n + 1 = Φ B ( Y ) n + 1 ; in particular, taking A = B A=B A = B , each Φ C \Phi_C Φ C is contractive.
We show by induction on m m m that A n = B n A_n = B_n A n = B n implies Φ A m ( { ⟨ ⊥ , ⊥ ⟩ } ) n + 1 = Φ B m ( { ⟨ ⊥ , ⊥ ⟩ } ) n + 1 \Phi_A^m(\{\langle\bot,\bot\rangle\})_{n+1}=\Phi_B^m(\{\langle\bot,\bot\rangle\})_{n+1} Φ A m ({⟨ ⊥ , ⊥ ⟩} ) n + 1 = Φ B m ({⟨ ⊥ , ⊥ ⟩} ) n + 1 : the base case is trivial, and the inductive step follows from the previous argument, as agreement at level n + 1 n+1 n + 1 implies agreement at level n n n .
Since all CUPERs agree at level 0, contractivity of Φ C \Phi_C Φ C gives ( Φ C m ( S ) ) m = ( Φ C m ( { ⟨ ⊥ , ⊥ ⟩ } ) ) m (\Phi_C^m(S))_m=(\Phi_C^m(\{\langle\bot,\bot\rangle\}))_m ( Φ C m ( S ) ) m = ( Φ C m ({⟨ ⊥ , ⊥ ⟩}) ) m for every S S S by induction on m m m ; instantiating S S S with the fixed point, ( f i x X Φ C ( X ) ) m = ( Φ C m ( { ⟨ ⊥ , ⊥ ⟩ } ) ) m (\mathop{\mathrm{fix}}X\ \Phi_C(X))_m=(\Phi_C^m(\{\langle\bot,\bot\rangle\}))_m ( fix X Φ C ( X ) ) m = ( Φ C m ({⟨ ⊥ , ⊥ ⟩}) ) m . Taking m = n + 1 m=n+1 m = n + 1 , the two fixed points agree at level n + 1 n+1 n + 1 . Hence the operator is contractive.
Proof of Lemma 7.2. We use the following abbreviations
Δ ≜ Γ , K : κ , x : σ ‾ i \Delta\triangleq\Gamma,K:\kappa,x:\overline{\sigma}^{i} Δ ≜ Γ , K : κ , x : σ i
δ ( x ) = ⟨ γ , ⟨ x , P ⊥ ⟩ ⟩ , v ‾ i \delta(x)=\langle\gamma,\langle x,P_\bot\rangle\rangle,\overline{v}^{i} δ ( x ) = ⟨ γ , ⟨ x , P ⊥ ⟩⟩ , v i
by induction on the structure of Δ ⊢ ρ : μ \Delta\vdash\rho:\mu Δ ⊢ ρ : μ ,
⟦ Δ ⊢ B : T y ⟧ ( δ ( P ) ) = ⟦ Δ ⊢ B : T y ⟧ ( δ ( Q ) ) \llbracket\Delta\vdash B:\mathsf{Ty}\rrbracket(\delta(P))=\llbracket\Delta\vdash B:\mathsf{Ty}\rrbracket(\delta(Q)) [ [ Δ ⊢ B : Ty ] ] ( δ ( P )) = [ [ Δ ⊢ B : Ty ] ] ( δ ( Q ))
⟦ Δ ⊢ ( y : σ ) → ρ : T y ⟧ ( δ ( P ) ) = { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( δ ( P ) ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( P ) , v ⟩ ) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( ι Δ ( δ ( P ) ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ι Δ ( δ ( P ) ) ) } \llbracket\Delta\vdash(y:\sigma)\to\rho:\mathsf{Ty}\rrbracket(\delta(P))
=
\left\{
\langle f,g\rangle
\ \middle|\
\begin{aligned}
&\forall\langle v,w\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(P)).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(P),v\rangle)\\
&\forall\langle v_\bot,w_\bot\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\iota_\Delta(\delta(P))).\ \langle f\cdot v_\bot,g\cdot w_\bot\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\iota_\Delta(\delta(P)))
\end{aligned}
\right\} [ [ Δ ⊢ ( y : σ ) → ρ : Ty ] ] ( δ ( P )) = { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( δ ( P )) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( P ) , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( ι Δ ( δ ( P ))) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] ( ι Δ ( δ ( P ))) }
By I. H. ⟦ Δ ⊢ σ : T y ⟧ ( δ ( Q ) ) ⊆ ⟦ Δ ⊢ σ : T y ⟧ ( δ ( P ) ) \llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(Q))\subseteq\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(P)) [ [ Δ ⊢ σ : Ty ] ] ( δ ( Q )) ⊆ [ [ Δ ⊢ σ : Ty ] ] ( δ ( P ))
⊆ { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( δ ( Q ) ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( P ) , v ⟩ ) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( ι Δ ( δ ( P ) ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ι Δ ( δ ( P ) ) ) } \subseteq
\left\{
\langle f,g\rangle
\ \middle|\
\begin{aligned}
&\forall\langle v,w\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(Q)).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(P),v\rangle)\\
&\forall\langle v_\bot,w_\bot\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\iota_\Delta(\delta(P))).\ \langle f\cdot v_\bot,g\cdot w_\bot\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\iota_\Delta(\delta(P)))
\end{aligned}
\right\} ⊆ { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( δ ( Q )) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( P ) , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( ι Δ ( δ ( P ))) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] ( ι Δ ( δ ( P ))) }
Notice ι Δ ( δ ( P ) ) = ι Δ ( δ ( Q ) ) \iota_\Delta(\delta(P))=\iota_\Delta(\delta(Q)) ι Δ ( δ ( P )) = ι Δ ( δ ( Q ))
= { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( δ ( Q ) ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( P ) , v ⟩ ) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( ι Δ ( δ ( Q ) ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ι Δ ( δ ( Q ) ) ) } =
\left\{
\langle f,g\rangle
\ \middle|\
\begin{aligned}
&\forall\langle v,w\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(Q)).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(P),v\rangle)\\
&\forall\langle v_\bot,w_\bot\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\iota_\Delta(\delta(Q))).\ \langle f\cdot v_\bot,g\cdot w_\bot\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\iota_\Delta(\delta(Q)))
\end{aligned}
\right\} = { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( δ ( Q )) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( P ) , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( ι Δ ( δ ( Q ))) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] ( ι Δ ( δ ( Q ))) }
By I. H. ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( Q ) , v ⟩ ) ⊇ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( P ) , v ⟩ ) \llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(Q),v\rangle)\supseteq\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(P),v\rangle) [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( Q ) , v ⟩) ⊇ [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( P ) , v ⟩)
⊆ { ⟨ f , g ⟩ | ∀ ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( δ ( Q ) ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( Q ) , v ⟩ ) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( ι Δ ( δ ( Q ) ) ) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ι Δ ( δ ( Q ) ) ) } = ⟦ Δ ⊢ ( y : σ ) → ρ : T y ⟧ ( δ ( Q ) ) \begin{aligned}
\subseteq
\left\{
\langle f,g\rangle
\ \middle|\
\begin{aligned}
&\forall\langle v,w\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(Q)).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(Q),v\rangle)\\
&\forall\langle v_\bot,w_\bot\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\iota_\Delta(\delta(Q))).\ \langle f\cdot v_\bot,g\cdot w_\bot\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\iota_\Delta(\delta(Q)))
\end{aligned}
\right\} \\
&=\llbracket\Delta\vdash(y:\sigma)\to\rho:\mathsf{Ty}\rrbracket(\delta(Q))
\end{aligned} ⊆ { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( δ ( Q )) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( Q ) , v ⟩) ∀ ⟨ v ⊥ , w ⊥ ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( ι Δ ( δ ( Q ))) . ⟨ f ⋅ v ⊥ , g ⋅ w ⊥ ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] ( ι Δ ( δ ( Q ))) } = [ [ Δ ⊢ ( y : σ ) → ρ : Ty ] ] ( δ ( Q ))
⟦ Δ ⊢ ( y : σ ) → ρ : T y ⟧ ( δ ( Q ) ) = { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( δ ( Q ) ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( Q ) , v ⟩ ) ∀ ⟨ v 1 , w 1 ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( i Δ ( δ ( Q ) ) ) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( i Δ ( δ ( Q ) ) ) } \begin{aligned}
\llbracket\Delta\vdash(y:\sigma) \to\rho:\mathsf{Ty}\rrbracket(\delta(Q)) \\
&= \left\{\left\langle f,g\right\rangle\mathrel{\Big|} \begin{array}{l}
\forall\langle v,w\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(Q)).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(Q),v\rangle)\\
\forall\langle v_1,w_1\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(i_\Delta(\delta(Q))).\ \langle f\cdot v_1,g\cdot w_1\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(i_\Delta(\delta(Q)))
\end{array}\right\}
\end{aligned} [ [ Δ ⊢ ( y : σ ) → ρ : Ty ] ] ( δ ( Q )) = { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( δ ( Q )) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( Q ) , v ⟩) ∀ ⟨ v 1 , w 1 ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( i Δ ( δ ( Q ))) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] ( i Δ ( δ ( Q ))) }
By I. H. ⟦ Δ ⊢ σ : T y ⟧ ( δ ( P ) ) ⊆ ⟦ Δ ⊢ σ : T y ⟧ ( δ ( Q ) ) \llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(P))\subseteq\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(Q)) [ [ Δ ⊢ σ : Ty ] ] ( δ ( P )) ⊆ [ [ Δ ⊢ σ : Ty ] ] ( δ ( Q ))
⊆ { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( δ ( P ) ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( Q ) , v ⟩ ) ∀ ⟨ v 1 , w 1 ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( i Δ ( δ ( Q ) ) ) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( i Δ ( δ ( Q ) ) ) } \subseteq\left\{\left\langle f,g\right\rangle\mathrel{\Big|} \begin{array}{l}
\forall\langle v,w\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(P)).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(Q),v\rangle)\\
\forall\langle v_1,w_1\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(i_\Delta(\delta(Q))).\ \langle f\cdot v_1,g\cdot w_1\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(i_\Delta(\delta(Q)))
\end{array}\right\} ⊆ { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( δ ( P )) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( Q ) , v ⟩) ∀ ⟨ v 1 , w 1 ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( i Δ ( δ ( Q ))) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] ( i Δ ( δ ( Q ))) }
Notice i Δ ( δ ( P ) ) = i Δ ( δ ( Q ) ) i_\Delta(\delta(P))=i_\Delta(\delta(Q)) i Δ ( δ ( P )) = i Δ ( δ ( Q ))
= { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( δ ( P ) ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( Q ) , v ⟩ ) ∀ ⟨ v 1 , w 1 ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( i Δ ( δ ( P ) ) ) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( i Δ ( δ ( P ) ) ) } = \left\{\left\langle f,g\right\rangle\mathrel{\Big|} \begin{array}{l}
\forall\langle v,w\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(P)).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(Q),v\rangle)\\
\forall\langle v_1,w_1\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(i_\Delta(\delta(P))).\ \langle f\cdot v_1,g\cdot w_1\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(i_\Delta(\delta(P)))
\end{array}\right\} = { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( δ ( P )) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( Q ) , v ⟩) ∀ ⟨ v 1 , w 1 ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( i Δ ( δ ( P ))) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] ( i Δ ( δ ( P ))) }
By I. H. ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( Q ) , v ⟩ ) ⊇ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( P ) , v ⟩ ) \llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(Q),v\rangle)\supseteq\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(P),v\rangle) [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( Q ) , v ⟩) ⊇ [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( P ) , v ⟩)
⊆ { ⟨ f , g ⟩ ∣ ∀ ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( δ ( P ) ) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( ⟨ δ ( P ) , v ⟩ ) ∀ ⟨ v 1 , w 1 ⟩ ∈ ⟦ Δ ⊢ σ : T y ⟧ ( i Δ ( δ ( P ) ) ) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ ⟦ Δ , y : σ ⊢ ρ : T y ⟧ ( i Δ ( δ ( P ) ) ) } = ⟦ Δ ⊢ ( y : σ ) → ρ : T y ⟧ ( δ ( P ) ) \begin{aligned}
\subseteq\left\{\left\langle f,g\right\rangle\mathrel{\Big|} \begin{array}{l}
\forall\langle v,w\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(\delta(P)).\ \langle f\cdot v,g\cdot w\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(\langle\delta(P),v\rangle)\\
\forall\langle v_1,w_1\rangle\in\llbracket\Delta\vdash\sigma:\mathsf{Ty}\rrbracket(i_\Delta(\delta(P))).\ \langle f\cdot v_1,g\cdot w_1\rangle\in\llbracket\Delta,y:\sigma\vdash\rho:\mathsf{Ty}\rrbracket(i_\Delta(\delta(P)))
\end{array}\right\} \\
&= \llbracket\Delta\vdash(y:\sigma)\to\rho:\mathsf{Ty}\rrbracket(\delta(P))
\end{aligned} ⊆ { ⟨ f , g ⟩ ∀ ⟨ v , w ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( δ ( P )) . ⟨ f ⋅ v , g ⋅ w ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] (⟨ δ ( P ) , v ⟩) ∀ ⟨ v 1 , w 1 ⟩ ∈ [ [ Δ ⊢ σ : Ty ] ] ( i Δ ( δ ( P ))) . ⟨ f ⋅ v 1 , g ⋅ w 1 ⟩ ∈ [ [ Δ , y : σ ⊢ ρ : Ty ] ] ( i Δ ( δ ( P ))) } = [ [ Δ ⊢ ( y : σ ) → ρ : Ty ] ] ( δ ( P ))
⟦ Δ ⊢ ∀ x : κ . σ : T y ⟧ ( δ ( P ) ) = { ⟨ v , w ⟩ ∣ ∀ R ∈ ⟦ Δ ⊢ κ : K d ⟧ ( δ ( P ) ) , ∀ R L ∈ ⟦ Δ ⊢ κ : K d ⟧ ( i Δ ( δ ( P ) ) ) π Δ , κ ( δ ( P ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ ⟦ Δ , x : κ ⊢ σ : T y ⟧ ( ⟨ δ ( P ) , ⟨ R , R L ⟩ ⟩ ) } \begin{aligned}
\llbracket\Delta\vdash\forall x:\kappa.\sigma:\mathsf{Ty}\rrbracket(\delta(P)) \\
&= \left\{\left\langle v,w\right\rangle\mathrel{\Big|} \begin{array}{l}
\forall R\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(\delta(P)),\ \forall R_L\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(i_\Delta(\delta(P)))\\
\pi_{\Delta,\kappa}(\delta(P),R)\subseteq R_L\Rightarrow\langle v,w\rangle\in\llbracket\Delta,x:\kappa\vdash\sigma:\mathsf{Ty}\rrbracket(\langle\delta(P),\langle R,R_L\rangle\rangle)
\end{array}\right\}
\end{aligned} [ [ Δ ⊢ ∀ x : κ . σ : Ty ] ] ( δ ( P )) = { ⟨ v , w ⟩ ∀ R ∈ [ [ Δ ⊢ κ : Kd ] ] ( δ ( P )) , ∀ R L ∈ [ [ Δ ⊢ κ : Kd ] ] ( i Δ ( δ ( P ))) π Δ , κ ( δ ( P ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ [ [ Δ , x : κ ⊢ σ : Ty ] ] (⟨ δ ( P ) , ⟨ R , R L ⟩⟩) }
By Lemma E.1 and i Δ ( δ ( P ) ) = i Δ ( δ ( Q ) ) i_\Delta(\delta(P))=i_\Delta(\delta(Q)) i Δ ( δ ( P )) = i Δ ( δ ( Q ))
⊆ { ⟨ v , w ⟩ ∣ ∀ R ∈ ⟦ Δ ⊢ κ : K d ⟧ ( δ ( Q ) ) , ∀ R L ∈ ⟦ Δ ⊢ κ : K d ⟧ ( i Δ ( δ ( Q ) ) ) π Δ , κ ( δ ( Q ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ ⟦ Δ , x : κ ⊢ σ : T y ⟧ ( ⟨ δ ( P ) , ⟨ R , R L ⟩ ⟩ ) } \subseteq\left\{\left\langle v,w\right\rangle\mathrel{\Big|} \begin{array}{l}
\forall R\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(\delta(Q)),\ \forall R_L\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(i_\Delta(\delta(Q)))\\
\pi_{\Delta,\kappa}(\delta(Q),R)\subseteq R_L\Rightarrow\langle v,w\rangle\in\llbracket\Delta,x:\kappa\vdash\sigma:\mathsf{Ty}\rrbracket(\langle\delta(P),\langle R,R_L\rangle\rangle)
\end{array}\right\} ⊆ { ⟨ v , w ⟩ ∀ R ∈ [ [ Δ ⊢ κ : Kd ] ] ( δ ( Q )) , ∀ R L ∈ [ [ Δ ⊢ κ : Kd ] ] ( i Δ ( δ ( Q ))) π Δ , κ ( δ ( Q ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ [ [ Δ , x : κ ⊢ σ : Ty ] ] (⟨ δ ( P ) , ⟨ R , R L ⟩⟩) }
By I. H.
⊆ { ⟨ v , w ⟩ ∣ ∀ R ∈ ⟦ Δ ⊢ κ : K d ⟧ ( δ ( Q ) ) , ∀ R L ∈ ⟦ Δ ⊢ κ : K d ⟧ ( i Δ ( δ ( Q ) ) ) π Δ , κ ( δ ( Q ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ ⟦ Δ , x : κ ⊢ σ : T y ⟧ ( ⟨ δ ( Q ) , ⟨ R , R L ⟩ ⟩ ) } = ⟦ Δ ⊢ ∀ x : κ . σ : T y ⟧ ( δ ( Q ) ) \begin{aligned}
\subseteq\left\{\left\langle v,w\right\rangle\mathrel{\Big|} \begin{array}{l}
\forall R\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(\delta(Q)),\ \forall R_L\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(i_\Delta(\delta(Q)))\\
\pi_{\Delta,\kappa}(\delta(Q),R)\subseteq R_L\Rightarrow\langle v,w\rangle\in\llbracket\Delta,x:\kappa\vdash\sigma:\mathsf{Ty}\rrbracket(\langle\delta(Q),\langle R,R_L\rangle\rangle)
\end{array}\right\} \\
&= \llbracket\Delta\vdash\forall x:\kappa.\sigma:\mathsf{Ty}\rrbracket(\delta(Q))
\end{aligned} ⊆ { ⟨ v , w ⟩ ∀ R ∈ [ [ Δ ⊢ κ : Kd ] ] ( δ ( Q )) , ∀ R L ∈ [ [ Δ ⊢ κ : Kd ] ] ( i Δ ( δ ( Q ))) π Δ , κ ( δ ( Q ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ [ [ Δ , x : κ ⊢ σ : Ty ] ] (⟨ δ ( Q ) , ⟨ R , R L ⟩⟩) } = [ [ Δ ⊢ ∀ x : κ . σ : Ty ] ] ( δ ( Q ))
⟦ Δ ⊢ ∀ x : κ . σ : T y ⟧ ( δ ( Q ) ) = { ⟨ v , w ⟩ ∣ ∀ R ∈ ⟦ Δ ⊢ κ : K d ⟧ ( δ ( Q ) ) , ∀ R L ∈ ⟦ Δ ⊢ κ : K d ⟧ ( i Δ ( δ ( Q ) ) ) π Δ , κ ( δ ( Q ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ ⟦ Δ , x : κ ⊢ σ : T y ⟧ ( ⟨ δ ( Q ) , ⟨ R , R L ⟩ ⟩ ) } \begin{aligned}
\llbracket\Delta\vdash\forall x:\kappa.\sigma:\mathsf{Ty}\rrbracket(\delta(Q)) \\
&= \left\{\left\langle v,w\right\rangle\mathrel{\Big|} \begin{array}{l}
\forall R\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(\delta(Q)),\ \forall R_L\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(i_\Delta(\delta(Q)))\\
\pi_{\Delta,\kappa}(\delta(Q),R)\subseteq R_L\Rightarrow\langle v,w\rangle\in\llbracket\Delta,x:\kappa\vdash\sigma:\mathsf{Ty}\rrbracket(\langle\delta(Q),\langle R,R_L\rangle\rangle)
\end{array}\right\}
\end{aligned} [ [ Δ ⊢ ∀ x : κ . σ : Ty ] ] ( δ ( Q )) = { ⟨ v , w ⟩ ∀ R ∈ [ [ Δ ⊢ κ : Kd ] ] ( δ ( Q )) , ∀ R L ∈ [ [ Δ ⊢ κ : Kd ] ] ( i Δ ( δ ( Q ))) π Δ , κ ( δ ( Q ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ [ [ Δ , x : κ ⊢ σ : Ty ] ] (⟨ δ ( Q ) , ⟨ R , R L ⟩⟩) }
By Lemma E.1 and i Δ ( δ ( Q ) ) = i Δ ( δ ( P ) ) i_\Delta(\delta(Q))=i_\Delta(\delta(P)) i Δ ( δ ( Q )) = i Δ ( δ ( P ))
⊆ { ⟨ v , w ⟩ ∣ ∀ R ∈ ⟦ Δ ⊢ κ : K d ⟧ ( δ ( P ) ) , ∀ R L ∈ ⟦ Δ ⊢ κ : K d ⟧ ( i Δ ( δ ( P ) ) ) π Δ , κ ( δ ( P ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ ⟦ Δ , x : κ ⊢ σ : T y ⟧ ( ⟨ δ ( Q ) , ⟨ R , R L ⟩ ⟩ ) } \subseteq\left\{\left\langle v,w\right\rangle\mathrel{\Big|} \begin{array}{l}
\forall R\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(\delta(P)),\ \forall R_L\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(i_\Delta(\delta(P)))\\
\pi_{\Delta,\kappa}(\delta(P),R)\subseteq R_L\Rightarrow\langle v,w\rangle\in\llbracket\Delta,x:\kappa\vdash\sigma:\mathsf{Ty}\rrbracket(\langle\delta(Q),\langle R,R_L\rangle\rangle)
\end{array}\right\} ⊆ { ⟨ v , w ⟩ ∀ R ∈ [ [ Δ ⊢ κ : Kd ] ] ( δ ( P )) , ∀ R L ∈ [ [ Δ ⊢ κ : Kd ] ] ( i Δ ( δ ( P ))) π Δ , κ ( δ ( P ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ [ [ Δ , x : κ ⊢ σ : Ty ] ] (⟨ δ ( Q ) , ⟨ R , R L ⟩⟩) }
By I. H.
⊆ { ⟨ v , w ⟩ ∣ ∀ R ∈ ⟦ Δ ⊢ κ : K d ⟧ ( δ ( P ) ) , ∀ R L ∈ ⟦ Δ ⊢ κ : K d ⟧ ( i Δ ( δ ( P ) ) ) π Δ , κ ( δ ( P ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ ⟦ Δ , x : κ ⊢ σ : T y ⟧ ( ⟨ δ ( P ) , ⟨ R , R L ⟩ ⟩ ) } = ⟦ Δ ⊢ ∀ x : κ . σ : T y ⟧ ( δ ( P ) ) \begin{aligned}
\subseteq\left\{\left\langle v,w\right\rangle\mathrel{\Big|} \begin{array}{l}
\forall R\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(\delta(P)),\ \forall R_L\in\llbracket\Delta\vdash\kappa:\mathsf{Kd}\rrbracket(i_\Delta(\delta(P)))\\
\pi_{\Delta,\kappa}(\delta(P),R)\subseteq R_L\Rightarrow\langle v,w\rangle\in\llbracket\Delta,x:\kappa\vdash\sigma:\mathsf{Ty}\rrbracket(\langle\delta(P),\langle R,R_L\rangle\rangle)
\end{array}\right\} \\
&= \llbracket\Delta\vdash\forall x:\kappa.\sigma:\mathsf{Ty}\rrbracket(\delta(P))
\end{aligned} ⊆ { ⟨ v , w ⟩ ∀ R ∈ [ [ Δ ⊢ κ : Kd ] ] ( δ ( P )) , ∀ R L ∈ [ [ Δ ⊢ κ : Kd ] ] ( i Δ ( δ ( P ))) π Δ , κ ( δ ( P ) , R ) ⊆ R L ⇒ ⟨ v , w ⟩ ∈ [ [ Δ , x : κ ⊢ σ : Ty ] ] (⟨ δ ( P ) , ⟨ R , R L ⟩⟩) } = [ [ Δ ⊢ ∀ x : κ . σ : Ty ] ] ( δ ( P ))
⟦ Δ ⊢ x : T y ⟧ ( δ ( P ) ) = δ ( P ) ( x ) \llbracket\Delta\vdash x:\mathrm{Ty}\rrbracket(\delta(P))
= \delta(P)(x) [ [ Δ ⊢ x : Ty ] ] ( δ ( P )) = δ ( P ) ( x )
By assumption
⊆ / ⊇ δ ( Q ) ( x ) = ⟦ Δ ⊢ x : T y ⟧ ( δ ( Q ) ) \subseteq/\supseteq\delta(Q)(x)
= \llbracket\Delta\vdash x:\mathrm{Ty}\rrbracket(\delta(Q)) ⊆ / ⊇ δ ( Q ) ( x ) = [ [ Δ ⊢ x : Ty ] ] ( δ ( Q ))
⟦ Δ ⊢ σ : T y ⟧ ( δ ( P ) ) = { ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ τ : T y ⟧ ( δ ( P ) ) ∣ { Δ , x : τ ⊢ ϕ p r p } ( ⟨ δ ( P ) , v ⟩ ) } \llbracket\Delta\vdash\sigma:\mathrm{Ty}\rrbracket(\delta(P))
= \{\langle v,w\rangle\in\llbracket\Delta\vdash\tau:\mathrm{Ty}\rrbracket(\delta(P)) \mid\{\Delta,x:\tau\vdash\phi\ \mathrm{prp}\}(\langle\delta(P),v\rangle)\} [ [ Δ ⊢ σ : Ty ] ] ( δ ( P )) = {⟨ v , w ⟩ ∈ [ [ Δ ⊢ τ : Ty ] ] ( δ ( P )) ∣ { Δ , x : τ ⊢ ϕ prp } (⟨ δ ( P ) , v ⟩)}
Notice that { − } \{\!-\!\} { − } is invariant under kind assignments
= { ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ τ : T y ⟧ ( δ ( P ) ) ∣ { Δ , x : τ ⊢ ϕ p r p } ( ⟨ δ ( Q ) , v ⟩ ) } = \{\langle v,w\rangle\in\llbracket\Delta\vdash\tau:\mathrm{Ty}\rrbracket(\delta(P)) \mid\{\Delta,x:\tau\vdash\phi\ \mathrm{prp}\}(\langle\delta(Q),v\rangle)\} = {⟨ v , w ⟩ ∈ [ [ Δ ⊢ τ : Ty ] ] ( δ ( P )) ∣ { Δ , x : τ ⊢ ϕ prp } (⟨ δ ( Q ) , v ⟩)}
By I. H.
⊆ / ⊇ { ⟨ v , w ⟩ ∈ ⟦ Δ ⊢ τ : T y ⟧ ( δ ( Q ) ) ∣ { Δ , x : τ ⊢ ϕ p r p } ( ⟨ δ ( Q ) , v ⟩ ) } = ⟦ Δ ⊢ σ : T y ⟧ ( δ ( Q ) ) \subseteq/\supseteq\{\langle v,w\rangle\in\llbracket\Delta\vdash\tau:\mathrm{Ty}\rrbracket(\delta(Q)) \mid\{\Delta,x:\tau\vdash\phi\ \mathrm{prp}\}(\langle\delta(Q),v\rangle)\}
= \llbracket\Delta\vdash\sigma:\mathrm{Ty}\rrbracket(\delta(Q)) ⊆ / ⊇ {⟨ v , w ⟩ ∈ [ [ Δ ⊢ τ : Ty ] ] ( δ ( Q )) ∣ { Δ , x : τ ⊢ ϕ prp } (⟨ δ ( Q ) , v ⟩)} = [ [ Δ ⊢ σ : Ty ] ] ( δ ( Q ))
⟦ Δ ⊢ σ ⋅ t : κ ⟧ ( δ ( P ) ) = ⟦ Δ ⊢ σ : ( x : τ ) → κ ⟧ ( δ ( P ) ) ⋅ ⟦ t ⟧ ( ρ Δ ( δ ( P ) ) ) \llbracket\Delta\vdash\sigma\cdot t:\kappa\rrbracket(\delta(P))
= \llbracket\Delta\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\delta(P))\cdot\llbracket t\rrbracket(\rho_\Delta(\delta(P))) [ [ Δ ⊢ σ ⋅ t : κ ] ] ( δ ( P )) = [ [ Δ ⊢ σ : ( x : τ ) → κ ] ] ( δ ( P )) ⋅ [ [ t ] ] ( ρ Δ ( δ ( P )))
By noticing that ρ Δ ( δ ( P ) ) = ρ Δ ( δ ( Q ) ) \rho_\Delta(\delta(P))=\rho_\Delta(\delta(Q)) ρ Δ ( δ ( P )) = ρ Δ ( δ ( Q ))
= ⟦ Δ ⊢ σ : ( x : τ ) → κ ⟧ ( δ ( P ) ) ⋅ ⟦ t ⟧ ( ρ Δ ( δ ( Q ) ) ) = \llbracket\Delta\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\delta(P))\cdot\llbracket t\rrbracket(\rho_\Delta(\delta(Q))) = [ [ Δ ⊢ σ : ( x : τ ) → κ ] ] ( δ ( P )) ⋅ [ [ t ] ] ( ρ Δ ( δ ( Q )))
By I. H.
≤ / ≥ ⟦ Δ ⊢ σ : ( x : τ ) → κ ⟧ ( δ ( Q ) ) ⋅ ⟦ t ⟧ ( ρ Δ ( δ ( Q ) ) ) = ⟦ Δ ⊢ σ ⋅ t : T y ⟧ ( δ ( Q ) ) \leq/\geq\llbracket\Delta\vdash\sigma:(x:\tau)\to\kappa\rrbracket(\delta(Q))\cdot\llbracket t\rrbracket(\rho_\Delta(\delta(Q)))
= \llbracket\Delta\vdash\sigma\cdot t:\mathrm{Ty}\rrbracket(\delta(Q)) ≤ / ≥ [ [ Δ ⊢ σ : ( x : τ ) → κ ] ] ( δ ( Q )) ⋅ [ [ t ] ] ( ρ Δ ( δ ( Q ))) = [ [ Δ ⊢ σ ⋅ t : Ty ] ] ( δ ( Q ))
\begin{aligned}
\llbracket\Delta\vdash\mu K^{\langle\nu\rangle}\left\{C:(y:\overline{\sigma}^{\,j})\to K\cdot\overline{t}^{\,k}_{i}\right\}:\overline{\tau}^{\,k}\to\mathrm{Ty}\rrbracket(\delta(P)) \\
&= \operatorname{lfp}_{X}(\overline{q}^{\,k}\mapsto\bigcup\{\{\langle c_i,\overline{v}_i\rangle,\langle c_i,\overline{w}_i\rangle\}\,\middle|\,\langle v_j,w_j\rangle\in\llbracket\Delta,K:\!K^{k}\to\mathrm{Ty},x:\tau^{j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\delta(P)),\ X,\Delta\vdash\mu K^{\langle\nu\rangle}\{C:(y:\overline{\sigma}^{\,j})\to K\cdot\overline{t}^{\,k}_{i}\}:\overline{\tau}^{\,k}\to\mathrm{Ty}\rrbracket(\iota_\Delta(\delta(P))),\overline{v}_{j-1}\}\})
\end{aligned}
\begin{aligned}
\llbracket\Delta\vdash\mu K^{\langle\nu\rangle}\left\{C:(y:\overline{\sigma}^{\,j})\to K\cdot\overline{t}^{\,k}_{i}\right\}:\overline{\tau}^{\,k}\to\mathrm{Ty}\rrbracket(\delta(Q)) \\
&= \operatorname{lfp}_{X}(\overline{q}^{\,k}\mapsto\bigcup\{\{\langle c_i,\overline{v}_i\rangle,\langle c_i,\overline{w}_i\rangle\}\,\middle|\,\langle v_j,w_j\rangle\in\llbracket\Delta,K:\!K^{k}\to\mathrm{Ty},x:\tau^{j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\delta(Q)),\ X,\Delta\vdash\mu K^{\langle\nu\rangle}\{C:(y:\overline{\sigma}^{\,j})\to K\cdot\overline{t}^{\,k}_{i}\}:\overline{\tau}^{\,k}\to\mathrm{Ty}\rrbracket(\iota_\Delta(\delta(Q))),\overline{v}_{j-1}\}\})
\end{aligned}
Since they are both defined as the least fixed point of a monotone functional, it suffices to show that for all X X X the functionals respect ≤ / ≥ \leq/\geq ≤ / ≥ pointwise; for this it is enough to show that each component of the functional respects the order ≤ / ≥ \leq/\geq ≤ / ≥ :
⟦ Δ , K : K k → T y , x : τ ‾ j − 1 ⊢ σ j : T y ⟧ ( δ ( P ) ) , X , Δ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ ‾ j ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( ι Δ ( δ ( P ) ) ) , v ‾ j − 1 \llbracket\Delta,K:\!K^{k}\to\mathrm{Ty},x:\overline{\tau}^{\,j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\delta(P)),\ X,\Delta\vdash\mu K^{\langle\nu\rangle}\left\{C:(y:\overline{\sigma}^{\,j})\to K\cdot\overline{t}^{\,k}_{i}\right\}:\overline{\tau}^{\,k}\to\mathrm{Ty}\rrbracket(\iota_\Delta(\delta(P))),\overline{v}_{j-1} [ [ Δ , K : K k → Ty , x : τ j − 1 ⊢ σ j : Ty ] ] ( δ ( P )) , X , Δ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → Ty ] ] ( ι Δ ( δ ( P ))) , v j − 1
⊆ / ⊇ \subseteq/\supseteq ⊆ / ⊇
⟦ Δ , K : K k → T y , x : τ ‾ j − 1 ⊢ σ j : T y ⟧ ( δ ( Q ) ) , X , Δ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ ‾ j ) → K ⋅ t ‾ i k } : τ ‾ k → T y ⟧ ( ι Δ ( δ ( Q ) ) ) , v ‾ j − 1 \llbracket\Delta,K:\!K^{k}\to\mathrm{Ty},x:\overline{\tau}^{\,j-1}\vdash\sigma_j:\mathrm{Ty}\rrbracket(\delta(Q)),\ X,\Delta\vdash\mu K^{\langle\nu\rangle}\left\{C:(y:\overline{\sigma}^{\,j})\to K\cdot\overline{t}^{\,k}_{i}\right\}:\overline{\tau}^{\,k}\to\mathrm{Ty}\rrbracket(\iota_\Delta(\delta(Q))),\overline{v}_{j-1} [ [ Δ , K : K k → Ty , x : τ j − 1 ⊢ σ j : Ty ] ] ( δ ( Q )) , X , Δ ⊢ μ K ⟨ ν ⟩ { C : ( y : σ j ) → K ⋅ t i k } : τ k → Ty ] ] ( ι Δ ( δ ( Q ))) , v j − 1
which follows from the I. H. and the fact that ρ Δ ( δ ( P ) ) = ρ Δ ( δ ( Q ) ) \rho_\Delta(\delta(P))=\rho_\Delta(\delta(Q)) ρ Δ ( δ ( P )) = ρ Δ ( δ ( Q )) and ι Δ ( δ ( P ) ) = ι Δ ( δ ( Q ) ) \iota_\Delta(\delta(P))=\iota_\Delta(\delta(Q)) ι Δ ( δ ( P )) = ι Δ ( δ ( Q ))
Ty-IndStrat when p ∈ { + , − } p \in\{+,-\} p ∈ { + , − } the only possible case is that pol K ( − ) = o \operatorname{pol}_{K}(-)=o pol K ( − ) = o and hence
[ Δ ⊢ μ K { m } { C : ( y : σ ‾ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ] ( δ ( P ) ) = [ Δ ⊢ μ K { m } { C : ( y : σ ‾ j ‾ ) → K ⋅ t ‾ i k } : τ ‾ k → T y ] ( δ ( Q ) ) \begin{aligned}
\left[\Delta\vdash\mu K^{\{m\}}\left\{C:(\overline{y:\overline{\sigma}^{j}})\to K\cdot\overline{t}_{i}^{k}\right\}:\overline{\tau}^{k}\to\mathrm{Ty}\right](\delta(P)) \\
&=\left[\Delta\vdash\mu K^{\{m\}}\left\{C:(\overline{y:\overline{\sigma}^{j}})\to K\cdot\overline{t}_{i}^{k}\right\}:\overline{\tau}^{k}\to\mathrm{Ty}\right](\delta(Q))
\end{aligned} [ Δ ⊢ μ K { m } { C : ( y : σ j ) → K ⋅ t i k } : τ k → Ty ] ( δ ( P )) = [ Δ ⊢ μ K { m } { C : ( y : σ j ) → K ⋅ t i k } : τ k → Ty ] ( δ ( Q ))
as the semantics of the kind is independent of the refined kind assignment of K K K .
Proof of Lemma E.1. We use the following abbreviations
Δ ≜ Γ \Delta\mathrel{\triangleq}\Gamma Δ ≜ Γ , K ∗ : μ K_{*:\mu} K ∗ : μ , x : σ ‾ i \overline{x:\sigma}^{i} x : σ i
δ ( x ) = ⟨ γ , ⟨ x , P ⊥ ⟩ , v ‾ i ⟩ \delta(x)=\langle\gamma,\langle x,P_{\perp}\rangle,\overline{v}^{i}\rangle δ ( x ) = ⟨ γ , ⟨ x , P ⊥ ⟩ , v i ⟩
We prove the case for p = − p=- p = − , the case for p = + p=+ p = + is identical but with the inequalities reversed. First, we notice that all kinds we have τ ‾ k → T y \overline{\tau}^{k}\to\mathrm{Ty} τ k → Ty , thus if pol K ( κ ) ≤ − \operatorname{pol}_{K}(\kappa)\leq- pol K ( κ ) ≤ − then ∀ κ ′ pol K ( τ κ ) ≤ + \forall\kappa'\operatorname{pol}_{K}(\tau_{\kappa})\leq+ ∀ κ ′ pol K ( τ κ ) ≤ + . Now, we can proceed by induction on k k k :
k = 0 k=0 k = 0 , then κ = T y \kappa=\mathrm{Ty} κ = Ty , and [ Δ ⊢ T y : K d ] ( δ ( P ) ) = P E R ( D ) = [ Δ ⊢ T y : K d ] ( δ ( Q ) ) \left[\Delta\vdash\mathrm{Ty}:\mathrm{Kd}\right](\delta(P))=\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D})=\left[\Delta\vdash\mathrm{Ty}:\mathrm{Kd}\right](\delta(Q)) [ Δ ⊢ Ty : Kd ] ( δ ( P )) = P E R ( D ) = [ Δ ⊢ Ty : Kd ] ( δ ( Q )) .
k > 0 k>0 k > 0 , then κ = τ → κ \kappa=\tau\to\kappa κ = τ → κ , and
\begin{aligned}
\left[\Delta\vdash\tau\to\kappa:\mathrm{Kd}\right](\delta(P)) \\
&=\{f\ \middle|\
\begin{aligned}
&f\in\mathcal{D}\to(\mathcal{D}\to)^{\operatorname{arity}(\kappa)}\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D})\\
&\forall v\in\operatorname{dom}([\Delta\vdash\tau:\mathrm{Ty}](\delta(P)))\ f(v)\in[\Delta,x:\tau\vdash\kappa:\mathrm{Kd}](\langle\delta(P),v\rangle)\\
&|\forall\langle v,w\rangle\in([\Delta\vdash\tau:\mathrm{Ty}](\iota_{\Delta}(\delta(P)))\cap\operatorname{dom}([\Delta\vdash\tau:\mathrm{Ty}](\delta(P))^{2}))\ f(v)=f(w)
\end{aligned}
\}
\end{aligned}
By Lemma 7.2 and ι Δ ( δ ( P ) ) = ι Δ ( δ ( Q ) ) \iota_{\Delta}(\delta(P))=\iota_{\Delta}(\delta(Q)) ι Δ ( δ ( P )) = ι Δ ( δ ( Q ))
\supseteq\{f\ \middle|\
\begin{aligned}
&f\in\mathcal{D}\to(\mathcal{D}\to)^{\operatorname{arity}(\kappa)}\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D})\\
&\forall v\in\operatorname{dom}([\Delta\vdash\tau:\mathrm{Ty}](\delta(Q)))\ f(v)\in[\Delta,x:\tau\vdash\kappa:\mathrm{Kd}](\langle\delta(P),v\rangle)\\
&|\forall\langle v,w\rangle\in([\Delta\vdash\tau:\mathrm{Ty}](\iota_{\Delta}(\delta(Q)))\cap\operatorname{dom}([\Delta\vdash\tau:\mathrm{Ty}](\delta(Q))^{2}))\ f(v)=f(w)
\end{aligned}
\}
By I. H.
\begin{aligned}
\supseteq\{f\ \middle|\
\begin{aligned}
&f\in\mathcal{D}\to(\mathcal{D}\to)^{\operatorname{arity}(\kappa)}\mathcal{P}\mathcal{E}\mathcal{R}(\mathcal{D})\\
&\forall v\in\operatorname{dom}([\Delta\vdash\tau:\mathrm{Ty}](\delta(Q)))\ f(v)\in[\Delta,x:\tau\vdash\kappa:\mathrm{Kd}](\langle\delta(Q),v\rangle)\\
&|\forall\langle v,w\rangle\in([\Delta\vdash\tau:\mathrm{Ty}](\iota_{\Delta}(\delta(Q)))\cap\operatorname{dom}([\Delta\vdash\tau:\mathrm{Ty}](\delta(Q))^{2}))\ f(v)=f(w)
\end{aligned}
\} \\
&=\left[\Delta\vdash\tau\to\kappa:\mathrm{Kd}\right](\delta(Q))
\end{aligned}
Proof of Lemma 7.3. By induction on the structure of τ \tau τ :
⟨ tmEl K ; r ( K ⋅ t ‾ k , γ ρ ( m ‾ ) ( γ ρ ) ) , tmEl K ; r ′ ( K ⋅ t ‾ k , δ ρ ( m ‾ ) ( δ ρ ) ) ⟩ = ⟨ r ⋅ ( t ‾ ) ( γ ρ ) − k ⋅ ( m ‾ ) ( γ ρ ) , r ′ ⋅ ( t ‾ ) ( δ ρ ) − k ⋅ ( m ‾ ) ( δ ρ ) ⟩ \begin{aligned}
\left\langle
\begin{array}{c}
\operatorname{tmEl}_{K;r}(K\cdot\overline{t}^{k},\gamma_{\rho}(\overline{m})(\gamma_{\rho})),\\
\operatorname{tmEl}_{K;r'}(K\cdot\overline{t}^{k},\delta_{\rho}(\overline{m})(\delta_{\rho}))
\end{array}
\right\rangle\\
&=\left\langle
\begin{array}{c}
r\cdot(\overline{t})(\gamma_{\rho})^{-k}\cdot(\overline{m})(\gamma_{\rho}),\\
r'\cdot(\overline{t})(\delta_{\rho})^{-k}\cdot(\overline{m})(\delta_{\rho})
\end{array}
\right\rangle
\end{aligned} ⟨ tmEl K ; r ( K ⋅ t k , γ ρ ( m ) ( γ ρ )) , tmEl K ; r ′ ( K ⋅ t k , δ ρ ( m ) ( δ ρ )) ⟩ = ⟨ r ⋅ ( t ) ( γ ρ ) − k ⋅ ( m ) ( γ ρ ) , r ′ ⋅ ( t ) ( δ ρ ) − k ⋅ ( m ) ( δ ρ ) ⟩
As m : K ⋅ t ‾ k m:K\cdot\overline{t}^{k} m : K ⋅ t k gives ( m ‾ ) ∈ P ⋅ ( t ‾ ) − k (\overline{m})\in P\cdot(\overline{t})^{-k} ( m ) ∈ P ⋅ ( t ) − k , the realizer hypothesis yields
∈ [ Γ , x : τ ‾ k , y : D ‾ x ‾ k ⊢ ρ : T y ] ( ⟨ γ , ( t ‾ ) ( γ ρ ) , ( m ‾ ) ( γ ρ ) ⟩ ) \in\left[\Gamma,x:\overline{\tau}^{k},y:\overline{D}\ \overline{x}^{k}\vdash\rho:\mathrm{Ty}\right]\left(\left\langle\gamma,(\overline{t})(\gamma_{\rho}),(\overline{m})(\gamma_{\rho})\right\rangle\right) ∈ [ Γ , x : τ k , y : D x k ⊢ ρ : Ty ] ( ⟨ γ , ( t ) ( γ ρ ) , ( m ) ( γ ρ ) ⟩ )
By Lemma C.5
= [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , K ⋅ t ‾ k ) : T y ] ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , v ‾ j − 1 ⟩ ) =\left[\Gamma,\Delta(j-1)\vdash\operatorname{El}_{K;\rho}(m,K\cdot\overline{t}^{k}):\mathrm{Ty}\right]\left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\overline{v}^{j-1}\right\rangle\right) = [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , K ⋅ t k ) : Ty ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , v j − 1 ⟩ )
⟨ tmEl K ; r ( τ , γ ρ , ( m ) ( γ ρ ) ) , tmEl K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ ⋆ , ⋆ ⟩ \left\langle
\begin{array}{l}
\operatorname{tmEl}_{K;r}(\tau,\gamma_{\rho},(\mathbf{m})(\gamma_{\rho})),\\
\operatorname{tmEl}_{K;r'}(\tau,\delta_{\rho},(\mathbf{m})(\delta_{\rho}))
\end{array}
\right\rangle
=\langle\star,\star\rangle ⟨ tmEl K ; r ( τ , γ ρ , ( m ) ( γ ρ )) , tmEl K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ )) ⟩ = ⟨ ⋆ , ⋆ ⟩
∈ ⟦ Γ , Δ ( j − 1 ) ⊢ Unit : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , ν ˉ j − 1 ⟩ ) = ⟦ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , τ ) : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , ν ˉ j − 1 ⟩ ) \begin{aligned}
\in\llbracket\Gamma,\Delta(j-1)\vdash\operatorname{Unit}:\mathsf{Ty}\rrbracket
\left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\bar{\nu}^{j-1}\right\rangle\right) \\
&=\llbracket\Gamma,\Delta(j-1)\vdash\operatorname{El}_{K;\rho}(\mathbf{m},\tau):\mathsf{Ty}\rrbracket
\left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\bar{\nu}^{j-1}\right\rangle\right)
\end{aligned} ∈ [ [ Γ , Δ ( j − 1 ) ⊢ Unit : Ty ] ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , ν ˉ j − 1 ⟩ ) = [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , τ ) : Ty ] ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , ν ˉ j − 1 ⟩ )
⟨ tmEl K ; r ( { x : τ ∣ ϕ } , γ ρ , ( m ) ( γ ρ ) ) , tmEl K ; r ′ ( { x : τ ∣ ϕ } , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ tmEl K ; r ( τ , γ ρ , ( m ) ( γ ρ ) ) , tmEl K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ ) ) ⟩ \left\langle
\begin{array}{l}
\operatorname{tmEl}_{K;r}(\{x:\tau\mid\phi\},\gamma_{\rho},(\mathbf{m})(\gamma_{\rho})),\\
\operatorname{tmEl}_{K;r'}(\{x:\tau\mid\phi\},\delta_{\rho},(\mathbf{m})(\delta_{\rho}))
\end{array}
\right\rangle
=
\left\langle
\begin{array}{l}
\operatorname{tmEl}_{K;r}(\tau,\gamma_{\rho},(\mathbf{m})(\gamma_{\rho})),\\
\operatorname{tmEl}_{K;r'}(\tau,\delta_{\rho},(\mathbf{m})(\delta_{\rho}))
\end{array}
\right\rangle ⟨ tmEl K ; r ({ x : τ ∣ ϕ } , γ ρ , ( m ) ( γ ρ )) , tmEl K ; r ′ ({ x : τ ∣ ϕ } , δ ρ , ( m ) ( δ ρ )) ⟩ = ⟨ tmEl K ; r ( τ , γ ρ , ( m ) ( γ ρ )) , tmEl K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ )) ⟩
By induction hypothesis
∈ ⟦ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , τ ) : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , ν ˉ j − 1 ⟩ ) = ⟦ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , { x : τ ∣ ϕ } ) : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , ν ˉ j − 1 ⟩ ) \begin{aligned}
\in\llbracket\Gamma,\Delta(j-1)\vdash\operatorname{El}_{K;\rho}(\mathbf{m},\tau):\mathsf{Ty}\rrbracket
\left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\bar{\nu}^{j-1}\right\rangle\right) \\
&=\llbracket\Gamma,\Delta(j-1)\vdash\operatorname{El}_{K;\rho}(\mathbf{m},\{x:\tau\mid\phi\}):\mathsf{Ty}\rrbracket
\left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\bar{\nu}^{j-1}\right\rangle\right)
\end{aligned} ∈ [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , τ ) : Ty ] ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , ν ˉ j − 1 ⟩ ) = [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , { x : τ ∣ ϕ }) : Ty ] ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , ν ˉ j − 1 ⟩ )
If τ = x : τ → σ \tau=x:\tau\to\sigma τ = x : τ → σ Fixed ⟨ q , n ⟩ ∈ ⟦ Γ , Δ ( j − 1 ) ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , ν ˉ j − 1 ⟩ ) \langle q,n\rangle\in\llbracket\Gamma,\Delta(j-1)\vdash\tau:\mathsf{Ty}\rrbracket\left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\bar{\nu}^{j-1}\right\rangle\right) ⟨ q , n ⟩ ∈ [ [ Γ , Δ ( j − 1 ) ⊢ τ : Ty ] ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , ν ˉ j − 1 ⟩ ) by I.H.
(i) ⟨ tmEl K ; r ( σ , ⟨ γ ρ , q ⟩ , ( m ⋅ x ) ( ⟨ γ ρ , q ⟩ ) ) , tmEl K ; r ′ ( σ , ⟨ δ ρ , n ⟩ , ( m ⋅ x ) ( ⟨ δ ρ , n ⟩ ) ) ⟩ \text{(i)}\quad
\left\langle
\begin{array}{l}
\operatorname{tmEl}_{K;r}(\sigma,\langle\gamma_{\rho},q\rangle,(\mathbf{m}\cdot x)(\langle\gamma_{\rho},q\rangle)),\\
\operatorname{tmEl}_{K;r'}(\sigma,\langle\delta_{\rho},n\rangle,(\mathbf{m}\cdot x)(\langle\delta_{\rho},n\rangle))
\end{array}
\right\rangle (i) ⟨ tmEl K ; r ( σ , ⟨ γ ρ , q ⟩ , ( m ⋅ x ) (⟨ γ ρ , q ⟩)) , tmEl K ; r ′ ( σ , ⟨ δ ρ , n ⟩ , ( m ⋅ x ) (⟨ δ ρ , n ⟩)) ⟩
∈ ⟦ Γ , Δ ( j − 1 ) , x : τ ⊢ El K ; ρ ( m ⋅ x , σ ) : T y ⟧ ( ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ ⟩ , ν ˉ j − 1 ⟩ , q ) \in\llbracket\Gamma,\Delta(j-1),x:\tau\vdash\operatorname{El}_{K;\rho}(\mathbf{m}\cdot x,\sigma):\mathsf{Ty}\rrbracket
\left(\left\langle\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle\right\rangle,\bar{\nu}^{j-1}\right\rangle,q\right) ∈ [ [ Γ , Δ ( j − 1 ) , x : τ ⊢ El K ; ρ ( m ⋅ x , σ ) : Ty ] ] ( ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ ⟩ , ν ˉ j − 1 ⟩ , q )
And fixed ⟨ q 1 , n 1 ⟩ ∈ ⟦ Γ , Δ ( j − 1 ) ⊢ τ : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , ν ˉ j − 1 ⟩ ) \langle q_{1},n_{1}\rangle\in\llbracket\Gamma,\Delta(j-1)\vdash\tau:\mathsf{Ty}\rrbracket\left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\bar{\nu}^{j-1}\right\rangle\right) ⟨ q 1 , n 1 ⟩ ∈ [ [ Γ , Δ ( j − 1 ) ⊢ τ : Ty ] ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , ν ˉ j − 1 ⟩ ) by Lemma E.2
(ii) ⟨ tmEl K ; r ( σ , ⟨ γ ρ , q 1 ⟩ , ( m ⋅ x ) ( ⟨ γ ρ , q 1 ⟩ ) ) , tmEl K ; r ′ ( σ , ⟨ δ ρ , n 1 ⟩ , ( m ⋅ x ) ( ⟨ δ ρ , n 1 ⟩ ) ) ⟩ \text{(ii)}\quad
\left\langle
\begin{array}{l}
\operatorname{tmEl}_{K;r}(\sigma,\langle\gamma_{\rho},q_{1}\rangle,(\mathbf{m}\cdot x)(\langle\gamma_{\rho},q_{1}\rangle)),\\
\operatorname{tmEl}_{K;r'}(\sigma,\langle\delta_{\rho},n_{1}\rangle,(\mathbf{m}\cdot x)(\langle\delta_{\rho},n_{1}\rangle))
\end{array}
\right\rangle (ii) ⟨ tmEl K ; r ( σ , ⟨ γ ρ , q 1 ⟩ , ( m ⋅ x ) (⟨ γ ρ , q 1 ⟩)) , tmEl K ; r ′ ( σ , ⟨ δ ρ , n 1 ⟩ , ( m ⋅ x ) (⟨ δ ρ , n 1 ⟩)) ⟩
∈ ⟦ Γ , Δ ( j − 1 ) , x : τ ⊢ El K ; ρ ( m ⋅ x , σ ) : T y ⟧ ( ⟨ ⟦ Γ , Δ ( j − 1 ) ⟧ ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , ν ˉ j − 1 ⟩ ) , q 1 ⟩ ) \in\llbracket\Gamma,\Delta(j-1),x:\tau\vdash\operatorname{El}_{K;\rho}(\mathbf{m}\cdot x,\sigma):\mathsf{Ty}\rrbracket
\left(\left\langle\llbracket\Gamma,\Delta(j-1)\rrbracket
\left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\bar{\nu}^{j-1}\right\rangle\right),q_{1}\right\rangle\right) ∈ [ [ Γ , Δ ( j − 1 ) , x : τ ⊢ El K ; ρ ( m ⋅ x , σ ) : Ty ] ] ( ⟨ [ [ Γ , Δ ( j − 1 ) ] ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , ν ˉ j − 1 ⟩ ) , q 1 ⟩ )
Hence,
⟨ tmEl K ; r ( x : τ → σ , γ ρ , ( m ) ( γ ρ ) ) , tmEl K ; r ′ ( x : τ → σ , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ i ↦ ( q ↦ tmEl K ; r ( σ , ⟨ γ ρ , q ⟩ , ( m ) ( γ ρ ) ⋅ q ) ) , i ↦ ( q ↦ tmEl K ; r ′ ( σ , ⟨ δ ρ , q ⟩ , ( m ) ( δ ρ ) ⋅ q ) ) ⟩ \left\langle
\begin{array}{l}
\operatorname{tmEl}_{K;r}(x:\tau\to\sigma,\gamma_{\rho},(\mathbf{m})(\gamma_{\rho})),\\
\operatorname{tmEl}_{K;r'}(x:\tau\to\sigma,\delta_{\rho},(\mathbf{m})(\delta_{\rho}))
\end{array}
\right\rangle
=
\left\langle
\begin{array}{l}
i\mapsto(q\mapsto\operatorname{tmEl}_{K;r}(\sigma,\langle\gamma_{\rho},q\rangle,(\mathbf{m})(\gamma_{\rho})\cdot q)),\\
i\mapsto(q\mapsto\operatorname{tmEl}_{K;r'}(\sigma,\langle\delta_{\rho},q\rangle,(\mathbf{m})(\delta_{\rho})\cdot q))
\end{array}
\right\rangle ⟨ tmEl K ; r ( x : τ → σ , γ ρ , ( m ) ( γ ρ )) , tmEl K ; r ′ ( x : τ → σ , δ ρ , ( m ) ( δ ρ )) ⟩ = ⟨ i ↦ ( q ↦ tmEl K ; r ( σ , ⟨ γ ρ , q ⟩ , ( m ) ( γ ρ ) ⋅ q )) , i ↦ ( q ↦ tmEl K ; r ′ ( σ , ⟨ δ ρ , q ⟩ , ( m ) ( δ ρ ) ⋅ q )) ⟩
We notice that ( t ⋅ x ) ( ⟨ γ , ν ⟩ ) = ( t ) ( γ ) ⋅ ν (t\cdot x)(\langle\gamma,\nu\rangle)=(t)(\gamma)\cdot\nu ( t ⋅ x ) (⟨ γ , ν ⟩) = ( t ) ( γ ) ⋅ ν if x x x is the last bound variable
= ⟨ i ↦ ( q ↦ tmEl K ; r ( σ , ⟨ γ ρ , q ⟩ , ( m ⋅ x ) ( ⟨ γ ρ , q ⟩ ) ) ) , i ↦ ( q ↦ tmEl K ; r ′ ( σ , ⟨ δ ρ , q ⟩ , ( m ⋅ x ) ( ⟨ δ ρ , q ⟩ ) ) ) ⟩ =
\left\langle
\begin{array}{l}
i\mapsto(q\mapsto\operatorname{tmEl}_{K;r}(\sigma,\langle\gamma_{\rho},q\rangle,(\mathbf{m}\cdot x)(\langle\gamma_{\rho},q\rangle))),\\
i\mapsto(q\mapsto\operatorname{tmEl}_{K;r'}(\sigma,\langle\delta_{\rho},q\rangle,(\mathbf{m}\cdot x)(\langle\delta_{\rho},q\rangle)))
\end{array}
\right\rangle = ⟨ i ↦ ( q ↦ tmEl K ; r ( σ , ⟨ γ ρ , q ⟩ , ( m ⋅ x ) (⟨ γ ρ , q ⟩))) , i ↦ ( q ↦ tmEl K ; r ′ ( σ , ⟨ δ ρ , q ⟩ , ( m ⋅ x ) (⟨ δ ρ , q ⟩))) ⟩
By (i) and (ii)
∈ ⟦ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , x : τ → σ ) : T y ⟧ ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , ν ˉ j − 1 ⟩ ) \in\llbracket\Gamma,\Delta(j-1)\vdash\operatorname{El}_{K;\rho}(\mathbf{m},x:\tau\to\sigma):\mathsf{Ty}\rrbracket
\left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\bar{\nu}^{j-1}\right\rangle\right) ∈ [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , x : τ → σ ) : Ty ] ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , ν ˉ j − 1 ⟩ )
First, we notice that for any Q ∈ [ Γ , Δ ( j − 1 ) ⊢ κ : K d ] ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , v ‾ j − 1 ⟩ ) Q \in[\Gamma, \Delta(j-1) \vdash\kappa:\mathrm{K}d] \left(\left\langle\gamma, \langle P, P_{\perp}(\gamma)\rangle, \overline{v}^{j-1}\right\rangle\right) Q ∈ [ Γ , Δ ( j − 1 ) ⊢ κ : K d ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , v j − 1 ⟩ ) , Q ⊥ ∈ [ Γ , Δ ( j − 1 ) ⊢ κ : K d ] ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , v ‾ j − 1 ⟩ ) Q_{\perp} \in[\Gamma, \Delta(j-1) \vdash\kappa:\mathrm{K}d] \left(\left\langle\gamma, \langle P, P_{\perp}(\gamma)\rangle, \overline{v}^{j-1}\right\rangle\right) Q ⊥ ∈ [ Γ , Δ ( j − 1 ) ⊢ κ : K d ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , v j − 1 ⟩ ) , by IH
⟨ t m E l K ; r ( τ , ρ Γ , Δ ( j − 1 ) , x : κ ( ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , v ‾ j − 1 ⟩ , ⟨ Q , Q ⊥ ⟩ ⟩ ) , ( m ⋅ x ) ( γ ρ ) ) , t m E l K ; r ′ ( τ , ρ Γ , Δ ( j − 1 ) , x : κ ( ⟨ ⟨ δ , ⟨ P , P ⊥ ( δ ) ⟩ , w ‾ j − 1 ⟩ , ⟨ Q , Q ⊥ ⟩ ⟩ ) , ( m ⋅ x ) ( δ ρ ) ) ⟩ \left\langle
\begin{aligned}
&\mathrm{tmEl}_{K;r}\left(\tau,\rho_{\Gamma,\Delta(j-1),x:\kappa}\left(\left\langle\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\overline{v}^{j-1}\right\rangle,\langle Q,Q_{\perp}\rangle\right\rangle\right),(\mathbf{m}\cdot\mathbf{x})(\gamma_{\rho})\right),\\
&\mathrm{tmEl}_{K;r'}\left(\tau,\rho_{\Gamma,\Delta(j-1),x:\kappa}\left(\left\langle\left\langle\delta,\langle P,P_{\perp}(\delta)\rangle,\overline{w}^{j-1}\right\rangle,\langle Q,Q_{\perp}\rangle\right\rangle\right),(\mathbf{m}\cdot\mathbf{x})(\delta_{\rho})\right)
\end{aligned}
\right\rangle ⟨ tmEl K ; r ( τ , ρ Γ , Δ ( j − 1 ) , x : κ ( ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , v j − 1 ⟩ , ⟨ Q , Q ⊥ ⟩ ⟩ ) , ( m ⋅ x ) ( γ ρ ) ) , tmEl K ; r ′ ( τ , ρ Γ , Δ ( j − 1 ) , x : κ ( ⟨ ⟨ δ , ⟨ P , P ⊥ ( δ )⟩ , w j − 1 ⟩ , ⟨ Q , Q ⊥ ⟩ ⟩ ) , ( m ⋅ x ) ( δ ρ ) ) ⟩
∈ [ Γ , Δ ( j − 1 ) , x : κ ⊢ E l K ; ρ ( m ⋅ x , τ ) : T y ] ( ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , v ‾ j − 1 ⟩ , ⟨ Q , Q ⊥ ⟩ ⟩ ) \in[\Gamma,\Delta(j-1),x:\kappa\vdash\mathrm{El}_{K;\rho}(\mathbf{m}\cdot\mathbf{x},\tau):\mathrm{Ty}] \left(\left\langle\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\overline{v}^{j-1}\right\rangle,\langle Q,Q_{\perp}\rangle\right\rangle\right) ∈ [ Γ , Δ ( j − 1 ) , x : κ ⊢ El K ; ρ ( m ⋅ x , τ ) : Ty ] ( ⟨ ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , v j − 1 ⟩ , ⟨ Q , Q ⊥ ⟩ ⟩ )
⟨ t m E l K ; r ( ∀ x : κ . τ , γ ρ , ( m ) ( γ ρ ) ) , t m E l K ; r ′ ( ∀ x : κ . τ , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ t m E l K ; r ( τ , γ ρ , ( m ) ( γ ρ ) ) , t m E l K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ ) ) ⟩ \left\langle
\begin{aligned}
&\mathrm{tmEl}_{K;r}(\forall x:\kappa.\tau,\gamma_{\rho},(\mathbf{m})(\gamma_{\rho})),\\
&\mathrm{tmEl}_{K;r'}(\forall x:\kappa.\tau,\delta_{\rho},(\mathbf{m})(\delta_{\rho}))
\end{aligned}
\right\rangle
=
\left\langle
\begin{aligned}
&\mathrm{tmEl}_{K;r}(\tau,\gamma_{\rho},(\mathbf{m})(\gamma_{\rho})),\\
&\mathrm{tmEl}_{K;r'}(\tau,\delta_{\rho},(\mathbf{m})(\delta_{\rho}))
\end{aligned}
\right\rangle ⟨ tmEl K ; r ( ∀ x : κ . τ , γ ρ , ( m ) ( γ ρ )) , tmEl K ; r ′ ( ∀ x : κ . τ , δ ρ , ( m ) ( δ ρ )) ⟩ = ⟨ tmEl K ; r ( τ , γ ρ , ( m ) ( γ ρ )) , tmEl K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ )) ⟩
ρ Γ , x : κ ( ⟨ γ , x ⟩ ) = ρ Γ ( γ ) \rho_{\Gamma,x:\kappa}(\langle\gamma,x\rangle)=\rho_{\Gamma}(\gamma) ρ Γ , x : κ (⟨ γ , x ⟩) = ρ Γ ( γ )
= ⟨ t m E l K ; r ( τ , γ ρ , ( m ⋅ x ) ( γ ρ ) ) , t m E l K ; r ′ ( τ , δ ρ , ( m ⋅ x ) ( δ ρ ) ) ⟩ =
\left\langle
\begin{aligned}
&\mathrm{tmEl}_{K;r}(\tau,\gamma_{\rho},(\mathbf{m}\cdot\mathbf{x})(\gamma_{\rho})),\\
&\mathrm{tmEl}_{K;r'}(\tau,\delta_{\rho},(\mathbf{m}\cdot\mathbf{x})(\delta_{\rho}))
\end{aligned}
\right\rangle = ⟨ tmEl K ; r ( τ , γ ρ , ( m ⋅ x ) ( γ ρ )) , tmEl K ; r ′ ( τ , δ ρ , ( m ⋅ x ) ( δ ρ )) ⟩
By the first observation
∈ [ Γ , Δ ( j − 1 ) ⊢ ∀ x : κ . E l K ; ρ ( m ⋅ x , τ ) : T y ] ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , v ‾ j − 1 ⟩ ) \in[\Gamma,\Delta(j-1)\vdash\forall x:\kappa.\mathrm{El}_{K;\rho}(\mathbf{m}\cdot\mathbf{x},\tau):\mathrm{Ty}] \left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\overline{v}^{j-1}\right\rangle\right) ∈ [ Γ , Δ ( j − 1 ) ⊢ ∀ x : κ . El K ; ρ ( m ⋅ x , τ ) : Ty ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , v j − 1 ⟩ )
∈ [ Γ , Δ ( j − 1 ) ⊢ E l K ; ρ ( m , ∀ x : κ . τ ) : T y ] ( ⟨ γ , ⟨ P , P ⊥ ( γ ) ⟩ , v ‾ j − 1 ⟩ ) \in[\Gamma,\Delta(j-1)\vdash\mathrm{El}_{K;\rho}(\mathbf{m},\forall x:\kappa.\tau):\mathrm{Ty}] \left(\left\langle\gamma,\langle P,P_{\perp}(\gamma)\rangle,\overline{v}^{j-1}\right\rangle\right) ∈ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , ∀ x : κ . τ ) : Ty ] ( ⟨ γ , ⟨ P , P ⊥ ( γ )⟩ , v j − 1 ⟩ )
□ \square □
Proof of Lemma E.2 . By induction on the structure of τ \tau τ :
⟨ t m E l K ; r ( K ⋅ t ‾ k , γ ρ , ( m ) ( γ ρ ) ) , t m E l K ; r ′ ( K ⋅ t ‾ k , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ r ⋅ ( t ‾ ) ( γ ρ ) k ⋅ ( m ) ( γ ρ ) , r ′ ⋅ ( t ‾ ) ( δ ρ ) k ⋅ ( m ) ( δ ρ ) ⟩ \left\langle
\begin{aligned}
&\mathrm{tmEl}_{K;r}(K\cdot\overline{t}^{k},\gamma_{\rho},(\mathbf{m})(\gamma_{\rho})),\\
&\mathrm{tmEl}_{K;r'}(K\cdot\overline{t}^{k},\delta_{\rho},(\mathbf{m})(\delta_{\rho}))
\end{aligned}
\right\rangle
=
\left\langle
\begin{aligned}
&r\cdot(\overline{t})(\gamma_{\rho})^{k}\cdot(\mathbf{m})(\gamma_{\rho}),\\
&r'\cdot(\overline{t})(\delta_{\rho})^{k}\cdot(\mathbf{m})(\delta_{\rho})
\end{aligned}
\right\rangle ⟨ tmEl K ; r ( K ⋅ t k , γ ρ , ( m ) ( γ ρ )) , tmEl K ; r ′ ( K ⋅ t k , δ ρ , ( m ) ( δ ρ )) ⟩ = ⟨ r ⋅ ( t ) ( γ ρ ) k ⋅ ( m ) ( γ ρ ) , r ′ ⋅ ( t ) ( δ ρ ) k ⋅ ( m ) ( δ ρ ) ⟩
By Theorem 5.6 (ii), since γ ρ , δ ρ \gamma_{\rho},\delta_{\rho} γ ρ , δ ρ are related, the index terms give a related pair
⟨ ( t ‾ ) ( γ ρ ) k , ( t ‾ ) ( δ ρ ) k ⟩ \left\langle(\overline{t})(\gamma_{\rho})^{k},(\overline{t})(\delta_{\rho})^{k}\right\rangle ⟨ ( t ) ( γ ρ ) k , ( t ) ( δ ρ ) k ⟩
and, as m : K ⋅ t ‾ − k m:K\cdot\overline{t}^{-k} m : K ⋅ t − k ,
⟨ ( m ) ( γ ρ ) , ( m ) ( δ ρ ) ⟩ ∈ P ⊥ ( γ ) ⋅ ( t ‾ ) ( γ ρ ) − k ; \left\langle(\mathbf{m})(\gamma_{\rho}),(\mathbf{m})(\delta_{\rho})\right\rangle\in P_{\perp}(\gamma)\cdot(\overline{t})(\gamma_{\rho})^{-k}; ⟨ ( m ) ( γ ρ ) , ( m ) ( δ ρ ) ⟩ ∈ P ⊥ ( γ ) ⋅ ( t ) ( γ ρ ) − k ;
the realizer hypothesis yields
∈ [ Γ , x ‾ : τ ‾ k , y : t ‾ ⋅ K ⋅ x ‾ − k ⊢ ρ : T y ] ( ⟨ γ , P ⊥ ( γ ) ⟩ ) \in[\Gamma,\overline{x}:\overline{\tau}^{k},y:\overline{t}\cdot K\cdot\overline{x}^{-k}\vdash\rho:\mathrm{Ty}] \left(\left\langle\gamma,P_{\perp}(\gamma)\right\rangle\right) ∈ [ Γ , x : τ k , y : t ⋅ K ⋅ x − k ⊢ ρ : Ty ] ( ⟨ γ , P ⊥ ( γ ) ⟩ )
Since [ _ − _ ] [\_-\_] [ _ − _ ] does not depend on the term assignment
= [ Γ , Δ ( j − 1 ) ⊢ E l K ; ρ ( m , K ⋅ t ‾ − k ) : T y ] ( ⟨ ⟨ γ , P ⊥ ( γ ) ⟩ , ϵ ⟩ ) = [\Gamma,\Delta(j-1)\vdash\mathrm{El}_{K;\rho}(m,K\cdot\overline{t}^{-k}):\mathrm{Ty}] \left(\left\langle\left\langle\gamma,P_{\perp}(\gamma)\right\rangle,\epsilon\right\rangle\right) = [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , K ⋅ t − k ) : Ty ] ( ⟨ ⟨ γ , P ⊥ ( γ ) ⟩ , ϵ ⟩ )
If τ ∈ { B , τ ⋅ t ‾ n } \tau\in\{\mathcal{B},\tau\cdot\overline{t}^{n}\} τ ∈ { B , τ ⋅ t n } ,
⟨ t m E l K ; r ( τ , γ ρ , ( m ) ( γ ρ ) ) , t m E l K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ ⋆ , ⋆ ⟩ \left\langle
\begin{aligned}
&\mathrm{tmEl}_{K;r}(\tau,\gamma_{\rho},(\mathbf{m})(\gamma_{\rho})),\\
&\mathrm{tmEl}_{K;r'}(\tau,\delta_{\rho},(\mathbf{m})(\delta_{\rho}))
\end{aligned}
\right\rangle
=\langle\star,\star\rangle ⟨ tmEl K ; r ( τ , γ ρ , ( m ) ( γ ρ )) , tmEl K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ )) ⟩ = ⟨ ⋆ , ⋆ ⟩
∈ ⟦ Γ , Δ ( j − 1 ) ⊢ U n i t : T y ⟧ ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) \in\llbracket\Gamma, \Delta(j-1) \vdash\mathrm{Unit}:\mathrm{Ty} \rrbracket\left(\left\langle\gamma, P_{\perp}(\gamma)\right\rangle, \varepsilon\right) ∈ [ [ Γ , Δ ( j − 1 ) ⊢ Unit : Ty ] ] ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε )
= ⟦ Γ , Δ ( j − 1 ) ⊢ E l K ; ρ ( m , τ ) : T y ⟧ ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) = \llbracket\Gamma, \Delta(j-1) \vdash\mathrm{El}_{K;\rho}(m,\tau):\mathrm{Ty} \rrbracket\left(\left\langle\gamma, P_{\perp}(\gamma)\right\rangle, \varepsilon\right) = [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , τ ) : Ty ] ] ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε )
⟨ t m E l K ; r ( { x : τ ∣ ϕ } , γ ρ , ( m ) ( γ ρ ) ) , t m E l K ; r ′ ( { x : τ ∣ ϕ } , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ t m E l K ; r ( τ , γ ρ , ( m ) ( γ ρ ) ) , t m E l K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ ) ) ⟩ \begin{aligned}
\left\langle
\begin{aligned}
\mathrm{tmEl}_{K;r}\left(\{x:\tau\mid\phi\},\gamma_{\rho},(m)(\gamma_{\rho})\right),\\
\mathrm{tmEl}_{K;r'}\left(\{x:\tau\mid\phi\},\delta_{\rho},(m)(\delta_{\rho})\right)
\end{aligned}
\right\rangle\\
&= \left\langle
\begin{aligned}
\mathrm{tmEl}_{K;r}\left(\tau,\gamma_{\rho},(m)(\gamma_{\rho})\right),\\
\mathrm{tmEl}_{K;r'}\left(\tau,\delta_{\rho},(m)(\delta_{\rho})\right)
\end{aligned}
\right\rangle
\end{aligned} ⟨ tmEl K ; r ( { x : τ ∣ ϕ } , γ ρ , ( m ) ( γ ρ ) ) , tmEl K ; r ′ ( { x : τ ∣ ϕ } , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ tmEl K ; r ( τ , γ ρ , ( m ) ( γ ρ ) ) , tmEl K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ ) ) ⟩
By I. H.
∈ ⟦ Γ , Δ ( j − 1 ) ⊢ E l K ; ρ ( m , τ ) : T y ⟧ ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) \in\llbracket\Gamma, \Delta(j-1) \vdash\mathrm{El}_{K;\rho}(m,\tau):\mathrm{Ty} \rrbracket\left(\left\langle\gamma, P_{\perp}(\gamma)\right\rangle,\varepsilon\right) ∈ [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , τ ) : Ty ] ] ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε )
= ⟦ Γ , Δ ( j − 1 ) ⊢ E l K ; ρ ( m , { x : τ ∣ ϕ } ) : T y ⟧ ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) = \llbracket\Gamma, \Delta(j-1) \vdash\mathrm{El}_{K;\rho}(m,\{x:\tau\mid\phi\}):\mathrm{Ty} \rrbracket\left(\left\langle\gamma, P_{\perp}(\gamma)\right\rangle,\varepsilon\right) = [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , { x : τ ∣ ϕ }) : Ty ] ] ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε )
If τ = x : τ → σ \tau=x:\tau\to\sigma τ = x : τ → σ , fixed ⟨ q 1 , n 1 ⟩ ∈ ⟦ Γ , Δ ( j − 1 ) ⊢ τ : T y ⟧ ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) \langle q_1,n_1\rangle\in\llbracket\Gamma,\Delta(j-1)\vdash\tau:\mathrm{Ty}\rrbracket\left(\left\langle\gamma,P_{\perp}(\gamma)\right\rangle,\varepsilon\right) ⟨ q 1 , n 1 ⟩ ∈ [ [ Γ , Δ ( j − 1 ) ⊢ τ : Ty ] ] ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) by I. H.
⟨ t m E l K ; r ( σ , ⟨ γ ρ , q 1 ⟩ , ( m ⋅ x ) ( ⟨ γ ρ , q 1 ⟩ ) ) , t m E l K ; r ′ ( σ , ⟨ δ ρ , n 1 ⟩ , ( m ⋅ x ) ( ⟨ δ ρ , n 1 ⟩ ) ) ⟩ \left\langle
\begin{aligned}
\mathrm{tmEl}_{K;r}\left(\sigma,\left\langle\gamma_{\rho},q_1\right\rangle,(m\cdot x)\left(\left\langle\gamma_{\rho},q_1\right\rangle\right)\right),\\
\mathrm{tmEl}_{K;r'}\left(\sigma,\left\langle\delta_{\rho},n_1\right\rangle,(m\cdot x)\left(\left\langle\delta_{\rho},n_1\right\rangle\right)\right)
\end{aligned}
\right\rangle ⟨ tmEl K ; r ( σ , ⟨ γ ρ , q 1 ⟩ , ( m ⋅ x ) ( ⟨ γ ρ , q 1 ⟩ ) ) , tmEl K ; r ′ ( σ , ⟨ δ ρ , n 1 ⟩ , ( m ⋅ x ) ( ⟨ δ ρ , n 1 ⟩ ) ) ⟩
∈ ⟦ Γ , Δ ( j − 1 ) , x : τ ⊢ E l K ; ρ ( m ⋅ x , σ ) : T y ⟧ ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) \in\llbracket\Gamma,\Delta(j-1),x:\tau\vdash\mathrm{El}_{K;\rho}(m\cdot x,\sigma):\mathrm{Ty}\rrbracket\left(\left\langle\gamma,P_{\perp}(\gamma)\right\rangle,\varepsilon\right) ∈ [ [ Γ , Δ ( j − 1 ) , x : τ ⊢ El K ; ρ ( m ⋅ x , σ ) : Ty ] ] ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε )
Hence,
⟨ t m E l K ; r ( x : τ → σ , γ ρ , ( m ) ( γ ρ ) ) , t m E l K ; r ′ ( x : τ → σ , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ i → ( q ↦ t m E l K ; r ( σ , ⟨ γ ρ , q ⟩ , ( m ) ( γ ρ ⋅ q ) ) ) , i → ( q ↦ t m E l K ; r ′ ( σ , ⟨ δ ρ , q ⟩ , ( m ) ( δ ρ ⋅ q ) ) ) ⟩ \begin{aligned}
\left\langle
\begin{aligned}
\mathrm{tmEl}_{K;r}(x:\tau\to\sigma,\gamma_{\rho},(m)(\gamma_{\rho})),\\
\mathrm{tmEl}_{K;r'}(x:\tau\to\sigma,\delta_{\rho},(m)(\delta_{\rho}))
\end{aligned}
\right\rangle\\
&= \left\langle
\begin{aligned}
i\to\left(q\mapsto\mathrm{tmEl}_{K;r}\left(\sigma,\left\langle\gamma_{\rho},q\right\rangle,(m)(\gamma_{\rho}\cdot q)\right)\right),\\
i\to\left(q\mapsto\mathrm{tmEl}_{K;r'}\left(\sigma,\left\langle\delta_{\rho},q\right\rangle,(m)(\delta_{\rho}\cdot q)\right)\right)
\end{aligned}
\right\rangle
\end{aligned} ⟨ tmEl K ; r ( x : τ → σ , γ ρ , ( m ) ( γ ρ )) , tmEl K ; r ′ ( x : τ → σ , δ ρ , ( m ) ( δ ρ )) ⟩ = ⟨ i → ( q ↦ tmEl K ; r ( σ , ⟨ γ ρ , q ⟩ , ( m ) ( γ ρ ⋅ q ) ) ) , i → ( q ↦ tmEl K ; r ′ ( σ , ⟨ δ ρ , q ⟩ , ( m ) ( δ ρ ⋅ q ) ) ) ⟩
We notice that ( τ ⋅ x ) ( ⟨ γ , ν ⟩ ) = ν (\tau\cdot x)\left(\left\langle\gamma,\nu\right\rangle\right)=\nu ( τ ⋅ x ) ( ⟨ γ , ν ⟩ ) = ν if x x x is the last bound variable
= ⟨ i → ( q ↦ t m E l K ; r ( σ , ⟨ γ ρ , q ⟩ , ( m ⋅ x ) ( ⟨ γ ρ , q ⟩ ) ) ) , i → ( q ↦ t m E l K ; r ′ ( σ , ⟨ δ ρ , q ⟩ , ( m ⋅ x ) ( ⟨ δ ρ , q ⟩ ) ) ) ⟩ = \left\langle
\begin{aligned}
i\to\left(q\mapsto\mathrm{tmEl}_{K;r}\left(\sigma,\left\langle\gamma_{\rho},q\right\rangle,(m\cdot x)\left(\left\langle\gamma_{\rho},q\right\rangle\right)\right)\right),\\
i\to\left(q\mapsto\mathrm{tmEl}_{K;r'}\left(\sigma,\left\langle\delta_{\rho},q\right\rangle,(m\cdot x)\left(\left\langle\delta_{\rho},q\right\rangle\right)\right)\right)
\end{aligned}
\right\rangle = ⟨ i → ( q ↦ tmEl K ; r ( σ , ⟨ γ ρ , q ⟩ , ( m ⋅ x ) ( ⟨ γ ρ , q ⟩ ) ) ) , i → ( q ↦ tmEl K ; r ′ ( σ , ⟨ δ ρ , q ⟩ , ( m ⋅ x ) ( ⟨ δ ρ , q ⟩ ) ) ) ⟩
By the above
∈ ⟦ Γ , Δ ( j − 1 ) ⊢ E l K ; ρ ( m , x : τ → σ ) : T y ⟧ ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) \in\llbracket\Gamma,\Delta(j-1)\vdash\mathrm{El}_{K;\rho}(m,x:\tau\to\sigma):\mathrm{Ty}\rrbracket\left(\left\langle\gamma,P_{\perp}(\gamma)\right\rangle,\varepsilon\right) ∈ [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , x : τ → σ ) : Ty ] ] ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε )
First, we notice that for any Q ∈ ⟦ Γ , Δ ( j − 1 ) ⊢ κ : K d ⟧ ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) Q\in\llbracket\Gamma,\Delta(j-1)\vdash\kappa:\mathrm{Kd}\rrbracket\left(\left\langle\gamma,P_{\perp}(\gamma)\right\rangle,\varepsilon\right) Q ∈ [ [ Γ , Δ ( j − 1 ) ⊢ κ : Kd ] ] ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) , since the runtime projection does not depend on the newly bound kind variable, by IH
⟨ t m E l K ; r ( τ , γ ρ , ( m ⋅ x ) ( γ ρ ) ) , t m E l K ; r ′ ( τ , δ ρ , ( m ⋅ x ) ( δ ρ ) ) ⟩ \left\langle
\begin{aligned}
\mathrm{tmEl}_{K;r}\left(\tau,\gamma_{\rho},(m\cdot x)(\gamma_{\rho})\right),\\
\mathrm{tmEl}_{K;r'}\left(\tau,\delta_{\rho},(m\cdot x)(\delta_{\rho})\right)
\end{aligned}
\right\rangle ⟨ tmEl K ; r ( τ , γ ρ , ( m ⋅ x ) ( γ ρ ) ) , tmEl K ; r ′ ( τ , δ ρ , ( m ⋅ x ) ( δ ρ ) ) ⟩
∈ ⟦ Γ , Δ ( j − 1 ) , x : κ ⊢ E l K ; ρ ( m ⋅ x , τ ) : T y ⟧ ( ⟨ ⟨ γ , P ⊥ ( γ ) ⟩ , ε ⟩ , Q ) \in\llbracket\Gamma,\Delta(j-1),x:\kappa\vdash\mathrm{El}_{K;\rho}(m\cdot x,\tau):\mathrm{Ty}\rrbracket\left(\left\langle\left\langle\gamma,P_{\perp}(\gamma)\right\rangle,\varepsilon\right\rangle,Q\right) ∈ [ [ Γ , Δ ( j − 1 ) , x : κ ⊢ El K ; ρ ( m ⋅ x , τ ) : Ty ] ] ( ⟨ ⟨ γ , P ⊥ ( γ ) ⟩ , ε ⟩ , Q )
⟨ t m E l K ; r ( ∀ x : κ . τ , γ ρ , ( m ) ( γ ρ ) ) , t m E l K ; r ′ ( ∀ x : κ . τ , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ t m E l K ; r ( τ , γ ρ , ( m ) ( γ ρ ) ) , t m E l K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ ) ) ⟩ \begin{aligned}
\left\langle
\begin{aligned}
\mathrm{tmEl}_{K;r}\left(\forall x:\kappa.\tau,\gamma_{\rho},(m)(\gamma_{\rho})\right),\\
\mathrm{tmEl}_{K;r'}\left(\forall x:\kappa.\tau,\delta_{\rho},(m)(\delta_{\rho})\right)
\end{aligned}
\right\rangle\\
&= \left\langle
\begin{aligned}
\mathrm{tmEl}_{K;r}\left(\tau,\gamma_{\rho},(m)(\gamma_{\rho})\right),\\
\mathrm{tmEl}_{K;r'}\left(\tau,\delta_{\rho},(m)(\delta_{\rho})\right)
\end{aligned}
\right\rangle
\end{aligned} ⟨ tmEl K ; r ( ∀ x : κ . τ , γ ρ , ( m ) ( γ ρ ) ) , tmEl K ; r ′ ( ∀ x : κ . τ , δ ρ , ( m ) ( δ ρ ) ) ⟩ = ⟨ tmEl K ; r ( τ , γ ρ , ( m ) ( γ ρ ) ) , tmEl K ; r ′ ( τ , δ ρ , ( m ) ( δ ρ ) ) ⟩
ρ Γ , x : κ ( ⟨ γ , x ⟩ ) = ρ Γ ( γ ) \rho_{\Gamma,x:\kappa}\left(\left\langle\gamma,x\right\rangle\right)=\rho_{\Gamma}(\gamma) ρ Γ , x : κ ( ⟨ γ , x ⟩ ) = ρ Γ ( γ )
= ⟨ t m E l K ; r ( τ , γ ρ , ( m ⋅ x ) ( γ ρ ) ) , t m E l K ; r ′ ( τ , δ ρ , ( m ⋅ x ) ( δ ρ ) ) ⟩ = \left\langle
\begin{aligned}
\mathrm{tmEl}_{K;r}\left(\tau,\gamma_{\rho},(m\cdot x)(\gamma_{\rho})\right),\\
\mathrm{tmEl}_{K;r'}\left(\tau,\delta_{\rho},(m\cdot x)(\delta_{\rho})\right)
\end{aligned}
\right\rangle = ⟨ tmEl K ; r ( τ , γ ρ , ( m ⋅ x ) ( γ ρ ) ) , tmEl K ; r ′ ( τ , δ ρ , ( m ⋅ x ) ( δ ρ ) ) ⟩
By the first observation
∈ ⟦ Γ , Δ ( j − 1 ) ⊢ ∀ x : κ . E l K ; ρ ( m ⋅ x , τ ) : T y ⟧ ( ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) ) = ⟦ Γ , Δ ( j − 1 ) ⊢ E l K ; ρ ( m , ∀ x : κ . τ ) : T y ⟧ ( ( ⟨ γ , P ⊥ ( γ ) ⟩ , ε ) ) \begin{aligned}
&\in\llbracket\Gamma, \Delta(j-1) \vdash\forall x:\kappa.\ \mathrm{El}_{K;\rho}(m \cdot x,\tau) : \mathrm{Ty} \rrbracket((\langle\gamma, P_{\perp}(\gamma)\rangle,\varepsilon)) \\
&= \llbracket\Gamma, \Delta(j-1) \vdash\mathrm{El}_{K;\rho}(m,\forall x:\kappa.\ \tau) : \mathrm{Ty} \rrbracket((\langle\gamma, P_{\perp}(\gamma)\rangle,\varepsilon))
\end{aligned} ∈ [ [ Γ , Δ ( j − 1 ) ⊢ ∀ x : κ . El K ; ρ ( m ⋅ x , τ ) : Ty ] ] ((⟨ γ , P ⊥ ( γ )⟩ , ε )) = [ [ Γ , Δ ( j − 1 ) ⊢ El K ; ρ ( m , ∀ x : κ . τ ) : Ty ] ] ((⟨ γ , P ⊥ ( γ )⟩ , ε ))
□