The law isn't a series of "if... then..." statements. It's a collection of vagueries and categorizations that are wholly open to interpretation of when and who they apply to. Add to that, sometimes they are in conflict with each other.
Judges jobs are to use they judgement.
> The law isn't a series of "if... then..." statements
I mean, it's literally called (in the US, at least) the United States Code[1].
It's not currently, but if we were able to use AI to generate laws in an objective and logically sound way based on general principles like "don't harm others or their property", we'd be much better off.