Markets with Transaction Costs: Mathematical Theory