= Solution
Use `not` for <negation as failure>, rather than classical <logical negation>. The disjunctive condition is expressed by two separate <Datalog with negation> rules:
$$
\boxed{\begin{aligned}
\mathit{Year}(x)\land\mathit{DivisibleBy}(x,400)&\to\mathit{Leap}(x),\\
\mathit{Year}(x)\land\mathit{DivisibleBy}(x,4)\land\operatorname{not}\mathit{DivisibleBy}(x,100)&\to\mathit{Leap}(x).
\end{aligned}}
$$
The positive $\mathit{Year}(x)$ premise restricts the rule to years and makes the variable explicitly safe. The divisibility relation is input data; the integer-looking constants do not make arbitrary arithmetic facts true automatically.
Back to article page