Interpretations of two-level binding families #
A model of a stacked family interprets its type level (tyAlg). It gives value-level typing
rules as functions of evaluated annotations (bindersV, sortV, resultV) and a
value-level side condition WFV. One coherence equation per rule relates the value-level
typing to the syntactic one, in the type-level meanings Den. A language whose coercions
change a type to one with the same carrier states that carrier equation in WFV, and its
interpretation of the coercion casts there.
The two kinds of interpretation follow the signature-level names. An ordinary
Model.Interp V and a continuous Model.DomainInterp D see a head only through its
evaluated annotations. They receive each child as a function, respectively a continuous
function, of the child's type arguments and fresh value binders. Model.denote and
Model.denoteDomain fold them at every type assignment. Because heads are seen only through
their evaluated annotations:
denoteDomain_map: substituting type parameters in the syntax commutes with the continuous meaning, for every interpretation, with no obligation per head;denoteDomain_related: a continuous and an ordinary interpretation that relate their results at every evaluated head give related meanings for every term, at every type assignment, in environments related byEnv.LiftRel.
Both folds are exposed, so a meaning computes definitionally on a concrete term.
denote_stackedNode and denoteDomain_stackedNode state one step of that computation; a large
meaning is better computed by rewriting with them than by one rfl.
Evaluated annotations #
Evaluated annotations: each slot as a function of its own type binders.
Equations
- H.AnnV Den h = IPFunctor.ScopedSignature.Env (fun (j : List K × K) => IPFunctor.ScopedSignature.Env Den j.1 → Den j.2) (H.slots h)
Instances For
Evaluate every annotation at a type assignment.
Equations
- IPFunctor.ScopedSignature.Heads.evalAnn alg a ρ j x ξ = IPFunctor.ScopedSignature.Term.denote (fun {a : K} => alg) (a j x) (ξ.append ρ)
Instances For
Evaluating substituted annotations evaluates at the substituted assignment.
A model of a stacked family: type-level meanings, and value-level typing on evaluated annotations, coherent with the syntactic typing.
- Den : K → Type d
Meanings of type-level kinds.
- tyAlg : τ.Interpretation self.Den
The type-level interpretation.
Value-level side condition, such as the carrier equation of a coercion.
- bindersV (h : H.Shape) : H.AnnV self.Den h → (p : H.Arg h) → Env self.Den (H.tbind h p) → List (self.Den k₀)
Value-level binder types.
Value-level child types.
Value-level result types.
- wf_coh {Θ : List K} (h : H.Shape) (a : H.Ann τ h Θ) (ρ : Env self.Den Θ) : S.WF h a → self.WFV h (Heads.evalAnn (fun {a : K} => self.tyAlg) a ρ)
The syntactic side condition gives the value-level one.
- binders_coh {Θ : List K} (h : H.Shape) (a : H.Ann τ h Θ) (ρ : Env self.Den Θ) (p : H.Arg h) (ξ : Env self.Den (H.tbind h p)) : S.WF h a → List.map (fun (s : τ.Term (H.tbind h p ++ Θ) k₀) => Term.denote (fun {a : K} => self.tyAlg) s (ξ.append ρ)) (S.binders h a p) = self.bindersV h (Heads.evalAnn (fun {a : K} => self.tyAlg) a ρ) p ξ
Binder types agree with the syntax.
- sort_coh {Θ : List K} (h : H.Shape) (a : H.Ann τ h Θ) (ρ : Env self.Den Θ) (p : H.Arg h) (ξ : Env self.Den (H.tbind h p)) : S.WF h a → Term.denote (fun {a : K} => self.tyAlg) (S.sort h a p) (ξ.append ρ) = self.sortV h (Heads.evalAnn (fun {a : K} => self.tyAlg) a ρ) p ξ
Child types agree with the syntax.
- result_coh {Θ : List K} (h : H.Shape) (a : H.Ann τ h Θ) (ρ : Env self.Den Θ) : S.WF h a → Term.denote (fun {a : K} => self.tyAlg) (S.result h a) ρ = self.resultV h (Heads.evalAnn (fun {a : K} => self.tyAlg) a ρ)
Result types agree with the syntax.
Instances For
Environments of a child #
Move a value environment below a block of type binders. Below no binders it is unchanged; below a non-empty block each value is transported along the weakening of its sort.
Equations
- M.ambientEnv V [] x_4 x✝¹ x✝ = x✝
- M.ambientEnv V (k :: Ξ) ξ x✝¹ x✝ = (IPFunctor.ScopedSignature.Stacked.enter (k :: Ξ)).env fun (s : τ.Term Θ k₀) (x : IPFunctor.ScopedVar Γ s) => cast ⋯ (x✝ s x)
Instances For
ambientEnv as a continuous map.
Equations
- One or more equations did not get rendered due to their size.
- M.ambientEnvContinuous D [] x_3 x✝ = OmegaCompletePartialOrder.ContinuousHom.id
Instances For
Read the fresh value binders of a child through the binder coherence equation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
binderEnv as a continuous map.
Equations
- M.binderEnvContinuous D a wf ρ p ξ = OmegaCompletePartialOrder.ContinuousHom.ofFun (M.binderEnv D a wf ρ p ξ) ⋯
Instances For
Ordinary interpretations #
An ordinary interpretation of the value level into a family of types. It sees each head only through its evaluated annotations and value-level side condition.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Ordinary meanings of terms: for each type assignment, a function of the value environment.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The syntax algebra induced by an ordinary interpretation over evaluated heads.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The ordinary meaning: the generic fold.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A checked node means its interpretation at the evaluated head, with each child read in its fresh binders and the ambient environment moved below the child's type binders.
Continuous interpretations #
A continuous interpretation of the value level. It sees each head only through its evaluated annotations and value-level side condition, and receives each child as a continuous function of the child's type arguments and fresh value binders.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Continuous meanings of terms: for each type assignment, a continuous function of the value environment.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The children of a head as a continuous function of the ambient environment.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The syntax algebra induced by a continuous interpretation over evaluated heads.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The continuous meaning: the generic fold.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A checked node means its interpretation at the evaluated head, with each child read in its fresh binders and the ambient environment moved below the child's type binders.
Type-parameter substitution commutes with the continuous meaning #
Substituting type parameters commutes with the continuous meaning, for every interpretation over evaluated heads. The value environments agree at every position.
The closed case: instantiate the parameters of a term with no free values.
The fundamental lemma #
A continuous interpretation simulated by an ordinary one: at every evaluated head, children related on related fresh binders give related results.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A relation indexed by type-level meanings survives transport along their equations.
Related fresh binders give related binder environments.
Related environments stay related below a block of type binders.