Legal regulation of artificial intelligence