This example shows one possible way of dealing with generic lists (with potentially void elements) in CITP, including operations for appending lists – denoted $l_1\! \mathrel{@} l_2$ – computing their lengths – denoted $\text{len}(l)$ – or reversing lists – denoted $\text{rev}(l)$. We prove that the append operation is associative and that, moreover, both the length and the reverse operations distribute over append. In symbols:
LISTS |- eq L1:List @(L2:List @ L3:List)=(L1:List @ L2:List)@ L3:List ;
See assoc.maude for the full proof.
LISTS |- eq len(L1:List @ L2:List)= len(L1:List)+ len(L2:List) ;
See distLen.maude for the full proof.
LISTS-ASSOC |- eq rev(L1:List @ L2:List)= rev(L2:List)@ rev(L1:List);
See distRev.maude for the full proof.