Definition. Dependent Tensor of Grammars

The tensor of grammars,

(π΄βŠ—π΅)(𝑀)=βˆ‘π‘€=𝑒𝑣𝐴(𝑒)×𝐡(𝑣)

is simply typed, so 𝐡 cannot see what 𝐴 matched.

Just as we have the generalization from the pair type 𝐴×𝐡 to the dependent pair Ξ£π‘Ž:π΄π΅π‘Ž, we can define a dependent tensor operation. It is a Ξ£-like generalization over the ordinary tensor, in which the second grammar depends on a parse tree of the first.

Write 𝖳𝗋𝖾𝖾(𝐴)=βˆ‘π‘€π΄(𝑀) for the type of parse trees of 𝐴, each paired with the string it parses.

For a grammar 𝐴 and a family of grammars 𝐡:𝖳𝗋𝖾𝖾(𝐴)→𝐆𝐫, the dependent tensor is:

(π΄βŠ—π–£π΅)(𝑀)=βˆ‘π‘€=π‘’π‘£βˆ‘π‘Ž:𝐴(𝑒)𝐡(𝑒,π‘Ž)(𝑣)

We may also write it as (π‘Žβˆˆπ΄)βŠ—π΅(π‘Ž).

When 𝐡 is a constant family, the dependent tensor reduces to the ordinary tensor π΄βŠ—π΅.

Dependence runs left to right here, which fits left-to-right parsing. The other handedness, in which the first grammar depends on a parse of the second, is also definable.

Relation to Day Convolution

Just as the ordinary tensor is given by Day convolution, I think there is a similar dependent Day convolution for which this operation is an instance. My best guess is for any 𝑋 presheaf on a monoidal category π’žοΈ€ and π‘Œ a functor from the category of elements of 𝑋 into presheaves on π’žοΈ€,

(π‘‹βŠ—π–£π‘Œ)𝑐=βˆ«π‘’,π‘£π’žοΈ€[𝑐,π‘’βŠ—π‘£]Γ—βˆ«π‘₯:π‘‹π‘’π‘Œ(𝑒,π‘₯)𝑣

I’m not positive on this though, and I would hope to also extend this to enrichments that aren’t π’πžπ­ but I don’t see how that could make sense given that I have quantified over the element π‘₯:𝑋𝑒 in the coend rather than using the tensor of the enriching category.

dependent-tensor definition entries/parsing/dependent-tensor.hel