Definition. Grammar Residuals

For formal grammars 𝐴 and 𝐡, the residual 𝐴⊸𝐡 (sometimes called the lollipop or linear implication) is the right adjoint to the grammar tensor π΄βŠ—π΅. It describes strings that, when prefixed by a string matching 𝐴, will match 𝐡.

Formally, it is defined as:

(𝐴⊸𝐡)(𝑣)=Π𝑒𝐴(𝑒)→𝐡(𝑒·𝑣)

Intuitively, a parse of 𝐴⊸𝐡 at a string 𝑣 is a function that takes any prefix string 𝑒 and a parse of 𝑒 in 𝐴, and produces a parse of the full concatenated string 𝑒·𝑣 in 𝐡.

grammar-residual definition entries/parsing/grammar-residual.hel