There is an extensive literature on Ricardian models with many goods and countries. For a survey see: Eaton, Jonathan, and Samuel Kortum. 2012. "Putting Ricardo to Work." Journal of Economic Perspectives, 26(2): 65-90. https://www.aeaweb.org/articles.php?doi=10.1257/jep.26.2.65 Original research publications: 1. *Two countries, continuum of goods*: Dornbusch, Rudiger, Stanley Fischer, and Paul Anthony Samuelson. "Comparative advantage, trade, and payments in a Ricardian model with a continuum of goods." *The American Economic Review* (1977): 823-839. http://www.jstor.org/stable/1828066 2. *Many countries, many goods*: Eaton, Jonathan, and Samuel Kortum. "Technology, geography, and trade." *Econometrica* (2002): 1741-1779. http://www.jstor.org/stable/3082019 Ricardian theory has many simplifications: only one input in production, constant returns to scale, perfect competition, full employment, no dynamic effects on technology and resources … These need to be kept in mind when applying its conclusions to the real world. But under these assumptions it is possible to give a fully rigorous mathematical account of the theory with no logical problems.