Defence Secretary James Mattis has resigned, telling Donald Trump in a letter that he should choose a person who is more in tune with his world view after the US president decided to withdraw American troops from Syria.