Environments of imported declarations #
An imported declaration is a term in the context of its dependencies' sorts, nearest first, the
value context of its Scope. A frontend gives the declaration a meaning by interpreting the term
in an environment of its dependencies' meanings, and relates two meanings of it, such as a lazy
meaning and a native value, by the fundamental lemma at a proof of Env.LiftRel over the
dependencies' relations.
Scope.envbuilds the environment of the value context from its values, as a chain ofEnv.consoverEnv.empty, writing each tail of the context from the scope's list suffixes.Scope.liftRelbuilds the proof ofEnv.LiftRel Rbetween two such environments from proofs ofRat each position, byEnv.LiftRel.consoverEnv.liftRel_empty.
Both write terms with every implicit argument explicit. They infer only the universe level of each carrier, and never the type of a value or a proof, so the values and proofs may be constants that the import adds later. The kernel checks the result.
EnvReader goes the other way, for a printer that shows a meaning with its environment read off.
EnvReader.values? lists the values of an explicit environment, built from Env.cons and
Env.single over Env.empty, and EnvReader.varIndex? reads the position of a variable, a chain
of ScopedVar.succ over ScopedVar.zero. EnvReader.lookup? replaces a lookup ρ a v of a
chain of Env.cons, as Scope.env builds it, by the entry. The readers are syntactic: the kernel
checks any statement written with them.
The universe level z of a carrier V : S → Type z.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The environments of the scope's value context and of each of its tails at the carrier V,
whose values live in Type z: entry k is Env.cons xs[k] (… (Env.cons xs[n-1] Env.empty)),
and the last entry is Env.empty. There must be one value per sort.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The environment Env.cons xs[0] (Env.cons xs[1] (… Env.empty)) of the scope's value context
at the carrier V, with the values xs, nearest first, one per sort.
Equations
Instances For
The proof of Env.LiftRel R (sc.env V xs) (sc.env W ys) from proofs hs[k] : R a xs[k] ys[k]
at the sorts a of the scope's value context, nearest first, one per sort.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The position of a variable: a chain of ScopedVar.succ over ScopedVar.zero.
A lookup ρ a v of a chain of Env.cons, as its entry.
Equations
- One or more equations did not get rendered due to their size.