## Type Theory Rules
### Overview
The image presents a set of type theory rules, likely related to a dynamic semantics or type system. Each rule is formatted as an inference rule, with premises above a horizontal line and a conclusion below. The rules cover various aspects of type checking and evaluation, including reflexivity, variable lookup, transitivity, value substitution, hole filling, and stack substitution.
### Components/Axes
The image contains six distinct inference rules, each labeled with a name starting with "TmDyn". The rules involve various type environments (Γ, Δ, Φ, Ψ), terms (E, V, M), types (T, A, B), and variables (x). The symbol "⊑" represents a subtyping or containment relation.
### Detailed Analysis
**1. Top-Right Box:**
* Text: "Φ ⊢ V ⊑ V': A ⊑ A' and Φ | Ψ ⊢ M ⊑ M': B ⊑ B'"
* This appears to be a general condition or context applicable to some of the rules. It states that V is a subtype of V' with type A a subtype of A', and M is a subtype of M' with type B a subtype of B', all under contexts Φ and Ψ.
**2. TmDynRefl (Top-Left):**
* Rule:
```
Γ ⊑ Γ | Δ ⊑ Δ ⊢ E ⊑ E : T ⊑ T
```
* This rule states that if the type environment Γ is a subtype of itself, Δ is a subtype of itself, then E is a subtype of itself with type T a subtype of itself. This represents a reflexivity property.
**3. TmDynVar (Top-Right):**
* Rule:
```
Φ, x ⊑ x' : A ⊑ A', Φ' ⊢ x ⊑ x' : A ⊑ A'
```
* This rule states that if x is a subtype of x' with type A a subtype of A' in the context Φ, then x is a subtype of x' with type A a subtype of A' in the context Φ'. This represents variable lookup.
**4. TmDynTrans (Middle-Left):**
* Rule:
```
Γ ⊑ Γ' | Δ ⊑ Δ' ⊢ E ⊑ E' : T ⊑ T'
Γ' ⊑ Γ'' | Δ' ⊑ Δ'' ⊢ E' ⊑ E'' : T' ⊑ T''
--------------------------------------------------
Γ ⊑ Γ'' | Δ ⊑ Δ'' ⊢ E ⊑ E'' : T ⊑ T''
```
* This rule states that if Γ is a subtype of Γ', Δ is a subtype of Δ', and E is a subtype of E' with type T a subtype of T', and Γ' is a subtype of Γ'', Δ' is a subtype of Δ'', and E' is a subtype of E'' with type T' a subtype of T'', then Γ is a subtype of Γ'', Δ is a subtype of Δ'', and E is a subtype of E'' with type T a subtype of T''. This represents a transitivity property.
**5. TmDynValSubst (Middle-Right):**
* Rule:
```
Φ ⊢ V ⊑ V' : A ⊑ A'
Φ, x ⊑ x' : A ⊑ A', Φ' | Ψ ⊢ E ⊑ E' : T ⊑ T'
--------------------------------------------------
Φ | Ψ ⊢ E[V/x] ⊑ E'[V'/x'] : T ⊑ T'
```
* This rule states that if V is a subtype of V' with type A a subtype of A', and E is a subtype of E' with type T a subtype of T' in the context Φ, then E[V/x] is a subtype of E'[V'/x'] with type T a subtype of T' in the context Φ. This represents value substitution.
**6. TmDynHole (Bottom-Left):**
* Rule:
```
Φ | • ⊑ • : B ⊑ B' ⊢ • ⊑ • : B ⊑ B'
```
* This rule states that if the hole "•" is a subtype of itself with type B a subtype of B', then the hole "•" is a subtype of itself with type B a subtype of B'. This represents a hole filling.
**7. TmDynStkSubst (Bottom-Right):**
* Rule:
```
Φ | Ψ ⊢ M₁ ⊑ M₁' : B₁ ⊑ B₁'
Φ | • ⊑ • : B₁ ⊑ B₁' ⊢ M₂ ⊑ M₂' : B₂ ⊑ B₂'
--------------------------------------------------
Φ | Ψ ⊢ M₂[M₁/•] ⊑ M₂'[M₁'/•] : B₂ ⊑ B₂'
```
* This rule states that if M₁ is a subtype of M₁' with type B₁ a subtype of B₁', and M₂ is a subtype of M₂' with type B₂ a subtype of B₂', then M₂[M₁/•] is a subtype of M₂'[M₁'/•] with type B₂ a subtype of B₂'. This represents stack substitution.
### Key Observations
* The rules define a subtyping relation between terms and types.
* The rules are inference rules, meaning that the conclusion is valid if the premises are valid.
* The rules cover various aspects of type checking and evaluation, including reflexivity, variable lookup, transitivity, value substitution, and stack substitution.
### Interpretation
The rules likely define a dynamic semantics for a type system. The subtyping relation allows for flexibility in type checking, as a term of a subtype can be used where a term of a supertype is expected. The rules ensure that the subtyping relation is preserved during evaluation. The presence of rules for hole filling and stack substitution suggests that the type system may be used for program synthesis or interactive development. The rules are foundational for ensuring type safety and correctness in a programming language or system.