Introduction
Normalization by evaluation (NbE) is a technique for deciding definitional equality in type theories by computing normal forms via an interpretation into a semantic domain, followed by a reification (readback) procedure that extracts syntactic normal forms from semantic values [2 , 5 ] . In the dependently typed setting, NbE has been studied extensively [1 , 3 , 4 , 6 , 7 , 8 , 9 ] , and serves as the algorithmic backbone of type checkers for proof assistants.
A recurring design decision in formalizations of NbE for dependent type theories is whether substitutions should be treated as explicit syntactic constructs or as meta-level operations on terms. In the explicit substitution approach, substitutions appear as term formers in the syntax, and the theory includes definitional equalities governing their interaction with other term formers (e.g. the congruence rule for λ \lambda λ abstraction ( λ x . t ) [ σ ] = λ x . t [ q ( σ ) ] (\lambda x.t)[\sigma] = \lambda x.t[q(\sigma)] ( λ x . t ) [ σ ] = λ x . t [ q ( σ )] ). This approach is prevalent in recent formalized accounts of NbE [3 , 4 , 7 , 8 , 9 ] , partly because it simplifies the semantic proofs: the compositionality of the evaluation function follows directly from the syntax, and many substitution lemmas become trivial consequences of the equational theory rather than requiring separate inductive proofs. Nevertheless, explicit substitutions have two downsides:
The exact formulation of explicit substitutions and its completeness are in question. For instance, we have seen explicit substitutions with and without terminal object (i.e. ϵ : Γ ⇒ ⋅ \epsilon: \Gamma\Rightarrow\cdot ϵ : Γ ⇒ ⋅ the substitution that puts a closed term in any context) and its companion laws. The associativity law of substitutions is technically not required given the presence of composition law ( t [ σ ∘ σ ′ ] = t [ σ ] [ σ ′ ] ) (t[\sigma\circ\sigma'] = t[\sigma][\sigma']) ( t [ σ ∘ σ ′ ] = t [ σ ] [ σ ′ ]) . Thus, explicit substitutions are difficult to standardize and its formulation is entirely on the author(s)’ discretion.
That equations of substitutions become part of definition equality have made proving, especially in the soundness proof, more technically involved. When reasoning about a chain of equalities of applying substitutions, explicit substitutions requires us also maintain the well-formedness of well-typedness of ambient contexts and types. This adds undesired complexity to the proof, whereas the operational approach allows unconditional equational reasoning as usual.
Author’s Contact Information: Jason Z. S. Hu, fdhzs2010@hotmail.com, Amazon, Seattle, WA, USA.
ACM XXXX-XXXX/2026/10-ART https://doi.org/10.1145/nnnnnnn.nnnnnnn
, Vol. 1, No. 1, Article . Publication date: October 2026.
The operational approach, in contrast, defines substitution as a recursive function on raw terms. This is the “classical” treatment found in standard presentations of Martin-Löf type theory (MLTT) [10 , 11 ] . While conceptually simpler and closer to implementations, this approach also requires us to establish a substantial body of tedious substitution lemmas — associativity of composition, interaction with weakening, and compatibility with the equational theory — as separate meta-theoretic results. Nevertheless, we argue that, to date, we should welcome more tedious prerequisites as they can easily be discharged by established tools like autosubst [12 , 13 ] and even LLM agents. The complication, however, lies in the completeness proof. In this approach, the semantic interpretation must explicitly witness that evaluation commutes with substitution, which requires careful reasoning about environments and their relationship to syntactic substitutions. This problem is shortcircuited with explicit substitutions.
Previously, we have investigated the simply typed λ \lambda λ -calculus (SLTC), and demonstrated that with substitutions as operations, the overall proof structure remains manageable and brings certain simplifications to the soundness proof, in spite of increasing complexity in the completeness proof. In this technical report, we extend the investigation to MLTT. In particular, we focus on extending the semantic judgment for completeness in SLTC to dependent types. With substitutions as operations, we also observe significant simplifications in the soundness proof.
Contributions. We present a complete account of NbE for a core MLTT with a universe à la Tarski, Π \Pi Π -types, and natural numbers, where substitutions are defined as operations rather than explicit syntax. Our main contributions are:
A careful presentation of the syntax, typing rules, and equational theory for MLTT with operational substitutions (Sec. 2 to 4).
A domain model and evaluation/readback functions suitable for the operational setting (Sec. 5).
A PER model establishing completeness: any two terms that are judgmentally equal evaluate to related semantic values, which in turn read back to the same normal form (Sec. 6).
A Kripke logical predicate establishing soundness: any well-typed term evaluates to a semantic value from which a normal form can be extracted, and this normal form is judgmentally equal to the original term (Sec. 7).
Notation. We use N \mathbb{N} N for the type of natural numbers at the meta-level. Contexts are snoc-lists written Γ , x : T \Gamma, x : T Γ , x : T . Application of a substitution σ \sigma σ to a term t t t is written t [ σ ] t[\sigma] t [ σ ] , and composition of substitutions is written σ ∘ τ \sigma\circ\tau σ ∘ τ (meaning first σ \sigma σ , then τ \tau τ ).
Syntax and Substitution
In this section, we define the raw syntax of our core Martin-Löf Type Theory (MLTT) and introduce weakenings and substitutions as meta-level operations (recursive functions on expressions). We establish the key algebraic properties of these operations, which form the backbone of the subsequent development.
The crucial design decision—and the one that distinguishes this work from Abel—is that substitutions are not part of the term syntax. Instead, the application of a substitution to a term is defined by recursion on the structure of the term, and the basic laws governing the interaction of substitutions with term formers are proved as meta-theoretic lemmas rather than being postulated as definitional equalities of the type theory.
Throughout this presentation, we use named variables, ranging over x x x , y y y , z z z . However, since we are handling weakenings and substitutions, we find it more rigorous to use de Bruijn indices under the hood. Therefore, we might use x x x to also refer to its underlying de Bruijn index as well, whenever the ambient context requires precision. We might use subscript, e.g. x 0 x_0 x 0 , to emphasize the de Bruijn index of a particular variable.
Raw Syntax
We work with a single syntactic category E x p \mathrm{Exp} Exp of expressions, which encompasses both types and terms.
Definition 2.1 (Raw Expressions). The set E x p \mathrm{Exp} Exp of raw expressions is generated by the following grammar:
t , s , S , T ∈ E x p : : = x (variable) ∣ T y i (universe at level i ) ∣ N a t (natural number type) ∣ Π ( x : S ) . T (dependent function type, x bound in T ) ∣ z e r o (zero) ∣ s u c c t (successor) ∣ e l i m N a t ( x . T ) z ( x , y . s ) t (natural number eliminator) ∣ λ x . t (lambda abstraction, x bound in t ) ∣ r s (application) \begin{aligned}
t,s,S,T \in\mathrm{Exp} &::= x &&\text{(variable)}\\
&\mid\mathrm{Ty}_{i} &&\text{(universe at level }i\text{)}\\
&\mid\mathrm{Nat} &&\text{(natural number type)}\\
&\mid\Pi(x:S).T &&\text{(dependent function type, }x\text{ bound in }T\text{)}\\
&\mid\mathrm{zero} &&\text{(zero)}\\
&\mid\mathrm{succ}\ t &&\text{(successor)}\\
&\mid\mathrm{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ t &&\text{(natural number eliminator)}\\
&\mid\lambda x.t &&\text{(lambda abstraction, }x\text{ bound in }t\text{)}\\
&\mid r\ s &&\text{(application)}
\end{aligned} t , s , S , T ∈ Exp ::= x ∣ Ty i ∣ Nat ∣ Π ( x : S ) . T ∣ zero ∣ succ t ∣ elim Nat ( x . T ) z ( x , y . s ) t ∣ λ x . t ∣ r s (variable) (universe at level i ) (natural number type) (dependent function type, x bound in T ) (zero) (successor) (natural number eliminator) (lambda abstraction, x bound in t ) (application) In the grammar above, Π ( x : S ) . T \Pi(x:S).T Π ( x : S ) . T represents the dependent function type where T T T may refer to the bound variable x x x . The constructor λ x . t \lambda x.t λ x . t is the introduction form for Π \Pi Π -types: the body t t t may refer to the variable x x x of type S S S . The eliminator e l i m N a t ( x . T ) z ( x , y . s ) t \mathrm{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ t elim Nat ( x . T ) z ( x , y . s ) t eliminates a natural number t t t with motive T T T , where x x x refers to the natural number being eliminated, zero case z z z , and successor case s s s . In the successor case, x x x names the predecessor and y y y names the inductive hypothesis; both are bound in s s s .
Definition 2.2 (Contexts). Contexts Γ , Δ ∈ C t x \Gamma,\Delta\in\mathrm{Ctx} Γ , Δ ∈ Ctx are ordered lists of variable-type pairs:
Γ ∈ C t x : : = ⋅ ∣ Γ , x : S \Gamma\in\mathrm{Ctx} ::= \mathord{\cdot}\mid\Gamma,x:S Γ ∈ Ctx ::= ⋅ ∣ Γ , x : S where ⋅ \mathord{\cdot} ⋅ is the empty context and Γ , x : S \Gamma,x:S Γ , x : S extends Γ \Gamma Γ with a fresh variable x x x of type S ∈ E x p S \in\mathrm{Exp} S ∈ Exp . We write ∣ Γ ∣ |\Gamma| ∣Γ∣ for the length of Γ \Gamma Γ .
Weakenings
To define the substitution operation, we must define weakenings first, ranging over ϕ , ψ \phi,\psi ϕ , ψ . Weakenings adjust de Bruijn indices. In our presentation, we define weakenings are functions between natural numbers: N → N \mathbb{N}\to\mathbb{N} N → N .
Definition 2.3 (Weakenings). A weakening is a function ϕ : N → N \phi:\mathbb{N}\to\mathbb{N} ϕ : N → N . The key operations on weakenings are:
i d : N → N i d ( x ) = x ↑ : N → N ↑ ( x ) = x + 1 q ( ϕ ) : N → N q ( ϕ ) ( 0 ) = 0 q ( ϕ ) ( x + 1 ) = ϕ ( x ) + 1 \begin{aligned}
\mathrm{id}:\mathbb{N}\to\mathbb{N} && \mathrm{id}(x)&=x\\
\uparrow:\mathbb{N}\to\mathbb{N} && \uparrow(x)&=x+1\\
q(\phi):\mathbb{N}\to\mathbb{N} && q(\phi)(0)&=0\\
&& q(\phi)(x+1)&=\phi(x)+1
\end{aligned} id : N → N ↑: N → N q ( ϕ ) : N → N id ( x ) ↑ ( x ) q ( ϕ ) ( 0 ) q ( ϕ ) ( x + 1 ) = x = x + 1 = 0 = ϕ ( x ) + 1 The shift ↑ \uparrow ↑ increments all indices by one (corresponding to introducing one new binding). The operation q ( ϕ ) q(\phi) q ( ϕ ) extends a weakening under a binder: it fixes index 0 0 0 (the newly bound variable) and applies ϕ \phi ϕ followed by a successor to all other indices.
Definition 2.4 (Weakening Application). The application of a weakening ϕ \phi ϕ to a term t t t , written t [ ϕ ] t[\phi] t [ ϕ ] , is defined by recursion on the structure of t t t :
x [ ϕ ] = ϕ ( x ) x[\phi]=\phi(x) x [ ϕ ] = ϕ ( x ) T y i [ ϕ ] = T y i \mathrm{Ty}_{i}[\phi]=\mathrm{Ty}_{i} Ty i [ ϕ ] = Ty i N a t [ ϕ ] = N a t \mathrm{Nat}[\phi]=\mathrm{Nat} Nat [ ϕ ] = Nat ( Π ( x : S ) . T ) [ ϕ ] = Π ( x : S [ ϕ ] ) . ( T [ q ( ϕ ) ] ) (\Pi(x:S).T)[\phi]=\Pi(x:S[\phi]).(T[q(\phi)]) ( Π ( x : S ) . T ) [ ϕ ] = Π ( x : S [ ϕ ]) . ( T [ q ( ϕ )])
zero [ ϕ ] = zero \operatorname{zero}[\phi] = \operatorname{zero} zero [ ϕ ] = zero
( succ t ) [ ϕ ] = succ ( t [ ϕ ] ) (\operatorname{succ}\ t)[\phi] = \operatorname{succ}\ (t[\phi]) ( succ t ) [ ϕ ] = succ ( t [ ϕ ])
( elimNat ( x . T ) z ( x , y . s ) t ) [ ϕ ] = elimNat ( x . T [ q ( ϕ ) ] ) z [ ϕ ] ( x , y . s [ q 2 ( ϕ ) ] ) t [ ϕ ] (\operatorname{elimNat}\ (x.T)\ z\ (x,y.s)\ t)[\phi] = \operatorname{elimNat}\ (x.T[q(\phi)])\ z[\phi]\ (x,y.s[q^{2}(\phi)])\ t[\phi] ( elimNat ( x . T ) z ( x , y . s ) t ) [ ϕ ] = elimNat ( x . T [ q ( ϕ )]) z [ ϕ ] ( x , y . s [ q 2 ( ϕ )]) t [ ϕ ]
( λ x . t ) [ ϕ ] = λ x . t [ q ( ϕ ) ] (\lambda x.t)[\phi] = \lambda x.t[q(\phi)] ( λ x . t ) [ ϕ ] = λ x . t [ q ( ϕ )]
( r s ) [ ϕ ] = ( r [ ϕ ] ) ( s [ ϕ ] ) (r\ s)[\phi] = (r[\phi])\ (s[\phi]) ( r s ) [ ϕ ] = ( r [ ϕ ]) ( s [ ϕ ])
Whenever we pass under a binder, we extend the weakening with q q q . The successor case of the eliminator binds two variables (x x x for the predecessor, y y y for the inductive hypothesis), hence q q q is applied twice.
Weakenings compose as: ( ϕ ∘ ψ ) ( x ) = ψ ( ϕ ( x ) ) (\phi\circ\psi)(x) = \psi(\phi(x)) ( ϕ ∘ ψ ) ( x ) = ψ ( ϕ ( x )) . We now establish the key algebraic properties of weakenings.
Lemma 2.5 (q q q -Identity). q ( i d ) = i d q(id) = id q ( i d ) = i d .
Proof. By case analysis on the argument:
q ( i d ) ( 0 ) = 0 = i d ( 0 ) q(id)(0) = 0 = id(0) q ( i d ) ( 0 ) = 0 = i d ( 0 ) q ( i d ) ( x + 1 ) = i d ( x ) + 1 = x + 1 = i d ( x + 1 ) q(id)(x+1) = id(x)+1 = x+1 = id(x+1) q ( i d ) ( x + 1 ) = i d ( x ) + 1 = x + 1 = i d ( x + 1 )
Lemma 2.6 (Identity Weakening). For all t ∈ E x p t \in Exp t ∈ E x p , t [ i d ] = t t[id] = t t [ i d ] = t .
Proof. By induction on t t t . We show a few representative cases.
Case t = x t = x t = x (variable).
x [ i d ] = i d ( x ) = x x[id] = id(x) = x x [ i d ] = i d ( x ) = x Case t = λ x . t ′ t = \lambda x.t' t = λ x . t ′ .
( λ x . t ′ ) [ i d ] = λ x . ( t ′ [ q ( i d ) ] ) (\lambda x.t')[id] = \lambda x.(t'[q(id)]) ( λ x . t ′ ) [ i d ] = λ x . ( t ′ [ q ( i d )]) = λ x . ( t ′ [ i d ] ) (by Theorem 2.5) = \lambda x.(t'[id]) \qquad\text{(by Theorem 2.5)} = λ x . ( t ′ [ i d ]) (by Theorem 2.5) = λ x . t ′ (by IH) = \lambda x.t' \qquad\text{(by IH)} = λ x . t ′ (by IH) Case t = Π ( x : S ) . T t = \Pi(x:S).T t = Π ( x : S ) . T .
( Π ( x : S ) . T ) [ i d ] = Π ( x : S [ i d ] ) . ( T [ q ( i d ) ] ) (\Pi(x:S).T)[id] = \Pi(x:S[id]).(T[q(id)]) ( Π ( x : S ) . T ) [ i d ] = Π ( x : S [ i d ]) . ( T [ q ( i d )]) = Π ( x : S ) . ( T [ i d ] ) (by IH and Theorem 2.5) = \Pi(x:S).(T[id]) \qquad\text{(by IH and Theorem 2.5)} = Π ( x : S ) . ( T [ i d ]) (by IH and Theorem 2.5) = Π ( x : S ) . T (by IH) = \Pi(x:S).T \qquad\text{(by IH)} = Π ( x : S ) . T (by IH) All other cases follow the same pattern.
Lemma 2.7 (q q q Distributes over Composition). For all weakenings ϕ , ψ \phi,\psi ϕ , ψ : q ( ϕ ) ∘ q ( ψ ) = q ( ϕ ∘ ψ ) q(\phi) \circ q(\psi) = q(\phi\circ\psi) q ( ϕ ) ∘ q ( ψ ) = q ( ϕ ∘ ψ ) .
Proof. By case analysis on the argument:
( q ( ϕ ) ∘ q ( ψ ) ) ( 0 ) = q ( ψ ) ( q ( ϕ ) ( 0 ) ) = q ( ψ ) ( 0 ) = 0 = q ( ϕ ∘ ψ ) ( 0 ) (q(\phi) \circ q(\psi))(0) = q(\psi)(q(\phi)(0)) = q(\psi)(0) = 0 = q(\phi\circ\psi)(0) ( q ( ϕ ) ∘ q ( ψ )) ( 0 ) = q ( ψ ) ( q ( ϕ ) ( 0 )) = q ( ψ ) ( 0 ) = 0 = q ( ϕ ∘ ψ ) ( 0 ) ( q ( ϕ ) ∘ q ( ψ ) ) ( x + 1 ) = q ( ψ ) ( ϕ ( x ) + 1 ) = ψ ( ϕ ( x ) ) + 1 (q(\phi) \circ q(\psi))(x+1) = q(\psi)(\phi(x)+1) = \psi(\phi(x))+1 ( q ( ϕ ) ∘ q ( ψ )) ( x + 1 ) = q ( ψ ) ( ϕ ( x ) + 1 ) = ψ ( ϕ ( x )) + 1 = ( ϕ ∘ ψ ) ( x ) + 1 = q ( ϕ ∘ ψ ) ( x + 1 ) = (\phi\circ\psi)(x)+1 = q(\phi\circ\psi)(x+1) = ( ϕ ∘ ψ ) ( x ) + 1 = q ( ϕ ∘ ψ ) ( x + 1 )
The previous lemma generalizes to arbitrary applications of q q q :
Lemma 2.8 (q n q^{n} q n Distributes over Composition). For all weakenings ϕ , ψ \phi,\psi ϕ , ψ : q n ( ϕ ) ∘ q n ( ψ ) = q n ( ϕ ∘ ψ ) q^{n}(\phi) \circ q^{n}(\psi) = q^{n}(\phi\circ\psi) q n ( ϕ ) ∘ q n ( ψ ) = q n ( ϕ ∘ ψ ) .
Lemma 2.9 (Composition of Weakening Application). For all t ∈ E x p t \in Exp t ∈ E x p and weakenings ϕ , ψ \phi,\psi ϕ , ψ : t [ ϕ ] [ ψ ] = t [ ϕ ∘ ψ ] t[\phi][\psi] = t[\phi\circ\psi] t [ ϕ ] [ ψ ] = t [ ϕ ∘ ψ ] .
Proof. By induction on t t t . We show a few representative cases.
Case t = x t = x t = x (variable).
x [ ϕ ] [ ψ ] = ( ϕ ( x ) ) [ ψ ] = ψ ( ϕ ( x ) ) = ( ϕ ∘ ψ ) ( x ) = x [ ϕ ∘ ψ ] x[\phi][\psi] = (\phi(x))[\psi] = \psi(\phi(x)) = (\phi\circ\psi)(x) = x[\phi\circ\psi] x [ ϕ ] [ ψ ] = ( ϕ ( x )) [ ψ ] = ψ ( ϕ ( x )) = ( ϕ ∘ ψ ) ( x ) = x [ ϕ ∘ ψ ] Case t = λ x . t ′ t = \lambda x.t' t = λ x . t ′ .
( λ x . t ′ ) [ ϕ ] [ ψ ] = ( λ x . ( t ′ [ q ( ϕ ) ] ) ) [ ψ ] = λ x . ( t ′ [ q ( ϕ ) ] [ q ( ψ ) ] ) = λ x . ( t ′ [ q ( ϕ ) ∘ q ( ψ ) ] ) (by IH) = λ x . ( t ′ [ q ( ϕ ∘ ψ ) ] ) (by Theorem 2.7) = ( λ x . t ′ ) [ ϕ ∘ ψ ] \begin{aligned}
(\lambda x.t')[\phi][\psi] &= (\lambda x.(t'[q(\phi)]))[\psi]\\
&= \lambda x.(t'[q(\phi)][q(\psi)])\\
&= \lambda x.(t'[q(\phi)\circ q(\psi)]) && \text{(by IH)}\\
&= \lambda x.(t'[q(\phi\circ\psi)]) && \text{(by Theorem 2.7)}\\
&= (\lambda x.t')[\phi\circ\psi]
\end{aligned} ( λ x . t ′ ) [ ϕ ] [ ψ ] = ( λ x . ( t ′ [ q ( ϕ )])) [ ψ ] = λ x . ( t ′ [ q ( ϕ )] [ q ( ψ )]) = λ x . ( t ′ [ q ( ϕ ) ∘ q ( ψ )]) = λ x . ( t ′ [ q ( ϕ ∘ ψ )]) = ( λ x . t ′ ) [ ϕ ∘ ψ ] (by IH) (by Theorem 2.7) Case t = elim N a t ( x . T ) z ( x , y . s ) t ′ t = \operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t' t = elim Nat ( x . T ) z ( x , y . s ) t ′ .
( elim N a t ( x . T ) z ( x , y . s ) t ′ ) [ ϕ ] [ ψ ] = ( elim N a t ( x . T [ q ( ϕ ) ] ) z [ ϕ ] ( x , y . s [ q 2 ( ϕ ) ] ) t ′ [ ϕ ] ) [ ψ ] = elim N a t ( x . T [ q ( ϕ ) ] [ q ( ψ ) ] ) z [ ϕ ] [ ψ ] ( x , y . s [ q 2 ( ϕ ) ] [ q 2 ( ψ ) ] ) t ′ [ ϕ ] [ ψ ] = elim N a t ( x . T [ q ( ϕ ) ∘ q ( ψ ) ] ) z [ ϕ ∘ ψ ] ( x , y . s [ q 2 ( ϕ ) ∘ q 2 ( ψ ) ] ) t ′ [ ϕ ∘ ψ ] (by IH) = elim N a t ( x . T [ q ( ϕ ∘ ψ ) ] ) z [ ϕ ∘ ψ ] ( x , y . s [ q 2 ( ϕ ∘ ψ ) ] ) t ′ [ ϕ ∘ ψ ] (by Theorem 2.8) = ( elim N a t ( x . T ) z ( x , y . s ) t ′ ) [ ϕ ∘ ψ ] \begin{aligned}
(\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t')[\phi][\psi]
&= (\operatorname{elim}_{\mathrm{Nat}}(x.T[q(\phi)])\ z[\phi]\ (x,y.s[q^2(\phi)])\ t'[\phi])[\psi]\\
&= \operatorname{elim}_{\mathrm{Nat}}(x.T[q(\phi)][q(\psi)])\ z[\phi][\psi]\ (x,y.s[q^2(\phi)][q^2(\psi)])\ t'[\phi][\psi]\\
&= \operatorname{elim}_{\mathrm{Nat}}(x.T[q(\phi)\circ q(\psi)])\ z[\phi\circ\psi]\ (x,y.s[q^2(\phi)\circ q^2(\psi)])\ t'[\phi\circ\psi] && \text{(by IH)}\\
&= \operatorname{elim}_{\mathrm{Nat}}(x.T[q(\phi\circ\psi)])\ z[\phi\circ\psi]\ (x,y.s[q^2(\phi\circ\psi)])\ t'[\phi\circ\psi] && \text{(by Theorem 2.8)}\\
&= (\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t')[\phi\circ\psi]
\end{aligned} ( elim Nat ( x . T ) z ( x , y . s ) t ′ ) [ ϕ ] [ ψ ] = ( elim Nat ( x . T [ q ( ϕ )]) z [ ϕ ] ( x , y . s [ q 2 ( ϕ )]) t ′ [ ϕ ]) [ ψ ] = elim Nat ( x . T [ q ( ϕ )] [ q ( ψ )]) z [ ϕ ] [ ψ ] ( x , y . s [ q 2 ( ϕ )] [ q 2 ( ψ )]) t ′ [ ϕ ] [ ψ ] = elim Nat ( x . T [ q ( ϕ ) ∘ q ( ψ )]) z [ ϕ ∘ ψ ] ( x , y . s [ q 2 ( ϕ ) ∘ q 2 ( ψ )]) t ′ [ ϕ ∘ ψ ] = elim Nat ( x . T [ q ( ϕ ∘ ψ )]) z [ ϕ ∘ ψ ] ( x , y . s [ q 2 ( ϕ ∘ ψ )]) t ′ [ ϕ ∘ ψ ] = ( elim Nat ( x . T ) z ( x , y . s ) t ′ ) [ ϕ ∘ ψ ] (by IH) (by Theorem 2.8) The cases for succ t \operatorname{succ}\ t succ t , r s r\ s r s , Π \Pi Π , N a t \mathrm{Nat} Nat , T y i \mathrm{Ty}_i Ty i , and zero are similar or immediate. □
Lemma 2.10 (Categorical Laws for Weakenings). Weakenings satisfy:
(1) (Left identity) id ∘ ϕ = ϕ \operatorname{id}\circ\phi= \phi id ∘ ϕ = ϕ .
(2) (Right identity) ϕ ∘ id = ϕ \phi\circ\operatorname{id} = \phi ϕ ∘ id = ϕ .
(3) (Associativity) ( ϕ ∘ ψ ) ∘ χ = ϕ ∘ ( ψ ∘ χ ) (\phi\circ\psi)\circ\chi= \phi\circ(\psi\circ\chi) ( ϕ ∘ ψ ) ∘ χ = ϕ ∘ ( ψ ∘ χ ) .
Proof. All three are immediate from the definition of composition as function composition on N \mathbb{N} N :
( id ∘ ϕ ) ( x ) = ϕ ( id ( x ) ) = ϕ ( x ) (\operatorname{id}\circ\phi)(x) = \phi(\operatorname{id}(x)) = \phi(x) ( id ∘ ϕ ) ( x ) = ϕ ( id ( x )) = ϕ ( x ) ( ϕ ∘ id ) ( x ) = id ( ϕ ( x ) ) = ϕ ( x ) (\phi\circ\operatorname{id})(x) = \operatorname{id}(\phi(x)) = \phi(x) ( ϕ ∘ id ) ( x ) = id ( ϕ ( x )) = ϕ ( x ) ( ( ϕ ∘ ψ ) ∘ χ ) ( x ) = χ ( ψ ( ϕ ( x ) ) ) = ( ϕ ∘ ( ψ ∘ χ ) ) ( x ) ((\phi\circ\psi)\circ\chi)(x) = \chi(\psi(\phi(x))) = (\phi\circ(\psi\circ\chi))(x) (( ϕ ∘ ψ ) ∘ χ ) ( x ) = χ ( ψ ( ϕ ( x ))) = ( ϕ ∘ ( ψ ∘ χ )) ( x )
Substitutions
A substitution is a function σ : N → E x p \sigma: \mathbb{N} \to Exp σ : N → E x p that maps each de Bruijn index to an expression. Substitution is the key meta-level operation in our development: it is defined by recursion on the structure of terms and is not part of the object language syntax.
Definition 2.11 (Substitution Operations). We define the following operations on substitutions:
(i) Identity. id : S u b s t \operatorname{id} : Subst id : S u b s t , defined by id ( x ) = x \operatorname{id}(x) = x id ( x ) = x .
(ii) Extension (cons). Given a substitution σ \sigma σ , a variable x x x , and a term s s s , we write ( σ , s / x ) (\sigma, s/x) ( σ , s / x ) for the substitution:
( σ , s / x ) ( 0 ) = s ( σ , s / x ) ( x + 1 ) = σ ( x ) (\sigma, s/x)(0) = s \qquad(\sigma, s/x)(x + 1) = \sigma(x) ( σ , s / x ) ( 0 ) = s ( σ , s / x ) ( x + 1 ) = σ ( x )
Here x x x is a visual mnemonic for the variable at de Bruijn index 0; under the hood, the extension always targets index 0.
(iii) Lifting under a binder. Given a substitution σ \sigma σ , we define q ( σ ) : S u b s t q(\sigma) : \mathrm{Subst} q ( σ ) : Subst by:
q ( σ ) ( 0 ) = 0 q ( σ ) ( x + 1 ) = ( σ ( x ) ) [ ⇑ ] q(\sigma)(0) = 0 \qquad q(\sigma)(x + 1) = (\sigma(x))[\Uparrow] q ( σ ) ( 0 ) = 0 q ( σ ) ( x + 1 ) = ( σ ( x )) [ ⇑ ]
This fixes index 0 and applies σ \sigma σ to the remaining indices, weakening the results by one to account for the new binder.
(iv) Applying a weakening to a substitution. Given a substitution σ \sigma σ and a weakening ϕ \phi ϕ , we define σ [ ϕ ] : S u b s t \sigma[\phi] : \mathrm{Subst} σ [ ϕ ] : Subst pointwise:
( σ [ ϕ ] ) ( x ) = ( σ ( x ) ) [ ϕ ] (\sigma[\phi])(x) = (\sigma(x))[\phi] ( σ [ ϕ ]) ( x ) = ( σ ( x )) [ ϕ ]
(v) Composition. Given substitutions σ \sigma σ and τ \tau τ , their composition is:
( σ ∘ τ ) ( x ) = ( σ ( x ) ) [ τ ] (\sigma\circ\tau)(x) = (\sigma(x))[\tau] ( σ ∘ τ ) ( x ) = ( σ ( x )) [ τ ]
The single substitution t [ s / x ] t[s/x] t [ s / x ] used in the β \beta β -rule is the special case t [ i d , s / x ] t[\mathrm{id},s/x] t [ id , s / x ] : the extension of the identity by s s s at index 0.
Definition 2.12 (Substitution Application). The function ( − ) [ − ] : E x p → S u b s t → E x p (-)[-] : \mathrm{Exp} \to\mathrm{Subst} \to\mathrm{Exp} ( − ) [ − ] : Exp → Subst → Exp is defined by recursion on the structure of the expression:
x [ σ ] = σ ( x ) T y i [ σ ] = T y i N a t [ σ ] = N a t ( Π ( x : S ) . T ) [ σ ] = Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) z e r o [ σ ] = z e r o ( s u c c t ) [ σ ] = s u c c ( t [ σ ] ) ( e l i m N a t ( x . T ) z ( x , y . s ) t ) [ σ ] = e l i m N a t ( x . T [ q ( σ ) ] ) z [ σ ] ( x , y . s [ q 2 ( σ ) ] ) t [ σ ] ( λ x . t ) [ σ ] = λ x . t [ q ( σ ) ] ( r s ) [ σ ] = ( r [ σ ] ) ( s [ σ ] ) \begin{aligned}
x[\sigma] &= \sigma(x) \\
\mathrm{Ty}_i[\sigma] &= \mathrm{Ty}_i \\
\mathrm{Nat}[\sigma] &= \mathrm{Nat} \\
(\Pi(x : S).T)[\sigma] &= \Pi(x : S[\sigma]).(T[q(\sigma)]) \\
\mathrm{zero}[\sigma] &= \mathrm{zero} \\
(\mathrm{succ}\ t)[\sigma] &= \mathrm{succ}\ (t[\sigma]) \\
(\mathrm{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ t)[\sigma] &= \mathrm{elim}_{\mathrm{Nat}}\ (x.T[q(\sigma)])\ z[\sigma]\ (x,y.s[q^2(\sigma)])\ t[\sigma] \\
(\lambda x.t)[\sigma] &= \lambda x.t[q(\sigma)] \\
(r\ s)[\sigma] &= (r[\sigma])\ (s[\sigma])
\end{aligned} x [ σ ] Ty i [ σ ] Nat [ σ ] ( Π ( x : S ) . T ) [ σ ] zero [ σ ] ( succ t ) [ σ ] ( elim Nat ( x . T ) z ( x , y . s ) t ) [ σ ] ( λ x . t ) [ σ ] ( r s ) [ σ ] = σ ( x ) = Ty i = Nat = Π ( x : S [ σ ]) . ( T [ q ( σ )]) = zero = succ ( t [ σ ]) = elim Nat ( x . T [ q ( σ )]) z [ σ ] ( x , y . s [ q 2 ( σ )]) t [ σ ] = λ x . t [ q ( σ )] = ( r [ σ ]) ( s [ σ ])
Whenever we pass under a binder, we lift σ \sigma σ with q q q . The successor case of the eliminator binds two variables, hence q q q is applied twice.
Definition 2.13 (Embedding of Weakenings into Substitutions). Every weakening ϕ \phi ϕ can be regarded as a substitution via the embedding:
ι ( ϕ ) : S u b s t ι ( ϕ ) ( x ) = ϕ ( x ) \iota(\phi) : \mathrm{Subst} \qquad\iota(\phi)(x) = \phi(x) ι ( ϕ ) : Subst ι ( ϕ ) ( x ) = ϕ ( x ) That is, ι ( ϕ ) \iota(\phi) ι ( ϕ ) maps each index n n n to the variable ϕ ( x ) \phi(x) ϕ ( x ) .
Lemma 2.14 (Embedding Correctness). For all t ∈ E x p t \in\mathrm{Exp} t ∈ Exp and weakenings ϕ \phi ϕ : t [ ϕ ] = t [ ι ( ϕ ) ] t[\phi] = t[\iota(\phi)] t [ ϕ ] = t [ ι ( ϕ )] .
Proof. By induction on t t t . The key observation is that q ( ι ( ϕ ) ) = ι ( q ( ϕ ) ) q(\iota(\phi)) = \iota(q(\phi)) q ( ι ( ϕ )) = ι ( q ( ϕ )) :
q ( ι ( ϕ ) ) ( 0 ) = 0 = ι ( q ( ϕ ) ) ( 0 ) q(\iota(\phi))(0) = 0 = \iota(q(\phi))(0) q ( ι ( ϕ )) ( 0 ) = 0 = ι ( q ( ϕ )) ( 0 ) q ( ι ( ϕ ) ) ( x + 1 ) = ι ( ϕ ) ( x ) [ ⇑ ] = ϕ ( x ) [ ⇑ ] = ϕ ( x ) + 1 = ι ( q ( ϕ ) ) ( x + 1 ) q(\iota(\phi))(x + 1) = \iota(\phi)(x)[\Uparrow] = \phi(x)[\Uparrow] = \phi(x) + 1 = \iota(q(\phi))(x + 1) q ( ι ( ϕ )) ( x + 1 ) = ι ( ϕ ) ( x ) [ ⇑ ] = ϕ ( x ) [ ⇑ ] = ϕ ( x ) + 1 = ι ( q ( ϕ )) ( x + 1 )
With this fact, the induction is straightforward: at each binding form, we use q ( ι ( ϕ ) ) = ι ( q ( ϕ ) ) q(\iota(\phi)) = \iota(q(\phi)) q ( ι ( ϕ )) = ι ( q ( ϕ )) to relate the substitution side to the weakening side. For example:
( λ x . t ′ ) [ ι ( ϕ ) ] = λ x . ( t ′ [ q ( ι ( ϕ ) ) ] ) = λ x . ( t ′ [ ι ( q ( ϕ ) ) ] ) = λ x . ( t ′ [ q ( ϕ ) ] ) = ( λ x . t ′ ) [ ϕ ] (\lambda x.t')[\iota(\phi)] = \lambda x.(t'[q(\iota(\phi))])
\\
= \lambda x.(t'[\iota(q(\phi))])
\\
= \lambda x.(t'[q(\phi)])
\\
= (\lambda x.t')[\phi] ( λ x . t ′ ) [ ι ( ϕ )] = λ x . ( t ′ [ q ( ι ( ϕ ))]) = λ x . ( t ′ [ ι ( q ( ϕ ))]) = λ x . ( t ′ [ q ( ϕ )]) = ( λ x . t ′ ) [ ϕ ]
(by IH)
Lemma 2.15 (Structural Properties of ι \iota ι ). The embedding ι \iota ι preserves all weakening structure:
ι ( i d ) = i d \iota(id) = id ι ( i d ) = i d .
ι ( ⇑ ) = ⇑ \iota(\Uparrow) = \Uparrow ι ( ⇑ ) =⇑ (as substitutions, i.e. ι ( ⇑ ) ( x ) = x + 1 \iota(\Uparrow)(x) = x + 1 ι ( ⇑ ) ( x ) = x + 1 ).
ι ( q ( ϕ ) ) = q ( ι ( ϕ ) ) \iota(q(\phi)) = q(\iota(\phi)) ι ( q ( ϕ )) = q ( ι ( ϕ )) .
ι ( ϕ ∘ ψ ) = ι ( ϕ ) ∘ ι ( ψ ) \iota(\phi\mathbin{\circ} \psi) = \iota(\phi) \mathbin{\circ} \iota(\psi) ι ( ϕ ∘ ψ ) = ι ( ϕ ) ∘ ι ( ψ ) .
Proof.
(1) ι ( i d ) ( x ) = i d ( x ) = x = i d ( x ) \iota(id)(x) = id(x) = x = id(x) ι ( i d ) ( x ) = i d ( x ) = x = i d ( x ) .
(2) ι ( ⇑ ) ( x ) = ⇑ ( x ) = x + 1 \iota(\Uparrow)(x) = \Uparrow(x) = x + 1 ι ( ⇑ ) ( x ) =⇑ ( x ) = x + 1 . As a substitution, this is the variable x + 1 x + 1 x + 1 , which equals ⇑ \Uparrow ⇑ viewed as a substitution.
(3) Already shown in the proof of Theorem 2.14: q ( ι ( ϕ ) ) ( 0 ) = 0 = ι ( q ( ϕ ) ) ( 0 ) q(\iota(\phi))(0) = 0 = \iota(q(\phi))(0) q ( ι ( ϕ )) ( 0 ) = 0 = ι ( q ( ϕ )) ( 0 ) and q ( ι ( ϕ ) ) ( x + 1 ) = ϕ ( x ) + 1 = ι ( q ( ϕ ) ) ( x + 1 ) q(\iota(\phi))(x + 1) = \phi(x) + 1 = \iota(q(\phi))(x + 1) q ( ι ( ϕ )) ( x + 1 ) = ϕ ( x ) + 1 = ι ( q ( ϕ )) ( x + 1 ) .
(4) We verify pointwise:
( ι ( ϕ ) ∘ ι ( ψ ) ) ( x ) = ι ( ϕ ) ( x ) [ ι ( ψ ) ] = ϕ ( x ) [ ι ( ψ ) ] = ψ ( ϕ ( x ) ) (\iota(\phi) \mathbin{\circ} \iota(\psi))(x) = \iota(\phi)(x)[\iota(\psi)]
\\
= \phi(x)[\iota(\psi)]
\\
= \psi(\phi(x)) ( ι ( ϕ ) ∘ ι ( ψ )) ( x ) = ι ( ϕ ) ( x ) [ ι ( ψ )] = ϕ ( x ) [ ι ( ψ )] = ψ ( ϕ ( x )) (by Theorem 2.14)
= ( ϕ ∘ ψ ) ( x ) = ι ( ϕ ∘ ψ ) ( x ) = (\phi\mathbin{\circ} \psi)(x)
\\
= \iota(\phi\mathbin{\circ} \psi)(x) = ( ϕ ∘ ψ ) ( x ) = ι ( ϕ ∘ ψ ) ( x )
Since ι \iota ι preserves identity, shift, q q q , and composition, it is a faithful embedding of the weakening algebra into the substitution algebra. We may therefore elide ι \iota ι entirely, treating weakenings as substitutions whenever convenient. In what follows, we write t [ ϕ ] t[\phi] t [ ϕ ] , σ ∘ ϕ \sigma\mathbin{\circ} \phi σ ∘ ϕ , etc., understanding that ϕ \phi ϕ is implicitly promoted to a substitution via ι \iota ι .
We now establish the key algebraic properties of substitutions and their interaction with weakenings.
Lemma 2.16 (q q q -Identity for Substitutions). q ( i d ) = i d q(id) = id q ( i d ) = i d .
Proof. By case analysis:
q ( i d ) ( 0 ) = 0 = i d ( 0 ) q(id)(0) = 0 = id(0) q ( i d ) ( 0 ) = 0 = i d ( 0 ) q ( i d ) ( x + 1 ) = i d ( x ) [ ⇑ ] = x [ ⇑ ] = x + 1 = i d ( x + 1 ) q(id)(x + 1) = id(x)[\Uparrow] = x[\Uparrow] = x + 1 = id(x + 1) q ( i d ) ( x + 1 ) = i d ( x ) [ ⇑ ] = x [ ⇑ ] = x + 1 = i d ( x + 1 )
Lemma 2.17 (Identity Substitution). For all t ∈ E x p t \in Exp t ∈ E x p : t [ i d ] = t t[id] = t t [ i d ] = t .
Proof. By induction on t t t .
Case t = x t = x t = x (variable). x [ i d ] = i d ( x ) = x x[id] = id(x) = x x [ i d ] = i d ( x ) = x .
Case t = λ x . t ′ t = \lambda x.t' t = λ x . t ′ .
( λ x . t ′ ) [ i d ] = λ x . ( t ′ [ q ( i d ) ] ) = λ x . ( t ′ [ i d ] ) = λ x . t ′ (\lambda x.t')[\mathrm{id}] = \lambda x.(t'[q(\mathrm{id})])
= \lambda x.(t'[\mathrm{id}])
= \lambda x.t' ( λ x . t ′ ) [ id ] = λ x . ( t ′ [ q ( id )]) = λ x . ( t ′ [ id ]) = λ x . t ′
(by Theorem 2.16)
(by IH)
Case t = Π ( x : S ) . T t = \Pi(x:S).T t = Π ( x : S ) . T .
( Π ( x : S ) . T ) [ i d ] = Π ( x : S [ i d ] ) . ( T [ q ( i d ) ] ) = Π ( x : S ) . ( T [ i d ] ) = Π ( x : S ) . T (\Pi(x:S).T)[\mathrm{id}] = \Pi(x:S[\mathrm{id}]).(T[q(\mathrm{id})])
= \Pi(x:S).(T[\mathrm{id}])
= \Pi(x:S).T ( Π ( x : S ) . T ) [ id ] = Π ( x : S [ id ]) . ( T [ q ( id )]) = Π ( x : S ) . ( T [ id ]) = Π ( x : S ) . T
(by IH and Theorem 2.16)
(by IH)
All other cases are similar. □
Before proving the commutation lemma, we establish auxiliary facts about how q n q^n q n acts on weakenings and substitutions at specific indices.
Lemma 2.18 (Action of q n q^n q n on Indices). For all n n n and weakenings ϕ \phi ϕ :
(1) If x < n x < n x < n , then q n ( ϕ ) ( x ) = x q^n(\phi)(x) = x q n ( ϕ ) ( x ) = x .
(2) q n ( ϕ ) ( x ) = ϕ ( 0 ) + x q^n(\phi)(x) = \phi(0) + x q n ( ϕ ) ( x ) = ϕ ( 0 ) + x .
(3) If x > n x > n x > n , then q n ( ϕ ) ( x ) = ϕ ( x − n ) + n q^n(\phi)(x) = \phi(x-n) + n q n ( ϕ ) ( x ) = ϕ ( x − n ) + n .
In particular, for ϕ = ⇑ \phi= \Uparrow ϕ =⇑ :
(a) If x < n x < n x < n , then q n ( ⇑ ) ( x ) = x q^n(\Uparrow)(x) = x q n ( ⇑ ) ( x ) = x .
(b) q n ( ⇑ ) ( x ) = x + 1 q^n(\Uparrow)(x) = x + 1 q n ( ⇑ ) ( x ) = x + 1 .
(c) If x > n x > n x > n , then q n ( ⇑ ) ( x ) = x + 1 q^n(\Uparrow)(x) = x + 1 q n ( ⇑ ) ( x ) = x + 1 .
Proof. By induction on n n n .
Case n = 0 n = 0 n = 0 : (1) vacuous. (2) q 0 ( ϕ ) ( 0 ) = ϕ ( 0 ) = ϕ ( 0 ) + 0 q^0(\phi)(0) = \phi(0) = \phi(0) + 0 q 0 ( ϕ ) ( 0 ) = ϕ ( 0 ) = ϕ ( 0 ) + 0 . (3) q 0 ( ϕ ) ( x ) = ϕ ( x ) = ϕ ( x − 0 ) + 0 q^0(\phi)(x) = \phi(x) = \phi(x - 0) + 0 q 0 ( ϕ ) ( x ) = ϕ ( x ) = ϕ ( x − 0 ) + 0 .
Case n + 1 n + 1 n + 1 : We use q n + 1 ( ϕ ) = q ( q n ( ϕ ) ) q^{n+1}(\phi) = q(q^n(\phi)) q n + 1 ( ϕ ) = q ( q n ( ϕ )) .
(1) If x < n + 1 x < n + 1 x < n + 1 : either x = 0 x = 0 x = 0 (then q ( q n ( ϕ ) ) ( 0 ) = 0 = x q(q^n(\phi))(0) = 0 = x q ( q n ( ϕ )) ( 0 ) = 0 = x ) or x = y + 1 x = y + 1 x = y + 1 with y < n y < n y < n (then q ( q n ( ϕ ) ) ( y + 1 ) = q n ( ϕ ) ( y ) + 1 = y + 1 = x q(q^n(\phi))(y + 1) = q^n(\phi)(y) + 1 = y + 1 = x q ( q n ( ϕ )) ( y + 1 ) = q n ( ϕ ) ( y ) + 1 = y + 1 = x by the IH).
(2) x = n + 1 x = n + 1 x = n + 1 : q ( q n ( ϕ ) ) ( n + 1 ) = q n ( ϕ ) ( n ) + 1 = ( ϕ ( 0 ) + n ) + 1 = ϕ ( 0 ) + ( n + 1 ) q(q^n(\phi))(n + 1) = q^n(\phi)(n) + 1 = (\phi(0) + n) + 1 = \phi(0) + (n + 1) q ( q n ( ϕ )) ( n + 1 ) = q n ( ϕ ) ( n ) + 1 = ( ϕ ( 0 ) + n ) + 1 = ϕ ( 0 ) + ( n + 1 ) by the IH.
(3) x > n + 1 x > n + 1 x > n + 1 : x = y + 1 x = y + 1 x = y + 1 with y > n y > n y > n . q ( q n ( ϕ ) ) ( y + 1 ) = q n ( ϕ ) ( y ) + 1 = ( ϕ ( y − n ) + n ) + 1 = ϕ ( ( y + 1 ) − ( n + 1 ) ) + ( n + 1 ) q(q^n(\phi))(y + 1) = q^n(\phi)(y) + 1 = (\phi(y - n) + n) + 1 = \phi((y + 1) - (n + 1)) + (n + 1) q ( q n ( ϕ )) ( y + 1 ) = q n ( ϕ ) ( y ) + 1 = ( ϕ ( y − n ) + n ) + 1 = ϕ (( y + 1 ) − ( n + 1 )) + ( n + 1 ) by the IH.
Lemma 2.19 (Action of q n q^n q n on Substitution Indices). For all n n n and substitutions σ \sigma σ :
(1) If x < n x < n x < n , then q n ( σ ) ( x ) = x q^n(\sigma)(x) = x q n ( σ ) ( x ) = x .
(2) q n ( σ ) ( n ) = σ ( 0 ) [ ⇑ n ] q^n(\sigma)(n) = \sigma(0)[\Uparrow^n] q n ( σ ) ( n ) = σ ( 0 ) [ ⇑ n ] (where ⇑ n \Uparrow^n ⇑ n denotes n n n -fold shift).
(3) If x > n x > n x > n , then q n ( σ ) ( x ) = σ ( x − n ) [ ⇑ n ] q^n(\sigma)(x) = \sigma(x - n)[\Uparrow^n] q n ( σ ) ( x ) = σ ( x − n ) [ ⇑ n ] .
Proof. By induction on n n n .
Case n = 0 n = 0 n = 0 : (1) vacuous. (2) q 0 ( σ ) ( 0 ) = σ ( 0 ) = σ ( 0 ) [ ⇑ 0 ] q^0(\sigma)(0) = \sigma(0) = \sigma(0)[\Uparrow^0] q 0 ( σ ) ( 0 ) = σ ( 0 ) = σ ( 0 ) [ ⇑ 0 ] . (3) q 0 ( σ ) ( x ) = σ ( x ) = σ ( x − 0 ) [ ⇑ 0 ] q^0(\sigma)(x) = \sigma(x) = \sigma(x - 0)[\Uparrow^0] q 0 ( σ ) ( x ) = σ ( x ) = σ ( x − 0 ) [ ⇑ 0 ] .
Case n + 1 n + 1 n + 1 : We use q n + 1 ( σ ) = q ( q n ( σ ) ) q^{n+1}(\sigma) = q(q^n(\sigma)) q n + 1 ( σ ) = q ( q n ( σ )) .
(1) If x < n + 1 x < n + 1 x < n + 1 : either x = 0 x = 0 x = 0 (then q ( q n ( σ ) ) ( 0 ) = 0 = x q(q^n(\sigma))(0) = 0 = x q ( q n ( σ )) ( 0 ) = 0 = x ) or x = y + 1 x = y + 1 x = y + 1 with y < n y < n y < n (then q ( q n ( σ ) ) ( y + 1 ) = ( q n ( σ ) ( y ) ) [ ⇑ ] = y [ ⇑ ] = y + 1 = x q(q^n(\sigma))(y + 1) = (q^n(\sigma)(y))[\Uparrow] = y[\Uparrow] = y + 1 = x q ( q n ( σ )) ( y + 1 ) = ( q n ( σ ) ( y )) [ ⇑ ] = y [ ⇑ ] = y + 1 = x by the IH (1)).
(2) x = n + 1 x = n + 1 x = n + 1 :
q ( q n ( σ ) ) ( n + 1 ) = ( q n ( σ ) ( n ) ) [ ⇑ ] = ( σ ( 0 ) [ ⇑ n ] ) [ ⇑ ] = σ ( 0 ) [ ⇑ n + 1 ] q(q^{n}(\sigma))(n + 1) = (q^{n}(\sigma)(n))[\Uparrow]
= (\sigma(0)[\Uparrow^{n}])[\Uparrow]
= \sigma(0)[\Uparrow^{n+1}] q ( q n ( σ )) ( n + 1 ) = ( q n ( σ ) ( n )) [ ⇑ ] = ( σ ( 0 ) [ ⇑ n ]) [ ⇑ ] = σ ( 0 ) [ ⇑ n + 1 ]
(by IH (2))
(by Theorem 2.9)
(3) x > n + 1 x > n + 1 x > n + 1 : x = y + 1 x = y + 1 x = y + 1 with y > n y > n y > n .
q ( q n ( σ ) ) ( y + 1 ) = ( q n ( σ ) ( y ) ) [ ⇑ ] = ( σ ( y − n ) [ ⇑ n ] ) [ ⇑ ] = σ ( y − n ) [ ⇑ n + 1 ] = σ ( ( y + 1 ) − ( n + 1 ) ) [ ⇑ n + 1 ] q(q^{n}(\sigma))(y + 1) = (q^{n}(\sigma)(y))[\Uparrow]
= (\sigma(y-n)[\Uparrow^{n}])[\Uparrow]
= \sigma(y-n)[\Uparrow^{n+1}]
= \sigma((y + 1) - (n + 1))[\Uparrow^{n+1}] q ( q n ( σ )) ( y + 1 ) = ( q n ( σ ) ( y )) [ ⇑ ] = ( σ ( y − n ) [ ⇑ n ]) [ ⇑ ] = σ ( y − n ) [ ⇑ n + 1 ] = σ (( y + 1 ) − ( n + 1 )) [ ⇑ n + 1 ]
(by IH (3))
(by Theorem 2.9)
Lemma 2.20 (Weakening–Substitution Commutation (Generalized)). For all t ∈ E x p t \in Exp t ∈ E x p , n ∈ N n \in\mathbb{N} n ∈ N , and substitutions σ \sigma σ :
( t [ q n ( ⇑ ) ] ) [ q 1 + n ( σ ) ] = [ t [ q n ( σ ) ] [ q n ( ⇑ ) ] (t[q^{n}(\Uparrow)]) [q^{1+n}(\sigma)] = [t[q^{n}(\sigma)] [q^{n}(\Uparrow)] ( t [ q n ( ⇑ )]) [ q 1 + n ( σ )] = [ t [ q n ( σ )] [ q n ( ⇑ )] The statement we actually need is the special case n = 0 n = 0 n = 0 : ( t [ ⇑ ] ) [ q ( σ ) ] = t [ σ ] [ ⇑ ] (t[\Uparrow]) [q(\sigma)] = t[\sigma] [\Uparrow] ( t [ ⇑ ]) [ q ( σ )] = t [ σ ] [ ⇑ ] . The generalization over n n n is required because passing under binders increments the q q q -level: in the body of a λ \lambda λ or Π \Pi Π , we need the statement at n + 1 n + 1 n + 1 .
Proof. By induction on t t t , generalizing over n n n .
Case t = x t = x t = x (variable). We must show ( q n ( ⇑ ) ( x ) ) [ q 1 + n ( σ ) ] = ( q n ( σ ) ( x ) ) [ q n ( ⇑ ) ] (q^{n}(\Uparrow)(x)) [q^{1+n}(\sigma)] = (q^{n}(\sigma)(x))[q^{n}(\Uparrow)] ( q n ( ⇑ ) ( x )) [ q 1 + n ( σ )] = ( q n ( σ ) ( x )) [ q n ( ⇑ )] . We case-split on the position of x x x relative to n n n .
– If x < n x < n x < n :
\begin{aligned}
\mathrm{LHS} &= (q^{n}(\Uparrow)(x))[q^{1+n}(\sigma)]\\
&= x[q^{1+n}(\sigma)] && \text{(by {xref}`Theorem 2.18(a)`: \$q^{n}(\Uparrow)(x) = x\$ since \$x < n\$)}\\
&= x && \text{(by {xref}`Theorem 2.19(1)`: \$q^{1+n}(\sigma)(x) = x\$ since \$x < n < 1 + n\$)}
\end{aligned}
\begin{aligned}
\mathrm{RHS} &= (q^{n}(\sigma)(x))[q^{n}(\Uparrow)]\\
&= x[q^{n}(\Uparrow)] && \text{(by {xref}`Theorem 2.19(1)`: \$q^{n}(\sigma)(x) = x\$ since \$x < n\$)}\\
&= x && \text{(by {xref}`Theorem 2.18(a)`)}
\end{aligned}
– If x = n x = n x = n :
L H S = ( q n ( ⇑ ) ( n ) ) [ q 1 + n ( σ ) ] = ( n + 1 ) [ q 1 + n ( σ ) ] (by xref‘Theorem 2.18(b)‘) = q 1 + n ( σ ) ( 1 + n ) = σ ( 0 ) [ ⇑ 1 + n ] (by xref‘Theorem 2.19(2)‘ at iteration $1 + n$) \begin{aligned}
\mathrm{LHS} &= (q^{n}(\Uparrow)(n))[q^{1+n}(\sigma)]\\
&= (n + 1)[q^{1+n}(\sigma)] && \text{(by {xref}`Theorem 2.18(b)`)}\\
&= q^{1+n}(\sigma)(1 + n)\\
&= \sigma(0)[\Uparrow^{1+n}] && \text{(by {xref}`Theorem 2.19(2)` at iteration \$1 + n\$)}
\end{aligned} LHS = ( q n ( ⇑ ) ( n )) [ q 1 + n ( σ )] = ( n + 1 ) [ q 1 + n ( σ )] = q 1 + n ( σ ) ( 1 + n ) = σ ( 0 ) [ ⇑ 1 + n ] (by xref ‘Theorem 2.18(b)‘) (by xref ‘Theorem 2.19(2)‘ at iteration $1 + n$)
\begin{aligned}
\mathrm{RHS} &= (q^{n}(\sigma)(n))[q^{n}(\Uparrow)]\\
&= (\sigma(0)[\Uparrow^{n}])[q^{n}(\Uparrow)] && \text{(by {xref}`Theorem 2.19(2)`)}\\
&= \sigma(0)[\Uparrow^{n} \circ q^{n}(\Uparrow)] && \text{(by {xref}`Theorem 2.9`)}\\
&= \sigma(0)[\Uparrow^{1+n}] && \text{(since \$(\Uparrow^{n} \circ q^{n}(\Uparrow))(x) = q^{n}(\Uparrow)(x + n) = x + 1 + n = \Uparrow^{1+n}(x)\$)}
\end{aligned}
– If x > n x > n x > n : Let x = 1 + n + k x = 1 + n + k x = 1 + n + k .
L H S = ( q n ( ⇑ ) ( 1 + n + k ) ) [ q 1 + n ( σ ) ] = ( 2 + n + k ) [ q 1 + n ( σ ) ] (by x r e f ‘ T h e o r e m 2.18 ( c ) ‘ ) = q 1 + n ( σ ) ( 2 + n + k ) = σ ( 1 + k ) [ ⇑ 1 + n ] (by x r e f ‘ T h e o r e m 2.19 ( 3 ) ‘ : ( 2 + n + k ) − ( 1 + n ) = 1 + k ) \begin{aligned}
\mathrm{LHS} &= (q^n(\Uparrow)(1+n+k))[q^{1+n}(\sigma)]\\
&= (2+n+k)[q^{1+n}(\sigma)] && \text{(by } {xref}`Theorem 2.18(c)`\text{)}\\
&= q^{1+n}(\sigma)(2+n+k)\\
&= \sigma(1+k)[\Uparrow^{1+n}] && \text{(by } {xref}`Theorem 2.19(3)`\text{: }(2+n+k)-(1+n)=1+k\text{)}
\end{aligned} LHS = ( q n ( ⇑ ) ( 1 + n + k )) [ q 1 + n ( σ )] = ( 2 + n + k ) [ q 1 + n ( σ )] = q 1 + n ( σ ) ( 2 + n + k ) = σ ( 1 + k ) [ ⇑ 1 + n ] (by x r e f ‘ T h eor e m 2.18 ( c ) ‘ ) (by x r e f ‘ T h eor e m 2.19 ( 3 ) ‘ : ( 2 + n + k ) − ( 1 + n ) = 1 + k )
R H S = ( q n ( σ ) ( 1 + n + k ) ) [ q n ( ⇑ ) ] = ( σ ( 1 + k ) [ ⇑ n ] ) [ q n ( ⇑ ) ] (by x r e f ‘ T h e o r e m 2.19 ( 3 ) ‘ : ( 1 + n + k ) − n = 1 + k ) = σ ( 1 + k ) [ ⇑ n ∘ q n ( ⇑ ) ] (by x r e f ‘ T h e o r e m 2.9 ‘ ) = σ ( 1 + k ) [ ⇑ 1 + n ] (as above) \begin{aligned}
\mathrm{RHS} &= (q^n(\sigma)(1+n+k))[q^n(\Uparrow)]\\
&= (\sigma(1+k)[\Uparrow^n])[q^n(\Uparrow)] && \text{(by } {xref}`Theorem 2.19(3)`\text{: }(1+n+k)-n=1+k\text{)}\\
&= \sigma(1+k)[\Uparrow^n\circ q^n(\Uparrow)] && \text{(by } {xref}`Theorem 2.9`\text{)}\\
&= \sigma(1+k)[\Uparrow^{1+n}] && \text{(as above)}
\end{aligned} RHS = ( q n ( σ ) ( 1 + n + k )) [ q n ( ⇑ )] = ( σ ( 1 + k ) [ ⇑ n ]) [ q n ( ⇑ )] = σ ( 1 + k ) [ ⇑ n ∘ q n ( ⇑ )] = σ ( 1 + k ) [ ⇑ 1 + n ] (by x r e f ‘ T h eor e m 2.19 ( 3 ) ‘ : ( 1 + n + k ) − n = 1 + k ) (by x r e f ‘ T h eor e m 2.9‘ ) (as above)
Case t = λ y . t ′ t = \lambda y.t' t = λ y . t ′ .
( λ y . t ′ ) [ q n ( ⇑ ) ] [ q 1 + n ( σ ) ] = ( λ y . t ′ [ q n ( ⇑ ) ] ) [ q 1 + n ( σ ) ] = λ y . ( t ′ [ q n ( ⇑ ) ] ) [ q 2 + n ( σ ) ] = λ y . ( t ′ [ q 1 + n ( σ ) ] ) [ q 1 + n ( ⇑ ) ] (by IH at 1 + n ) = ( λ y . t ′ [ q 1 + n ( σ ) ] ) [ q n ( ⇑ ) ] = ( λ y . t ′ ) [ q 1 + n ( σ ) ] [ q n ( ⇑ ) ] \begin{aligned}
(\lambda y.t')[q^n(\Uparrow)][q^{1+n}(\sigma)] &= (\lambda y.t'[q^n(\Uparrow)])[q^{1+n}(\sigma)]\\
&= \lambda y.(t'[q^n(\Uparrow)])[q^{2+n}(\sigma)]\\
&= \lambda y.(t'[q^{1+n}(\sigma)])[q^{1+n}(\Uparrow)] && \text{(by IH at }1+n\text{)}\\
&= (\lambda y.t'[q^{1+n}(\sigma)])[q^n(\Uparrow)]\\
&= (\lambda y.t')[q^{1+n}(\sigma)][q^n(\Uparrow)]
\end{aligned} ( λ y . t ′ ) [ q n ( ⇑ )] [ q 1 + n ( σ )] = ( λ y . t ′ [ q n ( ⇑ )]) [ q 1 + n ( σ )] = λ y . ( t ′ [ q n ( ⇑ )]) [ q 2 + n ( σ )] = λ y . ( t ′ [ q 1 + n ( σ )]) [ q 1 + n ( ⇑ )] = ( λ y . t ′ [ q 1 + n ( σ )]) [ q n ( ⇑ )] = ( λ y . t ′ ) [ q 1 + n ( σ )] [ q n ( ⇑ )] (by IH at 1 + n )
Case t = Π ( y : S ) . T t = \Pi(y:S).T t = Π ( y : S ) . T .
( Π ( y : S ) . T ) [ q n ( ⇑ ) ] [ q 1 + n ( σ ) ] = ( Π ( y : S [ q n ( ⇑ ) ] ) . ( T [ q 1 + n ( ⇑ ) ] ) ) [ q 1 + n ( σ ) ] = Π ( y : S [ q n ( ⇑ ) ] [ q 1 + n ( σ ) ] ) . ( T [ q 1 + n ( ⇑ ) ] [ q 2 + n ( σ ) ] ) = Π ( y : S [ q 1 + n ( σ ) ] [ q n ( ⇑ ) ] ) . ( T [ q 1 + n ( σ ) ] [ q 1 + n ( ⇑ ) ] ) (by IH at n and 1 + n ) = ( Π ( y : S [ q 1 + n ( σ ) ] ) . ( T [ q 1 + n ( σ ) ] ) ) [ q n ( ⇑ ) ] = ( Π ( y : S ) . T ) [ q 1 + n ( σ ) ] [ q n ( ⇑ ) ] \begin{aligned}
(\Pi(y:S).T)[q^n(\Uparrow)][q^{1+n}(\sigma)] &= (\Pi(y:S[q^n(\Uparrow)]).(T[q^{1+n}(\Uparrow)]))[q^{1+n}(\sigma)]\\
&= \Pi(y:S[q^n(\Uparrow)][q^{1+n}(\sigma)]).(T[q^{1+n}(\Uparrow)][q^{2+n}(\sigma)])\\
&= \Pi(y:S[q^{1+n}(\sigma)][q^n(\Uparrow)]).(T[q^{1+n}(\sigma)][q^{1+n}(\Uparrow)]) && \text{(by IH at }n\text{ and }1+n\text{)}\\
&= (\Pi(y:S[q^{1+n}(\sigma)]).(T[q^{1+n}(\sigma)]))[q^n(\Uparrow)]\\
&= (\Pi(y:S).T)[q^{1+n}(\sigma)][q^n(\Uparrow)]
\end{aligned} ( Π ( y : S ) . T ) [ q n ( ⇑ )] [ q 1 + n ( σ )] = ( Π ( y : S [ q n ( ⇑ )]) . ( T [ q 1 + n ( ⇑ )])) [ q 1 + n ( σ )] = Π ( y : S [ q n ( ⇑ )] [ q 1 + n ( σ )]) . ( T [ q 1 + n ( ⇑ )] [ q 2 + n ( σ )]) = Π ( y : S [ q 1 + n ( σ )] [ q n ( ⇑ )]) . ( T [ q 1 + n ( σ )] [ q 1 + n ( ⇑ )]) = ( Π ( y : S [ q 1 + n ( σ )]) . ( T [ q 1 + n ( σ )])) [ q n ( ⇑ )] = ( Π ( y : S ) . T ) [ q 1 + n ( σ )] [ q n ( ⇑ )] (by IH at n and 1 + n )
The remaining cases follow the same pattern, applying the IH at increased n n n for each binder. □
Lemma 2.21 (q Distributes over Composition). For all substitutions σ , τ \sigma,\tau σ , τ : q ( σ ) ∘ q ( τ ) = q ( σ ∘ τ ) q(\sigma)\circ q(\tau)=q(\sigma\circ\tau) q ( σ ) ∘ q ( τ ) = q ( σ ∘ τ ) .
Proof. By case analysis:
Case At index 0:
( q ( σ ) ∘ q ( τ ) ) ( 0 ) = q ( σ ) ( 0 ) [ q ( τ ) ] = 0 [ q ( τ ) ] = q ( τ ) ( 0 ) = 0 = q ( σ ∘ τ ) ( 0 ) (q(\sigma)\circ q(\tau))(0)=q(\sigma)(0)[q(\tau)]=0[q(\tau)]=q(\tau)(0)=0=q(\sigma\circ\tau)(0) ( q ( σ ) ∘ q ( τ )) ( 0 ) = q ( σ ) ( 0 ) [ q ( τ )] = 0 [ q ( τ )] = q ( τ ) ( 0 ) = 0 = q ( σ ∘ τ ) ( 0 )
Case At index x + 1 x+1 x + 1 :
( q ( σ ) ∘ q ( τ ) ) ( x + 1 ) = ( q ( σ ) ( x + 1 ) ) [ q ( τ ) ] = ( σ ( x ) ) [ ⇑ ] [ q ( τ ) ] = ( σ ( x ) ) [ τ ] [ ⇑ ] (by x r e f ‘ T h e o r e m 2.20 ‘ ) = ( ( σ ∘ τ ) ( x ) ) [ ⇑ ] = q ( σ ∘ τ ) ( x + 1 ) \begin{aligned}
(q(\sigma)\circ q(\tau))(x+1) &= (q(\sigma)(x+1))[q(\tau)]\\
&= (\sigma(x))[\Uparrow][q(\tau)]\\
&= (\sigma(x))[\tau][\Uparrow] && \text{(by } {xref}`Theorem 2.20`\text{)}\\
&= ((\sigma\circ\tau)(x))[\Uparrow]\\
&= q(\sigma\circ\tau)(x+1)
\end{aligned} ( q ( σ ) ∘ q ( τ )) ( x + 1 ) = ( q ( σ ) ( x + 1 )) [ q ( τ )] = ( σ ( x )) [ ⇑ ] [ q ( τ )] = ( σ ( x )) [ τ ] [ ⇑ ] = (( σ ∘ τ ) ( x )) [ ⇑ ] = q ( σ ∘ τ ) ( x + 1 ) (by x r e f ‘ T h eor e m 2.20‘ )
Lemma 2.22 (Composition of Substitution Application). For all t ∈ E x p t \in Exp t ∈ E x p and substitutions σ \sigma σ , τ \tau τ : t [ σ ] [ τ ] = t [ σ ∘ τ ] t[\sigma][\tau] = t[\sigma\circ\tau] t [ σ ] [ τ ] = t [ σ ∘ τ ] .
Proof. By induction on t t t .
Case t = x t = x t = x (variable). x [ σ ] [ τ ] = σ ( x ) [ τ ] = ( σ ∘ τ ) ( x ) = x [ σ ∘ τ ] x[\sigma][\tau] = \sigma(x)[\tau] = (\sigma\circ\tau)(x) = x[\sigma\circ\tau] x [ σ ] [ τ ] = σ ( x ) [ τ ] = ( σ ∘ τ ) ( x ) = x [ σ ∘ τ ] .
Case t = λ x . t ′ t = \lambda x.t' t = λ x . t ′ .
( λ x . t ′ ) [ σ ] [ τ ] = ( λ x . t ′ [ q ( σ ) ] ) [ τ ] (\lambda x.t')[\sigma][\tau] = (\lambda x.t'[q(\sigma)])[\tau] ( λ x . t ′ ) [ σ ] [ τ ] = ( λ x . t ′ [ q ( σ )]) [ τ ] = λ x . ( t ′ [ q ( σ ) ] [ q ( τ ) ] ) = \lambda x.(t'[q(\sigma)][q(\tau)]) = λ x . ( t ′ [ q ( σ )] [ q ( τ )]) = λ x . ( t ′ [ q ( σ ) ∘ q ( τ ) ] ) (by IH) = \lambda x.(t'[q(\sigma) \circ q(\tau)]) \qquad\text{(by IH)} = λ x . ( t ′ [ q ( σ ) ∘ q ( τ )]) (by IH) = λ x . ( t ′ [ q ( σ ∘ τ ) ] ) (by Theorem 2.21) = \lambda x.(t'[q(\sigma\circ\tau)]) \qquad\text{(by Theorem 2.21)} = λ x . ( t ′ [ q ( σ ∘ τ )]) (by Theorem 2.21) = ( λ x . t ′ ) [ σ ∘ τ ] = (\lambda x.t')[\sigma\circ\tau] = ( λ x . t ′ ) [ σ ∘ τ ] Case t = elim N a t ( x . T ) z ( x , y . s ) t ′ t = \operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t' t = elim Nat ( x . T ) z ( x , y . s ) t ′ .
( elim N a t ( x . T ) z ( x , y . s ) t ′ ) [ σ ] [ τ ] = ( elim N a t ( x . T [ q ( σ ) ] ) z [ σ ] ( x , y . s [ q 2 ( σ ) ] ) t ′ [ σ ] ) [ τ ] = elim N a t ( x . T [ q ( σ ) ] [ q ( τ ) ] ) z [ σ ] [ τ ] ( x , y . s [ q 2 ( σ ) ] [ q 2 ( τ ) ] ) t ′ [ σ ] [ τ ] = elim N a t ( x . T [ q ( σ ∘ τ ) ] ) z [ σ ∘ τ ] ( x , y . s [ q 2 ( σ ∘ τ ) ] ) t ′ [ σ ∘ τ ] (by IH and Theorem 2.21) = ( elim N a t ( x . T ) z ( x , y . s ) t ′ ) [ σ ∘ τ ] \begin{aligned}
(\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t')[\sigma][\tau]
&= (\operatorname{elim}_{\mathrm{Nat}}(x.T[q(\sigma)])\ z[\sigma]\ (x,y.s[q^2(\sigma)])\ t'[\sigma])[\tau]\\
&= \operatorname{elim}_{\mathrm{Nat}}(x.T[q(\sigma)][q(\tau)])\ z[\sigma][\tau]\ (x,y.s[q^2(\sigma)][q^2(\tau)])\ t'[\sigma][\tau]\\
&= \operatorname{elim}_{\mathrm{Nat}}(x.T[q(\sigma\circ\tau)])\ z[\sigma\circ\tau]\ (x,y.s[q^2(\sigma\circ\tau)])\ t'[\sigma\circ\tau]\\
&\qquad\text{(by IH and Theorem 2.21)}\\
&= (\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t')[\sigma\circ\tau]
\end{aligned} ( elim Nat ( x . T ) z ( x , y . s ) t ′ ) [ σ ] [ τ ] = ( elim Nat ( x . T [ q ( σ )]) z [ σ ] ( x , y . s [ q 2 ( σ )]) t ′ [ σ ]) [ τ ] = elim Nat ( x . T [ q ( σ )] [ q ( τ )]) z [ σ ] [ τ ] ( x , y . s [ q 2 ( σ )] [ q 2 ( τ )]) t ′ [ σ ] [ τ ] = elim Nat ( x . T [ q ( σ ∘ τ )]) z [ σ ∘ τ ] ( x , y . s [ q 2 ( σ ∘ τ )]) t ′ [ σ ∘ τ ] (by IH and Theorem 2.21) = ( elim Nat ( x . T ) z ( x , y . s ) t ′ ) [ σ ∘ τ ] Other cases are similar. □
Lemma 2.23 (q q q Commutes with Pointwise Weakening). For all substitutions σ \sigma σ and weakenings ϕ \phi ϕ : q ( σ [ ϕ ] ) = q ( σ ) [ q ( ϕ ) ] q(\sigma[\phi]) = q(\sigma)[q(\phi)] q ( σ [ ϕ ]) = q ( σ ) [ q ( ϕ )] .
Proof. Since σ [ ϕ ] = σ ∘ ϕ \sigma[\phi] = \sigma\circ\phi σ [ ϕ ] = σ ∘ ϕ (treating ϕ \phi ϕ as a substitution), we have:
q ( σ [ ϕ ] ) = q ( σ ∘ ϕ ) q(\sigma[\phi]) = q(\sigma\circ\phi) q ( σ [ ϕ ]) = q ( σ ∘ ϕ ) = q ( σ ) ∘ q ( ϕ ) (by Theorem 2.21) = q(\sigma)\circ q(\phi) \qquad\text{(by Theorem 2.21)} = q ( σ ) ∘ q ( ϕ ) (by Theorem 2.21) = q ( σ ) [ q ( ϕ ) ] = q(\sigma)[q(\phi)] = q ( σ ) [ q ( ϕ )] □
Lemma 2.24 (Weakening–Substitution Interaction). The following two properties hold:
(1) For all t ∈ E x p t \in Exp t ∈ E x p , weakening ϕ \phi ϕ , and substitution σ \sigma σ : ( t [ ϕ ] ) [ σ ] = t [ ϕ ∘ σ ] (t[\phi])[\sigma] = t[\phi\circ\sigma] ( t [ ϕ ]) [ σ ] = t [ ϕ ∘ σ ] .
(2) For all t ∈ E x p t \in Exp t ∈ E x p , substitution σ \sigma σ , and weakening ϕ \phi ϕ : ( t [ σ ] ) [ ϕ ] = t [ σ [ ϕ ] ] (t[\sigma])[\phi] = t[\sigma[\phi]] ( t [ σ ]) [ ϕ ] = t [ σ [ ϕ ]] .
Proof. Statement (1) is a corollary of Theorems 2.14 and 2.22. Since we elide the embedding, treating ϕ \phi ϕ as a substitution:
( t [ ϕ ] ) [ σ ] = t [ ϕ ∘ σ ] (by Theorem 2.22) (t[\phi])[\sigma] = t[\phi\circ\sigma] \qquad\text{(by Theorem 2.22)} ( t [ ϕ ]) [ σ ] = t [ ϕ ∘ σ ] (by Theorem 2.22) Statement (2) also follows from Theorem 2.22:
( t [ σ ] ) [ ϕ ] = t [ σ ∘ ϕ ] (by Theorem 2.22) (t[\sigma])[\phi] = t[\sigma\circ\phi] \qquad\text{(by Theorem 2.22)} ( t [ σ ]) [ ϕ ] = t [ σ ∘ ϕ ] (by Theorem 2.22) We verify: ( σ ∘ ϕ ) ( x ) = σ ( x ) [ ϕ ] = ( σ [ ϕ ] ) ( x ) (\sigma\circ\phi)(x) = \sigma(x)[\phi] = (\sigma[\phi])(x) ( σ ∘ ϕ ) ( x ) = σ ( x ) [ ϕ ] = ( σ [ ϕ ]) ( x ) , which is exactly the definition of σ [ ϕ ] \sigma[\phi] σ [ ϕ ] . Hence σ ∘ ϕ = σ [ ϕ ] \sigma\circ\phi= \sigma[\phi] σ ∘ ϕ = σ [ ϕ ] and the claim holds. □
Lemma 2.25 (Shift–Extension Cancellation). For all substitutions σ \sigma σ and terms s s s : ⇑ ∘ ( σ , s / x ) = σ \Uparrow\circ(\sigma,s/x) = \sigma ⇑ ∘ ( σ , s / x ) = σ .
Proof. Pointwise:
( ⇑ ∘ ( σ , s / x ) ) ( y ) = ⇑ ( y ) [ ( σ , s / x ) ] = ( y + 1 ) [ ( σ , s / x ) ] = ( σ , s / x ) ( y + 1 ) = σ ( y ) (\Uparrow\circ(\sigma, s/x))(y) = \Uparrow(y)[(\sigma, s/x)]
= (y+1)[(\sigma, s/x)]
= (\sigma, s/x)(y+1)
= \sigma(y) ( ⇑ ∘ ( σ , s / x )) ( y ) =⇑ ( y ) [( σ , s / x )] = ( y + 1 ) [( σ , s / x )] = ( σ , s / x ) ( y + 1 ) = σ ( y )
Lemma 2.26 (Extension–Composition Distribution). For all substitutions σ , τ \sigma,\tau σ , τ and terms s s s : ( σ , s / x ) ∘ τ = ( σ ∘ τ , s [ τ ] / x ) (\sigma,s/x)\circ\tau=(\sigma\circ\tau,s[\tau]/x) ( σ , s / x ) ∘ τ = ( σ ∘ τ , s [ τ ] / x ) .
Proof. Pointwise:
( ( σ , s / x ) ∘ τ ) ( 0 ) = ( σ , s / x ) ( 0 ) [ τ ] = s [ τ ] = ( σ ∘ τ , s [ τ ] / x ) ( 0 ) \begin{aligned}
((\sigma,s/x)\circ\tau)(0) &= (\sigma,s/x)(0)[\tau]\\
&=s[\tau]\\
&=(\sigma\circ\tau,s[\tau]/x)(0)
\end{aligned} (( σ , s / x ) ∘ τ ) ( 0 ) = ( σ , s / x ) ( 0 ) [ τ ] = s [ τ ] = ( σ ∘ τ , s [ τ ] / x ) ( 0 )
( ( σ , s / x ) ∘ τ ) ( y + 1 ) = ( σ , s / x ) ( y + 1 ) [ τ ] = σ ( y ) [ τ ] = ( σ ∘ τ ) ( y ) = ( σ ∘ τ , s [ τ ] / x ) ( y + 1 ) \begin{aligned}
((\sigma,s/x)\circ\tau)(y+1) &= (\sigma,s/x)(y+1)[\tau]\\
&=\sigma(y)[\tau]\\
&=(\sigma\circ\tau)(y)\\
&=(\sigma\circ\tau,s[\tau]/x)(y+1)
\end{aligned} (( σ , s / x ) ∘ τ ) ( y + 1 ) = ( σ , s / x ) ( y + 1 ) [ τ ] = σ ( y ) [ τ ] = ( σ ∘ τ ) ( y ) = ( σ ∘ τ , s [ τ ] / x ) ( y + 1 )
Lemma 2.27 (q q q –Extension Interaction). For all t ∈ E x p t\in\mathit{Exp} t ∈ Exp , substitutions σ \sigma σ , and terms s s s :
t [ q ( σ ) ] [ i d , s / x ] = t [ σ , s / x ] t[q(\sigma)][\mathit{id},s/x]=t[\sigma,s/x] t [ q ( σ )] [ id , s / x ] = t [ σ , s / x ]
Proof. By Theorem 2.22, it suffices to show q ( σ ) ∘ ( i d , s / x ) = ( σ , s / x ) q(\sigma)\circ(\mathit{id},s/x)=(\sigma,s/x) q ( σ ) ∘ ( id , s / x ) = ( σ , s / x ) . Recall q ( σ ) = ( σ [ ⇑ ] , 0 / x ) q(\sigma)=(\sigma[\Uparrow],0/x) q ( σ ) = ( σ [ ⇑ ] , 0/ x ) . By Theorem 2.26:
q ( σ ) ∘ ( i d , s / x ) = ( σ [ ⇑ ] , 0 / x ) ∘ ( i d , s / x ) = ( σ [ ⇑ ] ∘ ( i d , s / x ) , 0 [ ( i d , s / x ) ] / x ) (by Theorem 2.26) = ( ( σ ∘ ⇑ ) ∘ ( i d , s / x ) , s / x ) = ( σ ∘ ( ⇑ ∘ ( i d , s / x ) ) , s / x ) = ( σ ∘ i d , s / x ) (by Theorem 2.25) = ( σ , s / x ) (by Theorem 2.17) \begin{aligned}
q(\sigma)\circ(\mathit{id},s/x)&=(\sigma[\Uparrow],0/x)\circ(\mathit{id},s/x)\\
&=(\sigma[\Uparrow]\circ(\mathit{id},s/x),0[(\mathit{id},s/x)]/x) && \text{(by Theorem 2.26)}\\
&=((\sigma\circ\Uparrow)\circ(\mathit{id},s/x),s/x)\\
&=(\sigma\circ(\Uparrow\circ(\mathit{id},s/x)),s/x)\\
&=(\sigma\circ\mathit{id},s/x) && \text{(by Theorem 2.25)}\\
&=(\sigma,s/x) && \text{(by Theorem 2.17)}
\end{aligned} q ( σ ) ∘ ( id , s / x ) = ( σ [ ⇑ ] , 0/ x ) ∘ ( id , s / x ) = ( σ [ ⇑ ] ∘ ( id , s / x ) , 0 [( id , s / x )] / x ) = (( σ ∘ ⇑ ) ∘ ( id , s / x ) , s / x ) = ( σ ∘ ( ⇑ ∘ ( id , s / x )) , s / x ) = ( σ ∘ id , s / x ) = ( σ , s / x ) (by Theorem 2.26) (by Theorem 2.25) (by Theorem 2.17)
Lemma 2.28 (Generalized q q q –Extension Interaction). For all t ∈ E x p t\in\mathit{Exp} t ∈ Exp , substitution σ \sigma σ , weakening ϕ \phi ϕ , and term s s s :
t [ q ( σ ) ] [ ϕ , s / x ] = t [ σ [ ϕ ] , s / x ] t[q(\sigma)][\phi,s/x]=t[\sigma[\phi],s/x] t [ q ( σ )] [ ϕ , s / x ] = t [ σ [ ϕ ] , s / x ]
Proof. By Theorem 2.22, it suffices to show q ( σ ) ∘ ( ϕ , s / x ) = ( σ [ ϕ ] , s / x ) q(\sigma)\circ(\phi,s/x)=(\sigma[\phi],s/x) q ( σ ) ∘ ( ϕ , s / x ) = ( σ [ ϕ ] , s / x ) . Recall q ( σ ) = ( σ [ ⇑ ] , 0 / x ) q(\sigma)=(\sigma[\Uparrow],0/x) q ( σ ) = ( σ [ ⇑ ] , 0/ x ) .
q ( σ ) ∘ ( ϕ , s / x ) = ( σ [ ⇑ ] , 0 / x ) ∘ ( ϕ , s / x ) = ( σ [ ⇑ ] ∘ ( ϕ , s / x ) , 0 [ ( ϕ , s / x ) ] / x ) (by Theorem 2.26) = ( ( σ ∘ ⇑ ) ∘ ( ϕ , s / x ) , s / x ) \begin{aligned}
q(\sigma)\circ(\phi,s/x)&=(\sigma[\Uparrow],0/x)\circ(\phi,s/x)\\
&=(\sigma[\Uparrow]\circ(\phi,s/x),0[(\phi,s/x)]/x) && \text{(by Theorem 2.26)}\\
&=((\sigma\circ\Uparrow)\circ(\phi,s/x),s/x)
\end{aligned} q ( σ ) ∘ ( ϕ , s / x ) = ( σ [ ⇑ ] , 0/ x ) ∘ ( ϕ , s / x ) = ( σ [ ⇑ ] ∘ ( ϕ , s / x ) , 0 [( ϕ , s / x )] / x ) = (( σ ∘ ⇑ ) ∘ ( ϕ , s / x ) , s / x ) (by Theorem 2.26)
= ( σ ∘ ( ⇑ ∘ ( ϕ , s / x ) ) , s / x ) (by Theorem 2.29 associativity) = ( σ ∘ ϕ , s / x ) (by Theorem 2.25) = ( σ [ ϕ ] , s / x ) \begin{aligned}
&= \left(\sigma\circ\left(\Uparrow\circ(\phi, s/x)\right), s/x\right) && \text{(by Theorem 2.29 associativity)}\\
&= \left(\sigma\circ\phi, s/x\right) && \text{(by Theorem 2.25)}\\
&= \left(\sigma[\phi], s/x\right)
\end{aligned} = ( σ ∘ ( ⇑ ∘ ( ϕ , s / x ) ) , s / x ) = ( σ ∘ ϕ , s / x ) = ( σ [ ϕ ] , s / x ) (by Theorem 2.29 associativity) (by Theorem 2.25)
Lemma 2.29 (Categorical Laws for Substitutions). Substitutions satisfy:
(1) (Left identity) i d ∘ σ = σ id \circ\sigma= \sigma i d ∘ σ = σ for all σ \sigma σ .
(2) (Right identity) σ ∘ i d = σ \sigma\circ id = \sigma σ ∘ i d = σ for all σ \sigma σ .
(3) (Associativity) ( σ ∘ τ ) ∘ δ = σ ∘ ( τ ∘ δ ) (\sigma\circ\tau) \circ\delta= \sigma\circ(\tau\circ\delta) ( σ ∘ τ ) ∘ δ = σ ∘ ( τ ∘ δ ) .
Proof.
(1) ( i d ∘ σ ) ( x ) = i d ( x ) [ σ ] = x [ σ ] = σ ( x ) (id \circ\sigma)(x) = id(x)[\sigma] = x[\sigma] = \sigma(x) ( i d ∘ σ ) ( x ) = i d ( x ) [ σ ] = x [ σ ] = σ ( x ) .
(2) ( σ ∘ i d ) ( n ) = σ ( x ) [ i d ] = σ ( x ) (\sigma\circ id)(n) = \sigma(x)[id] = \sigma(x) ( σ ∘ i d ) ( n ) = σ ( x ) [ i d ] = σ ( x ) by Theorem 2.17.
(3) By pointwise calculation:
( ( σ ∘ τ ) ∘ δ ) ( x ) = ( ( σ ∘ τ ) ( x ) ) [ δ ] = ( σ ( x ) [ τ ] ) [ δ ] = σ ( x ) [ τ ∘ δ ] (by Theorem 2.22) = ( σ ∘ ( τ ∘ δ ) ) ( x ) \begin{aligned}
((\sigma\circ\tau) \circ\delta)(x) &= ((\sigma\circ\tau)(x))[\delta]\\
&= (\sigma(x)[\tau])[\delta]\\
&= \sigma(x)[\tau\circ\delta] && \text{(by Theorem 2.22)}\\
&= (\sigma\circ(\tau\circ\delta))(x)
\end{aligned} (( σ ∘ τ ) ∘ δ ) ( x ) = (( σ ∘ τ ) ( x )) [ δ ] = ( σ ( x ) [ τ ]) [ δ ] = σ ( x ) [ τ ∘ δ ] = ( σ ∘ ( τ ∘ δ )) ( x ) (by Theorem 2.22)
Lemma 2.30 (Substitution–Extension Commutation). For all t ∈ E x p t \in Exp t ∈ E x p , substitutions σ \sigma σ , and terms s s s :
t [ q ( σ ) ] [ s [ σ ] / x ] = t [ s / x ] [ σ ] t[q(\sigma)][s[\sigma]/x] = t[s/x][\sigma] t [ q ( σ )] [ s [ σ ] / x ] = t [ s / x ] [ σ ] Proof. We show both sides equal t [ σ , s [ σ ] / x ] t[\sigma, s[\sigma]/x] t [ σ , s [ σ ] / x ] .
t [ q ( σ ) ] [ s [ σ ] / x ] = t [ q ( σ ) ] [ i d , s [ σ ] / x ] (by notation) = t [ σ , s [ σ ] / x ] (by Theorem 2.27) \begin{aligned}
t[q(\sigma)][s[\sigma]/x] &= t[q(\sigma)][id, s[\sigma]/x] && \text{(by notation)}\\
&= t[\sigma, s[\sigma]/x] && \text{(by Theorem 2.27)}
\end{aligned} t [ q ( σ )] [ s [ σ ] / x ] = t [ q ( σ )] [ i d , s [ σ ] / x ] = t [ σ , s [ σ ] / x ] (by notation) (by Theorem 2.27) t [ s / x ] [ σ ] = t [ i d , s / x ] [ σ ] (by notation) = t [ ( i d , s / x ) ∘ σ ] (by Theorem 2.22) = t [ i d ∘ σ , s [ σ ] / x ] (by Theorem 2.26) = t [ σ , s [ σ ] / x ] (by Theorem 2.29 (left identity)) \begin{aligned}
t[s/x][\sigma] &= t[id, s/x][\sigma] && \text{(by notation)}\\
&= t[(id, s/x) \circ\sigma] && \text{(by Theorem 2.22)}\\
&= t[id \circ\sigma, s[\sigma]/x] && \text{(by Theorem 2.26)}\\
&= t[\sigma, s[\sigma]/x] && \text{(by Theorem 2.29 (left identity))}
\end{aligned} t [ s / x ] [ σ ] = t [ i d , s / x ] [ σ ] = t [( i d , s / x ) ∘ σ ] = t [ i d ∘ σ , s [ σ ] / x ] = t [ σ , s [ σ ] / x ] (by notation) (by Theorem 2.22) (by Theorem 2.26) (by Theorem 2.29 (left identity))
Lemma 2.31 (Expansion of Substitutions). For all substitutions σ \sigma σ : σ = ( ⇑ ∘ σ , x 0 [ σ ] / x ) \sigma= (\Uparrow\circ\sigma, x_0[\sigma]/x) σ = ( ⇑ ∘ σ , x 0 [ σ ] / x ) , where x 0 x_0 x 0 denotes the variable at index 0.
Proof. Pointwise:
( ⇑ ∘ σ , x 0 [ σ ] / x ) ( 0 ) = x 0 [ σ ] = σ ( 0 ) ( ⇑ ∘ σ , x 0 [ σ ] / x ) ( y + 1 ) = ( ⇑ ∘ σ ) ( y ) = ⇑ ( y ) [ σ ] = ( y + 1 ) [ σ ] = σ ( y + 1 ) \begin{aligned}
(\Uparrow\circ\sigma, x_0[\sigma]/x)(0) &= x_0[\sigma] = \sigma(0)\\
(\Uparrow\circ\sigma, x_0[\sigma]/x)(y+1) &= (\Uparrow\circ\sigma)(y)\\
&= \Uparrow(y)[\sigma]\\
&= (y+1)[\sigma]\\
&= \sigma(y+1)
\end{aligned} ( ⇑ ∘ σ , x 0 [ σ ] / x ) ( 0 ) ( ⇑ ∘ σ , x 0 [ σ ] / x ) ( y + 1 ) = x 0 [ σ ] = σ ( 0 ) = ( ⇑ ∘ σ ) ( y ) =⇑ ( y ) [ σ ] = ( y + 1 ) [ σ ] = σ ( y + 1 ) Hence both sides agree at every index. □
Typing and Equational Theory
We define four mutually dependent judgment forms for our type theory. We consider MLTT with universe subtyping in the same form as [8 ] .
Definition 3.1 (Judgment Forms). The judgments of our type theory are:
⊢ Γ Γ is a well-formed context Γ ⊢ t : T t has type T in Γ Γ ⊢ t ≈ t ′ : T t and t ′ are equal terms of type T in Γ Γ ⊢ S ⊆ T S is a subtype of T in Γ \begin{array}{rcl}
\vdash\Gamma& & \Gamma\text{ is a well-formed context}\\
\Gamma\vdash t:T & & t\text{ has type }T\text{ in }\Gamma\\
\Gamma\vdash t \approx t' : T & & t\text{ and }t'\text{ are equal terms of type }T\text{ in }\Gamma\\
\Gamma\vdash S \subseteq T & & S\text{ is a subtype of }T\text{ in }\Gamma
\end{array} ⊢ Γ Γ ⊢ t : T Γ ⊢ t ≈ t ′ : T Γ ⊢ S ⊆ T Γ is a well-formed context t has type T in Γ t and t ′ are equal terms of type T in Γ S is a subtype of T in Γ Additionally, we have a derived judgment for substitution typing:
Γ ⊢ σ : Δ σ is a well-typed substitution from Δ to Γ \Gamma\vdash\sigma:\Delta\qquad\sigma\text{ is a well-typed substitution from }\Delta\text{ to }\Gamma Γ ⊢ σ : Δ σ is a well-typed substitution from Δ to Γ
Context Well-Formedness
⊢ ⋅ ⊢ Γ Γ ⊢ S : Ty i ⊢ Γ , x 0 : S \frac{\ }{\vdash\cdot}
\qquad
\frac{\vdash\Gamma\qquad\Gamma\vdash S:\operatorname{Ty}_{i}}{\vdash\Gamma,x_{0}:S} ⊢ ⋅ ⊢ Γ , x 0 : S ⊢ Γ Γ ⊢ S : Ty i
Typing
We first define the look-up relation of a variable in a context:
x 0 : T [ ⇑ ] ∈ Γ , x 0 : T y : S ∈ Γ 1 + y : S [ ⇑ ] ∈ Γ , x : T \frac{\ }{x_{0}:T[\Uparrow]\in\Gamma,x_{0}:T}
\qquad
\frac{y:S\in\Gamma}{1+y:S[\Uparrow]\in\Gamma,x:T} x 0 : T [ ⇑ ] ∈ Γ , x 0 : T 1 + y : S [ ⇑ ] ∈ Γ , x : T y : S ∈ Γ
It is easy to show that for any variable binding in a context, we have
Lemma 3.2. x ∣ Γ ∣ : T [ ⇑ ] 1 + ∣ Γ ∣ ∈ Δ , x : T , Γ x_{|\Gamma|}:T[\Uparrow]^{1+|\Gamma|}\in\Delta,x:T,\Gamma x ∣Γ∣ : T [ ⇑ ] 1 + ∣Γ∣ ∈ Δ , x : T , Γ
In other words, T T T is weakened 1 + ∣ Γ ∣ 1+|\Gamma| 1 + ∣Γ∣ times.
Now, we define the typing judgment of the system.
\begin{array}{ccccc}
\textsc{U-Wf} & \textsc{N-Wf} & \Pi\textsc{-Wf} & \textsc{Var} & \textsc{Ze-I}\\[3pt]
\dfrac{\vdash\Gamma}{\Gamma\vdash\operatorname{Ty}_{i}:\operatorname{Ty}_{1+i}} &
\dfrac{\vdash\Gamma}{\Gamma\vdash\operatorname{Nat}:\operatorname{Ty}_{0}} &
\dfrac{\Gamma\vdash S:\operatorname{Ty}_{i}\qquad\Gamma,x:S\vdash T:\operatorname{Ty}_{i}}{\Gamma\vdash\Pi(x:S).T:\operatorname{Ty}_{i}} &
\dfrac{\vdash\Gamma\qquad x:T\in\Gamma}{\Gamma\vdash x:T} &
\dfrac{\vdash\Gamma}{\Gamma\vdash\operatorname{zero}:\operatorname{Nat}}
\end{array}
\begin{array}{ccc}
\textsc{Su-I} & \lambda\textsc{-I} & \lambda\textsc{-E}\\[3pt]
\dfrac{\Gamma\vdash t:\operatorname{Nat}}{\Gamma\vdash\operatorname{succ}\ t:\operatorname{Nat}} &
\dfrac{\Gamma\vdash S:\operatorname{Ty}_{i}\qquad\Gamma,x:S\vdash t:T}{\Gamma\vdash\lambda x.t:\Pi(x:S).T} &
\dfrac{\Gamma\vdash S:\operatorname{Ty}_{i}\qquad\Gamma,x:S\vdash T:\operatorname{Ty}_{i}\qquad\Gamma\vdash r:\Pi(x:S).T\qquad\Gamma\vdash s:S}{\Gamma\vdash r\ s:T[s/x]}
\end{array}
Γ , x : Nat ⊢ T : Ty i Γ ⊢ z : T [ zero / x ] Γ , x : Nat , y : T ⊢ s : T [ ⇑ ∘ ⇑ , succ x 1 / x ] Γ ⊢ t : Nat Γ ⊢ elim Nat ( x . T ) z ( x , y . s ) t : T [ t / x ] \frac{\Gamma,x:\operatorname{Nat}\vdash T:\operatorname{Ty}_{i}\qquad\Gamma\vdash z:T[\operatorname{zero}/x]\qquad\Gamma,x:\operatorname{Nat},y:T\vdash s:T[\Uparrow\circ\Uparrow,\operatorname{succ}\ x_{1}/x]\qquad\Gamma\vdash t:\operatorname{Nat}}{\Gamma\vdash\operatorname{elim}_{\operatorname{Nat}}(x.T)\ z\ (x,y.s)\ t:T[t/x]} Γ ⊢ elim Nat ( x . T ) z ( x , y . s ) t : T [ t / x ] Γ , x : Nat ⊢ T : Ty i Γ ⊢ z : T [ zero / x ] Γ , x : Nat , y : T ⊢ s : T [ ⇑ ∘ ⇑ , succ x 1 / x ] Γ ⊢ t : Nat
Γ ⊢ T : Ty i Γ ⊢ t : S Γ ⊢ S ⊆ T Γ ⊢ t : T \frac{\Gamma\vdash T:\operatorname{Ty}_{i}\qquad\Gamma\vdash t:S\qquad\Gamma\vdash S\subseteq T}{\Gamma\vdash t:T} Γ ⊢ t : T Γ ⊢ T : Ty i Γ ⊢ t : S Γ ⊢ S ⊆ T
The rule Var states that if the variable x x x is in the context Γ \Gamma Γ with type T T T , then x x x has type T T T in Γ \Gamma Γ . The weakening shifts are built into the lookup relation: looking up x x x in Γ \Gamma Γ automatically weakens the declared type to account for all bindings between the declaration and the top of the context.
The type formation rules (U-Wf, N-Wf, Π \Pi Π -Wf) also serve as term typing rules in Russell style: they simultaneously assert that Nat, Π ( x : S ) . T \Pi(x:S).T Π ( x : S ) . T , and T y i \mathrm{Ty}_i Ty i are well-typed terms inhabiting appropriate universes. Cumulativity is achieved through the combination of the subtyping judgment (defined below) and the subsumption rule Subsump.
The rule Λ \Lambda Λ -I requires the domain type S S S to be well-formed (inhabiting some T y i \mathrm{Ty}_i Ty i ) and the body t t t to be well-typed in the extended context.
The rule Λ \Lambda Λ -E (function application) states that applying a function r : Π ( x : S ) . T r:\Pi(x:S).T r : Π ( x : S ) . T to an argument s : S s:S s : S yields a result of type T [ s / x ] T[s/x] T [ s / x ] —the codomain T T T with the argument s s s substituted for the formal parameter x x x .
The rule N-E is the dependent elimination principle for natural numbers. The motive T T T lives in the context Γ , x : N a t \Gamma,x:\mathrm{Nat} Γ , x : Nat and must inhabit some universe T y i \mathrm{Ty}_i Ty i : the variable x x x represents the natural number being eliminated. The zero case z z z has type T [ z e r o / x ] T[\mathrm{zero}/x] T [ zero / x ] , i.e., the motive instantiated at zero. The successor case s s s lives in the context extended by both the predecessor x x x (of type Nat) and the inductive hypothesis y y y (of type T T T ), and must have type T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x] T [ ⇑ ∘ ⇑ , succ x 1 / x ] : the motive instantiated at the successor of the predecessor. The conclusion types the entire elimination at T [ t / x ] T[t/x] T [ t / x ] , i.e., the motive instantiated at the scrutinee.
The rule Subsump allows lifting the type of a term to a supertype. Combined with the subtyping rules below, this implements cumulativity and type conversion.
Weakening Typing
We write Γ ⊢ w ϕ : Δ \Gamma\vdash_w\phi:\Delta Γ ⊢ w ϕ : Δ to mean that ϕ \phi ϕ is a well-typed weakening from Δ \Delta Δ to Γ \Gamma Γ . A well-formed weakening transforms a well-formed context to another:
⊢ Γ ⊢ Δ ∀ x : T ∈ Δ , ϕ ( x ) : T [ ϕ ] ∈ Γ Γ ⊢ w ϕ : Δ \frac{\vdash\Gamma\qquad\vdash\Delta\qquad\forall x:T\in\Delta,\ \phi(x):T[\phi]\in\Gamma}{\Gamma\vdash_w\phi:\Delta} Γ ⊢ w ϕ : Δ ⊢ Γ ⊢ Δ ∀ x : T ∈ Δ , ϕ ( x ) : T [ ϕ ] ∈ Γ
We now show that the key weakening operations preserve well-typedness.
Lemma 3.3 (Identity Weakening). If ⊢ Γ \vdash\Gamma ⊢ Γ , then Γ ⊢ w i d : Γ \Gamma\vdash_w id:\Gamma Γ ⊢ w i d : Γ .
Proof. We must show: for all x : T ∈ Γ x:T\in\Gamma x : T ∈ Γ , i d ( x ) : T [ i d ] ∈ Γ id(x):T[id]\in\Gamma i d ( x ) : T [ i d ] ∈ Γ . Since i d ( x ) = x id(x)=x i d ( x ) = x and T [ i d ] = T T[id]=T T [ i d ] = T (by Theorem 2.6), this is immediate from x : T ∈ Γ x:T\in\Gamma x : T ∈ Γ . □ \square □
Lemma 3.4 (Shift Weakening). If ⊢ Γ \vdash\Gamma ⊢ Γ and Γ ⊢ S : T y i \Gamma\vdash S:\mathrm{Ty}_i Γ ⊢ S : Ty i , then Γ , x 0 : S ⊢ w ⇑ : Γ \Gamma,x_0:S\vdash_w\Uparrow:\Gamma Γ , x 0 : S ⊢ w ⇑: Γ .
Proof. We must show: for all y : T ∈ Γ y:T\in\Gamma y : T ∈ Γ , ⇑ ( y ) : T [ ⇑ ] ∈ Γ , x 0 : S \Uparrow(y):T[\Uparrow]\in\Gamma,x_0:S ⇑ ( y ) : T [ ⇑ ] ∈ Γ , x 0 : S . We have ⇑ ( y ) = 1 + y \Uparrow(y)=1+y ⇑ ( y ) = 1 + y . From y : T ∈ Γ y:T\in\Gamma y : T ∈ Γ , the lookup rule gives 1 + y : T [ ⇑ ] ∈ Γ , x 0 : S 1+y:T[\Uparrow]\in\Gamma,x_0:S 1 + y : T [ ⇑ ] ∈ Γ , x 0 : S . □ \square □
Lemma 3.5 (q q q Preserves Weakening Typing). If Γ ⊢ w ϕ : Δ \Gamma\vdash_w\phi:\Delta Γ ⊢ w ϕ : Δ and Δ ⊢ S : T y i \Delta\vdash S:\mathrm{Ty}_i Δ ⊢ S : Ty i , then Γ , x 0 : S [ ϕ ] ⊢ w q ( ϕ ) : Δ , x 0 : S \Gamma,x_0:S[\phi]\vdash_w q(\phi):\Delta,x_0:S Γ , x 0 : S [ ϕ ] ⊢ w q ( ϕ ) : Δ , x 0 : S .
Proof. We must show: for all y : T ∈ Δ , x 0 : S y:T\in\Delta,x_0:S y : T ∈ Δ , x 0 : S , q ( ϕ ) ( y ) : T [ q ( ϕ ) ] ∈ Γ , x 0 : S [ ϕ ] q(\phi)(y):T[q(\phi)]\in\Gamma,x_0:S[\phi] q ( ϕ ) ( y ) : T [ q ( ϕ )] ∈ Γ , x 0 : S [ ϕ ] . We case-split on the lookup y : T ∈ Δ , x 0 : S y:T\in\Delta,x_0:S y : T ∈ Δ , x 0 : S :
x 0 : S [ ⇑ ] ∈ Δ , x 0 : S x_0:S[\Uparrow]\in\Delta,x_0:S x 0 : S [ ⇑ ] ∈ Δ , x 0 : S : Then q ( ϕ ) ( x 0 ) = x 0 q(\phi)(x_0)=x_0 q ( ϕ ) ( x 0 ) = x 0 and S [ ⇑ ] [ q ( ϕ ) ] = S [ ϕ ] [ ⇑ ] S[\Uparrow][q(\phi)]=S[\phi][\Uparrow] S [ ⇑ ] [ q ( ϕ )] = S [ ϕ ] [ ⇑ ] (by Theorem 2.20). We have x 0 : S [ ϕ ] [ ⇑ ] ∈ Γ , x 0 : S [ ϕ ] x_0:S[\phi][\Uparrow]\in\Gamma,x_0:S[\phi] x 0 : S [ ϕ ] [ ⇑ ] ∈ Γ , x 0 : S [ ϕ ] by lookup.
1 + z : T ′ [ ⇑ ] ∈ Δ , x 0 : S 1+z:T'[\Uparrow]\in\Delta,x_0:S 1 + z : T ′ [ ⇑ ] ∈ Δ , x 0 : S where z : T ′ ∈ Δ z:T'\in\Delta z : T ′ ∈ Δ : Then q ( ϕ ) ( 1 + z ) = 1 + ϕ ( z ) q(\phi)(1+z)=1+\phi(z) q ( ϕ ) ( 1 + z ) = 1 + ϕ ( z ) and T ′ [ ⇑ ] [ q ( ϕ ) ] = T ′ [ ϕ ] [ ⇑ ] T'[\Uparrow][q(\phi)]=T'[\phi][\Uparrow] T ′ [ ⇑ ] [ q ( ϕ )] = T ′ [ ϕ ] [ ⇑ ] (by Theorem 2.20). From Γ ⊢ w ϕ : Δ \Gamma\vdash_w\phi:\Delta Γ ⊢ w ϕ : Δ , we have ϕ ( z ) : T ′ [ ϕ ] ∈ Γ \phi(z):T'[\phi]\in\Gamma ϕ ( z ) : T ′ [ ϕ ] ∈ Γ , so 1 + ϕ ( z ) : T ′ [ ϕ ] [ ⇑ ] ∈ Γ , x 0 : S [ ϕ ] 1+\phi(z):T'[\phi][\Uparrow]\in\Gamma,x_0:S[\phi] 1 + ϕ ( z ) : T ′ [ ϕ ] [ ⇑ ] ∈ Γ , x 0 : S [ ϕ ] by lookup. □ \square □
Lemma 3.6 (Composition Preserves Weakening Typing). If Γ ⊢ w ψ : Δ \Gamma\vdash_w\psi:\Delta Γ ⊢ w ψ : Δ and Δ ⊢ w ϕ : Θ \Delta\vdash_w\phi:\Theta Δ ⊢ w ϕ : Θ , then Γ ⊢ w ϕ ∘ ψ : Θ \Gamma\vdash_w\phi\circ\psi:\Theta Γ ⊢ w ϕ ∘ ψ : Θ .
Proof. We must show: for all x : T ∈ Θ x:T\in\Theta x : T ∈ Θ , ( ϕ ∘ ψ ) ( x ) : T [ ϕ ∘ ψ ] ∈ Γ (\phi\circ\psi)(x):T[\phi\circ\psi]\in\Gamma ( ϕ ∘ ψ ) ( x ) : T [ ϕ ∘ ψ ] ∈ Γ .
ϕ ( x ) : T [ ϕ ] ∈ Δ (from Δ ⊢ w ϕ : Θ and x : T ∈ Θ ) \phi(x):T[\phi]\in\Delta\qquad\text{(from }\Delta\vdash_w\phi:\Theta\text{ and }x:T\in\Theta\text{)} ϕ ( x ) : T [ ϕ ] ∈ Δ (from Δ ⊢ w ϕ : Θ and x : T ∈ Θ ) ψ ( ϕ ( x ) ) : T [ ϕ ] [ ψ ] ∈ Γ (from Γ ⊢ w ψ : Δ and ϕ ( x ) : T [ ϕ ] ∈ Δ ) (1) \psi(\phi(x)):T[\phi][\psi]\in\Gamma\qquad\text{(from }\Gamma\vdash_w\psi:\Delta\text{ and }\phi(x):T[\phi]\in\Delta\text{)} \tag*{(1)} ψ ( ϕ ( x )) : T [ ϕ ] [ ψ ] ∈ Γ (from Γ ⊢ w ψ : Δ and ϕ ( x ) : T [ ϕ ] ∈ Δ ) (1)
( ϕ ∘ ψ ) ( x ) = ψ ( ϕ ( x ) ) (by definition of composition) (\phi\circ\psi)(x) = \psi(\phi(x))
\qquad\text{(by definition of composition)} ( ϕ ∘ ψ ) ( x ) = ψ ( ϕ ( x )) (by definition of composition)
T [ ϕ ∘ ψ ] = T [ ϕ ] [ ψ ] (by Theorem 2.9) T[\phi\circ\psi] = T[\phi][\psi]
\qquad\text{(by Theorem 2.9)} T [ ϕ ∘ ψ ] = T [ ϕ ] [ ψ ] (by Theorem 2.9)
Hence ( ϕ ∘ ψ ) ( x ) : T [ ϕ ∘ ψ ] ∈ Γ (\phi\circ\psi)(x) : T[\phi\circ\psi] \in\Gamma ( ϕ ∘ ψ ) ( x ) : T [ ϕ ∘ ψ ] ∈ Γ . □ \square □
Substitution Typing
We define when a substitution is well-typed. We write Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ to mean that σ \sigma σ maps variables from Δ \Delta Δ to well-typed terms in Γ \Gamma Γ , preserving the typing structure.
⊢ Γ ⊢ Δ ∀ x : T ∈ Δ , Γ ⊢ σ ( x ) : T [ σ ] Γ ⊢ σ : Δ \frac{\vdash\Gamma\qquad\vdash\Delta\qquad\forall x : T \in\Delta,\ \Gamma\vdash\sigma(x) : T[\sigma]}{\Gamma\vdash\sigma: \Delta} Γ ⊢ σ : Δ ⊢ Γ ⊢ Δ ∀ x : T ∈ Δ , Γ ⊢ σ ( x ) : T [ σ ]
In practice, the most common substitutions that arise are:
The identity substitution: Γ ⊢ i d : Γ \Gamma\vdash\mathit{id} : \Gamma Γ ⊢ id : Γ , which maps every variable to itself.
The single substitution: Γ ⊢ ( i d , s / x ) : ( Γ , x 0 : S ) \Gamma\vdash(\mathit{id},s/x) : (\Gamma,x_0:S) Γ ⊢ ( id , s / x ) : ( Γ , x 0 : S ) (when Γ ⊢ s : S \Gamma\vdash s:S Γ ⊢ s : S ), which substitutes s s s for x 0 x_0 x 0 and is the identity on all other variables.
A general substitution: Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , which maps each variable x i x_i x i in Δ \Delta Δ with type S i S_i S i to a term σ ( x i ) \sigma(x_i) σ ( x i ) of type S i [ σ ] S_i[\sigma] S i [ σ ] in $\Gamma.
Subtyping
Following Jang et al. [ [8 ] , we define a covariant subtyping judgment Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T that implements cumulativity through universe subtyping, propagating covariantly through the codomain of Π \Pi Π -types.
Γ ⊢ i ≤ j Γ ⊢ T y i ⊆ T y j Γ ⊢ S ⊆ T Γ ⊢ T ⊆ U Γ ⊢ S ⊆ U Γ ⊢ T : T y i Γ ⊢ S ≈ T : T y i Γ ⊢ S ⊆ T \frac{\Gamma\vdash i \leq j}{\Gamma\vdash\mathsf{Ty}_i \subseteq\mathsf{Ty}_j}
\qquad
\frac{\Gamma\vdash S \subseteq T \qquad\Gamma\vdash T \subseteq U}{\Gamma\vdash S \subseteq U}
\qquad
\frac{\Gamma\vdash T : \mathsf{Ty}_i \qquad\Gamma\vdash S \approx T : \mathsf{Ty}_i}{\Gamma\vdash S \subseteq T} Γ ⊢ Ty i ⊆ Ty j Γ ⊢ i ≤ j Γ ⊢ S ⊆ U Γ ⊢ S ⊆ T Γ ⊢ T ⊆ U Γ ⊢ S ⊆ T Γ ⊢ T : Ty i Γ ⊢ S ≈ T : Ty i
Γ ⊢ S ′ : T y i Γ ⊢ S ≈ S ′ : T y i Γ , x : S ⊢ T : T y i Γ , x : S ′ ⊢ T ′ : T y i Γ , x : S ⊢ T ⊆ T ′ Γ ⊢ Π ( x : S ) . T ⊆ Π ( x : S ′ ) . T ′ \frac{\Gamma\vdash S' : \mathsf{Ty}_i \qquad\Gamma\vdash S \approx S' : \mathsf{Ty}_i \qquad\Gamma,x:S \vdash T : \mathsf{Ty}_i \qquad\Gamma,x:S' \vdash T' : \mathsf{Ty}_i \qquad\Gamma,x:S \vdash T \subseteq T'}{\Gamma\vdash\Pi(x:S).T \subseteq\Pi(x:S').T'} Γ ⊢ Π ( x : S ) . T ⊆ Π ( x : S ′ ) . T ′ Γ ⊢ S ′ : Ty i Γ ⊢ S ≈ S ′ : Ty i Γ , x : S ⊢ T : Ty i Γ , x : S ′ ⊢ T ′ : Ty i Γ , x : S ⊢ T ⊆ T ′
The rule S u b - U n i v \mathsf{Sub\text{-}Univ} Sub - Univ states that T y i \mathsf{Ty}_i Ty i is a subtype of T y j \mathsf{Ty}_j Ty j whenever i ≤ j i \leq j i ≤ j . The rule S u b - T r a n s \mathsf{Sub\text{-}Trans} Sub - Trans gives transitivity. The rule S u b - E q \mathsf{Sub\text{-}Eq} Sub - Eq embeds judgmental equality into subtyping: equal types are subtypes of each other. The rule S u b - P i \mathsf{Sub\text{-}Pi} Sub - Pi propagates subtyping covariantly through the codomain of Π \Pi Π -types, requiring the domains to be judgmentally equal.
Combined with the subsumption rule S u b s u m p \mathsf{Subsump} Subsump in the typing judgment, these rules implement a full cumulative universe hierarchy. For example, if Γ ⊢ S : T y 0 \Gamma\vdash S : \mathsf{Ty}_0 Γ ⊢ S : Ty 0 then S : T y 1 S : \mathsf{Ty}_1 S : Ty 1 follows by S u b s u m p \mathsf{Subsump} Subsump with Γ ⊢ T y 0 ⊆ T y 1 \Gamma\vdash\mathsf{Ty}_0 \subseteq\mathsf{Ty}_1 Γ ⊢ Ty 0 ⊆ Ty 1 (via S u b - U n i v \mathsf{Sub\text{-}Univ} Sub - Univ ).
Equational Theory
The equational theory defines judgmental equality for terms.
Term Equality — PER and Congruence Rules
Tm-Sym
Γ ⊢ t ≈ t ′ : T Γ ⊢ t ′ ≈ t : T \frac{\Gamma\vdash t \approx t' : T}{\Gamma\vdash t' \approx t : T} Γ ⊢ t ′ ≈ t : T Γ ⊢ t ≈ t ′ : T
Tm-Trans
Γ ⊢ t ≈ t ′ : T Γ ⊢ t ′ ≈ t ′ ′ : T Γ ⊢ t ≈ t ′ ′ : T \frac{\Gamma\vdash t \approx t' : T \qquad\Gamma\vdash t' \approx t'' : T}{\Gamma\vdash t \approx t'' : T} Γ ⊢ t ≈ t ′′ : T Γ ⊢ t ≈ t ′ : T Γ ⊢ t ′ ≈ t ′′ : T
Tm-Subsump
Γ ⊢ T : T y i Γ ⊢ t ≈ t ′ : S Γ ⊢ S ⊆ T Γ ⊢ t ≈ t ′ : T \frac{\Gamma\vdash T : \mathrm{Ty}_i \qquad\Gamma\vdash t \approx t' : S \qquad\Gamma\vdash S \subseteq T}{\Gamma\vdash t \approx t' : T} Γ ⊢ t ≈ t ′ : T Γ ⊢ T : Ty i Γ ⊢ t ≈ t ′ : S Γ ⊢ S ⊆ T
Var-Cong
x : T ∈ Γ Γ ⊢ x ≈ x : T \frac{x : T \in\Gamma}{\Gamma\vdash x \approx x : T} Γ ⊢ x ≈ x : T x : T ∈ Γ
U-Cong
Γ ⊢ T y i ≈ T y i : T y i + 1 \frac{}{\Gamma\vdash\mathrm{Ty}_i \approx\mathrm{Ty}_i : \mathrm{Ty}_{i+1}} Γ ⊢ Ty i ≈ Ty i : Ty i + 1
N-Cong
Γ ⊢ N a t ≈ N a t : T y 0 \frac{}{\Gamma\vdash\mathrm{Nat} \approx\mathrm{Nat} : \mathrm{Ty}_0} Γ ⊢ Nat ≈ Nat : Ty 0
Π-Cong
Γ ⊢ S ≈ S ′ : T y i Γ , x : S ⊢ T ≈ T ′ : T y i Γ ⊢ Π ( x : S ) . T ≈ Π ( x : S ′ ) . T ′ : T y i \frac{\Gamma\vdash S \approx S' : \mathrm{Ty}_i \qquad\Gamma,x:S \vdash T \approx T' : \mathrm{Ty}_i}{\Gamma\vdash\Pi(x:S).T \approx\Pi(x:S').T' : \mathrm{Ty}_i} Γ ⊢ Π ( x : S ) . T ≈ Π ( x : S ′ ) . T ′ : Ty i Γ ⊢ S ≈ S ′ : Ty i Γ , x : S ⊢ T ≈ T ′ : Ty i
Ze-Cong
Γ ⊢ z e r o ≈ z e r o : N a t \frac{}{\Gamma\vdash\mathrm{zero} \approx\mathrm{zero} : \mathrm{Nat}} Γ ⊢ zero ≈ zero : Nat
Su-Cong
Γ ⊢ t ≈ t ′ : N a t Γ ⊢ s u c c t ≈ s u c c t ′ : N a t \frac{\Gamma\vdash t \approx t' : \mathrm{Nat}}{\Gamma\vdash\mathrm{succ}\ t \approx\mathrm{succ}\ t' : \mathrm{Nat}} Γ ⊢ succ t ≈ succ t ′ : Nat Γ ⊢ t ≈ t ′ : Nat
λ-Cong
Γ ⊢ S : T y i Γ , x : S ⊢ t ≈ t ′ : T Γ ⊢ λ x . t ≈ λ x . t ′ : Π ( x : S ) . T \frac{\Gamma\vdash S : \mathrm{Ty}_i \qquad\Gamma,x:S \vdash t \approx t' : T}{\Gamma\vdash\lambda x.t \approx\lambda x.t' : \Pi(x:S).T} Γ ⊢ λ x . t ≈ λ x . t ′ : Π ( x : S ) . T Γ ⊢ S : Ty i Γ , x : S ⊢ t ≈ t ′ : T
App-Cong
Γ ⊢ r ≈ r ′ : Π ( x : S ) . T Γ ⊢ s ≈ s ′ : S Γ ⊢ r s ≈ r ′ s ′ : T [ s / x ] \frac{\Gamma\vdash r \approx r' : \Pi(x:S).T \qquad\Gamma\vdash s \approx s' : S}{\Gamma\vdash r\ s \approx r'\ s' : T[s/x]} Γ ⊢ r s ≈ r ′ s ′ : T [ s / x ] Γ ⊢ r ≈ r ′ : Π ( x : S ) . T Γ ⊢ s ≈ s ′ : S
Rec-Cong
Γ , x : N a t ⊢ T : T y i Γ ⊢ z ≈ z ′ : T [ z e r o / x ] Γ , x : N a t , y : T ⊢ s ≈ s ′ : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] Γ ⊢ t ≈ t ′ : N a t Γ ⊢ e l i m N a t ( x . T ) z ( x , y . s ) t ≈ e l i m N a t ( x . T ) z ′ ( x , y . s ′ ) t ′ : T [ t / x ] \frac{
\begin{gathered}
\Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i\\
\Gamma\vdash z\approx z':T[\mathrm{zero}/x]\qquad
\Gamma,x:\mathrm{Nat},y:T\vdash s\approx s':T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x]\qquad
\Gamma\vdash t\approx t':\mathrm{Nat}
\end{gathered}
}{
\Gamma\vdash\mathrm{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t\approx\mathrm{elim}_{\mathrm{Nat}}(x.T)\ z'\ (x,y.s')\ t':T[t/x]
} Γ ⊢ elim Nat ( x . T ) z ( x , y . s ) t ≈ elim Nat ( x . T ) z ′ ( x , y . s ′ ) t ′ : T [ t / x ] Γ , x : Nat ⊢ T : Ty i Γ ⊢ z ≈ z ′ : T [ zero / x ] Γ , x : Nat , y : T ⊢ s ≈ s ′ : T [ ⇑ ∘ ⇑ , succ x 1 / x ] Γ ⊢ t ≈ t ′ : Nat
Term Equality — Computation Rules (β-rules)
The computation rules express how eliminators interact with their corresponding introduction forms.
Π-β
Γ ⊢ S : T y i Γ , x : S ⊢ T : T y i Γ , x : S ⊢ t : T Γ ⊢ s : S Γ ⊢ ( λ x . t ) s ≈ t [ s / x ] : T [ s / x ] \frac{
\begin{gathered}
\Gamma\vdash S:\mathrm{Ty}_i\qquad\Gamma,x:S\vdash T:\mathrm{Ty}_i\\
\Gamma,x:S\vdash t:T\qquad\Gamma\vdash s:S
\end{gathered}
}{
\Gamma\vdash(\lambda x.t)\ s\approx t[s/x]:T[s/x]
} Γ ⊢ ( λ x . t ) s ≈ t [ s / x ] : T [ s / x ] Γ ⊢ S : Ty i Γ , x : S ⊢ T : Ty i Γ , x : S ⊢ t : T Γ ⊢ s : S
N-β-Ze
Γ , x : N a t ⊢ T : T y i Γ ⊢ z : T [ z e r o / x ] Γ , x : N a t , y : T ⊢ s : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] Γ ⊢ e l i m N a t ( x . T ) z ( x , y . s ) z e r o ≈ z : T [ z e r o / x ] \frac{
\begin{gathered}
\Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i\qquad\Gamma\vdash z:T[\mathrm{zero}/x]\\
\Gamma,x:\mathrm{Nat},y:T\vdash s:T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x]
\end{gathered}
}{
\Gamma\vdash\mathrm{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ \mathrm{zero}\approx z:T[\mathrm{zero}/x]
} Γ ⊢ elim Nat ( x . T ) z ( x , y . s ) zero ≈ z : T [ zero / x ] Γ , x : Nat ⊢ T : Ty i Γ ⊢ z : T [ zero / x ] Γ , x : Nat , y : T ⊢ s : T [ ⇑ ∘ ⇑ , succ x 1 / x ]
N-β-Su
Γ , x : N a t ⊢ T : T y i Γ ⊢ z : T [ z e r o / x ] Γ , x : N a t , y : T ⊢ s : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] Γ ⊢ t : N a t Γ ⊢ e l i m N a t ( x . T ) z ( x , y . s ) ( s u c c t ) ≈ s [ t / x , e l i m N a t ( x . T ) z ( x , y . s ) t / y ] : T [ s u c c t / x ] \frac{
\begin{gathered}
\Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i\qquad\Gamma\vdash z:T[\mathrm{zero}/x]\qquad
\Gamma,x:\mathrm{Nat},y:T\vdash s:T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x]\qquad
\Gamma\vdash t:\mathrm{Nat}
\end{gathered}
}{
\Gamma\vdash\mathrm{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ (\mathrm{succ}\ t)\approx s[t/x,\mathrm{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t/y]:T[\mathrm{succ}\ t/x]
} Γ ⊢ elim Nat ( x . T ) z ( x , y . s ) ( succ t ) ≈ s [ t / x , elim Nat ( x . T ) z ( x , y . s ) t / y ] : T [ succ t / x ] Γ , x : Nat ⊢ T : Ty i Γ ⊢ z : T [ zero / x ] Γ , x : Nat , y : T ⊢ s : T [ ⇑ ∘ ⇑ , succ x 1 / x ] Γ ⊢ t : Nat
The β-rule for Π states that applying a lambda to an argument reduces to the body with the argument substituted for the bound variable: ( λ x . t ) s ≈ t [ s / x ] (\lambda x.t)\ s\approx t[s/x] ( λ x . t ) s ≈ t [ s / x ] . The substitution [ s / x ] [s/x] [ s / x ] replaces x x x by s s s in t t t and leaves all other variables unchanged.
The β-rules for natural numbers state:
The eliminator applied to zero computes to the zero case z z z .
The eliminator applied to s u c c t \mathrm{succ}\ t succ t computes to the successor case s s s with two simultaneous substitutions: the predecessor t t t is substituted for x x x , and the recursive call e l i m N a t ( x . T ) z ( x , y . s ) t \mathrm{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t elim Nat ( x . T ) z ( x , y . s ) t (the inductive hypothesis) is substituted for y y y . That is, s [ t / x , e l i m N a t ( x . T ) z ( x , y . s ) t / y ] s[t/x,\mathrm{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t/y] s [ t / x , elim Nat ( x . T ) z ( x , y . s ) t / y ] .
Term Equality — Uniqueness Rules (η-rules)
Π-η
Γ ⊢ S : T y i Γ , x : S ⊢ T : T y i Γ ⊢ t : Π ( x : S ) . T Γ ⊢ t ≈ λ x . ( t [ ⇑ ] x ) : Π ( x : S ) . T \frac{\Gamma\vdash S:\mathrm{Ty}_i\qquad\Gamma,x:S\vdash T:\mathrm{Ty}_i\qquad\Gamma\vdash t:\Pi(x:S).T}{\Gamma\vdash t\approx\lambda x.(t[\Uparrow]\ x):\Pi(x:S).T} Γ ⊢ t ≈ λ x . ( t [ ⇑ ] x ) : Π ( x : S ) . T Γ ⊢ S : Ty i Γ , x : S ⊢ T : Ty i Γ ⊢ t : Π ( x : S ) . T
The η-rule for Π states that every function is equal to its η-expansion.
Properties of the Judgments
In this section we establish the fundamental metatheoretic properties of the typing and equational theory: presupposition (every judgment implies the well-formedness of its sub-components) and stability under substitution (well-typed substitutions preserve all judgments).
Weakening
Lemma 4.1 (Weakening Preserves Typing). The following are proved by mutual induction on the syntactic judgments:
If Γ ⊢ t : T \Gamma\vdash t : T Γ ⊢ t : T and Δ ⊢ w ϕ : Γ \Delta\vdash_{\mathrm{w}} \phi: \Gamma Δ ⊢ w ϕ : Γ , then Δ ⊢ t [ ϕ ] : T [ ϕ ] \Delta\vdash t[\phi] : T[\phi] Δ ⊢ t [ ϕ ] : T [ ϕ ] .
If Γ ⊢ t ≃ t ′ : T \Gamma\vdash t \mathrel{\simeq} t' : T Γ ⊢ t ≃ t ′ : T and Δ ⊢ w ϕ : Γ \Delta\vdash_{\mathrm{w}} \phi: \Gamma Δ ⊢ w ϕ : Γ , then Δ ⊢ t [ ϕ ] ≃ t ′ [ ϕ ] : T [ ϕ ] \Delta\vdash t[\phi] \mathrel{\simeq} t'[\phi] : T[\phi] Δ ⊢ t [ ϕ ] ≃ t ′ [ ϕ ] : T [ ϕ ] .
If Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T and Δ ⊢ w ϕ : Γ \Delta\vdash_{\mathrm{w}} \phi: \Gamma Δ ⊢ w ϕ : Γ , then Δ ⊢ S [ ϕ ] ⊆ T [ ϕ ] \Delta\vdash S[\phi] \subseteq T[\phi] Δ ⊢ S [ ϕ ] ⊆ T [ ϕ ] .
Proof. By mutual induction on the derivation of the syntactic judgment. We show representative cases for statement (1).
Case
Γ ⊢ y : T ∈ Γ Γ ⊢ y : T V a r \frac{\Gamma\vdash y : T \in\Gamma}{\Gamma\vdash y : T}
\quad\mathrm{Var} Γ ⊢ y : T Γ ⊢ y : T ∈ Γ Var
Then y [ ϕ ] = ϕ ( y ) y[\phi] = \phi(y) y [ ϕ ] = ϕ ( y ) . By the definition of Δ ⊢ w ϕ : Γ \Delta\vdash_{\mathrm{w}} \phi: \Gamma Δ ⊢ w ϕ : Γ , ϕ ( y ) : T [ ϕ ] ∈ Δ \phi(y) : T[\phi] \in\Delta ϕ ( y ) : T [ ϕ ] ∈ Δ . By Var, Δ ⊢ ϕ ( y ) : T [ ϕ ] \Delta\vdash\phi(y) : T[\phi] Δ ⊢ ϕ ( y ) : T [ ϕ ] .
Case
Γ ⊢ S ′ : T y i Γ , y : S ′ ⊢ t : T Γ ⊢ λ y . t : Π ( y : S ′ ) . T λ -I \frac{\Gamma\vdash S' : \mathrm{Ty}_{i} \qquad\Gamma,y:S' \vdash t:T}{\Gamma\vdash\lambda y.t : \Pi(y:S').T}
\quad\lambda\text{-I} Γ ⊢ λ y . t : Π ( y : S ′ ) . T Γ ⊢ S ′ : Ty i Γ , y : S ′ ⊢ t : T λ -I
We must show Δ ⊢ ( λ y . t ) [ ϕ ] : ( Π ( y : S ′ ) . T ) [ ϕ ] \Delta\vdash(\lambda y.t)[\phi] : (\Pi(y:S').T)[\phi] Δ ⊢ ( λ y . t ) [ ϕ ] : ( Π ( y : S ′ ) . T ) [ ϕ ] , i.e. Δ ⊢ λ y . ( t [ q ( ϕ ) ] ) : Π ( y : S ′ [ ϕ ] ) . ( T [ q ( ϕ ) ] ) \Delta\vdash\lambda y.(t[q(\phi)]) : \Pi(y:S'[\phi]).(T[q(\phi)]) Δ ⊢ λ y . ( t [ q ( ϕ )]) : Π ( y : S ′ [ ϕ ]) . ( T [ q ( ϕ )]) .
Δ ⊢ S ′ [ ϕ ] : T y i (by IH on first premise) Δ , y : S ′ [ ϕ ] ⊢ w q ( ϕ ) : Γ , y : S ′ (by Theorem 3.5) Δ , y : S ′ [ ϕ ] ⊢ t [ q ( ϕ ) ] : T [ q ( ϕ ) ] (by IH on second premise) Δ ⊢ λ y . ( t [ q ( ϕ ) ] ) : Π ( y : S ′ [ ϕ ] ) . ( T [ q ( ϕ ) ] ) (by λ -I) \begin{aligned}
\Delta&\vdash S'[\phi] : \mathrm{Ty}_{i} && \text{(by IH on first premise)}\\
\Delta,y:S'[\phi] &\vdash_{\mathrm{w}} q(\phi) : \Gamma,y:S' && \text{(by Theorem 3.5)}\\
\Delta,y:S'[\phi] &\vdash t[q(\phi)] : T[q(\phi)] && \text{(by IH on second premise)}\\
\Delta&\vdash\lambda y.(t[q(\phi)]) : \Pi(y:S'[\phi]).(T[q(\phi)]) && \text{(by }\lambda\text{-I)}
\end{aligned} Δ Δ , y : S ′ [ ϕ ] Δ , y : S ′ [ ϕ ] Δ ⊢ S ′ [ ϕ ] : Ty i ⊢ w q ( ϕ ) : Γ , y : S ′ ⊢ t [ q ( ϕ )] : T [ q ( ϕ )] ⊢ λ y . ( t [ q ( ϕ )]) : Π ( y : S ′ [ ϕ ]) . ( T [ q ( ϕ )]) (by IH on first premise) (by Theorem 3.5) (by IH on second premise) (by λ -I)
Case
Γ ⊢ S ′ : T y i Γ , y : S ′ ⊢ T : T y i Γ ⊢ r : Π ( y : S ′ ) . T Γ ⊢ s : S ′ Γ ⊢ r s : T [ s / y ] λ -E \frac{\Gamma\vdash S' : \mathrm{Ty}_{i} \qquad\Gamma,y:S' \vdash T : \mathrm{Ty}_{i} \qquad\Gamma\vdash r : \Pi(y:S').T \qquad\Gamma\vdash s:S'}{\Gamma\vdash r\ s : T[s/y]}
\quad\lambda\text{-E} Γ ⊢ r s : T [ s / y ] Γ ⊢ S ′ : Ty i Γ , y : S ′ ⊢ T : Ty i Γ ⊢ r : Π ( y : S ′ ) . T Γ ⊢ s : S ′ λ -E
Δ ⊢ S ′ [ ϕ ] : T y i (by IH) Δ , y : S ′ [ ϕ ] ⊢ T [ q ( ϕ ) ] : T y i (by IH, using Theorem 3.5) Δ ⊢ r [ ϕ ] : Π ( y : S ′ [ ϕ ] ) . ( T [ q ( ϕ ) ] ) (by IH) Δ ⊢ s [ ϕ ] : S ′ [ ϕ ] (by IH) Δ ⊢ r [ ϕ ] s [ ϕ ] : T [ q ( ϕ ) ] [ s [ ϕ ] / y ] (by λ -E) \begin{aligned}
\Delta&\vdash S'[\phi] : \mathrm{Ty}_{i} && \text{(by IH)}\\
\Delta,y:S'[\phi] &\vdash T[q(\phi)] : \mathrm{Ty}_{i} && \text{(by IH, using Theorem 3.5)}\\
\Delta&\vdash r[\phi] : \Pi(y:S'[\phi]).(T[q(\phi)]) && \text{(by IH)}\\
\Delta&\vdash s[\phi] : S'[\phi] && \text{(by IH)}\\
\Delta&\vdash r[\phi]\ s[\phi] : T[q(\phi)][s[\phi]/y] && \text{(by }\lambda\text{-E)}
\end{aligned} Δ Δ , y : S ′ [ ϕ ] Δ Δ Δ ⊢ S ′ [ ϕ ] : Ty i ⊢ T [ q ( ϕ )] : Ty i ⊢ r [ ϕ ] : Π ( y : S ′ [ ϕ ]) . ( T [ q ( ϕ )]) ⊢ s [ ϕ ] : S ′ [ ϕ ] ⊢ r [ ϕ ] s [ ϕ ] : T [ q ( ϕ )] [ s [ ϕ ] / y ] (by IH) (by IH, using Theorem 3.5) (by IH) (by IH) (by λ -E)
It remains to show T [ q ( ϕ ) ] [ s [ ϕ ] / y ] = T [ s / y ] [ ϕ ] T[q(\phi)][s[\phi]/y] = T[s/y][\phi] T [ q ( ϕ )] [ s [ ϕ ] / y ] = T [ s / y ] [ ϕ ] , which is Theorem 2.30.
, Vol. 1, No. 1, Article . Publication date: October 2026.
Case
Γ ⊢ T : T y i Γ ⊢ t : S Γ ⊢ S ⊆ T Γ ⊢ t : T \frac{\Gamma\vdash T : \mathrm{Ty}_i \qquad\Gamma\vdash t : S \qquad\Gamma\vdash S \subseteq T}{\Gamma\vdash t : T} Γ ⊢ t : T Γ ⊢ T : Ty i Γ ⊢ t : S Γ ⊢ S ⊆ T
Δ ⊢ T [ ϕ ] : T y i \Delta\vdash T[\phi] : \mathrm{Ty}_i Δ ⊢ T [ ϕ ] : Ty i (by IH)
Δ ⊢ t [ ϕ ] : S [ ϕ ] \Delta\vdash t[\phi] : S[\phi] Δ ⊢ t [ ϕ ] : S [ ϕ ] (by IH)
Δ ⊢ S [ ϕ ] ⊆ T [ ϕ ] \Delta\vdash S[\phi] \subseteq T[\phi] Δ ⊢ S [ ϕ ] ⊆ T [ ϕ ] (by IH, statement (3))
Δ ⊢ t [ ϕ ] : T [ ϕ ] \Delta\vdash t[\phi] : T[\phi] Δ ⊢ t [ ϕ ] : T [ ϕ ] (by Subsump)
We now show representative cases for statement (2).
Case
Γ ⊢ S ′ : T y i Γ , x : S ′ ⊢ T ′ : T y i Γ , x : S ′ ⊢ t : T ′ Γ ⊢ s : S ′ Γ ⊢ ( λ x . t ) s ≈ t [ s / x ] : T ′ [ s / x ] \frac{\Gamma\vdash S' : \mathrm{Ty}_i \qquad\Gamma, x : S' \vdash T' : \mathrm{Ty}_i \qquad\Gamma, x : S' \vdash t : T' \qquad\Gamma\vdash s : S'}{\Gamma\vdash(\lambda x.t)\,s \approx t[s/x] : T'[s/x]} Γ ⊢ ( λ x . t ) s ≈ t [ s / x ] : T ′ [ s / x ] Γ ⊢ S ′ : Ty i Γ , x : S ′ ⊢ T ′ : Ty i Γ , x : S ′ ⊢ t : T ′ Γ ⊢ s : S ′
We must show Δ ⊢ ( ( λ x . t ) s ) [ ϕ ] ≈ t [ s / x ] [ ϕ ] : T ′ [ s / x ] [ ϕ ] \Delta\vdash((\lambda x.t)\,s)[\phi] \approx t[s/x][\phi] : T'[s/x][\phi] Δ ⊢ (( λ x . t ) s ) [ ϕ ] ≈ t [ s / x ] [ ϕ ] : T ′ [ s / x ] [ ϕ ] .
( ( λ x . t ) s ) [ ϕ ] = ( λ x . ( t [ q ( ϕ ) ] ) ) ( s [ ϕ ] ) ((\lambda x.t)\,s)[\phi] = (\lambda x.(t[q(\phi)]))(s[\phi]) (( λ x . t ) s ) [ ϕ ] = ( λ x . ( t [ q ( ϕ )])) ( s [ ϕ ])
Now:
Δ ⊢ S ′ [ ϕ ] : T y i \Delta\vdash S'[\phi] : \mathrm{Ty}_i Δ ⊢ S ′ [ ϕ ] : Ty i (by IH)
Δ , x : S ′ [ ϕ ] ⊢ T ′ [ q ( ϕ ) ] : T y i \Delta, x : S'[\phi] \vdash T'[q(\phi)] : \mathrm{Ty}_i Δ , x : S ′ [ ϕ ] ⊢ T ′ [ q ( ϕ )] : Ty i (by IH, using Theorem 3.5)
Δ , x : S ′ [ ϕ ] ⊢ t [ q ( ϕ ) ] : T ′ [ q ( ϕ ) ] \Delta, x : S'[\phi] \vdash t[q(\phi)] : T'[q(\phi)] Δ , x : S ′ [ ϕ ] ⊢ t [ q ( ϕ )] : T ′ [ q ( ϕ )] (by IH, using Theorem 3.5)
Δ ⊢ s [ ϕ ] : S ′ [ ϕ ] \Delta\vdash s[\phi] : S'[\phi] Δ ⊢ s [ ϕ ] : S ′ [ ϕ ] (by IH)
Δ ⊢ ( λ x . ( t [ q ( ϕ ) ] ) ) ( s [ ϕ ] ) ≈ t [ q ( ϕ ) ] [ s [ ϕ ] / x ] : T ′ [ q ( ϕ ) ] [ s [ ϕ ] / x ] \Delta\vdash(\lambda x.(t[q(\phi)]))(s[\phi]) \approx t[q(\phi)][s[\phi]/x] : T'[q(\phi)][s[\phi]/x] Δ ⊢ ( λ x . ( t [ q ( ϕ )])) ( s [ ϕ ]) ≈ t [ q ( ϕ )] [ s [ ϕ ] / x ] : T ′ [ q ( ϕ )] [ s [ ϕ ] / x ] (by Π \Pi Π -β \beta β )
By Theorem 2.30: t [ q ( ϕ ) ] [ s [ ϕ ] / x ] = t [ s / x ] [ ϕ ] t[q(\phi)][s[\phi]/x] = t[s/x][\phi] t [ q ( ϕ )] [ s [ ϕ ] / x ] = t [ s / x ] [ ϕ ] and T ′ [ q ( ϕ ) ] [ s [ ϕ ] / x ] = T ′ [ s / x ] [ ϕ ] T'[q(\phi)][s[\phi]/x] = T'[s/x][\phi] T ′ [ q ( ϕ )] [ s [ ϕ ] / x ] = T ′ [ s / x ] [ ϕ ] .
Case
Γ ⊢ S ′ : T y i Γ , x : S ′ ⊢ T ′ : T y i Γ ⊢ t : Π ( x : S ′ ) . T ′ Γ ⊢ t ≈ λ x . ( t [ ⇑ ] x ) : Π ( x : S ′ ) . T ′ \frac{\Gamma\vdash S' : \mathrm{Ty}_i \qquad\Gamma, x : S' \vdash T' : \mathrm{Ty}_i \qquad\Gamma\vdash t : \Pi(x : S').T'}{\Gamma\vdash t \approx\lambda x.(t[\Uparrow]\,x) : \Pi(x : S').T'} Γ ⊢ t ≈ λ x . ( t [ ⇑ ] x ) : Π ( x : S ′ ) . T ′ Γ ⊢ S ′ : Ty i Γ , x : S ′ ⊢ T ′ : Ty i Γ ⊢ t : Π ( x : S ′ ) . T ′
We must show Δ ⊢ t [ ϕ ] ≈ ( λ x . ( t [ ⇑ ] x ) ) [ ϕ ] : ( Π ( x : S ′ ) . T ′ ) [ ϕ ] \Delta\vdash t[\phi] \approx(\lambda x.(t[\Uparrow]\,x))[\phi] : (\Pi(x : S').T')[\phi] Δ ⊢ t [ ϕ ] ≈ ( λ x . ( t [ ⇑ ] x )) [ ϕ ] : ( Π ( x : S ′ ) . T ′ ) [ ϕ ] . Unfolding the right-hand side:
( λ x . ( t [ ⇑ ] x ) ) [ ϕ ] = λ x . ( ( t [ ⇑ ] x ) [ q ( ϕ ) ] ) = λ x . ( t [ ⇑ ] [ q ( ϕ ) ] x ) = λ x . ( t [ ϕ ] [ ⇑ ] x ) (by Theorem 2.20) \begin{aligned}
(\lambda x.(t[\Uparrow]\,x))[\phi] &= \lambda x.((t[\Uparrow]\,x)[q(\phi)]) \\
&= \lambda x.(t[\Uparrow][q(\phi)]\,x) \\
&= \lambda x.(t[\phi][\Uparrow]\,x) \quad\text{(by Theorem 2.20)}
\end{aligned} ( λ x . ( t [ ⇑ ] x )) [ ϕ ] = λ x . (( t [ ⇑ ] x ) [ q ( ϕ )]) = λ x . ( t [ ⇑ ] [ q ( ϕ )] x ) = λ x . ( t [ ϕ ] [ ⇑ ] x ) (by Theorem 2.20)
Δ ⊢ S ′ [ ϕ ] : T y i \Delta\vdash S'[\phi] : \mathrm{Ty}_i Δ ⊢ S ′ [ ϕ ] : Ty i (by IH)
Δ , x : S ′ [ ϕ ] ⊢ T ′ [ q ( ϕ ) ] : T y i \Delta, x : S'[\phi] \vdash T'[q(\phi)] : \mathrm{Ty}_i Δ , x : S ′ [ ϕ ] ⊢ T ′ [ q ( ϕ )] : Ty i (by IH, using Theorem 3.5)
Δ ⊢ t [ ϕ ] : Π ( x : S ′ [ ϕ ] ) . ( T ′ [ q ( ϕ ) ] ) \Delta\vdash t[\phi] : \Pi(x : S'[\phi]).(T'[q(\phi)]) Δ ⊢ t [ ϕ ] : Π ( x : S ′ [ ϕ ]) . ( T ′ [ q ( ϕ )]) (by IH)
Δ , x : S ′ [ ϕ ] ⊢ ⇑ : Δ \Delta, x : S'[\phi] \vdash\mathord{\Uparrow} : \Delta Δ , x : S ′ [ ϕ ] ⊢ ⇑ : Δ (by Theorem 3.4)
Δ ⊢ t [ ϕ ] ≈ λ x . ( t [ ϕ ] [ ⇑ ] x ) : Π ( x : S ′ [ ϕ ] ) . ( T ′ [ q ( ϕ ) ] ) \Delta\vdash t[\phi] \approx\lambda x.(t[\phi][\Uparrow]\,x) : \Pi(x : S'[\phi]).(T'[q(\phi)]) Δ ⊢ t [ ϕ ] ≈ λ x . ( t [ ϕ ] [ ⇑ ] x ) : Π ( x : S ′ [ ϕ ]) . ( T ′ [ q ( ϕ )]) (by Π \Pi Π -η \eta η )
We show a case for statement (3).
Case
Sub-Pi
Γ ⊢ S ′ : Ty i Γ ⊢ S ≈ S ′ : Ty i Γ ⊢ S : Ty i Γ , x : S ⊢ T : Ty i Γ , x : S ′ ⊢ T ′ : Ty i Γ , x : S ⊢ T ⊆ T ′ Γ ⊢ Π ( x : S ) . T ⊆ Π ( x : S ′ ) . T ′ \frac{\Gamma\vdash S' : \operatorname{Ty}_i \qquad\Gamma\vdash S \approx S' : \operatorname{Ty}_i \qquad\Gamma\vdash S : \operatorname{Ty}_i \qquad\Gamma, x : S \vdash T : \operatorname{Ty}_i \qquad\Gamma, x : S' \vdash T' : \operatorname{Ty}_i \qquad\Gamma, x : S \vdash T \subseteq T'}{\Gamma\vdash\Pi(x : S).T \subseteq\Pi(x : S').T'} Γ ⊢ Π ( x : S ) . T ⊆ Π ( x : S ′ ) . T ′ Γ ⊢ S ′ : Ty i Γ ⊢ S ≈ S ′ : Ty i Γ ⊢ S : Ty i Γ , x : S ⊢ T : Ty i Γ , x : S ′ ⊢ T ′ : Ty i Γ , x : S ⊢ T ⊆ T ′
Δ ⊢ S [ ϕ ] : Ty i (by IH) \Delta\vdash S[\phi] : \operatorname{Ty}_i \qquad\text{(by IH)} Δ ⊢ S [ ϕ ] : Ty i (by IH)
Δ ⊢ S ′ [ ϕ ] : Ty i (by IH) \Delta\vdash S'[\phi] : \operatorname{Ty}_i \qquad\text{(by IH)} Δ ⊢ S ′ [ ϕ ] : Ty i (by IH)
Δ ⊢ S [ ϕ ] ≈ S ′ [ ϕ ] : Ty i (by IH, statement (2)) \Delta\vdash S[\phi] \approx S'[\phi] : \operatorname{Ty}_i \qquad\text{(by IH, statement (2))} Δ ⊢ S [ ϕ ] ≈ S ′ [ ϕ ] : Ty i (by IH, statement (2))
Δ , x : S [ ϕ ] ⊢ T [ q ( ϕ ) ] : Ty i (by IH, using Theorem 3.5) \Delta, x : S[\phi] \vdash T[q(\phi)] : \operatorname{Ty}_i \qquad\text{(by IH, using Theorem 3.5)} Δ , x : S [ ϕ ] ⊢ T [ q ( ϕ )] : Ty i (by IH, using Theorem 3.5)
Δ , x : S ′ [ ϕ ] ⊢ T ′ [ q ( ϕ ) ] : Ty i (by IH, using Theorem 3.5) \Delta, x : S'[\phi] \vdash T'[q(\phi)] : \operatorname{Ty}_i \qquad\text{(by IH, using Theorem 3.5)} Δ , x : S ′ [ ϕ ] ⊢ T ′ [ q ( ϕ )] : Ty i (by IH, using Theorem 3.5)
Δ , x : S [ ϕ ] ⊢ T [ q ( ϕ ) ] ⊆ T ′ [ q ( ϕ ) ] (by IH, statement (3), using Theorem 3.5) \Delta, x : S[\phi] \vdash T[q(\phi)] \subseteq T'[q(\phi)] \qquad\text{(by IH, statement (3), using Theorem 3.5)} Δ , x : S [ ϕ ] ⊢ T [ q ( ϕ )] ⊆ T ′ [ q ( ϕ )] (by IH, statement (3), using Theorem 3.5)
Δ ⊢ Π ( x : S [ ϕ ] ) . ( T [ q ( ϕ ) ] ) ⊆ Π ( x : S ′ [ ϕ ] ) . ( T ′ [ q ( ϕ ) ] ) (by Sub-Pi) \Delta\vdash\Pi(x : S[\phi]).(T[q(\phi)]) \subseteq\Pi(x : S'[\phi]).(T'[q(\phi)]) \qquad\text{(by Sub-Pi)} Δ ⊢ Π ( x : S [ ϕ ]) . ( T [ q ( ϕ )]) ⊆ Π ( x : S ′ [ ϕ ]) . ( T ′ [ q ( ϕ )]) (by Sub-Pi)
This is Δ ⊢ ( Π ( x : S ) . T ) [ ϕ ] ⊆ ( Π ( x : S ′ ) . T ′ ) [ ϕ ] \Delta\vdash(\Pi(x : S).T)[\phi] \subseteq(\Pi(x : S').T')[\phi] Δ ⊢ ( Π ( x : S ) . T ) [ ϕ ] ⊆ ( Π ( x : S ′ ) . T ′ ) [ ϕ ] .
The remaining cases (U-Wf, N-Wf, Π \Pi Π -Wf, Ze-I, Su-I, N-E, congruence rules, Sub-Univ, Sub-Trans, Sub-Eq) are analogous: apply the IH to each premise, using Theorem 3.5 to construct the weakening for extended contexts, and re-apply the rule. □
Well-Formedness of Substitution Operations
We show that the key substitution operations produce well-typed substitutions.
Lemma 4.2 (Identity Substitution is Well-Typed). If ⊢ Γ \vdash\Gamma ⊢ Γ , then Γ ⊢ i d : Γ \Gamma\vdash id : \Gamma Γ ⊢ i d : Γ .
Proof. We must show: for all x : T ∈ Γ x : T \in\Gamma x : T ∈ Γ , Γ ⊢ i d ( x ) : T [ i d ] \Gamma\vdash id(x) : T[id] Γ ⊢ i d ( x ) : T [ i d ] . Since i d ( x ) = x id(x) = x i d ( x ) = x and T [ i d ] = T T[id] = T T [ i d ] = T (by Theorem 2.17), this reduces to Γ ⊢ x : T \Gamma\vdash x : T Γ ⊢ x : T , which holds by Var. □
Lemma 4.3 (Extension is Well-Typed). If Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , Δ ⊢ S : Ty i \Delta\vdash S : \operatorname{Ty}_i Δ ⊢ S : Ty i , and Γ ⊢ s : S [ σ ] \Gamma\vdash s : S[\sigma] Γ ⊢ s : S [ σ ] , then Γ ⊢ ( σ , s / x ) : ( Δ , x : S ) \Gamma\vdash(\sigma, s/x) : (\Delta, x : S) Γ ⊢ ( σ , s / x ) : ( Δ , x : S ) .
Proof. We must show: for all y : T ∈ Δ , x : S y : T \in\Delta, x : S y : T ∈ Δ , x : S , Γ ⊢ ( σ , s / x ) ( y ) : T [ ( σ , s / x ) ] \Gamma\vdash(\sigma, s/x)(y) : T[(\sigma, s/x)] Γ ⊢ ( σ , s / x ) ( y ) : T [( σ , s / x )] .
x 0 : S [ ↑ ] ∈ Δ , x : S x_0 : S[\mathord{\uparrow}] \in\Delta, x : S x 0 : S [ ↑ ] ∈ Δ , x : S : Then ( σ , s / x ) ( x 0 ) = s (\sigma, s/x)(x_0) = s ( σ , s / x ) ( x 0 ) = s and S [ ↑ ] [ ( σ , s / x ) ] = S [ σ ] S[\mathord{\uparrow}][(\sigma, s/x)] = S[\sigma] S [ ↑ ] [( σ , s / x )] = S [ σ ] (by Theorems 2.22 and 2.25). We have Γ ⊢ s : S [ σ ] \Gamma\vdash s : S[\sigma] Γ ⊢ s : S [ σ ] by assumption.
1 + z : T ′ [ ↑ ] ∈ Δ , x : S 1+z : T'[\mathord{\uparrow}] \in\Delta, x : S 1 + z : T ′ [ ↑ ] ∈ Δ , x : S with z : T ′ ∈ Δ z : T' \in\Delta z : T ′ ∈ Δ : Then ( σ , s / x ) ( 1 + z ) = σ ( z ) (\sigma, s/x)(1+z) = \sigma(z) ( σ , s / x ) ( 1 + z ) = σ ( z ) and T ′ [ ↑ ] [ ( σ , s / x ) ] = T ′ [ σ ] T'[\mathord{\uparrow}][(\sigma, s/x)] = T'[\sigma] T ′ [ ↑ ] [( σ , s / x )] = T ′ [ σ ] (by Theorems 2.22 and 2.25). From Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , Γ ⊢ σ ( z ) : T ′ [ σ ] \Gamma\vdash\sigma(z) : T'[\sigma] Γ ⊢ σ ( z ) : T ′ [ σ ] .
Lemma 4.4 (Single Substitution is Well-Typed). If ⊢ Γ \vdash\Gamma ⊢ Γ , Γ ⊢ S : Ty i \Gamma\vdash S : \operatorname{Ty}_i Γ ⊢ S : Ty i , and Γ ⊢ s : S \Gamma\vdash s : S Γ ⊢ s : S , then Γ ⊢ ( i d , s / x ) : ( Γ , x : S ) \Gamma\vdash(id, s/x) : (\Gamma, x : S) Γ ⊢ ( i d , s / x ) : ( Γ , x : S ) .
Proof. By Theorem 4.2 and Theorem 4.3: i d id i d is well-typed by Theorem 4.2, and Γ ⊢ s : S = Γ ⊢ s : S [ i d ] \Gamma\vdash s : S = \Gamma\vdash s : S[id] Γ ⊢ s : S = Γ ⊢ s : S [ i d ] by Theorem 2.17. □
Lemma 4.5 (Weakening of Substitution is Well-Typed). If Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ and Γ ′ ⊢ w ϕ : Γ \Gamma' \vdash_w \phi: \Gamma Γ ′ ⊢ w ϕ : Γ , then Γ ′ ⊢ σ [ ϕ ] : Δ \Gamma' \vdash\sigma[\phi] : \Delta Γ ′ ⊢ σ [ ϕ ] : Δ .
Proof. We must show: for all x : T ∈ Δ x : T \in\Delta x : T ∈ Δ , Γ ′ ⊢ ( σ [ ϕ ] ) ( x ) : T [ σ [ ϕ ] ] \Gamma' \vdash(\sigma[\phi])(x) : T[\sigma[\phi]] Γ ′ ⊢ ( σ [ ϕ ]) ( x ) : T [ σ [ ϕ ]] . From Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , Γ ⊢ σ ( x ) : T [ σ ] \Gamma\vdash\sigma(x) : T[\sigma] Γ ⊢ σ ( x ) : T [ σ ] . By Theorem 4.1, Γ ′ ⊢ σ ( x ) [ ϕ ] : T [ σ ] [ ϕ ] \Gamma' \vdash\sigma(x)[\phi] : T[\sigma][\phi] Γ ′ ⊢ σ ( x ) [ ϕ ] : T [ σ ] [ ϕ ] . Now ( σ [ ϕ ] ) ( x ) = σ ( x ) [ ϕ ] (\sigma[\phi])(x) = \sigma(x)[\phi] ( σ [ ϕ ]) ( x ) = σ ( x ) [ ϕ ] and T [ σ [ ϕ ] ] = T [ σ ] [ ϕ ] T[\sigma[\phi]] = T[\sigma][\phi] T [ σ [ ϕ ]] = T [ σ ] [ ϕ ] (by Theorem 2.24). □
Lemma 4.6 (q Preserves Substitution Typing). If Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , Δ ⊢ S : T y i \Delta\vdash S : \mathrm{Ty}_i Δ ⊢ S : Ty i , and Γ ⊢ S [ σ ] : T y i \Gamma\vdash S[\sigma] : \mathrm{Ty}_i Γ ⊢ S [ σ ] : Ty i , then Γ , x 0 : S [ σ ] ⊢ q ( σ ) : ( Δ , x 0 : S ) \Gamma, x_0 : S[\sigma] \vdash q(\sigma) : (\Delta, x_0 : S) Γ , x 0 : S [ σ ] ⊢ q ( σ ) : ( Δ , x 0 : S ) .
Proof. We must show that q ( σ ) q(\sigma) q ( σ ) maps each variable in ( Δ , x 0 : S ) (\Delta, x_0 : S) ( Δ , x 0 : S ) to a well-typed term in ( Γ , x 0 : S [ σ ] ) (\Gamma, x_0 : S[\sigma]) ( Γ , x 0 : S [ σ ]) . We case-split on the lookup in ( Δ , x 0 : S ) (\Delta, x_0 : S) ( Δ , x 0 : S ) :
q ( σ ) ( x 0 ) = x 0 q(\sigma)(x_0) = x_0 q ( σ ) ( x 0 ) = x 0
S [ ⇑ ] [ q ( σ ) ] = S [ σ ] [ ⇑ ] (by Theorem 2.20) S[\Uparrow][q(\sigma)] = S[\sigma][\Uparrow] \qquad\text{(by Theorem 2.20)} S [ ⇑ ] [ q ( σ )] = S [ σ ] [ ⇑ ] (by Theorem 2.20)
x 0 : S [ σ ] [ ⇑ ] ∈ Γ , x 0 : S [ σ ] (by lookup) x_0 : S[\sigma][\Uparrow] \in\Gamma, x_0 : S[\sigma] \qquad\text{(by lookup)} x 0 : S [ σ ] [ ⇑ ] ∈ Γ , x 0 : S [ σ ] (by lookup)
Hence Γ , x 0 : S [ σ ] ⊢ x 0 : S [ ⇑ ] [ q ( σ ) ] \Gamma, x_0 : S[\sigma] \vdash x_0 : S[\Uparrow][q(\sigma)] Γ , x 0 : S [ σ ] ⊢ x 0 : S [ ⇑ ] [ q ( σ )] by Var.
1 + y : T [ ⇑ ] ∈ Δ , x 0 : S 1+y : T[\Uparrow] \in\Delta, x_0 : S 1 + y : T [ ⇑ ] ∈ Δ , x 0 : S where y : T ∈ Δ y : T \in\Delta y : T ∈ Δ :
q ( σ ) ( 1 + y ) = σ ( y ) [ ⇑ ] q(\sigma)(1+y) = \sigma(y)[\Uparrow] q ( σ ) ( 1 + y ) = σ ( y ) [ ⇑ ]
Γ ⊢ σ ( y ) : T [ σ ] (from Γ ⊢ σ : Δ ) \Gamma\vdash\sigma(y) : T[\sigma] \qquad\text{(from $\Gamma\vdash\sigma: \Delta$)} Γ ⊢ σ ( y ) : T [ σ ] (from Γ ⊢ σ : Δ)
Γ , x 0 : S [ σ ] ⊢ σ ( y ) [ ⇑ ] : T [ σ ] [ ⇑ ] (by Theorem 4.1 using Theorem 3.4) \Gamma, x_0 : S[\sigma] \vdash\sigma(y)[\Uparrow] : T[\sigma][\Uparrow] \qquad\text{(by Theorem 4.1 using Theorem 3.4)} Γ , x 0 : S [ σ ] ⊢ σ ( y ) [ ⇑ ] : T [ σ ] [ ⇑ ] (by Theorem 4.1 using Theorem 3.4)
T [ ⇑ ] [ q ( σ ) ] = T [ σ ] [ ⇑ ] (by Theorem 2.20) T[\Uparrow][q(\sigma)] = T[\sigma][\Uparrow] \qquad\text{(by Theorem 2.20)} T [ ⇑ ] [ q ( σ )] = T [ σ ] [ ⇑ ] (by Theorem 2.20)
Hence Γ , x 0 : S [ σ ] ⊢ σ ( y ) [ ⇑ ] : T [ ⇑ ] [ q ( σ ) ] \Gamma, x_0 : S[\sigma] \vdash\sigma(y)[\Uparrow] : T[\Uparrow][q(\sigma)] Γ , x 0 : S [ σ ] ⊢ σ ( y ) [ ⇑ ] : T [ ⇑ ] [ q ( σ )] .
Note that this lemma takes an extra premise Γ ⊢ S [ σ ] : T y i \Gamma\vdash S[\sigma] : \mathrm{Ty}_i Γ ⊢ S [ σ ] : Ty i . This premise would not be necessary once we have substitutions, but since at this point, the lemma is still not unavailable, we must bear with this extra premise, which can be later omitted.
Substitution Preserves Typing
The central property of the operational approach is that well-typed substitutions preserve all judgments.
Lemma 4.7 (Substitution Preserves Judgments). The following are proved by mutual induction on the syntactic judgments:
If Δ ⊢ t : T \Delta\vdash t : T Δ ⊢ t : T and Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , then Γ ⊢ t [ σ ] : T [ σ ] \Gamma\vdash t[\sigma] : T[\sigma] Γ ⊢ t [ σ ] : T [ σ ] .
If Δ ⊢ t ≈ t ′ : T \Delta\vdash t \approx t' : T Δ ⊢ t ≈ t ′ : T and Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , then Γ ⊢ t [ σ ] ≈ t ′ [ σ ] : T [ σ ] \Gamma\vdash t[\sigma] \approx t'[\sigma] : T[\sigma] Γ ⊢ t [ σ ] ≈ t ′ [ σ ] : T [ σ ] .
If Δ ⊢ S ⊆ T \Delta\vdash S \subseteq T Δ ⊢ S ⊆ T and Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , then Γ ⊢ S [ σ ] ⊆ T [ σ ] \Gamma\vdash S[\sigma] \subseteq T[\sigma] Γ ⊢ S [ σ ] ⊆ T [ σ ] .
Proof. By mutual induction on the derivation of the syntactic judgment. We show representative cases for statement (1).
Case
⊢ Δ x : T ∈ Δ Δ ⊢ x : T \frac{\vdash\Delta\qquad x : T \in\Delta}{\Delta\vdash x : T} Δ ⊢ x : T ⊢ Δ x : T ∈ Δ
Then t [ σ ] = x [ σ ] = σ ( x ) t[\sigma] = x[\sigma] = \sigma(x) t [ σ ] = x [ σ ] = σ ( x ) . By the definition of Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , we have Γ ⊢ σ ( x ) : T [ σ ] \Gamma\vdash\sigma(x) : T[\sigma] Γ ⊢ σ ( x ) : T [ σ ] , which is the goal.
Case
Δ ⊢ S : T y i Δ , x : S ⊢ t ′ : T Δ ⊢ λ x . t ′ : Π ( x : S ) . T \frac{\Delta\vdash S : \mathrm{Ty}_i \qquad\Delta, x : S \vdash t' : T}{\Delta\vdash\lambda x.t' : \Pi(x : S).T} Δ ⊢ λ x . t ′ : Π ( x : S ) . T Δ ⊢ S : Ty i Δ , x : S ⊢ t ′ : T
We must show Γ ⊢ ( λ x . t ′ ) [ σ ] : ( Π ( x : S ) . T ) [ σ ] \Gamma\vdash(\lambda x.t')[\sigma] : (\Pi(x : S).T)[\sigma] Γ ⊢ ( λ x . t ′ ) [ σ ] : ( Π ( x : S ) . T ) [ σ ] . Unfolding:
( λ x . t ′ ) [ σ ] = λ x . ( t ′ [ q ( σ ) ] ) (\lambda x.t')[\sigma] = \lambda x.(t'[q(\sigma)]) ( λ x . t ′ ) [ σ ] = λ x . ( t ′ [ q ( σ )])
( Π ( x : S ) . T ) [ σ ] = Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) (\Pi(x : S).T)[\sigma] = \Pi(x : S[\sigma]).(T[q(\sigma)]) ( Π ( x : S ) . T ) [ σ ] = Π ( x : S [ σ ]) . ( T [ q ( σ )])
Now:
Γ ⊢ S [ σ ] : T y i (by IH on first premise) Γ , x : S [ σ ] ⊢ q ( σ ) : ( Δ , x : S ) (by Theorem 4.6) Γ , x : S [ σ ] ⊢ t ′ [ q ( σ ) ] : T [ q ( σ ) ] (by IH on second premise) Γ ⊢ λ x . ( t ′ [ q ( σ ) ] ) : Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) (by λ -I) \begin{aligned}
\Gamma\vdash S[\sigma] &: \mathrm{Ty}_i && \text{(by IH on first premise)}\\
\Gamma, x : S[\sigma] \vdash q(\sigma) &: (\Delta, x : S) && \text{(by Theorem 4.6)}\\
\Gamma, x : S[\sigma] \vdash t'[q(\sigma)] &: T[q(\sigma)] && \text{(by IH on second premise)}\\
\Gamma\vdash\lambda x.(t'[q(\sigma)]) &: \Pi(x : S[\sigma]).(T[q(\sigma)]) && \text{(by }\lambda\text{-I)}
\end{aligned} Γ ⊢ S [ σ ] Γ , x : S [ σ ] ⊢ q ( σ ) Γ , x : S [ σ ] ⊢ t ′ [ q ( σ )] Γ ⊢ λ x . ( t ′ [ q ( σ )]) : Ty i : ( Δ , x : S ) : T [ q ( σ )] : Π ( x : S [ σ ]) . ( T [ q ( σ )]) (by IH on first premise) (by Theorem 4.6) (by IH on second premise) (by λ -I)
Case
Δ ⊢ S : T y i Δ , x : S ⊢ T : T y i Δ ⊢ r : Π ( x : S ) . T Δ ⊢ s : S Δ ⊢ r s : T [ s / x ] \frac{\Delta\vdash S : \mathrm{Ty}_i \qquad\Delta, x : S \vdash T : \mathrm{Ty}_i \qquad\Delta\vdash r : \Pi(x : S).T \qquad\Delta\vdash s : S}{\Delta\vdash r\ s : T[s/x]} Δ ⊢ r s : T [ s / x ] Δ ⊢ S : Ty i Δ , x : S ⊢ T : Ty i Δ ⊢ r : Π ( x : S ) . T Δ ⊢ s : S
We must show Γ ⊢ ( r s ) [ σ ] : ( T [ s / x ] ) [ σ ] \Gamma\vdash(r\ s)[\sigma] : (T[s/x])[\sigma] Γ ⊢ ( r s ) [ σ ] : ( T [ s / x ]) [ σ ] . Unfolding: ( r s ) [ σ ] = r [ σ ] s [ σ ] (r\ s)[\sigma] = r[\sigma]\ s[\sigma] ( r s ) [ σ ] = r [ σ ] s [ σ ] .
Γ ⊢ S [ σ ] : T y i (by IH on first premise) Γ , x : S [ σ ] ⊢ T [ q ( σ ) ] : T y i (by IH on second premise using Theorem 4.6) Γ ⊢ r [ σ ] : Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) (by IH on third premise) Γ ⊢ s [ σ ] : S [ σ ] (by IH on fourth premise) Γ ⊢ r [ σ ] s [ σ ] : T [ q ( σ ) ] [ s [ σ ] / x ] (by λ -E) \begin{aligned}
\Gamma\vdash S[\sigma] &: \mathrm{Ty}_i && \text{(by IH on first premise)}\\
\Gamma, x : S[\sigma] \vdash T[q(\sigma)] &: \mathrm{Ty}_i && \text{(by IH on second premise using Theorem 4.6)}\\
\Gamma\vdash r[\sigma] &: \Pi(x : S[\sigma]).(T[q(\sigma)]) && \text{(by IH on third premise)}\\
\Gamma\vdash s[\sigma] &: S[\sigma] && \text{(by IH on fourth premise)}\\
\Gamma\vdash r[\sigma]\ s[\sigma] &: T[q(\sigma)][s[\sigma]/x] && \text{(by }\lambda\text{-E)}
\end{aligned} Γ ⊢ S [ σ ] Γ , x : S [ σ ] ⊢ T [ q ( σ )] Γ ⊢ r [ σ ] Γ ⊢ s [ σ ] Γ ⊢ r [ σ ] s [ σ ] : Ty i : Ty i : Π ( x : S [ σ ]) . ( T [ q ( σ )]) : S [ σ ] : T [ q ( σ )] [ s [ σ ] / x ] (by IH on first premise) (by IH on second premise using Theorem 4.6) (by IH on third premise) (by IH on fourth premise) (by λ -E)
It remains to show T [ q ( σ ) ] [ s [ σ ] / x ] = ( T [ s / x ] ) [ σ ] T[q(\sigma)][s[\sigma]/x] = (T[s/x])[\sigma] T [ q ( σ )] [ s [ σ ] / x ] = ( T [ s / x ]) [ σ ] , which is Theorem 2.30.
Case
Δ ⊢ T : T y i Δ ⊢ t : S Δ ⊢ S ⊆ T Δ ⊢ t : T \frac{\Delta\vdash T : \mathrm{Ty}_i \qquad\Delta\vdash t : S \qquad\Delta\vdash S \subseteq T}{\Delta\vdash t : T} Δ ⊢ t : T Δ ⊢ T : Ty i Δ ⊢ t : S Δ ⊢ S ⊆ T
Γ ⊢ T [ σ ] : T y i (by IH on first premise) Γ ⊢ t [ σ ] : S [ σ ] (by IH on second premise) Γ ⊢ S [ σ ] ⊆ T [ σ ] (by IH, statement (3)) Γ ⊢ t [ σ ] : T [ σ ] (by Subsump) \begin{aligned}
\Gamma\vdash T[\sigma] &: \mathrm{Ty}_i && \text{(by IH on first premise)}\\
\Gamma\vdash t[\sigma] &: S[\sigma] && \text{(by IH on second premise)}\\
\Gamma\vdash S[\sigma] &\subseteq T[\sigma] && \text{(by IH, statement (3))}\\
\Gamma\vdash t[\sigma] &: T[\sigma] && \text{(by Subsump)}
\end{aligned} Γ ⊢ T [ σ ] Γ ⊢ t [ σ ] Γ ⊢ S [ σ ] Γ ⊢ t [ σ ] : Ty i : S [ σ ] ⊆ T [ σ ] : T [ σ ] (by IH on first premise) (by IH on second premise) (by IH, statement (3)) (by Subsump)
The remaining cases (U-Wf, N-Wf, Ze-I, Su-I) are straightforward applications of the IH.
We now show representative cases for statement (2). The congruence cases follow directly from the IH. We show the computation and uniqueness rules.
Case
Δ ⊢ S : T y i Δ , x : S ⊢ T : T y i Δ , x : S ⊢ t : T Δ ⊢ s : S Δ ⊢ ( λ x . t ) s ≈ t [ s / x ] : T [ s / x ] \frac{\Delta\vdash S : \mathrm{Ty}_i \qquad\Delta, x : S \vdash T : \mathrm{Ty}_i \qquad\Delta, x : S \vdash t : T \qquad\Delta\vdash s : S}{\Delta\vdash(\lambda x.t)\ s \approx t[s/x] : T[s/x]} Δ ⊢ ( λ x . t ) s ≈ t [ s / x ] : T [ s / x ] Δ ⊢ S : Ty i Δ , x : S ⊢ T : Ty i Δ , x : S ⊢ t : T Δ ⊢ s : S
We must show Γ ⊢ ( ( λ x . t ) s ) [ σ ] ≈ t [ s / x ] [ σ ] : T [ s / x ] [ σ ] \Gamma\vdash((\lambda x.t)\ s)[\sigma] \approx t[s/x][\sigma] : T[s/x][\sigma] Γ ⊢ (( λ x . t ) s ) [ σ ] ≈ t [ s / x ] [ σ ] : T [ s / x ] [ σ ] . Unfolding:
( ( λ x . t ) s ) [ σ ] = ( λ x . ( t [ q ( σ ) ] ) ) ( s [ σ ] ) t [ s / x ] [ σ ] = t [ ( i d , s / x ) ∘ σ ] (by Theorem 2.22) = t [ i d ∘ σ , s [ σ ] / x ] (by Theorem 2.26) = t [ σ , s [ σ ] / x ] (by Theorem 2.29 (left identity)) \begin{aligned}
((\lambda x.t)\ s)[\sigma] &= (\lambda x.(t[q(\sigma)]))\ (s[\sigma])\\
t[s/x][\sigma] &= t[(\mathrm{id},s/x)\circ\sigma] && \text{(by Theorem 2.22)}\\
&= t[\mathrm{id}\circ\sigma,s[\sigma]/x] && \text{(by Theorem 2.26)}\\
&= t[\sigma,s[\sigma]/x] && \text{(by Theorem 2.29 (left identity))}
\end{aligned} (( λ x . t ) s ) [ σ ] t [ s / x ] [ σ ] = ( λ x . ( t [ q ( σ )])) ( s [ σ ]) = t [( id , s / x ) ∘ σ ] = t [ id ∘ σ , s [ σ ] / x ] = t [ σ , s [ σ ] / x ] (by Theorem 2.22) (by Theorem 2.26) (by Theorem 2.29 (left identity))
Now:
Γ ⊢ S [ σ ] : T y i (by IH) Γ , x : S [ σ ] ⊢ T [ q ( σ ) ] : T y i (by IH using Theorem 4.6) Γ , x : S [ σ ] ⊢ t [ q ( σ ) ] : T [ q ( σ ) ] (by IH using Theorem 4.6) Γ ⊢ s [ σ ] : S [ σ ] (by IH) Γ ⊢ ( λ x . ( t [ q ( σ ) ] ) ) ( s [ σ ] ) ≈ t [ q ( σ ) ] [ s [ σ ] / x ] : T [ q ( σ ) ] [ s [ σ ] / x ] (by Π - β ) \begin{aligned}
\Gamma&\vdash S[\sigma] : \mathrm{Ty}_i &&\text{(by IH)}\\
\Gamma, x : S[\sigma] &\vdash T[q(\sigma)] : \mathrm{Ty}_i &&\text{(by IH using Theorem 4.6)}\\
\Gamma, x : S[\sigma] &\vdash t[q(\sigma)] : T[q(\sigma)] &&\text{(by IH using Theorem 4.6)}\\
\Gamma&\vdash s[\sigma] : S[\sigma] &&\text{(by IH)}\\
\Gamma&\vdash(\lambda x.(t[q(\sigma)]))(s[\sigma]) \mathrel{\approx} t[q(\sigma)][s[\sigma]/x] : T[q(\sigma)][s[\sigma]/x] &&\text{(by }\Pi\text{-}\beta\text{)}
\end{aligned} Γ Γ , x : S [ σ ] Γ , x : S [ σ ] Γ Γ ⊢ S [ σ ] : Ty i ⊢ T [ q ( σ )] : Ty i ⊢ t [ q ( σ )] : T [ q ( σ )] ⊢ s [ σ ] : S [ σ ] ⊢ ( λ x . ( t [ q ( σ )])) ( s [ σ ]) ≈ t [ q ( σ )] [ s [ σ ] / x ] : T [ q ( σ )] [ s [ σ ] / x ] (by IH) (by IH using Theorem 4.6) (by IH using Theorem 4.6) (by IH) (by Π - β )
By Theorem 2.30: t [ q ( σ ) ] [ s [ σ ] / x ] = ( t [ s / x ] ) [ σ ] t[q(\sigma)][s[\sigma]/x] = (t[s/x])[\sigma] t [ q ( σ )] [ s [ σ ] / x ] = ( t [ s / x ]) [ σ ] and T [ q ( σ ) ] [ s [ σ ] / x ] = ( T [ s / x ] ) [ σ ] T[q(\sigma)][s[\sigma]/x] = (T[s/x])[\sigma] T [ q ( σ )] [ s [ σ ] / x ] = ( T [ s / x ]) [ σ ] .
Case
Δ ⊢ S : T y i Δ , x : S ⊢ T : T y i Δ ⊢ t : Π ( x : S ) . T Δ ⊢ t ≈ λ x . ( t [ ⇑ ] x ) : Π ( x : S ) . T \frac{\Delta\vdash S : \mathrm{Ty}_i \qquad\Delta,x : S \vdash T : \mathrm{Ty}_i \qquad\Delta\vdash t : \Pi(x : S).T}{\Delta\vdash t \mathrel{\approx} \lambda x.(t[\Uparrow]x) : \Pi(x : S).T} Δ ⊢ t ≈ λ x . ( t [ ⇑ ] x ) : Π ( x : S ) . T Δ ⊢ S : Ty i Δ , x : S ⊢ T : Ty i Δ ⊢ t : Π ( x : S ) . T
We must show Γ ⊢ t [ σ ] ≈ ( λ x . ( t [ ⇑ ] x ) ) [ σ ] : ( Π ( x : S ) . T ) [ σ ] \Gamma\vdash t[\sigma] \mathrel{\approx} (\lambda x.(t[\Uparrow]x))[\sigma] : (\Pi(x : S).T)[\sigma] Γ ⊢ t [ σ ] ≈ ( λ x . ( t [ ⇑ ] x )) [ σ ] : ( Π ( x : S ) . T ) [ σ ] . Unfolding the right-hand side:
( λ x . ( t [ ⇑ ] x ) ) [ σ ] = λ x . ( ( t [ ⇑ ] x ) [ q ( σ ) ] ) = λ x . ( t [ ⇑ ] [ q ( σ ) ] x ) = λ x . ( t [ σ ] [ ⇑ ] x ) (by Theorem 2.20) \begin{aligned}
(\lambda x.(t[\Uparrow]x))[\sigma] &= \lambda x.((t[\Uparrow]x)[q(\sigma)])\\
&= \lambda x.(t[\Uparrow][q(\sigma)]x)\\
&= \lambda x.(t[\sigma][\Uparrow]x) &&\text{(by Theorem 2.20)}
\end{aligned} ( λ x . ( t [ ⇑ ] x )) [ σ ] = λ x . (( t [ ⇑ ] x ) [ q ( σ )]) = λ x . ( t [ ⇑ ] [ q ( σ )] x ) = λ x . ( t [ σ ] [ ⇑ ] x ) (by Theorem 2.20)
Now:
Γ ⊢ S [ σ ] : T y i (by IH) Γ , x : S [ σ ] ⊢ T [ q ( σ ) ] : T y i (by IH using Theorem 4.6) Γ ⊢ t [ σ ] : Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) (by IH) Γ ⊢ t [ σ ] ≈ λ x . ( t [ σ ] [ ⇑ ] x ) : Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) (by Π - η ) \begin{aligned}
\Gamma&\vdash S[\sigma] : \mathrm{Ty}_i &&\text{(by IH)}\\
\Gamma,x : S[\sigma] &\vdash T[q(\sigma)] : \mathrm{Ty}_i &&\text{(by IH using Theorem 4.6)}\\
\Gamma&\vdash t[\sigma] : \Pi(x : S[\sigma]).(T[q(\sigma)]) &&\text{(by IH)}\\
\Gamma&\vdash t[\sigma] \mathrel{\approx} \lambda x.(t[\sigma][\Uparrow]x) : \Pi(x : S[\sigma]).(T[q(\sigma)]) &&\text{(by }\Pi\text{-}\eta\text{)}
\end{aligned} Γ Γ , x : S [ σ ] Γ Γ ⊢ S [ σ ] : Ty i ⊢ T [ q ( σ )] : Ty i ⊢ t [ σ ] : Π ( x : S [ σ ]) . ( T [ q ( σ )]) ⊢ t [ σ ] ≈ λ x . ( t [ σ ] [ ⇑ ] x ) : Π ( x : S [ σ ]) . ( T [ q ( σ )]) (by IH) (by IH using Theorem 4.6) (by IH) (by Π - η )
We now show representative cases for statement (3).
Case
⊢ Δ i ≤ j Δ ⊢ T y i ⊆ T y j \frac{\vdash\Delta\ i \le j}{\Delta\vdash\mathrm{Ty}_i \subseteq\mathrm{Ty}_j} Δ ⊢ Ty i ⊆ Ty j ⊢ Δ i ≤ j
Then T y i [ σ ] = T y i \mathrm{Ty}_i[\sigma] = \mathrm{Ty}_i Ty i [ σ ] = Ty i and T y j [ σ ] = T y j \mathrm{Ty}_j[\sigma] = \mathrm{Ty}_j Ty j [ σ ] = Ty j . From Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , we have ⊢ Γ \vdash\Gamma ⊢ Γ . By Sub-Univ, Γ ⊢ T y i ⊆ T y j \Gamma\vdash\mathrm{Ty}_i \subseteq\mathrm{Ty}_j Γ ⊢ Ty i ⊆ Ty j .
Case
Δ ⊢ S ′ : T y i Δ ⊢ S ≈ S ′ : T y i Δ , x : S ⊢ T : T y i Δ , x : S ′ ⊢ T ′ : T y i Δ , x : S ⊢ T ⊆ T ′ Δ ⊢ Π ( x : S ) . T ⊆ Π ( x : S ′ ) . T ′ \frac{\Delta\vdash S' : \mathrm{Ty}_i \qquad\Delta\vdash S \mathrel{\approx} S' : \mathrm{Ty}_i \qquad\Delta,x : S \vdash T : \mathrm{Ty}_i \qquad\Delta,x : S' \vdash T' : \mathrm{Ty}_i \qquad\Delta,x : S \vdash T \subseteq T'}{\Delta\vdash\Pi(x : S).T \subseteq\Pi(x : S').T'} Δ ⊢ Π ( x : S ) . T ⊆ Π ( x : S ′ ) . T ′ Δ ⊢ S ′ : Ty i Δ ⊢ S ≈ S ′ : Ty i Δ , x : S ⊢ T : Ty i Δ , x : S ′ ⊢ T ′ : Ty i Δ , x : S ⊢ T ⊆ T ′
Γ ⊢ S [ σ ] : T y i (by IH) Γ ⊢ S ′ [ σ ] : T y i (by IH) Γ ⊢ S [ σ ] ≈ S ′ [ σ ] : T y i (by IH, statement (2)) Γ , x : S [ σ ] ⊢ T [ q ( σ ) ] : T y i (by IH using Theorem 4.6) Γ , x : S ′ [ σ ] ⊢ T ′ [ q ( σ ) ] : T y i (by IH using Theorem 4.6) Γ , x : S [ σ ] ⊢ T [ q ( σ ) ] ⊆ T ′ [ q ( σ ) ] (by IH, statement (3), using Theorem 4.6) Γ ⊢ Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) ⊆ Π ( x : S ′ [ σ ] ) . ( T ′ [ q ( σ ) ] ) (by Sub-Pi) \begin{aligned}
\Gamma&\vdash S[\sigma] : \mathrm{Ty}_i &&\text{(by IH)}\\
\Gamma&\vdash S'[\sigma] : \mathrm{Ty}_i &&\text{(by IH)}\\
\Gamma&\vdash S[\sigma] \mathrel{\approx} S'[\sigma] : \mathrm{Ty}_i &&\text{(by IH, statement (2))}\\
\Gamma,x : S[\sigma] &\vdash T[q(\sigma)] : \mathrm{Ty}_i &&\text{(by IH using Theorem 4.6)}\\
\Gamma,x : S'[\sigma] &\vdash T'[q(\sigma)] : \mathrm{Ty}_i &&\text{(by IH using Theorem 4.6)}\\
\Gamma,x : S[\sigma] &\vdash T[q(\sigma)] \subseteq T'[q(\sigma)] &&\text{(by IH, statement (3), using Theorem 4.6)}\\
\Gamma&\vdash\Pi(x : S[\sigma]).(T[q(\sigma)]) \subseteq\Pi(x : S'[\sigma]).(T'[q(\sigma)]) &&\text{(by Sub-Pi)}
\end{aligned} Γ Γ Γ Γ , x : S [ σ ] Γ , x : S ′ [ σ ] Γ , x : S [ σ ] Γ ⊢ S [ σ ] : Ty i ⊢ S ′ [ σ ] : Ty i ⊢ S [ σ ] ≈ S ′ [ σ ] : Ty i ⊢ T [ q ( σ )] : Ty i ⊢ T ′ [ q ( σ )] : Ty i ⊢ T [ q ( σ )] ⊆ T ′ [ q ( σ )] ⊢ Π ( x : S [ σ ]) . ( T [ q ( σ )]) ⊆ Π ( x : S ′ [ σ ]) . ( T ′ [ q ( σ )]) (by IH) (by IH) (by IH, statement (2)) (by IH using Theorem 4.6) (by IH using Theorem 4.6) (by IH, statement (3), using Theorem 4.6) (by Sub-Pi)
This is Γ ⊢ ( Π ( x : S ) . T ) [ σ ] ⊆ ( Π ( x : S ′ ) . T ′ ) [ σ ] \Gamma\vdash(\Pi(x : S).T)[\sigma] \subseteq(\Pi(x : S').T')[\sigma] Γ ⊢ ( Π ( x : S ) . T ) [ σ ] ⊆ ( Π ( x : S ′ ) . T ′ ) [ σ ] .
Case Sub-Trans: By two applications of the IH and Sub-Trans.
Case Sub-Eq: By statement (2) and Sub-Eq. □ \square □
Consequences
Lemma 4.8 (Composition of Substitutions is Well-Typed). If Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ and Γ ′ ⊢ τ : Γ \Gamma' \vdash\tau: \Gamma Γ ′ ⊢ τ : Γ , then Γ ′ ⊢ σ ∘ τ : Δ \Gamma' \vdash\sigma\circ\tau: \Delta Γ ′ ⊢ σ ∘ τ : Δ .
Proof. We must show: for all x : T ∈ Δ x : T \in\Delta x : T ∈ Δ , Γ ′ ⊢ ( σ ∘ τ ) ( x ) : T [ σ ∘ τ ] \Gamma' \vdash(\sigma\circ\tau)(x) : T[\sigma\circ\tau] Γ ′ ⊢ ( σ ∘ τ ) ( x ) : T [ σ ∘ τ ] .
Γ ⊢ σ ( x ) : T [ σ ] (from Γ ⊢ σ : Δ ) \Gamma\vdash\sigma(x) : T[\sigma] \qquad\text{(from }\Gamma\vdash\sigma: \Delta\text{)} Γ ⊢ σ ( x ) : T [ σ ] (from Γ ⊢ σ : Δ ) Γ ′ ⊢ σ ( x ) [ τ ] : T [ σ ] [ τ ] (by Theorem 4.7) \Gamma' \vdash\sigma(x)[\tau] : T[\sigma][\tau] \qquad\text{(by Theorem 4.7)} Γ ′ ⊢ σ ( x ) [ τ ] : T [ σ ] [ τ ] (by Theorem 4.7) ( σ ∘ τ ) ( x ) = σ ( x ) [ τ ] (by definition) (\sigma\circ\tau)(x) = \sigma(x)[\tau] \qquad\text{(by definition)} ( σ ∘ τ ) ( x ) = σ ( x ) [ τ ] (by definition) T [ σ ∘ τ ] = T [ σ ] [ τ ] (by Theorem 2.22) T[\sigma\circ\tau] = T[\sigma][\tau] \qquad\text{(by Theorem 2.22)} T [ σ ∘ τ ] = T [ σ ] [ τ ] (by Theorem 2.22)
Corollary 4.9 (Single Substitution Lemma). If Γ , x : S ⊢ t : T \Gamma, x : S \vdash t : T Γ , x : S ⊢ t : T and Γ ⊢ s : S \Gamma\vdash s : S Γ ⊢ s : S , then Γ ⊢ t [ s / x ] : T [ s / x ] \Gamma\vdash t[s/x] : T[s/x] Γ ⊢ t [ s / x ] : T [ s / x ] .
Proof. By Theorem 4.4 and Theorem 4.7, noting t [ s / x ] = t [ i d , s / x ] t[s/x] = t[\mathit{id},s/x] t [ s / x ] = t [ id , s / x ] . □ \square □
Presupposition
Presupposition states that every derivable judgment entails the well-formedness of its constituent parts.
Lemma 4.10 (Presupposition).
If Γ ⊢ t : T \Gamma\vdash t : T Γ ⊢ t : T , then ⊢ Γ \vdash\Gamma ⊢ Γ and Γ ⊢ T : T y i \Gamma\vdash T : \mathsf{Ty}_i Γ ⊢ T : Ty i for some i i i .
If Γ ⊢ t ≈ t ′ : T \Gamma\vdash t \approx t' : T Γ ⊢ t ≈ t ′ : T , then ⊢ Γ \vdash\Gamma ⊢ Γ , Γ ⊢ t : T \Gamma\vdash t : T Γ ⊢ t : T , Γ ⊢ t ′ : T \Gamma\vdash t' : T Γ ⊢ t ′ : T , and Γ ⊢ T : T y i \Gamma\vdash T : \mathsf{Ty}_i Γ ⊢ T : Ty i for some i i i .
If Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T , then ⊢ Γ \vdash\Gamma ⊢ Γ , Γ ⊢ S : T y i \Gamma\vdash S : \mathsf{Ty}_i Γ ⊢ S : Ty i and Γ ⊢ T : T y i \Gamma\vdash T : \mathsf{Ty}_i Γ ⊢ T : Ty i for some i i i .
Proof. By mutual induction on the derivation.
Case
⊢ Γ x : T ∈ Γ Γ ⊢ x : T \frac{\vdash\Gamma\qquad x : T \in\Gamma}{\Gamma\vdash x : T} Γ ⊢ x : T ⊢ Γ x : T ∈ Γ We have ⊢ Γ \vdash\Gamma ⊢ Γ immediately from the premise. For Γ ⊢ T : T y i \Gamma\vdash T : \mathsf{Ty}_i Γ ⊢ T : Ty i , we do induction on x : T ∈ Γ x : T \in\Gamma x : T ∈ Γ . If Γ = Γ ′ , x : T \Gamma= \Gamma', x : T Γ = Γ ′ , x : T , then Γ ′ , x : T \Gamma', x : T Γ ′ , x : T was derived by Ctx-Ext from Γ ′ ⊢ T : T y i \Gamma' \vdash T : \mathsf{Ty}_i Γ ′ ⊢ T : Ty i ; weakening gives Γ ⊢ T : T y i \Gamma\vdash T : \mathsf{Ty}_i Γ ⊢ T : Ty i . If Γ = Γ ′ , y : S \Gamma= \Gamma', y : S Γ = Γ ′ , y : S and x : T ∈ Γ ′ x : T \in\Gamma' x : T ∈ Γ ′ , then by IH on the smaller context Γ ′ ⊢ T : T y i \Gamma' \vdash T : \mathsf{Ty}_i Γ ′ ⊢ T : Ty i ; weakening gives Γ ⊢ T : T y i \Gamma\vdash T : \mathsf{Ty}_i Γ ⊢ T : Ty i .
Case
⊢ Γ Γ ⊢ T y i : T y 1 + i \frac{\vdash\Gamma}{\Gamma\vdash\mathsf{Ty}_i : \mathsf{Ty}_{1+i}} Γ ⊢ Ty i : Ty 1 + i ⊢ Γ We have ⊢ Γ \vdash\Gamma ⊢ Γ from the premise. The type of the conclusion is T y 1 + i \mathsf{Ty}_{1+i} Ty 1 + i , and Γ ⊢ T y 1 + i : T y 2 + i \Gamma\vdash\mathsf{Ty}_{1+i} : \mathsf{Ty}_{2+i} Γ ⊢ Ty 1 + i : Ty 2 + i by another application of U-Wf.
Case
Γ ⊢ S : T y i Γ , x : S ⊢ T : T y i Γ ⊢ Π ( x : S ) . T : T y i \frac{\Gamma\vdash S : \mathsf{Ty}_i \qquad\Gamma,x:S \vdash T : \mathsf{Ty}_i}{\Gamma\vdash\Pi(x:S).T : \mathsf{Ty}_i} Γ ⊢ Π ( x : S ) . T : Ty i Γ ⊢ S : Ty i Γ , x : S ⊢ T : Ty i ⊢ Γ (by IH on first premise) \vdash\Gamma\qquad\text{(by IH on first premise)} ⊢ Γ (by IH on first premise) Γ ⊢ T y i : T y 1 + i (by U-Wf) \Gamma\vdash\mathsf{Ty}_i : \mathsf{Ty}_{1+i} \qquad\text{(by U-Wf)} Γ ⊢ Ty i : Ty 1 + i (by U-Wf)
Case
Γ ⊢ S : T y i Γ , x : S ⊢ t : T Γ ⊢ λ x . t : Π ( x : S ) . T \frac{\Gamma\vdash S : \mathrm{Ty}_{i} \qquad\Gamma, x : S \vdash t : T}{\Gamma\vdash\lambda x.t : \Pi(x : S).T} Γ ⊢ λ x . t : Π ( x : S ) . T Γ ⊢ S : Ty i Γ , x : S ⊢ t : T
⊢ Γ (by IH on first premise) \vdash\Gamma\qquad\text{(by IH on first premise)} ⊢ Γ (by IH on first premise)
Γ , x : S ⊢ T : T y j for some j (by IH on second premise) \Gamma, x : S \vdash T : \mathrm{Ty}_{j}\text{ for some }j \qquad\text{(by IH on second premise)} Γ , x : S ⊢ T : Ty j for some j (by IH on second premise)
Γ ⊢ Π ( x : S ) . T : T y max ( i , j ) (by Π -Wf + Subsump) \Gamma\vdash\Pi(x : S).T : \mathrm{Ty}_{\max(i,j)} \qquad\text{(by }\Pi\text{-Wf + Subsump)} Γ ⊢ Π ( x : S ) . T : Ty m a x ( i , j ) (by Π -Wf + Subsump)
Case
Γ ⊢ S : T y i Γ , x : S ⊢ T : T y i Γ ⊢ r : Π ( x : S ) . T Γ ⊢ s : S \frac{\Gamma\vdash S : \mathrm{Ty}_{i} \qquad\Gamma, x : S \vdash T : \mathrm{Ty}_{i}}{\Gamma\vdash r : \Pi(x : S).T \qquad\Gamma\vdash s : S} Γ ⊢ r : Π ( x : S ) . T Γ ⊢ s : S Γ ⊢ S : Ty i Γ , x : S ⊢ T : Ty i
Γ ⊢ r s : T [ s / x ] \Gamma\vdash r\ s : T[s/x] Γ ⊢ r s : T [ s / x ]
⊢ Γ (by IH on first premise) \vdash\Gamma\qquad\text{(by IH on first premise)} ⊢ Γ (by IH on first premise)
Γ , x : S ⊢ T : T y i (directly from second premise) \Gamma, x : S \vdash T : \mathrm{Ty}_{i} \qquad\text{(directly from second premise)} Γ , x : S ⊢ T : Ty i (directly from second premise)
Γ ⊢ ( i d , s / x ) : ( Γ , x : S ) (by Theorem 4.4) \Gamma\vdash(\mathrm{id},s/x) : (\Gamma,x : S) \qquad\text{(by Theorem 4.4)} Γ ⊢ ( id , s / x ) : ( Γ , x : S ) (by Theorem 4.4)
Γ ⊢ T [ s / x ] : T y i (by Theorem 4.7) \Gamma\vdash T[s/x] : \mathrm{Ty}_{i} \qquad\text{(by Theorem 4.7)} Γ ⊢ T [ s / x ] : Ty i (by Theorem 4.7)
Case
Γ , x : N a t ⊢ T : T y i Γ ⊢ z : T [ z e r o / x ] Γ , x : N a t , y : T ⊢ s : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] Γ ⊢ t : N a t Γ ⊢ e l i m N a t ( x . T ) z ( x , y . s ) t : T [ t / x ] \frac{\Gamma,x : \mathrm{Nat} \vdash T : \mathrm{Ty}_{i} \qquad\Gamma\vdash z : T[\mathrm{zero}/x] \qquad\Gamma,x : \mathrm{Nat},y : T \vdash s : T[\mathord{\Uparrow}\circ\mathord{\Uparrow},\mathrm{succ}\ x_{1}/x] \qquad\Gamma\vdash t : \mathrm{Nat}}{\Gamma\vdash\mathrm{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ t : T[t/x]} Γ ⊢ elim Nat ( x . T ) z ( x , y . s ) t : T [ t / x ] Γ , x : Nat ⊢ T : Ty i Γ ⊢ z : T [ zero / x ] Γ , x : Nat , y : T ⊢ s : T [ ⇑ ∘ ⇑ , succ x 1 / x ] Γ ⊢ t : Nat
⊢ Γ (by IH on last premise) \vdash\Gamma\qquad\text{(by IH on last premise)} ⊢ Γ (by IH on last premise)
Γ ⊢ ( i d , t / x ) : ( Γ , x : N a t ) (by Theorem 4.4) \Gamma\vdash(\mathrm{id},t/x) : (\Gamma,x : \mathrm{Nat}) \qquad\text{(by Theorem 4.4)} Γ ⊢ ( id , t / x ) : ( Γ , x : Nat ) (by Theorem 4.4)
Γ ⊢ T [ t / x ] : T y i (by Theorem 4.7 on first premise) \Gamma\vdash T[t/x] : \mathrm{Ty}_{i} \qquad\text{(by Theorem 4.7 on first premise)} Γ ⊢ T [ t / x ] : Ty i (by Theorem 4.7 on first premise)
Case
Γ ⊢ T : T y i Γ ⊢ t : S Γ ⊢ S ⊆ T Γ ⊢ t : T \frac{\Gamma\vdash T : \mathrm{Ty}_{i} \qquad\Gamma\vdash t : S \qquad\Gamma\vdash S \subseteq T}{\Gamma\vdash t : T} Γ ⊢ t : T Γ ⊢ T : Ty i Γ ⊢ t : S Γ ⊢ S ⊆ T
⊢ Γ (by IH on first premise) \vdash\Gamma\qquad\text{(by IH on first premise)} ⊢ Γ (by IH on first premise)
Γ ⊢ T : T y i (directly from first premise) \Gamma\vdash T : \mathrm{Ty}_{i} \qquad\text{(directly from first premise)} Γ ⊢ T : Ty i (directly from first premise)
Case
Var-Cong
⊢ Γ x : T ∈ Γ Γ ⊢ x ≈ x : T \frac{\vdash\Gamma\qquad x : T \in\Gamma}{\Gamma\vdash x \approx x : T} Γ ⊢ x ≈ x : T ⊢ Γ x : T ∈ Γ
We have ⊢ Γ \vdash\Gamma ⊢ Γ from the premise. Γ ⊢ x : T \Gamma\vdash x : T Γ ⊢ x : T by Var. Γ ⊢ T : T y i \Gamma\vdash T : \mathrm{Ty}_{i} Γ ⊢ T : Ty i by the same argument as the Var typing case above.
Case
Π \Pi Π -β \beta β
Γ ⊢ S : T y i Γ , x : S ⊢ T : T y i Γ , x : S ⊢ t : T Γ ⊢ s : S Γ ⊢ ( λ x . t ) s ≈ t [ s / x ] : T [ s / x ] \frac{\Gamma\vdash S : \mathrm{Ty}_{i} \qquad\Gamma,x : S \vdash T : \mathrm{Ty}_{i} \qquad\Gamma,x : S \vdash t : T \qquad\Gamma\vdash s : S}{\Gamma\vdash(\lambda x.t)\ s \approx t[s/x] : T[s/x]} Γ ⊢ ( λ x . t ) s ≈ t [ s / x ] : T [ s / x ] Γ ⊢ S : Ty i Γ , x : S ⊢ T : Ty i Γ , x : S ⊢ t : T Γ ⊢ s : S
⊢ Γ \vdash\Gamma ⊢ Γ (by IH on first premise)
Γ ⊢ ( λ x . t ) s : T [ s / x ] \Gamma\vdash(\lambda x.t)\ s : T[s/x] Γ ⊢ ( λ x . t ) s : T [ s / x ] (by λ \lambda λ -E on λ \lambda λ -I)
Γ ⊢ t [ s / x ] : T [ s / x ] \Gamma\vdash t[s/x] : T[s/x] Γ ⊢ t [ s / x ] : T [ s / x ] (by Theorem 4.9 on third premise)
Γ ⊢ T [ s / x ] : T y i \Gamma\vdash T[s/x] : \mathrm{Ty}_i Γ ⊢ T [ s / x ] : Ty i (by Theorem 4.9 on second premise)
Case
Γ ⊢ S : T y i Γ , x : S ⊢ T : T y i Γ ⊢ t : Π ( x : S ) . T Γ ⊢ t ≈ λ x . ( t [ ⟦ ⇑ ⟧ ] x ) : Π ( x : S ) . T Π - η \frac{\Gamma\vdash S : \mathrm{Ty}_i \qquad\Gamma,x:S \vdash T : \mathrm{Ty}_i \qquad\Gamma\vdash t : \Pi(x:S).T}
{\Gamma\vdash t \approx\lambda x.(t[\llbracket\Uparrow\rrbracket]\ x) : \Pi(x:S).T}
\quad\Pi\text{-}\eta Γ ⊢ t ≈ λ x . ( t [ [ [ ⇑ ] ] ] x ) : Π ( x : S ) . T Γ ⊢ S : Ty i Γ , x : S ⊢ T : Ty i Γ ⊢ t : Π ( x : S ) . T Π - η
⊢ Γ \vdash\Gamma ⊢ Γ (by IH on first premise)
Γ ⊢ t : Π ( x : S ) . T \Gamma\vdash t : \Pi(x:S).T Γ ⊢ t : Π ( x : S ) . T (directly from third premise)
Γ , x : S ⊢ w ⇑ : Γ \Gamma,x:S \vdash_{\mathrm{w}} \Uparrow: \Gamma Γ , x : S ⊢ w ⇑: Γ (by Theorem 3.4)
Γ , x : S ⊢ t [ ⇑ ] : Π ( x : S [ ⇑ ] ) . ( T [ q ( ⇑ ) ] ) \Gamma,x:S \vdash t[\Uparrow] : \Pi(x:S[\Uparrow]).(T[q(\Uparrow)]) Γ , x : S ⊢ t [ ⇑ ] : Π ( x : S [ ⇑ ]) . ( T [ q ( ⇑ )]) (by Theorem 4.1)
x 0 : S [ ⇑ ] ∈ Γ , x 0 : S x_0:S[\Uparrow] \in\Gamma,x_0:S x 0 : S [ ⇑ ] ∈ Γ , x 0 : S (by lookup)
Γ , x : S ⊢ x : S [ ⇑ ] \Gamma,x:S \vdash x : S[\Uparrow] Γ , x : S ⊢ x : S [ ⇑ ] (by Var)
Γ , x : S ⊢ t [ ⇑ ] x : T [ q ( ⇑ ) ] [ x / x ] \Gamma,x:S \vdash t[\Uparrow]\ x : T[q(\Uparrow)][x/x] Γ , x : S ⊢ t [ ⇑ ] x : T [ q ( ⇑ )] [ x / x ] (by λ \lambda λ -E)
T [ q ( ⇑ ) ] [ x / x ] = T [ q ( ⇑ ) ] [ i d , x / x ] = T [ ⇑ , x / x ] T[q(\Uparrow)][x/x] = T[q(\Uparrow)][\mathrm{id},x/x] = T[\Uparrow,x/x] T [ q ( ⇑ )] [ x / x ] = T [ q ( ⇑ )] [ id , x / x ] = T [ ⇑ , x / x ] (by Theorem 2.27)
( ⇑ , x / x ) = i d (\Uparrow,x/x)=\mathrm{id} ( ⇑ , x / x ) = id (by Theorem 2.31 at σ = i d \sigma=\mathrm{id} σ = id )
T [ ⇑ , x / x ] = T [ i d ] = T T[\Uparrow,x/x]=T[\mathrm{id}]=T T [ ⇑ , x / x ] = T [ id ] = T (by Theorem 2.17)
Γ , x : S ⊢ t [ ⇑ ] x : T \Gamma,x:S \vdash t[\Uparrow]\ x : T Γ , x : S ⊢ t [ ⇑ ] x : T
Γ ⊢ λ x . ( t [ ⇑ ] x ) : Π ( x : S ) . T \Gamma\vdash\lambda x.(t[\Uparrow]\ x) : \Pi(x:S).T Γ ⊢ λ x . ( t [ ⇑ ] x ) : Π ( x : S ) . T (by λ \lambda λ -I)
Γ ⊢ Π ( x : S ) . T : T y i \Gamma\vdash\Pi(x:S).T : \mathrm{Ty}_i Γ ⊢ Π ( x : S ) . T : Ty i (by Π \Pi Π -Wf on first two premises)
Case
Γ ⊢ T : T y i Γ ⊢ t ≈ t ′ : S Γ ⊢ S ⊆ T Γ ⊢ t ≈ t ′ : T T m - S u b s u m p \frac{\Gamma\vdash T : \mathrm{Ty}_i \qquad\Gamma\vdash t \approx t' : S \qquad\Gamma\vdash S \subseteq T}
{\Gamma\vdash t \approx t' : T}
\quad\mathrm{Tm\text{-}Subsump} Γ ⊢ t ≈ t ′ : T Γ ⊢ T : Ty i Γ ⊢ t ≈ t ′ : S Γ ⊢ S ⊆ T Tm - Subsump
⊢ Γ \vdash\Gamma ⊢ Γ (by IH on first premise)
Γ ⊢ t : S \Gamma\vdash t:S Γ ⊢ t : S and Γ ⊢ t ′ : S \Gamma\vdash t':S Γ ⊢ t ′ : S (by IH on second premise)
Γ ⊢ t : T \Gamma\vdash t:T Γ ⊢ t : T and Γ ⊢ t ′ : T \Gamma\vdash t':T Γ ⊢ t ′ : T (by Subsump with third premise)
Γ ⊢ T : T y i \Gamma\vdash T:\mathrm{Ty}_i Γ ⊢ T : Ty i (directly from first premise)
Case
Γ ⊢ S ′ : T y i Γ ⊢ S ≈ S ′ : T y i Γ , x : S ⊢ T : T y i Γ , x : S ′ ⊢ T ′ : T y i Γ , x : S ⊢ T ⊆ T ′ Γ ⊢ Π ( x : S ) . T ⊆ Π ( x : S ′ ) . T ′ S u b - Π \frac{\Gamma\vdash S' : \mathrm{Ty}_i \qquad\Gamma\vdash S \approx S' : \mathrm{Ty}_i \qquad\Gamma,x:S \vdash T : \mathrm{Ty}_i \qquad\Gamma,x:S' \vdash T' : \mathrm{Ty}_i \qquad\Gamma,x:S \vdash T \subseteq T'}
{\Gamma\vdash\Pi(x:S).T \subseteq\Pi(x:S').T'}
\quad\mathrm{Sub\text{-}\Pi} Γ ⊢ Π ( x : S ) . T ⊆ Π ( x : S ′ ) . T ′ Γ ⊢ S ′ : Ty i Γ ⊢ S ≈ S ′ : Ty i Γ , x : S ⊢ T : Ty i Γ , x : S ′ ⊢ T ′ : Ty i Γ , x : S ⊢ T ⊆ T ′ Sub - Π
⊢ Γ \vdash\Gamma ⊢ Γ (by IH on first premise)
Γ ⊢ Π ( x : S ) . T : T y i \Gamma\vdash\Pi(x:S).T : \mathrm{Ty}_i Γ ⊢ Π ( x : S ) . T : Ty i (by Π \Pi Π -Wf on premises 1 and 4)
Γ ⊢ Π ( x : S ′ ) . T ′ : T y i \Gamma\vdash\Pi(x : S').T' : \mathrm{Ty}_i Γ ⊢ Π ( x : S ′ ) . T ′ : Ty i
(by Π \Pi Π -Wf on premises 2 and 5, using Subsump)
Case
⊢ Γ i ≤ j Γ ⊢ T y i ⊆ T y j \frac{\vdash\Gamma\qquad i \le j}{\Gamma\vdash\mathrm{Ty}_i \subseteq\mathrm{Ty}_j} Γ ⊢ Ty i ⊆ Ty j ⊢ Γ i ≤ j
Sub-Univ
⊢ Γ \vdash\Gamma ⊢ Γ (directly from premise)
Γ ⊢ T y i : T y 1 + i \Gamma\vdash\mathrm{Ty}_i : \mathrm{Ty}_{1+i} Γ ⊢ Ty i : Ty 1 + i (by U-Wf)
Γ ⊢ T y j : T y 1 + j \Gamma\vdash\mathrm{Ty}_j : \mathrm{Ty}_{1+j} Γ ⊢ Ty j : Ty 1 + j (by U-Wf)
Γ ⊢ T y i : T y 1 + j \Gamma\vdash\mathrm{Ty}_i : \mathrm{Ty}_{1+j} Γ ⊢ Ty i : Ty 1 + j and Γ ⊢ T y j : T y 1 + j \Gamma\vdash\mathrm{Ty}_j : \mathrm{Ty}_{1+j} Γ ⊢ Ty j : Ty 1 + j (by Subsump with Sub-Univ, since 1 + i ≤ 1 + j 1+i \le1+j 1 + i ≤ 1 + j )
The remaining cases follow similar patterns. □ \square □
Substitution Equivalence
We define a pointwise notion of substitution equivalence and show that equivalent substitutions preserve syntactic judgments equivalently.
Definition 4.11 (Substitution Equivalence). Γ ⊢ σ ≈ σ ′ : Δ \Gamma\vdash\sigma\approx\sigma' : \Delta Γ ⊢ σ ≈ σ ′ : Δ holds when:
(1) Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ and Γ ⊢ σ ′ : Δ \Gamma\vdash\sigma' : \Delta Γ ⊢ σ ′ : Δ , and
(2) for every x : T ∈ Δ x : T \in\Delta x : T ∈ Δ , Γ ⊢ σ ( x ) ≈ σ ′ ( x ) : T [ σ ] \Gamma\vdash\sigma(x) \approx\sigma'(x) : T[\sigma] Γ ⊢ σ ( x ) ≈ σ ′ ( x ) : T [ σ ] .
Note: by clause (2) and Theorem 4.7 statement (2) applied to the reflexive closure, Γ ⊢ T [ σ ] ≈ T [ σ ′ ] : T y i \Gamma\vdash T[\sigma] \approx T[\sigma'] : \mathrm{Ty}_i Γ ⊢ T [ σ ] ≈ T [ σ ′ ] : Ty i whenever Δ ⊢ T : T y i \Delta\vdash T : \mathrm{Ty}_i Δ ⊢ T : Ty i , so the type at which the σ ( x ) , σ ′ ( x ) \sigma(x), \sigma'(x) σ ( x ) , σ ′ ( x ) are equated is well-defined modulo equivalence.
We first establish that the q q q -extension preserves equivalence.
Lemma 4.12 (q Preserves Substitution Equivalence). If Γ ⊢ σ ≈ σ ′ : Δ \Gamma\vdash\sigma\approx\sigma' : \Delta Γ ⊢ σ ≈ σ ′ : Δ and Δ ⊢ S : T y i \Delta\vdash S : \mathrm{Ty}_i Δ ⊢ S : Ty i , then Γ , x : S [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : ( Δ , x : S ) \Gamma, x : S[\sigma] \vdash q(\sigma) \approx q(\sigma') : (\Delta, x : S) Γ , x : S [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : ( Δ , x : S ) .
Proof. By Theorem 4.6, Γ , x : S [ σ ] ⊢ q ( σ ) : ( Δ , x : S ) \Gamma, x : S[\sigma] \vdash q(\sigma) : (\Delta, x : S) Γ , x : S [ σ ] ⊢ q ( σ ) : ( Δ , x : S ) . We need Γ , x : S [ σ ] ⊢ q ( σ ′ ) : ( Δ , x : S ) \Gamma, x : S[\sigma] \vdash q(\sigma') : (\Delta, x : S) Γ , x : S [ σ ] ⊢ q ( σ ′ ) : ( Δ , x : S ) as well: from Γ ⊢ S [ σ ] ≈ S [ σ ′ ] : T y i \Gamma\vdash S[\sigma] \approx S[\sigma'] : \mathrm{Ty}_i Γ ⊢ S [ σ ] ≈ S [ σ ′ ] : Ty i (by Theorem 4.7 statement (2) applied to reflexivity on Δ ⊢ S : T y i \Delta\vdash S : \mathrm{Ty}_i Δ ⊢ S : Ty i ), the contexts Γ , x : S [ σ ] \Gamma, x : S[\sigma] Γ , x : S [ σ ] and Γ , x : S [ σ ′ ] \Gamma, x : S[\sigma'] Γ , x : S [ σ ′ ] are equivalent, so Γ , x : S [ σ ] ⊢ q ( σ ′ ) : ( Δ , x : S ) \Gamma, x : S[\sigma] \vdash q(\sigma') : (\Delta, x : S) Γ , x : S [ σ ] ⊢ q ( σ ′ ) : ( Δ , x : S ) by Theorem 4.6 and a context-conversion step.
We verify clause (2): for every y : T ∈ Δ , x : S y : T \in\Delta, x : S y : T ∈ Δ , x : S , Γ , x : S [ σ ] ⊢ q ( σ ) ( y ) ≈ q ( σ ′ ) ( y ) : T [ q ( σ ) ] \Gamma, x : S[\sigma] \vdash q(\sigma)(y) \approx q(\sigma')(y) : T[q(\sigma)] Γ , x : S [ σ ] ⊢ q ( σ ) ( y ) ≈ q ( σ ′ ) ( y ) : T [ q ( σ )] .
y = x 0 y = x_0 y = x 0 : T = S [ ⇑ ] T = S[\Uparrow] T = S [ ⇑ ] , q ( σ ) ( x 0 ) = x 0 = q ( σ ′ ) ( x 0 ) q(\sigma)(x_0) = x_0 = q(\sigma')(x_0) q ( σ ) ( x 0 ) = x 0 = q ( σ ′ ) ( x 0 ) . The required equality is reflexivity on x 0 x_0 x 0 at S [ ⇑ ] [ q ( σ ) ] = S [ σ ] [ ⇑ ] S[\Uparrow][q(\sigma)] = S[\sigma][\Uparrow] S [ ⇑ ] [ q ( σ )] = S [ σ ] [ ⇑ ] (by Theorem 2.20).
y = 1 + z y = 1+z y = 1 + z where z : T ′ ∈ Δ z : T' \in\Delta z : T ′ ∈ Δ : q ( σ ) ( 1 + z ) = σ ( z ) [ ⇑ ] q(\sigma)(1+z) = \sigma(z)[\Uparrow] q ( σ ) ( 1 + z ) = σ ( z ) [ ⇑ ] and q ( σ ′ ) ( 1 + z ) = σ ′ ( z ) [ ⇑ ] q(\sigma')(1+z) = \sigma'(z)[\Uparrow] q ( σ ′ ) ( 1 + z ) = σ ′ ( z ) [ ⇑ ] . By clause (2) of Theorem 4.11 on σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ , Γ ⊢ σ ( z ) ≈ σ ′ ( z ) : T ′ [ σ ] \Gamma\vdash\sigma(z) \approx\sigma'(z) : T'[\sigma] Γ ⊢ σ ( z ) ≈ σ ′ ( z ) : T ′ [ σ ] . By Theorem 4.1 applied to ⇑ \Uparrow ⇑ , Γ , x : S [ σ ] ⊢ σ ( z ) [ ⇑ ] ≈ σ ′ ( z ) [ ⇑ ] : T ′ [ σ ] [ ⇑ ] \Gamma, x : S[\sigma] \vdash\sigma(z)[\Uparrow] \approx\sigma'(z)[\Uparrow] : T'[\sigma][\Uparrow] Γ , x : S [ σ ] ⊢ σ ( z ) [ ⇑ ] ≈ σ ′ ( z ) [ ⇑ ] : T ′ [ σ ] [ ⇑ ] , and T ′ [ σ ] [ ⇑ ] = T ′ [ ⇑ ] [ q ( σ ) ] T'[\sigma][\Uparrow] = T'[\Uparrow][q(\sigma)] T ′ [ σ ] [ ⇑ ] = T ′ [ ⇑ ] [ q ( σ )] by Theorem 2.20, which equals T [ q ( σ ) ] T[q(\sigma)] T [ q ( σ )] .
□ \square □
Lemma 4.13 (Equivalent Substitutions Preserve Judgments). The following are proved by mutual induction on the syntactic judgments:
(1) If Δ ⊢ t : T \Delta\vdash t : T Δ ⊢ t : T and Γ ⊢ σ ≈ σ ′ : Δ \Gamma\vdash\sigma\approx\sigma' : \Delta Γ ⊢ σ ≈ σ ′ : Δ , then Γ ⊢ t [ σ ] ≈ t [ σ ′ ] : T [ σ ] \Gamma\vdash t[\sigma] \approx t[\sigma'] : T[\sigma] Γ ⊢ t [ σ ] ≈ t [ σ ′ ] : T [ σ ] .
(2) If Δ ⊢ t ≈ t ′ : T \Delta\vdash t \approx t' : T Δ ⊢ t ≈ t ′ : T and Γ ⊢ σ ≈ σ ′ : Δ \Gamma\vdash\sigma\approx\sigma' : \Delta Γ ⊢ σ ≈ σ ′ : Δ , then Γ ⊢ t [ σ ] ≈ t ′ [ σ ′ ] : T [ σ ] \Gamma\vdash t[\sigma] \approx t'[\sigma'] : T[\sigma] Γ ⊢ t [ σ ] ≈ t ′ [ σ ′ ] : T [ σ ] .
(3) If Δ ⊢ S ⊆ T \Delta\vdash S \subseteq T Δ ⊢ S ⊆ T and Γ ⊢ σ ≈ σ ′ : Δ \Gamma\vdash\sigma\approx\sigma' : \Delta Γ ⊢ σ ≈ σ ′ : Δ , then Γ ⊢ S [ σ ] ⊆ T [ σ ′ ] \Gamma\vdash S[\sigma] \subseteq T[\sigma'] Γ ⊢ S [ σ ] ⊆ T [ σ ′ ] .
Proof. By mutual induction on the syntactic derivation, parallel to Theorem 4.7. We show representative cases for statement (1).
Case
⊢ Δ x : T ∈ Δ Δ ⊢ x : T \frac{\vdash\Delta\qquad x : T \in\Delta}{\Delta\vdash x : T} Δ ⊢ x : T ⊢ Δ x : T ∈ Δ
Then x [ σ ] = σ ( x ) x[\sigma] = \sigma(x) x [ σ ] = σ ( x ) and x [ σ ′ ] = σ ′ ( x ) x[\sigma'] = \sigma'(x) x [ σ ′ ] = σ ′ ( x ) .
Γ ⊢ σ ( x ) ≈ σ ′ ( x ) : T [ σ ] \Gamma\vdash\sigma(x) \approx\sigma'(x) : T[\sigma] Γ ⊢ σ ( x ) ≈ σ ′ ( x ) : T [ σ ]
(by clause (2) of Theorem 4.11)
Case
Δ ⊢ S : T y i Δ , x : S ⊢ t : T Δ ⊢ λ x . t : Π ( x : S ) . T \frac{\Delta\vdash S : \mathrm{Ty}_i \qquad\Delta,x:S \vdash t:T}{\Delta\vdash\lambda x.t : \Pi(x:S).T} Δ ⊢ λ x . t : Π ( x : S ) . T Δ ⊢ S : Ty i Δ , x : S ⊢ t : T
We must show Γ ⊢ ( λ x . t ) [ σ ] ≈ ( λ x . t ) [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] \Gamma\vdash(\lambda x.t)[\sigma] \approx(\lambda x.t)[\sigma'] : (\Pi(x:S).T)[\sigma] Γ ⊢ ( λ x . t ) [ σ ] ≈ ( λ x . t ) [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] . We first lift the equivalence under q q q :
Γ , x : S [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : ( Δ , x : S ) \Gamma,x:S[\sigma] \vdash q(\sigma) \approx q(\sigma') : (\Delta,x:S) Γ , x : S [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : ( Δ , x : S )
(by Theorem 4.12)
Γ , x : S [ σ ] ⊢ t [ q ( σ ) ] ≈ t [ q ( σ ′ ) ] : T [ q ( σ ) ] \Gamma,x:S[\sigma] \vdash t[q(\sigma)] \approx t[q(\sigma')] : T[q(\sigma)] Γ , x : S [ σ ] ⊢ t [ q ( σ )] ≈ t [ q ( σ ′ )] : T [ q ( σ )]
(by IH on the second premise)
Γ ⊢ S [ σ ] ≈ S [ σ ′ ] : T y i \Gamma\vdash S[\sigma] \approx S[\sigma'] : \mathrm{Ty}_i Γ ⊢ S [ σ ] ≈ S [ σ ′ ] : Ty i
(by IH on the first premise)
Γ ⊢ λ x . ( t [ q ( σ ) ] ) ≈ λ x . ( t [ q ( σ ′ ) ] ) : Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) \Gamma\vdash\lambda x.(t[q(\sigma)]) \approx\lambda x.(t[q(\sigma')]) : \Pi(x:S[\sigma]).(T[q(\sigma)]) Γ ⊢ λ x . ( t [ q ( σ )]) ≈ λ x . ( t [ q ( σ ′ )]) : Π ( x : S [ σ ]) . ( T [ q ( σ )])
(by λ \lambda λ -Cong)
( λ x . t ) [ σ ] = λ x . ( t [ q ( σ ) ] ) , ( λ x . t ) [ σ ′ ] = λ x . ( t [ q ( σ ′ ) ] ) (\lambda x.t)[\sigma] = \lambda x.(t[q(\sigma)]), \qquad(\lambda x.t)[\sigma'] = \lambda x.(t[q(\sigma')]) ( λ x . t ) [ σ ] = λ x . ( t [ q ( σ )]) , ( λ x . t ) [ σ ′ ] = λ x . ( t [ q ( σ ′ )])
(syntactic substitution)
( Π ( x : S ) . T ) [ σ ] = Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) (\Pi(x:S).T)[\sigma] = \Pi(x:S[\sigma]).(T[q(\sigma)]) ( Π ( x : S ) . T ) [ σ ] = Π ( x : S [ σ ]) . ( T [ q ( σ )])
(syntactic substitution)
Case
Δ ⊢ S : T y i Δ , x : S ⊢ T : T y i Δ ⊢ r : Π ( x : S ) . T Δ ⊢ s : S Δ ⊢ r s : T [ s / x ] \frac{\Delta\vdash S : \mathrm{Ty}_i \qquad\Delta,x:S \vdash T : \mathrm{Ty}_i \qquad\Delta\vdash r : \Pi(x:S).T \qquad\Delta\vdash s:S}{\Delta\vdash r\ s : T[s/x]} Δ ⊢ r s : T [ s / x ] Δ ⊢ S : Ty i Δ , x : S ⊢ T : Ty i Δ ⊢ r : Π ( x : S ) . T Δ ⊢ s : S
We must show Γ ⊢ ( r s ) [ σ ] ≈ ( r s ) [ σ ′ ] : T [ s / x ] [ σ ] \Gamma\vdash(r\ s)[\sigma] \approx(r\ s)[\sigma'] : T[s/x][\sigma] Γ ⊢ ( r s ) [ σ ] ≈ ( r s ) [ σ ′ ] : T [ s / x ] [ σ ] .
Γ ⊢ r [ σ ] ≈ r [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] \Gamma\vdash r[\sigma] \approx r[\sigma'] : (\Pi(x:S).T)[\sigma] Γ ⊢ r [ σ ] ≈ r [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ]
(by IH on the third premise)
Γ ⊢ s [ σ ] ≈ s [ σ ′ ] : S [ σ ] \Gamma\vdash s[\sigma] \approx s[\sigma'] : S[\sigma] Γ ⊢ s [ σ ] ≈ s [ σ ′ ] : S [ σ ]
(by IH on the fourth premise)
Γ ⊢ r [ σ ] s [ σ ] ≈ r [ σ ′ ] s [ σ ′ ] : T [ q ( σ ) ] [ s [ σ ] / x ] \Gamma\vdash r[\sigma]\ s[\sigma] \approx r[\sigma']\ s[\sigma'] : T[q(\sigma)][s[\sigma]/x] Γ ⊢ r [ σ ] s [ σ ] ≈ r [ σ ′ ] s [ σ ′ ] : T [ q ( σ )] [ s [ σ ] / x ]
(by App-Cong)
( r s ) [ σ ] = r [ σ ] s [ σ ] , ( r s ) [ σ ′ ] = r [ σ ′ ] s [ σ ′ ] (r\ s)[\sigma] = r[\sigma]\ s[\sigma], \qquad(r\ s)[\sigma'] = r[\sigma']\ s[\sigma'] ( r s ) [ σ ] = r [ σ ] s [ σ ] , ( r s ) [ σ ′ ] = r [ σ ′ ] s [ σ ′ ]
(syntactic substitution on application)
T [ q ( σ ) ] [ s [ σ ] / x ] = T [ s / x ] [ σ ] T[q(\sigma)][s[\sigma]/x] = T[s/x][\sigma] T [ q ( σ )] [ s [ σ ] / x ] = T [ s / x ] [ σ ]
(by Theorem 2.30)
Case
U-Wf ⊢ Δ Δ ⊢ T y i : T y 1 + i \frac{\text{U-Wf}}{\vdash\Delta\qquad\Delta\vdash\mathrm{Ty}_i : \mathrm{Ty}_{1+i}} ⊢ Δ Δ ⊢ Ty i : Ty 1 + i U-Wf
T y i [ σ ] = T y i \mathrm{Ty}_i[\sigma] = \mathrm{Ty}_i Ty i [ σ ] = Ty i and T y i [ σ ′ ] = T y i \mathrm{Ty}_i[\sigma'] = \mathrm{Ty}_i Ty i [ σ ′ ] = Ty i .
(from Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ inside Theorem 4.11)
Γ ⊢ T y i ≈ T y i : T y 1 + i \Gamma\vdash\mathrm{Ty}_i \approx\mathrm{Ty}_i : \mathrm{Ty}_{1+i} Γ ⊢ Ty i ≈ Ty i : Ty 1 + i
(by U-Cong)
Case N-Wf: Analogous to U-Wf, with N a t [ σ ] = N a t = N a t [ σ ′ ] \mathrm{Nat}[\sigma] = \mathrm{Nat} = \mathrm{Nat}[\sigma'] Nat [ σ ] = Nat = Nat [ σ ′ ] and reflexivity by N-Cong. Case
Π -Wf Δ ⊢ S : T y i Δ , x : S ⊢ T : T y i Δ ⊢ Π ( x : S ) . T : T y i \begin{gathered}
\Pi\text{-Wf}\\
\Delta\vdash S : \mathrm{Ty}_i \qquad\Delta, x : S \vdash T : \mathrm{Ty}_i\\
\hline
\Delta\vdash\Pi(x : S).T : \mathrm{Ty}_i
\end{gathered} Π -Wf Δ ⊢ S : Ty i Δ , x : S ⊢ T : Ty i Δ ⊢ Π ( x : S ) . T : Ty i
\begin{aligned}
\Gamma&\vdash S[\sigma] \approx S[\sigma'] : \mathrm{Ty}_i && \text{(by IH on first premise)}\\
\Gamma, x : S[\sigma] &\vdash q(\sigma) \approx q(\sigma') : (\Delta, x : S) && \text{(by lifting, as in the \lambda-I case)}\\
\Gamma, x : S[\sigma] &\vdash T[q(\sigma)] \approx T[q(\sigma')] : \mathrm{Ty}_i && \text{(by IH on second premise)}\\
\Gamma&\vdash\Pi(x : S[\sigma]).(T[q(\sigma)]) \approx\Pi(x : S[\sigma']).(T[q(\sigma')]) : \mathrm{Ty}_i && \text{(by \Pi-Cong)}\\
(\Pi(x : S).T)[\sigma] &= \Pi(x : S[\sigma]).(T[q(\sigma)]) && \text{(syntactic substitution on \Pi)}
\end{aligned}
Case Ze-I: zero [ σ ] = zero = zero [ σ ′ ] \operatorname{zero}[\sigma] = \operatorname{zero} = \operatorname{zero}[\sigma'] zero [ σ ] = zero = zero [ σ ′ ] ; apply Ze-Cong. The type Nat [ σ ] = Nat \operatorname{Nat}[\sigma] = \operatorname{Nat} Nat [ σ ] = Nat .
Case
S u -I Δ ⊢ t : Nat Δ ⊢ succ t : Nat \begin{gathered}
\mathrm{Su}\text{-I}\\
\Delta\vdash t : \operatorname{Nat}\\
\hline
\Delta\vdash\operatorname{succ}\ t : \operatorname{Nat}
\end{gathered} Su -I Δ ⊢ t : Nat Δ ⊢ succ t : Nat
\begin{aligned}
\Gamma&\vdash t[\sigma] \approx t[\sigma'] : \operatorname{Nat} && \text{(by IH on premise; using \operatorname{Nat}[\sigma] = \operatorname{Nat})}\\
\Gamma&\vdash\operatorname{succ}\ t[\sigma] \approx\operatorname{succ}\ t[\sigma'] : \operatorname{Nat} && \text{(by Su-Cong)}\\
(\operatorname{succ}\ t)[\sigma] &= \operatorname{succ}\ t[\sigma],\quad(\operatorname{succ}\ t)[\sigma'] = \operatorname{succ}\ t[\sigma'] && \text{(syntactic substitution on \operatorname{succ})}
\end{aligned}
Case N-E: analogous to λ \lambda λ -E, applying the IH to each premise (motive, zero branch, step branch, scrutinee), lifting via q ( σ ) ≈ q ( σ ′ ) q(\sigma) \approx q(\sigma') q ( σ ) ≈ q ( σ ′ ) and q 2 ( σ ) ≈ q 2 ( σ ′ ) q^2(\sigma) \approx q^2(\sigma') q 2 ( σ ) ≈ q 2 ( σ ′ ) , and concluding by N-E-Cong.
Case
S u b s u m p Δ ⊢ T : T y i Δ ⊢ t : S Δ ⊢ S ⊆ T Δ ⊢ t : T \begin{gathered}
\mathrm{Subsump}\\
\Delta\vdash T : \mathrm{Ty}_i \qquad\Delta\vdash t : S \qquad\Delta\vdash S \subseteq T\\
\hline
\Delta\vdash t : T
\end{gathered} Subsump Δ ⊢ T : Ty i Δ ⊢ t : S Δ ⊢ S ⊆ T Δ ⊢ t : T
\begin{aligned}
\Gamma&\vdash t[\sigma] \approx t[\sigma'] : S[\sigma] && \text{(by IH on second premise)}\\
\Gamma&\vdash S[\sigma] \subseteq T[\sigma] && \text{(by IH on third premise via statement (3),}\\
&&&\text{instantiated at \sigma\approx\sigma, reflexive)}\\
\Gamma&\vdash T[\sigma] : \mathrm{Ty}_i && \text{(by Theorem 4.7 on first premise)}\\
\Gamma&\vdash t[\sigma] \approx t[\sigma'] : T[\sigma] && \text{(by Tm-Subsump)}
\end{aligned}
Statement (2): term-equality preservation. By induction on the term-equality derivation.
Case (Congruence rules: Var-Cong, U-Cong, N-Cong, Π \Pi Π -Cong, Ze-Cong, Su-Cong, λ \lambda λ -Cong, App-Cong, N-E-Cong). Each follows by IH on the premises and the same congruence rule, with substitution-on-syntax computed exactly as in statement (1).
Case
Π - β Δ ⊢ S : T y i Δ , x : S ⊢ T : T y i Δ , x : S ⊢ t : T Δ ⊢ s : S Δ ⊢ ( λ x . t ) s ≈ t [ s / x ] : T [ s / x ] \begin{gathered}
\Pi\text{-}\beta\\
\Delta\vdash S : \mathrm{Ty}_i \qquad\Delta, x : S \vdash T : \mathrm{Ty}_i \qquad\Delta, x : S \vdash t : T \qquad\Delta\vdash s : S\\
\hline
\Delta\vdash(\lambda x.t)\ s \approx t[s/x] : T[s/x]
\end{gathered} Π - β Δ ⊢ S : Ty i Δ , x : S ⊢ T : Ty i Δ , x : S ⊢ t : T Δ ⊢ s : S Δ ⊢ ( λ x . t ) s ≈ t [ s / x ] : T [ s / x ]
We must show Γ ⊢ ( ( λ x . t ) s ) [ σ ] ≈ t [ s / x ] [ σ ′ ] : T [ s / x ] [ σ ] \Gamma\vdash((\lambda x.t)\ s)[\sigma] \approx t[s/x][\sigma'] : T[s/x][\sigma] Γ ⊢ (( λ x . t ) s ) [ σ ] ≈ t [ s / x ] [ σ ′ ] : T [ s / x ] [ σ ] .
By Theorem 4.12 on σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ at S S S : Γ , x : S [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : ( Δ , x : S ) \Gamma, x : S[\sigma] \vdash q(\sigma) \approx q(\sigma') : (\Delta, x : S) Γ , x : S [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : ( Δ , x : S ) . Apply IH statement (1) to the third premise Δ , x : S ⊢ t : T \Delta, x : S \vdash t : T Δ , x : S ⊢ t : T and to the fourth premise Δ ⊢ s : S \Delta\vdash s : S Δ ⊢ s : S :
Γ , x : S [ σ ] ⊢ t [ q ( σ ) ] ≈ t [ q ( σ ′ ) ] : T [ q ( σ ) ] \Gamma, x : S[\sigma] \vdash t[q(\sigma)] \approx t[q(\sigma')] : T[q(\sigma)] Γ , x : S [ σ ] ⊢ t [ q ( σ )] ≈ t [ q ( σ ′ )] : T [ q ( σ )] (by IH on third premise)
Γ ⊢ s [ σ ] ≈ s [ σ ′ ] : S [ σ ] \Gamma\vdash s[\sigma] \approx s[\sigma'] : S[\sigma] Γ ⊢ s [ σ ] ≈ s [ σ ′ ] : S [ σ ] (by IH on fourth premise)
Build the head-extended substitution equivalence:
Γ ⊢ ( σ , s [ σ ] / x ) ≈ ( σ ′ , s [ σ ′ ] / x ) : ( Δ , x : S ) \Gamma\vdash(\sigma, s[\sigma]/x) \approx(\sigma', s[\sigma']/x) : (\Delta, x : S) Γ ⊢ ( σ , s [ σ ] / x ) ≈ ( σ ′ , s [ σ ′ ] / x ) : ( Δ , x : S ) (at every y ∈ Δ y \in\Delta y ∈ Δ , both yield σ ( y ) , σ ′ ( y ) \sigma(y), \sigma'(y) σ ( y ) , σ ′ ( y ) , equated by Theorem 4.11 clause (2) on σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ ; at x x x , the heads s [ σ ] , s [ σ ′ ] s[\sigma],s[\sigma'] s [ σ ] , s [ σ ′ ] are equated above)
Apply IH statement (1) on the third premise Δ , x : S ⊢ t : T \Delta, x : S \vdash t : T Δ , x : S ⊢ t : T at this equivalence:
Γ ⊢ t [ ( σ , s [ σ ] / x ) ] ≈ t [ ( σ ′ , s [ σ ′ ] / x ) ] : T [ ( σ , s [ σ ] / x ) ] \Gamma\vdash t[(\sigma,s[\sigma]/x)] \approx t[(\sigma',s[\sigma']/x)] : T[(\sigma,s[\sigma]/x)] Γ ⊢ t [( σ , s [ σ ] / x )] ≈ t [( σ ′ , s [ σ ′ ] / x )] : T [( σ , s [ σ ] / x )] (by IH on third premise at the head-extended equivalence)
t [ s / x ] [ σ ] = t [ ( σ , s [ σ ] / x ) ] t[s/x][\sigma] = t[(\sigma,s[\sigma]/x)] t [ s / x ] [ σ ] = t [( σ , s [ σ ] / x )] (by Theorem 2.30)
t [ s / x ] [ σ ′ ] = t [ ( σ ′ , s [ σ ′ ] / x ) ] t[s/x][\sigma'] = t[(\sigma',s[\sigma']/x)] t [ s / x ] [ σ ′ ] = t [( σ ′ , s [ σ ′ ] / x )] (by Theorem 2.30)
T [ s / x ] [ σ ] = T [ ( σ , s [ σ ] / x ) ] T[s/x][\sigma] = T[(\sigma,s[\sigma]/x)] T [ s / x ] [ σ ] = T [( σ , s [ σ ] / x )] (by Theorem 2.30)
Γ ⊢ t [ s / x ] [ σ ] ≈ t [ s / x ] [ σ ′ ] : T [ s / x ] [ σ ] \Gamma\vdash t[s/x][\sigma] \approx t[s/x][\sigma'] : T[s/x][\sigma] Γ ⊢ t [ s / x ] [ σ ] ≈ t [ s / x ] [ σ ′ ] : T [ s / x ] [ σ ] (rewriting the previous equality line)
Γ ⊢ ( ( λ x . t ) s ) [ σ ] ≈ t [ s / x ] [ σ ] : T [ s / x ] [ σ ] \Gamma\vdash((\lambda x.t)\ s)[\sigma] \approx t[s/x][\sigma] : T[s/x][\sigma] Γ ⊢ (( λ x . t ) s ) [ σ ] ≈ t [ s / x ] [ σ ] : T [ s / x ] [ σ ] (by Theorem 4.7 statement (2) on the original β \beta β , at σ \sigma σ )
Γ ⊢ ( ( λ x . t ) s ) [ σ ] ≈ t [ s / x ] [ σ ′ ] : T [ s / x ] [ σ ] \Gamma\vdash((\lambda x.t)\ s)[\sigma] \approx t[s/x][\sigma'] : T[s/x][\sigma] Γ ⊢ (( λ x . t ) s ) [ σ ] ≈ t [ s / x ] [ σ ′ ] : T [ s / x ] [ σ ] (by Tm-Trans)
Case
Δ ⊢ S : T y i Δ , x : S ⊢ T : T y i Δ ⊢ t : Π ( x : S ) . T Δ ⊢ t ≈ λ x . ( t [ ⇑ ] x ) : Π ( x : S ) . T \frac{\Delta\vdash S : \mathsf{Ty}_i \qquad\Delta,x:S \vdash T : \mathsf{Ty}_i \qquad\Delta\vdash t : \Pi(x:S).T}{\Delta\vdash t \approx\lambda x.(t[\Uparrow]x) : \Pi(x:S).T} Δ ⊢ t ≈ λ x . ( t [ ⇑ ] x ) : Π ( x : S ) . T Δ ⊢ S : Ty i Δ , x : S ⊢ T : Ty i Δ ⊢ t : Π ( x : S ) . T
We must show Γ ⊢ t [ σ ] ≈ ( λ x . ( t [ ⇑ ] x ) ) [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] \Gamma\vdash t[\sigma] \approx(\lambda x.(t[\Uparrow]x))[\sigma'] : (\Pi(x:S).T)[\sigma] Γ ⊢ t [ σ ] ≈ ( λ x . ( t [ ⇑ ] x )) [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] .
By IH statement (1) on the third premise:
Γ ⊢ t [ σ ] ≈ t [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] \Gamma\vdash t[\sigma] \approx t[\sigma'] : (\Pi(x:S).T)[\sigma] Γ ⊢ t [ σ ] ≈ t [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] (by IH on Δ ⊢ t : Π ( x : S ) . T \Delta\vdash t : \Pi(x:S).T Δ ⊢ t : Π ( x : S ) . T )
Apply Theorem 4.7 statement (2) on the original η \eta η -rule at σ ′ \sigma' σ ′ (a well-typed substitution since Γ ⊢ σ ′ : Δ \Gamma\vdash\sigma' : \Delta Γ ⊢ σ ′ : Δ by Theorem 4.11 clause (1)):
Γ ⊢ t [ σ ′ ] ≈ ( λ x . ( t [ ⇑ ] x ) ) [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ′ ] \Gamma\vdash t[\sigma'] \approx(\lambda x.(t[\Uparrow]x))[\sigma'] : (\Pi(x:S).T)[\sigma'] Γ ⊢ t [ σ ′ ] ≈ ( λ x . ( t [ ⇑ ] x )) [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ′ ] (by Theorem 4.7 statement (2) on η \eta η at σ ′ \sigma' σ ′ )
Bridge the type from σ ′ \sigma' σ ′ to σ \sigma σ via the Π \Pi Π -Wf case of statement (1), already proved on Δ ⊢ Π ( x : S ) . T : T y i \Delta\vdash\Pi(x:S).T : \mathsf{Ty}_i Δ ⊢ Π ( x : S ) . T : Ty i (derivable from the first two η \eta η -premises by Π \Pi Π -Wf):
Γ ⊢ ( Π ( x : S ) . T ) [ σ ] ≈ ( Π ( x : S ) . T ) [ σ ′ ] : T y i \Gamma\vdash(\Pi(x:S).T)[\sigma] \approx(\Pi(x:S).T)[\sigma'] : \mathsf{Ty}_i Γ ⊢ ( Π ( x : S ) . T ) [ σ ] ≈ ( Π ( x : S ) . T ) [ σ ′ ] : Ty i (by the Π \Pi Π -Wf case of statement (1))
Γ ⊢ t [ σ ′ ] ≈ ( λ x . ( t [ ⇑ ] x ) ) [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] \Gamma\vdash t[\sigma'] \approx(\lambda x.(t[\Uparrow]x))[\sigma'] : (\Pi(x:S).T)[\sigma] Γ ⊢ t [ σ ′ ] ≈ ( λ x . ( t [ ⇑ ] x )) [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] (by Tm-Subsump with Sub-Eq)
Γ ⊢ t [ σ ] ≈ ( λ x . ( t [ ⇑ ] x ) ) [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] \Gamma\vdash t[\sigma] \approx(\lambda x.(t[\Uparrow]x))[\sigma'] : (\Pi(x:S).T)[\sigma] Γ ⊢ t [ σ ] ≈ ( λ x . ( t [ ⇑ ] x )) [ σ ′ ] : ( Π ( x : S ) . T ) [ σ ] (by Tm-Trans)
Case N-β \beta β -ze, N-β \beta β -su: analogous to β \beta β above. Apply Theorem 4.7 statement (2) to the original reduction rule at σ \sigma σ to get equality at the contractum-substituted-by-σ \sigma σ . Then apply IH (statement (1)) to the typing of the contractum (derivable from the reduction rule and Theorem 4.10) to bridge the contractum from σ \sigma σ to σ ′ \sigma' σ ′ . Case
\begin{array}{c}
\mathrm{Tm\mathchar`-Sym}\\
\Delta\vdash t \approx t' : T\\
\hline
\Delta\vdash t' \approx t : T
\end{array}
By IH on the premise (with the roles of σ \sigma σ , σ ′ \sigma' σ ′ swapped): Γ ⊢ t [ σ ′ ] ≈ t ′ [ σ ′ ] : T [ σ ′ ] \Gamma\vdash t[\sigma'] \approx t'[\sigma'] : T[\sigma'] Γ ⊢ t [ σ ′ ] ≈ t ′ [ σ ′ ] : T [ σ ′ ] . By Theorem 4.7 statement (2), Γ ⊢ T [ σ ] ≈ T [ σ ′ ] : T y i \Gamma\vdash T[\sigma] \approx T[\sigma'] : \mathrm{Ty}_i Γ ⊢ T [ σ ] ≈ T [ σ ′ ] : Ty i (from the reflexive closure on the type-formation of T T T via presupposition). By Tm-Subsump with Sub-Eq, transport to the goal type T [ σ ] T[\sigma] T [ σ ] : Γ ⊢ t ′ [ σ ′ ] ≈ t [ σ ′ ] : T [ σ ] \Gamma\vdash t'[\sigma'] \approx t[\sigma'] : T[\sigma] Γ ⊢ t ′ [ σ ′ ] ≈ t [ σ ′ ] : T [ σ ] , then apply Tm-Sym.
Case
\begin{array}{c}
\mathrm{Tm\mathchar`-Trans}\\
\Delta\vdash t \approx t' : T\\
\Delta\vdash t' \approx t'' : T\\
\hline
\Delta\vdash t \approx t'' : T
\end{array}
By IH on the first premise: Γ ⊢ t [ σ ] ≈ t ′ [ σ ] : T [ σ ] \Gamma\vdash t[\sigma] \approx t'[\sigma] : T[\sigma] Γ ⊢ t [ σ ] ≈ t ′ [ σ ] : T [ σ ] (instantiated at σ ≈ σ \sigma\approx\sigma σ ≈ σ , reflexive). By IH on the second premise: Γ ⊢ t ′ [ σ ] ≈ t ′ ′ [ σ ′ ] : T [ σ ] \Gamma\vdash t'[\sigma] \approx t''[\sigma'] : T[\sigma] Γ ⊢ t ′ [ σ ] ≈ t ′′ [ σ ′ ] : T [ σ ] . By Tm-Trans: Γ ⊢ t [ σ ] ≈ t ′ ′ [ σ ′ ] : T [ σ ] \Gamma\vdash t[\sigma] \approx t''[\sigma'] : T[\sigma] Γ ⊢ t [ σ ] ≈ t ′′ [ σ ′ ] : T [ σ ] .
Case
\begin{array}{c}
\mathrm{Tm\mathchar`-Subsump}\\
\Delta\vdash T : \mathrm{Ty}_i\\
\Delta\vdash t \approx t' : S \qquad\Delta\vdash S \subseteq T\\
\hline
\Delta\vdash t \approx t' : T
\end{array}
Γ ⊢ t [ σ ] ≈ t ′ [ σ ′ ] : S [ σ ] (by IH on the second premise) Γ ⊢ S [ σ ] ⊆ T [ σ ] (by IH on the third premise via statement (3), instantiated at σ ≈ σ , reflexive) Γ ⊢ T [ σ ] : T y i (by Theorem 4.7 on the first premise) Γ ⊢ t [ σ ] ≈ t ′ [ σ ′ ] : T [ σ ] (by Tm-Subsump) \begin{aligned}
\Gamma&\vdash t[\sigma] \approx t'[\sigma'] : S[\sigma] && \text{(by IH on the second premise)}\\
\Gamma&\vdash S[\sigma] \subseteq T[\sigma] && \text{(by IH on the third premise via statement (3), instantiated at }\sigma\approx\sigma\text{, reflexive)}\\
\Gamma&\vdash T[\sigma] : \mathrm{Ty}_i && \text{(by Theorem 4.7 on the first premise)}\\
\Gamma&\vdash t[\sigma] \approx t'[\sigma'] : T[\sigma] && \text{(by Tm-Subsump)}
\end{aligned} Γ Γ Γ Γ ⊢ t [ σ ] ≈ t ′ [ σ ′ ] : S [ σ ] ⊢ S [ σ ] ⊆ T [ σ ] ⊢ T [ σ ] : Ty i ⊢ t [ σ ] ≈ t ′ [ σ ′ ] : T [ σ ] (by IH on the second premise) (by IH on the third premise via statement (3), instantiated at σ ≈ σ , reflexive) (by Theorem 4.7 on the first premise) (by Tm-Subsump)
Statement (3): subtyping preservation. By induction on the subtyping derivation.
Case Sub-Univ: T y i [ σ ] = T y i \mathrm{Ty}_i[\sigma] = \mathrm{Ty}_i Ty i [ σ ] = Ty i , T y j [ σ ′ ] = T y j \mathrm{Ty}_j[\sigma'] = \mathrm{Ty}_j Ty j [ σ ′ ] = Ty j , and the conclusion follows from Sub-Univ at i ≤ j i \leq j i ≤ j (the same hypothesis), with ⊢ Γ \vdash\Gamma ⊢ Γ from Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ .
Case
\begin{array}{c}
\mathrm{Sub\mathchar`-Pi}\\
\Delta\vdash S : \mathrm{Ty}_i \qquad\Delta\vdash S' : \mathrm{Ty}_i \qquad\Delta\vdash S \approx S' : \mathrm{Ty}_i\\
\Delta,x:S \vdash T : \mathrm{Ty}_i \qquad\Delta,x:S' \vdash T' : \mathrm{Ty}_i \qquad\Delta,x:S \vdash T \subseteq T'\\
\hline
\Delta\vdash\Pi(x:S).T \subseteq\Pi(x:S').T'
\end{array}
Γ ⊢ S [ σ ] ≈ S ′ [ σ ′ ] : T y i (by IH on third premise, statement (2)) Γ , x : S [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : ( Δ , x : S ) (by lifting) Γ , x : S [ σ ] ⊢ T [ q ( σ ) ] ⊆ T ′ [ q ( σ ′ ) ] (by IH on sixth premise) Γ ⊢ Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) ⊆ Π ( x : S ′ [ σ ′ ] ) . ( T ′ [ q ( σ ′ ) ] ) (by Sub-Pi on the previous lines and IH on the well-formedness premises 1, 2, 4, 5) ( Π ( x : S ) . T ) [ σ ] = Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) (syntactic) \begin{aligned}
\Gamma&\vdash S[\sigma] \approx S'[\sigma'] : \mathrm{Ty}_i && \text{(by IH on third premise, statement (2))}\\
\Gamma,x:S[\sigma] &\vdash q(\sigma) \approx q(\sigma') : (\Delta,x:S) && \text{(by lifting)}\\
\Gamma,x:S[\sigma] &\vdash T[q(\sigma)] \subseteq T'[q(\sigma')] && \text{(by IH on sixth premise)}\\
\Gamma&\vdash\Pi(x:S[\sigma]).(T[q(\sigma)]) \subseteq\Pi(x:S'[\sigma']).(T'[q(\sigma')]) && \text{(by Sub-Pi on the previous lines and IH on the well-formedness}\\
&&&\text{premises 1, 2, 4, 5)}\\
(\Pi(x:S).T)[\sigma] &= \Pi(x:S[\sigma]).(T[q(\sigma)]) && \text{(syntactic)}
\end{aligned} Γ Γ , x : S [ σ ] Γ , x : S [ σ ] Γ ( Π ( x : S ) . T ) [ σ ] ⊢ S [ σ ] ≈ S ′ [ σ ′ ] : Ty i ⊢ q ( σ ) ≈ q ( σ ′ ) : ( Δ , x : S ) ⊢ T [ q ( σ )] ⊆ T ′ [ q ( σ ′ )] ⊢ Π ( x : S [ σ ]) . ( T [ q ( σ )]) ⊆ Π ( x : S ′ [ σ ′ ]) . ( T ′ [ q ( σ ′ )]) = Π ( x : S [ σ ]) . ( T [ q ( σ )]) (by IH on third premise, statement (2)) (by lifting) (by IH on sixth premise) (by Sub-Pi on the previous lines and IH on the well-formedness premises 1, 2, 4, 5) (syntactic)
( Π ( x : S ′ ) . T ′ ) [ σ ′ ] = Π ( x : S ′ [ σ ′ ] ) . ( T ′ [ q ( σ ′ ) ] ) \left(\Pi(x : S').T'\right)[\sigma'] = \Pi\left(x : S'[\sigma']\right).\left(T'[q(\sigma')]\right) ( Π ( x : S ′ ) . T ′ ) [ σ ′ ] = Π ( x : S ′ [ σ ′ ] ) . ( T ′ [ q ( σ ′ )] )
Case Sub-Trans: by IH on both premises and Sub-Trans, using a shared middle subtype evaluated at σ \sigma σ on both sides.
Case Sub-Eq: by IH on the premise via statement (2) and Sub-Eq. □
Corollary 4.14 (Pointwise Equality at the Head Yields Type Equality). If Δ , x : S ⊢ T : T y i \Delta, x : S \vdash T : \mathrm{Ty}_i Δ , x : S ⊢ T : Ty i , Γ ⊢ σ : Δ \Gamma\vdash\sigma: \Delta Γ ⊢ σ : Δ , and Γ ⊢ s ≈ s ′ : S [ σ ] \Gamma\vdash s \approx s' : S[\sigma] Γ ⊢ s ≈ s ′ : S [ σ ] , then Γ ⊢ T [ σ , s / x ] ≈ T [ σ , s ′ / x ] : T y i \Gamma\vdash T[\sigma,s/x] \approx T[\sigma,s'/x] : \mathrm{Ty}_i Γ ⊢ T [ σ , s / x ] ≈ T [ σ , s ′ / x ] : Ty i .
Proof. By Theorem 4.10, Γ ⊢ s : S [ σ ] \Gamma\vdash s : S[\sigma] Γ ⊢ s : S [ σ ] and Γ ⊢ s ′ : S [ σ ] \Gamma\vdash s' : S[\sigma] Γ ⊢ s ′ : S [ σ ] from Γ ⊢ s ≈ s ′ : S [ σ ] \Gamma\vdash s \approx s' : S[\sigma] Γ ⊢ s ≈ s ′ : S [ σ ] . Build the substitution equivalence Γ ⊢ ( σ , s / x ) ≈ ( σ , s ′ / x ) : ( Δ , x : S ) \Gamma\vdash(\sigma,s/x) \approx(\sigma,s'/x) : (\Delta,x : S) Γ ⊢ ( σ , s / x ) ≈ ( σ , s ′ / x ) : ( Δ , x : S ) : at every y ∈ Δ y \in\Delta y ∈ Δ both sides yield σ ( y ) \sigma(y) σ ( y ) , and at x x x the heads s , s ′ s,s' s , s ′ are equated at S [ σ ] S[\sigma] S [ σ ] by hypothesis. Apply Theorem 4.13 statement (1) to Δ , x : S ⊢ T : T y i \Delta,x : S \vdash T : \mathrm{Ty}_i Δ , x : S ⊢ T : Ty i . □
Domain Model and Evaluation
In this section, we define the semantic domain into which terms of MLTT are interpreted, together with the evaluation function that maps syntactic terms (under an environment) to domain values, and the readback function that extracts normal forms from domain values. The overall structure follows the standard NbE recipe: evaluate into a domain of semantic values, then read back to produce syntactic normal forms. At this point, the difference with the explicit-substitution approach is still mundane; the main changes come from the semantic judgment, where we must make the commutativity between evaluation and substitution application explicit. Since substitutions are operations (not syntax), this commutativity does not come for free from the equational theory, and hence a semantic approach is required.
Semantic Domain
The domain model D serves as the target of the evaluation function. A central design principle of NbE for dependent types is that types are also values : unlike in the STLC setting where the domain is stratified by syntactic types, here both types and terms evaluate into the same domain D. This unification is what makes NbE work for dependent types, since the type of an expression may depend on the value of another expression.
We define three mutually recursive sets: domain values D, neutral domain values Dₙ, and annotated normal forms D_f. Semantic environments Env map variables to domain values.
Definition 5.1 (Semantic Domain). The domain D, neutral values Dₙ, normal forms D_f, and environments Env are defined mutually as follows:
Environments ρ ∈ E n v = N → D \rho\in\mathrm{Env} = \mathbb{N} \to\mathrm{D} ρ ∈ Env = N → D
Domain values a , b , A , B ∈ D a,b,A,B \in\mathrm{D} a , b , A , B ∈ D
: : = U i ∣ N ∣ Π ( a , t , ρ ) ∣ z e ∣ s u ( a ) ∣ λ ( t , ρ ) ∣ ↑ A ( e ) ::= U_i \mid N \mid\Pi(a,t,\rho) \mid\mathrm{ze} \mid\mathrm{su}(a) \mid\lambda(t,\rho) \mid\uparrow^{A}(e) ::= U i ∣ N ∣ Π ( a , t , ρ ) ∣ ze ∣ su ( a ) ∣ λ ( t , ρ ) ∣ ↑ A ( e ) Neutral values e ∈ D n e \in\mathrm{D}_n e ∈ D n
: : = ℓ n ∣ e $ d ∣ rec ( T , a , s , ρ , e ) ::= \ell_n \mid e \$ d \mid\operatorname{rec}(T,a,s,\rho,e) ::= ℓ n ∣ e $ d ∣ rec ( T , a , s , ρ , e ) Normal forms d ∈ D f d \in\mathrm{D}_f d ∈ D f
: : = ↓ A ( a ) ::= \downarrow^{A}(a) ::= ↓ A ( a )
Let us explain the intuition behind each constructor:
U i U_i U i (universe): the semantic value of the type T y i \mathrm{Ty}_i Ty i .
N N N (natural number type): the semantic value of the type N a t \mathrm{Nat} Nat .
Π ( a , t , ρ ) \Pi(a,t,\rho) Π ( a , t , ρ ) : the semantic value of a Π \Pi Π -type, where a ∈ D a \in D a ∈ D is the interpretation of the domain type, t ∈ E x p t \in\mathrm{Exp} t ∈ Exp is the body of the codomain, and ρ ∈ E n v \rho\in\mathrm{Env} ρ ∈ Env is the captured environment.
ze and su(d d d ): the standard constructors for natural numbers, lifted to the domain.
λ ( t , ρ ) \lambda(t,\rho) λ ( t , ρ ) : a closure , representing a lambda abstraction λ x . t \lambda x.t λ x . t together with the environment ρ \rho ρ that was active at the point of evaluation.
↑ A ( e ) \uparrow^{A}(e) ↑ A ( e ) : a neutral value e e e annotated with its type A ∈ D A \in\mathsf{D} A ∈ D . Neutral values arise when computation is blocked—for instance, when a variable stands in head position of an application. The type annotation is needed during readback to determine how to η \eta η -expand the neutral at function types.
ℓ n \ell_n ℓ n : a free variable at de Bruijn level n n n . During readback, levels are converted back to de Bruijn indices.
e $ d e \mathbin{\$} d e $ d : a neutral application, where e e e is a neutral function and d d d is an annotated normal form recording both the argument value and its type.
rec ( T , d , s , ρ , e ) \operatorname{rec}(T,d,s,\rho,e) rec ( T , d , s , ρ , e ) : a neutral recursion (eliminator for Nat), arising when the scrutinee is neutral. Here T T T is the captured syntactic motive, d d d is the zero case, s s s is the syntactic step expression, ρ \rho ρ is the captured ambient environment, and e e e is the neutral scrutinee.
↓ A ( a ) \downarrow^{A}(a) ↓ A ( a ) : an annotated normal form, pairing a type A ∈ D A \in\mathsf{D} A ∈ D with a value a ∈ D a \in\mathsf{D} a ∈ D . This is used both in neutral applications (to record the domain type of the argument) and as the input format for readback.
Environments
An environment ρ ∈ E n v = N → D \rho\in\mathsf{Env} = \mathbb{N} \to\mathsf{D} ρ ∈ Env = N → D maps de Bruijn indices to domain values. We write ( ρ , a / x ) (\rho,a/x) ( ρ , a / x ) for the extension of ρ \rho ρ by a a a at index 0:
( ρ , a / x ) ( 0 ) = a ( ρ , a / x ) ( y + 1 ) = ρ ( y ) (\rho,a/x)(0)=a \qquad(\rho,a/x)(y+1)=\rho(y) ( ρ , a / x ) ( 0 ) = a ( ρ , a / x ) ( y + 1 ) = ρ ( y )
We also define the drop operation ρ [ ⇑ ] \rho[\Uparrow] ρ [ ⇑ ] that discards the first binding:
ρ [ ⇑ ] ( x ) = ρ ( x + 1 ) \rho[\Uparrow](x)=\rho(x+1) ρ [ ⇑ ] ( x ) = ρ ( x + 1 )
This satisfies ( ρ , a / x ) [ ⇑ ] = ρ (\rho,a/x)[\Uparrow]=\rho ( ρ , a / x ) [ ⇑ ] = ρ .
Evaluation
Evaluation is defined as a big-step relation ⟦ t ⟧ ( ρ ) ↘ a \llbracket t\rrbracket(\rho) \searrow a [ [ t ] ] ( ρ ) ↘ a , meaning “expression t t t , evaluated in environment ρ \rho ρ , produces domain value d d d .” We define this relation by the inference rules in Figure 1 . The relation is written in relational (not functional) style to accommodate the partial nature of evaluation in the untyped setting; totality is established separately as part of the soundness theorem.
Figure 1. Evaluation rules: ⟦ t ⟧ ( ρ ) ↘ a \llbracket t\rrbracket(\rho) \searrow a [ [ t ] ] ( ρ ) ↘ a
Several points deserve emphasis:
Π-types: The rule EV-PI evaluates the domain type S S S to a value a a a , and records the codomain expression T T T together with the current environment ρ \rho ρ as a closure Π ( a , T , ρ ) \Pi(a,T,\rho) Π ( a , T , ρ ) . The codomain fiber at argument b b b is obtained later by evaluating T T T in ( ρ , b / x ) (\rho,b/x) ( ρ , b / x ) .
Lambda: The rule EV-LAM does not evaluate the body; it merely pairs the body t t t with the current environment ρ \rho ρ to form a closure λ ( t , ρ ) \lambda(t,\rho) λ ( t , ρ ) . The body will be evaluated when the closure is applied.
Application
The application judgment f ⋅ a ↘ b f \cdot a \searrow b f ⋅ a ↘ b describes how to apply a domain value f f f (which should be function-like) to an argument a a a .
⟦ t ⟧ ( ρ , a / x 0 ) ↘ b λ ( t , ρ ) ⋅ a ↘ b \frac{\llbracket t \rrbracket(\rho,a/x_0)\searrow b}{\lambda(t,\rho)\cdot a\searrow b} λ ( t , ρ ) ⋅ a ↘ b [ [ t ] ] ( ρ , a / x 0 ) ↘ b
⟦ T ⟧ ( ρ , a / x 0 ) ↘ B ↑ Π ( A , T , ρ ) ( e ) ⋅ a ↘ ↑ B ( e $ ↓ A ( a ) ) \frac{\llbracket T \rrbracket(\rho,a/x_0)\searrow B}{\uparrow^{\Pi(A,T,\rho)}(e)\cdot a\searrow\uparrow^B(e\mathbin{\$}\downarrow^A(a))} ↑ Π ( A , T , ρ ) ( e ) ⋅ a ↘ ↑ B ( e $ ↓ A ( a )) [ [ T ] ] ( ρ , a / x 0 ) ↘ B
fig:2 . Application rules: f ⋅ a ↘ b f \cdot a \searrow b f ⋅ a ↘ b
APP-LAM: Applying a closure λ ( t , ρ ) \lambda(t,\rho) λ ( t , ρ ) to an argument a a a extends the closure’s environment with a a a at index 0 and evaluates the body t t t .
APP-NE: Applying a neutral ↑ Π ( A , T , ρ ) ( e ) \uparrow^{\Pi(A,T,\rho)}(e) ↑ Π ( A , T , ρ ) ( e ) to an argument a a a produces a new neutral. The codomain fiber is obtained by evaluating T T T in ( ρ , a / x 0 ) (\rho,a/x_0) ( ρ , a / x 0 ) , yielding a type B B B . The result is ↑ B ( e $ ↓ A ( a ) ) \uparrow^B(e\mathbin{\$}\downarrow^A(a)) ↑ B ( e $ ↓ A ( a )) : a neutral at the codomain type, recording the application with the argument annotated by its domain type A A A .
Natural Number Recursion
The recursion judgment rec ( a , T , z , s , ρ ) ↘ b \operatorname{rec}(a,T,z,s,\rho)\searrow b rec ( a , T , z , s , ρ ) ↘ b defines the semantic interpretation of the natural number eliminator. Here a ∈ D a \in D a ∈ D is the evaluated scrutinee, T ∈ Exp T \in\operatorname{Exp} T ∈ Exp is the motive expression, z ∈ Exp z \in\operatorname{Exp} z ∈ Exp is the zero-case expression, s ∈ Exp s \in\operatorname{Exp} s ∈ Exp is the step-case expression (binding the predecessor x x x and the inductive hypothesis y y y ), and ρ ∈ Env \rho\in\operatorname{Env} ρ ∈ Env is the captured environment. Crucially, z z z and s s s are syntax—they are evaluated lazily inside the recursion judgment, not pre-evaluated.
⟦ z ⟧ ( ρ ) ↘ b rec ( ze , T , z , s , ρ ) ↘ b \frac{\llbracket z \rrbracket(\rho)\searrow b}{\operatorname{rec}(\operatorname{ze},T,z,s,\rho)\searrow b} rec ( ze , T , z , s , ρ ) ↘ b [ [ z ] ] ( ρ ) ↘ b
rec ( a , T , z , s , ρ ) ↘ b ⟦ s ⟧ ( ρ , a / x , b / y ) ↘ b ′ rec ( su ( a ) , T , z , s , ρ ) ↘ b ′ \frac{\operatorname{rec}(a,T,z,s,\rho)\searrow b \qquad\llbracket s \rrbracket(\rho,a/x,b/y)\searrow b'}{\operatorname{rec}(\operatorname{su}(a),T,z,s,\rho)\searrow b'} rec ( su ( a ) , T , z , s , ρ ) ↘ b ′ rec ( a , T , z , s , ρ ) ↘ b [ [ s ] ] ( ρ , a / x , b / y ) ↘ b ′
⟦ z ⟧ ( ρ ) ↘ a z ⟦ T ⟧ ( ρ , ↑ N ( e ) / x ) ↘ A rec ( ↑ N ( e ) , T , z , s , ρ ) ↘ ↑ A ( rec ( T , a z , s , ρ , e ) ) \frac{\llbracket z \rrbracket(\rho)\searrow a_z \qquad\llbracket T \rrbracket(\rho,\uparrow^N(e)/x)\searrow A}{\operatorname{rec}(\uparrow^N(e),T,z,s,\rho)\searrow\uparrow^A(\operatorname{rec}(T,a_z,s,\rho,e))} rec ( ↑ N ( e ) , T , z , s , ρ ) ↘ ↑ A ( rec ( T , a z , s , ρ , e )) [ [ z ] ] ( ρ ) ↘ a z [ [ T ] ] ( ρ , ↑ N ( e ) / x ) ↘ A
fig:3 . Recursion rules: rec ( a , T , z , s , ρ ) ↘ b \operatorname{rec}(a,T,z,s,\rho)\searrow b rec ( a , T , z , s , ρ ) ↘ b
REC-SU: When the scrutinee is su ( a ) \operatorname{su}(a) su ( a ) , first recursively compute the result b b b for the predecessor a a a , then evaluate the step expression s s s in the environment extended with a a a (the predecessor) and b b b (the inductive hypothesis).
REC-NE: When the scrutinee is neutral ↑ N ( e ) \uparrow^{N}(e) ↑ N ( e ) , computation is blocked. We evaluate the zero case to get a z a_z a z , evaluate the motive at the neutral scrutinee to get the result type A A A , and produce a neutral value ↑ A ( … ) \uparrow^{A}(\ldots) ↑ A ( … ) recording all components for later readback.
Readback
Readback (also called reification) extracts a syntactic normal form from a domain value. It is defined as three mutually recursive relations:
R n N f ( ↓ A ( a ) ) ↓ w R^{\mathrm{Nf}}_n(\downarrow^{A}(a)) \downarrow w R n Nf ( ↓ A ( a )) ↓ w : read back the value a a a at type A A A to produce a normal form w w w , where n ∈ N n \in\mathbb{N} n ∈ N is the current depth (the number of binders traversed so far, which determines the next fresh level).
R n T y ( A ) ↓ W R^{\mathrm{Ty}}_n(A) \downarrow W R n Ty ( A ) ↓ W : read back a domain type A A A to produce a type normal form W W W .
R n N e ( e ) ↓ u R^{\mathrm{Ne}}_n(e) \downarrow u R n Ne ( e ) ↓ u : read back a neutral value e e e to produce a neutral normal form u u u .
The level parameter n n n serves a dual purpose:
It determines the next fresh variable: when we need to η \eta η -expand a function, we apply it to the “generic” value ↑ A ( ℓ n ) \uparrow^{A}(\ell_n) ↑ A ( ℓ n ) and increment the depth to n + 1 n + 1 n + 1 .
It enables the conversion from de Bruijn levels to de Bruijn indices: a free variable at level ℓ \ell ℓ is read back as the index n − ℓ − 1 n - \ell- 1 n − ℓ − 1 , where n n n is the current depth.
The readback rules are given in Figure 4 .
Figure 4. Readback rules: R n N f R^{\mathrm{Nf}}_n R n Nf for normal forms, R n T y R^{\mathrm{Ty}}_n R n Ty for types, R n N e R^{\mathrm{Ne}}_n R n Ne for neutrals
The key rules are:
Rf-Ty: Reading back at type U i U_i U i delegates to the type readback R n T y R^{\mathrm{Ty}}_n R n Ty .
Rty-N, Rty-Pi, Rty-ne: Type readback R n T y R^{\mathrm{Ty}}_n R n Ty inspects the domain type value directly. For N N N , it produces Nat. For Π ( a , T , ρ ) \Pi(a,T,\rho) Π ( a , T , ρ ) , it reads back the domain a a a as a type to get W S W_S W S , evaluates the codomain T T T at a fresh generic ↑ A ( ℓ n ) \uparrow^{A}(\ell_n) ↑ A ( ℓ n ) to get B B B , then reads back B B B as a type with depth n + 1 n+1 n + 1 to get W T W_T W T . For a neutral ↑ A ( e ) \uparrow^{A}(e) ↑ A ( e ) , it reads back e e e via R n N e R^{\mathrm{Ne}}_n R n Ne .
Rf-Pi: The η \eta η -expansion rule for functions. To read back f f f at type Π ( A , T , ρ ) \Pi(A,T,\rho) Π ( A , T , ρ ) , we apply f f f to a fresh generic ↑ A ( ℓ n ) \uparrow^{A}(\ell_n) ↑ A ( ℓ n ) , evaluate the codomain at that generic to get the result type B B B , then read back the application result b b b at type B B B with depth n + 1 n+1 n + 1 . The result is λ x . w \lambda x.w λ x . w . This applies to all values at Π \Pi Π -type (including neutrals), enforcing η \eta η -long normal forms.
Rf-ne: A neutral value at a neutral type is read back via R N e R^{\mathrm{Ne}} R Ne . Neutrals at function type are handled by Rf-Pi (η \eta η -expanded).
Re-var: A level ℓ k \ell_k ℓ k becomes de Bruijn index n − k − 1 n-k-1 n − k − 1 .
Re-app: A neutral application reads back the head and argument.
Re-rec: A neutral recursion reads back the zero case, evaluates the step case at fresh generics and reads back all components, producing the syntactic eliminator.
Weakening and Substitution Evaluations
A weakening ψ \psi ψ maps between variables. Viewing it as a special kind of substitutions, we can write its evaluation relation as
⟦ ψ ⟧ ( ρ ) ( x ) : = ρ ( ψ ( x ) ) \llbracket\psi\rrbracket(\rho)(x) := \rho(\psi(x)) [ [ ψ ] ] ( ρ ) ( x ) := ρ ( ψ ( x ))
Namely ⟦ ψ ⟧ ( ρ ) \llbracket\psi\rrbracket(\rho) [ [ ψ ] ] ( ρ ) queries from ρ \rho ρ the value mapped by weakened variable ψ ( x ) \psi(x) ψ ( x ) .
A substitution σ \sigma σ mapping variables to expressions can be evaluated in an environment ρ \rho ρ to produce a new environment ρ ′ \rho' ρ ′ . We write ⟦ σ ⟧ ( ρ ) ⇝ ρ ′ \llbracket\sigma\rrbracket(\rho) \rightsquigarrow\rho' [ [ σ ] ] ( ρ ) ⇝ ρ ′ and define:
⟦ σ ⟧ ( ρ ) ⇝ ρ ′ ⟺ ∀ x . ⟦ σ ( x ) ⟧ ( ρ ) ⇝ ρ ′ ( x ) \llbracket\sigma\rrbracket(\rho) \rightsquigarrow\rho' \quad\Longleftrightarrow\quad\forall x.\ \llbracket\sigma(x)\rrbracket(\rho) \rightsquigarrow\rho'(x) [ [ σ ] ] ( ρ ) ⇝ ρ ′ ⟺ ∀ x . [ [ σ ( x ) ] ] ( ρ ) ⇝ ρ ′ ( x )
That is, the evaluation of a substitution is defined pointwise: the new environment ρ ′ \rho' ρ ′ assigns to each variable x x x the result of evaluating σ ( x ) \sigma(x) σ ( x ) in ρ \rho ρ .
In particular, we have the following relations:
Lemma 5.2. The follow evaluations hold:
⟦ ι ( ψ ) ⟧ ( ρ ) ⇝ ⟦ ψ ⟧ ( ρ ) \llbracket\iota(\psi)\rrbracket(\rho) \rightsquigarrow\llbracket\psi\rrbracket(\rho) [ [ ι ( ψ ) ] ] ( ρ ) ⇝ [ [ ψ ] ] ( ρ )
⟦ id ⟧ ( ρ ) ⇝ ρ \llbracket\operatorname{id}\rrbracket(\rho) \rightsquigarrow\rho [ [ id ] ] ( ρ ) ⇝ ρ ,
If ⟦ σ ⟧ ( ρ ) ⇝ ρ ′ \llbracket\sigma\rrbracket(\rho) \rightsquigarrow\rho' [ [ σ ] ] ( ρ ) ⇝ ρ ′ and ⟦ t ⟧ ( ρ ) ⇝ a \llbracket t\rrbracket(\rho) \rightsquigarrow a [ [ t ] ] ( ρ ) ⇝ a , then ⟦ σ , t / x ⟧ ( ρ ) ⇝ ( ρ ′ , a ) \llbracket\sigma,t/x\rrbracket(\rho) \rightsquigarrow(\rho',a) [ [ σ , t / x ] ] ( ρ ) ⇝ ( ρ ′ , a ) .
Indeed, the single substitution [ s / x ] [s/x] [ s / x ] yields:
⟦ [ s / x ] ⟧ ( ρ ) ⇝ ( ρ , ⟦ s ⟧ ( ρ ) / x ) \llbracket[s/x]\rrbracket(\rho) \rightsquigarrow(\rho,\llbracket s\rrbracket(\rho)/x) [ [ [ s / x ] ] ] ( ρ ) ⇝ ( ρ , [ [ s ] ] ( ρ ) / x )
This substitution evaluation judgment is the bridge between the syntactic notion of substitution (an operation on terms) and the semantic notion (a transformation of environments). However, by its definition, we are not able to derive the following desired properties obtained by definition with explicit substitutions:
⟦ σ [ ψ ] ⟧ ( ρ ) = ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) \llbracket\sigma[\psi]\rrbracket(\rho)=\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho)) [ [ σ [ ψ ] ] ] ( ρ ) = [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) ,
⟦ t [ σ ] ⟧ ( ρ ) = ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) \llbracket t[\sigma]\rrbracket(\rho)=\llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho)) [ [ t [ σ ] ] ] ( ρ ) = [ [ t ] ] ( [ [ σ ] ] ( ρ )) , or
⟦ σ ∘ σ ′ ⟧ ( ρ ) = ⟦ σ ⟧ ( ⟦ σ ′ ⟧ ( ρ ) ) \llbracket\sigma\circ\sigma'\rrbracket(\rho)=\llbracket\sigma\rrbracket(\llbracket\sigma'\rrbracket(\rho)) [ [ σ ∘ σ ′ ] ] ( ρ ) = [ [ σ ] ] ( [ [ σ ′ ] ] ( ρ )) .
The ultimate reason is that with explicit substitutions, the operation is delayed, so that substitutions can occur during evaluation. With our current settings, unfortunately, weakenings and substitutions must eagerly apply, because they are operations. Therefore, the equations above do not hold in general. Nevertheless, we can show that, these equations are in fact relations in the PER model, hence giving us handles to understand substitutions through the lenses of evaluations. That said, these relations cannot be described before defining the PER model, so we postpone the discussions in § 6 .
Determinism
All the relations defined above — evaluation, application, recursion, and readback — are deterministic (functional).
Lemma 5.3 (Determinism). (1) If [ [ t ] ] ( ρ ) ↘ a [\![t]\!](\rho) \mathrel{\searrow} a [ [ t ] ] ( ρ ) ↘ a and [ [ t ] ] ( ρ ) ↘ a ′ [\![t]\!](\rho) \mathrel{\searrow} a' [ [ t ] ] ( ρ ) ↘ a ′ , then a = a ′ a = a' a = a ′ . (2) If f ⋅ a ↘ b f \mathbin{\cdot} a \mathrel{\searrow} b f ⋅ a ↘ b and f ⋅ a ↘ b ′ f \mathbin{\cdot} a \mathrel{\searrow} b' f ⋅ a ↘ b ′ , then b = b ′ b = b' b = b ′ . (3) If rec ( a , T , z , s , ρ ) ↘ b \operatorname{rec}(a,T,z,s,\rho) \mathrel{\searrow} b rec ( a , T , z , s , ρ ) ↘ b and rec ( a , T , z , s , ρ ) ↘ b ′ \operatorname{rec}(a,T,z,s,\rho) \mathrel{\searrow} b' rec ( a , T , z , s , ρ ) ↘ b ′ , then b = b ′ b = b' b = b ′ . (4) If R n N f ( d ) ↘ w R_{n}^{\mathrm{Nf}}(d) \mathrel{\searrow} w R n Nf ( d ) ↘ w and R n N f ( d ) ↘ w ′ R_{n}^{\mathrm{Nf}}(d) \mathrel{\searrow} w' R n Nf ( d ) ↘ w ′ , then w = w ′ w = w' w = w ′ . (5) If R n N f ( A ) ↘ W R_{n}^{\mathrm{Nf}}(A) \mathrel{\searrow} W R n Nf ( A ) ↘ W and R n N f ( A ) ↘ W ′ R_{n}^{\mathrm{Nf}}(A) \mathrel{\searrow} W' R n Nf ( A ) ↘ W ′ , then W = W ′ W = W' W = W ′ . (6) If R n N e ( e ) ↘ u R_{n}^{\mathrm{Ne}}(e) \mathrel{\searrow} u R n Ne ( e ) ↘ u and R n N e ( e ) ↘ u ′ R_{n}^{\mathrm{Ne}}(e) \mathrel{\searrow} u' R n Ne ( e ) ↘ u ′ , then u = u ′ u = u' u = u ′ .
Proof. By mutual induction on the derivations. In each case, the conclusion follows because the rules are syntax-directed: no two rules apply to the same configuration. □
Determinism ensures that the NbE procedure, when it terminates, produces a unique normal form. This is essential for using NbE as a decision procedure for definitional equality.
Initial Environment
To normalize a term in context Γ \Gamma Γ , we need an appropriate initial environment that provides generic values for each variable in the context. The initial environment is constructed by induction on the context, assigning to each variable a neutral value (reflecting the variable itself) at its declared type.
Definition 5.4 (Initial Environment). Given a context Γ \Gamma Γ , the initial environment ↑ Γ : Env \uparrow^\Gamma: \operatorname{Env} ↑ Γ : Env is defined by induction on Γ \Gamma Γ :
↑ ∅ ( x ) = z e \uparrow^{\varnothing}(x) = \mathsf{ze} ↑ ∅ ( x ) = ze
↑ Γ , x : T = ( ↑ Γ , ↑ ⟦ T ⟧ ( ↑ Γ ) ( ℓ ∣ Γ ∣ ) ) \uparrow^{\Gamma,x:T} = \left(\uparrow^\Gamma,\ \uparrow^{\llbracket T \rrbracket(\uparrow^\Gamma)}(\ell_{\lvert\Gamma\rvert})\right) ↑ Γ , x : T = ( ↑ Γ , ↑ [ [ T ] ] ( ↑ Γ ) ( ℓ ∣ Γ ∣ ) )
Each variable x i x_i x i in Γ \Gamma Γ is mapped to a neutral value ↑ A i ( ℓ i ) \uparrow^{A_i}(\ell_i) ↑ A i ( ℓ i ) reflecting x i x_i x i at its evaluated type A i A_i A i . Here ∣ Γ ∣ \lvert\Gamma\rvert ∣ Γ ∣ denotes the length of Γ \Gamma Γ .
The initial environment assigns to the most recently bound variable x x x a neutral value ↑ A ( ℓ n ) \uparrow^A(\ell_n) ↑ A ( ℓ n ) where A A A is the interpretation of its declared type T T T and n = ∣ Γ ∣ n = \lvert\Gamma\rvert n = ∣ Γ ∣ is its de Bruijn level. Older variables are assigned inductively.
The NbE Procedure
With this setup, we can now define the full NbE procedure.
Definition 5.5 (NbE). Given Γ ⊢ t : T \Gamma\vdash t : T Γ ⊢ t : T , we define
nbe Γ T ( t ) : = R ∣ Γ ∣ N f ( ↓ ⟦ T ⟧ ( ↑ Γ ) ( ⟦ t ⟧ ( ↑ Γ ) ) ) \operatorname{nbe}_{\Gamma}^{T}(t) := R_{\lvert\Gamma\rvert}^{\mathrm{Nf}}\left(\downarrow\llbracket T\rrbracket(\uparrow^\Gamma)\left(\llbracket t\rrbracket(\uparrow^\Gamma)\right)\right) nbe Γ T ( t ) := R ∣ Γ ∣ Nf ( ↓ [ [ T ] ] ( ↑ Γ ) ( [ [ t ] ] ( ↑ Γ ) ) )
The fact that judgmentally equal terms yield the same normal form is the content of the completeness theorem, established in § 6 . The existence of a result for every well-typed term is the content of the soundness theorem, established in § 7 .
Completeness of NbE
In this section, we construct a partial equivalence relation (PER) model for MLTT and use it to establish the completeness of normalization by evaluation: if two terms are judgmentally equal, then they evaluate to semantically related values, which in turn read back to the same normal form.
The PER model follows the approach of Jang et al. [ [8 ] , using an impredicative formulation in Prop. The key idea is that the universe PER U i \mathcal{U}_i U i is defined as a functional relation: a judgment A ≈ A ′ ∈ U i ↘ R A \approx A' \in\mathcal{U}_i \searrow R A ≈ A ′ ∈ U i ↘ R simultaneously asserts that A A A and A ′ A' A ′ represent the “same type at level i i i ” and that R R R is the PER on inhabitants of that type. This functional-relational style avoids the need for inductive-recursive definitions while retaining full dependent-type support.
The key complication introduced by the operational substitution approach is that we must additionally show that evaluation commutes with substitution: evaluating a substituted term t [ σ ] t[\sigma] t [ σ ] directly in an environment ρ \rho ρ yields an equivalent semantic value as first evaluating σ \sigma σ to obtain a semantic environment and then evaluating t t t in that environment, related by the PER model. This property must be established as part of the fundamental theorem.
Introduction: Completeness via PERs
The completeness theorem states:
If Γ ⊢ s ≈ t : T , then nbe Γ T ( s ) = nbe Γ T ( t ) . \text{If } \Gamma\vdash s \approx t : T,\text{ then } \operatorname{nbe}_{\Gamma}^{T}(s) = \operatorname{nbe}_{\Gamma}^{T}(t). If Γ ⊢ s ≈ t : T , then nbe Γ T ( s ) = nbe Γ T ( t ) .
That is, judgmentally equal terms normalize to the same normal form. The proof strategy is standard:
Define a PER model that interprets each type as a binary relation on domain values.
Prove the realizability theorem and show that related domain values are read back to identical normal forms.
Prove the fundamental theorem: every derivable judgment is validated by the model.
Instantiate the fundamental theorem at the initial environment to conclude.
Following Jang et al. [ [8 ] , we define the PER model as a weak functional relation valued in an impredicative logic akin to Rocq’s Prop: the relation A ≈ A ′ ∈ U i ↘ R A \approx A' \in\mathcal{U}_i \searrow R A ≈ A ′ ∈ U i ↘ R simultaneously certifies that A A A , A ′ A' A ′ are related domain types and returns the PER R R R on their elements.
Base PERs via Readback
We begin by defining three base-level PERs that capture the behavior of the readback functions. Recall from Sec. 5 that R N f R^{\mathrm{Nf}} R Nf and R N e R^{\mathrm{Ne}} R Ne denote the readback relations for normal forms and neutral terms respectively, and that readback is parameterized by a name supply n ∈ N n \in\mathbb{N} n ∈ N (a de Bruijn level).
Definition 6.1 (PER Nf — Normal Forms). Two annotated normal forms d , d ′ ∈ D f d, d' \in D_f d , d ′ ∈ D f are related in Nf if they read back to the same syntactic normal form at every name supply level:
d ≈ d ′ ∈ N f : = ∀ n ∈ N . ∃ w . R n N f ( d ) ↘ w ∧ R n N f ( d ′ ) ↘ w d \approx d' \in\mathrm{Nf} \;:=\; \forall n \in\mathbb{N}.\ \exists w.\ R_n^{\mathrm{Nf}}(d) \searrow w \land R_n^{\mathrm{Nf}}(d') \searrow w d ≈ d ′ ∈ Nf := ∀ n ∈ N . ∃ w . R n Nf ( d ) ↘ w ∧ R n Nf ( d ′ ) ↘ w
Definition 6.2 (PER Ne — Neutral Terms). Two neutral domain values e , e ′ e, e' e , e ′ are related in Ne if they read back to the same neutral normal form at every name supply level:
e ≈ e ′ ∈ N e : = ∀ n ∈ N . ∃ u . R n N e ( e ) ↘ u ∧ R n N e ( e ′ ) ↘ u e \approx e' \in\mathrm{Ne} \;:=\; \forall n \in\mathbb{N}.\ \exists u.\ R_n^{\mathrm{Ne}}(e) \searrow u \land R_n^{\mathrm{Ne}}(e') \searrow u e ≈ e ′ ∈ Ne := ∀ n ∈ N . ∃ u . R n Ne ( e ) ↘ u ∧ R n Ne ( e ′ ) ↘ u
Definition 6.3 (PER Ty — Types). Two domain values A , A ′ A, A' A , A ′ representing types are related in Ty if they read back to the same type normal form:
A ≈ A ′ ∈ T y : = ∀ n ∈ N . ∃ W . R n T y ( A ) ↘ W ∧ R n T y ( A ′ ) ↘ W A \approx A' \in\mathrm{Ty} \;:=\; \forall n \in\mathbb{N}.\ \exists W.\ R_n^{\mathrm{Ty}}(A) \searrow W \land R_n^{\mathrm{Ty}}(A') \searrow W A ≈ A ′ ∈ Ty := ∀ n ∈ N . ∃ W . R n Ty ( A ) ↘ W ∧ R n Ty ( A ′ ) ↘ W
These three PERs are the observational backbone of the model: two values are related precisely when they are observationally indistinguishable through readback. The universal quantification over n n n is essential for the function space case, where fresh variables are introduced at arbitrary levels.
Lemma 6.4 (Base PERs are PERs). N f Nf N f , N e Ne N e , and T y Ty T y are symmetric and transitive (hence PERs).
Proof. Symmetry is immediate (swap the two conjuncts). Transitivity follows from determinism of readback (Theorem 5.3).
Case Ne. Suppose e ≈ e ′ ∈ N e e \approx e' \in Ne e ≈ e ′ ∈ N e and e ′ ≈ e ′ ′ ∈ N e e' \approx e'' \in Ne e ′ ≈ e ′′ ∈ N e .
∀ n . ∃ u . R n N e ( e ) ↓ u ∧ R n N e ( e ′ ) ↓ u (by first hypothesis) \forall n.\ \exists u.\ R^{Ne}_{n}(e) \mathrel{\downarrow} u \mathbin{\wedge} R^{Ne}_{n}(e') \mathrel{\downarrow} u
\qquad\text{(by first hypothesis)} ∀ n . ∃ u . R n N e ( e ) ↓ u ∧ R n N e ( e ′ ) ↓ u (by first hypothesis)
∀ n . ∃ u ′ . R n N e ( e ′ ) ↓ u ′ ∧ R n N e ( e ′ ′ ) ↓ u ′ (by second hypothesis) \forall n.\ \exists u'.\ R^{Ne}_{n}(e') \mathrel{\downarrow} u' \mathbin{\wedge} R^{Ne}_{n}(e'') \mathrel{\downarrow} u'
\qquad\text{(by second hypothesis)} ∀ n . ∃ u ′ . R n N e ( e ′ ) ↓ u ′ ∧ R n N e ( e ′′ ) ↓ u ′ (by second hypothesis)
u = u ′ (by determinism of R N e , Theorem 5.3) u = u'
\qquad\text{(by determinism of }R^{Ne}\text{, Theorem 5.3)} u = u ′ (by determinism of R N e , Theorem 5.3)
R n N e ( e ) ↓ u ∧ R n N e ( e ′ ′ ) ↓ u (combining above) R^{Ne}_{n}(e) \mathrel{\downarrow} u \mathbin{\wedge} R^{Ne}_{n}(e'') \mathrel{\downarrow} u
\qquad\text{(combining above)} R n N e ( e ) ↓ u ∧ R n N e ( e ′′ ) ↓ u (combining above)
The cases for N f Nf N f and T y Ty T y are analogous, using determinism of R N f R^{Nf} R N f and R T y R^{Ty} R T y respectively. □
PER for Neutral Domain Values
The PER Neu relates neutral domain values ↑ A ( e ) \uparrow^{A}(e) ↑ A ( e ) by ignoring the type annotation and comparing only the underlying neutral terms via Ne.
Definition 6.5 (PER Neu).
↑ A ( e ) ≈ ↑ A ′ ( e ′ ) ∈ N e u ≔ e ≈ e ′ ∈ N e \uparrow^{A}(e) \approx\uparrow^{A'}(e') \in Neu \coloneqq e \approx e' \in Ne ↑ A ( e ) ≈ ↑ A ′ ( e ′ ) ∈ N e u : = e ≈ e ′ ∈ N e
The key property of Neu is that it erases type annotations: two neutrals are related regardless of the types they carry, as long as their underlying neutral terms read back identically. This is sound because during readback at base type, only the neutral structure matters.
PER for Natural Numbers
Definition 6.6 (PER Nat). The relation a ≈ a ′ ∈ N a t a \approx a' \in Nat a ≈ a ′ ∈ N a t is defined inductively by:
\frac{\mathstrut\mathrm{ze} \approx\mathrm{ze} \in Nat}{\mathrm{Nat\mathchar`-Ze}}
a ≈ a ′ ∈ N a t s u ( a ) ≈ s u ( a ′ ) ∈ N a t \frac{a \approx a' \in Nat}{\mathrm{su}(a) \approx\mathrm{su}(a') \in Nat} su ( a ) ≈ su ( a ′ ) ∈ N a t a ≈ a ′ ∈ N a t e ≈ e ′ ∈ N e ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ N a t \frac{e \approx e' \in Ne}{\uparrow^{N}(e) \approx\uparrow^{N}(e') \in Nat} ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ N a t e ≈ e ′ ∈ N e
The first two constructors handle the canonical forms. The third constructor embeds neutral values into the PER: stuck computations (e.g., a variable of type Nat) are related whenever their underlying neutral terms are related in Ne.
Lemma 6.7 (Nat is a PER). N a t Nat N a t is symmetric and transitive.
Proof. By induction on the derivation.
Case
\frac{\mathstrut\mathrm{ze} \approx\mathrm{ze} \in Nat}{\mathrm{Nat\mathchar`-Ze}}
Symmetry and transitivity are immediate. Case
a ≈ a ′ ∈ N a t s u ( a ) ≈ s u ( a ′ ) ∈ N a t N a t - S u \frac{a \approx a' \in\mathrm{Nat}}{\mathrm{su}(a) \approx\mathrm{su}(a') \in\mathrm{Nat}}
\qquad\mathrm{Nat\text{-}Su} su ( a ) ≈ su ( a ′ ) ∈ Nat a ≈ a ′ ∈ Nat Nat - Su
a ′ ≈ a ∈ N a t (by IH, symmetry) a' \approx a \in\mathrm{Nat}
\qquad\text{(by IH, symmetry)} a ′ ≈ a ∈ Nat (by IH, symmetry)
s u ( a ′ ) ≈ s u ( a ) ∈ N a t (by Nat-Su) \mathrm{su}(a') \approx\mathrm{su}(a) \in\mathrm{Nat}
\qquad\text{(by Nat-Su)} su ( a ′ ) ≈ su ( a ) ∈ Nat (by Nat-Su)
Transitivity: given additionally s u ( a ′ ) ≈ s u ( a ′ ′ ) ∈ N a t \mathrm{su}(a') \approx\mathrm{su}(a'') \in\mathrm{Nat} su ( a ′ ) ≈ su ( a ′′ ) ∈ Nat (hence a ′ ≈ a ′ ′ ∈ N a t a' \approx a'' \in\mathrm{Nat} a ′ ≈ a ′′ ∈ Nat ), by the IH a ≈ a ′ ′ ∈ N a t a \approx a'' \in\mathrm{Nat} a ≈ a ′′ ∈ Nat , so s u ( a ) ≈ s u ( a ′ ′ ) ∈ N a t \mathrm{su}(a) \approx\mathrm{su}(a'') \in\mathrm{Nat} su ( a ) ≈ su ( a ′′ ) ∈ Nat .
Case
e ≈ e ′ ∈ N e ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ N a t N a t - N e \frac{e \approx e' \in\mathrm{Ne}}{\uparrow^{N}(e) \approx\uparrow^{N}(e') \in\mathrm{Nat}}
\qquad\mathrm{Nat\text{-}Ne} ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ Nat e ≈ e ′ ∈ Ne Nat - Ne
e ′ ≈ e ∈ N e (by symmetry of Ne, Theorem 6.4) e' \approx e \in\mathrm{Ne}
\qquad\text{(by symmetry of Ne, Theorem 6.4)} e ′ ≈ e ∈ Ne (by symmetry of Ne, Theorem 6.4)
↑ N ( e ′ ) ≈ ↑ N ( e ) ∈ N a t (by Nat-Ne) \uparrow^{N}(e') \approx\uparrow^{N}(e) \in\mathrm{Nat}
\qquad\text{(by Nat-Ne)} ↑ N ( e ′ ) ≈ ↑ N ( e ) ∈ Nat (by Nat-Ne)
Transitivity follows analogously from transitivity of Ne. □
Lemma 6.8 (Nat reads back correctly). If a ≈ a ′ ∈ N a t a \approx a' \in\mathrm{Nat} a ≈ a ′ ∈ Nat , then ↓ N ( a ) ≈ ↓ N ( a ′ ) ∈ N f \downarrow^{N}(a) \approx\downarrow^{N}(a') \in\mathrm{Nf} ↓ N ( a ) ≈ ↓ N ( a ′ ) ∈ Nf .
Proof. By induction on the derivation of a ≈ a ′ ∈ N a t a \approx a' \in\mathrm{Nat} a ≈ a ′ ∈ Nat .
Case
z e ≈ z e ∈ N a t N a t - Z e \frac{\mathrm{ze} \approx\mathrm{ze} \in\mathrm{Nat}}{\qquad}
\qquad\mathrm{Nat\text{-}Ze} ze ≈ ze ∈ Nat Nat - Ze
Both sides read back to zero at every level n n n , so ↓ N ( z e ) ≈ ↓ N ( z e ) ∈ N f \downarrow^{N}(\mathrm{ze}) \approx\downarrow^{N}(\mathrm{ze}) \in\mathrm{Nf} ↓ N ( ze ) ≈ ↓ N ( ze ) ∈ Nf .
Case
a ≈ a ′ ∈ N a t s u ( a ) ≈ s u ( a ′ ) ∈ N a t N a t - S u \frac{a \approx a' \in\mathrm{Nat}}{\mathrm{su}(a) \approx\mathrm{su}(a') \in\mathrm{Nat}}
\qquad\mathrm{Nat\text{-}Su} su ( a ) ≈ su ( a ′ ) ∈ Nat a ≈ a ′ ∈ Nat Nat - Su
↓ N ( a ) ≈ ↓ N ( a ′ ) ∈ N f (by IH) \downarrow^{N}(a) \approx\downarrow^{N}(a') \in\mathrm{Nf}
\qquad\text{(by IH)} ↓ N ( a ) ≈ ↓ N ( a ′ ) ∈ Nf (by IH)
∀ n . ∃ w . R n N f ( ↓ N ( a ) ) ↘ w ∧ R n N f ( ↓ N ( a ′ ) ) ↘ w (by definition of Nf) \forall n.\ \exists w.\ R^{\mathrm{Nf}}_{n}(\downarrow^{N}(a)) \searrow w \mathbin{\wedge} R^{\mathrm{Nf}}_{n}(\downarrow^{N}(a')) \searrow w
\qquad\text{(by definition of Nf)} ∀ n . ∃ w . R n Nf ( ↓ N ( a )) ↘ w ∧ R n Nf ( ↓ N ( a ′ )) ↘ w (by definition of Nf)
R n N f ( ↓ N ( s u ( a ) ) ) ↘ s u c c w ∧ R n N f ( ↓ N ( s u ( a ′ ) ) ) ↘ s u c c w (by Rf-Su) R^{\mathrm{Nf}}_{n}(\downarrow^{N}(\mathrm{su}(a))) \searrow\mathrm{succ}\ w \mathbin{\wedge} R^{\mathrm{Nf}}_{n}(\downarrow^{N}(\mathrm{su}(a'))) \searrow\mathrm{succ}\ w
\qquad\text{(by Rf-Su)} R n Nf ( ↓ N ( su ( a ))) ↘ succ w ∧ R n Nf ( ↓ N ( su ( a ′ ))) ↘ succ w (by Rf-Su)
Case
e ≈ e ′ ∈ N e ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ N a t N a t - N e \frac{e \approx e' \in\mathrm{Ne}}{\uparrow^{N}(e) \approx\uparrow^{N}(e') \in\mathrm{Nat}}
\qquad\mathrm{Nat\text{-}Ne} ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ Nat e ≈ e ′ ∈ Ne Nat - Ne
e ≈ e ′ ∈ N e (by hypothesis) e \approx e' \in\mathrm{Ne}
\qquad\text{(by hypothesis)} e ≈ e ′ ∈ Ne (by hypothesis)
∀ n . ∃ u . R n N e ( e ) ↘ u ∧ R n N e ( e ′ ) ↘ u (by definition of Ne) \forall n.\ \exists u.\ R^{\mathrm{Ne}}_{n}(e) \searrow u \mathbin{\wedge} R^{\mathrm{Ne}}_{n}(e') \searrow u
\qquad\text{(by definition of Ne)} ∀ n . ∃ u . R n Ne ( e ) ↘ u ∧ R n Ne ( e ′ ) ↘ u (by definition of Ne)
R n N f ( ↓ N ( ↑ N ( e ) ) ) ↘ u ∧ R n N f ( ↓ N ( ↑ N ( e ′ ) ) ) ↘ u (by Rf-Ne) R^{\mathrm{Nf}}_{n}(\downarrow^{N}(\uparrow^{N}(e))) \searrow u \mathbin{\wedge} R^{\mathrm{Nf}}_{n}(\downarrow^{N}(\uparrow^{N}(e'))) \searrow u
\qquad\text{(by Rf-Ne)} R n Nf ( ↓ N ( ↑ N ( e ))) ↘ u ∧ R n Nf ( ↓ N ( ↑ N ( e ′ ))) ↘ u (by Rf-Ne)
Universe PER U i \mathcal{U}_i U i
We now define the central component of the PER model: the universe PER at level i i i . Following Jang et al. [ [8 ] , the universe PER is a functional relation in Prop. The judgment
A ≈ A ′ ∈ U i ↘ R A \approx A' \in\mathcal{U}_i \searrow R A ≈ A ′ ∈ U i ↘ R
simultaneously asserts:
A A A and A ′ A' A ′ represent the “same type at level i i i ,”
R : D → D → P r o p R : \mathrm{D} \to\mathrm{D} \to\mathrm{Prop} R : D → D → Prop is the PER on elements of that type.
We first define relational equivalence: two binary relations R , R ′ R, R' R , R ′ on D are equivalent, written R ⇔ R ′ R \Leftrightarrow R' R ⇔ R ′ , when
R ⇔ R ′ : = ∀ a , a ′ . R ( a , a ′ ) ↔ R ′ ( a , a ′ ) R \Leftrightarrow R' := \forall a, a'.\; R(a,a') \leftrightarrow R'(a,a') R ⇔ R ′ := ∀ a , a ′ . R ( a , a ′ ) ↔ R ′ ( a , a ′ )
Definition 6.9 (Universe PER U i \mathcal{U}_i U i ). The relation A ≈ A ′ ∈ U i ↘ R A \approx A' \in\mathcal{U}_i \searrow R A ≈ A ′ ∈ U i ↘ R is defined inductively by the following four cases. The returned R R R is unique only up to ⇔ \Leftrightarrow ⇔ (not definitional equality).
b ≈ b ′ ∈ N e R ⇔ N e u ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R \frac{b \approx b' \in\mathrm{Ne} \qquad R \Leftrightarrow\mathrm{Neu}}{\uparrow^{A}(b) \approx\uparrow^{A'}(b') \in\mathcal{U}_i \searrow R} ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R b ≈ b ′ ∈ Ne R ⇔ Neu j < i R ⇔ U j U j ≈ U j ∈ U i ↘ R \frac{j < i \qquad R \Leftrightarrow\mathcal{U}_j}{\mathcal{U}_j \approx\mathcal{U}_j \in\mathcal{U}_i \searrow R} U j ≈ U j ∈ U i ↘ R j < i R ⇔ U j R ⇔ N a t N ≈ N ∈ U i ↘ R \frac{R \Leftrightarrow\mathrm{Nat}}{N \approx N \in\mathcal{U}_i \searrow R} N ≈ N ∈ U i ↘ R R ⇔ Nat A ≈ A ′ ∈ U i ↘ R I R I is a PER ∀ D : : a ≈ a ′ ∈ R I . ⟦ T ⟧ ( ρ , a / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ↔ ( ∀ D : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) ) Π ( A , T , ρ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i ↘ R \frac{\begin{gathered}
A \approx A' \in\mathcal{U}_i \searrow R_I \qquad R_I\text{ is a PER}\\
\forall\mathcal{D} :: a \approx a' \in R_I.\; \llbracket T\rrbracket(\rho,a/x) \approx\llbracket T'\rrbracket(\rho',a'/x) \in\mathcal{U}_i \searrow R_O(\mathcal{D})\\
\forall f,f'.\; f \approx f' \in R \leftrightarrow(\forall\mathcal{D} :: a \approx a' \in R_I.\; f\mathbin{\cdot}a \approx f'\mathbin{\cdot}a' \in R_O(\mathcal{D}))
\end{gathered}}{\Pi(A,T,\rho) \approx\Pi(A',T',\rho') \in\mathcal{U}_i \searrow R} Π ( A , T , ρ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i ↘ R A ≈ A ′ ∈ U i ↘ R I R I is a PER ∀ D :: a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) ≈ [ [ T ′ ] ] ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ↔ ( ∀ D :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ))
In the U-Pi case, Π ( A , T , ρ ) \Pi(A,T,\rho) Π ( A , T , ρ ) is the closure form: the codomain fiber at input b b b is obtained by evaluating T T T in ( ρ , b / x ) (\rho,b/x) ( ρ , b / x ) . The notation D : : a ≈ a ′ ∈ R I \mathcal{D} :: a \approx a' \in R_I D :: a ≈ a ′ ∈ R I means that D \mathcal{D} D is the proof/evidence that a ≈ a ′ ∈ R I a \approx a' \in R_I a ≈ a ′ ∈ R I holds; R O ( D ) R_O(\mathcal{D}) R O ( D ) may depend on this evidence. The fourth premise characterizes R R R as the PER on functions: f , f ′ f,f' f , f ′ are related in R R R if and only if applying them to related inputs yields related outputs. We write f ⋅ a f \mathbin{\cdot} a f ⋅ a for semantic application (i.e., there exists c c c with f ⋅ a ↘ c f \mathbin{\cdot} a \searrow c f ⋅ a ↘ c , and c c c participates in R O ( D ) R_O(\mathcal{D}) R O ( D ) ).
Let us explain each case:
U-Ne: A neutral type code ↑ A ( e ) \uparrow^{A}(e) ↑ A ( e ) is related to another ↑ A ′ ( e ′ ) \uparrow^{A'}(e') ↑ A ′ ( e ′ ) whenever the underlying neutrals are related in Ne. The type annotations A , A ′ A,A' A , A ′ are arbitrary and play no role. The returned PER is Neu: elements of an unknown (neutral) type are related when they are neutrals that read back identically.
U-Univ: The universe U j \mathcal{U}_j U j (with j < i j < i j < i ) is related to itself. The returned PER says that two values are related as elements of U j \mathcal{U}_j U j when they are themselves related type codes at level j j j . The “element PER” for a universe is defined in terms of the universe PER at a lower level.
U-Nat: The natural number type N N N is related to itself, returning the PER Nat defined in Theorem 6.6.
U-Pi: A Π \Pi Π -type Π ( A , T , ρ ) \Pi(A,T,\rho) Π ( A , T , ρ ) is related to Π ( A ′ , T ′ , ρ ′ ) \Pi(A',T',\rho') Π ( A ′ , T ′ , ρ ′ ) when: (i) the domains are related in U i \mathcal{U}_i U i returning some PER R I R_I R I which is itself a PER, (ii) for all evidence D : : a ≈ a ′ ∈ R I \mathcal{D} :: a \approx a' \in R_I D :: a ≈ a ′ ∈ R I , the codomain evaluations ⟦ T ⟧ ( ρ , a / x ) \llbracket T\rrbracket(\rho,a/x) [ [ T ] ] ( ρ , a / x ) and ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) \llbracket T'\rrbracket(\rho',a'/x) [ [ T ′ ] ] ( ρ ′ , a ′ / x ) are related in U i \mathcal{U}_i U i returning some PER R O ( D ) R_O(\mathcal{D}) R O ( D ) , and (iii) the returned R R R is characterized by the biconditional: f ≈ f ′ ∈ R f \approx f' \in R f ≈ f ′ ∈ R iff applying to all related inputs yields related outputs in the codomain PER.
Remark. Several points deserve emphasis:
The returned R R R in each case is specified only up to ⇔ \Leftrightarrow ⇔ . This makes U i \mathcal{U}_i U i a weak partial functional relation, avoiding the need for propositional or functional extensionality.
(2) The premise “R I R_I R I is a PER” in U-Pi strengthens the induction principle: it allows proving that returned PERs are PERs without extra axioms. Once symmetry and transitivity of the returned PER are established (see below), the premise becomes logically redundant but is needed for the induction to go through.
Cumulativity
Lemma 6.10 (Cumulativity). If A ≈ A ′ ∈ U i ↘ R A \approx A' \in\mathcal{U}_i \searrow R A ≈ A ′ ∈ U i ↘ R and i ≤ j i \le j i ≤ j , then A ≈ A ′ ∈ U j ↘ R A \approx A' \in\mathcal{U}_j \searrow R A ≈ A ′ ∈ U j ↘ R .
Proof. By induction on the derivation of A ≈ A ′ ∈ U i ↘ R A \approx A' \in\mathcal{U}_i \searrow R A ≈ A ′ ∈ U i ↘ R .
Case
U-Ne b ≈ b ′ ∈ N e R ⇔ N e u ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R \begin{gathered}
\text{U-Ne}\\
b \approx b' \in\mathrm{Ne}\qquad R \Leftrightarrow\mathrm{Neu}\\
\hline
\uparrow^{A}(b) \approx\uparrow^{A'}(b') \in\mathcal{U}_i \searrow R
\end{gathered} U-Ne b ≈ b ′ ∈ Ne R ⇔ Neu ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R
The same derivation works at level j j j (neutrals are level-independent): ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U j ↘ R \uparrow^{A}(b) \approx\uparrow^{A'}(b') \in\mathcal{U}_j \searrow R ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U j ↘ R by U-Ne.
Case
U-Univ k < i R ⇔ U k U k ≈ U k ∈ U i ↘ R \begin{gathered}
\text{U-Univ}\\
k < i\qquad R \Leftrightarrow\mathcal{U}_k\\
\hline
\mathcal{U}_k \approx\mathcal{U}_k \in\mathcal{U}_i \searrow R
\end{gathered} U-Univ k < i R ⇔ U k U k ≈ U k ∈ U i ↘ R
k < i ≤ j (by hypothesis) U k ≈ U k ∈ U j ↘ R (by U-Univ, since k < j ) \begin{aligned}
k < i \le j &&& \text{(by hypothesis)}\\
\mathcal{U}_k \approx\mathcal{U}_k \in\mathcal{U}_j \searrow R &&& \text{(by U-Univ, since } k < j\text{)}
\end{aligned} k < i ≤ j U k ≈ U k ∈ U j ↘ R (by hypothesis) (by U-Univ, since k < j )
Case
U-Nat R ⇔ N a t N ≈ N ∈ U i ↘ R \begin{gathered}
\text{U-Nat}\\
R \Leftrightarrow\mathrm{Nat}\\
\hline
N \approx N \in\mathcal{U}_i \searrow R
\end{gathered} U-Nat R ⇔ Nat N ≈ N ∈ U i ↘ R
Level-independent: N ≈ N ∈ U j ↘ R N \approx N \in\mathcal{U}_j \searrow R N ≈ N ∈ U j ↘ R by U-Nat.
Case
U-Pi A ≈ A ′ ∈ U i ↘ R I R I is a PER ∀ D : : a ≈ a ′ ∈ R I . ⟦ T ⟧ ( ρ , a / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⟺ ( ∀ D : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) ) Π ( A , T , ρ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i ↘ R \begin{gathered}
\text{U-Pi}\\
A \approx A' \in\mathcal{U}_i \searrow R_I \qquad R_I\text{ is a PER}\\
\forall D :: a \approx a' \in R_I.\ \llbracket T \rrbracket(\rho,a/x) \approx\llbracket T' \rrbracket(\rho',a'/x) \in\mathcal{U}_i \searrow R_O(D)\\
\forall f,f'.\ f \approx f' \in R \Longleftrightarrow(\forall D :: a \approx a' \in R_I.\ f \mathbin{\cdot} a \approx f' \mathbin{\cdot} a' \in R_O(D))\\
\hline
\Pi(A,T,\rho) \approx\Pi(A',T',\rho') \in\mathcal{U}_i \searrow R
\end{gathered} U-Pi A ≈ A ′ ∈ U i ↘ R I R I is a PER ∀ D :: a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) ≈ [ [ T ′ ] ] ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⟺ ( ∀ D :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D )) Π ( A , T , ρ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i ↘ R
A ≈ A ′ ∈ U j ↘ R I (by IH on domain) ∀ D : : a ≈ a ′ ∈ R I . ⟦ T ⟧ ( ρ , a / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) ∈ U j ↘ R O ( D ) (by IH on codomain) Π ( A , T , ρ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U j ↘ R (by U-Pi) \begin{aligned}
A \approx A' \in\mathcal{U}_j \searrow R_I &&& \text{(by IH on domain)}\\
\forall D :: a \approx a' \in R_I.\ \llbracket T \rrbracket(\rho,a/x) \approx\llbracket T' \rrbracket(\rho',a'/x) \in\mathcal{U}_j \searrow R_O(D) &&& \text{(by IH on codomain)}\\
\Pi(A,T,\rho) \approx\Pi(A',T',\rho') \in\mathcal{U}_j \searrow R &&& \text{(by U-Pi)}
\end{aligned} A ≈ A ′ ∈ U j ↘ R I ∀ D :: a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) ≈ [ [ T ′ ] ] ( ρ ′ , a ′ / x ) ∈ U j ↘ R O ( D ) Π ( A , T , ρ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U j ↘ R (by IH on domain) (by IH on codomain) (by U-Pi)
Semantic Subtyping
Semantic subtyping at level i i i is defined as an inductive relation A < : i A ′ A <:_{i} A' A < : i A ′ that mirrors the syntactic subtyping judgment.
Definition 6.11 (Semantic Subtyping < : i <:_{i} < : i ). The relation A < : i A ′ A <:_{i} A' A < : i A ′ is defined inductively by:
b ≈ b ′ ∈ N e ↑ A ( b ) < : i ↑ A ′ ( b ′ ) < : -Ne \frac{b \approx b' \in\mathrm{Ne}}{\uparrow^{A}(b) <:_{i} \uparrow^{A'}(b')} \quad{<:}\text{-Ne} ↑ A ( b ) < : i ↑ A ′ ( b ′ ) b ≈ b ′ ∈ Ne <: -Ne j ≤ k k < i U j < : i U k < : -Univ \frac{j \leq k \qquad k < i}{U_{j} <:_{i} U_{k}} \quad{<:}\text{-Univ} U j < : i U k j ≤ k k < i <: -Univ N < : i N < : -Nat \frac{}{N <:_{i} N} \quad{<:}\text{-Nat} N < : i N <: -Nat A ≈ A ′ ∈ U i ↘ R I ∀ D : : a ≈ a ′ ∈ R I . ⟦ T ⟧ ( ρ , a / x ) < : i ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) Π ( A , T , ρ ) ≈ Π ( A , T , ρ ) ∈ U i Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i Π ( A , T , ρ ) < : i Π ( A ′ , T ′ , ρ ′ ) < : -Pi \frac{
\begin{gathered}
A \approx A' \in U_{i} \searrow R_{I}
\qquad
\forall D :: a \approx a' \in R_{I}.\ \llbracket T \rrbracket(\rho,a/x) <:_{i} \llbracket T' \rrbracket(\rho',a'/x)\\
\Pi(A,T,\rho) \approx\Pi(A,T,\rho) \in U_{i}
\qquad
\Pi(A',T',\rho') \approx\Pi(A',T',\rho') \in U_{i}
\end{gathered}
}{
\Pi(A,T,\rho) <:_{i} \Pi(A',T',\rho')
}
\quad{<:}\text{-Pi} Π ( A , T , ρ ) < : i Π ( A ′ , T ′ , ρ ′ ) A ≈ A ′ ∈ U i ↘ R I ∀ D :: a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) < : i [ [ T ′ ] ] ( ρ ′ , a ′ / x ) Π ( A , T , ρ ) ≈ Π ( A , T , ρ ) ∈ U i Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i <: -Pi
The key properties of semantic subtyping:
< : <: <: -Ne: Neutral types are subtypes when their neutrals are related.
< : <: <: -Univ: U j < : i U k U_{j} <:_{i} U_{k} U j < : i U k whenever j ≤ k < i j \leq k < i j ≤ k < i , reflecting cumulative universes.
< : <: <: -Nat: N N N is a subtype of itself (natural numbers are invariant).
< : <: <: -Pi: Π \Pi Π -types are covariant in the codomain: the domains must be equal (related in U i U_{i} U i ) while the codomain fibers satisfy subtyping pointwise for all related inputs.
Properties of U i U_{i} U i
We establish the key structural properties of the universe PER.
U i U_{i} U i is a PER (Functionality).
Lemma 6.12 (Right irrelevance of U i U_{i} U i ). If A ≈ B ∈ U i ↘ R A \approx B \in U_{i} \searrow R A ≈ B ∈ U i ↘ R and A ≈ B ′ ∈ U j ↘ R ′ A \approx B' \in U_{j} \searrow R' A ≈ B ′ ∈ U j ↘ R ′ , then R ⇔ R ′ R \Leftrightarrow R' R ⇔ R ′ .
Proof. By induction on the two derivations simultaneously. The cases are forced: N N N can only match U-Nat, a neutral can only match U-Ne, etc.
Case U-Ne.
b ≈ b ′ ∈ N e R ⇔ N e u ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R \frac{b \approx b' \in\mathrm{Ne} \qquad R \Leftrightarrow\mathrm{Neu}}{\uparrow^{A}(b) \approx\uparrow^{A'}(b') \in U_{i} \searrow R} ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R b ≈ b ′ ∈ Ne R ⇔ Neu
Both derivations force R ⇔ N e u R \Leftrightarrow\mathrm{Neu} R ⇔ Neu and R ′ ⇔ N e u R' \Leftrightarrow\mathrm{Neu} R ′ ⇔ Neu , so R ⇔ R ′ R \Leftrightarrow R' R ⇔ R ′ .
Case U-Nat. Both derivations force R ⇔ N a t R \Leftrightarrow\mathrm{Nat} R ⇔ Nat and R ′ ⇔ N a t R' \Leftrightarrow\mathrm{Nat} R ′ ⇔ Nat , so R ⇔ R ′ R \Leftrightarrow R' R ⇔ R ′ .
Case U-Univ. Both derivations force R ⇔ U j R \Leftrightarrow U_{j} R ⇔ U j and R ′ ⇔ U j R' \Leftrightarrow U_{j} R ′ ⇔ U j , so R ⇔ R ′ R \Leftrightarrow R' R ⇔ R ′ .
Case U-Pi.
A ≈ A ′ ∈ U i ↘ R I R I is a PER ∀ D : : a ≈ a ′ ∈ R I . ⟦ T ⟧ ( ρ , a / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) ) Π ( A , T , ρ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i ↘ R \frac{
\begin{gathered}
A \approx A' \in U_{i} \searrow R_{I}
\qquad
R_{I}\text{ is a PER}\\
\forall D :: a \approx a' \in R_{I}.\ \llbracket T \rrbracket(\rho,a/x) \approx\llbracket T' \rrbracket(\rho',a'/x) \in U_{i} \searrow R_{O}(D)\\
\forall f,f'.\ f \approx f' \in R \Leftrightarrow(\forall D :: a \approx a' \in R_{I}.\ f \mathbin{\cdot} a \approx f' \mathbin{\cdot} a' \in R_{O}(D))
\end{gathered}
}{
\Pi(A,T,\rho) \approx\Pi(A',T',\rho') \in U_{i} \searrow R
} Π ( A , T , ρ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i ↘ R A ≈ A ′ ∈ U i ↘ R I R I is a PER ∀ D :: a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) ≈ [ [ T ′ ] ] ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ))
From the second derivation we get R I ′ R'_{I} R I ′ with A ≈ A ′ ∈ U i ↘ R I ′ A \approx A' \in U_{i} \searrow R'_{I} A ≈ A ′ ∈ U i ↘ R I ′ .
R I ⇔ R I ′ (by IH on domain) R_{I} \Leftrightarrow R'_{I}
\qquad\text{(by IH on domain)} R I ⇔ R I ′ (by IH on domain)
\begin{aligned}
\forall D :: a \approx a' \in R_I.\ R_O(D) \Leftrightarrow R'_O(D) &\qquad\text{(by IH on codomain at each input)}\\
R &\Leftrightarrow R' \qquad\text{(by the biconditional characterizations and transitivity of \Leftrightarrow)}
\end{aligned}
Lemma 6.13 (Symmetry of U i \mathcal{U}_i U i ). If A ≈ A ′ ∈ U i ↘ R A \approx A' \in\mathcal{U}_i \searrow R A ≈ A ′ ∈ U i ↘ R , then:
(1) A ′ ≈ A ∈ U i ↘ R A' \approx A \in\mathcal{U}_i \searrow R A ′ ≈ A ∈ U i ↘ R , and
(2) a ≈ a ′ ∈ R a \approx a' \in R a ≈ a ′ ∈ R implies a ′ ≈ a ∈ R a' \approx a \in R a ′ ≈ a ∈ R .
Proof. By induction on the derivation. We prove both statements simultaneously.
Case
U-Ne b ≈ b ′ ∈ N e R ⇔ N e u ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R \frac{\begin{gathered}
\text{U-Ne}\\
b \approx b' \in\mathrm{Ne}\qquad R \Leftrightarrow\mathrm{Neu}\\
\end{gathered}}
{\uparrow^{A}(b) \approx\uparrow^{A'}(b') \in\mathcal{U}_i \searrow R} ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R U-Ne b ≈ b ′ ∈ Ne R ⇔ Neu
For (1):
b ′ ≈ b ∈ N e (by symmetry of Ne) b' \approx b \in\mathrm{Ne}
\qquad\text{(by symmetry of Ne)} b ′ ≈ b ∈ Ne (by symmetry of Ne)
↑ A ′ ( b ′ ) ≈ ↑ A ( b ) ∈ U i ↘ R (by U-Ne) \uparrow^{A'}(b') \approx\uparrow^{A}(b) \in\mathcal{U}_i \searrow R
\qquad\text{(by U-Ne)} ↑ A ′ ( b ′ ) ≈ ↑ A ( b ) ∈ U i ↘ R (by U-Ne)
For (2): Suppose a ≈ a ′ ∈ R a \approx a' \in R a ≈ a ′ ∈ R , i.e. a ≈ a ′ ∈ N e u a \approx a' \in\mathrm{Neu} a ≈ a ′ ∈ Neu (since R ⇔ N e u R \Leftrightarrow\mathrm{Neu} R ⇔ Neu ). Then a = ↑ B ( e ) a = \uparrow^{B}(e) a = ↑ B ( e ) and a ′ = ↑ B ′ ( e ′ ) a' = \uparrow^{B'}(e') a ′ = ↑ B ′ ( e ′ ) with e ≈ e ′ ∈ N e e \approx e' \in\mathrm{Ne} e ≈ e ′ ∈ Ne . By symmetry of Ne, e ′ ≈ e ∈ N e e' \approx e \in\mathrm{Ne} e ′ ≈ e ∈ Ne , so a ′ ≈ a ∈ N e u a' \approx a \in\mathrm{Neu} a ′ ≈ a ∈ Neu , i.e. a ′ ≈ a ∈ R a' \approx a \in R a ′ ≈ a ∈ R .
Case
U-Univ j < i R ⇔ U j U j ≈ U j ∈ U i ↘ R \frac{\begin{gathered}
\text{U-Univ}\\
j < i\qquad R \Leftrightarrow\mathcal{U}_j
\end{gathered}}
{\mathcal{U}_j \approx\mathcal{U}_j \in\mathcal{U}_i \searrow R} U j ≈ U j ∈ U i ↘ R U-Univ j < i R ⇔ U j
For (1): Immediate (U j ≈ U j \mathcal{U}_j \approx\mathcal{U}_j U j ≈ U j is symmetric).
For (2): Suppose a ≈ a ′ ∈ R a \approx a' \in R a ≈ a ′ ∈ R , i.e. a ≈ a ′ ∈ U j ↘ R 0 a \approx a' \in\mathcal{U}_j \searrow R_0 a ≈ a ′ ∈ U j ↘ R 0 for some R 0 R_0 R 0 . By the IH at level j j j (which is structurally smaller), a ′ ≈ a ∈ U j ↘ R 0 a' \approx a \in\mathcal{U}_j \searrow R_0 a ′ ≈ a ∈ U j ↘ R 0 , so a ′ ≈ a ∈ R a' \approx a \in R a ′ ≈ a ∈ R .
Case
U-Nat R ⇔ N a t N ≈ N ∈ U i ↘ R \frac{\begin{gathered}
\text{U-Nat}\\
R \Leftrightarrow\mathrm{Nat}
\end{gathered}}
{N \approx N \in\mathcal{U}_i \searrow R} N ≈ N ∈ U i ↘ R U-Nat R ⇔ Nat
For (1): Immediate.
For (2): Suppose a ≈ a ′ ∈ R a \approx a' \in R a ≈ a ′ ∈ R , i.e. a ≈ a ′ ∈ N a t a \approx a' \in\mathrm{Nat} a ≈ a ′ ∈ Nat . By symmetry of Nat (Theorem 6.7), a ′ ≈ a ∈ N a t a' \approx a \in\mathrm{Nat} a ′ ≈ a ∈ Nat , so a ′ ≈ a ∈ R a' \approx a \in R a ′ ≈ a ∈ R .
Case
U-Pi A ≈ A ′ ∈ U i ↘ R I R I is a PER ∀ D : : a ≈ a ′ ∈ R I . ⟦ T ⟧ ( ρ , a / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) ) Π ( A , T , ρ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i ↘ R \frac{\begin{gathered}
\text{U-Pi}\\
A \approx A' \in\mathcal{U}_i \searrow R_I\qquad R_I\text{ is a PER}\\
\forall D :: a \approx a' \in R_I.\ \llbracket T\rrbracket(\rho,a/x) \approx\llbracket T'\rrbracket(\rho',a'/x) \in\mathcal{U}_i \searrow R_O(D)\\
\forall f,f'.\ f \approx f' \in R \Leftrightarrow(\forall D :: a \approx a' \in R_I.\ f\mathbin{\cdot}a \approx f'\mathbin{\cdot}a' \in R_O(D))
\end{gathered}}
{\Pi(A,T,\rho) \approx\Pi(A',T',\rho') \in\mathcal{U}_i \searrow R} Π ( A , T , ρ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i ↘ R U-Pi A ≈ A ′ ∈ U i ↘ R I R I is a PER ∀ D :: a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) ≈ [ [ T ′ ] ] ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ))
For (1): We construct a U-Pi derivation of Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A , T , ρ ) ∈ U i ↘ R \Pi(A',T',\rho') \approx\Pi(A,T,\rho) \in\mathcal{U}_i \searrow R Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A , T , ρ ) ∈ U i ↘ R . We verify the four premises.
<u>Premise 1</u> (domain):
A ′ ≈ A ∈ U i ↘ R I (by IH (1) on domain; same R I by Theorem 6.12) A' \approx A \in\mathcal{U}_i \searrow R_I
\qquad\text{(by IH (1) on domain; same \(R_I\) by Theorem 6.12)} A ′ ≈ A ∈ U i ↘ R I (by IH (1) on domain; same R I by Theorem 6.12)
Premise 2: R I R_I R I is a PER (by hypothesis).
Premise 3 (codomain): Let D ′ : : a ′ ≈ a ∈ R I D' :: a' \approx a \in R_I D ′ :: a ′ ≈ a ∈ R I .
a ≈ a ′ ∈ R I a \approx a' \in R_I a ≈ a ′ ∈ R I
(by symmetry of R I R_I R I ; call this D 0 D_0 D 0 )
⟦ T ⟧ ( ρ , a / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D 0 ) \llbracket T \rrbracket(\rho, a/x) \approx\llbracket T' \rrbracket(\rho', a'/x) \in U_i \searrow R_O(D_0) [ [ T ] ] ( ρ , a / x ) ≈ [ [ T ′ ] ] ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D 0 )
(original codomain premise at D 0 D_0 D 0 )
⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) ≈ ⟦ T ⟧ ( ρ , a / x ) ∈ U i ↘ R O ( D 0 ) \llbracket T' \rrbracket(\rho', a'/x) \approx\llbracket T \rrbracket(\rho, a/x) \in U_i \searrow R_O(D_0) [ [ T ′ ] ] ( ρ ′ , a ′ / x ) ≈ [ [ T ] ] ( ρ , a / x ) ∈ U i ↘ R O ( D 0 )
(by IH (1) on codomain; same R O ( D 0 ) R_O(D_0) R O ( D 0 ) returned)
Define R O ′ ( D ′ ) : = R O ( D 0 ) R'_O(D') := R_O(D_0) R O ′ ( D ′ ) := R O ( D 0 ) .
Premise 4 (biconditional): We must show
∀ f , f ′ . f ≈ f ′ ∈ R ↔ ( ∀ D ′ : : a ′ ≈ a ∈ R I . f ⋅ a ′ ≈ f ′ ⋅ a ∈ R O ′ ( D ′ ) ) \forall f,f'.\ f \approx f' \in R \leftrightarrow(\forall D' :: a' \approx a \in R_I.\ f \cdot a' \approx f' \cdot a \in R'_O(D')) ∀ f , f ′ . f ≈ f ′ ∈ R ↔ ( ∀ D ′ :: a ′ ≈ a ∈ R I . f ⋅ a ′ ≈ f ′ ⋅ a ∈ R O ′ ( D ′ ))
Since R I R_I R I is a PER, the set of pairs { ( a , a ′ ) ∣ a ≈ a ′ ∈ R I } \{(a,a') \mid a \approx a' \in R_I\} {( a , a ′ ) ∣ a ≈ a ′ ∈ R I } is closed under swapping: ( a , a ′ ) ∈ R I (a,a') \in R_I ( a , a ′ ) ∈ R I iff ( a ′ , a ) ∈ R I (a',a) \in R_I ( a ′ , a ) ∈ R I . By right irrelevance (Theorem 6.12), R O ( D ) R_O(D) R O ( D ) depends only on the pair ( a , a ′ ) (a,a') ( a , a ′ ) , not the specific evidence D D D . Hence the right-hand side “∀ D ′ : : a ′ ≈ a ∈ R I . f ⋅ a ′ ≈ f ′ ⋅ a ∈ R O ′ ( D ′ ) \forall D' :: a' \approx a \in R_I.\ f \cdot a' \approx f' \cdot a \in R'_O(D') ∀ D ′ :: a ′ ≈ a ∈ R I . f ⋅ a ′ ≈ f ′ ⋅ a ∈ R O ′ ( D ′ ) ” is, after renaming bound variables ( a ′ ↦ b , a ↦ b ′ ) (a' \mapsto b, a \mapsto b') ( a ′ ↦ b , a ↦ b ′ ) , equivalent to “∀ D ′ ′ : : b ≈ b ′ ∈ R I . f ⋅ b ≈ f ′ ⋅ b ′ ∈ R O ( D ′ ′ ) \forall D'' :: b \approx b' \in R_I.\ f \cdot b \approx f' \cdot b' \in R_O(D'') ∀ D ′′ :: b ≈ b ′ ∈ R I . f ⋅ b ≈ f ′ ⋅ b ′ ∈ R O ( D ′′ ) ” which is exactly the original right-hand side. Therefore the same R R R satisfies both biconditionals.
Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A , T , ρ ) ∈ U i ↘ R \Pi(A',T',\rho') \approx\Pi(A,T,\rho) \in U_i \searrow R Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A , T , ρ ) ∈ U i ↘ R
(by U-Pi)
For (2): Suppose f ≈ f ′ ∈ R f \approx f' \in R f ≈ f ′ ∈ R . We must show f ′ ≈ f ∈ R f' \approx f \in R f ′ ≈ f ∈ R , i.e. for all D : : a ≈ a ′ ∈ R I D :: a \approx a' \in R_I D :: a ≈ a ′ ∈ R I , f ′ ⋅ a ≈ f ⋅ a ′ ∈ R O ( D ) f' \cdot a \approx f \cdot a' \in R_O(D) f ′ ⋅ a ≈ f ⋅ a ′ ∈ R O ( D ) .
a ′ ≈ a ∈ R I a' \approx a \in R_I a ′ ≈ a ∈ R I
(by symmetry of R I R_I R I )
let D ′ : : a ′ ≈ a ∈ R I \text{let }D' :: a' \approx a \in R_I let D ′ :: a ′ ≈ a ∈ R I
f ⋅ a ′ ≈ f ′ ⋅ a ∈ R O ( D ′ ) f \cdot a' \approx f' \cdot a \in R_O(D') f ⋅ a ′ ≈ f ′ ⋅ a ∈ R O ( D ′ )
(from f ≈ f ′ ∈ R f \approx f' \in R f ≈ f ′ ∈ R , applied to D ′ D' D ′ )
R O ( D ) ⇔ R O ( D ′ ) R_O(D) \Leftrightarrow R_O(D') R O ( D ) ⇔ R O ( D ′ )
(by Theorem 6.12: both have same left type ⟦ T ⟧ ( ρ , a / x ) \llbracket T \rrbracket(\rho,a/x) [ [ T ] ] ( ρ , a / x ) )
f ′ ⋅ a ≈ f ⋅ a ′ ∈ R O ( D ′ ) f' \cdot a \approx f \cdot a' \in R_O(D') f ′ ⋅ a ≈ f ⋅ a ′ ∈ R O ( D ′ )
(by IH (2) on R O ( D ′ ) R_O(D') R O ( D ′ ) )
f ′ ⋅ a ≈ f ⋅ a ′ ∈ R O ( D ) f' \cdot a \approx f \cdot a' \in R_O(D) f ′ ⋅ a ≈ f ⋅ a ′ ∈ R O ( D )
(by R O ( D ) ⇔ R O ( D ′ ) R_O(D) \Leftrightarrow R_O(D') R O ( D ) ⇔ R O ( D ′ ) )
Lemma 6.14 (Transitivity of U i U_i U i ). If A 1 ≈ A 2 ∈ U i ↘ R A_1 \approx A_2 \in U_i \searrow R A 1 ≈ A 2 ∈ U i ↘ R , then:
(1) A 2 ≈ A 3 ∈ U j ↘ R ′ A_2 \approx A_3 \in U_j \searrow R' A 2 ≈ A 3 ∈ U j ↘ R ′ implies A 1 ≈ A 3 ∈ U i ↘ R A_1 \approx A_3 \in U_i \searrow R A 1 ≈ A 3 ∈ U i ↘ R , and
(2) a 1 ≈ a 2 ∈ R a_1 \approx a_2 \in R a 1 ≈ a 2 ∈ R and a 2 ≈ a 3 ∈ R a_2 \approx a_3 \in R a 2 ≈ a 3 ∈ R implies a 1 ≈ a 3 ∈ R a_1 \approx a_3 \in R a 1 ≈ a 3 ∈ R .
Proof. By induction on the two derivations. We must case-split on both; by the structure of the definition, matching cases are forced (e.g., N N N can only relate to N N N ).
Case U-Ne.
U-Ne b ≈ b ′ ∈ N e R R ⇔ N e u ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R \begin{aligned}
&\text{U-Ne}\\
&b \approx b' \in\mathrm{Ne}\ R \qquad R \Leftrightarrow\mathrm{Neu}\\
&\quad\uparrow^{A}(b) \approx\uparrow^{A'}(b') \in U_i \searrow R
\end{aligned} U-Ne b ≈ b ′ ∈ Ne R R ⇔ Neu ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R
and
U-Ne b ′ ≈ b ′ ′ ∈ N e R ′ R ′ ⇔ N e u ↑ A ′ ( b ′ ) ≈ ↑ A ′ ′ ( b ′ ′ ) ∈ U i ↘ R ′ \begin{aligned}
&\text{U-Ne}\\
&b' \approx b'' \in\mathrm{Ne}\ R' \qquad R' \Leftrightarrow\mathrm{Neu}\\
&\quad\uparrow^{A'}(b') \approx\uparrow^{A''}(b'') \in U_i \searrow R'
\end{aligned} U-Ne b ′ ≈ b ′′ ∈ Ne R ′ R ′ ⇔ Neu ↑ A ′ ( b ′ ) ≈ ↑ A ′′ ( b ′′ ) ∈ U i ↘ R ′
b ≈ b ′ ′ ∈ N e b \approx b'' \in\mathrm{Ne} b ≈ b ′′ ∈ Ne
(by transitivity of Ne)
↑ A ( b ) ≈ ↑ A ′ ′ ( b ′ ′ ) ∈ U i ↘ R \uparrow^{A}(b) \approx\uparrow^{A''}(b'') \in U_i \searrow R ↑ A ( b ) ≈ ↑ A ′′ ( b ′′ ) ∈ U i ↘ R
(by U-Ne)
:::
R ⇔ Neu ⇔ R ′ R \Leftrightarrow\operatorname{Neu} \Leftrightarrow R' R ⇔ Neu ⇔ R ′
(hence R ⇔ R ′ R \Leftrightarrow R' R ⇔ R ′ )
Case U-Nat and U-Univ: immediate.
Case U-Pi. The first derivation is:
U - P i A 1 ≈ A 2 ∈ U i ↘ R I R I is a PER ∀ D : : a ≈ a ′ ∈ R I . ⟦ T 1 ⟧ ( ρ 1 , a / x ) ≈ ⟦ T 2 ⟧ ( ρ 2 , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) ) Π ( A 1 , T 1 , ρ 1 ) ≈ Π ( A 2 , T 2 , ρ 2 ) ∈ U i ↘ R \begin{gathered}
\mathrm{U\text{-}Pi}\\
A_1 \approx A_2 \in\mathcal{U}_i \searrow R_I \qquad R_I\text{ is a PER}\\
\forall\mathcal{D}::a\approx a'\in R_I.\ \llbracket T_1\rrbracket(\rho_1,a/x)\approx\llbracket T_2\rrbracket(\rho_2,a'/x)\in\mathcal{U}_i\searrow R_O(\mathcal{D})\\
\forall f,f'.\ f\approx f'\in R\Leftrightarrow(\forall\mathcal{D}::a\approx a'\in R_I.\ f\cdot a\approx f'\cdot a'\in R_O(\mathcal{D}))\\
\Pi(A_1,T_1,\rho_1)\approx\Pi(A_2,T_2,\rho_2)\in\mathcal{U}_i\searrow R
\end{gathered} U - Pi A 1 ≈ A 2 ∈ U i ↘ R I R I is a PER ∀ D :: a ≈ a ′ ∈ R I . [ [ T 1 ] ] ( ρ 1 , a / x ) ≈ [ [ T 2 ] ] ( ρ 2 , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D )) Π ( A 1 , T 1 , ρ 1 ) ≈ Π ( A 2 , T 2 , ρ 2 ) ∈ U i ↘ R
The second derivation is:
U - P i A 2 ≈ A 3 ∈ U j ↘ R I ′ R I ′ is a PER ∀ D ′ : : a ≈ a ′ ∈ R I ′ . ⟦ T 2 ⟧ ( ρ 2 , a / x ) ≈ ⟦ T 3 ⟧ ( ρ 3 , a ′ / x ) ∈ U j ↘ R O ′ ( D ′ ) ∀ f , f ′ . f ≈ f ′ ∈ R ′ ⇔ ( ∀ D ′ : : a ≈ a ′ ∈ R I ′ . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ′ ( D ′ ) ) Π ( A 2 , T 2 , ρ 2 ) ≈ Π ( A 3 , T 3 , ρ 3 ) ∈ U j ↘ R ′ \begin{gathered}
\mathrm{U\text{-}Pi}\\
A_2\approx A_3\in\mathcal{U}_j\searrow R'_I \qquad R'_I\text{ is a PER}\\
\forall\mathcal{D}'::a\approx a'\in R'_I.\ \llbracket T_2\rrbracket(\rho_2,a/x)\approx\llbracket T_3\rrbracket(\rho_3,a'/x)\in\mathcal{U}_j\searrow R'_O(\mathcal{D}')\\
\forall f,f'.\ f\approx f'\in R'\Leftrightarrow(\forall\mathcal{D}'::a\approx a'\in R'_I.\ f\cdot a\approx f'\cdot a'\in R'_O(\mathcal{D}'))\\
\Pi(A_2,T_2,\rho_2)\approx\Pi(A_3,T_3,\rho_3)\in\mathcal{U}_j\searrow R'
\end{gathered} U - Pi A 2 ≈ A 3 ∈ U j ↘ R I ′ R I ′ is a PER ∀ D ′ :: a ≈ a ′ ∈ R I ′ . [ [ T 2 ] ] ( ρ 2 , a / x ) ≈ [ [ T 3 ] ] ( ρ 3 , a ′ / x ) ∈ U j ↘ R O ′ ( D ′ ) ∀ f , f ′ . f ≈ f ′ ∈ R ′ ⇔ ( ∀ D ′ :: a ≈ a ′ ∈ R I ′ . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ′ ( D ′ )) Π ( A 2 , T 2 , ρ 2 ) ≈ Π ( A 3 , T 3 , ρ 3 ) ∈ U j ↘ R ′
For (1): We construct a U-Pi derivation of Π ( A 1 , T 1 , ρ 1 ) ≈ Π ( A 3 , T 3 , ρ 3 ) ∈ U i ↘ R \Pi(A_1,T_1,\rho_1)\approx\Pi(A_3,T_3,\rho_3)\in\mathcal{U}_i\searrow R Π ( A 1 , T 1 , ρ 1 ) ≈ Π ( A 3 , T 3 , ρ 3 ) ∈ U i ↘ R .
Premise 1 (domain):
R I ⇔ R I ′ (by Theorem 6.12: both have left type A 2 ) R_I\Leftrightarrow R'_I \qquad\text{(by Theorem 6.12: both have left type }A_2\text{)} R I ⇔ R I ′ (by Theorem 6.12: both have left type A 2 )
A 1 ≈ A 3 ∈ U i ↘ R I (by IH (1) on domain) A_1\approx A_3\in\mathcal{U}_i\searrow R_I \qquad\text{(by IH (1) on domain)} A 1 ≈ A 3 ∈ U i ↘ R I (by IH (1) on domain)
Premise 2: R I R_I R I is a PER (by hypothesis).
Premise 3 (codomain): Let D : : a ≈ a ′ ∈ R I \mathcal{D}::a\approx a'\in R_I D :: a ≈ a ′ ∈ R I . We must show ⟦ T 1 ⟧ ( ρ 1 , a / x ) ≈ ⟦ T 3 ⟧ ( ρ 3 , a ′ / x ) ∈ U i ↘ R O ′ ′ ( D ) \llbracket T_1\rrbracket(\rho_1,a/x)\approx\llbracket T_3\rrbracket(\rho_3,a'/x)\in\mathcal{U}_i\searrow R''_O(\mathcal{D}) [ [ T 1 ] ] ( ρ 1 , a / x ) ≈ [ [ T 3 ] ] ( ρ 3 , a ′ / x ) ∈ U i ↘ R O ′′ ( D ) for some R O ′ ′ R''_O R O ′′ .
a ≈ a ∈ R I (by symmetry + transitivity of R I ; let this be D 1 ) a\approx a\in R_I \qquad\text{(by symmetry + transitivity of }R_I\text{; let this be }\mathcal{D}_1\text{)} a ≈ a ∈ R I (by symmetry + transitivity of R I ; let this be D 1 )
⟦ T 1 ⟧ ( ρ 1 , a / x ) ≈ ⟦ T 2 ⟧ ( ρ 2 , a / x ) ∈ U i ↘ R O ( D 1 ) (from first codomain at D 1 ) \llbracket T_1\rrbracket(\rho_1,a/x)\approx\llbracket T_2\rrbracket(\rho_2,a/x)\in\mathcal{U}_i\searrow R_O(\mathcal{D}_1)
\qquad\text{(from first codomain at }\mathcal{D}_1\text{)} [ [ T 1 ] ] ( ρ 1 , a / x ) ≈ [ [ T 2 ] ] ( ρ 2 , a / x ) ∈ U i ↘ R O ( D 1 ) (from first codomain at D 1 )
a ≈ a ′ ∈ R I ′ (by R I ⇔ R I ′ ; let evidence in R I ′ be D ′ ) a\approx a'\in R'_I \qquad\text{(by }R_I\Leftrightarrow R'_I\text{; let evidence in }R'_I\text{ be }\mathcal{D}'\text{)} a ≈ a ′ ∈ R I ′ (by R I ⇔ R I ′ ; let evidence in R I ′ be D ′ )
⟦ T 2 ⟧ ( ρ 2 , a / x ) ≈ ⟦ T 3 ⟧ ( ρ 3 , a ′ / x ) ∈ U j ↘ R O ′ ( D ′ ) (from second codomain at D ′ ) \llbracket T_2\rrbracket(\rho_2,a/x)\approx\llbracket T_3\rrbracket(\rho_3,a'/x)\in\mathcal{U}_j\searrow R'_O(\mathcal{D}')
\qquad\text{(from second codomain at }\mathcal{D}'\text{)} [ [ T 2 ] ] ( ρ 2 , a / x ) ≈ [ [ T 3 ] ] ( ρ 3 , a ′ / x ) ∈ U j ↘ R O ′ ( D ′ ) (from second codomain at D ′ )
⟦ T 1 ⟧ ( ρ 1 , a / x ) ≈ ⟦ T 3 ⟧ ( ρ 3 , a ′ / x ) ∈ U i ↘ R O ( D 1 ) (by IH (1) on codomain) \llbracket T_1\rrbracket(\rho_1,a/x)\approx\llbracket T_3\rrbracket(\rho_3,a'/x)\in\mathcal{U}_i\searrow R_O(\mathcal{D}_1)
\qquad\text{(by IH (1) on codomain)} [ [ T 1 ] ] ( ρ 1 , a / x ) ≈ [ [ T 3 ] ] ( ρ 3 , a ′ / x ) ∈ U i ↘ R O ( D 1 ) (by IH (1) on codomain)
Set R O ′ ′ ( D ) : = R O ( D 1 ) R''_O(\mathcal{D}):=R_O(\mathcal{D}_1) R O ′′ ( D ) := R O ( D 1 ) .
Premise 4 (biconditional): We must show f ≈ f ′ ∈ R ⇔ ( ∀ D : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ′ ′ ( D ) ) f\approx f'\in R\Leftrightarrow(\forall\mathcal{D}::a\approx a'\in R_I.\ f\cdot a\approx f'\cdot a'\in R''_O(\mathcal{D})) f ≈ f ′ ∈ R ⇔ ( ∀ D :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ′′ ( D )) . Since R O ′ ′ ( D ) = R O ( D 1 ) R''_O(\mathcal{D})=R_O(\mathcal{D}_1) R O ′′ ( D ) = R O ( D 1 ) and by right irrelevance R O ( D 1 ) ⇔ R O ( D ) R_O(\mathcal{D}_1)\Leftrightarrow R_O(\mathcal{D}) R O ( D 1 ) ⇔ R O ( D ) (both have the same left type ⟦ T 1 ⟧ ( ρ 1 , a / x ) \llbracket T_1\rrbracket(\rho_1,a/x) [ [ T 1 ] ] ( ρ 1 , a / x ) ), the right-hand side is equivalent to the original biconditional for R R R . Hence the same R R R works.
Π ( A 1 , T 1 , ρ 1 ) ≈ Π ( A 3 , T 3 , ρ 3 ) ∈ U i ↘ R (by U-Pi) \Pi(A_1,T_1,\rho_1)\approx\Pi(A_3,T_3,\rho_3)\in\mathcal{U}_i\searrow R
\qquad\text{(by U-Pi)} Π ( A 1 , T 1 , ρ 1 ) ≈ Π ( A 3 , T 3 , ρ 3 ) ∈ U i ↘ R (by U-Pi)
For (2): Suppose f 1 ≈ f 2 ∈ R f_1\approx f_2\in R f 1 ≈ f 2 ∈ R and f 2 ≈ f 3 ∈ R f_2\approx f_3\in R f 2 ≈ f 3 ∈ R . We must show f 1 ≈ f 3 ∈ R f_1\approx f_3\in R f 1 ≈ f 3 ∈ R , i.e. for all D : : a ≈ a ′ ∈ R I \mathcal{D}::a\approx a'\in R_I D :: a ≈ a ′ ∈ R I , f 1 ⋅ a ≈ f 3 ⋅ a ′ ∈ R O ( D ) f_1\cdot a\approx f_3\cdot a'\in R_O(\mathcal{D}) f 1 ⋅ a ≈ f 3 ⋅ a ′ ∈ R O ( D ) .
a ≈ a ∈ R I (by symmetry + transitivity of R I ; let this be D 1 ) a\approx a\in R_I \qquad\text{(by symmetry + transitivity of }R_I\text{; let this be }\mathcal{D}_1\text{)} a ≈ a ∈ R I (by symmetry + transitivity of R I ; let this be D 1 )
f 1 ⋅ a ≈ f 2 ⋅ a ∈ R O ( D 1 ) (from f 1 ≈ f 2 ∈ R at D 1 ) f_1\cdot a\approx f_2\cdot a\in R_O(\mathcal{D}_1)
\qquad\text{(from }f_1\approx f_2\in R\text{ at }\mathcal{D}_1\text{)} f 1 ⋅ a ≈ f 2 ⋅ a ∈ R O ( D 1 ) (from f 1 ≈ f 2 ∈ R at D 1 )
f 2 ⋅ a ≈ f 3 ⋅ a ′ ∈ R O ( D ) (from f 2 ≈ f 3 ∈ R at D ) f_2\cdot a\approx f_3\cdot a'\in R_O(\mathcal{D})
\qquad\text{(from }f_2\approx f_3\in R\text{ at }\mathcal{D}\text{)} f 2 ⋅ a ≈ f 3 ⋅ a ′ ∈ R O ( D ) (from f 2 ≈ f 3 ∈ R at D )
R O ( D 1 ) ⇔ R O ( D ) (by Theorem 6.12: same left type ⟦ T 1 ⟧ ( ρ 1 , a / x ) ) R_O(\mathcal{D}_1)\Leftrightarrow R_O(\mathcal{D})
\qquad\text{(by Theorem 6.12: same left type }\llbracket T_1\rrbracket(\rho_1,a/x)\text{)} R O ( D 1 ) ⇔ R O ( D ) (by Theorem 6.12: same left type [ [ T 1 ] ] ( ρ 1 , a / x ) )
f 1 ⋅ a ≈ f 2 ⋅ a ∈ R O ( D ) (by R O ( D 1 ) ⇔ R O ( D ) ) f_1\cdot a\approx f_2\cdot a\in R_O(\mathcal{D})
\qquad\text{(by }R_O(\mathcal{D}_1)\Leftrightarrow R_O(\mathcal{D})\text{)} f 1 ⋅ a ≈ f 2 ⋅ a ∈ R O ( D ) (by R O ( D 1 ) ⇔ R O ( D ) )
f 1 ⋅ a ≈ f 3 ⋅ a ′ ∈ R O ( D ) f_1 \cdot a \approx f_3 \cdot a' \in R_O(\mathcal{D}) f 1 ⋅ a ≈ f 3 ⋅ a ′ ∈ R O ( D ) (by IH (2) on R O ( D ) R_O(\mathcal{D}) R O ( D ) : transitivity)
Properties of < : i <:_{i} < : i
Lemma 6.15 (Subtyping of U i \mathcal{U}_i U i ). If A < : i A ′ A <:_{i} A' A < : i A ′ , A ≈ B ∈ U i ∖ R A \approx B \in\mathcal{U}_i \setminus R A ≈ B ∈ U i ∖ R , and A ′ ≈ B ′ ∈ U i ∖ R ′ A' \approx B' \in\mathcal{U}_i \setminus R' A ′ ≈ B ′ ∈ U i ∖ R ′ , then a ≈ a ′ ∈ R a \approx a' \in R a ≈ a ′ ∈ R implies a ≈ a ′ ∈ R ′ a \approx a' \in R' a ≈ a ′ ∈ R ′ .
Proof. By induction on the derivation of A < : i A ′ A <:_{i} A' A < : i A ′ .
Case
b ≈ b ′ ∈ N e ↑ A ( b ) < : i ↑ A ′ ( b ′ ) \frac{b \approx b' \in\mathrm{Ne}}{\uparrow^{A}(b) <:_{i} \uparrow^{A'}(b')} ↑ A ( b ) < : i ↑ A ′ ( b ′ ) b ≈ b ′ ∈ Ne
e ≈ e ′ ∈ N e e \approx e' \in\mathrm{Ne} e ≈ e ′ ∈ Ne (by symmetry + transitivity of Ne)
↑ U i ( e ) ≈ ↑ U i ( e ) ∈ U i ∖ R \uparrow^{\mathcal{U}_i}(e) \approx\uparrow^{\mathcal{U}_i}(e) \in\mathcal{U}_i \setminus R ↑ U i ( e ) ≈ ↑ U i ( e ) ∈ U i ∖ R with R ⇔ N e u R \Leftrightarrow\mathrm{Neu} R ⇔ Neu (by U-Ne)
e ′ ≈ e ′ ∈ N e e' \approx e' \in\mathrm{Ne} e ′ ≈ e ′ ∈ Ne (by symmetry + transitivity of Ne)
↑ U i ( e ′ ) ≈ ↑ U i ( e ′ ) ∈ U i ∖ R ′ \uparrow^{\mathcal{U}_i}(e') \approx\uparrow^{\mathcal{U}_i}(e') \in\mathcal{U}_i \setminus R' ↑ U i ( e ′ ) ≈ ↑ U i ( e ′ ) ∈ U i ∖ R ′ with R ′ ⇔ N e u R' \Leftrightarrow\mathrm{Neu} R ′ ⇔ Neu (by U-Ne)
R ⇔ N e u ⇔ R ′ R \Leftrightarrow\mathrm{Neu} \Leftrightarrow R' R ⇔ Neu ⇔ R ′ (hence R ⊆ R ′ R \subseteq R' R ⊆ R ′ )
Case
j ≤ k k < i U j < : i U k \frac{j \leq k \qquad k < i}{U_j <:_{i} U_k} U j < : i U k j ≤ k k < i
U j ≈ U j ∈ U i ∖ R U_j \approx U_j \in\mathcal{U}_i \setminus R U j ≈ U j ∈ U i ∖ R with R ⇔ ( λ a a ′ . ∃ R . a ≈ a ′ ∈ U j ∖ R ) R \Leftrightarrow(\lambda a\,a'.\ \exists R.\ a \approx a' \in\mathcal{U}_j \setminus R) R ⇔ ( λa a ′ . ∃ R . a ≈ a ′ ∈ U j ∖ R ) (by U-Univ, j < i j < i j < i )
U k ≈ U k ∈ U i ∖ R ′ U_k \approx U_k \in\mathcal{U}_i \setminus R' U k ≈ U k ∈ U i ∖ R ′ with R ′ ⇔ ( λ a a ′ . ∃ R . a ≈ a ′ ∈ U k ∖ R ) R' \Leftrightarrow(\lambda a\,a'.\ \exists R.\ a \approx a' \in\mathcal{U}_k \setminus R) R ′ ⇔ ( λa a ′ . ∃ R . a ≈ a ′ ∈ U k ∖ R ) (by U-Univ, k < i k < i k < i )
R ⊆ R ′ R \subseteq R' R ⊆ R ′ (by cumulativity, Theorem 6.10, since j ≤ k j \leq k j ≤ k )
Case
N < : i N \frac{}{N <:_{i} N} N < : i N
Both sides are in U i \mathcal{U}_i U i (via U-Nat) returning Nat, and N a t ⊆ N a t \mathrm{Nat} \subseteq\mathrm{Nat} Nat ⊆ Nat .
Case
A ≈ A ′ ∈ U i ∖ R I ∀ D : : a ≈ a ′ ∈ R I . ⟦ T ⟧ ( ρ , a / x ) < : i ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) Π ( A , T , ρ ) ≈ Π ( A , T , ρ ) ∈ U i Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i Π ( A , T , ρ ) < : i Π ( A ′ , T ′ , ρ ′ ) \frac{
\begin{gathered}
A \approx A' \in\mathcal{U}_i \setminus R_I
\qquad
\forall\mathcal{D} :: a \approx a' \in R_I.\ \llbracket T \rrbracket(\rho,a/x) <:_{i} \llbracket T' \rrbracket(\rho',a'/x) \\
\Pi(A,T,\rho) \approx\Pi(A,T,\rho) \in\mathcal{U}_i
\qquad
\Pi(A',T',\rho') \approx\Pi(A',T',\rho') \in\mathcal{U}_i
\end{gathered}
}{
\Pi(A,T,\rho) <:_{i} \Pi(A',T',\rho')
} Π ( A , T , ρ ) < : i Π ( A ′ , T ′ , ρ ′ ) A ≈ A ′ ∈ U i ∖ R I ∀ D :: a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) < : i [ [ T ′ ] ] ( ρ ′ , a ′ / x ) Π ( A , T , ρ ) ≈ Π ( A , T , ρ ) ∈ U i Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i
The domain PERs coincide by hypothesis. For the function PERs:
Given f ≈ f ′ ∈ R f \approx f' \in R f ≈ f ′ ∈ R (i.e., ∀ D : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) \forall\mathcal{D} :: a \approx a' \in R_I.\ f \cdot a \approx f' \cdot a' \in R_O(\mathcal{D}) ∀ D :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) )
Given D : : a ≈ a ′ ∈ R I \mathcal{D} :: a \approx a' \in R_I D :: a ≈ a ′ ∈ R I
f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) f \cdot a \approx f' \cdot a' \in R_O(\mathcal{D}) f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) (by above)
R O ( D ) ⊆ R O ′ ( D ) (by IH on codomain subtyping) f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ′ ( D ) (by inclusion) R_O(\mathcal{D}) \subseteq R_{O'}(\mathcal{D}) \qquad\text{(by IH on codomain subtyping)} \\
f \cdot a \approx f' \cdot a' \in R_{O'}(\mathcal{D}) \qquad\text{(by inclusion)} R O ( D ) ⊆ R O ′ ( D ) (by IH on codomain subtyping) f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ′ ( D ) (by inclusion)
Lemma 6.16 (Transitivity of < : i <:_{i} < : i ). If A < : i B A <:_{i} B A < : i B and B < : i C B <:_{i} C B < : i C , then A < : i C A <:_{i} C A < : i C .
Proof. By induction on the derivation of A < : i B A <:_{i} B A < : i B , with case analysis on the constructor of B < : i C B <:_{i} C B < : i C that must agree on the shape of B B B .
Case
b ≈ b ′ ∈ N e ↑ A 0 ( b ) < : i ↑ B 0 ( b ′ ) \frac{b \approx b' \in\mathsf{Ne}}{\uparrow^{A_0}(b) <:_{i} \uparrow^{B_0}(b')} ↑ A 0 ( b ) < : i ↑ B 0 ( b ′ ) b ≈ b ′ ∈ Ne
Here B = ↑ B 0 ( b ′ ) B = \uparrow^{B_0}(b') B = ↑ B 0 ( b ′ ) , so B < : i C B <:_{i} C B < : i C must also be by < : − N e <:-\mathsf{Ne} <: − Ne , with C = ↑ C 0 ( b ′ ′ ) C = \uparrow^{C_0}(b'') C = ↑ C 0 ( b ′′ ) and b ′ ≈ b ′ ′ ∈ N e b' \approx b'' \in\mathsf{Ne} b ′ ≈ b ′′ ∈ Ne . By transitivity of the neutral PER (Theorem 6.4), b ≈ b ′ ′ ∈ N e b \approx b'' \in\mathsf{Ne} b ≈ b ′′ ∈ Ne . By < : − N e <:-\mathsf{Ne} <: − Ne , ↑ A 0 ( b ) < : i ↑ C 0 ( b ′ ′ ) \uparrow^{A_0}(b) <:_{i} \uparrow^{C_0}(b'') ↑ A 0 ( b ) < : i ↑ C 0 ( b ′′ ) .
Case
j ≤ k k < i U j < : i U k \frac{j \leq k \qquad k < i}{U_j <:_{i} U_k} U j < : i U k j ≤ k k < i
Here B = U k B = U_k B = U k , so B < : i C B <:_{i} C B < : i C must be by < : − U n i v <:-\mathsf{Univ} <: − Univ , with C = U k ′ C = U_{k'} C = U k ′ , k ≤ k ′ k \leq k' k ≤ k ′ , and k ′ < i k' < i k ′ < i . By transitivity of ≤ \leq ≤ on N \mathbb{N} N , j ≤ k ′ j \leq k' j ≤ k ′ , and k ′ < i k' < i k ′ < i by hypothesis. By < : − U n i v <:-\mathsf{Univ} <: − Univ , U j < : i U k ′ U_j <:_{i} U_{k'} U j < : i U k ′ .
Case
N < : i N \frac{}{N <:_{i} N} N < : i N
Here B = N B = N B = N , so B < : i C B <:_{i} C B < : i C must be by < : − N a t <:-\mathsf{Nat} <: − Nat with C = N C = N C = N . By < : − N a t <:-\mathsf{Nat} <: − Nat , N < : i N N <:_{i} N N < : i N .
Case
A I ≈ B I ∈ U i ↘ R I ∀ D : : a ≈ a ′ ∈ R I . ⟦ T A ⟧ ( ρ A , a / x ) < : i ⟦ T B ⟧ ( ρ B , a ′ / x ) Π ( A I , T A , ρ A ) ≈ Π ( A I , T A , ρ A ) ∈ U i Π ( B I , T B , ρ B ) ≈ Π ( B I , T B , ρ B ) ∈ U i Π ( A I , T A , ρ A ) < : i Π ( B I , T B , ρ B ) \frac{
\begin{gathered}
A_I \approx B_I \in\mathcal{U}_i \searrow R_I
\qquad
\forall\mathcal{D} :: a \approx a' \in R_I.\; \llbracket T_A \rrbracket(\rho_A,a/x) <:_{i} \llbracket T_B \rrbracket(\rho_B,a'/x)
\\
\Pi(A_I,T_A,\rho_A) \approx\Pi(A_I,T_A,\rho_A) \in\mathcal{U}_i
\qquad
\Pi(B_I,T_B,\rho_B) \approx\Pi(B_I,T_B,\rho_B) \in\mathcal{U}_i
\end{gathered}
}{
\Pi(A_I,T_A,\rho_A) <:_{i} \Pi(B_I,T_B,\rho_B)
} Π ( A I , T A , ρ A ) < : i Π ( B I , T B , ρ B ) A I ≈ B I ∈ U i ↘ R I ∀ D :: a ≈ a ′ ∈ R I . [ [ T A ] ] ( ρ A , a / x ) < : i [ [ T B ] ] ( ρ B , a ′ / x ) Π ( A I , T A , ρ A ) ≈ Π ( A I , T A , ρ A ) ∈ U i Π ( B I , T B , ρ B ) ≈ Π ( B I , T B , ρ B ) ∈ U i
Here B = Π ( B I , T B , ρ B ) B = \Pi(B_I,T_B,\rho_B) B = Π ( B I , T B , ρ B ) , so B < : i C B <:_{i} C B < : i C must be by < : − P i <:-\mathsf{Pi} <: − Pi , with C = Π ( C I , T C , ρ C ) C = \Pi(C_I,T_C,\rho_C) C = Π ( C I , T C , ρ C ) and:
B I ≈ C I ∈ U i ↘ R I ′ (domain of the second derivation) B_I \approx C_I \in\mathcal{U}_i \searrow R'_I
\qquad\text{(domain of the second derivation)} B I ≈ C I ∈ U i ↘ R I ′ (domain of the second derivation)
∀ D ′ : : a ≈ a ′ ∈ R I ′ . ⟦ T B ⟧ ( ρ B , a / x ) < : i ⟦ T C ⟧ ( ρ C , a ′ / x ) (codomain) \forall\mathcal{D}' :: a \approx a' \in R'_I.\; \llbracket T_B \rrbracket(\rho_B,a/x) <:_{i} \llbracket T_C \rrbracket(\rho_C,a'/x)
\qquad\text{(codomain)} ∀ D ′ :: a ≈ a ′ ∈ R I ′ . [ [ T B ] ] ( ρ B , a / x ) < : i [ [ T C ] ] ( ρ C , a ′ / x ) (codomain)
Π ( C I , T C , ρ C ) ≈ Π ( C I , T C , ρ C ) ∈ U i (self-relatedness) \Pi(C_I,T_C,\rho_C) \approx\Pi(C_I,T_C,\rho_C) \in\mathcal{U}_i
\qquad\text{(self-relatedness)} Π ( C I , T C , ρ C ) ≈ Π ( C I , T C , ρ C ) ∈ U i (self-relatedness)
Domain. By Theorem 6.14 applied to A I ≈ B I ∈ U i ↘ R I A_I \approx B_I \in\mathcal{U}_i \searrow R_I A I ≈ B I ∈ U i ↘ R I and B I ≈ C I ∈ U i ↘ R I ′ B_I \approx C_I \in\mathcal{U}_i \searrow R'_I B I ≈ C I ∈ U i ↘ R I ′ : A I ≈ C I ∈ U i A_I \approx C_I \in\mathcal{U}_i A I ≈ C I ∈ U i , with output PER (call it R I ∗ R_I^* R I ∗ ) determined up to logical equivalence by Theorem 6.12; in particular, R I ∗ ⇔ R I ⇔ R I ′ R_I^* \Leftrightarrow R_I \Leftrightarrow R'_I R I ∗ ⇔ R I ⇔ R I ′ .
Codomain. Let D ∗ : : a ≈ a ′ ∈ R I ∗ \mathcal{D}^* :: a \approx a' \in R_I^* D ∗ :: a ≈ a ′ ∈ R I ∗ be given. By the equivalence R I ∗ ⇔ R I R_I^* \Leftrightarrow R_I R I ∗ ⇔ R I , D ∗ \mathcal{D}^* D ∗ also witnesses a ≈ a ′ ∈ R I a \approx a' \in R_I a ≈ a ′ ∈ R I , and by R I ∗ ⇔ R I ′ R_I^* \Leftrightarrow R'_I R I ∗ ⇔ R I ′ it also witnesses some D ′ : : a ≈ a ′ ∈ R I ′ \mathcal{D}' :: a \approx a' \in R'_I D ′ :: a ≈ a ′ ∈ R I ′ . Apply the codomain hypothesis of the first derivation at this D ∗ \mathcal{D}^* D ∗ (used as D \mathcal{D} D in R I R_I R I ):
⟦ T A ⟧ ( ρ A , a / x ) < : i ⟦ T B ⟧ ( ρ B , a ′ / x ) (codomain of the first derivation) \llbracket T_A \rrbracket(\rho_A,a/x) <:_{i} \llbracket T_B \rrbracket(\rho_B,a'/x)
\qquad\text{(codomain of the first derivation)} [ [ T A ] ] ( ρ A , a / x ) < : i [ [ T B ] ] ( ρ B , a ′ / x ) (codomain of the first derivation)
Apply the codomain hypothesis of the second derivation at D ′ D' D ′ :
⟦ T B ⟧ ( ρ B , a ′ / x ) < : i ⟦ T C ⟧ ( ρ C , a ′ ′ / x ) \llbracket T_B \rrbracket(\rho_B,a'/x) <:_{i} \llbracket T_C \rrbracket(\rho_C,a''/x) [ [ T B ] ] ( ρ B , a ′ / x ) < : i [ [ T C ] ] ( ρ C , a ′′ / x )
(codomain of the second derivation, with a ′ ≈ a ′ ′ ∈ R I ′ a' \approx a'' \in R'_I a ′ ≈ a ′′ ∈ R I ′ )
Since D ∗ \mathcal{D}^* D ∗ witnesses both pairs we have a ′ = a ′ ′ a'=a'' a ′ = a ′′ at this instantiation; the inductive hypothesis composes the two:
⟦ T A ⟧ ( ρ A , a / x ) < : i ⟦ T C ⟧ ( ρ C , a ′ / x ) \llbracket T_A \rrbracket(\rho_A,a/x) <:_{i} \llbracket T_C \rrbracket(\rho_C,a'/x) [ [ T A ] ] ( ρ A , a / x ) < : i [ [ T C ] ] ( ρ C , a ′ / x )
(by IH on the codomain)
Self-relatedness. Already given: Π ( A I , T A , ρ A ) ≈ Π ( A I , T A , ρ A ) ∈ U i \Pi(A_I,T_A,\rho_A) \approx\Pi(A_I,T_A,\rho_A) \in U_i Π ( A I , T A , ρ A ) ≈ Π ( A I , T A , ρ A ) ∈ U i from the first derivation and Π ( C I , T C , ρ C ) ≈ Π ( C I , T C , ρ C ) ∈ U i \Pi(C_I,T_C,\rho_C) \approx\Pi(C_I,T_C,\rho_C) \in U_i Π ( C I , T C , ρ C ) ≈ Π ( C I , T C , ρ C ) ∈ U i from the second.
Conclusion. By < : -Pi <:\text{-Pi} <: -Pi with the four ingredients (domain in U i ∖ R I ∗ U_i \setminus R_I^* U i ∖ R I ∗ , codomain pointwise subtyping at every D ∗ \mathcal{D}^* D ∗ , and the two self-relatedness facts):
Π ( A I , T A , ρ A ) < : i Π ( C I , T C , ρ C ) . \Pi(A_I,T_A,\rho_A) <:_{i} \Pi(C_I,T_C,\rho_C). Π ( A I , T A , ρ A ) < : i Π ( C I , T C , ρ C ) .
Lemma 6.17 (Uᵢ implies <:ᵢ)
Lemma 6.17 (Uᵢ implies <:ᵢ). If A ≈ A ′ ∈ U i ∖ R A \approx A' \in U_i \setminus R A ≈ A ′ ∈ U i ∖ R , then A < : i A ′ A <:_{i} A' A < : i A ′ .
Proof. By induction on A ≈ A ′ ∈ U i A \approx A' \in U_i A ≈ A ′ ∈ U i .
U-Ne: A = ↑ A 0 ( b ) A = \uparrow^{A_0}(b) A = ↑ A 0 ( b ) , A ′ = ↑ A 0 ′ ( b ′ ) A' = \uparrow^{A'_0}(b') A ′ = ↑ A 0 ′ ( b ′ ) , b ≈ b ′ ∈ N e b \approx b' \in\mathrm{Ne} b ≈ b ′ ∈ Ne . By < : -Ne <:\text{-Ne} <: -Ne .
U-Univ: A = A ′ = U j A = A' = U_j A = A ′ = U j with j < i j < i j < i . By < : -Univ <:\text{-Univ} <: -Univ with j ≤ j j \leq j j ≤ j .
U-Nat: A = A ′ = N A = A' = N A = A ′ = N . By < : -Nat <:\text{-Nat} <: -Nat .
U-Pi: A = Π ( A I , T , ρ ) A = \Pi(A_I,T,\rho) A = Π ( A I , T , ρ ) , A ′ = Π ( A I ′ , T ′ , ρ ′ ) A' = \Pi(A'_I,T',\rho') A ′ = Π ( A I ′ , T ′ , ρ ′ ) , domain A I ≈ A I ′ ∈ U i ∖ R I A_I \approx A'_I \in U_i \setminus R_I A I ≈ A I ′ ∈ U i ∖ R I , codomain pointwise ⟦ T ⟧ ( ρ , a / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) ∈ U i \llbracket T \rrbracket(\rho,a/x) \approx\llbracket T' \rrbracket(\rho',a'/x) \in U_i [ [ T ] ] ( ρ , a / x ) ≈ [ [ T ′ ] ] ( ρ ′ , a ′ / x ) ∈ U i , and self-relatedness of both Pi-types. By inner IH on the codomain U i U_i U i -equality: ⟦ T ⟧ ( ρ , a / x ) < : i ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) \llbracket T \rrbracket(\rho,a/x) <:_{i} \llbracket T' \rrbracket(\rho',a'/x) [ [ T ] ] ( ρ , a / x ) < : i [ [ T ′ ] ] ( ρ ′ , a ′ / x ) . By < : -Pi <:\text{-Pi} <: -Pi .
Realizability
Realizability. The following two lemmas are proved by simultaneous induction on A ≈ A ′ ∈ U i ∖ R A \approx A' \in U_i \setminus R A ≈ A ′ ∈ U i ∖ R .
Lemma 6.18 (Realizability of the PER model). Given A ≈ A ′ ∈ U i ∖ R A \approx A' \in U_i \setminus R A ≈ A ′ ∈ U i ∖ R :
(1) (Elements of R R R read back) If a ≈ a ′ ∈ R a \approx a' \in R a ≈ a ′ ∈ R , then ↓ A ( a ) ≈ ↓ A ′ ( a ′ ) ∈ N f \downarrow^{A}(a) \approx\downarrow^{A'}(a') \in Nf ↓ A ( a ) ≈ ↓ A ′ ( a ′ ) ∈ N f .
(2) (Neutrals inhabit R R R ) If e ≈ e ′ ∈ N e e \approx e' \in\mathrm{Ne} e ≈ e ′ ∈ Ne , then ↑ A ( e ) ≈ ↑ A ′ ( e ′ ) ∈ R \uparrow^{A}(e) \approx\uparrow^{A'}(e') \in R ↑ A ( e ) ≈ ↑ A ′ ( e ′ ) ∈ R .
(3) (Types read back) A ≈ A ′ ∈ T y A \approx A' \in Ty A ≈ A ′ ∈ T y .
Proof. By simultaneous induction on the derivation of A ≈ A ′ ∈ U i ∖ R A \approx A' \in U_i \setminus R A ≈ A ′ ∈ U i ∖ R . We also need an auxiliary lemma that a ≈ a ′ ∈ N a t a \approx a' \in Nat a ≈ a ′ ∈ N a t implies ↓ N ( a ) ≈ ↓ N ( a ′ ) ∈ N f \downarrow^{N}(a) \approx\downarrow^{N}(a') \in Nf ↓ N ( a ) ≈ ↓ N ( a ′ ) ∈ N f , which is Theorem 6.8.
Case
\begin{array}{c}
\mathrm{U\mathchar`-Ne}\\
b \approx b' \in\mathrm{Ne} \qquad R \Leftrightarrow\mathrm{Neu}\\
\hline
\uparrow^{A}(b) \approx\uparrow^{A'}(b') \in U_i \setminus R
\end{array}
For (1): Since R ⇔ N e u R \Leftrightarrow\mathrm{Neu} R ⇔ Neu , we have a = ↑ B ( e ) a=\uparrow^{B}(e) a = ↑ B ( e ) and a ′ = ↑ B ′ ( e ′ ) a'=\uparrow^{B'}(e') a ′ = ↑ B ′ ( e ′ ) with e ≈ e ′ ∈ N e e \approx e' \in\mathrm{Ne} e ≈ e ′ ∈ Ne . Reading back ↓ A ( b ) ( ↑ B ( e ) ) \downarrow^{A}(b)(\uparrow^{B}(e)) ↓ A ( b ) ( ↑ B ( e )) at a neutral type reads e e e as a neutral (by Rf-Ne), and both sides produce the same neutral normal form since e ≈ e ′ ∈ N e e \approx e' \in\mathrm{Ne} e ≈ e ′ ∈ Ne .
For (2): We need ↑ A ( b ) ( e ) ≈ ↑ A ′ ( b ′ ) ( e ′ ) ∈ R \uparrow^{A}(b)(e) \approx\uparrow^{A'}(b')(e') \in R ↑ A ( b ) ( e ) ≈ ↑ A ′ ( b ′ ) ( e ′ ) ∈ R . Since R ⇔ N e u R \Leftrightarrow\mathrm{Neu} R ⇔ Neu , this reduces to e ≈ e ′ ∈ N e e \approx e' \in\mathrm{Ne} e ≈ e ′ ∈ Ne , which holds by hypothesis.
For (3): We must show ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ T y \uparrow^{A}(b) \approx\uparrow^{A'}(b') \in Ty ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ T y , i.e. reading back both sides as types produces the same result. Since b ≈ b ′ ∈ N e b \approx b' \in\mathrm{Ne} b ≈ b ′ ∈ Ne , reading both as neutrals produces the same neutral normal form. Case
U-Univ j < i R ⇔ U j U j ≈ U j ∈ U i ↘ R \begin{array}{c}
\text{U-Univ}\\
j<i\qquad R\Leftrightarrow\mathcal{U}_j\\
\hline
\mathcal{U}_j\approx\mathcal{U}_j\in\mathcal{U}_i\searrow R
\end{array} U-Univ j < i R ⇔ U j U j ≈ U j ∈ U i ↘ R
For (1): We have a ≈ a ′ ∈ R a\approx a'\in R a ≈ a ′ ∈ R , i.e. a ≈ a ′ ∈ U j ↘ R 0 a\approx a'\in\mathcal{U}_j\searrow R_0 a ≈ a ′ ∈ U j ↘ R 0 for some R 0 R_0 R 0 . By IH (3) on the U j \mathcal{U}_j U j derivation (structurally smaller since j < i j<i j < i ), a ≈ a ′ ∈ T y j a\approx a'\in\mathrm{Ty}_j a ≈ a ′ ∈ Ty j . Reading back ↓ U j ( a ) \downarrow^{\mathcal{U}_j}(a) ↓ U j ( a ) as a normal form reads a a a as a type, hence ↓ U j ( a ) ≈ ↓ U j ( a ′ ) ∈ N f \downarrow^{\mathcal{U}_j}(a)\approx\downarrow^{\mathcal{U}_j}(a')\in\mathrm{Nf} ↓ U j ( a ) ≈ ↓ U j ( a ′ ) ∈ Nf .
For (2): We need ↑ U j ( e ) ≈ ↑ U j ( e ′ ) ∈ R \uparrow^{\mathcal{U}_j}(e)\approx\uparrow^{\mathcal{U}_j}(e')\in R ↑ U j ( e ) ≈ ↑ U j ( e ′ ) ∈ R , i.e. ↑ U j ( e ) ≈ ↑ U j ( e ′ ) ∈ U j ↘ R 0 \uparrow^{\mathcal{U}_j}(e)\approx\uparrow^{\mathcal{U}_j}(e')\in\mathcal{U}_j\searrow R_0 ↑ U j ( e ) ≈ ↑ U j ( e ′ ) ∈ U j ↘ R 0 for some R 0 R_0 R 0 .
e ≈ e ′ ∈ N e (by hypothesis) e\approx e'\in\mathrm{Ne}
\qquad\text{(by hypothesis)} e ≈ e ′ ∈ Ne (by hypothesis)
↑ U j ( e ) ≈ ↑ U j ( e ′ ) ∈ U j ↘ N e u (by U-Ne, taking R 0 ⇔ N e u ) \uparrow^{\mathcal{U}_j}(e)\approx\uparrow^{\mathcal{U}_j}(e')\in\mathcal{U}_j\searrow\mathrm{Neu}
\qquad\text{(by U-Ne, taking }R_0\Leftrightarrow\mathrm{Neu}\text{)} ↑ U j ( e ) ≈ ↑ U j ( e ′ ) ∈ U j ↘ Neu (by U-Ne, taking R 0 ⇔ Neu )
For (3): A = A ′ = U j A=A'=\mathcal{U}_j A = A ′ = U j . Both sides read back to T y j \mathrm{Ty}_j Ty j .
Case
U-Nat R ⇔ N a t N ≈ N ∈ U i ↘ R \begin{array}{c}
\text{U-Nat}\\
R\Leftrightarrow\mathrm{Nat}\\
\hline
N\approx N\in\mathcal{U}_i\searrow R
\end{array} U-Nat R ⇔ Nat N ≈ N ∈ U i ↘ R
For (1): Since R ⇔ N a t R\Leftrightarrow\mathrm{Nat} R ⇔ Nat , we have a ≈ a ′ ∈ N a t a\approx a'\in\mathrm{Nat} a ≈ a ′ ∈ Nat . By Theorem 6.8, ↓ N ( a ) ≈ ↓ N ( a ′ ) ∈ N f \downarrow^N(a)\approx\downarrow^N(a')\in\mathrm{Nf} ↓ N ( a ) ≈ ↓ N ( a ′ ) ∈ Nf .
For (2): We need ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ N a t \uparrow^N(e)\approx\uparrow^N(e')\in\mathrm{Nat} ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ Nat .
e ≈ e ′ ∈ N e (by hypothesis) e\approx e'\in\mathrm{Ne}
\qquad\text{(by hypothesis)} e ≈ e ′ ∈ Ne (by hypothesis)
↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ N a t (by Nat-Ne) \uparrow^N(e)\approx\uparrow^N(e')\in\mathrm{Nat}
\qquad\text{(by Nat-Ne)} ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ Nat (by Nat-Ne)
For (3): A = A ′ = N A=A'=N A = A ′ = N . Both sides read back to N a t \mathrm{Nat} Nat .
Case
U-Pi A 0 ≈ A 0 ′ ∈ U i ↘ R I R I is a PER ∀ D : : a ≈ a ′ ∈ R I . ⟦ T ⟧ ( ρ , a / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) ) Π ( A 0 , T , ρ ) ≈ Π ( A 0 ′ , T ′ , ρ ′ ) ∈ U i ↘ R \begin{array}{c}
\text{U-Pi}\\
A_0\approx A'_0\in\mathcal{U}_i\searrow R_I
\qquad R_I\text{ is a PER}\\
\forall\mathcal{D}::a\approx a'\in R_I.\; \llbracket T\rrbracket(\rho,a/x)\approx\llbracket T'\rrbracket(\rho',a'/x)\in\mathcal{U}_i\searrow R_O(\mathcal{D})\\
\forall f,f'.\; f\approx f'\in R\Leftrightarrow(\forall\mathcal{D}::a\approx a'\in R_I.\;f\mathbin{\cdot}a\approx f'\mathbin{\cdot}a'\in R_O(\mathcal{D}))\\
\hline
\Pi(A_0,T,\rho)\approx\Pi(A'_0,T',\rho')\in\mathcal{U}_i\searrow R
\end{array} U-Pi A 0 ≈ A 0 ′ ∈ U i ↘ R I R I is a PER ∀ D :: a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) ≈ [ [ T ′ ] ] ( ρ ′ , a ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D )) Π ( A 0 , T , ρ ) ≈ Π ( A 0 ′ , T ′ , ρ ′ ) ∈ U i ↘ R
For (1): We have f ≈ f ′ ∈ R f\approx f'\in R f ≈ f ′ ∈ R , i.e. for all D : : a ≈ a ′ ∈ R I \mathcal{D}::a\approx a'\in R_I D :: a ≈ a ′ ∈ R I , f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) f\mathbin{\cdot}a\approx f'\mathbin{\cdot}a'\in R_O(\mathcal{D}) f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D ) . Reading back ↓ Π ( A 0 , T , ρ ) ( f ) \downarrow^{\Pi(A_0,T,\rho)}(f) ↓ Π ( A 0 , T , ρ ) ( f ) at level n n n :
ℓ n ≈ ℓ n ∈ N e (a level variable reads back to itself) \ell_n\approx\ell_n\in\mathrm{Ne}
\qquad\text{(a level variable reads back to itself)} ℓ n ≈ ℓ n ∈ Ne (a level variable reads back to itself)
↑ A 0 ( ℓ n ) ≈ ↑ A 0 ′ ( ℓ n ) ∈ R I (by IH (2) on domain) \uparrow^{A_0}(\ell_n)\approx\uparrow^{A'_0}(\ell_n)\in R_I
\qquad\text{(by IH (2) on domain)} ↑ A 0 ( ℓ n ) ≈ ↑ A 0 ′ ( ℓ n ) ∈ R I (by IH (2) on domain)
Let D n : : ↑ A 0 ( ℓ n ) ≈ ↑ A 0 ′ ( ℓ n ) ∈ R I \mathcal{D}_n::\uparrow^{A_0}(\ell_n)\approx\uparrow^{A'_0}(\ell_n)\in R_I D n :: ↑ A 0 ( ℓ n ) ≈ ↑ A 0 ′ ( ℓ n ) ∈ R I
f ⋅ ↑ A 0 ( ℓ n ) ≈ f ′ ⋅ ↑ A 0 ′ ( ℓ n ) ∈ R O ( D n ) (from f ≈ f ′ ∈ R at D n ) f\mathbin{\cdot}\uparrow^{A_0}(\ell_n)\approx f'\mathbin{\cdot}\uparrow^{A'_0}(\ell_n)\in R_O(\mathcal{D}_n)
\qquad\text{(from }f\approx f'\in R\text{ at }\mathcal{D}_n\text{)} f ⋅ ↑ A 0 ( ℓ n ) ≈ f ′ ⋅ ↑ A 0 ′ ( ℓ n ) ∈ R O ( D n ) (from f ≈ f ′ ∈ R at D n )
⟦ T ⟧ ( ρ , ↑ A 0 ( ℓ n ) / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , ↑ A 0 ′ ( ℓ n ) / x ) ∈ U i ↘ R O ( D n ) (codomain premise at D n ) \llbracket T\rrbracket(\rho,\uparrow^{A_0}(\ell_n)/x)\approx\llbracket T'\rrbracket(\rho',\uparrow^{A'_0}(\ell_n)/x)\in\mathcal{U}_i\searrow R_O(\mathcal{D}_n)
\qquad\text{(codomain premise at }\mathcal{D}_n\text{)} [ [ T ] ] ( ρ , ↑ A 0 ( ℓ n ) / x ) ≈ [ [ T ′ ] ] ( ρ ′ , ↑ A 0 ′ ( ℓ n ) / x ) ∈ U i ↘ R O ( D n ) (codomain premise at D n )
↓ ⟦ T ⟧ ( ρ , ↑ A 0 ( ℓ n ) / x ) ( f ⋅ ↑ A 0 ( ℓ n ) ) ≈ ↓ ⟦ T ′ ⟧ ( ρ ′ , ↑ A 0 ′ ( ℓ n ) / x ) ( f ′ ⋅ ↑ A 0 ′ ( ℓ n ) ) ∈ N f (by IH (1) on codomain) \downarrow^{\llbracket T\rrbracket(\rho,\uparrow^{A_0}(\ell_n)/x)}
\left(f\mathbin{\cdot}\uparrow^{A_0}(\ell_n)\right)
\approx
\downarrow^{\llbracket T'\rrbracket(\rho',\uparrow^{A'_0}(\ell_n)/x)}
\left(f'\mathbin{\cdot}\uparrow^{A'_0}(\ell_n)\right)\in\mathrm{Nf}
\qquad\text{(by IH (1) on codomain)} ↓ [ [ T ] ] ( ρ , ↑ A 0 ( ℓ n ) / x ) ( f ⋅ ↑ A 0 ( ℓ n ) ) ≈ ↓ [ [ T ′ ] ] ( ρ ′ , ↑ A 0 ′ ( ℓ n ) / x ) ( f ′ ⋅ ↑ A 0 ′ ( ℓ n ) ) ∈ Nf (by IH (1) on codomain)
The readback rule for Π \Pi Π -types assembles these into R n N f ( ↓ Π ( A 0 , T , ρ ) ( f ) ) ↘ λ x . w R_n^{\mathrm{Nf}}(\downarrow^{\Pi(A_0,T,\rho)}(f))\searrow\lambda x.w R n Nf ( ↓ Π ( A 0 , T , ρ ) ( f )) ↘ λ x . w and R n N f ( ↓ Π ( A 0 ′ , T ′ , ρ ′ ) ( f ′ ) ) ↘ λ x . w R_n^{\mathrm{Nf}}(\downarrow^{\Pi(A'_0,T',\rho')}(f'))\searrow\lambda x.w R n Nf ( ↓ Π ( A 0 ′ , T ′ , ρ ′ ) ( f ′ )) ↘ λ x . w with the same body $w. For (2): By the biconditional, we must show that for all D : : a ≈ a ′ ∈ R I \mathcal{D} :: a \approx a' \in R_I D :: a ≈ a ′ ∈ R I , ( ↑ Π ( A 0 , T , ρ ) ( e ) ) ⋅ a ≈ ( ↑ Π ( A 0 ′ , T ′ , ρ ′ ) ( e ′ ) ) ⋅ a ′ ∈ R O ( D ) (\uparrow^{\Pi(A_0,T,\rho)}(e)) \cdot a \approx(\uparrow^{\Pi(A'_0,T',\rho')}(e')) \cdot a' \in R_O(\mathcal{D}) ( ↑ Π ( A 0 , T , ρ ) ( e )) ⋅ a ≈ ( ↑ Π ( A 0 ′ , T ′ , ρ ′ ) ( e ′ )) ⋅ a ′ ∈ R O ( D ) .
Let ⟦ T ⟧ ( ρ , a / x ) ↘ B \llbracket T \rrbracket(\rho,a/x) \searrow B [ [ T ] ] ( ρ , a / x ) ↘ B and ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) ↘ B ′ \llbracket T' \rrbracket(\rho',a'/x) \searrow B' [ [ T ′ ] ] ( ρ ′ , a ′ / x ) ↘ B ′
( ↑ Π ( A 0 , T , ρ ) ( e ) ) ⋅ a = ↑ B ( e $ ↓ A 0 ( a ) ) (by app-ne) ( ↑ Π ( A 0 ′ , T ′ , ρ ′ ) ( e ′ ) ) ⋅ a ′ = ↑ B ′ ( e ′ $ ↓ A 0 ′ ( a ′ ) ) (by app-ne) ↓ A 0 ( a ) ≈ ↓ A 0 ′ ( a ′ ) ∈ N f (by IH (1) on domain: a ≈ a ′ ∈ R I ) e $ ↓ A 0 ( a ) ≈ e ′ $ ↓ A 0 ′ ( a ′ ) ∈ N e (by e ≈ e ′ ∈ N e and above) B ≈ B ′ ∈ U i ↘ R O ( D ) (codomain premise at D ) ↑ B ( e $ ↓ A 0 ( a ) ) ≈ ↑ B ′ ( e ′ $ ↓ A 0 ′ ( a ′ ) ) ∈ R O ( D ) (by IH (2) on codomain) \begin{aligned}
(\uparrow^{\Pi(A_0,T,\rho)}(e)) \cdot a &= \uparrow^B(e \mathbin{\$} \downarrow^{A_0}(a)) && \text{(by app-ne)}\\
(\uparrow^{\Pi(A'_0,T',\rho')}(e')) \cdot a' &= \uparrow^{B'}(e' \mathbin{\$} \downarrow^{A'_0}(a')) && \text{(by app-ne)}\\
\downarrow^{A_0}(a) &\approx\downarrow^{A'_0}(a') \in\mathrm{Nf} && \text{(by IH (1) on domain: }a \approx a' \in R_I\text{)}\\
e \mathbin{\$} \downarrow^{A_0}(a) &\approx e' \mathbin{\$} \downarrow^{A'_0}(a') \in\mathrm{Ne} && \text{(by }e \approx e' \in\mathrm{Ne}\text{ and above)}\\
B &\approx B' \in U_i \searrow R_O(\mathcal{D}) && \text{(codomain premise at }\mathcal{D}\text{)}\\
\uparrow^B(e \mathbin{\$} \downarrow^{A_0}(a)) &\approx\uparrow^{B'}(e' \mathbin{\$} \downarrow^{A'_0}(a')) \in R_O(\mathcal{D}) && \text{(by IH (2) on codomain)}
\end{aligned} ( ↑ Π ( A 0 , T , ρ ) ( e )) ⋅ a ( ↑ Π ( A 0 ′ , T ′ , ρ ′ ) ( e ′ )) ⋅ a ′ ↓ A 0 ( a ) e $ ↓ A 0 ( a ) B ↑ B ( e $ ↓ A 0 ( a )) = ↑ B ( e $ ↓ A 0 ( a )) = ↑ B ′ ( e ′ $ ↓ A 0 ′ ( a ′ )) ≈ ↓ A 0 ′ ( a ′ ) ∈ Nf ≈ e ′ $ ↓ A 0 ′ ( a ′ ) ∈ Ne ≈ B ′ ∈ U i ↘ R O ( D ) ≈ ↑ B ′ ( e ′ $ ↓ A 0 ′ ( a ′ )) ∈ R O ( D ) (by app-ne) (by app-ne) (by IH (1) on domain: a ≈ a ′ ∈ R I ) (by e ≈ e ′ ∈ Ne and above) (codomain premise at D ) (by IH (2) on codomain)
For (3): Reading back Π ( A 0 , T , ρ ) \Pi(A_0,T,\rho) Π ( A 0 , T , ρ ) as a type at level n n n :
A 0 ≈ A 0 ′ ∈ T y (by IH (3) on domain) ℓ n ≈ ℓ n ∈ N e (reflexivity of level variable) ↑ A 0 ( ℓ n ) ≈ ↑ A 0 ′ ( ℓ n ) ∈ R I (by IH (2) on domain) \begin{aligned}
A_0 &\approx A'_0 \in\mathrm{Ty} && \text{(by IH (3) on domain)}\\
\ell_n &\approx\ell_n \in\mathrm{Ne} && \text{(reflexivity of level variable)}\\
\uparrow^{A_0}(\ell_n) &\approx\uparrow^{A'_0}(\ell_n) \in R_I && \text{(by IH (2) on domain)}
\end{aligned} A 0 ℓ n ↑ A 0 ( ℓ n ) ≈ A 0 ′ ∈ Ty ≈ ℓ n ∈ Ne ≈ ↑ A 0 ′ ( ℓ n ) ∈ R I (by IH (3) on domain) (reflexivity of level variable) (by IH (2) on domain)
Let D n : : ↑ A 0 ( ℓ n ) ≈ ↑ A 0 ′ ( ℓ n ) ∈ R I \mathcal{D}_n :: \uparrow^{A_0}(\ell_n) \approx\uparrow^{A'_0}(\ell_n) \in R_I D n :: ↑ A 0 ( ℓ n ) ≈ ↑ A 0 ′ ( ℓ n ) ∈ R I
⟦ T ⟧ ( ρ , ↑ A 0 ( ℓ n ) / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , ↑ A 0 ′ ( ℓ n ) / x ) ∈ U i ↘ R O ( D n ) (codomain premise at D n ) ⟦ T ⟧ ( ρ , ↑ A 0 ( ℓ n ) / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , ↑ A 0 ′ ( ℓ n ) / x ) ∈ T y (by IH (3) on codomain) \begin{aligned}
\llbracket T \rrbracket(\rho,\uparrow^{A_0}(\ell_n)/x) &\approx\llbracket T' \rrbracket(\rho',\uparrow^{A'_0}(\ell_n)/x) \in U_i \searrow R_O(\mathcal{D}_n) && \text{(codomain premise at }\mathcal{D}_n\text{)}\\
\llbracket T \rrbracket(\rho,\uparrow^{A_0}(\ell_n)/x) &\approx\llbracket T' \rrbracket(\rho',\uparrow^{A'_0}(\ell_n)/x) \in\mathrm{Ty} && \text{(by IH (3) on codomain)}
\end{aligned} [ [ T ] ] ( ρ , ↑ A 0 ( ℓ n ) / x ) [ [ T ] ] ( ρ , ↑ A 0 ( ℓ n ) / x ) ≈ [ [ T ′ ] ] ( ρ ′ , ↑ A 0 ′ ( ℓ n ) / x ) ∈ U i ↘ R O ( D n ) ≈ [ [ T ′ ] ] ( ρ ′ , ↑ A 0 ′ ( ℓ n ) / x ) ∈ Ty (codomain premise at D n ) (by IH (3) on codomain)
The type readback rule for Π \Pi Π -types reads back the domain and codomain separately; both agree by the above. □
Context PER
The PER model and semantic subtyping are extended to contexts and environments. The context PER Γ ≈ Γ ′ ↘ R \Gamma\approx\Gamma' \searrow R Γ ≈ Γ ′ ↘ R relates two contexts and returns a PER R R R on environments, following the same functional-relation pattern as U i U_i U i .
Definition 6.19 (Context PER). The relation Γ ≈ Γ ′ ↘ R \Gamma\approx\Gamma' \searrow R Γ ≈ Γ ′ ↘ R is defined inductively:
\begin{array}{c}
\textsc{Ctx-Emp}\\
\cdot\approx\cdot\searrow\top
\end{array}
\begin{array}{c}
\textsc{Ctx-Ext}\\
\Gamma\approx\Gamma' \searrow R_T \qquad R_T\text{ is a PER}\qquad\forall\mathcal{D} :: \rho\approx\rho' \in R_T.\ [\![S]\!](\rho) \approx[\![S']\!](\rho') \in U_i \searrow R_H(\mathcal{D})\\
\hline
\forall\rho,\rho'.\ \rho\approx\rho' \in R \Longleftrightarrow(\mathcal{D} :: \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R_T \land\rho(0) \approx\rho'(0) \in R_H(\mathcal{D}))\\
\Gamma,x:S \approx\Gamma',x:S' \searrow R
\end{array}
Here ⊤ \top ⊤ is the total relation (any two environments are related), ρ [ ↑ ] \rho[\mathord{\uparrow}] ρ [ ↑ ] is the weakened environment (dropping the head), and ρ ( 0 ) \rho(0) ρ ( 0 ) is the head value. The universe level i i i at which the heads are related is implicit in the conclusion.
Definition 6.20 (Semantic Subtyping for Contexts). The relation Γ < : Γ ′ \Gamma<: \Gamma' Γ <: Γ ′ is defined inductively:
\begin{array}{c}
\textsc{Ctx-<:-Emp}\\
\cdot<: \cdot
\end{array}
\begin{array}{c}
\textsc{Ctx-<:-Ext}\\
\Gamma<: \Gamma' \qquad\Gamma\approx\Gamma' \searrow R_T \qquad\forall\mathcal{D} :: \rho\approx\rho' \in R_T.\ [\![S]\!](\rho) <:_i [\![S']\!](\rho')\\
\Gamma,x:S \approx\Gamma,x:S \searrow R_1 \qquad\Gamma',x:S' \approx\Gamma',x:S' \searrow R_2\\
\hline
\Gamma,x:S <: \Gamma',x:S'
\end{array}
Properties of the Context PER
Lemma 6.21 (Right irrelevance of context PER). If Γ ≈ Γ ′ ↘ R \Gamma\approx\Gamma' \searrow R Γ ≈ Γ ′ ↘ R and Γ ≈ Γ ′ ′ ↘ R ′ \Gamma\approx\Gamma'' \searrow R' Γ ≈ Γ ′′ ↘ R ′ , then R ⇔ R ′ R \Leftrightarrow R' R ⇔ R ′ .
Proof. By induction on the first derivation.
Case
C t x - E m p ⋅ ≈ ⋅ ↘ ⊤ \begin{array}{c}
\mathrm{Ctx\text{-}Emp}\\
\cdot\approx\cdot\searrow\top
\end{array} Ctx - Emp ⋅ ≈ ⋅ ↘ ⊤
The second derivation also concludes ⋅ ≈ ⋅ ↘ ⊤ \cdot\approx\cdot\searrow\top ⋅ ≈ ⋅ ↘ ⊤ , so R = R ′ = ⊤ R = R' = \top R = R ′ = ⊤ and ⊤ ⇔ ⊤ \top\Leftrightarrow\top ⊤ ⇔ ⊤ .
Case The first derivation is:
C t x - E x t Γ ≈ Γ ′ ↘ R T R T is a PER ∀ D : : ρ ≈ ρ ′ ∈ R T . ⟦ S ⟧ ( ρ ) ≈ ⟦ S ′ ⟧ ( ρ ′ ) ∈ U i ↘ R H ( D ) ∀ ρ , ρ ′ . ρ ≈ ρ ′ ∈ R ⇔ ( D : : ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) ) Γ , x : S ≈ Γ ′ , x : S ′ ↘ R \begin{array}{c}
\mathrm{Ctx\text{-}Ext}\\
\Gamma\approx\Gamma' \searrow R_T \qquad R_T\text{ is a PER}\\
\forall D :: \rho\approx\rho' \in R_T.\ \llbracket S\rrbracket(\rho) \approx\llbracket S'\rrbracket(\rho') \in\mathcal{U}_i \searrow R_H(D)\\
\forall\rho,\rho'.\ \rho\approx\rho' \in R \Leftrightarrow(D :: \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R_T \mathbin{\land} \rho(0) \approx\rho'(0) \in R_H(D))\\
\hline
\Gamma,x:S \approx\Gamma',x:S' \searrow R
\end{array} Ctx - Ext Γ ≈ Γ ′ ↘ R T R T is a PER ∀ D :: ρ ≈ ρ ′ ∈ R T . [ [ S ] ] ( ρ ) ≈ [ [ S ′ ] ] ( ρ ′ ) ∈ U i ↘ R H ( D ) ∀ ρ , ρ ′ . ρ ≈ ρ ′ ∈ R ⇔ ( D :: ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D )) Γ , x : S ≈ Γ ′ , x : S ′ ↘ R
The second derivation is:
C t x - E x t Γ ≈ Γ ′ ′ ↘ R T ′ R T ′ is a PER ∀ D ′ : : ρ ≈ ρ ′ ∈ R T ′ . ⟦ S ⟧ ( ρ ) ≈ ⟦ S ′ ′ ⟧ ( ρ ′ ) ∈ U j ↘ R H ′ ( D ′ ) ∀ ρ , ρ ′ . ρ ≈ ρ ′ ∈ R ′ ⇔ ( D ′ : : ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ′ ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ ) ) Γ , x : S ≈ Γ ′ ′ , x : S ′ ′ ↘ R ′ \begin{array}{c}
\mathrm{Ctx\text{-}Ext}\\
\Gamma\approx\Gamma'' \searrow R'_T \qquad R'_T\text{ is a PER}\\
\forall D' :: \rho\approx\rho' \in R'_T.\ \llbracket S\rrbracket(\rho) \approx\llbracket S''\rrbracket(\rho') \in\mathcal{U}_j \searrow R'_H(D')\\
\forall\rho,\rho'.\ \rho\approx\rho' \in R' \Leftrightarrow(D' :: \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R'_T \mathbin{\land} \rho(0) \approx\rho'(0) \in R'_H(D'))\\
\hline
\Gamma,x:S \approx\Gamma'',x:S'' \searrow R'
\end{array} Ctx - Ext Γ ≈ Γ ′′ ↘ R T ′ R T ′ is a PER ∀ D ′ :: ρ ≈ ρ ′ ∈ R T ′ . [ [ S ] ] ( ρ ) ≈ [ [ S ′′ ] ] ( ρ ′ ) ∈ U j ↘ R H ′ ( D ′ ) ∀ ρ , ρ ′ . ρ ≈ ρ ′ ∈ R ′ ⇔ ( D ′ :: ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ′ ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ )) Γ , x : S ≈ Γ ′′ , x : S ′′ ↘ R ′
We show R ⇔ R ′ R \Leftrightarrow R' R ⇔ R ′ , i.e. ρ ≈ ρ ′ ∈ R \rho\approx\rho' \in R ρ ≈ ρ ′ ∈ R iff ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ .
R T ⇔ R T ′ R_T \Leftrightarrow R'_T R T ⇔ R T ′
(by IH on the tails)
( ⇒ ) (\Rightarrow) ( ⇒ ) : Suppose ρ ≈ ρ ′ ∈ R \rho\approx\rho' \in R ρ ≈ ρ ′ ∈ R . By the first biconditional, we obtain D : : ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T D :: \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R_T D :: ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T with ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) \rho(0) \approx\rho'(0) \in R_H(D) ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) .
ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ′ \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R'_T ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ′
(by R T ⇔ R T ′ R_T \Leftrightarrow R'_T R T ⇔ R T ′ ; call this evidence D ′ D' D ′ )
⟦ S ⟧ ( ρ [ ↑ ] ) ≈ ⟦ S ′ ⟧ ( ρ ′ [ ↑ ] ) ∈ U i ↘ R H ( D ) \llbracket S\rrbracket(\rho[\mathord{\uparrow}]) \approx\llbracket S'\rrbracket(\rho'[\mathord{\uparrow}]) \in\mathcal{U}_i \searrow R_H(D) [ [ S ] ] ( ρ [ ↑ ]) ≈ [ [ S ′ ] ] ( ρ ′ [ ↑ ]) ∈ U i ↘ R H ( D )
(from the first head premise at D D D )
⟦ S ⟧ ( ρ [ ↑ ] ) ≈ ⟦ S ′ ′ ⟧ ( ρ ′ [ ↑ ] ) ∈ U j ↘ R H ′ ( D ′ ) \llbracket S\rrbracket(\rho[\mathord{\uparrow}]) \approx\llbracket S''\rrbracket(\rho'[\mathord{\uparrow}]) \in\mathcal{U}_j \searrow R'_H(D') [ [ S ] ] ( ρ [ ↑ ]) ≈ [ [ S ′′ ] ] ( ρ ′ [ ↑ ]) ∈ U j ↘ R H ′ ( D ′ )
(from the second head premise at D ′ D' D ′ )
R H ( D ) ⇔ R H ′ ( D ′ ) R_H(D) \Leftrightarrow R'_H(D') R H ( D ) ⇔ R H ′ ( D ′ )
(by Theorem 6.12: same left type ⟦ S ⟧ ( ρ [ ↑ ] ) \llbracket S\rrbracket(\rho[\mathord{\uparrow}]) [ [ S ] ] ( ρ [ ↑ ]) )
ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ ) \rho(0) \approx\rho'(0) \in R'_H(D') ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ )
(by R H ( D ) ⇔ R H ′ ( D ′ ) R_H(D) \Leftrightarrow R'_H(D') R H ( D ) ⇔ R H ′ ( D ′ ) )
ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′
(by the second biconditional, with witness D ′ D' D ′ )
( ⇐ ) (\Leftarrow) ( ⇐ ) : Symmetric, swapping the roles of the two derivations. □ \square □
Lemma 6.22 (Symmetry of context PER). If Γ ≈ Γ ′ ↘ R \Gamma\approx\Gamma' \searrow R Γ ≈ Γ ′ ↘ R , then:
(1) Γ ′ ≈ Γ ↘ R \Gamma' \approx\Gamma\searrow R Γ ′ ≈ Γ ↘ R , and
(2) ρ ≈ ρ ′ ∈ R \rho\approx\rho' \in R ρ ≈ ρ ′ ∈ R implies ρ ′ ≈ ρ ∈ R \rho' \approx\rho\in R ρ ′ ≈ ρ ∈ R .
Proof. By induction on the derivation.
Case
C t x - E m p ⋅ ≈ ⋅ ↘ ⊤ \begin{array}{c}
\mathrm{Ctx\text{-}Emp}\\
\cdot\approx\cdot\searrow\top
\end{array} Ctx - Emp ⋅ ≈ ⋅ ↘ ⊤
Both statements are immediate (⊤ \top ⊤ is symmetric). Case
\begin{aligned}
&\mathsf{Ctx\text{-}Ext}\\
&\Gamma\approx\Gamma' \searrow R_T \qquad R_T\text{ is a PER}\\
&\forall D :: \rho\approx\rho' \in R_T.\ [\![S']\!](\rho') \approx[\![S]\!](\rho) \in\mathcal{U}_i \searrow R_H(D)\\
&\forall\rho,\rho'.\ \rho\approx\rho' \in R \leftrightarrow(D :: \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R_T \wedge\rho(0) \approx\rho'(0) \in R_H(D))\\
&\hline
\Gamma,x:S \approx\Gamma',x:S' \searrow R
\end{aligned}
For (1): We construct a Ctx-Ext derivation of Γ ′ , x : S ′ ≈ Γ , x : S ↘ R \Gamma',x:S' \approx\Gamma,x:S \searrow R Γ ′ , x : S ′ ≈ Γ , x : S ↘ R . We verify each of the four premises.
Premise 1 (tail):
Γ ′ ≈ Γ ↘ R T (by IH (1) on the tail; same R T by Theorem 6.21) \Gamma' \approx\Gamma\searrow R_T
\qquad\text{(by IH (1) on the tail; same } R_T \text{ by Theorem 6.21)} Γ ′ ≈ Γ ↘ R T (by IH (1) on the tail; same R T by Theorem 6.21)
Premise 2 : R T R_T R T is a PER (by hypothesis).
Premise 3 (head): Given D ′ : : ρ ′ ≈ ρ ∈ R T D' :: \rho' \approx\rho\in R_T D ′ :: ρ ′ ≈ ρ ∈ R T , we must show [ [ S ′ ] ] ( ρ ′ ) ≈ [ [ S ] ] ( ρ ) ∈ U i ↘ R H ′ ( D ′ ) [\![S']\!](\rho') \approx[\![S]\!](\rho) \in\mathcal{U}_i \searrow R'_H(D') [ [ S ′ ] ] ( ρ ′ ) ≈ [ [ S ] ] ( ρ ) ∈ U i ↘ R H ′ ( D ′ ) for some R H ′ R'_H R H ′ .
ρ ≈ ρ ′ ∈ R T (by IH (2) on the tail applied to D ′ ; call this D 0 ) \rho\approx\rho' \in R_T
\qquad\text{(by IH (2) on the tail applied to } D'\text{; call this } D_0\text{)} ρ ≈ ρ ′ ∈ R T (by IH (2) on the tail applied to D ′ ; call this D 0 )
[ [ S ] ] ( ρ ) ≈ [ [ S ′ ] ] ( ρ ′ ) ∈ U i ↘ R H ( D 0 ) (from the original head premise at D 0 ) [\![S]\!](\rho) \approx[\![S']\!](\rho') \in\mathcal{U}_i \searrow R_H(D_0)
\qquad\text{(from the original head premise at } D_0\text{)} [ [ S ] ] ( ρ ) ≈ [ [ S ′ ] ] ( ρ ′ ) ∈ U i ↘ R H ( D 0 ) (from the original head premise at D 0 )
[ [ S ′ ] ] ( ρ ′ ) ≈ [ [ S ] ] ( ρ ) ∈ U i ↘ R H ( D 0 ) (by Theorem 6.13 (1); same R H ( D 0 ) returned) [\![S']\!](\rho') \approx[\![S]\!](\rho) \in\mathcal{U}_i \searrow R_H(D_0)
\qquad\text{(by Theorem 6.13 (1); same } R_H(D_0) \text{ returned)} [ [ S ′ ] ] ( ρ ′ ) ≈ [ [ S ] ] ( ρ ) ∈ U i ↘ R H ( D 0 ) (by Theorem 6.13 (1); same R H ( D 0 ) returned)
Set R H ′ ( D ′ ) : = R H ( D 0 ) R'_H(D') := R_H(D_0) R H ′ ( D ′ ) := R H ( D 0 ) .
Premise 4 (biconditional): We must verify
∀ ρ , ρ ′ . ρ ≈ ρ ′ ∈ R ↔ ( D ′ : : ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ ) ) \forall\rho,\rho'.\ \rho\approx\rho' \in R \leftrightarrow(D' :: \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R_T \wedge\rho(0) \approx\rho'(0) \in R'_H(D')) ∀ ρ , ρ ′ . ρ ≈ ρ ′ ∈ R ↔ ( D ′ :: ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ ))
The original biconditional states:
ρ ≈ ρ ′ ∈ R ↔ ( D : : ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) ) \rho\approx\rho' \in R \leftrightarrow(D :: \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R_T \wedge\rho(0) \approx\rho'(0) \in R_H(D)) ρ ≈ ρ ′ ∈ R ↔ ( D :: ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ))
D D D and D ′ D' D ′ already discharge. Moreover R H ′ ( D ′ ) = R H ( D 0 ) ⇔ R H ( D ) R'_H(D') = R_H(D_0) \Leftrightarrow R_H(D) R H ′ ( D ′ ) = R H ( D 0 ) ⇔ R H ( D ) by right irrelevance. Hence both biconditionals characterize the same R R R .
Γ ′ , x : S ′ ≈ Γ , x : S ↘ R (by Ctx-Ext) \Gamma',x:S' \approx\Gamma,x:S \searrow R
\qquad\text{(by Ctx-Ext)} Γ ′ , x : S ′ ≈ Γ , x : S ↘ R (by Ctx-Ext)
For (2): Suppose ρ ≈ ρ ′ ∈ R \rho\approx\rho' \in R ρ ≈ ρ ′ ∈ R . By the biconditional, there exists D : : ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T D :: \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R_T D :: ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T with ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) \rho(0) \approx\rho'(0) \in R_H(D) ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) . We must show ρ ′ ≈ ρ ∈ R \rho' \approx\rho\in R ρ ′ ≈ ρ ∈ R , i.e. exhibit evidence for ρ ′ [ ↑ ] ≈ ρ [ ↑ ] ∈ R T \rho'[\mathord{\uparrow}] \approx\rho[\mathord{\uparrow}] \in R_T ρ ′ [ ↑ ] ≈ ρ [ ↑ ] ∈ R T together with the heads being related.
ρ ′ [ ↑ ] ≈ ρ [ ↑ ] ∈ R T (by IH (2) on tail applied to D ; call this D ′ ) \rho'[\mathord{\uparrow}] \approx\rho[\mathord{\uparrow}] \in R_T
\qquad\text{(by IH (2) on tail applied to } D\text{; call this } D'\text{)} ρ ′ [ ↑ ] ≈ ρ [ ↑ ] ∈ R T (by IH (2) on tail applied to D ; call this D ′ )
ρ ′ ( 0 ) ≈ ρ ( 0 ) ∈ R H ( D ) (by Theorem 6.13 (2)) \rho'(0) \approx\rho(0) \in R_H(D)
\qquad\text{(by Theorem 6.13 (2))} ρ ′ ( 0 ) ≈ ρ ( 0 ) ∈ R H ( D ) (by Theorem 6.13 (2))
R H ( D ) ⇔ R H ( D ′ ) (by Theorem 6.12) R_H(D) \Leftrightarrow R_H(D')
\qquad\text{(by Theorem 6.12)} R H ( D ) ⇔ R H ( D ′ ) (by Theorem 6.12)
ρ ′ ( 0 ) ≈ ρ ( 0 ) ∈ R H ( D ′ ) (by equivalence) \rho'(0) \approx\rho(0) \in R_H(D')
\qquad\text{(by equivalence)} ρ ′ ( 0 ) ≈ ρ ( 0 ) ∈ R H ( D ′ ) (by equivalence)
The tail evidence D ′ D' D ′ and the head relatedness ρ ′ ( 0 ) ≈ ρ ( 0 ) ∈ R H ( D ′ ) \rho'(0) \approx\rho(0) \in R_H(D') ρ ′ ( 0 ) ≈ ρ ( 0 ) ∈ R H ( D ′ ) together witness ρ ′ ≈ ρ ∈ R \rho' \approx\rho\in R ρ ′ ≈ ρ ∈ R by the biconditional. □ \square □
Lemma 6.23 (Transitivity of context PER). If Γ 1 ≈ Γ 2 ↘ R \Gamma_1 \approx\Gamma_2 \searrow R Γ 1 ≈ Γ 2 ↘ R , then:
(1) Γ 2 ≈ Γ 3 ↘ R ′ \Gamma_2 \approx\Gamma_3 \searrow R' Γ 2 ≈ Γ 3 ↘ R ′ implies Γ 1 ≈ Γ 3 ↘ R \Gamma_1 \approx\Gamma_3 \searrow R Γ 1 ≈ Γ 3 ↘ R , and
(2) ρ 1 ≈ ρ 2 ∈ R \rho_1 \approx\rho_2 \in R ρ 1 ≈ ρ 2 ∈ R and ρ 2 ≈ ρ 3 ∈ R \rho_2 \approx\rho_3 \in R ρ 2 ≈ ρ 3 ∈ R implies ρ 1 ≈ ρ 3 ∈ R \rho_1 \approx\rho_3 \in R ρ 1 ≈ ρ 3 ∈ R .
Proof. By induction on the first derivation.
Case
Ctx-Emp ⋅ ≈ ⋅ ↘ ⊤ \begin{array}{c}
\text{Ctx-Emp}\\
\cdot\approx\cdot\searrow\top
\end{array} Ctx-Emp ⋅ ≈ ⋅ ↘ ⊤
Both statements are immediate (⊤ \top ⊤ is transitive).
Case The first derivation is:
Ctx-Ext Γ 1 ≈ Γ 2 ↘ R T R T is a PER ∀ D : : ρ ≈ ρ ′ ∈ R T . [ [ S 1 ] ] ( ρ ) ≈ [ [ S 2 ] ] ( ρ ′ ) ∈ U i ↘ R H ( D ) ∀ ρ , ρ ′ . ρ ≈ ρ ′ ∈ R ⟺ ( D : : ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) ) Γ 1 , x : S 1 ≈ Γ 2 , x : S 2 ↘ R \begin{array}{c}
\text{Ctx-Ext}\\
\Gamma_1 \approx\Gamma_2 \searrow R_T \qquad R_T\text{ is a PER}\\
\forall D :: \rho\approx\rho' \in R_T.\ [\![S_1]\!](\rho) \approx[\![S_2]\!](\rho') \in U_i \searrow R_H(D)\\
\forall\rho,\rho'.\ \rho\approx\rho' \in R \Longleftrightarrow(D :: \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R_T \land\rho(0) \approx\rho'(0) \in R_H(D))\\
\hline
\Gamma_1,x:S_1 \approx\Gamma_2,x:S_2 \searrow R
\end{array} Ctx-Ext Γ 1 ≈ Γ 2 ↘ R T R T is a PER ∀ D :: ρ ≈ ρ ′ ∈ R T . [ [ S 1 ] ] ( ρ ) ≈ [ [ S 2 ] ] ( ρ ′ ) ∈ U i ↘ R H ( D ) ∀ ρ , ρ ′ . ρ ≈ ρ ′ ∈ R ⟺ ( D :: ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D )) Γ 1 , x : S 1 ≈ Γ 2 , x : S 2 ↘ R
The second derivation is:
Ctx-Ext Γ 2 ≈ Γ 3 ↘ R T ′ R T ′ is a PER ∀ D ′ : : ρ ≈ ρ ′ ∈ R T ′ . [ [ S 2 ] ] ( ρ ) ≈ [ [ S 3 ] ] ( ρ ′ ) ∈ U j ↘ R H ′ ( D ′ ) ∀ ρ , ρ ′ . ρ ≈ ρ ′ ∈ R ′ ⟺ ( D ′ : : ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ′ ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ ) ) Γ 2 , x : S 2 ≈ Γ 3 , x : S 3 ↘ R ′ \begin{array}{c}
\text{Ctx-Ext}\\
\Gamma_2 \approx\Gamma_3 \searrow R'_T \qquad R'_T\text{ is a PER}\\
\forall D' :: \rho\approx\rho' \in R'_T.\ [\![S_2]\!](\rho) \approx[\![S_3]\!](\rho') \in U_j \searrow R'_H(D')\\
\forall\rho,\rho'.\ \rho\approx\rho' \in R' \Longleftrightarrow(D' :: \rho[\mathord{\uparrow}] \approx\rho'[\mathord{\uparrow}] \in R'_T \land\rho(0) \approx\rho'(0) \in R'_H(D'))\\
\hline
\Gamma_2,x:S_2 \approx\Gamma_3,x:S_3 \searrow R'
\end{array} Ctx-Ext Γ 2 ≈ Γ 3 ↘ R T ′ R T ′ is a PER ∀ D ′ :: ρ ≈ ρ ′ ∈ R T ′ . [ [ S 2 ] ] ( ρ ) ≈ [ [ S 3 ] ] ( ρ ′ ) ∈ U j ↘ R H ′ ( D ′ ) ∀ ρ , ρ ′ . ρ ≈ ρ ′ ∈ R ′ ⟺ ( D ′ :: ρ [ ↑ ] ≈ ρ ′ [ ↑ ] ∈ R T ′ ∧ ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ )) Γ 2 , x : S 2 ≈ Γ 3 , x : S 3 ↘ R ′
For (1): We construct a Ctx-Ext derivation of Γ 1 , x : S 1 ≈ Γ 3 , x : S 3 ↘ R \Gamma_1,x:S_1 \approx\Gamma_3,x:S_3 \searrow R Γ 1 , x : S 1 ≈ Γ 3 , x : S 3 ↘ R .
Premise 1 (tail):
Γ 1 ≈ Γ 3 ↘ R T (by IH (1) on the tail) \Gamma_1 \approx\Gamma_3 \searrow R_T \qquad\text{(by IH (1) on the tail)} Γ 1 ≈ Γ 3 ↘ R T (by IH (1) on the tail)
Premise 2: R T R_T R T is a PER (by hypothesis).
Premise 3 (head): Given D : : ρ ≈ ρ ′ ∈ R T D :: \rho\approx\rho' \in R_T D :: ρ ≈ ρ ′ ∈ R T , we must show [ [ S 1 ] ] ( ρ ) ≈ [ [ S 3 ] ] ( ρ ′ ) ∈ U i ↘ R H ′ ′ ( D ) [\![S_1]\!](\rho) \approx[\![S_3]\!](\rho') \in U_i \searrow R''_H(D) [ [ S 1 ] ] ( ρ ) ≈ [ [ S 3 ] ] ( ρ ′ ) ∈ U i ↘ R H ′′ ( D ) .
ρ ≈ ρ ∈ R T (by symmetry + transitivity of R T ) \rho\approx\rho\in R_T \qquad\text{(by symmetry + transitivity of }R_T\text{)} ρ ≈ ρ ∈ R T (by symmetry + transitivity of R T )
Let D 1 : : ρ ≈ ρ ∈ R T D_1 :: \rho\approx\rho\in R_T D 1 :: ρ ≈ ρ ∈ R T .
[ [ S 1 ] ] ( ρ ) ≈ [ [ S 2 ] ] ( ρ ) ∈ U i ↘ R H ( D 1 ) (from first head premise at D 1 ) [\![S_1]\!](\rho) \approx[\![S_2]\!](\rho) \in U_i \searrow R_H(D_1) \qquad\text{(from first head premise at }D_1\text{)} [ [ S 1 ] ] ( ρ ) ≈ [ [ S 2 ] ] ( ρ ) ∈ U i ↘ R H ( D 1 ) (from first head premise at D 1 )
R T ⟺ R T ′ R_T \Longleftrightarrow R'_T R T ⟺ R T ′ (by Theorem 6.12 on tails: same left context Γ 2 \Gamma_2 Γ 2 ).
ρ ≈ ρ ′ ∈ R T ′ (from ρ ≈ ρ ′ ∈ R T and R T ⟺ R T ′ ) \rho\approx\rho' \in R'_T \qquad\text{(from }\rho\approx\rho' \in R_T\text{ and }R_T \Longleftrightarrow R'_T\text{)} ρ ≈ ρ ′ ∈ R T ′ (from ρ ≈ ρ ′ ∈ R T and R T ⟺ R T ′ )
Let D 2 : : ρ ≈ ρ ′ ∈ R T ′ D_2 :: \rho\approx\rho' \in R'_T D 2 :: ρ ≈ ρ ′ ∈ R T ′ .
[ [ S 2 ] ] ( ρ ) ≈ [ [ S 3 ] ] ( ρ ′ ) ∈ U j ↘ R H ′ ( D 2 ) (from second head premise at D 2 ) [\![S_2]\!](\rho) \approx[\![S_3]\!](\rho') \in U_j \searrow R'_H(D_2) \qquad\text{(from second head premise at }D_2\text{)} [ [ S 2 ] ] ( ρ ) ≈ [ [ S 3 ] ] ( ρ ′ ) ∈ U j ↘ R H ′ ( D 2 ) (from second head premise at D 2 )
[ [ S 1 ] ] ( ρ ) ≈ [ [ S 3 ] ] ( ρ ′ ) ∈ U i ↘ R H ( D 1 ) (by xref‘Theorem 6.14 (1)’) [\![S_1]\!](\rho) \approx[\![S_3]\!](\rho') \in U_i \searrow R_H(D_1) \qquad\text{(by {xref}`Theorem 6.14 (1)')} [ [ S 1 ] ] ( ρ ) ≈ [ [ S 3 ] ] ( ρ ′ ) ∈ U i ↘ R H ( D 1 ) (by xref ‘Theorem 6.14 (1)’)
Set R H ′ ′ ( D ) : = R H ( D 1 ) R''_H(D) := R_H(D_1) R H ′′ ( D ) := R H ( D 1 ) .
Premise 4 (biconditional): The biconditional characterizes the same R R R . Since R T R_T R T is a PER, the quantification ranges over the same set of pairs. By Theorem 6.12, R H ′ ′ ( D ) ⟺ R H ( D ) R''_H(D) \Longleftrightarrow R_H(D) R H ′′ ( D ) ⟺ R H ( D ) (both have the same left type [ [ S 1 ] ] ( ρ [ ↑ ] ) [\![S_1]\!](\rho[\mathord{\uparrow}]) [ [ S 1 ] ] ( ρ [ ↑ ]) ), so the biconditional is equivalent to the original.
Γ 1 , x : S 1 ≈ Γ 3 , x : S 3 ↘ R (by Ctx-Ext) \Gamma_1,x:S_1 \approx\Gamma_3,x:S_3 \searrow R \qquad\text{(by Ctx-Ext)} Γ 1 , x : S 1 ≈ Γ 3 , x : S 3 ↘ R (by Ctx-Ext)
For (2): Suppose ρ 1 ≈ ρ 2 ∈ R \rho_1 \approx\rho_2 \in R ρ 1 ≈ ρ 2 ∈ R and ρ 2 ≈ ρ 3 ∈ R \rho_2 \approx\rho_3 \in R ρ 2 ≈ ρ 3 ∈ R . We must show ρ 1 ≈ ρ 3 ∈ R \rho_1 \approx\rho_3 \in R ρ 1 ≈ ρ 3 ∈ R , i.e. exhibit D : : ρ 1 [ ↑ ] ≈ ρ 3 [ ↑ ] ∈ R T D :: \rho_1[\mathord{\uparrow}] \approx\rho_3[\mathord{\uparrow}] \in R_T D :: ρ 1 [ ↑ ] ≈ ρ 3 [ ↑ ] ∈ R T with ρ 1 ( 0 ) ≈ ρ 3 ( 0 ) ∈ R H ( D ) \rho_1(0) \approx\rho_3(0) \in R_H(D) ρ 1 ( 0 ) ≈ ρ 3 ( 0 ) ∈ R H ( D ) . By the biconditional, from ρ 1 ≈ ρ 2 ∈ R \rho_1 \approx\rho_2 \in R ρ 1 ≈ ρ 2 ∈ R we get D 1 : : ρ 1 [ ⇑ ] ≈ ρ 2 [ ⇑ ] ∈ R T D_1 :: \rho_1[\Uparrow] \approx\rho_2[\Uparrow] \in R_T D 1 :: ρ 1 [ ⇑ ] ≈ ρ 2 [ ⇑ ] ∈ R T with ρ 1 ( 0 ) ≈ ρ 2 ( 0 ) ∈ R H ( D 1 ) \rho_1(0) \approx\rho_2(0) \in R_H(D_1) ρ 1 ( 0 ) ≈ ρ 2 ( 0 ) ∈ R H ( D 1 ) . From ρ 2 ≈ ρ 3 ∈ R \rho_2 \approx\rho_3 \in R ρ 2 ≈ ρ 3 ∈ R we get D 2 : : ρ 2 [ ⇑ ] ≈ ρ 3 [ ⇑ ] ∈ R T D_2 :: \rho_2[\Uparrow] \approx\rho_3[\Uparrow] \in R_T D 2 :: ρ 2 [ ⇑ ] ≈ ρ 3 [ ⇑ ] ∈ R T with ρ 2 ( 0 ) ≈ ρ 3 ( 0 ) ∈ R H ( D 2 ) \rho_2(0) \approx\rho_3(0) \in R_H(D_2) ρ 2 ( 0 ) ≈ ρ 3 ( 0 ) ∈ R H ( D 2 ) .
ρ 1 [ ⇑ ] ≈ ρ 3 [ ⇑ ] ∈ R T (by IH (2) on tail; call this D ) R H ( D 1 ) ⟺ R H ( D 2 ) ⟺ R H ( D ) (by Theorem 6.12: same left type) ρ 2 ( 0 ) ≈ ρ 3 ( 0 ) ∈ R H ( D 1 ) (from R H ( D 2 ) ⟺ R H ( D 1 ) ) ρ 1 ( 0 ) ≈ ρ 3 ( 0 ) ∈ R H ( D 1 ) (by Theorem 6.14 (2)) ρ 1 ( 0 ) ≈ ρ 3 ( 0 ) ∈ R H ( D ) (by R H ( D 1 ) ⟺ R H ( D ) ) \begin{aligned}
\rho_{1}[\Uparrow] &\approx\rho_{3}[\Uparrow] \in R_{T} && \text{(by IH (2) on tail; call this }\mathcal{D}\text{)}\\
R_{H}(D_{1}) &\Longleftrightarrow R_{H}(D_{2}) \Longleftrightarrow R_{H}(\mathcal{D}) && \text{(by Theorem 6.12: same left type)}\\
\rho_{2}(0) &\approx\rho_{3}(0) \in R_{H}(D_{1}) && \text{(from }R_{H}(D_{2}) \Longleftrightarrow R_{H}(D_{1})\text{)}\\
\rho_{1}(0) &\approx\rho_{3}(0) \in R_{H}(D_{1}) && \text{(by Theorem 6.14 (2))}\\
\rho_{1}(0) &\approx\rho_{3}(0) \in R_{H}(\mathcal{D}) && \text{(by }R_{H}(D_{1}) \Longleftrightarrow R_{H}(\mathcal{D})\text{)}
\end{aligned} ρ 1 [ ⇑ ] R H ( D 1 ) ρ 2 ( 0 ) ρ 1 ( 0 ) ρ 1 ( 0 ) ≈ ρ 3 [ ⇑ ] ∈ R T ⟺ R H ( D 2 ) ⟺ R H ( D ) ≈ ρ 3 ( 0 ) ∈ R H ( D 1 ) ≈ ρ 3 ( 0 ) ∈ R H ( D 1 ) ≈ ρ 3 ( 0 ) ∈ R H ( D ) (by IH (2) on tail; call this D ) (by Theorem 6.12: same left type) (from R H ( D 2 ) ⟺ R H ( D 1 ) ) (by Theorem 6.14 (2)) (by R H ( D 1 ) ⟺ R H ( D ) )
Hence ρ 1 ≈ ρ 3 ∈ R \rho_1 \approx\rho_3 \in R ρ 1 ≈ ρ 3 ∈ R by the biconditional (with witness D \mathcal{D} D ). □
Lemma 6.24 (Transitivity of semantic subtyping for contexts). If Γ < : Γ ′ \Gamma<: \Gamma' Γ <: Γ ′ , Γ ≈ Γ ′ ↘ R \Gamma\approx\Gamma' \mathrel{\searrow} R Γ ≈ Γ ′ ↘ R , and Γ ′ ≈ Γ ′ ′ ↘ R ′ \Gamma' \approx\Gamma'{}' \mathrel{\searrow} R' Γ ′ ≈ Γ ′ ′ ↘ R ′ , then ρ ≈ ρ ′ ∈ R \rho\approx\rho' \in R ρ ≈ ρ ′ ∈ R implies ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ .
Proof. By induction on the context subtyping derivation.
Case
Ctx-<:-Emp ⋅ < : ⋅ \frac{\text{Ctx-<:-Emp}}{\cdot<: \cdot} ⋅ <: ⋅ Ctx-<:-Emp
Both R R R and R ′ R' R ′ are ⊤ \top ⊤ , so the inclusion is trivial.
Case
Ctx-<:-Ext Γ < : Γ ′ Γ ≈ Γ ′ ↘ R T ∀ D : : ρ ≈ ρ ′ ∈ R T . ⟦ S ⟧ ( ρ ) < : i ⟦ S ′ ⟧ ( ρ ′ ) Γ , x : S ≈ Γ , x : S ↘ R 1 Γ ′ , x : S ′ ≈ Γ ′ , x : S ′ ↘ R 2 Γ , x : S < : Γ ′ , x : S ′ \frac{
\begin{gathered}
\text{Ctx-<:-Ext}\\
\Gamma<: \Gamma' \qquad\Gamma\approx\Gamma' \mathrel{\searrow} R_T\\
\forall D :: \rho\approx\rho' \in R_T.\; \llbracket S\rrbracket(\rho) <:_i \llbracket S'\rrbracket(\rho')\\
\Gamma, x:S \approx\Gamma, x:S \mathrel{\searrow} R_1 \qquad\Gamma', x:S' \approx\Gamma', x:S' \mathrel{\searrow} R_2
\end{gathered}
}{
\Gamma, x:S <: \Gamma', x:S'
} Γ , x : S <: Γ ′ , x : S ′ Ctx-<:-Ext Γ <: Γ ′ Γ ≈ Γ ′ ↘ R T ∀ D :: ρ ≈ ρ ′ ∈ R T . [ [ S ] ] ( ρ ) < : i [ [ S ′ ] ] ( ρ ′ ) Γ , x : S ≈ Γ , x : S ↘ R 1 Γ ′ , x : S ′ ≈ Γ ′ , x : S ′ ↘ R 2
Suppose ρ ≈ ρ ′ ∈ R \rho\approx\rho' \in R ρ ≈ ρ ′ ∈ R . By Theorem 6.21, R ⟺ R 1 R \Longleftrightarrow R_1 R ⟺ R 1 (both derive from Γ , x : S ≈ Γ , x : S \Gamma, x:S \approx\Gamma, x:S Γ , x : S ≈ Γ , x : S ), so ρ ≈ ρ ′ ∈ R 1 \rho\approx\rho' \in R_1 ρ ≈ ρ ′ ∈ R 1 . We must show ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ . By Theorem 6.21, R ′ ⟺ R 2 R' \Longleftrightarrow R_2 R ′ ⟺ R 2 , so it suffices to show ρ ≈ ρ ′ ∈ R 2 \rho\approx\rho' \in R_2 ρ ≈ ρ ′ ∈ R 2 .
By the biconditional of R 1 R_1 R 1 : from ρ ≈ ρ ′ ∈ R 1 \rho\approx\rho' \in R_1 ρ ≈ ρ ′ ∈ R 1 we obtain D : : ρ [ ⇑ ] ≈ ρ ′ [ ⇑ ] ∈ R T \mathcal{D} :: \rho[\Uparrow] \approx\rho'[\Uparrow] \in R_T D :: ρ [ ⇑ ] ≈ ρ ′ [ ⇑ ] ∈ R T with ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) \rho(0) \approx\rho'(0) \in R_H(\mathcal{D}) ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) , where ⟦ S ⟧ ( ρ [ ⇑ ] ) ≈ ⟦ S ⟧ ( ρ ′ [ ⇑ ] ) ∈ U i ↘ R H ( D ) \llbracket S\rrbracket(\rho[\Uparrow]) \approx\llbracket S\rrbracket(\rho'[\Uparrow]) \in U_i \mathrel{\searrow} R_H(\mathcal{D}) [ [ S ] ] ( ρ [ ⇑ ]) ≈ [ [ S ] ] ( ρ ′ [ ⇑ ]) ∈ U i ↘ R H ( D ) .
By the IH on the tail: from ρ [ ⇑ ] ≈ ρ ′ [ ⇑ ] ∈ R T \rho[\Uparrow] \approx\rho'[\Uparrow] \in R_T ρ [ ⇑ ] ≈ ρ ′ [ ⇑ ] ∈ R T we get ρ [ ⇑ ] ≈ ρ ′ [ ⇑ ] ∈ R T ′ \rho[\Uparrow] \approx\rho'[\Uparrow] \in R'_T ρ [ ⇑ ] ≈ ρ ′ [ ⇑ ] ∈ R T ′ (where R T ′ R'_T R T ′ is the tail PER of R 2 R_2 R 2 ; call this evidence D ′ \mathcal{D}' D ′ ).
By the subtyping premise: ⟦ S ⟧ ( ρ [ ⇑ ] ) < : i ⟦ S ′ ⟧ ( ρ ′ [ ⇑ ] ) \llbracket S\rrbracket(\rho[\Uparrow]) <:_i \llbracket S'\rrbracket(\rho'[\Uparrow]) [ [ S ] ] ( ρ [ ⇑ ]) < : i [ [ S ′ ] ] ( ρ ′ [ ⇑ ]) . By the head premise of R 2 R_2 R 2 at D ′ \mathcal{D}' D ′ : ⟦ S ′ ⟧ ( ρ [ ⇑ ] ) ≈ ⟦ S ′ ⟧ ( ρ ′ [ ⇑ ] ) ∈ U i ↘ R H ′ ( D ′ ) \llbracket S'\rrbracket(\rho[\Uparrow]) \approx\llbracket S'\rrbracket(\rho'[\Uparrow]) \in U_i \mathrel{\searrow} R'_H(\mathcal{D}') [ [ S ′ ] ] ( ρ [ ⇑ ]) ≈ [ [ S ′ ] ] ( ρ ′ [ ⇑ ]) ∈ U i ↘ R H ′ ( D ′ ) .
ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) (from above) \rho(0) \approx\rho'(0) \in R_H(\mathcal{D}) \qquad\text{(from above)} ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ( D ) (from above)
ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ ) (by Theorem 6.15: ⟦ S ⟧ ( ρ [ ⇑ ] ) < : i ⟦ S ′ ⟧ ( ρ ′ [ ⇑ ] ) ) \rho(0) \approx\rho'(0) \in R'_{H}(\mathcal{D}') \qquad\text{(by Theorem 6.15: }\llbracket S\rrbracket(\rho[\Uparrow]) <\!:\!_{i} \llbracket S'\rrbracket(\rho'[\Uparrow])\text{)} ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ ) (by Theorem 6.15: [ [ S ] ] ( ρ [ ⇑ ]) < : i [ [ S ′ ] ] ( ρ ′ [ ⇑ ]) )
Hence ρ ≈ ρ ′ ∈ R 2 \rho\approx\rho' \in R_2 ρ ≈ ρ ′ ∈ R 2 by the biconditional of R 2 R_2 R 2 (with witness D ′ \mathcal{D}' D ′ and head ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ ) \rho(0) \approx\rho'(0) \in R'_H(\mathcal{D}') ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H ′ ( D ′ ) ), and thus ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ .
Lemma 6.25 (Initial environment is in context PER). If Γ ≈ Γ ↘ R \Gamma\approx\Gamma\mathrel{\searrow} R Γ ≈ Γ ↘ R , then ↑ Γ ≈ ↑ Γ ∈ R \uparrow^\Gamma\approx\uparrow^\Gamma\in R ↑ Γ ≈ ↑ Γ ∈ R .
Proof. By induction on the derivation of Γ ≈ Γ ↘ R \Gamma\approx\Gamma\mathrel{\searrow} R Γ ≈ Γ ↘ R .
Case Ctx-Emp: R = ⊤ R = \top R = ⊤ , so any two environments are related.
Case Ctx-Ext: By the biconditional, we must exhibit D : : ↑ Γ [ ⇑ ] ≈ ↑ Γ [ ⇑ ] ∈ R T \mathcal{D} :: \uparrow^\Gamma[\Uparrow] \approx\uparrow^\Gamma[\Uparrow] \in R_T D :: ↑ Γ [ ⇑ ] ≈ ↑ Γ [ ⇑ ] ∈ R T with ( ↑ Γ ) ( 0 ) ≈ ( ↑ Γ ) ( 0 ) ∈ R H ( D ) (\uparrow^\Gamma)(0) \approx(\uparrow^\Gamma)(0) \in R_H(\mathcal{D}) ( ↑ Γ ) ( 0 ) ≈ ( ↑ Γ ) ( 0 ) ∈ R H ( D ) .
↑ Γ [ ⇑ ] = ↑ Δ (where Γ = Δ , x : S ) \uparrow^{\Gamma}[\Uparrow] = \uparrow^{\Delta}\qquad\text{(where }\Gamma= \Delta, x:S\text{)} ↑ Γ [ ⇑ ] = ↑ Δ (where Γ = Δ , x : S )
↑ Δ ≈ ↑ Δ ∈ R T \uparrow^{\Delta} \approx\uparrow^{\Delta} \in R_T ↑ Δ ≈ ↑ Δ ∈ R T (by IH on tail; this gives us D \mathcal{D} D )
Let A = ⟦ S ⟧ ( ↑ Δ ) A = \llbracket S \rrbracket(\uparrow^{\Delta}) A = [ [ S ] ] ( ↑ Δ )
A ≈ A ∈ U i ↘ R H ( D ) A \approx A \in U_i \searrow R_H(\mathcal{D}) A ≈ A ∈ U i ↘ R H ( D ) (by the head premise at D \mathcal{D} D )
( ↑ Γ ) ( 0 ) = ↑ A ( ℓ ∣ Δ ∣ ) (\uparrow^{\Gamma})(0) = \uparrow^{A}(\ell_{|\Delta|}) ( ↑ Γ ) ( 0 ) = ↑ A ( ℓ ∣Δ∣ )
ℓ ∣ Δ ∣ ≈ ℓ ∣ Δ ∣ ∈ N e \ell_{|\Delta|} \approx\ell_{|\Delta|} \in\mathrm{Ne} ℓ ∣Δ∣ ≈ ℓ ∣Δ∣ ∈ Ne (a level variable reads back to itself)
↑ A ( ℓ ∣ Δ ∣ ) ≈ ↑ A ( ℓ ∣ Δ ∣ ) ∈ R H ( D ) \uparrow^{A}(\ell_{|\Delta|}) \approx\uparrow^{A}(\ell_{|\Delta|}) \in R_H(\mathcal{D}) ↑ A ( ℓ ∣Δ∣ ) ≈ ↑ A ( ℓ ∣Δ∣ ) ∈ R H ( D ) (by Item 2)
Semantic Judgments
Given a PER a ≈ b ∈ R a \approx b \in R a ≈ b ∈ R , we write { a , b } ⊆ R \{a,b\} \subseteq R { a , b } ⊆ R for the same meaning. This allows us to scale this notation to a larger number related values. By writing { a 1 , a 2 , a 3 } ⊆ R \{a_1,a_2,a_3\} \subseteq R { a 1 , a 2 , a 3 } ⊆ R , we mean a 1 ≈ a 2 ∈ R a_1 \approx a_2 \in R a 1 ≈ a 2 ∈ R and a 2 ≈ a 3 ∈ R a_2 \approx a_3 \in R a 2 ≈ a 3 ∈ R . So this notation gives us convenience when writing down multiple values related by the same relation.
To prove completeness, semantic judgments are defined in three layers. First, we define the semantic judgment for weakening.
Definition 6.26 (Semantic Weakening). The semantic judgment for weakening asks related environments respect weakenings:
Γ ≈ Γ ↘ R Δ ≈ Δ ↘ R ′ ∀ ρ ≈ ρ ′ ∈ R . ⟦ ψ ⟧ ( ρ ) ≈ ⟦ ψ ⟧ ( ρ ′ ) ∈ R ′ Γ ⊢ w ψ : Δ (2) \frac{\Gamma\approx\Gamma\searrow R \qquad\Delta\approx\Delta\searrow R' \qquad\forall\rho\approx\rho' \in R.\ \llbracket\psi\rrbracket(\rho) \approx\llbracket\psi\rrbracket(\rho') \in R'}{\Gamma\vdash_w \psi: \Delta} \tag*{(2)} Γ ⊢ w ψ : Δ Γ ≈ Γ ↘ R Δ ≈ Δ ↘ R ′ ∀ ρ ≈ ρ ′ ∈ R . [ [ ψ ] ] ( ρ ) ≈ [ [ ψ ] ] ( ρ ′ ) ∈ R ′ (2)
Since both weakenings are an operation, the respectfulness of related environments is not guaranteed, so we force this property for semantically well-formed weakening. It immediately questions whether this definition makes sense.
Lemma 6.27 (Identity is a Semantic Weakening). If Γ ≈ Γ ↘ R \Gamma\approx\Gamma\searrow R Γ ≈ Γ ↘ R , then Γ ⊢ w i d : Γ \Gamma\vdash_w id : \Gamma Γ ⊢ w i d : Γ .
Proof. Immediate because ⟦ i d ⟧ ( ρ ) = ρ \llbracket id \rrbracket(\rho) = \rho [ [ i d ] ] ( ρ ) = ρ for weakening. □
Lemma 6.28 (Shift is a Semantic Weakening). If Γ , x : T ≈ Γ , x : T ↘ R \Gamma, x : T \approx\Gamma, x : T \searrow R Γ , x : T ≈ Γ , x : T ↘ R , then Γ , x : T ⊢ w ↑ : Γ \Gamma, x : T \vdash_w \uparrow: \Gamma Γ , x : T ⊢ w ↑: Γ .
Proof. Immediate by analyzing Γ , x : T ≈ Γ , x : T ↘ R \Gamma, x : T \approx\Gamma, x : T \searrow R Γ , x : T ≈ Γ , x : T ↘ R . □
Lemma 6.29 (Composition of Semantic Weakenings). If Γ ⊢ w ψ : Γ ′ \Gamma\vdash_w \psi: \Gamma' Γ ⊢ w ψ : Γ ′ and Γ ′ ⊢ w ϕ : Γ ′ ′ \Gamma' \vdash_w \phi: \Gamma'' Γ ′ ⊢ w ϕ : Γ ′′ , then Γ ⊢ w ϕ ∘ ψ : Γ ′ ′ \Gamma\vdash_w \phi\circ\psi: \Gamma'' Γ ⊢ w ϕ ∘ ψ : Γ ′′ .
Proof. Immediate by the definition of composition. □
Then, we define that for substitutions.
Definition 6.30 (Semantic Substitution Equality). The semantic judgment for substitutions asks substitutions to be related under any semantic weakenings:
Γ ≈ Γ ′ ↘ R Δ ≈ Δ ′ ↘ R O ∀ Γ ′ ′ ≈ Γ ′ ′ ′ ↘ R ′ . Γ ′ ′ ′ ⊢ w ψ : Γ . ∀ ρ ≈ ρ ′ ∈ R ′ . { ⟦ σ [ ψ ] ⟧ ( ρ ) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) } ⊆ R O Γ ⊢ σ ≈ σ ′ : Δ (3) \frac{\Gamma\approx\Gamma' \searrow R \qquad\Delta\approx\Delta' \searrow R_O \qquad\forall\Gamma'' \approx\Gamma''' \searrow R'.\ \Gamma''' \vdash_w \psi: \Gamma.\ \forall\rho\approx\rho' \in R'.\ \{\llbracket\sigma[\psi] \rrbracket(\rho),\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho)),\llbracket\sigma' \rrbracket(\llbracket\psi\rrbracket(\rho')),\llbracket\sigma'[\psi] \rrbracket(\rho')\} \subseteq R_O}{\Gamma\vdash\sigma\approx\sigma' : \Delta} \tag*{(3)} Γ ⊢ σ ≈ σ ′ : Δ Γ ≈ Γ ′ ↘ R Δ ≈ Δ ′ ↘ R O ∀ Γ ′′ ≈ Γ ′′′ ↘ R ′ . Γ ′′′ ⊢ w ψ : Γ. ∀ ρ ≈ ρ ′ ∈ R ′ . { [ [ σ [ ψ ] ] ] ( ρ ) , [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) , [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ σ ′ [ ψ ] ] ] ( ρ ′ )} ⊆ R O (3)
The four values in the conclusion encode two distinct obligations:
Commutation: the outer two values (⟦ σ [ ψ ] ⟧ ( ρ ) \llbracket\sigma[\psi]\rrbracket(\rho) [ [ σ [ ψ ] ] ] ( ρ ) and ⟦ σ ′ [ ψ ′ ] ⟧ ( ρ ′ ) \llbracket\sigma'[\psi']\rrbracket(\rho') [ [ σ ′ [ ψ ′ ] ] ] ( ρ ′ ) ) are related to the inner two (⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) \llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho)) [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) and ⟦ σ ′ ⟧ ( ⟦ ψ ′ ⟧ ( ρ ′ ) \llbracket\sigma'\rrbracket(\llbracket\psi'\rrbracket(\rho') [ [ σ ′ ] ] ( [ [ ψ ′ ] ] ( ρ ′ ) )). This witnesses that evaluation commutes with weakening application: evaluating σ [ ψ ] \sigma[\psi] σ [ ψ ] directly in ρ \rho ρ yields the same result as first evaluating ψ \psi ψ in ρ \rho ρ to get an environment, then evaluating σ \sigma σ in that environment. With explicit substitutions, commutation holds definitionally. With operational substitutions, it becomes a genuine proof obligation.
Relatedness: the inner two values (⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) \llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho)) [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) and ⟦ σ ′ ⟧ ( ⟦ ψ ′ ⟧ ( ρ ′ ) \llbracket\sigma'\rrbracket(\llbracket\psi'\rrbracket(\rho') [ [ σ ′ ] ] ( [ [ ψ ′ ] ] ( ρ ′ ) )) are related in R O R_O R O , witnessing that σ \sigma σ and σ ′ \sigma' σ ′ produce semantically equivalent environments when evaluated in related inputs.
The universal quantification over all Γ ′ \Gamma' Γ ′ , ψ \psi ψ , and ρ ≈ ρ ′ \rho\approx\rho' ρ ≈ ρ ′ gives the judgment a Kripke-like flavor: the relatedness is stable under arbitrary context extensions (weakenings).
Given this definition, we can define the semantic judgment for terms. The key difference from the substitution judgment is that terms are stable under semantic substitutions (rather than weakenings), reflecting the fact that typing is preserved by well-typed substitutions.
Definition 6.31 (Semantic Judgment for Terms). The semantic judgment for terms requires stability under semantic substitutions:
Γ ′ ≈ Γ ↘ R ∃ i ∀ Γ ′ ≈ Γ ′ ↘ R ′ . ∀ Γ ′ ⊢ σ ≈ σ ′ : Γ . ∀ D : : ρ ≈ ρ ′ ∈ R ′ . { ⟦ T [ σ ] ⟧ ( ρ ) , ⟦ T ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ T [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R T ∧ { ⟦ t [ σ ] ⟧ ( ρ ) , ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R T \begin{gathered}
\Gamma' \approx\Gamma\searrow R \qquad\exists i\\
\forall\Gamma' \approx\Gamma' \searrow R'.\forall\Gamma' \vdash\sigma\approx\sigma' : \Gamma.\forall D :: \rho\approx\rho' \in R'.\\
\{\llbracket T[\sigma]\rrbracket(\rho),\llbracket T\rrbracket(\llbracket\sigma\rrbracket(\rho)),\llbracket T\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\llbracket T[\sigma']\rrbracket(\rho')\}\subseteq U_i\searrow R_T\\
\land\{\llbracket t[\sigma]\rrbracket(\rho),\llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho)),\llbracket t'\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\llbracket t'[\sigma']\rrbracket(\rho')\}\subseteq R_T
\end{gathered} Γ ′ ≈ Γ ↘ R ∃ i ∀ Γ ′ ≈ Γ ′ ↘ R ′ .∀ Γ ′ ⊢ σ ≈ σ ′ : Γ.∀ D :: ρ ≈ ρ ′ ∈ R ′ . { [ [ T [ σ ] ] ] ( ρ ) , [ [ T ] ] ( [ [ σ ] ] ( ρ )) , [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ T [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R T ∧ { [ [ t [ σ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ σ ] ] ( ρ )) , [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ t ′ [ σ ′ ] ] ] ( ρ ′ )} ⊆ R T Γ ⊢ t ≈ t ′ : T \Gamma\vdash t \approx t' : T Γ ⊢ t ≈ t ′ : T
As with the substitution judgment, the four-value pattern encodes both commutation and relatedness:
Type commutation: ⟦ T [ σ ] ⟧ ( ρ ) \llbracket T[\sigma]\rrbracket(\rho) [ [ T [ σ ] ] ] ( ρ ) and ⟦ T ⟧ ( ⟦ σ ⟧ ( ρ ) ) \llbracket T\rrbracket(\llbracket\sigma\rrbracket(\rho)) [ [ T ] ] ( [ [ σ ] ] ( ρ )) are related in U i U_i U i , witnessing that evaluating the substituted type directly agrees with first evaluating the substitution and then evaluating the type.
Term commutation: ⟦ t [ σ ] ⟧ ( ρ ) \llbracket t[\sigma]\rrbracket(\rho) [ [ t [ σ ] ] ] ( ρ ) and ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) \llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho)) [ [ t ] ] ( [ [ σ ] ] ( ρ )) are related in R T R_T R T , the same obligation at the term level.
Cross-relatedness: ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) \llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho)) [ [ t ] ] ( [ [ σ ] ] ( ρ )) and ⟦ t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) \llbracket t'\rrbracket(\llbracket\sigma'\rrbracket(\rho')) [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) are related, witnessing semantic equality of t t t and t ′ t' t ′ at the given type.
In an explicit-substitution formulation, the commutation fields would be trivial reflexivities (since ⟦ t [ σ ] ⟧ ( ρ ) \llbracket t[\sigma]\rrbracket(\rho) [ [ t [ σ ] ] ] ( ρ ) is definitionally equal to ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) \llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho)) [ [ t ] ] ( [ [ σ ] ] ( ρ )) ). With operational substitutions, they require genuine proof at every case of the fundamental theorem. This is the central cost of the operational approach, counterbalanced by the absence of a substitution calculus in the syntactic infrastructure.
Finally, we define the semantic judgment for subtyping, which connects the syntactic subtyping judgment Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T with the semantic subtyping relation < : i <:_i < : i on domain values.
Definition 6.32 (Semantic Judgment for Subtyping). The semantic subtyping judgment holds when the evaluations of the two types commute with their respective substitutions and are related by semantic subtyping:
Γ ′ ≈ Γ ↘ R ∃ i ∀ Γ ′ ≈ Γ ′ ↘ R ′ . ∀ Γ ′ ⊢ σ ≈ σ ′ : Γ . ∀ D : : ρ ≈ ρ ′ ∈ R ′ . ⟦ S [ σ ] ⟧ ( ρ ) ≈ ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) ∈ U i ∧ ⟦ T [ σ ′ ] ⟧ ( ρ ′ ) ≈ ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ U i ∧ ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) < i ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) \begin{gathered}
\Gamma' \approx\Gamma\searrow R \qquad\exists i\\
\forall\Gamma' \approx\Gamma' \searrow R'.\forall\Gamma' \vdash\sigma\approx\sigma' : \Gamma.\forall D :: \rho\approx\rho' \in R'.\\
\llbracket S[\sigma]\rrbracket(\rho)\approx\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho))\in U_i\\
\land\llbracket T[\sigma']\rrbracket(\rho')\approx\llbracket T\rrbracket(\llbracket\sigma'\rrbracket(\rho'))\in U_i\\
\land\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho))<_i\llbracket T\rrbracket(\llbracket\sigma'\rrbracket(\rho'))
\end{gathered} Γ ′ ≈ Γ ↘ R ∃ i ∀ Γ ′ ≈ Γ ′ ↘ R ′ .∀ Γ ′ ⊢ σ ≈ σ ′ : Γ.∀ D :: ρ ≈ ρ ′ ∈ R ′ . [ [ S [ σ ] ] ] ( ρ ) ≈ [ [ S ] ] ( [ [ σ ] ] ( ρ )) ∈ U i ∧ [ [ T [ σ ′ ] ] ] ( ρ ′ ) ≈ [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ∈ U i ∧ [ [ S ] ] ( [ [ σ ] ] ( ρ )) < i [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T
Note that semantic subtyping < : i <:_i < : i on domain values already implies (by Theorem 6.15) that the element PER for S S S is included in the element PER for T T T . Hence the semantic subtyping judgment directly supports the subsumption rule: if Γ ⊢ t ≈ t ′ : S \Gamma\vdash t \approx t' : S Γ ⊢ t ≈ t ′ : S and Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T , then Γ ⊢ t ≈ t ′ : T \Gamma\vdash t \approx t' : T Γ ⊢ t ≈ t ′ : T .
Finally, we package the inductive notion of semantic context well-formedness. This judgment maintains, in its derivation, both a context PER witness and the semantic well-formedness of every type in the context.
Definition 6.33 (Semantic Context Well-Formedness). The judgment ⊨ Γ \vDash\Gamma ⊨ Γ is defined inductively:
\begin{array}{c}
\textsc{Sem-Ctx-Emp}\\
\hline
\vDash\cdot
\end{array}
\qquad
\begin{array}{c}
\vDash\Gamma\qquad(\Gamma,x:S) \approx(\Gamma,x:S) \mathrel{\searrow} R \qquad\Gamma\vDash S \approx S : \mathrm{Ty}_i\\
\hline
\vDash\Gamma,x:S
\end{array}
By construction, the Sem-Ctx-Ext rule packages a witness of the context PER ( Γ , x : S ) ≈ ( Γ , x : S ) ↘ R (\Gamma,x:S) \approx(\Gamma,x:S) \mathrel{\searrow} R ( Γ , x : S ) ≈ ( Γ , x : S ) ↘ R together with the semantic well-formedness Γ ⊨ S ≈ S : T y i \Gamma\vDash S \approx S : \mathrm{Ty}_i Γ ⊨ S ≈ S : Ty i , so the corresponding context PER is immediate from any derivation of ⊨ Γ \vDash\Gamma ⊨ Γ .
Lemma 6.34 (Semantic context yields context PER). If ⊨ Γ \vDash\Gamma ⊨ Γ , then Γ ≈ Γ ↘ R \Gamma\approx\Gamma\mathrel{\searrow} R Γ ≈ Γ ↘ R for some R R R .
Proof. By induction on ⊨ Γ \vDash\Gamma ⊨ Γ . The empty case follows from Ctx-Emp, giving ⋅ ≈ ⋅ ↘ ⊤ \cdot\approx\cdot\mathrel{\searrow} \top ⋅ ≈ ⋅ ↘ ⊤ . The extension case directly returns the packaged ( Γ , x : S ) ≈ ( Γ , x : S ) ↘ R (\Gamma,x:S) \approx(\Gamma,x:S) \mathrel{\searrow} R ( Γ , x : S ) ≈ ( Γ , x : S ) ↘ R . □
Properties of Semantic Substitutions
We now establish structural properties of the semantic substitution judgment. These lemmas show that key operations on substitutions—identity, weakening, extension, lifting—preserve semantic relatedness.
Lemma 6.35 (Semantic weakening gives semantic substitution). If Δ ⊨ w ψ : Γ \Delta\vDash_w \psi: \Gamma Δ ⊨ w ψ : Γ , then Δ ⊨ ψ ≈ ψ : Γ \Delta\vDash\psi\approx\psi: \Gamma Δ ⊨ ψ ≈ ψ : Γ .
Proof. We must show: for all Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \mathrel{\searrow} R' Γ ′ ≈ Γ ′ ↘ R ′ , all Γ ′ ⊨ w ϕ : Δ \Gamma' \vDash_w \phi: \Delta Γ ′ ⊨ w ϕ : Δ , and all ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ ,
{ ⟦ ψ [ ϕ ] ⟧ ( ρ ) , ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) , ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) , ⟦ ψ [ ϕ ] ⟧ ( ρ ′ ) } ⊆ R Γ . \{ \llbracket\psi[\phi] \rrbracket(\rho),\ \llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho)),\ \llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho')), \llbracket\psi[\phi] \rrbracket(\rho') \} \subseteq R_\Gamma. { [ [ ψ [ ϕ ] ] ] ( ρ ) , [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ )) , [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ ′ )) , [ [ ψ [ ϕ ] ] ] ( ρ ′ )} ⊆ R Γ .
Recall from Sec. 5 that the evaluation of a weakening ψ \psi ψ in an environment ρ \rho ρ is defined by ⟦ ψ ⟧ ( ρ ) ( n ) = ρ ( ψ ( n ) ) \llbracket\psi\rrbracket(\rho)(n)=\rho(\psi(n)) [ [ ψ ] ] ( ρ ) ( n ) = ρ ( ψ ( n )) , i.e., it reindexes the environment according to ψ \psi ψ . We compute each of the four values:
⟦ ψ [ ϕ ] ⟧ ( ρ ) = ⟦ ψ ∘ ϕ ⟧ ( ρ ) (since ψ [ ϕ ] = ψ ∘ ϕ for weakenings) = λ n . ρ ( ( ψ ∘ ϕ ) ( n ) ) = λ n . ρ ( ϕ ( ψ ( n ) ) ) (by definition of weakening evaluation) ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) = λ n . ( ⟦ ϕ ⟧ ( ρ ) ) ( ψ ( n ) ) (by definition of weakening evaluation) = λ n . ρ ( ϕ ( ψ ( n ) ) ) (since ⟦ ϕ ⟧ ( ρ ) ( k ) = ρ ( ϕ ( k ) ) ) \begin{aligned}
\llbracket\psi[\phi] \rrbracket(\rho) &= \llbracket\psi\circ\phi\rrbracket(\rho) && \text{(since }\psi[\phi]=\psi\circ\phi\text{ for weakenings)}\\
&= \lambda n.\,\rho((\psi\circ\phi)(n)) = \lambda n.\,\rho(\phi(\psi(n))) && \text{(by definition of weakening evaluation)}\\
\llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho)) &= \lambda n.\,(\llbracket\phi\rrbracket(\rho))(\psi(n)) && \text{(by definition of weakening evaluation)}\\
&= \lambda n.\,\rho(\phi(\psi(n))) && \text{(since }\llbracket\phi\rrbracket(\rho)(k)=\rho(\phi(k))\text{)}
\end{aligned} [ [ ψ [ ϕ ] ] ] ( ρ ) [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ )) = [ [ ψ ∘ ϕ ] ] ( ρ ) = λn . ρ (( ψ ∘ ϕ ) ( n )) = λn . ρ ( ϕ ( ψ ( n ))) = λn . ( [ [ ϕ ] ] ( ρ )) ( ψ ( n )) = λn . ρ ( ϕ ( ψ ( n ))) (since ψ [ ϕ ] = ψ ∘ ϕ for weakenings) (by definition of weakening evaluation) (by definition of weakening evaluation) (since [ [ ϕ ] ] ( ρ ) ( k ) = ρ ( ϕ ( k )) )
Hence ⟦ ψ [ ϕ ] ⟧ ( ρ ) = ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) \llbracket\psi[\phi] \rrbracket(\rho)=\llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho)) [ [ ψ [ ϕ ] ] ] ( ρ ) = [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ )) —the commutation is definitional for weakenings. Similarly ⟦ ψ [ ϕ ] ⟧ ( ρ ′ ) = ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) \llbracket\psi[\phi] \rrbracket(\rho')=\llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho')) [ [ ψ [ ϕ ] ] ] ( ρ ′ ) = [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ ′ )) . So all four values collapse to two:
⟦ ψ ∘ ϕ ⟧ ( ρ ) and ⟦ ψ ∘ ϕ ⟧ ( ρ ′ ) . \llbracket\psi\circ\phi\rrbracket(\rho)
\qquad\text{and}\qquad
\llbracket\psi\circ\phi\rrbracket(\rho'). [ [ ψ ∘ ϕ ] ] ( ρ ) and [ [ ψ ∘ ϕ ] ] ( ρ ′ ) .
From Γ ′ ⊨ w ϕ : Δ \Gamma' \vDash_w \phi: \Delta Γ ′ ⊨ w ϕ : Δ and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ , we have ⟦ ϕ ⟧ ( ρ ) ≈ ⟦ ϕ ⟧ ( ρ ′ ) ∈ R Δ \llbracket\phi\rrbracket(\rho) \approx\llbracket\phi\rrbracket(\rho') \in R_\Delta [ [ ϕ ] ] ( ρ ) ≈ [ [ ϕ ] ] ( ρ ′ ) ∈ R Δ . From Δ ⊨ w ψ : Γ \Delta\vDash_w \psi: \Gamma Δ ⊨ w ψ : Γ and ⟦ ϕ ⟧ ( ρ ) ≈ ⟦ ϕ ⟧ ( ρ ′ ) ∈ R Δ \llbracket\phi\rrbracket(\rho) \approx\llbracket\phi\rrbracket(\rho') \in R_\Delta [ [ ϕ ] ] ( ρ ) ≈ [ [ ϕ ] ] ( ρ ′ ) ∈ R Δ , we have
⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) ≈ ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) ∈ R Γ (by the definition of Δ ⊨ w ψ : Γ ) \llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho)) \approx\llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho')) \in R_\Gamma
\qquad\text{(by the definition of }\Delta\vDash_w \psi:\Gamma\text{)} [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ )) ≈ [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ ′ )) ∈ R Γ (by the definition of Δ ⊨ w ψ : Γ )
Since all four values equal ⟦ ψ ∘ ϕ ⟧ ( ρ ) \llbracket\psi\circ\phi\rrbracket(\rho) [ [ ψ ∘ ϕ ] ] ( ρ ) or ⟦ ψ ∘ ϕ ⟧ ( ρ ′ ) \llbracket\psi\circ\phi\rrbracket(\rho') [ [ ψ ∘ ϕ ] ] ( ρ ′ ) (which equal the inner two by the above computation), the four-way relatedness follows by symmetry (Theorem 6.22) and transitivity (Theorem 6.23) of R Γ R_\Gamma R Γ . □
Lemma 6.36 (Identity is semantic). If Γ ≈ Γ ↘ R \Gamma\approx\Gamma\mathrel{\searrow} R Γ ≈ Γ ↘ R , then Γ ⊨ i d ≈ i d : Γ \Gamma\vDash id \approx id : \Gamma Γ ⊨ i d ≈ i d : Γ .
Proof. By Theorem 6.35 applied to Γ ⊨ w i d : Γ \Gamma\vDash_w id : \Gamma Γ ⊨ w i d : Γ (which holds by Theorem 6.27). □
Lemma 6.37 (Shift is semantic). If Γ ≈ Γ ↘ R Γ \Gamma\approx\Gamma\mathrel{\searrow} R_\Gamma Γ ≈ Γ ↘ R Γ and ( Γ , x : S ) ≈ ( Γ , x : S ) ↘ R (\Gamma,x:S) \approx(\Gamma,x:S) \mathrel{\searrow} R ( Γ , x : S ) ≈ ( Γ , x : S ) ↘ R , then Γ , x : S ⊨ ↑ ≈ ↑ : Γ \Gamma,x:S \vDash\uparrow\approx\uparrow: \Gamma Γ , x : S ⊨ ↑≈↑: Γ .
Proof. By Theorem 6.35 applied to Γ , x : S ⊨ w ⇑ Γ \Gamma, x : S \models_{\mathrm{w}\Uparrow} \Gamma Γ , x : S ⊨ w ⇑ Γ (which holds by Theorem 6.28). □
Lemma 6.38 (Identity Instantiation of Semantic Typing). If Γ ⊨ t ≈ t ′ : T \Gamma\models t \approx t' : T Γ ⊨ t ≈ t ′ : T , then for all ρ ≈ ρ ′ ∈ R Γ \rho\approx\rho' \in R_\Gamma ρ ≈ ρ ′ ∈ R Γ (where Γ ≈ Γ ↘ R Γ \Gamma\approx\Gamma\searrow R_\Gamma Γ ≈ Γ ↘ R Γ ), there exists R R R such that:
⟦ T ⟧ ( ρ ) ≈ ⟦ T ⟧ ( ρ ′ ) ∈ U i ↘ R ∧ ⟦ t ⟧ ( ρ ) ≈ ⟦ t ′ ⟧ ( ρ ′ ) ∈ R \llbracket T \rrbracket(\rho) \approx\llbracket T \rrbracket(\rho') \in U_i \searrow R \;\land\; \llbracket t \rrbracket(\rho) \approx\llbracket t' \rrbracket(\rho') \in R [ [ T ] ] ( ρ ) ≈ [ [ T ] ] ( ρ ′ ) ∈ U i ↘ R ∧ [ [ t ] ] ( ρ ) ≈ [ [ t ′ ] ] ( ρ ′ ) ∈ R
Proof. Instantiate Γ ⊨ t ≈ t ′ : T \Gamma\models t \approx t' : T Γ ⊨ t ≈ t ′ : T at Γ \Gamma Γ (with R Γ R_\Gamma R Γ ), the identity semantic substitution Γ ⊨ id ≈ id : Γ \Gamma\models\operatorname{id} \approx\operatorname{id} : \Gamma Γ ⊨ id ≈ id : Γ (Theorem 6.36), and ρ ≈ ρ ′ ∈ R Γ \rho\approx\rho' \in R_\Gamma ρ ≈ ρ ′ ∈ R Γ . Since T [ id ] = T T[\operatorname{id}] = T T [ id ] = T , t [ id ] = t t[\operatorname{id}] = t t [ id ] = t , t ′ [ id ] = t ′ t'[\operatorname{id}] = t' t ′ [ id ] = t ′ , and ⟦ id ⟧ ( ρ ) = ρ \llbracket\operatorname{id} \rrbracket(\rho) = \rho [ [ id ] ] ( ρ ) = ρ , the four-value patterns for the type and term collapse to ⟦ T ⟧ ( ρ ) ≈ ⟦ T ⟧ ( ρ ′ ) ∈ U i ↘ R \llbracket T \rrbracket(\rho) \approx\llbracket T \rrbracket(\rho') \in U_i \searrow R [ [ T ] ] ( ρ ) ≈ [ [ T ] ] ( ρ ′ ) ∈ U i ↘ R and ⟦ t ⟧ ( ρ ) ≈ ⟦ t ′ ⟧ ( ρ ′ ) ∈ R \llbracket t \rrbracket(\rho) \approx\llbracket t' \rrbracket(\rho') \in R [ [ t ] ] ( ρ ) ≈ [ [ t ′ ] ] ( ρ ′ ) ∈ R , respectively. □
Lemma 6.39 (Precomposition with weakening). If Δ ⊨ σ ≈ σ ′ : Δ ′ \Delta\models\sigma\approx\sigma' : \Delta' Δ ⊨ σ ≈ σ ′ : Δ ′ and Γ ⊨ w ψ : Δ \Gamma\models_{\mathrm{w}} \psi: \Delta Γ ⊨ w ψ : Δ , then Γ ⊨ σ [ ψ ] ≈ σ ′ [ ψ ] : Δ ′ \Gamma\models\sigma[\psi] \approx\sigma'[\psi] : \Delta' Γ ⊨ σ [ ψ ] ≈ σ ′ [ ψ ] : Δ ′ .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ be given, with Γ ′ ⊨ w ϕ : Γ \Gamma' \models_{\mathrm{w}} \phi: \Gamma Γ ′ ⊨ w ϕ : Γ and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ . We must show:
{ ⟦ ( σ [ ψ ] ) [ ϕ ] ⟧ ( ρ ) , ⟦ σ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) , ⟦ σ ′ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) , ⟦ ( σ ′ [ ψ ] ) [ ϕ ] ⟧ ( ρ ′ ) } ⊆ R Δ ′ . \{\llbracket(\sigma[\psi])[\phi]\rrbracket(\rho),\ \llbracket\sigma[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho)),\ \llbracket\sigma'[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho')), \ \llbracket(\sigma'[\psi])[\phi]\rrbracket(\rho')\} \subseteq R_{\Delta'}. { [ [ ( σ [ ψ ]) [ ϕ ] ] ] ( ρ ) , [ [ σ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ )) , [ [ σ ′ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ ′ )) , [ [ ( σ ′ [ ψ ]) [ ϕ ] ] ] ( ρ ′ )} ⊆ R Δ ′ . We make two instantiations of the hypothesis Δ ⊨ σ ≈ σ ′ : Δ ′ \Delta\models\sigma\approx\sigma' : \Delta' Δ ⊨ σ ≈ σ ′ : Δ ′ .
First instantiation: at Γ ′ \Gamma' Γ ′ , the composed semantic weakening Γ ′ ⊨ w ψ ∘ ϕ : Δ \Gamma' \models_{\mathrm{w}} \psi\circ\phi: \Delta Γ ′ ⊨ w ψ ∘ ϕ : Δ (by Theorem 6.29 from Γ ′ ⊨ w ϕ : Γ \Gamma' \models_{\mathrm{w}} \phi: \Gamma Γ ′ ⊨ w ϕ : Γ and Γ ⊨ w ψ : Δ \Gamma\models_{\mathrm{w}} \psi: \Delta Γ ⊨ w ψ : Δ ), and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ :
{ ⟦ σ [ ψ ∘ ϕ ] ⟧ ( ρ ) , ⟦ σ ⟧ ( ⟦ ψ ∘ ϕ ⟧ ( ρ ) ) , ⟦ σ ′ ⟧ ( ⟦ ψ ∘ ϕ ⟧ ( ρ ′ ) ) , ⟦ σ ′ [ ψ ∘ ϕ ] ⟧ ( ρ ′ ) } ⊆ R Δ ′ . \{\llbracket\sigma[\psi\circ\phi]\rrbracket(\rho),\ \llbracket\sigma\rrbracket(\llbracket\psi\circ\phi\rrbracket(\rho)),\ \llbracket\sigma'\rrbracket(\llbracket\psi\circ\phi\rrbracket(\rho')), \ \llbracket\sigma'[\psi\circ\phi]\rrbracket(\rho')\} \subseteq R_{\Delta'}. { [ [ σ [ ψ ∘ ϕ ] ] ] ( ρ ) , [ [ σ ] ] ( [ [ ψ ∘ ϕ ] ] ( ρ )) , [ [ σ ′ ] ] ( [ [ ψ ∘ ϕ ] ] ( ρ ′ )) , [ [ σ ′ [ ψ ∘ ϕ ] ] ] ( ρ ′ )} ⊆ R Δ ′ . Since ( σ [ ψ ] ) [ ϕ ] = σ [ ψ ∘ ϕ ] (\sigma[\psi])[\phi] = \sigma[\psi\circ\phi] ( σ [ ψ ]) [ ϕ ] = σ [ ψ ∘ ϕ ] (by Theorem 2.20), the outer values are ⟦ ( σ [ ψ ] ) [ ϕ ] ⟧ ( ρ ) \llbracket(\sigma[\psi])[\phi]\rrbracket(\rho) [ [ ( σ [ ψ ]) [ ϕ ] ] ] ( ρ ) and ⟦ ( σ ′ [ ψ ] ) [ ϕ ] ⟧ ( ρ ′ ) \llbracket(\sigma'[\psi])[\phi]\rrbracket(\rho') [ [ ( σ ′ [ ψ ]) [ ϕ ] ] ] ( ρ ′ ) .
Second instantiation: at Γ \Gamma Γ with R Γ R_\Gamma R Γ , the semantic weakening Γ ⊨ w ψ : Δ \Gamma\models_{\mathrm{w}} \psi: \Delta Γ ⊨ w ψ : Δ (given), and ⟦ ϕ ⟧ ( ρ ) ≈ ⟦ ϕ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\phi\rrbracket(\rho) \approx\llbracket\phi\rrbracket(\rho') \in R_\Gamma [ [ ϕ ] ] ( ρ ) ≈ [ [ ϕ ] ] ( ρ ′ ) ∈ R Γ (from Γ ′ ⊨ w ϕ : Γ \Gamma' \models_{\mathrm{w}} \phi: \Gamma Γ ′ ⊨ w ϕ : Γ applied to ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ ):
{ ⟦ σ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) ) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) ) , ⟦ σ ′ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) } ⊆ R Δ ′ . \{\llbracket\sigma[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho)),\ \llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho))),\ \llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho'))),\ \llbracket\sigma'[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho'))\} \subseteq R_{\Delta'}. { [ [ σ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ )) , [ [ σ ] ] ( [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ ))) , [ [ σ ′ ] ] ( [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ ′ ))) , [ [ σ ′ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ ′ ))} ⊆ R Δ ′ . The outer values here are ⟦ σ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) \llbracket\sigma[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho)) [ [ σ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ )) and ⟦ σ ′ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) \llbracket\sigma'[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho')) [ [ σ ′ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ ′ )) — exactly the inner values of our goal.
Now observe: since ⟦ ψ ∘ ϕ ⟧ ( ρ ) = ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) \llbracket\psi\circ\phi\rrbracket(\rho) = \llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho)) [ [ ψ ∘ ϕ ] ] ( ρ ) = [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ )) (weakenings commute with evaluation definitionally), the inner values of both instantiations coincide: ⟦ σ ⟧ ( ⟦ ψ ∘ ϕ ⟧ ( ρ ) ) = ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) ) \llbracket\sigma\rrbracket(\llbracket\psi\circ\phi\rrbracket(\rho)) = \llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho))) [ [ σ ] ] ( [ [ ψ ∘ ϕ ] ] ( ρ )) = [ [ σ ] ] ( [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ ))) .
From the first instantiation: ⟦ ( σ [ ψ ] ) [ ϕ ] ⟧ ( ρ ) ≈ ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) ) ∈ R Δ ′ \llbracket(\sigma[\psi])[\phi]\rrbracket(\rho) \approx\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho))) \in R_{\Delta'} [ [ ( σ [ ψ ]) [ ϕ ] ] ] ( ρ ) ≈ [ [ σ ] ] ( [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ ))) ∈ R Δ ′ . From the second instantiation: ⟦ σ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) ≈ ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) ) ∈ R Δ ′ \llbracket\sigma[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho)) \approx\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\llbracket\phi\rrbracket(\rho))) \in R_{\Delta'} [ [ σ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ )) ≈ [ [ σ ] ] ( [ [ ψ ] ] ( [ [ ϕ ] ] ( ρ ))) ∈ R Δ ′ . By symmetry and transitivity of R Δ ′ R_{\Delta'} R Δ ′ , all four goal values are related:
⟦ ( σ [ ψ ] ) [ ϕ ] ⟧ ( ρ ) ≈ ⟦ σ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) ∈ R Δ ′ (by transitivity through the shared inner value) \llbracket(\sigma[\psi])[\phi]\rrbracket(\rho) \approx\llbracket\sigma[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho)) \in R_{\Delta'} \qquad\text{(by transitivity through the shared inner value)} [ [ ( σ [ ψ ]) [ ϕ ] ] ] ( ρ ) ≈ [ [ σ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ )) ∈ R Δ ′ (by transitivity through the shared inner value) ⟦ σ ′ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) ≈ ⟦ ( σ ′ [ ψ ] ) [ ϕ ] ⟧ ( ρ ′ ) ∈ R Δ ′ (similarly for the primed side) \llbracket\sigma'[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho')) \approx\llbracket(\sigma'[\psi])[\phi]\rrbracket(\rho') \in R_{\Delta'} \qquad\text{(similarly for the primed side)} [ [ σ ′ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ ′ )) ≈ [ [ ( σ ′ [ ψ ]) [ ϕ ] ] ] ( ρ ′ ) ∈ R Δ ′ (similarly for the primed side) ⟦ σ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) ≈ ⟦ σ ′ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) ∈ R Δ ′ (from the second instantiation, outer-left ≈ outer-right) \llbracket\sigma[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho)) \approx\llbracket\sigma'[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho')) \in R_{\Delta'} \qquad\text{(from the second instantiation, outer-left }\approx\text{ outer-right)} [ [ σ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ )) ≈ [ [ σ ′ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ ′ )) ∈ R Δ ′ (from the second instantiation, outer-left ≈ outer-right) Hence { ⟦ ( σ [ ψ ] ) [ ϕ ] ⟧ ( ρ ) , ⟦ σ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) , ⟦ σ ′ [ ψ ] ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) , ⟦ ( σ ′ [ ψ ] ) [ ϕ ] ⟧ ( ρ ′ ) } ⊆ R Δ ′ \{\llbracket(\sigma[\psi])[\phi]\rrbracket(\rho),\ \llbracket\sigma[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho)),\ \llbracket\sigma'[\psi]\rrbracket(\llbracket\phi\rrbracket(\rho')), \ \llbracket(\sigma'[\psi])[\phi]\rrbracket(\rho')\} \subseteq R_{\Delta'} { [ [ ( σ [ ψ ]) [ ϕ ] ] ] ( ρ ) , [ [ σ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ )) , [ [ σ ′ [ ψ ] ] ] ( [ [ ϕ ] ] ( ρ ′ )) , [ [ ( σ ′ [ ψ ]) [ ϕ ] ] ] ( ρ ′ )} ⊆ R Δ ′ . □
Lemma 6.40 (Precomposition of substitutions by ⇑ \Uparrow ⇑ ). If Γ ⊨ σ ≈ σ ′ : Δ , x : T \Gamma\models\sigma\approx\sigma' : \Delta, x : T Γ ⊨ σ ≈ σ ′ : Δ , x : T , then Γ ⊨ ⇑ ∘ σ ≈ ⇑ ∘ σ ′ : Δ \Gamma\models^{\Uparrow} \circ\sigma\approx\Uparrow\circ\sigma' : \Delta Γ ⊨ ⇑ ∘ σ ≈⇑ ∘ σ ′ : Δ .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊨ w ϕ : Γ \Gamma' \models_{\mathrm{w}} \phi: \Gamma Γ ′ ⊨ w ϕ : Γ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ be given. We must show
{ ⟦ ( ⇑ ∘ σ ) [ ϕ ] ⟧ ( ρ ) , ⟦ ⇑ ∘ σ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) , ⟦ ⇑ ∘ σ ′ ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) , ⟦ ( ⇑ ∘ σ ′ ) [ ϕ ] ⟧ ( ρ ′ ) } ⊆ R Δ . \{\llbracket(\Uparrow\circ\sigma)[\phi]\rrbracket(\rho),\ \llbracket\Uparrow\circ\sigma\rrbracket(\llbracket\phi\rrbracket(\rho)),\ \llbracket\Uparrow\circ\sigma'\rrbracket(\llbracket\phi\rrbracket(\rho')), \ \llbracket(\Uparrow\circ\sigma')[\phi]\rrbracket(\rho')\} \subseteq R_\Delta. { [ [ ( ⇑ ∘ σ ) [ ϕ ] ] ] ( ρ ) , [ [ ⇑ ∘ σ ] ] ( [ [ ϕ ] ] ( ρ )) , [ [ ⇑ ∘ σ ′ ] ] ( [ [ ϕ ] ] ( ρ ′ )) , [ [ ( ⇑ ∘ σ ′ ) [ ϕ ] ] ] ( ρ ′ )} ⊆ R Δ . By Theorem 2.24 (2) and associativity (Theorem 2.22): ( ⇑ ∘ σ ) [ ϕ ] = ( ⇑ ∘ σ ) ∘ ϕ = ⇑ ∘ ( σ ∘ ϕ ) = ⇑ ∘ σ [ ϕ ] (\Uparrow\circ\sigma)[\phi] = (\Uparrow\circ\sigma) \circ\phi= \Uparrow\circ(\sigma\circ\phi) = \Uparrow\circ\sigma[\phi] ( ⇑ ∘ σ ) [ ϕ ] = ( ⇑ ∘ σ ) ∘ ϕ =⇑ ∘ ( σ ∘ ϕ ) =⇑ ∘ σ [ ϕ ] . For any substitution τ \tau τ and any environment ρ 0 \rho_0 ρ 0 , the pointwise definitions give
⟦ ⇑ ∘ τ ⟧ ( ρ 0 ) ( y ) = ⟦ ⇑ ∘ τ ( y ) ⟧ ( ρ 0 ) (pointwise definition of substitution evaluation) = ⟦ ⇑ ( y ) [ τ ] ⟧ ( ρ 0 ) (definition of composition) = ⟦ τ ( y + 1 ) ⟧ ( ρ 0 ) (since ⇑ ( y ) = y + 1 is a variable) \begin{aligned}
\llbracket\Uparrow\circ\tau\rrbracket(\rho_0)(y) &= \llbracket\Uparrow\circ\tau(y)\rrbracket(\rho_0) && \text{(pointwise definition of substitution evaluation)}\\
&= \llbracket\Uparrow(y)[\tau]\rrbracket(\rho_0) && \text{(definition of composition)}\\
&= \llbracket\tau(y+1)\rrbracket(\rho_0) && \text{(since }\Uparrow(y)=y+1\text{ is a variable)}
\end{aligned} [ [ ⇑ ∘ τ ] ] ( ρ 0 ) ( y ) = [ [ ⇑ ∘ τ ( y ) ] ] ( ρ 0 ) = [ [ ⇑ ( y ) [ τ ] ] ] ( ρ 0 ) = [ [ τ ( y + 1 ) ] ] ( ρ 0 ) (pointwise definition of substitution evaluation) (definition of composition) (since ⇑ ( y ) = y + 1 is a variable)
⟦ τ ⟧ ( ρ 0 ) ( y + 1 ) \llbracket\tau\rrbracket(\rho_0)(y+1) [ [ τ ] ] ( ρ 0 ) ( y + 1 )
(pointwise definition again)
= ( ⟦ τ ⟧ ( ρ 0 ) ) [ ⇑ ] ( y ) =(\llbracket\tau\rrbracket(\rho_0))[\Uparrow](y) = ( [ [ τ ] ] ( ρ 0 )) [ ⇑ ] ( y )
(definition of ρ [ ⇑ ] \rho[\Uparrow] ρ [ ⇑ ] )
Hence ⟦ ⇑ ∘ τ ⟧ ( ρ 0 ) = ( ⟦ τ ⟧ ( ρ 0 ) ) [ ⇑ ] \llbracket\Uparrow\mathbin{\circ}\tau\rrbracket(\rho_0)=(\llbracket\tau\rrbracket(\rho_0))[\Uparrow] [ [ ⇑ ∘ τ ] ] ( ρ 0 ) = ( [ [ τ ] ] ( ρ 0 )) [ ⇑ ] definitionally. Specialising:
⟦ ( ⇑ ∘ σ ) [ ϕ ] ⟧ ( ρ ) = ⟦ ⇑ ∘ σ [ ϕ ] ⟧ ( ρ ) = ( ⟦ σ [ ϕ ] ⟧ ( ρ ) ) [ ⇑ ] , \llbracket(\Uparrow\mathbin{\circ}\sigma)[\phi]\rrbracket(\rho)
=\llbracket\Uparrow\mathbin{\circ}\sigma[\phi]\rrbracket(\rho)
=(\llbracket\sigma[\phi]\rrbracket(\rho))[\Uparrow], [ [ ( ⇑ ∘ σ ) [ ϕ ] ] ] ( ρ ) = [ [ ⇑ ∘ σ [ ϕ ] ] ] ( ρ ) = ( [ [ σ [ ϕ ] ] ] ( ρ )) [ ⇑ ] ,
⟦ ⇑ ∘ σ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) = ( ⟦ σ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) ) [ ⇑ ] , \llbracket\Uparrow\mathbin{\circ}\sigma\rrbracket(\llbracket\phi\rrbracket(\rho))
=(\llbracket\sigma\rrbracket(\llbracket\phi\rrbracket(\rho)))[\Uparrow], [ [ ⇑ ∘ σ ] ] ( [ [ ϕ ] ] ( ρ )) = ( [ [ σ ] ] ( [ [ ϕ ] ] ( ρ ))) [ ⇑ ] ,
and analogously for the primed pair. So it suffices to show
{ ( ⟦ σ [ ϕ ] ⟧ ( ρ ) ) [ ⇑ ] , ( ⟦ σ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) ) [ ⇑ ] , ( ⟦ σ ′ ⟧ ( ⟦ ϕ ⟧ ( ρ ′ ) ) ) [ ⇑ ] , ( ⟦ σ ′ [ ϕ ′ ] ⟧ ( ρ ′ ) ) [ ⇑ ] } ⊆ R Δ . \{(\llbracket\sigma[\phi]\rrbracket(\rho))[\Uparrow],\;(\llbracket\sigma\rrbracket(\llbracket\phi\rrbracket(\rho)))[\Uparrow],\;(\llbracket\sigma'\rrbracket(\llbracket\phi\rrbracket(\rho')))[\Uparrow],\;(\llbracket\sigma'[\phi']\rrbracket(\rho'))[\Uparrow]\}\subseteq R_\Delta. {( [ [ σ [ ϕ ] ] ] ( ρ )) [ ⇑ ] , ( [ [ σ ] ] ( [ [ ϕ ] ] ( ρ ))) [ ⇑ ] , ( [ [ σ ′ ] ] ( [ [ ϕ ] ] ( ρ ′ ))) [ ⇑ ] , ( [ [ σ ′ [ ϕ ′ ] ] ] ( ρ ′ )) [ ⇑ ]} ⊆ R Δ .
Apply Γ ⊢ σ ≈ σ ′ : Δ , x : T \Gamma\vdash\sigma\approx\sigma':\Delta,x:T Γ ⊢ σ ≈ σ ′ : Δ , x : T at Γ ′ , ϕ \Gamma',\phi Γ ′ , ϕ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho'\in R' ρ ≈ ρ ′ ∈ R ′ : writing R Δ , x : T R_{\Delta,x:T} R Δ , x : T for the context PER of Δ , x : T \Delta,x:T Δ , x : T ,
{ ⟦ σ [ ϕ ] ⟧ ( ρ ) , ⟦ σ ⟧ ( ⟦ ϕ ⟧ ( ρ ) ) , ⟦ σ ′ ⟧ ( ⟦ ϕ ′ ⟧ ( ρ ′ ) ) , ⟦ σ ′ [ ϕ ′ ] ⟧ ( ρ ′ ) } ⊆ R Δ , x : T . \{\llbracket\sigma[\phi]\rrbracket(\rho),\;\llbracket\sigma\rrbracket(\llbracket\phi\rrbracket(\rho)),\;\llbracket\sigma'\rrbracket(\llbracket\phi'\rrbracket(\rho')),\;\llbracket\sigma'[\phi']\rrbracket(\rho')\}\subseteq R_{\Delta,x:T}. { [ [ σ [ ϕ ] ] ] ( ρ ) , [ [ σ ] ] ( [ [ ϕ ] ] ( ρ )) , [ [ σ ′ ] ] ( [ [ ϕ ′ ] ] ( ρ ′ )) , [ [ σ ′ [ ϕ ′ ] ] ] ( ρ ′ )} ⊆ R Δ , x : T .
By the biconditional of R Δ , x : T R_{\Delta,x:T} R Δ , x : T (from Ctx-Ext), every pair ρ 0 ≈ ρ 0 ′ ∈ R Δ , x : T \rho_0\approx\rho_0'\in R_{\Delta,x:T} ρ 0 ≈ ρ 0 ′ ∈ R Δ , x : T satisfies ρ 0 [ ⇑ ] ≈ ρ 0 ′ [ ⇑ ] ∈ R Δ \rho_0[\Uparrow]\approx\rho_0'[\Uparrow]\in R_\Delta ρ 0 [ ⇑ ] ≈ ρ 0 ′ [ ⇑ ] ∈ R Δ . Applying this pairwise to the four R Δ , x : T R_{\Delta,x:T} R Δ , x : T -related values above yields the desired R Δ R_\Delta R Δ -relatedness of the four shifted values. □
Lemma 6.41 (Symmetry of semantic substitutions). If Γ ⊢ σ ≈ σ ′ : Δ \Gamma\vdash\sigma\approx\sigma':\Delta Γ ⊢ σ ≈ σ ′ : Δ , then Γ ⊢ σ ′ ≈ σ : Δ \Gamma\vdash\sigma'\approx\sigma:\Delta Γ ⊢ σ ′ ≈ σ : Δ .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma'\approx\Gamma'\mathbin{\searrow}R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ w ψ : Γ \Gamma'\vdash_w\psi:\Gamma Γ ′ ⊢ w ψ : Γ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho'\in R' ρ ≈ ρ ′ ∈ R ′ be given. We must show:
{ ⟦ σ ′ [ ψ ] ⟧ ( ρ ) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ σ [ ψ ] ⟧ ( ρ ′ ) } ⊆ R Δ . \{\llbracket\sigma'[\psi]\rrbracket(\rho),\;\llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho)),\;\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho')),\;\llbracket\sigma[\psi]\rrbracket(\rho')\}\subseteq R_\Delta. { [ [ σ ′ [ ψ ] ] ] ( ρ ) , [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ )) , [ [ σ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ σ [ ψ ] ] ] ( ρ ′ )} ⊆ R Δ .
From the hypothesis Γ ⊢ σ ≈ σ ′ : Δ \Gamma\vdash\sigma\approx\sigma':\Delta Γ ⊢ σ ≈ σ ′ : Δ applied at Γ ′ , ψ \Gamma',\psi Γ ′ , ψ , and ρ ′ ≈ ρ ∈ R ′ \rho'\approx\rho\in R' ρ ′ ≈ ρ ∈ R ′ (using symmetry of R ′ R' R ′ , Theorem 6.22):
{ ⟦ σ [ ψ ] ⟧ ( ρ ′ ) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ σ ′ [ ψ ] ⟧ ( ρ ) } ⊆ R Δ . \{\llbracket\sigma[\psi]\rrbracket(\rho'),\;\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho')),\;\llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho)),\;\llbracket\sigma'[\psi]\rrbracket(\rho)\}\subseteq R_\Delta. { [ [ σ [ ψ ] ] ] ( ρ ′ ) , [ [ σ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ )) , [ [ σ ′ [ ψ ] ] ] ( ρ )} ⊆ R Δ .
This gives us ⟦ σ [ ψ ] ⟧ ( ρ ′ ) ≈ ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) ∈ R Δ \llbracket\sigma[\psi]\rrbracket(\rho')\approx\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho'))\in R_\Delta [ [ σ [ ψ ] ] ] ( ρ ′ ) ≈ [ [ σ ] ] ( [ [ ψ ] ] ( ρ ′ )) ∈ R Δ and ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ≈ ⟦ σ ′ [ ψ ] ⟧ ( ρ ) ∈ R Δ \llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho))\approx\llbracket\sigma'[\psi]\rrbracket(\rho)\in R_\Delta [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ )) ≈ [ [ σ ′ [ ψ ] ] ] ( ρ ) ∈ R Δ .
By symmetry of R Δ R_\Delta R Δ (Theorem 6.22), we can reverse pairs. The four values ⟦ σ ′ [ ψ ] ⟧ ( ρ ) \llbracket\sigma'[\psi]\rrbracket(\rho) [ [ σ ′ [ ψ ] ] ] ( ρ ) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) \llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho)) [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ )) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) \llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho')) [ [ σ ] ] ( [ [ ψ ] ] ( ρ ′ )) , ⟦ σ [ ψ ] ⟧ ( ρ ′ ) \llbracket\sigma[\psi]\rrbracket(\rho') [ [ σ [ ψ ] ] ] ( ρ ′ ) are then pairwise related in R Δ R_\Delta R Δ (by symmetry and transitivity), yielding the desired four-way relatedness. □
Lemma 6.42 (Transitivity of semantic substitutions). If Γ ⊢ σ ≈ σ ′ : Δ \Gamma\vdash\sigma\approx\sigma':\Delta Γ ⊢ σ ≈ σ ′ : Δ and Γ ⊢ σ ′ ≈ σ ′ ′ : Δ \Gamma\vdash\sigma'\approx\sigma'':\Delta Γ ⊢ σ ′ ≈ σ ′′ : Δ , then Γ ⊢ σ ≈ σ ′ ′ : Δ \Gamma\vdash\sigma\approx\sigma'':\Delta Γ ⊢ σ ≈ σ ′′ : Δ .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma'\approx\Gamma'\mathbin{\searrow}R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ w ψ : Γ \Gamma'\vdash_w\psi:\Gamma Γ ′ ⊢ w ψ : Γ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho'\in R' ρ ≈ ρ ′ ∈ R ′ be given. From the first hypothesis:
{ ⟦ σ [ ψ ] ⟧ ( ρ ) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) } ⊆ R Δ . \{\llbracket\sigma[\psi]\rrbracket(\rho),\;\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho)),\;\llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho')),\;\llbracket\sigma'[\psi]\rrbracket(\rho')\}\subseteq R_\Delta. { [ [ σ [ ψ ] ] ] ( ρ ) , [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) , [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ σ ′ [ ψ ] ] ] ( ρ ′ )} ⊆ R Δ .
In particular, ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ≈ ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) ∈ R Δ \llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho))\approx\llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho'))\in R_\Delta [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) ≈ [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) ∈ R Δ .
From the second hypothesis applied at the same Γ ′ , ψ \Gamma',\psi Γ ′ , ψ , and ρ ≈ ρ ′ \rho\approx\rho' ρ ≈ ρ ′ :
{ ⟦ σ ′ [ ψ ] ⟧ ( ρ ) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ σ ′ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ σ ′ ′ [ ψ ] ⟧ ( ρ ′ ) } ⊆ R Δ . \{\llbracket\sigma'[\psi]\rrbracket(\rho),\;\llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho)),\;\llbracket\sigma''\rrbracket(\llbracket\psi\rrbracket(\rho')),\;\llbracket\sigma''[\psi]\rrbracket(\rho')\}\subseteq R_\Delta. { [ [ σ ′ [ ψ ] ] ] ( ρ ) , [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ )) , [ [ σ ′′ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ σ ′′ [ ψ ] ] ] ( ρ ′ )} ⊆ R Δ .
In particular, ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ≈ ⟦ σ ′ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) ∈ R Δ \llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho))\approx\llbracket\sigma''\rrbracket(\llbracket\psi\rrbracket(\rho'))\in R_\Delta [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ )) ≈ [ [ σ ′′ ] ] ( [ [ ψ ] ] ( ρ ′ )) ∈ R Δ .
By transitivity of R Δ R_\Delta R Δ (Theorem 6.23), using ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ≈ ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) ∈ R Δ \llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho))\approx\llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho'))\in R_\Delta [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) ≈ [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) ∈ R Δ and (after mediating through symmetry) ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) ≈ ⟦ σ ′ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) ∈ R Δ \llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho'))\approx\llbracket\sigma''\rrbracket(\llbracket\psi\rrbracket(\rho'))\in R_\Delta [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) ≈ [ [ σ ′′ ] ] ( [ [ ψ ] ] ( ρ ′ )) ∈ R Δ , we get ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ≈ ⟦ σ ′ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) ∈ R Δ \llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho))\approx\llbracket\sigma''\rrbracket(\llbracket\psi\rrbracket(\rho'))\in R_\Delta [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) ≈ [ [ σ ′′ ] ] ( [ [ ψ ] ] ( ρ ′ )) ∈ R Δ .
For the outer pair: by similar reasoning on the weakened substitutions, ⟦ σ [ ψ ] ⟧ ( ρ ) ≈ ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ∈ R Δ \llbracket\sigma[\psi]\rrbracket(\rho)\approx\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho))\in R_\Delta [ [ σ [ ψ ] ] ] ( ρ ) ≈ [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) ∈ R Δ (from the first hypothesis) and ⟦ σ ′ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) ≈ ⟦ σ ′ ′ [ ψ ] ⟧ ( ρ ′ ) ∈ R Δ \llbracket\sigma''\rrbracket(\llbracket\psi\rrbracket(\rho'))\approx\llbracket\sigma''[\psi]\rrbracket(\rho')\in R_\Delta [ [ σ ′′ ] ] ( [ [ ψ ] ] ( ρ ′ )) ≈ [ [ σ ′′ [ ψ ] ] ] ( ρ ′ ) ∈ R Δ (from the second hypothesis). By transitivity, all four values are related in R Δ R_\Delta R Δ :
{ ⟦ σ [ ψ ] ⟧ ( ρ ) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ σ ′ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ σ ′ ′ [ ψ ] ⟧ ( ρ ′ ) } ⊆ R Δ . \{\llbracket\sigma[\psi]\rrbracket(\rho),\;\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho)),\;\llbracket\sigma''\rrbracket(\llbracket\psi\rrbracket(\rho')),\;\llbracket\sigma''[\psi]\rrbracket(\rho')\}\subseteq R_\Delta. { [ [ σ [ ψ ] ] ] ( ρ ) , [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) , [ [ σ ′′ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ σ ′′ [ ψ ] ] ] ( ρ ′ )} ⊆ R Δ .
Lemma 6.43 (q q q Preserves Semantic Weakening). If Γ ⊢ w ψ : Δ \Gamma\vdash_w\psi:\Delta Γ ⊢ w ψ : Δ and Δ ⊨ S ≈ S : T y i \Delta\models S\approx S:\mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i , then Γ , x : S [ ψ ] ⊢ w q ( ψ ) : Δ , x : S \Gamma,x:S[\psi]\vdash_w q(\psi):\Delta,x:S Γ , x : S [ ψ ] ⊢ w q ( ψ ) : Δ , x : S .
Proof. From Γ ⊨ w ψ : Δ \Gamma\models_w \psi: \Delta Γ ⊨ w ψ : Δ we have Γ ≈ Γ ↘ R Γ \Gamma\approx\Gamma\mathbin{\searrow} R_\Gamma Γ ≈ Γ ↘ R Γ and Δ ≈ Δ ↘ R Δ \Delta\approx\Delta\mathbin{\searrow} R_\Delta Δ ≈ Δ ↘ R Δ . By Theorem 6.38 on Δ ⊨ S ≈ S : T y i \Delta\models S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i : for every D Δ : : ρ 0 ≈ ρ 0 ′ ∈ R Δ \mathcal{D}_\Delta:: \rho_0 \approx\rho_0' \in R_\Delta D Δ :: ρ 0 ≈ ρ 0 ′ ∈ R Δ , there is R H A ( D Δ ) R_H^\mathsf{A}(\mathcal{D}_\Delta) R H A ( D Δ ) with ⟦ S ⟧ ( ρ 0 ) ≈ ⟦ S ⟧ ( ρ 0 ′ ) ∈ U i ↘ R H A ( D Δ ) \llbracket S \rrbracket(\rho_0) \approx\llbracket S \rrbracket(\rho_0') \in\mathcal{U}_i \mathbin{\searrow} R_H^\mathsf{A}(\mathcal{D}_\Delta) [ [ S ] ] ( ρ 0 ) ≈ [ [ S ] ] ( ρ 0 ′ ) ∈ U i ↘ R H A ( D Δ ) . By Ctx-Ext, this gives ( Δ , x : S ) ≈ ( Δ , x : S ) ↘ R Δ , S (\Delta,x:S) \approx(\Delta,x:S) \mathbin{\searrow} R_{\Delta,S} ( Δ , x : S ) ≈ ( Δ , x : S ) ↘ R Δ , S .
By Theorem 6.35, ψ \psi ψ gives Γ ⊨ ψ ≈ ψ : Δ \Gamma\models\psi\approx\psi: \Delta Γ ⊨ ψ ≈ ψ : Δ . Applying Δ ⊨ S ≈ S : T y i \Delta\models S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i at Γ \Gamma Γ with this semantic substitution and any ρ 0 ≈ ρ 0 ′ ∈ R Γ \rho_0 \approx\rho_0' \in R_\Gamma ρ 0 ≈ ρ 0 ′ ∈ R Γ , the type part gives in particular ⟦ S [ ψ ] ⟧ ( ρ 0 ) ≈ ⟦ S ⟧ ( ⟦ ψ ⟧ ( ρ 0 ) ) ∈ U i ↘ R H Γ \llbracket S[\psi]\rrbracket(\rho_0) \approx\llbracket S\rrbracket(\llbracket\psi\rrbracket(\rho_0)) \in\mathcal{U}_i \mathbin{\searrow} R_H^\Gamma [ [ S [ ψ ] ] ] ( ρ 0 ) ≈ [ [ S ] ] ( [ [ ψ ] ] ( ρ 0 )) ∈ U i ↘ R H Γ (commutation). By Ctx-Ext, this yields ( Γ , x : S [ ψ ] ) ≈ ( Γ , x : S [ ψ ] ) ↘ R Γ , S [ ψ ] (\Gamma,x:S[\psi]) \approx(\Gamma,x:S[\psi]) \mathbin{\searrow} R_{\Gamma,S[\psi]} ( Γ , x : S [ ψ ]) ≈ ( Γ , x : S [ ψ ]) ↘ R Γ , S [ ψ ] .
We must show: for all ρ ≈ ρ ′ ∈ R Γ , S [ ψ ] \rho\approx\rho' \in R_{\Gamma,S[\psi]} ρ ≈ ρ ′ ∈ R Γ , S [ ψ ] , ⟦ q ( ψ ) ⟧ ( ρ ) ≈ ⟦ q ( ψ ) ⟧ ( ρ ′ ) ∈ R Δ , S \llbracket q(\psi)\rrbracket(\rho) \approx\llbracket q(\psi)\rrbracket(\rho') \in R_{\Delta,S} [ [ q ( ψ ) ] ] ( ρ ) ≈ [ [ q ( ψ ) ] ] ( ρ ′ ) ∈ R Δ , S . By the biconditional of R Δ , S R_{\Delta,S} R Δ , S , we must exhibit evidence D : : ( ⟦ q ( ψ ) ⟧ ( ρ ) ) [ ⇑ ] ≈ ( ⟦ q ( ψ ) ⟧ ( ρ ′ ) ) [ ⇑ ] ∈ R Δ \mathcal{D} :: (\llbracket q(\psi)\rrbracket(\rho))[\Uparrow] \approx(\llbracket q(\psi)\rrbracket(\rho'))[\Uparrow] \in R_\Delta D :: ( [ [ q ( ψ ) ] ] ( ρ )) [ ⇑ ] ≈ ( [ [ q ( ψ ) ] ] ( ρ ′ )) [ ⇑ ] ∈ R Δ with ( ⟦ q ( ψ ) ⟧ ( ρ ) ) ( 0 ) ≈ ( ⟦ q ( ψ ) ⟧ ( ρ ′ ) ) ( 0 ) ∈ R H Δ ( D ) (\llbracket q(\psi)\rrbracket(\rho))(0) \approx(\llbracket q(\psi)\rrbracket(\rho'))(0) \in R_H^\Delta(\mathcal{D}) ( [ [ q ( ψ ) ] ] ( ρ )) ( 0 ) ≈ ( [ [ q ( ψ ) ] ] ( ρ ′ )) ( 0 ) ∈ R H Δ ( D ) .
_Tail._
( ⟦ q ( ψ ) ⟧ ( ρ ) ) [ ⇑ ] = ⟦ ψ ⟧ ( ρ [ ⇑ ] ) (since ( ⟦ q ( ψ ) ⟧ ( ρ ) ) [ ⇑ ] ( n ) = ρ ( q ( ψ ) ( n + 1 ) ) = ρ ( ψ ( n ) + 1 ) = ρ [ ⇑ ] ( ψ ( n ) ) ) (\llbracket q(\psi)\rrbracket(\rho))[\Uparrow] = \llbracket\psi\rrbracket(\rho[\Uparrow]) \qquad\text{(since }(\llbracket q(\psi)\rrbracket(\rho))[\Uparrow](n)=\rho(q(\psi)(n+1))=\rho(\psi(n)+1)=\rho[\Uparrow](\psi(n))\text{)} ( [ [ q ( ψ ) ] ] ( ρ )) [ ⇑ ] = [ [ ψ ] ] ( ρ [ ⇑ ]) (since ( [ [ q ( ψ ) ] ] ( ρ )) [ ⇑ ] ( n ) = ρ ( q ( ψ ) ( n + 1 )) = ρ ( ψ ( n ) + 1 ) = ρ [ ⇑ ] ( ψ ( n )) )
From ρ ≈ ρ ′ ∈ R Γ , S [ ψ ] \rho\approx\rho' \in R_{\Gamma,S[\psi]} ρ ≈ ρ ′ ∈ R Γ , S [ ψ ] , by the biconditional of R Γ , S [ ψ ] R_{\Gamma,S[\psi]} R Γ , S [ ψ ] : ρ [ ⇑ ] ≈ ρ ′ [ ⇑ ] ∈ R Γ \rho[\Uparrow] \approx\rho'[\Uparrow] \in R_\Gamma ρ [ ⇑ ] ≈ ρ ′ [ ⇑ ] ∈ R Γ . From Γ ⊨ w ψ : Δ \Gamma\models_w \psi: \Delta Γ ⊨ w ψ : Δ : ⟦ ψ ⟧ ( ρ [ ⇑ ] ) ≈ ⟦ ψ ⟧ ( ρ ′ [ ⇑ ] ) ∈ R Δ \llbracket\psi\rrbracket(\rho[\Uparrow]) \approx\llbracket\psi\rrbracket(\rho'[\Uparrow]) \in R_\Delta [ [ ψ ] ] ( ρ [ ⇑ ]) ≈ [ [ ψ ] ] ( ρ ′ [ ⇑ ]) ∈ R Δ . This gives evidence D \mathcal{D} D .
_Head._
( ⟦ q ( ψ ) ⟧ ( ρ ) ) ( 0 ) = ρ ( 0 ) (since q ( ψ ) ( 0 ) = 0 ) (\llbracket q(\psi)\rrbracket(\rho))(0)=\rho(0) \qquad\text{(since }q(\psi)(0)=0\text{)} ( [ [ q ( ψ ) ] ] ( ρ )) ( 0 ) = ρ ( 0 ) (since q ( ψ ) ( 0 ) = 0 )
From ρ ≈ ρ ′ ∈ R Γ , S [ ψ ] \rho\approx\rho' \in R_{\Gamma,S[\psi]} ρ ≈ ρ ′ ∈ R Γ , S [ ψ ] , by the biconditional of R Γ , S [ ψ ] R_{\Gamma,S[\psi]} R Γ , S [ ψ ] , there exists evidence D ′ \mathcal{D}' D ′ such that ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H Γ ( D ′ ) \rho(0) \approx\rho'(0) \in R_H^\Gamma(\mathcal{D}') ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H Γ ( D ′ ) , where R H Γ R_H^\Gamma R H Γ comes from ⟦ S [ ψ ] ⟧ ( ρ [ ⇑ ] ) ≈ ⟦ S [ ψ ] ⟧ ( ρ ′ [ ⇑ ] ) ∈ U i ↘ R H Γ ( D ′ ) \llbracket S[\psi]\rrbracket(\rho[\Uparrow]) \approx\llbracket S[\psi]\rrbracket(\rho'[\Uparrow]) \in\mathcal{U}_i \mathbin{\searrow} R_H^\Gamma(\mathcal{D}') [ [ S [ ψ ] ] ] ( ρ [ ⇑ ]) ≈ [ [ S [ ψ ] ] ] ( ρ ′ [ ⇑ ]) ∈ U i ↘ R H Γ ( D ′ ) .
By the head premise of R Δ , S R_{\Delta,S} R Δ , S at D \mathcal{D} D (using ⟦ ψ ⟧ ( ρ [ ⇑ ] ) ≈ ⟦ ψ ⟧ ( ρ ′ [ ⇑ ] ) ∈ R Δ \llbracket\psi\rrbracket(\rho[\Uparrow]) \approx\llbracket\psi\rrbracket(\rho'[\Uparrow]) \in R_\Delta [ [ ψ ] ] ( ρ [ ⇑ ]) ≈ [ [ ψ ] ] ( ρ ′ [ ⇑ ]) ∈ R Δ ): ⟦ S ⟧ ( ⟦ ψ ⟧ ( ρ [ ⇑ ] ) ) ≈ ⟦ S ⟧ ( ⟦ ψ ⟧ ( ρ ′ [ ⇑ ] ) ) ∈ U i ↘ R H Δ ( D ) \llbracket S\rrbracket(\llbracket\psi\rrbracket(\rho[\Uparrow])) \approx\llbracket S\rrbracket(\llbracket\psi\rrbracket(\rho'[\Uparrow])) \in\mathcal{U}_i \mathbin{\searrow} R_H^\Delta(\mathcal{D}) [ [ S ] ] ( [ [ ψ ] ] ( ρ [ ⇑ ])) ≈ [ [ S ] ] ( [ [ ψ ] ] ( ρ ′ [ ⇑ ])) ∈ U i ↘ R H Δ ( D ) .
From the semantic well-formedness Δ ⊨ S ≈ S : T y i \Delta\models S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i , instantiated as above (at Γ \Gamma Γ , Γ ⊨ ψ ≈ ψ : Δ \Gamma\models\psi\approx\psi: \Delta Γ ⊨ ψ ≈ ψ : Δ , ρ [ ⇑ ] ≈ ρ ′ [ ⇑ ] \rho[\Uparrow] \approx\rho'[\Uparrow] ρ [ ⇑ ] ≈ ρ ′ [ ⇑ ] ), the type part gives in particular the commutation ⟦ S [ ψ ] ⟧ ( ρ [ ⇑ ] ) ≈ ⟦ S ⟧ ( ⟦ ψ ⟧ ( ρ [ ⇑ ] ) ) ∈ U i \llbracket S[\psi]\rrbracket(\rho[\Uparrow]) \approx\llbracket S\rrbracket(\llbracket\psi\rrbracket(\rho[\Uparrow])) \in\mathcal{U}_i [ [ S [ ψ ] ] ] ( ρ [ ⇑ ]) ≈ [ [ S ] ] ( [ [ ψ ] ] ( ρ [ ⇑ ])) ∈ U i . By Theorem 6.12, R H Γ ( D ′ ) ⇔ R H Δ ( D ) R_H^\Gamma(\mathcal{D}') \Leftrightarrow R_H^\Delta(\mathcal{D}) R H Γ ( D ′ ) ⇔ R H Δ ( D ) (both have the same left-hand domain type up to ⇔ \Leftrightarrow ⇔ ). Hence ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H Δ ( D ) \rho(0) \approx\rho'(0) \in R_H^\Delta(\mathcal{D}) ρ ( 0 ) ≈ ρ ′ ( 0 ) ∈ R H Δ ( D ) . □
Lemma 6.44 (Extension is semantic). If Γ ⊨ σ ≈ σ ′ : Δ \Gamma\models\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ , Δ ⊨ S ≈ S : T y i \Delta\models S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i , and Γ ⊨ t ≈ t ′ : S [ σ ] \Gamma\models t \approx t' : S[\sigma] Γ ⊨ t ≈ t ′ : S [ σ ] , then Γ ⊨ ( σ , t / x ) ≈ ( σ ′ , t ′ / x ) : Δ , x : S \Gamma\models(\sigma,t/x) \approx(\sigma',t'/x) : \Delta,x:S Γ ⊨ ( σ , t / x ) ≈ ( σ ′ , t ′ / x ) : Δ , x : S .
Proof. From Γ ⊨ σ ≈ σ ′ : Δ \Gamma\models\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ we have Δ ≈ Δ ↘ R Δ \Delta\approx\Delta\mathbin{\searrow} R_\Delta Δ ≈ Δ ↘ R Δ . By Theorem 6.38 on Δ ⊨ S ≈ S : T y i \Delta\models S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i : for every D Δ : : ρ 0 ≈ ρ 0 ′ ∈ R Δ \mathcal{D}_\Delta:: \rho_0 \approx\rho_0' \in R_\Delta D Δ :: ρ 0 ≈ ρ 0 ′ ∈ R Δ , there is R H Δ ( D Δ ) R_H^\Delta(\mathcal{D}_\Delta) R H Δ ( D Δ ) with ⟦ S ⟧ ( ρ 0 ) ≈ ⟦ S ⟧ ( ρ 0 ′ ) ∈ U i ↘ R H Δ ( D Δ ) \llbracket S\rrbracket(\rho_0) \approx\llbracket S\rrbracket(\rho_0') \in\mathcal{U}_i \mathbin{\searrow} R_H^\Delta(\mathcal{D}_\Delta) [ [ S ] ] ( ρ 0 ) ≈ [ [ S ] ] ( ρ 0 ′ ) ∈ U i ↘ R H Δ ( D Δ ) . By Ctx-Ext, this gives ( Δ , x : S ) ≈ ( Δ , x : S ) ↘ R Δ , x : S (\Delta,x:S) \approx(\Delta,x:S) \mathbin{\searrow} R_{\Delta,x:S} ( Δ , x : S ) ≈ ( Δ , x : S ) ↘ R Δ , x : S .
Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \mathbin{\searrow} R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊨ w ψ : Γ \Gamma' \models_w \psi: \Gamma Γ ′ ⊨ w ψ : Γ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ be given. We must show:
{ ⟦ ( σ , t / x ) [ ψ ] ⟧ ( ρ ) , ⟦ ( σ , t / x ) ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ ( σ ′ , t ′ / x ) ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ ( σ ′ , t ′ / x ) [ ψ ] ⟧ ( ρ ′ ) } ⊆ R Δ , x : S . \{\llbracket(\sigma,t/x)[\psi]\rrbracket(\rho),\ \llbracket(\sigma,t/x)\rrbracket(\llbracket\psi\rrbracket(\rho)),\ \llbracket(\sigma',t'/x)\rrbracket(\llbracket\psi\rrbracket(\rho')),\ \llbracket(\sigma',t'/x)[\psi]\rrbracket(\rho')\} \subseteq R_{\Delta,x:S}. { [ [ ( σ , t / x ) [ ψ ] ] ] ( ρ ) , [ [ ( σ , t / x ) ] ] ( [ [ ψ ] ] ( ρ )) , [ [ ( σ ′ , t ′ / x ) ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ ( σ ′ , t ′ / x ) [ ψ ] ] ] ( ρ ′ )} ⊆ R Δ , x : S .
Each of the four environments has the form (tail, head): the tail is the value of the underlying substitution on Δ \Delta Δ , and the head is the value at position x x x . By the biconditional of R Δ , x : S R_{\Delta,x:S} R Δ , x : S , it suffices to show the tails are pairwise related in R Δ R_\Delta R Δ (yielding evidence D \mathcal{D} D ) and the heads are related in R H Δ ( D ) R_H^\Delta(\mathcal{D}) R H Δ ( D ) .
_Tails._ Since ( σ , t / x ) [ ψ ] = ( σ [ ψ ] , t [ ψ ] / x ) (\sigma,t/x)[\psi] = (\sigma[\psi],t[\psi]/x) ( σ , t / x ) [ ψ ] = ( σ [ ψ ] , t [ ψ ] / x ) (by Theorem 2.24), the four tail environments are:
⟦ σ [ ψ ] ⟧ ( ρ ) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) . \llbracket\sigma[\psi]\rrbracket(\rho),\quad\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho)),\quad\llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho')),\quad\llbracket\sigma'[\psi]\rrbracket(\rho'). [ [ σ [ ψ ] ] ] ( ρ ) , [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) , [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ σ ′ [ ψ ] ] ] ( ρ ′ ) .
From Γ ⊨ σ ≈ σ ′ : Δ \Gamma\models\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ instantiated at Γ ′ \Gamma' Γ ′ , ψ \psi ψ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ :
{ ⟦ σ [ ψ ] ⟧ ( ρ ) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) } ⊆ R Δ . \{\llbracket\sigma[\psi]\rrbracket(\rho),\ \llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho)),\ \llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho')),\ \llbracket\sigma'[\psi]\rrbracket(\rho')\} \subseteq R_\Delta. { [ [ σ [ ψ ] ] ] ( ρ ) , [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) , [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ σ ′ [ ψ ] ] ] ( ρ ′ )} ⊆ R Δ .
In particular, the outer pair gives evidence D : : ⟦ σ [ ψ ] ⟧ ( ρ ) ≈ ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) ∈ R Δ \mathcal{D} :: \llbracket\sigma[\psi]\rrbracket(\rho) \approx\llbracket\sigma'[\psi]\rrbracket(\rho') \in R_\Delta D :: [ [ σ [ ψ ] ] ] ( ρ ) ≈ [ [ σ ′ [ ψ ] ] ] ( ρ ′ ) ∈ R Δ .
_Heads._ The four heads are:
⟦ t [ ψ ] ⟧ ( ρ ) , ⟦ t ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ t ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ t ′ [ ψ ] ⟧ ( ρ ′ ) . \llbracket t[\psi]\rrbracket(\rho),\quad\llbracket t\rrbracket(\llbracket\psi\rrbracket(\rho)),\quad\llbracket t'\rrbracket(\llbracket\psi\rrbracket(\rho')), \quad\llbracket t'[\psi]\rrbracket(\rho'). [ [ t [ ψ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ ψ ] ] ( ρ )) , [ [ t ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ t ′ [ ψ ] ] ] ( ρ ′ ) .
We must show they are related in R H Δ ( D ) R_H^\Delta(\mathcal{D}) R H Δ ( D ) , where R H Δ ( D ) R_H^\Delta(\mathcal{D}) R H Δ ( D ) comes from
⟦ S ⟧ ( ⟦ σ [ ψ ] ⟧ ( ρ ) ) ≈ ⟦ S ⟧ ( ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) ) ∈ U i ↘ R H Δ ( D ) . \llbracket S\rrbracket(\llbracket\sigma[\psi]\rrbracket(\rho)) \approx\llbracket S\rrbracket(\llbracket\sigma'[\psi]\rrbracket(\rho')) \in\mathcal{U}_i \mathbin{\searrow} R_H^\Delta(\mathcal{D}). [ [ S ] ] ( [ [ σ [ ψ ] ] ] ( ρ )) ≈ [ [ S ] ] ( [ [ σ ′ [ ψ ] ] ] ( ρ ′ )) ∈ U i ↘ R H Δ ( D ) .
From Γ ⊢ t ≈ t ′ : S [ σ ] \Gamma\vdash t \approx t' : S[\sigma] Γ ⊢ t ≈ t ′ : S [ σ ] at Γ ′ \Gamma' Γ ′ , ψ \psi ψ , ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ , the type part gives some R t R_t R t with ⟦ ρ ⟧ ≈ ⟦ S [ σ ] ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ∈ U i ↘ R t \llbracket\rho\rrbracket\approx\llbracket S[\sigma]\rrbracket(\llbracket\psi\rrbracket(\rho)) \in\mathcal{U}_i \searrow R_t [ [ ρ ] ] ≈ [ [ S [ σ ] ] ] ( [ [ ψ ] ] ( ρ )) ∈ U i ↘ R t (and analogous primed versions), and the term part gives
{ ⟦ t [ ψ ] ⟧ ( ρ ) , ⟦ t ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ t ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ t ′ [ ψ ] ⟧ ( ρ ′ ) } ⊆ R t \{\llbracket t[\psi]\rrbracket(\rho),\llbracket t\rrbracket(\llbracket\psi\rrbracket(\rho)),\llbracket t'\rrbracket(\llbracket\psi\rrbracket(\rho')),\llbracket t'[\psi]\rrbracket(\rho')\} \subseteq R_t { [ [ t [ ψ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ ψ ] ] ( ρ )) , [ [ t ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ t ′ [ ψ ] ] ] ( ρ ′ )} ⊆ R t .
It remains to show R t ⇔ R H A ( D ) R_t \Leftrightarrow R_H^A(\mathcal{D}) R t ⇔ R H A ( D ) . Note that ⟦ ρ ⟧ = ⟦ S [ σ [ ψ ] ] ⟧ ( ρ ) \llbracket\rho\rrbracket= \llbracket S[\sigma[\psi]]\rrbracket(\rho) [ [ ρ ] ] = [ [ S [ σ [ ψ ]] ] ] ( ρ ) (by Theorem 2.20). By Theorem 6.39, we have Γ ′ ⊨ σ [ ψ ] ≈ σ ′ [ ψ ] : Δ \Gamma' \models\sigma[\psi] \approx\sigma'[\psi] : \Delta Γ ′ ⊨ σ [ ψ ] ≈ σ ′ [ ψ ] : Δ . Instantiating Δ ⊨ S ≈ S : T y i \Delta\models S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i at Γ ′ \Gamma' Γ ′ , this semantic substitution, and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ : the type part gives the commutation
⟦ S [ σ [ ψ ] ] ⟧ ( ρ ) ≈ ⟦ S ⟧ ( ⟦ σ [ ψ ] ⟧ ( ρ ) ) ∈ U i . \llbracket S[\sigma[\psi]]\rrbracket(\rho) \approx\llbracket S\rrbracket(\llbracket\sigma[\psi]\rrbracket(\rho)) \in\mathcal{U}_i. [ [ S [ σ [ ψ ]] ] ] ( ρ ) ≈ [ [ S ] ] ( [ [ σ [ ψ ] ] ] ( ρ )) ∈ U i .
Hence R t R_t R t (from ⟦ S [ σ [ ψ ] ] ⟧ ( ρ ) \llbracket S[\sigma[\psi]]\rrbracket(\rho) [ [ S [ σ [ ψ ]] ] ] ( ρ ) ) and R H A ( D ) R_H^A(\mathcal{D}) R H A ( D ) (from ⟦ S ⟧ ( ⟦ σ [ ψ ] ⟧ ( ρ ) ) \llbracket S\rrbracket(\llbracket\sigma[\psi]\rrbracket(\rho)) [ [ S ] ] ( [ [ σ [ ψ ] ] ] ( ρ )) ) have related left-hand types in U i \mathcal{U}_i U i ; by Theorem 6.12, R t ⇔ R H A ( D ) R_t \Leftrightarrow R_H^A(\mathcal{D}) R t ⇔ R H A ( D ) . Therefore the four heads are in R H A ( D ) R_H^A(\mathcal{D}) R H A ( D ) .
Lemma 6.45 (Extension by precomposed term). If Γ ⊨ σ ≈ σ ′ : Δ \Gamma\models\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ and Δ ⊨ t ≈ t ′ : T \Delta\models t \approx t' : T Δ ⊨ t ≈ t ′ : T , then Γ ⊨ ( σ , t [ σ ] / x ) ≈ ( σ ′ , t ′ [ σ ′ ] / x ) : Δ , x : T \Gamma\models(\sigma,t[\sigma]/x) \approx(\sigma',t'[\sigma']/x) : \Delta,x:T Γ ⊨ ( σ , t [ σ ] / x ) ≈ ( σ ′ , t ′ [ σ ′ ] / x ) : Δ , x : T .
Proof. By Theorem 6.38 on Δ ⊨ t ≈ t ′ : T \Delta\models t \approx t' : T Δ ⊨ t ≈ t ′ : T , for any ρ 0 ≈ ρ 0 ′ ∈ R Δ \rho_0 \approx\rho'_0 \in R_\Delta ρ 0 ≈ ρ 0 ′ ∈ R Δ : ⟦ T ⟧ ( ρ 0 ) ≈ ⟦ T ⟧ ( ρ 0 ′ ) ∈ U i ↘ R H A \llbracket T\rrbracket(\rho_0) \approx\llbracket T\rrbracket(\rho'_0) \in\mathcal{U}_i \searrow R_H^A [ [ T ] ] ( ρ 0 ) ≈ [ [ T ] ] ( ρ 0 ′ ) ∈ U i ↘ R H A . By Ctx-Ext, this yields ( Δ , x : T ) ≈ ( Δ , x : T ) ↘ R Δ , x : T (\Delta,x:T) \approx(\Delta,x:T) \searrow R_{\Delta,x:T} ( Δ , x : T ) ≈ ( Δ , x : T ) ↘ R Δ , x : T .
Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊨ w ψ : Γ \Gamma' \models_w \psi: \Gamma Γ ′ ⊨ w ψ : Γ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ be given. We must show:
{ ⟦ ( σ , t [ σ ] / x ) [ ψ ] ⟧ ( ρ ) , ⟦ ( σ , t [ σ ] / x ) ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ ( σ ′ , t ′ [ σ ′ ] / x ) ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ ( σ ′ , t ′ [ σ ′ ] / x ) [ ψ ] ⟧ ( ρ ′ ) } ⊆ R Δ , x : T \{\llbracket(\sigma,t[\sigma]/x)[\psi]\rrbracket(\rho),\llbracket(\sigma,t[\sigma]/x)\rrbracket(\llbracket\psi\rrbracket(\rho)),\llbracket(\sigma',t'[\sigma']/x)\rrbracket(\llbracket\psi\rrbracket(\rho')),\llbracket(\sigma',t'[\sigma']/x)[\psi]\rrbracket(\rho')\} \subseteq R_{\Delta,x:T} { [ [ ( σ , t [ σ ] / x ) [ ψ ] ] ] ( ρ ) , [ [ ( σ , t [ σ ] / x ) ] ] ( [ [ ψ ] ] ( ρ )) , [ [ ( σ ′ , t ′ [ σ ′ ] / x ) ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ ( σ ′ , t ′ [ σ ′ ] / x ) [ ψ ] ] ] ( ρ ′ )} ⊆ R Δ , x : T .
By the biconditional of R Δ , x : T R_{\Delta,x:T} R Δ , x : T (with respect to the substitution extensions ( σ , t [ σ ] / x ) (\sigma,t[\sigma]/x) ( σ , t [ σ ] / x ) , etc.), it suffices to exhibit evidence D : : ⟦ σ [ ψ ] ⟧ ( ρ ) ≈ ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) ∈ R Δ \mathcal{D} :: \llbracket\sigma[\psi]\rrbracket(\rho) \approx\llbracket\sigma'[\psi]\rrbracket(\rho') \in R_\Delta D :: [ [ σ [ ψ ] ] ] ( ρ ) ≈ [ [ σ ′ [ ψ ] ] ] ( ρ ′ ) ∈ R Δ —relating the tails of the outer pair of substitution evaluations—and to show that the four head values ⟦ t [ σ ] [ ψ ] ⟧ ( ρ ) \llbracket t[\sigma][\psi]\rrbracket(\rho) [ [ t [ σ ] [ ψ ] ] ] ( ρ ) , ⟦ t [ σ ] ⟧ ( ⟦ ψ ⟧ ( ρ ) ) \llbracket t[\sigma]\rrbracket(\llbracket\psi\rrbracket(\rho)) [ [ t [ σ ] ] ] ( [ [ ψ ] ] ( ρ )) , ⟦ t ′ [ σ ′ ] ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) \llbracket t'[\sigma']\rrbracket(\llbracket\psi\rrbracket(\rho')) [ [ t ′ [ σ ′ ] ] ] ( [ [ ψ ] ] ( ρ ′ )) , ⟦ t ′ [ σ ′ ] [ ψ ] ⟧ ( ρ ′ ) \llbracket t'[\sigma'][\psi]\rrbracket(\rho') [ [ t ′ [ σ ′ ] [ ψ ] ] ] ( ρ ′ ) are pairwise related in the head PER R H A ( D ) R_H^A(\mathcal{D}) R H A ( D ) , which is the PER returned by ⟦ T ⟧ ( ⟦ σ [ ψ ] ⟧ ( ρ ) ) ≈ ⟦ T ⟧ ( ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) ) ∈ U i ↘ R H A ( D ) \llbracket T\rrbracket(\llbracket\sigma[\psi]\rrbracket(\rho)) \approx\llbracket T\rrbracket(\llbracket\sigma'[\psi]\rrbracket(\rho')) \in\mathcal{U}_i \searrow R_H^A(\mathcal{D}) [ [ T ] ] ( [ [ σ [ ψ ] ] ] ( ρ )) ≈ [ [ T ] ] ( [ [ σ ′ [ ψ ] ] ] ( ρ ′ )) ∈ U i ↘ R H A ( D ) .
Tails.
( σ , t [ σ ] / x ) [ ψ ] = ( σ [ ψ ] , t [ σ ] [ ψ ] / x ) (\sigma,t[\sigma]/x)[\psi] = (\sigma[\psi],t[\sigma][\psi]/x) ( σ , t [ σ ] / x ) [ ψ ] = ( σ [ ψ ] , t [ σ ] [ ψ ] / x ) (by Theorem 2.24)
So the four tails are ⟦ σ [ ψ ] ⟧ ( ρ ) \llbracket\sigma[\psi]\rrbracket(\rho) [ [ σ [ ψ ] ] ] ( ρ ) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) \llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho)) [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) \llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho')) [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) , ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) \llbracket\sigma'[\psi]\rrbracket(\rho') [ [ σ ′ [ ψ ] ] ] ( ρ ′ ) . By Γ ⊨ σ ≈ σ ′ : Δ \Gamma\models\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ at Γ ′ \Gamma' Γ ′ , ψ \psi ψ , ρ ≈ ρ ′ \rho\approx\rho' ρ ≈ ρ ′ :
{ ⟦ σ [ ψ ] ⟧ ( ρ ) , ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ σ ′ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) } ⊆ R Δ \{\llbracket\sigma[\psi]\rrbracket(\rho),\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho)),\llbracket\sigma'\rrbracket(\llbracket\psi\rrbracket(\rho')),\llbracket\sigma'[\psi]\rrbracket(\rho')\} \subseteq R_\Delta { [ [ σ [ ψ ] ] ] ( ρ ) , [ [ σ ] ] ( [ [ ψ ] ] ( ρ )) , [ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ )) , [ [ σ ′ [ ψ ] ] ] ( ρ ′ )} ⊆ R Δ ,
with witness D : : ⟦ σ [ ψ ] ⟧ ( ρ ) ≈ ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) ∈ R Δ \mathcal{D} :: \llbracket\sigma[\psi]\rrbracket(\rho) \approx\llbracket\sigma'[\psi]\rrbracket(\rho') \in R_\Delta D :: [ [ σ [ ψ ] ] ] ( ρ ) ≈ [ [ σ ′ [ ψ ] ] ] ( ρ ′ ) ∈ R Δ .
Heads. We instantiate Δ ⊨ t ≈ t ′ : T \Delta\models t \approx t' : T Δ ⊨ t ≈ t ′ : T in two ways and bridge the resulting four-value patterns through a shared inner value.
First instantiation of Δ ⊨ t ≈ t ′ : T \Delta\models t \approx t' : T Δ ⊨ t ≈ t ′ : T : at Γ ′ \Gamma' Γ ′ , the semantic substitution Γ ′ ⊨ σ [ ψ ] ≈ σ ′ [ ψ ] : Δ \Gamma' \models\sigma[\psi] \approx\sigma'[\psi] : \Delta Γ ′ ⊨ σ [ ψ ] ≈ σ ′ [ ψ ] : Δ (Theorem 6.39), and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ . The type part gives some R t R_t R t with
⟦ T [ σ [ ψ ] ] ⟧ ( ρ ) ≈ ⟦ T ⟧ ( ⟦ σ [ ψ ] ⟧ ( ρ ) ) ∈ U i ↘ R t , \llbracket T[\sigma[\psi]]\rrbracket(\rho) \approx\llbracket T\rrbracket(\llbracket\sigma[\psi]\rrbracket(\rho)) \in\mathcal{U}_i \searrow R_t, [ [ T [ σ [ ψ ]] ] ] ( ρ ) ≈ [ [ T ] ] ( [ [ σ [ ψ ] ] ] ( ρ )) ∈ U i ↘ R t , and the term part gives
{ ⟦ t [ σ [ ψ ] ] ⟧ ( ρ ) , ⟦ t ⟧ ( ⟦ σ [ ψ ] ⟧ ( ρ ) ) , ⟦ t ′ ⟧ ( ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) ) , ⟦ t ′ [ σ ′ [ ψ ] ] ⟧ ( ρ ′ ) } ⊆ R t \{\llbracket t[\sigma[\psi]]\rrbracket(\rho),\llbracket t\rrbracket(\llbracket\sigma[\psi]\rrbracket(\rho)),\llbracket t'\rrbracket(\llbracket\sigma'[\psi]\rrbracket(\rho')),\llbracket t'[\sigma'[\psi]]\rrbracket(\rho')\} \subseteq R_t { [ [ t [ σ [ ψ ]] ] ] ( ρ ) , [ [ t ] ] ( [ [ σ [ ψ ] ] ] ( ρ )) , [ [ t ′ ] ] ( [ [ σ ′ [ ψ ] ] ] ( ρ ′ )) , [ [ t ′ [ σ ′ [ ψ ]] ] ] ( ρ ′ )} ⊆ R t .
By Theorem 6.12 (same left type ⟦ T ⟧ ( ⟦ σ [ ψ ] ⟧ ( ρ ) ) \llbracket T\rrbracket(\llbracket\sigma[\psi]\rrbracket(\rho)) [ [ T ] ] ( [ [ σ [ ψ ] ] ] ( ρ )) ), R t ⇔ R H A ( D ) R_t \Leftrightarrow R_H^A(\mathcal{D}) R t ⇔ R H A ( D ) . By Theorem 2.20, t [ σ ] [ ψ ] = t [ σ [ ψ ] ] t[\sigma][\psi] = t[\sigma[\psi]] t [ σ ] [ ψ ] = t [ σ [ ψ ]] , so the outer values match: ⟦ t [ σ ] [ ψ ] ⟧ ( ρ ) = ⟦ t [ σ [ ψ ] ] ⟧ ( ρ ) \llbracket t[\sigma][\psi]\rrbracket(\rho) = \llbracket t[\sigma[\psi]]\rrbracket(\rho) [ [ t [ σ ] [ ψ ] ] ] ( ρ ) = [ [ t [ σ [ ψ ]] ] ] ( ρ ) (and similarly for the primed side). Hence the outer pair of goal heads and the inner pair { ⟦ t ⟧ ( ⟦ σ [ ψ ] ⟧ ( ρ ) ) , ⟦ t ′ ⟧ ( ⟦ σ ′ [ ψ ] ⟧ ( ρ ′ ) ) } \{\llbracket t\rrbracket(\llbracket\sigma[\psi]\rrbracket(\rho)),\llbracket t'\rrbracket(\llbracket\sigma'[\psi]\rrbracket(\rho'))\} { [ [ t ] ] ( [ [ σ [ ψ ] ] ] ( ρ )) , [ [ t ′ ] ] ( [ [ σ ′ [ ψ ] ] ] ( ρ ′ ))} are all in R H A ( D ) R_H^A(\mathcal{D}) R H A ( D ) .
Second instantiation of Δ ⊨ t ≈ t ′ : T \Delta\models t \approx t' : T Δ ⊨ t ≈ t ′ : T : at Γ \Gamma Γ (with R Γ R_\Gamma R Γ , from Γ ′ ⊨ w ψ : Γ \Gamma' \models_w \psi: \Gamma Γ ′ ⊨ w ψ : Γ ), the semantic substitution σ ≈ σ ′ : Δ \sigma\approx\sigma' : \Delta σ ≈ σ ′ : Δ (the hypothesis), and ⟦ ψ ⟧ ( ρ ) ≈ ⟦ ψ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\psi\rrbracket(\rho) \approx\llbracket\psi\rrbracket(\rho') \in R_\Gamma [ [ ψ ] ] ( ρ ) ≈ [ [ ψ ] ] ( ρ ′ ) ∈ R Γ . The type part gives some R t ′ R'_t R t ′ with
⟦ T [ σ ] ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ≈ ⟦ T ⟧ ( ⟦ σ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ) ∈ U i ↘ R t ′ , \llbracket T[\sigma]\rrbracket(\llbracket\psi\rrbracket(\rho)) \approx\llbracket T\rrbracket(\llbracket\sigma\rrbracket(\llbracket\psi\rrbracket(\rho))) \in\mathcal{U}_i \searrow R'_t, [ [ T [ σ ] ] ] ( [ [ ψ ] ] ( ρ )) ≈ [ [ T ] ] ( [ [ σ ] ] ( [ [ ψ ] ] ( ρ ))) ∈ U i ↘ R t ′ ,
and the term part gives
{ [ t [ σ ] ] ( [ [ ψ ] ] ( ρ ) ) , [ t ] ( [ [ σ ] ] ( [ [ ψ ] ] ( ρ ) ) ) , [ t ′ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ ) ) , [ t ′ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ ) ) } ⊆ R t ′ . \{[t[\sigma]]([\![\psi]\!](\rho)), [t]([\![\sigma]\!]([\![\psi]\!](\rho))), [t'[\sigma']]([\![\psi]\!](\rho')), [t'[\sigma']]([\![\psi]\!](\rho'))\} \subseteq R'_t. {[ t [ σ ]] ([ [ ψ ] ] ( ρ )) , [ t ] ([ [ σ ] ] ([ [ ψ ] ] ( ρ ))) , [ t ′ [ σ ′ ]] ([ [ ψ ] ] ( ρ ′ )) , [ t ′ [ σ ′ ]] ([ [ ψ ] ] ( ρ ′ ))} ⊆ R t ′ .
Since [ [ σ [ ψ ] ] ] ( ρ ) [\![\sigma[\psi]]\!](\rho) [ [ σ [ ψ ]] ] ( ρ ) and [ [ σ ] ] ( [ [ ψ ] ] ( ρ ) ) [\![\sigma]\!]([\![\psi]\!](\rho)) [ [ σ ] ] ([ [ ψ ] ] ( ρ )) are both in R Δ R_\Delta R Δ (related by the tails part), by Theorem 6.12 applied to the two type evaluations (the head premise of R Δ , x : T R_{\Delta,x:T} R Δ , x : T at the appropriate evidence), R t ′ ⇔ R H Δ ( D ) R'_t \Leftrightarrow R_H^{\Delta}(\mathcal{D}) R t ′ ⇔ R H Δ ( D ) . This places the inner pair [ t [ σ ] ] ( [ [ ψ ] ] ( ρ ) ) , [ t ′ [ σ ′ ] ] ( [ [ ψ ] ] ( ρ ′ ) ) [t[\sigma]]([\![\psi]\!](\rho)), [t'[\sigma']]([\![\psi]\!](\rho')) [ t [ σ ]] ([ [ ψ ] ] ( ρ )) , [ t ′ [ σ ′ ]] ([ [ ψ ] ] ( ρ ′ )) of goal heads in R H Δ ( D ) R_H^{\Delta}(\mathcal{D}) R H Δ ( D ) .
Bridging the two instantiations. The shared inner value [ [ t ] ] ( [ [ σ ] ] ( [ [ ψ ] ] ( ρ ) ) ) [\![t]\!]([\![\sigma]\!]([\![\psi]\!](\rho))) [ [ t ] ] ([ [ σ ] ] ([ [ ψ ] ] ( ρ ))) appears in both R t R_t R t (as the inner-left of the first instantiation, after using [ [ σ [ ψ ] ] ] ( ρ ) ≈ [ [ σ ] ] ( [ [ ψ ] ] ( ρ ) ) ∈ R Δ [\![\sigma[\psi]]\!](\rho) \approx[\![\sigma]\!]([\![\psi]\!](\rho)) \in R_\Delta [ [ σ [ ψ ]] ] ( ρ ) ≈ [ [ σ ] ] ([ [ ψ ] ] ( ρ )) ∈ R Δ and right irrelevance) and R t ′ R'_t R t ′ (as the inner-left of the second instantiation). Both R t R_t R t and R t ′ R'_t R t ′ are equivalent to R H Δ ( D ) R_H^{\Delta}(\mathcal{D}) R H Δ ( D ) , so by transitivity of R H Δ ( D ) R_H^{\Delta}(\mathcal{D}) R H Δ ( D ) through this shared value, all four goal heads are related. □
Lemma 6.46 (Double extension by precomposed terms). If Γ ⊨ σ ≈ σ ′ : Δ \Gamma\vDash\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ , Δ ⊨ t ≈ t ′ : T \Delta\vDash t \approx t' : T Δ ⊨ t ≈ t ′ : T , and Δ , x : T ⊨ s ≈ s ′ : S \Delta, x : T \vDash s \approx s' : S Δ , x : T ⊨ s ≈ s ′ : S , then
Γ ⊨ ( σ , t [ σ ] / x , s [ σ , t [ σ ] / x ] / y ) ≈ ( σ ′ , t ′ [ σ ′ ] / x , s ′ [ σ ′ , t ′ [ σ ′ ] / x ] / y ) : Δ , x : T , y : S . \Gamma\vDash(\sigma, t[\sigma]/x, s[\sigma,t[\sigma]/x]/y) \approx(\sigma', t'[\sigma']/x, s'[\sigma',t'[\sigma']/x]/y) : \Delta, x : T, y : S. Γ ⊨ ( σ , t [ σ ] / x , s [ σ , t [ σ ] / x ] / y ) ≈ ( σ ′ , t ′ [ σ ′ ] / x , s ′ [ σ ′ , t ′ [ σ ′ ] / x ] / y ) : Δ , x : T , y : S .
Proof. By Theorem 6.45 on Γ ⊨ σ ≈ σ ′ : Δ \Gamma\vDash\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ and Δ ⊨ t ≈ t ′ : T \Delta\vDash t \approx t' : T Δ ⊨ t ≈ t ′ : T :
Γ ⊨ ( σ , t [ σ ] / x ) ≈ ( σ ′ , t ′ [ σ ′ ] / x ) : Δ , x : T . \Gamma\vDash(\sigma,t[\sigma]/x) \approx(\sigma',t'[\sigma']/x) : \Delta,x:T. Γ ⊨ ( σ , t [ σ ] / x ) ≈ ( σ ′ , t ′ [ σ ′ ] / x ) : Δ , x : T .
Apply Theorem 6.45 again with this semantic substitution and Δ , x : T ⊨ s ≈ s ′ : S \Delta, x : T \vDash s \approx s' : S Δ , x : T ⊨ s ≈ s ′ : S :
Γ ⊨ ( σ , t [ σ ] / x , s [ σ , t [ σ ] / x ] / y ) ≈ ( σ ′ , t ′ [ σ ′ ] / x , s ′ [ σ ′ , t ′ [ σ ′ ] / x ] / y ) : Δ , x : T , y : S . \Gamma\vDash(\sigma,t[\sigma]/x,s[\sigma,t[\sigma]/x]/y) \approx(\sigma',t'[\sigma']/x,s'[\sigma',t'[\sigma']/x]/y) : \Delta,x:T,y:S. Γ ⊨ ( σ , t [ σ ] / x , s [ σ , t [ σ ] / x ] / y ) ≈ ( σ ′ , t ′ [ σ ′ ] / x , s ′ [ σ ′ , t ′ [ σ ′ ] / x ] / y ) : Δ , x : T , y : S .
Lemma 6.47 (Lifting is semantic). If Γ ⊨ σ ≈ σ ′ : Δ \Gamma\vDash\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ and Δ ⊨ S ≈ S : T y i \Delta\vDash S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i , then Γ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Δ , x : S \Gamma,x:S[\sigma] \vDash q(\sigma) \approx q(\sigma') : \Delta,x:S Γ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Δ , x : S .
Proof. We first establish the context PER for Γ , x : S [ σ ] \Gamma,x:S[\sigma] Γ , x : S [ σ ] . From Γ ⊨ σ ≈ σ ′ : Δ \Gamma\vDash\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ we have Γ ≈ Γ ↘ R Γ \Gamma\approx\Gamma\searrow R_\Gamma Γ ≈ Γ ↘ R Γ . Apply Δ ⊨ S ≈ S : T y i \Delta\vDash S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i at Γ \Gamma Γ (with R Γ R_\Gamma R Γ ), the semantic substitution Γ ⊨ σ ≈ σ : Δ \Gamma\vDash\sigma\approx\sigma: \Delta Γ ⊨ σ ≈ σ : Δ (the reflexive instance, obtained from Γ ⊨ σ ≈ σ ′ : Δ \Gamma\vDash\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ via symmetry and transitivity, Theorems 6.41 and 6.42), and any D Γ : : ρ 0 ≈ ρ 0 ′ ∈ R Γ D_\Gamma:: \rho_0 \approx\rho'_0 \in R_\Gamma D Γ :: ρ 0 ≈ ρ 0 ′ ∈ R Γ : the type part gives, in particular, [ [ S [ σ ] ] ] ( ρ 0 ) ≈ [ [ S [ σ ] ] ] ( ρ 0 ′ ) ∈ U i ↘ R H Γ ( D Γ ) [\![S[\sigma]]\!](\rho_0) \approx[\![S[\sigma]]\!](\rho'_0) \in U_i \searrow R_H^\Gamma(D_\Gamma) [ [ S [ σ ]] ] ( ρ 0 ) ≈ [ [ S [ σ ]] ] ( ρ 0 ′ ) ∈ U i ↘ R H Γ ( D Γ ) for some head family R H Γ R_H^\Gamma R H Γ . By Ctx-Ext, this yields ( Γ , x : S [ σ ] ) ≈ ( Γ , x : S [ σ ] ) ↘ R Γ , x : S [ σ ] (\Gamma,x:S[\sigma]) \approx(\Gamma,x:S[\sigma]) \searrow R_{\Gamma,x:S[\sigma]} ( Γ , x : S [ σ ]) ≈ ( Γ , x : S [ σ ]) ↘ R Γ , x : S [ σ ] with the biconditional
ρ 1 ≈ ρ 1 ′ ∈ R Γ , x : S [ σ ] ⟺ ( D Γ : : ρ 1 [ ↑ ] ≈ ρ 1 ′ [ ↑ ] ∈ R Γ ∧ ρ 1 ( 0 ) ≈ ρ 1 ′ ( 0 ) ∈ R H Γ ( D Γ ) ) . \rho_1 \approx\rho'_1 \in R_{\Gamma,x:S[\sigma]} \Longleftrightarrow(D_\Gamma:: \rho_1[\mathord{\uparrow}] \approx\rho'_1[\mathord{\uparrow}] \in R_\Gamma\mathbin{\wedge} \rho_1(0) \approx\rho'_1(0) \in R_H^\Gamma(D_\Gamma)). ρ 1 ≈ ρ 1 ′ ∈ R Γ , x : S [ σ ] ⟺ ( D Γ :: ρ 1 [ ↑ ] ≈ ρ 1 ′ [ ↑ ] ∈ R Γ ∧ ρ 1 ( 0 ) ≈ ρ 1 ′ ( 0 ) ∈ R H Γ ( D Γ )) . By an analogous construction (or directly by Theorem 6.38 on Δ ⊨ S ≈ S : T y i \Delta\vDash S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i followed by Ctx-Ext), we also obtain ( Δ , x : S ) ≈ ( Δ , x : S ) ↘ R Δ , x : S (\Delta,x:S) \approx(\Delta,x:S) \searrow R_{\Delta,x:S} ( Δ , x : S ) ≈ ( Δ , x : S ) ↘ R Δ , x : S with head family R H Δ R_H^\Delta R H Δ , where for every D Δ : : ρ 0 ≈ ρ 0 ′ ∈ R Δ D_\Delta:: \rho_0 \approx\rho'_0 \in R_\Delta D Δ :: ρ 0 ≈ ρ 0 ′ ∈ R Δ , R H Δ ( D Δ ) R_H^\Delta(D_\Delta) R H Δ ( D Δ ) is determined by [ [ S ] ] ( ρ 0 ) ≈ [ [ S ] ] ( ρ 0 ′ ) ∈ U i ↘ R H Δ ( D Δ ) [\![S]\!](\rho_0) \approx[\![S]\!](\rho'_0) \in U_i \searrow R_H^\Delta(D_\Delta) [ [ S ] ] ( ρ 0 ) ≈ [ [ S ] ] ( ρ 0 ′ ) ∈ U i ↘ R H Δ ( D Δ ) , with biconditional
ρ 1 ≈ ρ 1 ′ ∈ R Δ , x : S ⟺ ( D Δ : : ρ 1 [ ↑ ] ≈ ρ 1 ′ [ ↑ ] ∈ R Δ ∧ ρ 1 ( 0 ) ≈ ρ 1 ′ ( 0 ) ∈ R H Δ ( D Δ ) ) . \rho_1 \approx\rho'_1 \in R_{\Delta,x:S} \Longleftrightarrow(D_\Delta:: \rho_1[\mathord{\uparrow}] \approx\rho'_1[\mathord{\uparrow}] \in R_\Delta\mathbin{\wedge} \rho_1(0) \approx\rho'_1(0) \in R_H^\Delta(D_\Delta)). ρ 1 ≈ ρ 1 ′ ∈ R Δ , x : S ⟺ ( D Δ :: ρ 1 [ ↑ ] ≈ ρ 1 ′ [ ↑ ] ∈ R Δ ∧ ρ 1 ( 0 ) ≈ ρ 1 ′ ( 0 ) ∈ R H Δ ( D Δ )) . Here R Δ R_\Delta R Δ comes from the premise Γ ⊨ σ ≈ σ ′ : Δ \Gamma\vDash\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ (which carries Δ ≈ Δ ↘ R Δ \Delta\approx\Delta\searrow R_\Delta Δ ≈ Δ ↘ R Δ ).
We now show Γ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Δ , x : S \Gamma,x:S[\sigma] \vDash q(\sigma) \approx q(\sigma') : \Delta,x:S Γ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Δ , x : S by unfolding the conclusion. Recall q ( σ ) = ( σ [ ↑ ] , x 0 / x ) q(\sigma) = (\sigma[\mathord{\uparrow}],x_0/x) q ( σ ) = ( σ [ ↑ ] , x 0 / x ) . By Theorem 2.24 (2), ( σ [ ↑ ] , x 0 / x ) [ ψ ] = ( σ [ ↑ ] [ ψ ] , x 0 [ ψ ] / x ) = ( σ [ ↑ ∘ ψ ] , ψ ( 0 ) / x ) (\sigma[\mathord{\uparrow}],x_0/x)[\psi] = (\sigma[\mathord{\uparrow}][\psi],x_0[\psi]/x) = (\sigma[\mathord{\uparrow}\circ\psi],\psi(0)/x) ( σ [ ↑ ] , x 0 / x ) [ ψ ] = ( σ [ ↑ ] [ ψ ] , x 0 [ ψ ] / x ) = ( σ [ ↑ ∘ ψ ] , ψ ( 0 ) / x ) for any weakening ψ \psi ψ (using σ [ ↑ ] [ ψ ] = σ [ ↑ ∘ ψ ] \sigma[\mathord{\uparrow}][\psi] = \sigma[\mathord{\uparrow}\circ\psi] σ [ ↑ ] [ ψ ] = σ [ ↑ ∘ ψ ] by associativity of post-composition with weakenings, and x 0 [ ψ ] = ψ ( 0 ) x_0[\psi] = \psi(0) x 0 [ ψ ] = ψ ( 0 ) ).
We must show: for every context Γ ′ \Gamma' Γ ′ with Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , every Γ ′ ⊢ w ψ : Γ , x : S [ σ ] \Gamma' \vdash_w \psi: \Gamma,x:S[\sigma] Γ ′ ⊢ w ψ : Γ , x : S [ σ ] , and every ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ , the four values
[ [ q ( σ ) [ ψ ] ] ] ( ρ ) , [ [ q ( σ ) ] ] ( [ [ ψ ] ] ( ρ ) ) , [ [ q ( σ ′ ) ] ] ( [ [ ψ ] ] ( ρ ′ ) ) , [ [ q ( σ ′ ) [ ψ ] ] ] ( ρ ′ ) [\![q(\sigma)[\psi]]\!](\rho),\quad[\![q(\sigma)]\!]([\![\psi]\!](\rho)),\quad[\![q(\sigma')]\!]([\![\psi]\!](\rho')),\quad[\![q(\sigma')[\psi]]\!](\rho') [ [ q ( σ ) [ ψ ]] ] ( ρ ) , [ [ q ( σ )] ] ([ [ ψ ] ] ( ρ )) , [ [ q ( σ ′ )] ] ([ [ ψ ] ] ( ρ ′ )) , [ [ q ( σ ′ ) [ ψ ]] ] ( ρ ′ ) lie in R Δ , x : S R_{\Delta,x:S} R Δ , x : S .
By definition of Γ ′ ⊨ w ψ : Γ , x : S [ σ ] \Gamma' \models_w \psi: \Gamma, x : S[\sigma] Γ ′ ⊨ w ψ : Γ , x : S [ σ ] , ⟦ ψ ⟧ ( ρ ) ≈ ⟦ ψ ⟧ ( ρ ′ ) ∈ R Γ , x : S [ σ ] \llbracket\psi\rrbracket(\rho) \approx\llbracket\psi\rrbracket(\rho') \in R_{\Gamma,x:S[\sigma]} [ [ ψ ] ] ( ρ ) ≈ [ [ ψ ] ] ( ρ ′ ) ∈ R Γ , x : S [ σ ] . By the biconditional of R Γ , x : S [ σ ] R_{\Gamma,x:S[\sigma]} R Γ , x : S [ σ ] established above, this gives
D Γ : : [ ⟦ ψ ⟧ ( ρ ) ] [ ⇑ ] ≈ [ ⟦ ψ ⟧ ( ρ ′ ) ] [ ⇑ ] ∈ R Γ \mathcal{D}_{\Gamma} :: [\llbracket\psi\rrbracket(\rho)] [\Uparrow] \approx[\llbracket\psi\rrbracket(\rho')] [\Uparrow] \in R_{\Gamma} D Γ :: [ [ [ ψ ] ] ( ρ )] [ ⇑ ] ≈ [ [ [ ψ ] ] ( ρ ′ )] [ ⇑ ] ∈ R Γ
(tail)
( ⟦ ψ ⟧ ( ρ ) ) ( 0 ) ≈ ( ⟦ ψ ⟧ ( ρ ′ ) ) ( 0 ) ∈ R Γ H ( D Γ ) (\llbracket\psi\rrbracket(\rho))(0) \approx(\llbracket\psi\rrbracket(\rho'))(0) \in R^H_{\Gamma}(\mathcal{D}_{\Gamma}) ( [ [ ψ ] ] ( ρ )) ( 0 ) ≈ ( [ [ ψ ] ] ( ρ ′ )) ( 0 ) ∈ R Γ H ( D Γ )
(head)
By Theorem 6.28, Γ , x : S [ σ ] ⊨ w ⇑ : Γ \Gamma, x : S[\sigma] \models_w \Uparrow: \Gamma Γ , x : S [ σ ] ⊨ w ⇑: Γ . By Theorem 6.29, Γ ′ ⊨ w ⇑ ∘ ψ : Γ \Gamma' \models_w \Uparrow\circ\psi: \Gamma Γ ′ ⊨ w ⇑ ∘ ψ : Γ , where ⇑ ∘ ψ \Uparrow\circ\psi ⇑ ∘ ψ is the composition of weakenings.
We must show the goal four values lie in R Δ , x : S R_{\Delta,x:S} R Δ , x : S . By the biconditional of R Δ , x : S R_{\Delta,x:S} R Δ , x : S recalled above, this requires evidence D Δ \mathcal{D}_{\Delta} D Δ relating the four tails in R Δ R_{\Delta} R Δ and the four heads in R Δ H ( D Δ ) R^H_{\Delta}(\mathcal{D}_{\Delta}) R Δ H ( D Δ ) .
Tails. We compute the four tails using the pointwise identities above. For an extended substitution ( τ , t / x ) (\tau,t/x) ( τ , t / x ) , the evaluation ⟦ ( τ , t / x ) ⟧ ( ρ 0 ) \llbracket(\tau,t/x)\rrbracket(\rho_0) [ [ ( τ , t / x ) ] ] ( ρ 0 ) is the environment with head ⟦ t ⟧ ( ρ 0 ) \llbracket t\rrbracket(\rho_0) [ [ t ] ] ( ρ 0 ) at index 0 and tail ⟦ τ ⟧ ( ρ 0 ) \llbracket\tau\rrbracket(\rho_0) [ [ τ ] ] ( ρ 0 ) at indices 1, 2, . . .; hence ( ⟦ ( τ , t / x ) ⟧ ( ρ 0 ) ) [ ⇑ ] = ⟦ τ ⟧ ( ρ 0 ) (\llbracket(\tau,t/x)\rrbracket(\rho_0))[\Uparrow] = \llbracket\tau\rrbracket(\rho_0) ( [ [ ( τ , t / x ) ] ] ( ρ 0 )) [ ⇑ ] = [ [ τ ] ] ( ρ 0 ) . Applied to the four goal values:
( ⟦ q ( σ ) [ ψ ] ⟧ ( ρ ) ) [ ⇑ ] = ⟦ σ [ ⇑ ∘ ψ ] ⟧ ( ρ ) , (\llbracket q(\sigma)[\psi]\rrbracket(\rho))[\Uparrow] = \llbracket\sigma[\Uparrow\circ\psi]\rrbracket(\rho), ( [ [ q ( σ ) [ ψ ] ] ] ( ρ )) [ ⇑ ] = [ [ σ [ ⇑ ∘ ψ ] ] ] ( ρ ) ,
( ⟦ q ( σ ) ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ) [ ⇑ ] = ⟦ σ [ ⇑ ] ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , (\llbracket q(\sigma)\rrbracket(\llbracket\psi\rrbracket(\rho)))[\Uparrow] = \llbracket\sigma[\Uparrow]\rrbracket(\llbracket\psi\rrbracket(\rho)), ( [ [ q ( σ ) ] ] ( [ [ ψ ] ] ( ρ ))) [ ⇑ ] = [ [ σ [ ⇑ ] ] ] ( [ [ ψ ] ] ( ρ )) ,
( ⟦ q ( σ ′ ) ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) ) [ ⇑ ] = ⟦ σ ′ [ ⇑ ] ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) , (\llbracket q(\sigma')\rrbracket(\llbracket\psi\rrbracket(\rho')))[\Uparrow] = \llbracket\sigma'[\Uparrow]\rrbracket(\llbracket\psi\rrbracket(\rho')), ( [ [ q ( σ ′ ) ] ] ( [ [ ψ ] ] ( ρ ′ ))) [ ⇑ ] = [ [ σ ′ [ ⇑ ] ] ] ( [ [ ψ ] ] ( ρ ′ )) ,
( ⟦ q ( σ ′ ) [ ψ ] ⟧ ( ρ ′ ) ) [ ⇑ ] = ⟦ σ ′ [ ⇑ ∘ ψ ] ⟧ ( ρ ′ ) . (\llbracket q(\sigma')[\psi]\rrbracket(\rho'))[\Uparrow] = \llbracket\sigma'[\Uparrow\circ\psi]\rrbracket(\rho'). ( [ [ q ( σ ′ ) [ ψ ] ] ] ( ρ ′ )) [ ⇑ ] = [ [ σ ′ [ ⇑ ∘ ψ ] ] ] ( ρ ′ ) .
First instantiation of Γ ⊨ σ ≈ σ ′ : Δ \Gamma\models\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ : at Γ ′ \Gamma' Γ ′ , the semantic weakening Γ ′ ⊨ w ⇑ ∘ ψ : Γ \Gamma' \models_w \Uparrow\circ\psi: \Gamma Γ ′ ⊨ w ⇑ ∘ ψ : Γ , and ρ ≈ ρ ′ ∈ R Γ ′ \rho\approx\rho' \in R_{\Gamma'} ρ ≈ ρ ′ ∈ R Γ ′ :
{ ⟦ σ [ ⇑ ∘ ψ ] ⟧ ( ρ ) , ⟦ σ ⟧ ( ⟦ ⇑ ∘ ψ ⟧ ( ρ ) ) , ⟦ σ ′ ⟧ ( ⟦ ⇑ ∘ ψ ⟧ ( ρ ′ ) ) , ⟦ σ ′ [ ⇑ ∘ ψ ] ⟧ ( ρ ′ ) } ⊆ R Δ . \{\llbracket\sigma[\Uparrow\circ\psi]\rrbracket(\rho),\ \llbracket\sigma\rrbracket(\llbracket\Uparrow\circ\psi\rrbracket(\rho)),\ \llbracket\sigma'\rrbracket(\llbracket\Uparrow\circ\psi\rrbracket(\rho')),\ \llbracket\sigma'[\Uparrow\circ\psi]\rrbracket(\rho')\} \subseteq R_{\Delta}. { [ [ σ [ ⇑ ∘ ψ ] ] ] ( ρ ) , [ [ σ ] ] ( [ [ ⇑ ∘ ψ ] ] ( ρ )) , [ [ σ ′ ] ] ( [ [ ⇑ ∘ ψ ] ] ( ρ ′ )) , [ [ σ ′ [ ⇑ ∘ ψ ] ] ] ( ρ ′ )} ⊆ R Δ .
Since ⇑ ∘ ψ \Uparrow\circ\psi ⇑ ∘ ψ is a weakening, by the definition of weakening evaluation, ⟦ ⇑ ∘ ψ ⟧ ( ρ 0 ) = ( ⟦ ψ ⟧ ( ρ 0 ) ) [ ⇑ ] \llbracket\Uparrow\circ\psi\rrbracket(\rho_0) = (\llbracket\psi\rrbracket(\rho_0))[\Uparrow] [ [ ⇑ ∘ ψ ] ] ( ρ 0 ) = ( [ [ ψ ] ] ( ρ 0 )) [ ⇑ ] for any ρ 0 \rho_0 ρ 0 (verified pointwise: ⟦ ⇑ ∘ ψ ⟧ ( ρ 0 ) ( n ) = ρ 0 ( ( ⇑ ∘ ψ ) ( n ) ) = ρ 0 ( ψ ( n + 1 ) ) = ( ⟦ ψ ⟧ ( ρ 0 ) ) [ ⇑ ] ( n ) ) . S o t h i s f i r s t i n s t a n t i a t i o n g i v e s t h e o u t e r t w o t a i l s o f t h e g o a l , p l u s i n t e r m e d i a t e v a l u e s \llbracket\Uparrow\circ\psi\rrbracket(\rho_0)(n) = \rho_0((\Uparrow\circ\psi)(n)) = \rho_0(\psi(n+1)) = (\llbracket\psi\rrbracket(\rho_0))[\Uparrow](n)). So this first instantiation gives the outer two tails of the goal, plus intermediate values [ [ ⇑ ∘ ψ ] ] ( ρ 0 ) ( n ) = ρ 0 (( ⇑ ∘ ψ ) ( n )) = ρ 0 ( ψ ( n + 1 )) = ( [ [ ψ ] ] ( ρ 0 )) [ ⇑ ] ( n )) . S o t hi s f i r s t in s t an t ia t i o n g i v es t h eo u t er tw o t ai l so f t h e g o a l , pl u s in t er m e d ia t e v a l u es \llbracket\sigma\rrbracket((\llbracket\psi\rrbracket(\rho))[\Uparrow])$ and ⟦ σ ′ ⟧ ( ( ⟦ ψ ⟧ ( ρ ′ ) ) [ ⇑ ] ) \llbracket\sigma'\rrbracket((\llbracket\psi\rrbracket(\rho'))[\Uparrow]) [ [ σ ′ ] ] (( [ [ ψ ] ] ( ρ ′ )) [ ⇑ ]) .
Second instantiation of Γ ⊨ σ ≈ σ ′ : Δ \Gamma\models\sigma\approx\sigma' : \Delta Γ ⊨ σ ≈ σ ′ : Δ : at Γ , x : S [ σ ] \Gamma, x : S[\sigma] Γ , x : S [ σ ] (using R Γ , x : S [ σ ] R_{\Gamma,x:S[\sigma]} R Γ , x : S [ σ ] ), the semantic weakening Γ , x : S [ σ ] ⊨ w ⇑ : Γ \Gamma, x : S[\sigma] \models_w \Uparrow: \Gamma Γ , x : S [ σ ] ⊨ w ⇑: Γ , and the related environments ⟦ ψ ⟧ ( ρ ) ≈ ⟦ ψ ⟧ ( ρ ′ ) ∈ R Γ , x : S [ σ ] \llbracket\psi\rrbracket(\rho) \approx\llbracket\psi\rrbracket(\rho') \in R_{\Gamma,x:S[\sigma]} [ [ ψ ] ] ( ρ ) ≈ [ [ ψ ] ] ( ρ ′ ) ∈ R Γ , x : S [ σ ] :
{ ⟦ σ [ ⇑ ] ⟧ ( ⟦ ψ ⟧ ( ρ ) ) , ⟦ σ ⟧ ( ⟦ ⇑ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ) , ⟦ σ ′ ⟧ ( ⟦ ⇑ ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) ) , ⟦ σ ′ [ ⇑ ] ⟧ ( ⟦ ψ ⟧ ( ρ ′ ) ) } ⊆ R Δ . \{\llbracket\sigma[\Uparrow]\rrbracket(\llbracket\psi\rrbracket(\rho)),\ \llbracket\sigma\rrbracket(\llbracket\Uparrow\rrbracket(\llbracket\psi\rrbracket(\rho))),\ \llbracket\sigma'\rrbracket(\llbracket\Uparrow\rrbracket(\llbracket\psi\rrbracket(\rho'))),\ \llbracket\sigma'[\Uparrow]\rrbracket(\llbracket\psi\rrbracket(\rho'))\} \subseteq R_{\Delta}. { [ [ σ [ ⇑ ] ] ] ( [ [ ψ ] ] ( ρ )) , [ [ σ ] ] ( [ [ ⇑ ] ] ( [ [ ψ ] ] ( ρ ))) , [ [ σ ′ ] ] ( [ [ ⇑ ] ] ( [ [ ψ ] ] ( ρ ′ ))) , [ [ σ ′ [ ⇑ ] ] ] ( [ [ ψ ] ] ( ρ ′ ))} ⊆ R Δ .
Since ⇑ \Uparrow ⇑ is a weakening, ⟦ ⇑ ⟧ ( ρ 0 ) = ρ 0 [ ⇑ ] \llbracket\Uparrow\rrbracket(\rho_0) = \rho_0[\Uparrow] [ [ ⇑ ] ] ( ρ 0 ) = ρ 0 [ ⇑ ] for any ρ 0 \rho_0 ρ 0 . So this second instantiation gives the inner two tails of the goal, plus the intermediate values ⟦ σ ⟧ ( ( ⟦ ψ ⟧ ( ρ ) ) [ ⇑ ] ) \llbracket\sigma\rrbracket((\llbracket\psi\rrbracket(\rho))[\Uparrow]) [ [ σ ] ] (( [ [ ψ ] ] ( ρ )) [ ⇑ ]) and ⟦ σ ′ ⟧ ( ( ⟦ ψ ⟧ ( ρ ′ ) ) [ ⇑ ] ) \llbracket\sigma'\rrbracket((\llbracket\psi\rrbracket(\rho'))[\Uparrow]) [ [ σ ′ ] ] (( [ [ ψ ] ] ( ρ ′ )) [ ⇑ ]) .
The intermediate inner-left value ⟦ σ ⟧ ( ( ⟦ ψ ⟧ ( ρ ) ) [ ⇑ ] ) \llbracket\sigma\rrbracket((\llbracket\psi\rrbracket(\rho))[\Uparrow]) [ [ σ ] ] (( [ [ ψ ] ] ( ρ )) [ ⇑ ]) appears in both instantiations (since ⟦ ⇑ ∘ ψ ⟧ ( ρ ) = ( ⟦ ψ ⟧ ( ρ ) ) [ ⇑ ] = ⟦ ⇑ ⟧ ( ⟦ ψ ⟧ ( ρ ) ) \llbracket\Uparrow\circ\psi\rrbracket(\rho) = (\llbracket\psi\rrbracket(\rho))[\Uparrow] = \llbracket\Uparrow\rrbracket(\llbracket\psi\rrbracket(\rho)) [ [ ⇑ ∘ ψ ] ] ( ρ ) = ( [ [ ψ ] ] ( ρ )) [ ⇑ ] = [ [ ⇑ ] ] ( [ [ ψ ] ] ( ρ )) ). By symmetry (Theorem 6.22) and transitivity (Theorem 6.23) of R Δ R_{\Delta} R Δ through this shared value, all four tails are pairwise related in R Δ R_{\Delta} R Δ . In particular, the outer pair gives evidence D Δ : : ⟦ σ [ ⇑ ∘ ψ ] ⟧ ( ρ ) ≈ ⟦ σ ′ [ ⇑ ∘ ψ ] ⟧ ( ρ ′ ) ∈ R Δ \mathcal{D}_{\Delta} :: \llbracket\sigma[\Uparrow\circ\psi]\rrbracket(\rho) \approx\llbracket\sigma'[\Uparrow\circ\psi]\rrbracket(\rho') \in R_{\Delta} D Δ :: [ [ σ [ ⇑ ∘ ψ ] ] ] ( ρ ) ≈ [ [ σ ′ [ ⇑ ∘ ψ ] ] ] ( ρ ′ ) ∈ R Δ .
Heads. The four heads of the goal four values are:
⟦ q ( σ ) [ ψ ] ⟧ ( ρ ) ( 0 ) = ⟦ ψ ( 0 ) ⟧ ( ρ ) = ρ ( ψ ( 0 ) ) = ( ⟦ ψ ⟧ ( ρ ) ) ( 0 ) , \llbracket q(\sigma)[\psi]\rrbracket(\rho)(0) = \llbracket\psi(0)\rrbracket(\rho) = \rho(\psi(0)) = (\llbracket\psi\rrbracket(\rho))(0), [ [ q ( σ ) [ ψ ] ] ] ( ρ ) ( 0 ) = [ [ ψ ( 0 ) ] ] ( ρ ) = ρ ( ψ ( 0 )) = ( [ [ ψ ] ] ( ρ )) ( 0 ) ,
⟦ q ( σ ) ⟧ ( ⟦ ψ ⟧ ( ρ ) ) ( 0 ) = ⟦ x 0 ⟧ ( ⟦ ψ ⟧ ( ρ ) ) = ( ⟦ ψ ⟧ ( ρ ) ) ( 0 ) , \llbracket q(\sigma)\rrbracket(\llbracket\psi\rrbracket(\rho))(0) = \llbracket x_0\rrbracket(\llbracket\psi\rrbracket(\rho)) = (\llbracket\psi\rrbracket(\rho))(0), [ [ q ( σ ) ] ] ( [ [ ψ ] ] ( ρ )) ( 0 ) = [ [ x 0 ] ] ( [ [ ψ ] ] ( ρ )) = ( [ [ ψ ] ] ( ρ )) ( 0 ) ,
and analogously for the primed pair. All four heads collapse to ( ⟦ ψ ⟧ ( ρ ) ) ( 0 ) (\llbracket\psi\rrbracket(\rho))(0) ( [ [ ψ ] ] ( ρ )) ( 0 ) and ( ⟦ ψ ⟧ ( ρ ′ ) ) ( 0 ) (\llbracket\psi\rrbracket(\rho'))(0) ( [ [ ψ ] ] ( ρ ′ )) ( 0 ) . By the head clause of the biconditional of R Γ , x : S [ σ ] R_{\Gamma,x:S[\sigma]} R Γ , x : S [ σ ] recalled above, ( ⟦ ψ ⟧ ( ρ ) ) ( 0 ) ≈ ( ⟦ ψ ⟧ ( ρ ′ ) ) ( 0 ) ∈ R Γ H ( D Γ ) (\llbracket\psi\rrbracket(\rho))(0) \approx(\llbracket\psi\rrbracket(\rho'))(0) \in R^H_{\Gamma}(\mathcal{D}_{\Gamma}) ( [ [ ψ ] ] ( ρ )) ( 0 ) ≈ ( [ [ ψ ] ] ( ρ ′ )) ( 0 ) ∈ R Γ H ( D Γ ) .
Bridging head PERs. It remains to show R Γ H ( D Γ ) ⇔ R Δ H ( D Δ ) R^H_{\Gamma}(\mathcal{D}_{\Gamma}) \Leftrightarrow R^H_{\Delta}(\mathcal{D}_{\Delta}) R Γ H ( D Γ ) ⇔ R Δ H ( D Δ ) , so that the four heads all lie in R Δ H ( D Δ ) R^H_{\Delta}(\mathcal{D}_{\Delta}) R Δ H ( D Δ ) . Apply Δ ⊨ S ≈ S : T y i \Delta\models S \approx S : T y_i Δ ⊨ S ≈ S : T y i at Γ \Gamma Γ (using R Γ R_{\Gamma} R Γ , available from Γ , x : S [ σ ] ⊨ w ⇑ : Γ \Gamma, x : S[\sigma] \models_w \Uparrow: \Gamma Γ , x : S [ σ ] ⊨ w ⇑: Γ ), the semantic substitution Γ ⊨ σ ≈ σ : Δ \Gamma\models\sigma\approx\sigma: \Delta Γ ⊨ σ ≈ σ : Δ (a special case of the hypothesis—formally, applying the hypothesis along with reflexivity by symmetry/transitivity to obtain the reflexive instance), and the related environments ( ⟦ ψ ⟧ ( ρ ) ) [ ⇑ ] ≈ ( ⟦ ψ ⟧ ( ρ ′ ) ) [ ⇑ ] ∈ R Γ (\llbracket\psi\rrbracket(\rho))[\Uparrow] \approx(\llbracket\psi\rrbracket(\rho'))[\Uparrow] \in R_{\Gamma} ( [ [ ψ ] ] ( ρ )) [ ⇑ ] ≈ ( [ [ ψ ] ] ( ρ ′ )) [ ⇑ ] ∈ R Γ (from D Γ \mathcal{D}_{\Gamma} D Γ ): the type part gives the commutation
⟦ S [ σ ] ⟧ ( ( ⟦ ψ ⟧ ( ρ ) ) [ ⇑ ] ) ≈ ⟦ S ⟧ ( ⟦ σ ⟧ ( ( ⟦ ψ ⟧ ( ρ ) ) [ ⇑ ] ) ) ∈ U i . \llbracket S[\sigma]\rrbracket((\llbracket\psi\rrbracket(\rho))[\Uparrow]) \approx\llbracket S\rrbracket(\llbracket\sigma\rrbracket((\llbracket\psi\rrbracket(\rho))[\Uparrow])) \in\mathcal{U}_i. [ [ S [ σ ] ] ] (( [ [ ψ ] ] ( ρ )) [ ⇑ ]) ≈ [ [ S ] ] ( [ [ σ ] ] (( [ [ ψ ] ] ( ρ )) [ ⇑ ])) ∈ U i .
The right-hand side is [ [ S ] ] ( ρ 0 ) [\![S]\!](\rho_0) [ [ S ] ] ( ρ 0 ) where ρ 0 = [ [ σ ] ] ( [ [ ψ ] ] ( ρ ) ) [ ↑ ] \rho_0 = [\![\sigma]\!]([\![\psi]\!](\rho))[\!\uparrow\!] ρ 0 = [ [ σ ] ] ([ [ ψ ] ] ( ρ )) [ ↑ ] , which is in R Δ R_\Delta R Δ via the second instantiation; by definition of R H A ( D Δ ) R^\mathsf{A}_H(\mathcal{D}_\Delta) R H A ( D Δ ) , this lands in U i ↘ R H A ( D Δ ) \mathcal{U}_i \searrow R^\mathsf{A}_H(\mathcal{D}_\Delta) U i ↘ R H A ( D Δ ) . The left-hand side [ [ S [ σ ] ] ] ( [ [ ψ ] ] ( ρ ) ) [ ↑ ] [\![S[\sigma]]\!]([\![\psi]\!](\rho))[\!\uparrow\!] [ [ S [ σ ]] ] ([ [ ψ ] ] ( ρ )) [ ↑ ] lands in U i ↘ R H R ( D Γ ) \mathcal{U}_i \searrow R^\mathsf{R}_H(\mathcal{D}_\Gamma) U i ↘ R H R ( D Γ ) by definition of R H R R^\mathsf{R}_H R H R . By Theorem 6.12, R H R ( D Γ ) ⇔ R H A ( D Δ ) R^\mathsf{R}_H(\mathcal{D}_\Gamma) \Leftrightarrow R^\mathsf{A}_H(\mathcal{D}_\Delta) R H R ( D Γ ) ⇔ R H A ( D Δ ) . Hence all four heads are in R H A ( D Δ ) R^\mathsf{A}_H(\mathcal{D}_\Delta) R H A ( D Δ ) . Combining tails and heads via the biconditional of R Δ , x : S R_{\Delta,x:S} R Δ , x : S , the four goal values are in R Δ , x : S R_{\Delta,x:S} R Δ , x : S .
Semantic Symmetry and Transitivity
Lemma 6.48 (Fundamental — Tm-Sym). If Γ ⊢ t ≈ t ′ : T \Gamma\vdash t \approx t' : T Γ ⊢ t ≈ t ′ : T , then Γ ⊢ t ′ ≈ t : T \Gamma\vdash t' \approx t : T Γ ⊢ t ′ ≈ t : T .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ . From the hypothesis:
{ [ [ t [ σ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ σ ] ] ( ρ ) ) , [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ) ) , [ [ t ′ [ σ ′ ] ] ] ( ρ ′ ) } ⊆ R T . \{[\![t[\sigma]]\!](\rho), [\![t]\!]([\![\sigma]\!](\rho)), [\![t']\!]([\![\sigma']\!](\rho')), [\![t'[\sigma']]\!](\rho')\} \subseteq R_T. {[ [ t [ σ ]] ] ( ρ ) , [ [ t ] ] ([ [ σ ] ] ( ρ )) , [ [ t ′ ] ] ([ [ σ ′ ] ] ( ρ ′ )) , [ [ t ′ [ σ ′ ]] ] ( ρ ′ )} ⊆ R T . We need:
{ [ [ t ′ [ σ ′ ] ] ] ( ρ ) , [ [ t ′ ] ] ( [ [ σ ] ] ( ρ ) ) , [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ ) ) , [ [ t [ σ ] ] ] ( ρ ′ ) } ⊆ R T . \{[\![t'[\sigma']]\!](\rho), [\![t']\!]([\![\sigma]\!](\rho)), [\![t]\!]([\![\sigma']\!](\rho')), [\![t[\sigma]]\!](\rho')\} \subseteq R_T. {[ [ t ′ [ σ ′ ]] ] ( ρ ) , [ [ t ′ ] ] ([ [ σ ] ] ( ρ )) , [ [ t ] ] ([ [ σ ′ ] ] ( ρ ′ )) , [ [ t [ σ ]] ] ( ρ ′ )} ⊆ R T . Apply the hypothesis at σ ′ ≈ σ \sigma' \approx\sigma σ ′ ≈ σ (using Theorem 6.41) and ρ ′ ≈ ρ \rho' \approx\rho ρ ′ ≈ ρ (using symmetry of R ′ R' R ′ ):
{ [ [ t ′ [ σ ′ ] ] ] ( ρ ′ ) , [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ) ) , [ [ t ] ] ( [ [ σ ] ] ( ρ ) ) , [ [ t ′ [ σ ] ] ] ( ρ ) } ⊆ R T . \{[\![t'[\sigma']]\!](\rho'), [\![t']\!]([\![\sigma']\!](\rho')), [\![t]\!]([\![\sigma]\!](\rho)), [\![t'[\sigma]]\!](\rho)\} \subseteq R_T. {[ [ t ′ [ σ ′ ]] ] ( ρ ′ ) , [ [ t ′ ] ] ([ [ σ ′ ] ] ( ρ ′ )) , [ [ t ] ] ([ [ σ ] ] ( ρ )) , [ [ t ′ [ σ ]] ] ( ρ )} ⊆ R T . By symmetry of R T R_T R T (Theorem 6.13), we can reverse the order:
{ [ [ t ′ [ σ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ σ ] ] ( ρ ) ) , [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ) ) , [ [ t [ σ ′ ] ] ] ( ρ ′ ) } ⊆ R T . \{[\![t'[\sigma]]\!](\rho), [\![t]\!]([\![\sigma]\!](\rho)), [\![t']\!]([\![\sigma']\!](\rho')), [\![t[\sigma']]\!](\rho')\} \subseteq R_T. {[ [ t ′ [ σ ]] ] ( ρ ) , [ [ t ] ] ([ [ σ ] ] ( ρ )) , [ [ t ′ ] ] ([ [ σ ′ ] ] ( ρ ′ )) , [ [ t [ σ ′ ]] ] ( ρ ′ )} ⊆ R T .
Lemma 6.49 (Fundamental — Tm-Trans). If Γ ⊢ t ≈ t ′ : T \Gamma\vdash t \approx t' : T Γ ⊢ t ≈ t ′ : T and Γ ⊢ t ′ ≈ t ′ ′ : T \Gamma\vdash t' \approx t'' : T Γ ⊢ t ′ ≈ t ′′ : T , then Γ ⊢ t ≈ t ′ ′ : T \Gamma\vdash t \approx t'' : T Γ ⊢ t ≈ t ′′ : T .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ . Apply the first hypothesis at σ ≈ σ ′ , ρ ≈ ρ ′ \sigma\approx\sigma', \rho\approx\rho' σ ≈ σ ′ , ρ ≈ ρ ′ :
[ [ t [ σ ] ] ] ( ρ ) ≈ [ [ t ′ [ σ ′ ] ] ] ( ρ ′ ) ∈ R T [\![t[\sigma]]\!](\rho) \approx[\![t'[\sigma']]\!](\rho') \in R_T [ [ t [ σ ]] ] ( ρ ) ≈ [ [ t ′ [ σ ′ ]] ] ( ρ ′ ) ∈ R T (four-value pattern, outer-LHS vs outer-RHS)
Apply the second hypothesis at σ ′ ≈ σ ′ \sigma' \approx\sigma' σ ′ ≈ σ ′ (reflexive, by Theorems 6.41 and 6.42) and ρ ′ ≈ ρ ′ \rho' \approx\rho' ρ ′ ≈ ρ ′ (reflexive, by symmetry of R ′ R' R ′ ):
[ [ t ′ [ σ ′ ] ] ] ( ρ ′ ) ≈ [ [ t ′ ′ [ σ ′ ] ] ] ( ρ ′ ) ∈ R T [\![t'[\sigma']]\!](\rho') \approx[\![t''[\sigma']]\!](\rho') \in R_T [ [ t ′ [ σ ′ ]] ] ( ρ ′ ) ≈ [ [ t ′′ [ σ ′ ]] ] ( ρ ′ ) ∈ R T (four-value pattern, outer-LHS vs outer-RHS)
By transitivity of R T R_T R T (Theorem 6.14):
[ [ t [ σ ] ] ] ( ρ ) ≈ [ [ t ′ ′ [ σ ′ ] ] ] ( ρ ′ ) ∈ R T [\![t[\sigma]]\!](\rho) \approx[\![t''[\sigma']]\!](\rho') \in R_T [ [ t [ σ ]] ] ( ρ ) ≈ [ [ t ′′ [ σ ′ ]] ] ( ρ ′ ) ∈ R T (transitivity)
This is the outer-LHS vs outer-RHS of the goal’s four-value pattern. The other three pairs follow by combining the first hypothesis (giving [ [ t [ σ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ σ ] ] ( ρ ) ) , [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ) ) , [ [ t ′ [ σ ′ ] ] ] ( ρ ′ ) [\![t[\sigma]]\!](\rho), [\![t]\!]([\![\sigma]\!](\rho)), [\![t']\!]([\![\sigma']\!](\rho')), [\![t'[\sigma']]\!](\rho') [ [ t [ σ ]] ] ( ρ ) , [ [ t ] ] ([ [ σ ] ] ( ρ )) , [ [ t ′ ] ] ([ [ σ ′ ] ] ( ρ ′ )) , [ [ t ′ [ σ ′ ]] ] ( ρ ′ ) pairwise in R T R_T R T ) with the above transitivity step.
Semantic Context Well-Formedness
We now show that every syntactic rule is validated semantically: each rule has a corresponding lemma asserting that the semantic judgments hold whenever the semantic counterparts of the rule’s premises do. These lemmas are the building blocks of the fundamental theorem (Sec. 6.20), which combines them by mutual induction on the syntactic derivation.
Lemma 6.50 (Fundamental — Ctx-Emp). ⊢ ⋅ \vdash\cdot ⊢ ⋅ .
Proof. By Sem-Ctx-Emp of Theorem 6.33.
Lemma 6.51 (Fundamental — Ctx-Ext). If ⊢ Γ \vdash\Gamma ⊢ Γ and Γ ⊢ S ≈ S : T y i \Gamma\vdash S \approx S : \mathsf{Ty}_i Γ ⊢ S ≈ S : Ty i , then ⊢ Γ , x : S \vdash\Gamma, x : S ⊢ Γ , x : S .
Proof. By Theorem 6.34 on ⊨ Γ \vDash\Gamma ⊨ Γ , Γ ≈ Γ ↓ R T \Gamma\approx\Gamma\mathbin{\downarrow} R_T Γ ≈ Γ ↓ R T for some R T R_T R T . By Theorem 6.38 on Γ ⊨ S ≈ S : T y i \Gamma\vDash S \approx S : \mathrm{Ty}_i Γ ⊨ S ≈ S : Ty i , for any D : : ρ ≈ ρ ′ ∈ R T \mathcal{D} :: \rho\approx\rho' \in R_T D :: ρ ≈ ρ ′ ∈ R T , ⟦ S ⟧ ( ρ ) ≈ ⟦ S ⟧ ( ρ ′ ) ∈ U i ↓ R H ( D ) \llbracket S\rrbracket(\rho) \approx\llbracket S\rrbracket(\rho') \in\mathcal{U}_i \mathbin{\downarrow} R_H(\mathcal{D}) [ [ S ] ] ( ρ ) ≈ [ [ S ] ] ( ρ ′ ) ∈ U i ↓ R H ( D ) . By Ctx-Ext of Theorem 6.19, this gives ( Γ , x : S ) ≈ ( Γ , x : S ) ↓ R (\Gamma, x : S) \approx(\Gamma, x : S) \mathbin{\downarrow} R ( Γ , x : S ) ≈ ( Γ , x : S ) ↓ R for some R R R . By Sem-Ctx-Ext of Theorem 6.33, applied to ⊨ Γ \vDash\Gamma ⊨ Γ , this context PER, and Γ ⊨ S ≈ S : T y i \Gamma\vDash S \approx S : \mathrm{Ty}_i Γ ⊨ S ≈ S : Ty i , we conclude ⊨ Γ , x : S \vDash\Gamma, x : S ⊨ Γ , x : S . □ \square □
Semantic Type Formation
Lemma 6.52 (Fundamental – U-Wf). If ⊨ Γ \vDash\Gamma ⊨ Γ , then Γ ⊨ T y i ≈ T y i : T y 1 + i \Gamma\vDash\mathrm{Ty}_i \approx\mathrm{Ty}_i : \mathrm{Ty}_{1+i} Γ ⊨ Ty i ≈ Ty i : Ty 1 + i .
Proof. By Theorem 6.34, Γ ≈ Γ ↓ R \Gamma\approx\Gamma\mathbin{\downarrow} R Γ ≈ Γ ↓ R for some R R R . Let Γ ′ ≈ Γ ′ ↓ R ′ \Gamma' \approx\Gamma' \mathbin{\downarrow} R' Γ ′ ≈ Γ ′ ↓ R ′ , Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \vDash\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. We must exhibit R T R_T R T such that
{ ⟦ T y 1 + i [ σ ] ⟧ ( ρ ) , ⟦ T y 1 + i ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ T y 1 + i ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ T y 1 + i [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U 2 + i ↓ R T \{\llbracket\mathrm{Ty}_{1+i}[\sigma]\rrbracket(\rho),\ \llbracket\mathrm{Ty}_{1+i}\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket\mathrm{Ty}_{1+i}\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \llbracket\mathrm{Ty}_{1+i}[\sigma']\rrbracket(\rho')\} \subseteq\mathcal{U}_{2+i} \mathbin{\downarrow} R_T { [ [ Ty 1 + i [ σ ] ] ] ( ρ ) , [ [ Ty 1 + i ] ] ( [ [ σ ] ] ( ρ )) , [ [ Ty 1 + i ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ Ty 1 + i [ σ ′ ] ] ] ( ρ ′ )} ⊆ U 2 + i ↓ R T
and
{ ⟦ T y i [ σ ] ⟧ ( ρ ) , ⟦ T y i ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ T y i ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ T y i [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R T . \{\llbracket\mathrm{Ty}_i[\sigma]\rrbracket(\rho),\ \llbracket\mathrm{Ty}_i\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket\mathrm{Ty}_i\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \llbracket\mathrm{Ty}_i[\sigma']\rrbracket(\rho')\} \subseteq R_T. { [ [ Ty i [ σ ] ] ] ( ρ ) , [ [ Ty i ] ] ( [ [ σ ] ] ( ρ )) , [ [ Ty i ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ Ty i [ σ ′ ] ] ] ( ρ ′ )} ⊆ R T .
Type part. Since T y 1 + i \mathrm{Ty}_{1+i} Ty 1 + i is closed (it has no free variables), we compute:
⟦ T y 1 + i [ σ ] ⟧ ( ρ ) = ⟦ T y 1 + i ⟧ ( ρ ) = U 1 + i \begin{aligned}
\llbracket\mathrm{Ty}_{1+i}[\sigma]\rrbracket(\rho) = \llbracket\mathrm{Ty}_{1+i}\rrbracket(\rho) \\
&= \mathcal{U}_{1+i}
\end{aligned} [ [ Ty 1 + i [ σ ] ] ] ( ρ ) = [ [ Ty 1 + i ] ] ( ρ ) = U 1 + i
⟦ T y 1 + i ⟧ ( ⟦ σ ⟧ ( ρ ) ) = U 1 + i \llbracket\mathrm{Ty}_{1+i}\rrbracket(\llbracket\sigma\rrbracket(\rho)) = \mathcal{U}_{1+i} [ [ Ty 1 + i ] ] ( [ [ σ ] ] ( ρ )) = U 1 + i
Identical computations apply to the other two type values. Hence all four type values collapse to U 1 + i \mathcal{U}_{1+i} U 1 + i , and we need U 1 + i ≈ U 1 + i ∈ U 2 + i ↓ R T \mathcal{U}_{1+i} \approx\mathcal{U}_{1+i} \in\mathcal{U}_{2+i} \mathbin{\downarrow} R_T U 1 + i ≈ U 1 + i ∈ U 2 + i ↓ R T for some R T R_T R T .
U 1 + i ≈ U 1 + i ∈ U 2 + i ↓ R T with R T ⇔ U 1 + i \mathcal{U}_{1+i} \approx\mathcal{U}_{1+i} \in\mathcal{U}_{2+i} \mathbin{\downarrow} R_T \quad\text{with } R_T \Leftrightarrow\mathcal{U}_{1+i} U 1 + i ≈ U 1 + i ∈ U 2 + i ↓ R T with R T ⇔ U 1 + i
(by U-Univ, since 1 + i < 2 + i 1+i < 2+i 1 + i < 2 + i )
Term part. Since T y i \mathrm{Ty}_i Ty i is closed, the same computation gives
⟦ T y i [ σ ] ⟧ ( ρ ) = ⟦ T y i ⟧ ( ρ ) = U i \llbracket\mathrm{Ty}_i[\sigma]\rrbracket(\rho) = \llbracket\mathrm{Ty}_i\rrbracket(\rho) = \mathcal{U}_i [ [ Ty i [ σ ] ] ] ( ρ ) = [ [ Ty i ] ] ( ρ ) = U i
⟦ T y i ⟧ ( ⟦ σ ⟧ ( ρ ) ) = U i \llbracket\mathrm{Ty}_i\rrbracket(\llbracket\sigma\rrbracket(\rho)) = \mathcal{U}_i [ [ Ty i ] ] ( [ [ σ ] ] ( ρ )) = U i
and similarly for the primed values, so all four term values collapse to U i \mathcal{U}_i U i . Since R T ⇔ U 1 + i R_T \Leftrightarrow\mathcal{U}_{1+i} R T ⇔ U 1 + i , it suffices to show U i ≈ U i ∈ U 1 + i \mathcal{U}_i \approx\mathcal{U}_i \in\mathcal{U}_{1+i} U i ≈ U i ∈ U 1 + i , i.e. ∃ R 0 . U i ≈ U i ∈ U 1 + i ↓ R 0 \exists R_0.\ \mathcal{U}_i \approx\mathcal{U}_i \in\mathcal{U}_{1+i} \mathbin{\downarrow} R_0 ∃ R 0 . U i ≈ U i ∈ U 1 + i ↓ R 0 .
U i ≈ U i ∈ U 1 + i ↓ R 0 with R 0 ⇔ U i \mathcal{U}_i \approx\mathcal{U}_i \in\mathcal{U}_{1+i} \mathbin{\downarrow} R_0 \quad\text{with } R_0 \Leftrightarrow\mathcal{U}_i U i ≈ U i ∈ U 1 + i ↓ R 0 with R 0 ⇔ U i
(by U-Univ, since i < 1 + i i < 1+i i < 1 + i )
Hence U i ≈ U i ∈ R T \mathcal{U}_i \approx\mathcal{U}_i \in R_T U i ≈ U i ∈ R T , and the four-value pattern follows. □ \square □
Lemma 6.53 (Fundamental – N-Wf). If ⊨ Γ \vDash\Gamma ⊨ Γ , then Γ ⊨ N a t ≈ N a t : T y 0 \Gamma\vDash\mathrm{Nat} \approx\mathrm{Nat} : \mathrm{Ty}_0 Γ ⊨ Nat ≈ Nat : Ty 0 .
Proof. By Theorem 6.34, Γ ≈ Γ ↓ R \Gamma\approx\Gamma\mathbin{\downarrow} R Γ ≈ Γ ↓ R for some R R R . Let Γ ′ ≈ Γ ′ ↓ R ′ \Gamma' \approx\Gamma' \mathbin{\downarrow} R' Γ ′ ≈ Γ ′ ↓ R ′ , Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \vDash\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. We must exhibit R T R_T R T such that
{ ⟦ T y 0 [ σ ] ⟧ ( ρ ) , ⟦ T y 0 ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ T y 0 ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ T y 0 [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U 1 ↓ R T \{\llbracket\mathrm{Ty}_0[\sigma]\rrbracket(\rho),\ \llbracket\mathrm{Ty}_0\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket\mathrm{Ty}_0\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \llbracket\mathrm{Ty}_0[\sigma']\rrbracket(\rho')\} \subseteq\mathcal{U}_1 \mathbin{\downarrow} R_T { [ [ Ty 0 [ σ ] ] ] ( ρ ) , [ [ Ty 0 ] ] ( [ [ σ ] ] ( ρ )) , [ [ Ty 0 ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ Ty 0 [ σ ′ ] ] ] ( ρ ′ )} ⊆ U 1 ↓ R T
and
{ ⟦ N a t [ σ ] ⟧ ( ρ ) , ⟦ N a t ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ N a t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ N a t [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R T . \{\llbracket\mathrm{Nat}[\sigma]\rrbracket(\rho),\ \llbracket\mathrm{Nat}\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket\mathrm{Nat}\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \llbracket\mathrm{Nat}[\sigma']\rrbracket(\rho')\} \subseteq R_T. { [ [ Nat [ σ ] ] ] ( ρ ) , [ [ Nat ] ] ( [ [ σ ] ] ( ρ )) , [ [ Nat ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ Nat [ σ ′ ] ] ] ( ρ ′ )} ⊆ R T .
Type part. Since T y 0 \mathrm{Ty}_0 Ty 0 is closed, we compute:
⟦ T y 0 [ σ ] ⟧ ( ρ ) = ⟦ T y 0 ⟧ ( ρ ) = U 0 \llbracket\mathrm{Ty}_0[\sigma]\rrbracket(\rho) = \llbracket\mathrm{Ty}_0\rrbracket(\rho) = \mathcal{U}_0 [ [ Ty 0 [ σ ] ] ] ( ρ ) = [ [ Ty 0 ] ] ( ρ ) = U 0
⟦ T y 0 ⟧ ( ⟦ σ ⟧ ( ρ ) ) = U 0 \llbracket\mathrm{Ty}_0\rrbracket(\llbracket\sigma\rrbracket(\rho)) = \mathcal{U}_0 [ [ Ty 0 ] ] ( [ [ σ ] ] ( ρ )) = U 0
Identical computations give the same value for the other two type values. All four type values collapse to U 0 U_0 U 0 , and we need U 0 ≈ U 0 ∈ U 1 ↘ R T U_0 \approx U_0 \in\mathcal{U}_1 \searrow R_T U 0 ≈ U 0 ∈ U 1 ↘ R T .
U 0 ≈ U 0 ∈ U 1 ↘ R T U_0 \approx U_0 \in\mathcal{U}_1 \searrow R_T U 0 ≈ U 0 ∈ U 1 ↘ R T
with R T ⇔ U 0 R_T \Leftrightarrow\mathcal{U}_0 R T ⇔ U 0 (by U-Univ, since 0 < 1 0 < 1 0 < 1 )
Term part. Since Nat is closed, all four term values collapse to N N N :
⟦ Nat [ σ ] ⟧ ( ρ ) = ⟦ Nat ⟧ ( ρ ) = N \llbracket\operatorname{Nat}[\sigma]\rrbracket(\rho)=\llbracket\operatorname{Nat}\rrbracket(\rho)=N [ [ Nat [ σ ] ] ] ( ρ ) = [ [ Nat ] ] ( ρ ) = N
(closed term, by evaluation)
⟦ Nat ⟧ ( ⟦ σ ⟧ ( ρ ) ) = N \llbracket\operatorname{Nat}\rrbracket(\llbracket\sigma\rrbracket(\rho))=N [ [ Nat ] ] ( [ [ σ ] ] ( ρ )) = N
(by evaluation)
Since R T ⇔ U 0 R_T \Leftrightarrow\mathcal{U}_0 R T ⇔ U 0 , it suffices to show N ≈ N ∈ U 0 N \approx N \in\mathcal{U}_0 N ≈ N ∈ U 0 , i.e. ∃ R 0 . N ≈ N ∈ U 0 ↘ R 0 \exists R_0. \ N \approx N \in\mathcal{U}_0 \searrow R_0 ∃ R 0 . N ≈ N ∈ U 0 ↘ R 0 .
N ≈ N ∈ U 0 ↘ R 0 N \approx N \in\mathcal{U}_0 \searrow R_0 N ≈ N ∈ U 0 ↘ R 0
with R 0 ⇔ Nat R_0 \Leftrightarrow\operatorname{Nat} R 0 ⇔ Nat (by U-Nat)
Hence N ≈ N ∈ R T N \approx N \in R_T N ≈ N ∈ R T , and the four-value pattern follows.
Lemma 6.54 (Fundamental — Π \Pi Π -Wf / Π \Pi Π -Cong). If Γ ⊨ S ≈ S ′ : Ty i \Gamma\models S \approx S' : \operatorname{Ty}_i Γ ⊨ S ≈ S ′ : Ty i and Γ , x : S ⊨ T ≈ T ′ : Ty i \Gamma, x : S \models T \approx T' : \operatorname{Ty}_i Γ , x : S ⊨ T ≈ T ′ : Ty i , then Γ ⊨ Π ( x : S ) . T ≈ Π ( x : S ′ ) . T ′ : Ty i \Gamma\models\Pi(x : S).T \approx\Pi(x : S').T' : \operatorname{Ty}_i Γ ⊨ Π ( x : S ) . T ≈ Π ( x : S ′ ) . T ′ : Ty i .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \models\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. We must show that the four type values
{ ⟦ Ty i [ σ ] ⟧ ( ρ ) , ⟦ Ty i ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ Ty i ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ Ty i [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U 1 + i ↘ R T \{\llbracket\operatorname{Ty}_i[\sigma]\rrbracket(\rho),\ \llbracket\operatorname{Ty}_i\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket\operatorname{Ty}_i\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \ \llbracket\operatorname{Ty}_i[\sigma']\rrbracket(\rho')\} \subseteq\mathcal{U}_{1+i} \searrow R_T { [ [ Ty i [ σ ] ] ] ( ρ ) , [ [ Ty i ] ] ( [ [ σ ] ] ( ρ )) , [ [ Ty i ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ Ty i [ σ ′ ] ] ] ( ρ ′ )} ⊆ U 1 + i ↘ R T for some R T R_T R T with R T ⇔ U i R_T \Leftrightarrow\mathcal{U}_i R T ⇔ U i (as in Theorem 6.52), and that the four term values
{ ⟦ ( Π ( x : S ) . T ) [ σ ] ⟧ ( ρ ) , ⟦ Π ( x : S ) . T ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ Π ( x : S ′ ) . T ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ ( Π ( x : S ′ ) . T ′ ) [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R T , \{\llbracket(\Pi(x : S).T)[\sigma]\rrbracket(\rho),\ \llbracket\Pi(x : S).T\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket\Pi(x : S').T'\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \ \llbracket(\Pi(x : S').T')[\sigma']\rrbracket(\rho')\} \subseteq R_T, { [ [ ( Π ( x : S ) . T ) [ σ ] ] ] ( ρ ) , [ [ Π ( x : S ) . T ] ] ( [ [ σ ] ] ( ρ )) , [ [ Π ( x : S ′ ) . T ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ ( Π ( x : S ′ ) . T ′ ) [ σ ′ ] ] ] ( ρ ′ )} ⊆ R T , i.e. relate in U i ↘ R \mathcal{U}_i \searrow R U i ↘ R for some R R R .
Type part. As in Theorem 6.52, the four values of Ty i \operatorname{Ty}_i Ty i collapse to U i U_i U i , and U i ≈ U i ∈ U 1 + i ↘ R T U_i \approx U_i \in\mathcal{U}_{1+i} \searrow R_T U i ≈ U i ∈ U 1 + i ↘ R T with R T ⇔ U i R_T \Leftrightarrow\mathcal{U}_i R T ⇔ U i by U-Univ.
Term part. We compute the four term values:
⟦ ( Π ( x : S ) . T ) [ σ ] ⟧ ( ρ ) = ⟦ Π ( x : S [ σ ] ) . ( T [ q ( σ ) ] ) ⟧ ( ρ ) \llbracket(\Pi(x : S).T)[\sigma]\rrbracket(\rho)=\llbracket\Pi(x : S[\sigma]).(T[q(\sigma)])\rrbracket(\rho) [ [ ( Π ( x : S ) . T ) [ σ ] ] ] ( ρ ) = [ [ Π ( x : S [ σ ]) . ( T [ q ( σ )]) ] ] ( ρ ) (by definition of substitution on Π \Pi Π )
= Π ( ⟦ S [ σ ] ⟧ ( ρ ) , T [ q ( σ ) ] , ρ ) =\Pi(\llbracket S[\sigma]\rrbracket(\rho),T[q(\sigma)],\rho) = Π ( [ [ S [ σ ] ] ] ( ρ ) , T [ q ( σ )] , ρ ) (by evaluation of Π \Pi Π )
⟦ Π ( x : S ) . T ⟧ ( ⟦ σ ⟧ ( ρ ) ) = Π ( ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) , T , ⟦ σ ⟧ ( ρ ) ) \llbracket\Pi(x : S).T\rrbracket(\llbracket\sigma\rrbracket(\rho))
=\Pi(\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho)),T,\llbracket\sigma\rrbracket(\rho)) [ [ Π ( x : S ) . T ] ] ( [ [ σ ] ] ( ρ )) = Π ( [ [ S ] ] ( [ [ σ ] ] ( ρ )) , T , [ [ σ ] ] ( ρ )) (by evaluation of Π \Pi Π )
Analogous computations apply to the primed pair, yielding
Π ( ⟦ S ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , T ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) \Pi(\llbracket S'\rrbracket(\llbracket\sigma'\rrbracket(\rho')),T',\llbracket\sigma'\rrbracket(\rho')) Π ( [ [ S ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , T ′ , [ [ σ ′ ] ] ( ρ ′ )) and
Π ( ⟦ S ′ [ σ ′ ] ⟧ ( ρ ′ ) , T ′ [ q ( σ ′ ) ] , ρ ′ ) . \Pi(\llbracket S'[\sigma']\rrbracket(\rho'),T'[q(\sigma')],\rho'). Π ( [ [ S ′ [ σ ′ ] ] ] ( ρ ′ ) , T ′ [ q ( σ ′ )] , ρ ′ ) . We construct a U-Pi derivation relating the outermost two values; the inner two follow analogously.
Domain. Apply Γ ⊨ S ≈ S ′ : Ty i \Gamma\models S \approx S' : \operatorname{Ty}_i Γ ⊨ S ≈ S ′ : Ty i at Γ ′ , σ ≈ σ ′ : Γ \Gamma', \sigma\approx\sigma' : \Gamma Γ ′ , σ ≈ σ ′ : Γ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ :
{ ⟦ S [ σ ] ⟧ ( ρ ) , ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ S ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ S ′ [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R I \{\llbracket S[\sigma]\rrbracket(\rho),\ \llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket S'\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \ \llbracket S'[\sigma']\rrbracket(\rho')\} \subseteq\mathcal{U}_i \searrow R_I { [ [ S [ σ ] ] ] ( ρ ) , [ [ S ] ] ( [ [ σ ] ] ( ρ )) , [ [ S ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ S ′ [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R I (by hypothesis on S , S ′ S,S' S , S ′ )
Codomain via lifting. By Theorem 6.47 on Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \models\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ and Γ ⊨ S ≈ S ′ : Ty i \Gamma\models S \approx S' : \operatorname{Ty}_i Γ ⊨ S ≈ S ′ : Ty i (using its reflexive instance Γ ⊨ S ≈ S : Ty i \Gamma\models S \approx S : \operatorname{Ty}_i Γ ⊨ S ≈ S : Ty i via Theorems 6.41 and 6.42 for the well-formedness premise of Theorem 6.47):
Γ ′ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S . \Gamma',x:S[\sigma]\models q(\sigma)\approx q(\sigma'):\Gamma,x:S. Γ ′ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S . By the first premise of the semantic substitution judgment, this carries ( Γ ′ , x : S [ σ ] ) ≈ ( Γ ′ , x : S [ σ ′ ] ) ↘ R Γ ′ , x : S [ σ ′ ] (\Gamma',x:S[\sigma]) \approx(\Gamma',x:S[\sigma']) \searrow R_{\Gamma',x:S[\sigma']} ( Γ ′ , x : S [ σ ]) ≈ ( Γ ′ , x : S [ σ ′ ]) ↘ R Γ ′ , x : S [ σ ′ ] and ( Γ , x : S ) ≈ ( Γ , x : S ) ↘ R Γ , x : S (\Gamma,x:S) \approx(\Gamma,x:S) \searrow R_{\Gamma,x:S} ( Γ , x : S ) ≈ ( Γ , x : S ) ↘ R Γ , x : S .
Let D I : : a ≈ a ′ ∈ R I \mathcal{D}_I :: a \approx a' \in R_I D I :: a ≈ a ′ ∈ R I be given. By the biconditional of R Γ ′ , x : S [ σ ′ ] R_{\Gamma',x:S[\sigma']} R Γ ′ , x : S [ σ ′ ] from Ctx-Ext, ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ′ ] (\rho,a/x) \approx(\rho',a'/x) \in R_{\Gamma',x:S[\sigma']} ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ′ ] requires ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ (which we have) and a ≈ a ′ ∈ R H ′ ( D ′ ) a \approx a' \in R'_H(\mathcal{D}') a ≈ a ′ ∈ R H ′ ( D ′ ) where R H ′ R'_H R H ′ is the head family for R Γ ′ , x : S [ σ ′ ] R_{\Gamma',x:S[\sigma']} R Γ ′ , x : S [ σ ′ ] , governed by ⟦ S [ σ ] ⟧ ( ρ ) ≈ ⟦ S [ σ ′ ] ⟧ ( ρ ′ ) ∈ U i ↘ R H ′ ( D ′ ) \llbracket S[\sigma]\rrbracket(\rho) \approx\llbracket S[\sigma']\rrbracket(\rho') \in\mathcal{U}_i \searrow R'_H(\mathcal{D}') [ [ S [ σ ] ] ] ( ρ ) ≈ [ [ S [ σ ′ ] ] ] ( ρ ′ ) ∈ U i ↘ R H ′ ( D ′ ) (with D ′ : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D}' :: \rho\approx\rho' \in R' D ′ :: ρ ≈ ρ ′ ∈ R ′ ). By Theorem 6.12 on the same left type
⟦ S [ σ ] ⟧ ( ρ ) \llbracket S[\sigma]\rrbracket(\rho) [ [ S [ σ ] ] ] ( ρ ) that governs both R I R_I R I (from the domain step) and R H ′ ( D ′ ) R'_H(\mathcal{D}') R H ′ ( D ′ ) , R I ⇔ R H ′ ( D ′ ) R_I \Leftrightarrow R'_H(\mathcal{D}') R I ⇔ R H ′ ( D ′ ) . Hence a ≈ a ′ ∈ R H ′ ( D ′ ) a \approx a' \in R'_H(\mathcal{D}') a ≈ a ′ ∈ R H ′ ( D ′ ) , and ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ] (\rho,a/x) \approx(\rho',a'/x) \in R_{\Gamma',x:S[\sigma]} ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ] .
Apply Γ , x : S ⊨ T ≈ T ′ : T y i \Gamma,x:S \vDash T \approx T' : \mathsf{Ty}_i Γ , x : S ⊨ T ≈ T ′ : Ty i at Γ ′ , x : S [ σ ] \Gamma',x:S[\sigma] Γ ′ , x : S [ σ ] (with R Γ ′ , x : S [ σ ] R_{\Gamma',x:S[\sigma]} R Γ ′ , x : S [ σ ] ), the lifted substitution Γ ′ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S \Gamma',x:S[\sigma] \vDash q(\sigma) \approx q(\sigma') : \Gamma,x:S Γ ′ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S , and ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ] (\rho,a/x) \approx(\rho',a'/x) \in R_{\Gamma',x:S[\sigma]} ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ] :
{ ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) , ⟦ T ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) ) , ⟦ T ′ ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ) , ⟦ T ′ [ q ( σ ′ ) ] ⟧ ( ( ρ ′ , a ′ / x ) ) } ⊆ U i ↘ R O ( D I ) \left\{
\begin{aligned}
&\llbracket T[q(\sigma)]\rrbracket((\rho,a/x)),\ \llbracket T\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,a/x))),\\
&\llbracket T'\rrbracket(\llbracket q(\sigma')\rrbracket((\rho',a'/x))),\ \llbracket T'[q(\sigma')]\rrbracket((\rho',a'/x))
\end{aligned}
\right\}
\subseteq\mathcal{U}_i \mathbin{\searrow} R_O(\mathcal{D}_I) { [ [ T [ q ( σ )] ] ] (( ρ , a / x )) , [ [ T ] ] ( [ [ q ( σ ) ] ] (( ρ , a / x ))) , [ [ T ′ ] ] ( [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x ))) , [ [ T ′ [ q ( σ ′ )] ] ] (( ρ ′ , a ′ / x )) } ⊆ U i ↘ R O ( D I )
(by hypothesis on T , T ′ T,T' T , T ′ )
The outer two values ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) \llbracket T[q(\sigma)]\rrbracket((\rho,a/x)) [ [ T [ q ( σ )] ] ] (( ρ , a / x )) and ⟦ T ′ [ q ( σ ′ ) ] ⟧ ( ( ρ ′ , a ′ / x ) ) \llbracket T'[q(\sigma')]\rrbracket((\rho',a'/x)) [ [ T ′ [ q ( σ ′ )] ] ] (( ρ ′ , a ′ / x )) are exactly the codomain expressions of the outer Π \Pi Π -values applied to a , a ′ a,a' a , a ′ , satisfying the U-Pi codomain premise for the outer pair.
For the inner Π \Pi Π -values Π ( ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) , T , ⟦ σ ⟧ ( ρ ) ) \Pi(\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho)),T,\llbracket\sigma\rrbracket(\rho)) Π ( [ [ S ] ] ( [ [ σ ] ] ( ρ )) , T , [ [ σ ] ] ( ρ )) (left) and Π ( ⟦ S ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , T ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) \Pi(\llbracket S'\rrbracket(\llbracket\sigma'\rrbracket(\rho')),T',\llbracket\sigma'\rrbracket(\rho')) Π ( [ [ S ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , T ′ , [ [ σ ′ ] ] ( ρ ′ )) (right), the codomain expressions applied to a , a ′ a,a' a , a ′ are ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , a / x ) ) \llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),a/x)) [ [ T ] ] (( [ [ σ ] ] ( ρ ) , a / x )) and ⟦ T ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) \llbracket T'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x)) [ [ T ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) . Applying the lifted-substitution four-value pattern (instantiated at the identity weakening on Γ ′ , x : S [ σ ] \Gamma',x:S[\sigma] Γ ′ , x : S [ σ ] with ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) (\rho,a/x) \approx(\rho',a'/x) ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ), we obtain in particular
⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) ≈ ( ⟦ σ ⟧ ( ρ ) , a / x ) ∈ R Γ , x : S \llbracket q(\sigma)\rrbracket((\rho,a/x)) \approx(\llbracket\sigma\rrbracket(\rho),a/x) \in R_{\Gamma,x:S} [ [ q ( σ ) ] ] (( ρ , a / x )) ≈ ( [ [ σ ] ] ( ρ ) , a / x ) ∈ R Γ , x : S
(the outer-versus-inner relatedness in that four-value pattern). By Theorem 6.38 on Γ , x : S ⊨ T ≈ T : T y i \Gamma,x:S \vDash T \approx T : \mathsf{Ty}_i Γ , x : S ⊨ T ≈ T : Ty i applied to this related pair:
⟦ T ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) ) ≈ ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , a / x ) ) ∈ U i . \llbracket T\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,a/x))) \approx\llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),a/x)) \in\mathcal{U}_i. [ [ T ] ] ( [ [ q ( σ ) ] ] (( ρ , a / x ))) ≈ [ [ T ] ] (( [ [ σ ] ] ( ρ ) , a / x )) ∈ U i .
Combined with the inner-pair relatedness from the codomain four-value pattern
⟦ T ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) ) ≈ ⟦ T ′ ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ) ∈ U i ↘ R O ( D I ) \llbracket T\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,a/x))) \approx\llbracket T'\rrbracket(\llbracket q(\sigma')\rrbracket((\rho',a'/x))) \in\mathcal{U}_i \mathbin{\searrow} R_O(\mathcal{D}_I) [ [ T ] ] ( [ [ q ( σ ) ] ] (( ρ , a / x ))) ≈ [ [ T ′ ] ] ( [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x ))) ∈ U i ↘ R O ( D I )
and the analogous identity
⟦ T ′ ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ) ≈ ⟦ T ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) ∈ U i \llbracket T'\rrbracket(\llbracket q(\sigma')\rrbracket((\rho',a'/x))) \approx\llbracket T'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x)) \in\mathcal{U}_i [ [ T ′ ] ] ( [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x ))) ≈ [ [ T ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) ∈ U i
on the primed side (by Theorem 6.38 on the reflexive Γ , x : S ⊨ T ′ ≈ T ′ : T y i \Gamma,x:S \vDash T' \approx T' : \mathsf{Ty}_i Γ , x : S ⊨ T ′ ≈ T ′ : Ty i obtained from Γ , x : S ⊨ T ≈ T ′ : T y i \Gamma,x:S \vDash T \approx T' : \mathsf{Ty}_i Γ , x : S ⊨ T ≈ T ′ : Ty i by symmetry/transitivity), symmetry and transitivity of U i \mathcal{U}_i U i yield
⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , a / x ) ) ≈ ⟦ T ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) ∈ U i ↘ R O ( D I ) . \llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),a/x)) \approx\llbracket T'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x)) \in\mathcal{U}_i \mathbin{\searrow} R_O(\mathcal{D}_I). [ [ T ] ] (( [ [ σ ] ] ( ρ ) , a / x )) ≈ [ [ T ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) ∈ U i ↘ R O ( D I ) .
This is the U-Pi codomain premise for the inner pair.
Function PER. Define R R R by the biconditional: f ≈ f ′ ∈ R ↔ ( ∀ D I : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D I ) ) f \approx f' \in R \leftrightarrow(\forall D_I :: a \approx a' \in R_I.\ f \mathbin{\cdot} a \approx f' \mathbin{\cdot} a' \in R_O(\mathcal{D}_I)) f ≈ f ′ ∈ R ↔ ( ∀ D I :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D I )) .
Outer pair. By U-Pi applied with domain R I R_I R I (from Domain ) and codomain R O ( D I ) R_O(\mathcal{D}_I) R O ( D I ) (from the outer pair of the codomain four-value pattern):
Π ( ⟦ S [ σ ] ⟧ ( ρ ) , T [ q ( σ ) ] , ρ ) ≈ Π ( ⟦ S ′ [ σ ′ ] ⟧ ( ρ ′ ) , T ′ [ q ( σ ′ ) ] , ρ ′ ) ∈ U i ↘ R . \Pi(\llbracket S[\sigma]\rrbracket(\rho),T[q(\sigma)],\rho) \approx\Pi(\llbracket S'[\sigma']\rrbracket(\rho'),T'[q(\sigma')],\rho') \in\mathcal{U}_i \mathbin{\searrow} R. Π ( [ [ S [ σ ] ] ] ( ρ ) , T [ q ( σ )] , ρ ) ≈ Π ( [ [ S ′ [ σ ′ ] ] ] ( ρ ′ ) , T ′ [ q ( σ ′ )] , ρ ′ ) ∈ U i ↘ R .
Inner pair. By U-Pi applied with domain R I R_I R I (the inner pair ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) ≈ ⟦ S ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ U i \llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho)) \approx\llbracket S'\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \in\mathcal{U}_i [ [ S ] ] ( [ [ σ ] ] ( ρ )) ≈ [ [ S ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ∈ U i from Domain also lands in R I R_I R I by Theorem 6.12) and codomain R O ( D I ) R_O(\mathcal{D}_I) R O ( D I ) (just derived for the inner pair):
Π ( ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) , T , ⟦ σ ⟧ ( ρ ) ) ≈ Π ( ⟦ S ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , T ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ U i ↘ R . \Pi(\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho)),T,\llbracket\sigma\rrbracket(\rho)) \approx\Pi(\llbracket S'\rrbracket(\llbracket\sigma'\rrbracket(\rho')),T',\llbracket\sigma'\rrbracket(\rho')) \in\mathcal{U}_i \mathbin{\searrow} R. Π ( [ [ S ] ] ( [ [ σ ] ] ( ρ )) , T , [ [ σ ] ] ( ρ )) ≈ Π ( [ [ S ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , T ′ , [ [ σ ′ ] ] ( ρ ′ )) ∈ U i ↘ R .
Cross-relations. We have established Π \Pi Π -relatedness for the outer pair and for the inner pair, both with element PER R R R . To get full four-way relatedness, we establish one cross-relation (outer-left versus inner-left) via a third U-Pi derivation; the remaining cross-relations follow by symmetry (Theorem 6.13) and transitivity (Theorem 6.14) of U i \mathcal{U}_i U i .
The third U-Pi derivation uses:
⟦ S [ σ ] ⟧ ( ρ ) ≈ ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) ∈ U i \llbracket S[\sigma]\rrbracket(\rho) \approx\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho)) \in\mathcal{U}_i [ [ S [ σ ] ] ] ( ρ ) ≈ [ [ S ] ] ( [ [ σ ] ] ( ρ )) ∈ U i
holds, with element PER R I R_I R I by Theorem 6.12.
⟦ T [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) ≈ ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , a ′ / x ) ) ∈ U i ↘ R O ( D I ) . \llbracket T[q(\sigma)]\rrbracket((\rho,a/x)) \approx\llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),a'/x)) \in\mathcal{U}_i \searrow R_O(D_I). [ [ T [ q ( σ )] ] ] (( ρ , a / x )) ≈ [ [ T ] ] (( [ [ σ ] ] ( ρ ) , a ′ / x )) ∈ U i ↘ R O ( D I ) .
From the codomain four-value pattern, the cross relation
⟦ T [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) ≈ ⟦ T ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ) ∈ U i ↘ R O ( D I ) \llbracket T[q(\sigma)]\rrbracket((\rho,a/x)) \approx\llbracket T\rrbracket(\llbracket q(\sigma')\rrbracket((\rho',a'/x))) \in\mathcal{U}_i \searrow R_O(D_I) [ [ T [ q ( σ )] ] ] (( ρ , a / x )) ≈ [ [ T ] ] ( [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x ))) ∈ U i ↘ R O ( D I )
holds (outer-left versus inner-right). By Theorem 6.38 applied at the relatedness ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ≈ ( ⟦ σ ′ ⟧ ( ρ ) , a ′ / x ) ∈ R Γ , x : S \llbracket q(\sigma')\rrbracket((\rho',a'/x)) \approx(\llbracket\sigma'\rrbracket(\rho),a'/x) \in R_{\Gamma,x:S} [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x )) ≈ ( [ [ σ ′ ] ] ( ρ ) , a ′ / x ) ∈ R Γ , x : S (which holds by symmetry and transitivity in R Γ , x : S R_{\Gamma,x:S} R Γ , x : S , bridging through the inner-pair relatedness of the lifted substitution four-value pattern):
⟦ T ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ) ≈ ⟦ T ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ) , a ′ / x ) ) ∈ U i . \llbracket T\rrbracket(\llbracket q(\sigma')\rrbracket((\rho',a'/x))) \approx\llbracket T\rrbracket((\llbracket\sigma'\rrbracket(\rho),a'/x)) \in\mathcal{U}_i. [ [ T ] ] ( [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x ))) ≈ [ [ T ] ] (( [ [ σ ′ ] ] ( ρ ) , a ′ / x )) ∈ U i .
By transitivity of U i \mathcal{U}_i U i , ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) ≈ ⟦ T ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ) , a ′ / x ) ) ∈ U i ↘ R O ( D I ) \llbracket T[q(\sigma)]\rrbracket((\rho,a/x)) \approx\llbracket T\rrbracket((\llbracket\sigma'\rrbracket(\rho),a'/x)) \in\mathcal{U}_i \searrow R_O(D_I) [ [ T [ q ( σ )] ] ] (( ρ , a / x )) ≈ [ [ T ] ] (( [ [ σ ′ ] ] ( ρ ) , a ′ / x )) ∈ U i ↘ R O ( D I ) .
By U-Pi with this domain and codomain:
Π ( ⟦ S [ σ ] ⟧ ( ρ ) , ⟦ T [ q ( σ ) ] ⟧ , ρ ) ≈ Π ( ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) , T , ⟦ σ ⟧ ( ρ ) ) ∈ U i ↘ R . \Pi(\llbracket S[\sigma]\rrbracket(\rho),\llbracket T[q(\sigma)]\rrbracket,\rho) \approx\Pi(\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho)),T,\llbracket\sigma\rrbracket(\rho)) \in\mathcal{U}_i \searrow R. Π ( [ [ S [ σ ] ] ] ( ρ ) , [ [ T [ q ( σ )] ] ] , ρ ) ≈ Π ( [ [ S ] ] ( [ [ σ ] ] ( ρ )) , T , [ [ σ ] ] ( ρ )) ∈ U i ↘ R .
This is the outer-left ≈ \approx ≈ inner-left cross-relation. By symmetry and transitivity of U i \mathcal{U}_i U i combined with the outer-pair and inner-pair relations, all six pairs among the four Π \Pi Π -values are related in U i ↘ R \mathcal{U}_i \searrow R U i ↘ R . Hence all four Π \Pi Π -values lie pairwise in U i ↘ R \mathcal{U}_i \searrow R U i ↘ R .
Semantic Variable Rule
The fundamental lemma for the variable rule cannot be proved by induction on ⊨ Γ \models\Gamma ⊨ Γ alone: at the step case of the lookup derivation, the inductive hypothesis would have to convert Δ ⊨ y ≈ y : S \Delta\models y \approx y : S Δ ⊨ y ≈ y : S to Γ ⊨ y [ ⇑ ] ≈ y [ ⇑ ] : S [ ⇑ ] \Gamma\models y[\Uparrow] \approx y[\Uparrow] : S[\Uparrow] Γ ⊨ y [ ⇑ ] ≈ y [ ⇑ ] : S [ ⇑ ] , but the semantic term judgment is not directly closed under precomposition by a semantic weakening (this would be the term-level analogue of Theorem 6.39, which we do not establish independently). We therefore unfold the conclusion of the semantic term judgment, fixing an arbitrary outer instantiation ( Γ ′ , σ , σ ′ , ρ , ρ ′ ) (\Gamma',\sigma,\sigma',\rho,\rho') ( Γ ′ , σ , σ ′ , ρ , ρ ′ ) , and induct on the lookup derivation under that fixed instantiation.
Lemma 6.55 (Lookup at fixed instantiation). ** Suppose ⊨ Γ , Γ ′ ≈ Γ ′ ↘ R ′ \models\Gamma,\Gamma' \approx\Gamma' \searrow R' ⊨ Γ , Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \models\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ D :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ . Then for every x : T ∈ Γ x : T \in\Gamma x : T ∈ Γ , there exists R T R_T R T such that
{ ⟦ T [ σ ] ⟧ ( ρ ) , ⟦ T ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ T [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R T \{\llbracket T[\sigma]\rrbracket(\rho),\llbracket T\rrbracket(\llbracket\sigma\rrbracket(\rho)),\llbracket T\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\llbracket T[\sigma']\rrbracket(\rho')\} \subseteq\mathcal{U}_i \searrow R_T { [ [ T [ σ ] ] ] ( ρ ) , [ [ T ] ] ( [ [ σ ] ] ( ρ )) , [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ T [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R T and
{ ⟦ x [ σ ] ⟧ ( ρ ) , ⟦ x ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ x ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ x [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R T . \{\llbracket x[\sigma]\rrbracket(\rho),\llbracket x\rrbracket(\llbracket\sigma\rrbracket(\rho)),\llbracket x\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\llbracket x[\sigma']\rrbracket(\rho')\} \subseteq R_T. { [ [ x [ σ ] ] ] ( ρ ) , [ [ x ] ] ( [ [ σ ] ] ( ρ )) , [ [ x ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ x [ σ ′ ] ] ] ( ρ ′ )} ⊆ R T .
Proof. By induction on the lookup derivation x : T ∈ Γ x : T \in\Gamma x : T ∈ Γ , with Γ ′ , R ′ , σ , σ ′ , ρ , ρ ′ \Gamma',R',\sigma,\sigma',\rho,\rho' Γ ′ , R ′ , σ , σ ′ , ρ , ρ ′ , and the witness D D D fixed throughout.
Case
x 0 : S [ ⇑ ] ∈ Δ , x 0 : S \frac{x_0 : S[\Uparrow] \in\Delta,\ x_0 : S}{} x 0 : S [ ⇑ ] ∈ Δ , x 0 : S
Here Γ = Δ , x 0 : S \Gamma= \Delta,x_0:S Γ = Δ , x 0 : S , x = x 0 x=x_0 x = x 0 , and T = S [ ⇑ ] T=S[\Uparrow] T = S [ ⇑ ] . Inverting ⊨ Δ , x 0 : S \models\Delta,x_0:S ⊨ Δ , x 0 : S via Sem-Ctx-Ext gives ⊨ Δ \models\Delta ⊨ Δ , the packaged context PER ( Δ , x 0 : S ) ≈ ( Δ , x 0 : S ) ↘ R Γ (\Delta,x_0:S) \approx(\Delta,x_0:S) \searrow R_\Gamma ( Δ , x 0 : S ) ≈ ( Δ , x 0 : S ) ↘ R Γ , and Δ ⊨ S ≈ S : T y i \Delta\models S \approx S : \mathrm{Ty}_i Δ ⊨ S ≈ S : Ty i for some i i i . Inverting the context PER via Ctx-Ext gives Δ ≈ Δ ↘ R Δ \Delta\approx\Delta\searrow R_\Delta Δ ≈ Δ ↘ R Δ , a head family R H R_H R H with ⟦ S ⟧ ( ρ 0 ) ≈ ⟦ S ⟧ ( ρ 0 ′ ) ∈ U i ↘ R H ( D Δ ) \llbracket S\rrbracket(\rho_0) \approx\llbracket S\rrbracket(\rho'_0) \in\mathcal{U}_i \searrow R_H(D_\Delta) [ [ S ] ] ( ρ 0 ) ≈ [ [ S ] ] ( ρ 0 ′ ) ∈ U i ↘ R H ( D Δ ) for D Δ : : ρ 0 ≈ ρ 0 ′ ∈ R Δ D_\Delta:: \rho_0 \approx\rho'_0 \in R_\Delta D Δ :: ρ 0 ≈ ρ 0 ′ ∈ R Δ , and the biconditional
ρ 1 ≈ ρ 1 ′ ∈ R Γ ⟺ ( D Δ : : ρ 1 [ ⇑ ] ≈ ρ 1 ′ [ ⇑ ] ∈ R Δ ∧ ρ 1 ( 0 ) ≈ ρ 1 ′ ( 0 ) ∈ R H ( D Δ ) ) . \rho_1 \approx\rho'_1 \in R_\Gamma\Longleftrightarrow(D_\Delta:: \rho_1[\Uparrow] \approx\rho'_1[\Uparrow] \in R_\Delta\land\rho_1(0) \approx\rho'_1(0) \in R_H(D_\Delta)). ρ 1 ≈ ρ 1 ′ ∈ R Γ ⟺ ( D Δ :: ρ 1 [ ⇑ ] ≈ ρ 1 ′ [ ⇑ ] ∈ R Δ ∧ ρ 1 ( 0 ) ≈ ρ 1 ′ ( 0 ) ∈ R H ( D Δ )) .
Instantiate Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \models\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ at Γ ′ , Γ ′ ⊨ w i d : Γ ′ \Gamma',\Gamma' \models_w \mathrm{id} : \Gamma' Γ ′ , Γ ′ ⊨ w id : Γ ′ (Theorem 6.27), and D D D ; using σ [ i d ] = σ \sigma[\mathrm{id}] = \sigma σ [ id ] = σ and ⟦ i d ⟧ ( ρ ) = ρ \llbracket\mathrm{id}\rrbracket(\rho)=\rho [ [ id ] ] ( ρ ) = ρ we obtain ⟦ σ ⟧ ( ρ ) ≈ ⟦ σ ′ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\sigma\rrbracket(\rho) \approx\llbracket\sigma'\rrbracket(\rho') \in R_\Gamma [ [ σ ] ] ( ρ ) ≈ [ [ σ ′ ] ] ( ρ ′ ) ∈ R Γ . By the biconditional of R Γ R_\Gamma R Γ , there exists D Δ D_\Delta D Δ with
D Δ : : ( ⟦ σ ⟧ ( ρ ) ) [ ⇑ ] ≈ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) [ ⇑ ] ∈ R Δ (tail) D_\Delta:: (\llbracket\sigma\rrbracket(\rho))[\Uparrow] \approx(\llbracket\sigma'\rrbracket(\rho'))[\Uparrow] \in R_\Delta\qquad\text{(tail)} D Δ :: ( [ [ σ ] ] ( ρ )) [ ⇑ ] ≈ ( [ [ σ ′ ] ] ( ρ ′ )) [ ⇑ ] ∈ R Δ (tail)
( ⟦ σ ⟧ ( ρ ) ) ( 0 ) ≈ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ( 0 ) ∈ R H ( D Δ ) (head) (\llbracket\sigma\rrbracket(\rho))(0) \approx(\llbracket\sigma' \rrbracket(\rho'))(0) \in R_H(D_\Delta)
\qquad\text{(head)} ( [ [ σ ] ] ( ρ )) ( 0 ) ≈ ( [ [ σ ′ ] ] ( ρ ′ )) ( 0 ) ∈ R H ( D Δ ) (head)
Set R T : = R H ( D Δ ) R_T := R_H(D_\Delta) R T := R H ( D Δ ) .
Type part. We must show { ⟦ ρ ⟧ , ⟦ S [ ⇑ ] ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ S [ ⇑ ] ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ ρ ′ ⟧ } ⊆ U i ↘ R T \{\llbracket\rho\rrbracket, \llbracket S[\Uparrow]\rrbracket(\llbracket\sigma\rrbracket(\rho)), \llbracket S[\Uparrow]\rrbracket(\llbracket\sigma' \rrbracket(\rho')), \llbracket\rho' \rrbracket\} \subseteq\mathcal{U}_i \mathbin{\searrow} R_T { [ [ ρ ] ] , [ [ S [ ⇑ ] ] ] ( [ [ σ ] ] ( ρ )) , [ [ S [ ⇑ ] ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ ρ ′ ] ] } ⊆ U i ↘ R T . We obtain this by two instantiations of Δ ⊨ S ≈ S : T y i \Delta\vDash S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i , bridged through a shared inner value.
By Theorem 6.34, Γ ≈ Γ ↘ R Γ \Gamma\approx\Gamma\mathbin{\searrow} R_\Gamma Γ ≈ Γ ↘ R Γ . By Theorem 6.28, Γ ⊨ w ⇑ : Δ \Gamma\vDash_{\mathsf w} \Uparrow: \Delta Γ ⊨ w ⇑: Δ . By Theorem 6.40 on Γ ⊨ w ⇑ : Δ \Gamma\vDash_{\mathsf w} \Uparrow: \Delta Γ ⊨ w ⇑: Δ and Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \vDash\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ : Γ ′ ⊨ ⇑ ∘ σ ≈ ⇑ ∘ σ ′ : Δ \Gamma' \vDash\Uparrow\circ\sigma\approx\Uparrow\circ\sigma' : \Delta Γ ′ ⊨ ⇑ ∘ σ ≈⇑ ∘ σ ′ : Δ .
First instantiation. Apply Δ ⊨ S ≈ S : T y i \Delta\vDash S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i at Γ ′ \Gamma' Γ ′ , Γ ′ ⊨ ⇑ ∘ σ ≈ ⇑ ∘ σ ′ : Δ \Gamma' \vDash\Uparrow\circ\sigma\approx\Uparrow\circ\sigma' : \Delta Γ ′ ⊨ ⇑ ∘ σ ≈⇑ ∘ σ ′ : Δ , and D \mathcal{D} D : for some R 1 R_1 R 1 ,
{ ⟦ S [ ⇑ ∘ σ ] ⟧ ( ρ ) , ⟦ S ⟧ ( ⟦ ⇑ ∘ σ ⟧ ( ρ ) ) , ⟦ S ⟧ ( ⟦ ⇑ ∘ σ ′ ⟧ ( ρ ′ ) ) , ⟦ S [ ⇑ ∘ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R 1 . \{\llbracket S[\Uparrow\circ\sigma]\rrbracket(\rho),\ \llbracket S\rrbracket(\llbracket\Uparrow\circ\sigma\rrbracket(\rho)),\ \llbracket S\rrbracket(\llbracket\Uparrow\circ\sigma'\rrbracket(\rho')), \llbracket S[\Uparrow\circ\sigma']\rrbracket(\rho')\} \subseteq\mathcal{U}_i \mathbin{\searrow} R_1. { [ [ S [ ⇑ ∘ σ ] ] ] ( ρ ) , [ [ S ] ] ( [ [ ⇑ ∘ σ ] ] ( ρ )) , [ [ S ] ] ( [ [ ⇑ ∘ σ ′ ] ] ( ρ ′ )) , [ [ S [ ⇑ ∘ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R 1 .
By Theorem 2.24 (1), = S [ ⇑ ∘ σ ] = S[\Uparrow\circ\sigma] = S [ ⇑ ∘ σ ] , so the outer values of the first instantiation match the goal’s outer values.
Second instantiation. By Theorem 6.35 on Γ ⊨ w ⇑ : Δ \Gamma\vDash_{\mathsf w} \Uparrow: \Delta Γ ⊨ w ⇑: Δ : Γ ⊨ ⇑ ≈ ⇑ : Δ \Gamma\vDash\Uparrow\approx\Uparrow: \Delta Γ ⊨ ⇑≈⇑: Δ . From Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \vDash\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ at Γ ′ \Gamma' Γ ′ , i d \mathrm{id} id , D \mathcal{D} D : ⟦ σ ⟧ ( ρ ) ≈ ⟦ σ ′ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\sigma\rrbracket(\rho) \approx\llbracket\sigma' \rrbracket(\rho') \in R_\Gamma [ [ σ ] ] ( ρ ) ≈ [ [ σ ′ ] ] ( ρ ′ ) ∈ R Γ . Apply Δ ⊨ S ≈ S : T y i \Delta\vDash S \approx S : \mathsf{Ty}_i Δ ⊨ S ≈ S : Ty i at Γ \Gamma Γ (using R Γ R_\Gamma R Γ ), Γ ⊨ ⇑ ≈ ⇑ : Δ \Gamma\vDash\Uparrow\approx\Uparrow: \Delta Γ ⊨ ⇑≈⇑: Δ , and ⟦ σ ⟧ ( ρ ) ≈ ⟦ σ ′ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\sigma\rrbracket(\rho) \approx\llbracket\sigma' \rrbracket(\rho') \in R_\Gamma [ [ σ ] ] ( ρ ) ≈ [ [ σ ′ ] ] ( ρ ′ ) ∈ R Γ : for some R 2 R_2 R 2 ,
{ ⟦ S [ ⇑ ] ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ S ⟧ ( ⟦ ⇑ ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) , ⟦ S ⟧ ( ⟦ ⇑ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ) , ⟦ S [ ⇑ ] ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) } ⊆ U i ↘ R 2 . \{\llbracket S[\Uparrow]\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket S\rrbracket(\llbracket\Uparrow\rrbracket(\llbracket\sigma\rrbracket(\rho))),\ \llbracket S\rrbracket(\llbracket\Uparrow\rrbracket(\llbracket\sigma' \rrbracket(\rho'))),\ \llbracket S[\Uparrow]\rrbracket(\llbracket\sigma' \rrbracket(\rho'))\} \subseteq\mathcal{U}_i \mathbin{\searrow} R_2. { [ [ S [ ⇑ ] ] ] ( [ [ σ ] ] ( ρ )) , [ [ S ] ] ( [ [ ⇑ ] ] ( [ [ σ ] ] ( ρ ))) , [ [ S ] ] ( [ [ ⇑ ] ] ( [ [ σ ′ ] ] ( ρ ′ ))) , [ [ S [ ⇑ ] ] ] ( [ [ σ ′ ] ] ( ρ ′ ))} ⊆ U i ↘ R 2 .
The outer values here are exactly the goal’s inner values.
Bridge. We have already established ⟦ ⇑ ∘ σ ⟧ ( ρ 0 ) = ⟦ ⇑ ⟧ ( ⟦ σ ⟧ ( ρ 0 ) ) \llbracket\Uparrow\circ\sigma\rrbracket(\rho_0) = \llbracket\Uparrow\rrbracket(\llbracket\sigma\rrbracket(\rho_0)) [ [ ⇑ ∘ σ ] ] ( ρ 0 ) = [ [ ⇑ ] ] ( [ [ σ ] ] ( ρ 0 )) (from the proof of Theorem 6.40). Hence the inner-left values of both instantiations coincide:
⟦ S ⟧ ( ⟦ ⇑ ∘ σ ⟧ ( ρ ) ) = ⟦ S ⟧ ( ⟦ ⇑ ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) . \llbracket S\rrbracket(\llbracket\Uparrow\circ\sigma\rrbracket(\rho)) = \llbracket S\rrbracket(\llbracket\Uparrow\rrbracket(\llbracket\sigma\rrbracket(\rho))). [ [ S ] ] ( [ [ ⇑ ∘ σ ] ] ( ρ )) = [ [ S ] ] ( [ [ ⇑ ] ] ( [ [ σ ] ] ( ρ ))) .
Analogously for the primed side. By Theorem 6.12, R 1 ⇔ R 2 R_1 \Leftrightarrow R_2 R 1 ⇔ R 2 ; set R T : = R 1 R_T := R_1 R T := R 1 . By symmetry and transitivity of U i \mathcal{U}_i U i through the shared inner-left value, all four goal values are related in U i ↘ R T \mathcal{U}_i \mathbin{\searrow} R_T U i ↘ R T .
Term part. Compute:
⟦ x 0 [ σ ] ⟧ ( ρ ) = ⟦ σ ( x 0 ) ⟧ ( ρ ) = ( ⟦ σ ⟧ ( ρ ) ) ( 0 ) (by definition of substitution and ev-var) \llbracket x_0[\sigma]\rrbracket(\rho) = \llbracket\sigma(x_0)\rrbracket(\rho) = (\llbracket\sigma\rrbracket(\rho))(0)
\qquad\text{(by definition of substitution and ev-var)} [ [ x 0 [ σ ] ] ] ( ρ ) = [ [ σ ( x 0 ) ] ] ( ρ ) = ( [ [ σ ] ] ( ρ )) ( 0 ) (by definition of substitution and ev-var)
⟦ x 0 ⟧ ( ⟦ σ ⟧ ( ρ ) ) = ( ⟦ σ ⟧ ( ρ ) ) ( 0 ) (by ev-var) \llbracket x_0\rrbracket(\llbracket\sigma\rrbracket(\rho)) = (\llbracket\sigma\rrbracket(\rho))(0)
\qquad\text{(by ev-var)} [ [ x 0 ] ] ( [ [ σ ] ] ( ρ )) = ( [ [ σ ] ] ( ρ )) ( 0 ) (by ev-var)
The outer-left and inner-left values coincide as ( ⟦ σ ⟧ ( ρ ) ) ( 0 ) (\llbracket\sigma\rrbracket(\rho))(0) ( [ [ σ ] ] ( ρ )) ( 0 ) ; the primed pair coincides as ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ( 0 ) (\llbracket\sigma'\rrbracket(\rho'))(0) ( [ [ σ ′ ] ] ( ρ ′ )) ( 0 ) . By the head clause, ( ⟦ σ ⟧ ( ρ ) ) ( 0 ) ≈ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ( 0 ) ∈ R T (\llbracket\sigma\rrbracket(\rho))(0) \approx(\llbracket\sigma'\rrbracket(\rho'))(0) \in R_T ( [ [ σ ] ] ( ρ )) ( 0 ) ≈ ( [ [ σ ′ ] ] ( ρ ′ )) ( 0 ) ∈ R T , so all four term values are related in R T R_T R T .
Case
y : S ∈ Δ 1 + y : S [ ⇑ ] ∈ Δ , x 0 : U \begin{array}{c}
y : S \in\Delta\\
\hline
1+y : S[\Uparrow] \in\Delta,\ x_0 : U
\end{array} y : S ∈ Δ 1 + y : S [ ⇑ ] ∈ Δ , x 0 : U
Here Γ = Δ , x 0 : U \Gamma= \Delta, x_0 : U Γ = Δ , x 0 : U , x = 1 + y x = 1+y x = 1 + y , and T = S [ ⇑ ] T = S[\Uparrow] T = S [ ⇑ ] . Inverting ⊢ Δ , x 0 : U \vdash\Delta, x_0 : U ⊢ Δ , x 0 : U gives ⊢ Δ \vdash\Delta ⊢ Δ , the packaged context PER Γ ≈ Γ ↘ R Γ \Gamma\approx\Gamma\mathbin{\searrow} R_\Gamma Γ ≈ Γ ↘ R Γ , and Δ ⊨ U ≈ U : T y j \Delta\vDash U \approx U : \mathsf{Ty}_j Δ ⊨ U ≈ U : Ty j .
By Theorem 6.28, Γ ⊨ w ⇑ : Δ \Gamma\vDash_{\mathsf w} \Uparrow: \Delta Γ ⊨ w ⇑: Δ . By Theorem 6.40 on Γ ⊨ w ⇑ : Δ \Gamma\vDash_{\mathsf w} \Uparrow: \Delta Γ ⊨ w ⇑: Δ and Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \vDash\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ : Γ ′ ⊨ ⇑ ∘ σ ≈ ⇑ ∘ σ ′ : Δ \Gamma' \vDash\Uparrow\circ\sigma\approx\Uparrow\circ\sigma' : \Delta Γ ′ ⊨ ⇑ ∘ σ ≈⇑ ∘ σ ′ : Δ . By Theorem 6.35 on Γ ⊨ w ⇑ : Δ \Gamma\vDash_{\mathsf w} \Uparrow: \Delta Γ ⊨ w ⇑: Δ : Γ ⊨ ⇑ ≈ ⇑ : Δ \Gamma\vDash\Uparrow\approx\Uparrow: \Delta Γ ⊨ ⇑≈⇑: Δ . From Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \vDash\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ at Γ ′ \Gamma' Γ ′ , i d \mathrm{id} id , D \mathcal{D} D : ⟦ σ ⟧ ( ρ ) ≈ ⟦ σ ′ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\sigma\rrbracket(\rho) \approx\llbracket\sigma'\rrbracket(\rho') \in R_\Gamma [ [ σ ] ] ( ρ ) ≈ [ [ σ ′ ] ] ( ρ ′ ) ∈ R Γ .
We apply the IH on y : S ∈ Δ y : S \in\Delta y : S ∈ Δ twice, paralleling the two instantiations used in the Base case.
First IH instantiation. Apply the IH to y : S ∈ Δ y : S \in\Delta y : S ∈ Δ at Γ ′ \Gamma' Γ ′ , the semantic substitution Γ ′ ⊨ ⇑ ∘ σ ≈ ⇑ ∘ σ ′ : Δ \Gamma' \vDash\Uparrow\circ\sigma\approx\Uparrow\circ\sigma' : \Delta Γ ′ ⊨ ⇑ ∘ σ ≈⇑ ∘ σ ′ : Δ , and D \mathcal{D} D : for some R 1 R_1 R 1 ,
{ ⟦ S [ ⇑ ∘ σ ] ⟧ ( ρ ) , ⟦ S ⟧ ( ⟦ ⇑ ∘ σ ⟧ ( ρ ) ) , ⟦ S ⟧ ( ⟦ ⇑ ∘ σ ′ ⟧ ( ρ ′ ) ) , ⟦ S [ ⇑ ∘ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R 1 , \{\llbracket S[\Uparrow\circ\sigma]\rrbracket(\rho),\ \llbracket S\rrbracket(\llbracket\Uparrow\circ\sigma\rrbracket(\rho)),\ \llbracket S\rrbracket(\llbracket\Uparrow\circ\sigma'\rrbracket(\rho')), \llbracket S[\Uparrow\circ\sigma']\rrbracket(\rho')\} \subseteq\mathcal{U}_i \mathbin{\searrow} R_1, { [ [ S [ ⇑ ∘ σ ] ] ] ( ρ ) , [ [ S ] ] ( [ [ ⇑ ∘ σ ] ] ( ρ )) , [ [ S ] ] ( [ [ ⇑ ∘ σ ′ ] ] ( ρ ′ )) , [ [ S [ ⇑ ∘ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R 1 ,
{ ⟦ y [ ⇑ ∘ σ ] ⟧ ( ρ ) , ⟦ y ⟧ ( ⟦ ⇑ ∘ σ ⟧ ( ρ ) ) , ⟦ y ⟧ ( ⟦ ⇑ ∘ σ ′ ⟧ ( ρ ′ ) ) , ⟦ y [ ⇑ ∘ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R 1 . \{\llbracket y[\Uparrow\circ\sigma]\rrbracket(\rho),\ \llbracket y\rrbracket(\llbracket\Uparrow\circ\sigma\rrbracket(\rho)),\ \llbracket y\rrbracket(\llbracket\Uparrow\circ\sigma'\rrbracket(\rho')), \llbracket y[\Uparrow\circ\sigma']\rrbracket(\rho')\} \subseteq R_1. { [ [ y [ ⇑ ∘ σ ] ] ] ( ρ ) , [ [ y ] ] ( [ [ ⇑ ∘ σ ] ] ( ρ )) , [ [ y ] ] ( [ [ ⇑ ∘ σ ′ ] ] ( ρ ′ )) , [ [ y [ ⇑ ∘ σ ′ ] ] ] ( ρ ′ )} ⊆ R 1 .
Second IH instantiation. Apply the IH to y : S ∈ Δ y : S \in\Delta y : S ∈ Δ at Γ \Gamma Γ (using R Γ R_\Gamma R Γ ), the semantic substitution Γ ⊨ ⇑ ≈ ⇑ : Δ \Gamma\vDash\Uparrow\approx\Uparrow: \Delta Γ ⊨ ⇑≈⇑: Δ , and ⟦ σ ⟧ ( ρ ) ≈ ⟦ σ ′ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\sigma\rrbracket(\rho) \approx\llbracket\sigma'\rrbracket(\rho') \in R_\Gamma [ [ σ ] ] ( ρ ) ≈ [ [ σ ′ ] ] ( ρ ′ ) ∈ R Γ : for some R 2 R_2 R 2 ,
{ ⟦ S [ ⇑ ] ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ S ⟧ ( ⟦ ⇑ ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) , ⟦ S ⟧ ( ⟦ ⇑ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ) , ⟦ S [ ⇑ ] ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) } ⊆ U i ↘ R 2 . \{\llbracket S[\Uparrow]\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket S\rrbracket(\llbracket\Uparrow\rrbracket(\llbracket\sigma\rrbracket(\rho))),\ \llbracket S\rrbracket(\llbracket\Uparrow\rrbracket(\llbracket\sigma'\rrbracket(\rho'))),\ \llbracket S[\Uparrow]\rrbracket(\llbracket\sigma'\rrbracket(\rho'))\} \subseteq\mathcal{U}_i \mathbin{\searrow} R_2. { [ [ S [ ⇑ ] ] ] ( [ [ σ ] ] ( ρ )) , [ [ S ] ] ( [ [ ⇑ ] ] ( [ [ σ ] ] ( ρ ))) , [ [ S ] ] ( [ [ ⇑ ] ] ( [ [ σ ′ ] ] ( ρ ′ ))) , [ [ S [ ⇑ ] ] ] ( [ [ σ ′ ] ] ( ρ ′ ))} ⊆ U i ↘ R 2 .
\left\{\llbracket y\rrbracket\llbrbracket\sigma\rrbrbracket(\rho),\ \llbracket y\rrbracket(\llbracket\mathord{\Uparrow}\rrbracket(\llbracket\sigma\rrbracket(\rho))),\ \llbracket y\rrbracket(\llbracket\mathord{\Uparrow}\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\ \llbracket y\rrbracket\llbracket\mathord{\Uparrow}\rrbracket(\llbracket\sigma'\rrbracket(\rho'))\right\} \subseteq R_2.
Match outer values to the goal. By Theorem 2.24 (1): = S [ ⇑ ∘ σ ] = S[\mathord{\Uparrow}\circ\sigma] = S [ ⇑ ∘ σ ] , so the first IH instantiation’s outer-type values are exactly the goal’s outer-type values. The second IH instantiation’s outer-type values ⟦ S [ ⇑ ] ⟧ ( ⟦ σ ⟧ ( ρ ) ) \llbracket S[\mathord{\Uparrow}]\rrbracket(\llbracket\sigma\rrbracket(\rho)) [ [ S [ ⇑ ] ] ] ( [ [ σ ] ] ( ρ )) are exactly the goal’s inner-type values.
For the term values:
⟦ ( 1 + y ) [ σ ] ⟧ ( ρ ) = ⟦ σ ( 1 + y ) ⟧ ( ρ ) = ⟦ ( ⇑ ∘ σ ) ( y ) ⟧ ( ρ ) = ⟦ y [ ⇑ ∘ σ ] ⟧ ( ρ ) \llbracket(1+y)[\sigma]\rrbracket(\rho)=\llbracket\sigma(1+y)\rrbracket(\rho)=\llbracket(\mathord{\Uparrow}\circ\sigma)(y)\rrbracket(\rho)=\llbracket y[\mathord{\Uparrow}\circ\sigma]\rrbracket(\rho) [ [ ( 1 + y ) [ σ ] ] ] ( ρ ) = [ [ σ ( 1 + y ) ] ] ( ρ ) = [ [ ( ⇑ ∘ σ ) ( y ) ] ] ( ρ ) = [ [ y [ ⇑ ∘ σ ] ] ] ( ρ )
⟦ 1 + y ⟧ ( ⟦ σ ⟧ ( ρ ) ) = ( ⟦ σ ⟧ ( ρ ) ) ( 1 + y ) = ⟦ y [ ⇑ ] ⟧ ( ⟦ σ ⟧ ( ρ ) ) \llbracket1+y\rrbracket(\llbracket\sigma\rrbracket(\rho))=(\llbracket\sigma\rrbracket(\rho))(1+y)=\llbracket y[\mathord{\Uparrow}]\rrbracket(\llbracket\sigma\rrbracket(\rho)) [ [ 1 + y ] ] ( [ [ σ ] ] ( ρ )) = ( [ [ σ ] ] ( ρ )) ( 1 + y ) = [ [ y [ ⇑ ] ] ] ( [ [ σ ] ] ( ρ ))
(using ( ⇑ ∘ σ ) ( y ) = σ ( y + 1 ) (\mathord{\Uparrow}\circ\sigma)(y)=\sigma(y+1) ( ⇑ ∘ σ ) ( y ) = σ ( y + 1 ) and ⟦ y [ ⇑ ] ⟧ ( ρ 0 ) = ⟦ ⇑ ( y ) ⟧ ( ρ 0 ) = ρ 0 ( y + 1 ) \llbracket y[\mathord{\Uparrow}]\rrbracket(\rho_0)=\llbracket\mathord{\Uparrow}(y)\rrbracket(\rho_0)=\rho_0(y+1) [ [ y [ ⇑ ] ] ] ( ρ 0 ) = [ [ ⇑ ( y ) ] ] ( ρ 0 ) = ρ 0 ( y + 1 ) ). Hence the first IH’s outer-term values equal the goal’s outer-term values, and the second IH’s outer-term values equal the goal’s inner-term values.
Bridge via shared inner. By the identity established in the proof of Theorem 6.40, ⟦ ⇑ ∘ σ ⟧ ( ρ 0 ) = ( ⟦ σ ⟧ ( ρ 0 ) ) [ ⇑ ] \llbracket\mathord{\Uparrow}\circ\sigma\rrbracket(\rho_0)=(\llbracket\sigma\rrbracket(\rho_0))[\mathord{\Uparrow}] [ [ ⇑ ∘ σ ] ] ( ρ 0 ) = ( [ [ σ ] ] ( ρ 0 )) [ ⇑ ] for any ρ 0 \rho_0 ρ 0 . Also ⟦ ⇑ ⟧ ( ⟦ σ ⟧ ( ρ ) ) = ( ⟦ σ ⟧ ( ρ ) ) [ ⇑ ] \llbracket\mathord{\Uparrow}\rrbracket(\llbracket\sigma\rrbracket(\rho))=(\llbracket\sigma\rrbracket(\rho))[\mathord{\Uparrow}] [ [ ⇑ ] ] ( [ [ σ ] ] ( ρ )) = ( [ [ σ ] ] ( ρ )) [ ⇑ ] by the pointwise definition of weakening evaluation. Hence the inner values of the two IH instantiations coincide:
⟦ S ⟧ ( ⟦ ⇑ ∘ σ ⟧ ( ρ ) ) = ⟦ S ⟧ ( ⟦ ⇑ ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) , \llbracket S\rrbracket(\llbracket\mathord{\Uparrow}\circ\sigma\rrbracket(\rho))=\llbracket S\rrbracket(\llbracket\mathord{\Uparrow}\rrbracket(\llbracket\sigma\rrbracket(\rho))), [ [ S ] ] ( [ [ ⇑ ∘ σ ] ] ( ρ )) = [ [ S ] ] ( [ [ ⇑ ] ] ( [ [ σ ] ] ( ρ ))) ,
⟦ y ⟧ ( ⟦ ⇑ ∘ σ ⟧ ( ρ ) ) = ⟦ y ⟧ ( ⟦ ⇑ ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) , \llbracket y\rrbracket(\llbracket\mathord{\Uparrow}\circ\sigma\rrbracket(\rho))=\llbracket y\rrbracket(\llbracket\mathord{\Uparrow}\rrbracket(\llbracket\sigma\rrbracket(\rho))), [ [ y ] ] ( [ [ ⇑ ∘ σ ] ] ( ρ )) = [ [ y ] ] ( [ [ ⇑ ] ] ( [ [ σ ] ] ( ρ ))) ,
and analogously for the primed side. By Theorem 6.12, R 1 ⟺ R 2 R_1\Longleftrightarrow R_2 R 1 ⟺ R 2 ; set R T : = R 1 R_T := R_1 R T := R 1 . By symmetry and transitivity through the shared inner value, all four goal type values are related in U i ↘ R T U_i\searrow R_T U i ↘ R T , and all four goal term values are related in R T R_T R T .
Lemma 6.56 (Fundamental — Var)
Proof. By Theorem 6.34, Γ ≈ Γ ↘ R \Gamma\approx\Gamma\searrow R Γ ≈ Γ ↘ R for some R R R , giving the first premise of the semantic term judgment. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma'\approx\Gamma'\searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma'\vdash\sigma\approx\sigma':\Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ D::\rho\approx\rho'\in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. By Theorem 6.55 on ⊨ Γ \vDash\Gamma ⊨ Γ , x : T ∈ Γ x:T\in\Gamma x : T ∈ Γ at this instantiation, the four-value patterns hold for some R T R_T R T .
Semantic Term Introduction and Elimination
Lemma 6.57 (Fundamental — Ze-I)
Proof. By Theorem 6.34, Γ ≈ Γ ↘ R \Gamma\approx\Gamma\searrow R Γ ≈ Γ ↘ R for some R R R . Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma'\approx\Gamma'\searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma'\vdash\sigma\approx\sigma':\Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ D::\rho\approx\rho'\in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. We must show
{ ⟦ N a t [ σ ] ⟧ ( ρ ) , ⟦ N a t ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ N a t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ N a t [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U 0 ↘ R T \left\{\llbracket\mathrm{Nat}[\sigma]\rrbracket(\rho),\ \llbracket\mathrm{Nat}\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket\mathrm{Nat}\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\ \llbracket\mathrm{Nat}[\sigma']\rrbracket(\rho')\right\}\subseteq U_0\searrow R_T { [ [ Nat [ σ ] ] ] ( ρ ) , [ [ Nat ] ] ( [ [ σ ] ] ( ρ )) , [ [ Nat ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ Nat [ σ ′ ] ] ] ( ρ ′ ) } ⊆ U 0 ↘ R T
for some R T R_T R T , and
{ ⟦ z e r o [ σ ] ⟧ ( ρ ) , ⟦ z e r o ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ z e r o ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ z e r o [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R T . \left\{\llbracket\mathrm{zero}[\sigma]\rrbracket(\rho),\ \llbracket\mathrm{zero}\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket\mathrm{zero}\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\ \llbracket\mathrm{zero}[\sigma']\rrbracket(\rho')\right\}\subseteq R_T. { [ [ zero [ σ ] ] ] ( ρ ) , [ [ zero ] ] ( [ [ σ ] ] ( ρ )) , [ [ zero ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ zero [ σ ′ ] ] ] ( ρ ′ ) } ⊆ R T .
Type part. Since Nat is closed, all four type values collapse to N N N :
⟦ N a t [ σ ] ⟧ ( ρ ) = ⟦ N a t ⟧ ( ρ ) = N \llbracket\mathrm{Nat}[\sigma]\rrbracket(\rho)=\llbracket\mathrm{Nat}\rrbracket(\rho)=N [ [ Nat [ σ ] ] ] ( ρ ) = [ [ Nat ] ] ( ρ ) = N
(closed term, by evaluation)
⟦ N a t ⟧ ( ⟦ σ ⟧ ( ρ ) ) = N \llbracket\mathrm{Nat}\rrbracket(\llbracket\sigma\rrbracket(\rho))=N [ [ Nat ] ] ( [ [ σ ] ] ( ρ )) = N
(by evaluation)
and analogously for the primed pair.
N ≈ N ∈ U 0 ↘ R T with R T ⟺ N a t N\approx N\in U_0\searrow R_T\text{ with }R_T\Longleftrightarrow\mathrm{Nat} N ≈ N ∈ U 0 ↘ R T with R T ⟺ Nat
(by U-Nat)
Term part. Since zero is closed, all four term values collapse to ze:
⟦ z e r o [ σ ] ⟧ ( ρ ) = ⟦ z e r o ⟧ ( ρ ) = z e \llbracket\mathrm{zero}[\sigma]\rrbracket(\rho)=\llbracket\mathrm{zero}\rrbracket(\rho)=\mathrm{ze} [ [ zero [ σ ] ] ] ( ρ ) = [ [ zero ] ] ( ρ ) = ze
(closed term, by evaluation)
⟦ z e r o ⟧ ( ⟦ σ ⟧ ( ρ ) ) = z e \llbracket\mathrm{zero}\rrbracket(\llbracket\sigma\rrbracket(\rho))=\mathrm{ze} [ [ zero ] ] ( [ [ σ ] ] ( ρ )) = ze
(by evaluation) Since R T ⇔ N a t R_T \Leftrightarrow\mathrm{Nat} R T ⇔ Nat , it suffices to show z e ≈ z e ∈ N a t \mathrm{ze} \approx\mathrm{ze} \in\mathrm{Nat} ze ≈ ze ∈ Nat .
z e ≈ z e ∈ N a t \mathrm{ze} \approx\mathrm{ze} \in\mathrm{Nat} ze ≈ ze ∈ Nat
(by Nat-Ze)
Hence z e ≈ z e ∈ R T \mathrm{ze} \approx\mathrm{ze} \in R_T ze ≈ ze ∈ R T , and the four-value pattern follows. □
Lemma 6.58 (Fundamental — Su-I / Su-Cong). If Γ ⊢ t ≈ t ′ : N a t \Gamma\vdash t \approx t' : \mathrm{Nat} Γ ⊢ t ≈ t ′ : Nat , then Γ ⊢ succ t ≈ succ t ′ : N a t \Gamma\vdash\operatorname{succ} t \approx\operatorname{succ} t' : \mathrm{Nat} Γ ⊢ succ t ≈ succ t ′ : Nat .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ D :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given.
Type part. Identical to Theorem 6.57: { ⟦ N a t [ σ ] ⟧ ( ρ ) , … } ⊆ U 0 ↘ R T \{\llbracket\mathrm{Nat}[\sigma]\rrbracket(\rho), \ldots\} \subseteq U_0 \searrow R_T { [ [ Nat [ σ ] ] ] ( ρ ) , … } ⊆ U 0 ↘ R T with R T ⇔ N a t R_T \Leftrightarrow\mathrm{Nat} R T ⇔ Nat by U-Nat.
Term part. We compute the four term values, using that substitution and evaluation distribute over su:
⟦ ( succ t ) [ σ ] ⟧ ( ρ ) = ⟦ succ t [ σ ] ⟧ ( ρ ) \llbracket(\operatorname{succ}\ t)[\sigma]\rrbracket(\rho) = \llbracket\operatorname{succ}\ t[\sigma]\rrbracket(\rho) [ [ ( succ t ) [ σ ] ] ] ( ρ ) = [ [ succ t [ σ ] ] ] ( ρ ) (by definition of substitution on su)
= su ( ⟦ t [ σ ] ⟧ ( ρ ) ) = \operatorname{su}(\llbracket t[\sigma]\rrbracket(\rho)) = su ( [ [ t [ σ ] ] ] ( ρ )) (by evaluation of su)
⟦ succ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) = su ( ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) \llbracket\operatorname{succ}\ t\rrbracket(\llbracket\sigma\rrbracket(\rho)) = \operatorname{su}(\llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho))) [ [ succ t ] ] ( [ [ σ ] ] ( ρ )) = su ( [ [ t ] ] ( [ [ σ ] ] ( ρ ))) (by evaluation of su)
Analogous computations apply to the primed pair, giving su ( ⟦ t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ) \operatorname{su}(\llbracket t'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))) su ( [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ))) and su ( ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) ) \operatorname{su}(\llbracket t'[\sigma']\rrbracket(\rho')) su ( [ [ t ′ [ σ ′ ] ] ] ( ρ ′ )) .
By the hypothesis Γ ⊢ t ≈ t ′ : N a t \Gamma\vdash t \approx t' : \mathrm{Nat} Γ ⊢ t ≈ t ′ : Nat applied at Γ ′ \Gamma' Γ ′ , σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ , the term part gives
{ ⟦ t [ σ ] ⟧ ( ρ ) , ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ N a t \{\llbracket t[\sigma]\rrbracket(\rho), \llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho)), \llbracket t'\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \llbracket t'[\sigma']\rrbracket(\rho')\} \subseteq\mathrm{Nat} { [ [ t [ σ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ σ ] ] ( ρ )) , [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ t ′ [ σ ′ ] ] ] ( ρ ′ )} ⊆ Nat (by hypothesis on t , t ′ t,t' t , t ′ )
Applying Nat-Su pointwise (using transitivity of Nat, Theorem 6.7, to chain the four values):
su ( ⟦ t [ σ ] ⟧ ( ρ ) ) ≈ su ( ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) ∈ N a t \operatorname{su}(\llbracket t[\sigma]\rrbracket(\rho)) \approx\operatorname{su}(\llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho))) \in\mathrm{Nat} su ( [ [ t [ σ ] ] ] ( ρ )) ≈ su ( [ [ t ] ] ( [ [ σ ] ] ( ρ ))) ∈ Nat (by Nat-Su)
su ( ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) ≈ su ( ⟦ t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ) ∈ N a t \operatorname{su}(\llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho))) \approx\operatorname{su}(\llbracket t'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))) \in\mathrm{Nat} su ( [ [ t ] ] ( [ [ σ ] ] ( ρ ))) ≈ su ( [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ))) ∈ Nat (by Nat-Su)
su ( ⟦ t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ) ≈ su ( ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) ) ∈ N a t \operatorname{su}(\llbracket t'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))) \approx\operatorname{su}(\llbracket t'[\sigma']\rrbracket(\rho')) \in\mathrm{Nat} su ( [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ))) ≈ su ( [ [ t ′ [ σ ′ ] ] ] ( ρ ′ )) ∈ Nat (by Nat-Su)
By transitivity of Nat, all four are related in Nat, hence in R T R_T R T . □
Lemma 6.59 (Fundamental — λ \lambda λ -I / λ \lambda λ -Cong). If Γ ⊢ S ≈ S : T y i \Gamma\vdash S \approx S : \mathrm{Ty}_i Γ ⊢ S ≈ S : Ty i and Γ , x : S ⊢ t ≈ t ′ : T \Gamma, x : S \vdash t \approx t' : T Γ , x : S ⊢ t ≈ t ′ : T , then Γ ⊢ λ x . t ≈ λ x . t ′ : Π ( x : S ) . T \Gamma\vdash\lambda x.\,t \approx\lambda x.\,t' : \Pi(x : S).T Γ ⊢ λ x . t ≈ λ x . t ′ : Π ( x : S ) . T .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ D :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given.
Type part. By Theorem 6.54 applied to the hypotheses Γ ⊢ S ≈ S : T y i \Gamma\vdash S \approx S : \mathrm{Ty}_i Γ ⊢ S ≈ S : Ty i and Γ , x : S ⊢ T ≈ T : T y i \Gamma, x : S \vdash T \approx T : \mathrm{Ty}_i Γ , x : S ⊢ T ≈ T : Ty i (the latter follows from Γ , x : S ⊢ t ≈ t ′ : T \Gamma, x : S \vdash t \approx t' : T Γ , x : S ⊢ t ≈ t ′ : T via type extraction):
{ ⟦ ( Π ( x : S ) . T ) [ σ ] ⟧ ( ρ ) , ⟦ Π ( x : S ) . T ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ Π ( x : S ) . T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ ( Π ( x : S ) . T ) [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R \{\llbracket(\Pi(x : S).T)[\sigma]\rrbracket(\rho), \llbracket\Pi(x : S).T\rrbracket(\llbracket\sigma\rrbracket(\rho)), \llbracket\Pi(x : S).T\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \llbracket(\Pi(x : S).T)[\sigma']\rrbracket(\rho')\} \subseteq U_i \searrow R { [ [ ( Π ( x : S ) . T ) [ σ ] ] ] ( ρ ) , [ [ Π ( x : S ) . T ] ] ( [ [ σ ] ] ( ρ )) , [ [ Π ( x : S ) . T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ ( Π ( x : S ) . T ) [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R where R R R is the function PER characterized by: f ≈ f ′ ∈ R ⇔ ( ∀ D I : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D I ) ) f \approx f' \in R \Leftrightarrow(\forall D_I :: a \approx a' \in R_I.\ f \mathbin{\cdot} a \approx f' \mathbin{\cdot} a' \in R_O(D_I)) f ≈ f ′ ∈ R ⇔ ( ∀ D I :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D I )) .
Term part. We compute the four term values using the substitution behavior of λ \lambda λ :
⟦ ( λ x . t ) [ σ ] ⟧ ( ρ ) = ⟦ λ x . ( t [ q ( σ ) ] ) ⟧ ( ρ ) \llbracket(\lambda x.\,t)[\sigma]\rrbracket(\rho) = \llbracket\lambda x.\,(t[q(\sigma)])\rrbracket(\rho) [ [ ( λ x . t ) [ σ ] ] ] ( ρ ) = [ [ λ x . ( t [ q ( σ )]) ] ] ( ρ ) (by definition of substitution under λ \lambda λ )
= λ ( t [ q ( σ ) ] , ρ ) = \lambda(t[q(\sigma)],\rho) = λ ( t [ q ( σ )] , ρ ) (by evaluation of λ \lambda λ , forming a closure)
⟦ λ x . t ⟧ ( ⟦ σ ⟧ ( ρ ) ) = λ ( t , ⟦ σ ⟧ ( ρ ) ) \llbracket\lambda x.\,t\rrbracket(\llbracket\sigma\rrbracket(\rho)) = \lambda(t,\llbracket\sigma\rrbracket(\rho)) [ [ λ x . t ] ] ( [ [ σ ] ] ( ρ )) = λ ( t , [ [ σ ] ] ( ρ )) (by evaluation of λ \lambda λ )
Analogously, ⟦ λ x . t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) = λ ( t ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) \llbracket\lambda x.\,t'\rrbracket(\llbracket\sigma'\rrbracket(\rho')) = \lambda(t',\llbracket\sigma'\rrbracket(\rho')) [ [ λ x . t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) = λ ( t ′ , [ [ σ ′ ] ] ( ρ ′ )) and ⟦ ( λ x . t ′ ) [ σ ′ ] ⟧ ( ρ ′ ) = λ ( t ′ [ q ( σ ′ ) ] , ρ ′ ) \llbracket(\lambda x.\,t')[\sigma']\rrbracket(\rho') = \lambda(t'[q(\sigma')],\rho') [ [ ( λ x . t ′ ) [ σ ′ ] ] ] ( ρ ′ ) = λ ( t ′ [ q ( σ ′ )] , ρ ′ ) .
By the biconditional characterization of R R R , it suffices to show that for every D I : : a ≈ a ′ ∈ R I D_I :: a \approx a' \in R_I D I :: a ≈ a ′ ∈ R I (where R I R_I R I is the domain PER), the four closure applications are related in R O ( D I ) R_O(D_I) R O ( D I ) :
{ λ ( t [ q ( σ ) ] , ρ ) ⋅ a , λ ( t , ⟦ σ ⟧ ( ρ ) ) ⋅ a , λ ( t ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) ⋅ a ′ , λ ( t ′ [ q ( σ ′ ) ] , ρ ′ ) ⋅ a ′ } ⊆ R O ( D I ) . \{\lambda(t[q(\sigma)],\rho) \mathbin{\cdot} a,\ \lambda(t,\llbracket\sigma\rrbracket(\rho)) \mathbin{\cdot} a,\ \lambda(t',\llbracket\sigma'\rrbracket(\rho')) \mathbin{\cdot} a',\ \lambda(t'[q(\sigma')],\rho') \mathbin{\cdot} a'\} \subseteq R_O(D_I). { λ ( t [ q ( σ )] , ρ ) ⋅ a , λ ( t , [ [ σ ] ] ( ρ )) ⋅ a , λ ( t ′ , [ [ σ ′ ] ] ( ρ ′ )) ⋅ a ′ , λ ( t ′ [ q ( σ ′ )] , ρ ′ ) ⋅ a ′ } ⊆ R O ( D I ) . We compute these closure applications:
λ ( t [ q ( σ ) ] , ρ ) ⋅ a = ⟦ t [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) \lambda(t[q(\sigma)],\rho) \mathbin{\cdot} a = \llbracket t[q(\sigma)]\rrbracket((\rho,a/x)) λ ( t [ q ( σ )] , ρ ) ⋅ a = [ [ t [ q ( σ )] ] ] (( ρ , a / x )) (by closure application)
@page 72/142 starts_mid=1 ends_mid=1
Since $R_T \Leftrightarrow\mathrm{Nat}$, it suffices to show $\mathrm{ze} \approx\mathrm{ze} \in\mathrm{Nat}$.
\mathrm{ze} \approx \mathrm{ze} \in \mathrm{Nat}
( b y N a t − Z e ) (by Nat-Ze) ( b y N a t − Z e ) Hence z e ≈ z e ∈ R T \mathrm{ze} \approx\mathrm{ze} \in R_T ze ≈ ze ∈ R T , and the four-value pattern follows. □
Lemma 6.58 (Fundamental — Su-I / Su-Cong). If Γ ⊢ t ≈ t ′ : N a t \Gamma\vdash t \approx t' : \mathrm{Nat} Γ ⊢ t ≈ t ′ : Nat , then Γ ⊢ succ t ≈ succ t ′ : N a t \Gamma\vdash\operatorname{succ} t \approx\operatorname{succ} t' : \mathrm{Nat} Γ ⊢ succ t ≈ succ t ′ : Nat .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ D :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given.
Type part. Identical to Theorem 6.57: { ⟦ N a t [ σ ] ⟧ ( ρ ) , … } ⊆ U 0 ↘ R T \{\llbracket\mathrm{Nat}[\sigma]\rrbracket(\rho), \ldots\} \subseteq U_0 \searrow R_T { [ [ Nat [ σ ] ] ] ( ρ ) , … } ⊆ U 0 ↘ R T with R T ⇔ N a t R_T \Leftrightarrow\mathrm{Nat} R T ⇔ Nat by U-Nat.
Term part. We compute the four term values, using that substitution and evaluation distribute over su:
⟦ ( succ t ) [ σ ] ⟧ ( ρ ) = ⟦ succ t [ σ ] ⟧ ( ρ ) \llbracket(\operatorname{succ}\ t)[\sigma]\rrbracket(\rho) = \llbracket\operatorname{succ}\ t[\sigma]\rrbracket(\rho) [ [ ( succ t ) [ σ ] ] ] ( ρ ) = [ [ succ t [ σ ] ] ] ( ρ ) (by definition of substitution on su)
= su ( ⟦ t [ σ ] ⟧ ( ρ ) ) = \operatorname{su}(\llbracket t[\sigma]\rrbracket(\rho)) = su ( [ [ t [ σ ] ] ] ( ρ )) (by evaluation of su)
⟦ succ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) = su ( ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) \llbracket\operatorname{succ}\ t\rrbracket(\llbracket\sigma\rrbracket(\rho)) = \operatorname{su}(\llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho))) [ [ succ t ] ] ( [ [ σ ] ] ( ρ )) = su ( [ [ t ] ] ( [ [ σ ] ] ( ρ ))) (by evaluation of su)
Analogous computations apply to the primed pair, giving su ( ⟦ t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ) \operatorname{su}(\llbracket t'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))) su ( [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ))) and su ( ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) ) \operatorname{su}(\llbracket t'[\sigma']\rrbracket(\rho')) su ( [ [ t ′ [ σ ′ ] ] ] ( ρ ′ )) .
By the hypothesis Γ ⊢ t ≈ t ′ : N a t \Gamma\vdash t \approx t' : \mathrm{Nat} Γ ⊢ t ≈ t ′ : Nat applied at Γ ′ \Gamma' Γ ′ , σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ , the term part gives
{ ⟦ t [ σ ] ⟧ ( ρ ) , ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ N a t \{\llbracket t[\sigma]\rrbracket(\rho), \llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho)), \llbracket t'\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \llbracket t'[\sigma']\rrbracket(\rho')\} \subseteq\mathrm{Nat} { [ [ t [ σ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ σ ] ] ( ρ )) , [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ t ′ [ σ ′ ] ] ] ( ρ ′ )} ⊆ Nat (by hypothesis on t , t ′ t,t' t , t ′ )
Applying Nat-Su pointwise (using transitivity of Nat, Theorem 6.7, to chain the four values):
su ( ⟦ t [ σ ] ⟧ ( ρ ) ) ≈ su ( ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) ∈ N a t \operatorname{su}(\llbracket t[\sigma]\rrbracket(\rho)) \approx\operatorname{su}(\llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho))) \in\mathrm{Nat} su ( [ [ t [ σ ] ] ] ( ρ )) ≈ su ( [ [ t ] ] ( [ [ σ ] ] ( ρ ))) ∈ Nat (by Nat-Su)
su ( ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) ≈ su ( ⟦ t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ) ∈ N a t \operatorname{su}(\llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho))) \approx\operatorname{su}(\llbracket t'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))) \in\mathrm{Nat} su ( [ [ t ] ] ( [ [ σ ] ] ( ρ ))) ≈ su ( [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ))) ∈ Nat (by Nat-Su)
su ( ⟦ t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ) ≈ su ( ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) ) ∈ N a t \operatorname{su}(\llbracket t'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))) \approx\operatorname{su}(\llbracket t'[\sigma']\rrbracket(\rho')) \in\mathrm{Nat} su ( [ [ t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ))) ≈ su ( [ [ t ′ [ σ ′ ] ] ] ( ρ ′ )) ∈ Nat (by Nat-Su)
By transitivity of Nat, all four are related in Nat, hence in R T R_T R T . □
Lemma 6.59 (Fundamental — λ \lambda λ -I / λ \lambda λ -Cong). If Γ ⊢ S ≈ S : T y i \Gamma\vdash S \approx S : \mathrm{Ty}_i Γ ⊢ S ≈ S : Ty i and Γ , x : S ⊢ t ≈ t ′ : T \Gamma, x : S \vdash t \approx t' : T Γ , x : S ⊢ t ≈ t ′ : T , then Γ ⊢ λ x . t ≈ λ x . t ′ : Π ( x : S ) . T \Gamma\vdash\lambda x.\,t \approx\lambda x.\,t' : \Pi(x : S).T Γ ⊢ λ x . t ≈ λ x . t ′ : Π ( x : S ) . T .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ D :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given.
Type part. By Theorem 6.54 applied to the hypotheses Γ ⊢ S ≈ S : T y i \Gamma\vdash S \approx S : \mathrm{Ty}_i Γ ⊢ S ≈ S : Ty i and Γ , x : S ⊢ T ≈ T : T y i \Gamma, x : S \vdash T \approx T : \mathrm{Ty}_i Γ , x : S ⊢ T ≈ T : Ty i (the latter follows from Γ , x : S ⊢ t ≈ t ′ : T \Gamma, x : S \vdash t \approx t' : T Γ , x : S ⊢ t ≈ t ′ : T via type extraction):
{ ⟦ ( Π ( x : S ) . T ) [ σ ] ⟧ ( ρ ) , ⟦ Π ( x : S ) . T ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ Π ( x : S ) . T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ ( Π ( x : S ) . T ) [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R \{\llbracket(\Pi(x : S).T)[\sigma]\rrbracket(\rho), \llbracket\Pi(x : S).T\rrbracket(\llbracket\sigma\rrbracket(\rho)), \llbracket\Pi(x : S).T\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \llbracket(\Pi(x : S).T)[\sigma']\rrbracket(\rho')\} \subseteq U_i \searrow R { [ [ ( Π ( x : S ) . T ) [ σ ] ] ] ( ρ ) , [ [ Π ( x : S ) . T ] ] ( [ [ σ ] ] ( ρ )) , [ [ Π ( x : S ) . T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ ( Π ( x : S ) . T ) [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R where R R R is the function PER characterized by: f ≈ f ′ ∈ R ⇔ ( ∀ D I : : a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D I ) ) f \approx f' \in R \Leftrightarrow(\forall D_I :: a \approx a' \in R_I.\ f \mathbin{\cdot} a \approx f' \mathbin{\cdot} a' \in R_O(D_I)) f ≈ f ′ ∈ R ⇔ ( ∀ D I :: a ≈ a ′ ∈ R I . f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D I )) .
Term part. We compute the four term values using the substitution behavior of λ \lambda λ :
⟦ ( λ x . t ) [ σ ] ⟧ ( ρ ) = ⟦ λ x . ( t [ q ( σ ) ] ) ⟧ ( ρ ) \llbracket(\lambda x.\,t)[\sigma]\rrbracket(\rho) = \llbracket\lambda x.\,(t[q(\sigma)])\rrbracket(\rho) [ [ ( λ x . t ) [ σ ] ] ] ( ρ ) = [ [ λ x . ( t [ q ( σ )]) ] ] ( ρ ) (by definition of substitution under λ \lambda λ )
= λ ( t [ q ( σ ) ] , ρ ) = \lambda(t[q(\sigma)],\rho) = λ ( t [ q ( σ )] , ρ ) (by evaluation of λ \lambda λ , forming a closure)
⟦ λ x . t ⟧ ( ⟦ σ ⟧ ( ρ ) ) = λ ( t , ⟦ σ ⟧ ( ρ ) ) \llbracket\lambda x.\,t\rrbracket(\llbracket\sigma\rrbracket(\rho)) = \lambda(t,\llbracket\sigma\rrbracket(\rho)) [ [ λ x . t ] ] ( [ [ σ ] ] ( ρ )) = λ ( t , [ [ σ ] ] ( ρ )) (by evaluation of λ \lambda λ )
Analogously, ⟦ λ x . t ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) = λ ( t ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) \llbracket\lambda x.\,t'\rrbracket(\llbracket\sigma'\rrbracket(\rho')) = \lambda(t',\llbracket\sigma'\rrbracket(\rho')) [ [ λ x . t ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) = λ ( t ′ , [ [ σ ′ ] ] ( ρ ′ )) and ⟦ ( λ x . t ′ ) [ σ ′ ] ⟧ ( ρ ′ ) = λ ( t ′ [ q ( σ ′ ) ] , ρ ′ ) \llbracket(\lambda x.\,t')[\sigma']\rrbracket(\rho') = \lambda(t'[q(\sigma')],\rho') [ [ ( λ x . t ′ ) [ σ ′ ] ] ] ( ρ ′ ) = λ ( t ′ [ q ( σ ′ )] , ρ ′ ) .
By the biconditional characterization of R R R , it suffices to show that for every D I : : a ≈ a ′ ∈ R I D_I :: a \approx a' \in R_I D I :: a ≈ a ′ ∈ R I (where R I R_I R I is the domain PER), the four closure applications are related in R O ( D I ) R_O(D_I) R O ( D I ) :
{ λ ( t [ q ( σ ) ] , ρ ) ⋅ a , λ ( t , ⟦ σ ⟧ ( ρ ) ) ⋅ a , λ ( t ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) ⋅ a ′ , λ ( t ′ [ q ( σ ′ ) ] , ρ ′ ) ⋅ a ′ } ⊆ R O ( D I ) . \{\lambda(t[q(\sigma)],\rho) \mathbin{\cdot} a,\ \lambda(t,\llbracket\sigma\rrbracket(\rho)) \mathbin{\cdot} a,\ \lambda(t',\llbracket\sigma'\rrbracket(\rho')) \mathbin{\cdot} a',\ \lambda(t'[q(\sigma')],\rho') \mathbin{\cdot} a'\} \subseteq R_O(D_I). { λ ( t [ q ( σ )] , ρ ) ⋅ a , λ ( t , [ [ σ ] ] ( ρ )) ⋅ a , λ ( t ′ , [ [ σ ′ ] ] ( ρ ′ )) ⋅ a ′ , λ ( t ′ [ q ( σ ′ )] , ρ ′ ) ⋅ a ′ } ⊆ R O ( D I ) . We compute these closure applications:
λ ( t [ q ( σ ) ] , ρ ) ⋅ a = ⟦ t [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) \lambda(t[q(\sigma)],\rho) \mathbin{\cdot} a = \llbracket t[q(\sigma)]\rrbracket((\rho,a/x)) λ ( t [ q ( σ )] , ρ ) ⋅ a = [ [ t [ q ( σ )] ] ] (( ρ , a / x )) (by closure application)
λ ( t , ⟦ σ ⟧ ( ρ ) ) ⋅ a = ⟦ t ⟧ ( ( ⟦ σ ⟧ ( ρ ) , a / x ) ) \lambda(t,\llbracket\sigma\rrbracket(\rho)) \cdot a = \llbracket t \rrbracket((\llbracket\sigma\rrbracket(\rho),a/x)) λ ( t , [ [ σ ] ] ( ρ )) ⋅ a = [ [ t ] ] (( [ [ σ ] ] ( ρ ) , a / x ))
(by closure application)
Analogous identities hold for the primed pair (using t ′ t' t ′ ).
By Theorem 6.47 on Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \vDash\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ and Γ ⊨ S ≈ S : T y i \Gamma\vDash S \approx S : \mathrm{Ty}_i Γ ⊨ S ≈ S : Ty i , Γ ′ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S \Gamma',x:S[\sigma] \vDash q(\sigma) \approx q(\sigma') : \Gamma,x:S Γ ′ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S . By the first premise of this judgment, ( Γ ′ , x : S [ σ ] ) ≈ ( Γ ′ , x : S [ σ ] ) ↘ R Γ ′ , x : S [ σ ] (\Gamma',x:S[\sigma]) \approx(\Gamma',x:S[\sigma]) \searrow R_{\Gamma',x:S[\sigma]} ( Γ ′ , x : S [ σ ]) ≈ ( Γ ′ , x : S [ σ ]) ↘ R Γ ′ , x : S [ σ ] and ( Γ , x : S ) ≈ ( Γ , x : S ) ↘ R Γ , x : S (\Gamma,x:S) \approx(\Gamma,x:S) \searrow R_{\Gamma,x:S} ( Γ , x : S ) ≈ ( Γ , x : S ) ↘ R Γ , x : S .
By Theorem 6.12 on the same left type ⟦ S [ σ ] ⟧ ( ρ ) \llbracket S[\sigma]\rrbracket(\rho) [ [ S [ σ ] ] ] ( ρ ) governing both R I R_I R I (from Theorem 6.54’s domain step) and the head PER R H ′ R'_H R H ′ of R Γ ′ , x : S [ σ ] R_{\Gamma',x:S[\sigma]} R Γ ′ , x : S [ σ ] , R I ⇔ R H ′ ( D ′ ) R_I \Leftrightarrow R'_H(\mathcal{D}') R I ⇔ R H ′ ( D ′ ) for D ′ : ρ ≈ ρ ′ ∈ R ′ \mathcal{D}':\rho\approx\rho'\in R' D ′ : ρ ≈ ρ ′ ∈ R ′ . Hence a ≈ a ′ ∈ R H ′ ( D ′ ) a\approx a'\in R'_H(\mathcal{D}') a ≈ a ′ ∈ R H ′ ( D ′ ) , so by the biconditional of R Γ ′ , x : S [ σ ] R_{\Gamma',x:S[\sigma]} R Γ ′ , x : S [ σ ] , ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ] (\rho,a/x)\approx(\rho',a'/x)\in R_{\Gamma',x:S[\sigma]} ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ] .
Apply the hypothesis Γ , x : S ⊨ t ≈ t ′ : T \Gamma,x:S \vDash t\approx t':T Γ , x : S ⊨ t ≈ t ′ : T at Γ ′ , x : S [ σ ] \Gamma',x:S[\sigma] Γ ′ , x : S [ σ ] , the lifted substitution Γ ′ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S \Gamma',x:S[\sigma]\vDash q(\sigma)\approx q(\sigma'):\Gamma,x:S Γ ′ , x : S [ σ ] ⊨ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S , and ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ] (\rho,a/x)\approx(\rho',a'/x)\in R_{\Gamma',x:S[\sigma]} ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ] :
{ ⟦ t [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) , ⟦ t ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) ) , ⟦ t ′ ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ) , ⟦ t ′ [ q ( σ ′ ) ] ⟧ ( ( ρ ′ , a ′ / x ) ) } ⊆ R O ( D I ) \{\llbracket t[q(\sigma)]\rrbracket((\rho,a/x)),\ \llbracket t\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,a/x))),
\llbracket t'\rrbracket(\llbracket q(\sigma')\rrbracket((\rho',a'/x))),\ \llbracket t'[q(\sigma')]\rrbracket((\rho',a'/x))\}\subseteq R_O(\mathcal{D}_I) { [ [ t [ q ( σ )] ] ] (( ρ , a / x )) , [ [ t ] ] ( [ [ q ( σ ) ] ] (( ρ , a / x ))) , [ [ t ′ ] ] ( [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x ))) , [ [ t ′ [ q ( σ ′ )] ] ] (( ρ ′ , a ′ / x ))} ⊆ R O ( D I )
(by hypothesis on t , t ′ t,t' t , t ′ )
The outer two values are the closure applications λ ( t [ q ( σ ) ] , ρ ) ⋅ a \lambda(t[q(\sigma)],\rho)\cdot a λ ( t [ q ( σ )] , ρ ) ⋅ a and λ ( t ′ [ q ( σ ′ ) ] , ρ ′ ) ⋅ a ′ \lambda(t'[q(\sigma')],\rho')\cdot a' λ ( t ′ [ q ( σ ′ )] , ρ ′ ) ⋅ a ′ . The inner two values are ⟦ t ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) ) \llbracket t\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,a/x))) [ [ t ] ] ( [ [ q ( σ ) ] ] (( ρ , a / x ))) and ⟦ t ′ ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ) \llbracket t'\rrbracket(\llbracket q(\sigma')\rrbracket((\rho',a'/x))) [ [ t ′ ] ] ( [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x ))) , which we must relate to ⟦ t ⟧ ( ( ⟦ σ ⟧ ( ρ ) , a / x ) ) = λ ( t , ⟦ σ ⟧ ( ρ ) ) ⋅ a \llbracket t\rrbracket((\llbracket\sigma\rrbracket(\rho),a/x))=\lambda(t,\llbracket\sigma\rrbracket(\rho))\cdot a [ [ t ] ] (( [ [ σ ] ] ( ρ ) , a / x )) = λ ( t , [ [ σ ] ] ( ρ )) ⋅ a and ⟦ t ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) = λ ( t ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) ⋅ a ′ \llbracket t'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x))=\lambda(t',\llbracket\sigma'\rrbracket(\rho'))\cdot a' [ [ t ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) = λ ( t ′ , [ [ σ ′ ] ] ( ρ ′ )) ⋅ a ′ .
We now show ⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) ≈ ( ⟦ σ ⟧ ( ρ ) , a / x ) ∈ R Γ , x : S \llbracket q(\sigma)\rrbracket((\rho,a/x))\approx(\llbracket\sigma\rrbracket(\rho),a/x)\in R_{\Gamma,x:S} [ [ q ( σ ) ] ] (( ρ , a / x )) ≈ ( [ [ σ ] ] ( ρ ) , a / x ) ∈ R Γ , x : S . Unfolding q ( σ ) = ( σ [ ⇑ ] , x 0 / x ) q(\sigma)=(\sigma[\Uparrow],x_0/x) q ( σ ) = ( σ [ ⇑ ] , x 0 / x ) , the environment ⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) \llbracket q(\sigma)\rrbracket((\rho,a/x)) [ [ q ( σ ) ] ] (( ρ , a / x )) has tail ⟦ σ [ ⇑ ] ⟧ ( ( ρ , a / x ) ) \llbracket\sigma[\Uparrow]\rrbracket((\rho,a/x)) [ [ σ [ ⇑ ] ] ] (( ρ , a / x )) and head a a a (since ⟦ x 0 ⟧ ( ( ρ , a / x ) ) = a \llbracket x_0\rrbracket((\rho,a/x))=a [ [ x 0 ] ] (( ρ , a / x )) = a ). The environment ( ⟦ σ ⟧ ( ρ ) , a / x ) (\llbracket\sigma\rrbracket(\rho),a/x) ( [ [ σ ] ] ( ρ ) , a / x ) has tail ⟦ σ ⟧ ( ρ ) \llbracket\sigma\rrbracket(\rho) [ [ σ ] ] ( ρ ) and head a a a . By the biconditional of R Γ , x : S R_{\Gamma,x:S} R Γ , x : S (from Ctx-Ext), it suffices to show:
Tails: ⟦ σ [ ⇑ ] ⟧ ( ( ρ , a / x ) ) ≈ ⟦ σ ⟧ ( ρ ) ∈ R Γ \llbracket\sigma[\Uparrow]\rrbracket((\rho,a/x))\approx\llbracket\sigma\rrbracket(\rho)\in R_\Gamma [ [ σ [ ⇑ ] ] ] (( ρ , a / x )) ≈ [ [ σ ] ] ( ρ ) ∈ R Γ . By Theorem 6.28, Γ ′ , x : S [ σ ] ⊨ w ⇑ : Γ ′ \Gamma',x:S[\sigma]\vDash_w\Uparrow:\Gamma' Γ ′ , x : S [ σ ] ⊨ w ⇑: Γ ′ . Apply Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma'\vDash\sigma\approx\sigma':\Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ at Γ ′ , x : S [ σ ] \Gamma',x:S[\sigma] Γ ′ , x : S [ σ ] , ⇑ \Uparrow ⇑ , and ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ] (\rho,a/x)\approx(\rho',a'/x)\in R_{\Gamma',x:S[\sigma]} ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ] : the four-value pattern includes ⟦ σ [ ⇑ ] ⟧ ( ( ρ , a / x ) ) ≈ ⟦ σ ⟧ ( ⟦ ⇑ ⟧ ( ( ρ , a / x ) ) ) ∈ R Γ \llbracket\sigma[\Uparrow]\rrbracket((\rho,a/x))\approx\llbracket\sigma\rrbracket(\llbracket\Uparrow\rrbracket((\rho,a/x)))\in R_\Gamma [ [ σ [ ⇑ ] ] ] (( ρ , a / x )) ≈ [ [ σ ] ] ( [ [ ⇑ ] ] (( ρ , a / x ))) ∈ R Γ . Since ⟦ ⇑ ⟧ ( ( ρ , a / x ) ) = ρ \llbracket\Uparrow\rrbracket((\rho,a/x))=\rho [ [ ⇑ ] ] (( ρ , a / x )) = ρ definitionally (the shift on environments drops the head), this gives the desired relatedness. Let D Γ \mathcal{D}_\Gamma D Γ denote this evidence in R Γ R_\Gamma R Γ .
Heads: a ≈ a ∈ R H I ( D Γ ) a\approx a\in R_H^I(\mathcal{D}_\Gamma) a ≈ a ∈ R H I ( D Γ ) , where R H I ( D Γ ) R_H^I(\mathcal{D}_\Gamma) R H I ( D Γ ) is the head PER governed by ⟦ S ⟧ ( ⟦ σ [ ⇑ ] ⟧ ( ( ρ , a / x ) ) ) ≈ ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) ∈ U i ↘ R H I ( D Γ ) \llbracket S\rrbracket(\llbracket\sigma[\Uparrow]\rrbracket((\rho,a/x)))\approx\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho))\in\mathcal{U}_i\searrow R_H^I(\mathcal{D}_\Gamma) [ [ S ] ] ( [ [ σ [ ⇑ ] ] ] (( ρ , a / x ))) ≈ [ [ S ] ] ( [ [ σ ] ] ( ρ )) ∈ U i ↘ R H I ( D Γ ) . By Γ ⊨ S ≈ S : T y i \Gamma\vDash S\approx S:\mathrm{Ty}_i Γ ⊨ S ≈ S : Ty i instantiated at Γ ′ ⊨ σ ≈ σ : Γ \Gamma'\vDash\sigma\approx\sigma:\Gamma Γ ′ ⊨ σ ≈ σ : Γ (reflexive, by Theorems 6.41 and 6.42), and ρ ≈ ρ ∈ R ′ \rho\approx\rho\in R' ρ ≈ ρ ∈ R ′ : the type part gives the commutation ⟦ S [ σ ] ⟧ ( ρ ) ≈ ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) ∈ U i \llbracket S[\sigma]\rrbracket(\rho)\approx\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho))\in\mathcal{U}_i [ [ S [ σ ] ] ] ( ρ ) ≈ [ [ S ] ] ( [ [ σ ] ] ( ρ )) ∈ U i . By Theorem 6.12, R I ⇔ R H I ( D Γ ) R_I\Leftrightarrow R_H^I(\mathcal{D}_\Gamma) R I ⇔ R H I ( D Γ ) . From a ≈ a ∈ R I a\approx a\in R_I a ≈ a ∈ R I (reflexive of a ≈ a ′ ∈ R I a\approx a'\in R_I a ≈ a ′ ∈ R I ), we conclude a ≈ a ∈ R H I ( D Γ ) a\approx a\in R_H^I(\mathcal{D}_\Gamma) a ≈ a ∈ R H I ( D Γ ) .
By Ctx-Ext’s biconditional, ⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) ≈ ( ⟦ σ ⟧ ( ρ ) , a / x ) ∈ R Γ , x : S \llbracket q(\sigma)\rrbracket((\rho,a/x))\approx(\llbracket\sigma\rrbracket(\rho),a/x)\in R_{\Gamma,x:S} [ [ q ( σ ) ] ] (( ρ , a / x )) ≈ ( [ [ σ ] ] ( ρ ) , a / x ) ∈ R Γ , x : S . By Theorem 6.38 on the reflexive instance Γ , x : S ⊨ t ≈ t : T \Gamma,x:S\vDash t\approx t:T Γ , x : S ⊨ t ≈ t : T (from Γ , x : S ⊨ t ≈ t ′ : T \Gamma,x:S\vDash t\approx t':T Γ , x : S ⊨ t ≈ t ′ : T by Theorems 6.41 and 6.42) applied to this related pair:
⟦ t ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) ) ≈ ⟦ t ⟧ ( ( ⟦ σ ⟧ ( ρ ) , a / x ) ) ∈ R O ′ ( D I ) \llbracket t\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,a/x)))\approx\llbracket t\rrbracket((\llbracket\sigma\rrbracket(\rho),a/x))\in R'_O(\mathcal{D}_I) [ [ t ] ] ( [ [ q ( σ ) ] ] (( ρ , a / x ))) ≈ [ [ t ] ] (( [ [ σ ] ] ( ρ ) , a / x )) ∈ R O ′ ( D I )
for some R O ′ ( D I ) R'_O(\mathcal{D}_I) R O ′ ( D I ) . By Theorem 6.12, R O ′ ( D I ) ⇔ R O ( D I ) R'_O(\mathcal{D}_I)\Leftrightarrow R_O(\mathcal{D}_I) R O ′ ( D I ) ⇔ R O ( D I ) (governed by the same type ⟦ T ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , a / x ) ) ) \llbracket T\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,a/x))) [ [ T ] ] ( [ [ q ( σ ) ] ] (( ρ , a / x ))) which lies in U i ↘ R O ( D I ) \mathcal{U}_i\searrow R_O(\mathcal{D}_I) U i ↘ R O ( D I ) by the type part of the four-value pattern). Analogously on the primed side (using the reflexive instance Γ , x : S ⊨ t ′ ≈ t ′ : T \Gamma,x:S\vDash t'\approx t':T Γ , x : S ⊨ t ′ ≈ t ′ : T ): ⟦ t ′ ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ) ≈ ⟦ t ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) ∈ R O ( D I ) \llbracket t'\rrbracket(\llbracket q(\sigma')\rrbracket((\rho',a'/x)))\approx\llbracket t'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x))\in R_O(\mathcal{D}_I) [ [ t ′ ] ] ( [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x ))) ≈ [ [ t ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) ∈ R O ( D I ) .
Combining via symmetry and transitivity of R O ( D I ) R_O(\mathcal{D}_I) R O ( D I ) , the four closure applications
{ λ ( t [ q ( σ ) ] , ρ ) ⋅ a , λ ( t , ⟦ σ ⟧ ( ρ ) ) ⋅ a , λ ( t ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) ⋅ a ′ , λ ( t ′ [ q ( σ ′ ) ] , ρ ′ ) ⋅ a ′ } ⊆ R O ( D I ) . \{\lambda(t[q(\sigma)],\rho)\cdot a,\ \lambda(t,\llbracket\sigma\rrbracket(\rho))\cdot a,\ \lambda(t',\llbracket\sigma'\rrbracket(\rho'))\cdot a',\ \lambda(t'[q(\sigma')],\rho')\cdot a'\}\subseteq R_O(\mathcal{D}_I). { λ ( t [ q ( σ )] , ρ ) ⋅ a , λ ( t , [ [ σ ] ] ( ρ )) ⋅ a , λ ( t ′ , [ [ σ ′ ] ] ( ρ ′ )) ⋅ a ′ , λ ( t ′ [ q ( σ ′ )] , ρ ′ ) ⋅ a ′ } ⊆ R O ( D I ) .
Hence the biconditional is satisfied, and the four closures are related in R R R .
Lemma 6.60 (Fundamental – λ \lambda λ -E / App-Cong). If Γ ⊨ S ≈ S ′ : T y i \Gamma\vDash S\approx S':\mathrm{Ty}_i Γ ⊨ S ≈ S ′ : Ty i , Γ , x : S ⊨ T ≈ T ′ : T y i \Gamma,x:S\vDash T\approx T':\mathrm{Ty}_i Γ , x : S ⊨ T ≈ T ′ : Ty i , Γ ⊨ r ≈ r ′ : Π ( x : S ) . T \Gamma\vDash r\approx r':\Pi(x:S).T Γ ⊨ r ≈ r ′ : Π ( x : S ) . T , and Γ ⊨ s ≈ s ′ : S \Gamma\vDash s\approx s':S Γ ⊨ s ≈ s ′ : S , then Γ ⊨ r s ≈ r ′ s ′ : T [ s / x ] \Gamma\vDash r\,s\approx r'\,s':T[s/x] Γ ⊨ r s ≈ r ′ s ′ : T [ s / x ] .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma'\approx\Gamma'\searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma'\vDash\sigma\approx\sigma':\Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ , and D : ρ ≈ ρ ′ ∈ R ′ \mathcal{D}:\rho\approx\rho'\in R' D : ρ ≈ ρ ′ ∈ R ′ be given.
By Γ ⊨ s ≈ s ′ : S \Gamma\vDash s\approx s':S Γ ⊨ s ≈ s ′ : S at Γ ′ \Gamma' Γ ′ , σ ≈ σ ′ : Γ \sigma\approx\sigma':\Gamma σ ≈ σ ′ : Γ , ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho'\in R' ρ ≈ ρ ′ ∈ R ′ :
{ ⟦ S [ σ ] ⟧ ( ρ ) , ⟦ S [ σ ] ⟧ ( ρ ′ ) , ⟦ S [ σ ′ ] ⟧ ( ρ ′ ) , ⟦ S [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R I \{\llbracket S[\sigma]\rrbracket(\rho),\llbracket S[\sigma]\rrbracket(\rho'),\llbracket S[\sigma']\rrbracket(\rho'),\llbracket S[\sigma']\rrbracket(\rho')\}\subseteq\mathcal{U}_i\searrow R_I { [ [ S [ σ ] ] ] ( ρ ) , [ [ S [ σ ] ] ] ( ρ ′ ) , [ [ S [ σ ′ ] ] ] ( ρ ′ ) , [ [ S [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R I
(by hypothesis on S S S )
{ ⟦ s [ σ ] ⟧ ( ρ ) , ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ s ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ s ′ [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R I \{\llbracket s[\sigma]\rrbracket(\rho),\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho)),\llbracket s'\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\llbracket s'[\sigma']\rrbracket(\rho')\}\subseteq R_I { [ [ s [ σ ] ] ] ( ρ ) , [ [ s ] ] ( [ [ σ ] ] ( ρ )) , [ [ s ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ s ′ [ σ ′ ] ] ] ( ρ ′ )} ⊆ R I
(by hypothesis on s , s ′ s,s' s , s ′ ) In particular, let D I : : ⟦ s [ σ ] ⟧ ( ρ ) ≈ ⟦ s ′ [ σ ′ ] ⟧ ( ρ ′ ) ∈ R I D_I :: \llbracket s[\sigma]\rrbracket(\rho) \approx\llbracket s'[\sigma']\rrbracket(\rho') \in R_I D I :: [ [ s [ σ ] ] ] ( ρ ) ≈ [ [ s ′ [ σ ′ ] ] ] ( ρ ′ ) ∈ R I .
By Γ ⊢ r ≈ r ′ : Π ( x : S ) . T \Gamma\vdash r \approx r' : \Pi(x : S).T Γ ⊢ r ≈ r ′ : Π ( x : S ) . T at the same data, the four evaluations of r , r ′ r,r' r , r ′ are related in the function PER R R R for Π ( ⟦ S [ σ ] ⟧ ( ρ ) , T [ q ( σ ) ] , ρ ) \Pi(\llbracket S[\sigma]\rrbracket(\rho),T[q(\sigma)],\rho) Π ( [ [ S [ σ ] ] ] ( ρ ) , T [ q ( σ )] , ρ ) :
{ ⟦ r [ σ ] ⟧ ( ρ ) , ⟦ r ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ r ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ r ′ [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R \{\llbracket r[\sigma]\rrbracket(\rho),\llbracket r\rrbracket(\llbracket\sigma\rrbracket(\rho)),\llbracket r'\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\llbracket r'[\sigma']\rrbracket(\rho')\}\subseteq R { [ [ r [ σ ] ] ] ( ρ ) , [ [ r ] ] ( [ [ σ ] ] ( ρ )) , [ [ r ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ r ′ [ σ ′ ] ] ] ( ρ ′ )} ⊆ R
(by hypothesis on r , r ′ r,r' r , r ′ ).
Term part. We compute the four term values:
⟦ ( r s ) [ σ ] ⟧ ( ρ ) = ⟦ r [ σ ] s [ σ ] ⟧ ( ρ ) \llbracket(r\ s)[\sigma]\rrbracket(\rho)=\llbracket r[\sigma]\ s[\sigma]\rrbracket(\rho) [ [ ( r s ) [ σ ] ] ] ( ρ ) = [ [ r [ σ ] s [ σ ] ] ] ( ρ )
(by definition of substitution on app)
= ⟦ r [ σ ] ⟧ ( ρ ) ⋅ ⟦ s [ σ ] ⟧ ( ρ ) =\llbracket r[\sigma]\rrbracket(\rho)\cdot\llbracket s[\sigma]\rrbracket(\rho) = [ [ r [ σ ] ] ] ( ρ ) ⋅ [ [ s [ σ ] ] ] ( ρ )
(by evaluation of app)
⟦ r s ⟧ ( ⟦ σ ⟧ ( ρ ) ) = ⟦ r ⟧ ( ⟦ σ ⟧ ( ρ ) ) ⋅ ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) \llbracket r\ s\rrbracket(\llbracket\sigma\rrbracket(\rho))=\llbracket r\rrbracket(\llbracket\sigma\rrbracket(\rho))\cdot\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho)) [ [ r s ] ] ( [ [ σ ] ] ( ρ )) = [ [ r ] ] ( [ [ σ ] ] ( ρ )) ⋅ [ [ s ] ] ( [ [ σ ] ] ( ρ ))
(by evaluation of app)
Analogous computations for the primed pair (with r ′ , s ′ r',s' r ′ , s ′ ), yielding ⟦ r ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ⋅ ⟦ s ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) \llbracket r'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))\cdot\llbracket s'\rrbracket(\llbracket\sigma'\rrbracket(\rho')) [ [ r ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ⋅ [ [ s ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) and ⟦ r ′ [ σ ′ ] ⟧ ( ρ ′ ) ⋅ ⟦ s ′ [ σ ′ ] ⟧ ( ρ ′ ) \llbracket r'[\sigma']\rrbracket(\rho')\cdot\llbracket s'[\sigma']\rrbracket(\rho') [ [ r ′ [ σ ′ ] ] ] ( ρ ′ ) ⋅ [ [ s ′ [ σ ′ ] ] ] ( ρ ′ ) .
Denote the four r / r ′ r/r' r / r ′ -values as f 1 , f 2 , f 3 , f 4 f_1,f_2,f_3,f_4 f 1 , f 2 , f 3 , f 4 (in order) and the four s / s ′ s/s' s / s ′ -values as a 1 , a 2 , a 3 , a 4 a_1,a_2,a_3,a_4 a 1 , a 2 , a 3 , a 4 . By hypothesis, { f 1 , f 2 , f 3 , f 4 } ⊆ R \{f_1,f_2,f_3,f_4\}\subseteq R { f 1 , f 2 , f 3 , f 4 } ⊆ R and { a 1 , a 2 , a 3 , a 4 } ⊆ R I \{a_1,a_2,a_3,a_4\}\subseteq R_I { a 1 , a 2 , a 3 , a 4 } ⊆ R I . For each pair ( i , j ) (i,j) ( i , j ) with 1 ≤ i < j ≤ 4 1\leq i<j\leq4 1 ≤ i < j ≤ 4 , we have f i ≈ f j ∈ R f_i\approx f_j\in R f i ≈ f j ∈ R and a i ≈ a j ∈ R I a_i\approx a_j\in R_I a i ≈ a j ∈ R I ; let D I i j : : a i ≈ a j ∈ R I D_I^{ij}::a_i\approx a_j\in R_I D I ij :: a i ≈ a j ∈ R I . By the biconditional of R R R applied to f i ≈ f j ∈ R f_i\approx f_j\in R f i ≈ f j ∈ R and D I i j D_I^{ij} D I ij : f i ⋅ a i ≈ f j ⋅ a j ∈ R O ( D I i j ) f_i\cdot a_i\approx f_j\cdot a_j\in R_O(D_I^{ij}) f i ⋅ a i ≈ f j ⋅ a j ∈ R O ( D I ij ) . By Theorem 6.12 (right irrelevance), R O ( D I i j ) R_O(D_I^{ij}) R O ( D I ij ) is independent of the witness, agreeing with R O ( D I ) R_O(D_I) R O ( D I ) for any fixed D I : : a 1 ≈ a 4 ∈ R I D_I::a_1\approx a_4\in R_I D I :: a 1 ≈ a 4 ∈ R I . Hence
{ ⟦ r [ σ ] ⟧ ( ρ ) ⋅ ⟦ s [ σ ] ⟧ ( ρ ) , ⟦ r ⟧ ( ⟦ σ ⟧ ( ρ ) ) ⋅ ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ r ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ⋅ ⟦ s ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ r ′ [ σ ′ ] ⟧ ( ρ ′ ) ⋅ ⟦ s ′ [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R O ( D I ) . \{\llbracket r[\sigma]\rrbracket(\rho)\cdot\llbracket s[\sigma]\rrbracket(\rho),\llbracket r\rrbracket(\llbracket\sigma\rrbracket(\rho))\cdot\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho)),
\llbracket r'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))\cdot\llbracket s'\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\llbracket r'[\sigma']\rrbracket(\rho')\cdot\llbracket s'[\sigma']\rrbracket(\rho')\}\subseteq R_O(D_I). { [ [ r [ σ ] ] ] ( ρ ) ⋅ [ [ s [ σ ] ] ] ( ρ ) , [ [ r ] ] ( [ [ σ ] ] ( ρ )) ⋅ [ [ s ] ] ( [ [ σ ] ] ( ρ )) , [ [ r ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ⋅ [ [ s ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ r ′ [ σ ′ ] ] ] ( ρ ′ ) ⋅ [ [ s ′ [ σ ′ ] ] ] ( ρ ′ )} ⊆ R O ( D I ) .
Type part. We instantiate Γ , x : S ⊢ T ≈ T : T y i \Gamma,x:S\vdash T\approx T:Ty_i Γ , x : S ⊢ T ≈ T : T y i at two semantic substitutions to obtain the goal’s outer and inner values, then bridge via Theorem 6.38.
Pattern A (outer instantiation): ( σ , s [ σ ] / x ) (\sigma,s[\sigma]/x) ( σ , s [ σ ] / x ) vs ( σ ′ , s ′ [ σ ′ ] / x ) (\sigma',s'[\sigma']/x) ( σ ′ , s ′ [ σ ′ ] / x ) .
Γ ′ ⊢ ( σ , s [ σ ] / x ) ≈ ( σ ′ , s ′ [ σ ′ ] / x ) : Γ , x : S \Gamma'\vdash(\sigma,s[\sigma]/x)\approx(\sigma',s'[\sigma']/x):\Gamma,x:S Γ ′ ⊢ ( σ , s [ σ ] / x ) ≈ ( σ ′ , s ′ [ σ ′ ] / x ) : Γ , x : S
(by Theorem 6.45 on σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ and s ≈ s ′ s\approx s' s ≈ s ′ )
Apply Γ , x : S ⊢ T ≈ T : T y i \Gamma,x:S\vdash T\approx T:Ty_i Γ , x : S ⊢ T ≈ T : T y i at Γ ′ \Gamma' Γ ′ , this semantic substitution, and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho'\in R' ρ ≈ ρ ′ ∈ R ′ :
{ ⟦ T [ σ , s [ σ ] / x ] ⟧ ( ρ ) , ⟦ T ⟧ ( ⟦ ( σ , s [ σ ] / x ) ⟧ ( ρ ) ) , ⟦ T ⟧ ( ⟦ ( σ ′ , s ′ [ σ ′ ] / x ) ⟧ ( ρ ′ ) ) , ⟦ T [ σ ′ , s ′ [ σ ′ ] / x ] ⟧ ( ρ ′ ) } ⊆ U i ∖ R O ( D I ) . \{\llbracket T[\sigma,s[\sigma]/x]\rrbracket(\rho),\llbracket T\rrbracket(\llbracket(\sigma,s[\sigma]/x)\rrbracket(\rho)),
\llbracket T\rrbracket(\llbracket(\sigma',s'[\sigma']/x)\rrbracket(\rho')),\llbracket T[\sigma',s'[\sigma']/x]\rrbracket(\rho')\}\subseteq U_i\setminus R_O(D_I). { [ [ T [ σ , s [ σ ] / x ] ] ] ( ρ ) , [ [ T ] ] ( [ [ ( σ , s [ σ ] / x ) ] ] ( ρ )) , [ [ T ] ] ( [ [ ( σ ′ , s ′ [ σ ′ ] / x ) ] ] ( ρ ′ )) , [ [ T [ σ ′ , s ′ [ σ ′ ] / x ] ] ] ( ρ ′ )} ⊆ U i ∖ R O ( D I ) .
Identify the four values syntactically and definitionally:
T [ σ , s [ σ ] / x ] = T[\sigma,s[\sigma]/x]= T [ σ , s [ σ ] / x ] =
(by Theorem 2.30)
T [ σ ′ , s ′ [ σ ′ ] / x ] = T[\sigma',s'[\sigma']/x]= T [ σ ′ , s ′ [ σ ′ ] / x ] =
(by Theorem 2.30)
⟦ ( σ , s [ σ ] / x ) ⟧ ( ρ ) = ( ⟦ σ ⟧ ( ρ ) , ⟦ s [ σ ] ⟧ ( ρ ) / x ) \llbracket(\sigma,s[\sigma]/x)\rrbracket(\rho)=(\llbracket\sigma\rrbracket(\rho),\llbracket s[\sigma]\rrbracket(\rho)/x) [ [ ( σ , s [ σ ] / x ) ] ] ( ρ ) = ( [ [ σ ] ] ( ρ ) , [ [ s [ σ ] ] ] ( ρ ) / x )
(by pointwise definition of substitution evaluation)
Hence the four-value pattern reads:
{ ⟦ T ⟧ ( ρ ) , ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , ⟦ s [ σ ] ⟧ ( ρ ) / x ) ) , ⟦ T ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , ⟦ s ′ [ σ ′ ] ⟧ ( ρ ′ ) / x ) ) , ⟦ T ⟧ ( ρ ′ ) } ⊆ U i ∖ R O ( D I ) . \{\llbracket T\rrbracket(\rho),\llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\llbracket s[\sigma]\rrbracket(\rho)/x)),
\llbracket T\rrbracket((\llbracket\sigma'\rrbracket(\rho'),\llbracket s'[\sigma']\rrbracket(\rho')/x)),\llbracket T\rrbracket(\rho')\}\subseteq U_i\setminus R_O(D_I). { [ [ T ] ] ( ρ ) , [ [ T ] ] (( [ [ σ ] ] ( ρ ) , [ [ s [ σ ] ] ] ( ρ ) / x )) , [ [ T ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , [ [ s ′ [ σ ′ ] ] ] ( ρ ′ ) / x )) , [ [ T ] ] ( ρ ′ )} ⊆ U i ∖ R O ( D I ) .
The outer-left value matches the goal’s outer-left ⟦ T ⟧ ( ρ ) \llbracket T\rrbracket(\rho) [ [ T ] ] ( ρ ) . The outer-right value ⟦ T ⟧ ( ρ ′ ) \llbracket T\rrbracket(\rho') [ [ T ] ] ( ρ ′ ) governs the same PER as ⟦ T ⟧ ( ρ ′ ) \llbracket T\rrbracket(\rho') [ [ T ] ] ( ρ ′ ) by Theorem 6.12 once we establish
⟦ T ⟧ ( ρ ′ ) ≈ ⟦ T ⟧ ( ρ ′ ) ∈ U i , \llbracket T\rrbracket(\rho')\approx\llbracket T\rrbracket(\rho')\in U_i, [ [ T ] ] ( ρ ′ ) ≈ [ [ T ] ] ( ρ ′ ) ∈ U i ,
which holds by another instantiation of Γ , x : S ⊢ T ≈ T : T y i \Gamma,x:S\vdash T\approx T:Ty_i Γ , x : S ⊢ T ≈ T : T y i at the related env-pair
( ⟦ σ ′ ⟧ ( ρ ′ ) , ⟦ s [ σ ′ ] ⟧ ( ρ ′ ) / x ) ≈ ( ⟦ σ ′ ⟧ ( ρ ′ ) , ⟦ s ′ [ σ ′ ] ⟧ ( ρ ′ ) / x ) ∈ R Γ , x : S . (\llbracket\sigma'\rrbracket(\rho'),\llbracket s[\sigma']\rrbracket(\rho')/x)\approx(\llbracket\sigma'\rrbracket(\rho'),\llbracket s'[\sigma']\rrbracket(\rho')/x)\in R_{\Gamma,x:S}. ( [ [ σ ′ ] ] ( ρ ′ ) , [ [ s [ σ ′ ] ] ] ( ρ ′ ) / x ) ≈ ( [ [ σ ′ ] ] ( ρ ′ ) , [ [ s ′ [ σ ′ ] ] ] ( ρ ′ ) / x ) ∈ R Γ , x : S .
(using the four-value relatedness of s s s , s ′ s' s ′ ).
Pattern B (inner instantiation): ( id , s / x ) (\operatorname{id},s/x) ( id , s / x ) vs ( id , s ′ / x ) (\operatorname{id},s'/x) ( id , s ′ / x ) . By Theorem 6.45 on Γ ⊢ id ≈ id : Γ \Gamma\vdash\operatorname{id} \approx\operatorname{id} : \Gamma Γ ⊢ id ≈ id : Γ and Γ ⊢ s ≈ s ′ : S \Gamma\vdash s \approx s' : S Γ ⊢ s ≈ s ′ : S : Γ ⊢ ( id , s / x ) ≈ ( id , s ′ / x ) : Γ , x : S \Gamma\vdash(\operatorname{id},s/x) \approx(\operatorname{id},s'/x) : \Gamma,x:S Γ ⊢ ( id , s / x ) ≈ ( id , s ′ / x ) : Γ , x : S (using s [ id ] = s s[\operatorname{id}]=s s [ id ] = s and s ′ [ id ] = s ′ s'[\operatorname{id}]=s' s ′ [ id ] = s ′ ). From Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ at id \operatorname{id} id , D D D : ⟦ σ ⟧ ( ρ ) ≈ ⟦ σ ′ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\sigma\rrbracket(\rho) \approx\llbracket\sigma'\rrbracket(\rho') \in R_\Gamma [ [ σ ] ] ( ρ ) ≈ [ [ σ ′ ] ] ( ρ ′ ) ∈ R Γ . Apply Γ , x : S ⊢ T ≈ T : Ty i \Gamma,x:S \vdash T \approx T : \operatorname{Ty}_i Γ , x : S ⊢ T ≈ T : Ty i at Γ \Gamma Γ (with R Γ R_\Gamma R Γ ), this semantic substitution, and ⟦ σ ⟧ ( ρ ) ≈ ⟦ σ ′ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\sigma\rrbracket(\rho) \approx\llbracket\sigma'\rrbracket(\rho') \in R_\Gamma [ [ σ ] ] ( ρ ) ≈ [ [ σ ′ ] ] ( ρ ′ ) ∈ R Γ :
{ ⟦ T [ id , s / x ] ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ T ⟧ ( ⟦ ( id , s / x ) ⟧ ( ⟦ σ ⟧ ( ρ ) ) ) , ⟦ T ⟧ ( ⟦ ( id , s ′ / x ) ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ T [ id , s ′ / x ] ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) } ⊆ U i ↘ R O B . \left\{
\begin{aligned}
&\llbracket T[\operatorname{id},s/x]\rrbracket(\llbracket\sigma\rrbracket(\rho)),\
\llbracket T\rrbracket(\llbracket(\operatorname{id},s/x)\rrbracket(\llbracket\sigma\rrbracket(\rho))),\\
&\llbracket T\rrbracket(\llbracket(\operatorname{id},s'/x)\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\
\llbracket T[\operatorname{id},s'/x]\rrbracket(\llbracket\sigma'\rrbracket(\rho'))
\end{aligned}
\right\}
\subseteq U_i \mathbin{\searrow} R_O^B. { [ [ T [ id , s / x ] ] ] ( [ [ σ ] ] ( ρ )) , [ [ T ] ] ( [ [ ( id , s / x ) ] ] ( [ [ σ ] ] ( ρ ))) , [ [ T ] ] ( [ [ ( id , s ′ / x ) ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ T [ id , s ′ / x ] ] ] ( [ [ σ ′ ] ] ( ρ ′ )) } ⊆ U i ↘ R O B .
Identify T [ id , s / x ] = T [ s / x ] T[\operatorname{id},s/x]=T[s/x] T [ id , s / x ] = T [ s / x ] , T [ id , s ′ / x ] = T [ s ′ / x ] T[\operatorname{id},s'/x]=T[s'/x] T [ id , s ′ / x ] = T [ s ′ / x ] , and ⟦ ( id , s / x ) ⟧ ( ⟦ σ ⟧ ( ρ ) ) = ( ⟦ σ ⟧ ( ρ ) , ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) / x ) \llbracket(\operatorname{id},s/x)\rrbracket(\llbracket\sigma\rrbracket(\rho))=(\llbracket\sigma\rrbracket(\rho),\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho))/x) [ [ ( id , s / x ) ] ] ( [ [ σ ] ] ( ρ )) = ( [ [ σ ] ] ( ρ ) , [ [ s ] ] ( [ [ σ ] ] ( ρ )) / x ) (pointwise; ⟦ id ⟧ ( ⟦ σ ⟧ ( ρ ) ) = ⟦ σ ⟧ ( ρ ) \llbracket\operatorname{id}\rrbracket(\llbracket\sigma\rrbracket(\rho))=\llbracket\sigma\rrbracket(\rho) [ [ id ] ] ( [ [ σ ] ] ( ρ )) = [ [ σ ] ] ( ρ ) ). So the four-value pattern reads:
{ ⟦ T [ s / x ] ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) / x ) ) , ⟦ T ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , ⟦ s ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) / x ) ) , ⟦ T [ s ′ / x ] ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) } ⊆ U i ↘ R O B . \left\{
\begin{aligned}
&\llbracket T[s/x]\rrbracket(\llbracket\sigma\rrbracket(\rho)),\
\llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho))/x)),\\
&\llbracket T\rrbracket((\llbracket\sigma'\rrbracket(\rho'),\llbracket s'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))/x)),\
\llbracket T[s'/x]\rrbracket(\llbracket\sigma'\rrbracket(\rho'))
\end{aligned}
\right\}
\subseteq U_i \mathbin{\searrow} R_O^B. { [ [ T [ s / x ] ] ] ( [ [ σ ] ] ( ρ )) , [ [ T ] ] (( [ [ σ ] ] ( ρ ) , [ [ s ] ] ( [ [ σ ] ] ( ρ )) / x )) , [ [ T ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , [ [ s ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) / x )) , [ [ T [ s ′ / x ] ] ] ( [ [ σ ′ ] ] ( ρ ′ )) } ⊆ U i ↘ R O B .
The outer values match the goal’s inner-left ⟦ T [ s / x ] ⟧ ( ⟦ σ ⟧ ( ρ ) ) \llbracket T[s/x]\rrbracket(\llbracket\sigma\rrbracket(\rho)) [ [ T [ s / x ] ] ] ( [ [ σ ] ] ( ρ )) and inner-right ⟦ T [ s ′ / x ] ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) \llbracket T[s'/x]\rrbracket(\llbracket\sigma'\rrbracket(\rho')) [ [ T [ s ′ / x ] ] ] ( [ [ σ ′ ] ] ( ρ ′ )) (modulo Theorem 6.12 on T [ s / x ] T[s/x] T [ s / x ] vs T [ s ′ / x ] T[s'/x] T [ s ′ / x ] at ⟦ σ ′ ⟧ ( ρ ′ ) \llbracket\sigma'\rrbracket(\rho') [ [ σ ′ ] ] ( ρ ′ ) , established as in Pattern A).
Bridging Pattern A and Pattern B. Pattern A’s inner-left is
⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , ⟦ s [ σ ] ⟧ ( ρ ) / x ) ) . \llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\llbracket s[\sigma]\rrbracket(\rho)/x)). [ [ T ] ] (( [ [ σ ] ] ( ρ ) , [ [ s [ σ ] ] ] ( ρ ) / x )) .
and Pattern B’s inner-left is
⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) / x ) ) . \llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho))/x)). [ [ T ] ] (( [ [ σ ] ] ( ρ ) , [ [ s ] ] ( [ [ σ ] ] ( ρ )) / x )) .
We bridge them via Theorem 6.38. We show
( ⟦ σ ⟧ ( ρ ) , ⟦ s [ σ ] ⟧ ( ρ ) / x ) ≈ ( ⟦ σ ⟧ ( ρ ) , ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) / x ) ∈ R Γ , x : S (\llbracket\sigma\rrbracket(\rho),\llbracket s[\sigma]\rrbracket(\rho)/x)
\approx
(\llbracket\sigma\rrbracket(\rho),\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho))/x)
\in R_{\Gamma,x:S} ( [ [ σ ] ] ( ρ ) , [ [ s [ σ ] ] ] ( ρ ) / x ) ≈ ( [ [ σ ] ] ( ρ ) , [ [ s ] ] ( [ [ σ ] ] ( ρ )) / x ) ∈ R Γ , x : S
by Ctx-Ext’s biconditional:
⟦ σ ⟧ ( ρ ) ≈ ⟦ σ ⟧ ( ρ ) ∈ R Γ (reflexive; let D Γ be this witness) \llbracket\sigma\rrbracket(\rho)\approx\llbracket\sigma\rrbracket(\rho)\in R_\Gamma
\qquad
\text{(reflexive; let }D_\Gamma\text{ be this witness)} [ [ σ ] ] ( ρ ) ≈ [ [ σ ] ] ( ρ ) ∈ R Γ (reflexive; let D Γ be this witness)
⟦ s [ σ ] ⟧ ( ρ ) ≈ ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) ∈ R I (outer-left vs inner-left of the four-value pattern of s ) \llbracket s[\sigma]\rrbracket(\rho)\approx\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho))\in R_I
\qquad
\text{(outer-left vs inner-left of the four-value pattern of }s\text{)} [ [ s [ σ ] ] ] ( ρ ) ≈ [ [ s ] ] ( [ [ σ ] ] ( ρ )) ∈ R I (outer-left vs inner-left of the four-value pattern of s )
⟦ S [ σ ] ⟧ ( ρ ) ≈ ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) ∈ U i (outer-left vs inner-left of the type part of s ) \llbracket S[\sigma]\rrbracket(\rho)\approx\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho))\in U_i
\qquad
\text{(outer-left vs inner-left of the type part of }s\text{)} [ [ S [ σ ] ] ] ( ρ ) ≈ [ [ S ] ] ( [ [ σ ] ] ( ρ )) ∈ U i (outer-left vs inner-left of the type part of s )
R I ⟺ R H Γ ( D Γ ) (by Theorem 6.12, both governed by ⟦ S [ σ ] ⟧ ( ρ ) ) R_I \Longleftrightarrow R_H^\Gamma(D_\Gamma)
\qquad
\text{(by Theorem 6.12, both governed by }\llbracket S[\sigma]\rrbracket(\rho)\text{)} R I ⟺ R H Γ ( D Γ ) (by Theorem 6.12, both governed by [ [ S [ σ ] ] ] ( ρ ) )
⟦ s [ σ ] ⟧ ( ρ ) ≈ ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) ∈ R H Γ ( D Γ ) (transferring across the biconditional) \llbracket s[\sigma]\rrbracket(\rho)\approx\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho))\in R_H^\Gamma(D_\Gamma)
\qquad
\text{(transferring across the biconditional)} [ [ s [ σ ] ] ] ( ρ ) ≈ [ [ s ] ] ( [ [ σ ] ] ( ρ )) ∈ R H Γ ( D Γ ) (transferring across the biconditional)
Apply Theorem 6.38 on Γ , x : S ⊢ T ≈ T : Ty i \Gamma,x:S\vdash T\approx T:\operatorname{Ty}_i Γ , x : S ⊢ T ≈ T : Ty i at this related pair:
⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , ⟦ s [ σ ] ⟧ ( ρ ) / x ) ) ≈ ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) / x ) ) ∈ U i . \llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\llbracket s[\sigma]\rrbracket(\rho)/x))
\approx
\llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho))/x))
\in U_i. [ [ T ] ] (( [ [ σ ] ] ( ρ ) , [ [ s [ σ ] ] ] ( ρ ) / x )) ≈ [ [ T ] ] (( [ [ σ ] ] ( ρ ) , [ [ s ] ] ( [ [ σ ] ] ( ρ )) / x )) ∈ U i .
Analogously on the primed side, bridging Pattern A’s inner-right and Pattern B’s inner-right:
⟦ T ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , ⟦ s ′ [ σ ′ ] ⟧ ( ρ ′ ) / x ) ) ≈ ⟦ T ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , ⟦ s ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) / x ) ) ∈ U i . \llbracket T\rrbracket((\llbracket\sigma'\rrbracket(\rho'),\llbracket s'[\sigma']\rrbracket(\rho')/x))
\approx
\llbracket T\rrbracket((\llbracket\sigma'\rrbracket(\rho'),\llbracket s'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))/x))
\in U_i. [ [ T ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , [ [ s ′ [ σ ′ ] ] ] ( ρ ′ ) / x )) ≈ [ [ T ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , [ [ s ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) / x )) ∈ U i .
Combining. By transitivity of U i ↘ R O ( D I ) U_i \mathbin{\searrow} R_O(D_I) U i ↘ R O ( D I ) through the bridges:
⟦ T ⟧ ( ρ ) ≈ ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , ⟦ s [ σ ] ⟧ ( ρ ) / x ) ) (Pattern A: outer-left vs inner-left) \llbracket T\rrbracket(\rho)
\approx
\llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\llbracket s[\sigma]\rrbracket(\rho)/x))
\qquad
\text{(Pattern A: outer-left vs inner-left)} [ [ T ] ] ( ρ ) ≈ [ [ T ] ] (( [ [ σ ] ] ( ρ ) , [ [ s [ σ ] ] ] ( ρ ) / x )) (Pattern A: outer-left vs inner-left)
⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , ⟦ s [ σ ] ⟧ ( ρ ) / x ) ) ≈ ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) / x ) ) (bridge above) \llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\llbracket s[\sigma]\rrbracket(\rho)/x))
\approx
\llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho))/x))
\qquad
\text{(bridge above)} [ [ T ] ] (( [ [ σ ] ] ( ρ ) , [ [ s [ σ ] ] ] ( ρ ) / x )) ≈ [ [ T ] ] (( [ [ σ ] ] ( ρ ) , [ [ s ] ] ( [ [ σ ] ] ( ρ )) / x )) (bridge above)
⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , ⟦ s ⟧ ( ⟦ σ ⟧ ( ρ ) ) / x ) ) ≈ ⟦ T [ s / x ] ⟧ ( ⟦ σ ⟧ ( ρ ) ) (Pattern B, with R O B ⟺ R O ( D I ) by Theorem 6.12) \llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\llbracket s\rrbracket(\llbracket\sigma\rrbracket(\rho))/x))
\approx
\llbracket T[s/x]\rrbracket(\llbracket\sigma\rrbracket(\rho))
\qquad
\text{(Pattern B, with }R_O^B\Longleftrightarrow R_O(D_I)\text{ by Theorem 6.12)} [ [ T ] ] (( [ [ σ ] ] ( ρ ) , [ [ s ] ] ( [ [ σ ] ] ( ρ )) / x )) ≈ [ [ T [ s / x ] ] ] ( [ [ σ ] ] ( ρ )) (Pattern B, with R O B ⟺ R O ( D I ) by Theorem 6.12)
Hence the goal’s outer-left ≈ \approx ≈ goal’s inner-left in U i ↘ R O ( D I ) \mathcal{U}_i \searrow R_O(D_I) U i ↘ R O ( D I ) . Analogously for outer-right ≈ \approx ≈ inner-right (using the primed bridge). Combined with Pattern A’s outer pair and Pattern B’s outer pair (which directly relate inner-left to inner-right in their respective four-value patterns), all four type values lie pairwise in U i ↘ R O ( D I ) \mathcal{U}_i \searrow R_O(D_I) U i ↘ R O ( D I ) . □ \square □
Before stating the fundamental lemma for elim N a t \operatorname{elim}_{\mathrm{Nat}} elim Nat , we extract the inductive core into two helpers (paralleling the simply-typed version’s rec-helper and rec-helper′). The first relates two unsubstituted recursions over Γ \Gamma Γ -environments (used for the inner pair of the four-value pattern). The second is one-sided: it bridges a substituted recursion on the left with an unsubstituted recursion on the right (used for the cross-relation between outer and inner positions).
Lemma 6.61 (Semantic recursion, unsubstituted). Suppose:
(1) Γ , x : N a t ⊢ T ≈ T ′ : T y i \Gamma, x : \mathrm{Nat} \vdash T \approx T' : \mathrm{Ty}_i Γ , x : Nat ⊢ T ≈ T ′ : Ty i ,
(2) Γ ⊢ z ≈ z ′ : T [ z e r o / x ] \Gamma\vdash z \approx z' : T[\mathrm{zero}/x] Γ ⊢ z ≈ z ′ : T [ zero / x ] ,
(3) Γ , x : N a t , y : T ⊢ s ≈ s ′ : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] \Gamma, x : \mathrm{Nat}, y : T \vdash s \approx s' : T[\mathord{\Uparrow} \circ\mathord{\Uparrow}, \mathrm{succ}\ x_1/x] Γ , x : Nat , y : T ⊢ s ≈ s ′ : T [ ⇑ ∘ ⇑ , succ x 1 / x ] ,
(4) Γ ≈ Γ ′ ↘ R Γ \Gamma\approx\Gamma' \searrow R_\Gamma Γ ≈ Γ ′ ↘ R Γ and ρ ≈ ρ ′ ∈ R Γ \rho\approx\rho' \in R_\Gamma ρ ≈ ρ ′ ∈ R Γ .
Then for every a ≈ a ′ ∈ N a t a \approx a' \in\mathrm{Nat} a ≈ a ′ ∈ Nat , there exist domain values b , b ′ b,b' b , b ′ with
rec ( a , T , z , s , ρ ) ↘ b , \operatorname{rec}(a,T,z,s,\rho) \searrow b, rec ( a , T , z , s , ρ ) ↘ b , rec ( a ′ , T ′ , z ′ , s ′ , ρ ′ ) ↘ b ′ , \operatorname{rec}(a',T',z',s',\rho') \searrow b', rec ( a ′ , T ′ , z ′ , s ′ , ρ ′ ) ↘ b ′ , and b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T , where R T R_T R T is determined by ⟦ T ⟧ ( ( ρ , a / x ) ) ≈ ⟦ T ′ ⟧ ( ( ρ ′ , a ′ / x ) ) ∈ U i ↘ R T \llbracket T\rrbracket((\rho,a/x)) \approx\llbracket T'\rrbracket((\rho',a'/x)) \in\mathcal{U}_i \searrow R_T [ [ T ] ] (( ρ , a / x )) ≈ [ [ T ′ ] ] (( ρ ′ , a ′ / x )) ∈ U i ↘ R T .
Symmetric/reflexive instances also follow: by symmetry and transitivity of the hypotheses (Theorem 6.41, Theorem 6.42), the lemma can be applied at T ≈ T T \approx T T ≈ T (using only T T T on both sides) when needed. Furthermore, this U i \mathcal{U}_i U i -relatedness of types holds.
Proof. We first establish the second claim.
( Γ , x : N a t ) ≈ ( Γ , x : N a t ) ↘ R Γ , x : N a t (by xref‘Theorem 6.51‘ on Γ ⊢ N a t ≈ N a t : T y 0 ) the head PER of R Γ , x : N a t is Nat (by U-Nat) ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ , x : N a t (by Ctx-Ext’s biconditional) ⟦ T ⟧ ( ( ρ , a / x ) ) ≈ ⟦ T ′ ⟧ ( ( ρ ′ , a ′ / x ) ) ∈ U i ↘ R T (by xref‘Theorem 6.38‘ on Γ , x : N a t ⊢ T ≈ T ′ : T y i ) \begin{aligned}
(\Gamma,x:\mathrm{Nat}) &\approx(\Gamma,x:\mathrm{Nat}) \searrow R_{\Gamma,x:\mathrm{Nat}} && \text{(by {xref}`Theorem 6.51` on }\Gamma\vdash\mathrm{Nat}\approx\mathrm{Nat}:\mathrm{Ty}_0\text{)}\\
\text{the head PER of }R_{\Gamma,x:\mathrm{Nat}} &\text{ is Nat} && \text{(by U-Nat)}\\
(\rho,a/x) &\approx(\rho',a'/x)\in R_{\Gamma,x:\mathrm{Nat}} && \text{(by Ctx-Ext’s biconditional)}\\
\llbracket T\rrbracket((\rho,a/x)) &\approx\llbracket T'\rrbracket((\rho',a'/x))\in\mathcal{U}_i\searrow R_T && \text{(by {xref}`Theorem 6.38` on }\Gamma,x:\mathrm{Nat}\vdash T\approx T':\mathrm{Ty}_i\text{)}
\end{aligned} ( Γ , x : Nat ) the head PER of R Γ , x : Nat ( ρ , a / x ) [ [ T ] ] (( ρ , a / x )) ≈ ( Γ , x : Nat ) ↘ R Γ , x : Nat is Nat ≈ ( ρ ′ , a ′ / x ) ∈ R Γ , x : Nat ≈ [ [ T ′ ] ] (( ρ ′ , a ′ / x )) ∈ U i ↘ R T (by xref ‘Theorem 6.51‘ on Γ ⊢ Nat ≈ Nat : Ty 0 ) (by U-Nat) (by Ctx-Ext’s biconditional) (by xref ‘Theorem 6.38‘ on Γ , x : Nat ⊢ T ≈ T ′ : Ty i )
for some R T R_T R T .
We prove the first claim by induction on a ≈ a ′ ∈ N a t a \approx a' \in\mathrm{Nat} a ≈ a ′ ∈ Nat .
Case
N a t - Z e z e ≈ z e ∈ N a t \begin{gathered}
\mathrm{Nat\text{-}Ze}\\
\hline
\mathrm{ze}\approx\mathrm{ze}\in\mathrm{Nat}
\end{gathered} Nat - Ze ze ≈ ze ∈ Nat
Here a = a ′ = z e a=a'=\mathrm{ze} a = a ′ = ze .
⟦ z ⟧ ( ρ ) ↘ b (some b , by termination via xref‘Theorem 6.38‘) ⟦ z ′ ⟧ ( ρ ′ ) ↘ b ′ (some b ′ ) rec ( z e , T , z , s , ρ ) ↘ b (by REC-ZE) rec ( z e , T ′ , z ′ , s ′ , ρ ′ ) ↘ b ′ (by REC-ZE) \begin{aligned}
\llbracket z\rrbracket(\rho)&\searrow b && \text{(some }b\text{, by termination via {xref}`Theorem 6.38`)}\\
\llbracket z'\rrbracket(\rho')&\searrow b' && \text{(some }b'\text{)}\\
\operatorname{rec}(\mathrm{ze},T,z,s,\rho)&\searrow b && \text{(by REC-ZE)}\\
\operatorname{rec}(\mathrm{ze},T',z',s',\rho')&\searrow b' && \text{(by REC-ZE)}
\end{aligned} [ [ z ] ] ( ρ ) [ [ z ′ ] ] ( ρ ′ ) rec ( ze , T , z , s , ρ ) rec ( ze , T ′ , z ′ , s ′ , ρ ′ ) ↘ b ↘ b ′ ↘ b ↘ b ′ (some b , by termination via xref ‘Theorem 6.38‘) (some b ′ ) (by REC-ZE) (by REC-ZE)
We must show b ≈ b ′ ∈ R T b\approx b'\in R_T b ≈ b ′ ∈ R T .
⟦ z ⟧ ( ρ ) ≈ ⟦ z ′ ⟧ ( ρ ′ ) ∈ R z (by xref‘Theorem 6.38‘) \llbracket z\rrbracket(\rho)\approx\llbracket z'\rrbracket(\rho')\in R_z
\qquad\text{(by {xref}`Theorem 6.38`)} [ [ z ] ] ( ρ ) ≈ [ [ z ′ ] ] ( ρ ′ ) ∈ R z (by xref ‘Theorem 6.38‘)
⟦ T [ z e r o / x ] ⟧ ( ρ ) ≈ ⟦ T ′ [ z e r o / x ] ⟧ ( ρ ′ ) ∈ U i ↘ R z (type part of xref‘Theorem 6.38‘) \llbracket T[\mathrm{zero}/x]\rrbracket(\rho)\approx\llbracket T'[\mathrm{zero}/x]\rrbracket(\rho')\in\mathcal{U}_i\searrow R_z
\qquad\text{(type part of {xref}`Theorem 6.38`)} [ [ T [ zero / x ] ] ] ( ρ ) ≈ [ [ T ′ [ zero / x ] ] ] ( ρ ′ ) ∈ U i ↘ R z (type part of xref ‘Theorem 6.38‘)
Hence b ≈ b ′ ∈ R z b \approx b' \in R_z b ≈ b ′ ∈ R z . We show R z ⇔ R T R_z \Leftrightarrow R_T R z ⇔ R T .
Γ ⊢ ( i d , z e r o / x ) ≈ ( i d , z e r o / x ) : Γ , x : N a t \Gamma\vdash(\mathrm{id},\mathrm{zero}/x) \approx(\mathrm{id},\mathrm{zero}/x) : \Gamma, x : \mathrm{Nat} Γ ⊢ ( id , zero / x ) ≈ ( id , zero / x ) : Γ , x : Nat (by Theorem 6.45 on id and Theorem 6.57)
⟦ T [ z e r o / x ] ⟧ ( ρ ) ≈ ⟦ T ⟧ ( ( ρ , z e / x ) ) ∈ U i \llbracket T[\mathrm{zero}/x]\rrbracket(\rho) \approx\llbracket T\rrbracket((\rho,\mathrm{ze}/x)) \in\mathcal{U}_i [ [ T [ zero / x ] ] ] ( ρ ) ≈ [ [ T ] ] (( ρ , ze / x )) ∈ U i (outer-vs-inner of T T T at ( i d , z e r o / x ) (\mathrm{id},\mathrm{zero}/x) ( id , zero / x ) , ρ ≈ ρ ′ \rho\approx\rho' ρ ≈ ρ ′ , using T [ i d , z e r o / x ] = T [ z e r o / x ] T[\mathrm{id},\mathrm{zero}/x] = T[\mathrm{zero}/x] T [ id , zero / x ] = T [ zero / x ] and ev-ze)
R z ⇔ R T R_z \Leftrightarrow R_T R z ⇔ R T (by Theorem 6.12)
Hence b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T .
Case
a 0 ≈ a 0 ′ ∈ N a t s u ( a 0 ) ≈ s u ( a 0 ′ ) ∈ N a t \begin{gathered}
a_0 \approx a'_0 \in\mathrm{Nat}\\
\hline
\mathrm{su}(a_0) \approx\mathrm{su}(a'_0) \in\mathrm{Nat}
\end{gathered} a 0 ≈ a 0 ′ ∈ Nat su ( a 0 ) ≈ su ( a 0 ′ ) ∈ Nat
with a = s u ( a 0 ) a = \mathrm{su}(a_0) a = su ( a 0 ) , a ′ = s u ( a 0 ′ ) a' = \mathrm{su}(a'_0) a ′ = su ( a 0 ′ ) . By IH on a 0 ≈ a 0 ′ a_0 \approx a'_0 a 0 ≈ a 0 ′ , there exist b 0 , b 0 ′ b_0,b'_0 b 0 , b 0 ′ with
rec ( a 0 , T , z , s , ρ ) ↘ b 0 \operatorname{rec}(a_0,T,z,s,\rho) \searrow b_0 rec ( a 0 , T , z , s , ρ ) ↘ b 0
(by IH)
rec ( a 0 ′ , T ′ , z ′ , s ′ , ρ ′ ) ↘ b 0 ′ \operatorname{rec}(a'_0,T',z',s',\rho') \searrow b'_0 rec ( a 0 ′ , T ′ , z ′ , s ′ , ρ ′ ) ↘ b 0 ′
(by IH)
b 0 ≈ b 0 ′ ∈ R T 0 b_0 \approx b'_0 \in R_T^0 b 0 ≈ b 0 ′ ∈ R T 0 (by IH, with R T 0 R_T^0 R T 0 governed by ⟦ T ⟧ ( ( ρ , a 0 / x ) ) \llbracket T\rrbracket((\rho,a_0/x)) [ [ T ] ] (( ρ , a 0 / x )) )
By REC-SU:
⟦ s ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ↘ b \llbracket s\rrbracket((\rho,a_0/x,b_0/y)) \searrow b [ [ s ] ] (( ρ , a 0 / x , b 0 / y )) ↘ b
(some b b b )
⟦ s ′ ⟧ ( ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) ) ↘ b ′ \llbracket s'\rrbracket((\rho',a'_0/x,b'_0/y)) \searrow b' [ [ s ′ ] ] (( ρ ′ , a 0 ′ / x , b 0 ′ / y )) ↘ b ′
(some b ′ b' b ′ )
rec ( s u ( a 0 ) , T , z , s , ρ ) ↘ b \operatorname{rec}(\mathrm{su}(a_0),T,z,s,\rho) \searrow b rec ( su ( a 0 ) , T , z , s , ρ ) ↘ b
(by REC-SU)
rec ( s u ( a 0 ′ ) , T ′ , z ′ , s ′ , ρ ′ ) ↘ b ′ \operatorname{rec}(\mathrm{su}(a'_0),T',z',s',\rho') \searrow b' rec ( su ( a 0 ′ ) , T ′ , z ′ , s ′ , ρ ′ ) ↘ b ′
(by REC-SU)
We must show b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T . Build the env-pair in R Γ , x : N a t , y : T R_{\Gamma,x:\mathrm{Nat},y:T} R Γ , x : Nat , y : T :
( ρ , a 0 / x ) ≈ ( ρ ′ , a 0 ′ / x ) ∈ R Γ , x : N a t (\rho,a_0/x) \approx(\rho',a'_0/x) \in R_{\Gamma,x:\mathrm{Nat}} ( ρ , a 0 / x ) ≈ ( ρ ′ , a 0 ′ / x ) ∈ R Γ , x : Nat (by CTX-EXT, head PER Nat)
( ρ , a 0 / x , b 0 / y ) ≈ ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) (\rho,a_0/x,b_0/y) \approx(\rho',a'_0/x,b'_0/y) ( ρ , a 0 / x , b 0 / y ) ≈ ( ρ ′ , a 0 ′ / x , b 0 ′ / y )
∈ R Γ , x : N a t , y : T \in R_{\Gamma,x:\mathrm{Nat},y:T} ∈ R Γ , x : Nat , y : T (by CTX-EXT, head PER R T 0 R_T^0 R T 0 )
Apply Theorem 6.38 on Γ , x : N a t , y : T ⊢ s ≈ s ′ : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] \Gamma,x:\mathrm{Nat},y:T \vdash s \approx s' : T[\mathord{\Uparrow}\circ\mathord{\Uparrow},\mathrm{succ}\ x_1/x] Γ , x : Nat , y : T ⊢ s ≈ s ′ : T [ ⇑ ∘ ⇑ , succ x 1 / x ] at this env-pair:
⟦ T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ⟦ T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] ⟧ ( ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) ) ∈ U i ↘ R s \llbracket T[\mathord{\Uparrow}\circ\mathord{\Uparrow},\mathrm{succ}\ x_1/x]\rrbracket((\rho,a_0/x,b_0/y))
\approx
\llbracket T[\mathord{\Uparrow}\circ\mathord{\Uparrow},\mathrm{succ}\ x_1/x]\rrbracket((\rho',a'_0/x,b'_0/y))
\in\mathcal{U}_i \searrow R_s [ [ T [ ⇑ ∘ ⇑ , succ x 1 / x ] ] ] (( ρ , a 0 / x , b 0 / y )) ≈ [ [ T [ ⇑ ∘ ⇑ , succ x 1 / x ] ] ] (( ρ ′ , a 0 ′ / x , b 0 ′ / y )) ∈ U i ↘ R s
(type part of Theorem 6.38)
⟦ s ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ⟦ s ′ ⟧ ( ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) ) ∈ R s \llbracket s\rrbracket((\rho,a_0/x,b_0/y))
\approx
\llbracket s'\rrbracket((\rho',a'_0/x,b'_0/y))
\in R_s [ [ s ] ] (( ρ , a 0 / x , b 0 / y )) ≈ [ [ s ′ ] ] (( ρ ′ , a 0 ′ / x , b 0 ′ / y )) ∈ R s
(term part of Theorem 6.38)
where R s R_s R s is the PER governed by
⟦ T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) . \llbracket T[\mathord{\Uparrow}\circ\mathord{\Uparrow},\mathrm{succ}\ x_1/x]\rrbracket((\rho,a_0/x,b_0/y)). [ [ T [ ⇑ ∘ ⇑ , succ x 1 / x ] ] ] (( ρ , a 0 / x , b 0 / y )) .
Hence b ≈ b ′ ∈ R s b \approx b' \in R_s b ≈ b ′ ∈ R s .
We show R s ⇔ R T R_s \Leftrightarrow R_T R s ⇔ R T by instantiating hypothesis on T T T at the substitution τ : = ( ⇑ ∘ ⇑ , s u c c x 1 / x ) \tau:= (\mathord{\Uparrow}\circ\mathord{\Uparrow},\mathrm{succ}\ x_1/x) τ := ( ⇑ ∘ ⇑ , succ x 1 / x ) over Γ , x : N a t , y : T \Gamma,x:\mathrm{Nat},y:T Γ , x : Nat , y : T (mapping into Γ , x : N a t \Gamma,x:\mathrm{Nat} Γ , x : Nat ). Semantic well-formedness of τ \tau τ :
Γ , x : N a t , y : T ⊢ ⇑ ∘ ⇑ ≈ ⇑ ∘ ⇑ : Γ \Gamma,x:\mathrm{Nat},y:T \vdash\mathord{\Uparrow}\circ\mathord{\Uparrow} \approx\mathord{\Uparrow}\circ\mathord{\Uparrow} : \Gamma Γ , x : Nat , y : T ⊢ ⇑ ∘ ⇑ ≈ ⇑ ∘ ⇑ : Γ (by Theorem 6.28 (twice), Theorem 6.29, and Theorem 6.35)
Γ , x : N a t , y : T ⊢ x 1 ≈ x 1 : N a t \Gamma,x:\mathrm{Nat},y:T \vdash x_1 \approx x_1 : \mathrm{Nat} Γ , x : Nat , y : T ⊢ x 1 ≈ x 1 : Nat (by Theorem 6.56, lookup x 1 : N a t [ ⇑ ] = N a t x_1 : \mathrm{Nat}[\mathord{\Uparrow}] = \mathrm{Nat} x 1 : Nat [ ⇑ ] = Nat )
Γ , x : N a t , y : T ⊢ s u c c x 1 ≈ s u c c x 1 : N a t \Gamma,x:\mathrm{Nat},y:T \vdash\mathrm{succ}\ x_1 \approx\mathrm{succ}\ x_1 : \mathrm{Nat} Γ , x : Nat , y : T ⊢ succ x 1 ≈ succ x 1 : Nat (by Theorem 6.58) Γ , x : N a t , y : T ⊨ τ ≈ τ : Γ , x : N a t \Gamma, x : \mathrm{Nat}, y : T \models\tau\approx\tau: \Gamma, x : \mathrm{Nat} Γ , x : Nat , y : T ⊨ τ ≈ τ : Γ , x : Nat (by Theorem 6.45)
Apply Γ , x : N a t ⊨ T ≈ T : T y i \Gamma, x : \mathrm{Nat} \models T \approx T : \mathrm{Ty}_i Γ , x : Nat ⊨ T ≈ T : Ty i at Γ , x : N a t , y : T \Gamma, x : \mathrm{Nat}, y : T Γ , x : Nat , y : T , τ ≈ τ \tau\approx\tau τ ≈ τ , and the env-pair ( ρ , a 0 / x , b 0 / y ) ≈ ( ρ , a 0 / x , b 0 / y ) ∈ R Γ , x : N a t , y : T (\rho, a_0/x, b_0/y) \approx(\rho, a_0/x, b_0/y) \in R_{\Gamma,x:\mathrm{Nat},y:T} ( ρ , a 0 / x , b 0 / y ) ≈ ( ρ , a 0 / x , b 0 / y ) ∈ R Γ , x : Nat , y : T (reflexive):
⟦ T [ τ ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ⟦ T ⟧ ( ⟦ τ ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ) ∈ U i ↘ R ′ \llbracket T[\tau]\rrbracket((\rho, a_0/x, b_0/y)) \approx\llbracket T\rrbracket(\llbracket\tau\rrbracket((\rho, a_0/x, b_0/y))) \in\mathcal{U}_i \mathbin{\searrow} R' [ [ T [ τ ] ] ] (( ρ , a 0 / x , b 0 / y )) ≈ [ [ T ] ] ( [ [ τ ] ] (( ρ , a 0 / x , b 0 / y ))) ∈ U i ↘ R ′
(outer-left vs inner-left)
⟦ τ ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) = ( ρ , su ( a 0 ) / x ) \llbracket\tau\rrbracket((\rho, a_0/x, b_0/y)) = (\rho, \operatorname{su}(a_0)/x) [ [ τ ] ] (( ρ , a 0 / x , b 0 / y )) = ( ρ , su ( a 0 ) / x )
(by pointwise eval: ⇑ ∘ ⇑ \Uparrow\circ\Uparrow ⇑ ∘ ⇑ projects to ρ \rho ρ , succ x 1 x_1 x 1 evaluates to su ( a 0 ) \operatorname{su}(a_0) su ( a 0 ) via ev-su, ev-var)
Hence:
⟦ T [ ⇑ ∘ ⇑ , succ x 1 / x ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ⟦ T ⟧ ( ( ρ , su ( a 0 ) / x ) ) ∈ U i ↘ R ′ \llbracket T[\Uparrow\circ\Uparrow,\operatorname{succ}\ x_1/x]\rrbracket((\rho, a_0/x, b_0/y)) \approx\llbracket T\rrbracket((\rho,\operatorname{su}(a_0)/x)) \in\mathcal{U}_i \mathbin{\searrow} R' [ [ T [ ⇑ ∘ ⇑ , succ x 1 / x ] ] ] (( ρ , a 0 / x , b 0 / y )) ≈ [ [ T ] ] (( ρ , su ( a 0 ) / x )) ∈ U i ↘ R ′
(by the above)
Combining with the second claim ⟦ T ⟧ ( ( ρ , su ( a 0 ) / x ) ) ≈ ⟦ T ⟧ ( ( ρ ′ , su ( a 0 ′ ) / x ) ) ∈ U i ↘ R T \llbracket T\rrbracket((\rho,\operatorname{su}(a_0)/x)) \approx\llbracket T\rrbracket((\rho',\operatorname{su}(a'_0)/x)) \in\mathcal{U}_i \mathbin{\searrow} R_T [ [ T ] ] (( ρ , su ( a 0 ) / x )) ≈ [ [ T ] ] (( ρ ′ , su ( a 0 ′ ) / x )) ∈ U i ↘ R T (applied at su ( a 0 ) ≈ su ( a 0 ′ ) \operatorname{su}(a_0) \approx\operatorname{su}(a'_0) su ( a 0 ) ≈ su ( a 0 ′ ) ):
R s ⇔ R ′ ⇔ R T R_s \Leftrightarrow R' \Leftrightarrow R_T R s ⇔ R ′ ⇔ R T
(by Theorem 6.12 on shared values)
Hence b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T .
Case
Nat-Ne e ≈ e ′ ∈ N e e \approx e' \in\mathrm{Ne} e ≈ e ′ ∈ Ne ⇑ N ( e ) ≈ ⇑ N ( e ′ ) ∈ N a t \Uparrow^{N}(e) \approx\Uparrow^{N}(e') \in\mathrm{Nat} ⇑ N ( e ) ≈ ⇑ N ( e ′ ) ∈ Nat
with a = ⇑ N ( e ) a = \Uparrow^{N}(e) a = ⇑ N ( e ) , a ′ = ⇑ N ( e ′ ) a' = \Uparrow^{N}(e') a ′ = ⇑ N ( e ′ ) . Compute the eliminator outputs by rec-ne:
⟦ T ⟧ ( ( ρ , ⇑ N ( e ) / x ) ) ↘ A \llbracket T\rrbracket((\rho,\Uparrow^{N}(e)/x)) \mathbin{\searrow} A [ [ T ] ] (( ρ , ⇑ N ( e ) / x )) ↘ A
(by the second claim, governing R T R_T R T )
⟦ T ⟧ ( ( ρ ′ , ⇑ N ( e ′ ) / x ) ) ↘ A ′ \llbracket T\rrbracket((\rho',\Uparrow^{N}(e')/x)) \mathbin{\searrow} A' [ [ T ] ] (( ρ ′ , ⇑ N ( e ′ ) / x )) ↘ A ′
(analogously)
A ≈ A ′ ∈ U i ↘ R T A \approx A' \in\mathcal{U}_i \mathbin{\searrow} R_T A ≈ A ′ ∈ U i ↘ R T
(by the second claim at ⇑ N ( e ) ≈ ⇑ N ( e ′ ) \Uparrow^{N}(e) \approx\Uparrow^{N}(e') ⇑ N ( e ) ≈ ⇑ N ( e ′ ) )
⟦ z ⟧ ( ρ ) ↘ a z , ⟦ z ′ ⟧ ( ρ ′ ) ↘ a z ′ , a z ≈ a z ′ ∈ R z \llbracket z\rrbracket(\rho) \mathbin{\searrow} a_z,\quad\llbracket z'\rrbracket(\rho') \mathbin{\searrow} a'_z,\quad a_z \approx a'_z \in R_z [ [ z ] ] ( ρ ) ↘ a z , [ [ z ′ ] ] ( ρ ′ ) ↘ a z ′ , a z ≈ a z ′ ∈ R z
(by Theorem 6.38 on Γ ⊢ z ≈ z ′ : T [ z e r o / x ] \Gamma\vdash z \approx z' : T[\mathrm{zero}/x] Γ ⊢ z ≈ z ′ : T [ zero / x ] )
b = ⇑ A ( rec ( T , a z , s , ρ , e ) ) b = \Uparrow^{A}(\operatorname{rec}(T,a_z,s,\rho,e)) b = ⇑ A ( rec ( T , a z , s , ρ , e ))
(by rec-ne)
b ′ = ⇑ A ′ ( rec ( T , a z ′ , s ′ , ρ ′ , e ′ ) ) b' = \Uparrow^{A'}(\operatorname{rec}(T,a'_z,s',\rho',e')) b ′ = ⇑ A ′ ( rec ( T , a z ′ , s ′ , ρ ′ , e ′ ))
(by rec-ne)
We must show b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T . By Item 2 on A ≈ A ′ ∈ U i ↘ R T A \approx A' \in\mathcal{U}_i \mathbin{\searrow} R_T A ≈ A ′ ∈ U i ↘ R T , it suffices to show
rec ( T , a z , s , ρ , e ) ≈ rec ( T , a z ′ , s ′ , ρ ′ , e ′ ) ∈ N e , \operatorname{rec}(T,a_z,s,\rho,e) \approx\operatorname{rec}(T,a'_z,s',\rho',e') \in\mathrm{Ne}, rec ( T , a z , s , ρ , e ) ≈ rec ( T , a z ′ , s ′ , ρ ′ , e ′ ) ∈ Ne ,
i.e. for every depth n n n both sides read back via R n N e R^{\mathrm{Ne}}_n R n Ne to the same neutral normal form. By rule RE-REC:
R n N e ( rec ( T , a z , s , ρ , e ) ) ↘ elim N a t ( x . W T ) w z ( x , y . w s ) u R^{\mathrm{Ne}}_n(\operatorname{rec}(T,a_z,s,\rho,e)) \mathbin{\searrow} \operatorname{elim}_{\mathrm{Nat}}(x.W_T)\ w_z\ (x,y.w_s)\ u R n Ne ( rec ( T , a z , s , ρ , e )) ↘ elim Nat ( x . W T ) w z ( x , y . w s ) u
whenever
R n + 1 T y ( A x ) ↘ W T R^{\mathrm{Ty}}_{n+1}(A_x) \mathbin{\searrow} W_T R n + 1 Ty ( A x ) ↘ W T
where ⟦ T ⟧ ( ( ρ , ⇑ N ( ℓ n ) / x ) ) ↘ A x \llbracket T\rrbracket((\rho,\Uparrow^{N}(\ell_n)/x)) \mathbin{\searrow} A_x [ [ T ] ] (( ρ , ⇑ N ( ℓ n ) / x )) ↘ A x
R n N f ( ↓ A z ( a z ) ) ↘ w z R^{\mathrm{Nf}}_n(\downarrow^{A_z}(a_z)) \mathbin{\searrow} w_z R n Nf ( ↓ A z ( a z )) ↘ w z
where ⟦ T ⟧ ( ( ρ , z e / x ) ) ↘ A z \llbracket T\rrbracket((\rho,\mathrm{ze}/x)) \mathbin{\searrow} A_z [ [ T ] ] (( ρ , ze / x )) ↘ A z
⟦ s ⟧ ( ( ρ , ⇑ N ( ℓ n ) / x , ⇑ A x ( ℓ n + 1 ) / y ) ) ↘ b s \llbracket s\rrbracket((\rho,\Uparrow^{N}(\ell_n)/x,\Uparrow^{A_x}(\ell_{n+1})/y)) \mathbin{\searrow} b_s [ [ s ] ] (( ρ , ⇑ N ( ℓ n ) / x , ⇑ A x ( ℓ n + 1 ) / y )) ↘ b s
R n + 2 N f ( ↓ A x s u c c ( b s ) ) ↘ w s R^{\mathrm{Nf}}_{n+2}(\downarrow^{A_x^{\mathrm{succ}}}(b_s)) \mathbin{\searrow} w_s R n + 2 Nf ( ↓ A x succ ( b s )) ↘ w s
where ⟦ T ⟧ ( ( ρ , su ( ⇑ N ( ℓ n ) ) / x ) ) ↘ A x s u c c \llbracket T\rrbracket((\rho,\operatorname{su}(\Uparrow^{N}(\ell_n))/x)) \mathbin{\searrow} A_x^{\mathrm{succ}} [ [ T ] ] (( ρ , su ( ⇑ N ( ℓ n )) / x )) ↘ A x succ
R n N e ( e ) ↘ u R^{\mathrm{Ne}}_n(e) \mathbin{\searrow} u R n Ne ( e ) ↘ u
(and analogously for the primed side, producing elim N a t ( x . W T ′ ) w z ′ ( x , y . w s ′ ) u ′ \operatorname{elim}_{\mathrm{Nat}}(x.W'_T)\ w'_z\ (x,y.w'_s)\ u' elim Nat ( x . W T ′ ) w z ′ ( x , y . w s ′ ) u ′ ). We show each component reads back to the same syntactic form. Motive W T = W T ′ W_T = W'_T W T = W T ′ . Apply Γ , x : N a t ⊢ T ≈ T ′ : T y i \Gamma, x : \mathrm{Nat} \vdash T \approx T' : \mathrm{Ty}_i Γ , x : Nat ⊢ T ≈ T ′ : Ty i at the env-pair extended with the fresh level ℓ n \ell_n ℓ n :
↑ N ( ℓ n ) ≈ ↑ N ( ℓ n ) ∈ N a t (by Nat-Ne, ℓ n ≈ ℓ n ∈ N e ) \uparrow^{N}(\ell_{n}) \approx\uparrow^{N}(\ell_{n}) \in\mathrm{Nat}
\qquad\text{(by Nat-Ne, }\ell_{n} \approx\ell_{n} \in\mathrm{Ne}\text{)} ↑ N ( ℓ n ) ≈ ↑ N ( ℓ n ) ∈ Nat (by Nat-Ne, ℓ n ≈ ℓ n ∈ Ne )
( ρ , ↑ N ( ℓ n ) / x ) ≈ ( ρ ′ , ↑ N ( ℓ n ) / x ) ∈ R Γ , x : N a t (by Ctx-Ext) (\rho, \uparrow^{N}(\ell_n)/x) \approx(\rho', \uparrow^{N}(\ell_n)/x) \in R_{\Gamma,x:\mathrm{Nat}}
\qquad\text{(by Ctx-Ext)} ( ρ , ↑ N ( ℓ n ) / x ) ≈ ( ρ ′ , ↑ N ( ℓ n ) / x ) ∈ R Γ , x : Nat (by Ctx-Ext)
⟦ T ⟧ ( ( ρ , ↑ N ( ℓ n ) / x ) ) ≈ ⟦ T ⟧ ( ( ρ ′ , ↑ N ( ℓ n ) / x ) ) ∈ U i ↘ R T ℓ (by Theorem 6.38) \llbracket T \rrbracket((\rho, \uparrow^{N}(\ell_n)/x)) \approx\llbracket T \rrbracket((\rho', \uparrow^{N}(\ell_n)/x)) \in\mathcal{U}_i \searrow R_T^{\ell}
\qquad\text{(by Theorem 6.38)} [ [ T ] ] (( ρ , ↑ N ( ℓ n ) / x )) ≈ [ [ T ] ] (( ρ ′ , ↑ N ( ℓ n ) / x )) ∈ U i ↘ R T ℓ (by Theorem 6.38)
W T = W T ′ (by Item 3) W_T = W'_T
\qquad\text{(by Item 3)} W T = W T ′ (by Item 3)
Zero branch w z = w z ′ w_z = w'_z w z = w z ′ . Apply Γ ⊢ z ≈ z ′ : T [ z e r o / x ] \Gamma\vdash z \approx z' : T[\mathrm{zero}/x] Γ ⊢ z ≈ z ′ : T [ zero / x ] at Γ \Gamma Γ , id, and ρ ≈ ρ ′ ∈ R Γ \rho\approx\rho' \in R_\Gamma ρ ≈ ρ ′ ∈ R Γ (term and type parts):
⟦ T ⟧ ( ρ ) ≈ ⟦ T [ z e r o / x ] ⟧ ( ρ ′ ) ∈ U i ↘ R z (type part) \llbracket T \rrbracket(\rho) \approx\llbracket T[\mathrm{zero}/x] \rrbracket(\rho') \in\mathcal{U}_i \searrow R_z
\qquad\text{(type part)} [ [ T ] ] ( ρ ) ≈ [ [ T [ zero / x ] ] ] ( ρ ′ ) ∈ U i ↘ R z (type part)
⟦ z [ i d ] ⟧ ( ρ ) ≈ ⟦ z ′ ⟧ ( ρ ′ ) ∈ R z (term part) \llbracket z[\mathrm{id}] \rrbracket(\rho) \approx\llbracket z' \rrbracket(\rho') \in R_z
\qquad\text{(term part)} [ [ z [ id ] ] ] ( ρ ) ≈ [ [ z ′ ] ] ( ρ ′ ) ∈ R z (term part)
a z ≈ a z ′ ∈ R z (using z [ i d ] = z , z ′ [ i d ] = z ′ ) a_{z} \approx a'_{z} \in R_{z}
\qquad\text{(using }z[\mathrm{id}] = z,\ z'[\mathrm{id}] = z'\text{)} a z ≈ a z ′ ∈ R z (using z [ id ] = z , z ′ [ id ] = z ′ )
Bridge R z ⇔ R T R_z \Leftrightarrow R_T R z ⇔ R T -at-ze via the same outer-vs-inner pattern as the Nat-Ze case (instantiate T T T at ( i d , z e r o / x ) (\mathrm{id}, \mathrm{zero}/x) ( id , zero / x ) ). By Item 1 on a z ≈ a z ′ ∈ R T a_z \approx a'_z \in R_T a z ≈ a z ′ ∈ R T -at-ze:
w z = w z ′ (by Item 1) w_z = w'_z
\qquad\text{(by Item 1)} w z = w z ′ (by Item 1)
Step branch w s = w s ′ w_s = w'_s w s = w s ′ . Build the env-pair at fresh levels:
( ρ , ↑ N ( ℓ n ) / x ) ≈ ( ρ ′ , ↑ N ( ℓ n ) / x ) ∈ R Γ , x : N a t (as above) (\rho, \uparrow^{N}(\ell_n)/x) \approx(\rho', \uparrow^{N}(\ell_n)/x) \in R_{\Gamma,x:\mathrm{Nat}}
\qquad\text{(as above)} ( ρ , ↑ N ( ℓ n ) / x ) ≈ ( ρ ′ , ↑ N ( ℓ n ) / x ) ∈ R Γ , x : Nat (as above)
( ρ , ↑ N ( ℓ n ) / x , ↑ A x ( ℓ n + 1 ) / y ) ≈ ( ρ ′ , ↑ N ( ℓ n ) / x , ↑ A x ( ℓ n + 1 ) / y ) ∈ R Γ , x : N a t , y : T (\rho, \uparrow^{N}(\ell_n)/x, \uparrow^{A^x}(\ell_{n+1})/y) \approx
(\rho', \uparrow^{N}(\ell_n)/x, \uparrow^{A^{x}}(\ell_{n+1})/y)
\in R_{\Gamma,x:\mathrm{Nat},y:T} ( ρ , ↑ N ( ℓ n ) / x , ↑ A x ( ℓ n + 1 ) / y ) ≈ ( ρ ′ , ↑ N ( ℓ n ) / x , ↑ A x ( ℓ n + 1 ) / y ) ∈ R Γ , x : Nat , y : T
(by Ctx-Ext, head PER R T ℓ R_T^\ell R T ℓ ; ↑ A x ( ℓ n + 1 ) ≈ ↑ A ′ x ( ℓ n + 1 ) ∈ R T ℓ \uparrow^{A^x}(\ell_{n+1}) \approx\uparrow^{A'^{x}}(\ell_{n+1}) \in R_T^\ell ↑ A x ( ℓ n + 1 ) ≈ ↑ A ′ x ( ℓ n + 1 ) ∈ R T ℓ by Item 2)
Apply Γ , x : N a t , y : T ⊢ s ≈ s ′ : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] \Gamma, x : \mathrm{Nat}, y : T \vdash s \approx s' : T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x] Γ , x : Nat , y : T ⊢ s ≈ s ′ : T [ ⇑ ∘ ⇑ , succ x 1 / x ] at this env-pair (term and type parts, after bridging T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x] T [ ⇑ ∘ ⇑ , succ x 1 / x ] to T T T at s u ( ↑ N ( ℓ n ) ) / x \mathrm{su}(\uparrow^{N}(\ell_n))/x su ( ↑ N ( ℓ n )) / x as in the Nat-Su case):
b s ≈ b s ′ ∈ R T -at-su ( ↑ N ( ℓ n ) ) (by Theorem 6.38 and bridging) b_s \approx b'_s \in R_T\text{-at-su}(\uparrow^{N}(\ell_n))
\qquad\text{(by Theorem 6.38 and bridging)} b s ≈ b s ′ ∈ R T -at-su ( ↑ N ( ℓ n )) (by Theorem 6.38 and bridging)
By Item 1:
w s = w s ′ (by Item 1) w_s = w'_s
\qquad\text{(by Item 1)} w s = w s ′ (by Item 1)
Underlying neutral u = u ′ u = u' u = u ′ . By hypothesis e ≈ e ′ ∈ N e e \approx e' \in\mathrm{Ne} e ≈ e ′ ∈ Ne :
R n N e ( e ) ↘ u , R n N e ( e ′ ) ↘ u (by definition of Ne) R_n^{\mathrm{Ne}}(e) \searrow u,\qquad R_n^{\mathrm{Ne}}(e') \searrow u
\qquad\text{(by definition of Ne)} R n Ne ( e ) ↘ u , R n Ne ( e ′ ) ↘ u (by definition of Ne)
Combining:
R n N e ( rec ( T , a z , s , ρ , e ) ) ↘ elim N a t ( x . W T ) w z ( x , y . w s ) u R_n^{\mathrm{Ne}}(\operatorname{rec}(T,a_z,s,\rho,e))
\searrow\operatorname{elim}_{\mathrm{Nat}}(x.W_T)\ w_z\ (x,y.w_s)\ u R n Ne ( rec ( T , a z , s , ρ , e )) ↘ elim Nat ( x . W T ) w z ( x , y . w s ) u
R n N e ( rec ( T , a z ′ , s ′ , ρ ′ , e ′ ) ) ↘ elim N a t ( x . W T ) w z ( x , y . w s ) u (same syntactic form) R_n^{\mathrm{Ne}}(\operatorname{rec}(T,a'_z,s',\rho',e'))
\searrow\operatorname{elim}_{\mathrm{Nat}}(x.W_T)\ w_z\ (x,y.w_s)\ u
\qquad\text{(same syntactic form)} R n Ne ( rec ( T , a z ′ , s ′ , ρ ′ , e ′ )) ↘ elim Nat ( x . W T ) w z ( x , y . w s ) u (same syntactic form)
rec ( T , a z , s , ρ , e ) ≈ rec ( T , a z ′ , s ′ , ρ ′ , e ′ ) ∈ N e (by definition of Ne) \operatorname{rec}(T,a_z,s,\rho,e) \approx\operatorname{rec}(T,a'_z,s',\rho',e') \in\mathrm{Ne}
\qquad\text{(by definition of Ne)} rec ( T , a z , s , ρ , e ) ≈ rec ( T , a z ′ , s ′ , ρ ′ , e ′ ) ∈ Ne (by definition of Ne)
Hence b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T . □ \square □
The second helper handles the one-sided substituted form: substitution applied to the motive and branches on the left, but not on the right.
Lemma 6.62 (Semantic recursion, one-sided substituted). Suppose:
(1) Γ , x : N a t ⊢ T ≈ T ′ : T y i \Gamma, x : \mathrm{Nat} \vdash T \approx T' : \mathrm{Ty}_i Γ , x : Nat ⊢ T ≈ T ′ : Ty i ,
(2) Γ ⊢ z ≈ z ′ : T [ z e r o / x ] , \Gamma\vdash z \approx z' : T[\mathsf{zero}/x], Γ ⊢ z ≈ z ′ : T [ zero / x ] ,
(3) Γ , x : N a t , y : T ⊢ s ≈ s ′ : T [ ↑ ∘ ↑ , s u c c x 1 / x ] , \Gamma, x : \mathsf{Nat}, y : T \vdash s \approx s' : T[\mathord{\uparrow} \circ\mathord{\uparrow},\mathsf{succ}\ x_1/x], Γ , x : Nat , y : T ⊢ s ≈ s ′ : T [ ↑ ∘ ↑ , succ x 1 / x ] ,
(4) Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ , and ρ ≈ ρ ′ ∈ R ′ . \Gamma' \approx\Gamma' \searrow R',\ \Gamma' \vdash\sigma\approx\sigma' : \Gamma,\ \text{and }\rho\approx\rho' \in R'. Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ , and ρ ≈ ρ ′ ∈ R ′ .
Then for every a ≈ a ′ ∈ N a t a \approx a' \in\mathsf{Nat} a ≈ a ′ ∈ Nat , there exist domain values b , b ′ b,b' b , b ′ with
rec ( a , T [ q ( σ ) ] , z [ σ ] , s [ q 2 ( σ ) ] , ρ ) ↘ b (substituted, left) rec ( a ′ , T ′ , z ′ , s ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) ↘ b ′ (unsubstituted, right) \begin{aligned}
\operatorname{rec}(a,T[q(\sigma)],z[\sigma],s[q^2(\sigma)],\rho)&\searrow b &&\text{(substituted, left)}\\
\operatorname{rec}(a',T',z',s',\llbracket\sigma'\rrbracket(\rho'))&\searrow b' &&\text{(unsubstituted, right)}
\end{aligned} rec ( a , T [ q ( σ )] , z [ σ ] , s [ q 2 ( σ )] , ρ ) rec ( a ′ , T ′ , z ′ , s ′ , [ [ σ ′ ] ] ( ρ ′ )) ↘ b ↘ b ′ (substituted, left) (unsubstituted, right)
and b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T , where R T R_T R T is determined by ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) ≈ ⟦ T ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) ∈ U i ↘ R T \llbracket T[q(\sigma)]\rrbracket((\rho,a/x)) \approx\llbracket T'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x)) \in\mathcal{U}_i \searrow R_T [ [ T [ q ( σ )] ] ] (( ρ , a / x )) ≈ [ [ T ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) ∈ U i ↘ R T . Furthermore, this U i \mathcal{U}_i U i -relatedness of types holds.
Proof. We first establish the lifted substitution and the second claim.
Γ ′ , x : N a t ⊢ q ( σ ) ≈ q ( σ ′ ) : Γ , x : N a t (by Theorem 6.47 on σ ≈ σ ′ and Nat, using N a t [ σ ] = N a t ) \Gamma',x:\mathsf{Nat} \vdash q(\sigma) \approx q(\sigma') : \Gamma,x:\mathsf{Nat}\qquad\text{(by Theorem 6.47 on }\sigma\approx\sigma'\text{ and Nat, using }\mathsf{Nat}[\sigma]=\mathsf{Nat}\text{)} Γ ′ , x : Nat ⊢ q ( σ ) ≈ q ( σ ′ ) : Γ , x : Nat (by Theorem 6.47 on σ ≈ σ ′ and Nat, using Nat [ σ ] = Nat )
( Γ ′ , x : N a t ) ≈ ( Γ ′ , x : N a t ) ↘ R Γ ′ , x : N a t (carried by the lifted substitution) (\Gamma',x:\mathsf{Nat}) \approx(\Gamma',x:\mathsf{Nat}) \searrow R_{\Gamma',x:\mathsf{Nat}}
\qquad\text{(carried by the lifted substitution)} ( Γ ′ , x : Nat ) ≈ ( Γ ′ , x : Nat ) ↘ R Γ ′ , x : Nat (carried by the lifted substitution)
( Γ , x : N a t ) ≈ ( Γ , x : N a t ) ↘ R Γ , x : N a t (carried by the lifted substitution) (\Gamma,x:\mathsf{Nat}) \approx(\Gamma,x:\mathsf{Nat}) \searrow R_{\Gamma,x:\mathsf{Nat}}
\qquad\text{(carried by the lifted substitution)} ( Γ , x : Nat ) ≈ ( Γ , x : Nat ) ↘ R Γ , x : Nat (carried by the lifted substitution)
both head PERs are N a t \mathsf{Nat} Nat (by U-Nat)
( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : N a t (by Ctx-Ext’s biconditional) (\rho,a/x) \approx(\rho',a'/x) \in R_{\Gamma',x:\mathsf{Nat}}
\qquad\text{(by Ctx-Ext’s biconditional)} ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : Nat (by Ctx-Ext’s biconditional)
Apply Γ , x : N a t ⊢ T ≈ T ′ : T y i \Gamma,x:\mathsf{Nat} \vdash T \approx T' : \mathsf{Ty}_i Γ , x : Nat ⊢ T ≈ T ′ : Ty i at Γ ′ , x : N a t \Gamma',x:\mathsf{Nat} Γ ′ , x : Nat , the lifted substitution, and the env-pair above:
⟦ T [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) ≈ ⟦ T ′ ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ) ∈ U i ↘ R T \llbracket T[q(\sigma)]\rrbracket((\rho,a/x)) \approx\llbracket T'\rrbracket(\llbracket q(\sigma')\rrbracket((\rho',a'/x))) \in\mathcal{U}_i \searrow R_T [ [ T [ q ( σ )] ] ] (( ρ , a / x )) ≈ [ [ T ′ ] ] ( [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x ))) ∈ U i ↘ R T
(outer-left vs inner-right of the four-value pattern)
Bridge ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) \llbracket q(\sigma')\rrbracket((\rho',a'/x)) [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x )) to ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) (\llbracket\sigma'\rrbracket(\rho'),a'/x) ( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x ) :
⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ≈ ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ∈ R Γ , x : N a t (by Ctx-Ext, tail via σ ′ at ↑ , head a ′ ≈ a ′ ) \llbracket q(\sigma')\rrbracket((\rho',a'/x)) \approx(\llbracket\sigma'\rrbracket(\rho'),a'/x) \in R_{\Gamma,x:\mathsf{Nat}}\qquad\text{(by Ctx-Ext, tail via }\sigma'\text{ at }\mathord{\uparrow}\text{, head }a' \approx a'\text{)} [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x )) ≈ ( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x ) ∈ R Γ , x : Nat (by Ctx-Ext, tail via σ ′ at ↑ , head a ′ ≈ a ′ )
⟦ T ′ ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ) ≈ ⟦ T ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) ∈ U i \llbracket T'\rrbracket(\llbracket q(\sigma')\rrbracket((\rho',a'/x))) \approx\llbracket T'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x)) \in\mathcal{U}_i [ [ T ′ ] ] ( [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x ))) ≈ [ [ T ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) ∈ U i
(by Theorem 6.38 on T ′ ≈ T ′ T' \approx T' T ′ ≈ T ′ , derived from T ≈ T ′ T \approx T' T ≈ T ′ via symmetry and transitivity)
By transitivity of U i \mathcal{U}_i U i and Theorem 6.12, ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , a / x ) ) ≈ ⟦ T ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) ∈ U i ↘ R T \llbracket T[q(\sigma)]\rrbracket((\rho,a/x)) \approx\llbracket T'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x)) \in\mathcal{U}_i \searrow R_T [ [ T [ q ( σ )] ] ] (( ρ , a / x )) ≈ [ [ T ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) ∈ U i ↘ R T , establishing the second claim.
We prove the first claim by induction on a ≈ a ′ ∈ N a t a \approx a' \in\mathsf{Nat} a ≈ a ′ ∈ Nat .
Case
N a t - Z e \mathsf{Nat\text{-}Ze} Nat - Ze
z e ≈ z e ∈ N a t ze \approx ze \in\mathsf{Nat} z e ≈ z e ∈ Nat
Here a = a ′ = z e a=a'=ze a = a ′ = z e . Apply Γ ⊢ z ≈ z ′ : T [ z e r o / x ] \Gamma\vdash z \approx z' : T[\mathsf{zero}/x] Γ ⊢ z ≈ z ′ : T [ zero / x ] at Γ ′ , σ ≈ σ ′ \Gamma',\sigma\approx\sigma' Γ ′ , σ ≈ σ ′ , and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ (this gives the four-value pattern of z , z ′ z,z' z , z ′ ):
⟦ z [ σ ] ⟧ ( ρ ) ↘ b , ⟦ z ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ↘ b ′ (termination, by hypothesis on z , z ′ ) \llbracket z[\sigma]\rrbracket(\rho) \searrow b,\qquad\llbracket z'\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \searrow b'\qquad\text{(termination, by hypothesis on }z,z'\text{)} [ [ z [ σ ] ] ] ( ρ ) ↘ b , [ [ z ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ↘ b ′ (termination, by hypothesis on z , z ′ )
b ≈ b ′ ∈ R z b \approx b' \in R_z b ≈ b ′ ∈ R z \qquad\text{(outer-left vs inner-right of z , z ′ z,z' z , z ′ )}
⟦ ∗ ⟧ ( ρ ) ≈ ⟦ T [ z e r o / x ] ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ U i ↘ R z \llbracket\ast\rrbracket(\rho) \approx\llbracket T[\mathsf{zero}/x]\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \in\mathcal{U}_i \searrow R_z [ [ ∗ ] ] ( ρ ) ≈ [ [ T [ zero / x ] ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ∈ U i ↘ R z
(corresponding type part)
Then by REC-ZE applied to these evaluations:
rec ( z e , T [ q ( σ ) ] , z [ σ ] , s [ q 2 ( σ ) ] , ρ ) ↘ b (by REC-ZE, using ⟦ z [ σ ] ⟧ ( ρ ) ↘ b ) \operatorname{rec}(ze,T[q(\sigma)],z[\sigma],s[q^2(\sigma)],\rho)\searrow b\qquad\text{(by REC-ZE, using }\llbracket z[\sigma]\rrbracket(\rho)\searrow b\text{)} rec ( z e , T [ q ( σ )] , z [ σ ] , s [ q 2 ( σ )] , ρ ) ↘ b (by REC-ZE, using [ [ z [ σ ] ] ] ( ρ ) ↘ b )
rec ( z e , T ′ , z ′ , s ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) ↘ b ′ (by REC-ZE, using ⟦ z ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ↘ b ′ ) \operatorname{rec}(ze,T',z',s',\llbracket\sigma'\rrbracket(\rho'))\searrow b'\qquad\text{(by REC-ZE, using }\llbracket z'\rrbracket(\llbracket\sigma'\rrbracket(\rho'))\searrow b'\text{)} rec ( z e , T ′ , z ′ , s ′ , [ [ σ ′ ] ] ( ρ ′ )) ↘ b ′ (by REC-ZE, using [ [ z ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ↘ b ′ )
We must show b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T . Currently b ≈ b ′ ∈ R z b \approx b' \in R_z b ≈ b ′ ∈ R z where R z R_z R z is governed by ⟦ ρ ⟧ \llbracket\rho\rrbracket [ [ ρ ] ] , while R T R_T R T is governed by ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , z e / x ) ) \llbracket T[q(\sigma)]\rrbracket((\rho, \mathit{ze}/x)) [ [ T [ q ( σ )] ] ] (( ρ , ze / x )) (substituted left, second-claim instance at a = a ′ = z e a = a' = \mathit{ze} a = a ′ = ze ). We bridge R z ⇔ R T R_z \Leftrightarrow R_T R z ⇔ R T via two type-hypothesis instantiations.
Left bridge. By Theorem 6.45 on Γ ′ ⊢ σ ≈ σ : Γ \Gamma' \vdash\sigma\approx\sigma: \Gamma Γ ′ ⊢ σ ≈ σ : Γ (reflexive instance via Theorems 6.41 and 6.42) and Γ ′ ⊢ zero [ σ ] ≈ zero [ σ ] : Nat [ σ ] \Gamma' \vdash\operatorname{zero}[\sigma] \approx\operatorname{zero}[\sigma] : \operatorname{Nat}[\sigma] Γ ′ ⊢ zero [ σ ] ≈ zero [ σ ] : Nat [ σ ] (using zero [ σ ] = zero \operatorname{zero}[\sigma] = \operatorname{zero} zero [ σ ] = zero , Nat [ σ ] = Nat \operatorname{Nat}[\sigma] = \operatorname{Nat} Nat [ σ ] = Nat , and Theorem 6.57):
Γ ′ ⊢ ( σ , zero / x ) ≈ ( σ , zero / x ) : Γ , x : Nat \Gamma' \vdash(\sigma,\operatorname{zero}/x) \approx(\sigma,\operatorname{zero}/x) : \Gamma,x:\operatorname{Nat} Γ ′ ⊢ ( σ , zero / x ) ≈ ( σ , zero / x ) : Γ , x : Nat
(by Theorem 6.45)
Apply Γ , x : Nat ⊢ T ≈ T : Ty i \Gamma,x:\operatorname{Nat} \vdash T \approx T : \operatorname{Ty}_i Γ , x : Nat ⊢ T ≈ T : Ty i at Γ ′ \Gamma' Γ ′ , this substitution, and ρ ≈ ρ ∈ R ′ \rho\approx\rho\in R' ρ ≈ ρ ∈ R ′ (reflexive):
⟦ T [ ( σ , zero / x ) ] ⟧ ( ρ ) ≈ ⟦ T ⟧ ( ⟦ ( σ , zero / x ) ⟧ ( ρ ) ) ∈ U i ↘ R z ′ \llbracket T[(\sigma,\operatorname{zero}/x)]\rrbracket(\rho) \approx\llbracket T\rrbracket(\llbracket(\sigma,\operatorname{zero}/x)\rrbracket(\rho)) \in U_i \searrow R'_z [ [ T [( σ , zero / x )] ] ] ( ρ ) ≈ [ [ T ] ] ( [ [ ( σ , zero / x ) ] ] ( ρ )) ∈ U i ↘ R z ′
(outer-left vs inner-left)
T [ ( σ , zero / x ) ] = ⟦ T ⟧ T[(\sigma,\operatorname{zero}/x)] = \llbracket T\rrbracket T [( σ , zero / x )] = [ [ T ] ]
(by Theorem 2.30)
⟦ ( σ , zero / x ) ⟧ ( ρ ) = ( ⟦ σ ⟧ ( ρ ) , z e / x ) \llbracket(\sigma,\operatorname{zero}/x)\rrbracket(\rho) = (\llbracket\sigma\rrbracket(\rho),\mathit{ze}/x) [ [ ( σ , zero / x ) ] ] ( ρ ) = ( [ [ σ ] ] ( ρ ) , ze / x )
(by pointwise eval, ev-ze)
R z ′ ⇔ R z R'_z \Leftrightarrow R_z R z ′ ⇔ R z
(by Theorem 6.12 on shared ⟦ ρ ⟧ \llbracket\rho\rrbracket [ [ ρ ] ] )
Hence ⟦ ρ ⟧ ≈ ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , z e / x ) ) ∈ U i ↘ R z \llbracket\rho\rrbracket\approx\llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\mathit{ze}/x)) \in U_i \searrow R_z [ [ ρ ] ] ≈ [ [ T ] ] (( [ [ σ ] ] ( ρ ) , ze / x )) ∈ U i ↘ R z .
Right bridge. Symmetrically, instantiate T T T at ( id , zero / x ) (\operatorname{id},\operatorname{zero}/x) ( id , zero / x ) over Γ \Gamma Γ at the env-pair ⟦ σ ⟧ ( ρ ) ≈ ⟦ σ ′ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\sigma\rrbracket(\rho) \approx\llbracket\sigma'\rrbracket(\rho') \in R_\Gamma [ [ σ ] ] ( ρ ) ≈ [ [ σ ′ ] ] ( ρ ′ ) ∈ R Γ (carried by the semantic-substitution hypothesis):
Γ ⊢ ( id , zero / x ) ≈ ( id , zero / x ) : Γ , x : Nat \Gamma\vdash(\operatorname{id},\operatorname{zero}/x) \approx(\operatorname{id},\operatorname{zero}/x) : \Gamma,x:\operatorname{Nat} Γ ⊢ ( id , zero / x ) ≈ ( id , zero / x ) : Γ , x : Nat
(by Theorem 6.45 and Theorem 6.57)
⟦ T [ zero / x ] ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ≈ ⟦ T ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , z e / x ) ) ∈ U i \llbracket T[\operatorname{zero}/x]\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \approx\llbracket T\rrbracket((\llbracket\sigma'\rrbracket(\rho'),\mathit{ze}/x)) \in U_i [ [ T [ zero / x ] ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ≈ [ [ T ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , ze / x )) ∈ U i
(outer-vs-inner of the four-value pattern of T T T )
Combining via the second claim. The second claim (proved above) gives:
⟦ T [ q ( σ ) ] ⟧ ( ( ρ , z e / x ) ) ≈ ⟦ T ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , z e / x ) ) ∈ U i ↘ R T \llbracket T[q(\sigma)]\rrbracket((\rho,\mathit{ze}/x)) \approx\llbracket T'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),\mathit{ze}/x)) \in U_i \searrow R_T [ [ T [ q ( σ )] ] ] (( ρ , ze / x )) ≈ [ [ T ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , ze / x )) ∈ U i ↘ R T
Chaining via the bridges (using Theorem 6.12, Theorem 6.14, Theorem 6.13):
⟦ ρ ⟧ ≈ ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , z e / x ) ) ≈ ⟦ T ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , z e / x ) ) ≈ ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , z e / x ) ) ∈ U i \begin{aligned}
\llbracket\rho\rrbracket&\approx\llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\mathit{ze}/x)) \\
&\approx\llbracket T\rrbracket((\llbracket\sigma'\rrbracket(\rho'),\mathit{ze}/x)) \\
&\approx\llbracket T[q(\sigma)]\rrbracket((\rho,\mathit{ze}/x)) \in U_i
\end{aligned} [ [ ρ ] ] ≈ [ [ T ] ] (( [ [ σ ] ] ( ρ ) , ze / x )) ≈ [ [ T ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , ze / x )) ≈ [ [ T [ q ( σ )] ] ] (( ρ , ze / x )) ∈ U i
R z ⇔ R T R_z \Leftrightarrow R_T R z ⇔ R T
(by Theorem 6.12)
Hence b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T .
Case
N a t - S u a 0 ≈ a 0 ′ ∈ Nat su ( a 0 ) ≈ su ( a 0 ′ ) ∈ Nat \begin{array}{c}
\mathrm{Nat\text{-}Su}\\
a_0 \approx a'_0 \in\operatorname{Nat}\\
\hline
\operatorname{su}(a_0) \approx\operatorname{su}(a'_0) \in\operatorname{Nat}
\end{array} Nat - Su a 0 ≈ a 0 ′ ∈ Nat su ( a 0 ) ≈ su ( a 0 ′ ) ∈ Nat
with a = su ( a 0 ) a = \operatorname{su}(a_0) a = su ( a 0 ) , a ′ = su ( a 0 ′ ) a' = \operatorname{su}(a'_0) a ′ = su ( a 0 ′ ) . By IH on a 0 ≈ a 0 ′ a_0 \approx a'_0 a 0 ≈ a 0 ′ , there exist b 0 , b 0 ′ b_0,b'_0 b 0 , b 0 ′ with
rec ( a 0 , T [ q ( σ ) ] , z [ σ ] , s [ q 2 ( σ ) ] , ρ ) ↘ b 0 \operatorname{rec}(a_0,T[q(\sigma)],z[\sigma],s[q^2(\sigma)],\rho) \searrow b_0 rec ( a 0 , T [ q ( σ )] , z [ σ ] , s [ q 2 ( σ )] , ρ ) ↘ b 0
(by IH)
rec ( a 0 ′ , T ′ , z ′ , s ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) ↘ b 0 ′ \operatorname{rec}(a'_0,T',z',s',\llbracket\sigma'\rrbracket(\rho')) \searrow b'_0 rec ( a 0 ′ , T ′ , z ′ , s ′ , [ [ σ ′ ] ] ( ρ ′ )) ↘ b 0 ′
(by IH)
b 0 ≈ b 0 ′ ∈ R T 0 b_0 \approx b'_0 \in R_T^0 b 0 ≈ b 0 ′ ∈ R T 0
(by IH, with R T 0 R_T^0 R T 0 governed by ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , a 0 / x ) ) \llbracket T[q(\sigma)]\rrbracket((\rho,a_0/x)) [ [ T [ q ( σ )] ] ] (( ρ , a 0 / x )) )
We derive the evaluations of s [ q 2 ( σ ) ] s[q^2(\sigma)] s [ q 2 ( σ )] and s ′ s' s ′ from the hypothesis on s , s ′ s,s' s , s ′ . First, lift σ , σ ′ \sigma,\sigma' σ , σ ′ over Nat and T T T :
Γ ′ , x : Nat ⊢ q ( σ ) ≈ q ( σ ′ ) : Γ , x : Nat \Gamma',x:\operatorname{Nat} \vdash q(\sigma) \approx q(\sigma') : \Gamma,x:\operatorname{Nat} Γ ′ , x : Nat ⊢ q ( σ ) ≈ q ( σ ′ ) : Γ , x : Nat
(by Theorem 6.47 on σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ and Nat; using Nat [ σ ] = Nat \operatorname{Nat}[\sigma] = \operatorname{Nat} Nat [ σ ] = Nat )
Γ ′ , x : Nat , y : T [ q ( σ ) ] ⊢ q 2 ( σ ) ≈ q 2 ( σ ′ ) : Γ , x : Nat , y : T \Gamma',x:\operatorname{Nat},y:T[q(\sigma)] \vdash q^2(\sigma) \approx q^2(\sigma') : \Gamma,x:\operatorname{Nat},y:T Γ ′ , x : Nat , y : T [ q ( σ )] ⊢ q 2 ( σ ) ≈ q 2 ( σ ′ ) : Γ , x : Nat , y : T
(by Theorem 6.47 again on T T T ) Build the env-pair via two applications of Ctx-Ext:
( ρ , a 0 / x ) ≈ ( ρ ′ , a 0 ′ / x ) ∈ R Γ ′ , x : N a t (\rho, a_0/x) \approx(\rho', a'_0/x) \in R_{\Gamma',x:\mathrm{Nat}} ( ρ , a 0 / x ) ≈ ( ρ ′ , a 0 ′ / x ) ∈ R Γ ′ , x : Nat
(by Ctx-Ext, head PER Nat)
( ρ , a 0 / x , b 0 / y ) ≈ ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) ∈ R Γ ′ , x : N a t , y : T [ q ( σ ) ] (\rho, a_0/x, b_0/y) \approx(\rho', a'_0/x, b'_0/y) \in R_{\Gamma',x:\mathrm{Nat},y:T[q(\sigma)]} ( ρ , a 0 / x , b 0 / y ) ≈ ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) ∈ R Γ ′ , x : Nat , y : T [ q ( σ )]
(by Ctx-Ext, head PER R T 0 R^0_T R T 0 )
Apply Γ , x : N a t , y : T ⊢ s ≈ s ′ : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] \Gamma, x : \mathrm{Nat}, y : T \vdash s \approx s' : T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x] Γ , x : Nat , y : T ⊢ s ≈ s ′ : T [ ⇑ ∘ ⇑ , succ x 1 / x ] at Γ ′ , x : N a t , y : T [ q ( σ ) ] \Gamma', x : \mathrm{Nat}, y : T[q(\sigma)] Γ ′ , x : Nat , y : T [ q ( σ )] , the doubly-lifted substitution q 2 ( σ ) ≈ q 2 ( σ ′ ) q^2(\sigma) \approx q^2(\sigma') q 2 ( σ ) ≈ q 2 ( σ ′ ) , and this env-pair (this gives the four-value pattern of s , s ′ s,s' s , s ′ ):
⟦ s [ q 2 ( σ ) ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ⇓ b \llbracket s[q^2(\sigma)]\rrbracket((\rho, a_0/x,b_0/y)) \mathrel{\Downarrow} b [ [ s [ q 2 ( σ )] ] ] (( ρ , a 0 / x , b 0 / y )) ⇓ b
(termination, by hypothesis on s s s )
⟦ s ′ ⟧ ( ⟦ q 2 ( σ ′ ) ⟧ ( ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) ) ) ⇓ b 0 ′ \llbracket s'\rrbracket(\llbracket q^2(\sigma')\rrbracket((\rho',a'_0/x,b'_0/y))) \mathrel{\Downarrow} b'_0 [ [ s ′ ] ] ( [ [ q 2 ( σ ′ ) ] ] (( ρ ′ , a 0 ′ / x , b 0 ′ / y ))) ⇓ b 0 ′
(termination, by hypothesis on s ′ s' s ′ )
⟦ s ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) , a 0 ′ / x , b 0 ′ / y ) ) ⇓ b ′ \llbracket s'\rrbracket(\llbracket\sigma'\rrbracket(\rho'),a'_0/x,b'_0/y)) \mathrel{\Downarrow} b' [ [ s ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ) , a 0 ′ / x , b 0 ′ / y )) ⇓ b ′
(termination, by reflexive instance … ⊨ s ′ ≈ s ′ : … \ldots\vDash s' \approx s' : \ldots … ⊨ s ′ ≈ s ′ : … )
By rec-su:
rec ( su ( a 0 ) , T [ q ( σ ) ] , z [ σ ] , s [ q 2 ( σ ) ] , ρ ) ⇓ b \operatorname{rec}(\operatorname{su}(a_0),T[q(\sigma)],z[\sigma],s[q^2(\sigma)],\rho) \mathrel{\Downarrow} b rec ( su ( a 0 ) , T [ q ( σ )] , z [ σ ] , s [ q 2 ( σ )] , ρ ) ⇓ b
(by rec-su, using ⟦ s [ q 2 ( σ ) ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ⇓ b \llbracket s[q^2(\sigma)]\rrbracket((\rho,a_0/x,b_0/y)) \mathrel{\Downarrow} b [ [ s [ q 2 ( σ )] ] ] (( ρ , a 0 / x , b 0 / y )) ⇓ b )
rec ( su ( a 0 ′ ) , T ′ , z ′ , s ′ , ⟦ σ ′ ⟧ ( ρ ′ ) ) ⇓ b ′ \operatorname{rec}(\operatorname{su}(a'_0),T',z',s',\llbracket\sigma'\rrbracket(\rho')) \mathrel{\Downarrow} b' rec ( su ( a 0 ′ ) , T ′ , z ′ , s ′ , [ [ σ ′ ] ] ( ρ ′ )) ⇓ b ′
(by rec-su, using ⟦ s ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) , a 0 ′ / x , b 0 ′ / y ) ) ⇓ b ′ \llbracket s'\rrbracket(\llbracket\sigma'\rrbracket(\rho'),a'_0/x,b'_0/y)) \mathrel{\Downarrow} b' [ [ s ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ) , a 0 ′ / x , b 0 ′ / y )) ⇓ b ′ )
We must show b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T . Outer-left vs inner-right of the four-value pattern of s , s ′ s,s' s , s ′ :
⟦ ( T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] ) [ q 2 ( σ ) ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ⟦ T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] ⟧ ( ⟦ q 2 ( σ ′ ) ⟧ ( ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) ) ) ∈ U i ⇓ R s \llbracket(T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x])[q^2(\sigma)]\rrbracket((\rho,a_0/x,b_0/y))
\approx
\llbracket T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x]\rrbracket(\llbracket q^2(\sigma')\rrbracket((\rho',a'_0/x,b'_0/y))) \in\mathcal{U}_i \mathrel{\Downarrow} R_s [ [ ( T [ ⇑ ∘ ⇑ , succ x 1 / x ]) [ q 2 ( σ )] ] ] (( ρ , a 0 / x , b 0 / y )) ≈ [ [ T [ ⇑ ∘ ⇑ , succ x 1 / x ] ] ] ( [ [ q 2 ( σ ′ ) ] ] (( ρ ′ , a 0 ′ / x , b 0 ′ / y ))) ∈ U i ⇓ R s
(type part)
⟦ s [ q 2 ( σ ) ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ⟦ s ′ ⟧ ( ⟦ q 2 ( σ ′ ) ⟧ ( ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) ) ) ∈ R s \llbracket s[q^2(\sigma)]\rrbracket((\rho,a_0/x,b_0/y))
\approx
\llbracket s'\rrbracket(\llbracket q^2(\sigma')\rrbracket((\rho',a'_0/x,b'_0/y))) \in R_s [ [ s [ q 2 ( σ )] ] ] (( ρ , a 0 / x , b 0 / y )) ≈ [ [ s ′ ] ] ( [ [ q 2 ( σ ′ ) ] ] (( ρ ′ , a 0 ′ / x , b 0 ′ / y ))) ∈ R s
(term part, by hypothesis on s , s ′ s,s' s , s ′ )
where R s R_s R s is the PER governed by ⟦ ( T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] ) [ q 2 ( σ ) ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) \llbracket(T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x])[q^2(\sigma)]\rrbracket((\rho,a_0/x,b_0/y)) [ [ ( T [ ⇑ ∘ ⇑ , succ x 1 / x ]) [ q 2 ( σ )] ] ] (( ρ , a 0 / x , b 0 / y )) . Bridge ⟦ q 2 ( σ ′ ) ⟧ ( ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) ) \llbracket q^2(\sigma')\rrbracket((\rho',a'_0/x,b'_0/y)) [ [ q 2 ( σ ′ ) ] ] (( ρ ′ , a 0 ′ / x , b 0 ′ / y )) to ( ⟦ σ ′ ⟧ ( ρ ′ ) , a 0 ′ / x , b 0 ′ / y ) (\llbracket\sigma'\rrbracket(\rho'),a'_0/x,b'_0/y) ( [ [ σ ′ ] ] ( ρ ′ ) , a 0 ′ / x , b 0 ′ / y ) in R Γ ′ , x : N a t , y : T R_{\Gamma',x:\mathrm{Nat},y:T} R Γ ′ , x : Nat , y : T analogously, then apply Theorem 6.38 on Γ ′ , x : N a t , y : T ⊨ s ′ ≈ s ′ : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] \Gamma', x : \mathrm{Nat}, y : T \vDash s' \approx s' : T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x] Γ ′ , x : Nat , y : T ⊨ s ′ ≈ s ′ : T [ ⇑ ∘ ⇑ , succ x 1 / x ] (the reflexive instance):
⟦ s ′ ⟧ ( ⟦ q 2 ( σ ′ ) ⟧ ( ( ρ ′ , a 0 ′ / x , b 0 ′ / y ) ) ) ≈ ⟦ s ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) , a 0 ′ / x , b 0 ′ / y ) ) ∈ R s \llbracket s'\rrbracket(\llbracket q^2(\sigma')\rrbracket((\rho',a'_0/x,b'_0/y)))
\approx
\llbracket s'\rrbracket(\llbracket\sigma'\rrbracket(\rho'),a'_0/x,b'_0/y)) \in R_s [ [ s ′ ] ] ( [ [ q 2 ( σ ′ ) ] ] (( ρ ′ , a 0 ′ / x , b 0 ′ / y ))) ≈ [ [ s ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ) , a 0 ′ / x , b 0 ′ / y )) ∈ R s
(by Theorem 6.38)
By transitivity, b ≈ b ′ ∈ R s b \approx b' \in R_s b ≈ b ′ ∈ R s .
We bridge R s ⇔ R T R_s \Leftrightarrow R_T R s ⇔ R T , where R s R_s R s is governed by ⟦ ( T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] ) [ q 2 ( σ ) ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) \llbracket(T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x])[q^2(\sigma)]\rrbracket((\rho,a_0/x,b_0/y)) [ [ ( T [ ⇑ ∘ ⇑ , succ x 1 / x ]) [ q 2 ( σ )] ] ] (( ρ , a 0 / x , b 0 / y )) and R T R_T R T is governed by ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , su ( a 0 ) / x ) ) \llbracket T[q(\sigma)]\rrbracket((\rho,\operatorname{su}(a_0)/x)) [ [ T [ q ( σ )] ] ] (( ρ , su ( a 0 ) / x )) (the second-claim pattern instantiated at su ( a 0 ) ≈ su ( a 0 ′ ) \operatorname{su}(a_0) \approx\operatorname{su}(a'_0) su ( a 0 ) ≈ su ( a 0 ′ ) ):
⟦ T [ q ( σ ) ] ⟧ ( ( ρ , su ( a 0 ) / x ) ) ≈ ⟦ T ′ ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) , su ( a 0 ′ ) / x ) ) ∈ U i ⇓ R T \llbracket T[q(\sigma)]\rrbracket((\rho,\operatorname{su}(a_0)/x))
\approx
\llbracket T'\rrbracket(\llbracket\sigma'\rrbracket(\rho'),\operatorname{su}(a'_0)/x)) \in\mathcal{U}_i \mathrel{\Downarrow} R_T [ [ T [ q ( σ )] ] ] (( ρ , su ( a 0 ) / x )) ≈ [ [ T ′ ] ] ( [ [ σ ′ ] ] ( ρ ′ ) , su ( a 0 ′ ) / x )) ∈ U i ⇓ R T
(second claim)
All bridging uses syntactic substitution-composition lemmas (Theorems 2.22, 2.26 and 2.29) and instantiations of hypothesis on T T T .
Bridge B1: collapse ( T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] ) [ q 2 ( σ ) ] (T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x])[q^2(\sigma)] ( T [ ⇑ ∘ ⇑ , succ x 1 / x ]) [ q 2 ( σ )] into a single substitution.
( T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] ) [ q 2 ( σ ) ] = T [ ( ⇑ ∘ ⇑ , s u c c x 1 / x ) ∘ q 2 ( σ ) ] (T[\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x])[q^2(\sigma)]
= T[(\Uparrow\circ\Uparrow,\mathrm{succ}\ x_1/x) \circ q^2(\sigma)] ( T [ ⇑ ∘ ⇑ , succ x 1 / x ]) [ q 2 ( σ )] = T [( ⇑ ∘ ⇑ , succ x 1 / x ) ∘ q 2 ( σ )]
(by Theorem 2.22)
= T [ ( ⇑ ∘ ⇑ ) ∘ q 2 ( σ ) , s u c c x 1 [ q 2 ( σ ) ] / x ] = T[(\Uparrow\circ\Uparrow) \circ q^2(\sigma),\mathrm{succ}\ x_1[q^2(\sigma)]/x] = T [( ⇑ ∘ ⇑ ) ∘ q 2 ( σ ) , succ x 1 [ q 2 ( σ )] / x ]
(by Theorem 2.26)
= T [ σ ∘ ( ⇑ ∘ ⇑ ) , s u c c x 1 / x ] = T[\sigma\circ(\Uparrow\circ\Uparrow),\mathrm{succ}\ x_1/x] = T [ σ ∘ ( ⇑ ∘ ⇑ ) , succ x 1 / x ]
(using s u c c x 1 [ q 2 ( σ ) ] = s u c c x 1 \mathrm{succ}\ x_1[q^2(\sigma)] = \mathrm{succ}\ x_1 succ x 1 [ q 2 ( σ )] = succ x 1 (since q 2 ( σ ) ( 1 ) = x 1 q^2(\sigma)(1)=x_1 q 2 ( σ ) ( 1 ) = x 1 ))
(and ( ⇑ ∘ ⇑ ) ∘ q 2 ( σ ) = σ ∘ ( ⇑ ∘ ⇑ ) (\Uparrow\circ\Uparrow) \circ q^2(\sigma) = \sigma\circ(\Uparrow\circ\Uparrow) ( ⇑ ∘ ⇑ ) ∘ q 2 ( σ ) = σ ∘ ( ⇑ ∘ ⇑ ) (Theorem 2.20))
Denote the collapsed substitution by τ : = ( σ ∘ ( ⇑ ∘ ⇑ ) , s u c c x 1 / x ) \tau:= (\sigma\circ(\Uparrow\circ\Uparrow),\mathrm{succ}\ x_1/x) τ := ( σ ∘ ( ⇑ ∘ ⇑ ) , succ x 1 / x ) , with Γ ′ , x : N a t , y : T [ q ( σ ) ] ⊢ τ : Γ , x : N a t \Gamma', x : \mathrm{Nat}, y : T[q(\sigma)] \vdash\tau: \Gamma, x : \mathrm{Nat} Γ ′ , x : Nat , y : T [ q ( σ )] ⊢ τ : Γ , x : Nat .
Bridge B2: instantiate hypothesis on T T T via τ \tau τ . We show τ \tau τ is a semantic substitution from Γ ′ , x : N a t , y : T [ q ( σ ) ] \Gamma', x : \mathrm{Nat}, y : T[q(\sigma)] Γ ′ , x : Nat , y : T [ q ( σ )] to Γ , x : N a t \Gamma, x : \mathrm{Nat} Γ , x : Nat . By Theorem 6.28 (twice) and Theorem 6.29: Γ ′ , x : N a t , y : T [ q ( σ ) ] ⊨ τ ≈ τ : Γ ′ \Gamma', x : \mathrm{Nat}, y : T[q(\sigma)] \vDash\tau\approx\tau: \Gamma' Γ ′ , x : Nat , y : T [ q ( σ )] ⊨ τ ≈ τ : Γ ′ . Apply Theorem 6.39 to Γ ′ ⊨ σ ≈ σ : Γ \Gamma' \vDash\sigma\approx\sigma: \Gamma Γ ′ ⊨ σ ≈ σ : Γ (reflexive, by Theorems 6.41 and 6.42) and this semantic weakening:
Γ ′ , x : N a t , y : T [ q ( σ ) ] ⊨ σ ∘ ( ⇑ ∘ ⇑ ) ≈ σ ∘ ( ⇑ ∘ ⇑ ) : Γ \Gamma', x : \mathrm{Nat}, y : T[q(\sigma)] \vDash\sigma\circ(\Uparrow\circ\Uparrow) \approx\sigma\circ(\Uparrow\circ\Uparrow) : \Gamma Γ ′ , x : Nat , y : T [ q ( σ )] ⊨ σ ∘ ( ⇑ ∘ ⇑ ) ≈ σ ∘ ( ⇑ ∘ ⇑ ) : Γ
By Theorem 6.56, Theorem 6.58: Γ ′ , x : Nat , y : T [ q ( σ ) ] ⊢ succ x 1 ≈ succ x 1 : Nat \Gamma', x : \operatorname{Nat}, y : T[q(\sigma)] \vdash\operatorname{succ}\ x_1 \approx\operatorname{succ}\ x_1 : \operatorname{Nat} Γ ′ , x : Nat , y : T [ q ( σ )] ⊢ succ x 1 ≈ succ x 1 : Nat (lookup x 1 : Nat x_1 : \operatorname{Nat} x 1 : Nat at the second slot of Γ ′ , x : Nat , y : T [ q ( σ ) ] \Gamma', x : \operatorname{Nat}, y : T[q(\sigma)] Γ ′ , x : Nat , y : T [ q ( σ )] , with Nat [ ⇑ ] = Nat \operatorname{Nat}[\Uparrow] = \operatorname{Nat} Nat [ ⇑ ] = Nat ). By Theorem 6.45:
Γ ′ , x : Nat , y : T [ q ( σ ) ] ⊢ τ ≈ τ : Γ , x : Nat \Gamma', x : \operatorname{Nat}, y : T[q(\sigma)] \vdash\tau\approx\tau: \Gamma, x : \operatorname{Nat} Γ ′ , x : Nat , y : T [ q ( σ )] ⊢ τ ≈ τ : Γ , x : Nat
Apply Γ , x : Nat ⊢ T ≈ T : Ty i \Gamma, x : \operatorname{Nat} \vdash T \approx T : \operatorname{Ty}_i Γ , x : Nat ⊢ T ≈ T : Ty i at Γ ′ , x : Nat , y : T [ q ( σ ) ] , τ ≈ τ \Gamma', x : \operatorname{Nat}, y : T[q(\sigma)], \tau\approx\tau Γ ′ , x : Nat , y : T [ q ( σ )] , τ ≈ τ , and the reflexive env-pair ( ρ , a 0 / x , b 0 / y ) ≈ ( ρ , a 0 / x , b 0 / y ) ∈ R Γ ′ , x : Nat , y : T [ q ( σ ) ] (\rho, a_0/x, b_0/y) \approx(\rho, a_0/x, b_0/y) \in R_{\Gamma',x:\operatorname{Nat},y:T[q(\sigma)]} ( ρ , a 0 / x , b 0 / y ) ≈ ( ρ , a 0 / x , b 0 / y ) ∈ R Γ ′ , x : Nat , y : T [ q ( σ )] . Outer-left vs inner-left:
⟦ T [ τ ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ⟦ T ⟧ ( ⟦ τ ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ) ∈ U i ↘ R B 2 \begin{aligned}
\llbracket T[\tau]\rrbracket((\rho,a_0/x,b_0/y)) \\
\approx\llbracket T\rrbracket(\llbracket\tau\rrbracket((\rho,a_0/x,b_0/y))) \in\mathcal{U}_i \searrow R_{B2}
\end{aligned} [ [ T [ τ ] ] ] (( ρ , a 0 / x , b 0 / y )) ≈ [ [ T ] ] ( [ [ τ ] ] (( ρ , a 0 / x , b 0 / y ))) ∈ U i ↘ R B 2
By Bridge B1,
T [ τ ] = ( T [ ⇑ ∘ ⇑ , succ x 1 / x ] ) [ q 2 ( σ ) ] , T[\tau] = (T[\Uparrow\circ\Uparrow,\operatorname{succ}\ x_1/x])[q^2(\sigma)], T [ τ ] = ( T [ ⇑ ∘ ⇑ , succ x 1 / x ]) [ q 2 ( σ )] ,
so the outer-left is exactly
⟦ ( T [ ⇑ ∘ ⇑ , succ x 1 / x ] ) [ q 2 ( σ ) ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) \llbracket(T[\Uparrow\circ\Uparrow,\operatorname{succ}\ x_1/x])[q^2(\sigma)]\rrbracket((\rho,a_0/x,b_0/y)) [ [ ( T [ ⇑ ∘ ⇑ , succ x 1 / x ]) [ q 2 ( σ )] ] ] (( ρ , a 0 / x , b 0 / y ))
—the value governing R s R_s R s . Hence R s ⇔ R B 2 R_s \Leftrightarrow R_{B2} R s ⇔ R B 2 .
By pointwise definition of substitution evaluation:
⟦ τ ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) = ( ⟦ σ ∘ ( ⇑ ∘ ⇑ ) ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) , su ( a 0 ) / x ) \llbracket\tau\rrbracket((\rho,a_0/x,b_0/y)) = (\llbracket\sigma\circ(\Uparrow\circ\Uparrow)\rrbracket((\rho,a_0/x,b_0/y)),\operatorname{su}(a_0)/x) [ [ τ ] ] (( ρ , a 0 / x , b 0 / y )) = ( [ [ σ ∘ ( ⇑ ∘ ⇑ ) ] ] (( ρ , a 0 / x , b 0 / y )) , su ( a 0 ) / x )
(pointwise; head: ⟦ succ x 1 ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) = su ( a 0 ) \llbracket\operatorname{succ}\ x_1\rrbracket((\rho,a_0/x,b_0/y)) = \operatorname{su}(a_0) [ [ succ x 1 ] ] (( ρ , a 0 / x , b 0 / y )) = su ( a 0 ) via ev-su, ev-var)
We do not equate the tail ⟦ σ ∘ ( ⇑ ∘ ⇑ ) ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) \llbracket\sigma\circ(\Uparrow\circ\Uparrow)\rrbracket((\rho,a_0/x,b_0/y)) [ [ σ ∘ ( ⇑ ∘ ⇑ ) ] ] (( ρ , a 0 / x , b 0 / y )) with ⟦ σ ⟧ ( ρ ) \llbracket\sigma\rrbracket(\rho) [ [ σ ] ] ( ρ ) definitionally — such an equality is a substitution–evaluation commutation that does not hold for operational substitutions. Instead, we relate them in R Γ ′ R_{\Gamma'} R Γ ′ via the four-value pattern of σ ∘ ( ⇑ ∘ ⇑ ) : = σ [ ⇑ ∘ ⇑ ] \sigma\circ(\Uparrow\circ\Uparrow) := \sigma[\Uparrow\circ\Uparrow] σ ∘ ( ⇑ ∘ ⇑ ) := σ [ ⇑ ∘ ⇑ ] established by Theorem 6.39, and the four-value pattern of σ \sigma σ itself:
⟦ σ [ ⇑ ∘ ⇑ ] ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ⟦ σ ⟧ ( ⟦ ⇑ ∘ ⇑ ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ) ∈ R Γ ′ \llbracket\sigma[\Uparrow\circ\Uparrow]\rrbracket((\rho,a_0/x,b_0/y)) \approx\llbracket\sigma\rrbracket(\llbracket\Uparrow\circ\Uparrow\rrbracket((\rho,a_0/x,b_0/y))) \in R_{\Gamma'} [ [ σ [ ⇑ ∘ ⇑ ] ] ] (( ρ , a 0 / x , b 0 / y )) ≈ [ [ σ ] ] ( [ [ ⇑ ∘ ⇑ ] ] (( ρ , a 0 / x , b 0 / y ))) ∈ R Γ ′
(four-value pattern of σ [ ⇑ ∘ ⇑ ] \sigma[\Uparrow\circ\Uparrow] σ [ ⇑ ∘ ⇑ ] , outer-left vs inner-left)
⟦ ⇑ ∘ ⇑ ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ρ ∈ R Γ ′ \llbracket\Uparrow\circ\Uparrow\rrbracket((\rho,a_0/x,b_0/y)) \approx\rho\in R_{\Gamma'} [ [ ⇑ ∘ ⇑ ] ] (( ρ , a 0 / x , b 0 / y )) ≈ ρ ∈ R Γ ′
(four-value pattern of ⇑ ∘ ⇑ \Uparrow\circ\Uparrow ⇑ ∘ ⇑ , by Theorems 6.29 and 6.37)
⟦ σ ⟧ ( ⟦ ⇑ ∘ ⇑ ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ) ≈ ⟦ σ ⟧ ( ρ ) ∈ R Γ ′ \llbracket\sigma\rrbracket(\llbracket\Uparrow\circ\Uparrow\rrbracket((\rho,a_0/x,b_0/y))) \approx\llbracket\sigma\rrbracket(\rho) \in R_{\Gamma'} [ [ σ ] ] ( [ [ ⇑ ∘ ⇑ ] ] (( ρ , a 0 / x , b 0 / y ))) ≈ [ [ σ ] ] ( ρ ) ∈ R Γ ′
(by Theorem 6.38 on the reflexive σ \sigma σ )
By transitivity of R Γ ′ R_{\Gamma'} R Γ ′ :
⟦ σ ∘ ( ⇑ ∘ ⇑ ) ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ⟦ σ ⟧ ( ρ ) ∈ R Γ ′ \llbracket\sigma\circ(\Uparrow\circ\Uparrow)\rrbracket((\rho,a_0/x,b_0/y)) \approx\llbracket\sigma\rrbracket(\rho) \in R_{\Gamma'} [ [ σ ∘ ( ⇑ ∘ ⇑ ) ] ] (( ρ , a 0 / x , b 0 / y )) ≈ [ [ σ ] ] ( ρ ) ∈ R Γ ′
⟦ τ ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ( ⟦ σ ⟧ ( ρ ) , su ( a 0 ) / x ) ∈ R Γ ′ , x : Nat \llbracket\tau\rrbracket((\rho,a_0/x,b_0/y)) \approx(\llbracket\sigma\rrbracket(\rho),\operatorname{su}(a_0)/x) \in R_{\Gamma',x:\operatorname{Nat}} [ [ τ ] ] (( ρ , a 0 / x , b 0 / y )) ≈ ( [ [ σ ] ] ( ρ ) , su ( a 0 ) / x ) ∈ R Γ ′ , x : Nat
(by Ctx-Ext, head su ( a 0 ) ≈ su ( a 0 ) \operatorname{su}(a_0) \approx\operatorname{su}(a_0) su ( a 0 ) ≈ su ( a 0 ) )
Bridge B3: instantiate hypothesis on T T T via q ( σ ) q(\sigma) q ( σ ) . Apply Γ , x : Nat ⊢ T ≈ T : Ty i \Gamma, x : \operatorname{Nat} \vdash T \approx T : \operatorname{Ty}_i Γ , x : Nat ⊢ T ≈ T : Ty i at Γ ′ , x : Nat \Gamma', x : \operatorname{Nat} Γ ′ , x : Nat , the lifted q ( σ ) ≈ q ( σ ) q(\sigma) \approx q(\sigma) q ( σ ) ≈ q ( σ ) , and reflexive ( ρ , su ( a 0 ) / x ) ≈ ( ρ , su ( a 0 ) / x ) ∈ R Γ ′ , x : Nat (\rho,\operatorname{su}(a_0)/x) \approx(\rho,\operatorname{su}(a_0)/x) \in R_{\Gamma',x:\operatorname{Nat}} ( ρ , su ( a 0 ) / x ) ≈ ( ρ , su ( a 0 ) / x ) ∈ R Γ ′ , x : Nat (head su ( a 0 ) ≈ su ( a 0 ) \operatorname{su}(a_0) \approx\operatorname{su}(a_0) su ( a 0 ) ≈ su ( a 0 ) via Theorem 6.7 reflexivity). Outer-left vs inner-left:
⟦ T [ q ( σ ) ] ⟧ ( ( ρ , su ( a 0 ) / x ) ) ≈ ⟦ T ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , su ( a 0 ) / x ) ) ) ∈ U i ↘ R B 3 \begin{aligned}
\llbracket T[q(\sigma)]\rrbracket((\rho,\operatorname{su}(a_0)/x)) \\
\approx\llbracket T\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,\operatorname{su}(a_0)/x))) \in\mathcal{U}_i \searrow R_{B3}
\end{aligned} [ [ T [ q ( σ )] ] ] (( ρ , su ( a 0 ) / x )) ≈ [ [ T ] ] ( [ [ q ( σ ) ] ] (( ρ , su ( a 0 ) / x ))) ∈ U i ↘ R B 3
⟦ q ( σ ) ⟧ ( ( ρ , su ( a 0 ) / x ) ) ≈ ( ⟦ σ ⟧ ( ρ ) , su ( a 0 ) / x ) ∈ R Γ ′ , x : Nat \llbracket q(\sigma)\rrbracket((\rho,\operatorname{su}(a_0)/x)) \approx(\llbracket\sigma\rrbracket(\rho),\operatorname{su}(a_0)/x) \in R_{\Gamma',x:\operatorname{Nat}} [ [ q ( σ ) ] ] (( ρ , su ( a 0 ) / x )) ≈ ( [ [ σ ] ] ( ρ ) , su ( a 0 ) / x ) ∈ R Γ ′ , x : Nat
(by Ctx-Ext)
Combining B2 and B3. By B2’s bridging, ⟦ τ ⟧ ( ( ρ , a 0 / x , b 0 / y ) ) ≈ ( ⟦ σ ⟧ ( ρ ) , su ( a 0 ) / x ) ∈ R Γ ′ , x : Nat \llbracket\tau\rrbracket((\rho,a_0/x,b_0/y)) \approx(\llbracket\sigma\rrbracket(\rho),\operatorname{su}(a_0)/x) \in R_{\Gamma',x:\operatorname{Nat}} [ [ τ ] ] (( ρ , a 0 / x , b 0 / y )) ≈ ( [ [ σ ] ] ( ρ ) , su ( a 0 ) / x ) ∈ R Γ ′ , x : Nat . By B3’s Ctx-Ext computation, ⟦ q ( σ ) ⟧ ( ( ρ , su ( a 0 ) / x ) ) ≈ ( ⟦ σ ⟧ ( ρ ) , su ( a 0 ) / x ) ∈ R Γ ′ , x : Nat \llbracket q(\sigma)\rrbracket((\rho,\operatorname{su}(a_0)/x)) \approx(\llbracket\sigma\rrbracket(\rho),\operatorname{su}(a_0)/x) \in R_{\Gamma',x:\operatorname{Nat}} [ [ q ( σ ) ] ] (( ρ , su ( a 0 ) / x )) ≈ ( [ [ σ ] ] ( ρ ) , su ( a 0 ) / x ) ∈ R Γ ′ , x : Nat (PER-related, via the lifted-substitution evidence). Apply Theorem 6.38 on T T T to bridge the B3 inner-left:
⟦ T ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , su ( a 0 ) / x ) ) ) ≈ ⟦ T ⟧ ( ( ⟦ σ ⟧ ( ρ ) , su ( a 0 ) / x ) ) ∈ U i \llbracket T\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,\operatorname{su}(a_0)/x))) \approx\llbracket T\rrbracket((\llbracket\sigma\rrbracket(\rho),\operatorname{su}(a_0)/x)) \in\mathcal{U}_i [ [ T ] ] ( [ [ q ( σ ) ] ] (( ρ , su ( a 0 ) / x ))) ≈ [ [ T ] ] (( [ [ σ ] ] ( ρ ) , su ( a 0 ) / x )) ∈ U i
Both B2 and B3 inner-left values are now U i \mathcal{U}_i U i -related to the common value ⟦ T ⟧ ( ⟦ σ ⟧ ( ρ ) , su ( a 0 ) / x ) \llbracket T\rrbracket(\llbracket\sigma\rrbracket(\rho),\operatorname{su}(a_0)/x) [ [ T ] ] ( [ [ σ ] ] ( ρ ) , su ( a 0 ) / x ) , so by transitivity and Theorem 6.12, R B 2 ⇔ R B 3 R_{B_2} \Leftrightarrow R_{B_3} R B 2 ⇔ R B 3 .
Chaining: R s ⇔ R B 2 ⇔ R B 3 ⇔ R T R_s \Leftrightarrow R_{B_2} \Leftrightarrow R_{B_3} \Leftrightarrow R_T R s ⇔ R B 2 ⇔ R B 3 ⇔ R T . Hence b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T .
Case
N a t - N e e ≈ e ′ ∈ N e ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ N a t \begin{gathered}
\mathrm{Nat\text{-}Ne}\\
e \approx e' \in\mathrm{Ne}\\
\hline
\uparrow^N(e) \approx\uparrow^N(e') \in\mathrm{Nat}
\end{gathered} Nat - Ne e ≈ e ′ ∈ Ne ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ Nat
with a = ↑ N ( e ) a = \uparrow^N(e) a = ↑ N ( e ) , a ′ = ↑ N ( e ′ ) a' = \uparrow^N(e') a ′ = ↑ N ( e ′ ) . Compute the eliminator outputs by r e c - n e \mathrm{rec\text{-}ne} rec - ne :
⟦ T [ q ( σ ) ] ⟧ ( ( ρ , ↑ N ( e ) / x ) ) ↘ A \llbracket T[q(\sigma)]\rrbracket((\rho,\uparrow^N(e)/x)) \mathrel{\searrow} A [ [ T [ q ( σ )] ] ] (( ρ , ↑ N ( e ) / x )) ↘ A
(governing the left motive)
⟦ T ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , ↑ N ( e ′ ) / x ) ) ↘ A ′ \llbracket T'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),\uparrow^N(e')/x)) \mathrel{\searrow} A' [ [ T ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , ↑ N ( e ′ ) / x )) ↘ A ′
(governing the right motive)
A ≈ A ′ ∈ U i ↘ R T A \approx A' \in\mathcal{U}_i \mathrel{\searrow} R_T A ≈ A ′ ∈ U i ↘ R T
(by the second claim at ↑ N ( e ) ≈ ↑ N ( e ′ ) \uparrow^N(e) \approx\uparrow^N(e') ↑ N ( e ) ≈ ↑ N ( e ′ ) )
⟦ z [ σ ] ⟧ ( ρ ) ↘ a z , ⟦ z ′ [ σ ′ ] ⟧ ( ρ ′ ) ↘ a z ′ , a z ≈ a z ′ ∈ R z \llbracket z[\sigma]\rrbracket(\rho) \mathrel{\searrow} a_z,\qquad
\llbracket z'[\sigma']\rrbracket(\rho') \mathrel{\searrow} a'_z,\qquad
a_z \approx a'_z \in R_z [ [ z [ σ ] ] ] ( ρ ) ↘ a z , [ [ z ′ [ σ ′ ] ] ] ( ρ ′ ) ↘ a z ′ , a z ≈ a z ′ ∈ R z
(by hypothesis on z , z ′ z,z' z , z ′ )
b = ↑ A ( rec ( T [ q ( σ ) ] , a z , s [ q 2 ( σ ) ] , ρ , e ) ) b = \uparrow^A(\operatorname{rec}(T[q(\sigma)],a_z,s[q^2(\sigma)],\rho,e)) b = ↑ A ( rec ( T [ q ( σ )] , a z , s [ q 2 ( σ )] , ρ , e ))
(by r e c - n e \mathrm{rec\text{-}ne} rec - ne )
b ′ = ↑ A ′ ( rec ( T ′ , a z ′ , s ′ , ⟦ σ ′ ⟧ ( ρ ′ ) , e ′ ) ) b' = \uparrow^{A'}(\operatorname{rec}(T',a'_z,s',\llbracket\sigma'\rrbracket(\rho'),e')) b ′ = ↑ A ′ ( rec ( T ′ , a z ′ , s ′ , [ [ σ ′ ] ] ( ρ ′ ) , e ′ ))
(by r e c - n e \mathrm{rec\text{-}ne} rec - ne )
We must show b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T . By Item 2 on A ≈ A ′ ∈ U i ↘ R T A \approx A' \in\mathcal{U}_i \mathrel{\searrow} R_T A ≈ A ′ ∈ U i ↘ R T , it suffices to show
rec ( T [ q ( σ ) ] , a z , s [ q 2 ( σ ) ] , ρ , e ) ≈ rec ( T ′ , a z ′ , s ′ , ⟦ σ ′ ⟧ ( ρ ′ ) , e ′ ) ∈ N e , \operatorname{rec}(T[q(\sigma)],a_z,s[q^2(\sigma)],\rho,e)
\approx
\operatorname{rec}(T',a'_z,s',\llbracket\sigma'\rrbracket(\rho'),e')
\in\mathrm{Ne}, rec ( T [ q ( σ )] , a z , s [ q 2 ( σ )] , ρ , e ) ≈ rec ( T ′ , a z ′ , s ′ , [ [ σ ′ ] ] ( ρ ′ ) , e ′ ) ∈ Ne ,
i.e. for every depth n n n both sides read back via R n N e R_n^{\mathrm{Ne}} R n Ne to the same neutral normal form. By rule R e - r e c \mathrm{Re\text{-}rec} Re - rec :
R n N e ( rec ( T [ q ( σ ) ] , a z , s [ q 2 ( σ ) ] , ρ , e ) ) ↘ elim N a t ( x . W T ) w z ( x , y . w s ) u R_n^{\mathrm{Ne}}\bigl(\operatorname{rec}(T[q(\sigma)],a_z,s[q^2(\sigma)],\rho,e)\bigr)
\mathrel{\searrow}
\operatorname{elim}_{\mathrm{Nat}}(x.W_T)\,w_z\,(x,y.w_s)\,u R n Ne ( rec ( T [ q ( σ )] , a z , s [ q 2 ( σ )] , ρ , e ) ) ↘ elim Nat ( x . W T ) w z ( x , y . w s ) u
whenever
R n + 1 T y ( A x ) ↘ W T where ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , ↑ N ( ℓ n ) / x ) ) ↘ A x R_{n+1}^{\mathrm{Ty}}(A_x) \mathrel{\searrow} W_T
\qquad\text{where}\qquad
\llbracket T[q(\sigma)]\rrbracket((\rho,\uparrow^N(\ell_n)/x)) \mathrel{\searrow} A_x R n + 1 Ty ( A x ) ↘ W T where [ [ T [ q ( σ )] ] ] (( ρ , ↑ N ( ℓ n ) / x )) ↘ A x
R n N f ( ↓ A z ( a z ) ) ↘ w z where ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , z e / x ) ) ↘ A z R_n^{\mathrm{Nf}}(\downarrow A_z(a_z)) \mathrel{\searrow} w_z
\qquad\text{where}\qquad
\llbracket T[q(\sigma)]\rrbracket((\rho,\mathrm{ze}/x)) \mathrel{\searrow} A_z R n Nf ( ↓ A z ( a z )) ↘ w z where [ [ T [ q ( σ )] ] ] (( ρ , ze / x )) ↘ A z
⟦ s [ q 2 ( σ ) ] ⟧ ( ( ρ , ↑ N ( ℓ n ) / x , ↑ A x ( ℓ n + 1 ) / y ) ) ↘ b s \llbracket s[q^2(\sigma)]\rrbracket((\rho,\uparrow^N(\ell_n)/x,\uparrow^{A_x}(\ell_{n+1})/y)) \mathrel{\searrow} b_s [ [ s [ q 2 ( σ )] ] ] (( ρ , ↑ N ( ℓ n ) / x , ↑ A x ( ℓ n + 1 ) / y )) ↘ b s
R n + 2 N f ( ↓ A x s u c c ( b s ) ) ↘ w s where ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , su ( ↑ N ( ℓ n ) ) / x ) ) ↘ A x s u c c R_{n+2}^{\mathrm{Nf}}(\downarrow A_x^{\mathrm{succ}}(b_s)) \mathrel{\searrow} w_s
\qquad\text{where}\qquad
\llbracket T[q(\sigma)]\rrbracket((\rho,\operatorname{su}(\uparrow^N(\ell_n))/x)) \mathrel{\searrow} A_x^{\mathrm{succ}} R n + 2 Nf ( ↓ A x succ ( b s )) ↘ w s where [ [ T [ q ( σ )] ] ] (( ρ , su ( ↑ N ( ℓ n )) / x )) ↘ A x succ
R n N e ( e ) ↘ u R_n^{\mathrm{Ne}}(e) \mathrel{\searrow} u R n Ne ( e ) ↘ u
and analogously for the primed side, producing elim N a t ( x . W T ′ ) w z ′ ( x , y . w s ′ ) u ′ \operatorname{elim}_{\mathrm{Nat}}(x.W'_T)\,w'_z\,(x,y.w'_s)\,u' elim Nat ( x . W T ′ ) w z ′ ( x , y . w s ′ ) u ′ . We show each component reads back to the same syntactic form.
Motive W T = W T ′ W_T = W'_T W T = W T ′ . Apply the second claim of this lemma at the fresh-level relation ↑ N ( ℓ n ) ≈ ↑ N ( ℓ n ) ∈ N a t \uparrow^N(\ell_n) \approx\uparrow^N(\ell_n) \in\mathrm{Nat} ↑ N ( ℓ n ) ≈ ↑ N ( ℓ n ) ∈ Nat (by N a t - N e \mathrm{Nat\text{-}Ne} Nat - Ne , ℓ n ≈ ℓ n ∈ N e \ell_n \approx\ell_n \in\mathrm{Ne} ℓ n ≈ ℓ n ∈ Ne ):
⟦ T [ q ( σ ) ] ⟧ ( ( ρ , ↑ N ( ℓ n ) / x ) ) ≈ ⟦ T ′ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , ↑ N ( ℓ n ) / x ) ) ∈ U i ↘ R T q \llbracket T[q(\sigma)]\rrbracket((\rho,\uparrow^N(\ell_n)/x))
\approx
\llbracket T'\rrbracket((\llbracket\sigma'\rrbracket(\rho'),\uparrow^N(\ell_n)/x))
\in\mathcal{U}_i \mathrel{\searrow} R_T^q [ [ T [ q ( σ )] ] ] (( ρ , ↑ N ( ℓ n ) / x )) ≈ [ [ T ′ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , ↑ N ( ℓ n ) / x )) ∈ U i ↘ R T q
(second claim at ℓ n \ell_n ℓ n )
(by Item 3)
No separate env-pair construction is needed: the second claim is parametric in a ≈ a ′ ∈ N a t a \approx a' \in\mathrm{Nat} a ≈ a ′ ∈ Nat and directly relates the two motive values at envs over the heterogeneous source–target contexts.
Zero branch w z = w z ′ w_z = w'_z w z = w z ′ . By the N a t - Z e \mathrm{Nat\text{-}Ze} Nat - Ze sub-case proved above, a z ≈ a z ′ ∈ R T - a t - z e a_z \approx a'_z \in R_T\text{-}\mathrm{at\text{-}ze} a z ≈ a z ′ ∈ R T - at - ze (the PER governed by ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , z e / x ) ) \llbracket T[q(\sigma)]\rrbracket((\rho,\mathrm{ze}/x)) [ [ T [ q ( σ )] ] ] (( ρ , ze / x )) , which equals A z A_z A z ). By Item 1:
(by Item 1) Step branch w s = w s ′ w_s = w'_s w s = w s ′ . We obtain b s ≈ b s ′ b_s \approx b'_s b s ≈ b s ′ at fresh levels by replaying the Nat-Su case with a 0 : = ↑ N ( ℓ n ) a_0 := \uparrow^N(\ell_n) a 0 := ↑ N ( ℓ n ) . First, lift σ , σ ′ \sigma, \sigma' σ , σ ′ to handle the binders of s s s :
Γ ′ , x : N a t ⊢ q ( σ ) ≈ q ( σ ′ ) : Γ , x : N a t \Gamma', x : \mathop{\mathrm{Nat}} \vdash q(\sigma) \approx q(\sigma') : \Gamma, x : \mathop{\mathrm{Nat}} Γ ′ , x : Nat ⊢ q ( σ ) ≈ q ( σ ′ ) : Γ , x : Nat
(by Theorem 6.47 on σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ and Nat)
Γ ′ , x : N a t , y : T [ q ( σ ) ] ⊢ q 2 ( σ ) ≈ q 2 ( σ ′ ) : Γ , x : N a t , y : T \Gamma', x : \mathop{\mathrm{Nat}}, y : T[q(\sigma)] \vdash q^2(\sigma) \approx q^2(\sigma') : \Gamma, x : \mathop{\mathrm{Nat}}, y : T Γ ′ , x : Nat , y : T [ q ( σ )] ⊢ q 2 ( σ ) ≈ q 2 ( σ ′ ) : Γ , x : Nat , y : T
(by Theorem 6.47 again on T T T )
Build the env-pair via two applications of Ctx-Ext:
↑ N ( ℓ n ) ≈ ↑ N ( ℓ n ) ∈ N a t \uparrow^N(\ell_n) \approx\uparrow^N(\ell_n) \in\mathop{\mathrm{Nat}} ↑ N ( ℓ n ) ≈ ↑ N ( ℓ n ) ∈ Nat
(Nat-Ne, ℓ n ≈ ℓ n ∈ N e \ell_n \approx\ell_n \in\mathop{\mathrm{Ne}} ℓ n ≈ ℓ n ∈ Ne )
( ρ , ↑ N ( ℓ n ) / x ) ≈ ( ρ ′ , ↑ N ( ℓ n ) / x ) ∈ R Γ ′ , x : N a t (\rho, \uparrow^N(\ell_n)/x) \approx(\rho', \uparrow^N(\ell_n)/x) \in R_{\Gamma',x:\mathop{\mathrm{Nat}}} ( ρ , ↑ N ( ℓ n ) / x ) ≈ ( ρ ′ , ↑ N ( ℓ n ) / x ) ∈ R Γ ′ , x : Nat
(Ctx-Ext, head Nat)
↑ A x ( ℓ n + 1 ) ≈ ↑ A x ′ ( ℓ n + 1 ) ∈ R T ℓ \uparrow^{A_x}(\ell_{n+1}) \approx\uparrow^{A'_x}(\ell_{n+1}) \in R_T^\ell ↑ A x ( ℓ n + 1 ) ≈ ↑ A x ′ ( ℓ n + 1 ) ∈ R T ℓ
(by Item 2 on ℓ n + 1 ≈ ℓ n + 1 ∈ N e \ell_{n+1} \approx\ell_{n+1} \in\mathop{\mathrm{Ne}} ℓ n + 1 ≈ ℓ n + 1 ∈ Ne )
( ρ , ↑ N ( ℓ n ) / x , ↑ A x ( ℓ n + 1 ) / y ) ≈ ( ρ ′ , ↑ N ( ℓ n ) / x , ↑ A x ′ ( ℓ n + 1 ) / y ) ∈ R Γ ′ , x : N a t , y : T [ q ( σ ) ] (\rho, \uparrow^N(\ell_n)/x, \uparrow^{A_x}(\ell_{n+1})/y)
\approx
(\rho', \uparrow^N(\ell_n)/x, \uparrow^{A'_x}(\ell_{n+1})/y)
\in R_{\Gamma',x:\mathop{\mathrm{Nat}},y:T[q(\sigma)]} ( ρ , ↑ N ( ℓ n ) / x , ↑ A x ( ℓ n + 1 ) / y ) ≈ ( ρ ′ , ↑ N ( ℓ n ) / x , ↑ A x ′ ( ℓ n + 1 ) / y ) ∈ R Γ ′ , x : Nat , y : T [ q ( σ )]
(Ctx-Ext, head R T ℓ R_T^\ell R T ℓ )
Apply Γ , x : N a t , y : T ⊢ s ≈ s ′ : T [ ⟦ ↑ ∘ ↑ , s u c c x 1 / x ⟧ ] \Gamma, x : \mathop{\mathrm{Nat}}, y : T \vdash s \approx s' : T[\llbracket\uparrow\mathbin{\circ} \uparrow,\mathop{\mathrm{succ}} x_1/x\rrbracket] Γ , x : Nat , y : T ⊢ s ≈ s ′ : T [ [ [ ↑ ∘ ↑ , succ x 1 / x ] ] ] at Γ ′ , x : N a t , y : T [ q ( σ ) ] \Gamma', x : \mathop{\mathrm{Nat}}, y : T[q(\sigma)] Γ ′ , x : Nat , y : T [ q ( σ )] , the doubly-lifted substitution q 2 ( σ ) ≈ q 2 ( σ ′ ) q^2(\sigma) \approx q^2(\sigma') q 2 ( σ ) ≈ q 2 ( σ ′ ) , and this env-pair. The four-value pattern of s , s ′ s, s' s , s ′ gives:
b s ≈ b s ′ ∈ R T s t e p b_s \approx b'_s \in R_T^{\mathop{\mathrm{step}}} b s ≈ b s ′ ∈ R T step
(outer-left vs inner-right, parallel to the helper’s Nat-Su case)
where R T s t e p R_T^{\mathop{\mathrm{step}}} R T step is governed by ⟦ T [ ⟦ ↑ ∘ ↑ , s u c c x 1 / x ⟧ ] ⟧ [ q 2 ( σ ) ] ( ( ρ , ↑ N ( ℓ n ) / x , ↑ A x ( ℓ n + 1 ) / y ) ) \llbracket T[\llbracket\uparrow\mathbin{\circ} \uparrow,\mathop{\mathrm{succ}} x_1/x\rrbracket]\rrbracket[q^2(\sigma)]((\rho,\uparrow^N(\ell_n)/x,\uparrow^{A_x}(\ell_{n+1})/y)) [ [ T [ [ [ ↑ ∘ ↑ , succ x 1 / x ] ] ] ] ] [ q 2 ( σ )] (( ρ , ↑ N ( ℓ n ) / x , ↑ A x ( ℓ n + 1 ) / y )) .
By the B1/B2/B3 bridging of the Nat-Su case (with a 0 a_0 a 0 replaced by ↑ N ( ℓ n ) \uparrow^N(\ell_n) ↑ N ( ℓ n ) ):
R T s t e p ⟺ R T s u c c -at-su ( ↑ N ( ℓ n ) ) R_T^{\mathop{\mathrm{step}}} \Longleftrightarrow R_T^{\mathop{\mathrm{succ}}\text{-at-su}}(\uparrow^N(\ell_n)) R T step ⟺ R T succ -at-su ( ↑ N ( ℓ n ))
(B1/B2/B3 bridges, Theorem 6.12)
i.e. the PER at ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , s u ( ↑ N ( ℓ n ) ) / x ) ) \llbracket T[q(\sigma)]\rrbracket((\rho,\mathop{\mathrm{su}}(\uparrow^N(\ell_n))/x)) [ [ T [ q ( σ )] ] ] (( ρ , su ( ↑ N ( ℓ n )) / x )) , which equals A x s u c c A_x^{\mathop{\mathrm{succ}}} A x succ . Hence b s ≈ b s ′ ∈ R T s u c c -at-su ( ℓ n ) b_s \approx b'_s \in R_T^{\mathop{\mathrm{succ}}\text{-at-su}}(\ell_n) b s ≈ b s ′ ∈ R T succ -at-su ( ℓ n ) , and:
(by Item 1)
Underlying neutral u = u ′ u = u' u = u ′ . By hypothesis e ≈ e ′ ∈ N e e \approx e' \in\mathop{\mathrm{Ne}} e ≈ e ′ ∈ Ne :
R n N e ( e ) ↘ u , R n N e ( e ′ ) ↘ u R_n^{\mathop{\mathrm{Ne}}}(e) \searrow u,\qquad R_n^{\mathop{\mathrm{Ne}}}(e') \searrow u R n Ne ( e ) ↘ u , R n Ne ( e ′ ) ↘ u
(by definition of Ne)
Combining:
R n N e ( rec ( T [ q ( σ ) ] , a z , s [ q 2 ( σ ) ] , ρ , e ) ) ↘ elim N a t ( x . W T ) w z ( x , y . w s ) u R^{\mathop{\mathrm{Ne}}}_n(\operatorname{rec}(T[q(\sigma)],a_z,s[q^2(\sigma)],\rho,e))
\searrow
\operatorname{elim}_{\mathop{\mathrm{Nat}}}(x.W_T)\ w_z\ (x,y.w_s)\ u R n Ne ( rec ( T [ q ( σ )] , a z , s [ q 2 ( σ )] , ρ , e )) ↘ elim Nat ( x . W T ) w z ( x , y . w s ) u
R n N e ( rec ( T ′ , a z ′ , s ′ , ⟦ σ ′ ⟧ ( ρ ′ ) , e ′ ) ) ↘ elim N a t ( x . W T ) w z ( x , y . w s ) u R^{\mathop{\mathrm{Ne}}}_n(\operatorname{rec}(T',a'_z,s',\llbracket\sigma'\rrbracket(\rho'),e'))
\searrow
\operatorname{elim}_{\mathop{\mathrm{Nat}}}(x.W_T)\ w_z\ (x,y.w_s)\ u R n Ne ( rec ( T ′ , a z ′ , s ′ , [ [ σ ′ ] ] ( ρ ′ ) , e ′ )) ↘ elim Nat ( x . W T ) w z ( x , y . w s ) u
(same syntactic form)
rec ( T [ q ( σ ) ] , a z , s [ q 2 ( σ ) ] , ρ , e ) ≈ rec ( T ′ , a z ′ , s ′ , ⟦ σ ′ ⟧ ( ρ ′ ) , e ′ ) ∈ N e \operatorname{rec}(T[q(\sigma)],a_z,s[q^2(\sigma)],\rho,e)
\approx
\operatorname{rec}(T',a'_z,s',\llbracket\sigma'\rrbracket(\rho'),e')
\in\mathop{\mathrm{Ne}} rec ( T [ q ( σ )] , a z , s [ q 2 ( σ )] , ρ , e ) ≈ rec ( T ′ , a z ′ , s ′ , [ [ σ ′ ] ] ( ρ ′ ) , e ′ ) ∈ Ne
(definition of Ne)
Hence b ≈ b ′ ∈ R T b \approx b' \in R_T b ≈ b ′ ∈ R T . □
Lemma 6.63 (Fundamental — N-E / Rec-Cong). If Γ , x : N a t ⊢ T ≈ T ′ : T y i \Gamma, x : \mathop{\mathrm{Nat}} \vdash T \approx T' : \mathop{\mathrm{Ty}}_i Γ , x : Nat ⊢ T ≈ T ′ : Ty i , Γ ⊢ z ≈ z ′ : T [ z e r o / x ] \Gamma\vdash z \approx z' : T[\mathop{\mathrm{zero}}/x] Γ ⊢ z ≈ z ′ : T [ zero / x ] , Γ , x : N a t , y : T ⊢ s ≈ s ′ : T [ ⟦ ↑ ∘ ↑ , s u c c x 1 / x ⟧ ] \Gamma, x : \mathop{\mathrm{Nat}}, y : T \vdash s \approx s' : T[\llbracket\uparrow\mathbin{\circ} \uparrow,\mathop{\mathrm{succ}} x_1/x\rrbracket] Γ , x : Nat , y : T ⊢ s ≈ s ′ : T [ [ [ ↑ ∘ ↑ , succ x 1 / x ] ] ] , and Γ ⊢ t ≈ t ′ : N a t \Gamma\vdash t \approx t' : \mathop{\mathrm{Nat}} Γ ⊢ t ≈ t ′ : Nat , then Γ ⊢ elim N a t ( x . T ) z ( x , y . s ) t ≈ elim N a t ( x . T ′ ) z ′ ( x , y . s ′ ) t ′ : T [ t / x ] \Gamma\vdash\operatorname{elim}_{\mathop{\mathrm{Nat}}}(x.T)\ z\ (x,y.s)\ t \approx\operatorname{elim}_{\mathop{\mathrm{Nat}}}(x.T')\ z'\ (x,y.s')\ t' : T[t/x] Γ ⊢ elim Nat ( x . T ) z ( x , y . s ) t ≈ elim Nat ( x . T ′ ) z ′ ( x , y . s ′ ) t ′ : T [ t / x ] .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. Write ρ σ : = ⟦ σ ⟧ ( ρ ) \rho_\sigma:= \llbracket\sigma\rrbracket(\rho) ρ σ := [ [ σ ] ] ( ρ ) and ρ σ ′ : = ⟦ σ ′ ⟧ ( ρ ′ ) \rho_{\sigma'} := \llbracket\sigma'\rrbracket(\rho') ρ σ ′ := [ [ σ ′ ] ] ( ρ ′ ) . From Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ at id, D \mathcal{D} D : ρ σ ≈ ρ σ ′ ∈ R Γ \rho_\sigma\approx\rho_{\sigma'} \in R_\Gamma ρ σ ≈ ρ σ ′ ∈ R Γ where Γ ≈ Γ ↘ R Γ \Gamma\approx\Gamma\searrow R_\Gamma Γ ≈ Γ ↘ R Γ .
By Γ ⊢ t ≈ t ′ : N a t \Gamma\vdash t \approx t' : \mathop{\mathrm{Nat}} Γ ⊢ t ≈ t ′ : Nat applied at Γ ′ \Gamma' Γ ′ , σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ , ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ :
{ ⟦ t [ σ ] ⟧ ( ρ ) , ⟦ t ⟧ ( ρ σ ) , ⟦ t ′ ⟧ ( ρ σ ′ ) , ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ N a t \{\llbracket t[\sigma]\rrbracket(\rho),\ \llbracket t\rrbracket(\rho_\sigma),\ \llbracket t'\rrbracket(\rho_{\sigma'}),\ \llbracket t'[\sigma']\rrbracket(\rho')\} \subseteq\mathop{\mathrm{Nat}} { [ [ t [ σ ] ] ] ( ρ ) , [ [ t ] ] ( ρ σ ) , [ [ t ′ ] ] ( ρ σ ′ ) , [ [ t ′ [ σ ′ ] ] ] ( ρ ′ )} ⊆ Nat
(by hypothesis on t , t ′ t,t' t , t ′ )
Compute the four eliminator term values:
⟦ ( elim N a t ( x . T ) z ( x , y . s ) t ) [ σ ] ⟧ ( ρ ) (4) \llbracket(\operatorname{elim}_{\mathop{\mathrm{Nat}}}(x.T)\ z\ (x,y.s)\ t)[\sigma]\rrbracket(\rho) \tag*{(4)} [ [ ( elim Nat ( x . T ) z ( x , y . s ) t ) [ σ ] ] ] ( ρ ) (4)
⟦ elim N a t ( x . T [ q ( σ ) ] ) z [ σ ] ( x , y . s [ q 2 ( σ ) ] ) t [ σ ] ⟧ ( ρ ) = rec ( ⟦ t [ σ ] ⟧ ( ρ ) , T [ q ( σ ) ] , z [ σ ] , s [ q 2 ( σ ) ] , ρ ) \begin{aligned}
\llbracket\operatorname{elim}_{\mathrm{Nat}}\ (x.T[q(\sigma)])\ z[\sigma]\ (x,y.s[q^2(\sigma)])\ t[\sigma]\rrbracket(\rho) \\
&= \operatorname{rec}(\llbracket t[\sigma]\rrbracket(\rho),T[q(\sigma)],z[\sigma],s[q^2(\sigma)],\rho)
\end{aligned} [ [ elim Nat ( x . T [ q ( σ )]) z [ σ ] ( x , y . s [ q 2 ( σ )]) t [ σ ] ] ] ( ρ ) = rec ( [ [ t [ σ ] ] ] ( ρ ) , T [ q ( σ )] , z [ σ ] , s [ q 2 ( σ )] , ρ )
(by ev-rec)
⟦ elim N a t ( x . T ) z ( x , y . s ) t ⟧ ( ρ σ ) = rec ( ⟦ t ⟧ ( ρ σ ) , T , z , s , ρ σ ) \begin{aligned}
\llbracket\operatorname{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ t\rrbracket(\rho\sigma) \\
&= \operatorname{rec}(\llbracket t\rrbracket(\rho\sigma),T,z,s,\rho\sigma)
\end{aligned} [ [ elim Nat ( x . T ) z ( x , y . s ) t ] ] ( ρ σ ) = rec ( [ [ t ] ] ( ρ σ ) , T , z , s , ρ σ )
(by ev-rec)
Analogous computations for the primed pair (using z ′ z' z ′ , s ′ s' s ′ , t ′ t' t ′ ): rec ( ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) , T [ q ( σ ′ ) ] , z ′ [ σ ′ ] , s ′ [ q 2 ( σ ′ ) ] , ρ ′ ) \operatorname{rec}(\llbracket t'[\sigma']\rrbracket(\rho'),T[q(\sigma')],z'[\sigma'],s'[q^2(\sigma')],\rho') rec ( [ [ t ′ [ σ ′ ] ] ] ( ρ ′ ) , T [ q ( σ ′ )] , z ′ [ σ ′ ] , s ′ [ q 2 ( σ ′ )] , ρ ′ ) and rec ( ⟦ t ′ ⟧ ( ρ ′ σ ′ ) , T , z ′ , s ′ , ρ ′ σ ′ ) \operatorname{rec}(\llbracket t'\rrbracket(\rho'\sigma'),T,z',s',\rho'\sigma') rec ( [ [ t ′ ] ] ( ρ ′ σ ′ ) , T , z ′ , s ′ , ρ ′ σ ′ ) .
Before applying the helpers, derive reflexive instances of all hypotheses (the helpers’ RHS are in primed form; we sometimes need unprimed-to-unprimed instances):
Γ , x : Nat ⊢ T ≈ T : Ty i \Gamma,x:\operatorname{Nat}\vdash T\approx T:\operatorname{Ty}_i Γ , x : Nat ⊢ T ≈ T : Ty i
(reflexive, by Theorems 6.48 and 6.49 on T ≈ T ′ T\approx T' T ≈ T ′ )
Γ ⊢ z ≈ z : T [ zero / x ] \Gamma\vdash z\approx z:T[\operatorname{zero}/x] Γ ⊢ z ≈ z : T [ zero / x ]
(reflexive)
Γ , x : Nat , y : T ⊢ s ≈ s : T [ ⟦ ⇑ ∘ ⇑ , succ x 1 / x ⟧ ] \Gamma,x:\operatorname{Nat},y:T\vdash s\approx s:T[\llbracket\Uparrow\circ\Uparrow,\operatorname{succ}\ x_1/x\rrbracket] Γ , x : Nat , y : T ⊢ s ≈ s : T [ [ [ ⇑ ∘ ⇑ , succ x 1 / x ] ] ]
(reflexive)
Γ ⊢ t ≈ t : Nat \Gamma\vdash t\approx t:\operatorname{Nat} Γ ⊢ t ≈ t : Nat
(reflexive)
Γ ′ ⊢ σ ≈ σ : Γ \Gamma'\vdash\sigma\approx\sigma:\Gamma Γ ′ ⊢ σ ≈ σ : Γ
(reflexive)
(Primed analogues hold symmetrically.)
Inner pair via the unsubstituted helper. Apply Theorem 6.61 at T ≈ T T\approx T T ≈ T (reflexive), z ≈ z ′ z\approx z' z ≈ z ′ , s ≈ s ′ s\approx s' s ≈ s ′ , R Γ R_\Gamma R Γ , env-pair ρ σ ≈ ρ ′ σ ′ \rho\sigma\approx\rho'\sigma' ρ σ ≈ ρ ′ σ ′ , and witness ⟦ t ⟧ ( ρ σ ) ≈ ⟦ t ′ ⟧ ( ρ ′ σ ′ ) ∈ Nat \llbracket t\rrbracket(\rho\sigma)\approx\llbracket t'\rrbracket(\rho'\sigma')\in\operatorname{Nat} [ [ t ] ] ( ρ σ ) ≈ [ [ t ′ ] ] ( ρ ′ σ ′ ) ∈ Nat (inner-left vs inner-right of the four-value pattern of t , t ′ t,t' t , t ′ ):
rec ( ⟦ t ⟧ ( ρ σ ) , T , z , s , ρ σ ) ↘ b i \operatorname{rec}(\llbracket t\rrbracket(\rho\sigma),T,z,s,\rho\sigma)\mathrel{\searrow}b_i rec ( [ [ t ] ] ( ρ σ ) , T , z , s , ρ σ ) ↘ b i
rec ( ⟦ t ′ ⟧ ( ρ ′ σ ′ ) , T , z ′ , s ′ , ρ ′ σ ′ ) ↘ b i ′ \operatorname{rec}(\llbracket t'\rrbracket(\rho'\sigma'),T,z',s',\rho'\sigma')\mathrel{\searrow}b'_i rec ( [ [ t ′ ] ] ( ρ ′ σ ′ ) , T , z ′ , s ′ , ρ ′ σ ′ ) ↘ b i ′
b i ≈ b i ′ ∈ R T b_i\approx b'_i\in R_T b i ≈ b i ′ ∈ R T
(by Theorem 6.61)
where R T R_T R T is governed by ⟦ T ⟧ ( ( ρ σ , ⟦ t ⟧ ( ρ σ ) / x ) ) ≈ ⟦ T ⟧ ( ( ρ ′ σ ′ , ⟦ t ′ ⟧ ( ρ ′ σ ′ ) / x ) ) ∈ U i ↘ R T \llbracket T\rrbracket((\rho\sigma,\llbracket t\rrbracket(\rho\sigma)/x))\approx\llbracket T\rrbracket((\rho'\sigma',\llbracket t'\rrbracket(\rho'\sigma')/x))\in U_i\mathrel{\searrow}R_T [ [ T ] ] (( ρ σ , [ [ t ] ] ( ρ σ ) / x )) ≈ [ [ T ] ] (( ρ ′ σ ′ , [ [ t ′ ] ] ( ρ ′ σ ′ ) / x )) ∈ U i ↘ R T . These match the goal’s inner-left and inner-right term values.
Outer-vs-inner via the one-sided helper. Apply Theorem 6.62 at T ≈ T T\approx T T ≈ T , z ≈ z z\approx z z ≈ z , s ≈ s s\approx s s ≈ s (all reflexive), Γ ′ ≈ Γ ′ ↘ R ′ \Gamma'\approx\Gamma'\mathrel{\searrow}R' Γ ′ ≈ Γ ′ ↘ R ′ , σ ≈ σ \sigma\approx\sigma σ ≈ σ (reflexive), ρ ≈ ρ ∈ R ′ \rho\approx\rho\in R' ρ ≈ ρ ∈ R ′ (reflexive), and witness ⟦ t [ σ ] ⟧ ( ρ ) ≈ ⟦ t ⟧ ( ρ σ ) ∈ Nat \llbracket t[\sigma]\rrbracket(\rho)\approx\llbracket t\rrbracket(\rho\sigma)\in\operatorname{Nat} [ [ t [ σ ] ] ] ( ρ ) ≈ [ [ t ] ] ( ρ σ ) ∈ Nat (outer-left vs inner-left of the four-value pattern of t t t ):
rec ( ⟦ t [ σ ] ⟧ ( ρ ) , T [ q ( σ ) ] , z [ σ ] , s [ q 2 ( σ ) ] , ρ ) ↘ b o \operatorname{rec}(\llbracket t[\sigma]\rrbracket(\rho),T[q(\sigma)],z[\sigma],s[q^2(\sigma)],\rho)\mathrel{\searrow}b_o rec ( [ [ t [ σ ] ] ] ( ρ ) , T [ q ( σ )] , z [ σ ] , s [ q 2 ( σ )] , ρ ) ↘ b o
rec ( ⟦ t ⟧ ( ρ σ ) , T , z , s , ρ σ ) ↘ b i \operatorname{rec}(\llbracket t\rrbracket(\rho\sigma),T,z,s,\rho\sigma)\mathrel{\searrow}b_i rec ( [ [ t ] ] ( ρ σ ) , T , z , s , ρ σ ) ↘ b i
b o ≈ b i ∈ R T o i b_o\approx b_i\in R_T^{oi} b o ≈ b i ∈ R T o i
(by Theorem 6.62)
where R T o i R_T^{oi} R T o i is governed by ⟦ T [ q ( σ ) ] ⟧ ( ( ρ , ⟦ t [ σ ] ⟧ ( ρ ) / x ) ) ≈ ⟦ T ⟧ ( ( ρ σ , ⟦ t ⟧ ( ρ σ ) / x ) ) ∈ U i ↘ R T o i \llbracket T[q(\sigma)]\rrbracket((\rho,\llbracket t[\sigma]\rrbracket(\rho)/x))\approx\llbracket T\rrbracket((\rho\sigma,\llbracket t\rrbracket(\rho\sigma)/x))\in U_i\mathrel{\searrow}R_T^{oi} [ [ T [ q ( σ )] ] ] (( ρ , [ [ t [ σ ] ] ] ( ρ ) / x )) ≈ [ [ T ] ] (( ρ σ , [ [ t ] ] ( ρ σ ) / x )) ∈ U i ↘ R T o i . By Theorem 6.12, R T o i ⇄ R T R_T^{oi}\rightleftarrows R_T R T o i ⇄ R T . Hence b o ≈ b i ∈ R T b_o\approx b_i\in R_T b o ≈ b i ∈ R T .
Apply Theorem 6.62 symmetrically at the primed reflexive instances (T ′ ≈ T ′ T'\approx T' T ′ ≈ T ′ , z ′ ≈ z ′ z'\approx z' z ′ ≈ z ′ , s ′ ≈ s ′ s'\approx s' s ′ ≈ s ′ , σ ′ ≈ σ ′ \sigma'\approx\sigma' σ ′ ≈ σ ′ , ρ ′ ≈ ρ ′ ∈ R ′ \rho'\approx\rho'\in R' ρ ′ ≈ ρ ′ ∈ R ′ ), with witness ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) ≈ ⟦ t ′ ⟧ ( ρ ′ σ ′ ) ∈ Nat \llbracket t'[\sigma']\rrbracket(\rho')\approx\llbracket t'\rrbracket(\rho'\sigma')\in\operatorname{Nat} [ [ t ′ [ σ ′ ] ] ] ( ρ ′ ) ≈ [ [ t ′ ] ] ( ρ ′ σ ′ ) ∈ Nat :
b o ′ ≈ b i ′ ∈ R T b'_o\approx b'_i\in R_T b o ′ ≈ b i ′ ∈ R T
(by Theorem 6.62 and Theorem 6.12)
Combining. We assemble the four goal term values:
b i ≈ b i ′ ∈ R T b_i\approx b'_i\in R_T b i ≈ b i ′ ∈ R T
(inner pair, above)
b o ≈ b i ∈ R T b_o\approx b_i\in R_T b o ≈ b i ∈ R T
(outer-vs-inner, left side, above)
b o ′ ≈ b i ′ ∈ R T b'_o\approx b'_i\in R_T b o ′ ≈ b i ′ ∈ R T
(outer-vs-inner, right side, above)
b o ≈ b o ′ ∈ R T b_o\approx b'_o\in R_T b o ≈ b o ′ ∈ R T
(by symmetry and transitivity of R T R_T R T ) Thus all four goal term values { b o , b i , b o ′ , b i ′ } \{b_o, b_i, b'_o, b'_i\} { b o , b i , b o ′ , b i ′ } are pairwise related in R T R_T R T .
Type part. The goal type is T [ t / x ] T[t/x] T [ t / x ] on the LHS and T ′ [ t ′ / x ] T'[t'/x] T ′ [ t ′ / x ] on the RHS (by the syntactic conclusion’s type, via the four-value pattern of the outer Γ ⊢ elim N a t ( … ) … ( … ) t ≈ elim N a t ( … ) … ( … ) t ′ : T [ t / x ] \Gamma\vdash\operatorname{elim}_{\mathrm{Nat}}(\ldots)\ldots(\ldots)\ t \approx\operatorname{elim}_{\mathrm{Nat}}(\ldots)\ldots(\ldots)\ t' : T[t/x] Γ ⊢ elim Nat ( … ) … ( … ) t ≈ elim Nat ( … ) … ( … ) t ′ : T [ t / x ] semantic judgment). We bridge the four goal type values via outer and inner instantiations of T ≈ T ′ T \approx T' T ≈ T ′ .
Outer instantiation. By Theorem 6.45 on Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ and Γ ⊢ t ≈ t ′ : N a t \Gamma\vdash t \approx t' : \mathrm{Nat} Γ ⊢ t ≈ t ′ : Nat :
Γ ′ ⊢ ( σ , t [ σ ] / x ) ≈ ( σ ′ , t ′ [ σ ′ ] / x ) : Γ , x : N a t \Gamma' \vdash(\sigma,t[\sigma]/x) \approx(\sigma',t'[\sigma']/x) : \Gamma,x:\mathrm{Nat} Γ ′ ⊢ ( σ , t [ σ ] / x ) ≈ ( σ ′ , t ′ [ σ ′ ] / x ) : Γ , x : Nat
Apply Γ , x : N a t ⊢ T ≈ T ′ : T y i \Gamma,x:\mathrm{Nat} \vdash T \approx T' : \mathrm{Ty}_i Γ , x : Nat ⊢ T ≈ T ′ : Ty i at Γ ′ \Gamma' Γ ′ , this semantic substitution, and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ :
{ ⟦ T [ σ , t [ σ ] / x ] ⟧ ( ρ ) , ⟦ T ⟧ ( ( ρ σ , ⟦ t [ σ ] ⟧ ( ρ ) / x ) ) , ⟦ T ′ ⟧ ( ( ρ ′ σ ′ , ⟦ t ′ [ σ ′ ] ⟧ ( ρ ′ ) / x ) ) , ⟦ T ′ [ σ ′ , t ′ [ σ ′ ] / x ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R T o u t \left\{\llbracket T[\sigma,t[\sigma]/x]\rrbracket(\rho),\llbracket T\rrbracket((\rho\sigma,\llbracket t[\sigma]\rrbracket(\rho)/x)),\llbracket T'\rrbracket((\rho'\sigma',\llbracket t'[\sigma']\rrbracket(\rho')/x)),\llbracket T'[\sigma',t'[\sigma']/x]\rrbracket(\rho')\right\}\subseteq\mathcal{U}_i\mathbin{\searrow}R_T^{\mathrm{out}} { [ [ T [ σ , t [ σ ] / x ] ] ] ( ρ ) , [ [ T ] ] (( ρ σ , [ [ t [ σ ] ] ] ( ρ ) / x )) , [ [ T ′ ] ] (( ρ ′ σ ′ , [ [ t ′ [ σ ′ ] ] ] ( ρ ′ ) / x )) , [ [ T ′ [ σ ′ , t ′ [ σ ′ ] / x ] ] ] ( ρ ′ ) } ⊆ U i ↘ R T out
T [ σ , t [ σ ] / x ] = ( T [ t / x ] ) [ σ ] T[\sigma,t[\sigma]/x]=(T[t/x])[\sigma] T [ σ , t [ σ ] / x ] = ( T [ t / x ]) [ σ ] (by Theorem 2.30)
T ′ [ σ ′ , t ′ [ σ ′ ] / x ] = ( T ′ [ t ′ / x ] ) [ σ ′ ] T'[\sigma',t'[\sigma']/x]=(T'[t'/x])[\sigma'] T ′ [ σ ′ , t ′ [ σ ′ ] / x ] = ( T ′ [ t ′ / x ]) [ σ ′ ] (by Theorem 2.30)
Now the goal’s outer-RHS type is ⟦ ⟧ ( ρ ′ ) \llbracket\rrbracket(\rho') [ [ ] ] ( ρ ′ ) , but the outer instantiation gives ⟦ ( T ′ [ t ′ / x ] ) [ σ ′ ] ⟧ ( ρ ′ ) \llbracket(T'[t'/x])[\sigma']\rrbracket(\rho') [ [ ( T ′ [ t ′ / x ]) [ σ ′ ] ] ] ( ρ ′ ) . We show these coincide modulo U i \mathcal{U}_i U i :
⟦ ⟧ ( ρ ′ ) ≈ ⟦ ( T ′ [ t ′ / x ] ) [ σ ′ ] ⟧ ( ρ ′ ) ∈ U i \llbracket\rrbracket(\rho')\approx\llbracket(T'[t'/x])[\sigma']\rrbracket(\rho')\in\mathcal{U}_i [ [ ] ] ( ρ ′ ) ≈ [ [ ( T ′ [ t ′ / x ]) [ σ ′ ] ] ] ( ρ ′ ) ∈ U i
So the four values lie in U i ↘ R T o u t \mathcal{U}_i\mathbin{\searrow}R_T^{\mathrm{out}} U i ↘ R T out with the outer-LHS value exactly matching the goal’s ⟦ ⟧ ( ρ ) \llbracket\rrbracket(\rho) [ [ ] ] ( ρ ) and the outer-RHS value matching the goal’s ⟦ ⟧ ( ρ ′ ) \llbracket\rrbracket(\rho') [ [ ] ] ( ρ ′ ) (modulo U i \mathcal{U}_i U i , hence by Theorem 6.12).
Inner instantiation. By Theorem 6.45 over Γ \Gamma Γ on Γ ⊢ id ≈ id : Γ \Gamma\vdash\operatorname{id}\approx\operatorname{id}:\Gamma Γ ⊢ id ≈ id : Γ and Γ ⊢ t ≈ t ′ : N a t \Gamma\vdash t\approx t':\mathrm{Nat} Γ ⊢ t ≈ t ′ : Nat :
Γ ⊢ ( id , t / x ) ≈ ( id , t ′ / x ) : Γ , x : N a t \Gamma\vdash(\operatorname{id},t/x)\approx(\operatorname{id},t'/x):\Gamma,x:\mathrm{Nat} Γ ⊢ ( id , t / x ) ≈ ( id , t ′ / x ) : Γ , x : Nat
Apply Γ , x : N a t ⊢ T ≈ T ′ : T y i \Gamma,x:\mathrm{Nat}\vdash T\approx T':\mathrm{Ty}_i Γ , x : Nat ⊢ T ≈ T ′ : Ty i at Γ \Gamma Γ , this semantic substitution, and ρ σ ≈ ρ ′ σ ′ ∈ R Γ \rho\sigma\approx\rho'\sigma'\in R_\Gamma ρ σ ≈ ρ ′ σ ′ ∈ R Γ :
{ ⟦ T [ id , t / x ] ⟧ ( ρ σ ) , ⟦ T ⟧ ( ( ρ σ , ⟦ t ⟧ ( ρ σ ) / x ) ) , ⟦ T ′ ⟧ ( ( ρ ′ σ ′ , ⟦ t ′ ⟧ ( ρ ′ σ ′ ) / x ) ) , ⟦ T ′ [ id , t ′ / x ] ⟧ ( ρ ′ σ ′ ) } ⊆ U i ↘ R T i n \left\{\llbracket T[\operatorname{id},t/x]\rrbracket(\rho\sigma),\llbracket T\rrbracket((\rho\sigma,\llbracket t\rrbracket(\rho\sigma)/x)),\llbracket T'\rrbracket((\rho'\sigma',\llbracket t'\rrbracket(\rho'\sigma')/x)),\llbracket T'[\operatorname{id},t'/x]\rrbracket(\rho'\sigma')\right\}\subseteq\mathcal{U}_i\mathbin{\searrow}R_T^{\mathrm{in}} { [ [ T [ id , t / x ] ] ] ( ρ σ ) , [ [ T ] ] (( ρ σ , [ [ t ] ] ( ρ σ ) / x )) , [ [ T ′ ] ] (( ρ ′ σ ′ , [ [ t ′ ] ] ( ρ ′ σ ′ ) / x )) , [ [ T ′ [ id , t ′ / x ] ] ] ( ρ ′ σ ′ ) } ⊆ U i ↘ R T in
T [ id , t / x ] = T [ t / x ] T[\operatorname{id},t/x]=T[t/x] T [ id , t / x ] = T [ t / x ] (definition of single substitution)
T ′ [ id , t ′ / x ] = T ′ [ t ′ / x ] T'[\operatorname{id},t'/x]=T'[t'/x] T ′ [ id , t ′ / x ] = T ′ [ t ′ / x ] (definition of single substitution)
Bridging. The inner-pair values ⟦ T ⟧ ( ( ρ σ , ⟦ t ⟧ ( ρ σ ) / x ) ) \llbracket T\rrbracket((\rho\sigma,\llbracket t\rrbracket(\rho\sigma)/x)) [ [ T ] ] (( ρ σ , [ [ t ] ] ( ρ σ ) / x )) (shared between outer and inner instantiations) and ⟦ T ′ ⟧ ( ( ρ ′ σ ′ , ⟦ t ′ ⟧ ( ρ ′ σ ′ ) / x ) ) \llbracket T'\rrbracket((\rho'\sigma',\llbracket t'\rrbracket(\rho'\sigma')/x)) [ [ T ′ ] ] (( ρ ′ σ ′ , [ [ t ′ ] ] ( ρ ′ σ ′ ) / x )) (shared) bridge the PERs:
R T o u t ⟺ R T i n R_T^{\mathrm{out}}\Longleftrightarrow R_T^{\mathrm{in}} R T out ⟺ R T in
⟦ T ⟧ ( ( ρ σ , ⟦ t ⟧ ( ρ σ ) / x ) ) ≈ ⟦ T ′ ⟧ ( ( ρ ′ σ ′ , ⟦ t ′ ⟧ ( ρ ′ σ ′ ) / x ) ) ∈ U i ↘ R T \llbracket T\rrbracket((\rho\sigma,\llbracket t\rrbracket(\rho\sigma)/x))\approx\llbracket T'\rrbracket((\rho'\sigma',\llbracket t'\rrbracket(\rho'\sigma')/x))\in\mathcal{U}_i\mathbin{\searrow}R_T [ [ T ] ] (( ρ σ , [ [ t ] ] ( ρ σ ) / x )) ≈ [ [ T ′ ] ] (( ρ ′ σ ′ , [ [ t ′ ] ] ( ρ ′ σ ′ ) / x )) ∈ U i ↘ R T
R T i n ⟺ R T R_T^{\mathrm{in}}\Longleftrightarrow R_T R T in ⟺ R T
Hence all four goal type values lie in U i ↘ R T \mathcal{U}_i\mathbin{\searrow}R_T U i ↘ R T , with the term values { b o , b i , b o ′ , b i ′ } \{b_o,b_i,b'_o,b'_i\} { b o , b i , b o ′ , b i ′ } in R T R_T R T as established. □
Lemma 6.64 (Fundamental — Subsump). If Γ ⊢ T ≈ T : T y i \Gamma\vdash T\approx T:\mathrm{Ty}_i Γ ⊢ T ≈ T : Ty i and Γ ⊢ t ≈ t : S \Gamma\vdash t\approx t:S Γ ⊢ t ≈ t : S and Γ ⊢ S ⊆ T \Gamma\vdash S\subseteq T Γ ⊢ S ⊆ T , then Γ ⊢ t ≈ t : T \Gamma\vdash t\approx t:T Γ ⊢ t ≈ t : T .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma'\approx\Gamma'\mathbin{\searrow}R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma'\vdash\sigma\approx\sigma':\Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D}\mathrel{::}\rho\approx\rho'\in R' D :: ρ ≈ ρ ′ ∈ R ′ be given.
Type part. By Γ ⊢ T ≈ T : T y i \Gamma\vdash T\approx T:\mathrm{Ty}_i Γ ⊢ T ≈ T : Ty i at the given data:
{ ⟦ T [ σ ] ⟧ ( ρ ) , ⟦ T ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ T [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R T \{\llbracket T[\sigma]\rrbracket(\rho),\llbracket T\rrbracket(\llbracket\sigma\rrbracket(\rho)),\llbracket T\rrbracket(\llbracket\sigma'\rrbracket(\rho')), \llbracket T[\sigma']\rrbracket(\rho')\}\subseteq\mathcal{U}_i\mathbin{\searrow}R_T { [ [ T [ σ ] ] ] ( ρ ) , [ [ T ] ] ( [ [ σ ] ] ( ρ )) , [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ T [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R T
Term part. By Γ ⊨ t ≈ t : S \Gamma\models t \approx t : S Γ ⊨ t ≈ t : S at the given data:
{ ⟦ S [ σ ] ⟧ ( ρ ) , ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ S ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ S [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R S \{ \llbracket S[\sigma] \rrbracket(\rho), \llbracket S \rrbracket(\llbracket\sigma\rrbracket(\rho)), \llbracket S \rrbracket(\llbracket\sigma' \rrbracket(\rho')), \llbracket S[\sigma'] \rrbracket(\rho') \} \subseteq U_i \searrow R_S { [ [ S [ σ ] ] ] ( ρ ) , [ [ S ] ] ( [ [ σ ] ] ( ρ )) , [ [ S ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ S [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R S
(by hypothesis on S S S )
{ ⟦ t [ σ ] ⟧ ( ρ ) , ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R S \{ \llbracket t[\sigma] \rrbracket(\rho), \llbracket t \rrbracket(\llbracket\sigma\rrbracket(\rho)), \llbracket t \rrbracket(\llbracket\sigma' \rrbracket(\rho')), \llbracket t[\sigma'] \rrbracket(\rho') \} \subseteq R_S { [ [ t [ σ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ σ ] ] ( ρ )) , [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ t [ σ ′ ] ] ] ( ρ ′ )} ⊆ R S
(by hypothesis on t t t )
By Γ ⊨ S ⊆ T \Gamma\models S \subseteq T Γ ⊨ S ⊆ T at the given data:
⟦ S [ σ ] ⟧ ( ρ ) ≈ ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) ∈ U i \llbracket S[\sigma] \rrbracket(\rho) \approx\llbracket S \rrbracket(\llbracket\sigma\rrbracket(\rho)) \in U_i [ [ S [ σ ] ] ] ( ρ ) ≈ [ [ S ] ] ( [ [ σ ] ] ( ρ )) ∈ U i
(by semantic subtyping, commutation)
⟦ T [ σ ′ ] ⟧ ( ρ ′ ) ≈ ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ U i \llbracket T[\sigma'] \rrbracket(\rho') \approx\llbracket T \rrbracket(\llbracket\sigma' \rrbracket(\rho')) \in U_i [ [ T [ σ ′ ] ] ] ( ρ ′ ) ≈ [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ∈ U i
(by semantic subtyping, commutation)
⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) < : i ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) \llbracket S \rrbracket(\llbracket\sigma\rrbracket(\rho)) <:_i \llbracket T \rrbracket(\llbracket\sigma' \rrbracket(\rho')) [ [ S ] ] ( [ [ σ ] ] ( ρ )) < : i [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ ))
(by semantic subtyping)
By Theorem 6.15 applied to the subtyping ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) < : i ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) \llbracket S \rrbracket(\llbracket\sigma\rrbracket(\rho)) <:_i \llbracket T \rrbracket(\llbracket\sigma' \rrbracket(\rho')) [ [ S ] ] ( [ [ σ ] ] ( ρ )) < : i [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) together with ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) ≈ ⟦ S ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ U i ↘ R S \llbracket S \rrbracket(\llbracket\sigma\rrbracket(\rho)) \approx\llbracket S \rrbracket(\llbracket\sigma' \rrbracket(\rho')) \in U_i \searrow R_S [ [ S ] ] ( [ [ σ ] ] ( ρ )) ≈ [ [ S ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ∈ U i ↘ R S and ⟦ T ⟧ ( ⟦ σ ⟧ ( ρ ) ) ≈ ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ U i ↘ R T \llbracket T \rrbracket(\llbracket\sigma\rrbracket(\rho)) \approx\llbracket T \rrbracket(\llbracket\sigma' \rrbracket(\rho')) \in U_i \searrow R_T [ [ T ] ] ( [ [ σ ] ] ( ρ )) ≈ [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ∈ U i ↘ R T :
R S ⊆ R T R_S \subseteq R_T R S ⊆ R T
(by Theorem 6.15)
Hence the four term values, which lie in R S R_S R S , also lie in R T R_T R T :
{ ⟦ t [ σ ] ⟧ ( ρ ) , ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R T \{ \llbracket t[\sigma] \rrbracket(\rho), \llbracket t \rrbracket(\llbracket\sigma\rrbracket(\rho)), \llbracket t \rrbracket(\llbracket\sigma' \rrbracket(\rho')), \llbracket t[\sigma'] \rrbracket(\rho') \} \subseteq R_T { [ [ t [ σ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ σ ] ] ( ρ )) , [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ t [ σ ′ ] ] ] ( ρ ′ )} ⊆ R T
(by R S ⊆ R T R_S \subseteq R_T R S ⊆ R T )
Semantic Computation Rules
Lemma 6.65 (Fundamental — Π \Pi Π -β \beta β ). If Γ ⊨ S ≈ S : T y i \Gamma\models S \approx S : \mathrm{Ty}_i Γ ⊨ S ≈ S : Ty i and Γ , x : S ⊨ T ≈ T : T y i \Gamma, x : S \models T \approx T : \mathrm{Ty}_i Γ , x : S ⊨ T ≈ T : Ty i and Γ , x : S ⊨ t ≈ t : T \Gamma, x : S \models t \approx t : T Γ , x : S ⊨ t ≈ t : T and Γ ⊨ s ≈ s : S \Gamma\models s \approx s : S Γ ⊨ s ≈ s : S , then Γ ⊨ ( λ x . t ) s ≈ t [ s / x ] : T [ s / x ] \Gamma\models(\lambda x.\ t)\ s \approx t[s/x] : T[s/x] Γ ⊨ ( λ x . t ) s ≈ t [ s / x ] : T [ s / x ] .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \models\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ D :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given.
LHS computation at σ , ρ \sigma, \rho σ , ρ . By the syntactic action of substitution on λ \lambda λ and application, then ev-app/ev-lam/closure-application:
( ( λ x . t ) s ) [ σ ] = ( λ x . t [ q ( σ ) ] ) s [ σ ] ((\lambda x.\ t)\ s)[\sigma] = (\lambda x.\ t[q(\sigma)])\ s[\sigma] (( λ x . t ) s ) [ σ ] = ( λ x . t [ q ( σ )]) s [ σ ] (syntactic, definition of substitution)
⟦ ( λ x . t [ q ( σ ) ] ) s [ σ ] ⟧ ( ρ ) ↘ b L \llbracket(\lambda x.\ t[q(\sigma)])\ s[\sigma] \rrbracket(\rho) \searrow b_L [ [ ( λ x . t [ q ( σ )]) s [ σ ] ] ] ( ρ ) ↘ b L where
⟦ λ x . t [ q ( σ ) ] ⟧ ( ρ ) ↘ λ ( t [ q ( σ ) ] , ρ ) \llbracket\lambda x.\ t[q(\sigma)] \rrbracket(\rho) \searrow\lambda(t[q(\sigma)],\rho) [ [ λ x . t [ q ( σ )] ] ] ( ρ ) ↘ λ ( t [ q ( σ )] , ρ ) (ev-lam)
⟦ s [ σ ] ⟧ ( ρ ) ↘ a s \llbracket s[\sigma] \rrbracket(\rho) \searrow a_s [ [ s [ σ ] ] ] ( ρ ) ↘ a s (some a s a_s a s )
λ ( t [ q ( σ ) ] , ρ ) ⋅ a s ↘ b L \lambda(t[q(\sigma)],\rho) \cdot a_s \searrow b_L λ ( t [ q ( σ )] , ρ ) ⋅ a s ↘ b L (closure application:
⟦ t [ q ( σ ) ] ⟧ ( ( ρ , a s / x ) ) ↘ b L \llbracket t[q(\sigma)] \rrbracket((\rho,a_s/x)) \searrow b_L [ [ t [ q ( σ )] ] ] (( ρ , a s / x )) ↘ b L )
RHS expression at σ , ρ \sigma, \rho σ , ρ . Using the sugar [ s / x ] = [ i d , s / x ] [s/x] = [\mathrm{id},s/x] [ s / x ] = [ id , s / x ] and Theorems 2.27 and 2.30:
= t [ q ( σ ) ] [ s [ σ ] / x ] = t [ σ , s [ σ ] / x ] = t[q(\sigma)][s[\sigma]/x] = t[\sigma,s[\sigma]/x] = t [ q ( σ )] [ s [ σ ] / x ] = t [ σ , s [ σ ] / x ] (by Theorems 2.27 and 2.30)
Let b R b_R b R satisfy ⟦ t [ σ , s [ σ ] / x ] ⟧ ( ρ ) ↘ b R \llbracket t[\sigma,s[\sigma]/x] \rrbracket(\rho) \searrow b_R [ [ t [ σ , s [ σ ] / x ] ] ] ( ρ ) ↘ b R (existence via the four-value pattern below). We relate b L b_L b L and b R b_R b R in the term PER via the four-value pattern of t t t on the extended substitution.
Relatedness. By Theorem 6.45 on Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \models\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ and Γ ⊨ s ≈ s : S \Gamma\models s \approx s : S Γ ⊨ s ≈ s : S :
Γ ′ ⊨ ( σ , s [ σ ] / x ) ≈ ( σ ′ , s [ σ ′ ] / x ) : Γ , x : S \Gamma' \models(\sigma,s[\sigma]/x) \approx(\sigma',s[\sigma']/x) : \Gamma,x:S Γ ′ ⊨ ( σ , s [ σ ] / x ) ≈ ( σ ′ , s [ σ ′ ] / x ) : Γ , x : S (Theorem 6.45)
Apply Γ , x : S ⊨ t ≈ t : T \Gamma,x:S \models t \approx t:T Γ , x : S ⊨ t ≈ t : T at Γ ′ \Gamma' Γ ′ , this extended substitution, and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ . Let R T R_T R T be the PER governing the four-value pattern of t t t at this instantiation; concretely, R T R_T R T is determined by the type four-value pattern of T T T at the same env-pair (carried by semantic typing of t : T t:T t : T ):
{ ⟦ T [ σ , s [ σ ] / x ] ⟧ ( ρ ) , ⟦ T ⟧ ( ⟦ ( σ , s [ σ ] / x ) ⟧ ( ρ ) ) , ⟦ T ⟧ ( ⟦ ( σ ′ , s [ σ ′ ] / x ) ⟧ ( ρ ′ ) ) , ⟦ T [ σ ′ , s [ σ ′ ] / x ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R T \{ \llbracket T[\sigma,s[\sigma]/x] \rrbracket(\rho), \llbracket T \rrbracket(\llbracket(\sigma,s[\sigma]/x)\rrbracket(\rho)), \llbracket T \rrbracket(\llbracket(\sigma',s[\sigma']/x)\rrbracket(\rho')), \llbracket T[\sigma',s[\sigma']/x] \rrbracket(\rho') \} \subseteq U_i \searrow R_T { [ [ T [ σ , s [ σ ] / x ] ] ] ( ρ ) , [ [ T ] ] ( [ [ ( σ , s [ σ ] / x ) ] ] ( ρ )) , [ [ T ] ] ( [ [ ( σ ′ , s [ σ ′ ] / x ) ] ] ( ρ ′ )) , [ [ T [ σ ′ , s [ σ ′ ] / x ] ] ] ( ρ ′ )} ⊆ U i ↘ R T
The term four-value pattern then gives:
{ ⟦ t [ σ , s [ σ ] / x ] ⟧ ( ρ ) , ⟦ t ⟧ ( ⟦ ( σ , s [ σ ] / x ) ⟧ ( ρ ) ) , ⟦ t ⟧ ( ⟦ ( σ ′ , s [ σ ′ ] / x ) ⟧ ( ρ ′ ) ) , ⟦ t [ σ ′ , s [ σ ′ ] / x ] ⟧ ( ρ ′ ) } ⊆ R T \left\{\llbracket t[\sigma,s[\sigma]/x]\rrbracket(\rho),\ \llbracket t\rrbracket(\llbracket(\sigma,s[\sigma]/x)\rrbracket(\rho)),\ \llbracket t\rrbracket(\llbracket(\sigma',s[\sigma']/x)\rrbracket(\rho')),\ \llbracket t[\sigma',s[\sigma']/x]\rrbracket(\rho')\right\}\subseteq R_T { [ [ t [ σ , s [ σ ] / x ] ] ] ( ρ ) , [ [ t ] ] ( [ [ ( σ , s [ σ ] / x ) ] ] ( ρ )) , [ [ t ] ] ( [ [ ( σ ′ , s [ σ ′ ] / x ) ] ] ( ρ ′ )) , [ [ t [ σ ′ , s [ σ ′ ] / x ] ] ] ( ρ ′ ) } ⊆ R T
(by hypothesis on t t t )
By the syntactic identity above (and analogously at σ ′ , ρ ′ \sigma',\rho' σ ′ , ρ ′ ), the outer values coincide with the goal’s RHS outer-values { ⟦ ⟧ ( ρ ) , ⟦ ⟧ ( ρ ′ ) } \{\llbracket\rrbracket(\rho),\llbracket\rrbracket(\rho')\} { [ [ ] ] ( ρ ) , [ [ ] ] ( ρ ′ )} .
LHS values via four-value pattern of t t t at q ( σ ) q(\sigma) q ( σ ) . We bridge b L = ⟦ t [ q ( σ ) ] ⟧ ( ( ρ , a s / x ) ) b_L=\llbracket t[q(\sigma)]\rrbracket((\rho,a_s/x)) b L = [ [ t [ q ( σ )] ] ] (( ρ , a s / x )) to the inner-left value ⟦ t ⟧ ( ⟦ ( σ , s [ σ ] / x ) ⟧ ( ρ ) ) \llbracket t\rrbracket(\llbracket(\sigma,s[\sigma]/x)\rrbracket(\rho)) [ [ t ] ] ( [ [ ( σ , s [ σ ] / x ) ] ] ( ρ )) above. By Theorem 6.47 on Γ ′ ⊢ σ ≈ σ : Γ \Gamma' \vdash\sigma\approx\sigma:\Gamma Γ ′ ⊢ σ ≈ σ : Γ (reflexive, via Theorems 6.41 and 6.42) and Γ ⊢ S ≈ S : T y i \Gamma\vdash S\approx S:\mathrm{Ty}_i Γ ⊢ S ≈ S : Ty i :
Γ ′ , x : S [ σ ] ⊢ q ( σ ) ≈ q ( σ ) : Γ , x : S \Gamma',x:S[\sigma]\vdash q(\sigma)\approx q(\sigma):\Gamma,x:S Γ ′ , x : S [ σ ] ⊢ q ( σ ) ≈ q ( σ ) : Γ , x : S
(Theorem 6.47)
The reflexive env-pair ( ρ , a s / x ) ≈ ( ρ , a s / x ) (\rho,a_s/x)\approx(\rho,a_s/x) ( ρ , a s / x ) ≈ ( ρ , a s / x ) in R Γ ′ , x : S [ σ ] R_{\Gamma',x:S[\sigma]} R Γ ′ , x : S [ σ ] holds via Ctx-Ext (head a s ≈ a s a_s\approx a_s a s ≈ a s reflexively in the head PER, tail ρ ≈ ρ ∈ R ′ \rho\approx\rho\in R' ρ ≈ ρ ∈ R ′ ). Apply Γ , x : S ⊢ t ≈ t : T \Gamma,x:S\vdash t\approx t:T Γ , x : S ⊢ t ≈ t : T at Γ ′ , x : S [ σ ] \Gamma',x:S[\sigma] Γ ′ , x : S [ σ ] , q ( σ ) ≈ q ( σ ) q(\sigma)\approx q(\sigma) q ( σ ) ≈ q ( σ ) , and this env-pair (four-value pattern of t t t , outer-left vs inner-left):
⟦ t [ q ( σ ) ] ⟧ ( ( ρ , a s / x ) ) ≈ ⟦ t ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , a s / x ) ) ) ∈ R T \llbracket t[q(\sigma)]\rrbracket((\rho,a_s/x))\approx\llbracket t\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,a_s/x)))\in R_T [ [ t [ q ( σ )] ] ] (( ρ , a s / x )) ≈ [ [ t ] ] ( [ [ q ( σ ) ] ] (( ρ , a s / x ))) ∈ R T
(four-value pattern of t t t )
Bridge ⟦ q ( σ ) ⟧ ( ( ρ , a s / x ) ) \llbracket q(\sigma)\rrbracket((\rho,a_s/x)) [ [ q ( σ ) ] ] (( ρ , a s / x )) to ⟦ ( σ , s [ σ ] / x ) ⟧ ( ρ ) \llbracket(\sigma,s[\sigma]/x)\rrbracket(\rho) [ [ ( σ , s [ σ ] / x ) ] ] ( ρ ) in R Γ , x : S R_{\Gamma,x:S} R Γ , x : S pointwise. Both envs have head a s a_s a s :
⟦ q ( σ ) ⟧ ( ( ρ , a s / x ) ) = ( ⟦ σ [ ⇑ ] ⟧ ( ( ρ , a s / x ) ) , a s / x ) \llbracket q(\sigma)\rrbracket((\rho,a_s/x))=(\llbracket\sigma[\Uparrow]\rrbracket((\rho,a_s/x)),a_s/x) [ [ q ( σ ) ] ] (( ρ , a s / x )) = ( [ [ σ [ ⇑ ] ] ] (( ρ , a s / x )) , a s / x )
(by q ( σ ) = ( σ [ ⇑ ] , 0 / x ) q(\sigma)=(\sigma[\Uparrow],0/x) q ( σ ) = ( σ [ ⇑ ] , 0/ x ) , pointwise eval)
⟦ ( σ , s [ σ ] / x ) ⟧ ( ρ ) = ( ⟦ σ ⟧ ( ρ ) , a s / x ) \llbracket(\sigma,s[\sigma]/x)\rrbracket(\rho)=(\llbracket\sigma\rrbracket(\rho),a_s/x) [ [ ( σ , s [ σ ] / x ) ] ] ( ρ ) = ( [ [ σ ] ] ( ρ ) , a s / x )
(pointwise eval; ⟦ s [ σ ] ⟧ ( ρ ) = a s \llbracket s[\sigma]\rrbracket(\rho)=a_s [ [ s [ σ ] ] ] ( ρ ) = a s )
⟦ σ [ ⇑ ] ⟧ ( ( ρ , a s / x ) ) ≈ ⟦ σ ⟧ ( ρ ) ∈ R Γ \llbracket\sigma[\Uparrow]\rrbracket((\rho,a_s/x))\approx\llbracket\sigma\rrbracket(\rho)\in R_\Gamma [ [ σ [ ⇑ ] ] ] (( ρ , a s / x )) ≈ [ [ σ ] ] ( ρ ) ∈ R Γ
(four-value pattern of σ ≈ σ \sigma\approx\sigma σ ≈ σ at Γ ′ , x : S [ σ ] ⊢ w ⇑ : Γ ′ , e n v \Gamma',x:S[\sigma]\vdash_w\Uparrow:\Gamma',\mathrm{env} Γ ′ , x : S [ σ ] ⊢ w ⇑: Γ ′ , env
( ρ , a s / x ) ≈ ( ρ , a s / x ) ∈ R Γ ′ , x : S [ σ ] (\rho,a_s/x)\approx(\rho,a_s/x)\in R_{\Gamma',x:S[\sigma]} ( ρ , a s / x ) ≈ ( ρ , a s / x ) ∈ R Γ ′ , x : S [ σ ] ; using ⟦ ⇑ ⟧ ( ( ρ , a s / x ) ) = ρ \llbracket\Uparrow\rrbracket((\rho,a_s/x))=\rho [ [ ⇑ ] ] (( ρ , a s / x )) = ρ pointwise)
⟦ q ( σ ) ⟧ ( ( ρ , a s / x ) ) ≈ ⟦ ( σ , s [ σ ] / x ) ⟧ ( ρ ) ∈ R Γ , x : S \llbracket q(\sigma)\rrbracket((\rho,a_s/x))\approx\llbracket(\sigma,s[\sigma]/x)\rrbracket(\rho)\in R_{\Gamma,x:S} [ [ q ( σ ) ] ] (( ρ , a s / x )) ≈ [ [ ( σ , s [ σ ] / x ) ] ] ( ρ ) ∈ R Γ , x : S
(by Ctx-Ext, head a s ≈ a s a_s\approx a_s a s ≈ a s reflexively)
Apply Theorem 6.38 on the reflexive instance Γ , x : S ⊢ t ≈ t : T \Gamma,x:S\vdash t\approx t:T Γ , x : S ⊢ t ≈ t : T at this env-pair:
⟦ t ⟧ ( ⟦ q ( σ ) ⟧ ( ( ρ , a s / x ) ) ) ≈ ⟦ t ⟧ ( ⟦ ( σ , s [ σ ] / x ) ⟧ ( ρ ) ) ∈ R T \llbracket t\rrbracket(\llbracket q(\sigma)\rrbracket((\rho,a_s/x)))\approx\llbracket t\rrbracket(\llbracket(\sigma,s[\sigma]/x)\rrbracket(\rho))\in R_T [ [ t ] ] ( [ [ q ( σ ) ] ] (( ρ , a s / x ))) ≈ [ [ t ] ] ( [ [ ( σ , s [ σ ] / x ) ] ] ( ρ )) ∈ R T
(Theorem 6.38)
By transitivity, b L ≈ ⟦ t ⟧ ( ⟦ ( σ , s [ σ ] / x ) ⟧ ( ρ ) ) b_L\approx\llbracket t\rrbracket(\llbracket(\sigma,s[\sigma]/x)\rrbracket(\rho)) b L ≈ [ [ t ] ] ( [ [ ( σ , s [ σ ] / x ) ] ] ( ρ )) in R T R_T R T (the inner-left value of the relatedness pattern). Symmetrically for the primed side.
Combining: all eight values (four LHS, four RHS) lie in R T R_T R T , so the LHS-RHS pair at each of the four positions is in R T R_T R T .
Type part. Already established: the type four-value pattern displayed above (in U i ↘ R T \mathcal{U}_i\searrow R_T U i ↘ R T ) is the goal’s T [ s / x ] T[s/x] T [ s / x ] pattern, since T [ σ , s [ σ ] / x ] = T[\sigma,s[\sigma]/x]= T [ σ , s [ σ ] / x ] = by the syntactic identity used for the term part. □
**Lemma 6.66 (Fundamental — Π \Pi Π -η ) . ∗ ∗ I f \eta).** If η ) . ∗ ∗ I f \Gamma\vdash S\approx S:\mathrm{Ty}_i$ and Γ , x : S ⊢ T ≈ T : T y i \Gamma,x:S\vdash T\approx T:\mathrm{Ty}_i Γ , x : S ⊢ T ≈ T : Ty i and Γ ⊢ t ≈ t : Π ( x : S ) . T \Gamma\vdash t\approx t:\Pi(x:S).T Γ ⊢ t ≈ t : Π ( x : S ) . T , then Γ ⊢ t ≈ λ x . ( t [ ⇑ ] x ) : Π ( x : S ) . T \Gamma\vdash t\approx\lambda x.(t[\Uparrow]\,x):\Pi(x:S).T Γ ⊢ t ≈ λ x . ( t [ ⇑ ] x ) : Π ( x : S ) . T .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma'\approx\Gamma'\searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma'\vdash\sigma\approx\sigma':\Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D}::\rho\approx\rho'\in R' D :: ρ ≈ ρ ′ ∈ R ′ be given.
LHS values. By Γ ⊢ t ≈ t : Π ( x : S ) . T \Gamma\vdash t\approx t:\Pi(x:S).T Γ ⊢ t ≈ t : Π ( x : S ) . T at Γ ′ , σ ≈ σ ′ , ρ ≈ ρ ′ ∈ R ′ \Gamma',\sigma\approx\sigma',\rho\approx\rho'\in R' Γ ′ , σ ≈ σ ′ , ρ ≈ ρ ′ ∈ R ′ , the four evaluations of t t t are related in the function PER R R R :
{ ⟦ t [ σ ] ⟧ ( ρ ) , ⟦ t ⟧ ( ⟦ σ ⟧ ( ρ ) ) , ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) , ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R \left\{\llbracket t[\sigma]\rrbracket(\rho),\ \llbracket t\rrbracket(\llbracket\sigma\rrbracket(\rho)),\ \llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')),\ \llbracket t[\sigma']\rrbracket(\rho')\right\}\subseteq R { [ [ t [ σ ] ] ] ( ρ ) , [ [ t ] ] ( [ [ σ ] ] ( ρ )) , [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) , [ [ t [ σ ′ ] ] ] ( ρ ′ ) } ⊆ R
(by hypothesis on t t t )
with biconditional characterization f ≈ f ′ ∈ R ⟺ ( ∀ D I : : a ≈ a ′ ∈ R I f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D I ) ) f\approx f'\in R\Longleftrightarrow(\forall D_I::a\approx a'\in R_I\ f\cdot a\approx f'\cdot a'\in R_O(D_I)) f ≈ f ′ ∈ R ⟺ ( ∀ D I :: a ≈ a ′ ∈ R I f ⋅ a ≈ f ′ ⋅ a ′ ∈ R O ( D I )) .
RHS values. The RHS evaluates on the σ ′ , ρ ′ \sigma',\rho' σ ′ , ρ ′ -side only:
⟦ ( λ x . ( t [ ⇑ ] x ) ) [ σ ′ ] ⟧ ( ρ ′ ) ↘ f 0 \llbracket(\lambda x.(t[\Uparrow]\,x))[\sigma']\rrbracket(\rho')\searrow f_0 [ [ ( λ x . ( t [ ⇑ ] x )) [ σ ′ ] ] ] ( ρ ′ ) ↘ f 0
(syntactic and ev-lam)
⟦ λ x . ( t [ ⇑ ] x ) ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ↘ f i \llbracket\lambda x.\,(t[\mathord{\Uparrow}]\,x)\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \searrow f_i [ [ λ x . ( t [ ⇑ ] x ) ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ↘ f i
where f o : = λ ( t [ ⇑ ] ⟦ q ( σ ′ ) ⟧ x , ρ ′ ) f_o := \lambda(t[\mathord{\Uparrow}]\llbracket q(\sigma')\rrbracket\,x,\rho') f o := λ ( t [ ⇑ ] [ [ q ( σ ′ ) ] ] x , ρ ′ ) and f i : = λ ( t [ ⇑ ] x , ⟦ σ ′ ⟧ ( ρ ′ ) ) f_i := \lambda(t[\mathord{\Uparrow}]\,x,\llbracket\sigma'\rrbracket(\rho')) f i := λ ( t [ ⇑ ] x , [ [ σ ′ ] ] ( ρ ′ )) .
Step 1: ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ≈ f o \llbracket t[\sigma']\rrbracket(\rho') \approx f_o [ [ t [ σ ′ ] ] ] ( ρ ′ ) ≈ f o in R R R . By the biconditional, suffices to show: for every D I : : a ≈ a ′ ∈ R I \mathcal{D}_I :: a \approx a' \in R_I D I :: a ≈ a ′ ∈ R I , ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ⋅ a ≈ f o ⋅ a ′ ∈ R O ( D I ) \llbracket t[\sigma']\rrbracket(\rho') \cdot a \approx f_o \cdot a' \in R_O(\mathcal{D}_I) [ [ t [ σ ′ ] ] ] ( ρ ′ ) ⋅ a ≈ f o ⋅ a ′ ∈ R O ( D I ) .
Compute f o ⋅ a ′ f_o \cdot a' f o ⋅ a ′ :
f o ⋅ a ′ = ⟦ t [ ⇑ ] ⟦ q ( σ ′ ) ⟧ x ⟧ ( ( ρ ′ , a ′ / x ) ) (closure app) = ⟦ t [ ⇑ ] ⟧ ⟦ q ( σ ′ ) ⟧ ( ( ρ ′ , a ′ / x ) ) ⋅ a ′ (ev-app) = ⟦ t [ σ ′ [ ⇑ ] ] ⟧ ( ( ρ ′ , a ′ / x ) ) ⋅ a ′ (Theorem 2.22 and Theorem 2.25: ⇑ ∘ q ( σ ′ ) = σ ′ [ ⇑ ] ) \begin{aligned}
f_o \cdot a' &= \llbracket t[\mathord{\Uparrow}]\llbracket q(\sigma')\rrbracket\,x\rrbracket((\rho',a'/x)) && \text{(closure app)}\\
&= \llbracket t[\mathord{\Uparrow}]\rrbracket\llbracket q(\sigma')\rrbracket((\rho',a'/x)) \cdot a' && \text{(ev-app)}\\
&= \llbracket t[\sigma'[\mathord{\Uparrow}]]\rrbracket((\rho',a'/x)) \cdot a' && \text{(Theorem 2.22 and Theorem 2.25:}\\
&&&\qquad\mathord{\Uparrow}\circ q(\sigma') = \sigma'[\mathord{\Uparrow}])
\end{aligned} f o ⋅ a ′ = [ [ t [ ⇑ ] [ [ q ( σ ′ ) ] ] x ] ] (( ρ ′ , a ′ / x )) = [ [ t [ ⇑ ] ] ] [ [ q ( σ ′ ) ] ] (( ρ ′ , a ′ / x )) ⋅ a ′ = [ [ t [ σ ′ [ ⇑ ]] ] ] (( ρ ′ , a ′ / x )) ⋅ a ′ (closure app) (ev-app) (Theorem 2.22 and Theorem 2.25: ⇑ ∘ q ( σ ′ ) = σ ′ [ ⇑ ])
Bridge ⟦ t [ σ ′ [ ⇑ ] ] ⟧ ( ( ρ ′ , a ′ / x ) ) ≈ ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ∈ R \llbracket t[\sigma'[\mathord{\Uparrow}]]\rrbracket((\rho',a'/x)) \approx\llbracket t[\sigma']\rrbracket(\rho') \in R [ [ t [ σ ′ [ ⇑ ]] ] ] (( ρ ′ , a ′ / x )) ≈ [ [ t [ σ ′ ] ] ] ( ρ ′ ) ∈ R :
Γ ′ , x : S [ σ ′ ] ⊨ w ⇑ : Γ ′ \Gamma',x:S[\sigma'] \models_w \mathord{\Uparrow}:\Gamma' Γ ′ , x : S [ σ ′ ] ⊨ w ⇑ : Γ ′
(Theorem 6.28)
Γ ′ , x : S [ σ ′ ] ⊨ σ ′ [ ⇑ ] ≈ σ ′ [ ⇑ ] : Γ \Gamma',x:S[\sigma'] \models\sigma'[\mathord{\Uparrow}] \approx\sigma'[\mathord{\Uparrow}]:\Gamma Γ ′ , x : S [ σ ′ ] ⊨ σ ′ [ ⇑ ] ≈ σ ′ [ ⇑ ] : Γ
(Theorem 6.39 on σ ′ ≈ σ ′ \sigma' \approx\sigma' σ ′ ≈ σ ′ refl.)
Apply hypothesis on t t t at Γ ′ , x : S [ σ ′ ] \Gamma',x:S[\sigma'] Γ ′ , x : S [ σ ′ ] , σ ′ [ ⇑ ] ≈ σ ′ [ ⇑ ] \sigma'[\mathord{\Uparrow}] \approx\sigma'[\mathord{\Uparrow}] σ ′ [ ⇑ ] ≈ σ ′ [ ⇑ ] , env-pair ( ρ ′ , a ′ / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ′ ] (\rho',a'/x) \approx(\rho',a'/x) \in R_{\Gamma',x:S[\sigma']} ( ρ ′ , a ′ / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R Γ ′ , x : S [ σ ′ ] :
⟦ t [ σ ′ [ ⇑ ] ] ⟧ ( ( ρ ′ , a ′ / x ) ) ≈ ⟦ t ⟧ ( ⟦ σ ′ [ ⇑ ] ⟧ ( ( ρ ′ , a ′ / x ) ) ) ∈ R \llbracket t[\sigma'[\mathord{\Uparrow}]]\rrbracket((\rho',a'/x))
\approx
\llbracket t\rrbracket(\llbracket\sigma'[\mathord{\Uparrow}]\rrbracket((\rho',a'/x))) \in R [ [ t [ σ ′ [ ⇑ ]] ] ] (( ρ ′ , a ′ / x )) ≈ [ [ t ] ] ( [ [ σ ′ [ ⇑ ] ] ] (( ρ ′ , a ′ / x ))) ∈ R
(outer-left vs inner-left of t t t )
Apply hypothesis on σ ′ \sigma' σ ′ at the same data (⇑ \mathord{\Uparrow} ⇑ as the weakening, env-pair as above), giving ⟦ σ ′ [ ⇑ ] ⟧ ( ( ρ ′ , a ′ / x ) ) ≈ ⟦ σ ′ ⟧ ( ρ ′ ) ∈ R Γ \llbracket\sigma'[\mathord{\Uparrow}]\rrbracket((\rho',a'/x)) \approx\llbracket\sigma'\rrbracket(\rho') \in R_\Gamma [ [ σ ′ [ ⇑ ] ] ] (( ρ ′ , a ′ / x )) ≈ [ [ σ ′ ] ] ( ρ ′ ) ∈ R Γ (using ⟦ ⇑ ⟧ ( ( ρ ′ , a ′ / x ) ) = ρ ′ \llbracket\mathord{\Uparrow}\rrbracket((\rho',a'/x))=\rho' [ [ ⇑ ] ] (( ρ ′ , a ′ / x )) = ρ ′ pointwise). By Theorem 6.38 on t t t :
⟦ t ⟧ ( ⟦ σ ′ [ ⇑ ] ⟧ ( ( ρ ′ , a ′ / x ) ) ) ≈ ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ R \llbracket t\rrbracket(\llbracket\sigma'[\mathord{\Uparrow}]\rrbracket((\rho',a'/x)))
\approx
\llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \in R [ [ t ] ] ( [ [ σ ′ [ ⇑ ] ] ] (( ρ ′ , a ′ / x ))) ≈ [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ∈ R
(Theorem 6.38)
Chained with ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ≈ ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ∈ R \llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \approx\llbracket t[\sigma']\rrbracket(\rho') \in R [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ≈ [ [ t [ σ ′ ] ] ] ( ρ ′ ) ∈ R (four-value pattern of t t t , inner-left vs outer-left):
⟦ t [ σ ′ [ ⇑ ] ] ⟧ ( ( ρ ′ , a ′ / x ) ) ≈ ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ∈ R \llbracket t[\sigma'[\mathord{\Uparrow}]]\rrbracket((\rho',a'/x))
\approx
\llbracket t[\sigma']\rrbracket(\rho') \in R [ [ t [ σ ′ [ ⇑ ]] ] ] (( ρ ′ , a ′ / x )) ≈ [ [ t [ σ ′ ] ] ] ( ρ ′ ) ∈ R
(transitivity)
Apply the biconditional of R R R at D I \mathcal{D}_I D I : ⟦ t [ σ ′ [ ⇑ ] ] ⟧ ( ( ρ ′ , a ′ / x ) ) ⋅ a ≈ ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ⋅ a ′ ∈ R O ( D I ) \llbracket t[\sigma'[\mathord{\Uparrow}]]\rrbracket((\rho',a'/x)) \cdot a \approx\llbracket t[\sigma']\rrbracket(\rho') \cdot a' \in R_O(\mathcal{D}_I) [ [ t [ σ ′ [ ⇑ ]] ] ] (( ρ ′ , a ′ / x )) ⋅ a ≈ [ [ t [ σ ′ ] ] ] ( ρ ′ ) ⋅ a ′ ∈ R O ( D I ) . Since f o ⋅ a ′ = ⟦ t [ σ ′ [ ⇑ ] ] ⟧ ( ( ρ ′ , a ′ / x ) ) ⋅ a ′ f_o \cdot a' = \llbracket t[\sigma'[\mathord{\Uparrow}]]\rrbracket((\rho',a'/x)) \cdot a' f o ⋅ a ′ = [ [ t [ σ ′ [ ⇑ ]] ] ] (( ρ ′ , a ′ / x )) ⋅ a ′ , by symmetry of R O R_O R O on the reflexive instance of ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ≈ ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ∈ R \llbracket t[\sigma']\rrbracket(\rho') \approx\llbracket t[\sigma']\rrbracket(\rho') \in R [ [ t [ σ ′ ] ] ] ( ρ ′ ) ≈ [ [ t [ σ ′ ] ] ] ( ρ ′ ) ∈ R at a ≈ a ′ a \approx a' a ≈ a ′ :
⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ⋅ a ≈ f o ⋅ a ′ ∈ R O ( D I ) . \llbracket t[\sigma']\rrbracket(\rho') \cdot a \approx f_o \cdot a' \in R_O(\mathcal{D}_I). [ [ t [ σ ′ ] ] ] ( ρ ′ ) ⋅ a ≈ f o ⋅ a ′ ∈ R O ( D I ) .
Step 2: ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ≈ f i \llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \approx f_i [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ≈ f i in R R R . Suffices to show: for every D I : : a ≈ a ′ ∈ R I \mathcal{D}_I :: a \approx a' \in R_I D I :: a ≈ a ′ ∈ R I , ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ⋅ a ≈ f i ⋅ a ′ ∈ R O ( D I ) \llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \cdot a \approx f_i \cdot a' \in R_O(\mathcal{D}_I) [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ⋅ a ≈ f i ⋅ a ′ ∈ R O ( D I ) .
Compute:
f i ⋅ a ′ = ⟦ t [ ⇑ ] x ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) (closure app) = ⟦ t [ ⇑ ] ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) ⋅ a ′ (ev-app) \begin{aligned}
f_i \cdot a' &= \llbracket t[\mathord{\Uparrow}]\,x\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x)) && \text{(closure app)}\\
&= \llbracket t[\mathord{\Uparrow}]\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x)) \cdot a' && \text{(ev-app)}
\end{aligned} f i ⋅ a ′ = [ [ t [ ⇑ ] x ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) = [ [ t [ ⇑ ] ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) ⋅ a ′ (closure app) (ev-app)
Bridge ⟦ t [ ⇑ ] ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) ≈ ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ R \llbracket t[\mathord{\Uparrow}]\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x)) \approx\llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \in R [ [ t [ ⇑ ] ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) ≈ [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ∈ R via the four-value pattern of t t t (reflexive) at the new context Γ , x : S \Gamma,x:S Γ , x : S , Γ , x : S ⊨ w ⇑ : Γ \Gamma,x:S \models_w \mathord{\Uparrow}:\Gamma Γ , x : S ⊨ w ⇑ : Γ , env-pair ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ≈ ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ∈ R Γ , x : S (\llbracket\sigma'\rrbracket(\rho'),a'/x) \approx(\llbracket\sigma'\rrbracket(\rho'),a'/x) \in R_{\Gamma,x:S} ( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x ) ≈ ( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x ) ∈ R Γ , x : S : outer-left ⟦ t [ ⇑ ] ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) \llbracket t[\mathord{\Uparrow}]\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x)) [ [ t [ ⇑ ] ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x )) , inner-left ⟦ t ⟧ ( ⟦ ⇑ ⟧ ( ( ⟦ σ ′ ⟧ ( ρ ′ ) , a ′ / x ) ) ) = ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) \llbracket t\rrbracket(\llbracket\mathord{\Uparrow}\rrbracket((\llbracket\sigma'\rrbracket(\rho'),a'/x))) = \llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) [ [ t ] ] ( [ [ ⇑ ] ] (( [ [ σ ′ ] ] ( ρ ′ ) , a ′ / x ))) = [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) (pointwise). Apply biconditional at D I \mathcal{D}_I D I and the reflexive ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ≈ ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) \llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \approx\llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ≈ [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) at a ≈ a ′ a \approx a' a ≈ a ′ : ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ⋅ a ≈ f i ⋅ a ′ ∈ R O ( D I ) \llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \cdot a \approx f_i \cdot a' \in R_O(\mathcal{D}_I) [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ⋅ a ≈ f i ⋅ a ′ ∈ R O ( D I ) .
Combining. By the four-value pattern of t t t , all four LHS values are pairwise related in R R R . By Steps 1 and 2, ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ≈ f o \llbracket t[\sigma']\rrbracket(\rho') \approx f_o [ [ t [ σ ′ ] ] ] ( ρ ′ ) ≈ f o and ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ≈ f i \llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \approx f_i [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ≈ f i in R R R . By symmetry and transitivity of R R R , every LHS-RHS pair (e.g. ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) ≈ f o \llbracket t[\sigma']\rrbracket(\rho') \approx f_o [ [ t [ σ ′ ] ] ] ( ρ ′ ) ≈ f o , ⟦ t ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ≈ f i \llbracket t\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \approx f_i [ [ t ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ≈ f i , etc.) lies in R R R .
Type part. By Theorem 6.54 on Γ ⊨ S ≈ S : T y i \Gamma\models S \approx S : \mathsf{Ty}_i Γ ⊨ S ≈ S : Ty i and Γ , x : S ⊨ T ≈ T : T y i \Gamma,x:S \models T \approx T : \mathsf{Ty}_i Γ , x : S ⊨ T ≈ T : Ty i , the four-value pattern of Π ( x : S ) . T \Pi(x:S).T Π ( x : S ) . T in U i U_i U i is established. The goal’s type is Π ( x : S ) . T \Pi(x:S).T Π ( x : S ) . T on both sides, exactly this pattern. □ \square □
Lemma 6.67 (Fundamental — N-β \beta β -Ze). If Γ , x : N a t ⊨ T ≈ T : T y i \Gamma,x:\mathsf{Nat} \models T \approx T : \mathsf{Ty}_i Γ , x : Nat ⊨ T ≈ T : Ty i and Γ ⊨ z ≈ z : T [ z e r o / x ] \Gamma\models z \approx z : T[\mathsf{zero}/x] Γ ⊨ z ≈ z : T [ zero / x ] and Γ , x : N a t , y : T ⊨ s ≈ s : T [ ⟦ ⇑ ⟧ ∘ ⇑ , s u c c x 1 / x ] \Gamma,x:\mathsf{Nat},y:T \models s \approx s : T[\llbracket\mathord{\Uparrow}\rrbracket\circ\mathord{\Uparrow},\mathsf{succ}\ x_1/x] Γ , x : Nat , y : T ⊨ s ≈ s : T [ [ [ ⇑ ] ] ∘ ⇑ , succ x 1 / x ] , then Γ ⊨ e l i m N a t ( x . T ) z ( x , y . s ) z e r o ≈ z : T [ z e r o / x ] \Gamma\models e\mathsf{lim}_{\mathsf{Nat}}(x.T)\ z\ (x,y.s)\ \mathsf{zero} \approx z : T[\mathsf{zero}/x] Γ ⊨ e lim Nat ( x . T ) z ( x , y . s ) zero ≈ z : T [ zero / x ] .**
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \models\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. Write ρ σ : = ⟦ σ ⟧ ( ρ ) \rho_\sigma:= \llbracket\sigma\rrbracket(\rho) ρ σ := [ [ σ ] ] ( ρ ) and ρ σ ′ : = ⟦ σ ′ ⟧ ( ρ ′ ) \rho_{\sigma'} := \llbracket\sigma' \rrbracket(\rho') ρ σ ′ := [ [ σ ′ ] ] ( ρ ′ ) .
LHS computation on the σ , ρ \sigma,\rho σ , ρ - and ρ σ \rho_\sigma ρ σ -side. The LHS is elim N a t ( x . T ) z ( x , y . s ) z e r o \operatorname{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ \mathrm{zero} elim Nat ( x . T ) z ( x , y . s ) zero . Outer-LHS at σ , ρ \sigma,\rho σ , ρ :
⟦ ( elim N a t ( x . T ) z ( x , y . s ) z e r o ) [ σ ] ⟧ ( ρ ) = ⟦ elim N a t ( x . T [ q ( σ ) ] ) z [ σ ] ( x , y . s [ q 2 ( σ ) ] ) z e r o ⟧ ( ρ ) \llbracket(\operatorname{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ \mathrm{zero})[\sigma]\rrbracket(\rho)
= \llbracket\operatorname{elim}_{\mathrm{Nat}}\ (x.T[q(\sigma)])\ z[\sigma]\ (x,y.s[q^2(\sigma)])\ \mathrm{zero}\rrbracket(\rho) [ [ ( elim Nat ( x . T ) z ( x , y . s ) zero ) [ σ ] ] ] ( ρ ) = [ [ elim Nat ( x . T [ q ( σ )]) z [ σ ] ( x , y . s [ q 2 ( σ )]) zero ] ] ( ρ )
(definition of substitution on elim N a t \operatorname{elim}_{\mathrm{Nat}} elim Nat )
(by ev-rec, ⟦ z e r o ⟧ ( ρ ) = z e \llbracket\mathrm{zero}\rrbracket(\rho)=\mathrm{ze} [ [ zero ] ] ( ρ ) = ze ; rec ( z e , T [ q ( σ ) ] , z [ σ ] , s [ q 2 ( σ ) ] , ρ ) ↘ b \operatorname{rec}(\mathrm{ze},T[q(\sigma)],z[\sigma],s[q^2(\sigma)],\rho)\searrow b rec ( ze , T [ q ( σ )] , z [ σ ] , s [ q 2 ( σ )] , ρ ) ↘ b )
b = ⟦ z [ σ ] ⟧ ( ρ ) b=\llbracket z[\sigma]\rrbracket(\rho) b = [ [ z [ σ ] ] ] ( ρ ) (by REC-ZE)
Inner-LHS at ρ σ \rho_\sigma ρ σ :
⟦ elim N a t ( x . T ) z ( x , y . s ) z e r o ⟧ ( ρ σ ) ↘ b ′ \llbracket\operatorname{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ \mathrm{zero}\rrbracket(\rho_\sigma)\searrow b' [ [ elim Nat ( x . T ) z ( x , y . s ) zero ] ] ( ρ σ ) ↘ b ′
(by ev-rec; rec ( z e , T , z , s , ρ σ ) ↘ b ′ \operatorname{rec}(\mathrm{ze},T,z,s,\rho_\sigma)\searrow b' rec ( ze , T , z , s , ρ σ ) ↘ b ′ )
b ′ = ⟦ z ⟧ ( ρ σ ) b'=\llbracket z\rrbracket(\rho_\sigma) b ′ = [ [ z ] ] ( ρ σ ) (by REC-ZE)
RHS values on the σ ′ , ρ ′ \sigma',\rho' σ ′ , ρ ′ - and ρ σ ′ \rho_{\sigma'} ρ σ ′ -side. The RHS is z z z , evaluated directly:
⟦ z [ σ ′ ] ⟧ ( ρ ′ ) \llbracket z[\sigma']\rrbracket(\rho') [ [ z [ σ ′ ] ] ] ( ρ ′ )
(outer-RHS)
⟦ z ⟧ ( ρ σ ′ ) \llbracket z\rrbracket(\rho_{\sigma'}) [ [ z ] ] ( ρ σ ′ )
(inner-RHS)
Relatedness. By Γ ⊨ z ≈ z : T [ z e r o / x ] \Gamma\models z \approx z : T[\mathrm{zero}/x] Γ ⊨ z ≈ z : T [ zero / x ] at Γ ′ \Gamma' Γ ′ , σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ , ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ (four-value pattern of z z z ):
{ ⟦ z [ σ ] ⟧ ( ρ ) , ⟦ z ⟧ ( ρ σ ) , ⟦ z ⟧ ( ρ σ ′ ) , ⟦ z [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ R z \{\llbracket z[\sigma]\rrbracket(\rho),\llbracket z\rrbracket(\rho_\sigma),\llbracket z\rrbracket(\rho_{\sigma'}),\llbracket z[\sigma']\rrbracket(\rho')\}\subseteq R_z { [ [ z [ σ ] ] ] ( ρ ) , [ [ z ] ] ( ρ σ ) , [ [ z ] ] ( ρ σ ′ ) , [ [ z [ σ ′ ] ] ] ( ρ ′ )} ⊆ R z
(by hypothesis on z z z )
where R z R_z R z is the PER governed by the type four-value pattern of T [ z e r o / x ] T[\mathrm{zero}/x] T [ zero / x ] . The LHS values b , b ′ b,b' b , b ′ coincide with ⟦ z [ σ ] ⟧ ( ρ ) \llbracket z[\sigma]\rrbracket(\rho) [ [ z [ σ ] ] ] ( ρ ) and ⟦ z ⟧ ( ρ σ ) \llbracket z\rrbracket(\rho_\sigma) [ [ z ] ] ( ρ σ ) (the unprimed-side outer-LHS and inner-LHS of the z z z pattern). The RHS values ⟦ z [ σ ′ ] ⟧ ( ρ ′ ) \llbracket z[\sigma']\rrbracket(\rho') [ [ z [ σ ′ ] ] ] ( ρ ′ ) and ⟦ z ⟧ ( ρ σ ′ ) \llbracket z\rrbracket(\rho_{\sigma'}) [ [ z ] ] ( ρ σ ′ ) are exactly the primed-side outer-RHS and inner-RHS of the same pattern. Hence all four LHS-RHS pairs lie in R z R_z R z .
Bridge R z ⟺ R T R_z \Longleftrightarrow R_T R z ⟺ R T (where R T R_T R T is the goal’s type PER, governed by ⟦ T [ z e r o / x ] [ σ ] ⟧ ( ρ ) \llbracket T[\mathrm{zero}/x][\sigma]\rrbracket(\rho) [ [ T [ zero / x ] [ σ ] ] ] ( ρ ) ): the goal’s type is also T [ z e r o / x ] T[\mathrm{zero}/x] T [ zero / x ] , so R z = R T R_z=R_T R z = R T (functionality of U i \mathcal{U}_i U i , Theorem 6.12). □
Lemma 6.68 (Fundamental – N-β \beta β -Su). If Γ , x : N a t ⊨ T ≈ T : T y i \Gamma,x:\mathrm{Nat}\models T\approx T:\mathrm{Ty}_i Γ , x : Nat ⊨ T ≈ T : Ty i and Γ ⊨ z ≈ z : T [ z e r o / x ] \Gamma\models z\approx z:T[\mathrm{zero}/x] Γ ⊨ z ≈ z : T [ zero / x ] and Γ , x : N a t , y : T ⊨ s ≈ s : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] \Gamma,x:\mathrm{Nat},y:T\models s\approx s:T[\mathord{\Uparrow}\circ\mathord{\Uparrow},\mathrm{succ}\ x_1/x] Γ , x : Nat , y : T ⊨ s ≈ s : T [ ⇑ ∘ ⇑ , succ x 1 / x ] and Γ ⊨ t ≈ t : N a t \Gamma\models t\approx t:\mathrm{Nat} Γ ⊨ t ≈ t : Nat , then Γ ⊨ elim N a t ( x . T ) z ( x , y . s ) ( s u c c t ) ≈ s [ t / x , elim N a t ( x . T ) z ( x , y . s ) t / y ] : T [ s u c c t / x ] \Gamma\models\operatorname{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ (\mathrm{succ}\ t)\approx s[t/x,\operatorname{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ t/y]:T[\mathrm{succ}\ t/x] Γ ⊨ elim Nat ( x . T ) z ( x , y . s ) ( succ t ) ≈ s [ t / x , elim Nat ( x . T ) z ( x , y . s ) t / y ] : T [ succ t / x ] .
Proof. Let Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma' \models\sigma\approx\sigma' : \Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. Write ρ σ : = ⟦ σ ⟧ ( ρ ) \rho_\sigma:= \llbracket\sigma\rrbracket(\rho) ρ σ := [ [ σ ] ] ( ρ ) and ρ σ ′ : = ⟦ σ ′ ⟧ ( ρ ′ ) \rho_{\sigma'} := \llbracket\sigma'\rrbracket(\rho') ρ σ ′ := [ [ σ ′ ] ] ( ρ ′ ) . Let a = ⟦ t ⟧ ( ρ σ ) a=\llbracket t\rrbracket(\rho_\sigma) a = [ [ t ] ] ( ρ σ ) , a ′ = ⟦ t ⟧ ( ρ σ ′ ) a'=\llbracket t\rrbracket(\rho_{\sigma'}) a ′ = [ [ t ] ] ( ρ σ ′ ) , b t = ⟦ t [ σ ] ⟧ ( ρ ) b_t=\llbracket t[\sigma]\rrbracket(\rho) b t = [ [ t [ σ ] ] ] ( ρ ) , b t ′ = ⟦ t [ σ ′ ] ⟧ ( ρ ′ ) b_t'=\llbracket t[\sigma']\rrbracket(\rho') b t ′ = [ [ t [ σ ′ ] ] ] ( ρ ′ ) .
Denote E : = elim N a t ( x . T ) z ( x , y . s ) t E:=\operatorname{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ t E := elim Nat ( x . T ) z ( x , y . s ) t (the inner eliminator with scrutinee t t t ; this is the recursive call appearing in the β \beta β -su rule). Define c t : = ⟦ E [ σ ] ⟧ ( ρ ) c_t:=\llbracket E[\sigma]\rrbracket(\rho) c t := [ [ E [ σ ] ] ] ( ρ ) , c t ′ : = ⟦ E [ σ ′ ] ⟧ ( ρ ′ ) c_t':=\llbracket E[\sigma']\rrbracket(\rho') c t ′ := [ [ E [ σ ′ ] ] ] ( ρ ′ ) , c : = ⟦ E ⟧ ( ρ σ ) c:=\llbracket E\rrbracket(\rho_\sigma) c := [ [ E ] ] ( ρ σ ) , c ′ : = ⟦ E ⟧ ( ρ σ ′ ) c':=\llbracket E\rrbracket(\rho_{\sigma'}) c ′ := [ [ E ] ] ( ρ σ ′ ) (the four evaluations of E E E at the corresponding positions; existence by termination of evaluation).
LHS computation. By the syntactic action of substitution on elim N a t \operatorname{elim}_{\mathrm{Nat}} elim Nat , ev-rec, and rec-su:
⟦ ( elim N a t ( x . T ) z ( x , y . s ) ( s u c c t ) ) [ σ ] ⟧ ( ρ ) = ⟦ elim N a t ( x . T [ q ( σ ) ] ) z [ σ ] ( x , y . s [ q 2 ( σ ) ] ) ( s u c c t [ σ ] ) ⟧ ( ρ ) \llbracket(\operatorname{elim}_{\mathrm{Nat}}\ (x.T)\ z\ (x,y.s)\ (\mathrm{succ}\ t))[\sigma]\rrbracket(\rho)
= \llbracket\operatorname{elim}_{\mathrm{Nat}}\ (x.T[q(\sigma)])\ z[\sigma]\ (x,y.s[q^2(\sigma)])\ (\mathrm{succ}\ t[\sigma])\rrbracket(\rho) [ [ ( elim Nat ( x . T ) z ( x , y . s ) ( succ t )) [ σ ] ] ] ( ρ ) = [ [ elim Nat ( x . T [ q ( σ )]) z [ σ ] ( x , y . s [ q 2 ( σ )]) ( succ t [ σ ]) ] ] ( ρ )
(definition of substitution on elim N a t \operatorname{elim}_{\mathrm{Nat}} elim Nat )
(by ev-rec, ⟦ s u c c t [ σ ] ⟧ ( ρ ) = s u ( b t ) \llbracket\mathrm{succ}\ t[\sigma]\rrbracket(\rho)=\mathrm{su}(b_t) [ [ succ t [ σ ] ] ] ( ρ ) = su ( b t ) )
rec ( s u ( b t ) , T [ q ( σ ) ] , z [ σ ] , s [ q 2 ( σ ) ] , ρ ) ↘ b L \operatorname{rec}(\mathrm{su}(b_t),T[q(\sigma)],z[\sigma],s[q^2(\sigma)],\rho)\searrow b_L rec ( su ( b t ) , T [ q ( σ )] , z [ σ ] , s [ q 2 ( σ )] , ρ ) ↘ b L
(rec-su needs predecessor’s rec value)
rec ( b t , T [ q ( σ ) ] , z [ σ ] , s [ q 2 ( σ ) ] , ρ ) ↘ c t \operatorname{rec}(b_t,T[q(\sigma)],z[\sigma],s[q^2(\sigma)],\rho)\searrow c_t rec ( b t , T [ q ( σ )] , z [ σ ] , s [ q 2 ( σ )] , ρ ) ↘ c t
(by ev-rec on E [ σ ] E[\sigma] E [ σ ] evaluated at ρ \rho ρ ; @ҵә
⟦ t [ σ ] ⟧ ( ρ ) = b t \llbracket t[\sigma]\rrbracket(\rho)=b_t [ [ t [ σ ] ] ] ( ρ ) = b t
⟦ s [ q 2 ( σ ) ] ⟧ ( ( ρ , b t / x , c t / y ) ) ↘ b L \llbracket s[q^2(\sigma)]\rrbracket((\rho,b_t/x,c_t/y))\searrow b_L [ [ s [ q 2 ( σ )] ] ] (( ρ , b t / x , c t / y )) ↘ b L
(by REC-SU)
At the inner position:
⟦ elim N a t ( x . T ) z ( x , y . s ) ( succ t ) ⟧ ( ρ σ ) ↘ b I \llbracket\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ (\operatorname{succ}\ t)\rrbracket(\rho\sigma)\searrow b_I [ [ elim Nat ( x . T ) z ( x , y . s ) ( succ t ) ] ] ( ρ σ ) ↘ b I
(by ev-rec)
rec ( su ( a ) , T , z , s , ρ σ ) ↘ b I \operatorname{rec}(\operatorname{su}(a),T,z,s,\rho\sigma)\searrow b_I rec ( su ( a ) , T , z , s , ρ σ ) ↘ b I
(rec-su)
rec ( a , T , z , s , ρ σ ) ↘ c \operatorname{rec}(a,T,z,s,\rho\sigma)\searrow c rec ( a , T , z , s , ρ σ ) ↘ c
(by ev-rec on E E E at ρ σ \rho\sigma ρ σ ; ⟦ t ⟧ ( ρ σ ) = a \llbracket t\rrbracket(\rho\sigma)=a [ [ t ] ] ( ρ σ ) = a )
⟦ s ⟧ ( ( ρ σ , a / x , c / y ) ) ↘ b I \llbracket s\rrbracket((\rho\sigma,a/x,c/y))\searrow b_I [ [ s ] ] (( ρ σ , a / x , c / y )) ↘ b I
(by REC-SU)
RHS expression on the σ ′ , ρ ′ \sigma',\rho' σ ′ , ρ ′ -side. The RHS appears on the right of ≈ \approx ≈ in the goal, so the four-value pattern’s RHS values are ⟦ ρ ′ ⟧ \llbracket\rho'\rrbracket [ [ ρ ′ ] ] (outer-RHS) and ⟦ s [ t / x , E / y ] ⟧ ( ρ σ ′ ) \llbracket s[t/x,E/y]\rrbracket(\rho\sigma') [ [ s [ t / x , E / y ] ] ] ( ρ σ ′ ) (inner-RHS). By Theorems 2.22, 2.26 and 2.27:
= s [ σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ] =s[\sigma',t[\sigma']/x,E[\sigma']/y] = s [ σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ]
(syntactic, composition of substitutions)
Doubly-extended semantic substitution. We need the recursive call to be semantically valid: by Theorem 6.56, Γ , x : N a t ⊨ x ≈ x : N a t \Gamma,x:\mathrm{Nat}\models x\approx x:\mathrm{Nat} Γ , x : Nat ⊨ x ≈ x : Nat . By Theorem 6.63 on T ≈ T T\approx T T ≈ T , z ≈ z z\approx z z ≈ z , s ≈ s s\approx s s ≈ s (all reflexive hypotheses, using Theorems 6.48 and 6.49) and x ≈ x x\approx x x ≈ x :
Γ , x : N a t ⊨ elim N a t ( x . T ) z ( x , y . s ) x ≈ elim N a t ( x . T ) z ( x , y . s ) x : T \Gamma,x:\mathrm{Nat}\models\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ x\approx\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ x:T Γ , x : Nat ⊨ elim Nat ( x . T ) z ( x , y . s ) x ≈ elim Nat ( x . T ) z ( x , y . s ) x : T
(by Theorem 6.63, scrutinee x x x ; conclusion type T [ x / x ] = T T[x/x]=T T [ x / x ] = T )
By Theorem 6.46 on Γ ′ ⊨ σ ≈ σ ′ : Γ \Gamma'\models\sigma\approx\sigma':\Gamma Γ ′ ⊨ σ ≈ σ ′ : Γ , Γ , x : N a t ⊨ t ≈ t : N a t \Gamma,x:\mathrm{Nat}\models t\approx t:\mathrm{Nat} Γ , x : Nat ⊨ t ≈ t : Nat , and the above (with the head substitution computing E [ σ ] E[\sigma] E [ σ ] on the LHS, E [ σ ′ ] E[\sigma'] E [ σ ′ ] on the RHS):
Γ ′ ⊨ ( σ , t [ σ ] / x , E [ σ ] / y ) ≈ ( σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ) : Γ , x : N a t , y : T . \Gamma'\models(\sigma,t[\sigma]/x,E[\sigma]/y)
\approx(\sigma',t[\sigma']/x,E[\sigma']/y):\Gamma,x:\mathrm{Nat},y:T. Γ ′ ⊨ ( σ , t [ σ ] / x , E [ σ ] / y ) ≈ ( σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ) : Γ , x : Nat , y : T .
Four-value pattern of s s s at the doubly-extended substitution. Apply Γ , x : N a t , y : T ⊨ s ≈ s : T [ ⇑ ∘ ⇑ , succ x 1 / x ] \Gamma,x:\mathrm{Nat},y:T\models s\approx s:T[\Uparrow\circ\Uparrow,\operatorname{succ}\ x_1/x] Γ , x : Nat , y : T ⊨ s ≈ s : T [ ⇑ ∘ ⇑ , succ x 1 / x ] at the above substitution and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho'\in R' ρ ≈ ρ ′ ∈ R ′ :
{ ⟦ s [ σ , t [ σ ] / x , E [ σ ] / y ] ⟧ ( ρ ) , ⟦ s ⟧ ( ⟦ ( σ , t [ σ ] / x , E [ σ ] / y ) ⟧ ( ρ ) ) , ⟦ s ⟧ ( ⟦ ( σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ) ⟧ ( ρ ′ ) , ⟦ s [ σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ] ⟧ ( ρ ′ ) } ⊆ R O \{\llbracket s[\sigma,t[\sigma]/x,E[\sigma]/y]\rrbracket(\rho),\ \llbracket s\rrbracket(\llbracket(\sigma,t[\sigma]/x,E[\sigma]/y)\rrbracket(\rho)),
\llbracket s\rrbracket(\llbracket(\sigma',t[\sigma']/x,E[\sigma']/y)\rrbracket(\rho'),\ \llbracket s[\sigma',t[\sigma']/x,E[\sigma']/y]\rrbracket(\rho')\}\subseteq R_O { [ [ s [ σ , t [ σ ] / x , E [ σ ] / y ] ] ] ( ρ ) , [ [ s ] ] ( [ [ ( σ , t [ σ ] / x , E [ σ ] / y ) ] ] ( ρ )) , [ [ s ] ] ( [ [ ( σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ) ] ] ( ρ ′ ) , [ [ s [ σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ] ] ] ( ρ ′ )} ⊆ R O
(by hypothesis on s s s )
By substitution-extension evaluation:
⟦ ( σ , t [ σ ] / x , E [ σ ] / y ) ⟧ ( ρ ) = ( ρ σ , b t / x , c t / y ) \llbracket(\sigma,t[\sigma]/x,E[\sigma]/y)\rrbracket(\rho)=(\rho\sigma,b_t/x,c_t/y) [ [ ( σ , t [ σ ] / x , E [ σ ] / y ) ] ] ( ρ ) = ( ρ σ , b t / x , c t / y )
(pointwise; head eval, ⟦ E [ σ ] ⟧ ( ρ ) = c t \llbracket E[\sigma]\rrbracket(\rho)=c_t [ [ E [ σ ] ] ] ( ρ ) = c t )
⟦ ( σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ) ⟧ ( ρ ′ ) = ( ρ σ ′ , b t ′ / x , c t ′ / y ) \llbracket(\sigma',t[\sigma']/x,E[\sigma']/y)\rrbracket(\rho')=(\rho\sigma',b_t'/x,c_t'/y) [ [ ( σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ) ] ] ( ρ ′ ) = ( ρ σ ′ , b t ′ / x , c t ′ / y )
(symmetrically; ⟦ E [ σ ′ ] ⟧ ( ρ ′ ) = c t ′ \llbracket E[\sigma']\rrbracket(\rho')=c_t' [ [ E [ σ ′ ] ] ] ( ρ ′ ) = c t ′ )
where c t ′ c_t' c t ′ is the corresponding recursive-call value. Hence the four values of the pattern read:
{ ⟦ s [ σ , t [ σ ] / x , E [ σ ] / y ] ⟧ ( ρ ) , ⟦ s ⟧ ( ( ρ σ , b t / x , c t / y ) ) , ⟦ s ⟧ ( ( ρ σ ′ , b t ′ / x , c t ′ / y ) ) , ⟦ s [ σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ] ⟧ ( ρ ′ ) } ⊆ R O \{\llbracket s[\sigma,t[\sigma]/x,E[\sigma]/y]\rrbracket(\rho),\ \llbracket s\rrbracket((\rho\sigma,b_t/x,c_t/y)),
\llbracket s\rrbracket((\rho\sigma',b_t'/x,c_t'/y)),\ \llbracket s[\sigma',t[\sigma']/x,E[\sigma']/y]\rrbracket(\rho')\}\subseteq R_O { [ [ s [ σ , t [ σ ] / x , E [ σ ] / y ] ] ] ( ρ ) , [ [ s ] ] (( ρ σ , b t / x , c t / y )) , [ [ s ] ] (( ρ σ ′ , b t ′ / x , c t ′ / y )) , [ [ s [ σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ] ] ] ( ρ ′ )} ⊆ R O
Identifying R O R_O R O . R O R_O R O is the PER returned by the type four-value pattern of T [ ⇑ ∘ ⇑ , succ x 1 / x ] T[\Uparrow\circ\Uparrow,\operatorname{succ}\ x_1/x] T [ ⇑ ∘ ⇑ , succ x 1 / x ] at the same doubly-extended substitution. We bridge it to the PER at ⟦ T ⟧ ( ( ρ σ , su ( a ) / x ) ) \llbracket T\rrbracket((\rho\sigma,\operatorname{su}(a)/x)) [ [ T ] ] (( ρ σ , su ( a ) / x )) (which is the goal’s type T [ succ t / x ] T[\operatorname{succ}\ t/x] T [ succ t / x ] evaluated at the inner position) via two steps.
Step (a): collapse the iterated substitution. Denote τ ∗ : = ( σ , t [ σ ] / x , E [ σ ] / y ) \tau_*:=(\sigma,t[\sigma]/x,E[\sigma]/y) τ ∗ := ( σ , t [ σ ] / x , E [ σ ] / y ) (the doubly-extended substitution from Γ ′ \Gamma' Γ ′ to Γ , x : N a t , y : T \Gamma,x:\mathrm{Nat},y:T Γ , x : Nat , y : T ). The value ⟦ ( T [ ⇑ ∘ ⇑ , succ x 1 / x ] ) [ τ ∗ ] ⟧ ( ρ ) \llbracket(T[\Uparrow\circ\Uparrow,\operatorname{succ}\ x_1/x])[\tau_*]\rrbracket(\rho) [ [ ( T [ ⇑ ∘ ⇑ , succ x 1 / x ]) [ τ ∗ ] ] ] ( ρ ) governs R O R_O R O . By Theorem 2.22 and Theorem 2.26:
( T [ ⇑ ∘ ⇑ , succ x 1 / x ] ) [ τ ∗ ] = T [ ( ⇑ ∘ ⇑ , succ x 1 / x ) ∘ τ ∗ ] (T[\Uparrow\circ\Uparrow,\operatorname{succ}\ x_1/x])[\tau_*]
=T[(\Uparrow\circ\Uparrow,\operatorname{succ}\ x_1/x)\circ\tau_*] ( T [ ⇑ ∘ ⇑ , succ x 1 / x ]) [ τ ∗ ] = T [( ⇑ ∘ ⇑ , succ x 1 / x ) ∘ τ ∗ ]
(by Theorem 2.22)
( ⇑ ∘ ⇑ , succ x 1 / x ) ∘ τ ∗ = ( ( ⇑ ∘ ⇑ ) ∘ τ ∗ , ( succ x 1 ) [ τ ∗ ] / x ) (\Uparrow\circ\Uparrow,\operatorname{succ}\ x_1/x)\circ\tau_*
=((\Uparrow\circ\Uparrow)\circ\tau_*,(\operatorname{succ}\ x_1)[\tau_*]/x) ( ⇑ ∘ ⇑ , succ x 1 / x ) ∘ τ ∗ = (( ⇑ ∘ ⇑ ) ∘ τ ∗ , ( succ x 1 ) [ τ ∗ ] / x )
(by Theorem 2.26)
( ⇑ ∘ ⇑ ) ∘ τ ∗ = σ (\Uparrow\circ\Uparrow) \circ\tau_* = \sigma ( ⇑ ∘ ⇑ ) ∘ τ ∗ = σ
(by Theorem 2.25 twice, dropping E [ σ ] / y E[\sigma]/y E [ σ ] / y and t [ σ ] / x t[\sigma]/x t [ σ ] / x )
( succ x 1 ) [ τ ∗ ] = succ x 1 [ τ ∗ ] = succ t [ σ ] (\operatorname{succ} x_1)[\tau_*] = \operatorname{succ} x_1[\tau_*] = \operatorname{succ} t[\sigma] ( succ x 1 ) [ τ ∗ ] = succ x 1 [ τ ∗ ] = succ t [ σ ]
(by syntactic substitution; τ ∗ ( 1 ) = t [ σ ] \tau_*(1) = t[\sigma] τ ∗ ( 1 ) = t [ σ ] )
Hence the collapsed substitution is ( σ , succ t [ σ ] / x ) (\sigma,\operatorname{succ} t[\sigma]/x) ( σ , succ t [ σ ] / x ) :
( T [ ⇑ ∘ ⇑ , succ x 1 / x ] ) [ τ ∗ ] = T [ σ , succ t [ σ ] / x ] (T[\Uparrow\circ\Uparrow,\operatorname{succ} x_1/x])[\tau_*] = T[\sigma,\operatorname{succ} t[\sigma]/x] ( T [ ⇑ ∘ ⇑ , succ x 1 / x ]) [ τ ∗ ] = T [ σ , succ t [ σ ] / x ]
(by combining the above)
Step (b): instantiate hypothesis on T T T at the collapsed substitution. By the IH on Γ , x : Nat ⊢ T ≈ T : Ty i \Gamma,x:\operatorname{Nat} \vdash T \approx T:\operatorname{Ty}_i Γ , x : Nat ⊢ T ≈ T : Ty i , applied at Γ ′ \Gamma' Γ ′ , the semantic substitution Γ ′ ⊨ ( σ , succ t [ σ ] / x ) ≈ ( σ ′ , succ t [ σ ′ ] / x ) : Γ , x : Nat \Gamma' \vDash(\sigma,\operatorname{succ} t[\sigma]/x) \approx(\sigma',\operatorname{succ} t[\sigma']/x):\Gamma,x:\operatorname{Nat} Γ ′ ⊨ ( σ , succ t [ σ ] / x ) ≈ ( σ ′ , succ t [ σ ′ ] / x ) : Γ , x : Nat (by Theorem 6.45 on σ ≈ σ ′ \sigma\approx\sigma' σ ≈ σ ′ and succ t [ σ ] ≈ succ t [ σ ′ ] ∈ Nat \operatorname{succ} t[\sigma] \approx\operatorname{succ} t[\sigma'] \in\operatorname{Nat} succ t [ σ ] ≈ succ t [ σ ′ ] ∈ Nat via Nat-Su on the t t t -pattern), and ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ :
⟦ T [ σ , succ t [ σ ] / x ] ⟧ ( ρ ) ≈ ⟦ T ⟧ ( ⟦ ( σ , succ t [ σ ] / x ) ⟧ ( ρ ) ) ∈ U i ↘ R O \begin{aligned}
\llbracket T[\sigma,\operatorname{succ} t[\sigma]/x]\rrbracket(\rho) \\
&\approx\llbracket T\rrbracket(\llbracket(\sigma,\operatorname{succ} t[\sigma]/x)\rrbracket(\rho)) \in\mathcal{U}_i \searrow R_O
\end{aligned} [ [ T [ σ , succ t [ σ ] / x ] ] ] ( ρ ) ≈ [ [ T ] ] ( [ [ ( σ , succ t [ σ ] / x ) ] ] ( ρ )) ∈ U i ↘ R O
(four-value of T T T , outer-LHS vs inner-LHS)
⟦ ( σ , succ t [ σ ] / x ) ⟧ ( ρ ) = ( ρ σ , su ( b t ) / x ) \llbracket(\sigma,\operatorname{succ} t[\sigma]/x)\rrbracket(\rho) = (\rho\sigma,\operatorname{su}(b_t)/x) [ [ ( σ , succ t [ σ ] / x ) ] ] ( ρ ) = ( ρ σ , su ( b t ) / x )
(pointwise eval; ⟦ succ t [ σ ] ⟧ ( ρ ) = su ( b t ) \llbracket\operatorname{succ} t[\sigma]\rrbracket(\rho)=\operatorname{su}(b_t) [ [ succ t [ σ ] ] ] ( ρ ) = su ( b t ) )
Bridge su ( b t ) \operatorname{su}(b_t) su ( b t ) to su ( a ) \operatorname{su}(a) su ( a ) : from the four-value pattern of t t t ,
b t = ⟦ t [ σ ] ⟧ ( ρ ) ≈ a = ⟦ t ⟧ ( ρ σ ) ∈ Nat b_t = \llbracket t[\sigma]\rrbracket(\rho) \approx a = \llbracket t\rrbracket(\rho\sigma) \in\operatorname{Nat} b t = [ [ t [ σ ] ] ] ( ρ ) ≈ a = [ [ t ] ] ( ρ σ ) ∈ Nat
(outer-LHS vs inner-LHS), so su ( b t ) ≈ su ( a ) ∈ Nat \operatorname{su}(b_t) \approx\operatorname{su}(a) \in\operatorname{Nat} su ( b t ) ≈ su ( a ) ∈ Nat by Nat-Su. By Theorem 6.38 on T T T :
⟦ T ⟧ ( ( ρ σ , su ( b t ) / x ) ) ≈ ⟦ T ⟧ ( ( ρ σ , su ( a ) / x ) ) ∈ U i \llbracket T\rrbracket((\rho\sigma,\operatorname{su}(b_t)/x)) \approx\llbracket T\rrbracket((\rho\sigma,\operatorname{su}(a)/x)) \in\mathcal{U}_i [ [ T ] ] (( ρ σ , su ( b t ) / x )) ≈ [ [ T ] ] (( ρ σ , su ( a ) / x )) ∈ U i
(Theorem 6.38)
By transitivity and Theorem 6.12, R O R_O R O is the PER at ⟦ T ⟧ ( ( ρ σ , su ( a ) / x ) ) \llbracket T\rrbracket((\rho\sigma,\operatorname{su}(a)/x)) [ [ T ] ] (( ρ σ , su ( a ) / x )) — the goal’s type T [ succ t / x ] T[\operatorname{succ} t/x] T [ succ t / x ] inner-LHS value (since T [ succ t / x ] T[\operatorname{succ} t/x] T [ succ t / x ] evaluated at ρ σ \rho\sigma ρ σ equals T T T at the inner-extended env, modulo the same bridge).
LHS-RHS bridging. The RHS outer-RHS value is ⟦ ρ ′ ⟧ = ⟦ s [ σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ] ⟧ ( ρ ′ ) \llbracket\rho'\rrbracket= \llbracket s[\sigma',t[\sigma']/x,E[\sigma']/y]\rrbracket(\rho') [ [ ρ ′ ] ] = [ [ s [ σ ′ , t [ σ ′ ] / x , E [ σ ′ ] / y ] ] ] ( ρ ′ ) , which is the outer-RHS of the four-value pattern of s s s above. Similarly, the RHS inner-RHS value ⟦ s [ t / x , E / y ] ⟧ ( ρ σ ′ ) \llbracket s[t/x,E/y]\rrbracket(\rho\sigma') [ [ s [ t / x , E / y ] ] ] ( ρ σ ′ ) relates to ⟦ s ⟧ ( ( ρ σ ′ , b t ′ / x , c t ′ / y ) ) \llbracket s\rrbracket((\rho\sigma',b_{t'}/x,c_{t'}/y)) [ [ s ] ] (( ρ σ ′ , b t ′ / x , c t ′ / y )) via the four-value pattern of s s s on the primed side (analogous to the LHS-side bridging below).
For LHS values (the σ , ρ \sigma,\rho σ , ρ - and ρ σ \rho\sigma ρ σ -sides of the goal): the LHS computation gives b L = ⟦ s [ q 2 ( σ ) ] ⟧ ( ( ρ , b t / x , c t / y ) ) b_L=\llbracket s[q^2(\sigma)]\rrbracket((\rho,b_t/x,c_t/y)) b L = [ [ s [ q 2 ( σ )] ] ] (( ρ , b t / x , c t / y )) at σ , ρ \sigma,\rho σ , ρ , and b I = ⟦ s ⟧ ( ( ρ σ , a / x , c / y ) ) b_I=\llbracket s\rrbracket((\rho\sigma,a/x,c/y)) b I = [ [ s ] ] (( ρ σ , a / x , c / y )) at ρ σ \rho\sigma ρ σ . We bridge b L b_L b L to ⟦ s ⟧ ( ( ρ σ , b t / x , c t / y ) ) \llbracket s\rrbracket((\rho\sigma,b_t/x,c_t/y)) [ [ s ] ] (( ρ σ , b t / x , c t / y )) (the inner-LHS of the four-value pattern) via the four-value pattern of s ≈ s s\approx s s ≈ s (reflexive) at Γ ′ , x : Nat , y : T [ q ( σ ) ] \Gamma',x:\operatorname{Nat},y:T[q(\sigma)] Γ ′ , x : Nat , y : T [ q ( σ )] , doubly-lifted substitution q 2 ( σ ) ≈ q 2 ( σ ) q^2(\sigma)\approx q^2(\sigma) q 2 ( σ ) ≈ q 2 ( σ ) , and reflexive env-pair ( ρ , b t / x , c t / y ) ≈ ( ρ , b t / x , c t / y ) (\rho,b_t/x,c_t/y)\approx(\rho,b_t/x,c_t/y) ( ρ , b t / x , c t / y ) ≈ ( ρ , b t / x , c t / y ) :
⟦ s [ q 2 ( σ ) ] ⟧ ( ( ρ , b t / x , c t / y ) ) ≈ ⟦ s ⟧ ( ⟦ q 2 ( σ ) ⟧ ( ( ρ , b t / x , c t / y ) ) ) ∈ R O \llbracket s[q^2(\sigma)]\rrbracket((\rho,b_t/x,c_t/y)) \approx\llbracket s\rrbracket(\llbracket q^2(\sigma)\rrbracket((\rho,b_t/x,c_t/y))) \in R_O [ [ s [ q 2 ( σ )] ] ] (( ρ , b t / x , c t / y )) ≈ [ [ s ] ] ( [ [ q 2 ( σ ) ] ] (( ρ , b t / x , c t / y ))) ∈ R O
(four-value pattern of s s s )
⟦ q 2 ( σ ) ⟧ ( ( ρ , b t / x , c t / y ) ) ≈ ( ρ σ , b t / x , c t / y ) ∈ R Γ , x : Nat , y : T \llbracket q^2(\sigma)\rrbracket((\rho,b_t/x,c_t/y)) \approx(\rho\sigma,b_t/x,c_t/y) \in R_{\Gamma,x:\operatorname{Nat},y:T} [ [ q 2 ( σ ) ] ] (( ρ , b t / x , c t / y )) ≈ ( ρ σ , b t / x , c t / y ) ∈ R Γ , x : Nat , y : T
(by Ctx-Ext twice and the four-value pattern of σ \sigma σ at ⇑ \Uparrow ⇑ for the tail)
⟦ s ⟧ ( ⟦ q 2 ( σ ) ⟧ ( ( ρ , b t / x , c t / y ) ) ) ≈ ⟦ s ⟧ ( ( ρ σ , b t / x , c t / y ) ) ∈ R O \llbracket s\rrbracket(\llbracket q^2(\sigma)\rrbracket((\rho,b_t/x,c_t/y))) \approx\llbracket s\rrbracket((\rho\sigma,b_t/x,c_t/y)) \in R_O [ [ s ] ] ( [ [ q 2 ( σ ) ] ] (( ρ , b t / x , c t / y ))) ≈ [ [ s ] ] (( ρ σ , b t / x , c t / y )) ∈ R O
(Theorem 6.38 on s s s )
Hence by transitivity, b L ≈ ⟦ s ⟧ ( ( ρ σ , b t / x , c t / y ) ) ∈ R O b_L\approx\llbracket s\rrbracket((\rho\sigma,b_t/x,c_t/y))\in R_O b L ≈ [ [ s ] ] (( ρ σ , b t / x , c t / y )) ∈ R O .
For b I = ⟦ s ⟧ ( ( ρ σ , a / x , c / y ) ) b_I=\llbracket s\rrbracket((\rho\sigma,a/x,c/y)) b I = [ [ s ] ] (( ρ σ , a / x , c / y )) : bridge to ⟦ s ⟧ ( ( ρ σ , b t / x , c t / y ) ) \llbracket s\rrbracket((\rho\sigma,b_t/x,c_t/y)) [ [ s ] ] (( ρ σ , b t / x , c t / y )) via Theorem 6.38 on s s s at the env-pair related by:
b t ≈ a ∈ Nat b_t \approx a \in\operatorname{Nat} b t ≈ a ∈ Nat
(four-value pattern of t t t , outer-LHS vs inner-LHS)
c t ≈ c ∈ R T -at- a c_t \approx c \in R_T\text{-at-}a c t ≈ c ∈ R T -at- a
(four-value pattern of E E E at σ \sigma σ , outer-LHS vs inner-LHS; using E E E semantic by Theorem 6.63)
giving ⟦ s ⟧ ( ( ρ σ , b t / x , c t / y ) ) ≈ ⟦ s ⟧ ( ( ρ σ , a / x , c / y ) ) = b I ∈ R O \llbracket s\rrbracket((\rho\sigma,b_t/x,c_t/y))\approx\llbracket s\rrbracket((\rho\sigma,a/x,c/y))=b_I\in R_O [ [ s ] ] (( ρ σ , b t / x , c t / y )) ≈ [ [ s ] ] (( ρ σ , a / x , c / y )) = b I ∈ R O . Hence b L ≈ b I b_L\approx b_I b L ≈ b I in R O R_O R O , and both are PER-related to the four-value pattern’s inner-LHS.
Symmetrically for the primed side. Combining: all four LHS values ({ b L , b I , b L ′ , b I ′ } \{b_L, b_I, b'_L, b'_I\} { b L , b I , b L ′ , b I ′ } ) are pairwise related to the four RHS values (the four-value pattern of s s s outer/inner) in R O R_O R O , by transitivity through the inner-LHS/inner-RHS bridge.
Type part. The type four-value pattern is included in the application of Γ , x : N a t , y : T ⊢ s ≈ s : T [ ⇑ ∘ ⇑ , succ x 1 / x ] \Gamma, x : \mathrm{Nat}, y : T \vdash s \approx s : T[\Uparrow\circ\Uparrow, \operatorname{succ} x_1/x] Γ , x : Nat , y : T ⊢ s ≈ s : T [ ⇑ ∘ ⇑ , succ x 1 / x ] above; by the same syntactic identity used for the term part, the goal’s type T [ succ t / x ] T[\operatorname{succ} t/x] T [ succ t / x ] pattern coincides with this type four-value pattern modulo the substitution-composition lemmas.
Semantic Subtyping Rules
The semantic subtyping judgment Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T unfolds to: for all Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , all Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and all D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ :
⟦ S [ σ ] ⟧ ( ρ ) ≈ ⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) ∈ U i \llbracket S[\sigma]\rrbracket(\rho) \approx\llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho)) \in U_i [ [ S [ σ ] ] ] ( ρ ) ≈ [ [ S ] ] ( [ [ σ ] ] ( ρ )) ∈ U i ,
⟦ T [ σ ′ ] ⟧ ( ρ ′ ) ≈ ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ U i \llbracket T[\sigma']\rrbracket(\rho') \approx\llbracket T\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \in U_i [ [ T [ σ ′ ] ] ] ( ρ ′ ) ≈ [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ∈ U i ,
⟦ S ⟧ ( ⟦ σ ⟧ ( ρ ) ) < : i ⟦ T ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) \llbracket S\rrbracket(\llbracket\sigma\rrbracket(\rho)) <:_{i} \llbracket T\rrbracket(\llbracket\sigma'\rrbracket(\rho')) [ [ S ] ] ( [ [ σ ] ] ( ρ )) < : i [ [ T ] ] ( [ [ σ ′ ] ] ( ρ ′ )) .
We establish the semantic counterpart of each subtyping rule as a separate lemma.
Lemma 6.69 (Fundamental — Sub-Univ). If ⊢ Γ \vdash\Gamma ⊢ Γ and i ≤ j i \leq j i ≤ j , then Γ ⊢ T y i ⊆ T y j \Gamma\vdash\mathrm{Ty}_i \subseteq\mathrm{Ty}_j Γ ⊢ Ty i ⊆ Ty j .
Proof. By Theorem 6.34 on ⊢ Γ \vdash\Gamma ⊢ Γ we obtain Γ ≈ Γ ↘ R Γ \Gamma\approx\Gamma\searrow R_\Gamma Γ ≈ Γ ↘ R Γ . Let Γ ′ \Gamma' Γ ′ with Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. We verify the three clauses of Γ ⊢ T y i ⊆ T y j \Gamma\vdash\mathrm{Ty}_i \subseteq\mathrm{Ty}_j Γ ⊢ Ty i ⊆ Ty j at the level k : = 1 + max ( i , j ) k := 1 + \max(i,j) k := 1 + max ( i , j ) .
Since T y i \mathrm{Ty}_i Ty i and T y j \mathrm{Ty}_j Ty j are closed terms, for any substitution τ \tau τ and any environment ρ 0 \rho_0 ρ 0 we have T y i [ τ ] = T y i \mathrm{Ty}_i[\tau] = \mathrm{Ty}_i Ty i [ τ ] = Ty i , T y j [ τ ] = T y j \mathrm{Ty}_j[\tau] = \mathrm{Ty}_j Ty j [ τ ] = Ty j , and by evaluation of the universe constructor ⟦ T y i ⟧ ( ρ 0 ) = U i \llbracket\mathrm{Ty}_i\rrbracket(\rho_0) = U_i [ [ Ty i ] ] ( ρ 0 ) = U i , ⟦ T y j ⟧ ( ρ 0 ) = U j \llbracket\mathrm{Ty}_j\rrbracket(\rho_0) = U_j [ [ Ty j ] ] ( ρ 0 ) = U j .
Part (1).
⟦ T y i [ σ ] ⟧ ( ρ ) = U i (closed term + evaluation of T y i ) ⟦ T y i ⟧ ( ⟦ σ ⟧ ( ρ ) ) = U i (evaluation of T y i ) U i ≈ U i ∈ U k ↘ ( U i ) (by U-Univ, since i < k ) ⟦ T y i [ σ ] ⟧ ( ρ ) ≈ ⟦ T y i ⟧ ( ⟦ σ ⟧ ( ρ ) ) ∈ U k (reflexivity of the previous line) \begin{aligned}
\llbracket\mathrm{Ty}_i[\sigma]\rrbracket(\rho) &= U_i && \text{(closed term + evaluation of }\mathrm{Ty}_i\text{)}\\
\llbracket\mathrm{Ty}_i\rrbracket(\llbracket\sigma\rrbracket(\rho)) &= U_i && \text{(evaluation of }\mathrm{Ty}_i\text{)}\\
U_i &\approx U_i \in U_k \searrow(U_i) && \text{(by U-Univ, since }i < k\text{)}\\
\llbracket\mathrm{Ty}_i[\sigma]\rrbracket(\rho) &\approx\llbracket\mathrm{Ty}_i\rrbracket(\llbracket\sigma\rrbracket(\rho)) \in U_k && \text{(reflexivity of the previous line)}
\end{aligned} [ [ Ty i [ σ ] ] ] ( ρ ) [ [ Ty i ] ] ( [ [ σ ] ] ( ρ )) U i [ [ Ty i [ σ ] ] ] ( ρ ) = U i = U i ≈ U i ∈ U k ↘ ( U i ) ≈ [ [ Ty i ] ] ( [ [ σ ] ] ( ρ )) ∈ U k (closed term + evaluation of Ty i ) (evaluation of Ty i ) (by U-Univ, since i < k ) (reflexivity of the previous line) Part (2). Symmetrically:
⟦ T y j [ σ ′ ] ⟧ ( ρ ′ ) = U j = ⟦ T y j ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) (closed term + evaluation of T y j ) U j ≈ U j ∈ U k ↘ ( U j ) (by U-Univ, since j < k ) ⟦ T y j [ σ ′ ] ⟧ ( ρ ′ ) ≈ ⟦ T y j ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) ∈ U k (reflexivity) \begin{aligned}
\llbracket\mathrm{Ty}_j[\sigma']\rrbracket(\rho') &= U_j = \llbracket\mathrm{Ty}_j\rrbracket(\llbracket\sigma'\rrbracket(\rho')) && \text{(closed term + evaluation of }\mathrm{Ty}_j\text{)}\\
U_j &\approx U_j \in U_k \searrow(U_j) && \text{(by U-Univ, since }j < k\text{)}\\
\llbracket\mathrm{Ty}_j[\sigma']\rrbracket(\rho') &\approx\llbracket\mathrm{Ty}_j\rrbracket(\llbracket\sigma'\rrbracket(\rho')) \in U_k && \text{(reflexivity)}
\end{aligned} [ [ Ty j [ σ ′ ] ] ] ( ρ ′ ) U j [ [ Ty j [ σ ′ ] ] ] ( ρ ′ ) = U j = [ [ Ty j ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ≈ U j ∈ U k ↘ ( U j ) ≈ [ [ Ty j ] ] ( [ [ σ ′ ] ] ( ρ ′ )) ∈ U k (closed term + evaluation of Ty j ) (by U-Univ, since j < k ) (reflexivity) Part (3). By < : <: <: -Univ with i ≤ j i \leq j i ≤ j and j < k j < k j < k :
⟦ T y i ⟧ ( ⟦ σ ⟧ ( ρ ) ) = U i < : k U j = ⟦ T y j ⟧ ( ⟦ σ ′ ⟧ ( ρ ′ ) ) (by < : -Univ) \llbracket\mathrm{Ty}_i\rrbracket(\llbracket\sigma\rrbracket(\rho)) = U_i <:_k U_j = \llbracket\mathrm{Ty}_j\rrbracket(\llbracket\sigma'\rrbracket(\rho'))
\qquad\text{(by }<:\text{-Univ)} [ [ Ty i ] ] ( [ [ σ ] ] ( ρ )) = U i < : k U j = [ [ Ty j ] ] ( [ [ σ ′ ] ] ( ρ ′ )) (by <: -Univ)
Lemma 6.70 (Fundamental — Sub-Pi). If Γ ⊢ S 1 ≈ S 1 : T y i \Gamma\vdash S_1 \approx S_1 : \mathrm{Ty}_i Γ ⊢ S 1 ≈ S 1 : Ty i , Γ ⊢ S 2 ≈ S 2 : T y i \Gamma\vdash S_2 \approx S_2 : \mathrm{Ty}_i Γ ⊢ S 2 ≈ S 2 : Ty i , Γ ⊢ S 1 ≈ S 2 : T y i \Gamma\vdash S_1 \approx S_2 : \mathrm{Ty}_i Γ ⊢ S 1 ≈ S 2 : Ty i , Γ , x : S 1 ⊢ T 1 ≈ T 1 : T y i \Gamma, x : S_1 \vdash T_1 \approx T_1 : \mathrm{Ty}_i Γ , x : S 1 ⊢ T 1 ≈ T 1 : Ty i , Γ , x : S 2 ⊢ T 2 ≈ T 2 : T y i \Gamma, x : S_2 \vdash T_2 \approx T_2 : \mathrm{Ty}_i Γ , x : S 2 ⊢ T 2 ≈ T 2 : Ty i , and Γ , x : S 1 ⊢ T 1 ⊆ T 2 \Gamma, x : S_1 \vdash T_1 \subseteq T_2 Γ , x : S 1 ⊢ T 1 ⊆ T 2 , then Γ ⊢ Π ( x : S 1 ) . T 1 ⊆ Π ( x : S 2 ) . T 2 \Gamma\vdash\Pi(x : S_1).T_1 \subseteq\Pi(x : S_2).T_2 Γ ⊢ Π ( x : S 1 ) . T 1 ⊆ Π ( x : S 2 ) . T 2 .
Proof. Let Γ ′ \Gamma' Γ ′ with Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. Write ρ σ : = ⟦ σ ⟧ ( ρ ) \rho_\sigma:= \llbracket\sigma\rrbracket(\rho) ρ σ := [ [ σ ] ] ( ρ ) and ρ σ ′ : = ⟦ σ ′ ⟧ ( ρ ′ ) \rho_{\sigma'} := \llbracket\sigma'\rrbracket(\rho') ρ σ ′ := [ [ σ ′ ] ] ( ρ ′ ) .
We must verify the three clauses of Γ ⊢ Π ( x : S 1 ) . T 1 ⊆ Π ( x : S 2 ) . T 2 \Gamma\vdash\Pi(x : S_1).T_1 \subseteq\Pi(x : S_2).T_2 Γ ⊢ Π ( x : S 1 ) . T 1 ⊆ Π ( x : S 2 ) . T 2 . Computing the four type values via substitution and evaluation of Π \Pi Π :
⟦ ( Π ( x : S 1 ) . T 1 ) [ σ ] ⟧ ( ρ ) = Π ( ⟦ S 1 [ σ ] ⟧ ( ρ ) , T 1 [ q ( σ ) ] , ρ ) (by definition of substitution and evaluation on Π ) \llbracket(\Pi(x : S_1).T_1)[\sigma]\rrbracket(\rho) = \Pi(\llbracket S_1[\sigma]\rrbracket(\rho), T_1[q(\sigma)], \rho)
\qquad\text{(by definition of substitution and evaluation on }\Pi\text{)} [ [ ( Π ( x : S 1 ) . T 1 ) [ σ ] ] ] ( ρ ) = Π ( [ [ S 1 [ σ ] ] ] ( ρ ) , T 1 [ q ( σ )] , ρ ) (by definition of substitution and evaluation on Π ) ⟦ Π ( x : S 1 ) . T 1 ⟧ ( ρ σ ) = Π ( ⟦ S 1 ⟧ ( ρ σ ) , T 1 , ρ σ ) (by evaluation on Π ) \llbracket\Pi(x : S_1).T_1\rrbracket(\rho_\sigma) = \Pi(\llbracket S_1\rrbracket(\rho_\sigma), T_1, \rho_\sigma)
\qquad\text{(by evaluation on }\Pi\text{)} [ [ Π ( x : S 1 ) . T 1 ] ] ( ρ σ ) = Π ( [ [ S 1 ] ] ( ρ σ ) , T 1 , ρ σ ) (by evaluation on Π )
⟦ Π ( x : S 2 ) . T 2 ⟧ ( ρ σ ′ ) = Π ( ⟦ S 2 ⟧ ( ρ σ ′ ) , T 2 , ρ σ ′ ) \llbracket\Pi(x:S_2).T_2\rrbracket(\rho\sigma')=\Pi(\llbracket S_2\rrbracket(\rho\sigma'),T_2,\rho\sigma') [ [ Π ( x : S 2 ) . T 2 ] ] ( ρ σ ′ ) = Π ( [ [ S 2 ] ] ( ρ σ ′ ) , T 2 , ρ σ ′ )
(by evaluation on Π \Pi Π )
⟦ ( Π ( x : S 2 ) . T 2 ) [ σ ′ ] ⟧ ( ρ ′ ) = Π ( ⟦ S 2 [ σ ′ ] ⟧ ( ρ ′ ) , T 2 [ q ( σ ′ ) ] , ρ ′ ) \llbracket(\Pi(x:S_2).T_2)[\sigma']\rrbracket(\rho')=\Pi(\llbracket S_2[\sigma']\rrbracket(\rho'),T_2[q(\sigma')],\rho') [ [ ( Π ( x : S 2 ) . T 2 ) [ σ ′ ] ] ] ( ρ ′ ) = Π ( [ [ S 2 [ σ ′ ] ] ] ( ρ ′ ) , T 2 [ q ( σ ′ )] , ρ ′ )
(by definition of substitution and evaluation on Π \Pi Π )
Part (1). By Theorem 6.54 applied to Γ ⊢ S 1 ≈ S 1 : T y i \Gamma\vdash S_1 \approx S_1 : \mathsf{Ty}_i Γ ⊢ S 1 ≈ S 1 : Ty i and Γ , x : S 1 ⊢ T 1 ≈ T 1 : T y i \Gamma,x:S_1 \vdash T_1 \approx T_1 : \mathsf{Ty}_i Γ , x : S 1 ⊢ T 1 ≈ T 1 : Ty i , we obtain Γ ⊢ Π ( x : S 1 ) . T 1 ≈ Π ( x : S 1 ) . T 1 : T y i \Gamma\vdash\Pi(x:S_1).T_1 \approx\Pi(x:S_1).T_1 : \mathsf{Ty}_i Γ ⊢ Π ( x : S 1 ) . T 1 ≈ Π ( x : S 1 ) . T 1 : Ty i . Instantiating its type-side four-value relation at Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ and D \mathcal{D} D , the outer-LHS-vs-inner-LHS leg yields:
Π ( ⟦ S 1 [ σ ] ⟧ ( ρ ) , T 1 [ q ( σ ) ] , ρ ) ≈ Π ( ⟦ S 1 ⟧ ( ρ σ ) , T 1 , ρ σ ) ∈ U i \Pi(\llbracket S_1[\sigma]\rrbracket(\rho),T_1[q(\sigma)],\rho)\approx\Pi(\llbracket S_1\rrbracket(\rho\sigma),T_1,\rho\sigma)\in\mathcal{U}_i Π ( [ [ S 1 [ σ ] ] ] ( ρ ) , T 1 [ q ( σ )] , ρ ) ≈ Π ( [ [ S 1 ] ] ( ρ σ ) , T 1 , ρ σ ) ∈ U i
(part (1))
Part (2). Symmetrically, by Theorem 6.54 on S 2 S_2 S 2 and T 2 T_2 T 2 and the outer-RHS-vs-inner-RHS leg of its type-side four-value relation at the same data:
Π ( ⟦ S 2 ⟧ ( ρ σ ′ ) , T 2 , ρ σ ′ ) ≈ Π ( ⟦ S 2 [ σ ′ ] ⟧ ( ρ ′ ) , T 2 [ q ( σ ′ ) ] , ρ ′ ) ∈ U i \Pi(\llbracket S_2\rrbracket(\rho\sigma'),T_2,\rho\sigma')\approx\Pi(\llbracket S_2[\sigma']\rrbracket(\rho'),T_2[q(\sigma')],\rho')\in\mathcal{U}_i Π ( [ [ S 2 ] ] ( ρ σ ′ ) , T 2 , ρ σ ′ ) ≈ Π ( [ [ S 2 [ σ ′ ] ] ] ( ρ ′ ) , T 2 [ q ( σ ′ )] , ρ ′ ) ∈ U i
(part (2), via symmetry of U i \mathcal{U}_i U i )
Part (3). We must show Π ( ⟦ S 1 ⟧ ( ρ σ ) , T 1 , ρ σ ) < : i Π ( ⟦ S 2 ⟧ ( ρ σ ′ ) , T 2 , ρ σ ′ ) \Pi(\llbracket S_1\rrbracket(\rho\sigma),T_1,\rho\sigma)<:_i\Pi(\llbracket S_2\rrbracket(\rho\sigma'),T_2,\rho\sigma') Π ( [ [ S 1 ] ] ( ρ σ ) , T 1 , ρ σ ) < : i Π ( [ [ S 2 ] ] ( ρ σ ′ ) , T 2 , ρ σ ′ ) . We apply < : <: <: -Pi, which requires:
(a) ⟦ S 1 ⟧ ( ρ σ ) ≈ ⟦ S 2 ⟧ ( ρ σ ′ ) ∈ U i ↘ R I \llbracket S_1\rrbracket(\rho\sigma)\approx\llbracket S_2\rrbracket(\rho\sigma')\in\mathcal{U}_i\mathbin{\searrow}R_I [ [ S 1 ] ] ( ρ σ ) ≈ [ [ S 2 ] ] ( ρ σ ′ ) ∈ U i ↘ R I for some R I R_I R I ;
(b) for every D I : : a ≈ a ′ ∈ R I \mathcal{D}_I::a\approx a'\in R_I D I :: a ≈ a ′ ∈ R I , ⟦ T 1 ⟧ ( ρ σ , a / x ) < : i ⟦ T 2 ⟧ ( ρ σ ′ , a ′ / x ) \llbracket T_1\rrbracket(\rho\sigma,a/x)<:_i\llbracket T_2\rrbracket(\rho\sigma',a'/x) [ [ T 1 ] ] ( ρ σ , a / x ) < : i [ [ T 2 ] ] ( ρ σ ′ , a ′ / x ) ;
(c) Π ( ⟦ S 1 ⟧ ( ρ σ ) , T 1 , ρ σ ) ≈ Π ( ⟦ S 1 ⟧ ( ρ σ ) , T 1 , ρ σ ) ∈ U i \Pi(\llbracket S_1\rrbracket(\rho\sigma),T_1,\rho\sigma)\approx\Pi(\llbracket S_1\rrbracket(\rho\sigma),T_1,\rho\sigma)\in\mathcal{U}_i Π ( [ [ S 1 ] ] ( ρ σ ) , T 1 , ρ σ ) ≈ Π ( [ [ S 1 ] ] ( ρ σ ) , T 1 , ρ σ ) ∈ U i and Π ( ⟦ S 2 ⟧ ( ρ σ ′ ) , T 2 , ρ σ ′ ) ≈ Π ( ⟦ S 2 ⟧ ( ρ σ ′ ) , T 2 , ρ σ ′ ) ∈ U i \Pi(\llbracket S_2\rrbracket(\rho\sigma'),T_2,\rho\sigma')\approx\Pi(\llbracket S_2\rrbracket(\rho\sigma'),T_2,\rho\sigma')\in\mathcal{U}_i Π ( [ [ S 2 ] ] ( ρ σ ′ ) , T 2 , ρ σ ′ ) ≈ Π ( [ [ S 2 ] ] ( ρ σ ′ ) , T 2 , ρ σ ′ ) ∈ U i .
(a) Domain. Instantiate the type-side four-value relation of Γ ⊢ S 1 ≈ S 2 : T y i \Gamma\vdash S_1\approx S_2:\mathsf{Ty}_i Γ ⊢ S 1 ≈ S 2 : Ty i at Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma'\vdash\sigma\approx\sigma':\Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ and D \mathcal{D} D :
{ ⟦ S 1 [ σ ] ⟧ ( ρ ) , ⟦ S 1 ⟧ ( ρ σ ) , ⟦ S 2 ⟧ ( ρ σ ′ ) , ⟦ S 2 [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R I \{\llbracket S_1[\sigma]\rrbracket(\rho),\llbracket S_1\rrbracket(\rho\sigma),\llbracket S_2\rrbracket(\rho\sigma'),\llbracket S_2[\sigma']\rrbracket(\rho')\}\subseteq\mathcal{U}_i\mathbin{\searrow}R_I { [ [ S 1 [ σ ] ] ] ( ρ ) , [ [ S 1 ] ] ( ρ σ ) , [ [ S 2 ] ] ( ρ σ ′ ) , [ [ S 2 [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R I
(by hypothesis on S 1 , S 2 S_1,S_2 S 1 , S 2 )
The inner-LHS-vs-inner-RHS pair gives ⟦ S 1 ⟧ ( ρ σ ) ≈ ⟦ S 2 ⟧ ( ρ σ ′ ) ∈ U i ↘ R I \llbracket S_1\rrbracket(\rho\sigma)\approx\llbracket S_2\rrbracket(\rho\sigma')\in\mathcal{U}_i\mathbin{\searrow}R_I [ [ S 1 ] ] ( ρ σ ) ≈ [ [ S 2 ] ] ( ρ σ ′ ) ∈ U i ↘ R I .
(b) Codomain. By Theorem 6.43 on Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma'\vdash\sigma\approx\sigma':\Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ and Γ ⊢ S 1 ≈ S 1 : T y i \Gamma\vdash S_1\approx S_1:\mathsf{Ty}_i Γ ⊢ S 1 ≈ S 1 : Ty i :
Γ ′ , x : S 1 [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S 1 . \Gamma',x:S_1[\sigma]\vdash q(\sigma)\approx q(\sigma'):\Gamma,x:S_1. Γ ′ , x : S 1 [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S 1 .
By the first premise of the semantic substitution judgment, this carries ( Γ ′ , x : S 1 [ σ ] ) ≈ ( Γ ′ , x : S 1 [ σ ] ) ↘ R x : S 1 [ σ ] ′ (\Gamma',x:S_1[\sigma])\approx(\Gamma',x:S_1[\sigma])\mathbin{\searrow}R'_{x:S_1[\sigma]} ( Γ ′ , x : S 1 [ σ ]) ≈ ( Γ ′ , x : S 1 [ σ ]) ↘ R x : S 1 [ σ ] ′ and ( Γ , x : S 1 ) ≈ ( Γ , x : S 1 ) ↘ R Γ , x : S 1 ′ (\Gamma,x:S_1)\approx(\Gamma,x:S_1)\mathbin{\searrow}R'_{\Gamma,x:S_1} ( Γ , x : S 1 ) ≈ ( Γ , x : S 1 ) ↘ R Γ , x : S 1 ′ .
Let D I : : a ≈ a ′ ∈ R I \mathcal{D}_I::a\approx a'\in R_I D I :: a ≈ a ′ ∈ R I be given. By the biconditional of R x : S 1 [ σ ] ′ R'_{x:S_1[\sigma]} R x : S 1 [ σ ] ′ from Ctx-Ext, ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R x : S 1 [ σ ] ′ (\rho,a/x)\approx(\rho',a'/x)\in R'_{x:S_1[\sigma]} ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R x : S 1 [ σ ] ′ requires ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho'\in R' ρ ≈ ρ ′ ∈ R ′ (which we have via D \mathcal{D} D ) and a ≈ a ′ ∈ R H ′ ( D ) a\approx a'\in R'_H(\mathcal{D}) a ≈ a ′ ∈ R H ′ ( D ) where R H ′ R'_H R H ′ is the head family for R x : S 1 [ σ ] ′ R'_{x:S_1[\sigma]} R x : S 1 [ σ ] ′ governed by ⟦ S 1 [ σ ] ⟧ ( ρ ) ≈ ⟦ S 1 [ σ ] ⟧ ( ρ ′ ) ∈ U i ↘ R H ′ ( D ) \llbracket S_1[\sigma]\rrbracket(\rho)\approx\llbracket S_1[\sigma]\rrbracket(\rho')\in\mathcal{U}_i\mathbin{\searrow}R'_H(\mathcal{D}) [ [ S 1 [ σ ] ] ] ( ρ ) ≈ [ [ S 1 [ σ ] ] ] ( ρ ′ ) ∈ U i ↘ R H ′ ( D ) . By Theorem 6.12 on the same left type ⟦ S 1 [ σ ] ⟧ ( ρ ) \llbracket S_1[\sigma]\rrbracket(\rho) [ [ S 1 [ σ ] ] ] ( ρ ) that governs both R I R_I R I (from (a)) and R H ′ ( D ) R'_H(\mathcal{D}) R H ′ ( D ) , R I ⇔ R H ′ ( D ) R_I\Leftrightarrow R'_H(\mathcal{D}) R I ⇔ R H ′ ( D ) . Hence a ≈ a ′ ∈ R H ′ ( D ) a\approx a'\in R'_H(\mathcal{D}) a ≈ a ′ ∈ R H ′ ( D ) , and ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R x : S 1 [ σ ] ′ (\rho,a/x)\approx(\rho',a'/x)\in R'_{x:S_1[\sigma]} ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R x : S 1 [ σ ] ′ .
Apply Γ , x : S 1 ⊢ T 1 ⊆ T 2 \Gamma,x:S_1\vdash T_1\subseteq T_2 Γ , x : S 1 ⊢ T 1 ⊆ T 2 at Γ ′ , x : S 1 [ σ ] \Gamma',x:S_1[\sigma] Γ ′ , x : S 1 [ σ ] (with R x : S 1 [ σ ] ′ R'_{x:S_1[\sigma]} R x : S 1 [ σ ] ′ ), the lifted substitution Γ ′ , x : S 1 [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S 1 \Gamma',x:S_1[\sigma]\vdash q(\sigma)\approx q(\sigma'):\Gamma,x:S_1 Γ ′ , x : S 1 [ σ ] ⊢ q ( σ ) ≈ q ( σ ′ ) : Γ , x : S 1 , and ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R x : S 1 [ σ ] ′ (\rho,a/x)\approx(\rho',a'/x)\in R'_{x:S_1[\sigma]} ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ∈ R x : S 1 [ σ ] ′ :
⟦ T 1 [ q ( σ ) ] ⟧ ( ρ , a / x ) ≈ ⟦ T 1 ⟧ ( ⟦ q ( σ ) ⟧ ( ρ , a / x ) ) ∈ U i \llbracket T_1[q(\sigma)]\rrbracket(\rho,a/x)\approx\llbracket T_1\rrbracket(\llbracket q(\sigma)\rrbracket(\rho,a/x))\in\mathcal{U}_i [ [ T 1 [ q ( σ )] ] ] ( ρ , a / x ) ≈ [ [ T 1 ] ] ( [ [ q ( σ ) ] ] ( ρ , a / x )) ∈ U i
(part (1) of T 1 ⊆ T 2 T_1\subseteq T_2 T 1 ⊆ T 2 )
⟦ T 2 [ q ( σ ′ ) ] ⟧ ( ρ ′ , a ′ / x ) ≈ ⟦ T 2 ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ρ ′ , a ′ / x ) ) ∈ U i \llbracket T_2[q(\sigma')]\rrbracket(\rho',a'/x)\approx\llbracket T_2\rrbracket(\llbracket q(\sigma')\rrbracket(\rho',a'/x))\in\mathcal{U}_i [ [ T 2 [ q ( σ ′ )] ] ] ( ρ ′ , a ′ / x ) ≈ [ [ T 2 ] ] ( [ [ q ( σ ′ ) ] ] ( ρ ′ , a ′ / x )) ∈ U i
(part (2))
⟦ T 1 ⟧ ( ⟦ q ( σ ) ⟧ ( ρ , a / x ) ) < i ⟦ T 2 ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ρ ′ , a ′ / x ) ) \llbracket T_1\rrbracket(\llbracket q(\sigma)\rrbracket(\rho,a/x))<_i\llbracket T_2\rrbracket(\llbracket q(\sigma')\rrbracket(\rho',a'/x)) [ [ T 1 ] ] ( [ [ q ( σ ) ] ] ( ρ , a / x )) < i [ [ T 2 ] ] ( [ [ q ( σ ′ ) ] ] ( ρ ′ , a ′ / x ))
(part (3))
We now bridge the inner-evaluations of q ( σ ) q(\sigma) q ( σ ) and q ( σ ′ ) q(\sigma') q ( σ ′ ) to the desired environments. Using the lifted-substitution four-value pattern (instantiated at the identity weakening on Γ ′ , x : S 1 [ σ ] \Gamma',x:S_1[\sigma] Γ ′ , x : S 1 [ σ ] with ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) (\rho,a/x)\approx(\rho',a'/x) ( ρ , a / x ) ≈ ( ρ ′ , a ′ / x ) ):
⟦ q ( σ ) ⟧ ( ρ , a / x ) ≈ ( ρ σ , a / x ) ∈ R Γ , x : S 1 \llbracket q(\sigma)\rrbracket(\rho,a/x)\approx(\rho_\sigma,a/x)\in R_{\Gamma,x:S_1} [ [ q ( σ ) ] ] ( ρ , a / x ) ≈ ( ρ σ , a / x ) ∈ R Γ , x : S 1
(outer-LHS vs inner-LHS in the four-value pattern)
⟦ q ( σ ′ ) ⟧ ( ρ ′ , a ′ / x ) ≈ ( ρ σ ′ , a ′ / x ) ∈ R Γ , x : S 1 \llbracket q(\sigma')\rrbracket(\rho',a'/x)\approx(\rho_{\sigma'},a'/x)\in R_{\Gamma,x:S_1} [ [ q ( σ ′ ) ] ] ( ρ ′ , a ′ / x ) ≈ ( ρ σ ′ , a ′ / x ) ∈ R Γ , x : S 1
(outer-RHS vs inner-RHS, symmetrically)
By Theorem 6.38 on Γ , x : S 1 ⊢ T 1 ≈ T 1 : T y i \Gamma,x:S_1\vdash T_1\approx T_1:\mathsf{Ty}_i Γ , x : S 1 ⊢ T 1 ≈ T 1 : Ty i applied to the first relation, and on Γ , x : S 2 ⊢ T 2 ≈ T 2 : T y i \Gamma,x:S_2\vdash T_2\approx T_2:\mathsf{Ty}_i Γ , x : S 2 ⊢ T 2 ≈ T 2 : Ty i applied (after substituting S 1 S_1 S 1 for S 2 S_2 S 2 via the well-formedness premises) to the second:
⟦ T 1 ⟧ ( ⟦ q ( σ ) ⟧ ( ρ , a / x ) ) ≈ ⟦ T 1 ⟧ ( ρ σ , a / x ) ∈ U i \llbracket T_1\rrbracket(\llbracket q(\sigma)\rrbracket(\rho,a/x))\approx\llbracket T_1\rrbracket(\rho_\sigma,a/x)\in\mathcal{U}_i [ [ T 1 ] ] ( [ [ q ( σ ) ] ] ( ρ , a / x )) ≈ [ [ T 1 ] ] ( ρ σ , a / x ) ∈ U i
(by Theorem 6.38 on T 1 T_1 T 1 )
⟦ T 2 ⟧ ( ⟦ q ( σ ′ ) ⟧ ( ρ ′ , a ′ / x ) ) ≈ ⟦ T 2 ⟧ ( ρ σ ′ , a ′ / x ) ∈ U i \llbracket T_2\rrbracket(\llbracket q(\sigma')\rrbracket(\rho',a'/x))\approx\llbracket T_2\rrbracket(\rho_{\sigma'},a'/x)\in\mathcal{U}_i [ [ T 2 ] ] ( [ [ q ( σ ′ ) ] ] ( ρ ′ , a ′ / x )) ≈ [ [ T 2 ] ] ( ρ σ ′ , a ′ / x ) ∈ U i
(by Theorem 6.38 on T 2 T_2 T 2 ) By Theorem 6.15 applied to the codomain subtyping above and these two U i \mathcal{U}_i U i -equivalences:
⟦ T 1 ⟧ ( ρ σ , a / x ) < : i ⟦ T 2 ⟧ ( ρ σ ′ , a ′ / x ) \llbracket T_1\rrbracket(\rho_\sigma,a/x) <:_i \llbracket T_2\rrbracket(\rho_{\sigma'},a'/x) [ [ T 1 ] ] ( ρ σ , a / x ) < : i [ [ T 2 ] ] ( ρ σ ′ , a ′ / x )
(by Theorem 6.15)
(c) Self-relatedness. By Theorem 6.54 on Γ ⊢ S 1 ≈ S 1 : T y i \Gamma\vdash S_1 \approx S_1 : \mathrm{Ty}_i Γ ⊢ S 1 ≈ S 1 : Ty i and Γ , x : S 1 ⊢ T 1 ≈ T 1 : T y i \Gamma,x:S_1 \vdash T_1 \approx T_1 : \mathrm{Ty}_i Γ , x : S 1 ⊢ T 1 ≈ T 1 : Ty i instantiated at the same data, the inner-LHS-vs-inner-LHS leg of the resulting type-side four-value relation gives Π ( ⟦ S 1 ⟧ ( ρ σ ) , T 1 , ρ σ ) ≈ Π ( ⟦ S 1 ⟧ ( ρ σ ) , T 1 , ρ σ ) ∈ U i \Pi(\llbracket S_1\rrbracket(\rho_\sigma),T_1,\rho_\sigma) \approx\Pi(\llbracket S_1\rrbracket(\rho_\sigma),T_1,\rho_\sigma) \in\mathcal{U}_i Π ( [ [ S 1 ] ] ( ρ σ ) , T 1 , ρ σ ) ≈ Π ( [ [ S 1 ] ] ( ρ σ ) , T 1 , ρ σ ) ∈ U i . Symmetrically for S 2 , T 2 S_2,T_2 S 2 , T 2 : Π ( ⟦ S 2 ⟧ ( ρ σ ′ ) , T 2 , ρ σ ′ ) ≈ Π ( ⟦ S 2 ⟧ ( ρ σ ′ ) , T 2 , ρ σ ′ ) ∈ U i \Pi(\llbracket S_2\rrbracket(\rho_{\sigma'}),T_2,\rho_{\sigma'}) \approx\Pi(\llbracket S_2\rrbracket(\rho_{\sigma'}),T_2,\rho_{\sigma'}) \in\mathcal{U}_i Π ( [ [ S 2 ] ] ( ρ σ ′ ) , T 2 , ρ σ ′ ) ≈ Π ( [ [ S 2 ] ] ( ρ σ ′ ) , T 2 , ρ σ ′ ) ∈ U i .
Conclusion. By < : − Π <:\!-\Pi <: − Π with the four ingredients (a)–(c):
Π ( ⟦ S 1 ⟧ ( ρ σ ) , T 1 , ρ σ ) < : i Π ( ⟦ S 2 ⟧ ( ρ σ ′ ) , T 2 , ρ σ ′ ) \Pi(\llbracket S_1\rrbracket(\rho_\sigma),T_1,\rho_\sigma) <:_i \Pi(\llbracket S_2\rrbracket(\rho_{\sigma'}),T_2,\rho_{\sigma'}) Π ( [ [ S 1 ] ] ( ρ σ ) , T 1 , ρ σ ) < : i Π ( [ [ S 2 ] ] ( ρ σ ′ ) , T 2 , ρ σ ′ )
(part (3))
Lemma 6.71 (Fundamental — Sub-Trans). If Γ ⊢ S ⊆ T ′ \Gamma\vdash S \subseteq T' Γ ⊢ S ⊆ T ′ and Γ ⊢ T ′ ⊆ T \Gamma\vdash T' \subseteq T Γ ⊢ T ′ ⊆ T , then Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T .
Proof. Let Γ ′ \Gamma' Γ ′ with Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. Write ρ σ : = ⟦ σ ⟧ ( ρ ) \rho_\sigma:= \llbracket\sigma\rrbracket(\rho) ρ σ := [ [ σ ] ] ( ρ ) and ρ σ ′ : = ⟦ σ ′ ⟧ ( ρ ′ ) \rho_{\sigma'} := \llbracket\sigma'\rrbracket(\rho') ρ σ ′ := [ [ σ ′ ] ] ( ρ ′ ) . We must establish each clause of Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T .
Part (1). Instantiate the first hypothesis Γ ⊢ S ⊆ T ′ \Gamma\vdash S \subseteq T' Γ ⊢ S ⊆ T ′ at this data; its clause (1) gives the goal:
⟦ S [ σ ] ⟧ ( ρ ) ≈ ⟦ S ⟧ ( ρ σ ) ∈ U i \llbracket S[\sigma]\rrbracket(\rho) \approx\llbracket S\rrbracket(\rho_\sigma) \in\mathcal{U}_i [ [ S [ σ ] ] ] ( ρ ) ≈ [ [ S ] ] ( ρ σ ) ∈ U i (by clause (1) of Γ ⊢ S ⊆ T ′ \Gamma\vdash S \subseteq T' Γ ⊢ S ⊆ T ′ )
Part (2). Instantiate the second hypothesis Γ ⊢ T ′ ⊆ T \Gamma\vdash T' \subseteq T Γ ⊢ T ′ ⊆ T at the same data; its clause (2) gives the goal:
⟦ T ′ [ σ ′ ] ⟧ ( ρ ′ ) ≈ ⟦ T ′ ⟧ ( ρ σ ′ ) ∈ U i \llbracket T'[\sigma']\rrbracket(\rho') \approx\llbracket T'\rrbracket(\rho_{\sigma'}) \in\mathcal{U}_i [ [ T ′ [ σ ′ ] ] ] ( ρ ′ ) ≈ [ [ T ′ ] ] ( ρ σ ′ ) ∈ U i (by clause (2) of Γ ⊢ T ′ ⊆ T \Gamma\vdash T' \subseteq T Γ ⊢ T ′ ⊆ T )
Part (3). From the two hypotheses at the same data:
⟦ S ⟧ ( ρ σ ) < : i ⟦ T ′ ⟧ ( ρ σ ′ ) \llbracket S\rrbracket(\rho_\sigma) <:_i \llbracket T'\rrbracket(\rho_{\sigma'}) [ [ S ] ] ( ρ σ ) < : i [ [ T ′ ] ] ( ρ σ ′ ) (by clause (3) of Γ ⊢ S ⊆ T ′ \Gamma\vdash S \subseteq T' Γ ⊢ S ⊆ T ′ )
⟦ T ′ ⟧ ( ρ σ ′ ) < : i ⟦ T ⟧ ( ρ σ ′ ) \llbracket T'\rrbracket(\rho_{\sigma'}) <:_i \llbracket T\rrbracket(\rho_{\sigma'}) [ [ T ′ ] ] ( ρ σ ′ ) < : i [ [ T ] ] ( ρ σ ′ ) (by clause (3) of Γ ⊢ T ′ ⊆ T \Gamma\vdash T' \subseteq T Γ ⊢ T ′ ⊆ T )
⟦ S ⟧ ( ρ σ ) < : i ⟦ T ⟧ ( ρ σ ′ ) \llbracket S\rrbracket(\rho_\sigma) <:_i \llbracket T\rrbracket(\rho_{\sigma'}) [ [ S ] ] ( ρ σ ) < : i [ [ T ] ] ( ρ σ ′ ) (by transitivity of < : i <:\!_i <: i , Theorem 6.16)
All three clauses of Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T are now established.
Lemma 6.72 (Fundamental — Sub-Eq). If Γ ⊢ T ≈ T : T y i \Gamma\vdash T \approx T : \mathrm{Ty}_i Γ ⊢ T ≈ T : Ty i and Γ ⊢ S ≈ T : T y i \Gamma\vdash S \approx T : \mathrm{Ty}_i Γ ⊢ S ≈ T : Ty i , then Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T .
Proof. Let Γ ′ \Gamma' Γ ′ with Γ ′ ≈ Γ ′ ↘ R ′ \Gamma' \approx\Gamma' \searrow R' Γ ′ ≈ Γ ′ ↘ R ′ , Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , and D : : ρ ≈ ρ ′ ∈ R ′ \mathcal{D} :: \rho\approx\rho' \in R' D :: ρ ≈ ρ ′ ∈ R ′ be given. Write ρ σ : = ⟦ σ ⟧ ( ρ ) \rho_\sigma:= \llbracket\sigma\rrbracket(\rho) ρ σ := [ [ σ ] ] ( ρ ) and ρ σ ′ : = ⟦ σ ′ ⟧ ( ρ ′ ) \rho_{\sigma'} := \llbracket\sigma'\rrbracket(\rho') ρ σ ′ := [ [ σ ′ ] ] ( ρ ′ ) . We establish each clause of Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T .
Part (1). Instantiate the type-side four-value relation of Γ ⊢ S ≈ T : T y i \Gamma\vdash S \approx T : \mathrm{Ty}_i Γ ⊢ S ≈ T : Ty i at Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ and D \mathcal{D} D :
{ ⟦ S [ σ ] ⟧ ( ρ ) , ⟦ S ⟧ ( ρ σ ) , ⟦ T ⟧ ( ρ σ ′ ) , ⟦ T [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R T \{\llbracket S[\sigma]\rrbracket(\rho),\llbracket S\rrbracket(\rho_\sigma),\llbracket T\rrbracket(\rho_{\sigma'}),\llbracket T[\sigma']\rrbracket(\rho')\} \subseteq\mathcal{U}_i \searrow R_T { [ [ S [ σ ] ] ] ( ρ ) , [ [ S ] ] ( ρ σ ) , [ [ T ] ] ( ρ σ ′ ) , [ [ T [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R T (by hypothesis on S , T S,T S , T )
The outer-LHS-vs-inner-LHS leg gives ⟦ S [ σ ] ⟧ ( ρ ) ≈ ⟦ S ⟧ ( ρ σ ) ∈ U i \llbracket S[\sigma]\rrbracket(\rho) \approx\llbracket S\rrbracket(\rho_\sigma) \in\mathcal{U}_i [ [ S [ σ ] ] ] ( ρ ) ≈ [ [ S ] ] ( ρ σ ) ∈ U i , which is clause (1).
Part (2). Instantiate the type-side four-value relation of Γ ⊢ T ≈ T : T y i \Gamma\vdash T \approx T : \mathrm{Ty}_i Γ ⊢ T ≈ T : Ty i at the same data:
{ ⟦ T [ σ ] ⟧ ( ρ ) , ⟦ T ⟧ ( ρ σ ) , ⟦ T ⟧ ( ρ σ ′ ) , ⟦ T [ σ ′ ] ⟧ ( ρ ′ ) } ⊆ U i ↘ R T ′ \{\llbracket T[\sigma]\rrbracket(\rho),\llbracket T\rrbracket(\rho_\sigma),\llbracket T\rrbracket(\rho_{\sigma'}),\llbracket T[\sigma']\rrbracket(\rho')\} \subseteq\mathcal{U}_i \searrow R'_T { [ [ T [ σ ] ] ] ( ρ ) , [ [ T ] ] ( ρ σ ) , [ [ T ] ] ( ρ σ ′ ) , [ [ T [ σ ′ ] ] ] ( ρ ′ )} ⊆ U i ↘ R T ′ (by hypothesis on T , T T,T T , T )
The outer-RHS-vs-inner-RHS leg gives ⟦ T [ σ ′ ] ⟧ ( ρ ′ ) ≈ ⟦ T ⟧ ( ρ σ ′ ) ∈ U i \llbracket T[\sigma']\rrbracket(\rho') \approx\llbracket T\rrbracket(\rho_{\sigma'}) \in\mathcal{U}_i [ [ T [ σ ′ ] ] ] ( ρ ′ ) ≈ [ [ T ] ] ( ρ σ ′ ) ∈ U i , which is clause (2).
Part (3). From the four-value relation in part (1), the inner-LHS-vs-inner-RHS leg gives:
⟦ S ⟧ ( ρ σ ) ≈ ⟦ T ⟧ ( ρ σ ′ ) ∈ U i ↘ R T \llbracket S\rrbracket(\rho_\sigma) \approx\llbracket T\rrbracket(\rho_{\sigma'}) \in\mathcal{U}_i \searrow R_T [ [ S ] ] ( ρ σ ) ≈ [ [ T ] ] ( ρ σ ′ ) ∈ U i ↘ R T (inner-LHS vs inner-RHS in the four-value pattern)
By Theorem 6.17:
⟦ S ⟧ ( ρ σ ) < : i ⟦ T ⟧ ( ρ σ ′ ) \llbracket S\rrbracket(\rho_\sigma) <:_i \llbracket T\rrbracket(\rho_{\sigma'}) [ [ S ] ] ( ρ σ ) < : i [ [ T ] ] ( ρ σ ′ ) (by Theorem 6.17)
This is clause (3).
The Fundamental Theorem
The fundamental theorem assembles the semantic rules established in the preceding subsections into a single statement: every syntactically derivable judgment is validated by the PER model.
Theorem 6.73 (Fundamental Theorem). The following statements hold:
(1) If ⊢ Γ \vdash\Gamma ⊢ Γ , then ⊨ Γ \models\Gamma ⊨ Γ .
(2) If Γ ⊢ t : T \Gamma\vdash t : T Γ ⊢ t : T , then Γ ⊨ t ≈ t : T \Gamma\models t \approx t : T Γ ⊨ t ≈ t : T .
(3) If Γ ⊢ t ≈ t ′ : T \Gamma\vdash t \approx t' : T Γ ⊢ t ≈ t ′ : T , then Γ ⊨ t ≈ t ′ : T \Gamma\models t \approx t' : T Γ ⊨ t ≈ t ′ : T .
(4) If Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T , then Γ ⊨ S ⊆ T \Gamma\models S \subseteq T Γ ⊨ S ⊆ T .
Proof. By mutual induction on the syntactic derivations. Each rule’s case follows by applying the corresponding semantic rule lemma (Sec. 6.13 to 6.15 and 6.17 to 6.19) to the IHs on the rule’s premises. □
Completeness
We can now state and prove the completeness theorem for normalization by evaluation.
Theorem 6.74 (Completeness of NbE). If Γ ⊢ s ≈ t : T \Gamma\vdash s \approx t : T Γ ⊢ s ≈ t : T , then nbe Γ T ( s ) = nbe Γ T ( t ) \operatorname{nbe}_{\Gamma}^{T}(s) = \operatorname{nbe}_{\Gamma}^{T}(t) nbe Γ T ( s ) = nbe Γ T ( t ) . That is, judgmentally equal terms have the same normal form.
Proof. By the fundamental theorem (Theorem 6.73, statement (3)): Γ ⊨ s ≈ t : T \Gamma\models s \approx t : T Γ ⊨ s ≈ t : T . Unfolding, this means: for all Γ ′ ≈ Γ ↘ R ′ \Gamma' \approx\Gamma\searrow R' Γ ′ ≈ Γ ↘ R ′ , all Γ ′ ⊢ σ ≈ σ ′ : Γ \Gamma' \vdash\sigma\approx\sigma' : \Gamma Γ ′ ⊢ σ ≈ σ ′ : Γ , all ρ ≈ ρ ′ ∈ R ′ \rho\approx\rho' \in R' ρ ≈ ρ ′ ∈ R ′ , the evaluations of s s s and t t t are related in the appropriate PER.
We instantiate at:
Γ ′ : = Γ \Gamma' := \Gamma Γ ′ := Γ (by statement (1), Γ ≈ Γ ↘ R \Gamma\approx\Gamma\searrow R Γ ≈ Γ ↘ R for some R R R ),
σ : = σ ′ : = id \sigma:= \sigma' := \operatorname{id} σ := σ ′ := id (the identity substitution is semantic by Theorem 6.36),
ρ : = ρ ′ : = ↑ Γ \rho:= \rho' := \uparrow^\Gamma ρ := ρ ′ := ↑ Γ (the initial environment is in R R R by Theorem 6.25).
Since s [ id ] = s s[\operatorname{id}] = s s [ id ] = s and t [ id ] = t t[\operatorname{id}] = t t [ id ] = t , and ⟦ id ⟧ ( ρ ) = ρ \llbracket\operatorname{id}\rrbracket(\rho) = \rho [ [ id ] ] ( ρ ) = ρ , we obtain:
⟦ T ⟧ ( ↑ Γ ) ≈ ⟦ T ⟧ ( ↑ Γ ) ∈ U i ↘ R T \llbracket T\rrbracket(\uparrow^\Gamma) \approx\llbracket T\rrbracket(\uparrow^\Gamma) \in U_i \searrow R_T [ [ T ] ] ( ↑ Γ ) ≈ [ [ T ] ] ( ↑ Γ ) ∈ U i ↘ R T
(type part, with LHS = RHS since σ = σ ′ \sigma= \sigma' σ = σ ′ and ρ = ρ ′ \rho= \rho' ρ = ρ ′ )
⟦ s ⟧ ( ↑ Γ ) ≈ ⟦ t ⟧ ( ↑ Γ ) ∈ R T \llbracket s\rrbracket(\uparrow^\Gamma) \approx\llbracket t\rrbracket(\uparrow^\Gamma) \in R_T [ [ s ] ] ( ↑ Γ ) ≈ [ [ t ] ] ( ↑ Γ ) ∈ R T
(term part)
Let A = ⟦ T ⟧ ( ↑ Γ ) A = \llbracket T\rrbracket(\uparrow^\Gamma) A = [ [ T ] ] ( ↑ Γ ) , a = ⟦ s ⟧ ( ↑ Γ ) a = \llbracket s\rrbracket(\uparrow^\Gamma) a = [ [ s ] ] ( ↑ Γ ) , and b = ⟦ t ⟧ ( ↑ Γ ) b = \llbracket t\rrbracket(\uparrow^\Gamma) b = [ [ t ] ] ( ↑ Γ ) . Then A ≈ A ∈ U i ↘ R T A \approx A \in U_i \searrow R_T A ≈ A ∈ U i ↘ R T and a ≈ b ∈ R T a \approx b \in R_T a ≈ b ∈ R T .
By realizability (Item 1): ⇓ A ( a ) ≈ ⇓ A ( b ) ∈ N f \Downarrow^A(a) \approx\Downarrow^A(b) \in\mathrm{Nf} ⇓ A ( a ) ≈ ⇓ A ( b ) ∈ Nf . Unfolding the definition of N f \mathrm{Nf} Nf : for all n n n , there exists w w w such that R n N f ( ⇓ A ( a ) ) ↘ w R_n^{\mathrm{Nf}}(\Downarrow^A(a)) \searrow w R n Nf ( ⇓ A ( a )) ↘ w and R n N f ( ⇓ A ( b ) ) ↘ w R_n^{\mathrm{Nf}}(\Downarrow^A(b)) \searrow w R n Nf ( ⇓ A ( b )) ↘ w .
Taking n = ∣ Γ ∣ n = |\Gamma| n = ∣Γ∣ (the length of Γ \Gamma Γ , which provides enough fresh names):
nbe Γ T ( s ) = R ∣ Γ ∣ N f ( ⇓ ⟦ T ⟧ ( ↑ Γ ) ( ⟦ s ⟧ ( ↑ Γ ) ) ) = R ∣ Γ ∣ N f ( ⇓ A ( a ) ) ↘ w \operatorname{nbe}_{\Gamma}^{T}(s) = R_{|\Gamma|}^{\mathrm{Nf}}\bigl(\Downarrow^{\llbracket T\rrbracket(\uparrow^\Gamma)}(\llbracket s\rrbracket(\uparrow^\Gamma))\bigr) = R_{|\Gamma|}^{\mathrm{Nf}}\bigl(\Downarrow^A(a)\bigr) \searrow w nbe Γ T ( s ) = R ∣Γ∣ Nf ( ⇓ [ [ T ] ] ( ↑ Γ ) ( [ [ s ] ] ( ↑ Γ )) ) = R ∣Γ∣ Nf ( ⇓ A ( a ) ) ↘ w
nbe Γ T ( t ) = R ∣ Γ ∣ N f ( ⇓ ⟦ T ⟧ ( ↑ Γ ) ( ⟦ t ⟧ ( ↑ Γ ) ) ) = R ∣ Γ ∣ N f ( ⇓ A ( b ) ) ↘ w \operatorname{nbe}_{\Gamma}^{T}(t) = R_{|\Gamma|}^{\mathrm{Nf}}\bigl(\Downarrow^{\llbracket T\rrbracket(\uparrow^\Gamma)}(\llbracket t\rrbracket(\uparrow^\Gamma))\bigr) = R_{|\Gamma|}^{\mathrm{Nf}}\bigl(\Downarrow^A(b)\bigr) \searrow w nbe Γ T ( t ) = R ∣Γ∣ Nf ( ⇓ [ [ T ] ] ( ↑ Γ ) ( [ [ t ] ] ( ↑ Γ )) ) = R ∣Γ∣ Nf ( ⇓ A ( b ) ) ↘ w
Hence nbe Γ T ( s ) = w = nbe Γ T ( t ) \operatorname{nbe}_{\Gamma}^{T}(s) = w = \operatorname{nbe}_{\Gamma}^{T}(t) nbe Γ T ( s ) = w = nbe Γ T ( t ) . □
Soundness
In this section we establish the soundness of normalization by evaluation: every well-typed term has a normal form, and that normal form is judgmentally equal to the original term. Concretely, if Γ ⊢ t : T \Gamma\vdash t : T Γ ⊢ t : T then there exists a term v v v such that nbe produces v v v from t t t and Γ ⊢ t ≈ v : T \Gamma\vdash t \approx v : T Γ ⊢ t ≈ v : T .
The proof proceeds via a Kripke gluing model — a unary inductive predicate connecting syntactic types and terms with their semantic (domain) interpretations. Unlike the PER model of Sec. 6 which is a binary relation on domain values, the gluing model is a unary predicate that simultaneously constrains a syntactic entity and a domain value, ensuring coherence between the two. The “Kripke” qualifier refers to the stability of the predicate under Kripke weakenings, a sub-class of the syntactic weakenings restricted to compositions of the shift ⇑ \Uparrow ⇑ .
Kripke Weakenings
Unlike Sec. 2’s general weakenings (which include lifting q ( ϕ ) q(\phi) q ( ϕ ) under binders), the gluing predicates of this section quantify over a stricter sub-class.
Definition 7.1 (Kripke weakening). The judgment Γ ⊢ k ϕ : Δ \Gamma\vdash_k \phi: \Delta Γ ⊢ k ϕ : Δ states that ϕ \phi ϕ is a Kripke weakening from Δ \Delta Δ to Γ \Gamma Γ (i.e. ϕ \phi ϕ extends Δ \Delta Δ to Γ \Gamma Γ by appending entries on the left). It is defined inductively:
KW-Id Γ ⊢ i d : Γ KW-Shift Γ ⊢ k ϕ : Δ Γ ⊢ S : T y i Γ , x : S ⊢ k ϕ ∘ ⇑ : Δ \begin{aligned}
&\text{KW-Id} && \Gamma\vdash\mathrm{id} : \Gamma\\
&\text{KW-Shift} && \Gamma\vdash_k \phi: \Delta\qquad\Gamma\vdash S : \mathrm{Ty}_i \\
&&& \Gamma, x : S \vdash_k \phi\circ\Uparrow: \Delta
\end{aligned} KW-Id KW-Shift Γ ⊢ id : Γ Γ ⊢ k ϕ : Δ Γ ⊢ S : Ty i Γ , x : S ⊢ k ϕ ∘ ⇑: Δ
Equivalently, every Kripke weakening is a finite composition ⇑ ∘ ⋯ ∘ ⇑ \Uparrow\circ\cdots\circ\Uparrow ⇑ ∘ ⋯ ∘ ⇑ of ⇑ \Uparrow ⇑ ’s (with i d \mathrm{id} id as the empty composition); no q ( ϕ ) q(\phi) q ( ϕ ) lifting is permitted.
Lemma 7.2 (Kripke weakenings are weakenings). If Γ ⊢ k ϕ : Δ \Gamma\vdash_k \phi: \Delta Γ ⊢ k ϕ : Δ , then Γ ⊢ w ϕ : Δ \Gamma\vdash_w \phi: \Delta Γ ⊢ w ϕ : Δ .
Proof. By induction on Γ ⊢ k ϕ : Δ \Gamma\vdash_k \phi: \Delta Γ ⊢ k ϕ : Δ .
KW-Id : Γ ⊢ w i d : Γ (by Theorem 3.3) KW-Shift : Γ ⊢ w ϕ : Δ (IH) Γ , x : S ⊢ w ⇑ : Γ (by Theorem 3.4) Γ , x : S ⊢ w ϕ ∘ ⇑ : Δ (by Theorem 3.6) \begin{aligned}
\text{KW-Id} &: \Gamma\vdash_w \mathrm{id} : \Gamma&& \text{(by Theorem 3.3)}\\
\text{KW-Shift} &: \Gamma\vdash_w \phi: \Delta&& \text{(IH)}\\
&\Gamma, x : S \vdash_w \Uparrow: \Gamma&& \text{(by Theorem 3.4)}\\
&\Gamma, x : S \vdash_w \phi\circ\Uparrow: \Delta&& \text{(by Theorem 3.6)}
\end{aligned} KW-Id KW-Shift : Γ ⊢ w id : Γ : Γ ⊢ w ϕ : Δ Γ , x : S ⊢ w ⇑: Γ Γ , x : S ⊢ w ϕ ∘ ⇑: Δ (by Theorem 3.3) (IH) (by Theorem 3.4) (by Theorem 3.6)
Lemma 7.3 (Composition of Kripke weakenings). If Γ ⊢ k ψ : Δ \Gamma\vdash_k \psi: \Delta Γ ⊢ k ψ : Δ and Δ ′ ⊢ k ϕ : Γ \Delta' \vdash_k \phi: \Gamma Δ ′ ⊢ k ϕ : Γ , then Δ ′ ⊢ k ψ ∘ ϕ : Δ \Delta' \vdash_k \psi\circ\phi: \Delta Δ ′ ⊢ k ψ ∘ ϕ : Δ .
Proof. By induction on Δ ′ ⊢ k ϕ : Γ \Delta' \vdash_k \phi: \Gamma Δ ′ ⊢ k ϕ : Γ .
KW-Id ( ϕ = i d ) : ψ ∘ i d = ψ (by left-id of ∘ ) Δ ′ ⊢ k ψ : Δ (by hypothesis) KW-Shift ( ϕ = ϕ 0 ∘ ⇑ , Δ ′ = Δ 0 , x : S ) : Δ 0 ⊢ k ψ ∘ ϕ 0 : Δ (by IH on ϕ 0 ) Δ 0 , x : S ⊢ k ( ψ ∘ ϕ 0 ) ∘ ⇑ : Δ (by KW-Shift) ψ ∘ ( ϕ 0 ∘ ⇑ ) = ( ψ ∘ ϕ 0 ) ∘ ⇑ (by associativity of ∘ ) Δ ′ ⊢ k ψ ∘ ϕ : Δ (by the above) \begin{aligned}
\text{KW-Id }(\phi= \mathrm{id}) &: \psi\circ\mathrm{id} = \psi&& \text{(by left-id of }\circ\text{)}\\
&\Delta' \vdash_k \psi: \Delta&& \text{(by hypothesis)}\\
\text{KW-Shift }(\phi= \phi_0 \circ\Uparrow,\ \Delta' = \Delta_0, x : S) &: \\
&\Delta_0 \vdash_k \psi\circ\phi_0 : \Delta&& \text{(by IH on }\phi_0\text{)}\\
&\Delta_0, x : S \vdash_k (\psi\circ\phi_0) \circ\Uparrow: \Delta&& \text{(by KW-Shift)}\\
&\psi\circ(\phi_0 \circ\Uparrow) = (\psi\circ\phi_0) \circ\Uparrow&& \text{(by associativity of }\circ\text{)}\\
&\Delta' \vdash_k \psi\circ\phi: \Delta&& \text{(by the above)}
\end{aligned} KW-Id ( ϕ = id ) KW-Shift ( ϕ = ϕ 0 ∘ ⇑ , Δ ′ = Δ 0 , x : S ) : ψ ∘ id = ψ Δ ′ ⊢ k ψ : Δ : Δ 0 ⊢ k ψ ∘ ϕ 0 : Δ Δ 0 , x : S ⊢ k ( ψ ∘ ϕ 0 ) ∘ ⇑: Δ ψ ∘ ( ϕ 0 ∘ ⇑ ) = ( ψ ∘ ϕ 0 ) ∘ ⇑ Δ ′ ⊢ k ψ ∘ ϕ : Δ (by left-id of ∘ ) (by hypothesis) (by IH on ϕ 0 ) (by KW-Shift) (by associativity of ∘ ) (by the above)
The Type Gluing Model U i ∗ U_i^* U i ∗
The type gluing model is a unary inductive relation on domain values. Given a domain value a ∈ D a \in D a ∈ D that represents a type at level i i i , the judgment
a ∈ U i ∗ ↘ P ↘ E l a \in U_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El
asserts that a a a is a well-behaved type value, returning two predicates:
Definition 7.4 (Type Gluing Model U i ∗ U_i^* U i ∗ ). The relation a ∈ U i ∗ ↘ P ↘ E l a \in U_i^* \searrow P \searrow\mathbf{El} a ∈ U i ∗ ↘ P ↘ El is defined inductively by:
↑ A ( e ) ∈ D P ⇔ N e u i e E l ⇔ N e u i e ↑ A ( e ) ∈ U i ∗ ↘ P ↘ E l \frac{\mathord{\uparrow}^{\mathsf{A}}(e) \in D \qquad P \Leftrightarrow\mathsf{Neu}_i^e \qquad\mathbf{El} \Leftrightarrow\mathsf{Neu}_i^e}{\mathord{\uparrow}^{\mathsf{A}}(e) \in U_i^* \searrow P \searrow\mathbf{El}} ↑ A ( e ) ∈ U i ∗ ↘ P ↘ El ↑ A ( e ) ∈ D P ⇔ Neu i e El ⇔ Neu i e
P ⇔ N a t i E l ⇔ N a t i N ∈ U i ∗ ↘ P ↘ E l \frac{P \Leftrightarrow\mathsf{Nat}_i \qquad\mathbf{El} \Leftrightarrow\mathsf{Nat}_i}{N \in U_i^* \searrow P \searrow\mathbf{El}} N ∈ U i ∗ ↘ P ↘ El P ⇔ Nat i El ⇔ Nat i
j < i P ⇔ U n i v i , j E l ⇔ U n i v i , j E l U j ∈ U i ∗ ↘ P ↘ E l \frac{j < i \qquad P \Leftrightarrow\mathsf{Univ}_{i,j} \qquad\mathbf{El} \Leftrightarrow\mathsf{Univ}^{\mathbf{El}}_{i,j}}{U_j \in U_i^* \searrow P \searrow\mathbf{El}} U j ∈ U i ∗ ↘ P ↘ El j < i P ⇔ Univ i , j El ⇔ Univ i , j El
a ∈ U i ∗ ↘ P I ↘ E l I a ≈ a ∈ U i ↘ R I ∀ D : : b ≈ b ∈ R I , c . ⟦ T ⟧ ( ρ , b / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R P ⇔ Π i ( R I , P I , E l I , P O ) E l ⇔ Π i E l ( R , R I , P I , E l I , E l O ) Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ E l \frac{
\begin{gathered}
a \in U_i^* \searrow P_I \searrow\mathbf{El}_I
\qquad
a \approx a \in U_i \searrow R_I\\
\forall D :: b \approx b \in R_I,\ c.\ \llbracket T \rrbracket(\rho,b/x) \searrow c
\Longrightarrow c \in U_i^* \searrow P_O(D) \searrow\mathbf{El}_O(D)\\
\Pi(a,T,\rho) \approx\Pi(a,T,\rho) \in U_i \searrow R\\
P \Leftrightarrow\Pi_i(R_I,P_I,\mathbf{El}_I,P_O)
\qquad
\mathbf{El} \Leftrightarrow\Pi_i^{\mathbf{El}}(R,R_I,P_I,\mathbf{El}_I,\mathbf{El}_O)
\end{gathered}
}{
\Pi(a,T,\rho) \in U_i^* \searrow P \searrow\mathbf{El}
} Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ El a ∈ U i ∗ ↘ P I ↘ El I a ≈ a ∈ U i ↘ R I ∀ D :: b ≈ b ∈ R I , c . [ [ T ] ] ( ρ , b / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R P ⇔ Π i ( R I , P I , El I , P O ) El ⇔ Π i El ( R , R I , P I , El I , El O )
Concrete Predicates
We now define the concrete predicates used by U i ∗ U_i^* U i ∗ . All Kripke conditions quantify over Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ rather than arbitrary Δ ⊢ w ϕ : Γ \Delta\vdash_w \phi: \Gamma Δ ⊢ w ϕ : Γ .
Definition 7.5 (Neutral Type Predicate N e u i e \mathsf{Neu}_i^e Neu i e ). The judgment Γ ⊢ S : T y i R ∘ N e u i e \Gamma\vdash S : \mathsf{Ty}_i \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} \mathsf{Neu}_i^e Γ ⊢ S : Ty i R ∘ Neu i e holds when:
(1) Γ ⊢ S : T y i \Gamma\vdash S : \mathsf{Ty}_i Γ ⊢ S : Ty i , and
(2) for all Δ , ϕ \Delta,\phi Δ , ϕ with Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , there exists u u u with R ∣ Δ ∣ N e ( e ) ↘ u R^{\mathsf{Ne}}_{|\Delta|}(e) \searrow u R ∣Δ∣ Ne ( e ) ↘ u and Δ ⊢ S [ ϕ ] ≈ u : T y i \Delta\vdash S[\phi] \approx u : \mathsf{Ty}_i Δ ⊢ S [ ϕ ] ≈ u : Ty i .
Definition 7.6 (Neutral Term Predicate N e u i e \mathsf{Neu}_i^e Neu i e ). The judgment Γ ⊢ t : S R ∘ ↑ A ( w ) ∈ N e u i e \Gamma\vdash t : S \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} \mathord{\uparrow}^{\mathsf{A}}(w) \in\mathsf{Neu}_i^e Γ ⊢ t : S R ∘ ↑ A ( w ) ∈ Neu i e holds when:
(1) Γ ⊢ S : T y i R ∘ N e u i e \Gamma\vdash S : \mathsf{Ty}_i \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} \mathsf{Neu}_i^e Γ ⊢ S : Ty i R ∘ Neu i e ,
(2) Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S ,
(3) w ≈ w ∈ N e w \approx w \in\mathsf{Ne} w ≈ w ∈ Ne , and
(4) for all Δ , ϕ \Delta,\phi Δ , ϕ with Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , there exists u u u with R ∣ Δ ∣ N e ( w ) ↘ u R^{\mathsf{Ne}}_{|\Delta|}(w) \searrow u R ∣Δ∣ Ne ( w ) ↘ u and Δ ⊢ t [ ϕ ] ≈ u : S [ ϕ ] \Delta\vdash t[\phi] \approx u : S[\phi] Δ ⊢ t [ ϕ ] ≈ u : S [ ϕ ] .
Definition 7.7 (Natural Number Type Predicate N a t i \mathsf{Nat}_i Nat i ). Γ ⊢ S : T y i R ∘ N a t i \Gamma\vdash S : \mathsf{Ty}_i \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} \mathsf{Nat}_i Γ ⊢ S : Ty i R ∘ Nat i holds when Γ ⊢ S ≈ N a t : T y i \Gamma\vdash S \approx\mathsf{Nat} : \mathsf{Ty}_i Γ ⊢ S ≈ Nat : Ty i .
Definition 7.8 (Natural Number Term Predicate N a t i \mathsf{Nat}_i Nat i ). The judgment Γ ⊢ t : S R ∘ b ∈ N a t i \Gamma\vdash t : S \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} b \in\mathsf{Nat}_i Γ ⊢ t : S R ∘ b ∈ Nat i holds when Γ ⊢ S : T y i R ∘ N a t i \Gamma\vdash S : \mathsf{Ty}_i \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} \mathsf{Nat}_i Γ ⊢ S : Ty i R ∘ Nat i and Γ ⊢ t : S R ∘ b ∈ N a t \Gamma\vdash t : S \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} b \in\mathsf{Nat} Γ ⊢ t : S R ∘ b ∈ Nat , where the latter is defined by:
Γ ⊢ t ≈ z e r o : S Γ ⊢ t : S R ∘ z e ∈ N a t \frac{\Gamma\vdash t \approx\mathsf{zero} : S}{\Gamma\vdash t : S \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} \mathsf{ze} \in\mathsf{Nat}} Γ ⊢ t : S R ∘ ze ∈ Nat Γ ⊢ t ≈ zero : S
Γ ⊢ t ′ : S R ∘ b ′ ∈ N a t Γ ⊢ t ≈ s u c c t ′ : S Γ ⊢ t : S R ∘ s u ( b ′ ) ∈ N a t \frac{\Gamma\vdash t' : S \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} b' \in\mathsf{Nat}
\qquad
\Gamma\vdash t \approx\mathsf{succ}\ t' : S}
{\Gamma\vdash t : S \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} \mathsf{su}(b') \in\mathsf{Nat}} Γ ⊢ t : S R ∘ su ( b ′ ) ∈ Nat Γ ⊢ t ′ : S R ∘ b ′ ∈ Nat Γ ⊢ t ≈ succ t ′ : S
Γ ⊢ t : S R ∘ ↑ N ( w ) ∈ N e u i e Γ ⊢ t : S R ∘ ↑ N ( w ) ∈ N a t \frac{\Gamma\vdash t : S \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} \mathord{\uparrow}^{\mathsf{N}}(w) \in\mathsf{Neu}_i^e}
{\Gamma\vdash t : S \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} \mathord{\uparrow}^{\mathsf{N}}(w) \in\mathsf{Nat}} Γ ⊢ t : S R ∘ ↑ N ( w ) ∈ Nat Γ ⊢ t : S R ∘ ↑ N ( w ) ∈ Neu i e
Definition 7.9 (Pi Type Predicate Π i ( R I , P I , E l I , P O ) \Pi_i(R_I,P_I,\mathbf{El}_I,P_O) Π i ( R I , P I , El I , P O ) ). Γ ⊢ S : T y i R ∘ Π i ( R I , P I , E l I , P O ) \Gamma\vdash S : \mathsf{Ty}_i \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} \Pi_i(R_I,P_I,\mathbf{El}_I,P_O) Γ ⊢ S : Ty i R ∘ Π i ( R I , P I , El I , P O ) holds when:
(1) There exist S 1 , S 2 S_1,S_2 S 1 , S 2 with Γ ⊢ S ≈ Π ( x : S 1 ) . S 2 : T y i \Gamma\vdash S \approx\Pi(x:S_1).S_2 : \mathsf{Ty}_i Γ ⊢ S ≈ Π ( x : S 1 ) . S 2 : Ty i .
(2) For all Δ , ϕ \Delta,\phi Δ , ϕ with Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ : Δ ⊢ S 1 [ ϕ ] : T y i R ∘ P I \Delta\vdash S_1[\phi] : \mathsf{Ty}_i \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} P_I Δ ⊢ S 1 [ ϕ ] : Ty i R ∘ P I .
(3) For all Δ , ϕ \Delta,\phi Δ , ϕ with Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , and all s , b s,b s , b with Δ ⊢ s : S 1 [ ϕ ] R ∘ b ∈ E l I \Delta\vdash s : S_1[\phi] \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} b \in\mathbf{El}_I Δ ⊢ s : S 1 [ ϕ ] R ∘ b ∈ El I , and all D : : b ≈ b ∈ R I D :: b \approx b \in R_I D :: b ≈ b ∈ R I : Δ ⊢ S 2 [ ι ( ϕ ) , s / x ] : T y i R ∘ P O ( D ) \Delta\vdash S_2[\iota(\phi),s/x] : \mathsf{Ty}_i \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} P_O(D) Δ ⊢ S 2 [ ι ( ϕ ) , s / x ] : Ty i R ∘ P O ( D ) .
Definition 7.10 (Pi Term Predicate Π i E l \Pi_i^{\mathbf{El}} Π i El ). Γ ⊢ t : S R ∘ f ∈ Π i E l ( R , R I , P I , E l I , E l O ) \Gamma\vdash t : S \mathrel{\mathop{\mathsf{R}}\limits^{\mathord{\circ}}} f \in\Pi_i^{\mathbf{El}}(R,R_I,P_I,\mathbf{El}_I,\mathbf{El}_O) Γ ⊢ t : S R ∘ f ∈ Π i El ( R , R I , P I , El I , El O ) holds when: (1) Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S .
(2) f ≈ f ∈ R f \approx f \in R f ≈ f ∈ R .
(3) Γ ⊢ S : T y i ® Π i ( R I , P I , E l I , P O ) \Gamma\vdash S : \mathrm{Ty}_i \circledR\Pi_i(R_I, P_I, \mathrm{El}_I, P_O) Γ ⊢ S : Ty i ® Π i ( R I , P I , El I , P O ) .
(4) For all Δ , ϕ \Delta, \phi Δ , ϕ with Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , and all s , b s, b s , b with Δ ⊢ s : S 1 [ ϕ ] ® b ∈ E l I \Delta\vdash s : S_1[\phi] \circledR b \in\mathrm{El}_I Δ ⊢ s : S 1 [ ϕ ] ® b ∈ El I , and all D : b ≈ b ∈ R I \mathcal{D} : b \approx b \in R_I D : b ≈ b ∈ R I : there exists c c c with f ⋅ b ↘ c f \cdot b \searrow c f ⋅ b ↘ c and Δ ⊢ ( t [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ E l O ( D ) \Delta\vdash(t[\phi])\,s : S_2[\iota(\phi),s/x] \circledR c \in\mathrm{El}_O(\mathcal{D}) Δ ⊢ ( t [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ El O ( D ) .
Definition 7.11 (Universe Type Predicate U n i v i , j \mathrm{Univ}_{i,j} Univ i , j ). Γ ⊢ S : T y i ® U n i v i , j \Gamma\vdash S : \mathrm{Ty}_i \circledR\mathrm{Univ}_{i,j} Γ ⊢ S : Ty i ® Univ i , j holds when Γ ⊢ S ≈ T y j : T y i \Gamma\vdash S \approx\mathrm{Ty}_j : \mathrm{Ty}_i Γ ⊢ S ≈ Ty j : Ty i .
Definition 7.12 (Universe Term Predicate U n i v E l i , j \mathrm{UnivEl}_{i,j} UnivEl i , j ). Γ ⊢ t : S ® b ∈ U n i v E l i , j \Gamma\vdash t : S \circledR b \in\mathrm{UnivEl}_{i,j} Γ ⊢ t : S ® b ∈ UnivEl i , j holds when:
(1) Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S ,
(2) Γ ⊢ S ≈ T y j : T y i \Gamma\vdash S \approx\mathrm{Ty}_j : \mathrm{Ty}_i Γ ⊢ S ≈ Ty j : Ty i , and
(3) there exist P b , E l b P_b,\mathrm{El}_b P b , El b with b ∈ U j ∗ ↘ P b ↘ E l b b \in U_j^* \searrow P_b \searrow\mathrm{El}_b b ∈ U j ∗ ↘ P b ↘ El b and Γ ⊢ t : T y j ® P b \Gamma\vdash t : \mathrm{Ty}_j \circledR P_b Γ ⊢ t : Ty j ® P b (the term t t t , viewed as a type at T y j \mathrm{Ty}_j Ty j via Russell, glues to P b P_b P b ).
Definition 7.13 (Normal Form Predicate N f i a \mathrm{Nf}_i^a Nf i a ). Γ ⊢ t : S ® b ∈ N f i a \Gamma\vdash t : S \circledR b \in\mathrm{Nf}_i^a Γ ⊢ t : S ® b ∈ Nf i a holds when:
(1) Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S ,
(2) ↓ a ( b ) ≈ ↓ a ( b ) ∈ N f \downarrow^a(b) \approx\downarrow^a(b) \in\mathrm{Nf} ↓ a ( b ) ≈ ↓ a ( b ) ∈ Nf , and
(3) for all Δ , ϕ \Delta,\phi Δ , ϕ with Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , there exists w w w with R ∣ Δ ∣ N f ( ↓ a ( b ) ) ↘ w R_{\lvert\Delta\rvert}^{\mathrm{Nf}}(\downarrow^a(b)) \searrow w R ∣ Δ ∣ Nf ( ↓ a ( b )) ↘ w and Δ ⊢ t [ ϕ ] ≈ w : S [ ϕ ] \Delta\vdash t[\phi] \approx w : S[\phi] Δ ⊢ t [ ϕ ] ≈ w : S [ ϕ ] .
Definition 7.14 (Neutral Predicate N e i a \mathrm{Ne}_i^a Ne i a ). Γ ⊢ t : S ® w ∈ N e i a \Gamma\vdash t : S \circledR w \in\mathrm{Ne}_i^a Γ ⊢ t : S ® w ∈ Ne i a holds when:
(1) Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S ,
(2) w ≈ w ∈ N e w \approx w \in\mathrm{Ne} w ≈ w ∈ Ne , and
(3) for all Δ , ϕ \Delta,\phi Δ , ϕ with Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , there exists u u u with R ∣ Δ ∣ N e ( w ) ↘ u R_{\lvert\Delta\rvert}^{\mathrm{Ne}}(w) \searrow u R ∣ Δ ∣ Ne ( w ) ↘ u and Δ ⊢ t [ ϕ ] ≈ u : S [ ϕ ] \Delta\vdash t[\phi] \approx u : S[\phi] Δ ⊢ t [ ϕ ] ≈ u : S [ ϕ ] .
Definition 7.15 (Wrapped predicates B o t i a \mathrm{Bot}_i^a Bot i a and T o p i a \mathrm{Top}_i^a Top i a ). The wrappers package gluing-side data with a uniform interface, parameterized by a domain value a ∈ U i ∗ a \in U_i^* a ∈ U i ∗ . The judgment form distinguishes type-level from term-level use.
(1) (Term-bottom) Γ ⊢ t : S ® w ∈ B o t i a \Gamma\vdash t : S \circledR w \in\mathrm{Bot}_i^a Γ ⊢ t : S ® w ∈ Bot i a holds when there exist P , E l P,\mathrm{El} P , El with a ∈ U i ∗ ↘ P ↘ E l a \in U_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El and:
(a) Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S ,
(b) Γ ⊢ S : T y i ® P \Gamma\vdash S : \mathrm{Ty}_i \circledR P Γ ⊢ S : Ty i ® P , and
(c) Γ ⊢ t : S ® w ∈ N e i a \Gamma\vdash t : S \circledR w \in\mathrm{Ne}_i^a Γ ⊢ t : S ® w ∈ Ne i a .
(2) (Type-top) Γ ⊢ S : T y i ® T o p i a \Gamma\vdash S : \mathrm{Ty}_i \circledR\mathrm{Top}_i^a Γ ⊢ S : Ty i ® Top i a holds when:
(a) Γ ⊢ S : T y i \Gamma\vdash S : \mathrm{Ty}_i Γ ⊢ S : Ty i ,
(b) a ≈ a ∈ U i ↘ R a \approx a \in U_i \searrow R a ≈ a ∈ U i ↘ R for some R R R , and
(c) for all Δ , ϕ \Delta,\phi Δ , ϕ with Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , there exists W W W with R ∣ Δ ∣ T y ( a ) ↘ W R_{\lvert\Delta\rvert}^{\mathrm{Ty}}(a) \searrow W R ∣ Δ ∣ Ty ( a ) ↘ W and Δ ⊢ S [ ϕ ] ≈ W : T y i \Delta\vdash S[\phi] \approx W : \mathrm{Ty}_i Δ ⊢ S [ ϕ ] ≈ W : Ty i .
(3) (Term-top) Γ ⊢ t : S ® b ∈ T o p i a \Gamma\vdash t : S \circledR b \in\mathrm{Top}_i^a Γ ⊢ t : S ® b ∈ Top i a holds when there exist P , E l P,\mathrm{El} P , El with a ∈ U i ∗ ↘ P ↘ E l a \in U_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El and:
(a) Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S ,
(b) Γ ⊢ S : T y i ® P \Gamma\vdash S : \mathrm{Ty}_i \circledR P Γ ⊢ S : Ty i ® P , and
(c) Γ ⊢ t : S ® b ∈ N f i a \Gamma\vdash t : S \circledR b \in\mathrm{Nf}_i^a Γ ⊢ t : S ® b ∈ Nf i a .
Context Gluing Model
Definition 7.16 (Context Gluing). Given a well-formed context Γ \Gamma Γ , the judgment Γ ↘ S b \Gamma\searrow\mathsf{Sb} Γ ↘ Sb defines a predicate S b \mathsf{Sb} Sb on substitution–environment pairs Δ ⊢ σ : Γ ® ρ ∈ S b \Delta\vdash\sigma: \Gamma\mathbin{\circledR} \rho\in\mathsf{Sb} Δ ⊢ σ : Γ ® ρ ∈ Sb , inductively on Γ \Gamma Γ :
G-Ctx-⋅ S b ⟺ ( Δ ⊢ σ : ⋅ ) ⋅ ↘ S b \begin{aligned}
&\text{G-Ctx-·}\\
&\mathsf{Sb} \Longleftrightarrow(\Delta\vdash\sigma: \cdot)\\
&\cdot\searrow\mathsf{Sb}
\end{aligned} G-Ctx-⋅ Sb ⟺ ( Δ ⊢ σ : ⋅ ) ⋅ ↘ Sb G-Ctx-Ext Γ ↘ S b T Γ ⊢ S : T y i ∀ Δ ′ , σ T , ρ T . Δ ′ ⊢ σ T : Γ ® ρ T ∈ S b T ⇒ ∃ a , P , E l . ⟦ S ⟧ ( ρ T ) ↘ a ∧ a ∈ U i ∗ ↘ P ↘ E l ∧ Δ ′ ⊢ S [ σ T ] : T y i ® P S b ⟺ Cons i ( Γ , S , S b T ) ( Γ , x : S ) ↘ S b \begin{aligned}
&\text{G-Ctx-Ext}\\
&\frac{
\Gamma\searrow\mathsf{Sb}_{T}
\qquad
\Gamma\vdash S : \mathsf{Ty}_{i}
\qquad
\forall\Delta',\sigma_{T},\rho_{T}.\ \Delta' \vdash\sigma_{T} : \Gamma\mathbin{\circledR} \rho_{T} \in\mathsf{Sb}_{T}
\Rightarrow
\exists a,P,\mathbf{El}.\ \llbracket S\rrbracket(\rho_{T}) \searrow a \land a \in\mathcal{U}^{*}_{i} \searrow P \searrow\mathbf{El} \land\Delta' \vdash S[\sigma_{T}] : \mathsf{Ty}_{i} \mathbin{\circledR} P
}{
\mathsf{Sb} \Longleftrightarrow\operatorname{Cons}_{i}(\Gamma,S,\mathsf{Sb}_{T})
\qquad
(\Gamma,x:S) \searrow\mathsf{Sb}
}
\end{aligned} G-Ctx-Ext Sb ⟺ Cons i ( Γ , S , Sb T ) ( Γ , x : S ) ↘ Sb Γ ↘ Sb T Γ ⊢ S : Ty i ∀ Δ ′ , σ T , ρ T . Δ ′ ⊢ σ T : Γ ® ρ T ∈ Sb T ⇒ ∃ a , P , El . [ [ S ] ] ( ρ T ) ↘ a ∧ a ∈ U i ∗ ↘ P ↘ El ∧ Δ ′ ⊢ S [ σ T ] : Ty i ® P Here Cons i ( Γ , S , S b T ) \operatorname{Cons}_{i}(\Gamma,S,\mathsf{Sb}_{T}) Cons i ( Γ , S , Sb T ) holds at any Δ ⊢ σ : Γ , x : S ® ρ \Delta\vdash\sigma: \Gamma,x:S \mathbin{\circledR} \rho Δ ⊢ σ : Γ , x : S ® ρ when there exist i , a , P , E l i,a,P,\mathbf{El} i , a , P , El with:
Substitution typing: Δ ⊢ σ : Γ , x : S \Delta\vdash\sigma: \Gamma,x:S Δ ⊢ σ : Γ , x : S ,
Tail: Δ ⊢ ⇑ ∘ σ : Γ ® ρ [ ⇑ ] ∈ S b T \Delta\vdash\Uparrow\circ\sigma: \Gamma\mathbin{\circledR} \rho[\Uparrow] \in\mathsf{Sb}_{T} Δ ⊢⇑ ∘ σ : Γ ® ρ [ ⇑ ] ∈ Sb T ,
Type: ⟦ S ⟧ ( ρ [ ⇑ ] ) ↘ a \llbracket S\rrbracket(\rho[\Uparrow]) \searrow a [ [ S ] ] ( ρ [ ⇑ ]) ↘ a , a ∈ U i ∗ ↘ P ↘ E l a \in\mathcal{U}^{*}_{i} \searrow P \searrow\mathbf{El} a ∈ U i ∗ ↘ P ↘ El , and Δ ⊢ S [ ⇑ ∘ σ ] : T y i ® P \Delta\vdash S[\Uparrow\circ\sigma] : \mathsf{Ty}_{i} \mathbin{\circledR} P Δ ⊢ S [ ⇑ ∘ σ ] : Ty i ® P , and
Head: Δ ⊢ x 0 [ σ ] : S [ ⇑ ∘ σ ] ® ρ ( x 0 ) ∈ E l \Delta\vdash x_{0}[\sigma] : S[\Uparrow\circ\sigma] \mathbin{\circledR} \rho(x_{0}) \in\mathbf{El} Δ ⊢ x 0 [ σ ] : S [ ⇑ ∘ σ ] ® ρ ( x 0 ) ∈ El .
Here ⇑ ∘ σ \Uparrow\circ\sigma ⇑ ∘ σ drops the head, mapping index n n n to σ ( n + 1 ) \sigma(n+1) σ ( n + 1 ) ; the corresponding drop operation ρ [ ⇑ ] \rho[\Uparrow] ρ [ ⇑ ] on environments is from Sec. 5.
Definition 7.17 (Semantic context well-formedness). We write ⊩ Γ \Vdash\Gamma ⊩ Γ to mean that the context-gluing predicate exists for Γ \Gamma Γ :
⊩ Γ ⟺ ∃ S b . Γ ↘ S b . \Vdash\Gamma\qquad\Longleftrightarrow\qquad\exists\mathsf{Sb}.\ \Gamma\searrow\mathsf{Sb}. ⊩ Γ ⟺ ∃ Sb . Γ ↘ Sb . Syntactic well-formedness ⊢ Γ \vdash\Gamma ⊢ Γ is derivable as a consequence of ⊩ Γ \Vdash\Gamma ⊩ Γ (proved next).
Lemma 7.18 (⊩ Γ \Vdash\Gamma ⊩ Γ implies ⊢ Γ \vdash\Gamma ⊢ Γ ). If ⊩ Γ \Vdash\Gamma ⊩ Γ , then ⊢ Γ \vdash\Gamma ⊢ Γ .
Proof. By induction on the derivation of Γ ↘ S b \Gamma\searrow\mathsf{Sb} Γ ↘ Sb .
Case
G-Ctx-⋅ S b ⟺ ( Δ ⊢ σ : ⋅ ) ⋅ ↘ S b \begin{aligned}
&\text{G-Ctx-·}\\
&\mathsf{Sb} \Longleftrightarrow(\Delta\vdash\sigma: \cdot)\\
&\cdot\searrow\mathsf{Sb}
\end{aligned} G-Ctx-⋅ Sb ⟺ ( Δ ⊢ σ : ⋅ ) ⋅ ↘ Sb ⊢ ⋅ \vdash\cdot ⊢ ⋅ holds by Ctx-Emp.
Case
G-Ctx-Ext Γ 0 ↘ S b T Γ 0 ⊢ S : T y i ∀ Δ ′ , σ T , ρ T . Δ ′ ⊢ σ T : Γ 0 ® ρ T ∈ S b T ⇒ ∃ a , P , E l . ⟦ S ⟧ ( ρ T ) ↘ a ∧ a ∈ U i ∗ ↘ P ↘ E l ∧ Δ ′ ⊢ S [ σ T ] : T y i ® P S b ⟺ Cons i ( Γ 0 , S , S b T ) ( Γ 0 , x : S ) ↘ S b \begin{aligned}
&\text{G-Ctx-Ext}\\
&\frac{
\Gamma_{0} \searrow\mathsf{Sb}_{T}
\qquad
\Gamma_{0} \vdash S : \mathsf{Ty}_{i}
\qquad
\forall\Delta',\sigma_{T},\rho_{T}.\ \Delta' \vdash\sigma_{T} : \Gamma_{0} \mathbin{\circledR} \rho_{T} \in\mathsf{Sb}_{T}
\Rightarrow
\exists a,P,\mathbf{El}.\ \llbracket S\rrbracket(\rho_{T}) \searrow a \land a \in\mathcal{U}^{*}_{i} \searrow P \searrow\mathbf{El} \land\Delta' \vdash S[\sigma_{T}] : \mathsf{Ty}_{i} \mathbin{\circledR} P
}{
\mathsf{Sb} \Longleftrightarrow\operatorname{Cons}_{i}(\Gamma_{0},S,\mathsf{Sb}_{T})
\qquad
(\Gamma_{0},x:S) \searrow\mathsf{Sb}
}
\end{aligned} G-Ctx-Ext Sb ⟺ Cons i ( Γ 0 , S , Sb T ) ( Γ 0 , x : S ) ↘ Sb Γ 0 ↘ Sb T Γ 0 ⊢ S : Ty i ∀ Δ ′ , σ T , ρ T . Δ ′ ⊢ σ T : Γ 0 ® ρ T ∈ Sb T ⇒ ∃ a , P , El . [ [ S ] ] ( ρ T ) ↘ a ∧ a ∈ U i ∗ ↘ P ↘ El ∧ Δ ′ ⊢ S [ σ T ] : Ty i ® P ⊢ Γ 0 (by IH on Γ 0 ↘ S b T ) Γ 0 ⊢ S : T y i (by G-Ctx-Ext premise) ⊢ Γ 0 , x : S (by Ctx-Ext) \begin{aligned}
\vdash\Gamma_{0} &\qquad\text{(by IH on }\Gamma_{0} \searrow\mathsf{Sb}_{T}\text{)}\\
\Gamma_{0} \vdash S : \mathsf{Ty}_{i} &\qquad\text{(by G-Ctx-Ext premise)}\\
\vdash\Gamma_{0},x:S &\qquad\text{(by Ctx-Ext)}
\end{aligned} ⊢ Γ 0 Γ 0 ⊢ S : Ty i ⊢ Γ 0 , x : S (by IH on Γ 0 ↘ Sb T ) (by G-Ctx-Ext premise) (by Ctx-Ext)
Properties of the Kripke Gluing Model
Theorem 7.19 (Monotonicity). Suppose a ∈ U i ∗ ↘ P ↘ E l a \in\mathcal{U}_i^* \searrow P \searrow El a ∈ U i ∗ ↘ P ↘ E l and Δ ′ ⊢ k ψ : Δ \Delta' \vdash_k \psi: \Delta Δ ′ ⊢ k ψ : Δ .
(1) If Δ ⊢ S : T y i ® P \Delta\vdash S : \mathop{\mathrm{Ty}}\nolimits_i \mathbin{\mathrel{\circledR}} P Δ ⊢ S : Ty i ® P , then Δ ′ ⊢ S [ ψ ] : T y i ® P \Delta' \vdash S[\psi] : \mathop{\mathrm{Ty}}\nolimits_i \mathbin{\mathrel{\circledR}} P Δ ′ ⊢ S [ ψ ] : Ty i ® P .
(2) If Δ ⊢ t : S ® b ∈ E l \Delta\vdash t : S \mathbin{\mathrel{\circledR}} b \in El Δ ⊢ t : S ® b ∈ E l , then Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® b ∈ E l \Delta' \vdash t[\psi] : S[\psi] \mathbin{\mathrel{\circledR}} b \in El Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® b ∈ E l .
Proof. By induction on the derivation a ∈ U i ∗ ↘ P ↘ E l a \in\mathcal{U}_i^* \searrow P \searrow El a ∈ U i ∗ ↘ P ↘ E l .
Case
G - N e ↑ A ( e ) ∈ D P ⟺ N e u i e E l ⟺ N e u i e ↑ A ( e ) ∈ U i ∗ ↘ P ↘ E l \frac{
\begin{gathered}
\mathsf{G\text{-}Ne}\\
\uparrow^{A}(e) \in D \qquad P \Longleftrightarrow\mathop{\mathrm{Neu}}\nolimits_i^e \qquad El \Longleftrightarrow\mathop{\mathrm{Neu}}\nolimits_i^e
\end{gathered}
}{
\uparrow^{A}(e) \in\mathcal{U}_i^* \searrow P \searrow El
} ↑ A ( e ) ∈ U i ∗ ↘ P ↘ E l G - Ne ↑ A ( e ) ∈ D P ⟺ Neu i e E l ⟺ Neu i e
Type predicate (1). Assume Δ ⊢ S : T y i ® N e u i e \Delta\vdash S : \mathop{\mathrm{Ty}}\nolimits_i \mathbin{\mathrel{\circledR}} \mathop{\mathrm{Neu}}\nolimits_i^e Δ ⊢ S : Ty i ® Neu i e . By Theorem 7.5:
Δ ⊢ S : T y i (by Theorem 7.5 clause 1) \Delta\vdash S : \mathop{\mathrm{Ty}}\nolimits_i
\qquad\text{(by Theorem 7.5 clause 1)} Δ ⊢ S : Ty i (by Theorem 7.5 clause 1)
∀ Δ ′ ′ , Δ ′ ′ ⊢ k ϕ ′ : Δ . ∃ u . R ∣ Δ ′ ′ ∣ N e ( e ) ↘ u ∧ Δ ′ ′ ⊢ S [ ϕ ′ ] ≈ u : T y i (by Theorem 7.5 clause 2) \forall\Delta'',\ \Delta'' \vdash_k \phi' : \Delta.\ \exists u.\ R^{\mathrm{Ne}}_{|\Delta''|}(e) \searrow u \mathbin{\wedge} \Delta'' \vdash S[\phi'] \approx u : \mathop{\mathrm{Ty}}\nolimits_i
\qquad\text{(by Theorem 7.5 clause 2)} ∀ Δ ′′ , Δ ′′ ⊢ k ϕ ′ : Δ. ∃ u . R ∣ Δ ′′ ∣ Ne ( e ) ↘ u ∧ Δ ′′ ⊢ S [ ϕ ′ ] ≈ u : Ty i (by Theorem 7.5 clause 2)
We must show Δ ′ ⊢ S [ ψ ] : T y i ® N e u i e \Delta' \vdash S[\psi] : \mathop{\mathrm{Ty}}\nolimits_i \mathbin{\mathrel{\circledR}} \mathop{\mathrm{Neu}}\nolimits_i^e Δ ′ ⊢ S [ ψ ] : Ty i ® Neu i e .
Δ ′ ⊢ S [ ψ ] : T y i (by Theorem 7.2 on ψ and Theorem 4.1) \Delta' \vdash S[\psi] : \mathop{\mathrm{Ty}}\nolimits_i
\qquad\text{(by Theorem 7.2 on }\psi\text{ and Theorem 4.1)} Δ ′ ⊢ S [ ψ ] : Ty i (by Theorem 7.2 on ψ and Theorem 4.1)
For the Kripke condition: take any Δ ′ ′ \Delta'' Δ ′′ with Δ ′ ′ ⊢ k ϕ ′ : Δ ′ \Delta'' \vdash_k \phi' : \Delta' Δ ′′ ⊢ k ϕ ′ : Δ ′ .
Δ ′ ′ ⊢ k ψ ∘ ϕ ′ : Δ (by Theorem 7.3 on ψ and ϕ ′ ) \Delta'' \vdash_k \psi\circ\phi' : \Delta
\qquad\text{(by Theorem 7.3 on }\psi\text{ and }\phi'\text{)} Δ ′′ ⊢ k ψ ∘ ϕ ′ : Δ (by Theorem 7.3 on ψ and ϕ ′ )
∃ u . R ∣ Δ ′ ′ ∣ N e ( e ) ↘ u ∧ Δ ′ ′ ⊢ S [ ψ ∘ ϕ ′ ] ≈ u : T y i (by hypothesis on S at the composed weakening) \exists u.\ R^{\mathrm{Ne}}_{|\Delta''|}(e) \searrow u \mathbin{\wedge} \Delta'' \vdash S[\psi\circ\phi'] \approx u : \mathop{\mathrm{Ty}}\nolimits_i
\qquad\text{(by hypothesis on }S\text{ at the composed weakening)} ∃ u . R ∣ Δ ′′ ∣ Ne ( e ) ↘ u ∧ Δ ′′ ⊢ S [ ψ ∘ ϕ ′ ] ≈ u : Ty i (by hypothesis on S at the composed weakening)
S [ ψ ∘ ϕ ′ ] = S [ ψ ] [ ϕ ′ ] (by Sec. 2’s substitution-composition law) S[\psi\circ\phi'] = S[\psi][\phi']
\qquad\text{(by Sec. 2’s substitution-composition law)} S [ ψ ∘ ϕ ′ ] = S [ ψ ] [ ϕ ′ ] (by Sec. 2’s substitution-composition law)
Δ ′ ′ ⊢ S [ ψ ] [ ϕ ′ ] ≈ u : T y i (rewriting) \Delta'' \vdash S[\psi][\phi'] \approx u : \mathop{\mathrm{Ty}}\nolimits_i
\qquad\text{(rewriting)} Δ ′′ ⊢ S [ ψ ] [ ϕ ′ ] ≈ u : Ty i (rewriting)
This establishes the Kripke condition for S [ ψ ] S[\psi] S [ ψ ] at N e u i e \mathop{\mathrm{Neu}}\nolimits_i^e Neu i e .
Term predicate (2). Assume Δ ⊢ t : S ® ↑ A ( w ) ∈ N e u i e \Delta\vdash t : S \mathbin{\mathrel{\circledR}} \uparrow^{A}(w) \in\mathop{\mathrm{Neu}}\nolimits_i^e Δ ⊢ t : S ® ↑ A ( w ) ∈ Neu i e . By Theorem 7.6:
Δ ⊢ S : T y i ® N e u i e , Δ ⊢ t : S , w ≈ w ∈ N e (Theorem 7.6 clauses 1–3) \Delta\vdash S : \mathop{\mathrm{Ty}}\nolimits_i \mathbin{\mathrel{\circledR}} \mathop{\mathrm{Neu}}\nolimits_i^e,\quad\Delta\vdash t : S,\ w \approx w \in Ne
\qquad\text{(Theorem 7.6 clauses 1–3)} Δ ⊢ S : Ty i ® Neu i e , Δ ⊢ t : S , w ≈ w ∈ N e (Theorem 7.6 clauses 1–3)
∀ Δ ′ ′ , Δ ′ ′ ⊢ k ϕ ′ : Δ . ∃ u . R ∣ Δ ′ ′ ∣ N e ( w ) ↘ u ∧ Δ ′ ′ ⊢ t [ ϕ ′ ] ≈ u : S [ ϕ ′ ] (Theorem 7.6 clause 4) \forall\Delta'',\ \Delta'' \vdash_k \phi' : \Delta.\ \exists u.\ R^{\mathrm{Ne}}_{|\Delta''|}(w) \searrow u \mathbin{\wedge} \Delta'' \vdash t[\phi'] \approx u : S[\phi']
\qquad\text{(Theorem 7.6 clause 4)} ∀ Δ ′′ , Δ ′′ ⊢ k ϕ ′ : Δ. ∃ u . R ∣ Δ ′′ ∣ Ne ( w ) ↘ u ∧ Δ ′′ ⊢ t [ ϕ ′ ] ≈ u : S [ ϕ ′ ] (Theorem 7.6 clause 4)
By type-predicate monotonicity (just proved): Δ ′ ⊢ S [ ψ ] : T y i ® N e u i e \Delta' \vdash S[\psi] : \mathop{\mathrm{Ty}}\nolimits_i \mathbin{\mathrel{\circledR}} \mathop{\mathrm{Neu}}\nolimits_i^e Δ ′ ⊢ S [ ψ ] : Ty i ® Neu i e . Δ ′ ⊢ t [ ψ ] : S [ ψ ] \Delta' \vdash t[\psi] : S[\psi] Δ ′ ⊢ t [ ψ ] : S [ ψ ] by Sec. 4. w ≈ w ∈ N e w \approx w \in Ne w ≈ w ∈ N e unchanged. Kripke condition: for Δ ′ ′ ⊢ k ϕ ′ : Δ ′ \Delta'' \vdash_k \phi' : \Delta' Δ ′′ ⊢ k ϕ ′ : Δ ′ , by Theorem 7.3 Δ ′ ′ ⊢ k ψ ∘ ϕ ′ : Δ \Delta'' \vdash_k \psi\circ\phi' : \Delta Δ ′′ ⊢ k ψ ∘ ϕ ′ : Δ , hypothesis gives R ∣ Δ ′ ′ ∣ N e ( w ) ↘ u R^{\mathrm{Ne}}_{|\Delta''|}(w) \searrow u R ∣ Δ ′′ ∣ Ne ( w ) ↘ u and Δ ′ ′ ⊢ t [ ψ ∘ ϕ ′ ] ≈ u : S [ ψ ∘ ϕ ′ ] \Delta'' \vdash t[\psi\circ\phi'] \approx u : S[\psi\circ\phi'] Δ ′′ ⊢ t [ ψ ∘ ϕ ′ ] ≈ u : S [ ψ ∘ ϕ ′ ] . By substitution composition: t [ ψ ∘ ϕ ′ ] = t [ ψ ] [ ϕ ′ ] t[\psi\circ\phi'] = t[\psi][\phi'] t [ ψ ∘ ϕ ′ ] = t [ ψ ] [ ϕ ′ ] and S [ ψ ∘ ϕ ′ ] = S [ ψ ] [ ϕ ′ ] S[\psi\circ\phi'] = S[\psi][\phi'] S [ ψ ∘ ϕ ′ ] = S [ ψ ] [ ϕ ′ ] .
Case
G - N a t P ⟺ N a t i E l ⟺ N a t i N ∈ U i ∗ ↘ P ↘ E l \frac{
\begin{gathered}
\mathsf{G\text{-}Nat}\\
P \Longleftrightarrow\mathop{\mathrm{Nat}}\nolimits_i \qquad El \Longleftrightarrow\mathop{\mathrm{Nat}}\nolimits_i
\end{gathered}
}{
N \in\mathcal{U}_i^* \searrow P \searrow El
} N ∈ U i ∗ ↘ P ↘ E l G - Nat P ⟺ Nat i E l ⟺ Nat i
Type predicate (1). Assume Δ ⊢ S : T y i ® N a t i \Delta\vdash S : \mathop{\mathrm{Ty}}\nolimits_i \mathbin{\mathrel{\circledR}} \mathop{\mathrm{Nat}}\nolimits_i Δ ⊢ S : Ty i ® Nat i , i.e. Δ ⊢ S ≈ N a t : T y i \Delta\vdash S \approx\mathop{\mathrm{Nat}} : \mathop{\mathrm{Ty}}\nolimits_i Δ ⊢ S ≈ Nat : Ty i .
Δ ′ ⊢ S [ ψ ] ≈ N a t [ ψ ] : T y i (by Theorem 4.1) \Delta' \vdash S[\psi] \approx\mathop{\mathrm{Nat}}[\psi] : \mathop{\mathrm{Ty}}\nolimits_i
\qquad\text{(by Theorem 4.1)} Δ ′ ⊢ S [ ψ ] ≈ Nat [ ψ ] : Ty i (by Theorem 4.1)
N a t [ ψ ] = N a t (syntactic, Nat closed) \mathop{\mathrm{Nat}}[\psi] = \mathop{\mathrm{Nat}}
\qquad\text{(syntactic, Nat closed)} Nat [ ψ ] = Nat (syntactic, Nat closed)
Δ ′ ⊢ S [ ψ ] ≈ N a t : T y i (rewriting) \Delta' \vdash S[\psi] \approx\mathop{\mathrm{Nat}} : \mathop{\mathrm{Ty}}\nolimits_i
\qquad\text{(rewriting)} Δ ′ ⊢ S [ ψ ] ≈ Nat : Ty i (rewriting)
Δ ′ ⊢ S [ ψ ] : T y i ® N a t i (by Theorem 7.7) \Delta' \vdash S[\psi] : \mathop{\mathrm{Ty}}\nolimits_i \mathbin{\mathrel{\circledR}} \mathop{\mathrm{Nat}}\nolimits_i
\qquad\text{(by Theorem 7.7)} Δ ′ ⊢ S [ ψ ] : Ty i ® Nat i (by Theorem 7.7)
Term predicate (2). Assume Δ ⊢ t : S ® b ∈ N a t i \Delta\vdash t : S \mathbin{\mathrel{\circledR}} b \in\mathop{\mathrm{Nat}}\nolimits_i Δ ⊢ t : S ® b ∈ Nat i . By inner induction on the derivation b ∈ N a t b \in\mathop{\mathrm{Nat}} b ∈ Nat . Sub-case
G N - Z e Δ ⊢ t ≈ z e r o : S Δ ⊢ t : S ® z e ∈ N a t \begin{gathered}
\mathrm{GN\text{-}Ze}\\
\Delta\vdash t \approx\mathrm{zero} : S\\
\hline
\Delta\vdash t : S \mathbin{\circledR} \mathrm{ze} \in\mathrm{Nat}
\end{gathered} GN - Ze Δ ⊢ t ≈ zero : S Δ ⊢ t : S ® ze ∈ Nat
Δ ′ ⊢ t [ ψ ] ≈ z e r o [ ψ ] : S [ ψ ] (by Theorem 4.1) z e r o [ ψ ] = z e r o (syntactic, zero closed) Δ ′ ⊢ t [ ψ ] ≈ z e r o : S [ ψ ] (rewriting) Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® z e ∈ N a t (by GN-ZE) \begin{aligned}
\Delta' \vdash t[\psi] \approx\mathrm{zero}[\psi] : S[\psi] &\qquad\text{(by Theorem 4.1)}\\
\mathrm{zero}[\psi] = \mathrm{zero} &\qquad\text{(syntactic, zero closed)}\\
\Delta' \vdash t[\psi] \approx\mathrm{zero} : S[\psi] &\qquad\text{(rewriting)}\\
\Delta' \vdash t[\psi] : S[\psi] \mathbin{\circledR} \mathrm{ze} \in\mathrm{Nat} &\qquad\text{(by GN-ZE)}
\end{aligned} Δ ′ ⊢ t [ ψ ] ≈ zero [ ψ ] : S [ ψ ] zero [ ψ ] = zero Δ ′ ⊢ t [ ψ ] ≈ zero : S [ ψ ] Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® ze ∈ Nat (by Theorem 4.1) (syntactic, zero closed) (rewriting) (by GN-ZE)
Sub-case
G N - S u Δ ⊢ t ′ : S ® b ′ ∈ N a t Δ ⊢ t ≈ s u c c t ′ : S Δ ⊢ t : S ® s u ( b ′ ) ∈ N a t \begin{gathered}
\mathrm{GN\text{-}Su}\\
\Delta\vdash t' : S \mathbin{\circledR} b' \in\mathrm{Nat}
\qquad
\Delta\vdash t \approx\mathrm{succ}\ t' : S\\
\hline
\Delta\vdash t : S \mathbin{\circledR} \mathrm{su}(b') \in\mathrm{Nat}
\end{gathered} GN - Su Δ ⊢ t ′ : S ® b ′ ∈ Nat Δ ⊢ t ≈ succ t ′ : S Δ ⊢ t : S ® su ( b ′ ) ∈ Nat
Δ ′ ⊢ t ′ [ ψ ] : S [ ψ ] ® b ′ ∈ N a t (by inner IH on b ′ ) Δ ′ ⊢ t [ ψ ] ≈ ( s u c c t ′ ) [ ψ ] : S [ ψ ] (by Theorem 4.1) ( s u c c t ′ ) [ ψ ] = s u c c ( t ′ [ ψ ] ) (syntactic substitution on succ) Δ ′ ⊢ t [ ψ ] ≈ s u c c ( t ′ [ ψ ] ) : S [ ψ ] (rewriting) Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® s u ( b ′ ) ∈ N a t (by GN-Su on the IH) \begin{aligned}
\Delta' \vdash t'[\psi] : S[\psi] \mathbin{\circledR} b' \in\mathrm{Nat} &\qquad\text{(by inner IH on }b'\text{)}\\
\Delta' \vdash t[\psi] \approx(\mathrm{succ}\ t')[\psi] : S[\psi] &\qquad\text{(by Theorem 4.1)}\\
(\mathrm{succ}\ t')[\psi] = \mathrm{succ}\ (t'[\psi]) &\qquad\text{(syntactic substitution on succ)}\\
\Delta' \vdash t[\psi] \approx\mathrm{succ}\ (t'[\psi]) : S[\psi] &\qquad\text{(rewriting)}\\
\Delta' \vdash t[\psi] : S[\psi] \mathbin{\circledR} \mathrm{su}(b') \in\mathrm{Nat} &\qquad\text{(by GN-Su on the IH)}
\end{aligned} Δ ′ ⊢ t ′ [ ψ ] : S [ ψ ] ® b ′ ∈ Nat Δ ′ ⊢ t [ ψ ] ≈ ( succ t ′ ) [ ψ ] : S [ ψ ] ( succ t ′ ) [ ψ ] = succ ( t ′ [ ψ ]) Δ ′ ⊢ t [ ψ ] ≈ succ ( t ′ [ ψ ]) : S [ ψ ] Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® su ( b ′ ) ∈ Nat (by inner IH on b ′ ) (by Theorem 4.1) (syntactic substitution on succ) (rewriting) (by GN-Su on the IH)
Sub-case
G N - N e Δ ⊢ t : S ® ↑ N ( w ) ∈ N e u i e Δ ⊢ t : S ® ↑ N ( w ) ∈ N a t \begin{gathered}
\mathrm{GN\text{-}Ne}\\
\Delta\vdash t : S \mathbin{\circledR} \uparrow^{N}(w) \in\mathrm{Neu}^{e}_{i}\\
\hline
\Delta\vdash t : S \mathbin{\circledR} \uparrow^{N}(w) \in\mathrm{Nat}
\end{gathered} GN - Ne Δ ⊢ t : S ® ↑ N ( w ) ∈ Neu i e Δ ⊢ t : S ® ↑ N ( w ) ∈ Nat
Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® ↑ N ( w ) ∈ N e u i e (by the G-Ne case above, applied to N e u i e ) Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® ↑ N ( w ) ∈ N a t (by GN-Ne) \begin{aligned}
\Delta' \vdash t[\psi] : S[\psi] \mathbin{\circledR} \uparrow^{N}(w) \in\mathrm{Neu}^{e}_{i}
&\qquad\text{(by the G-Ne case above, applied to }\mathrm{Neu}^{e}_{i}\text{)}\\
\Delta' \vdash t[\psi] : S[\psi] \mathbin{\circledR} \uparrow^{N}(w) \in\mathrm{Nat}
&\qquad\text{(by GN-Ne)}
\end{aligned} Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® ↑ N ( w ) ∈ Neu i e Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® ↑ N ( w ) ∈ Nat (by the G-Ne case above, applied to Neu i e ) (by GN-Ne)
Case
G - U n i v j < i P ⇔ U n i v i , j E l ⇔ U n i v i , j E l U j ∈ U i ∗ ↘ P ↘ E l \begin{gathered}
\mathrm{G\text{-}Univ}\\
j < i \qquad P \Leftrightarrow\mathrm{Univ}_{i,j}
\qquad
\mathrm{El} \Leftrightarrow\mathrm{Univ}^{\mathrm{El}}_{i,j}\\
\hline
U_j \in\mathcal{U}^{*}_{i} \searrow P \searrow\mathrm{El}
\end{gathered} G - Univ j < i P ⇔ Univ i , j El ⇔ Univ i , j El U j ∈ U i ∗ ↘ P ↘ El
Type predicate (1). Assume Δ ⊢ S : T y i ® U n i v i , j \Delta\vdash S : \mathrm{Ty}_{i} \mathbin{\circledR} \mathrm{Univ}_{i,j} Δ ⊢ S : Ty i ® Univ i , j , i.e. Δ ⊢ S ≈ T y j : T y i \Delta\vdash S \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i} Δ ⊢ S ≈ Ty j : Ty i .
Δ ′ ⊢ S [ ψ ] ≈ T y j [ ψ ] : T y i (by Theorem 4.1) T y j [ ψ ] = T y j (syntactic; T y j closed) Δ ′ ⊢ S [ ψ ] ≈ T y j : T y i (rewriting) Δ ′ ⊢ S [ ψ ] : T y i ® U n i v i , j (by Theorem 7.11) \begin{aligned}
\Delta' \vdash S[\psi] \approx\mathrm{Ty}_{j}[\psi] : \mathrm{Ty}_{i} &\qquad\text{(by Theorem 4.1)}\\
\mathrm{Ty}_{j}[\psi] = \mathrm{Ty}_{j} &\qquad\text{(syntactic; }\mathrm{Ty}_{j}\text{ closed)}\\
\Delta' \vdash S[\psi] \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i} &\qquad\text{(rewriting)}\\
\Delta' \vdash S[\psi] : \mathrm{Ty}_{i} \mathbin{\circledR} \mathrm{Univ}_{i,j} &\qquad\text{(by Theorem 7.11)}
\end{aligned} Δ ′ ⊢ S [ ψ ] ≈ Ty j [ ψ ] : Ty i Ty j [ ψ ] = Ty j Δ ′ ⊢ S [ ψ ] ≈ Ty j : Ty i Δ ′ ⊢ S [ ψ ] : Ty i ® Univ i , j (by Theorem 4.1) (syntactic; Ty j closed) (rewriting) (by Theorem 7.11)
Term predicate (2). Assume Δ ⊢ t : S ® b ∈ U n i v i , j E l \Delta\vdash t : S \mathbin{\circledR} b \in\mathrm{Univ}^{\mathrm{El}}_{i,j} Δ ⊢ t : S ® b ∈ Univ i , j El . By Theorem 7.12, b ∈ U j ∗ ↘ P b ↘ E l b b \in\mathcal{U}^{*}_{j} \searrow P_b \searrow\mathrm{El}_b b ∈ U j ∗ ↘ P b ↘ El b , for some P b , E l b P_b,\mathrm{El}_b P b , El b , with Δ ⊢ t : T y j ® P b \Delta\vdash t : \mathrm{Ty}_{j} \mathbin{\circledR} P_b Δ ⊢ t : Ty j ® P b at level j j j and Δ ⊢ S ≈ T y j : T y i \Delta\vdash S \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i} Δ ⊢ S ≈ Ty j : Ty i .
Δ ′ ⊢ t [ ψ ] : T y j [ ψ ] ® P b (by IH at level j on b ∈ U j ∗ , type predicate) (5) \Delta' \vdash t[\psi] : \mathrm{Ty}_{j}[\psi] \mathbin{\circledR} P_b
\qquad\text{(by IH at level }j\text{ on }b \in\mathcal{U}^{*}_{j}\text{, type predicate)} \tag*{(5)} Δ ′ ⊢ t [ ψ ] : Ty j [ ψ ] ® P b (by IH at level j on b ∈ U j ∗ , type predicate) (5)
T y j [ ψ ] = T y j \mathrm{Ty}_j[\psi] = \mathrm{Ty}_j Ty j [ ψ ] = Ty j
Δ ′ ⊢ t [ ψ ] : T y j ® P b \Delta' \vdash t[\psi] : \mathrm{Ty}_j \mathbin{\circledR} P_b Δ ′ ⊢ t [ ψ ] : Ty j ® P b
Δ ′ ⊢ S [ ψ ] ≈ T y j : T y i \Delta' \vdash S[\psi] \approx\mathrm{Ty}_j : \mathrm{Ty}_i Δ ′ ⊢ S [ ψ ] ≈ Ty j : Ty i
Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® b ∈ U n i v E l i , j \Delta' \vdash t[\psi] : S[\psi] \mathbin{\circledR} b \in\mathrm{UnivEl}_{i,j} Δ ′ ⊢ t [ ψ ] : S [ ψ ] ® b ∈ UnivEl i , j
Case
G-Pi
a ∈ U i ∗ ↘ P I ↘ E l I a ≈ a ∈ U i ↘ R I a \in U_i^* \searrow P_I \searrow\mathrm{El}_I \qquad a \approx a \in U_i \searrow R_I a ∈ U i ∗ ↘ P I ↘ El I a ≈ a ∈ U i ↘ R I
∀ D : : b ≈ b ∈ R I , c . ⟦ T ⟧ ( ρ , b / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) \forall\mathcal{D} :: b \approx b \in R_I,\ c.\ \llbracket T\rrbracket(\rho,b/x) \searrow c \Longrightarrow c \in U_i^* \searrow P_O(\mathcal{D}) \searrow\mathrm{El}_O(\mathcal{D}) ∀ D :: b ≈ b ∈ R I , c . [ [ T ] ] ( ρ , b / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D )
Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R \Pi(a,T,\rho) \approx\Pi(a,T,\rho) \in U_i \searrow R Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R
P ⇔ Π i ( R I , P I , E l I , P O ) E l ⇔ Π i ( R , R I , P I , E l I , E l O ) P \Leftrightarrow\Pi_i(R_I,P_I,\mathrm{El}_I,P_O) \qquad\mathrm{El} \Leftrightarrow\Pi_i(R,R_I,P_I,\mathrm{El}_I,\mathrm{El}_O) P ⇔ Π i ( R I , P I , El I , P O ) El ⇔ Π i ( R , R I , P I , El I , El O )
Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ E l \Pi(a,T,\rho) \in U_i^* \searrow P \searrow\mathrm{El} Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ El
Type predicate (1). Assume Δ ⊢ S : T y i ® Π i ( R I , P I , E l I , P O ) \Delta\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \Pi_i(R_I,P_I,\mathrm{El}_I,P_O) Δ ⊢ S : Ty i ® Π i ( R I , P I , El I , P O ) . By Theorem 7.9, this gives S 1 , S 2 S_1,S_2 S 1 , S 2 with Δ ⊢ S ≈ Π ( x : S 1 ) . S 2 : T y i \Delta\vdash S \approx\Pi(x:S_1).S_2 : \mathrm{Ty}_i Δ ⊢ S ≈ Π ( x : S 1 ) . S 2 : Ty i and the three clauses (well-formedness of S S S , domain-predicate, codomain-predicate). We must show Δ ′ ⊢ S [ ψ ] : T y i ® Π i ( R I , P I , E l I , P O ) \Delta' \vdash S[\psi] : \mathrm{Ty}_i \mathbin{\circledR} \Pi_i(R_I,P_I,\mathrm{El}_I,P_O) Δ ′ ⊢ S [ ψ ] : Ty i ® Π i ( R I , P I , El I , P O ) .
Clause 1: Π \Pi Π -shape equality.
Δ ⊢ S ≈ Π ( x : S 1 ) . S 2 : T y i \Delta\vdash S \approx\Pi(x:S_1).S_2 : \mathrm{Ty}_i Δ ⊢ S ≈ Π ( x : S 1 ) . S 2 : Ty i
Δ ′ ⊢ S [ ψ ] ≈ ( Π ( x : S 1 ) . S 2 ) [ ψ ] : T y i \Delta' \vdash S[\psi] \approx(\Pi(x:S_1).S_2)[\psi] : \mathrm{Ty}_i Δ ′ ⊢ S [ ψ ] ≈ ( Π ( x : S 1 ) . S 2 ) [ ψ ] : Ty i
( Π ( x : S 1 ) . S 2 ) [ ψ ] = Π ( x : S 1 [ ψ ] ) . ( S 2 [ q ( ψ ) ] ) (\Pi(x:S_1).S_2)[\psi] = \Pi(x:S_1[\psi]).(S_2[q(\psi)]) ( Π ( x : S 1 ) . S 2 ) [ ψ ] = Π ( x : S 1 [ ψ ]) . ( S 2 [ q ( ψ )])
Δ ′ ⊢ S [ ψ ] ≈ Π ( x : S 1 [ ψ ] ) . ( S 2 [ q ( ψ ) ] ) : T y i \Delta' \vdash S[\psi] \approx\Pi(x:S_1[\psi]).(S_2[q(\psi)]) : \mathrm{Ty}_i Δ ′ ⊢ S [ ψ ] ≈ Π ( x : S 1 [ ψ ]) . ( S 2 [ q ( ψ )]) : Ty i
Clause 2: domain-predicate at every Kripke extension of Δ ′ \Delta' Δ ′ . Let Δ ′ ′ ⊢ k ϕ ′ : Δ ′ \Delta'' \vdash_k \phi' : \Delta' Δ ′′ ⊢ k ϕ ′ : Δ ′ be arbitrary.
Δ ′ ′ ⊢ k ψ ∘ ϕ ′ : Δ \Delta'' \vdash_k \psi\circ\phi' : \Delta Δ ′′ ⊢ k ψ ∘ ϕ ′ : Δ
Δ ′ ′ ⊢ S 1 [ ψ ∘ ϕ ′ ] : T y i ® P I \Delta'' \vdash S_1[\psi\circ\phi'] : \mathrm{Ty}_i \mathbin{\circledR} P_I Δ ′′ ⊢ S 1 [ ψ ∘ ϕ ′ ] : Ty i ® P I
S 1 [ ψ ∘ ϕ ′ ] = ( S 1 [ ψ ] ) [ ϕ ′ ] S_1[\psi\circ\phi'] = (S_1[\psi])[\phi'] S 1 [ ψ ∘ ϕ ′ ] = ( S 1 [ ψ ]) [ ϕ ′ ]
Δ ′ ′ ⊢ ( S 1 [ ψ ] ) [ ϕ ′ ] : T y i ® P I \Delta'' \vdash(S_1[\psi])[\phi'] : \mathrm{Ty}_i \mathbin{\circledR} P_I Δ ′′ ⊢ ( S 1 [ ψ ]) [ ϕ ′ ] : Ty i ® P I
Clause 3: codomain-predicate at every Kripke extension of Δ ′ \Delta' Δ ′ and every E l \mathrm{El} El -related b b b . Let Δ ′ ′ ⊢ k ϕ ′ : Δ ′ \Delta'' \vdash_k \phi' : \Delta' Δ ′′ ⊢ k ϕ ′ : Δ ′ , s , b , D : : b ≈ b ∈ R I s,b,\mathcal{D} :: b \approx b \in R_I s , b , D :: b ≈ b ∈ R I with Δ ′ ′ ⊢ s : ( S 1 [ ψ ] ) [ ϕ ′ ] ® b ∈ E l I \Delta'' \vdash s : (S_1[\psi])[\phi'] \mathbin{\circledR} b \in\mathrm{El}_I Δ ′′ ⊢ s : ( S 1 [ ψ ]) [ ϕ ′ ] ® b ∈ El I .
Δ ′ ′ ⊢ k ψ ∘ ϕ ′ : Δ \Delta'' \vdash_k \psi\circ\phi' : \Delta Δ ′′ ⊢ k ψ ∘ ϕ ′ : Δ
Δ ′ ′ ⊢ s : S 1 [ ψ ∘ ϕ ′ ] ® b ∈ E l I \Delta'' \vdash s : S_1[\psi\circ\phi'] \mathbin{\circledR} b \in\mathrm{El}_I Δ ′′ ⊢ s : S 1 [ ψ ∘ ϕ ′ ] ® b ∈ El I
Δ ′ ′ ⊢ S 2 [ ι ( ψ ∘ ϕ ′ ) , s / x ] : T y i ® P O ( D ) \Delta'' \vdash S_2[\iota(\psi\circ\phi'),s/x] : \mathrm{Ty}_i \mathbin{\circledR} P_O(\mathcal{D}) Δ ′′ ⊢ S 2 [ ι ( ψ ∘ ϕ ′ ) , s / x ] : Ty i ® P O ( D )
This is the required predicate at the Kripke weakening ψ ∘ ϕ ′ \psi\circ\phi' ψ ∘ ϕ ′ for Π i \Pi_i Π i at S [ ψ ] S[\psi] S [ ψ ] over Δ ′ \Delta' Δ ′ .
Term predicate (2). Assume Δ ⊢ t : S ® f ∈ Π i E l ( R , R I , P I , E l I , E l O ) \Delta\vdash t : S \mathbin{\circledR} f \in\Pi_i^{{\mathrm{El}}}(R,R_I,P_I,\mathrm{El}_I,\mathrm{El}_O) Δ ⊢ t : S ® f ∈ Π i El ( R , R I , P I , El I , El O ) . We verify the four clauses of Theorem 7.10 at Δ ′ ⊢ t [ ψ ] : S [ ψ ] \Delta' \vdash t[\psi] : S[\psi] Δ ′ ⊢ t [ ψ ] : S [ ψ ] and value f f f .
Clause 1: self-relatedness f ≈ f ∈ R f \approx f \in R f ≈ f ∈ R . Unchanged by Kripke weakening (PER fact, independent of Δ \Delta Δ ).
Clause 2: R I R_I R I -coherence of f f f . Unchanged for the same reason.
Clause 3: type-readback of f f f at Π \Pi Π -shape. By type-predicate monotonicity (1) above, the Π i \Pi_i Π i -type predicate transfers to S [ ψ ] S[\psi] S [ ψ ] over Δ ′ \Delta' Δ ′ , supplying the type-readback witnesses required by clause 3.
Clause 4: application. Let Δ ′ ′ ⊢ k ϕ ′ : Δ ′ \Delta'' \vdash_k \phi' : \Delta' Δ ′′ ⊢ k ϕ ′ : Δ ′ , s , b , D : : b ≈ b ∈ R I s,b,\mathcal{D} :: b \approx b \in R_I s , b , D :: b ≈ b ∈ R I with Δ ′ ′ ⊢ s : ( S 1 [ ψ ] ) [ ϕ ′ ] ® b ∈ E l I \Delta'' \vdash s : (S_1[\psi])[\phi'] \mathbin{\circledR} b \in\mathrm{El}_I Δ ′′ ⊢ s : ( S 1 [ ψ ]) [ ϕ ′ ] ® b ∈ El I .
Δ ′ ′ ⊢ k ψ ∘ ϕ ′ : Δ (6) \Delta'' \vdash_k \psi\circ\phi' : \Delta \tag*{(6)} Δ ′′ ⊢ k ψ ∘ ϕ ′ : Δ (6)
Δ ′ ′ ⊢ s : S 1 [ ψ ∘ ϕ ′ ] ® b ∈ E l I \Delta'' \vdash s : S_1[\psi\circ\phi'] \mathbin{\circledR} b \in\mathrm{El}_I Δ ′′ ⊢ s : S 1 [ ψ ∘ ϕ ′ ] ® b ∈ El I
(by Theorem 2.22)
f ⋅ b ↘ c f \cdot b \searrow c f ⋅ b ↘ c
(by hypothesis clause 4 at ψ ∘ ϕ ′ \psi\circ\phi' ψ ∘ ϕ ′ , s s s , b b b , D \mathcal{D} D )
Δ ′ ′ ⊢ ( t [ ψ ∘ ϕ ′ ] ) s : S 2 [ ι ( ψ ∘ ϕ ′ ) , s / x ] ® c ∈ E l O ( D ) \Delta'' \vdash(t[\psi\circ\phi'])\,s : S_2[\iota(\psi\circ\phi'),s/x] \mathbin{\circledR} c \in\mathrm{El}_O(\mathcal{D}) Δ ′′ ⊢ ( t [ ψ ∘ ϕ ′ ]) s : S 2 [ ι ( ψ ∘ ϕ ′ ) , s / x ] ® c ∈ El O ( D )
(by hypothesis clause 4)
t [ ψ ∘ ϕ ′ ] = t [ ψ ] [ ϕ ′ ] t[\psi\circ\phi'] = t[\psi][\phi'] t [ ψ ∘ ϕ ′ ] = t [ ψ ] [ ϕ ′ ]
(by Theorem 2.22)
Δ ′ ′ ⊢ t [ ψ ] [ ϕ ′ ] s : S 2 [ ι ( ψ ∘ ϕ ′ ) , s / x ] ® c ∈ E l O ( D ) \Delta'' \vdash t[\psi][\phi']\,s : S_2[\iota(\psi\circ\phi'),s/x] \mathbin{\circledR} c \in\mathrm{El}_O(\mathcal{D}) Δ ′′ ⊢ t [ ψ ] [ ϕ ′ ] s : S 2 [ ι ( ψ ∘ ϕ ′ ) , s / x ] ® c ∈ El O ( D )
(rewriting)
This is the required form for Π i E l \Pi_i^{\mathrm{El}} Π i El clause 4 at t [ ψ ] t[\psi] t [ ψ ] over Δ ′ \Delta' Δ ′ at the Kripke weakening ψ ∘ ϕ ′ \psi\circ\phi' ψ ∘ ϕ ′ .
Clause 5: R I R_I R I -coherence under application. Inherited from the original predicate’s clause 5 by composition with ψ \psi ψ as in clause 4.
Corollary 7.20 (Context Gluing Monotonicity). If Γ ↘ S b \Gamma\searrow Sb Γ ↘ S b , Δ ⊢ σ : Γ ® ρ ∈ S b \Delta\vdash\sigma: \Gamma\mathbin{\circledR} \rho\in Sb Δ ⊢ σ : Γ ® ρ ∈ S b , and Δ ′ ⊢ k ψ : Δ \Delta' \vdash_k \psi: \Delta Δ ′ ⊢ k ψ : Δ , then Δ ′ ⊢ σ [ ψ ] : Γ ® ρ ∈ S b \Delta' \vdash\sigma[\psi] : \Gamma\mathbin{\circledR} \rho\in Sb Δ ′ ⊢ σ [ ψ ] : Γ ® ρ ∈ S b .
Proof. By induction on the context-gluing derivation Γ ↘ S b \Gamma\searrow Sb Γ ↘ S b .
Case
G-Ctx- ⋅ S b ⟺ ( Δ ⊢ σ : ⋅ ) ⋅ ↘ S b \begin{gathered}
\text{G-Ctx-}\cdot\\
Sb \Longleftrightarrow(\Delta\vdash\sigma: \cdot)\\
\cdot\searrow Sb
\end{gathered} G-Ctx- ⋅ S b ⟺ ( Δ ⊢ σ : ⋅ ) ⋅ ↘ S b
Δ ⊢ σ : ⋅ \Delta\vdash\sigma: \cdot Δ ⊢ σ : ⋅
(by hypothesis on σ \sigma σ )
Δ ′ ⊢ σ [ ψ ] : ⋅ \Delta' \vdash\sigma[\psi] : \cdot Δ ′ ⊢ σ [ ψ ] : ⋅
(by substitution composition, Sec. 2)
Δ ′ ⊢ σ [ ψ ] : ⋅ ® ρ ∈ S b \Delta' \vdash\sigma[\psi] : \cdot\mathbin{\circledR} \rho\in Sb Δ ′ ⊢ σ [ ψ ] : ⋅ ® ρ ∈ S b
(by S b Sb S b ’s definition for ⋅ \cdot ⋅ )
Case
G-Ctx-Ext Γ 0 ↘ S b T Γ 0 ⊢ S : T y i ∀ Δ ′ ′ , σ T , ρ T . Δ ′ ′ ⊢ σ T : Γ 0 ® ρ T ∈ S b T ⟹ ∃ a , P , E l . ⟦ S ⟧ ( ρ T ) ↘ a ∧ a ∈ U i ∗ ↘ P ↘ E l ∧ Δ ′ ′ ⊢ S [ σ T ] : T y i ® P S b ⟺ Cons i ( Γ 0 , S , S b T ) ( Γ 0 , x : S ) ↘ S b \begin{gathered}
\text{G-Ctx-Ext}\\
\Gamma_0 \searrow Sb_T \qquad\Gamma_0 \vdash S : Ty_i\\
\forall\Delta'',\sigma_T,\rho_T.\ \Delta'' \vdash\sigma_T : \Gamma_0 \mathbin{\circledR} \rho_T \in Sb_T \Longrightarrow\\
\exists a,P,\mathrm{El}.\ \llbracket S\rrbracket(\rho_T) \searrow a \land a \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El} \land\Delta'' \vdash S[\sigma_T] : Ty_i \mathbin{\circledR} P\\
Sb \Longleftrightarrow\operatorname{Cons}_i(\Gamma_0,S,Sb_T)\\
(\Gamma_0,x:S) \searrow Sb
\end{gathered} G-Ctx-Ext Γ 0 ↘ S b T Γ 0 ⊢ S : T y i ∀ Δ ′′ , σ T , ρ T . Δ ′′ ⊢ σ T : Γ 0 ® ρ T ∈ S b T ⟹ ∃ a , P , El . [ [ S ] ] ( ρ T ) ↘ a ∧ a ∈ U i ∗ ↘ P ↘ El ∧ Δ ′′ ⊢ S [ σ T ] : T y i ® P S b ⟺ Cons i ( Γ 0 , S , S b T ) ( Γ 0 , x : S ) ↘ S b
Unfolding Cons i \operatorname{Cons}_i Cons i at σ , ρ \sigma,\rho σ , ρ provides existential a , P , E l a,P,\mathrm{El} a , P , El specific to this pair:
Δ ⊢ ↑ ∘ σ : Γ 0 ® ρ [ ↑ ] ∈ S b T \Delta\vdash\mathord{\uparrow}\circ\sigma: \Gamma_0 \mathbin{\circledR} \rho[\mathord{\uparrow}] \in Sb_T Δ ⊢ ↑ ∘ σ : Γ 0 ® ρ [ ↑ ] ∈ S b T
(tail of Cons i \operatorname{Cons}_i Cons i )
⟦ S ⟧ ( ρ [ ↑ ] ) ↘ a , a ∈ U i ∗ ↘ P ↘ E l \llbracket S\rrbracket(\rho[\mathord{\uparrow}]) \searrow a,\quad a \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El} [ [ S ] ] ( ρ [ ↑ ]) ↘ a , a ∈ U i ∗ ↘ P ↘ El
(type clause of Cons i \operatorname{Cons}_i Cons i )
Δ ⊢ S [ ↑ ∘ σ ] : T y i ® P \Delta\vdash S[\mathord{\uparrow}\circ\sigma] : Ty_i \mathbin{\circledR} P Δ ⊢ S [ ↑ ∘ σ ] : T y i ® P
(type clause of Cons i \operatorname{Cons}_i Cons i )
Δ ⊢ x 0 [ σ ] : S [ ↑ ∘ σ ] ® ρ ( x 0 ) ∈ E l \Delta\vdash x_0[\sigma] : S[\mathord{\uparrow}\circ\sigma] \mathbin{\circledR} \rho(x_0) \in\mathrm{El} Δ ⊢ x 0 [ σ ] : S [ ↑ ∘ σ ] ® ρ ( x 0 ) ∈ El
(head of Cons i \operatorname{Cons}_i Cons i )
Δ ′ ⊢ ( ↑ ∘ σ ) [ ψ ] : Γ 0 ® ρ [ ↑ ] ∈ S b T \Delta' \vdash(\mathord{\uparrow}\circ\sigma)[\psi] : \Gamma_0 \mathbin{\circledR} \rho[\mathord{\uparrow}] \in Sb_T Δ ′ ⊢ ( ↑ ∘ σ ) [ ψ ] : Γ 0 ® ρ [ ↑ ] ∈ S b T
(by IH on the smaller derivation Γ 0 ↘ S b T \Gamma_0 \searrow Sb_T Γ 0 ↘ S b T )
( ↑ ∘ σ ) [ ψ ] = ↑ ∘ ( σ [ ψ ] ) (\mathord{\uparrow}\circ\sigma)[\psi] = \mathord{\uparrow}\circ(\sigma[\psi]) ( ↑ ∘ σ ) [ ψ ] = ↑ ∘ ( σ [ ψ ])
(by associativity of ∘ \circ ∘ , Theorem 2.29)
Δ ′ ⊢ S [ ↑ ∘ σ ] [ ψ ] : T y i ® P \Delta' \vdash S[\mathord{\uparrow}\circ\sigma][\psi] : Ty_i \mathbin{\circledR} P Δ ′ ⊢ S [ ↑ ∘ σ ] [ ψ ] : T y i ® P
(by Theorem 7.19 on the type predicate)
S [ ↑ ∘ σ ] [ ψ ] = S [ ↑ ∘ σ [ ψ ] ] S[\mathord{\uparrow}\circ\sigma][\psi] = S[\mathord{\uparrow}\circ\sigma[\psi]] S [ ↑ ∘ σ ] [ ψ ] = S [ ↑ ∘ σ [ ψ ]]
(by Theorem 2.22 and the previous identity)
Δ ′ ⊢ x 0 [ σ ] [ ψ ] : S [ ↑ ∘ σ ] [ ψ ] ® ρ ( x 0 ) ∈ E l \Delta' \vdash x_0[\sigma][\psi] : S[\mathord{\uparrow}\circ\sigma][\psi] \mathbin{\circledR} \rho(x_0) \in\mathrm{El} Δ ′ ⊢ x 0 [ σ ] [ ψ ] : S [ ↑ ∘ σ ] [ ψ ] ® ρ ( x 0 ) ∈ El
(by Theorem 7.19 on the head)
x 0 [ σ ] [ ψ ] = x 0 [ σ [ ψ ] ] x_0[\sigma][\psi] = x_0[\sigma[\psi]] x 0 [ σ ] [ ψ ] = x 0 [ σ [ ψ ]]
(by Theorem 2.22)
Δ ′ ⊢ x 0 [ σ [ ψ ] ] : S [ ↑ ∘ σ [ ψ ] ] ® ρ ( x 0 ) ∈ E l \Delta' \vdash x_0[\sigma[\psi]] : S[\mathord{\uparrow}\circ\sigma[\psi]] \mathbin{\circledR} \rho(x_0) \in\mathrm{El} Δ ′ ⊢ x 0 [ σ [ ψ ]] : S [ ↑ ∘ σ [ ψ ]] ® ρ ( x 0 ) ∈ El
(rewriting via the previous identities)
Δ ′ ⊢ σ [ ψ ] : Γ 0 , x : S ® ρ ∈ S b \Delta' \vdash\sigma[\psi] : \Gamma_0, x : S \mathbin{\circledR} \rho\in\mathrm{Sb} Δ ′ ⊢ σ [ ψ ] : Γ 0 , x : S ® ρ ∈ Sb
(by C o n s i \mathrm{Cons}_{i} Cons i assembly with the same a a a , P P P , E l \mathrm{El} El )
□
Lemma 7.21 (Gluing implies PER). If a ∈ U i ∗ ↘ P ↘ E l a \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El , then there exists R R R such that a ≈ a ∈ U i ↘ R a \approx a \in\mathcal{U}_i \searrow R a ≈ a ∈ U i ↘ R .
Proof. By induction on the derivation a ∈ U i ∗ a \in\mathcal{U}_i^* a ∈ U i ∗ .
Case
\frac{\begin{gathered}
\mathrm{G\mathchar`-Ne}\\
\uparrow^{A}(e) \in D
\end{gathered}}
{\uparrow^{A}(e) \in\mathcal{U}_i^*}
By U-Ne of Theorem 6.9: ↑ A ( e ) ≈ ↑ A ( e ) ∈ U i ↘ R \uparrow^{A}(e) \approx\uparrow^{A}(e) \in\mathcal{U}_i \searrow R ↑ A ( e ) ≈ ↑ A ( e ) ∈ U i ↘ R with R ⇔ N e u R \Leftrightarrow\mathrm{Neu} R ⇔ Neu , using e ≈ e ∈ N e e \approx e \in\mathrm{Ne} e ≈ e ∈ Ne from U i ∗ \mathcal{U}_i^* U i ∗ 's implicit assumption.
Case
\frac{\mathrm{G\mathchar`-Nat}}{N \in\mathcal{U}_i^*}
By U-Nat: N ≈ N ∈ U i ↘ R N \approx N \in\mathcal{U}_i \searrow R N ≈ N ∈ U i ↘ R with R ⇔ N a t R \Leftrightarrow\mathrm{Nat} R ⇔ Nat .
Case
\frac{\begin{gathered}
\mathrm{G\mathchar`-Univ}\\
j < i\\
U_j \in\mathcal{U}_i^*
\end{gathered}}{}
By U-Univ: U j ≈ U j ∈ U i ↘ R U_j \approx U_j \in\mathcal{U}_i \searrow R U j ≈ U j ∈ U i ↘ R with R ⇔ U j R \Leftrightarrow U_j R ⇔ U j .
Case
\frac{\begin{gathered}
\mathrm{G\mathchar`-Pi}\\
a \in\mathcal{U}_i^* \searrow P_I \searrow\mathrm{El}_I
\qquad
a \approx a \in\mathcal{U}_i \searrow R_I\\
\forall D :: b \approx b \in R_I,\ c.\ \llbracket T \rrbracket(\rho,b/x) \searrow c \Longrightarrow c \in\mathcal{U}_i^* \searrow P_O(D) \searrow\mathrm{El}_O(D)\\
\Pi(a,T,\rho) \approx\Pi(a,T,\rho) \in\mathcal{U}_i \searrow R\\
P \Leftrightarrow\Pi_i(R_I,P_I,\mathrm{El}_I,P_O)
\qquad
\mathrm{El} \Leftrightarrow\Pi_i(R,R_I,P_I,\mathrm{El}_I,\mathrm{El}_O)
\end{gathered}}
{\Pi(a,T,\rho) \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El}}
The PER witness R R R for Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i \Pi(a,T,\rho) \approx\Pi(a,T,\rho) \in\mathcal{U}_i Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i is packaged directly as a premise of G-Pi, hence is available immediately. □
Lemma 7.22 (Type-predicate syntactic escape). If a ∈ U i ∗ ↘ P ↘ E l a \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El and Γ ⊢ S : T y i ® P \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} P Γ ⊢ S : Ty i ® P , then Γ ⊢ S : T y i \Gamma\vdash S : \mathrm{Ty}_i Γ ⊢ S : Ty i .
Proof. By case analysis on a ∈ U i ∗ ↘ P ↘ E l a \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El .
Case
\frac{\begin{gathered}
\mathrm{G\mathchar`-Ne}\\
\uparrow^{A}(e) \in D
\qquad
P \Leftrightarrow\mathrm{Neu}_i^e
\qquad
\mathrm{El} \Leftrightarrow\mathrm{Neu}_i^e
\end{gathered}}
{\uparrow^{A}(e) \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El}}
Γ ⊢ S : T y i ® N e u i e (by hypothesis with P ⇔ N e u i e ) \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \mathrm{Neu}_i^e
\qquad\text{(by hypothesis with } P \Leftrightarrow\mathrm{Neu}_i^e\text{)} Γ ⊢ S : Ty i ® Neu i e (by hypothesis with P ⇔ Neu i e )
Γ ⊢ S : T y i (by Theorem 7.5 clause 1) \Gamma\vdash S : \mathrm{Ty}_i
\qquad\text{(by Theorem 7.5 clause 1)} Γ ⊢ S : Ty i (by Theorem 7.5 clause 1)
Case
G-Nat P ⇔ N a t i E l ⇔ N a t i N ∈ U i ∗ ∖ P ∖ E l Γ ⊢ S : T y i ® N a t i (by hypothesis) Γ ⊢ S ≈ N a t : T y i (by Theorem 7.7) Γ ⊢ S : T y i (by presupposition of judgmental equality) \begin{aligned}
&\text{G-Nat}\qquad P \Leftrightarrow\mathrm{Nat}_{i}\qquad\mathbf{El} \Leftrightarrow\mathrm{Nat}_{i}\\
&N \in\mathcal{U}_{i}^{*}\setminus P\setminus\mathbf{El}\\
&\Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\circledR} \mathrm{Nat}_{i} && \text{(by hypothesis)}\\
&\Gamma\vdash S \approx\mathrm{Nat} : \mathrm{Ty}_{i} && \text{(by Theorem 7.7)}\\
&\Gamma\vdash S : \mathrm{Ty}_{i} && \text{(by presupposition of judgmental equality)}
\end{aligned} G-Nat P ⇔ Nat i El ⇔ Nat i N ∈ U i ∗ ∖ P ∖ El Γ ⊢ S : Ty i ® Nat i Γ ⊢ S ≈ Nat : Ty i Γ ⊢ S : Ty i (by hypothesis) (by Theorem 7.7) (by presupposition of judgmental equality)
Case
G-Univ j < i P ⇔ U n i v i , j E l ⇔ U n i v i , j E l U j ∈ U i ∗ ∖ P ∖ E l Γ ⊢ S : T y i ® U n i v i , j (by hypothesis) Γ ⊢ S ≈ T y j : T y i (by Theorem 7.11) Γ ⊢ S : T y i (by presupposition of judgmental equality) \begin{aligned}
&\text{G-Univ}\qquad j < i\qquad P \Leftrightarrow\mathrm{Univ}_{i,j}\qquad\mathbf{El} \Leftrightarrow\mathrm{Univ}^{\mathbf{El}}_{i,j}\\
&U_{j} \in\mathcal{U}_{i}^{*}\setminus P\setminus\mathbf{El}\\
&\Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\circledR} \mathrm{Univ}_{i,j} && \text{(by hypothesis)}\\
&\Gamma\vdash S \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i} && \text{(by Theorem 7.11)}\\
&\Gamma\vdash S : \mathrm{Ty}_{i} && \text{(by presupposition of judgmental equality)}
\end{aligned} G-Univ j < i P ⇔ Univ i , j El ⇔ Univ i , j El U j ∈ U i ∗ ∖ P ∖ El Γ ⊢ S : Ty i ® Univ i , j Γ ⊢ S ≈ Ty j : Ty i Γ ⊢ S : Ty i (by hypothesis) (by Theorem 7.11) (by presupposition of judgmental equality)
Case
G-Pi P ⇔ Π i ( R I , P I , E l I , P O ) E l ⇔ Π i E l ( R , R I , P I , E l I , E l O ) Π ( a I , T , ρ ) ∈ U i ∗ ∖ P ∖ E l Γ ⊢ S : T y i ® Π i ( R I , P I , E l I , P O ) (by hypothesis) ∃ S 1 , S 2 . Γ ⊢ S ≈ Π ( x : S 1 ) . S 2 : T y i (by Theorem 7.9 clause 1) Γ ⊢ S : T y i (by presupposition of judgmental equality) \begin{aligned}
&\text{G-Pi}\qquad P \Leftrightarrow\Pi_{i}(R_{I},P_{I},\mathbf{El}_{I},P_{O})\qquad\mathbf{El} \Leftrightarrow\Pi^{\mathbf{El}}_{i}(R,R_{I},P_{I},\mathbf{El}_{I},\mathbf{El}_{O})\\
&\Pi(a_{I},T,\rho) \in\mathcal{U}_{i}^{*}\setminus P\setminus\mathbf{El}\\
&\Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\circledR} \Pi_{i}(R_{I},P_{I},\mathbf{El}_{I},P_{O}) && \text{(by hypothesis)}\\
&\exists S_{1},S_{2}.\ \Gamma\vdash S \approx\Pi(x:S_{1}).S_{2} : \mathrm{Ty}_{i} && \text{(by Theorem 7.9 clause 1)}\\
&\Gamma\vdash S : \mathrm{Ty}_{i} && \text{(by presupposition of judgmental equality)}
\end{aligned} G-Pi P ⇔ Π i ( R I , P I , El I , P O ) El ⇔ Π i El ( R , R I , P I , El I , El O ) Π ( a I , T , ρ ) ∈ U i ∗ ∖ P ∖ El Γ ⊢ S : Ty i ® Π i ( R I , P I , El I , P O ) ∃ S 1 , S 2 . Γ ⊢ S ≈ Π ( x : S 1 ) . S 2 : Ty i Γ ⊢ S : Ty i (by hypothesis) (by Theorem 7.9 clause 1) (by presupposition of judgmental equality)
Lemma 7.23 (Term-predicate syntactic escape). If a ∈ U i ∗ ∖ P ∖ E l a \in\mathcal{U}_{i}^{*}\setminus P\setminus\mathbf{El} a ∈ U i ∗ ∖ P ∖ El and Γ ⊢ t : S ® b ∈ E l \Gamma\vdash t : S \mathrel{\circledR} b \in\mathbf{El} Γ ⊢ t : S ® b ∈ El , then Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S and Γ ⊢ S : T y i ® P \Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\circledR} P Γ ⊢ S : Ty i ® P .
Proof. By case analysis on a ∈ U i ∗ ∖ P ∖ E l a \in\mathcal{U}_{i}^{*}\setminus P\setminus\mathbf{El} a ∈ U i ∗ ∖ P ∖ El .
Case
G-Ne ↑ A ( e ) ∈ D P ⇔ N e u i e E l ⇔ N e u i e ↑ A ( e ) ∈ U i ∗ ∖ P ∖ E l Γ ⊢ t : S ® b ∈ N e u i e (by hypothesis) Γ ⊢ S : T y i ® N e u i e (by Theorem 7.6 clause 1) Γ ⊢ t : S (by Theorem 7.6 clause 2) \begin{aligned}
&\text{G-Ne}\qquad\uparrow^{A}(e) \in D\qquad P \Leftrightarrow\mathrm{Neu}_{i}^{e}\qquad\mathbf{El} \Leftrightarrow\mathrm{Neu}_{i}^{e}\\
&\uparrow^{A}(e) \in\mathcal{U}_{i}^{*}\setminus P\setminus\mathbf{El}\\
&\Gamma\vdash t : S \mathrel{\circledR} b \in\mathrm{Neu}_{i}^{e} && \text{(by hypothesis)}\\
&\Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\circledR} \mathrm{Neu}_{i}^{e} && \text{(by Theorem 7.6 clause 1)}\\
&\Gamma\vdash t : S && \text{(by Theorem 7.6 clause 2)}
\end{aligned} G-Ne ↑ A ( e ) ∈ D P ⇔ Neu i e El ⇔ Neu i e ↑ A ( e ) ∈ U i ∗ ∖ P ∖ El Γ ⊢ t : S ® b ∈ Neu i e Γ ⊢ S : Ty i ® Neu i e Γ ⊢ t : S (by hypothesis) (by Theorem 7.6 clause 1) (by Theorem 7.6 clause 2)
Case
G-Nat P ⇔ N a t i E l ⇔ N a t i N ∈ U i ∗ ∖ P ∖ E l \begin{aligned}
&\text{G-Nat}\qquad P \Leftrightarrow\mathrm{Nat}_{i}\qquad\mathbf{El} \Leftrightarrow\mathrm{Nat}_{i}\\
&N \in\mathcal{U}_{i}^{*}\setminus P\setminus\mathbf{El}
\end{aligned} G-Nat P ⇔ Nat i El ⇔ Nat i N ∈ U i ∗ ∖ P ∖ El
Γ ⊢ t : S ® b ∈ N a t i (by hypothesis) \Gamma\vdash t : S \mathrel{\circledR} b \in\mathrm{Nat}_{i}
\qquad\text{(by hypothesis)} Γ ⊢ t : S ® b ∈ Nat i (by hypothesis)
Γ ⊢ S : T y i ® N a t i (by Theorem 7.8) \Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\circledR} \mathrm{Nat}_{i}
\qquad\text{(by Theorem 7.8)} Γ ⊢ S : Ty i ® Nat i (by Theorem 7.8)
By inner induction on the Nat-derivation at b b b :
Sub-case
Γ ⊢ t ≈ z e r o : S Γ ⊢ t : S ® z e ∈ N a t GN-Ze \frac{\Gamma\vdash t \approx\mathrm{zero} : S}{\Gamma\vdash t : S \mathrel{\circledR} \mathrm{ze} \in\mathrm{Nat}}
\quad\text{GN-Ze} Γ ⊢ t : S ® ze ∈ Nat Γ ⊢ t ≈ zero : S GN-Ze
Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S by presupposition of Γ ⊢ t ≈ z e r o : S \Gamma\vdash t \approx\mathrm{zero} : S Γ ⊢ t ≈ zero : S .
Sub-case
Γ ⊢ t ′ : S ® b ′ ∈ N a t Γ ⊢ t ≈ s u c c t ′ : S Γ ⊢ t : S ® s u ( b ′ ) ∈ N a t GN-Su \frac{\Gamma\vdash t' : S \mathrel{\circledR} b' \in\mathrm{Nat}
\qquad
\Gamma\vdash t \approx\mathrm{succ}\ t' : S}
{\Gamma\vdash t : S \mathrel{\circledR} \mathrm{su}(b') \in\mathrm{Nat}}
\quad\text{GN-Su} Γ ⊢ t : S ® su ( b ′ ) ∈ Nat Γ ⊢ t ′ : S ® b ′ ∈ Nat Γ ⊢ t ≈ succ t ′ : S GN-Su
Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S by presupposition of Γ ⊢ t ≈ s u c c t ′ : S \Gamma\vdash t \approx\mathrm{succ}\ t' : S Γ ⊢ t ≈ succ t ′ : S .
Sub-case
Γ ⊢ t : S ® ↑ N ( w ) ∈ N e u i e Γ ⊢ t : S ® ↑ N ( w ) ∈ N a t GN-Ne \frac{\Gamma\vdash t : S \mathrel{\circledR} \uparrow^{N}(w) \in\mathrm{Neu}^{e}_{i}}
{\Gamma\vdash t : S \mathrel{\circledR} \uparrow^{N}(w) \in\mathrm{Nat}}
\quad\text{GN-Ne} Γ ⊢ t : S ® ↑ N ( w ) ∈ Nat Γ ⊢ t : S ® ↑ N ( w ) ∈ Neu i e GN-Ne
Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S by G-Ne case (just proved) on the neutral premise.
Case
j < i P ⇔ U n i v i , j E l ⇔ U n i v i , j E l U j ∈ U i ∗ ↘ P ↘ E l G-Univ \frac{
\begin{gathered}
j < i \qquad P \Leftrightarrow\mathrm{Univ}_{i,j} \qquad\mathrm{El} \Leftrightarrow\mathrm{Univ}^{\mathrm{El}}_{i,j}\\
U_j \in\mathcal{U}^{*}_{i}\mathbin{\searrow}P\mathbin{\searrow}\mathrm{El}
\end{gathered}
}{\text{G-Univ}} G-Univ j < i P ⇔ Univ i , j El ⇔ Univ i , j El U j ∈ U i ∗ ↘ P ↘ El
Γ ⊢ t : S ® b ∈ U n i v i , j E l (by hypothesis) Γ ⊢ S : T y i ® U n i v i , j (by Theorem 7.12 clause 1) Γ ⊢ t : T y j ® P b (by Theorem 7.12 clause 2) Γ ⊢ t : T y j (by Theorem 7.22 on the previous line at level j ) Γ ⊢ S ≈ T y j : T y i (by Theorem 7.11) Γ ⊢ T y j ⊆ S (by Sub-Eq from the symmetric equality) Γ ⊢ t : S (by Subsump) \begin{aligned}
\Gamma\vdash t : S \mathrel{\circledR} b \in\mathrm{Univ}^{\mathrm{El}}_{i,j}
&\qquad\text{(by hypothesis)}\\
\Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\circledR} \mathrm{Univ}_{i,j}
&\qquad\text{(by Theorem 7.12 clause 1)}\\
\Gamma\vdash t : \mathrm{Ty}_{j} \mathrel{\circledR} P_b
&\qquad\text{(by Theorem 7.12 clause 2)}\\
\Gamma\vdash t : \mathrm{Ty}_{j}
&\qquad\text{(by Theorem 7.22 on the previous line at level }j\text{)}\\
\Gamma\vdash S \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i}
&\qquad\text{(by Theorem 7.11)}\\
\Gamma\vdash\mathrm{Ty}_{j} \subseteq S
&\qquad\text{(by Sub-Eq from the symmetric equality)}\\
\Gamma\vdash t : S
&\qquad\text{(by Subsump)}
\end{aligned} Γ ⊢ t : S ® b ∈ Univ i , j El Γ ⊢ S : Ty i ® Univ i , j Γ ⊢ t : Ty j ® P b Γ ⊢ t : Ty j Γ ⊢ S ≈ Ty j : Ty i Γ ⊢ Ty j ⊆ S Γ ⊢ t : S (by hypothesis) (by Theorem 7.12 clause 1) (by Theorem 7.12 clause 2) (by Theorem 7.22 on the previous line at level j ) (by Theorem 7.11) (by Sub-Eq from the symmetric equality) (by Subsump)
Case
P ⇔ Π i ( R I , P I , E l I , P O ) E l ⇔ Π i E l ( R , R I , P I , E l I , E l O ) Π ( a I , T , ρ ) ∈ U i ∗ ↘ P ↘ E l G-Pi \frac{
\begin{gathered}
P \Leftrightarrow\Pi_{i}(R_{I},P_{I},\mathrm{El}_{I},P_{O})
\qquad
\mathrm{El} \Leftrightarrow\Pi^{\mathrm{El}}_{i}(R,R_{I},P_{I},\mathrm{El}_{I},\mathrm{El}_{O})\\
\Pi(a_{I},T,\rho)\in\mathcal{U}^{*}_{i}\mathbin{\searrow}P\mathbin{\searrow}\mathrm{El}
\end{gathered}
}{\text{G-Pi}} G-Pi P ⇔ Π i ( R I , P I , El I , P O ) El ⇔ Π i El ( R , R I , P I , El I , El O ) Π ( a I , T , ρ ) ∈ U i ∗ ↘ P ↘ El
Γ ⊢ t : S ® b ∈ Π i E l (by hypothesis) Γ ⊢ t : S (by Theorem 7.10 clause 2) Γ ⊢ S : T y i ® Π i (by Theorem 7.10 clause 3) \begin{aligned}
\Gamma\vdash t : S \mathrel{\circledR} b \in\Pi^{\mathrm{El}}_{i}
&\qquad\text{(by hypothesis)}\\
\Gamma\vdash t : S
&\qquad\text{(by Theorem 7.10 clause 2)}\\
\Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\circledR} \Pi_{i}
&\qquad\text{(by Theorem 7.10 clause 3)}
\end{aligned} Γ ⊢ t : S ® b ∈ Π i El Γ ⊢ t : S Γ ⊢ S : Ty i ® Π i (by hypothesis) (by Theorem 7.10 clause 2) (by Theorem 7.10 clause 3)
Lemma 7.24 (Functionality of U i ∗ U_i^* U i ∗ ). If a ∈ U i ∗ ↘ P 1 ↘ E l 1 a \in U_i^* \searrow P_1 \searrow\mathbf{El}_1 a ∈ U i ∗ ↘ P 1 ↘ El 1 and a ∈ U i ∗ ↘ P 2 ↘ E l 2 a \in U_i^* \searrow P_2 \searrow\mathbf{El}_2 a ∈ U i ∗ ↘ P 2 ↘ El 2 , then P 1 ⇔ P 2 P_1 \Leftrightarrow P_2 P 1 ⇔ P 2 and E l 1 ⇔ E l 2 \mathbf{El}_1 \Leftrightarrow\mathbf{El}_2 El 1 ⇔ El 2 .
Proof. By induction on the first derivation a ∈ U i ∗ a \in U_i^* a ∈ U i ∗ , with case analysis on the second (which must end with the same rule, since each rule’s conclusion form determines a a a syntactically).
Case
G-Ne ↑ A ( e ) ∈ D P ⇔ Neu i e E l ⇔ Neu i e ↑ A ( e ) ∈ U i ∗ ↘ P ↘ E l \frac{
\begin{gathered}
\text{G-Ne}\\
\uparrow^A(e) \in D \qquad P \Leftrightarrow\operatorname{Neu}_i^e \qquad\mathbf{El} \Leftrightarrow\operatorname{Neu}_i^e
\end{gathered}
}{
\uparrow^A(e) \in U_i^* \searrow P \searrow\mathbf{El}
} ↑ A ( e ) ∈ U i ∗ ↘ P ↘ El G-Ne ↑ A ( e ) ∈ D P ⇔ Neu i e El ⇔ Neu i e
P 1 ⇔ Neu i e P_1 \Leftrightarrow\operatorname{Neu}_i^e P 1 ⇔ Neu i e \hfill (by G-Ne on the first derivation)
P 2 ⇔ Neu i e P_2 \Leftrightarrow\operatorname{Neu}_i^e P 2 ⇔ Neu i e \hfill (by G-Ne on the second derivation)
P 1 ⇔ P 2 P_1 \Leftrightarrow P_2 P 1 ⇔ P 2 \hfill (transitivity)
E l 1 ⇔ Neu i e ⇔ E l 2 \mathbf{El}_1 \Leftrightarrow\operatorname{Neu}_i^e \Leftrightarrow\mathbf{El}_2 El 1 ⇔ Neu i e ⇔ El 2 \hfill (symmetrically)
Case
G-Nat P ⇔ Nat i E l ⇔ Nat i N ∈ U i ∗ ↘ P ↘ E l \frac{
\begin{gathered}
\text{G-Nat}\\
P \Leftrightarrow\operatorname{Nat}_i \qquad\mathbf{El} \Leftrightarrow\operatorname{Nat}_i
\end{gathered}
}{
N \in U_i^* \searrow P \searrow\mathbf{El}
} N ∈ U i ∗ ↘ P ↘ El G-Nat P ⇔ Nat i El ⇔ Nat i
P 1 ⇔ Nat i ⇔ P 2 , E l 1 ⇔ Nat i ⇔ E l 2 P_1 \Leftrightarrow\operatorname{Nat}_i \Leftrightarrow P_2,\quad\mathbf{El}_1 \Leftrightarrow\operatorname{Nat}_i \Leftrightarrow\mathbf{El}_2 P 1 ⇔ Nat i ⇔ P 2 , El 1 ⇔ Nat i ⇔ El 2 \hfill (by G-Nat on both derivations)
Case
G-Univ j < i P ⇔ Univ i , j E l ⇔ Univ i , j E l U j ∈ U i ∗ ↘ P ↘ E l \frac{
\begin{gathered}
\text{G-Univ}\\
j < i \qquad P \Leftrightarrow\operatorname{Univ}_{i,j} \qquad\mathbf{El} \Leftrightarrow\operatorname{Univ}_{i,j}^{\mathbf{El}}
\end{gathered}
}{
U_j \in U_i^* \searrow P \searrow\mathbf{El}
} U j ∈ U i ∗ ↘ P ↘ El G-Univ j < i P ⇔ Univ i , j El ⇔ Univ i , j El
Both derivations fix the same j < i j < i j < i , so P 1 ⇔ Univ i , j ⇔ P 2 P_1 \Leftrightarrow\operatorname{Univ}_{i,j} \Leftrightarrow P_2 P 1 ⇔ Univ i , j ⇔ P 2 and E l 1 ⇔ Univ i , j E l ⇔ E l 2 \mathbf{El}_1 \Leftrightarrow\operatorname{Univ}_{i,j}^{\mathbf{El}} \Leftrightarrow\mathbf{El}_2 El 1 ⇔ Univ i , j El ⇔ El 2 .
Case
G-Pi a ∈ U i ∗ ↘ P I ↘ E l I a ≈ a ∈ U i ↘ R I ∀ D : : b ≈ b ∈ R I , c . ⟦ T ⟧ ( ρ , b / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R P ⇔ Π i ( R I , P I , E l I , P O ) E l ⇔ Π i E l ( R , R I , P I , E l I , E l O ) Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ E l \frac{
\begin{gathered}
\text{G-Pi}\\
a \in U_i^* \searrow P_I \searrow\mathbf{El}_I
\qquad
a \approx a \in U_i \searrow R_I\\
\forall D :: b \approx b \in R_I,\ c.\ \llbracket T \rrbracket(\rho,b/x) \searrow c \Longrightarrow c \in U_i^* \searrow P_O(D) \searrow\mathbf{El}_O(D)\\
\Pi(a,T,\rho) \approx\Pi(a,T,\rho) \in U_i \searrow R\\
P \Leftrightarrow\Pi_i(R_I,P_I,\mathbf{El}_I,P_O)
\qquad
\mathbf{El} \Leftrightarrow\Pi_i^{\mathbf{El}}(R,R_I,P_I,\mathbf{El}_I,\mathbf{El}_O)
\end{gathered}
}{
\Pi(a,T,\rho) \in U_i^* \searrow P \searrow\mathbf{El}
} Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ El G-Pi a ∈ U i ∗ ↘ P I ↘ El I a ≈ a ∈ U i ↘ R I ∀ D :: b ≈ b ∈ R I , c . [ [ T ] ] ( ρ , b / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R P ⇔ Π i ( R I , P I , El I , P O ) El ⇔ Π i El ( R , R I , P I , El I , El O )
Let the two derivations have inner data ( P I ( 1 ) , E l I ( 1 ) , R I ( 1 ) , P O ( 1 ) , E l O ( 1 ) , R ( 1 ) ) (P_I^{(1)},\mathbf{El}_I^{(1)},R_I^{(1)},P_O^{(1)},\mathbf{El}_O^{(1)},R^{(1)}) ( P I ( 1 ) , El I ( 1 ) , R I ( 1 ) , P O ( 1 ) , El O ( 1 ) , R ( 1 ) ) and ( P I ( 2 ) , … ) (P_I^{(2)},\ldots) ( P I ( 2 ) , … ) respectively.
P I ( 1 ) ⇔ P I ( 2 ) , E l I ( 1 ) ⇔ E l I ( 2 ) P_I^{(1)} \Leftrightarrow P_I^{(2)},\quad\mathbf{El}_I^{(1)} \Leftrightarrow\mathbf{El}_I^{(2)} P I ( 1 ) ⇔ P I ( 2 ) , El I ( 1 ) ⇔ El I ( 2 ) \hfill (by IH on the inner a ∈ U i ∗ a \in U_i^* a ∈ U i ∗ )
R I ( 1 ) ⇔ R I ( 2 ) , R ( 1 ) ⇔ R ( 2 ) R_I^{(1)} \Leftrightarrow R_I^{(2)},\quad R^{(1)} \Leftrightarrow R^{(2)} R I ( 1 ) ⇔ R I ( 2 ) , R ( 1 ) ⇔ R ( 2 ) \hfill (by Theorem 6.12 on the inner U i U_i U i judgments)
∀ D . P O ( 1 ) ( D ) ⇔ P O ( 2 ) ( D ) , E l O ( 1 ) ( D ) ⇔ E l O ( 2 ) ( D ) \forall D.\ P_O^{(1)}(D) \Leftrightarrow P_O^{(2)}(D),\ \mathbf{El}_O^{(1)}(D) \Leftrightarrow\mathbf{El}_O^{(2)}(D) ∀ D . P O ( 1 ) ( D ) ⇔ P O ( 2 ) ( D ) , El O ( 1 ) ( D ) ⇔ El O ( 2 ) ( D ) \hfill (by IH on the codomain fibers, pointwise in D D D )
P 1 ⇔ Π i ( R I ( 1 ) , P I ( 1 ) , E l I ( 1 ) , P O ( 1 ) ) ⇔ Π i ( R I ( 2 ) , P I ( 2 ) , E l I ( 2 ) , P O ( 2 ) ) P_1 \Leftrightarrow\Pi_i(R_I^{(1)},P_I^{(1)},\mathbf{El}_I^{(1)},P_O^{(1)}) \Leftrightarrow\Pi_i(R_I^{(2)},P_I^{(2)},\mathbf{El}_I^{(2)},P_O^{(2)}) P 1 ⇔ Π i ( R I ( 1 ) , P I ( 1 ) , El I ( 1 ) , P O ( 1 ) ) ⇔ Π i ( R I ( 2 ) , P I ( 2 ) , El I ( 2 ) , P O ( 2 ) )
⇔ P 2 \Leftrightarrow P_2 ⇔ P 2 \hfill (by congruence of Π i \Pi_i Π i )
E l 1 ⇔ Π i E l ( … ) ⇔ E l 2 \mathbf{El}_1 \Leftrightarrow\Pi_i^{\mathbf{El}}(\ldots) \Leftrightarrow\mathbf{El}_2 El 1 ⇔ Π i El ( … ) ⇔ El 2 \hfill (symmetrically)
Lemma 7.25 (Cumulativity of U i ∗ U_i^* U i ∗ (subrelation)). Suppose i ≤ j i \leq j i ≤ j , a ∈ U i ∗ ↘ P ↘ E l a \in U_i^* \searrow P \searrow El a ∈ U i ∗ ↘ P ↘ E l , and a ∈ U j ∗ ↘ P ′ ↘ E l ′ a \in U_j^* \searrow P' \searrow El' a ∈ U j ∗ ↘ P ′ ↘ E l ′ . Then:
Type-predicate raising: If Γ ⊢ S : T y i ⊚ P \Gamma\vdash S : \mathrm{Ty}_i \mathrel{\circledcirc} P Γ ⊢ S : Ty i ⊚ P , then Γ ⊢ S : T y j ⊚ P ′ \Gamma\vdash S : \mathrm{Ty}_j \mathrel{\circledcirc} P' Γ ⊢ S : Ty j ⊚ P ′ .
Term-predicate raising: If Γ ⊢ t : S ⊚ b ∈ E l \Gamma\vdash t : S \mathrel{\circledcirc} b \in El Γ ⊢ t : S ⊚ b ∈ E l , then Γ ⊢ t : S ⊚ b ∈ E l ′ \Gamma\vdash t : S \mathrel{\circledcirc} b \in El' Γ ⊢ t : S ⊚ b ∈ E l ′ .
Term-predicate lowering (under type-predicate at level i i i ): If Γ ⊢ S : T y i ⊚ P \Gamma\vdash S : \mathrm{Ty}_i \mathrel{\circledcirc} P Γ ⊢ S : Ty i ⊚ P and Γ ⊢ t : S ⊚ b ∈ E l ′ \Gamma\vdash t : S \mathrel{\circledcirc} b \in El' Γ ⊢ t : S ⊚ b ∈ E l ′ , then Γ ⊢ t : S ⊚ b ∈ E l \Gamma\vdash t : S \mathrel{\circledcirc} b \in El Γ ⊢ t : S ⊚ b ∈ E l .
Existence of P ′ P' P ′ , E l ′ El' E l ′ at level j j j follows from re-applying the gluing rules at level j j j to the same data.
Proof. Since the gluing rules at level i i i and level j j j agree on the syntactic shape of a a a , the second derivation a ∈ U j ∗ ↘ P ′ ↘ E l ′ a \in U_j^* \searrow P' \searrow El' a ∈ U j ∗ ↘ P ′ ↘ E l ′ must end with the same rule (G-Ne, G-Nat, G-Univ, or G-Pi) as the first. We proceed by induction on a ∈ U i ∗ ↘ P ↘ E l a \in U_i^* \searrow P \searrow El a ∈ U i ∗ ↘ P ↘ E l , with sub-case-analysis on the rule shared by the two derivations.
Case
G-Ne ↑ A ( e ) ∈ D P ⟺ N e u i e E l ⟺ N e u i e ↑ A ( e ) ∈ U i ∗ ↘ P ↘ E l \frac{\begin{array}{c}
\text{G-Ne}\\
\uparrow^{\!A}(e) \in D \qquad P \Longleftrightarrow\mathrm{Neu}^{e}_{i} \qquad El \Longleftrightarrow\mathrm{Neu}^{e}_{i}
\end{array}}
{\uparrow^{\!A}(e) \in U_i^* \searrow P \searrow El} ↑ A ( e ) ∈ U i ∗ ↘ P ↘ E l G-Ne ↑ A ( e ) ∈ D P ⟺ Neu i e E l ⟺ Neu i e
Then P ′ ⟺ N e u j e P' \Longleftrightarrow\mathrm{Neu}^{e}_{j} P ′ ⟺ Neu j e and E l ′ ⟺ N e u j e El' \Longleftrightarrow\mathrm{Neu}^{e}_{j} E l ′ ⟺ Neu j e . But N e u ∗ e \mathrm{Neu}^{e}_{*} Neu ∗ e does not depend on the index (Theorems 7.5 and 7.6), so P ⟺ P ′ P \Longleftrightarrow P' P ⟺ P ′ and E l ⟺ E l ′ El \Longleftrightarrow El' E l ⟺ E l ′ . All three claims (1)–(3) hold trivially.
Case
G-Nat P ⟺ N a t i E l ⟺ N a t i N ∈ U i ∗ ↘ P ↘ E l \frac{\begin{array}{c}
\text{G-Nat}\\
P \Longleftrightarrow\mathrm{Nat}_{i} \qquad El \Longleftrightarrow\mathrm{Nat}_{i}
\end{array}}
{N \in U_i^* \searrow P \searrow El} N ∈ U i ∗ ↘ P ↘ E l G-Nat P ⟺ Nat i E l ⟺ Nat i
Then P ′ ⟺ N a t j P' \Longleftrightarrow\mathrm{Nat}_{j} P ′ ⟺ Nat j and E l ′ ⟺ N a t j El' \Longleftrightarrow\mathrm{Nat}_{j} E l ′ ⟺ Nat j .
Type-predicate raising (1): given Γ ⊢ S : T y i ⊚ N a t i \Gamma\vdash S : \mathrm{Ty}_i \mathrel{\circledcirc} \mathrm{Nat}_i Γ ⊢ S : Ty i ⊚ Nat i :
Γ ⊢ S ≈ N a t : T y i (by Theorem 7.7) Γ ⊢ S ≈ N a t : T y j (by cumulativity of universes, i ≤ j , Sec. 3) Γ ⊢ S : T y j ⊚ N a t j (by Theorem 7.7 at level j ) \begin{aligned}
\Gamma&\vdash S \approx\mathrm{Nat} : \mathrm{Ty}_i && \text{(by Theorem 7.7)}\\
\Gamma&\vdash S \approx\mathrm{Nat} : \mathrm{Ty}_j && \text{(by cumulativity of universes, }i \leq j\text{, Sec. 3)}\\
\Gamma&\vdash S : \mathrm{Ty}_j \mathrel{\circledcirc} \mathrm{Nat}_j && \text{(by Theorem 7.7 at level }j\text{)}
\end{aligned} Γ Γ Γ ⊢ S ≈ Nat : Ty i ⊢ S ≈ Nat : Ty j ⊢ S : Ty j ⊚ Nat j (by Theorem 7.7) (by cumulativity of universes, i ≤ j , Sec. 3) (by Theorem 7.7 at level j )
Term-predicate raising (2): given Γ ⊢ t : S ⊚ b ∈ N a t i \Gamma\vdash t : S \mathrel{\circledcirc} b \in\mathrm{Nat}_i Γ ⊢ t : S ⊚ b ∈ Nat i , by inner induction on the Nat-derivation at b b b . Each sub-case (GN-Ze, GN-Su, GN-Ne) constructs the same derivation at level j j j , since the constructors Nat, zero, succ and the neutral predicate N e u ∗ e \mathrm{Neu}^{e}_{*} Neu ∗ e are level-independent. The type-predicate part upgrades via (1).
Term-predicate lowering (3): given Γ ⊢ S : T y i ⊚ N a t i \Gamma\vdash S : \mathrm{Ty}_i \mathrel{\circledcirc} \mathrm{Nat}_i Γ ⊢ S : Ty i ⊚ Nat i and Γ ⊢ t : S ⊚ b ∈ N a t j \Gamma\vdash t : S \mathrel{\circledcirc} b \in\mathrm{Nat}_j Γ ⊢ t : S ⊚ b ∈ Nat j . By inner induction on the Nat-derivation at b b b (level-j j j ); each sub-case re-uses the level-independent constructors and re-derives the Nat-predicate at level i i i , with the type-predicate part already provided by hypothesis.
Case
G-Univ k < i P ⟺ U n i v i , k E l ⟺ U n i v i , k E l U k ∈ U i ∗ ↘ P ↘ E l \frac{\begin{array}{c}
\text{G-Univ}\\
k < i \qquad P \Longleftrightarrow\mathrm{Univ}_{i,k} \qquad El \Longleftrightarrow\mathrm{Univ}^{El}_{i,k}
\end{array}}
{U_k \in U_i^* \searrow P \searrow El} U k ∈ U i ∗ ↘ P ↘ E l G-Univ k < i P ⟺ Univ i , k E l ⟺ Univ i , k E l
Then k < j k < j k < j (from k < i ≤ j k < i \leq j k < i ≤ j ), P ′ ⟺ U n i v j , k P' \Longleftrightarrow\mathrm{Univ}_{j,k} P ′ ⟺ Univ j , k , E l ′ ⟺ U n i v j , k E l El' \Longleftrightarrow\mathrm{Univ}^{El}_{j,k} E l ′ ⟺ Univ j , k E l .
Type-predicate raising (1):
Γ ⊢ S ≈ T y k : T y i (by Theorem 7.11 on U n i v i , k ) \Gamma\vdash S \approx\mathrm{Ty}_k : \mathrm{Ty}_i \qquad\text{(by Theorem 7.11 on }\mathrm{Univ}_{i,k}\text{)} Γ ⊢ S ≈ Ty k : Ty i (by Theorem 7.11 on Univ i , k )
Γ ⊢ S ≈ T y k : T y j \Gamma\vdash S \approx\mathrm{Ty}_k : \mathrm{Ty}_j Γ ⊢ S ≈ Ty k : Ty j
(by cumulativity of universes, i ≤ j i \le j i ≤ j , Sec. 3)
Γ ⊢ S : T y j ® U n i v j , k \Gamma\vdash S : \mathrm{Ty}_j \mathrel{\circledR} \mathrm{Univ}_{j,k} Γ ⊢ S : Ty j ® Univ j , k
(by Theorem 7.11 at level j j j )
Term-predicate raising (2): the conditions b ∈ U k ∗ ↘ P b ↘ E l b b \in\mathcal{U}_k^* \searrow P_b \searrow\mathrm{El}_b b ∈ U k ∗ ↘ P b ↘ El b and Γ ⊢ t : T y k ® P b \Gamma\vdash t : \mathrm{Ty}_k \mathrel{\circledR} P_b Γ ⊢ t : Ty k ® P b at level k k k are unchanged; the type-predicate part upgrades via (1).
Term-predicate lowering (3): given Γ ⊢ S : T y i ® U n i v i , k \Gamma\vdash S : \mathrm{Ty}_i \mathrel{\circledR} \mathrm{Univ}_{i,k} Γ ⊢ S : Ty i ® Univ i , k and Γ ⊢ t : S ® b ∈ U n i v j , k E l \Gamma\vdash t : S \mathrel{\circledR} b \in\mathrm{Univ}^{\mathrm{El}}_{j,k} Γ ⊢ t : S ® b ∈ Univ j , k El . The conditions at level k k k (b ∈ U k ∗ ↘ P b ↘ E l b b \in\mathcal{U}_k^* \searrow P_b \searrow\mathrm{El}_b b ∈ U k ∗ ↘ P b ↘ El b and Γ ⊢ t : T y k ® P b \Gamma\vdash t : \mathrm{Ty}_k \mathrel{\circledR} P_b Γ ⊢ t : Ty k ® P b ) are level-k k k data, unchanged; the type-predicate at level i i i is provided by hypothesis. Hence Γ ⊢ t : S ® b ∈ U n i v i , k E l \Gamma\vdash t : S \mathrel{\circledR} b \in\mathrm{Univ}^{\mathrm{El}}_{i,k} Γ ⊢ t : S ® b ∈ Univ i , k El via Theorem 7.12.
Case
G-Pi
a ∈ U i ∗ ↘ P I ↘ E l I a ≈ a ∈ U i ↘ R I ∀ D : : b ≈ b ∈ R I , c . ⟦ T ⟧ ( ρ , b / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R P ⟺ Π i ( R I , P I , E l I , P O ) E l ⟺ Π i E l ( R , R I , P I , E l I , E l O ) Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ E l \begin{aligned}
a &\in\mathcal{U}_i^* \searrow P_I \searrow\mathrm{El}_I
& a &\approx a \in\mathcal{U}_i \searrow R_I \\
\forall\mathcal{D} :: b &\approx b \in R_I,\ c.\ \llbracket T \rrbracket(\rho,b/x) \searrow c
&\Longrightarrow c &\in\mathcal{U}_i^* \searrow P_O(\mathcal{D}) \searrow\mathrm{El}_O(\mathcal{D}) \\
\Pi(a,T,\rho) &\approx\Pi(a,T,\rho) \in\mathcal{U}_i \searrow R \\
P &\Longleftrightarrow\Pi_i(R_I,P_I,\mathrm{El}_I,P_O)
&\mathrm{El} &\Longleftrightarrow\Pi_i^{\mathrm{El}}(R,R_I,P_I,\mathrm{El}_I,\mathrm{El}_O) \\
\Pi(a,T,\rho) &\in\mathcal{U}_i^* \searrow P \searrow\mathrm{El}
\end{aligned} a ∀ D :: b Π ( a , T , ρ ) P Π ( a , T , ρ ) ∈ U i ∗ ↘ P I ↘ El I ≈ b ∈ R I , c . [ [ T ] ] ( ρ , b / x ) ↘ c ≈ Π ( a , T , ρ ) ∈ U i ↘ R ⟺ Π i ( R I , P I , El I , P O ) ∈ U i ∗ ↘ P ↘ El a ⟹ c El ≈ a ∈ U i ↘ R I ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) ⟺ Π i El ( R , R I , P I , El I , El O )
By inversion on the level-j j j derivation (which must end with G-Pi by the syntactic shape of Π ( a , T , ρ ) \Pi(a,T,\rho) Π ( a , T , ρ ) ):
a ∈ U j ∗ ↘ P I ′ ↘ E l I ′ (level- j -inner data) a \in\mathcal{U}_j^* \searrow P'_I \searrow\mathrm{El}'_I
\qquad\text{(level-}j\text{-inner data)} a ∈ U j ∗ ↘ P I ′ ↘ El I ′ (level- j -inner data)
a ≈ a ∈ U j ↘ R I (by Theorem 6.10; same R I as level i ) a \approx a \in\mathcal{U}_j \searrow R_I
\qquad\text{(by Theorem 6.10; same }R_I\text{ as level }i\text{)} a ≈ a ∈ U j ↘ R I (by Theorem 6.10; same R I as level i )
∀ D , c . ⟦ T ⟧ ( ρ , b / x ) ↘ c ⟹ c ∈ U j ∗ ↘ P O ′ ( D ) ↘ E l O ′ ( D ) (level- j -codomain fibers) \forall\mathcal{D},c.\ \llbracket T \rrbracket(\rho,b/x) \searrow c \Longrightarrow c \in\mathcal{U}_j^* \searrow P'_O(\mathcal{D}) \searrow\mathrm{El}'_O(\mathcal{D})
\qquad\text{(level-}j\text{-codomain fibers)} ∀ D , c . [ [ T ] ] ( ρ , b / x ) ↘ c ⟹ c ∈ U j ∗ ↘ P O ′ ( D ) ↘ El O ′ ( D ) (level- j -codomain fibers)
Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U j ↘ R (by Theorem 6.10; same R ) \Pi(a,T,\rho) \approx\Pi(a,T,\rho) \in\mathcal{U}_j \searrow R
\qquad\text{(by Theorem 6.10; same }R\text{)} Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U j ↘ R (by Theorem 6.10; same R )
P ′ ⟺ Π j ( R I , P I ′ , E l I ′ , P O ′ ) P' \Longleftrightarrow\Pi_j(R_I,P'_I,\mathrm{El}'_I,P'_O) P ′ ⟺ Π j ( R I , P I ′ , El I ′ , P O ′ )
E l ′ ⟺ Π j E l ( R , R I , P I ′ , E l I ′ , E l O ′ ) \mathrm{El}' \Longleftrightarrow\Pi_j^{\mathrm{El}}(R,R_I,P'_I,\mathrm{El}'_I,\mathrm{El}'_O) El ′ ⟺ Π j El ( R , R I , P I ′ , El I ′ , El O ′ )
The PER witnesses R I , R R_I,R R I , R are unchanged (level-independent in U \mathcal{U} U via Theorem 6.10). The IH applies to the inner a a a and to each codomain fiber c c c (smaller derivations).
Type-predicate raising (1). Suppose Γ ⊢ S : T y i ® Π i ( R I , P I , E l I , P O ) \Gamma\vdash S : \mathrm{Ty}_i \mathrel{\circledR} \Pi_i(R_I,P_I,\mathrm{El}_I,P_O) Γ ⊢ S : Ty i ® Π i ( R I , P I , El I , P O ) with witnesses S 1 , S 2 S_1,S_2 S 1 , S 2 . We verify the three clauses of Π j ( R I , P I ′ , E l I ′ , P O ′ ) \Pi_j(R_I,P'_I,\mathrm{El}'_I,P'_O) Π j ( R I , P I ′ , El I ′ , P O ′ ) at S S S .
Clause 1.
Γ ⊢ S ≈ Π ( x : S 1 ) . S 2 : T y i (by Theorem 7.9 clause 1 on the hypothesis) \Gamma\vdash S \approx\Pi(x:S_1).S_2 : \mathrm{Ty}_i
\qquad\text{(by Theorem 7.9 clause 1 on the hypothesis)} Γ ⊢ S ≈ Π ( x : S 1 ) . S 2 : Ty i (by Theorem 7.9 clause 1 on the hypothesis)
Γ ⊢ S ≈ Π ( x : S 1 ) . S 2 : T y j (by cumulativity of universes, i ≤ j , Sec. 3) \Gamma\vdash S \approx\Pi(x:S_1).S_2 : \mathrm{Ty}_j
\qquad\text{(by cumulativity of universes, }i \le j\text{, Sec. 3)} Γ ⊢ S ≈ Π ( x : S 1 ) . S 2 : Ty j (by cumulativity of universes, i ≤ j , Sec. 3)
Clause 2. Let Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ .
Δ ⊢ S 1 [ ϕ ] : T y i ® P I (by Theorem 7.9 clause 2 on the hypothesis) \Delta\vdash S_1[\phi] : \mathrm{Ty}_i \mathrel{\circledR} P_I
\qquad\text{(by Theorem 7.9 clause 2 on the hypothesis)} Δ ⊢ S 1 [ ϕ ] : Ty i ® P I (by Theorem 7.9 clause 2 on the hypothesis)
Δ ⊢ S 1 [ ϕ ] : T y j ® P I ′ (by IH (1) on a , raising) \Delta\vdash S_1[\phi] : \mathrm{Ty}_j \mathrel{\circledR} P'_I
\qquad\text{(by IH (1) on }a\text{, raising)} Δ ⊢ S 1 [ ϕ ] : Ty j ® P I ′ (by IH (1) on a , raising)
Clause 3. Let Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , s s s , b b b , D : : b ≈ b ∈ R I \mathcal{D} :: b \approx b \in R_I D :: b ≈ b ∈ R I with Δ ⊢ s : S 1 [ ϕ ] ® b ∈ E l I ′ \Delta\vdash s : S_1[\phi] \mathrel{\circledR} b \in\mathrm{El}'_I Δ ⊢ s : S 1 [ ϕ ] ® b ∈ El I ′ .
Δ ⊢ S 1 [ ϕ ] : T y i ® P I (by clause 2 above, the level- i part) \Delta\vdash S_1[\phi] : \mathrm{Ty}_i \mathrel{\circledR} P_I
\qquad\text{(by clause 2 above, the level-}i\text{ part)} Δ ⊢ S 1 [ ϕ ] : Ty i ® P I (by clause 2 above, the level- i part)
Δ ⊢ s : S 1 [ ϕ ] ® b ∈ E l I (by IH (3) on a , lowering, using the previous line as the level- i -type-predicate) \Delta\vdash s : S_1[\phi] \mathrel{\circledR} b \in\mathrm{El}_I
\qquad\text{(by IH (3) on }a\text{, lowering, using the previous line as the level-}i\text{-type-predicate)} Δ ⊢ s : S 1 [ ϕ ] ® b ∈ El I (by IH (3) on a , lowering, using the previous line as the level- i -type-predicate)
Δ ⊢ S 2 [ ι ( ϕ ) , s / x ] : T y i ® P O ( D ) (by Theorem 7.9 clause 3 on the hypothesis) \Delta\vdash S_2[\iota(\phi),s/x] : \mathrm{Ty}_i \mathrel{\circledR} P_O(\mathcal{D})
\qquad\text{(by Theorem 7.9 clause 3 on the hypothesis)} Δ ⊢ S 2 [ ι ( ϕ ) , s / x ] : Ty i ® P O ( D ) (by Theorem 7.9 clause 3 on the hypothesis)
Δ ⊢ S 2 [ ι ( ϕ ) , s / x ] : T y j ® P O ′ ( D ) (by IH (1) on the codomain fiber c at D , raising) \Delta\vdash S_2[\iota(\phi),s/x] : \mathrm{Ty}_j \mathrel{\circledR} P'_O(\mathcal{D})
\qquad\text{(by IH (1) on the codomain fiber }c\text{ at }\mathcal{D}\text{, raising)} Δ ⊢ S 2 [ ι ( ϕ ) , s / x ] : Ty j ® P O ′ ( D ) (by IH (1) on the codomain fiber c at D , raising)
Term-predicate raising (2). Suppose Γ ⊢ t : S ® f ∈ Π i E l ( R , R I , P I , E l I , E l O ) \Gamma\vdash t : S \mathbin{\circledR} f \in\Pi_i^{\mathrm{El}}(R, R_I, P_I, \mathrm{El}_I, \mathrm{El}_O) Γ ⊢ t : S ® f ∈ Π i El ( R , R I , P I , El I , El O ) . We verify the four clauses of Π j E l ( R , R I , P I ′ , E l I ′ , E l O ′ ) \Pi_j^{\mathrm{El}}(R, R_I, P'_I, \mathrm{El}'_I, \mathrm{El}'_O) Π j El ( R , R I , P I ′ , El I ′ , El O ′ ) at t , f t, f t , f .
Clauses 1–2.
f ≈ f ∈ R (unchanged from hypothesis) f \approx f \in R \qquad\text{(unchanged from hypothesis)} f ≈ f ∈ R (unchanged from hypothesis)
Γ ⊢ t : S (unchanged from hypothesis) \Gamma\vdash t : S \qquad\text{(unchanged from hypothesis)} Γ ⊢ t : S (unchanged from hypothesis)
Clause 3.
Γ ⊢ S : T y i ® Π i ( R I , P I , E l I , P O ) (by Theorem 7.10 clause 3 on the hypothesis) \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \Pi_i(R_I, P_I, \mathrm{El}_I, P_O) \qquad\text{(by Theorem 7.10 clause 3 on the hypothesis)} Γ ⊢ S : Ty i ® Π i ( R I , P I , El I , P O ) (by Theorem 7.10 clause 3 on the hypothesis)
Γ ⊢ S : T y j ® Π j ( R I , P I ′ , E l I ′ , P O ′ ) (by part (1) of this case, applied just above) \Gamma\vdash S : \mathrm{Ty}_j \mathbin{\circledR} \Pi_j(R_I, P'_I, \mathrm{El}'_I, P'_O) \qquad\text{(by part (1) of this case, applied just above)} Γ ⊢ S : Ty j ® Π j ( R I , P I ′ , El I ′ , P O ′ ) (by part (1) of this case, applied just above)
Clause 4 (application). Let Δ ⊢ k ϕ : Γ , s , b , D : : b ≈ b ∈ R I \Delta\vdash_k \phi: \Gamma, s, b, \mathcal{D} :: b \approx b \in R_I Δ ⊢ k ϕ : Γ , s , b , D :: b ≈ b ∈ R I with Δ ⊢ s : S 1 [ ϕ ] ® b ∈ E l I ′ \Delta\vdash s : S_1[\phi] \mathbin{\circledR} b \in\mathrm{El}'_I Δ ⊢ s : S 1 [ ϕ ] ® b ∈ El I ′ .
Δ ⊢ S 1 [ ϕ ] : T y i ® P I (by hypothesis clause 3 at level i , clause 2 of Π i ) \Delta\vdash S_1[\phi] : \mathrm{Ty}_i \mathbin{\circledR} P_I \qquad\text{(by hypothesis clause 3 at level }i\text{, clause 2 of }\Pi_i\text{)} Δ ⊢ S 1 [ ϕ ] : Ty i ® P I (by hypothesis clause 3 at level i , clause 2 of Π i )
Δ ⊢ s : S 1 [ ϕ ] ® b ∈ E l I (by IH (3) on a , lowering) \Delta\vdash s : S_1[\phi] \mathbin{\circledR} b \in\mathrm{El}_I \qquad\text{(by IH (3) on }a\text{, lowering)} Δ ⊢ s : S 1 [ ϕ ] ® b ∈ El I (by IH (3) on a , lowering)
f ⋅ b ↘ c , Δ ⊢ ( t [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ E l O ( D ) (by hypothesis clause 4 at level i ) f \cdot b \searrow c,\quad\Delta\vdash(t[\phi])\,s : S_2[\iota(\phi),s/x] \mathbin{\circledR} c \in\mathrm{El}_O(\mathcal{D}) \qquad\text{(by hypothesis clause 4 at level }i\text{)} f ⋅ b ↘ c , Δ ⊢ ( t [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ El O ( D ) (by hypothesis clause 4 at level i )
Δ ⊢ ( t [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ E l O ′ ( D ) (by IH (2) on the codomain fiber c , raising) \Delta\vdash(t[\phi])\,s : S_2[\iota(\phi),s/x] \mathbin{\circledR} c \in\mathrm{El}'_O(\mathcal{D}) \qquad\text{(by IH (2) on the codomain fiber }c\text{, raising)} Δ ⊢ ( t [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ El O ′ ( D ) (by IH (2) on the codomain fiber c , raising)
Clause 5 (R I R_I R I -coherence). Unchanged, since the R I R_I R I -classes and the function value f f f are level-independent.
Term-predicate lowering (3). Suppose Γ ⊢ S : T y i ® Π i ( R I , P I , E l I , P O ) \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \Pi_i(R_I, P_I, \mathrm{El}_I, P_O) Γ ⊢ S : Ty i ® Π i ( R I , P I , El I , P O ) and Γ ⊢ t : S ® f ∈ Π j E l ( R , R I , P I ′ , E l I ′ , E l O ′ ) \Gamma\vdash t : S \mathbin{\circledR} f \in\Pi_j^{\mathrm{El}}(R, R_I, P'_I, \mathrm{El}'_I, \mathrm{El}'_O) Γ ⊢ t : S ® f ∈ Π j El ( R , R I , P I ′ , El I ′ , El O ′ ) . We verify the four clauses of Π i E l \Pi_i^{\mathrm{El}} Π i El at t , f t, f t , f .
Clauses 1–3.
f ≈ f ∈ R (by Theorem 7.10 clause 1 on hypothesis at level j ) f \approx f \in R \qquad\text{(by Theorem 7.10 clause 1 on hypothesis at level }j\text{)} f ≈ f ∈ R (by Theorem 7.10 clause 1 on hypothesis at level j )
Γ ⊢ t : S (by Theorem 7.10 clause 2 on hypothesis at level j ) \Gamma\vdash t : S \qquad\text{(by Theorem 7.10 clause 2 on hypothesis at level }j\text{)} Γ ⊢ t : S (by Theorem 7.10 clause 2 on hypothesis at level j )
Γ ⊢ S : T y i ® Π i ( R I , P I , E l I , P O ) (by lemma’s lowering hypothesis on S ) \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \Pi_i(R_I, P_I, \mathrm{El}_I, P_O) \qquad\text{(by lemma’s lowering hypothesis on }S\text{)} Γ ⊢ S : Ty i ® Π i ( R I , P I , El I , P O ) (by lemma’s lowering hypothesis on S )
Clause 4 (application). Let Δ ⊢ k ϕ : Γ , s , b , D : : b ≈ b ∈ R I \Delta\vdash_k \phi: \Gamma, s, b, \mathcal{D} :: b \approx b \in R_I Δ ⊢ k ϕ : Γ , s , b , D :: b ≈ b ∈ R I with Δ ⊢ s : S 1 [ ϕ ] ® b ∈ E l I \Delta\vdash s : S_1[\phi] \mathbin{\circledR} b \in\mathrm{El}_I Δ ⊢ s : S 1 [ ϕ ] ® b ∈ El I .
Δ ⊢ s : S 1 [ ϕ ] ® b ∈ E l I ′ (by IH (2) on a , raising) \Delta\vdash s : S_1[\phi] \mathbin{\circledR} b \in\mathrm{El}'_I \qquad\text{(by IH (2) on }a\text{, raising)} Δ ⊢ s : S 1 [ ϕ ] ® b ∈ El I ′ (by IH (2) on a , raising)
f ⋅ b ↘ c (by hypothesis clause 4 at level j ) f \cdot b \searrow c \qquad\text{(by hypothesis clause 4 at level }j\text{)} f ⋅ b ↘ c (by hypothesis clause 4 at level j )
Δ ⊢ ( t [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ E l O ′ ( D ) (by hypothesis clause 4 at level j ) \Delta\vdash(t[\phi])\,s : S_2[\iota(\phi),s/x] \mathbin{\circledR} c \in\mathrm{El}'_O(\mathcal{D}) \qquad\text{(by hypothesis clause 4 at level }j\text{)} Δ ⊢ ( t [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ El O ′ ( D ) (by hypothesis clause 4 at level j )
Δ ⊢ S 2 [ ι ( ϕ ) , s / x ] : T y i ® P O ( D ) (by Theorem 7.9 clause 3 on the level- i type-predicate hypothesis) \Delta\vdash S_2[\iota(\phi),s/x] : \mathrm{Ty}_i \mathbin{\circledR} P_O(\mathcal{D}) \qquad\text{(by Theorem 7.9 clause 3 on the level-}i\text{ type-predicate hypothesis)} Δ ⊢ S 2 [ ι ( ϕ ) , s / x ] : Ty i ® P O ( D ) (by Theorem 7.9 clause 3 on the level- i type-predicate hypothesis)
Δ ⊢ ( t [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ E l O ( D ) (by IH (3) on the codomain fiber c , lowering) \Delta\vdash(t[\phi])\,s : S_2[\iota(\phi),s/x] \mathbin{\circledR} c \in\mathrm{El}_O(\mathcal{D}) \qquad\text{(by IH (3) on the codomain fiber }c\text{, lowering)} Δ ⊢ ( t [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ El O ( D ) (by IH (3) on the codomain fiber c , lowering)
Lemma 7.26 (Gluing respects judgmental equality). Suppose a ∈ U i ∗ ↘ P ↘ E l a \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El .
(1) If Γ ⊢ S : T y i ® P \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} P Γ ⊢ S : Ty i ® P and Γ ⊢ S ≈ S ′ : T y i \Gamma\vdash S \approx S' : \mathrm{Ty}_i Γ ⊢ S ≈ S ′ : Ty i , then Γ ⊢ S ′ : T y i ® P \Gamma\vdash S' : \mathrm{Ty}_i \mathbin{\circledR} P Γ ⊢ S ′ : Ty i ® P .
(2) If Γ ⊢ t : S ® b ∈ E l \Gamma\vdash t : S \mathbin{\circledR} b \in\mathrm{El} Γ ⊢ t : S ® b ∈ El and Γ ⊢ t ≈ t ′ : S \Gamma\vdash t \approx t' : S Γ ⊢ t ≈ t ′ : S , then Γ ⊢ t ′ : S ® b ∈ E l \Gamma\vdash t' : S \mathbin{\circledR} b \in\mathrm{El} Γ ⊢ t ′ : S ® b ∈ El .
(3) If Γ ⊢ t : S ® b ∈ E l \Gamma\vdash t : S \mathbin{\circledR} b \in\mathrm{El} Γ ⊢ t : S ® b ∈ El and Γ ⊢ S ≈ S ′ : T y i \Gamma\vdash S \approx S' : \mathrm{Ty}_i Γ ⊢ S ≈ S ′ : Ty i , then Γ ⊢ t : S ′ ® b ∈ E l \Gamma\vdash t : S' \mathbin{\circledR} b \in\mathrm{El} Γ ⊢ t : S ′ ® b ∈ El .
Proof. By induction on a ∈ U i ∗ a \in\mathcal{U}_i^* a ∈ U i ∗ .
Case
⊢ G - N e ( e ) ∈ D P ⟺ N e u i e E l ⟺ N e u i e ⊢ A ( e ) ∈ U i ∗ ↘ P ↘ E l \begin{gathered}
\mathrel{\vdash^{\mathrm{G\text{-}Ne}}} (e) \in\mathcal{D}
\qquad
P \Longleftrightarrow\mathrm{Neu}_i^e
\qquad
\mathrm{El} \Longleftrightarrow\mathrm{Neu}_i^e \\
\mathrel{\vdash^A} (e) \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El}
\end{gathered} ⊢ G - Ne ( e ) ∈ D P ⟺ Neu i e El ⟺ Neu i e ⊢ A ( e ) ∈ U i ∗ ↘ P ↘ El
Type predicate (1). Given Γ ⊢ S : T y i ® N e u i e \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \mathrm{Neu}_i^e Γ ⊢ S : Ty i ® Neu i e and Γ ⊢ S ≈ S ′ : T y i \Gamma\vdash S \approx S' : \mathrm{Ty}_i Γ ⊢ S ≈ S ′ : Ty i with Γ ⊢ S ′ : T y i \Gamma\vdash S' : \mathrm{Ty}_i Γ ⊢ S ′ : Ty i . For arbitrary Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ :
∃ u . R ∣ Δ ∣ N e ( e ) ↘ u ∧ Δ ⊢ S [ ϕ ] ≈ u : T y i (by hypothesis on S ) Δ ⊢ S [ ϕ ] ≈ S ′ [ ϕ ] : T y i (by Theorem 4.1) Δ ⊢ S ′ [ ϕ ] ≈ u : T y i (by symmetry and transitivity of judgmental equality) Γ ⊢ S ′ : T y i ® N e u i e (by Theorem 7.5) \begin{aligned}
&\exists u.\ R^{\mathrm{Ne}}_{|\Delta|}(e) \searrow u \mathbin{\wedge} \Delta\vdash S[\phi] \approx u : \mathrm{Ty}_i && \text{(by hypothesis on }S\text{)}\\
&\Delta\vdash S[\phi] \approx S'[\phi] : \mathrm{Ty}_i && \text{(by Theorem 4.1)}\\
&\Delta\vdash S'[\phi] \approx u : \mathrm{Ty}_i && \text{(by symmetry and transitivity of judgmental equality)}\\
&\Gamma\vdash S' : \mathrm{Ty}_i \mathbin{\circledR} \mathrm{Neu}_i^e && \text{(by Theorem 7.5)}
\end{aligned} ∃ u . R ∣Δ∣ Ne ( e ) ↘ u ∧ Δ ⊢ S [ ϕ ] ≈ u : Ty i Δ ⊢ S [ ϕ ] ≈ S ′ [ ϕ ] : Ty i Δ ⊢ S ′ [ ϕ ] ≈ u : Ty i Γ ⊢ S ′ : Ty i ® Neu i e (by hypothesis on S ) (by Theorem 4.1) (by symmetry and transitivity of judgmental equality) (by Theorem 7.5)
Term predicate (2). Given Γ ⊢ t : S ® ↑ A ( w ) ∈ N e u i e \Gamma\vdash t : S \mathbin{\circledR} \mathord{\uparrow}^{A}(w) \in\mathrm{Neu}_i^e Γ ⊢ t : S ® ↑ A ( w ) ∈ Neu i e and Γ ⊢ t ≈ t ′ : S \Gamma\vdash t \approx t' : S Γ ⊢ t ≈ t ′ : S with Γ ⊢ t ′ : S \Gamma\vdash t' : S Γ ⊢ t ′ : S . For Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ :
∃ u . R ∣ Δ ∣ N e ( w ) ↘ u ∧ Δ ⊢ t [ ϕ ] ≈ u : S [ ϕ ] (by hypothesis on t ) Δ ⊢ t [ ϕ ] ≈ t ′ [ ϕ ] : S [ ϕ ] (by Theorem 4.1) Δ ⊢ t ′ [ ϕ ] ≈ u : S [ ϕ ] (by symmetry and transitivity) Γ ⊢ t ′ : S ® ↑ A ( w ) ∈ N e u i e (by Theorem 7.6) \begin{aligned}
&\exists u.\ R^{\mathrm{Ne}}_{|\Delta|}(w) \searrow u \mathbin{\wedge} \Delta\vdash t[\phi] \approx u : S[\phi] && \text{(by hypothesis on }t\text{)}\\
&\Delta\vdash t[\phi] \approx t'[\phi] : S[\phi] && \text{(by Theorem 4.1)}\\
&\Delta\vdash t'[\phi] \approx u : S[\phi] && \text{(by symmetry and transitivity)}\\
&\Gamma\vdash t' : S \mathbin{\circledR} \mathord{\uparrow}^{A}(w) \in\mathrm{Neu}_i^e && \text{(by Theorem 7.6)}
\end{aligned} ∃ u . R ∣Δ∣ Ne ( w ) ↘ u ∧ Δ ⊢ t [ ϕ ] ≈ u : S [ ϕ ] Δ ⊢ t [ ϕ ] ≈ t ′ [ ϕ ] : S [ ϕ ] Δ ⊢ t ′ [ ϕ ] ≈ u : S [ ϕ ] Γ ⊢ t ′ : S ® ↑ A ( w ) ∈ Neu i e (by hypothesis on t ) (by Theorem 4.1) (by symmetry and transitivity) (by Theorem 7.6)
Type-side rewriting (3). Given Γ ⊢ t : S ® ↑ A ( w ) ∈ N e u i e \Gamma\vdash t : S \mathbin{\circledR} \mathord{\uparrow}^{A}(w) \in\mathrm{Neu}_i^e Γ ⊢ t : S ® ↑ A ( w ) ∈ Neu i e and Γ ⊢ S ≈ S ′ : T y i \Gamma\vdash S \approx S' : \mathrm{Ty}_i Γ ⊢ S ≈ S ′ : Ty i with Γ ⊢ t : S ′ \Gamma\vdash t : S' Γ ⊢ t : S ′ . For Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ :
∃ u . R ∣ Δ ∣ N e ( w ) ↘ u ∧ Δ ⊢ t [ ϕ ] ≈ u : S [ ϕ ] (by hypothesis on t ) Δ ⊢ S [ ϕ ] ≈ S ′ [ ϕ ] : T y i (by Theorem 4.1) Δ ⊢ t [ ϕ ] ≈ u : S ′ [ ϕ ] (by Tm-Subsump with the previous line) Γ ⊢ t : S ′ ® ↑ A ( w ) ∈ N e u i e (by Theorem 7.6, using the type predicate at S ′ from (1)) \begin{aligned}
&\exists u.\ R^{\mathrm{Ne}}_{|\Delta|}(w) \searrow u \mathbin{\wedge} \Delta\vdash t[\phi] \approx u : S[\phi] && \text{(by hypothesis on }t\text{)}\\
&\Delta\vdash S[\phi] \approx S'[\phi] : \mathrm{Ty}_i && \text{(by Theorem 4.1)}\\
&\Delta\vdash t[\phi] \approx u : S'[\phi] && \text{(by Tm-Subsump with the previous line)}\\
&\Gamma\vdash t : S' \mathbin{\circledR} \mathord{\uparrow}^{A}(w) \in\mathrm{Neu}_i^e && \text{(by Theorem 7.6, using the type predicate at }S'\text{ from (1))}
\end{aligned} ∃ u . R ∣Δ∣ Ne ( w ) ↘ u ∧ Δ ⊢ t [ ϕ ] ≈ u : S [ ϕ ] Δ ⊢ S [ ϕ ] ≈ S ′ [ ϕ ] : Ty i Δ ⊢ t [ ϕ ] ≈ u : S ′ [ ϕ ] Γ ⊢ t : S ′ ® ↑ A ( w ) ∈ Neu i e (by hypothesis on t ) (by Theorem 4.1) (by Tm-Subsump with the previous line) (by Theorem 7.6, using the type predicate at S ′ from (1))
Case
G - N a t P ⇔ N a t i E l ⇔ N a t i N ∈ U i ∗ ↘ P ↘ E l \begin{gathered}
\mathrm{G\text{-}Nat}\\
P \Leftrightarrow\mathrm{Nat}_i \qquad\mathrm{El} \Leftrightarrow\mathrm{Nat}_i\\
N \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El}
\end{gathered} G - Nat P ⇔ Nat i El ⇔ Nat i N ∈ U i ∗ ↘ P ↘ El
Type predicate (1).
Γ ⊢ S ≈ N a t : T y i (by Theorem 7.7 on hypothesis) Γ ⊢ S ′ ≈ S : T y i (by symmetry of Γ ⊢ S ≈ S ′ : T y i ) Γ ⊢ S ′ ≈ N a t : T y i (by transitivity of judgmental equality) Γ ⊢ S ′ : T y i ® N a t i (by Theorem 7.7) \begin{aligned}
&\Gamma\vdash S \approx\mathrm{Nat} : \mathrm{Ty}_i && \text{(by Theorem 7.7 on hypothesis)}\\
&\Gamma\vdash S' \approx S : \mathrm{Ty}_i && \text{(by symmetry of }\Gamma\vdash S \approx S' : \mathrm{Ty}_i\text{)}\\
&\Gamma\vdash S' \approx\mathrm{Nat} : \mathrm{Ty}_i && \text{(by transitivity of judgmental equality)}\\
&\Gamma\vdash S' : \mathrm{Ty}_i \mathbin{\circledR} \mathrm{Nat}_i && \text{(by Theorem 7.7)}
\end{aligned} Γ ⊢ S ≈ Nat : Ty i Γ ⊢ S ′ ≈ S : Ty i Γ ⊢ S ′ ≈ Nat : Ty i Γ ⊢ S ′ : Ty i ® Nat i (by Theorem 7.7 on hypothesis) (by symmetry of Γ ⊢ S ≈ S ′ : Ty i ) (by transitivity of judgmental equality) (by Theorem 7.7)
Term predicate (2). Given Γ ⊢ t : S ® b ∈ N a t i \Gamma\vdash t : S \mathbin{\circledR} b \in\mathrm{Nat}_i Γ ⊢ t : S ® b ∈ Nat i and Γ ⊢ t ≈ t ′ : S \Gamma\vdash t \approx t' : S Γ ⊢ t ≈ t ′ : S . By inner induction on the derivation b ∈ N a t i b \in\mathrm{Nat}_i b ∈ Nat i at t t t :
Sub-case
G N - Z e Γ ⊢ t ≈ z e r o : S Γ ⊢ t : S ® z e ∈ N a t \begin{gathered}
\mathrm{GN\text{-}Ze}\\
\Gamma\vdash t \approx\mathrm{zero} : S\\
\hline
\Gamma\vdash t : S \mathbin{\circledR} \mathrm{ze} \in\mathrm{Nat}
\end{gathered} GN - Ze Γ ⊢ t ≈ zero : S Γ ⊢ t : S ® ze ∈ Nat
Γ ⊢ t ′ ≈ t : S (by symmetry of Γ ⊢ t ≈ t ′ : S ) Γ ⊢ t ′ ≈ z e r o : S (by transitivity) Γ ⊢ t ′ : S ® z e ∈ N a t (by GN-Ze) \begin{aligned}
&\Gamma\vdash t' \approx t : S && \text{(by symmetry of }\Gamma\vdash t \approx t' : S\text{)}\\
&\Gamma\vdash t' \approx\mathrm{zero} : S && \text{(by transitivity)}\\
&\Gamma\vdash t' : S \mathbin{\circledR} \mathrm{ze} \in\mathrm{Nat} && \text{(by GN-Ze)}
\end{aligned} Γ ⊢ t ′ ≈ t : S Γ ⊢ t ′ ≈ zero : S Γ ⊢ t ′ : S ® ze ∈ Nat (by symmetry of Γ ⊢ t ≈ t ′ : S ) (by transitivity) (by GN-Ze)
Sub-case
GN-Su Γ ⊢ t 0 : S R b ′ ∈ N a t Γ ⊢ t ≈ succ t 0 : S Γ ⊢ t : S R su ( b ′ ) ∈ N a t \begin{aligned}
&\text{GN-Su}\\
&\frac{\Gamma\vdash t_0 : S \mathrel{\mathsf{R}} b' \in\mathrm{Nat}\qquad\Gamma\vdash t \approx\operatorname{succ} t_0 : S}{\Gamma\vdash t : S \mathrel{\mathsf{R}} \operatorname{su}(b') \in\mathrm{Nat}}
\end{aligned} GN-Su Γ ⊢ t : S R su ( b ′ ) ∈ Nat Γ ⊢ t 0 : S R b ′ ∈ Nat Γ ⊢ t ≈ succ t 0 : S
Γ ⊢ t ′ ≈ succ t 0 : S (by symmetry/transitivity, as above) Γ ⊢ t 0 : S R b ′ ∈ N a t (unchanged, hypothesis on t 0 ) Γ ⊢ t ′ : S R su ( b ′ ) ∈ N a t (by GN-Su) \begin{aligned}
\Gamma&\vdash t' \approx\operatorname{succ} t_0 : S &&\text{(by symmetry/transitivity, as above)}\\
\Gamma&\vdash t_0 : S \mathrel{\mathsf{R}} b' \in\mathrm{Nat} &&\text{(unchanged, hypothesis on }t_0\text{)}\\
\Gamma&\vdash t' : S \mathrel{\mathsf{R}} \operatorname{su}(b') \in\mathrm{Nat} &&\text{(by GN-Su)}
\end{aligned} Γ Γ Γ ⊢ t ′ ≈ succ t 0 : S ⊢ t 0 : S R b ′ ∈ Nat ⊢ t ′ : S R su ( b ′ ) ∈ Nat (by symmetry/transitivity, as above) (unchanged, hypothesis on t 0 ) (by GN-Su)
Sub-case
GN-Ne Γ ⊢ t : S R w ∈ N e i N Γ ⊢ t : S R ↑ N ( w ) ∈ N a t \begin{aligned}
&\text{GN-Ne}\\
&\frac{\Gamma\vdash t : S \mathrel{\mathsf{R}} w \in\mathrm{Ne}^{N}_{i}}{\Gamma\vdash t : S \mathrel{\mathsf{R}} \mathord{\uparrow}^{N}(w) \in\mathrm{Nat}}
\end{aligned} GN-Ne Γ ⊢ t : S R ↑ N ( w ) ∈ Nat Γ ⊢ t : S R w ∈ Ne i N
Γ ⊢ t ′ : S R w ∈ N e i N (by the G-Ne case (2) above on the neutral predicate) Γ ⊢ t ′ : S R ↑ N ( w ) ∈ N a t (by GN-Ne) \begin{aligned}
\Gamma&\vdash t' : S \mathrel{\mathsf{R}} w \in\mathrm{Ne}^{N}_{i} &&\text{(by the G-Ne case (2) above on the neutral predicate)}\\
\Gamma&\vdash t' : S \mathrel{\mathsf{R}} \mathord{\uparrow}^{N}(w) \in\mathrm{Nat} &&\text{(by GN-Ne)}
\end{aligned} Γ Γ ⊢ t ′ : S R w ∈ Ne i N ⊢ t ′ : S R ↑ N ( w ) ∈ Nat (by the G-Ne case (2) above on the neutral predicate) (by GN-Ne)
Type-side rewriting (3). Given Γ ⊢ S ≈ S ′ : T y i \Gamma\vdash S \approx S' : \mathrm{Ty}_{i} Γ ⊢ S ≈ S ′ : Ty i . Then Γ ⊢ S ′ ≈ N a t : T y i \Gamma\vdash S' \approx\mathrm{Nat} : \mathrm{Ty}_{i} Γ ⊢ S ′ ≈ Nat : Ty i by symmetry/transitivity with Γ ⊢ S ≈ N a t : T y i \Gamma\vdash S \approx\mathrm{Nat} : \mathrm{Ty}_{i} Γ ⊢ S ≈ Nat : Ty i . The Nat-derivation transfers to Γ ⊢ t : S ′ \Gamma\vdash t : S' Γ ⊢ t : S ′ since each sub-case’s hypotheses involve S S S only through Γ ⊢ t ≈ w : S \Gamma\vdash t \approx w : S Γ ⊢ t ≈ w : S for some w w w , which becomes Γ ⊢ t ≈ w : S ′ \Gamma\vdash t \approx w : S' Γ ⊢ t ≈ w : S ′ via Tm-Subsump.
Case
G-Univ j < i P ⟺ U n i v i , j E l ⟺ U n i v i , j E l U j ∈ U i ∗ ↘ P ↘ E l \begin{aligned}
&\text{G-Univ}\\
&\frac{j < i\qquad P \Longleftrightarrow\mathrm{Univ}_{i,j}\qquad\mathrm{El} \Longleftrightarrow\mathrm{Univ}^{\mathrm{El}}_{i,j}}{U_j \in\mathcal{U}^{*}_{i} \searrow P \searrow\mathrm{El}}
\end{aligned} G-Univ U j ∈ U i ∗ ↘ P ↘ El j < i P ⟺ Univ i , j El ⟺ Univ i , j El
Type predicate (1).
Γ ⊢ S ≈ T y j : T y i (by xref‘Theorem 7.11‘) Γ ⊢ S ′ ≈ T y j : T y i (by symmetry/transitivity with the assumed equality) Γ ⊢ S ′ : T y i R U n i v i , j (by xref‘Theorem 7.11‘) \begin{aligned}
\Gamma&\vdash S \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i} &&\text{(by {xref}`Theorem 7.11`)}\\
\Gamma&\vdash S' \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i} &&\text{(by symmetry/transitivity with the assumed equality)}\\
\Gamma&\vdash S' : \mathrm{Ty}_{i} \mathrel{\mathsf{R}} \mathrm{Univ}_{i,j} &&\text{(by {xref}`Theorem 7.11`)}
\end{aligned} Γ Γ Γ ⊢ S ≈ Ty j : Ty i ⊢ S ′ ≈ Ty j : Ty i ⊢ S ′ : Ty i R Univ i , j (by xref ‘Theorem 7.11‘) (by symmetry/transitivity with the assumed equality) (by xref ‘Theorem 7.11‘)
Term predicate (2). Given Γ ⊢ t : S R b ∈ U n i v i , j E l \Gamma\vdash t : S \mathrel{\mathsf{R}} b \in\mathrm{Univ}^{\mathrm{El}}_{i,j} Γ ⊢ t : S R b ∈ Univ i , j El and Γ ⊢ t ≈ t ′ : S \Gamma\vdash t \approx t' : S Γ ⊢ t ≈ t ′ : S . By Theorem 7.12, b ∈ U j ∗ ↘ P b ↘ E l b b \in\mathcal{U}^{*}_{j} \searrow P_b \searrow\mathrm{El}_b b ∈ U j ∗ ↘ P b ↘ El b with Γ ⊢ t : T y j R P b \Gamma\vdash t : \mathrm{Ty}_{j} \mathrel{\mathsf{R}} P_b Γ ⊢ t : Ty j R P b and Γ ⊢ S ≈ T y j : T y i \Gamma\vdash S \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i} Γ ⊢ S ≈ Ty j : Ty i .
Γ ⊢ t ≈ t ′ : T y j (by judgmental-equality conversion under Γ ⊢ S ≈ T y j : T y i ) Γ ⊢ t ′ : T y j R P b (by IH on P b at level j , type-predicate part) Γ ⊢ t ′ : S R b ∈ U n i v i , j E l (by xref‘Theorem 7.12‘ with Γ ⊢ S ≈ T y j : T y i ) \begin{aligned}
\Gamma&\vdash t \approx t' : \mathrm{Ty}_{j} &&\text{(by judgmental-equality conversion under }\Gamma\vdash S \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i}\text{)}\\
\Gamma&\vdash t' : \mathrm{Ty}_{j} \mathrel{\mathsf{R}} P_b &&\text{(by IH on }P_b\text{ at level }j\text{, type-predicate part)}\\
\Gamma&\vdash t' : S \mathrel{\mathsf{R}} b \in\mathrm{Univ}^{\mathrm{El}}_{i,j} &&\text{(by {xref}`Theorem 7.12` with }\Gamma\vdash S \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i}\text{)}
\end{aligned} Γ Γ Γ ⊢ t ≈ t ′ : Ty j ⊢ t ′ : Ty j R P b ⊢ t ′ : S R b ∈ Univ i , j El (by judgmental-equality conversion under Γ ⊢ S ≈ Ty j : Ty i ) (by IH on P b at level j , type-predicate part) (by xref ‘Theorem 7.12‘ with Γ ⊢ S ≈ Ty j : Ty i )
Type-side rewriting (3). Given Γ ⊢ S ≈ S ′ : T y i \Gamma\vdash S \approx S' : \mathrm{Ty}_{i} Γ ⊢ S ≈ S ′ : Ty i . Then Γ ⊢ S ′ ≈ T y j : T y i \Gamma\vdash S' \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i} Γ ⊢ S ′ ≈ Ty j : Ty i by transitivity, and the universe term predicate at S ′ S' S ′ holds with the same data b b b , P b P_b P b , E l b \mathrm{El}_b El b .
Case
a ∈ U i ∗ ↘ P I ↘ E l I a ≈ a ′ ∈ U i ↘ R I ∀ D : : b ≈ b ′ ∈ R I , c . ⟦ T ⟧ ( ρ , b / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R P ⟺ Π i ( … ) E l ⟺ Π i E l ( … ) Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ E l \begin{aligned}
a &\in U_i^* \searrow P_I \searrow\mathrm{El}_I \qquad a \approx a' \in U_i \searrow R_I\\
\forall\mathcal{D} :: b \approx b' \in R_I,\ c.\ \llbracket T \rrbracket(\rho,b/x) \searrow c \Longrightarrow c \in U_i^* \searrow P_O(\mathcal{D}) \searrow\mathrm{El}_O(\mathcal{D})\\
\Pi(a,T,\rho) \approx\Pi(a,T,\rho) \in U_i \searrow R\\
P \Longleftrightarrow\Pi_i(\ldots) \qquad\mathrm{El} \Longleftrightarrow\Pi_i^{\mathrm{El}}(\ldots)\\
\Pi(a,T,\rho) \in U_i^* \searrow P \searrow\mathrm{El}
\end{aligned} a ∀ D :: b ≈ b ′ ∈ R I , c . [ [ T ] ] ( ρ , b / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R P ⟺ Π i ( … ) El ⟺ Π i El ( … ) Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ El ∈ U i ∗ ↘ P I ↘ El I a ≈ a ′ ∈ U i ↘ R I
Type predicate (1). Given Γ ⊢ S : T y i ∘ Π i ( R I , P I , E l I , P O ) \Gamma\vdash S : \mathrm{Ty}_i \circ\Pi_i(R_I,P_I,\mathrm{El}_I,P_O) Γ ⊢ S : Ty i ∘ Π i ( R I , P I , El I , P O ) and Γ ⊢ S ≈ S ′ : T y i \Gamma\vdash S \approx S' : \mathrm{Ty}_i Γ ⊢ S ≈ S ′ : Ty i . By Theorem 7.9 clause 1, Γ ⊢ S ≈ Π ( x : S 1 ) . S 2 : T y i \Gamma\vdash S \approx\Pi(x:S_1).S_2 : \mathrm{Ty}_i Γ ⊢ S ≈ Π ( x : S 1 ) . S 2 : Ty i for some S 1 , S 2 S_1,S_2 S 1 , S 2 .
Γ ⊢ S ′ ≈ S : T y i \Gamma\vdash S' \approx S : \mathrm{Ty}_i Γ ⊢ S ′ ≈ S : Ty i
(by symmetry of Γ ⊢ S ≈ S ′ : T y i \Gamma\vdash S \approx S' : \mathrm{Ty}_i Γ ⊢ S ≈ S ′ : Ty i )
Γ ⊢ S ′ ≈ Π ( x : S 1 ) . S 2 : T y i \Gamma\vdash S' \approx\Pi(x:S_1).S_2 : \mathrm{Ty}_i Γ ⊢ S ′ ≈ Π ( x : S 1 ) . S 2 : Ty i
(by transitivity with the previous line)
Clauses 2–3 of Π i \Pi_i Π i for S ′ S' S ′ at any Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ require the same data on S 1 [ ϕ ] S_1[\phi] S 1 [ ϕ ] and S 2 [ ι ( ϕ ) , s / x ] S_2[\iota(\phi),s/x] S 2 [ ι ( ϕ ) , s / x ] as the original predicate; these are exactly the data already satisfied by hypothesis on S S S , since the data depend on S 1 , S 2 S_1,S_2 S 1 , S 2 rather than on the outer type S S S .
Term predicate (2). Given Γ ⊢ t : S ∘ f ∈ Π i E l ( R , R I , P I , E l I , E l O ) \Gamma\vdash t : S \circ f \in\Pi_i^{\mathrm{El}}(R,R_I,P_I,\mathrm{El}_I,\mathrm{El}_O) Γ ⊢ t : S ∘ f ∈ Π i El ( R , R I , P I , El I , El O ) and Γ ⊢ t ≈ t ′ : S \Gamma\vdash t \approx t' : S Γ ⊢ t ≈ t ′ : S with Γ ⊢ t ′ : S \Gamma\vdash t' : S Γ ⊢ t ′ : S . We verify the four clauses of Theorem 7.10 at t ′ t' t ′ and value f f f .
Self-relatedness f ≈ f ∈ R f \approx f \in R f ≈ f ∈ R does not depend on t t t .
R I R_I R I -coherence: a property of f f f , not of t t t .
Type-readback: clause 3 of Π i E l \Pi_i^{\mathrm{El}} Π i El matches clause 3 of Π i \Pi_i Π i on S S S at t t t , and is preserved by part (1) above on S ′ S' S ′ unchanged.
Application: let Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , s s s , b b b , D : : b ≈ b ′ ∈ R I \mathcal{D} :: b \approx b' \in R_I D :: b ≈ b ′ ∈ R I with Δ ⊢ s : S 1 [ ϕ ] ∘ b ∈ E l I \Delta\vdash s : S_1[\phi] \circ b \in\mathrm{El}_I Δ ⊢ s : S 1 [ ϕ ] ∘ b ∈ El I .
f ⋅ b ↘ c f \mathbin{\cdot} b \searrow c f ⋅ b ↘ c
(by hypothesis clause 4 on f f f )
Δ ⊢ ( t [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] ∘ c ∈ E l O ( D ) \Delta\vdash(t[\phi])\,s : S_2[\iota(\phi),s/x] \circ c \in\mathrm{El}_O(\mathcal{D}) Δ ⊢ ( t [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ] ∘ c ∈ El O ( D )
(by hypothesis clause 4)
Δ ⊢ t [ ϕ ] ≈ t ′ [ ϕ ] : S [ ϕ ] \Delta\vdash t[\phi] \approx t'[\phi] : S[\phi] Δ ⊢ t [ ϕ ] ≈ t ′ [ ϕ ] : S [ ϕ ]
(by Theorem 4.1)
Δ ⊢ ( t [ ϕ ] ) s ≈ ( t ′ [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] \Delta\vdash(t[\phi])\,s \approx(t'[\phi])\,s : S_2[\iota(\phi),s/x] Δ ⊢ ( t [ ϕ ]) s ≈ ( t ′ [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ]
(by App-Cong on the previous line, after observing that S [ ϕ ] S[\phi] S [ ϕ ] on the function side reduces to Π ( x : S 1 [ ϕ ] ) . ( S 2 [ φ ( ϕ ) ] ) \Pi(x:S_1[\phi]).(S_2[\varphi(\phi)]) Π ( x : S 1 [ ϕ ]) . ( S 2 [ φ ( ϕ )]) )
Δ ⊢ ( t ′ [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] ∘ c ∈ E l O ( D ) \Delta\vdash(t'[\phi])\,s : S_2[\iota(\phi),s/x] \circ c \in\mathrm{El}_O(\mathcal{D}) Δ ⊢ ( t ′ [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ] ∘ c ∈ El O ( D )
(by IH (2) on E l O ( D ) \mathrm{El}_O(\mathcal{D}) El O ( D ) applied to the equality above)
R I R_I R I -coherence under application: a property of f f f via clauses 4 parametrically; transfers from t t t to t ′ t' t ′ alongside clause 4.
Type-side rewriting (3). Given Γ ⊢ S ≈ S ′ : T y i \Gamma\vdash S \approx S' : \mathrm{Ty}_i Γ ⊢ S ≈ S ′ : Ty i with Γ ⊢ t : S ′ \Gamma\vdash t : S' Γ ⊢ t : S ′ . Clauses 1, 4 of Π i E l \Pi_i^{\mathrm{El}} Π i El depend on S S S only through S 2 [ ι ( ϕ ) , s / x ] S_2[\iota(\phi),s/x] S 2 [ ι ( ϕ ) , s / x ] (the codomain instantiation), which is invariant under the equation S ≈ S ′ S \approx S' S ≈ S ′ . Clause 3’s Π \Pi Π -shape readback transfers via part (1) applied to the universe-equation. Hence Γ ⊢ t : S ′ ∘ f ∈ Π i E l \Gamma\vdash t : S' \circ f \in\Pi_i^{\mathrm{El}} Γ ⊢ t : S ′ ∘ f ∈ Π i El . □
Lemma 7.27 ( U i ∗ U_i^* U i ∗ closed under U i U_i U i -equivalence). If a ≈ a ′ ∈ U i ↘ R a \approx a' \in U_i \searrow R a ≈ a ′ ∈ U i ↘ R and a ∈ U i ∗ ↘ P ↘ E l a \in U_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El , then a ′ ∈ U i ∗ ↘ P ↘ E l a' \in U_i^* \searrow P \searrow\mathrm{El} a ′ ∈ U i ∗ ↘ P ↘ El .
Proof. By induction on a ≈ a ′ ∈ U i a \approx a' \in U_i a ≈ a ′ ∈ U i . Case
U-Ne b ≈ b ′ ∈ N e R ⇔ N e u ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R \begin{gathered}
\text{U-Ne}\\
b \approx b' \in\mathrm{Ne}\qquad R \Leftrightarrow\mathrm{Neu}\\
\hline
\uparrow^{A}(b) \approx\uparrow^{A'}(b') \in\mathcal{U}_i \searrow R
\end{gathered} U-Ne b ≈ b ′ ∈ Ne R ⇔ Neu ↑ A ( b ) ≈ ↑ A ′ ( b ′ ) ∈ U i ↘ R
a = ↑ A ( b ) a = \uparrow^{A}(b) a = ↑ A ( b ) , a ′ = ↑ A ′ ( b ′ ) a' = \uparrow^{A'}(b') a ′ = ↑ A ′ ( b ′ ) . a ∈ U i ∗ a \in\mathcal{U}_i^* a ∈ U i ∗ via G-Ne with P ⇔ E l ⇔ N e u i b P \Leftrightarrow\mathrm{El} \Leftrightarrow\mathrm{Neu}_i^b P ⇔ El ⇔ Neu i b . By definition of Ne (b ≈ b ′ ∈ N e b \approx b' \in\mathrm{Ne} b ≈ b ′ ∈ Ne ), readbacks of b b b and b ′ b' b ′ coincide, so N e u i b ⇔ N e u i b ′ \mathrm{Neu}_i^b \Leftrightarrow\mathrm{Neu}_i^{b'} Neu i b ⇔ Neu i b ′ . Hence a ′ ∈ U i ∗ a' \in\mathcal{U}_i^* a ′ ∈ U i ∗ via G-Ne with the same predicates.
Case
U-Univ j < i R ⇔ U j U j ≈ U j ∈ U i ↘ R \begin{gathered}
\text{U-Univ}\\
j < i\qquad R \Leftrightarrow\mathcal{U}_j\\
\hline
\mathcal{U}_j \approx\mathcal{U}_j \in\mathcal{U}_i \searrow R
\end{gathered} U-Univ j < i R ⇔ U j U j ≈ U j ∈ U i ↘ R
a = a ′ = U j a = a' = \mathcal{U}_j a = a ′ = U j ; the conclusion is immediate.
Case
U-Nat R ⇔ N a t N ≈ N ∈ U i ↘ R \begin{gathered}
\text{U-Nat}\\
R \Leftrightarrow\mathrm{Nat}\\
\hline
\mathbb{N} \approx\mathbb{N} \in\mathcal{U}_i \searrow R
\end{gathered} U-Nat R ⇔ Nat N ≈ N ∈ U i ↘ R
a = a ′ = N a = a' = \mathbb{N} a = a ′ = N ; immediate.
Case
U-Pi a I ≈ a I ′ ∈ U i ↘ R I R I is a PER ∀ D : : b ≈ b ′ ∈ R I . ⟦ T ⟧ ( ρ , b / x ) ≈ ⟦ T ′ ⟧ ( ρ ′ , b ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D : : b ≈ b ′ ∈ R I . f ⋅ b ≈ f ′ ⋅ b ′ ∈ R O ( D ) ) Π ( a I , T , ρ ) ≈ Π ( a I ′ , T ′ , ρ ′ ) ∈ U i ↘ R \begin{gathered}
\text{U-Pi}\\
a_I \approx a'_I \in\mathcal{U}_i \searrow R_I\qquad R_I\text{ is a PER}\\
\forall D :: b \approx b' \in R_I.\ \llbracket T \rrbracket(\rho,b/x) \approx\llbracket T' \rrbracket(\rho',b'/x) \in\mathcal{U}_i \searrow R_O(D)\\
\forall f,f'.\ f \approx f' \in R \Leftrightarrow(\forall D :: b \approx b' \in R_I.\ f\mathbin{\cdot}b \approx f'\mathbin{\cdot}b' \in R_O(D))\\
\hline
\Pi(a_I,T,\rho) \approx\Pi(a'_I,T',\rho') \in\mathcal{U}_i \searrow R
\end{gathered} U-Pi a I ≈ a I ′ ∈ U i ↘ R I R I is a PER ∀ D :: b ≈ b ′ ∈ R I . [ [ T ] ] ( ρ , b / x ) ≈ [ [ T ′ ] ] ( ρ ′ , b ′ / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D :: b ≈ b ′ ∈ R I . f ⋅ b ≈ f ′ ⋅ b ′ ∈ R O ( D )) Π ( a I , T , ρ ) ≈ Π ( a I ′ , T ′ , ρ ′ ) ∈ U i ↘ R
a = Π ( a I , T , ρ ) a = \Pi(a_I,T,\rho) a = Π ( a I , T , ρ ) , a ′ = Π ( a I ′ , T ′ , ρ ′ ) a' = \Pi(a'_I,T',\rho') a ′ = Π ( a I ′ , T ′ , ρ ′ ) . a ∈ U i ∗ a \in\mathcal{U}_i^* a ∈ U i ∗ via G-Pi provides inner data a I ∈ U i ∗ ↘ P I ↘ E l I a_I \in\mathcal{U}_i^* \searrow P_I \searrow\mathrm{El}_I a I ∈ U i ∗ ↘ P I ↘ El I and a codomain clause: for any D : : b ≈ b ′ ∈ R I D :: b \approx b' \in R_I D :: b ≈ b ′ ∈ R I and c c c with ⟦ T ⟧ ( ρ , b / x ) ↘ c \llbracket T \rrbracket(\rho,b/x) \searrow c [ [ T ] ] ( ρ , b / x ) ↘ c , c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) c \in\mathcal{U}_i^* \searrow P_O(D) \searrow\mathrm{El}_O(D) c ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) .
a I ≈ a I ′ ∈ U i ↘ R I (from the U-Pi premise) a I ′ ∈ U i ∗ ↘ P I ↘ E l I (by IH on a I ≈ a I ′ ∈ U i and a I ∈ U i ∗ ) ∀ D ′ : : b ′ ≈ b ′ ′ ∈ R I , c ′ . ⟦ T ′ ⟧ ( ρ ′ , b ′ / x ) ↘ c ′ ⇒ c ′ ≈ c ′ ′ ∈ U i (by symmetry/transitivity from the U-Pi premise) ∀ D ′ : : b ′ ≈ b ′ ′ ∈ R I , c ′ . ⟦ T ′ ⟧ ( ρ ′ , b ′ / x ) ↘ c ′ ⇒ c ′ ∈ U i ∗ ↘ P O ( D ′ ) ↘ E l O ( D ′ ) (by IH on the codomain fibers, transporting from c ≈ c ′ ) Π ( a I ′ , T ′ , ρ ′ ) ≈ Π ( a I ′ , T ′ , ρ ′ ) ∈ U i ↘ R (by Theorems 6.13 and 6.14) Π ( a I ′ , T ′ , ρ ′ ) ∈ U i ∗ ↘ P ↘ E l (by G-Pi at the previous data, with the same P , E l ) \begin{aligned}
a_I &\approx a'_I \in\mathcal{U}_i \searrow R_I
&&\text{(from the U-Pi premise)}\\
a'_I &\in\mathcal{U}_i^* \searrow P_I \searrow\mathrm{El}_I
&&\text{(by IH on }a_I \approx a'_I \in\mathcal{U}_i\text{ and }a_I \in\mathcal{U}_i^*\text{)}\\
\forall D' :: b' &\approx b'{}' \in R_I,\ c'.\ \llbracket T' \rrbracket(\rho',b'/x) \searrow c'
\\
&\Rightarrow c' \approx c'{}' \in\mathcal{U}_i
&&\text{(by symmetry/transitivity from the U-Pi premise)}\\
\forall D' :: b' &\approx b'{}' \in R_I,\ c'.\ \llbracket T' \rrbracket(\rho',b'/x) \searrow c'
\\
&\Rightarrow c' \in\mathcal{U}_i^* \searrow P_O(D') \searrow\mathrm{El}_O(D')
&&\text{(by IH on the codomain fibers, transporting from }c \approx c'\text{)}\\
\Pi(a'_I,T',\rho') &\approx\Pi(a'_I,T',\rho') \in\mathcal{U}_i \searrow R
&&\text{(by Theorems 6.13 and 6.14)}\\
\Pi(a'_I,T',\rho') &\in\mathcal{U}_i^* \searrow P \searrow\mathrm{El}
&&\text{(by G-Pi at the previous data, with the same }P,\ \mathrm{El}\text{)}
\end{aligned} a I a I ′ ∀ D ′ :: b ′ ∀ D ′ :: b ′ Π ( a I ′ , T ′ , ρ ′ ) Π ( a I ′ , T ′ , ρ ′ ) ≈ a I ′ ∈ U i ↘ R I ∈ U i ∗ ↘ P I ↘ El I ≈ b ′ ′ ∈ R I , c ′ . [ [ T ′ ] ] ( ρ ′ , b ′ / x ) ↘ c ′ ⇒ c ′ ≈ c ′ ′ ∈ U i ≈ b ′ ′ ∈ R I , c ′ . [ [ T ′ ] ] ( ρ ′ , b ′ / x ) ↘ c ′ ⇒ c ′ ∈ U i ∗ ↘ P O ( D ′ ) ↘ El O ( D ′ ) ≈ Π ( a I ′ , T ′ , ρ ′ ) ∈ U i ↘ R ∈ U i ∗ ↘ P ↘ El (from the U-Pi premise) (by IH on a I ≈ a I ′ ∈ U i and a I ∈ U i ∗ ) (by symmetry/transitivity from the U-Pi premise) (by IH on the codomain fibers, transporting from c ≈ c ′ ) (by Theorems 6.13 and 6.14) (by G-Pi at the previous data, with the same P , El )
Lemma 7.28 (PER membership yields gluing-model membership). If a ≈ a ∈ U i ↘ R a \approx a \in\mathcal{U}_i \searrow R a ≈ a ∈ U i ↘ R , then there exist P , E l P,\mathrm{El} P , El with a ∈ U i ∗ ↘ P ↘ E l a \in\mathcal{U}_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El .
Proof. By induction on a ≈ a ∈ U i a \approx a \in\mathcal{U}_i a ≈ a ∈ U i .
Case
U - N e b ≈ b ∈ N e R ⇔ N e u ↑ A ( b ) ≈ ↑ A ( b ) ∈ U i ↘ R \begin{gathered}
\mathrm{U\text{-}Ne}\\
b \approx b \in\mathrm{Ne}\qquad R \Leftrightarrow\mathrm{Neu}\\
\hline
\uparrow^{A}(b) \approx\uparrow^{A}(b) \in\mathcal{U}_i \searrow R
\end{gathered} U - Ne b ≈ b ∈ Ne R ⇔ Neu ↑ A ( b ) ≈ ↑ A ( b ) ∈ U i ↘ R
↑ A ( b ) ∈ U i ∗ ↘ N e u i b ↘ N e u i b (by G-Ne on b ) \uparrow^{A}(b) \in\mathcal{U}_i^{*} \searrow\mathrm{Neu}_i^{b} \searrow\mathrm{Neu}_i^{b}
\qquad\text{(by G-Ne on }b\text{)} ↑ A ( b ) ∈ U i ∗ ↘ Neu i b ↘ Neu i b (by G-Ne on b )
Case
U - U n i v j < i R ⇔ U j U j ≈ U j ∈ U i ↘ R \begin{gathered}
\mathrm{U\text{-}Univ}\\
j < i \qquad R \Leftrightarrow\mathcal{U}_j\\
\hline
\mathcal{U}_j \approx\mathcal{U}_j \in\mathcal{U}_i \searrow R
\end{gathered} U - Univ j < i R ⇔ U j U j ≈ U j ∈ U i ↘ R
U j ∈ U i ∗ ↘ U n i v i , j ↘ U n i v E l i , j (by G-Univ at j < i ) \mathcal{U}_j \in\mathcal{U}_i^{*} \searrow\mathrm{Univ}_{i,j} \searrow\mathrm{UnivEl}_{i,j}
\qquad\text{(by G-Univ at }j < i\text{)} U j ∈ U i ∗ ↘ Univ i , j ↘ UnivEl i , j (by G-Univ at j < i )
Case
U - N a t R ⇔ N a t N ≈ N ∈ U i ↘ R \begin{gathered}
\mathrm{U\text{-}Nat}\\
R \Leftrightarrow\mathrm{Nat}\\
\hline
N \approx N \in\mathcal{U}_i \searrow R
\end{gathered} U - Nat R ⇔ Nat N ≈ N ∈ U i ↘ R
N ∈ U i ∗ ↘ N a t i ↘ N a t i (by G-Nat) N \in\mathcal{U}_i^{*} \searrow\mathrm{Nat}_i \searrow\mathrm{Nat}_i
\qquad\text{(by G-Nat)} N ∈ U i ∗ ↘ Nat i ↘ Nat i (by G-Nat)
Case
U - P i a I ≈ a I ∈ U i ↘ R I R I is a PER ∀ D : : b ≈ b ∈ R I . ⟦ T ⟧ ( ρ , b / x ) ≈ ⟦ T ⟧ ( ρ , b / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D : : b ≈ b ′ ∈ R I . f ⋅ b ≈ f ′ ⋅ b ′ ∈ R O ( D ) ) Π ( a I , T , ρ ) ≈ Π ( a I , T , ρ ) ∈ U i ↘ R \begin{gathered}
\mathrm{U\text{-}Pi}\\
a_I \approx a_I \in\mathcal{U}_i \searrow R_I
\qquad R_I\text{ is a PER}\\
\forall\mathcal{D} :: b \approx b \in R_I.\ \llbracket T\rrbracket(\rho,b/x) \approx\llbracket T\rrbracket(\rho,b/x) \in\mathcal{U}_i \searrow R_O(\mathcal{D})\\
\forall f,f'.\ f \approx f' \in R \Leftrightarrow(\forall\mathcal{D} :: b \approx b' \in R_I.\ f \mathbin{\cdot} b \approx f' \mathbin{\cdot} b' \in R_O(\mathcal{D}))\\
\hline
\Pi(a_I,T,\rho) \approx\Pi(a_I,T,\rho) \in\mathcal{U}_i \searrow R
\end{gathered} U - Pi a I ≈ a I ∈ U i ↘ R I R I is a PER ∀ D :: b ≈ b ∈ R I . [ [ T ] ] ( ρ , b / x ) ≈ [ [ T ] ] ( ρ , b / x ) ∈ U i ↘ R O ( D ) ∀ f , f ′ . f ≈ f ′ ∈ R ⇔ ( ∀ D :: b ≈ b ′ ∈ R I . f ⋅ b ≈ f ′ ⋅ b ′ ∈ R O ( D )) Π ( a I , T , ρ ) ≈ Π ( a I , T , ρ ) ∈ U i ↘ R
a I ∈ U i ∗ ↘ P I ↘ E l I (by IH) a_I \in\mathcal{U}_i^{*} \searrow P_I \searrow\mathrm{El}_I
\qquad\text{(by IH)} a I ∈ U i ∗ ↘ P I ↘ El I (by IH)
∀ D : : b ≈ b ∈ R I , c . ⟦ T ⟧ ( ρ , b / x ) ↘ c \forall\mathcal{D} :: b \approx b \in R_I,\ c.\ \llbracket T\rrbracket(\rho,b/x) \searrow c ∀ D :: b ≈ b ∈ R I , c . [ [ T ] ] ( ρ , b / x ) ↘ c
⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) (by IH) \Longrightarrow c \in\mathcal{U}_i^{*} \searrow P_O(\mathcal{D}) \searrow\mathrm{El}_O(\mathcal{D})
\qquad\text{(by IH)} ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) (by IH)
Π ( a I , T , ρ ) ∈ U i ∗ ↘ Π i ( R I , P I , E l I , P O ) ↘ Π i E l ( R , R I , P I , E l I , E l O ) (by G-Pi) \Pi(a_I,T,\rho) \in\mathcal{U}_i^{*} \searrow\Pi_i(R_I,P_I,\mathrm{El}_I,P_O) \searrow\Pi_i^{\mathrm{El}}(R,R_I,P_I,\mathrm{El}_I,\mathrm{El}_O)
\qquad\text{(by G-Pi)} Π ( a I , T , ρ ) ∈ U i ∗ ↘ Π i ( R I , P I , El I , P O ) ↘ Π i El ( R , R I , P I , El I , El O ) (by G-Pi)
Lemma 7.29 (Term predicate closed under PER-equivalence). Suppose a ∈ U i ∗ ↘ P ↘ E l a \in\mathcal{U}_i^{*} \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El and a ≈ a ∈ U i ↘ R a \approx a \in\mathcal{U}_i \searrow R a ≈ a ∈ U i ↘ R . If Γ ⊢ t : S ® b ∈ E l \Gamma\vdash t : S \mathbin{\circledR} b \in\mathrm{El} Γ ⊢ t : S ® b ∈ El and b ≈ b ′ ∈ R b \approx b' \in R b ≈ b ′ ∈ R , then Γ ⊢ t : S ® b ′ ∈ E l \Gamma\vdash t : S \mathbin{\circledR} b' \in\mathrm{El} Γ ⊢ t : S ® b ′ ∈ El .
Proof. By induction on a ∈ U i ∗ a \in\mathcal{U}_i^{*} a ∈ U i ∗ .
Case
G - N e ↑ A ( e ) ∈ D P ⇔ N e u i e E l ⇔ N e u i e ↑ A ( e ) ∈ U i ∗ ↘ P ↘ E l \begin{gathered}
\mathrm{G\text{-}Ne}\\
\uparrow^{A}(e) \in\mathcal{D}\qquad P \Leftrightarrow\mathrm{Neu}_i^{e}\qquad\mathrm{El} \Leftrightarrow\mathrm{Neu}_i^{e}\\
\hline
\uparrow^{A}(e) \in\mathcal{U}_i^{*} \searrow P \searrow\mathrm{El}
\end{gathered} G - Ne ↑ A ( e ) ∈ D P ⇔ Neu i e El ⇔ Neu i e ↑ A ( e ) ∈ U i ∗ ↘ P ↘ El
R ⇔ N e u R \Leftrightarrow\mathrm{Neu} R ⇔ Neu . From E l ⇔ N e u i e \mathrm{El} \Leftrightarrow\mathrm{Neu}^{e}_{i} El ⇔ Neu i e , b = ↑ Λ 0 ( w ) b = \uparrow^{\Lambda^{0}}(w) b = ↑ Λ 0 ( w ) with w ≈ w ∈ N e w \approx w \in\mathrm{Ne} w ≈ w ∈ Ne . b ≈ b ′ ∈ R ⇔ N e u b \approx b' \in R \Leftrightarrow\mathrm{Neu} b ≈ b ′ ∈ R ⇔ Neu gives b ′ = ↑ Λ 0 ( w ′ ) b' = \uparrow^{\Lambda^{0}}(w') b ′ = ↑ Λ 0 ( w ′ ) with w ≈ w ′ ∈ N e w \approx w' \in\mathrm{Ne} w ≈ w ′ ∈ Ne .
∀ Δ ⊢ k ϕ : Γ . ∃ u . R ∣ Δ ∣ N e ( w ) ↘ u ∧ Δ ⊢ t [ ϕ ] ≈ u : S [ ϕ ] (hypothesis on b = ↑ Λ 0 ( w ) ) R ∣ Δ ∣ N e ( w ′ ) ↘ u (by definition of Ne, w ≈ w ′ read back to the same u ) Γ ⊢ t : S ® ↑ Λ 0 ( w ′ ) ∈ N e u i e (by Theorem 7.6) \begin{aligned}
&\forall\Delta\vdash_{k} \phi: \Gamma.\ \exists u.\ R^{\mathrm{Ne}}_{\lvert\Delta\rvert}(w) \searrow u \land\Delta\vdash t[\phi] \approx u : S[\phi] && \text{(hypothesis on } b = \uparrow^{\Lambda^{0}}(w)\text{)} \\
&R^{\mathrm{Ne}}_{\lvert\Delta\rvert}(w') \searrow u && \text{(by definition of Ne, } w \approx w'\text{ read back to the same }u\text{)} \\
&\Gamma\vdash t : S \mathbin{\circledR} \uparrow^{\Lambda^{0}}(w') \in\mathrm{Neu}^{e}_{i} && \text{(by Theorem 7.6)}
\end{aligned} ∀Δ ⊢ k ϕ : Γ. ∃ u . R ∣ Δ ∣ Ne ( w ) ↘ u ∧ Δ ⊢ t [ ϕ ] ≈ u : S [ ϕ ] R ∣ Δ ∣ Ne ( w ′ ) ↘ u Γ ⊢ t : S ® ↑ Λ 0 ( w ′ ) ∈ Neu i e (hypothesis on b = ↑ Λ 0 ( w ) ) (by definition of Ne, w ≈ w ′ read back to the same u ) (by Theorem 7.6)
Case
G - N a t P ⇔ N a t i E l ⇔ N a t i N ∈ U i ∗ ↘ P ↘ E l \frac{
\begin{array}{c}
\mathrm{G\text{-}Nat}\\
P \Leftrightarrow\mathrm{Nat}_{i}\qquad\mathrm{El} \Leftrightarrow\mathrm{Nat}_{i}
\end{array}
}{
N \in\mathcal{U}^{*}_{i}\searrow P\searrow\mathrm{El}
} N ∈ U i ∗ ↘ P ↘ El G - Nat P ⇔ Nat i El ⇔ Nat i
R ⇔ N a t R \Leftrightarrow\mathrm{Nat} R ⇔ Nat , and b ≈ b ′ ∈ N a t b \approx b' \in\mathrm{Nat} b ≈ b ′ ∈ Nat . By inner induction on the Nat derivation (Theorem 6.6).
Sub-case
N a t - Z e z e ≈ z e ∈ N a t \frac{\mathrm{Nat\text{-}Ze}}{ze \approx ze \in\mathrm{Nat}} z e ≈ z e ∈ Nat Nat - Ze
b = b ′ = z e b = b' = ze b = b ′ = z e ; the predicate is unchanged.
Sub-case
b 0 ≈ b 0 ′ ∈ N a t N a t - S u s u ( b 0 ) ≈ s u ( b 0 ′ ) ∈ N a t \frac{
\begin{array}{c}
b_{0} \approx b'_{0} \in\mathrm{Nat}\\
\mathrm{Nat\text{-}Su}
\end{array}
}{
su(b_{0}) \approx su(b'_{0}) \in\mathrm{Nat}
} s u ( b 0 ) ≈ s u ( b 0 ′ ) ∈ Nat b 0 ≈ b 0 ′ ∈ Nat Nat - Su
b = s u ( b 0 ) b = su(b_{0}) b = s u ( b 0 ) , b ′ = s u ( b 0 ′ ) b' = su(b'_{0}) b ′ = s u ( b 0 ′ ) . The Nat-predicate derivation for b b b uses GN-Su from a derivation for some t 0 t_{0} t 0 at b 0 b_{0} b 0 :
Γ ⊢ t 0 : S ® b 0 ∈ N a t (from the GN-Su premise) \Gamma\vdash t_{0} : S \mathbin{\circledR} b_{0} \in\mathrm{Nat}
\qquad\text{(from the GN-Su premise)} Γ ⊢ t 0 : S ® b 0 ∈ Nat (from the GN-Su premise)
Γ ⊢ t ≈ s u c c t 0 : S (from the GN-Su premise) \Gamma\vdash t \approx succ\ t_{0} : S
\qquad\text{(from the GN-Su premise)} Γ ⊢ t ≈ s u cc t 0 : S (from the GN-Su premise)
Γ ⊢ t 0 : S ® b 0 ′ ∈ N a t (by inner IH) \Gamma\vdash t_{0} : S \mathbin{\circledR} b'_{0} \in\mathrm{Nat}
\qquad\text{(by inner IH)} Γ ⊢ t 0 : S ® b 0 ′ ∈ Nat (by inner IH)
Γ ⊢ t : S ® s u ( b 0 ′ ) ∈ N a t (by GN-Su repackaging) \Gamma\vdash t : S \mathbin{\circledR} su(b'_{0}) \in\mathrm{Nat}
\qquad\text{(by GN-Su repackaging)} Γ ⊢ t : S ® s u ( b 0 ′ ) ∈ Nat (by GN-Su repackaging)
Sub-case
N a t - N e e ≈ e ′ ∈ N e ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ N a t \frac{
\begin{array}{c}
\mathrm{Nat\text{-}Ne}\\
e \approx e' \in\mathrm{Ne}
\end{array}
}{
\uparrow^{N}(e) \approx\uparrow^{N}(e') \in\mathrm{Nat}
} ↑ N ( e ) ≈ ↑ N ( e ′ ) ∈ Nat Nat - Ne e ≈ e ′ ∈ Ne
b = ↑ N ( e ) b = \uparrow^{N}(e) b = ↑ N ( e ) , b ′ = ↑ N ( e ′ ) b' = \uparrow^{N}(e') b ′ = ↑ N ( e ′ ) . The Nat-predicate derivation for b b b uses GN-Ne from a neutral predicate at e e e :
Γ ⊢ t : S ® e ∈ N e i N (from the GN-Ne premise) \Gamma\vdash t : S \mathbin{\circledR} e \in\mathrm{Ne}^{N}_{i}
\qquad\text{(from the GN-Ne premise)} Γ ⊢ t : S ® e ∈ Ne i N (from the GN-Ne premise)
Γ ⊢ t : S ® e ′ ∈ N e i N (by readback equality: e ≈ e ′ ∈ N e implies R N e ( e ) = R N e ( e ′ ) at every depth) \Gamma\vdash t : S \mathbin{\circledR} e' \in\mathrm{Ne}^{N}_{i}
\qquad\text{(by readback equality: }e \approx e' \in\mathrm{Ne}\text{ implies }R^{\mathrm{Ne}}(e)=R^{\mathrm{Ne}}(e')\text{ at every depth)} Γ ⊢ t : S ® e ′ ∈ Ne i N (by readback equality: e ≈ e ′ ∈ Ne implies R Ne ( e ) = R Ne ( e ′ ) at every depth)
Γ ⊢ t : S ® ↑ N ( e ′ ) ∈ N a t (by GN-Ne) \Gamma\vdash t : S \mathbin{\circledR} \uparrow^{N}(e') \in\mathrm{Nat}
\qquad\text{(by GN-Ne)} Γ ⊢ t : S ® ↑ N ( e ′ ) ∈ Nat (by GN-Ne)
Case
G - U n i v j < i P ⇔ U n i v i , j E l ⇔ U n i v i , j E l U j ∈ U i ∗ ↘ P ↘ E l \frac{
\begin{array}{c}
\mathrm{G\text{-}Univ}\\
j < i \qquad P \Leftrightarrow\mathrm{Univ}_{i,j}\qquad\mathrm{El} \Leftrightarrow\mathrm{Univ}^{\mathrm{El}}_{i,j}
\end{array}
}{
U_{j} \in\mathcal{U}^{*}_{i}\searrow P\searrow\mathrm{El}
} U j ∈ U i ∗ ↘ P ↘ El G - Univ j < i P ⇔ Univ i , j El ⇔ Univ i , j El
R ⇔ U j R \Leftrightarrow\mathcal{U}_j R ⇔ U j . By Theorem 7.12, b ∈ U j ∗ ↘ P b ↘ E l b b \in\mathcal{U}_j^* \searrow P_b \searrow\mathbf{El}_b b ∈ U j ∗ ↘ P b ↘ El b with Γ ⊢ t : T y j ® P b \Gamma\vdash t : \mathsf{Ty}_j \mathbin{\circledR} P_b Γ ⊢ t : Ty j ® P b , and b ≈ b ′ ∈ U j b \approx b' \in\mathcal{U}_j b ≈ b ′ ∈ U j .
b ′ ∈ U j ∗ ↘ P b ↘ E l b b' \in\mathcal{U}_j^* \searrow P_b \searrow\mathbf{El}_b b ′ ∈ U j ∗ ↘ P b ↘ El b \hfill (by Theorem 7.27 at level j j j on b ≈ b ′ b \approx b' b ≈ b ′ )
Γ ⊢ t : T y j ® P b \Gamma\vdash t : \mathsf{Ty}_j \mathbin{\circledR} P_b Γ ⊢ t : Ty j ® P b \hfill (unchanged from hypothesis)
Γ ⊢ t : S ® b ′ ∈ U n i v E l i , j \Gamma\vdash t : S \mathbin{\circledR} b' \in\mathsf{UnivEl}_{i,j} Γ ⊢ t : S ® b ′ ∈ UnivEl i , j \hfill (by Theorem 7.12 with the previous lines and Γ ⊢ S ≈ T y j : T y i \Gamma\vdash S \approx\mathsf{Ty}_j : \mathsf{Ty}_i Γ ⊢ S ≈ Ty j : Ty i )
Case
G-Pi
a ∈ U i ∗ ↘ P I ↘ E l I a ≈ a ∈ U i ↘ R I ∀ D : : b 0 ≈ b 0 ∈ R I , c . ⟦ T ⟧ ( ρ , b 0 / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R P ⟺ Π i ( … ) E l ⟺ Π i E l ( … ) Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ E l \begin{gathered}
a \in\mathcal{U}_i^* \searrow P_I \searrow\mathbf{El}_I
\qquad
a \approx a \in\mathcal{U}_i \searrow R_I\\
\forall D :: b_0 \approx b_0 \in R_I,\ c.\ \llbracket T \rrbracket(\rho,b_0/x) \searrow c \Longrightarrow c \in\mathcal{U}_i^* \searrow P_O(D) \searrow\mathbf{El}_O(D)\\
\Pi(a,T,\rho) \approx\Pi(a,T,\rho) \in\mathcal{U}_i \searrow R\\
P \Longleftrightarrow\Pi_i(\ldots)\qquad\mathbf{El} \Longleftrightarrow\Pi_i^{\mathbf{El}}(\ldots)\\
\Pi(a,T,\rho) \in\mathcal{U}_i^* \searrow P \searrow\mathbf{El}
\end{gathered} a ∈ U i ∗ ↘ P I ↘ El I a ≈ a ∈ U i ↘ R I ∀ D :: b 0 ≈ b 0 ∈ R I , c . [ [ T ] ] ( ρ , b 0 / x ) ↘ c ⟹ c ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) Π ( a , T , ρ ) ≈ Π ( a , T , ρ ) ∈ U i ↘ R P ⟺ Π i ( … ) El ⟺ Π i El ( … ) Π ( a , T , ρ ) ∈ U i ∗ ↘ P ↘ El
Hypothesis: Γ ⊢ t : S ® f ∈ Π i E l ( R , R I , P I , E l I , E l O ) \Gamma\vdash t : S \mathbin{\circledR} f \in\Pi_i^{\mathbf{El}}(R,R_I,P_I,\mathbf{El}_I,\mathbf{El}_O) Γ ⊢ t : S ® f ∈ Π i El ( R , R I , P I , El I , El O ) and f ≈ f ′ ∈ R f \approx f' \in R f ≈ f ′ ∈ R . We verify the four clauses of Theorem 7.10 at f ′ f' f ′ .
(1) Self-relatedness f ′ ≈ f ′ ∈ R f' \approx f' \in R f ′ ≈ f ′ ∈ R : by PER symmetry and transitivity on f ≈ f ′ ∈ R f \approx f' \in R f ≈ f ′ ∈ R (Theorems 6.13 and 6.14).
(2) R I R_I R I -coherence of f ′ f' f ′ : clause (2) is a property of R R R -classes; since f f f , f ′ f' f ′ are in the same R R R -class, the coherence transfers.
(3) Type-readback of f ′ f' f ′ : clause (3) depends only on S S S and the Π \Pi Π -shape, not on the function value, so it transfers verbatim.
(4) Application: let Δ ⊢ k ϕ : Γ , s , b 0 , D : : b 0 ≈ b 0 ∈ R I \Delta\vdash_k \phi: \Gamma, s, b_0, D :: b_0 \approx b_0 \in R_I Δ ⊢ k ϕ : Γ , s , b 0 , D :: b 0 ≈ b 0 ∈ R I with Δ ⊢ s : S 1 [ ϕ ] ® b 0 ∈ E l I \Delta\vdash s : S_1[\phi] \mathbin{\circledR} b_0 \in\mathbf{El}_I Δ ⊢ s : S 1 [ ϕ ] ® b 0 ∈ El I .
f ⋅ b 0 ↘ c f \cdot b_0 \searrow c f ⋅ b 0 ↘ c \hfill (by hypothesis on f f f , clause (4))
Δ ⊢ ( t [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ E l O ( D ) \Delta\vdash(t[\phi])\ s : S_2[\iota(\phi),s/x] \mathbin{\circledR} c \in\mathbf{El}_O(D) Δ ⊢ ( t [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ] ® c ∈ El O ( D ) \hfill (by hypothesis on f f f , clause (4))
f ⋅ b 0 ≈ f ′ ⋅ b 0 ∈ R O ( D ) f \cdot b_0 \approx f' \cdot b_0 \in R_O(D) f ⋅ b 0 ≈ f ′ ⋅ b 0 ∈ R O ( D ) \hfill (by the application clause of R R R for f ≈ f ′ ∈ R f \approx f' \in R f ≈ f ′ ∈ R at b 0 ≈ b 0 ∈ R I b_0 \approx b_0 \in R_I b 0 ≈ b 0 ∈ R I )
∃ c ′ . f ′ ⋅ b 0 ↘ c ′ , c ≈ c ′ ∈ R O ( D ) \exists c'.\ f' \cdot b_0 \searrow c',\ c \approx c' \in R_O(D) ∃ c ′ . f ′ ⋅ b 0 ↘ c ′ , c ≈ c ′ ∈ R O ( D ) \hfill (by determinism of evaluation and the previous line)
Δ ⊢ ( t [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] ® c ′ ∈ E l O ( D ) \Delta\vdash(t[\phi])\ s : S_2[\iota(\phi),s/x] \mathbin{\circledR} c' \in\mathbf{El}_O(D) Δ ⊢ ( t [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ] ® c ′ ∈ El O ( D ) \hfill (by IH on the codomain fiber E l O ( D ) \mathbf{El}_O(D) El O ( D ) , applied to c ≈ c ′ c \approx c' c ≈ c ′ )
(5) R I R_I R I -coherence under application: a property of the R R R -class on the codomain; transfers as in clauses (1)–(2).
□ \square □
Lemma 7.30 (Subtyping type-escape). Suppose a 1 ∈ U i ∗ ↘ P 1 ↘ E l 1 a_1 \in\mathcal{U}_i^* \searrow P_1 \searrow\mathbf{El}_1 a 1 ∈ U i ∗ ↘ P 1 ↘ El 1 , a 2 ∈ U i ∗ ↘ P 2 ↘ E l 2 a_2 \in\mathcal{U}_i^* \searrow P_2 \searrow\mathbf{El}_2 a 2 ∈ U i ∗ ↘ P 2 ↘ El 2 , and a 1 < : i a 2 a_1 {<:}_i a_2 a 1 <: i a 2 (semantic subtyping from Sec. 6). If Γ ⊢ S 1 : T y i ® P 1 \Gamma\vdash S_1 : \mathsf{Ty}_i \mathbin{\circledR} P_1 Γ ⊢ S 1 : Ty i ® P 1 and Γ ⊢ S 2 : T y i ® P 2 \Gamma\vdash S_2 : \mathsf{Ty}_i \mathbin{\circledR} P_2 Γ ⊢ S 2 : Ty i ® P 2 , then Γ ⊢ S 1 ⊆ S 2 \Gamma\vdash S_1 \subseteq S_2 Γ ⊢ S 1 ⊆ S 2 .
Proof. By induction on a 1 < : i a 2 a_1 {<:}_i a_2 a 1 <: i a 2 .
Case
b ≈ b ′ ∈ N e ↑ A ( b ) < : i ↑ A ′ ( b ′ ) \frac{
\begin{gathered}
b \approx b' \in\mathsf{Ne}
\end{gathered}
}{
\uparrow^{A}(b) {<:}_i \uparrow^{A'}(b')
} ↑ A ( b ) <: i ↑ A ′ ( b ′ ) b ≈ b ′ ∈ Ne
P 1 ⇔ N e u i b P_1 \Leftrightarrow\mathsf{Neu}_i^b P 1 ⇔ Neu i b , P 2 ⇔ N e u i b ′ P_2 \Leftrightarrow\mathsf{Neu}_i^{b'} P 2 ⇔ Neu i b ′ . The hypothesis b ≈ b ′ ∈ N e b \approx b' \in\mathsf{Ne} b ≈ b ′ ∈ Ne implies R n N e ( b ) R_n^{\mathsf{Ne}}(b) R n Ne ( b ) and R n N e ( b ′ ) R_n^{\mathsf{Ne}}(b') R n Ne ( b ′ ) produce the same syntactic neutral at every depth.
R ∣ Γ ∣ N e ( b ) ↘ u , Γ ⊢ S 1 ≈ u : T y i R_{|\Gamma|}^{\mathsf{Ne}}(b) \searrow u,\ \Gamma\vdash S_1 \approx u : \mathsf{Ty}_i R ∣Γ∣ Ne ( b ) ↘ u , Γ ⊢ S 1 ≈ u : Ty i \hfill (by Theorem 7.5 on S 1 S_1 S 1 at ϕ = id \phi= \operatorname{id} ϕ = id )
R ∣ Γ ∣ N e ( b ′ ) ↘ u R_{|\Gamma|}^{\mathsf{Ne}}(b') \searrow u R ∣Γ∣ Ne ( b ′ ) ↘ u \hfill (by b ≈ b ′ ∈ N e b \approx b' \in\mathsf{Ne} b ≈ b ′ ∈ Ne , same readback)
Γ ⊢ S 2 ≈ u : T y i (by Theorem 7.5 on S 2 at ϕ = i d ) Γ ⊢ S 1 ≈ S 2 : T y i (by symmetry/transitivity of judgmental equality) Γ ⊢ S 1 ⊆ S 2 (by Sub-Eq on the previous line) \begin{aligned}
\Gamma\vdash S_2 \approx u : \mathrm{Ty}_i &&& \text{(by Theorem 7.5 on } S_2 \text{ at } \phi=\mathrm{id}\text{)}\\
\Gamma\vdash S_1 \approx S_2 : \mathrm{Ty}_i &&& \text{(by symmetry/transitivity of judgmental equality)}\\
\Gamma\vdash S_1 \subseteq S_2 &&& \text{(by Sub-Eq on the previous line)}
\end{aligned} Γ ⊢ S 2 ≈ u : Ty i Γ ⊢ S 1 ≈ S 2 : Ty i Γ ⊢ S 1 ⊆ S 2 (by Theorem 7.5 on S 2 at ϕ = id ) (by symmetry/transitivity of judgmental equality) (by Sub-Eq on the previous line)
Case
<:-Univ j ≤ k k < i U j < : i U k \begin{gathered}
\text{<:-Univ}\\
j \leq k \qquad k < i\\
\hline
U_j \mathrel{<: _i} U_k
\end{gathered} <:-Univ j ≤ k k < i U j < : i U k
P 1 ⇔ U n i v i , j P_1 \Leftrightarrow\mathrm{Univ}_{i,j} P 1 ⇔ Univ i , j , P 2 ⇔ U n i v i , k P_2 \Leftrightarrow\mathrm{Univ}_{i,k} P 2 ⇔ Univ i , k .
Γ ⊢ S 1 ≈ T y j : T y i (by Theorem 7.11 on U n i v i , j ) Γ ⊢ S 2 ≈ T y k : T y i (by Theorem 7.11 on U n i v i , k ) Γ ⊢ T y j ⊆ T y k (by Sub-Univ from j ≤ k ) Γ ⊢ S 1 ⊆ S 2 (by Sub-Trans via the equalities and the previous line) \begin{aligned}
\Gamma\vdash S_1 \approx\mathrm{Ty}_j : \mathrm{Ty}_i &&& \text{(by Theorem 7.11 on }\mathrm{Univ}_{i,j}\text{)}\\
\Gamma\vdash S_2 \approx\mathrm{Ty}_k : \mathrm{Ty}_i &&& \text{(by Theorem 7.11 on }\mathrm{Univ}_{i,k}\text{)}\\
\Gamma\vdash\mathrm{Ty}_j \subseteq\mathrm{Ty}_k &&& \text{(by Sub-Univ from }j \leq k\text{)}\\
\Gamma\vdash S_1 \subseteq S_2 &&& \text{(by Sub-Trans via the equalities and the previous line)}
\end{aligned} Γ ⊢ S 1 ≈ Ty j : Ty i Γ ⊢ S 2 ≈ Ty k : Ty i Γ ⊢ Ty j ⊆ Ty k Γ ⊢ S 1 ⊆ S 2 (by Theorem 7.11 on Univ i , j ) (by Theorem 7.11 on Univ i , k ) (by Sub-Univ from j ≤ k ) (by Sub-Trans via the equalities and the previous line)
Case
<:-Nat N < : i N ‾ \begin{gathered}
\text{<:-Nat}\\
\overline{N \mathrel{<: _i} N}
\end{gathered} <:-Nat N < : i N
P 1 ⇔ P 2 ⇔ N a t i P_1 \Leftrightarrow P_2 \Leftrightarrow\mathrm{Nat}_i P 1 ⇔ P 2 ⇔ Nat i .
Γ ⊢ S 1 ≈ N a t : T y i (by Theorem 7.7 on S 1 ) Γ ⊢ S 2 ≈ N a t : T y i (by Theorem 7.7 on S 2 ) Γ ⊢ S 1 ≈ S 2 : T y i (by symmetry/transitivity through Nat) Γ ⊢ S 1 ⊆ S 2 (by Sub-Eq) \begin{aligned}
\Gamma\vdash S_1 \approx\mathrm{Nat} : \mathrm{Ty}_i &&& \text{(by Theorem 7.7 on }S_1\text{)}\\
\Gamma\vdash S_2 \approx\mathrm{Nat} : \mathrm{Ty}_i &&& \text{(by Theorem 7.7 on }S_2\text{)}\\
\Gamma\vdash S_1 \approx S_2 : \mathrm{Ty}_i &&& \text{(by symmetry/transitivity through Nat)}\\
\Gamma\vdash S_1 \subseteq S_2 &&& \text{(by Sub-Eq)}
\end{aligned} Γ ⊢ S 1 ≈ Nat : Ty i Γ ⊢ S 2 ≈ Nat : Ty i Γ ⊢ S 1 ≈ S 2 : Ty i Γ ⊢ S 1 ⊆ S 2 (by Theorem 7.7 on S 1 ) (by Theorem 7.7 on S 2 ) (by symmetry/transitivity through Nat) (by Sub-Eq)
Case
<:-Pi A ≈ A ′ ∈ U i ↘ R I ∀ D : : a ≈ a ′ ∈ R I . ⟦ T ⟧ ( ρ , a / x ) < : i ⟦ T ′ ⟧ ( ρ ′ , a ′ / x ) Π ( A , T , ρ ) ≈ Π ( A , T , ρ ) ∈ U i Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i Π ( A , T , ρ ) < : i Π ( A ′ , T ′ , ρ ′ ) \begin{gathered}
\text{<:-Pi}\\
A \approx A' \in\mathcal{U}_i \searrow R_I
\qquad
\forall D :: a \approx a' \in R_I.\ \llbracket T \rrbracket(\rho,a/x) \mathrel{<: _i} \llbracket T' \rrbracket(\rho',a'/x)\\
\Pi(A,T,\rho) \approx\Pi(A,T,\rho) \in\mathcal{U}_i
\qquad
\Pi(A',T',\rho') \approx\Pi(A',T',\rho') \in\mathcal{U}_i\\
\hline
\Pi(A,T,\rho) \mathrel{<: _i} \Pi(A',T',\rho')
\end{gathered} <:-Pi A ≈ A ′ ∈ U i ↘ R I ∀ D :: a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) < : i [ [ T ′ ] ] ( ρ ′ , a ′ / x ) Π ( A , T , ρ ) ≈ Π ( A , T , ρ ) ∈ U i Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i Π ( A , T , ρ ) < : i Π ( A ′ , T ′ , ρ ′ )
P 1 ⇔ Π i ( R I , P I , E l I , P O ) P_1 \Leftrightarrow\Pi_i(R_I,P_I,\mathrm{El}_I,P_O) P 1 ⇔ Π i ( R I , P I , El I , P O ) , P 2 ⇔ Π i ( R I ′ , P I ′ , E l I ′ , P O ′ ) P_2 \Leftrightarrow\Pi_i(R'_I,P'_I,\mathrm{El}'_I,P'_O) P 2 ⇔ Π i ( R I ′ , P I ′ , El I ′ , P O ′ ) . The domain PERs are related by equality (A ≈ A ′ ∈ U i ↘ R I A \approx A' \in\mathcal{U}_i \searrow R_I A ≈ A ′ ∈ U i ↘ R I , so R I = R I ′ R_I = R'_I R I = R I ′ via Theorem 6.12; correspondingly P I ⇔ P I ′ P_I \Leftrightarrow P'_I P I ⇔ P I ′ , E l I ⇔ E l I ′ \mathrm{El}_I \Leftrightarrow\mathrm{El}'_I El I ⇔ El I ′ via Theorem 7.27).
Given Γ ⊢ S 1 : T y i ⊗ Π i ( … ) \Gamma\vdash S_1 : \mathrm{Ty}_i \otimes\Pi_i(\ldots) Γ ⊢ S 1 : Ty i ⊗ Π i ( … ) at shape Π ( x : S 1 , 1 ) . S 1 , 2 \Pi(x : S_{1,1}).S_{1,2} Π ( x : S 1 , 1 ) . S 1 , 2 and similarly S 2 S_2 S 2 at Π ( x : S 2 , 1 ) . S 2 , 2 \Pi(x : S_{2,1}).S_{2,2} Π ( x : S 2 , 1 ) . S 2 , 2 (both by Theorem 7.9 clause 1).
Γ ⊢ S 1 , 1 : T y i ⊗ P I (by Theorem 7.9 clause 2 on S 1 at ϕ = i d ) Γ ⊢ S 2 , 1 : T y i ⊗ P I (symmetrically on S 2 , using P I ′ ⇔ P I ) Γ ⊢ S 1 , 1 ≈ S 2 , 1 : T y i (by Theorem 7.24 on the two predicates at a = A ) Γ , x : S 1 , 1 ⊢ S 1 , 2 ⊆ S 2 , 2 (by IH on the codomain subtyping at fresh variable x at A ) Γ ⊢ Π ( x : S 1 , 1 ) . S 1 , 2 ⊆ Π ( x : S 2 , 1 ) . S 2 , 2 (by Sub-Pi) Γ ⊢ S 1 ⊆ S 2 (by Sub-Eq with the Π -shape equalities) \begin{aligned}
\Gamma\vdash S_{1,1} : \mathrm{Ty}_i \otimes P_I &&& \text{(by Theorem 7.9 clause 2 on }S_1\text{ at }\phi=\mathrm{id}\text{)}\\
\Gamma\vdash S_{2,1} : \mathrm{Ty}_i \otimes P_I &&& \text{(symmetrically on }S_2\text{, using }P'_{I} \Leftrightarrow P_I\text{)}\\
\Gamma\vdash S_{1,1} \approx S_{2,1} : \mathrm{Ty}_i &&& \text{(by Theorem 7.24 on the two predicates at }a=A\text{)}\\
\Gamma,x : S_{1,1} \vdash S_{1,2} \subseteq S_{2,2} &&& \text{(by IH on the codomain subtyping at fresh variable }x\text{ at }A\text{)}\\
\Gamma\vdash\Pi(x : S_{1,1}).S_{1,2} \subseteq\Pi(x : S_{2,1}).S_{2,2} &&& \text{(by Sub-Pi)}\\
\Gamma\vdash S_1 \subseteq S_2 &&& \text{(by Sub-Eq with the }\Pi\text{-shape equalities)}
\end{aligned} Γ ⊢ S 1 , 1 : Ty i ⊗ P I Γ ⊢ S 2 , 1 : Ty i ⊗ P I Γ ⊢ S 1 , 1 ≈ S 2 , 1 : Ty i Γ , x : S 1 , 1 ⊢ S 1 , 2 ⊆ S 2 , 2 Γ ⊢ Π ( x : S 1 , 1 ) . S 1 , 2 ⊆ Π ( x : S 2 , 1 ) . S 2 , 2 Γ ⊢ S 1 ⊆ S 2 (by Theorem 7.9 clause 2 on S 1 at ϕ = id ) (symmetrically on S 2 , using P I ′ ⇔ P I ) (by Theorem 7.24 on the two predicates at a = A ) (by IH on the codomain subtyping at fresh variable x at A ) (by Sub-Pi) (by Sub-Eq with the Π -shape equalities)
Lemma 7.31 (Subtyping term-transfer). Suppose a 1 ∈ U i ∗ ↘ P 1 ↘ E l 1 a_1 \in\mathcal{U}_i^* \searrow P_1 \searrow\mathbf{El}_1 a 1 ∈ U i ∗ ↘ P 1 ↘ El 1 , a 2 ∈ U i ∗ ↘ P 2 ↘ E l 2 a_2 \in\mathcal{U}_i^* \searrow P_2 \searrow\mathbf{El}_2 a 2 ∈ U i ∗ ↘ P 2 ↘ El 2 , and a 1 < : i a 2 a_1 <:_i a_2 a 1 < : i a 2 . If Γ ⊢ S 2 : T y i ⊚ P 2 \Gamma\vdash S_2 : \mathsf{Ty}_i \circledcirc P_2 Γ ⊢ S 2 : Ty i ⊚ P 2 and Γ ⊢ t : S 1 ⊚ b ∈ E l 1 \Gamma\vdash t : S_1 \circledcirc b \in\mathbf{El}_1 Γ ⊢ t : S 1 ⊚ b ∈ El 1 , then Γ ⊢ t : S 2 ⊚ b ∈ E l 2 \Gamma\vdash t : S_2 \circledcirc b \in\mathbf{El}_2 Γ ⊢ t : S 2 ⊚ b ∈ El 2 .
Proof. By induction on a 1 < : i a 2 a_1 <:_i a_2 a 1 < : i a 2 . Each case extracts the type predicate at S 1 S_1 S 1 from the term predicate (via the relevant El-definition) and then applies Theorem 7.30 to obtain Γ ⊢ S 1 ⊆ S 2 \Gamma\vdash S_1 \subseteq S_2 Γ ⊢ S 1 ⊆ S 2 .
Case
b ≈ b ′ ∈ N e ↑ A ( b ) < : i ↑ A ′ ( b ′ ) \frac{b \approx b' \in\mathsf{Ne}}{\uparrow^{\mathsf{A}}(b) <:_i \uparrow^{\mathsf{A}'}(b')} ↑ A ( b ) < : i ↑ A ′ ( b ′ ) b ≈ b ′ ∈ Ne
P 1 ⇔ E l 1 ⇔ N e u i b P_1 \Leftrightarrow\mathbf{El}_1 \Leftrightarrow\mathsf{Neu}_i^b P 1 ⇔ El 1 ⇔ Neu i b , P 2 ⇔ E l 2 ⇔ N e u i b ′ P_2 \Leftrightarrow\mathbf{El}_2 \Leftrightarrow\mathsf{Neu}_i^{b'} P 2 ⇔ El 2 ⇔ Neu i b ′ . Given Γ ⊢ t : S 1 ⊚ w ∈ N e u i b \Gamma\vdash t : S_1 \circledcirc w \in\mathsf{Neu}_i^b Γ ⊢ t : S 1 ⊚ w ∈ Neu i b .
Γ ⊢ S 1 : T y i ⊚ N e u i b (by xref‘Theorem 7.6‘ on the hypothesis) \Gamma\vdash S_1 : \mathsf{Ty}_i \circledcirc\mathsf{Neu}_i^b \qquad\text{(by {xref}`Theorem 7.6` on the hypothesis)} Γ ⊢ S 1 : Ty i ⊚ Neu i b (by xref ‘Theorem 7.6‘ on the hypothesis)
\Gamma\vdash S_1 \subseteq S_2 \qquad\text{(by {xref}`Theorem 7.30` on \$S_1\$, \$S_2\$, \$P_1\$, \$P_2\$)}
For each Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , by Theorem 7.6:
∃ v . R b N e ( w ) ↘ v ∧ Δ ⊢ t [ ϕ ] ≈ v : S 1 [ ϕ ] (Kripke condition at $w$) \exists v.\ R^{\mathsf{Ne}}_b(w) \searrow v \mathbin{\wedge} \Delta\vdash t[\phi] \approx v : S_1[\phi] \qquad\text{(Kripke condition at \$w\$)} ∃ v . R b Ne ( w ) ↘ v ∧ Δ ⊢ t [ ϕ ] ≈ v : S 1 [ ϕ ] (Kripke condition at $w$)
Δ ⊢ S 1 [ ϕ ] ⊆ S 2 [ ϕ ] (by xref‘Theorem 4.1‘ on the previous-block subtyping) \Delta\vdash S_1[\phi] \subseteq S_2[\phi] \qquad\text{(by {xref}`Theorem 4.1` on the previous-block subtyping)} Δ ⊢ S 1 [ ϕ ] ⊆ S 2 [ ϕ ] (by xref ‘Theorem 4.1‘ on the previous-block subtyping)
Δ ⊢ t [ ϕ ] ≈ v : S 2 [ ϕ ] (by Tm-Subsump on the previous two lines) \Delta\vdash t[\phi] \approx v : S_2[\phi] \qquad\text{(by Tm-Subsump on the previous two lines)} Δ ⊢ t [ ϕ ] ≈ v : S 2 [ ϕ ] (by Tm-Subsump on the previous two lines)
Combining with b ≈ b ′ ∈ N e b \approx b' \in\mathsf{Ne} b ≈ b ′ ∈ Ne (same readback at every depth) and the type predicate at S 2 S_2 S 2 (hypothesis), Theorem 7.6 gives Γ ⊢ t : S 2 ⊚ w ∈ N e u i b ′ \Gamma\vdash t : S_2 \circledcirc w \in\mathsf{Neu}_i^{b'} Γ ⊢ t : S 2 ⊚ w ∈ Neu i b ′ .
Case
j ≤ k k < i U j < : i U k \frac{j \leq k \qquad k < i}{U_j <:_i U_k} U j < : i U k j ≤ k k < i
E l 1 ⇔ U n i v i , j E l \mathbf{El}_1 \Leftrightarrow\mathsf{Univ}^{\mathbf{El}}_{i,j} El 1 ⇔ Univ i , j El , E l 2 ⇔ U n i v i , k E l \mathbf{El}_2 \Leftrightarrow\mathsf{Univ}^{\mathbf{El}}_{i,k} El 2 ⇔ Univ i , k El . Given Γ ⊢ t : S 1 ⊚ b ∈ U n i v i , j E l \Gamma\vdash t : S_1 \circledcirc b \in\mathsf{Univ}^{\mathbf{El}}_{i,j} Γ ⊢ t : S 1 ⊚ b ∈ Univ i , j El , so by Theorem 7.12: b ∈ U j ∗ ↘ P b ↘ E l b b \in\mathcal{U}_j^* \searrow P_b \searrow\mathbf{El}_b b ∈ U j ∗ ↘ P b ↘ El b and Γ ⊢ t : T y j ⊚ P b \Gamma\vdash t : \mathsf{Ty}_j \circledcirc P_b Γ ⊢ t : Ty j ⊚ P b .
\exists P_b',\mathbf{El}_b'.\ b \in\mathcal{U}_k^* \searrow P_b' \searrow\mathbf{El}_b' \qquad\text{(by {xref}`Theorem 7.25` existence at \$k\$, since \$j \leq k\$)}
Γ ⊢ t : T y k ⊚ P b ′ (by xref‘Theorem 7.25‘ (1) raising on $b$ from $j$ to $k$) \Gamma\vdash t : \mathsf{Ty}_k \circledcirc P_b' \qquad\text{(by {xref}`Theorem 7.25` (1) raising on \$b\$ from \$j\$ to \$k\$)} Γ ⊢ t : Ty k ⊚ P b ′ (by xref ‘Theorem 7.25‘ (1) raising on $b$ from $j$ to $k$)
\Gamma\vdash S_2 : \mathsf{Ty}_i \circledcirc\mathsf{Univ}_{i,k} \qquad\text{(by hypothesis \$P_2 = \mathsf{Univ}_{i,k}\$)}
Γ ⊢ t : S 2 ⊚ b ∈ U n i v i , k E l (by xref‘Theorem 7.12‘ with the previous lines) \Gamma\vdash t : S_2 \circledcirc b \in\mathsf{Univ}^{\mathbf{El}}_{i,k} \qquad\text{(by {xref}`Theorem 7.12` with the previous lines)} Γ ⊢ t : S 2 ⊚ b ∈ Univ i , k El (by xref ‘Theorem 7.12‘ with the previous lines)
Case
N < : i N \frac{}{N <:_i N} N < : i N
P 1 ⇔ E l 1 ⇔ P 2 ⇔ E l 2 ⇔ N a t i P_1 \Leftrightarrow\mathbf{El}_1 \Leftrightarrow P_2 \Leftrightarrow\mathbf{El}_2 \Leftrightarrow\mathsf{Nat}_i P 1 ⇔ El 1 ⇔ P 2 ⇔ El 2 ⇔ Nat i . Given Γ ⊢ t : S 1 ⊚ b ∈ N a t i \Gamma\vdash t : S_1 \circledcirc b \in\mathsf{Nat}_i Γ ⊢ t : S 1 ⊚ b ∈ Nat i .
Γ ⊢ S 1 : T y i ⊚ N a t i (by xref‘Theorem 7.8‘ on the hypothesis) \Gamma\vdash S_1 : \mathsf{Ty}_i \circledcirc\mathsf{Nat}_i \qquad\text{(by {xref}`Theorem 7.8` on the hypothesis)} Γ ⊢ S 1 : Ty i ⊚ Nat i (by xref ‘Theorem 7.8‘ on the hypothesis)
Γ ⊢ S 1 ⊆ S 2 (by xref‘Theorem 7.30‘) \Gamma\vdash S_1 \subseteq S_2 \qquad\text{(by {xref}`Theorem 7.30`)} Γ ⊢ S 1 ⊆ S 2 (by xref ‘Theorem 7.30‘)
\Gamma\vdash S_1 \approx S_2 : \mathsf{Ty}_i \qquad\text{(by {xref}`Theorem 7.7` on \$S_1\$ and \$S_2\$, both equal Nat)}
Γ ⊢ t : S 2 ⊚ b ∈ N a t i (by xref‘Theorem 7.26‘ (3) on $a = N$) \Gamma\vdash t : S_2 \circledcirc b \in\mathsf{Nat}_i \qquad\text{(by {xref}`Theorem 7.26` (3) on \$a = N\$)} Γ ⊢ t : S 2 ⊚ b ∈ Nat i (by xref ‘Theorem 7.26‘ (3) on $a = N$)
Case
< : − Π A ≈ A ′ ∈ U i ↘ R I ∀ D : : a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) < : i [ [ T ′ ] ] ( ρ ′ , a ′ / x ) Π ( A , T , ρ ) ≈ Π ( A , T , ρ ) ∈ U i Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i Π ( A , T , ρ ) < : i Π ( A ′ , T ′ , ρ ′ ) \begin{gathered}
<\!:\!-\Pi\\
A \approx A' \in U_i \searrow R_I \qquad\forall D :: a \approx a' \in R_I.\ [\![T]\!](\rho,a/x) <\!:\!_i [\![T']\!](\rho',a'/x) \\
\Pi(A,T,\rho) \approx\Pi(A,T,\rho) \in U_i \qquad\Pi(A',T',\rho') \approx\Pi(A',T',\rho') \in U_i \\
\Pi(A,T,\rho) <\!:\!_i \Pi(A',T',\rho')
\end{gathered} < : − Π A ≈ A ′ ∈ U i ↘ R I ∀ D :: a ≈ a ′ ∈ R I . [ [ T ] ] ( ρ , a / x ) < : i [ [ T ′ ] ] ( ρ ′ , a ′ / x ) Π ( A , T , ρ ) ≈ Π ( A , T , ρ ) ∈ U i Π ( A ′ , T ′ , ρ ′ ) ≈ Π ( A ′ , T ′ , ρ ′ ) ∈ U i Π ( A , T , ρ ) < : i Π ( A ′ , T ′ , ρ ′ )
P 1 ⇔ Π i ( R I , P I , E l I , P O ) P_1 \Leftrightarrow\Pi_i(R_I,P_I,\mathrm{El}_I,P_O) P 1 ⇔ Π i ( R I , P I , El I , P O ) , E l 1 ⇔ Π i E l ( R , R I , P I , E l I , E l O ) \mathrm{El}_1 \Leftrightarrow\Pi_i^{\mathrm{El}}(R,R_I,P_I,\mathrm{El}_I,\mathrm{El}_O) El 1 ⇔ Π i El ( R , R I , P I , El I , El O ) , P 2 ⇔ Π i ( R I , P I , E l I , P O ′ ) P_2 \Leftrightarrow\Pi_i(R_I,P_I,\mathrm{El}_I,P'_O) P 2 ⇔ Π i ( R I , P I , El I , P O ′ ) , E l 2 ⇔ Π i E l ( R ′ , R I , P I , E l I , E l O ′ ) \mathrm{El}_2 \Leftrightarrow\Pi_i^{\mathrm{El}}(R',R_I,P_I,\mathrm{El}_I,\mathrm{El}'_O) El 2 ⇔ Π i El ( R ′ , R I , P I , El I , El O ′ ) , ( R I , P I , E l I (R_I,P_I,\mathrm{El}_I ( R I , P I , El I shared via Theorem 7.27, as the domains are PER-equal). The hypothesis P 2 P_2 P 2 has shape Π ( x : S 2 , 1 ) . S 2 , 2 \Pi(x:S_{2,1}).S_{2,2} Π ( x : S 2 , 1 ) . S 2 , 2 ; similarly S 1 S_1 S 1 has shape Π ( x : S 1 , 1 ) . S 1 , 2 \Pi(x:S_{1,1}).S_{1,2} Π ( x : S 1 , 1 ) . S 1 , 2 from the term-predicate hypothesis on E l 1 \mathrm{El}_1 El 1 via Theorem 7.10 clause 3.
<u>Setup: subtyping at the syntactic Pi-shapes.</u>
Γ ⊢ S 1 : T y i ® Π i ( R I , P I , E l I , P O ) (by Theorem 7.10 clause 3 on f ∈ E l 1 ) \Gamma\vdash S_1 : \mathrm{Ty}_i \mathrel{\circledR} \Pi_i(R_I,P_I,\mathrm{El}_I,P_O)
\qquad\text{(by Theorem 7.10 clause 3 on }f \in\mathrm{El}_1\text{)} Γ ⊢ S 1 : Ty i ® Π i ( R I , P I , El I , P O ) (by Theorem 7.10 clause 3 on f ∈ El 1 )
Γ ⊢ S 1 ⊆ S 2 (by Theorem 7.30) \Gamma\vdash S_1 \subseteq S_2
\qquad\text{(by Theorem 7.30)} Γ ⊢ S 1 ⊆ S 2 (by Theorem 7.30)
Given Γ ⊢ t : S 1 ® f ∈ Π i E l \Gamma\vdash t:S_1 \mathrel{\circledR} f \in\Pi_i^{\mathrm{El}} Γ ⊢ t : S 1 ® f ∈ Π i El at E l 1 \mathrm{El}_1 El 1 . We verify the four clauses of E l 2 ⇔ Π i E l ( R ′ , R I , P I , E l I , E l O ′ ) \mathrm{El}_2 \Leftrightarrow\Pi_i^{\mathrm{El}}(R',R_I,P_I,\mathrm{El}_I,\mathrm{El}'_O) El 2 ⇔ Π i El ( R ′ , R I , P I , El I , El O ′ ) at S 2 , t , f S_2,t,f S 2 , t , f .
<u>Clause 1.</u>
f ≈ f ∈ R (by hypothesis clause 1 on f ∈ E l 1 ) f \approx f \in R
\qquad\text{(by hypothesis clause 1 on }f \in\mathrm{El}_1\text{)} f ≈ f ∈ R (by hypothesis clause 1 on f ∈ El 1 )
f ≈ f ∈ R ′ (by U-Pi’s biconditional: domains equal, codomains R O < : i R O ′ from the inner subtyping) f \approx f \in R'
\qquad\text{(by U-Pi’s biconditional: domains equal, codomains }R_O <\!:\!_i R'_O\text{ from the inner subtyping)} f ≈ f ∈ R ′ (by U-Pi’s biconditional: domains equal, codomains R O < : i R O ′ from the inner subtyping)
<u>Clause 2.</u>
Γ ⊢ t : S 1 (by hypothesis clause 2 on f ∈ E l 1 ) \Gamma\vdash t:S_1
\qquad\text{(by hypothesis clause 2 on }f \in\mathrm{El}_1\text{)} Γ ⊢ t : S 1 (by hypothesis clause 2 on f ∈ El 1 )
Γ ⊢ t : S 2 (by Subsump with Γ ⊢ S 1 ⊆ S 2 ) \Gamma\vdash t:S_2
\qquad\text{(by Subsump with }\Gamma\vdash S_1 \subseteq S_2\text{)} Γ ⊢ t : S 2 (by Subsump with Γ ⊢ S 1 ⊆ S 2 )
<u>Clause 3.</u> Γ ⊢ S 2 : T y i ® Π i ( R I , P I , E l I , P O ′ ) \Gamma\vdash S_2:\mathrm{Ty}_i \mathrel{\circledR} \Pi_i(R_I,P_I,\mathrm{El}_I,P'_O) Γ ⊢ S 2 : Ty i ® Π i ( R I , P I , El I , P O ′ ) holds directly by the lemma’s hypothesis on S 2 , P 2 S_2,P_2 S 2 , P 2 .
<u>Clause 4 (application).</u> Let Δ ⊢ k ϕ : Γ , s , b 0 , D : : b 0 ≈ b 0 ∈ R I \Delta\vdash_k \phi:\Gamma,s,b_0,D::b_0 \approx b_0 \in R_I Δ ⊢ k ϕ : Γ , s , b 0 , D :: b 0 ≈ b 0 ∈ R I with Δ ⊢ s : S 2 , 1 [ ϕ ] ® b 0 ∈ E l I \Delta\vdash s:S_{2,1}[\phi] \mathrel{\circledR} b_0 \in\mathrm{El}_I Δ ⊢ s : S 2 , 1 [ ϕ ] ® b 0 ∈ El I .
Γ ⊢ S 1 , 1 : T y i ® P I , Γ ⊢ S 2 , 1 : T y i ® P I (by clause 2 of Π i on S 1 , S 2 at ϕ = i d ) \Gamma\vdash S_{1,1}:\mathrm{Ty}_i \mathrel{\circledR} P_I,\quad
\Gamma\vdash S_{2,1}:\mathrm{Ty}_i \mathrel{\circledR} P_I
\qquad\text{(by clause 2 of }\Pi_i\text{ on }S_1,S_2\text{ at }\phi=\mathrm{id)} Γ ⊢ S 1 , 1 : Ty i ® P I , Γ ⊢ S 2 , 1 : Ty i ® P I (by clause 2 of Π i on S 1 , S 2 at ϕ = id )
Γ ⊢ S 1 , 1 ≈ S 2 , 1 : T y i (by Theorem 7.24 on the two predicates) \Gamma\vdash S_{1,1} \approx S_{2,1}:\mathrm{Ty}_i
\qquad\text{(by Theorem 7.24 on the two predicates)} Γ ⊢ S 1 , 1 ≈ S 2 , 1 : Ty i (by Theorem 7.24 on the two predicates)
Δ ⊢ S 1 , 1 [ ϕ ] ≈ S 2 , 1 [ ϕ ] : T y i (by Theorem 4.1) \Delta\vdash S_{1,1}[\phi] \approx S_{2,1}[\phi]:\mathrm{Ty}_i
\qquad\text{(by Theorem 4.1)} Δ ⊢ S 1 , 1 [ ϕ ] ≈ S 2 , 1 [ ϕ ] : Ty i (by Theorem 4.1)
Δ ⊢ s : S 1 , 1 [ ϕ ] ® b 0 ∈ E l I (by Theorem 7.26 (3) on the equality above) \Delta\vdash s:S_{1,1}[\phi] \mathrel{\circledR} b_0 \in\mathrm{El}_I
\qquad\text{(by Theorem 7.26 (3) on the equality above)} Δ ⊢ s : S 1 , 1 [ ϕ ] ® b 0 ∈ El I (by Theorem 7.26 (3) on the equality above)
f ⋅ b 0 ↘ c , Δ ⊢ ( t [ ϕ ] ) s : S 1 , 2 [ ι ( ϕ ) , s / x ] ® c ∈ E l O ( D ) (by hypothesis clause 4 on f ∈ E l 1 ) f\mathbin{\cdot}b_0 \searrow c,\quad
\Delta\vdash(t[\phi])\,s:S_{1,2}[\iota(\phi),s/x] \mathrel{\circledR} c \in\mathrm{El}_O(D)
\qquad\text{(by hypothesis clause 4 on }f \in\mathrm{El}_1\text{)} f ⋅ b 0 ↘ c , Δ ⊢ ( t [ ϕ ]) s : S 1 , 2 [ ι ( ϕ ) , s / x ] ® c ∈ El O ( D ) (by hypothesis clause 4 on f ∈ El 1 )
[ [ T ] ] ( ρ , b 0 / x ) < : i [ [ T ′ ] ] ( ρ ′ , b 0 / x ) (by codomain subtyping at D : : b 0 ≈ b 0 ∈ R I ) [\![T]\!](\rho,b_0/x) <\!:\!_i [\![T']\!](\rho',b_0/x)
\qquad\text{(by codomain subtyping at }D::b_0\approx b_0\in R_I\text{)} [ [ T ] ] ( ρ , b 0 / x ) < : i [ [ T ′ ] ] ( ρ ′ , b 0 / x ) (by codomain subtyping at D :: b 0 ≈ b 0 ∈ R I )
Δ ⊢ S 2 , 2 [ ι ( ϕ ) , s / x ] : T y i ® P O ′ ( D ) (by clause 3 of Π i on S 2 at ϕ , s , b 0 , D ) \Delta\vdash S_{2,2}[\iota(\phi),s/x]:\mathrm{Ty}_i \mathrel{\circledR} P'_O(D)
\qquad\text{(by clause 3 of }\Pi_i\text{ on }S_2\text{ at }\phi,s,b_0,D\text{)} Δ ⊢ S 2 , 2 [ ι ( ϕ ) , s / x ] : Ty i ® P O ′ ( D ) (by clause 3 of Π i on S 2 at ϕ , s , b 0 , D )
Δ ⊢ ( t [ ϕ ] ) s : S 2 , 2 [ ι ( ϕ ) , s / x ] ® c ∈ E l O ′ ( D ) (by IH (term-transfer) on the codomain subtyping at D , using the previous-line type-predicate at level i ) \Delta\vdash(t[\phi])\,s:S_{2,2}[\iota(\phi),s/x] \mathrel{\circledR} c \in\mathrm{El}'_O(D)
\qquad\text{(by IH (term-transfer) on the codomain subtyping at }D,\text{ using the previous-line type-predicate at level }i\text{)} Δ ⊢ ( t [ ϕ ]) s : S 2 , 2 [ ι ( ϕ ) , s / x ] ® c ∈ El O ′ ( D ) (by IH (term-transfer) on the codomain subtyping at D , using the previous-line type-predicate at level i )
<u>Clause 5 (R I R_I R I -coherence under application).</u> Inherited from clause 5 on f ∈ E l 1 f \in\mathrm{El}_1 f ∈ El 1 , alongside the codomain subtyping: an R I R_I R I -class of arguments produces an R O ′ R'_O R O ′ -class of results in the codomain via clause 4. □
Realizability
The realizability properties of the gluing model are stated as a single mutual theorem, parallel to Theorem 6.18 of Sec. 6: every domain value in U i ∗ U_i^* U i ∗ admits neutral inhabitants (Ne enters El), normalization (El-elements read back to Nf), and type-readback.
Theorem 7.32 (Realizability of the gluing model). Suppose a ∈ U i ∗ ↘ P ↘ E l a \in U_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El .
(1) (Bot enters El. ) If Γ ⊢ t : S ® w ∈ B o t i a \Gamma\vdash t : S \mathbin{\circledR} w \in\mathrm{Bot}_{i}^{a} Γ ⊢ t : S ® w ∈ Bot i a , then Γ ⊢ t : S ® ↑ A ( w ) ∈ E l \Gamma\vdash t : S \mathbin{\circledR} \uparrow^{A}(w) \in\mathrm{El} Γ ⊢ t : S ® ↑ A ( w ) ∈ El .
(2) (El enters Top. ) If Γ ⊢ t : S ® b ∈ E l \Gamma\vdash t : S \mathbin{\circledR} b \in\mathrm{El} Γ ⊢ t : S ® b ∈ El and b ≈ b ∈ R b \approx b \in R b ≈ b ∈ R (where a ≈ a ∈ U i ↘ R a \approx a \in U_i \searrow R a ≈ a ∈ U i ↘ R ), then Γ ⊢ t : S ® b ∈ T o p i a \Gamma\vdash t : S \mathbin{\circledR} b \in\mathrm{Top}_{i}^{a} Γ ⊢ t : S ® b ∈ Top i a .
(3) (P P P enters Top. ) If Γ ⊢ S : T y i ® P \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} P Γ ⊢ S : Ty i ® P , then Γ ⊢ S : T y i ® T o p i a \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \mathrm{Top}_{i}^{a} Γ ⊢ S : Ty i ® Top i a .
Proof. By simultaneous induction on the lexicographic pair ( i , a ∈ U i ∗ ↘ P ↘ E l ) (i, a \in U_i^{*} \searrow P \searrow\mathrm{El}) ( i , a ∈ U i ∗ ↘ P ↘ El ) : the outer induction on the level i i i provides the IH at strictly smaller levels, used in the G-Univ case; the inner induction on the gluing derivation provides the IH at structurally smaller derivations at the same level i i i .
Case
G - N e a = ↑ A ( e ) P ⟺ N e u i e E l ⟺ N e u i e ↑ A ( e ) ∈ U i ∗ \begin{array}{c}
\mathrm{G\text{-}Ne}\\
a = \uparrow^{A}(e) \qquad P \Longleftrightarrow\mathrm{Neu}_{i}^{e} \qquad\mathrm{El} \Longleftrightarrow\mathrm{Neu}_{i}^{e}\\
\hline
\uparrow^{A}(e) \in U_i^{*}
\end{array} G - Ne a = ↑ A ( e ) P ⟺ Neu i e El ⟺ Neu i e ↑ A ( e ) ∈ U i ∗
(1) Bot enters El. Suppose Γ ⊢ t : S ® w ∈ B o t i a \Gamma\vdash t : S \mathbin{\circledR} w \in\mathrm{Bot}_{i}^{a} Γ ⊢ t : S ® w ∈ Bot i a . Unpacking Theorem 7.15 clauses (a)–(c) yields Γ ⊢ S : T y i ® N e u i e \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \mathrm{Neu}_{i}^{e} Γ ⊢ S : Ty i ® Neu i e (the P P P -side component) and Γ ⊢ t : S ® w ∈ N e i a \Gamma\vdash t : S \mathbin{\circledR} w \in\mathrm{Ne}_{i}^{a} Γ ⊢ t : S ® w ∈ Ne i a . These are exactly the four clauses of Theorem 7.6 for the term ↑ A ( w ) \uparrow^{A}(w) ↑ A ( w ) , hence Γ ⊢ t : S ® ↑ A ( w ) ∈ E l ⟺ N e u i e \Gamma\vdash t : S \mathbin{\circledR} \uparrow^{A}(w) \in\mathrm{El} \Longleftrightarrow\mathrm{Neu}_{i}^{e} Γ ⊢ t : S ® ↑ A ( w ) ∈ El ⟺ Neu i e .
(2) El enters Top. Suppose Γ ⊢ t : S ® ↑ A ( w ) ∈ N e u i e \Gamma\vdash t : S \mathbin{\circledR} \uparrow^{A}(w) \in\mathrm{Neu}_{i}^{e} Γ ⊢ t : S ® ↑ A ( w ) ∈ Neu i e and ↑ A ( w ) ≈ ↑ A ( w ) ∈ R \uparrow^{A}(w) \approx\uparrow^{A}(w) \in R ↑ A ( w ) ≈ ↑ A ( w ) ∈ R . We assemble the three clauses of Theorem 7.15(c). The type-side gluing Γ ⊢ S : T y i ® P ⟺ N e u i e \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} P \Longleftrightarrow\mathrm{Neu}_{i}^{e} Γ ⊢ S : Ty i ® P ⟺ Neu i e is the inner component of N e u i e \mathrm{Neu}_{i}^{e} Neu i e at term level. For N f i a \mathrm{Nf}_{i}^{a} Nf i a : for each Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ , by Rf-ne:
R Δ N f [ ↓ A ( e ) ( ↑ A ( w ) ) ] ↘ v (via R Δ N e ( w ) ↘ v , by Rf-ne) Δ ⊢ t [ ϕ ] ≈ v : S [ ϕ ] (by xref‘Theorem 7.6‘) \begin{array}{rcl}
R_{\Delta}^{\mathrm{Nf}}\left[\downarrow^{A(e)}\left(\uparrow^{A}(w)\right)\right] &\searrow& v \qquad\text{(via }R_{\Delta}^{\mathrm{Ne}}(w)\searrow v,\text{ by Rf-ne)}\\
\Delta\vdash t[\phi] &\approx& v : S[\phi] \qquad\text{(by {xref}`Theorem 7.6`)}
\end{array} R Δ Nf [ ↓ A ( e ) ( ↑ A ( w ) ) ] Δ ⊢ t [ ϕ ] ↘ ≈ v (via R Δ Ne ( w ) ↘ v , by Rf-ne) v : S [ ϕ ] (by xref ‘Theorem 7.6‘)
This satisfies N f i a \mathrm{Nf}_{i}^{a} Nf i a , and packaged with Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S and the type gluing yields Γ ⊢ t : S ® ↑ A ( w ) ∈ T o p i a \Gamma\vdash t : S \mathbin{\circledR} \uparrow^{A}(w) \in\mathrm{Top}_{i}^{a} Γ ⊢ t : S ® ↑ A ( w ) ∈ Top i a .
(3) P P P enters Top. Hypothesis: Γ ⊢ S : T y i ® N e u i e \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \mathrm{Neu}_{i}^{e} Γ ⊢ S : Ty i ® Neu i e . We assemble the three clauses of Theorem 7.15(b). The first clause Γ ⊢ S : T y i \Gamma\vdash S : \mathrm{Ty}_i Γ ⊢ S : Ty i is part of N e u i e \mathrm{Neu}_{i}^{e} Neu i e . For a ≈ a ∈ U i ↘ R a \approx a \in U_i \searrow R a ≈ a ∈ U i ↘ R : by Theorem 7.21, the binary relation R R R exists. For each Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ :
R ∣ Δ ∣ N e ( e ) ↘ u (by Theorem 7.5 applied to N e u i e ) R ∣ Δ ∣ T y ( ↑ A ( e ) ) ↘ u (by Rty-ne) Δ ⊢ S [ ϕ ] ≈ u : T y i (by Theorem 7.5) \begin{array}{rcll}
R^{\mathrm{Ne}}_{\lvert\Delta\rvert}(e) &\searrow& u & \text{(by Theorem 7.5 applied to }\mathrm{Neu}_{i}^{e}\text{)}\\
R^{\mathrm{Ty}}_{\lvert\Delta\rvert}(\uparrow^{A}(e)) &\searrow& u & \text{(by Rty-ne)}\\
\Delta\vdash S[\phi] &\approx& u : \mathrm{Ty}_{i} & \text{(by Theorem 7.5)}
\end{array} R ∣ Δ ∣ Ne ( e ) R ∣ Δ ∣ Ty ( ↑ A ( e )) Δ ⊢ S [ ϕ ] ↘ ↘ ≈ u u u : Ty i (by Theorem 7.5 applied to Neu i e ) (by Rty-ne) (by Theorem 7.5)
Case
G - N a t P ⟺ N a t i E l ⟺ N a t i N ∈ U i ∗ \begin{array}{c}
\mathrm{G\text{-}Nat}\\
P \Longleftrightarrow\mathrm{Nat}_i \qquad\mathrm{El} \Longleftrightarrow\mathrm{Nat}_i\\
\hline
N \in U_i^{*}
\end{array} G - Nat P ⟺ Nat i El ⟺ Nat i N ∈ U i ∗
(1) Bot enters El. Suppose Γ ⊢ t : S ® w ∈ B o t i N \Gamma\vdash t : S \mathbin{\circledR} w \in\mathrm{Bot}_{i}^{N} Γ ⊢ t : S ® w ∈ Bot i N . Unpacking Theorem 7.15(a) yields Γ ⊢ S : T y i ® N a t i \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \mathrm{Nat}_i Γ ⊢ S : Ty i ® Nat i (which by Theorem 7.7 gives Γ ⊢ S ≈ N a t : T y i \Gamma\vdash S \approx\mathrm{Nat} : \mathrm{Ty}_i Γ ⊢ S ≈ Nat : Ty i ) and Γ ⊢ t : S ® w ∈ N e i N \Gamma\vdash t : S \mathbin{\circledR} w \in\mathrm{Ne}_{i}^{N} Γ ⊢ t : S ® w ∈ Ne i N . The premises of GN-Ne are exactly these, hence ↑ N ( w ) ∈ N a t i \uparrow^{N}(w) \in\mathrm{Nat}_i ↑ N ( w ) ∈ Nat i at t t t .
(2) El enters Top. Given Γ ⊢ t : S ® b ∈ N a t i \Gamma\vdash t : S \mathbin{\circledR} b \in\mathrm{Nat}_i Γ ⊢ t : S ® b ∈ Nat i and b ≈ b ∈ R b \approx b \in R b ≈ b ∈ R (where R R R is the Nat-PER closure), we establish the three clauses of Theorem 7.15(c). The type-side Γ ⊢ S : T y i ® N a t i \Gamma\vdash S : \mathrm{Ty}_i \mathbin{\circledR} \mathrm{Nat}_i Γ ⊢ S : Ty i ® Nat i is part of Theorem 7.8; for N f i N \mathrm{Nf}_{i}^{N} Nf i N , by inner induction on the derivation of b ∈ N a t i b \in\mathrm{Nat}_i b ∈ Nat i .
Sub-case
G N - Z e Γ ⊢ t ≈ z e r o : S Γ ⊢ t : S ® z e ∈ N a t \begin{array}{c}
\mathrm{GN\text{-}Ze}\\
\Gamma\vdash t \approx\mathrm{zero} : S\\
\hline
\Gamma\vdash t : S \mathbin{\circledR} \mathrm{ze} \in\mathrm{Nat}
\end{array} GN - Ze Γ ⊢ t ≈ zero : S Γ ⊢ t : S ® ze ∈ Nat
For each Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ :
R ∣ Δ ∣ N f ( ↓ N ( z e ) ) ↘ z e r o (by Rf-ZE) Δ ⊢ t [ ϕ ] ≈ z e r o : S [ ϕ ] (by xref‘Theorem 4.1‘ on the hypothesis) \begin{aligned}
R^{\mathrm{Nf}}_{|\Delta|}(\downarrow\mathcal{N}(\mathrm{ze})) &\searrow\mathrm{zero} && \text{(by Rf-ZE)}\\
\Delta\vdash t[\phi] \approx\mathrm{zero} : S[\phi] &&& \text{(by {xref}`Theorem 4.1` on the hypothesis)}
\end{aligned} R ∣Δ∣ Nf ( ↓ N ( ze )) Δ ⊢ t [ ϕ ] ≈ zero : S [ ϕ ] ↘ zero (by Rf-ZE) (by xref ‘Theorem 4.1‘ on the hypothesis)
Sub-case
Γ ⊢ t ′ : S ® b ′ ∈ N a t Γ ⊢ t ≈ s u c c t ′ : S Γ ⊢ t : S ® s u ( b ′ ) ∈ N a t GN-Su \frac{\Gamma\vdash t' : S \mathbin{\circledR} b' \in\mathrm{Nat} \qquad\Gamma\vdash t \approx\mathrm{succ}\,t' : S}{\Gamma\vdash t : S \mathbin{\circledR} \mathrm{su}(b') \in\mathrm{Nat}}
\quad\text{GN-Su} Γ ⊢ t : S ® su ( b ′ ) ∈ Nat Γ ⊢ t ′ : S ® b ′ ∈ Nat Γ ⊢ t ≈ succ t ′ : S GN-Su
For each Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ :
R ∣ Δ ∣ N f ( ↓ N ( b ′ ) ) ↘ w ′ (by inner IH on b ′ ) Δ ⊢ t ′ [ ϕ ] ≈ w ′ : S [ ϕ ] (by inner IH on b ′ ) R ∣ Δ ∣ N f ( ↓ N ( s u ( b ′ ) ) ) ↘ s u c c w ′ (by Rf-Su) Δ ⊢ s u c c t ′ [ ϕ ] ≈ s u c c w ′ : S [ ϕ ] (by Su-Cong on the previous line) Δ ⊢ t [ ϕ ] ≈ s u c c w ′ : S [ ϕ ] (by transitivity with the GN-Su hypothesis) \begin{aligned}
R^{\mathrm{Nf}}_{|\Delta|}(\downarrow\mathcal{N}(b')) &\searrow w' && \text{(by inner IH on } b'\text{)}\\
\Delta\vdash t'[\phi] \approx w' : S[\phi] &&& \text{(by inner IH on } b'\text{)}\\
R^{\mathrm{Nf}}_{|\Delta|}(\downarrow\mathcal{N}(\mathrm{su}(b'))) &\searrow\mathrm{succ}\,w' && \text{(by Rf-Su)}\\
\Delta\vdash\mathrm{succ}\,t'[\phi] \approx\mathrm{succ}\,w' : S[\phi] &&& \text{(by Su-Cong on the previous line)}\\
\Delta\vdash t[\phi] \approx\mathrm{succ}\,w' : S[\phi] &&& \text{(by transitivity with the GN-Su hypothesis)}
\end{aligned} R ∣Δ∣ Nf ( ↓ N ( b ′ )) Δ ⊢ t ′ [ ϕ ] ≈ w ′ : S [ ϕ ] R ∣Δ∣ Nf ( ↓ N ( su ( b ′ ))) Δ ⊢ succ t ′ [ ϕ ] ≈ succ w ′ : S [ ϕ ] Δ ⊢ t [ ϕ ] ≈ succ w ′ : S [ ϕ ] ↘ w ′ ↘ succ w ′ (by inner IH on b ′ ) (by inner IH on b ′ ) (by Rf-Su) (by Su-Cong on the previous line) (by transitivity with the GN-Su hypothesis)
Sub-case
Γ ⊢ t : S ® ↑ N ( w ) ∈ N e u i e Γ ⊢ t : S ® ↑ N ( w ) ∈ N a t GN-Ne \frac{\Gamma\vdash t : S \mathbin{\circledR} \uparrow^{\mathcal{N}}(w) \in\mathrm{Neu}^{e}_{i}}{\Gamma\vdash t : S \mathbin{\circledR} \uparrow^{\mathcal{N}}(w) \in\mathrm{Nat}}
\quad\text{GN-Ne} Γ ⊢ t : S ® ↑ N ( w ) ∈ Nat Γ ⊢ t : S ® ↑ N ( w ) ∈ Neu i e GN-Ne
For each Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ :
R ∣ Δ ∣ N e ( w ) ↘ v (by hypothesis on w ∈ N e i a ) R ∣ Δ ∣ N f ( ↓ N ( ↑ N ( w ) ) ) ↘ v (by Rf-Ne) Δ ⊢ t [ ϕ ] ≈ v : S [ ϕ ] (by hypothesis on w ) \begin{aligned}
R^{\mathrm{Ne}}_{|\Delta|}(w) &\searrow v && \text{(by hypothesis on } w \in\mathrm{Ne}^{a}_{i}\text{)}\\
R^{\mathrm{Nf}}_{|\Delta|}(\downarrow\mathcal{N}(\uparrow^{\mathcal{N}}(w))) &\searrow v && \text{(by Rf-Ne)}\\
\Delta\vdash t[\phi] \approx v : S[\phi] &&& \text{(by hypothesis on } w\text{)}
\end{aligned} R ∣Δ∣ Ne ( w ) R ∣Δ∣ Nf ( ↓ N ( ↑ N ( w ))) Δ ⊢ t [ ϕ ] ≈ v : S [ ϕ ] ↘ v ↘ v (by hypothesis on w ∈ Ne i a ) (by Rf-Ne) (by hypothesis on w )
(3) P P P enters Top. Hypothesis: Γ ⊢ S : T y i ® N a t i \Gamma\vdash S : \mathrm{Ty}_{i} \mathbin{\circledR} \mathrm{Nat}_{i} Γ ⊢ S : Ty i ® Nat i . We assemble the three clauses of Theorem 7.15(b). The first clause Γ ⊢ S : T y i \Gamma\vdash S : \mathrm{Ty}_{i} Γ ⊢ S : Ty i is part of Theorem 7.7 via presupposition. For N ≈ N ∈ U i ↘ R N N \approx N \in\mathcal{U}_{i} \searrow R_{N} N ≈ N ∈ U i ↘ R N : immediate by the PER definition. For each Δ ⊢ k ϕ : Γ \Delta\vdash_k \phi: \Gamma Δ ⊢ k ϕ : Γ :
R ∣ Δ ∣ T y ( N ) ↘ N a t (by RTy-N) Δ ⊢ S [ ϕ ] ≈ N a t : T y i (by xref‘Theorem 7.7‘) \begin{aligned}
R^{\mathrm{Ty}}_{|\Delta|}(N) &\searrow\mathrm{Nat} && \text{(by RTy-N)}\\
\Delta\vdash S[\phi] \approx\mathrm{Nat} : \mathrm{Ty}_{i} &&& \text{(by {xref}`Theorem 7.7`)}
\end{aligned} R ∣Δ∣ Ty ( N ) Δ ⊢ S [ ϕ ] ≈ Nat : Ty i ↘ Nat (by RTy-N) (by xref ‘Theorem 7.7‘)
Case
a = Π ( a I , T , ρ ) a I ∈ U i ∗ ↘ P I ↘ E l I ∀ D : : b ≈ b ∈ R I , c . ⟦ T ⟧ ( ρ , b / x ) ↘ c = ⇒ c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) P ⇔ Π i ( R I , P I , P O ) E l ⇔ Π E l ( R , R I , P I , E l I , E l O ) Π ( a I , T , ρ ) ∈ U i ∗ G-Pi \frac{\begin{aligned}
a &= \Pi(a_I,T,\rho) && a_I \in\mathcal{U}^{*}_{i} \searrow P_I \searrow\mathrm{El}_I\\
\forall D :: b \approx b \in R_I,\ c.\ \llbracket T \rrbracket(\rho,b/x) \searrow c &=\!\Rightarrow c \in\mathcal{U}^{*}_{i} \searrow P_O(D) \searrow\mathrm{El}_O(D)\\
P &\Leftrightarrow\Pi_i(R_I,P_I,P_O) & \mathrm{El} &\Leftrightarrow\Pi^{\mathrm{El}}(R,R_I,P_I,\mathrm{El}_I,\mathrm{El}_O)
\end{aligned}}{\Pi(a_I,T,\rho) \in\mathcal{U}^{*}_{i}}
\quad\text{G-Pi} Π ( a I , T , ρ ) ∈ U i ∗ a ∀ D :: b ≈ b ∈ R I , c . [ [ T ] ] ( ρ , b / x ) ↘ c P = Π ( a I , T , ρ ) = ⇒ c ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) ⇔ Π i ( R I , P I , P O ) El a I ∈ U i ∗ ↘ P I ↘ El I ⇔ Π El ( R , R I , P I , El I , El O ) G-Pi
By inner IH-(1) on a I a_I a I , neutral inhabitants enter E l I \mathrm{El}_I El I ; by inner IH-(2) on a I a_I a I , E l I \mathrm{El}_I El I -elements read back; analogously for E l O ( D ) \mathrm{El}_O(D) El O ( D ) at each D D D .
(1) Bot enters El. Suppose
Γ ⊢ t : S R w ∈ B o t i a . \Gamma\vdash t : S \mathrel{\mathsf{R}} w \in\mathrm{Bot}_{i}^{a}. Γ ⊢ t : S R w ∈ Bot i a .
Unpacking Theorem 7.15(a) yields
Γ ⊢ S : T y i R Π i ( R I , P I , E l I , P O ) \Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\mathsf{R}} \Pi_{i}(R_{I},P_{I},\mathrm{El}_{I},P_{O}) Γ ⊢ S : Ty i R Π i ( R I , P I , El I , P O )
together with Γ ⊢ t : S R w ∈ N e i a \Gamma\vdash t : S \mathrel{\mathsf{R}} w \in\mathrm{Ne}_{i}^{a} Γ ⊢ t : S R w ∈ Ne i a . We verify the four clauses of Theorem 7.10 for ↑ a ( w ) \uparrow^{a}(w) ↑ a ( w ) .
(1) Self-relatedness ↑ a ( w ) ≈ ↑ a ( w ) ∈ R \uparrow^{a}(w) \approx\uparrow^{a}(w) \in R ↑ a ( w ) ≈ ↑ a ( w ) ∈ R holds by U-Ne of the PER closure.
(2) Coherence under R I R_{I} R I : trivial because the function value does not depend on a representative of R I R_{I} R I on the left of the predicate.
(3) For each Δ ⊢ k ϕ : Γ \Delta\vdash_{k} \phi: \Gamma Δ ⊢ k ϕ : Γ , R ∣ Δ ∣ N e ( w ) ↘ v R^{\mathrm{Ne}}_{|\Delta|}(w) \searrow v R ∣Δ∣ Ne ( w ) ↘ v by hypothesis on w ∈ N e w \in\mathrm{Ne} w ∈ Ne , so the type readback obligation holds via Theorem 7.9.
(4) Application: given Δ ⊢ k ϕ : Γ \Delta\vdash_{k} \phi: \Gamma Δ ⊢ k ϕ : Γ and Δ ⊢ s : S 1 [ ϕ ] R b ∈ E l I \Delta\vdash s : S_{1}[\phi] \mathrel{\mathsf{R}} b \in\mathrm{El}_{I} Δ ⊢ s : S 1 [ ϕ ] R b ∈ El I with D : : b ≈ b ∈ R I \mathcal{D} :: b \approx b \in R_{I} D :: b ≈ b ∈ R I (by inner IH-(1) bridging through Theorem 7.21, applied to b b b ):
⟦ T ⟧ ( ρ , b / x ) ↘ c b \llbracket T \rrbracket(\rho,b/x) \searrow c_{b} [ [ T ] ] ( ρ , b / x ) ↘ c b
(evaluation of T T T at ρ , b / x \rho,b/x ρ , b / x ; well-defined since Π ( a I , T , ρ ) ≈ Π ( a I , T , ρ ) ∈ U i \Pi(a_{I},T,\rho) \approx\Pi(a_{I},T,\rho) \in\mathcal{U}_{i} Π ( a I , T , ρ ) ≈ Π ( a I , T , ρ ) ∈ U i )
c b ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) c_{b} \in\mathcal{U}_{i}^{*} \searrow P_{O}(\mathcal{D}) \searrow\mathrm{El}_{O}(\mathcal{D}) c b ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D )
(by the G-Pi codomain clause applied to D \mathcal{D} D and c b c_{b} c b )
b ∈ N f i a I b \in\mathrm{Nf}_{i}^{a_{I}} b ∈ Nf i a I
(by inner IH-(2) on a I a_{I} a I applied to b ∈ E l I b \in\mathrm{El}_{I} b ∈ El I )
R ∣ Δ ∣ N f ( ↓ a I ( b ) ) ↘ u b R^{\mathrm{Nf}}_{|\Delta|}(\downarrow^{a_{I}}(b)) \searrow u_{b} R ∣Δ∣ Nf ( ↓ a I ( b )) ↘ u b
(by the previous line)
↑ a ( w ) ⋅ b ↘ ↑ c b ( w $ ↓ a I ( b ) ) \uparrow^{a}(w)\mathbin{\cdot}b \searrow\uparrow^{c_{b}}(w \mathbin{\$} \downarrow^{a_{I}}(b)) ↑ a ( w ) ⋅ b ↘ ↑ c b ( w $ ↓ a I ( b ))
(by neutral application)
w $ ↓ a I ( b ) ∈ N e i c b w \mathbin{\$} \downarrow^{a_{I}}(b) \in\mathrm{Ne}_{i}^{c_{b}} w $ ↓ a I ( b ) ∈ Ne i c b
(by Rne-app, using R ∣ Δ ∣ N e ( w ) R^{\mathrm{Ne}}_{|\Delta|}(w) R ∣Δ∣ Ne ( w ) and u b u_{b} u b )
Δ ⊢ ( t [ ϕ ] ) s : S 2 [ ι ( ϕ ) , s / x ] \Delta\vdash(t[\phi])\,s : S_{2}[\iota(\phi),s/x] Δ ⊢ ( t [ ϕ ]) s : S 2 [ ι ( ϕ ) , s / x ]
↑ c b ( w $ ↓ a I ( b ) ) ∈ E l O ( D ) \uparrow^{c_{b}}(w \mathbin{\$} \downarrow^{a_{I}}(b)) \in\mathrm{El}_{O}(\mathcal{D}) ↑ c b ( w $ ↓ a I ( b )) ∈ El O ( D )
(by inner IH-(1) on c b c_{b} c b )
(2) El enters Top. Suppose Γ ⊢ t : S R f ∈ Π i E l ( R , R I , P I , E l I , E l O ) \Gamma\vdash t : S \mathrel{\mathsf{R}} f \in\Pi_{i}^{\mathrm{El}}(R,R_{I},P_{I},\mathrm{El}_{I},\mathrm{El}_{O}) Γ ⊢ t : S R f ∈ Π i El ( R , R I , P I , El I , El O ) and f ≈ f ∈ R f \approx f \in R f ≈ f ∈ R . We assemble the three clauses of Theorem 7.15(c). The type-side Γ ⊢ S : T y i R Π i ( R I , P I , E l I , P O ) \Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\mathsf{R}} \Pi_{i}(R_{I},P_{I},\mathrm{El}_{I},P_{O}) Γ ⊢ S : Ty i R Π i ( R I , P I , El I , P O ) is part of Theorem 7.10; the term-typing Γ ⊢ t : S \Gamma\vdash t : S Γ ⊢ t : S likewise. For N f i a \mathrm{Nf}_{i}^{a} Nf i a , for each Δ ⊢ k ϕ : Γ \Delta\vdash_{k} \phi: \Gamma Δ ⊢ k ϕ : Γ , set n : = ∣ Δ ∣ n := |\Delta| n := ∣Δ∣ and form Δ ′ : = Δ , x ′ : S 1 [ ϕ ] \Delta' := \Delta,x':S_{1}[\phi] Δ ′ := Δ , x ′ : S 1 [ ϕ ] together with the lifted Kripke weakening ϕ ∘ ⇑ \phi^{\circ}\mathbin{\Uparrow} ϕ ∘ ⇑ (by KW-Shift; Theorem 7.3).
Δ ′ ⊢ x ′ : S 1 [ ϕ ∘ ⇑ ] R ↑ a I ( ℓ n ) ∈ E l I \Delta' \vdash x' : S_{1}[\phi^{\circ}\mathbin{\Uparrow}] \mathrel{\mathsf{R}} \uparrow^{a_{I}}(\ell_{n}) \in\mathrm{El}_{I} Δ ′ ⊢ x ′ : S 1 [ ϕ ∘ ⇑ ] R ↑ a I ( ℓ n ) ∈ El I
(by inner IH-(1) on a I a_{I} a I applied to ℓ n \ell_{n} ℓ n )
f ⋅ ↑ a I ( ℓ n ) ↘ c f\mathbin{\cdot}\uparrow^{a_{I}}(\ell_{n}) \searrow c f ⋅ ↑ a I ( ℓ n ) ↘ c
(by clause (4) of Π i E l \Pi_{i}^{\mathrm{El}} Π i El on f f f )
Δ ′ ⊢ ( t [ ϕ ∘ ⇑ ] ) x ′ : S 2 [ ι ( ϕ ∘ ⇑ ) , x ′ / x ] R c ∈ E l O ( D ′ ) \Delta' \vdash(t[\phi^{\circ}\mathbin{\Uparrow}])\,x' : S_{2}[\iota(\phi^{\circ}\mathbin{\Uparrow}),x'/x] \mathrel{\mathsf{R}} c \in\mathrm{El}_{O}(\mathcal{D}') Δ ′ ⊢ ( t [ ϕ ∘ ⇑ ]) x ′ : S 2 [ ι ( ϕ ∘ ⇑ ) , x ′ / x ] R c ∈ El O ( D ′ )
(by clause (4) on f f f , with D ′ \mathcal{D}' D ′ the witness from line 1)
c ∈ N f i c ℓ n c \in\mathrm{Nf}_{i}^{c_{\ell_{n}}} c ∈ Nf i c ℓ n
(by inner IH-(2) on c ℓ n ∈ U i ∗ c_{\ell_{n}} \in\mathcal{U}_{i}^{*} c ℓ n ∈ U i ∗ )
R n + 1 N f ( ↓ c ℓ n ( c ) ) ↘ v R^{\mathrm{Nf}}_{n+1}(\downarrow^{c_{\ell_{n}}}(c)) \searrow v R n + 1 Nf ( ↓ c ℓ n ( c )) ↘ v
(by the previous line)
Δ ′ ⊢ ( t [ ϕ ∘ ⇑ ] ) x ′ ≈ v : S 2 [ ι ( ϕ ∘ ⇑ ) , x ′ / x ] \Delta' \vdash(t[\phi^{\circ}\mathbin{\Uparrow}])\,x' \approx v : S_{2}[\iota(\phi^{\circ}\mathbin{\Uparrow}),x'/x] Δ ′ ⊢ ( t [ ϕ ∘ ⇑ ]) x ′ ≈ v : S 2 [ ι ( ϕ ∘ ⇑ ) , x ′ / x ]
(by inner IH-(2) on c ℓ n c_{\ell_{n}} c ℓ n )
R n N f ( ↓ a ( f ) ) ↘ λ x . v R^{\mathrm{Nf}}_{n}(\downarrow^{a}(f)) \searrow\lambda x.v R n Nf ( ↓ a ( f )) ↘ λ x . v
(by Rf-Pi, using the previous line)
Δ ⊢ t [ ϕ ] ≈ λ x . ( t [ ϕ ∘ ⇑ ] ) x ′ : S [ ϕ ] \Delta\vdash t[\phi] \approx\lambda x.(t[\phi^{\circ}\mathbin{\Uparrow}])\,x' : S[\phi] Δ ⊢ t [ ϕ ] ≈ λ x . ( t [ ϕ ∘ ⇑ ]) x ′ : S [ ϕ ]
(by Π \Pi Π -η \eta η )
Δ ⊢ t [ ϕ ] ≈ λ x . v : S [ ϕ ] \Delta\vdash t[\phi] \approx\lambda x.v : S[\phi] Δ ⊢ t [ ϕ ] ≈ λ x . v : S [ ϕ ]
(by congruence with the R N f R^{\mathrm{Nf}} R Nf equality)
(3) P enters Top. Hypothesis: Γ ⊢ S : T y i R Π i ( R I , P I , E l I , P O ) \Gamma\vdash S : \mathrm{Ty}_{i} \mathrel{\mathsf{R}} \Pi_{i}(R_{I},P_{I},\mathrm{El}_{I},P_{O}) Γ ⊢ S : Ty i R Π i ( R I , P I , El I , P O ) . We assemble the three clauses of Theorem 7.15(b). The first clause Γ ⊢ S : T y i \Gamma\vdash S : \mathrm{Ty}_{i} Γ ⊢ S : Ty i is part of Theorem 7.9. For a ≈ a ∈ U i ↘ R a \approx a \in\mathcal{U}_{i} \searrow R a ≈ a ∈ U i ↘ R : by Theorem 7.21 on the components a I a_{I} a I and c c c at each D \mathcal{D} D , the binary closure exists. For each Δ ⊢ k ϕ : Γ \Delta\vdash_{k} \phi: \Gamma Δ ⊢ k ϕ : Γ , set n : = ∣ Δ ∣ n := |\Delta| n := ∣Δ∣ :
R n T y ( a I ) ↘ W S , Δ ⊢ S 1 [ ϕ ] ≈ W S : T y i R_{n}^{\mathrm{Ty}}(a_{I}) \searrow W_{S},\quad\Delta\vdash S_{1}[\phi] \approx W_{S} : \mathrm{Ty}_{i} R n Ty ( a I ) ↘ W S , Δ ⊢ S 1 [ ϕ ] ≈ W S : Ty i
(by inner IH-(3) on a I a_{I} a I ) ⟦ T ⟧ ( ρ , ↑ a I ( ℓ n ) / x ) ↘ c ℓ n \llbracket T \rrbracket(\rho,\uparrow^{\mathit{aI}}(\ell_n)/x) \searrow c_{\ell_n} [ [ T ] ] ( ρ , ↑ aI ( ℓ n ) / x ) ↘ c ℓ n (by Theorem 7.9)
R n + 1 T y ( c ℓ n ) ↘ W T R^{\mathit{Ty}}_{n+1}(c_{\ell_n}) \searrow W_T R n + 1 Ty ( c ℓ n ) ↘ W T (by inner IH-(3) on c ℓ n c_{\ell_n} c ℓ n )
Δ , x ′ : S 1 [ ϕ ] ⊢ S 2 [ ι ( ϕ ∘ ⇑ ) , x ′ / x ] ≈ W T : T y i \Delta,x' : S_1[\phi] \vdash S_2[\iota(\phi\circ\Uparrow),x'/x] \approx W_T : \mathit{Ty}_i Δ , x ′ : S 1 [ ϕ ] ⊢ S 2 [ ι ( ϕ ∘ ⇑ ) , x ′ / x ] ≈ W T : Ty i (by inner IH-(3) on c ℓ n c_{\ell_n} c ℓ n )
R n T y ( Π ( a I , T , ρ ) ) ↘ Π ( x : W S ) . W T R^{\mathit{Ty}}_n(\Pi(a_I,T,\rho)) \searrow\Pi(x : W_S).W_T R n Ty ( Π ( a I , T , ρ )) ↘ Π ( x : W S ) . W T (by Rty-Pi)
Δ ⊢ S [ ϕ ] ≈ Π ( x : W S ) . W T : T y i \Delta\vdash S[\phi] \approx\Pi(x : W_S).W_T : \mathit{Ty}_i Δ ⊢ S [ ϕ ] ≈ Π ( x : W S ) . W T : Ty i (by Theorem 7.9 clauses 1–3 and Π \Pi Π -Cong)
Case
G - U n i v j < i P ⟺ U n i v i , j E l ⟺ U n i v i , j E l U j ∈ U i ∗ \begin{array}{c}
\mathrm{G\text{-}Univ}\\
j<i \qquad P \Longleftrightarrow\mathrm{Univ}_{i,j}\qquad\mathrm{El}\Longleftrightarrow\mathrm{Univ}^{\mathrm{El}}_{i,j}\\
U_j\in\mathcal{U}^{*}_i
\end{array} G - Univ j < i P ⟺ Univ i , j El ⟺ Univ i , j El U j ∈ U i ∗
Since j < i j<i j < i , the outer-IH applies at level j j j to every value b ∈ U j ∗ b\in\mathcal{U}^{*}_j b ∈ U j ∗ .
Bot enters El. Suppose Γ ⊢ t : S ® w ∈ B o t i U j \Gamma\vdash t:S\mathbin{\circledR}w\in\mathrm{Bot}^{U_j}_i Γ ⊢ t : S ® w ∈ Bot i U j . Unpacking Theorem 7.15(a) yields Γ ⊢ S : T y i ® U n i v i , j \Gamma\vdash S:\mathit{Ty}_i\mathbin{\circledR}\mathrm{Univ}_{i,j} Γ ⊢ S : Ty i ® Univ i , j and Γ ⊢ t : S ® w ∈ N e i U j \Gamma\vdash t:S\mathbin{\circledR}w\in\mathrm{Ne}^{U_j}_i Γ ⊢ t : S ® w ∈ Ne i U j . Apply G-Ne at level j j j :
↑ A ( w ) ∈ U j ∗ ↘ N e u j e ↘ N e u j e \uparrow^{A}(w)\in\mathcal{U}^{*}_j\searrow\mathrm{Neu}^{e}_j\searrow\mathrm{Neu}^{e}_j ↑ A ( w ) ∈ U j ∗ ↘ Neu j e ↘ Neu j e
(by G-Ne at level j j j )
Γ ⊢ t : S ® ↑ A ( w ) ∈ U j ∗ \Gamma\vdash t:S\mathbin{\circledR}\uparrow^{A}(w)\in\mathcal{U}^{*}_j Γ ⊢ t : S ® ↑ A ( w ) ∈ U j ∗
(by Theorem 7.12 clause (1) with the previous line)
Γ ⊢ t : T y j ® N e u j e \Gamma\vdash t:\mathit{Ty}_j\mathbin{\circledR}\mathrm{Neu}^{e}_j Γ ⊢ t : Ty j ® Neu j e
(by Theorem 7.12 clause (2); the type predicate attached to ↑ A ( w ) \uparrow^{A}(w) ↑ A ( w ) is N e u j e \mathrm{Neu}^{e}_j Neu j e , which by hypothesis on w w w inhabits the type-predicate condition; the equality Γ ⊢ S ≈ T y j : T y i \Gamma\vdash S\approx\mathit{Ty}_j:\mathit{Ty}_i Γ ⊢ S ≈ Ty j : Ty i comes from Theorem 7.11)
El enters Top. Suppose Γ ⊢ t : S ® b ∈ U n i v i , j E l \Gamma\vdash t:S\mathbin{\circledR}b\in\mathrm{Univ}^{\mathrm{El}}_{i,j} Γ ⊢ t : S ® b ∈ Univ i , j El and b ≈ b ∈ R b\approx b\in R b ≈ b ∈ R . By Theorem 7.12, b ∈ U j ∗ ↘ P b ↘ E l b b\in\mathcal{U}^{*}_j\searrow P_b\searrow\mathrm{El}_b b ∈ U j ∗ ↘ P b ↘ El b for some P b , E l b P_b,\mathrm{El}_b P b , El b , with Γ ⊢ t : T y j ® P b \Gamma\vdash t:\mathit{Ty}_j\mathbin{\circledR}P_b Γ ⊢ t : Ty j ® P b at the type level. We assemble Theorem 7.15(c). The P P P -side Γ ⊢ S : T y i ® U n i v i , j \Gamma\vdash S:\mathit{Ty}_i\mathbin{\circledR}\mathrm{Univ}_{i,j} Γ ⊢ S : Ty i ® Univ i , j comes from Theorem 7.12; for N f i U j \mathrm{Nf}^{U_j}_i Nf i U j , for each Δ ⊢ k ϕ : Γ \Delta\vdash_k\phi:\Gamma Δ ⊢ k ϕ : Γ , n : = ∣ Δ ∣ n:=|\Delta| n := ∣Δ∣ :
R n T y ( b ) ↘ W R^{\mathit{Ty}}_n(b)\searrow W R n Ty ( b ) ↘ W
(by outer-IH-(3) on b ∈ U j ∗ b\in\mathcal{U}^{*}_j b ∈ U j ∗ )
Δ ⊢ t [ ϕ ] ≈ W : T y j \Delta\vdash t[\phi]\approx W:\mathit{Ty}_j Δ ⊢ t [ ϕ ] ≈ W : Ty j
(by outer-IH-(3) on b b b )
R n N f ( ↓ U j ( b ) ) ↘ W R^{\mathit{Nf}}_n(\downarrow^{U_j}(b))\searrow W R n Nf ( ↓ U j ( b )) ↘ W
(by Rf-Univ)
Δ ⊢ t [ ϕ ] ≈ W : S [ ϕ ] \Delta\vdash t[\phi]\approx W:S[\phi] Δ ⊢ t [ ϕ ] ≈ W : S [ ϕ ]
(by Theorem 7.11: Δ ⊢ S [ ϕ ] ≈ T y j : T y i \Delta\vdash S[\phi]\approx\mathit{Ty}_j:\mathit{Ty}_i Δ ⊢ S [ ϕ ] ≈ Ty j : Ty i , and Subsump from the T y j \mathit{Ty}_j Ty j -equality)
P P P enters Top. Hypothesis: Γ ⊢ S : T y i ® U n i v i , j \Gamma\vdash S:\mathit{Ty}_i\mathbin{\circledR}\mathrm{Univ}_{i,j} Γ ⊢ S : Ty i ® Univ i , j . We assemble Theorem 7.15(b). The first clause is from Theorem 7.11; for U j ≈ U j ∈ U i ↘ R U_j\approx U_j\in U_i\searrow R U j ≈ U j ∈ U i ↘ R , immediate from U-Univ of the PER. For each Δ ⊢ k ϕ : Γ \Delta\vdash_k\phi:\Gamma Δ ⊢ k ϕ : Γ :
R ∣ Δ ∣ T y ( U j ) ↘ T y j R^{\mathit{Ty}}_{|\Delta|}(U_j)\searrow\mathit{Ty}_j R ∣Δ∣ Ty ( U j ) ↘ Ty j
(by Rty-Univ)
Δ ⊢ S [ ϕ ] ≈ T y j : T y i \Delta\vdash S[\phi]\approx\mathit{Ty}_j:\mathit{Ty}_i Δ ⊢ S [ ϕ ] ≈ Ty j : Ty i
(by Theorem 7.11)
Lemma 7.33 (Initial Environment Validity). If Γ ↘ S b \Gamma\searrow Sb Γ ↘ S b , then Γ ⊢ i d : Γ ® ↑ Γ ∈ S b \Gamma\vdash id:\Gamma\mathbin{\circledR}\uparrow^{\Gamma}\in Sb Γ ⊢ i d : Γ ® ↑ Γ ∈ S b .
Proof. By induction on Γ ↘ S b \Gamma\searrow\mathsf{Sb} Γ ↘ Sb .
Case
S b ⟺ ( Δ ⊢ σ : ⋅ ) ⋅ ↘ S b G-Ctx- ⋅ \frac{\mathsf{Sb} \Longleftrightarrow(\Delta\vdash\sigma: \cdot)}
{\cdot\searrow\mathsf{Sb}}
\quad\text{G-Ctx-}\cdot ⋅ ↘ Sb Sb ⟺ ( Δ ⊢ σ : ⋅ ) G-Ctx- ⋅
⋅ ⊢ i d : ⋅ \cdot\vdash\mathsf{id} : \cdot ⋅ ⊢ id : ⋅ holds trivially, hence ⋅ ⊢ i d : ⋅ ® ↑ ⋅ ∈ S b \cdot\vdash\mathsf{id} : \cdot\mathbin{\circledR} \mathord{\uparrow}^{\cdot} \in\mathsf{Sb} ⋅ ⊢ id : ⋅ ® ↑ ⋅ ∈ Sb .
Case
Γ ′ ↘ S b ′ Γ ′ ⊢ S k : T y i ∀ Δ 0 , σ T , ρ T . Δ 0 ⊢ σ T : Γ ′ ® ρ T ∈ S b ′ ⟹ ∃ a , P , E l . ⟦ S k ⟧ ( ρ T ) ↘ a ∧ a ∈ U i ∗ ↘ P ↘ E l ∧ Δ 0 ⊢ S k [ σ T ] : T y i ® P S b ⟺ Cons i ( Γ ′ , S k , S b ′ ) G − C t x − E x t ( Γ ′ , x k : S k ) ↘ S b \frac{
\begin{gathered}
\Gamma' \searrow\mathsf{Sb}' \qquad\Gamma' \vdash S_k : \mathsf{Ty}_i \\
\forall\Delta_0,\sigma_T,\rho_T.\ \Delta_0 \vdash\sigma_T : \Gamma' \mathbin{\circledR} \rho_T \in\mathsf{Sb}' \Longrightarrow\\
\exists a,P,\mathsf{El}.\ \llbracket S_k\rrbracket(\rho_T) \searrow a \land a \in\mathcal{U}^{*}_i \searrow P \searrow\mathsf{El} \land\Delta_0 \vdash S_k[\sigma_T] : \mathsf{Ty}_i \mathbin{\circledR} P
\end{gathered}
}
{
\mathsf{Sb} \Longleftrightarrow\operatorname{Cons}_i(\Gamma',S_k,\mathsf{Sb}')
}
\quad
\begin{gathered}
\mathsf{G-Ctx-Ext}\\
(\Gamma',x_k:S_k)\searrow\mathsf{Sb}
\end{gathered} Sb ⟺ Cons i ( Γ ′ , S k , Sb ′ ) Γ ′ ↘ Sb ′ Γ ′ ⊢ S k : Ty i ∀ Δ 0 , σ T , ρ T . Δ 0 ⊢ σ T : Γ ′ ® ρ T ∈ Sb ′ ⟹ ∃ a , P , El . [ [ S k ] ] ( ρ T ) ↘ a ∧ a ∈ U i ∗ ↘ P ↘ El ∧ Δ 0 ⊢ S k [ σ T ] : Ty i ® P G − Ctx − Ext ( Γ ′ , x k : S k ) ↘ Sb
Set Γ : = Γ ′ , x k : S k \Gamma:= \Gamma',x_k:S_k Γ := Γ ′ , x k : S k with ∣ Γ ∣ = k + 1 |\Gamma|=k+1 ∣Γ∣ = k + 1 .
Γ ′ ⊢ i d : Γ ′ ® ↑ Γ ′ ∈ S b ′ (by IH on Γ ′ ↘ S b ′ ) \Gamma' \vdash\mathsf{id}:\Gamma' \mathbin{\circledR} \mathord{\uparrow}^{\Gamma'} \in\mathsf{Sb}'\qquad\text{(by IH on }\Gamma'\searrow\mathsf{Sb}'\text{)} Γ ′ ⊢ id : Γ ′ ® ↑ Γ ′ ∈ Sb ′ (by IH on Γ ′ ↘ Sb ′ )
⟦ S k ⟧ ( ↑ Γ ′ ) ↘ A k , A k ∈ U i ∗ ↘ P k ↘ E l k (by the universal type-clause of G-Ctx-Ext instantiated at i d , ↑ Γ ′ ) \llbracket S_k\rrbracket(\mathord{\uparrow}^{\Gamma'})\searrow A_k,\ A_k\in\mathcal{U}^{*}_i\searrow P_k\searrow\mathsf{El}_k\qquad\text{(by the universal type-clause of G-Ctx-Ext instantiated at }\mathsf{id},\mathord{\uparrow}^{\Gamma'}\text{)} [ [ S k ] ] ( ↑ Γ ′ ) ↘ A k , A k ∈ U i ∗ ↘ P k ↘ El k (by the universal type-clause of G-Ctx-Ext instantiated at id , ↑ Γ ′ )
Γ ′ ⊢ S k [ i d ] : T y i ® P k (type clause at the same instantiation) \Gamma'\vdash S_k[\mathsf{id}]:\mathsf{Ty}_i\mathbin{\circledR}P_k
\qquad\text{(type clause at the same instantiation)} Γ ′ ⊢ S k [ id ] : Ty i ® P k (type clause at the same instantiation)
Γ ′ ⊢ S k : T y i ® P k (using S k [ i d ] = S k ) \Gamma'\vdash S_k:\mathsf{Ty}_i\mathbin{\circledR}P_k\qquad\text{(using }S_k[\mathsf{id}]=S_k\text{)} Γ ′ ⊢ S k : Ty i ® P k (using S k [ id ] = S k )
We supply the head witness for Cons i \operatorname{Cons}_i Cons i :
↑ Γ = ( ↑ Γ ′ , ↑ A k ( ℓ k ) / x k ) (by Theorem 5.4) \mathord{\uparrow}^{\Gamma}=(\mathord{\uparrow}^{\Gamma'},\mathord{\uparrow}^{A_k}(\ell_k)/x_k)
\qquad\text{(by Theorem 5.4)} ↑ Γ = ( ↑ Γ ′ , ↑ A k ( ℓ k ) / x k ) (by Theorem 5.4)
Γ ⊢ x k : S k [ ↑ ] (by Var-Hd) \Gamma\vdash x_k:S_k[\mathord{\uparrow}]
\qquad\text{(by Var-Hd)} Γ ⊢ x k : S k [ ↑ ] (by Var-Hd)
R ∣ Δ ′ ∣ N e ( ℓ k ) ↘ x ∣ Δ ′ ∣ − k − 1 ∣ Δ ′ ∣ for each Δ k ′ ⊢ ϕ : Γ (by Rne-var, the level-reading rule for ℓ k ) R^{\mathsf{Ne}}_{|\Delta'|}(\ell_k)\searrow x^{|\Delta'|}_{|\Delta'|-k-1}\ \text{for each }\Delta'_k\vdash\phi:\Gamma\qquad\text{(by Rne-var, the level-reading rule for }\ell_k\text{)} R ∣ Δ ′ ∣ Ne ( ℓ k ) ↘ x ∣ Δ ′ ∣ − k − 1 ∣ Δ ′ ∣ for each Δ k ′ ⊢ ϕ : Γ (by Rne-var, the level-reading rule for ℓ k )
Δ ′ ⊢ x k [ ϕ ] ≈ x ∣ Δ ′ ∣ − k − 1 ∣ Δ ′ ∣ : S k [ ↑ ] [ ϕ ] (by the syntactic action of ϕ on the variable x k ) \Delta'\vdash x_k[\phi]\approx x^{|\Delta'|}_{|\Delta'|-k-1}:S_k[\mathord{\uparrow}][\phi]\qquad\text{(by the syntactic action of }\phi\text{ on the variable }x_k\text{)} Δ ′ ⊢ x k [ ϕ ] ≈ x ∣ Δ ′ ∣ − k − 1 ∣ Δ ′ ∣ : S k [ ↑ ] [ ϕ ] (by the syntactic action of ϕ on the variable x k )
Γ ⊢ x k : S k [ ↑ ] ® ℓ k ∈ N e i A k (by Theorem 7.6, using the previous two lines) \Gamma\vdash x_k:S_k[\mathord{\uparrow}]\mathbin{\circledR}\ell_k\in\mathsf{Ne}^{A_k}_i
\qquad\text{(by Theorem 7.6, using the previous two lines)} Γ ⊢ x k : S k [ ↑ ] ® ℓ k ∈ Ne i A k (by Theorem 7.6, using the previous two lines)
Γ ⊢ x k : S k [ ↑ ] ® ↑ A k ( ℓ k ) ∈ E l k (by Theorem 7.32 part (1) on A k ) \Gamma\vdash x_k:S_k[\mathord{\uparrow}]\mathbin{\circledR}\mathord{\uparrow}^{A_k}(\ell_k)\in\mathsf{El}_k\qquad\text{(by Theorem 7.32 part (1) on }A_k\text{)} Γ ⊢ x k : S k [ ↑ ] ® ↑ A k ( ℓ k ) ∈ El k (by Theorem 7.32 part (1) on A k )
Γ ⊢ i d : Γ ® ↑ Γ ∈ S b (by Cons i assembly: tail (IH) and head witness above) \Gamma\vdash\mathsf{id}:\Gamma\mathbin{\circledR}\mathord{\uparrow}^{\Gamma}\in\mathsf{Sb}\qquad\text{(by }\operatorname{Cons}_i\text{ assembly: tail (IH) and head witness above)} Γ ⊢ id : Γ ® ↑ Γ ∈ Sb (by Cons i assembly: tail (IH) and head witness above)
Semantic Typing Rules
We now establish, for each syntactic rule, a corresponding semantic rule that validates the gluing model. The fundamental theorem of soundness then assembles these by mutual induction on the syntactic derivation.
The semantic typing judgment Γ ⊩ t : T \Gamma\Vdash t:T Γ ⊩ t : T is defined to be the existence of S b \mathsf{Sb} Sb with Γ ↘ S b \Gamma\searrow\mathsf{Sb} Γ ↘ Sb such that, for all Δ \Delta Δ and all Δ ⊢ σ : Γ ® ρ ∈ S b \Delta\vdash\sigma:\Gamma\mathbin{\circledR}\rho\in\mathsf{Sb} Δ ⊢ σ : Γ ® ρ ∈ Sb , there exist a , P , E l a,P,\mathsf{El} a , P , El with:
⟦ T ⟧ ( ρ ) ↘ a \llbracket T\rrbracket(\rho)\searrow a [ [ T ] ] ( ρ ) ↘ a ,
a ∈ U i ∗ ↘ P ↘ E l a\in\mathcal{U}^{*}_i\searrow P\searrow\mathsf{El} a ∈ U i ∗ ↘ P ↘ El ,
Δ ⊢ T [ σ ] : T y i ® P \Delta\vdash T[\sigma]:\mathsf{Ty}_i\mathbin{\circledR}P Δ ⊢ T [ σ ] : Ty i ® P , and
Δ ⊢ t [ σ ] : T [ σ ] ® ⟦ t ⟧ ( ρ ) ∈ E l \Delta\vdash t[\sigma]:T[\sigma]\mathbin{\circledR}\llbracket t\rrbracket(\rho)\in\mathsf{El} Δ ⊢ t [ σ ] : T [ σ ] ® [ [ t ] ] ( ρ ) ∈ El .
Lemma 7.34 (Semantic — Ctx-Emp). ⊩ ⋅ \Vdash\cdot ⊩ ⋅ .
Proof. By G-Ctx-⋅ \cdot ⋅ : ⋅ ↘ S b \cdot\searrow\mathsf{Sb} ⋅ ↘ Sb where S b ⇔ ( Δ ⊢ σ : ⋅ ) \mathsf{Sb} \Leftrightarrow(\Delta\vdash\sigma: \cdot) Sb ⇔ ( Δ ⊢ σ : ⋅ ) . Hence ⊩ ⋅ \Vdash\cdot ⊩ ⋅ by Theorem 7.17. □ \square □
Lemma 7.35 (Semantic — Ctx-Ext). If ⊩ Γ \Vdash\Gamma ⊩ Γ and Γ ⊩ S : T y i \Gamma\Vdash S : \mathsf{Ty}_i Γ ⊩ S : Ty i , then ⊩ Γ , x : S \Vdash\Gamma, x : S ⊩ Γ , x : S .
Proof. By ⊩ Γ \Vdash\Gamma ⊩ Γ , fix Γ ↘ S b T \Gamma\searrow\mathsf{Sb}_{T} Γ ↘ Sb T for some S b T \mathsf{Sb}_{T} Sb T . We supply each premise of G-Ctx-Ext.
Syntactic typing of S S S . By Theorem 7.33 on Γ ↘ S b T \Gamma\searrow\mathsf{Sb}_{T} Γ ↘ Sb T , the initial pair Γ ⊢ i d : Γ ® ↑ ∈ S b T \Gamma\vdash\mathsf{id} : \Gamma\mathrel{\circledR} \mathord{\uparrow}\in\mathsf{Sb}_{T} Γ ⊢ id : Γ ® ↑ ∈ Sb T is in S b T \mathsf{Sb}_{T} Sb T . By Γ ⊩ S : T y i \Gamma\Vdash S : \mathsf{Ty}_i Γ ⊩ S : Ty i at this pair, Γ ⊢ S [ i d ] : T y i ® P \Gamma\vdash S[\mathsf{id}] : \mathsf{Ty}_i \mathrel{\circledR} P Γ ⊢ S [ id ] : Ty i ® P for some P P P , hence Γ ⊢ S : T y i \Gamma\vdash S : \mathsf{Ty}_i Γ ⊢ S : Ty i by Theorem 7.22 (using S [ i d ] = S S[\mathsf{id}] = S S [ id ] = S ).
Universal type-clause. Let Δ ′ ⊢ σ T : Γ ® ρ T ∈ S b T \Delta' \vdash\sigma_T : \Gamma\mathrel{\circledR} \rho_T \in\mathsf{Sb}_{T} Δ ′ ⊢ σ T : Γ ® ρ T ∈ Sb T be arbitrary. By Γ ⊩ S : T y i \Gamma\Vdash S : \mathsf{Ty}_i Γ ⊩ S : Ty i at σ T , ρ T \sigma_T,\rho_T σ T , ρ T :
⟦ S ⟧ ( ρ T ) ↘ a , a ∈ U i ∗ ↘ P ↘ E l \llbracket S\rrbracket(\rho_T) \searrow a,\quad a \in\mathcal{U}^{*}_i \searrow P \searrow\mathsf{El} [ [ S ] ] ( ρ T ) ↘ a , a ∈ U i ∗ ↘ P ↘ El
(by Γ ⊩ S : T y i \Gamma\Vdash S : \mathsf{Ty}_i Γ ⊩ S : Ty i at σ T , ρ T \sigma_T,\rho_T σ T , ρ T )
Δ ′ ⊢ S [ σ T ] : T y i ® P \Delta' \vdash S[\sigma_T] : \mathsf{Ty}_i \mathrel{\circledR} P Δ ′ ⊢ S [ σ T ] : Ty i ® P
(by Γ ⊩ S : T y i \Gamma\Vdash S : \mathsf{Ty}_i Γ ⊩ S : Ty i , type part)
This supplies the universal-clause witness for the given σ T , ρ T \sigma_T,\rho_T σ T , ρ T .
By G-Ctx-Ext: ( Γ , x : S ) ↘ S b (\Gamma, x : S) \searrow\mathsf{Sb} ( Γ , x : S ) ↘ Sb where S b ⇔ Cons i ( Γ , S , S b T ) \mathsf{Sb} \Leftrightarrow\operatorname{Cons}_i(\Gamma,S,\mathsf{Sb}_T) Sb ⇔ Cons i ( Γ , S , Sb T ) . Hence ⊩ Γ , x : S \Vdash\Gamma, x : S ⊩ Γ , x : S by Theorem 7.17. □ \square □
Lemma 7.36 (Semantic — Var). If ⊩ Γ \Vdash\Gamma ⊩ Γ and x : S ∈ Γ x : S \in\Gamma x : S ∈ Γ , then Γ ⊩ x : S \Gamma\Vdash x : S Γ ⊩ x : S .
Proof. By ⊩ Γ \Vdash\Gamma ⊩ Γ , fix Γ ↘ S b \Gamma\searrow\mathsf{Sb} Γ ↘ Sb and let Δ ⊢ σ : Γ ® ρ ∈ S b \Delta\vdash\sigma: \Gamma\mathrel{\circledR} \rho\in\mathsf{Sb} Δ ⊢ σ : Γ ® ρ ∈ Sb be given. We proceed by induction on the lookup derivation x : S ∈ Γ x : S \in\Gamma x : S ∈ Γ .
Case
x 0 : T [ ↑ ] ∈ Γ 0 , x 0 : T V a r − H d \frac{x_0 : T[\mathord{\uparrow}] \in\Gamma_0, x_0 : T}{\mathsf{Var-Hd}} Var − Hd x 0 : T [ ↑ ] ∈ Γ 0 , x 0 : T
Here Γ = Γ 0 , x 0 : T \Gamma= \Gamma_0, x_0 : T Γ = Γ 0 , x 0 : T and S = T [ ↑ ] S = T[\mathord{\uparrow}] S = T [ ↑ ] . We must show Γ ⊩ x 0 : T [ ↑ ] \Gamma\Vdash x_0 : T[\mathord{\uparrow}] Γ ⊩ x 0 : T [ ↑ ] : for the given Δ ⊢ σ : Γ ® ρ ∈ S b \Delta\vdash\sigma: \Gamma\mathrel{\circledR} \rho\in\mathsf{Sb} Δ ⊢ σ : Γ ® ρ ∈ Sb , evaluating T [ ↑ ] T[\mathord{\uparrow}] T [ ↑ ] at ρ \rho ρ yields a value a ∗ a^{*} a ∗ with a ∗ ∈ U i ∗ ↘ P ∗ ↘ E l ∗ a^{*} \in\mathcal{U}^{*}_i \searrow P^{*} \searrow\mathsf{El}^{*} a ∗ ∈ U i ∗ ↘ P ∗ ↘ El ∗ , and:
Δ ⊢ T [ ↑ ∘ σ ] : T y i ® P ∗ \Delta\vdash T[\mathord{\uparrow}\circ\sigma] : \mathsf{Ty}_i \mathrel{\circledR} P^{*} Δ ⊢ T [ ↑ ∘ σ ] : Ty i ® P ∗ , and
Δ ⊢ x 0 [ σ ] : T [ ↑ ∘ σ ] ® ⟦ x 0 ⟧ ( ρ ) ∈ E l ∗ \Delta\vdash x_0[\sigma] : T[\mathord{\uparrow}\circ\sigma] \mathrel{\circledR} \llbracket x_0\rrbracket(\rho) \in\mathsf{El}^{*} Δ ⊢ x 0 [ σ ] : T [ ↑ ∘ σ ] ® [ [ x 0 ] ] ( ρ ) ∈ El ∗ .
Since Γ = Γ 0 , x 0 : T \Gamma= \Gamma_0, x_0 : T Γ = Γ 0 , x 0 : T , the gluing Γ ↘ S b \Gamma\searrow\mathsf{Sb} Γ ↘ Sb is by G-Ctx-Ext on Γ 0 ↘ S b T 0 \Gamma_0 \searrow\mathsf{Sb}_{T_0} Γ 0 ↘ Sb T 0 with Γ 0 ⊢ T : T y i \Gamma_0 \vdash T : \mathsf{Ty}_i Γ 0 ⊢ T : Ty i , and S b ⇔ Cons i ( Γ 0 , T , S b T 0 ) \mathsf{Sb} \Leftrightarrow\operatorname{Cons}_i(\Gamma_0,T,\mathsf{Sb}_{T_0}) Sb ⇔ Cons i ( Γ 0 , T , Sb T 0 ) . Unfolding Cons i \operatorname{Cons}_i Cons i at our σ , ρ \sigma,\rho σ , ρ (which provides existential a , P , E l a,P,\mathsf{El} a , P , El specific to this σ , ρ \sigma,\rho σ , ρ ):
Δ ⊢ ↑ ∘ σ : Γ 0 ® ρ [ ↑ ] ∈ S b T 0 (tail of Cons i ) \Delta\vdash\mathord{\uparrow}\circ\sigma: \Gamma_0 \mathrel{\circledR} \rho[\mathord{\uparrow}] \in\mathsf{Sb}_{T_0}\qquad\text{(tail of }\operatorname{Cons}_i\text{)} Δ ⊢ ↑ ∘ σ : Γ 0 ® ρ [ ↑ ] ∈ Sb T 0 (tail of Cons i )
⟦ T ⟧ ( ρ [ ↑ ] ) ↘ a , a ∈ U i ∗ ↘ P ↘ E l (type clause of Cons i ) \llbracket T\rrbracket(\rho[\mathord{\uparrow}]) \searrow a,\quad a \in\mathcal{U}^{*}_i \searrow P \searrow\mathsf{El}\qquad\text{(type clause of }\operatorname{Cons}_i\text{)} [ [ T ] ] ( ρ [ ↑ ]) ↘ a , a ∈ U i ∗ ↘ P ↘ El (type clause of Cons i )
Δ ⊢ T [ ↑ ∘ σ ] : T y i ® P (type clause of Cons i ) \Delta\vdash T[\mathord{\uparrow}\circ\sigma] : \mathsf{Ty}_i \mathrel{\circledR} P\qquad\text{(type clause of }\operatorname{Cons}_i\text{)} Δ ⊢ T [ ↑ ∘ σ ] : Ty i ® P (type clause of Cons i )
Δ ⊢ x 0 [ σ ] : T [ ↑ ∘ σ ] ® ρ ( x 0 ) ∈ E l (head of Cons i ) \Delta\vdash x_0[\sigma] : T[\mathord{\uparrow}\circ\sigma] \mathrel{\circledR} \rho(x_0) \in\mathsf{El}\qquad\text{(head of }\operatorname{Cons}_i\text{)} Δ ⊢ x 0 [ σ ] : T [ ↑ ∘ σ ] ® ρ ( x 0 ) ∈ El (head of Cons i )
⟦ x 0 ⟧ ( ρ ) = ρ ( x 0 ) (by ev-var) \llbracket x_0\rrbracket(\rho) = \rho(x_0)
\qquad\text{(by ev-var)} [ [ x 0 ] ] ( ρ ) = ρ ( x 0 ) (by ev-var)
Establishing the goal ⟦ T [ ↑ ] ⟧ ( ρ ) ↘ a ∗ \llbracket T[\mathord{\uparrow}]\rrbracket(\rho) \searrow a^{*} [ [ T [ ↑ ] ] ] ( ρ ) ↘ a ∗ at the same ( P , E l ) (P,\mathsf{El}) ( P , El ) . The Cons i \operatorname{Cons}_i Cons i type clause gives ⟦ T ⟧ ( ρ [ ↑ ] ) ↘ a \llbracket T\rrbracket(\rho[\mathord{\uparrow}]) \searrow a [ [ T ] ] ( ρ [ ↑ ]) ↘ a , but the goal needs ⟦ T [ ↑ ] ⟧ ( ρ ) ↘ a ∗ \llbracket T[\mathord{\uparrow}]\rrbracket(\rho) \searrow a^{*} [ [ T [ ↑ ] ] ] ( ρ ) ↘ a ∗ . By Theorem 6.73 of Sec. 6 on Γ 0 ⊢ T : T y i \Gamma_0 \vdash T : \mathsf{Ty}_i Γ 0 ⊢ T : Ty i , Γ 0 ⊨ T ≈ T : T y i \Gamma_0 \models T \approx T : \mathsf{Ty}_i Γ 0 ⊨ T ≈ T : Ty i . Instantiate this at ↑ \mathord{\uparrow} ↑ and ρ \rho ρ (self-related in R Γ R_{\Gamma} R Γ ):
Γ ⊩ w ↑ : Γ 0 (by KW-Shift) \Gamma\Vdash_{\mathsf{w}} \mathord{\uparrow} : \Gamma_0
\qquad\text{(by KW-Shift)} Γ ⊩ w ↑ : Γ 0 (by KW-Shift)
Γ ⊩ ↑ ≈ ↑ : Γ 0 (by Theorem 6.35) \Gamma\Vdash\mathord{\uparrow}\approx\mathord{\uparrow} : \Gamma_0
\qquad\text{(by Theorem 6.35)} Γ ⊩ ↑ ≈ ↑ : Γ 0 (by Theorem 6.35)
⟦ T [ ↑ ] ⟧ ( ρ ) ≈ ⟦ T ⟧ ( ⟦ ↑ ⟧ ( ρ ) ) ∈ U i ↘ R (four-value pattern of Γ 0 ⊨ T ≈ T : T y i at ↑ , ρ ) \llbracket T[\mathord{\uparrow}]\rrbracket(\rho) \approx\llbracket T\rrbracket(\llbracket\mathord{\uparrow}\rrbracket(\rho)) \in\mathcal{U}_i \searrow R\qquad\text{(four-value pattern of }\Gamma_0 \models T \approx T : \mathsf{Ty}_i\text{ at }\mathord{\uparrow},\rho\text{)} [ [ T [ ↑ ] ] ] ( ρ ) ≈ [ [ T ] ] ( [ [ ↑ ] ] ( ρ )) ∈ U i ↘ R (four-value pattern of Γ 0 ⊨ T ≈ T : Ty i at ↑ , ρ )
⟦ ↑ ⟧ ( ρ ) = ρ [ ↑ ] (by definition of weakening evaluation, Sec. 5) \llbracket\mathord{\uparrow}\rrbracket(\rho) = \rho[\mathord{\uparrow}]
\qquad\text{(by definition of weakening evaluation, Sec. 5)} [ [ ↑ ] ] ( ρ ) = ρ [ ↑ ] (by definition of weakening evaluation, Sec. 5)
a ∗ ≈ a ∈ U i ↘ R (rewriting ⟦ T [ ↑ ] ⟧ ( ρ ) = a ∗ and ⟦ T ⟧ ( ρ [ ↑ ] ) = a ) a^{*} \approx a \in\mathcal{U}_i \searrow R\qquad\text{(rewriting }\llbracket T[\mathord{\uparrow}]\rrbracket(\rho) = a^{*}\text{ and }\llbracket T\rrbracket(\rho[\mathord{\uparrow}]) = a\text{)} a ∗ ≈ a ∈ U i ↘ R (rewriting [ [ T [ ↑ ] ] ] ( ρ ) = a ∗ and [ [ T ] ] ( ρ [ ↑ ]) = a )
a ∗ ∈ U i ∗ ↘ P ↘ E l (by Theorem 7.27 from a ∈ U i ∗ ↘ P ↘ E l ) a^{*} \in\mathcal{U}^{*}_i \searrow P \searrow\mathsf{El}\qquad\text{(by Theorem 7.27 from }a \in\mathcal{U}^{*}_i \searrow P \searrow\mathsf{El}\text{)} a ∗ ∈ U i ∗ ↘ P ↘ El (by Theorem 7.27 from a ∈ U i ∗ ↘ P ↘ El )
This supplies the goal evaluation ⟦ T [ ⇑ ] ⟧ ( ρ ) ↘ a ∗ \llbracket T[\Uparrow]\rrbracket(\rho) \searrow a^* [ [ T [ ⇑ ] ] ] ( ρ ) ↘ a ∗ with a ∗ ∈ U i ∗ ↘ P ↘ E l a^* \in U_i^* \searrow P \searrow\mathrm{El} a ∗ ∈ U i ∗ ↘ P ↘ El , where ( P , E l ) (P,\mathrm{El}) ( P , El ) are the same predicates packaged by Cons i \operatorname{Cons}_i Cons i . Clauses (1) and (2) of Γ ⊩ x 0 : T [ ⇑ ] \Gamma\Vdash x_0 : T[\Uparrow] Γ ⊩ x 0 : T [ ⇑ ] are exactly the Cons i \operatorname{Cons}_i Cons i type clause Δ ⊢ T [ ⇑ ∘ σ ] : T y i ® P \Delta\vdash T[\Uparrow\circ\sigma] : \mathrm{Ty}_i \mathbin{\circledR} P Δ ⊢ T [ ⇑ ∘ σ ] : Ty i ® P and the head’s E l \mathrm{El} El -witness ρ ( x 0 ) = ⟦ x 0 ⟧ ( ρ ) \rho(x_0)=\llbracket x_0\rrbracket(\rho) ρ ( x 0 ) = [ [ x 0 ] ] ( ρ ) above.
Case
y : S ′ ∈ Γ 0 1 + y : S ′ [ ⇑ ] ∈ Γ 0 , z : T \frac{y:S' \in\Gamma_0}{1+y:S'[\Uparrow] \in\Gamma_0,z:T} 1 + y : S ′ [ ⇑ ] ∈ Γ 0 , z : T y : S ′ ∈ Γ 0
Here Γ = Γ 0 , z : T \Gamma=\Gamma_0,z:T Γ = Γ 0 , z : T , x = 1 + y x=1+y x = 1 + y for some y y y with y : S ′ ∈ Γ 0 y:S' \in\Gamma_0 y : S ′ ∈ Γ 0 , and S = S ′ [ ⇑ ] S=S'[\Uparrow] S = S ′ [ ⇑ ] . We must show Γ ⊩ 1 + y : S ′ [ ⇑ ] \Gamma\Vdash1+y:S'[\Uparrow] Γ ⊩ 1 + y : S ′ [ ⇑ ] : evaluating S ′ [ ⇑ ] S'[\Uparrow] S ′ [ ⇑ ] at ρ \rho ρ yields a value a ∗ a^* a ∗ in U i ∗ ↘ P ∗ ↘ E l ∗ U_i^* \searrow P^* \searrow\mathrm{El}^* U i ∗ ↘ P ∗ ↘ El ∗ , with the type and term predicates at σ , ρ \sigma,\rho σ , ρ . S b \mathrm{Sb} Sb unfolds to Cons i \operatorname{Cons}_i Cons i at σ , ρ \sigma,\rho σ , ρ , giving the tail ⇑ ∘ σ , ρ [ ⇑ ] ∈ S b T \Uparrow\circ\sigma,\rho[\Uparrow]\in\mathrm{Sb}_T ⇑ ∘ σ , ρ [ ⇑ ] ∈ Sb T .
<u>Apply IH on the tail.</u>
Δ ⊢ ⇑ ∘ σ : Γ 0 ® ρ [ ⇑ ] ∈ S b T (tail of Cons i ) y : S ′ ∈ Γ 0 (premise) Γ 0 ⊩ y : S ′ (by IH on the shorter lookup derivation, with ⊩ Γ 0 from ⊩ Γ via the tail) ⟦ S ′ ⟧ ( ρ [ ⇑ ] ) ↘ b , b ∈ U i ∗ ↘ P ′ ↘ E l ′ (by IH on S ′ at ⇑ ∘ σ , ρ [ ⇑ ] ) Δ ⊢ S ′ [ ⇑ ∘ σ ] : T y i ® P ′ (by IH on S ′ , type part) Δ ⊢ y [ ⇑ ∘ σ ] : S ′ [ ⇑ ∘ σ ] ® ⟦ y ⟧ ( ρ [ ⇑ ] ) ∈ E l ′ (by IH on y , term part) \begin{aligned}
\Delta\vdash\Uparrow\circ\sigma:\Gamma_0 \mathbin{\circledR} \rho[\Uparrow]\in\mathrm{Sb}_T && \text{(tail of }\operatorname{Cons}_i\text{)}\\
y:S'\in\Gamma_0 && \text{(premise)}\\
\Gamma_0\Vdash y:S' && \text{(by IH on the shorter lookup derivation, with }\Vdash\Gamma_0\text{ from }\Vdash\Gamma\text{ via the tail)}\\
\llbracket S'\rrbracket(\rho[\Uparrow])\searrow b,\ b\in U_i^*\searrow P'\searrow\mathrm{El}' && \text{(by IH on }S'\text{ at }\Uparrow\circ\sigma,\rho[\Uparrow]\text{)}\\
\Delta\vdash S'[\Uparrow\circ\sigma]:\mathrm{Ty}_i\mathbin{\circledR}P' && \text{(by IH on }S'\text{, type part)}\\
\Delta\vdash y[\Uparrow\circ\sigma]:S'[\Uparrow\circ\sigma]\mathbin{\circledR}\llbracket y\rrbracket(\rho[\Uparrow])\in\mathrm{El}' && \text{(by IH on }y\text{, term part)}
\end{aligned} Δ ⊢⇑ ∘ σ : Γ 0 ® ρ [ ⇑ ] ∈ Sb T y : S ′ ∈ Γ 0 Γ 0 ⊩ y : S ′ [ [ S ′ ] ] ( ρ [ ⇑ ]) ↘ b , b ∈ U i ∗ ↘ P ′ ↘ El ′ Δ ⊢ S ′ [ ⇑ ∘ σ ] : Ty i ® P ′ Δ ⊢ y [ ⇑ ∘ σ ] : S ′ [ ⇑ ∘ σ ] ® [ [ y ] ] ( ρ [ ⇑ ]) ∈ El ′ (tail of Cons i ) (premise) (by IH on the shorter lookup derivation, with ⊩ Γ 0 from ⊩ Γ via the tail) (by IH on S ′ at ⇑ ∘ σ , ρ [ ⇑ ] ) (by IH on S ′ , type part) (by IH on y , term part)
<u>Bridging the goal evaluation ⟦ S ′ [ ⇑ ] ⟧ ( ρ ) \llbracket S'[\Uparrow]\rrbracket(\rho) [ [ S ′ [ ⇑ ] ] ] ( ρ ) to b b b .</u> By Theorem 6.73 of Sec. 6 on Γ 0 ⊢ S ′ : T y i \Gamma_0\vdash S':\mathrm{Ty}_i Γ 0 ⊢ S ′ : Ty i (extracted from the IH via Theorem 7.22): Γ 0 ⊨ S ′ ≈ S ′ : T y i \Gamma_0\models S'\approx S':\mathrm{Ty}_i Γ 0 ⊨ S ′ ≈ S ′ : Ty i . Instantiating at ⇑ \Uparrow ⇑ and ρ \rho ρ (self-related in R Γ R_\Gamma R Γ ):
⟦ ⇑ ⟧ ( ρ ) = ρ [ ⇑ ] (by definition of weakening evaluation, Sec. 5) ⟦ S ′ [ ⇑ ] ⟧ ( ρ ) ≈ ⟦ S ′ ⟧ ( ρ [ ⇑ ] ) ∈ U i ↘ R ′ (four-value pattern of Γ 0 ⊨ S ′ ≈ S ′ : T y i at ⇑ , ρ ) a ∗ ≈ b ∈ U i ↘ R ′ (rewriting ⟦ S ′ [ ⇑ ] ⟧ ( ρ ) = a ∗ and ⟦ S ′ ⟧ ( ρ [ ⇑ ] ) = b ) a ∗ ∈ U i ∗ ↘ P ′ ↘ E l ′ (by Theorem 7.27 from b ∈ U i ∗ ↘ P ′ ↘ E l ′ ) \begin{aligned}
\llbracket\Uparrow\rrbracket(\rho)&=\rho[\Uparrow] && \text{(by definition of weakening evaluation, Sec. 5)}\\
\llbracket S'[\Uparrow]\rrbracket(\rho)&\approx\llbracket S'\rrbracket(\rho[\Uparrow])\in U_i\searrow R' && \text{(four-value pattern of }\Gamma_0\models S'\approx S':\mathrm{Ty}_i\text{ at }\Uparrow,\rho\text{)}\\
a^*&\approx b\in U_i\searrow R' && \text{(rewriting }\llbracket S'[\Uparrow]\rrbracket(\rho)=a^*\text{ and }\llbracket S'\rrbracket(\rho[\Uparrow])=b\text{)}\\
a^*&\in U_i^*\searrow P'\searrow\mathrm{El}' && \text{(by Theorem 7.27 from }b\in U_i^*\searrow P'\searrow\mathrm{El}'\text{)}
\end{aligned} [ [ ⇑ ] ] ( ρ ) [ [ S ′ [ ⇑ ] ] ] ( ρ ) a ∗ a ∗ = ρ [ ⇑ ] ≈ [ [ S ′ ] ] ( ρ [ ⇑ ]) ∈ U i ↘ R ′ ≈ b ∈ U i ↘ R ′ ∈ U i ∗ ↘ P ′ ↘ El ′ (by definition of weakening evaluation, Sec. 5) (four-value pattern of Γ 0 ⊨ S ′ ≈ S ′ : Ty i at ⇑ , ρ ) (rewriting [ [ S ′ [ ⇑ ] ] ] ( ρ ) = a ∗ and [ [ S ′ ] ] ( ρ [ ⇑ ]) = b ) (by Theorem 7.27 from b ∈ U i ∗ ↘ P ′ ↘ El ′ )
The term-side equality ⟦ 1 + y ⟧ ( ρ ) = ⟦ y ⟧ ( ρ [ ⇑ ] ) \llbracket1+y\rrbracket(\rho)=\llbracket y\rrbracket(\rho[\Uparrow]) [ [ 1 + y ] ] ( ρ ) = [ [ y ] ] ( ρ [ ⇑ ]) holds directly: ⟦ 1 + y ⟧ ( ρ ) = ρ ( 1 + y ) = ρ [ ⇑ ] ( y ) = ⟦ y ⟧ ( ρ [ ⇑ ] ) \llbracket1+y\rrbracket(\rho)=\rho(1+y)=\rho[\Uparrow](y)=\llbracket y\rrbracket(\rho[\Uparrow]) [ [ 1 + y ] ] ( ρ ) = ρ ( 1 + y ) = ρ [ ⇑ ] ( y ) = [ [ y ] ] ( ρ [ ⇑ ]) (variable lookup), so no bridging is needed for the term side.
<u>Assembling the goal.</u>
( 1 + y ) [ σ ] = y [ ⇑ ∘ σ ] (by syntactic action and Theorem 2.22) S ′ [ ⇑ ] [ σ ] = S ′ [ ⇑ ∘ σ ] (by Theorem 2.22) Δ ⊢ ( 1 + y ) [ σ ] : S ′ [ ⇑ ] [ σ ] ® ⟦ 1 + y ⟧ ( ρ ) ∈ E l ′ (rewriting the IH instance via the previous identities) \begin{aligned}
(1+y)[\sigma]&=y[\Uparrow\circ\sigma] && \text{(by syntactic action and Theorem 2.22)}\\
S'[\Uparrow][\sigma]&=S'[\Uparrow\circ\sigma] && \text{(by Theorem 2.22)}\\
\Delta\vdash(1+y)[\sigma]&:S'[\Uparrow][\sigma]\mathbin{\circledR}\llbracket1+y\rrbracket(\rho)\in\mathrm{El}' && \text{(rewriting the IH instance via the previous identities)}
\end{aligned} ( 1 + y ) [ σ ] S ′ [ ⇑ ] [ σ ] Δ ⊢ ( 1 + y ) [ σ ] = y [ ⇑ ∘ σ ] = S ′ [ ⇑ ∘ σ ] : S ′ [ ⇑ ] [ σ ] ® [ [ 1 + y ] ] ( ρ ) ∈ El ′ (by syntactic action and Theorem 2.22) (by Theorem 2.22) (rewriting the IH instance via the previous identities)
This supplies the goal at a ∗ ∈ U i ∗ ↘ P ′ ↘ E l ′ a^*\in U_i^*\searrow P'\searrow\mathrm{El}' a ∗ ∈ U i ∗ ↘ P ′ ↘ El ′ .
Lemma 7.37 (Semantic – U-Wf). If ⊩ Γ \Vdash\Gamma ⊩ Γ and j < i j<i j < i , then Γ ⊩ T y j : T y i \Gamma\Vdash\mathrm{Ty}_j:\mathrm{Ty}_i Γ ⊩ Ty j : Ty i .
Proof. By ⊩ Γ \Vdash\Gamma ⊩ Γ , fix Γ ↘ S b \Gamma\searrow\mathrm{Sb} Γ ↘ Sb and let Δ ⊢ σ : Γ ® ρ ∈ S b \Delta\vdash\sigma:\Gamma\mathbin{\circledR}\rho\in\mathrm{Sb} Δ ⊢ σ : Γ ® ρ ∈ Sb be given. Type is T y i \mathrm{Ty}_i Ty i , sitting at universe-level 1 + i 1+i 1 + i . We establish the four clauses of Γ ⊩ T y j : T y i \Gamma\Vdash\mathrm{Ty}_j:\mathrm{Ty}_i Γ ⊩ Ty j : Ty i at a = U i a=U_i a = U i , P = U n i v 1 + i , i P=\mathrm{Univ}_{1+i,i} P = Univ 1 + i , i , E l = U n i v E l 1 + i , i \mathrm{El}=\mathrm{UnivEl}_{1+i,i} El = UnivEl 1 + i , i .
⟦ T y i ⟧ ( ρ ) ↘ U i (by ev-U) [clause 1] \llbracket\mathrm{Ty}_i\rrbracket(\rho)\searrow U_i
\qquad\text{(by ev-U)}
\qquad\text{[clause 1]} [ [ Ty i ] ] ( ρ ) ↘ U i (by ev-U) [clause 1]
U i ∈ U 1 + i ∗ ↘ U n i v 1 + i , i ↘ U n i v E l 1 + i , i (by G-Univ) [clause 2] U_i\in U_{1+i}^*\searrow\mathrm{Univ}_{1+i,i}\searrow\mathrm{UnivEl}_{1+i,i}
\qquad\text{(by G-Univ)}
\qquad\text{[clause 2]} U i ∈ U 1 + i ∗ ↘ Univ 1 + i , i ↘ UnivEl 1 + i , i (by G-Univ) [clause 2]
T y i [ σ ] = T y i (syntactic; closed) \mathrm{Ty}_i[\sigma]=\mathrm{Ty}_i
\qquad\text{(syntactic; closed)} Ty i [ σ ] = Ty i (syntactic; closed)
Δ ⊢ T y i [ σ ] ≈ T y i : T y 1 + i (by reflexivity) Δ ⊢ T y i [ σ ] : T y 1 + i R U n i v 1 + i , i (by Theorem 7.11) ⟦ T y j ⟧ ( ρ ) ↘ U j (by ev-U) U j ∈ U 1 + j ∗ ↘ U n i v 1 + j , j ↘ U n i v 1 + j , j E l (by G-Univ at level 1 + j ) U j ∈ U i ∗ ↘ U n i v i , j ↘ U n i v i , j E l (by Theorem 7.25 from 1 + j ≤ i , since j < i ) Δ ⊢ T y j [ σ ] ≈ T y j : T y i (by reflexivity, j < i ) Δ ⊢ T y j [ σ ] : T y i R U j ∈ U n i v 1 + i , i E l (by Theorem 7.12 on U j ∈ U i ∗ ↘ U n i v i , j ↘ U n i v i , j E l ) \begin{aligned}
\Delta&\vdash\mathrm{Ty}_{i}[\sigma] \approx\mathrm{Ty}_{i} : \mathrm{Ty}_{1+i} && \text{(by reflexivity)} \\
\Delta&\vdash\mathrm{Ty}_{i}[\sigma] : \mathrm{Ty}_{1+i} \mathbin{\mathsf{R}} \mathrm{Univ}_{1+i,i} && \text{(by Theorem 7.11)} \\
\llbracket\mathrm{Ty}_{j}\rrbracket(\rho) &\searrow U_{j} && \text{(by ev-U)} \\
U_{j} &\in\mathcal{U}^{*}_{1+j} \searrow\mathrm{Univ}_{1+j,j} \searrow\mathrm{Univ}^{\mathrm{El}}_{1+j,j} && \text{(by G-Univ at level }1+j\text{)} \\
U_{j} &\in\mathcal{U}^{*}_{i} \searrow\mathrm{Univ}_{i,j} \searrow\mathrm{Univ}^{\mathrm{El}}_{i,j} && \text{(by Theorem 7.25 from }1+j \le i\text{, since }j<i\text{)} \\
\Delta&\vdash\mathrm{Ty}_{j}[\sigma] \approx\mathrm{Ty}_{j} : \mathrm{Ty}_{i} && \text{(by reflexivity, }j<i\text{)} \\
\Delta&\vdash\mathrm{Ty}_{j}[\sigma] : \mathrm{Ty}_{i} \mathbin{\mathsf{R}} U_{j} \in\mathrm{Univ}^{\mathrm{El}}_{1+i,i} && \text{(by Theorem 7.12 on }U_{j} \in\mathcal{U}^{*}_{i} \searrow\mathrm{Univ}_{i,j} \searrow\mathrm{Univ}^{\mathrm{El}}_{i,j}\text{)}
\end{aligned} Δ Δ [ [ Ty j ] ] ( ρ ) U j U j Δ Δ ⊢ Ty i [ σ ] ≈ Ty i : Ty 1 + i ⊢ Ty i [ σ ] : Ty 1 + i R Univ 1 + i , i ↘ U j ∈ U 1 + j ∗ ↘ Univ 1 + j , j ↘ Univ 1 + j , j El ∈ U i ∗ ↘ Univ i , j ↘ Univ i , j El ⊢ Ty j [ σ ] ≈ Ty j : Ty i ⊢ Ty j [ σ ] : Ty i R U j ∈ Univ 1 + i , i El (by reflexivity) (by Theorem 7.11) (by ev-U) (by G-Univ at level 1 + j ) (by Theorem 7.25 from 1 + j ≤ i , since j < i ) (by reflexivity, j < i ) (by Theorem 7.12 on U j ∈ U i ∗ ↘ Univ i , j ↘ Univ i , j El )
Lemma 7.38 (Semantic — N-Wf). If ⊩ Γ \Vdash\Gamma ⊩ Γ , then Γ ⊩ N a t : T y i \Gamma\Vdash\mathrm{Nat} : \mathrm{Ty}_{i} Γ ⊩ Nat : Ty i for every i i i .
Proof. By ⊩ Γ \Vdash\Gamma ⊩ Γ , fix Γ ↘ S b \Gamma\searrow\mathrm{Sb} Γ ↘ Sb and let Δ ⊢ σ : Γ R ρ ∈ S b \Delta\vdash\sigma: \Gamma\mathbin{\mathsf{R}} \rho\in\mathrm{Sb} Δ ⊢ σ : Γ R ρ ∈ Sb be given. We establish the four clauses of Γ ⊩ N a t : T y i \Gamma\Vdash\mathrm{Nat} : \mathrm{Ty}_{i} Γ ⊩ Nat : Ty i at a = U i a = U_{i} a = U i , P = U n i v 1 + i , i P = \mathrm{Univ}_{1+i,i} P = Univ 1 + i , i , E l = U n i v 1 + i , i E l \mathrm{El} = \mathrm{Univ}^{\mathrm{El}}_{1+i,i} El = Univ 1 + i , i El .
⟦ T y i ⟧ ( ρ ) ↘ U i (by ev-U) U i ∈ U 1 + i ∗ ↘ U n i v 1 + i , i ↘ U n i v 1 + i , i E l (by G-Univ) T y i [ σ ] = T y i (syntactic; closed) Δ ⊢ T y i [ σ ] ≈ T y i : T y 1 + i (by reflexivity) Δ ⊢ T y i [ σ ] : T y 1 + i R U n i v 1 + i , i (by Theorem 7.11) ⟦ N a t ⟧ ( ρ ) ↘ N (by ev-N) N ∈ U i ∗ ↘ N a t i ↘ N a t i (by G-Nat) N a t [ σ ] = N a t (syntactic; closed) Δ ⊢ N a t [ σ ] ≈ N a t : T y i (by reflexivity) Δ ⊢ N a t [ σ ] : T y i R N ∈ U n i v 1 + i , i E l (by Theorem 7.12 on N ∈ U i ∗ ) \begin{aligned}
\llbracket\mathrm{Ty}_{i}\rrbracket(\rho) &\searrow U_{i} && \text{(by ev-U)} \\
U_{i} &\in\mathcal{U}^{*}_{1+i} \searrow\mathrm{Univ}_{1+i,i} \searrow\mathrm{Univ}^{\mathrm{El}}_{1+i,i} && \text{(by G-Univ)} \\
\mathrm{Ty}_{i}[\sigma] &= \mathrm{Ty}_{i} && \text{(syntactic; closed)} \\
\Delta&\vdash\mathrm{Ty}_{i}[\sigma] \approx\mathrm{Ty}_{i} : \mathrm{Ty}_{1+i} && \text{(by reflexivity)} \\
\Delta&\vdash\mathrm{Ty}_{i}[\sigma] : \mathrm{Ty}_{1+i} \mathbin{\mathsf{R}} \mathrm{Univ}_{1+i,i} && \text{(by Theorem 7.11)} \\
\llbracket\mathrm{Nat}\rrbracket(\rho) &\searrow N && \text{(by ev-N)} \\
N &\in\mathcal{U}^{*}_{i} \searrow\mathrm{Nat}_{i} \searrow\mathrm{Nat}_{i} && \text{(by G-Nat)} \\
\mathrm{Nat}[\sigma] &= \mathrm{Nat} && \text{(syntactic; closed)} \\
\Delta&\vdash\mathrm{Nat}[\sigma] \approx\mathrm{Nat} : \mathrm{Ty}_{i} && \text{(by reflexivity)} \\
\Delta&\vdash\mathrm{Nat}[\sigma] : \mathrm{Ty}_{i} \mathbin{\mathsf{R}} N \in\mathrm{Univ}^{\mathrm{El}}_{1+i,i} && \text{(by Theorem 7.12 on }N \in\mathcal{U}^{*}_{i}\text{)}
\end{aligned} [ [ Ty i ] ] ( ρ ) U i Ty i [ σ ] Δ Δ [ [ Nat ] ] ( ρ ) N Nat [ σ ] Δ Δ ↘ U i ∈ U 1 + i ∗ ↘ Univ 1 + i , i ↘ Univ 1 + i , i El = Ty i ⊢ Ty i [ σ ] ≈ Ty i : Ty 1 + i ⊢ Ty i [ σ ] : Ty 1 + i R Univ 1 + i , i ↘ N ∈ U i ∗ ↘ Nat i ↘ Nat i = Nat ⊢ Nat [ σ ] ≈ Nat : Ty i ⊢ Nat [ σ ] : Ty i R N ∈ Univ 1 + i , i El (by ev-U) (by G-Univ) (syntactic; closed) (by reflexivity) (by Theorem 7.11) (by ev-N) (by G-Nat) (syntactic; closed) (by reflexivity) (by Theorem 7.12 on N ∈ U i ∗ )
Lemma 7.39 (Semantic — Π \Pi Π -Wf). If Γ ⊩ S 1 : T y i \Gamma\Vdash S_{1} : \mathrm{Ty}_{i} Γ ⊩ S 1 : Ty i and Γ , x : S 1 ⊩ S 2 : T y i \Gamma, x : S_{1} \Vdash S_{2} : \mathrm{Ty}_{i} Γ , x : S 1 ⊩ S 2 : Ty i , then Γ ⊩ Π ( x : S 1 ) . S 2 : T y i \Gamma\Vdash\Pi(x : S_{1}). S_{2} : \mathrm{Ty}_{i} Γ ⊩ Π ( x : S 1 ) . S 2 : Ty i .
Proof. Fix Γ ↘ S b \Gamma\searrow\mathrm{Sb} Γ ↘ Sb from Γ ⊩ S 1 : T y i \Gamma\Vdash S_{1} : \mathrm{Ty}_{i} Γ ⊩ S 1 : Ty i and Γ , x : S 1 ↘ S b ′ \Gamma, x : S_{1} \searrow\mathrm{Sb}' Γ , x : S 1 ↘ Sb ′ from Γ , x : S 1 ⊩ S 2 : T y i \Gamma, x : S_{1} \Vdash S_{2} : \mathrm{Ty}_{i} Γ , x : S 1 ⊩ S 2 : Ty i . By inversion on G-Ctx-Ext for the latter, S b ′ ⇔ C o n s i ( Γ , S 1 , S b ) \mathrm{Sb}' \Leftrightarrow\mathrm{Cons}_{i}(\Gamma, S_{1}, \mathrm{Sb}) Sb ′ ⇔ Cons i ( Γ , S 1 , Sb ) (using S b \mathrm{Sb} Sb uniqueness up to biimplication via Theorem 7.24).
Let Δ ⊢ σ : Γ R ρ ∈ S b \Delta\vdash\sigma: \Gamma\mathbin{\mathsf{R}} \rho\in\mathrm{Sb} Δ ⊢ σ : Γ R ρ ∈ Sb be given. By hypothesis on S 1 S_{1} S 1 at σ , ρ \sigma, \rho σ , ρ :
⟦ S 1 ⟧ ( ρ ) ↘ a I , a I ∈ U i ∗ ↘ P I ↘ E l I (by hypothesis on S 1 ) Δ ⊢ S 1 [ σ ] : T y i R P I (by hypothesis on S 1 , type part at level 1 + i ) a I ≈ a I ∈ U i ↘ R I (by Theorem 7.21) ⟦ Π ( x : S 1 ) . S 2 ⟧ ( ρ ) ↘ Π ( a I , S 2 , ρ ) (by ev-Pi) \begin{aligned}
\llbracket S_{1}\rrbracket(\rho) &\searrow a_{I},\quad a_{I} \in\mathcal{U}^{*}_{i} \searrow P_{I} \searrow\mathrm{El}_{I} && \text{(by hypothesis on }S_{1}\text{)} \\
\Delta&\vdash S_{1}[\sigma] : \mathrm{Ty}_{i} \mathbin{\mathsf{R}} P_{I} && \text{(by hypothesis on }S_{1}\text{, type part at level }1+i\text{)} \\
a_{I} &\approx a_{I} \in\mathcal{U}_{i} \searrow R_{I} && \text{(by Theorem 7.21)} \\
\llbracket\Pi(x : S_{1}). S_{2}\rrbracket(\rho) &\searrow\Pi(a_{I}, S_{2}, \rho) && \text{(by ev-Pi)}
\end{aligned} [ [ S 1 ] ] ( ρ ) Δ a I [ [ Π ( x : S 1 ) . S 2 ] ] ( ρ ) ↘ a I , a I ∈ U i ∗ ↘ P I ↘ El I ⊢ S 1 [ σ ] : Ty i R P I ≈ a I ∈ U i ↘ R I ↘ Π ( a I , S 2 , ρ ) (by hypothesis on S 1 ) (by hypothesis on S 1 , type part at level 1 + i ) (by Theorem 7.21) (by ev-Pi)
By syntactic substitution:
( Π ( x : S 1 ) . S 2 ) [ σ ] = Π ( x : S 1 [ σ ] ) . ( S 2 [ q ( σ ) ] ) (\Pi(x : S_{1}). S_{2})[\sigma] = \Pi(x : S_{1}[\sigma]).(S_{2}[q(\sigma)]) ( Π ( x : S 1 ) . S 2 ) [ σ ] = Π ( x : S 1 [ σ ]) . ( S 2 [ q ( σ )])
We construct Π ( a I , S 2 , ρ ) ∈ U i ∗ \Pi(a_{I}, S_{2}, \rho) \in\mathcal{U}^{*}_{i} Π ( a I , S 2 , ρ ) ∈ U i ∗ by G-Pi, deriving each premise. We first establish the PER-side membership of the Π \Pi Π , which introduces the codomain PER family R O R_{O} R O used below. PER-side: Π ( a I , S 2 , ρ ) ≈ Π ( a I , S 2 , ρ ) ∈ U i ↘ R \Pi(a_I,S_2,\rho) \approx\Pi(a_I,S_2,\rho) \in\mathcal{U}_i \searrow R Π ( a I , S 2 , ρ ) ≈ Π ( a I , S 2 , ρ ) ∈ U i ↘ R .
Γ ⊢ S 1 : T y i (by Theorem 7.22 on hypothesis S 1 ) Γ , x : S 1 ⊢ S 2 : T y i (by Theorem 7.22 on hypothesis S 2 ) Γ ⊢ Π ( x : S 1 ) . S 2 : T y i (by Π -Wf) Γ ⊢ Π ( x : S 1 ) . S 2 ≈ Π ( x : S 1 ) . S 2 : T y i (by Theorem 6.73 of Sec. 6) Π ( a I , S 2 , ρ ) ≈ Π ( a I , S 2 , ρ ) ∈ U i ↘ R (by instantiating at σ , ρ self-related in R Γ ) \begin{aligned}
\Gamma&\vdash S_1 : \mathrm{Ty}_i && \text{(by Theorem 7.22 on hypothesis }S_1\text{)}\\
\Gamma,x:S_1 &\vdash S_2 : \mathrm{Ty}_i && \text{(by Theorem 7.22 on hypothesis }S_2\text{)}\\
\Gamma&\vdash\Pi(x:S_1).S_2 : \mathrm{Ty}_i && \text{(by }\Pi\text{-Wf)}\\
\Gamma&\vdash\Pi(x:S_1).S_2 \approx\Pi(x:S_1).S_2 : \mathrm{Ty}_i && \text{(by Theorem 6.73 of Sec. 6)}\\
\Pi(a_I,S_2,\rho) &\approx\Pi(a_I,S_2,\rho) \in\mathcal{U}_i \searrow R && \text{(by instantiating at }\sigma,\rho\text{ self-related in }R_\Gamma\text{)}
\end{aligned} Γ Γ , x : S 1 Γ Γ Π ( a I , S 2 , ρ ) ⊢ S 1 : Ty i ⊢ S 2 : Ty i ⊢ Π ( x : S 1 ) . S 2 : Ty i ⊢ Π ( x : S 1 ) . S 2 ≈ Π ( x : S 1 ) . S 2 : Ty i ≈ Π ( a I , S 2 , ρ ) ∈ U i ↘ R (by Theorem 7.22 on hypothesis S 1 ) (by Theorem 7.22 on hypothesis S 2 ) (by Π -Wf) (by Theorem 6.73 of Sec. 6) (by instantiating at σ , ρ self-related in R Γ )
Inverting the resulting U-Pi witness yields the codomain PER family: for every D : : b ≈ b ∈ R I \mathcal{D} :: b \approx b \in R_I D :: b ≈ b ∈ R I , ⟦ S 2 ⟧ ( ( ρ , b / x ) ) ≈ ⟦ S 2 ⟧ ( ( ρ , b / x ) ) ∈ U i ↘ R O ( D ) \llbracket S_2\rrbracket((\rho,b/x)) \approx\llbracket S_2\rrbracket((\rho,b/x)) \in\mathcal{U}_i \searrow R_O(\mathcal{D}) [ [ S 2 ] ] (( ρ , b / x )) ≈ [ [ S 2 ] ] (( ρ , b / x )) ∈ U i ↘ R O ( D ) .
Codomain gluing. Let D : : b ≈ b ∈ R I \mathcal{D} :: b \approx b \in R_I D :: b ≈ b ∈ R I and c c c with ⟦ S 2 ⟧ ( ( ρ , b / x ) ) ↘ c \llbracket S_2\rrbracket((\rho,b/x)) \searrow c [ [ S 2 ] ] (( ρ , b / x )) ↘ c be given.
c ≈ c ∈ U i ↘ R O ( D ) (by the codomain PER family established above) c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) (by Theorem 7.28) \begin{aligned}
c &\approx c \in\mathcal{U}_i \searrow R_O(\mathcal{D}) && \text{(by the codomain PER family established above)}\\
c &\in\mathcal{U}_i^* \searrow P_O(\mathcal{D}) \searrow\mathrm{El}_O(\mathcal{D}) && \text{(by Theorem 7.28)}
\end{aligned} c c ≈ c ∈ U i ↘ R O ( D ) ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) (by the codomain PER family established above) (by Theorem 7.28)
This defines P O ( D ) , E l O ( D ) P_O(\mathcal{D}),\mathrm{El}_O(\mathcal{D}) P O ( D ) , El O ( D ) ; functionality in D \mathcal{D} D follows from Theorem 7.24, since glu-univ-elem predicates at a fixed domain value are unique up to logical equivalence.
Combining all premises:
Π ( a I , S 2 , ρ ) ∈ U i ∗ ↘ Π i ( R I , P I , E l I , P O ) ↘ Π i E l ( R , R I , P I , E l I , E l O ) (by G-Pi) \Pi(a_I,S_2,\rho) \in\mathcal{U}_i^* \searrow\Pi_i(R_I,P_I,\mathrm{El}_I,P_O) \searrow\Pi_i^{\mathrm{El}}(R,R_I,P_I,\mathrm{El}_I,\mathrm{El}_O)
\qquad\text{(by G-Pi)} Π ( a I , S 2 , ρ ) ∈ U i ∗ ↘ Π i ( R I , P I , El I , P O ) ↘ Π i El ( R , R I , P I , El I , El O ) (by G-Pi)
Type-predicate Π i \Pi_i Π i at ( Π ( x : S 1 ) . S 2 ) [ σ ] (\Pi(x:S_1).S_2)[\sigma] ( Π ( x : S 1 ) . S 2 ) [ σ ] . We verify the three clauses of Theorem 7.9.
Clause 1.
( Π ( x : S 1 ) . S 2 ) [ σ ] = Π ( x : S 1 [ σ ] ) . ( S 2 [ q ( σ ) ] ) (\Pi(x:S_1).S_2)[\sigma] = \Pi(x:S_1[\sigma]).(S_2[q(\sigma)]) ( Π ( x : S 1 ) . S 2 ) [ σ ] = Π ( x : S 1 [ σ ]) . ( S 2 [ q ( σ )])
(syntactic substitution on Π \Pi Π )
Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] ≈ Π ( x : S 1 [ σ ] ) . ( S 2 [ q ( σ ) ] ) : T y i \Delta\vdash(\Pi(x:S_1).S_2)[\sigma] \approx\Pi(x:S_1[\sigma]).(S_2[q(\sigma)]) : \mathrm{Ty}_i Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] ≈ Π ( x : S 1 [ σ ]) . ( S 2 [ q ( σ )]) : Ty i
(by reflexivity)
Clause 2 (domain Kripke). For each Δ ′ ′ ⊢ k ϕ ′ : Δ \Delta'' \vdash_k \phi' : \Delta Δ ′′ ⊢ k ϕ ′ : Δ :
Δ ′ ′ ⊢ σ [ ϕ ′ ] : Γ ® ρ ∈ S b (by Theorem 7.20) Δ ′ ′ ⊢ S 1 [ σ [ ϕ ′ ] ] : T y i ® P I (by hypothesis on S 1 , type part at σ [ ϕ ′ ] , ρ ) S 1 [ σ ] [ ϕ ′ ] = S 1 [ σ [ ϕ ′ ] ] (by Theorem 2.22) Δ ′ ′ ⊢ S 1 [ σ ] [ ϕ ′ ] : T y i ® P I (rewriting) \begin{aligned}
\Delta'' &\vdash\sigma[\phi'] : \Gamma\mathrel{\circledR} \rho\in\mathrm{Sb} && \text{(by Theorem 7.20)}\\
\Delta'' &\vdash S_1[\sigma[\phi']] : \mathrm{Ty}_i \mathrel{\circledR} P_I && \text{(by hypothesis on }S_1\text{, type part at }\sigma[\phi'],\rho\text{)}\\
S_1[\sigma][\phi'] &= S_1[\sigma[\phi']] && \text{(by Theorem 2.22)}\\
\Delta'' &\vdash S_1[\sigma][\phi'] : \mathrm{Ty}_i \mathrel{\circledR} P_I && \text{(rewriting)}
\end{aligned} Δ ′′ Δ ′′ S 1 [ σ ] [ ϕ ′ ] Δ ′′ ⊢ σ [ ϕ ′ ] : Γ ® ρ ∈ Sb ⊢ S 1 [ σ [ ϕ ′ ]] : Ty i ® P I = S 1 [ σ [ ϕ ′ ]] ⊢ S 1 [ σ ] [ ϕ ′ ] : Ty i ® P I (by Theorem 7.20) (by hypothesis on S 1 , type part at σ [ ϕ ′ ] , ρ ) (by Theorem 2.22) (rewriting)
Clause 3 (codomain Kripke). For each Δ ′ ′ ⊢ k ϕ ′ : Δ , s , b ′ , D : : b ′ ≈ b ′ ∈ R I \Delta'' \vdash_k \phi' : \Delta,s,b',\mathcal{D} :: b' \approx b' \in R_I Δ ′′ ⊢ k ϕ ′ : Δ , s , b ′ , D :: b ′ ≈ b ′ ∈ R I with Δ ′ ′ ⊢ s ′ : S 1 [ σ ] [ ϕ ′ ] ® b ′ ∈ E l I \Delta'' \vdash s' : S_1[\sigma][\phi'] \mathrel{\circledR} b' \in\mathrm{El}_I Δ ′′ ⊢ s ′ : S 1 [ σ ] [ ϕ ′ ] ® b ′ ∈ El I , set σ ′ : = ( σ [ ϕ ′ ] , s ′ / x ) \sigma' := (\sigma[\phi'],s'/x) σ ′ := ( σ [ ϕ ′ ] , s ′ / x ) . We first transport the substitution into S b ′ \mathrm{Sb}' Sb ′ , then unpack Γ , x : S 1 ⊢ S 2 : T y i \Gamma,x:S_1 \vdash S_2:\mathrm{Ty}_i Γ , x : S 1 ⊢ S 2 : Ty i at the resulting pair.
Δ ′ ′ ⊢ σ [ ϕ ′ ] : Γ ® ρ ∈ S b (by Theorem 7.20 on the substitution-environment pair) Δ ′ ′ ⊢ σ ′ : Γ , x : S 1 ® ( ρ , b ′ / x ) ∈ S b ′ (by G-Ctx-Ext’s Cons i , head: b ′ ∈ E l I ) \begin{aligned}
\Delta'' &\vdash\sigma[\phi'] : \Gamma\mathrel{\circledR} \rho\in\mathrm{Sb} && \text{(by Theorem 7.20 on the substitution-environment pair)}\\
\Delta'' &\vdash\sigma' : \Gamma,x:S_1 \mathrel{\circledR}(\rho,b'/x) \in\mathrm{Sb}' && \text{(by G-Ctx-Ext's Cons}_i\text{, head: }b'\in\mathrm{El}_I\text{)}
\end{aligned} Δ ′′ Δ ′′ ⊢ σ [ ϕ ′ ] : Γ ® ρ ∈ Sb ⊢ σ ′ : Γ , x : S 1 ® ( ρ , b ′ / x ) ∈ Sb ′ (by Theorem 7.20 on the substitution-environment pair) (by G-Ctx-Ext’s Cons i , head: b ′ ∈ El I )
Instantiating Γ , x : S 1 ⊢ S 2 : T y i \Gamma,x:S_1 \vdash S_2:\mathrm{Ty}_i Γ , x : S 1 ⊢ S 2 : Ty i at σ ′ , ( ρ , b ′ / x ) \sigma',(\rho,b'/x) σ ′ , ( ρ , b ′ / x ) yields the four clauses of Sec. 7.7’s semantic typing judgment at a = U i a=U_i a = U i , P = U n i v 1 + i , i P=\mathrm{Univ}_{1+i,i} P = Univ 1 + i , i , E l = U n i v E l 1 + i , i \mathrm{El}=\mathrm{UnivEl}_{1+i,i} El = UnivEl 1 + i , i . The fourth clause states Δ ′ ′ ⊢ S 2 [ σ ′ ] : T y i [ σ ′ ] ® ⟦ S 2 ⟧ ( ( ρ , b ′ / x ) ) ∈ U n i v E l 1 + i , i \Delta'' \vdash S_2[\sigma']:\mathrm{Ty}_i[\sigma'] \mathrel{\circledR} \llbracket S_2\rrbracket((\rho,b'/x)) \in\mathrm{UnivEl}_{1+i,i} Δ ′′ ⊢ S 2 [ σ ′ ] : Ty i [ σ ′ ] ® [ [ S 2 ] ] (( ρ , b ′ / x )) ∈ UnivEl 1 + i , i .
Unpacking Theorem 7.12:
⟦ S 2 ⟧ ( ( ρ , b ′ / x ) ) ↘ c b ′ (evaluation; deterministic) c b ′ ∈ U i ∗ ↘ P b ′ ↘ E l b ′ (by Theorem 7.12 clause (3)) Δ ′ ′ ⊢ S 2 [ σ ′ ] : T y i ® P b ′ (by Theorem 7.12 clause (3), Russell type-side gluing) \begin{aligned}
\llbracket S_2\rrbracket((\rho,b'/x)) &\searrow c_{b'} && \text{(evaluation; deterministic)}\\
c_{b'} &\in\mathcal{U}_i^* \searrow P_{b'} \searrow\mathrm{El}_{b'} && \text{(by Theorem 7.12 clause (3))}\\
\Delta'' &\vdash S_2[\sigma']:\mathrm{Ty}_i \mathrel{\circledR} P_{b'} && \text{(by Theorem 7.12 clause (3), Russell type-side gluing)}
\end{aligned} [ [ S 2 ] ] (( ρ , b ′ / x )) c b ′ Δ ′′ ↘ c b ′ ∈ U i ∗ ↘ P b ′ ↘ El b ′ ⊢ S 2 [ σ ′ ] : Ty i ® P b ′ (evaluation; deterministic) (by Theorem 7.12 clause (3)) (by Theorem 7.12 clause (3), Russell type-side gluing)
By Theorem 7.24 (the gluing-model membership c b ′ ∈ U i ∗ c_{b'} \in\mathcal{U}_i^* c b ′ ∈ U i ∗ uniquely determines its predicates up to extensional equivalence), P b ′ ⇔ P O ( D ) P_{b'} \Leftrightarrow P_O(D) P b ′ ⇔ P O ( D ) and E l b ′ ⇔ E l O ( D ) \mathrm{El}_{b'} \Leftrightarrow\mathrm{El}_O(D) El b ′ ⇔ El O ( D ) , where P O , E l O P_O,\mathrm{El}_O P O , El O are the codomain predicates established in the Codomain-gluing block. Rewriting:
c b ′ ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) (by Theorem 7.24) c_{b'} \in\mathcal{U}_i^* \searrow P_O(D) \searrow\mathrm{El}_O(D) \qquad\text{(by Theorem 7.24)} c b ′ ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) (by Theorem 7.24)
S 2 [ σ ∗ ] = S 2 [ ( σ [ ϕ ′ ] , s ′ / x ) ] = S 2 [ q ( σ ) ] [ ϕ ′ , s ′ / x ] (by Theorem 2.28) S_2[\sigma^*] = S_2[(\sigma[\phi'],s'/x)] = S_2[q(\sigma)][\phi',s'/x] \qquad\text{(by Theorem 2.28)} S 2 [ σ ∗ ] = S 2 [( σ [ ϕ ′ ] , s ′ / x )] = S 2 [ q ( σ )] [ ϕ ′ , s ′ / x ] (by Theorem 2.28)
Δ ′ ⊢ S 2 [ q ( σ ) ] [ ϕ ′ , s ′ / x ] : T y i ⊗ P O ( D ) (rewriting the previous type-gluing line) \Delta' \vdash S_2[q(\sigma)][\phi',s'/x] : \mathrm{Ty}_i \mathrel{\mathop{\otimes}} P_O(D) \qquad\text{(rewriting the previous type-gluing line)} Δ ′ ⊢ S 2 [ q ( σ )] [ ϕ ′ , s ′ / x ] : Ty i ⊗ P O ( D ) (rewriting the previous type-gluing line)
Combining the three clauses of Π i \Pi_i Π i :
Δ ⊢ Π ( x : S 1 [ σ ] ) . ( S 2 [ q ( σ ) ] ) : T y i ⊗ Π i ( R I , P I , E l I , P O ) (by Theorem 7.9 clauses 1–3) \Delta\vdash\Pi(x:S_1[\sigma]).(S_2[q(\sigma)]) : \mathrm{Ty}_i \mathrel{\mathop{\otimes}} \Pi_i(R_I,P_I,\mathrm{El}_I,P_O) \qquad\text{(by Theorem 7.9 clauses 1--3)} Δ ⊢ Π ( x : S 1 [ σ ]) . ( S 2 [ q ( σ )]) : Ty i ⊗ Π i ( R I , P I , El I , P O ) (by Theorem 7.9 clauses 1–3)
Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] : T y i ⊗ Π i ( R I , P I , E l I , P O ) (by clause 1’s equality on the LHS) \Delta\vdash(\Pi(x:S_1).S_2)[\sigma] : \mathrm{Ty}_i \mathrel{\mathop{\otimes}} \Pi_i(R_I,P_I,\mathrm{El}_I,P_O) \qquad\text{(by clause 1's equality on the LHS)} Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] : Ty i ⊗ Π i ( R I , P I , El I , P O ) (by clause 1’s equality on the LHS)
For the term predicate at T y 1 + i \mathrm{Ty}_{1+i} Ty 1 + i , Π ( a I , S 2 , ρ ) ∈ U i ∗ \Pi(a_I,S_2,\rho) \in\mathcal{U}_i^* Π ( a I , S 2 , ρ ) ∈ U i ∗ by the previous derivation, the four clauses of Γ ⊢ Π ( x : S 1 ) . S 2 : T y i \Gamma\vdash\Pi(x:S_1).S_2 : \mathrm{Ty}_i Γ ⊢ Π ( x : S 1 ) . S 2 : Ty i at a = U i a=U_i a = U i , P = U n i v 1 + i , i P=\mathrm{Univ}_{1+i,i} P = Univ 1 + i , i , E l = U n i v E l 1 + i , i \mathrm{El}=\mathrm{UnivEl}^{1+i,i} El = UnivEl 1 + i , i :
⟦ T y i ⟧ ( ρ ) ↘ U i (by ev-U) [clause 1] \llbracket\mathrm{Ty}_i\rrbracket(\rho) \searrow U_i \qquad\text{(by ev-U)} \qquad\text{[clause 1]} [ [ Ty i ] ] ( ρ ) ↘ U i (by ev-U) [clause 1]
U i ∈ U 1 + i ∗ ↘ U n i v 1 + i , i ↘ U n i v E l 1 + i , i (by G-Univ) [clause 2] U_i \in\mathcal{U}_{1+i}^* \searrow\mathrm{Univ}_{1+i,i} \searrow\mathrm{UnivEl}^{1+i,i} \qquad\text{(by G-Univ)} \qquad\text{[clause 2]} U i ∈ U 1 + i ∗ ↘ Univ 1 + i , i ↘ UnivEl 1 + i , i (by G-Univ) [clause 2]
Δ ⊢ T y i [ σ ] : T y 1 + i ⊗ U n i v 1 + i , i (by Theorem 7.11 with T y i [ σ ] = T y i ) [clause 3] \Delta\vdash\mathrm{Ty}_i[\sigma] : \mathrm{Ty}_{1+i} \mathrel{\mathop{\otimes}} \mathrm{Univ}_{1+i,i} \qquad\text{(by Theorem 7.11 with }\mathrm{Ty}_i[\sigma]=\mathrm{Ty}_i\text{)} \qquad\text{[clause 3]} Δ ⊢ Ty i [ σ ] : Ty 1 + i ⊗ Univ 1 + i , i (by Theorem 7.11 with Ty i [ σ ] = Ty i ) [clause 3]
Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] : T y i ⊗ Π ( a I , S 2 , ρ ) ∈ U n i v 1 + i , i (by Theorem 7.12 on the Π -gluing above) [clause 4] \Delta\vdash(\Pi(x:S_1).S_2)[\sigma] : \mathrm{Ty}_i \mathrel{\mathop{\otimes}} \Pi(a_I,S_2,\rho) \in\mathrm{Univ}^{1+i,i} \qquad\text{(by Theorem 7.12 on the }\Pi\text{-gluing above)} \qquad\text{[clause 4]} Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] : Ty i ⊗ Π ( a I , S 2 , ρ ) ∈ Univ 1 + i , i (by Theorem 7.12 on the Π -gluing above) [clause 4]
□
Lemma 7.40 (Semantic — Ze-I). If ⊢ Γ \vdash\Gamma ⊢ Γ , then Γ ⊢ z e r o : N a t \Gamma\vdash\mathit{zero} : \mathit{Nat} Γ ⊢ zero : Nat .
Proof. By ⊢ Γ \vdash\Gamma ⊢ Γ , fix Γ ↘ S b \Gamma\searrow\mathrm{Sb} Γ ↘ Sb and let Δ ⊢ σ : Γ ⊗ ρ ∈ S b \Delta\vdash\sigma: \Gamma\mathrel{\mathop{\otimes}} \rho\in\mathrm{Sb} Δ ⊢ σ : Γ ⊗ ρ ∈ Sb be given. We establish the four clauses of Γ ⊢ z e r o : N a t \Gamma\vdash\mathit{zero} : \mathit{Nat} Γ ⊢ zero : Nat at a = N a=N a = N , P = N a t i P=\mathrm{Nat}_i P = Nat i , E l = N a t i \mathrm{El}=\mathrm{Nat}_i El = Nat i .
⟦ N a t ⟧ ( ρ ) ↘ N (by ev-N) [clause 1] \llbracket\mathrm{Nat}\rrbracket(\rho) \searrow N \qquad\text{(by ev-N)} \qquad\text{[clause 1]} [ [ Nat ] ] ( ρ ) ↘ N (by ev-N) [clause 1] N ∈ U i ∗ ↘ N a t i ↘ N a t i (by G-Nat) [clause 2] N \in\mathcal{U}_i^* \searrow\mathrm{Nat}_i \searrow\mathrm{Nat}_i \qquad\text{(by G-Nat)} \qquad\text{[clause 2]} N ∈ U i ∗ ↘ Nat i ↘ Nat i (by G-Nat) [clause 2] N a t [ σ ] = N a t (syntactic; closed) \mathrm{Nat}[\sigma] = \mathrm{Nat} \qquad\text{(syntactic; closed)} Nat [ σ ] = Nat (syntactic; closed) Δ ⊢ N a t [ σ ] ≈ N a t : T y i (by reflexivity) \Delta\vdash\mathrm{Nat}[\sigma] \approx\mathrm{Nat} : \mathrm{Ty}_i \qquad\text{(by reflexivity)} Δ ⊢ Nat [ σ ] ≈ Nat : Ty i (by reflexivity) Δ ⊢ N a t [ σ ] : T y i ⊗ N a t i (by Theorem 7.7) [clause 3] \Delta\vdash\mathrm{Nat}[\sigma] : \mathrm{Ty}_i \mathrel{\mathop{\otimes}} \mathrm{Nat}_i \qquad\text{(by Theorem 7.7)} \qquad\text{[clause 3]} Δ ⊢ Nat [ σ ] : Ty i ⊗ Nat i (by Theorem 7.7) [clause 3] ⟦ z e r o ⟧ ( ρ ) ↘ z e (by ev-Ze) \llbracket\mathit{zero}\rrbracket(\rho) \searrow\mathit{ze} \qquad\text{(by ev-Ze)} [ [ zero ] ] ( ρ ) ↘ ze (by ev-Ze) z e r o [ σ ] = z e r o (syntactic; closed) \mathit{zero}[\sigma] = \mathit{zero} \qquad\text{(syntactic; closed)} zero [ σ ] = zero (syntactic; closed) Δ ⊢ z e r o [ σ ] ≈ z e r o : N a t [ σ ] (by reflexivity) \Delta\vdash\mathit{zero}[\sigma] \approx\mathit{zero} : \mathrm{Nat}[\sigma] \qquad\text{(by reflexivity)} Δ ⊢ zero [ σ ] ≈ zero : Nat [ σ ] (by reflexivity) Δ ⊢ z e r o [ σ ] : N a t [ σ ] ⊗ z e ∈ N a t i (by GN-Ze combined with the type predicate above, Theorem 7.8) [clause 4] \Delta\vdash\mathit{zero}[\sigma] : \mathrm{Nat}[\sigma] \mathrel{\mathop{\otimes}} \mathit{ze} \in\mathrm{Nat}_i \qquad\text{(by GN-Ze combined with the type predicate above, Theorem 7.8)} \qquad\text{[clause 4]} Δ ⊢ zero [ σ ] : Nat [ σ ] ⊗ ze ∈ Nat i (by GN-Ze combined with the type predicate above, Theorem 7.8) [clause 4] □
Lemma 7.41 (Semantic — Su-I). If Γ ⊢ t : N a t \Gamma\vdash t : \mathit{Nat} Γ ⊢ t : Nat , then Γ ⊢ s u c c t : N a t \Gamma\vdash\mathit{succ}\ t : \mathit{Nat} Γ ⊢ succ t : Nat .
Proof. ⊢ Γ \vdash\Gamma ⊢ Γ is presupposed by the hypothesis Γ ⊢ t : N a t \Gamma\vdash t : \mathit{Nat} Γ ⊢ t : Nat . Fix Γ ↘ S b \Gamma\searrow\mathrm{Sb} Γ ↘ Sb and let Δ ⊢ σ : Γ ⊗ ρ ∈ S b \Delta\vdash\sigma: \Gamma\mathrel{\mathop{\otimes}} \rho\in\mathrm{Sb} Δ ⊢ σ : Γ ⊗ ρ ∈ Sb be given. We establish the four clauses of Γ ⊢ s u c c t : N a t \Gamma\vdash\mathit{succ}\ t : \mathit{Nat} Γ ⊢ succ t : Nat at a = N a=N a = N , P = N a t i P=\mathrm{Nat}_i P = Nat i , E l = N a t i \mathrm{El}=\mathrm{Nat}_i El = Nat i .
⟦ N a t ⟧ ( ρ ) ↘ N (by ev-N) [clause 1] \llbracket\mathrm{Nat}\rrbracket(\rho) \searrow N \qquad\text{(by ev-N)} \qquad\text{[clause 1]} [ [ Nat ] ] ( ρ ) ↘ N (by ev-N) [clause 1] N ∈ U i ∗ ↘ N a t i ↘ N a t i (by G-Nat) [clause 2] N \in\mathcal{U}_i^* \searrow\mathrm{Nat}_i \searrow\mathrm{Nat}_i \qquad\text{(by G-Nat)} \qquad\text{[clause 2]} N ∈ U i ∗ ↘ Nat i ↘ Nat i (by G-Nat) [clause 2]
Δ ⊢ Nat [ σ ] : Ty i R Nat i (by Theorem 7.7 with Nat [ σ ] = Nat ) \Delta\vdash\operatorname{Nat}[\sigma] : \operatorname{Ty}_{i} \mathrel{\mathsf{R}} \operatorname{Nat}_{i}\qquad\text{(by Theorem 7.7 with }\operatorname{Nat}[\sigma] = \operatorname{Nat}\text{)} Δ ⊢ Nat [ σ ] : Ty i R Nat i (by Theorem 7.7 with Nat [ σ ] = Nat )
⟦ t ⟧ ( ρ ) ↘ b (by hypothesis on t ) \llbracket t \rrbracket(\rho) \searrow b\qquad\text{(by hypothesis on }t\text{)} [ [ t ] ] ( ρ ) ↘ b (by hypothesis on t )
Δ ⊢ t [ σ ] : Nat [ σ ] R b ∈ Nat i (by hypothesis on t , term part) \Delta\vdash t[\sigma] : \operatorname{Nat}[\sigma] \mathrel{\mathsf{R}} b \in\operatorname{Nat}_{i}\qquad\text{(by hypothesis on }t\text{, term part)} Δ ⊢ t [ σ ] : Nat [ σ ] R b ∈ Nat i (by hypothesis on t , term part)
⟦ succ t ⟧ ( ρ ) ↘ su ( b ) (by ev-SU) \llbracket\operatorname{succ}\ t \rrbracket(\rho) \searrow\operatorname{su}(b)
\qquad\text{(by ev-SU)} [ [ succ t ] ] ( ρ ) ↘ su ( b ) (by ev-SU)
( succ t ) [ σ ] = succ t [ σ ] (syntactic substitution on succ ) (\operatorname{succ}\ t)[\sigma] = \operatorname{succ}\ t[\sigma]\qquad\text{(syntactic substitution on }\operatorname{succ}\text{)} ( succ t ) [ σ ] = succ t [ σ ] (syntactic substitution on succ )
Δ ⊢ ( succ t ) [ σ ] : Nat [ σ ] R su ( b ) ∈ Nat i (by GN-Su combined with the type predicate above, Theorem 7.8) \Delta\vdash(\operatorname{succ}\ t)[\sigma] : \operatorname{Nat}[\sigma] \mathrel{\mathsf{R}} \operatorname{su}(b) \in\operatorname{Nat}_{i}
\qquad\text{(by GN-Su combined with the type predicate above, Theorem 7.8)} Δ ⊢ ( succ t ) [ σ ] : Nat [ σ ] R su ( b ) ∈ Nat i (by GN-Su combined with the type predicate above, Theorem 7.8)
Lemma 7.42 (Semantic — λ \lambda λ -I). If Γ ⊢ S 1 : Ty i \Gamma\vdash S_{1} : \operatorname{Ty}_{i} Γ ⊢ S 1 : Ty i , Γ , x : S 1 ⊢ S 2 : Ty i \Gamma, x : S_{1} \vdash S_{2} : \operatorname{Ty}_{i} Γ , x : S 1 ⊢ S 2 : Ty i , and Γ , x : S 1 ⊢ t : S 2 \Gamma, x : S_{1} \vdash t : S_{2} Γ , x : S 1 ⊢ t : S 2 , then Γ ⊢ λ x . t : Π ( x : S 1 ) . S 2 \Gamma\vdash\lambda x.\,t : \Pi(x : S_{1}).\,S_{2} Γ ⊢ λ x . t : Π ( x : S 1 ) . S 2 .
Proof. ⊩ Γ \Vdash\Gamma ⊩ Γ is presupposed; fix Γ ↘ Sb Γ \Gamma\searrow\operatorname{Sb}_{\Gamma} Γ ↘ Sb Γ and Γ , x : S 1 ↘ Sb Γ , x : S 1 \Gamma, x : S_{1} \searrow\operatorname{Sb}_{\Gamma,x:S_{1}} Γ , x : S 1 ↘ Sb Γ , x : S 1 where, by inversion on G-Ctx-Ext, Sb Γ , x : S 1 ⇔ Cons i ( Γ , S 1 , Sb Γ ) \operatorname{Sb}_{\Gamma,x:S_{1}} \Leftrightarrow\operatorname{Cons}_{i}(\Gamma, S_{1}, \operatorname{Sb}_{\Gamma}) Sb Γ , x : S 1 ⇔ Cons i ( Γ , S 1 , Sb Γ ) . By Theorem 7.22 on the hypotheses:
Γ ⊢ S 1 : Ty i (by Theorem 7.22 on the S 1 hypothesis) Γ , x : S 1 ⊢ S 2 : Ty i (by Theorem 7.22 on the S 2 hypothesis) Γ , x : S 1 ⊢ t : S 2 (by Theorem 7.23 on the t hypothesis) Γ ⊢ λ x . t : Π ( x : S 1 ) . S 2 (by λ -I) \begin{aligned}
\Gamma&\vdash S_{1} : \operatorname{Ty}_{i} &&\text{(by Theorem 7.22 on the }S_{1}\text{ hypothesis)}\\
\Gamma, x : S_{1} &\vdash S_{2} : \operatorname{Ty}_{i} &&\text{(by Theorem 7.22 on the }S_{2}\text{ hypothesis)}\\
\Gamma, x : S_{1} &\vdash t : S_{2} &&\text{(by Theorem 7.23 on the }t\text{ hypothesis)}\\
\Gamma&\vdash\lambda x.\,t : \Pi(x : S_{1}).\,S_{2} &&\text{(by }\lambda\text{-I)}
\end{aligned} Γ Γ , x : S 1 Γ , x : S 1 Γ ⊢ S 1 : Ty i ⊢ S 2 : Ty i ⊢ t : S 2 ⊢ λ x . t : Π ( x : S 1 ) . S 2 (by Theorem 7.22 on the S 1 hypothesis) (by Theorem 7.22 on the S 2 hypothesis) (by Theorem 7.23 on the t hypothesis) (by λ -I)
By Theorem 7.39 on the S 1 , S 2 S_{1}, S_{2} S 1 , S 2 hypotheses, Γ ⊢ Π ( x : S 1 ) . S 2 : Ty i \Gamma\vdash\Pi(x : S_{1}).\,S_{2} : \operatorname{Ty}_{i} Γ ⊢ Π ( x : S 1 ) . S 2 : Ty i .
Let Δ ⊢ σ : Γ R ρ ∈ Sb Γ \Delta\vdash\sigma: \Gamma\mathrel{\mathsf{R}} \rho\in\operatorname{Sb}_{\Gamma} Δ ⊢ σ : Γ R ρ ∈ Sb Γ be given.
⟦ S 1 ⟧ ( ρ ) ↘ a I , a I ∈ U i ∗ ↘ P I ↘ El I (by hypothesis on S 1 , evaluation and gluing clauses) \llbracket S_{1} \rrbracket(\rho) \searrow a_{I},\quad a_{I} \in U_{i}^{*} \searrow P_{I} \searrow\operatorname{El}_{I}\qquad\text{(by hypothesis on }S_{1}\text{, evaluation and gluing clauses)} [ [ S 1 ] ] ( ρ ) ↘ a I , a I ∈ U i ∗ ↘ P I ↘ El I (by hypothesis on S 1 , evaluation and gluing clauses)
a I ≈ a I ∈ U i ↘ R I (by Theorem 7.21) a_{I} \approx a_{I} \in\mathcal{U}_{i} \searrow R_{I}
\qquad\text{(by Theorem 7.21)} a I ≈ a I ∈ U i ↘ R I (by Theorem 7.21)
Δ ⊢ S 1 [ σ ] : Ty i R P I (by hypothesis on S 1 , type clause) \Delta\vdash S_{1}[\sigma] : \operatorname{Ty}_{i} \mathrel{\mathsf{R}} P_{I}\qquad\text{(by hypothesis on }S_{1}\text{, type clause)} Δ ⊢ S 1 [ σ ] : Ty i R P I (by hypothesis on S 1 , type clause)
⟦ Π ( x : S 1 ) . S 2 ⟧ ( ρ ) ↘ Π ( a I , S 2 , ρ ) (by ev-Pi) \llbracket\Pi(x : S_{1}).\,S_{2} \rrbracket(\rho) \searrow\Pi(a_{I}, S_{2}, \rho)
\qquad\text{(by ev-Pi)} [ [ Π ( x : S 1 ) . S 2 ] ] ( ρ ) ↘ Π ( a I , S 2 , ρ ) (by ev-Pi)
⟦ λ x . t ⟧ ( ρ ) ↘ λ ( t , ρ ) (by ev-LAM) \llbracket\lambda x.\,t \rrbracket(\rho) \searrow\lambda(t,\rho)
\qquad\text{(by ev-LAM)} [ [ λ x . t ] ] ( ρ ) ↘ λ ( t , ρ ) (by ev-LAM)
Π ( a I , S 2 , ρ ) ∈ U i ∗ ↘ Π i ( R I , P I , El I , P O ) ↘ Π i El ( R , R I , P I , El I , El O ) (by Theorem 7.39, gluing clause) \Pi(a_{I}, S_{2}, \rho) \in U_{i}^{*}
\searrow\Pi_{i}(R_{I}, P_{I}, \operatorname{El}_{I}, P_{O})
\searrow\Pi_{i}^{\operatorname{El}}(R, R_{I}, P_{I}, \operatorname{El}_{I}, \operatorname{El}_{O})
\qquad\text{(by Theorem 7.39, gluing clause)} Π ( a I , S 2 , ρ ) ∈ U i ∗ ↘ Π i ( R I , P I , El I , P O ) ↘ Π i El ( R , R I , P I , El I , El O ) (by Theorem 7.39, gluing clause)
Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] : Ty i R Π i ( R I , P I , El I , P O ) (by Theorem 7.39, type clause) \Delta\vdash(\Pi(x : S_{1}).\,S_{2})[\sigma] : \operatorname{Ty}_{i} \mathrel{\mathsf{R}} \Pi_{i}(R_{I}, P_{I}, \operatorname{El}_{I}, P_{O})
\qquad\text{(by Theorem 7.39, type clause)} Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] : Ty i R Π i ( R I , P I , El I , P O ) (by Theorem 7.39, type clause)
We assemble the four clauses of Γ ⊩ λ x . t : Π ( x : S 1 ) . S 2 \Gamma\Vdash\lambda x.\,t : \Pi(x : S_{1}).\,S_{2} Γ ⊩ λ x . t : Π ( x : S 1 ) . S 2 at a : = Π ( a I , S 2 , ρ ) a := \Pi(a_{I}, S_{2}, \rho) a := Π ( a I , S 2 , ρ ) , P : = Π i ( R I , P I , El I , P O ) P := \Pi_{i}(R_{I}, P_{I}, \operatorname{El}_{I}, P_{O}) P := Π i ( R I , P I , El I , P O ) , El : = Π i El ( R , R I , P I , El I , El O ) \operatorname{El} := \Pi_{i}^{\operatorname{El}}(R, R_{I}, P_{I}, \operatorname{El}_{I}, \operatorname{El}_{O}) El := Π i El ( R , R I , P I , El I , El O ) :
⟦ Π ( x : S 1 ) . S 2 ⟧ ( ρ ) ↘ Π ( a I , S 2 , ρ ) [clause 1] \llbracket\Pi(x : S_{1}).\,S_{2} \rrbracket(\rho) \searrow\Pi(a_{I}, S_{2}, \rho)
\qquad\text{[clause 1]} [ [ Π ( x : S 1 ) . S 2 ] ] ( ρ ) ↘ Π ( a I , S 2 , ρ ) [clause 1]
Π ( a I , S 2 , ρ ) ∈ U i ∗ ↘ P ↘ El [clause 2] \Pi(a_{I}, S_{2}, \rho) \in U_{i}^{*} \searrow P \searrow\operatorname{El}
\qquad\text{[clause 2]} Π ( a I , S 2 , ρ ) ∈ U i ∗ ↘ P ↘ El [clause 2]
Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] : Ty i R P [clause 3] \Delta\vdash(\Pi(x : S_{1}).\,S_{2})[\sigma] : \operatorname{Ty}_{i} \mathrel{\mathsf{R}} P
\qquad\text{[clause 3]} Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] : Ty i R P [clause 3]
All three are restated from the per-substitution data block. For clause (4), we must show Δ ⊢ ( λ x . t ) [ σ ] : ( Π ( x : S 1 ) . S 2 ) [ σ ] R λ ( t , ρ ) ∈ El \Delta\vdash(\lambda x.\,t)[\sigma] : (\Pi(x : S_{1}).\,S_{2})[\sigma] \mathrel{\mathsf{R}} \lambda(t,\rho) \in\operatorname{El} Δ ⊢ ( λ x . t ) [ σ ] : ( Π ( x : S 1 ) . S 2 ) [ σ ] R λ ( t , ρ ) ∈ El . We verify the four sub-clauses of Theorem 7.10.
Sub-clause (1): Δ ⊢ ( λ x . t ) [ σ ] : ( Π ( x : S 1 ) . S 2 ) [ σ ] \Delta\vdash(\lambda x.\,t)[\sigma] : (\Pi(x : S_{1}).\,S_{2})[\sigma] Δ ⊢ ( λ x . t ) [ σ ] : ( Π ( x : S 1 ) . S 2 ) [ σ ] . By syntactic substitution applied to Γ ⊢ λ x . t : Π ( x : S 1 ) . S 2 \Gamma\vdash\lambda x.\,t : \Pi(x : S_{1}).\,S_{2} Γ ⊢ λ x . t : Π ( x : S 1 ) . S 2 along Δ ⊢ σ : Γ \Delta\vdash\sigma: \Gamma Δ ⊢ σ : Γ .
Sub-clause (2): λ ( t , ρ ) ≈ λ ( t , ρ ) ∈ R \lambda(t,\rho) \approx\lambda(t,\rho) \in R λ ( t , ρ ) ≈ λ ( t , ρ ) ∈ R . By Theorem 6.73 of Sec. 6 on Γ ⊢ λ x . t : Π ( x : S 1 ) . S 2 \Gamma\vdash\lambda x.\,t : \Pi(x : S_{1}).\,S_{2} Γ ⊢ λ x . t : Π ( x : S 1 ) . S 2 , instantiated at ρ ≈ ρ ∈ ⟦ Γ ⟧ \rho\approx\rho\in\llbracket\Gamma\rrbracket ρ ≈ ρ ∈ [ [ Γ ] ] (self-related via Theorem 7.21): λ ( t , ρ ) ≈ λ ( t , ρ ) ∈ R \lambda(t,\rho) \approx\lambda(t,\rho) \in R λ ( t , ρ ) ≈ λ ( t , ρ ) ∈ R . Sub-clause (3): Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] : T y i R Π i ( R I , P I , E l I , P O ) \Delta\vdash(\Pi(x : S_1). S_2)[\sigma] : \mathrm{Ty}_i \mathrel{\mathsf{R}} \Pi_i(R_I, P_I, \mathrm{El}_I, P_O) Δ ⊢ ( Π ( x : S 1 ) . S 2 ) [ σ ] : Ty i R Π i ( R I , P I , El I , P O ) . Established above from Theorem 7.39.
Sub-clause (4): application. Given Δ ′ ⊢ k ϕ : Δ \Delta' \vdash_k \phi: \Delta Δ ′ ⊢ k ϕ : Δ and s , b s, b s , b with Δ ′ ⊢ s : S 1 [ σ ] [ ϕ ] R b ∈ E l I \Delta' \vdash s : S_1[\sigma][\phi] \mathrel{\mathsf{R}} b \in\mathrm{El}_I Δ ′ ⊢ s : S 1 [ σ ] [ ϕ ] R b ∈ El I , and D : : b ≈ b ∈ R I \mathcal{D} :: b \approx b \in R_I D :: b ≈ b ∈ R I (by Theorem 7.21 on b ∈ E l I b \in\mathrm{El}_I b ∈ El I ). Set σ ∗ : = ( σ [ ϕ ] , s / x ) \sigma_* := (\sigma[\phi], s/x) σ ∗ := ( σ [ ϕ ] , s / x ) .
Δ ′ ⊢ σ [ ϕ ] : Γ R ρ ∈ S b Γ \Delta' \vdash\sigma[\phi] : \Gamma\mathrel{\mathsf{R}} \rho\in\mathrm{Sb}_\Gamma Δ ′ ⊢ σ [ ϕ ] : Γ R ρ ∈ Sb Γ
(by Theorem 7.20 on σ , ρ \sigma,\rho σ , ρ along ϕ \phi ϕ )
Δ ′ ⊢ S 1 [ σ [ ϕ ] ] : T y i R P I \Delta' \vdash S_1[\sigma[\phi]] : \mathrm{Ty}_i \mathrel{\mathsf{R}} P_I Δ ′ ⊢ S 1 [ σ [ ϕ ]] : Ty i R P I
(by hypothesis on S 1 S_1 S 1 at σ [ ϕ ] , ρ \sigma[\phi],\rho σ [ ϕ ] , ρ , type clause)
S 1 [ σ ] [ ϕ ] = S 1 [ σ [ ϕ ] ] S_1[\sigma][\phi] = S_1[\sigma[\phi]] S 1 [ σ ] [ ϕ ] = S 1 [ σ [ ϕ ]]
(by Theorem 2.22)
Δ ′ ⊢ s : S 1 [ σ [ ϕ ] ] R b ∈ E l I \Delta' \vdash s : S_1[\sigma[\phi]] \mathrel{\mathsf{R}} b \in\mathrm{El}_I Δ ′ ⊢ s : S 1 [ σ [ ϕ ]] R b ∈ El I
(rewriting via the previous line)
Δ ′ ⊢ σ ∗ : Γ , x : S 1 R ( ρ , b / x ) ∈ S b Γ , x : S 1 \Delta' \vdash\sigma_* : \Gamma,x:S_1 \mathrel{\mathsf{R}} (\rho,b/x) \in\mathrm{Sb}_{\Gamma,x:S_1} Δ ′ ⊢ σ ∗ : Γ , x : S 1 R ( ρ , b / x ) ∈ Sb Γ , x : S 1
(by C o n s i \mathrm{Cons}_i Cons i on the type-side P I P_I P I and the term-side b ∈ E l I b \in\mathrm{El}_I b ∈ El I , realized by s s s at S 1 [ σ [ ϕ ] ] S_1[\sigma[\phi]] S 1 [ σ [ ϕ ]] )
Instantiate the t t t -hypothesis at σ ∗ , ( ρ , b / x ) \sigma_*,(\rho,b/x) σ ∗ , ( ρ , b / x ) :
⟦ t ⟧ ( ( ρ , b / x ) ) ↘ c \llbracket t\rrbracket((\rho,b/x)) \searrow c [ [ t ] ] (( ρ , b / x )) ↘ c
(by hypothesis on t t t , evaluation clause)
⟦ S 2 ⟧ ( ( ρ , b / x ) ) ↘ a ′ \llbracket S_2\rrbracket((\rho,b/x)) \searrow a' [ [ S 2 ] ] (( ρ , b / x )) ↘ a ′
(by hypothesis on t t t , type-eval clause)
a ′ ∈ U i ∗ ↘ P ′ ↘ E l ′ a' \in\mathcal{U}_i^* \searrow P' \searrow\mathrm{El}' a ′ ∈ U i ∗ ↘ P ′ ↘ El ′
(by hypothesis on t t t , gluing clause)
Δ ′ ⊢ t [ σ ∗ ] : S 2 [ σ ∗ ] R c ∈ E l ′ \Delta' \vdash t[\sigma_*] : S_2[\sigma_*] \mathrel{\mathsf{R}} c \in\mathrm{El}' Δ ′ ⊢ t [ σ ∗ ] : S 2 [ σ ∗ ] R c ∈ El ′
(by hypothesis on t t t , term clause)
P ′ ⇔ P O ( D ) , E l ′ ⇔ E l O ( D ) P' \Leftrightarrow P_O(\mathcal{D}),\quad\mathrm{El}' \Leftrightarrow\mathrm{El}_O(\mathcal{D}) P ′ ⇔ P O ( D ) , El ′ ⇔ El O ( D )
(by Theorem 7.24: same a ′ a' a ′ as in Theorem 7.39; gluing-model predicates at a fixed value are unique up to logical equivalence)
Δ ′ ⊢ t [ σ ∗ ] : S 2 [ σ ∗ ] R c ∈ E l O ( D ) \Delta' \vdash t[\sigma_*] : S_2[\sigma_*] \mathrel{\mathsf{R}} c \in\mathrm{El}_O(\mathcal{D}) Δ ′ ⊢ t [ σ ∗ ] : S 2 [ σ ∗ ] R c ∈ El O ( D )
(rewriting via the previous line)
λ ( t , ρ ) ⋅ b ↘ c \lambda(t,\rho) \mathbin{\cdot} b \searrow c λ ( t , ρ ) ⋅ b ↘ c
(by ev-app-clos)
Compute syntactic identities for the resulting term and type:
( λ x . t ) [ σ ] = λ x . ( t [ q ( σ ) ] ) (\lambda x.t)[\sigma] = \lambda x.(t[q(\sigma)]) ( λ x . t ) [ σ ] = λ x . ( t [ q ( σ )])
(by syntactic substitution on λ \lambda λ )
( λ x . ( t [ q ( σ ) ] ) ) [ ϕ ] = λ x . ( t [ q ( σ ) ] [ q ( ϕ ) ] ) (\lambda x.(t[q(\sigma)]))[\phi] = \lambda x.(t[q(\sigma)][q(\phi)]) ( λ x . ( t [ q ( σ )])) [ ϕ ] = λ x . ( t [ q ( σ )] [ q ( ϕ )])
(by syntactic substitution on λ \lambda λ along ϕ \phi ϕ )
t [ q ( σ ) ] [ q ( ϕ ) ] = t [ q ( σ ) ∘ q ( ϕ ) ] = t [ q ( σ [ ϕ ] ) ] t[q(\sigma)][q(\phi)] = t[q(\sigma)\mathbin{\circ}q(\phi)] = t[q(\sigma[\phi])] t [ q ( σ )] [ q ( ϕ )] = t [ q ( σ ) ∘ q ( ϕ )] = t [ q ( σ [ ϕ ])]
(by Theorem 2.22 and Theorem 2.21)
( λ x . t ) [ σ ] [ ϕ ] = λ x . ( t [ q ( σ [ ϕ ] ) ] ) (\lambda x.t)[\sigma][\phi] = \lambda x.(t[q(\sigma[\phi])]) ( λ x . t ) [ σ ] [ ϕ ] = λ x . ( t [ q ( σ [ ϕ ])])
(combining)
t [ q ( σ [ ϕ ] ) ] [ s / x ] = t [ σ ∗ ] t[q(\sigma[\phi])][s/x] = t[\sigma_*] t [ q ( σ [ ϕ ])] [ s / x ] = t [ σ ∗ ]
(by Theorem 2.27)
S 2 [ q ( σ [ ϕ ] ) ] [ s / x ] = S 2 [ σ ∗ ] S_2[q(\sigma[\phi])][s/x] = S_2[\sigma_*] S 2 [ q ( σ [ ϕ ])] [ s / x ] = S 2 [ σ ∗ ]
(by Theorem 2.27)
Apply the β \beta β -rule with premises Δ ′ ⊢ S 1 [ σ [ ϕ ] ] : T y i \Delta' \vdash S_1[\sigma[\phi]] : \mathrm{Ty}_i Δ ′ ⊢ S 1 [ σ [ ϕ ]] : Ty i (escaped above); Δ ′ , x : S 1 [ σ [ ϕ ] ] ⊢ S 2 [ q ( σ [ ϕ ] ) ] : T y i \Delta',x:S_1[\sigma[\phi]] \vdash S_2[q(\sigma[\phi])] : \mathrm{Ty}_i Δ ′ , x : S 1 [ σ [ ϕ ]] ⊢ S 2 [ q ( σ [ ϕ ])] : Ty i (by substitution typing on the S 2 S_2 S 2 escape along q ( σ [ ϕ ] ) q(\sigma[\phi]) q ( σ [ ϕ ]) ); Δ ′ , x : S 1 [ σ [ ϕ ] ] ⊢ t [ q ( σ [ ϕ ] ) ] : S 2 [ q ( σ [ ϕ ] ) ] \Delta',x:S_1[\sigma[\phi]] \vdash t[q(\sigma[\phi])] : S_2[q(\sigma[\phi])] Δ ′ , x : S 1 [ σ [ ϕ ]] ⊢ t [ q ( σ [ ϕ ])] : S 2 [ q ( σ [ ϕ ])] (by substitution typing on the t t t escape); and Δ ′ ⊢ s : S 1 [ σ [ ϕ ] ] \Delta' \vdash s : S_1[\sigma[\phi]] Δ ′ ⊢ s : S 1 [ σ [ ϕ ]] (escape on s s s ):
Δ ′ ⊢ ( λ x . ( t [ q ( σ [ ϕ ] ) ) ) s ≈ t [ q ( σ [ ϕ ] ) ] [ s / x ] : S 2 [ q ( σ [ ϕ ] ) ] [ s / x ] \Delta' \vdash(\lambda x.(t[q(\sigma[\phi])))\,s \approx t[q(\sigma[\phi])][s/x] : S_2[q(\sigma[\phi])][s/x] Δ ′ ⊢ ( λ x . ( t [ q ( σ [ ϕ ]))) s ≈ t [ q ( σ [ ϕ ])] [ s / x ] : S 2 [ q ( σ [ ϕ ])] [ s / x ]
(by β \beta β )
Δ ′ ⊢ ( λ x . t ) [ σ ] [ ϕ ] s ≈ t [ σ ∗ ] : S 2 [ σ ∗ ] \Delta' \vdash(\lambda x.t)[\sigma][\phi]\,s \approx t[\sigma_*] : S_2[\sigma_*] Δ ′ ⊢ ( λ x . t ) [ σ ] [ ϕ ] s ≈ t [ σ ∗ ] : S 2 [ σ ∗ ]
(rewriting)
Δ ′ ⊢ ( λ x . t ) [ σ ] [ ϕ ] s : S 2 [ σ ∗ ] R c ∈ E l O ( D ) \Delta' \vdash(\lambda x.t)[\sigma][\phi]\,s : S_2[\sigma_*] \mathrel{\mathsf{R}} c \in\mathrm{El}_O(\mathcal{D}) Δ ′ ⊢ ( λ x . t ) [ σ ] [ ϕ ] s : S 2 [ σ ∗ ] R c ∈ El O ( D )
(by Theorem 7.26)
S 2 [ σ ∗ ] = S 2 [ q ( σ ) ] [ ι ( ϕ ) , s / x ] S_2[\sigma_*] = S_2[q(\sigma)][\iota(\phi),s/x] S 2 [ σ ∗ ] = S 2 [ q ( σ )] [ ι ( ϕ ) , s / x ]
(by Theorem 2.28)
Δ ′ ⊢ ( λ x . t ) [ σ ] [ ϕ ] s : S 2 [ q ( σ ) ] [ ι ( ϕ ) , s / x ] R c ∈ E l O ( D ) \Delta' \vdash(\lambda x.t)[\sigma][\phi]\,s : S_2[q(\sigma)][\iota(\phi),s/x] \mathrel{\mathsf{R}} c \in\mathrm{El}_O(\mathcal{D}) Δ ′ ⊢ ( λ x . t ) [ σ ] [ ϕ ] s : S 2 [ q ( σ )] [ ι ( ϕ ) , s / x ] R c ∈ El O ( D )
(rewriting; matches Theorem 7.10 clause (4))
Lemma 7.43 (Semantic — λ \lambda λ -E). If Γ , x : S 1 ⊢ S 2 : T y i \Gamma, x : S_1 \vdash S_2 : \mathrm{Ty}_i Γ , x : S 1 ⊢ S 2 : Ty i , Γ ⊢ r : Π ( x : S 1 ) . S 2 \Gamma\vdash r : \Pi(x : S_1). S_2 Γ ⊢ r : Π ( x : S 1 ) . S 2 , and Γ ⊢ s : S 1 \Gamma\vdash s : S_1 Γ ⊢ s : S 1 , then Γ ⊢ r s : S 2 [ s / x ] \Gamma\vdash r\,s : S_2[s/x] Γ ⊢ r s : S 2 [ s / x ] .
Proof. ⊩ Γ \Vdash\Gamma ⊩ Γ and ⊩ Γ , x : S 1 \Vdash\Gamma, x : S_1 ⊩ Γ , x : S 1 are presupposed. Fix Γ ↘ S b Γ \Gamma\searrow\mathrm{Sb}_{\Gamma} Γ ↘ Sb Γ and ( Γ , x : S 1 ) ↘ S b Γ , x : S 1 (\Gamma, x : S_1) \searrow\mathrm{Sb}_{\Gamma,x:S_1} ( Γ , x : S 1 ) ↘ Sb Γ , x : S 1 where S b Γ , x : S 1 ⇔ Cons i ( Γ , S 1 , S b Γ ) \mathrm{Sb}_{\Gamma,x:S_1} \Leftrightarrow\operatorname{Cons}_i(\Gamma,S_1,\mathrm{Sb}_{\Gamma}) Sb Γ , x : S 1 ⇔ Cons i ( Γ , S 1 , Sb Γ ) by G-Ctx-Ext. Let Δ ⊢ σ : Γ ® ρ ∈ S b Γ \Delta\vdash\sigma: \Gamma\circledR\rho\in\mathrm{Sb}_{\Gamma} Δ ⊢ σ : Γ ® ρ ∈ Sb Γ be given.
Unpacking the hypotheses.
⟦ r ⟧ ( ρ ) ↘ f \llbracket r\rrbracket(\rho) \searrow f [ [ r ] ] ( ρ ) ↘ f
(by hypothesis on r r r , evaluation clause)
Δ ⊢ r [ σ ] : ( Π ( x : S 1 ) . S 2 ) [ σ ] ® f ∈ Π i E l ( R , R I , P I , E l I , E l O ) \Delta\vdash r[\sigma] : (\Pi(x : S_1).S_2)[\sigma] \circledR f \in\Pi_i^{\mathrm{El}}(R,R_I,P_I,\mathbf{El}_I,\mathbf{El}_O) Δ ⊢ r [ σ ] : ( Π ( x : S 1 ) . S 2 ) [ σ ] ® f ∈ Π i El ( R , R I , P I , El I , El O )
(by hypothesis on r r r , term clause)
⟦ s ⟧ ( ρ ) ↘ b \llbracket s\rrbracket(\rho) \searrow b [ [ s ] ] ( ρ ) ↘ b
(by hypothesis on s s s , evaluation clause)
Δ ⊢ s [ σ ] : S 1 [ σ ] ® b ∈ E l I \Delta\vdash s[\sigma] : S_1[\sigma] \circledR b \in\mathbf{El}_I Δ ⊢ s [ σ ] : S 1 [ σ ] ® b ∈ El I
(by hypothesis on s s s , term clause)
b ≈ b ∈ R I b \approx b \in R_I b ≈ b ∈ R I
(by Theorem 7.21)
Let D : : b ≈ b ∈ R I \mathcal{D} :: b \approx b \in R_I D :: b ≈ b ∈ R I . Here P O , E l O P_O,\mathbf{El}_O P O , El O are functions of D \mathcal{D} D , supplied by the Π \Pi Π -gluing of f f f .
Building the substitution-environment pair for S 2 S_2 S 2 . Set σ ∗ : = ( σ , s [ σ ] / x ) \sigma_* := (\sigma,s[\sigma]/x) σ ∗ := ( σ , s [ σ ] / x ) .
Δ ⊢ σ ∗ : Γ , x : S 1 ® ( ρ , b / x ) ∈ S b Γ , x : S 1 \Delta\vdash\sigma_* : \Gamma,x:S_1 \circledR(\rho,b/x) \in\mathrm{Sb}_{\Gamma,x:S_1} Δ ⊢ σ ∗ : Γ , x : S 1 ® ( ρ , b / x ) ∈ Sb Γ , x : S 1
(by Cons i \operatorname{Cons}_i Cons i on σ , ρ ∈ S b Γ \sigma,\rho\in\mathrm{Sb}_{\Gamma} σ , ρ ∈ Sb Γ and the term gluing of s [ σ ] s[\sigma] s [ σ ] , taking the trailing weakening as id)
Instantiating the codomain semantic typing. Apply Γ , x : S 1 ⊩ S 2 : T y i \Gamma,x:S_1 \Vdash S_2 : \mathrm{Ty}_i Γ , x : S 1 ⊩ S 2 : Ty i at σ ∗ , ( ρ , b / x ) \sigma_*,(\rho,b/x) σ ∗ , ( ρ , b / x ) :
⟦ S 2 ⟧ ( ( ρ , b / x ) ) ↘ a 2 \llbracket S_2\rrbracket((\rho,b/x)) \searrow a_2 [ [ S 2 ] ] (( ρ , b / x )) ↘ a 2
(by hypothesis on S 2 S_2 S 2 , evaluation clause)
a 2 ∈ U i ∗ ↘ P 2 ↘ E l 2 a_2 \in U_i^* \searrow P_2 \searrow\mathbf{El}_2 a 2 ∈ U i ∗ ↘ P 2 ↘ El 2
(by hypothesis on S 2 S_2 S 2 , gluing clause)
Δ ⊢ S 2 [ σ ∗ ] : T y i ® P 2 \Delta\vdash S_2[\sigma_*] : \mathrm{Ty}_i \circledR P_2 Δ ⊢ S 2 [ σ ∗ ] : Ty i ® P 2
(by hypothesis on S 2 S_2 S 2 , type clause)
Reconciling ( P 2 , E l 2 ) (P_2,\mathbf{El}_2) ( P 2 , El 2 ) with ( P O ( D ) , E l O ( D ) ) (P_O(\mathcal{D}),\mathbf{El}_O(\mathcal{D})) ( P O ( D ) , El O ( D )) . The Π \Pi Π -gluing of f f f , by G-Pi, requires ⟦ S 2 ⟧ ( ( ρ , b / x ) ) ↘ c \llbracket S_2\rrbracket((\rho,b/x)) \searrow c [ [ S 2 ] ] (( ρ , b / x )) ↘ c implies
c ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) c \in U_i^* \searrow P_O(\mathcal{D}) \searrow\mathbf{El}_O(\mathcal{D}) c ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D )
By determinism, c = a 2 c=a_2 c = a 2 , so a 2 ∈ U i ∗ ↘ P O ( D ) ↘ E l O ( D ) a_2 \in U_i^* \searrow P_O(\mathcal{D}) \searrow\mathbf{El}_O(\mathcal{D}) a 2 ∈ U i ∗ ↘ P O ( D ) ↘ El O ( D ) . By Theorem 7.24, gluing-model predicates at a fixed domain value are unique up to logical equivalence:
P 2 ⇔ P O ( D ) , E l 2 ⇔ E l O ( D ) P_2 \Leftrightarrow P_O(\mathcal{D}),\qquad\mathbf{El}_2 \Leftrightarrow\mathbf{El}_O(\mathcal{D}) P 2 ⇔ P O ( D ) , El 2 ⇔ El O ( D )
(by Theorem 7.24)
Application via the Π \Pi Π -gluing of f f f . Instantiate the application clause (Theorem 7.10 clause (4)) on f f f at the identity Kripke weakening i d \mathrm{id} id , term s [ σ ] s[\sigma] s [ σ ] , value b b b , witness D \mathcal{D} D :
f ⋅ b ↘ c f \mathbin{\cdot} b \searrow c f ⋅ b ↘ c
(by clause (4) on f f f )
Δ ⊢ ( r [ σ ] [ i d ] ) s [ σ ] : S 2 [ ι ( i d ) ∘ q ( σ ) , s [ σ ] / x ] ® c ∈ E l O ( D ) \Delta\vdash(r[\sigma][\mathrm{id}])\,s[\sigma] : S_2[\iota(\mathrm{id}) \circ q(\sigma),s[\sigma]/x] \circledR c \in\mathbf{El}_O(\mathcal{D}) Δ ⊢ ( r [ σ ] [ id ]) s [ σ ] : S 2 [ ι ( id ) ∘ q ( σ ) , s [ σ ] / x ] ® c ∈ El O ( D )
(by clause (4) on f f f )
r [ σ ] [ i d ] = r [ σ ] r[\sigma][\mathrm{id}] = r[\sigma] r [ σ ] [ id ] = r [ σ ]
(by Theorem 2.17)
ι ( i d ) = i d \iota(\mathrm{id}) = \mathrm{id} ι ( id ) = id
(by definition of ι \iota ι on the identity weakening)
S 2 [ ι ( i d ) ∘ q ( σ ) , s [ σ ] / x ] = S 2 [ σ ∗ ] S_2[\iota(\mathrm{id}) \circ q(\sigma),s[\sigma]/x] = S_2[\sigma_*] S 2 [ ι ( id ) ∘ q ( σ ) , s [ σ ] / x ] = S 2 [ σ ∗ ]
(via Theorem 2.27 and identity absorption)
Δ ⊢ ( r [ σ ] ) s [ σ ] : S 2 [ σ ∗ ] ® c ∈ E l O ( D ) \Delta\vdash(r[\sigma])\,s[\sigma] : S_2[\sigma_*] \circledR c \in\mathbf{El}_O(\mathcal{D}) Δ ⊢ ( r [ σ ]) s [ σ ] : S 2 [ σ ∗ ] ® c ∈ El O ( D )
(rewriting the previous gluing line)
Type rewriting from S 2 [ σ ∗ ] S_2[\sigma_*] S 2 [ σ ∗ ] to S 2 [ s / x ] [ σ ] S_2[s/x][\sigma] S 2 [ s / x ] [ σ ] .
S 2 [ σ ∗ ] = S 2 [ ( σ , s [ σ ] / x ) ] = S 2 [ q ( σ ) ] [ s [ σ ] / x ] S_2[\sigma_*] = S_2[(\sigma,s[\sigma]/x)] = S_2[q(\sigma)][s[\sigma]/x] S 2 [ σ ∗ ] = S 2 [( σ , s [ σ ] / x )] = S 2 [ q ( σ )] [ s [ σ ] / x ]
(by Theorem 2.27)
S 2 [ s / x ] [ σ ] = S 2 [ σ , s [ σ ] / x ] = S 2 [ σ ∗ ] S_2[s/x][\sigma] = S_2[\sigma,s[\sigma]/x] = S_2[\sigma_*] S 2 [ s / x ] [ σ ] = S 2 [ σ , s [ σ ] / x ] = S 2 [ σ ∗ ]
(by Theorem 2.30)
Bridging ⟦ S 2 [ s / x ] ⟧ ( ρ ) \llbracket S_2[s/x]\rrbracket(\rho) [ [ S 2 [ s / x ] ] ] ( ρ ) to a 2 a_2 a 2 . With operational substitutions, ⟦ S 2 [ s / x ] ⟧ ( ρ ) \llbracket S_2[s/x]\rrbracket(\rho) [ [ S 2 [ s / x ] ] ] ( ρ ) does not directly evaluate to a 2 a_2 a 2 . By Theorem 6.73 of Sec. 6 on Γ , x : S 1 ⊢ S 2 : T y i \Gamma,x:S_1 \vdash S_2 : \mathrm{Ty}_i Γ , x : S 1 ⊢ S 2 : Ty i (escaped from the S 2 S_2 S 2 hypothesis), we obtain Γ , x : S 1 ⊩ S 2 ≈ S 2 : T y i \Gamma,x:S_1 \Vdash S_2 \approx S_2 : \mathrm{Ty}_i Γ , x : S 1 ⊩ S 2 ≈ S 2 : Ty i . By Theorem 6.73 on the substitution typing Γ ⊢ ( i d , s / x ) : Γ , x : S 1 \Gamma\vdash(\mathrm{id},s/x) : \Gamma,x:S_1 Γ ⊢ ( id , s / x ) : Γ , x : S 1 (derivable from Γ ⊢ s : S 1 \Gamma\vdash s:S_1 Γ ⊢ s : S 1 via the substitution-extension rule), we obtain Γ ⊢ ( i d , s / x ) ≈ ( i d , s / x ) : Γ , x : S 1 \Gamma\vdash(\mathrm{id},s/x) \approx(\mathrm{id},s/x) : \Gamma,x:S_1 Γ ⊢ ( id , s / x ) ≈ ( id , s / x ) : Γ , x : S 1 . Instantiate Γ , x : S 1 ⊢ S 2 ≈ S 2 : T y i \Gamma,x:S_1 \vdash S_2 \approx S_2 : \mathrm{Ty}_i Γ , x : S 1 ⊢ S 2 ≈ S 2 : Ty i at outer context Γ \Gamma Γ , this semantic substitution, and ρ ≈ ρ ∈ ⟦ Γ ⟧ \rho\approx\rho\in\llbracket\Gamma\rrbracket ρ ≈ ρ ∈ [ [ Γ ] ] (the latter from ρ ∈ S b Γ \rho\in Sb_\Gamma ρ ∈ S b Γ via Theorem 7.21). The four-value pattern of Theorem 6.31 yields:
⟦ ( id , s / x ) ⟧ ( ρ ) ↘ ( ρ , b / x ) (by ev-ext on ⟦ id ⟧ ( ρ ) ↘ ρ and ⟦ s ⟧ ( ρ ) ↘ b ) ⟦ S 2 [ ( id , s / x ) ] ⟧ ( ρ ) ↘ a 2 ′ (by the four-value pattern, outer left value) S 2 [ s / x ] = S 2 [ ( id , s / x ) ] (by definition: single-substitution sugar) ⟦ S 2 [ s / x ] ⟧ ( ρ ) ↘ a 2 ′ (rewriting) a 2 ′ ≈ ⟦ S 2 ⟧ ( ( ρ , b / x ) ) ∈ U i ↘ R O ( D ) (by the four-value pattern, outer-inner relatedness) a 2 ′ ≈ a 2 ∈ U i ↘ R O ( D ) (by determinism: ⟦ S 2 ⟧ ( ( ρ , b / x ) ) = a 2 ) a 2 ′ ∈ U i ∗ ↘ P 2 ↘ E l 2 (by Theorem 7.27 symmetric form on a 2 ∈ U i ∗ ) \begin{aligned}
\llbracket(\operatorname{id},s/x)\rrbracket(\rho) &\searrow(\rho,b/x) && \text{(by ev-ext on }\llbracket\operatorname{id}\rrbracket(\rho) \searrow\rho\text{ and }\llbracket s\rrbracket(\rho) \searrow b\text{)}\\
\llbracket S_2[(\operatorname{id},s/x)]\rrbracket(\rho) &\searrow a'_2 && \text{(by the four-value pattern, outer left value)}\\
S_2[s/x] &= S_2[(\operatorname{id},s/x)] && \text{(by definition: single-substitution sugar)}\\
\llbracket S_2[s/x]\rrbracket(\rho) &\searrow a'_2 && \text{(rewriting)}\\
a'_2 &\approx\llbracket S_2\rrbracket((\rho,b/x)) \in U_i \searrow R_O(\mathcal{D}) && \text{(by the four-value pattern, outer-inner relatedness)}\\
a'_2 &\approx a_2 \in U_i \searrow R_O(\mathcal{D}) && \text{(by determinism: }\llbracket S_2\rrbracket((\rho,b/x)) = a_2\text{)}\\
a'_2 &\in U_i^* \searrow P_2 \searrow\mathrm{El}_2 && \text{(by Theorem 7.27 symmetric form on }a_2 \in U_i^*\text{)}
\end{aligned} [ [ ( id , s / x ) ] ] ( ρ ) [ [ S 2 [( id , s / x )] ] ] ( ρ ) S 2 [ s / x ] [ [ S 2 [ s / x ] ] ] ( ρ ) a 2 ′ a 2 ′ a 2 ′ ↘ ( ρ , b / x ) ↘ a 2 ′ = S 2 [( id , s / x )] ↘ a 2 ′ ≈ [ [ S 2 ] ] (( ρ , b / x )) ∈ U i ↘ R O ( D ) ≈ a 2 ∈ U i ↘ R O ( D ) ∈ U i ∗ ↘ P 2 ↘ El 2 (by ev-ext on [ [ id ] ] ( ρ ) ↘ ρ and [ [ s ] ] ( ρ ) ↘ b ) (by the four-value pattern, outer left value) (by definition: single-substitution sugar) (rewriting) (by the four-value pattern, outer-inner relatedness) (by determinism: [ [ S 2 ] ] (( ρ , b / x )) = a 2 ) (by Theorem 7.27 symmetric form on a 2 ∈ U i ∗ )
Assembling the four clauses of Γ ⊩ r s : S 2 [ s / x ] \Gamma\Vdash r\ s : S_2[s/x] Γ ⊩ r s : S 2 [ s / x ] . At a : = a 2 ′ a := a'_2 a := a 2 ′ , P : = P 2 P := P_2 P := P 2 , E l : = E l 2 \mathrm{El} := \mathrm{El}_2 El := El 2 :
⟦ S 2 [ s / x ] ⟧ ( ρ ) ↘ a 2 ′ [clause 1] a 2 ′ ∈ U i ∗ ↘ P 2 ↘ E l 2 [clause 2] Δ ⊢ S 2 [ s / x ] [ σ ] : T y i ⊗ P 2 (rewriting S 2 [ σ ∗ ] = S 2 [ s / x ] [ σ ] on the type-clause line) [clause 3] ⟦ r s ⟧ ( ρ ) ↘ c (by ev-app on ⟦ r ⟧ ( ρ ) ↘ f , ⟦ s ⟧ ( ρ ) ↘ b , f ⋅ b ↘ c ) ( r s ) [ σ ] = r [ σ ] s [ σ ] (by syntactic substitution on application) Δ ⊢ r s [ σ ] : S 2 [ σ ∗ ] ⊗ c ∈ E l O ( D ) (established above) Δ ⊢ ( r s ) [ σ ] : S 2 [ s / x ] [ σ ] ⊗ c ∈ E l 2 (rewriting via S 2 [ σ ∗ ] = S 2 [ s / x ] [ σ ] and E l O ( D ) ⇔ E l 2 ) [clause 4] \begin{aligned}
\llbracket S_2[s/x]\rrbracket(\rho) &\searrow a'_2 && \text{[clause 1]}\\
a'_2 &\in U_i^* \searrow P_2 \searrow\mathbf{El}_2 && \text{[clause 2]}\\
\Delta&\vdash S_2[s/x][\sigma] : \mathrm{Ty}_i \otimes P_2 && \text{(rewriting }S_2[\sigma_*] = S_2[s/x][\sigma]\text{ on the type-clause line) [clause 3]}\\
\llbracket r\ s\rrbracket(\rho) &\searrow c && \text{(by ev-app on }\llbracket r\rrbracket(\rho) \searrow f\text{, }\llbracket s\rrbracket(\rho) \searrow b\text{, }f \mathbin{\cdot} b \searrow c\text{)}\\
(r\ s)[\sigma] &= r[\sigma]\ s[\sigma] && \text{(by syntactic substitution on application)}\\
\Delta&\vdash r\ s[\sigma] : S_2[\sigma_*] \otimes c \in\mathrm{El}_O(\mathcal{D}) && \text{(established above)}\\
\Delta&\vdash(r\ s)[\sigma] : S_2[s/x][\sigma] \otimes c \in\mathrm{El}_2 && \text{(rewriting via }S_2[\sigma_*] = S_2[s/x][\sigma]\text{ and }\mathrm{El}_O(\mathcal{D}) \Leftrightarrow\mathrm{El}_2\text{) [clause 4]}
\end{aligned} [ [ S 2 [ s / x ] ] ] ( ρ ) a 2 ′ Δ [ [ r s ] ] ( ρ ) ( r s ) [ σ ] Δ Δ ↘ a 2 ′ ∈ U i ∗ ↘ P 2 ↘ El 2 ⊢ S 2 [ s / x ] [ σ ] : Ty i ⊗ P 2 ↘ c = r [ σ ] s [ σ ] ⊢ r s [ σ ] : S 2 [ σ ∗ ] ⊗ c ∈ El O ( D ) ⊢ ( r s ) [ σ ] : S 2 [ s / x ] [ σ ] ⊗ c ∈ El 2 [clause 1] [clause 2] (rewriting S 2 [ σ ∗ ] = S 2 [ s / x ] [ σ ] on the type-clause line) [clause 3] (by ev-app on [ [ r ] ] ( ρ ) ↘ f , [ [ s ] ] ( ρ ) ↘ b , f ⋅ b ↘ c ) (by syntactic substitution on application) (established above) (rewriting via S 2 [ σ ∗ ] = S 2 [ s / x ] [ σ ] and El O ( D ) ⇔ El 2 ) [clause 4]
The semantic N-E rule is established via a recursive helper that performs the induction on the natural-number gluing predicate N a t i \mathrm{Nat}_i Nat i . The helper takes the four semantic hypotheses (motive T T T , zero-branch z z z , step-branch s s s ) and the natural-number gluing of the scrutinee, and returns a value with the term-side gluing for the recursor at that scrutinee.
Lemma 7.44 (N-E helper). Suppose Γ , x : N a t ⊩ T : T y i \Gamma, x : \mathrm{Nat} \Vdash T : \mathrm{Ty}_i Γ , x : Nat ⊩ T : Ty i , Γ ⊩ z : T [ z e r o / x ] \Gamma\Vdash z : T[zero/x] Γ ⊩ z : T [ z er o / x ] , and Γ , x : N a t , y : T ⊩ s : T [ ⇑ ∘ ⇑ , s u c c x 1 / x ] \Gamma, x : \mathrm{Nat}, y : T \Vdash s : T[\mathord{\Uparrow} \circ\mathord{\Uparrow},succ\ x_1/x] Γ , x : Nat , y : T ⊩ s : T [ ⇑ ∘ ⇑ , s u cc x 1 / x ] . Let Δ ⊢ σ : Γ ⊗ ρ ∈ S b \Delta\vdash\sigma: \Gamma\otimes\rho\in Sb Δ ⊢ σ : Γ ⊗ ρ ∈ S b be given, with S b Sb S b from ⊩ Γ \Vdash\Gamma ⊩ Γ . For any t ∗ t_* t ∗ and b b b with Δ ⊢ t ∗ : N a t ⊗ b ∈ N a t i \Delta\vdash t_* : \mathrm{Nat} \otimes b \in\mathrm{Nat}_i Δ ⊢ t ∗ : Nat ⊗ b ∈ Nat i , and any a a a , P P P , E l \mathrm{El} El with ⟦ T ⟧ ( ( ρ , b / x ) ) ↘ a \llbracket T\rrbracket((\rho,b/x)) \searrow a [ [ T ] ] (( ρ , b / x )) ↘ a and a ∈ U i ∗ ↘ P ↘ E l a \in U_i^* \searrow P \searrow\mathrm{El} a ∈ U i ∗ ↘ P ↘ El , there exists r r r with rec ( b , T , z , s , ρ ) ↘ r \operatorname{rec}(b,T,z,s,\rho) \searrow r rec ( b , T , z , s , ρ ) ↘ r and Δ ⊢ elim N a t ( x . T [ q ( σ ) ] ) z [ σ ] ( x , y . s [ q ( q ( σ ) ) ] ) t ∗ : T [ σ , t ∗ / x ] ⊗ r ∈ E l \Delta\vdash\operatorname{elim}_{\mathrm{Nat}}(x.T[q(\sigma)])\ z[\sigma]\ (x,y.s[q(q(\sigma))])\ t_* : T[\sigma,t_*/x] \otimes r \in\mathrm{El} Δ ⊢ elim Nat ( x . T [ q ( σ )]) z [ σ ] ( x , y . s [ q ( q ( σ ))]) t ∗ : T [ σ , t ∗ / x ] ⊗ r ∈ El .
Proof. Write E : = elim N a t ( x . T [ q ( σ ) ] ) z [ σ ] ( x , y . s [ q ( q ( σ ) ) ] ) t ∗ E := \operatorname{elim}_{\mathrm{Nat}}(x.T[q(\sigma)])\ z[\sigma]\ (x,y.s[q(q(\sigma))])\ t_* E := elim Nat ( x . T [ q ( σ )]) z [ σ ] ( x , y . s [ q ( q ( σ ))]) t ∗ for the syntactic recursor under σ \sigma σ . By inner induction on b ∈ N a t b \in\mathrm{Nat} b ∈ Nat (Theorem 7.8).
Case
G N - Z e Δ ⊢ t ∗ ≈ z e r o : N a t Δ ⊢ t ∗ : N a t ⊗ z e ∈ N a t \begin{gathered}
\mathrm{GN\text{-}Ze}\\
\Delta\vdash t_* \approx zero : \mathrm{Nat}\\
\Delta\vdash t_* : \mathrm{Nat} \otimes ze \in\mathrm{Nat}
\end{gathered} GN - Ze Δ ⊢ t ∗ ≈ z er o : Nat Δ ⊢ t ∗ : Nat ⊗ z e ∈ Nat
Here b = z e b = ze b = z e , so the helper’s hypothesis specializes to ⟦ T ⟧ ( ( ρ , z e / x ) ) ↘ a \llbracket T\rrbracket((\rho,ze/x)) \searrow a [ [ T ] ] (( ρ , z e / x )) ↘ a .
⟦ T [ z e r o / x ] ⟧ ( ρ ) ↘ a z e (by hypothesis on z , type-evaluation clause) a z e ∈ U i ∗ ↘ P z e ↘ E l z e (by hypothesis on z , gluing clause) ⟦ z ⟧ ( ρ ) ↘ r z (by hypothesis on z , evaluation clause) Δ ⊢ z [ σ ] : T [ z e r o / x ] [ σ ] ⊗ r z ∈ E l z e (by hypothesis on z , term clause) \begin{aligned}
\llbracket T[zero/x]\rrbracket(\rho) &\searrow a^{ze} && \text{(by hypothesis on }z\text{, type-evaluation clause)}\\
a^{ze} &\in U_i^* \searrow P^{ze} \searrow\mathbf{El}^{ze} && \text{(by hypothesis on }z\text{, gluing clause)}\\
\llbracket z\rrbracket(\rho) &\searrow r_z && \text{(by hypothesis on }z\text{, evaluation clause)}\\
\Delta&\vdash z[\sigma] : T[zero/x][\sigma] \otimes r_z \in\mathbf{El}^{ze} && \text{(by hypothesis on }z\text{, term clause)}
\end{aligned} [ [ T [ z er o / x ] ] ] ( ρ ) a z e [ [ z ] ] ( ρ ) Δ ↘ a z e ∈ U i ∗ ↘ P z e ↘ El z e ↘ r z ⊢ z [ σ ] : T [ z er o / x ] [ σ ] ⊗ r z ∈ El z e (by hypothesis on z , type-evaluation clause) (by hypothesis on z , gluing clause) (by hypothesis on z , evaluation clause) (by hypothesis on z , term clause)
rec ( z e , T , z , s , ρ ) ↘ r z \operatorname{rec}(ze,T,z,s,\rho)\mathrel{\searrow}r_z rec ( z e , T , z , s , ρ ) ↘ r z
(by REC-ZE)
a z e ≈ a ∈ U i a^{ze}\approx a\in\mathcal{U}_i a z e ≈ a ∈ U i
(by completeness on Γ , x : N a t ⊢ T : T y i \Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i Γ , x : Nat ⊢ T : Ty i instantiated at ( i d , z e r o / x ) (\mathrm{id},\mathrm{zero}/x) ( id , zero / x ) ; both evaluations produce the same value modulo U i \mathcal{U}_i U i )
E l z e ⇔ E l \mathrm{El}^{ze}\Leftrightarrow\mathrm{El} El z e ⇔ El
(by Theorem 7.24: gluing-model predicates at the same value are unique up to logical equivalence)
T [ z e r o / x ] [ σ ] = T [ σ , z e r o / x ] T[\mathrm{zero}/x][\sigma]=T[\sigma,\mathrm{zero}/x] T [ zero / x ] [ σ ] = T [ σ , zero / x ]
(by Theorem 2.30)
Δ ⊢ T [ σ , z e r o / x ] ≈ T [ σ , t ∗ / x ] : T y i \Delta\vdash T[\sigma,\mathrm{zero}/x]\approx T[\sigma,t_*/x]:\mathrm{Ty}_i Δ ⊢ T [ σ , zero / x ] ≈ T [ σ , t ∗ / x ] : Ty i
(by Theorem 4.14 on Γ , x : N a t ⊢ T : T y i \Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i Γ , x : Nat ⊢ T : Ty i from Theorem 7.22, the substitution σ \sigma σ , and the head equality Δ ⊢ z e r o ≈ t ∗ : N a t \Delta\vdash\mathrm{zero}\approx t_*:\mathrm{Nat} Δ ⊢ zero ≈ t ∗ : Nat from Δ ⊢ t ∗ ≈ z e r o : N a t \Delta\vdash t_*\approx\mathrm{zero}:\mathrm{Nat} Δ ⊢ t ∗ ≈ zero : Nat by symmetry)
Δ ⊢ E ≈ z [ σ ] : T [ σ , t ∗ / x ] \Delta\vdash E\approx z[\sigma]:T[\sigma,t_*/x] Δ ⊢ E ≈ z [ σ ] : T [ σ , t ∗ / x ]
(by the β \beta β -zero rule combined with Δ ⊢ t ∗ ≈ z e r o : N a t \Delta\vdash t_*\approx\mathrm{zero}:\mathrm{Nat} Δ ⊢ t ∗ ≈ zero : Nat )
Δ ⊢ E : T [ σ , t ∗ / x ] ® r z ∈ E l \Delta\vdash E:T[\sigma,t_*/x]\mathrel{\circledR}r_z\in\mathrm{El} Δ ⊢ E : T [ σ , t ∗ / x ] ® r z ∈ El
(by Theorem 7.26 on the previous lines)
Take r : = r z r:=r_z r := r z .
Case
Δ ⊢ t ∗ : N a t ® b ′ ∈ N a t Δ ⊢ t ∗ ≈ succ t ∗ ′ : N a t Δ ⊢ t ∗ : N a t ® su ( b ′ ) ∈ N a t GN-Su \frac{\Delta\vdash t_*:\mathrm{Nat}\mathrel{\circledR}b'\in\mathrm{Nat}\qquad\Delta\vdash t_*\approx\operatorname{succ}t_*':\mathrm{Nat}}{\Delta\vdash t_*:\mathrm{Nat}\mathrel{\circledR}\operatorname{su}(b')\in\mathrm{Nat}}
\qquad\text{GN-Su} Δ ⊢ t ∗ : Nat ® su ( b ′ ) ∈ Nat Δ ⊢ t ∗ : Nat ® b ′ ∈ Nat Δ ⊢ t ∗ ≈ succ t ∗ ′ : Nat GN-Su
Here b = su ( b ′ ) b=\operatorname{su}(b') b = su ( b ′ ) .
Predecessor via inner IH. We need to apply the helper inductively at t ∗ ′ , b ′ t_*',b' t ∗ ′ , b ′ . By Theorem 6.73 of Sec. 6 on Γ , x : N a t ⊢ T : T y i \Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i Γ , x : Nat ⊢ T : Ty i instantiated at the related environments ( ρ , b ′ / x ) ≈ ( ρ , b ′ / x ) ∈ ⟦ Γ , x : N a t ⟧ (\rho,b'/x)\approx(\rho,b'/x)\in\llbracket\Gamma,x:\mathrm{Nat}\rrbracket ( ρ , b ′ / x ) ≈ ( ρ , b ′ / x ) ∈ [ [ Γ , x : Nat ] ] (using b ′ ∈ R N a t b'\in R_{\mathrm{Nat}} b ′ ∈ R Nat via Theorem 7.21 on the inner predecessor):
⟦ T ⟧ ( ( ρ , b ′ / x ) ) ↘ a ′ \llbracket T\rrbracket((\rho,b'/x))\mathrel{\searrow}a' [ [ T ] ] (( ρ , b ′ / x )) ↘ a ′
(by completeness on T T T )
a ′ ∈ U i ∗ ↘ P ′ ↘ E l ′ a'\in\mathcal{U}_i^*\mathrel{\searrow}P'\mathrel{\searrow}\mathrm{El}' a ′ ∈ U i ∗ ↘ P ′ ↘ El ′
(by Theorem 7.28 on a ′ ≈ a ′ ∈ U i a'\approx a'\in\mathcal{U}_i a ′ ≈ a ′ ∈ U i )
rec ( b ′ , T , z , s , ρ ) ↘ r ′ , Δ ⊢ E ′ : T [ σ , t ∗ ′ / x ] ® r ′ ∈ E l ′ \operatorname{rec}(b',T,z,s,\rho)\mathrel{\searrow}r',\quad\Delta\vdash E':T[\sigma,t_*'/x]\mathrel{\circledR}r'\in\mathrm{El}' rec ( b ′ , T , z , s , ρ ) ↘ r ′ , Δ ⊢ E ′ : T [ σ , t ∗ ′ / x ] ® r ′ ∈ El ′
(by inner IH on b ′ , t ∗ ′ , a ′ , P ′ , E l ′ b',t_*',a',P',\mathrm{El'} b ′ , t ∗ ′ , a ′ , P ′ , E l ′ ; E ′ : = elim N a t ( x . T [ q ( σ ) ] ) z [ σ ] ( x , y . s [ q ( q ( σ ) ) ] ) t ∗ ′ E':=\operatorname{elim}_{\mathrm{Nat}}(x.T[q(\sigma)])\,z[\sigma]\,(x,y.s[q(q(\sigma))])\,t_*' E ′ := elim Nat ( x . T [ q ( σ )]) z [ σ ] ( x , y . s [ q ( q ( σ ))]) t ∗ ′ )
Step instantiation. Set σ s t e p : = ( σ , t ∗ ′ / x , E ′ / y ) \sigma_{\mathrm{step}:=}(\sigma,t_*'/x,E'/y) σ step := ( σ , t ∗ ′ / x , E ′ / y ) and ρ s t e p : = ( ρ , b ′ / x , r ′ / y ) \rho_{\mathrm{step}:=}(\rho,b'/x,r'/y) ρ step := ( ρ , b ′ / x , r ′ / y ) .
Δ ⊢ ( σ , t ∗ ′ / x ) : Γ , x : N a t ® ( ρ , b ′ / x ) ∈ S b x : N a t \Delta\vdash(\sigma,t_*'/x):\Gamma,x:\mathrm{Nat}\mathrel{\circledR}(\rho,b'/x)\in\mathrm{Sb}_{x:\mathrm{Nat}} Δ ⊢ ( σ , t ∗ ′ / x ) : Γ , x : Nat ® ( ρ , b ′ / x ) ∈ Sb x : Nat
(by C o n s 0 \mathrm{Cons}_0 Cons 0 on Δ ⊢ t ∗ ′ : N a t [ σ ] ® b ′ ∈ N a t i \Delta\vdash t_*':\mathrm{Nat}[\sigma]\mathrel{\circledR}b'\in\mathrm{Nat}_i Δ ⊢ t ∗ ′ : Nat [ σ ] ® b ′ ∈ Nat i , after rewriting N a t [ σ ] = N a t \mathrm{Nat}[\sigma]=\mathrm{Nat} Nat [ σ ] = Nat )
Δ ⊢ σ s t e p : Γ , x : N a t , y : T ® ρ s t e p ∈ S b x : N a t , y : T \Delta\vdash\sigma_{\mathrm{step}}:\Gamma,x:\mathrm{Nat},y:T\mathrel{\circledR}\rho_{\mathrm{step}}\in\mathrm{Sb}_{x:\mathrm{Nat},y:T} Δ ⊢ σ step : Γ , x : Nat , y : T ® ρ step ∈ Sb x : Nat , y : T
(by C o n s i \mathrm{Cons}_i Cons i on the previous line, head r ′ ∈ E l ′ r'\in\mathrm{El'} r ′ ∈ E l ′ , type bridged via Theorem 7.26)
⟦ T ⟧ ( ρ s t e p ) ↘ a s u \llbracket T\rrbracket(\rho_{\mathrm{step}})\mathrel{\searrow}a^{su} [ [ T ] ] ( ρ step ) ↘ a s u
(by hypothesis on s s s , type-evaluation clause)
a s u ∈ U i ∗ ↘ P s u ↘ E l s u a^{su}\in\mathcal{U}_i^*\mathrel{\searrow}P^{su}\mathrel{\searrow}\mathrm{El}^{su} a s u ∈ U i ∗ ↘ P s u ↘ El s u
(by hypothesis on s s s , gluing clause)
⟦ s ⟧ ( ρ s t e p ) ↘ r s \llbracket s\rrbracket(\rho_{\mathrm{step}})\mathrel{\searrow}r_s [ [ s ] ] ( ρ step ) ↘ r s
(by hypothesis on s s s , evaluation clause)
Δ ⊢ s [ σ s t e p ] : T [ ⇑ ∘ ⇑ , succ x 1 / x ] [ σ s t e p ] ® r s ∈ E l s u \Delta\vdash s[\sigma_{\mathrm{step}}]:T[\Uparrow\circ\Uparrow,\operatorname{succ}x_1/x][\sigma_{\mathrm{step}}]\mathrel{\circledR}r_s\in\mathrm{El}^{su} Δ ⊢ s [ σ step ] : T [ ⇑ ∘ ⇑ , succ x 1 / x ] [ σ step ] ® r s ∈ El s u
(by hypothesis on s s s , term clause)
rec ( su ( b ′ ) , T , z , s , ρ ) ↘ r s \operatorname{rec}(\operatorname{su}(b'),T,z,s,\rho)\mathrel{\searrow}r_s rec ( su ( b ′ ) , T , z , s , ρ ) ↘ r s
(by REC-SU on rec ( b ′ , … ) ↘ r ′ \operatorname{rec}(b',\ldots)\mathrel{\searrow}r' rec ( b ′ , … ) ↘ r ′ and ⟦ s ⟧ ( ρ s t e p ) ↘ r s \llbracket s\rrbracket(\rho_{\mathrm{step}})\mathrel{\searrow}r_s [ [ s ] ] ( ρ step ) ↘ r s )
Type rewriting for the step branch. We compute the substituted motive type:
T [ ⇑ ∘ ⇑ , succ x 1 / x ] [ σ s t e p ] = T [ ( ⇑ ∘ ⇑ , succ x 1 / x ) ∘ σ s t e p ] T[\Uparrow\circ\Uparrow,\operatorname{succ}x_1/x][\sigma_{\mathrm{step}}]
=
T[(\Uparrow\circ\Uparrow,\operatorname{succ}x_1/x)\circ\sigma_{\mathrm{step}}] T [ ⇑ ∘ ⇑ , succ x 1 / x ] [ σ step ] = T [( ⇑ ∘ ⇑ , succ x 1 / x ) ∘ σ step ]
(by Theorem 2.22)
( ⇑ ∘ ⇑ , succ x 1 / x ) ∘ σ s t e p = ( ⇑ ∘ ⇑ ∘ σ s t e p , succ x 1 [ σ s t e p ] / x ) (by Theorem 2.26) (\Uparrow\circ\Uparrow,\operatorname{succ} x_1/x) \circ\sigma_{\mathrm{step}} = (\Uparrow\circ\Uparrow\circ\sigma_{\mathrm{step}},\operatorname{succ} x_1[\sigma_{\mathrm{step}}]/x) \qquad\text{(by Theorem 2.26)} ( ⇑ ∘ ⇑ , succ x 1 / x ) ∘ σ step = ( ⇑ ∘ ⇑ ∘ σ step , succ x 1 [ σ step ] / x ) (by Theorem 2.26)
⇑ ∘ σ s t e p = ( σ , t ∗ ′ / x ) , ⇑ ∘ ( σ , t ∗ ′ / x ) = σ (by Theorem 2.25) \Uparrow\circ\sigma_{\mathrm{step}} = (\sigma,t'_{\ast}/x),\quad\Uparrow\circ(\sigma,t'_{\ast}/x) = \sigma\qquad\text{(by Theorem 2.25)} ⇑ ∘ σ step = ( σ , t ∗ ′ / x ) , ⇑ ∘ ( σ , t ∗ ′ / x ) = σ (by Theorem 2.25)
⇑ ∘ ⇑ ∘ σ s t e p = σ (combining) \Uparrow\circ\Uparrow\circ\sigma_{\mathrm{step}} = \sigma\qquad\text{(combining)} ⇑ ∘ ⇑ ∘ σ step = σ (combining)
x 1 [ σ s t e p ] = t ∗ ′ (de Bruijn lookup at index 1 in σ s t e p ) x_1[\sigma_{\mathrm{step}}] = t'_{\ast} \qquad\text{(de Bruijn lookup at index 1 in }\sigma_{\mathrm{step}}\text{)} x 1 [ σ step ] = t ∗ ′ (de Bruijn lookup at index 1 in σ step )
succ x 1 [ σ s t e p ] = succ x 1 [ σ s t e p ] = succ t ∗ ′ (by syntactic substitution on succ ) \operatorname{succ} x_1[\sigma_{\mathrm{step}}] = \operatorname{succ} x_1[\sigma_{\mathrm{step}}] = \operatorname{succ} t'_{\ast} \qquad\text{(by syntactic substitution on }\operatorname{succ}\text{)} succ x 1 [ σ step ] = succ x 1 [ σ step ] = succ t ∗ ′ (by syntactic substitution on succ )
T [ ⇑ ∘ ⇑ , succ x 1 / x ] [ σ s t e p ] = T [ σ , succ t ∗ ′ / x ] (combining the previous lines) T[\Uparrow\circ\Uparrow,\operatorname{succ} x_1/x][\sigma_{\mathrm{step}}] = T[\sigma,\operatorname{succ} t'_{\ast}/x] \qquad\text{(combining the previous lines)} T [ ⇑ ∘ ⇑ , succ x 1 / x ] [ σ step ] = T [ σ , succ t ∗ ′ / x ] (combining the previous lines)
Δ ⊢ T [ σ , succ t ∗ ′ / x ] ≈ T [ σ , t ∗ / x ] : T y i \Delta\vdash T[\sigma,\operatorname{succ} t'_{\ast}/x] \approx T[\sigma,t_{\ast}/x] : \mathrm{Ty}_i Δ ⊢ T [ σ , succ t ∗ ′ / x ] ≈ T [ σ , t ∗ / x ] : Ty i
(by Theorem 4.14 on Γ , x : N a t ⊢ T : T y i \Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i Γ , x : Nat ⊢ T : Ty i , the substitution σ \sigma σ , and the head equality Δ ⊢ succ t ∗ ≈ t ∗ : N a t \Delta\vdash\operatorname{succ}t_{\ast}\approx t_{\ast}: \mathrm{Nat} Δ ⊢ succ t ∗ ≈ t ∗ : Nat from Δ ⊢ t ∗ ≈ succ t ∗ ′ : N a t \Delta\vdash t_{\ast}\approx\operatorname{succ}t'_{\ast}: \mathrm{Nat} Δ ⊢ t ∗ ≈ succ t ∗ ′ : Nat by symmetry)
Functionality. By the type rewriting, T [ ⇑ ∘ ⇑ , succ x 1 / x ] [ σ s t e p ] = T [ σ , succ t ∗ ′ / x ] T[\Uparrow\circ\Uparrow,\operatorname{succ} x_1/x][\sigma_{\mathrm{step}}] = T[\sigma,\operatorname{succ}t'_{\ast}/x] T [ ⇑ ∘ ⇑ , succ x 1 / x ] [ σ step ] = T [ σ , succ t ∗ ′ / x ] , whose evaluation is ⟦ T ⟧ ( ( ρ , su ( b ′ ) / x ) ) ⇓ a \llbracket T\rrbracket((\rho,\operatorname{su}(b')/x))\mathrel{\Downarrow}a [ [ T ] ] (( ρ , su ( b ′ ) / x )) ⇓ a (the helper’s hypothesis on a a a at b = su ( b ′ ) b=\operatorname{su}(b') b = su ( b ′ ) ). Hence a su ≈ a ∈ U i a^{\operatorname{su}}\approx a\in\mathcal{U}_i a su ≈ a ∈ U i by completeness on Γ , x : N a t ⊢ T : T y i \Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i Γ , x : Nat ⊢ T : Ty i , and E l su ⇔ E l \mathrm{El}^{\operatorname{su}}\Leftrightarrow\mathrm{El} El su ⇔ El by Theorem 7.24.
Conclusion.
Δ ⊢ E ≈ s [ σ s t e p ] : T [ σ , t ∗ / x ] \Delta\vdash E\approx s[\sigma_{\mathrm{step}}] : T[\sigma,t_{\ast}/x] Δ ⊢ E ≈ s [ σ step ] : T [ σ , t ∗ / x ]
(by the β \beta β -su rule combined with Δ ⊢ t ∗ ≈ succ t ∗ ′ : N a t \Delta\vdash t_{\ast}\approx\operatorname{succ}t'_{\ast}:\mathrm{Nat} Δ ⊢ t ∗ ≈ succ t ∗ ′ : Nat and the type rewriting)
Δ ⊢ E : T [ σ , t ∗ / x ] ® r s ∈ E l \Delta\vdash E:T[\sigma,t_{\ast}/x]\ \mathbin{\circledR}\ r_s\in\mathrm{El} Δ ⊢ E : T [ σ , t ∗ / x ] ® r s ∈ El
(by Theorem 7.26)
Take r : = r s r:=r_s r := r s .
Case
G N - N e Δ ⊢ t ∗ : N a t ® ⇑ N ( e ) ∈ N e u i e Δ ⊢ t ∗ : N a t ® ⇑ N ( e ) ∈ N a t \begin{gathered}
\mathrm{GN\text{-}Ne}\\
\Delta\vdash t_{\ast}:\mathrm{Nat}\ \mathbin{\circledR}\ \Uparrow^{N}(e)\in\mathrm{Neu}^{e}_{i}\\
\Delta\vdash t_{\ast}:\mathrm{Nat}\ \mathbin{\circledR}\ \Uparrow^{N}(e)\in\mathrm{Nat}
\end{gathered} GN - Ne Δ ⊢ t ∗ : Nat ® ⇑ N ( e ) ∈ Neu i e Δ ⊢ t ∗ : Nat ® ⇑ N ( e ) ∈ Nat
Here b = ⇑ N ( e ) b=\Uparrow^{N}(e) b = ⇑ N ( e ) , with the type-side neutral predicate giving R n N e ( e ) ⇓ u e R^{\mathrm{Ne}}_n(e)\mathrel{\Downarrow}u_e R n Ne ( e ) ⇓ u e and Δ ′ ′ ⊢ k ϕ : Δ \Delta''\vdash_k\phi:\Delta Δ ′′ ⊢ k ϕ : Δ , n : = ∣ Δ ′ ′ ∣ n:=|\Delta''| n := ∣ Δ ′′ ∣ .
Reduction step. The helper’s hypothesis specializes to ⟦ T ⟧ ( ( ρ , ⇑ N ( e ) / x ) ) ⇓ a \llbracket T\rrbracket((\rho,\Uparrow^{N}(e)/x))\mathrel{\Downarrow}a [ [ T ] ] (( ρ , ⇑ N ( e ) / x )) ⇓ a .
rec ( ⇑ N ( e ) , T , z , s , ρ ) ⇓ ⇑ a ( rec ( T , a z , s , ρ , e ) ) (by REC-NE, where ⟦ z ⟧ ( ρ ) ⇓ a z ) \operatorname{rec}(\Uparrow^{N}(e),T,z,s,\rho)\mathrel{\Downarrow}\Uparrow^{a}(\operatorname{rec}(T,a_z,s,\rho,e))
\qquad\text{(by REC-NE, where }\llbracket z\rrbracket(\rho)\mathrel{\Downarrow}a_z\text{)} rec ( ⇑ N ( e ) , T , z , s , ρ ) ⇓ ⇑ a ( rec ( T , a z , s , ρ , e )) (by REC-NE, where [ [ z ] ] ( ρ ) ⇓ a z )
⇑ N ( e ) ≈ ⇑ N ( e ) ∈ R N a t (by U-NE) \Uparrow^{N}(e)\approx\Uparrow^{N}(e)\in R_{\mathrm{Nat}}
\qquad\text{(by U-NE)} ⇑ N ( e ) ≈ ⇑ N ( e ) ∈ R Nat (by U-NE)
Recursor as a neutral. We verify rec ( T , a z , s , ρ , e ) ∈ N e i a \operatorname{rec}(T,a_z,s,\rho,e)\in\mathrm{Ne}^{a}_{i} rec ( T , a z , s , ρ , e ) ∈ Ne i a at the term E E E . For each Δ ′ ′ ⊢ k ϕ : Δ \Delta''\vdash_k\phi:\Delta Δ ′′ ⊢ k ϕ : Δ , set n : = ∣ Δ ′ ′ ∣ n:=|\Delta''| n := ∣ Δ ′′ ∣ and assemble the four readback components:
R n N e ( e ) ⇓ u e , Δ ′ ′ ⊢ t ∗ [ ϕ ] ≈ u e : N a t R^{\mathrm{Ne}}_n(e)\mathrel{\Downarrow}u_e,\quad\Delta''\vdash t_{\ast}[\phi]\approx u_e:\mathrm{Nat} R n Ne ( e ) ⇓ u e , Δ ′′ ⊢ t ∗ [ ϕ ] ≈ u e : Nat
(by hypothesis on e e e , neutral readback)
R n + 1 T y ( a ) ⇓ W T , Δ ′ ′ , x ′ : N a t ⊢ T [ q ( σ ) ] [ ι ( ϕ ) , x ′ / x ] ≈ W T : T y i R^{\mathrm{Ty}}_{n+1}(a)\mathrel{\Downarrow}W_T,\quad\Delta'',x':\mathrm{Nat}\vdash T[q(\sigma)][\iota(\phi),x'/x]\approx W_T:\mathrm{Ty}_i R n + 1 Ty ( a ) ⇓ W T , Δ ′′ , x ′ : Nat ⊢ T [ q ( σ )] [ ι ( ϕ ) , x ′ / x ] ≈ W T : Ty i
(by Theorem 7.32 part (3) on a ∈ U i ∗ a\in\mathcal{U}^{*}_{i} a ∈ U i ∗ , at the Kripke weakening to Δ ′ ′ , x ′ : N a t \Delta'',x':\mathrm{Nat} Δ ′′ , x ′ : Nat )
⟦ T [ zero / x ] ⟧ ( ρ ) ⇓ A z ′ , A z ′ ∈ U i ∗ ⇓ P z ′ ⇓ E l z ′ \llbracket T[\operatorname{zero}/x]\rrbracket(\rho)\mathrel{\Downarrow}A'_z,\quad A'_z\in\mathcal{U}^{*}_{i}\mathrel{\Downarrow}P'_z\mathrel{\Downarrow}\mathrm{El}'_z [ [ T [ zero / x ] ] ] ( ρ ) ⇓ A z ′ , A z ′ ∈ U i ∗ ⇓ P z ′ ⇓ El z ′
(by hypothesis on z z z via Γ ⊩ z : T [ zero / x ] \Gamma\Vdash z:T[\operatorname{zero}/x] Γ ⊩ z : T [ zero / x ] , type-evaluation and gluing clauses)
Δ ⊢ z [ σ ] : T [ zero / x ] [ σ ] ® a z ∈ E l z ′ \Delta\vdash z[\sigma]:T[\operatorname{zero}/x][\sigma]\ \mathbin{\circledR}\ a_z\in\mathrm{El}'_z Δ ⊢ z [ σ ] : T [ zero / x ] [ σ ] ® a z ∈ El z ′
(by hypothesis on z z z , term clause; with a z : = ⟦ z ⟧ ( ρ ) a_z:=\llbracket z\rrbracket(\rho) a z := [ [ z ] ] ( ρ ) )
⟦ T ⟧ ( ( ρ , z e / x ) ) ⇓ A z \llbracket T\rrbracket((\rho,z_e/x))\mathrel{\Downarrow}A_z [ [ T ] ] (( ρ , z e / x )) ⇓ A z
(type evaluation; the form required by RE-REC)
A z ′ ≈ A z ∈ U i A'_z\approx A_z\in\mathcal{U}_i A z ′ ≈ A z ∈ U i
(by completeness on Γ , x : N a t ⊢ T : T y i \Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i Γ , x : Nat ⊢ T : Ty i instantiated at the substitution ( i d , zero / x ) (\mathrm{id},\operatorname{zero}/x) ( id , zero / x ) )
A z ∈ U i ∗ ↘ P z ↘ E l z , E l z ′ ⇔ E l z A_z \in\mathcal{U}_i^* \searrow P_z \searrow\mathrm{El}_z,\mathrm{El}'_z \Leftrightarrow\mathrm{El}_z A z ∈ U i ∗ ↘ P z ↘ El z , El z ′ ⇔ El z
(by Theorem 7.27 and Theorem 7.24)
R n N f ( ↓ A z ( a z ) ) ↘ w z R^{\mathrm{Nf}}_n(\downarrow A_z(a_z)) \searrow w_z R n Nf ( ↓ A z ( a z )) ↘ w z
(by Theorem 7.32 part (2) on a z ∈ E l z a_z \in\mathrm{El}_z a z ∈ El z )
Δ ′ ′ ⊢ z [ σ ] [ ϕ ] ≈ w z : T [ z e r o / x ] [ σ ] [ ϕ ] \Delta^{\prime\prime} \vdash z[\sigma][\phi] \approx w_z : T[\mathrm{zero}/x][\sigma][\phi] Δ ′′ ⊢ z [ σ ] [ ϕ ] ≈ w z : T [ zero / x ] [ σ ] [ ϕ ]
(after term-side type-bridging via Theorem 7.26)
⟦ T ⟧ ( ( ρ , su ( ↑ N ( ℓ n ) ) / x ) ) ↘ A s \llbracket T\rrbracket((\rho,\operatorname{su}(\uparrow^{N}(\ell_n))/x)) \searrow A_s [ [ T ] ] (( ρ , su ( ↑ N ( ℓ n )) / x )) ↘ A s
(type evaluation at the fresh-step head su ( ℓ n ) \operatorname{su}(\ell_n) su ( ℓ n ) )
⟦ s ⟧ ( ρ , ↑ N ( ℓ n ) / x , ↑ A p ( ℓ n + 1 ) / y ) ↘ b s \llbracket s\rrbracket(\rho,\uparrow^{N}(\ell_n)/x,\uparrow^{A_p}(\ell_{n+1})/y) \searrow b_s [ [ s ] ] ( ρ , ↑ N ( ℓ n ) / x , ↑ A p ( ℓ n + 1 ) / y ) ↘ b s
(step branch evaluated at the fresh-neutral pair, where A p : = ⟦ T ⟧ ( ( ρ , ↑ N ( ℓ n ) / x ) ) A_p := \llbracket T\rrbracket((\rho,\uparrow^{N}(\ell_n)/x)) A p := [ [ T ] ] (( ρ , ↑ N ( ℓ n ) / x )) )
R n + 2 N f ( ↓ A s ( b s ) ) ↘ w s R^{\mathrm{Nf}}_{n+2}(\downarrow A_s(b_s)) \searrow w_s R n + 2 Nf ( ↓ A s ( b s )) ↘ w s
(by Theorem 7.32 part (2) on the step value)
Δ s ⊢ s [ q ( q ( σ ) ) ] [ ι ( ι ( ϕ ) ) ] ≈ w s \Delta_s \vdash s[q(q(\sigma))][\iota(\iota(\phi))] \approx w_s Δ s ⊢ s [ q ( q ( σ ))] [ ι ( ι ( ϕ ))] ≈ w s
: T [ q ( σ ) ] [ ι ( ϕ ) , succ x ′ / x ] : T[q(\sigma)][\iota(\phi),\operatorname{succ}x'/x] : T [ q ( σ )] [ ι ( ϕ ) , succ x ′ / x ]
(at the corresponding type, where Δ s : = Δ ′ ′ , x ′ : N a t , y ′ : T [ q ( σ ) ] [ ι ( ϕ ) , x ′ / x ] \Delta_s := \Delta^{\prime\prime},x':\mathrm{Nat},y':T[q(\sigma)][\iota(\phi),x'/x] Δ s := Δ ′′ , x ′ : Nat , y ′ : T [ q ( σ )] [ ι ( ϕ ) , x ′ / x ] )
R n N e ( rec ( T , a z , s , ρ , e ) ) R^{\mathrm{Ne}}_n(\operatorname{rec}(T,a_z,s,\rho,e)) R n Ne ( rec ( T , a z , s , ρ , e ))
↘ elim N a t ( x . W T ) w z ( x , y . w s ) u e \searrow\operatorname{elim}_{\mathrm{Nat}}(x.W_T)\ w_z\ (x,y.w_s)\ u_e ↘ elim Nat ( x . W T ) w z ( x , y . w s ) u e
(by RNE-REC)
Δ ′ ′ ⊢ E [ ϕ ] ≈ elim N a t ( x . W T ) w z ( x , y . w s ) u e \Delta^{\prime\prime}\vdash E[\phi]\approx\operatorname{elim}_{\mathrm{Nat}}(x.W_T)\ w_z\ (x,y.w_s)\ u_e Δ ′′ ⊢ E [ ϕ ] ≈ elim Nat ( x . W T ) w z ( x , y . w s ) u e
: T [ σ , t ∗ / x ] [ ϕ ] :T[\sigma,t_*/x][\phi] : T [ σ , t ∗ / x ] [ ϕ ]
(by N-E-Cong on the four readback equalities)
Type-side gluing. The helper’s hypothesis already gives the type-side gluing of T [ σ , t ∗ / x ] T[\sigma,t_*/x] T [ σ , t ∗ / x ] at P P P (via the outer Γ , x : N a t ⊩ T : T y i \Gamma,x:\mathrm{Nat}\Vdash T:\mathrm{Ty}_i Γ , x : Nat ⊩ T : Ty i instantiation that produced a , P , E l a,P,\mathrm{El} a , P , El ).
Conclusion.
Δ ⊢ E : T [ σ , t ∗ / x ] ⊚ rec ( T , a z , s , ρ , e ) ∈ N e i a \Delta\vdash E:T[\sigma,t_*/x]\ \mathbin{\circledcirc}\ \operatorname{rec}(T,a_z,s,\rho,e)\in\mathrm{Ne}^{a}_i Δ ⊢ E : T [ σ , t ∗ / x ] ⊚ rec ( T , a z , s , ρ , e ) ∈ Ne i a
(by Theorem 7.6 from the previous block)
Δ ⊢ E : T [ σ , t ∗ / x ] ⊚ ↑ a ( rec ( T , a z , s , ρ , e ) ) ∈ E l \Delta\vdash E:T[\sigma,t_*/x]\ \mathbin{\circledcirc}\ \uparrow^{a}(\operatorname{rec}(T,a_z,s,\rho,e))\in\mathrm{El} Δ ⊢ E : T [ σ , t ∗ / x ] ⊚ ↑ a ( rec ( T , a z , s , ρ , e )) ∈ El
(by Theorem 7.32 part (1) on a ∈ U i ∗ a\in\mathcal{U}_i^* a ∈ U i ∗ )
Take r : = ↑ a ( rec ( T , a z , s , ρ , e ) ) r:=\uparrow^{a}(\operatorname{rec}(T,a_z,s,\rho,e)) r := ↑ a ( rec ( T , a z , s , ρ , e )) . □
Lemma 7.45 (Semantic – N-E). If Γ , x : N a t ⊢ T : T y i \Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i Γ , x : Nat ⊢ T : Ty i , Γ ⊢ z : T [ z e r o / x ] \Gamma\vdash z:T[\mathrm{zero}/x] Γ ⊢ z : T [ zero / x ] , Γ , x : N a t , y : T ⊢ s : T [ ↑ ∘ ↑ , succ x 1 / x ] \Gamma,x:\mathrm{Nat},y:T\vdash s:T[\uparrow\circ\uparrow,\operatorname{succ}x_1/x] Γ , x : Nat , y : T ⊢ s : T [ ↑ ∘ ↑ , succ x 1 / x ] , and Γ ⊢ t : N a t \Gamma\vdash t:\mathrm{Nat} Γ ⊢ t : Nat , then Γ ⊢ elim N a t ( x . T ) z ( x , y . s ) t : T [ t / x ] \Gamma\vdash\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t:T[t/x] Γ ⊢ elim Nat ( x . T ) z ( x , y . s ) t : T [ t / x ] .
Proof. If Γ \Gamma Γ is presupposed by the hypotheses. Fix Γ ↘ S b \Gamma\searrow\mathrm{Sb} Γ ↘ Sb and let Δ ⊢ σ : Γ ⊚ ρ ∈ S b \Delta\vdash\sigma:\Gamma\mathbin{\circledcirc}\rho\in\mathrm{Sb} Δ ⊢ σ : Γ ⊚ ρ ∈ Sb be given.
⟦ t ⟧ ( ρ ) ↘ a \llbracket t\rrbracket(\rho)\searrow a [ [ t ] ] ( ρ ) ↘ a
(by hypothesis on t t t , evaluation clause)
Δ ⊢ t [ σ ] : N a t [ σ ] ⊚ a ∈ N a t i \Delta\vdash t[\sigma]:\mathrm{Nat}[\sigma]\mathbin{\circledcirc}a\in\mathrm{Nat}_i Δ ⊢ t [ σ ] : Nat [ σ ] ⊚ a ∈ Nat i
(by hypothesis on t t t , term clause)
Δ ⊢ N a t [ σ ] ≈ N a t : T y 0 \Delta\vdash\mathrm{Nat}[\sigma]\approx\mathrm{Nat}:\mathrm{Ty}_0 Δ ⊢ Nat [ σ ] ≈ Nat : Ty 0
(syntactic; closed)
Δ ⊢ t [ σ ] : N a t ⊚ a ∈ N a t i \Delta\vdash t[\sigma]:\mathrm{Nat}\mathbin{\circledcirc}a\in\mathrm{Nat}_i Δ ⊢ t [ σ ] : Nat ⊚ a ∈ Nat i
(by Theorem 7.26)
Build the substitution pair for T T T :
σ T : = ( σ , t [ σ ] / x ) \sigma_T:=(\sigma,t[\sigma]/x) σ T := ( σ , t [ σ ] / x )
(definition)
Δ ⊢ σ T : Γ , x : N a t ⊚ ( ρ , a / x ) ∈ S b x : N a t \Delta\vdash\sigma_T:\Gamma,x:\mathrm{Nat}\mathbin{\circledcirc}(\rho,a/x)\in\mathrm{Sb}_{x:\mathrm{Nat}} Δ ⊢ σ T : Γ , x : Nat ⊚ ( ρ , a / x ) ∈ Sb x : Nat
(by Cons0 _0 0 on Sb, head a ∈ N a t i a\in\mathrm{Nat}_i a ∈ Nat i realized by t [ σ ] t[\sigma] t [ σ ] )
⟦ T ⟧ ( ( ρ , a / x ) ) ↘ a T \llbracket T\rrbracket((\rho,a/x))\searrow a_T [ [ T ] ] (( ρ , a / x )) ↘ a T
(by hypothesis on T T T at σ T \sigma_T σ T , ( ρ , a / x ) (\rho,a/x) ( ρ , a / x ) )
a T ∈ U i ∗ ↘ P T ↘ E l T a_T\in\mathcal{U}_i^*\searrow P_T\searrow\mathrm{El}_T a T ∈ U i ∗ ↘ P T ↘ El T
(by hypothesis on T T T , gluing clause)
Δ ⊢ T [ σ T ] : T y i ⊚ P T \Delta\vdash T[\sigma_T]:\mathrm{Ty}_i\mathbin{\circledcirc}P_T Δ ⊢ T [ σ T ] : Ty i ⊚ P T
(by hypothesis on T T T , type clause)
By Theorem 7.44 on t ∗ : = t [ σ ] t_*:=t[\sigma] t ∗ := t [ σ ] , b : = a b:=a b := a , with the data above:
rec ( a , T , z , s , ρ ) ↘ r \operatorname{rec}(a,T,z,s,\rho)\searrow r rec ( a , T , z , s , ρ ) ↘ r
(by helper)
Δ ⊢ elim N a t ( x . T [ q ( σ ) ] ) z [ σ ] ( x , y . s [ q ( q ( σ ) ) ] ) t [ σ ] : T [ σ , t [ σ ] / x ] ® r ∈ E l T (by helper) \Delta\vdash\operatorname{elim}_{\mathrm{Nat}}\left(x.T[q(\sigma)]\right)z[\sigma]\left(x,y.s[q(q(\sigma))]\right)t[\sigma] : T[\sigma,t[\sigma]/x] \mathbin{\circledR} r \in\mathrm{El}_{T}
\qquad\text{(by helper)} Δ ⊢ elim Nat ( x . T [ q ( σ )] ) z [ σ ] ( x , y . s [ q ( q ( σ ))] ) t [ σ ] : T [ σ , t [ σ ] / x ] ® r ∈ El T (by helper)
⟦ elim N a t ( x . T ) z ( x , y . s ) t ⟧ ( ρ ) ↘ r (by ev-rec) \llbracket\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t \rrbracket(\rho) \searrow r
\qquad\text{(by ev-rec)} [ [ elim Nat ( x . T ) z ( x , y . s ) t ] ] ( ρ ) ↘ r (by ev-rec)
( elim N a t ( x . T ) z ( x , y . s ) t ) [ σ ] = elim N a t ( x . T [ q ( σ ) ] ) z [ σ ] ( x , y . s [ q ( q ( σ ) ) ] ) t [ σ ] (by syntactic substitution on elim N a t ) T [ σ T ] = T [ σ , t [ σ ] / x ] = T [ t / x ] [ σ ] (by Theorem 2.30) \begin{aligned}
(\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t)[\sigma]
&= \operatorname{elim}_{\mathrm{Nat}}\left(x.T[q(\sigma)]\right)z[\sigma]\left(x,y.s[q(q(\sigma))]\right)t[\sigma]
&& \text{(by syntactic substitution on }\operatorname{elim}_{\mathrm{Nat}}\text{)}\\
T[\sigma_T]&=T[\sigma,t[\sigma]/x]=T[t/x][\sigma]
&& \text{(by Theorem 2.30)}
\end{aligned} ( elim Nat ( x . T ) z ( x , y . s ) t ) [ σ ] T [ σ T ] = elim Nat ( x . T [ q ( σ )] ) z [ σ ] ( x , y . s [ q ( q ( σ ))] ) t [ σ ] = T [ σ , t [ σ ] / x ] = T [ t / x ] [ σ ] (by syntactic substitution on elim Nat ) (by Theorem 2.30)
We assemble the four clauses of Γ ⊩ : f \Gamma\Vdash\mathord{:} f Γ ⊩ : f or the conclusion at a : = a T a := a_T a := a T , P : = P T P := P_T P := P T , E l : = E l T \mathrm{El} := \mathrm{El}_T El := El T :
⟦ T [ t / x ] ⟧ ( ρ ) ↘ a T (via the equality ⟦ T [ t / x ] ⟧ ( ρ ) = ⟦ T ⟧ ( ( ρ , a / x ) ) established by Theorem 6.73 of Sec. 6 on Γ , x : N a t ⊢ T : T y i ) [clause 1] a T ∈ U i ∗ ↘ P T ↘ E l T (established above) [clause 2] Δ ⊢ T [ t / x ] [ σ ] : T y i ® P T (by rewriting the T [ σ T ] identity) [clause 3] Δ ⊢ ( elim N a t ( x . T ) z ( x , y . s ) t ) [ σ ] : T [ t / x ] [ σ ] ® r ∈ E l T (by rewriting via the syntactic identity above) [clause 4] \begin{aligned}
\llbracket T[t/x]\rrbracket(\rho)&\searrow a_T
&&\text{(via the equality }\llbracket T[t/x]\rrbracket(\rho)=\llbracket T\rrbracket((\rho,a/x))\text{ established by}\\
&&&\text{Theorem 6.73 of Sec. 6 on }\Gamma,x:\mathrm{Nat}\vdash T:\mathrm{Ty}_i)
&&\text{[clause 1]}\\
a_T&\in\mathcal{U}_i^* \searrow P_T \searrow\mathrm{El}_T
&&\text{(established above)}
&&\text{[clause 2]}\\
\Delta\vdash T[t/x][\sigma]&:\mathrm{Ty}_i\mathbin{\circledR}P_T
&&\text{(by rewriting the }T[\sigma_T]\text{ identity)}
&&\text{[clause 3]}\\
\Delta\vdash(\operatorname{elim}_{\mathrm{Nat}}(x.T)\ z\ (x,y.s)\ t)[\sigma]&:T[t/x][\sigma]\\
\mathbin{\circledR}r&\in\mathrm{El}_T
&&\text{(by rewriting via the syntactic identity above)}
&&\text{[clause 4]}
\end{aligned} [ [ T [ t / x ] ] ] ( ρ ) a T Δ ⊢ T [ t / x ] [ σ ] Δ ⊢ ( elim Nat ( x . T ) z ( x , y . s ) t ) [ σ ] ® r ↘ a T ∈ U i ∗ ↘ P T ↘ El T : Ty i ® P T : T [ t / x ] [ σ ] ∈ El T (via the equality [ [ T [ t / x ] ] ] ( ρ ) = [ [ T ] ] (( ρ , a / x )) established by Theorem 6.73 of Sec. 6 on Γ , x : Nat ⊢ T : Ty i ) (established above) (by rewriting the T [ σ T ] identity) (by rewriting via the syntactic identity above) [clause 1] [clause 2] [clause 3] [clause 4]
Lemma 7.46 (Semantic — Subsump). If Γ ⊩ t : S \Gamma\Vdash t:S Γ ⊩ t : S , Γ ⊩ T : T y i \Gamma\Vdash T:\mathrm{Ty}_i Γ ⊩ T : Ty i , and Γ ⊢ S ⊆ T \Gamma\vdash S \subseteq T Γ ⊢ S ⊆ T , then Γ ⊩ t : T \Gamma\Vdash t:T Γ ⊩ t : T .
Proof. ⊩ Γ \Vdash\Gamma ⊩ Γ is presupposed by the hypotheses. Fix Γ ↘ S b \Gamma\searrow\mathrm{Sb} Γ ↘ Sb and let Δ ⊢ σ : Γ ® ρ ∈ S b \Delta\vdash\sigma:\Gamma\mathbin{\circledR}\rho\in\mathrm{Sb} Δ ⊢ σ : Γ ® ρ ∈ Sb be given. By Theorem 6.73 of Sec. 6 on Γ ⊢ S ⊆ T \Gamma\vdash S\subseteq T Γ ⊢ S ⊆ T , we obtain the semantic subtyping judgment Γ ⊨ S ⊆ T \Gamma\models S\subseteq T Γ ⊨ S ⊆ T (Theorem 6.32).
⟦ S ⟧ ( ρ ) ↘ a S , a S ∈ U i ∗ ↘ P S ↘ E l S (by hypothesis on t , evaluation and gluing clauses) ⟦ T ⟧ ( ρ ) ↘ a T , a T ∈ U i ∗ ↘ P T ↘ E l T (by hypothesis on T , evaluation and gluing clauses) Δ ⊢ t [ σ ] : S [ σ ] ® ⟦ t ⟧ ( ρ ) ∈ E l S (by hypothesis on t , term clause) ρ ≈ ρ ∈ R Γ (by Theorem 7.21 on ρ ∈ S b ) Γ ⊢ i d ≈ i d : Γ (by Theorem 6.36) a S < : i a T (by Γ ⊨ S ⊆ T instantiated at the identity semantic substitution and ρ ≈ ρ : the inner-pair relation gives ⟦ S ⟧ ( ⟦ i d ⟧ ( ρ ) ) < : i ⟦ T ⟧ ( ⟦ i d ⟧ ( ρ ) ) , which is ⟦ S ⟧ ( ρ ) < : i ⟦ T ⟧ ( ρ ) Δ ⊢ T [ σ ] : T y i ® P T (by hypothesis on T , type clause) Δ ⊢ t [ σ ] : T [ σ ] ® ⟦ t ⟧ ( ρ ) ∈ E l T (by Theorem 7.31 on a S < : i a T , a S ∈ E l S , and T [ σ ] ® P T ) \begin{aligned}
\llbracket S\rrbracket(\rho)&\searrow a_S,\quad a_S\in\mathcal{U}_i^*\searrow P_S\searrow\mathrm{El}_S
&&\text{(by hypothesis on }t\text{, evaluation and gluing clauses)}\\
\llbracket T\rrbracket(\rho)&\searrow a_T,\quad a_T\in\mathcal{U}_i^*\searrow P_T\searrow\mathrm{El}_T
&&\text{(by hypothesis on }T\text{, evaluation and gluing clauses)}\\
\Delta\vdash t[\sigma]&:S[\sigma]\mathbin{\circledR}\llbracket t\rrbracket(\rho)\in\mathrm{El}_S
&&\text{(by hypothesis on }t\text{, term clause)}\\
\rho&\approx\rho\in R_\Gamma
&&\text{(by Theorem 7.21 on }\rho\in\mathrm{Sb}\text{)}\\
\Gamma&\vdash\mathrm{id}\approx\mathrm{id}:\Gamma
&&\text{(by Theorem 6.36)}\\
a_S&<:_i a_T
&&\text{(by }\Gamma\models S\subseteq T\text{ instantiated at}\\
&&&\text{the identity semantic substitution and }\rho\approx\rho\text{:}\\
&&&\text{the inner-pair relation gives }\llbracket S\rrbracket(\llbracket\mathrm{id}\rrbracket(\rho))<:_i\llbracket T\rrbracket(\llbracket\mathrm{id}\rrbracket(\rho)),\\
&&&\text{which is }\llbracket S\rrbracket(\rho)<:_i\llbracket T\rrbracket(\rho)\\
\Delta\vdash T[\sigma]&:\mathrm{Ty}_i\mathbin{\circledR}P_T
&&\text{(by hypothesis on }T\text{, type clause)}\\
\Delta\vdash t[\sigma]&:T[\sigma]\mathbin{\circledR}\llbracket t\rrbracket(\rho)\in\mathrm{El}_T
&&\text{(by Theorem 7.31 on }a_S<:_i a_T,\ a_S\in\mathrm{El}_S,\\
&&&\text{and }T[\sigma]\mathbin{\circledR}P_T\text{)}
\end{aligned} [ [ S ] ] ( ρ ) [ [ T ] ] ( ρ ) Δ ⊢ t [ σ ] ρ Γ a S Δ ⊢ T [ σ ] Δ ⊢ t [ σ ] ↘ a S , a S ∈ U i ∗ ↘ P S ↘ El S ↘ a T , a T ∈ U i ∗ ↘ P T ↘ El T : S [ σ ] ® [ [ t ] ] ( ρ ) ∈ El S ≈ ρ ∈ R Γ ⊢ id ≈ id : Γ < : i a T : Ty i ® P T : T [ σ ] ® [ [ t ] ] ( ρ ) ∈ El T (by hypothesis on t , evaluation and gluing clauses) (by hypothesis on T , evaluation and gluing clauses) (by hypothesis on t , term clause) (by Theorem 7.21 on ρ ∈ Sb ) (by Theorem 6.36) (by Γ ⊨ S ⊆ T instantiated at the identity semantic substitution and ρ ≈ ρ : the inner-pair relation gives [ [ S ] ] ( [ [ id ] ] ( ρ )) < : i [ [ T ] ] ( [ [ id ] ] ( ρ )) , which is [ [ S ] ] ( ρ ) < : i [ [ T ] ] ( ρ ) (by hypothesis on T , type clause) (by Theorem 7.31 on a S < : i a T , a S ∈ El S , and T [ σ ] ® P T )
The Fundamental Theorem
Theorem 7.47 (Fundamental Theorem (Soundness)).
If ⊢ Γ \vdash\Gamma ⊢ Γ , then ⊩ Γ \Vdash\Gamma ⊩ Γ .
If Γ ⊢ t : T \Gamma\vdash t:T Γ ⊢ t : T , then ⊩ Γ \Vdash\Gamma ⊩ Γ and Γ ⊩ t : T \Gamma\Vdash t:T Γ ⊩ t : T .
Proof. By simultaneous induction on the well-formedness derivation ⊢ Γ \vdash\Gamma ⊢ Γ and the typing derivation Γ ⊢ t : T \Gamma\vdash t:T Γ ⊢ t : T . The presupposition ⊢ Γ \vdash\Gamma ⊢ Γ inherent in Γ ⊢ t : T \Gamma\vdash t:T Γ ⊢ t : T produces ⊩ Γ \Vdash\Gamma ⊩ Γ through part (1) at each step; semantic rules in Sec. 7.7 consume ⊩ Γ \Vdash\Gamma ⊩ Γ wherever needed. Each case applies the corresponding semantic-rule lemma:
Each lemma’s ⊩ \Vdash ⊩ -hypotheses are supplied by part (1) on the corresponding ⊢ \vdash ⊢ -premise of its syntactic rule; its Γ ⊩ \Gamma\Vdash Γ ⊩ -hypotheses are the IHs from the typing premises. □
Initial Environment and Soundness
Theorem 7.48 (Soundness of NbE). If Γ ⊢ t : T \Gamma\vdash t : T Γ ⊢ t : T , then nbe Γ T ( t ) = v \operatorname{nbe}_{\Gamma}^{T}(t) = v nbe Γ T ( t ) = v for some v v v with Γ ⊢ t ≈ v : T \Gamma\vdash t \approx v : T Γ ⊢ t ≈ v : T .
Proof.
⊩ Γ , Γ ⊩ t : T (by Theorem 7.47 part (2)) Γ ↘ S b (by Theorem 7.17 on ⊩ Γ ) Γ ⊢ i d : Γ ® ↑ Γ ∈ S b (by Theorem 7.33 on Γ ↘ S b ) ⟦ T ⟧ ( ↑ Γ ) ↘ a , a ∈ U i ∗ ↘ P ↘ E l (unfolding ⊩ at i d , ↑ Γ ) Γ ⊢ t [ i d ] : T [ i d ] ® ⟦ t ⟧ ( ↑ Γ ) ∈ E l (unfolding ⊩ at i d , ↑ Γ ) T [ i d ] = T , t [ i d ] = t (by left-id of substitution) Γ ⊢ t : T ® b ∈ N f i a where b = ⟦ t ⟧ ( ↑ Γ ) (by Theorem 7.32 part (2)) R Γ ⊢ T N f ( ↓ a ( b ) ) ↘ v , Γ ⊢ t [ i d ] ≈ v : T [ i d ] (Kripke condition at ϕ = i d ) Γ ⊢ t ≈ v : T (using t [ i d ] = t , T [ i d ] = T ) nbe Γ T ( t ) = v (by Theorem 5.5: evaluation followed by readback) \begin{aligned}
&\Vdash\Gamma,\ \Gamma\Vdash t : T && \text{(by Theorem 7.47 part (2))}\\
&\Gamma\searrow\mathrm{Sb} && \text{(by Theorem 7.17 on }\Vdash\Gamma\text{)}\\
&\Gamma\vdash\mathrm{id} : \Gamma\mathbin{\circledR} \uparrow\Gamma\in\mathrm{Sb} && \text{(by Theorem 7.33 on }\Gamma\searrow\mathrm{Sb}\text{)}\\
&\llbracket T \rrbracket(\uparrow\Gamma) \searrow a,\ a \in\mathcal{U}^{*}_{i} \searrow P \searrow\mathrm{El} && \text{(unfolding }\Vdash\text{ at }\mathrm{id},\uparrow\Gamma\text{)}\\
&\Gamma\vdash t[\mathrm{id}] : T[\mathrm{id}] \mathbin{\circledR} \llbracket t \rrbracket(\uparrow\Gamma) \in\mathrm{El} && \text{(unfolding }\Vdash\text{ at }\mathrm{id},\uparrow\Gamma\text{)}\\
&T[\mathrm{id}] = T,\ t[\mathrm{id}] = t && \text{(by left-id of substitution)}\\
&\Gamma\vdash t : T \mathbin{\circledR} b \in\mathrm{Nf}^{a}_{i}\ \text{where } b = \llbracket t \rrbracket(\uparrow\Gamma) && \text{(by Theorem 7.32 part (2))}\\
&\mathrm{R}^{\mathrm{Nf}}_{\Gamma\vdash T}(\downarrow^{a}(b)) \searrow v,\ \Gamma\vdash t[\mathrm{id}] \approx v : T[\mathrm{id}] && \text{(Kripke condition at }\phi=\mathrm{id}\text{)}\\
&\Gamma\vdash t \approx v : T && \text{(using }t[\mathrm{id}] = t,T[\mathrm{id}] = T\text{)}\\
&\operatorname{nbe}_{\Gamma}^{T}(t) = v && \text{(by Theorem 5.5: evaluation followed by readback)}
\end{aligned} ⊩ Γ , Γ ⊩ t : T Γ ↘ Sb Γ ⊢ id : Γ ® ↑ Γ ∈ Sb [ [ T ] ] ( ↑ Γ ) ↘ a , a ∈ U i ∗ ↘ P ↘ El Γ ⊢ t [ id ] : T [ id ] ® [ [ t ] ] ( ↑ Γ ) ∈ El T [ id ] = T , t [ id ] = t Γ ⊢ t : T ® b ∈ Nf i a where b = [ [ t ] ] ( ↑ Γ ) R Γ ⊢ T Nf ( ↓ a ( b )) ↘ v , Γ ⊢ t [ id ] ≈ v : T [ id ] Γ ⊢ t ≈ v : T nbe Γ T ( t ) = v (by Theorem 7.47 part (2)) (by Theorem 7.17 on ⊩ Γ ) (by Theorem 7.33 on Γ ↘ Sb ) (unfolding ⊩ at id , ↑ Γ ) (unfolding ⊩ at id , ↑ Γ ) (by left-id of substitution) (by Theorem 7.32 part (2)) (Kripke condition at ϕ = id ) (using t [ id ] = t , T [ id ] = T ) (by Theorem 5.5: evaluation followed by readback)
Discussion
The soundness proof via the Kripke gluing model has a clean structure:
The type gluing model U i ∗ \mathcal{U}^{*}_{i} U i ∗ mirrors the PER model U i \mathcal{U}_{i} U i but is unary, returning predicates P P P and E l \mathrm{El} El that connect syntax with semantics.
The Kripke structure (universal quantification over Kripke weakenings) replaces the traditional approach of parameterizing by context extensions. the substitution composition law t [ ϕ ] [ ψ ] = t [ ϕ ∘ ψ ] t[\phi][\psi] = t[\phi\circ\psi] t [ ϕ ] [ ψ ] = t [ ϕ ∘ ψ ] from Sec. 2 makes monotonicity proofs go through.
Realizability (Theorem 7.32) is the central mutual theorem providing reflection, reification, and type-readback as a unit.
The semantic typing rules (Sec. 7.7) are stated per syntactic rule, mirroring the structure of Sec. 6.17.
Together with completeness (Sec. 6), this gives the full correctness:
Soundness: Γ ⊢ t : T \Gamma\vdash t : T Γ ⊢ t : T implies Γ ⊢ t ≈ nbe Γ T ( t ) : T \Gamma\vdash t \approx\operatorname{nbe}_{\Gamma}^{T}(t) : T Γ ⊢ t ≈ nbe Γ T ( t ) : T .
Completeness: Γ ⊢ t ≈ t ′ : T \Gamma\vdash t \approx t' : T Γ ⊢ t ≈ t ′ : T implies nbe Γ T ( t ) = nbe Γ T ( t ′ ) \operatorname{nbe}_{\Gamma}^{T}(t) = \operatorname{nbe}_{\Gamma}^{T}(t') nbe Γ T ( t ) = nbe Γ T ( t ′ ) .
Corollary 7.49 (Decidability of Judgmental Equality). Given Γ ⊢ s : T \Gamma\vdash s : T Γ ⊢ s : T and Γ ⊢ t : T \Gamma\vdash t : T Γ ⊢ t : T , the judgment Γ ⊢ s ≈ t : T \Gamma\vdash s \approx t : T Γ ⊢ s ≈ t : T is decidable.
Proof. By soundness, Γ ⊢ s ≈ nbe Γ T ( s ) : T \Gamma\vdash s \approx\operatorname{nbe}_{\Gamma}^{T}(s) : T Γ ⊢ s ≈ nbe Γ T ( s ) : T and Γ ⊢ t ≈ nbe Γ T ( t ) : T \Gamma\vdash t \approx\operatorname{nbe}_{\Gamma}^{T}(t) : T Γ ⊢ t ≈ nbe Γ T ( t ) : T . By completeness, Γ ⊢ s ≈ t : T \Gamma\vdash s \approx t : T Γ ⊢ s ≈ t : T iff nbe Γ T ( s ) = nbe Γ T ( t ) \operatorname{nbe}_{\Gamma}^{T}(s) = \operatorname{nbe}_{\Gamma}^{T}(t) nbe Γ T ( s ) = nbe Γ T ( t ) . Comparing normal forms is decidable. □
References