Skip to content

Reindexed proof interpretations

A rule presentation can serve as the source of a typed translation. Its proofs carry source indices, while the translation produces a family of values indexed by target types, layouts, or other static terms. A reindexed proof interpretation relates those two sets of indices and checks the translation one rule at a time.

Construction

Let \(I\) be the set of ground source judgments, \(J\) the set of target indices, and \(h : I \to J\) a static map. Let \(E \to J\) be the target family. Pulling back \(E\) along \(h\) gives a family over \(I\) whose fiber at \(i\) is \(E_{h(i)}\). For a rule with premises \(i_1, \ldots, i_n\) and conclusion \(i\), a pure interpretation provides an operation on its ordinary fields \(V_r\) and interpreted premises.

\[ V_r \times E_{h(i_1)} \times \cdots \times E_{h(i_n)} \longrightarrow E_{h(i)}. \]

Axioms have no recursive premises. If \(P\) is the indexed polynomial functor of the presentation, these operations give a \(P\)-algebra on \(h^*E\). The proof trees form the initial \(P\)-algebra, and the interpretation is its unique fold into \(h^*E\) that preserves those operations. Altenkirch and Morris, Indexed Containers, sections 3–6

The adjunction \(\Sigma_h \dashv h^*\) gives an equivalent description of the individual operations. An algebra \(P(h^*E) \to h^*E\) is equivalent to an algebra \(\Sigma_h P(h^*E) \to E\) on the relabeled signature. The equivalence is about the operations. It does not identify the two sets of proof trees.

The indices used in proof search matter even if their images agree. For instance, suppose an input proves \(A\) and a rule expects a distinct \(B\). If \(h(A)=h(B)\), the interpreter gives values of the same type to proofs of \(A\) and \(B\). It still takes a proof of \(B\) to apply the source rule. A weighted chart therefore continues to search over the original judgments and to assign weight to each original derivation.

Two applications

In combinatory categorial grammar, map both slash constructors to an arrow from the argument category's image to the result category's image. Forward application shares the argument category between its premises. The corresponding rule operation receives a function and an argument with the same input type index. Crossed composition uses the same principle for its intermediate type. Each lexical entry has a checked meaning at the image of its category.

A stack compiler can map source stack shapes to machine stack layouts. A derivation from source shape \(s\) to \(t\) translates to code from \(h(s)\) to \(h(t)\). Sequential composition gets the same intermediate layout index on both sides, while the source verifier still distinguishes source shapes with the same machine representation. McBride's stack machine uses stack-height-indexed code and folds it into functions between stacks of the corresponding heights. McBride, Ornamental Algebras, Algebraic Ornaments, section 9

Lowering

The compiler checks each map clause as a target index term over the images of the constructor's arguments. It calculates images of symbolic rule indices as well as ground derivation indices. An authored map on a lexical deduction's generated term sort can omit symbols outside its category language. The compiler checks coverage of lexical categories and rule patterns and requires each conclusion category variable to be bound in a premise category.

The compiler builds a companion presentation with the original judgment indices and additional indices for the selected images. Rules in the companion state how those image indices are shared. Input alternatives specialize their axiom slots at fixed source indices. Specialization is keyed by input occurrence, so two lexical entries with the same spelling and category can name different operations. This lets the existing QIEC proof fold check both rule and input operations against their indexed types.

The interpretation handles closed proofs of unconditional presentations without proof equations. It rejects a companion rule if its conclusion would need an image variable that no premise determines. This can happen when a map drops an argument of a constructor and a rule then exposes that argument in its conclusion.

In QVR, declare the map with index map and name the lexical alternatives with #[entry=NAME]. The optional interpretation argument of parse_proofs selects the companion for the weighted query. Its rule operations use existing QIEC code and types. See the deduction guide for both runnable examples.