Provably optimal decision trees with arbitrary splitting rules in polynomial time