Sets of integers form a monoid, where the product of two sets Aand B is defined as the set containing a+b for all $a\in A$
and$b\in B$
. We give a characterization of when a family of finitesets is a code in this monoid, that is when the sets do not satisfyany nontrivial relation. We also extend this result for someinfinite sets, including all infinite rational sets.