Two lists are bag equivalent if they are permutations of each other, i.e. if they contain the same elements, with the same multiplicity, but perhaps not in the same order. This paper describes how one can define bag equivalence as the presence of bijections between sets of membership proofs. This definition has some desirable properties: 1. Many bag equivalences can be proved using a flexible form of equa-tional reasoning. 2. The definition generalises easily to arbitrary unary containers, including types with infinite values, such as streams. 3. By using a slight variation of the definition one gets set equivalence instead, i.e. equality up to order and multiplicity. Other variations give the subset and subbag preorders. 4. The definition works well in mechanised proofs.
展开▼