Theories are simply named groups of declarations. Examples for theories are first-order or higher-order theories, logics, type theories, logical frameworks. Their conrete syntax is
<body> is a sequence of declarations. The context available to any specific declaration is everything provided by previous declarations, specifically theory inclusions and everything provided by the meta theory.
The meta theory statement is optional and behaves like a theory inclusion.
Theories can be nested, like this:
in which case the visible context of both the inner theory as well as
<previousbody>, i.e. the inner theory can see all previous declarations of the outer theory, but at no point can the outer theory see inside the inner theory (unless explicitely included).
Given two theories
B, a view from
B maps all declarations in
A to expressions over symbols in
B, while preserving typing judgments. i.e. if
|- a : tpA in
v:A->B is a view, then
|- v(a) : v(tpA). Hence, views are truth preserving.
A is the domain of
B is the codomain.
Their conrete syntax is
<assignments> is a list of assignment declarations. Their syntax looks like this:
<name> has to be a symbol declared in (the dependency closure of)
<term> has to be a well-formed term over symbols in
<codomain> preserving typing judgments.