A general theory of artificial intelligence and law