Linear typed λ-calculi are more delicate than their simply typed siblings when it comes to metatheoretic results like preservation of typing under renaming and substitution. Tracking the usage of variables in contexts places more constraints on how variables may be renamed or substituted. We present a methodology based on linear algebra over semirings, extending McBride's kits and traversals approach for the metatheory of syntax with binding to linear usage-annotated terms. Our approach is readily formalisable, and we have done so in Agda.
The Agda formalisation is at https://github.com/laMudri/generic-lr/tree/lin/tlla-submission-2021/src/Specific. The article appears in the Linearity-TLLA 2020 Post-proceedings.