# `ExDatalog.Constraints.Arithmetic`
[🔗](https://github.com/thanos/ex_datalog/blob/v0.5.0/lib/ex_datalog/constraints/arithmetic.ex#L1)

Arithmetic constraint implementation for the Constraint behaviour.

Evaluates arithmetic constraints (`:add`, `:sub`, `:mul`, `:div`) which
bind a result variable. All arithmetic is integer-only. Division by zero
filters the binding.

This module is the canonical evaluator for arithmetic operations. It is
dispatched to by `ExDatalog.Constraint.evaluate/3` when the constraint's
`op` is `:add`, `:sub`, `:mul`, or `:div`.

# `evaluate`

```elixir
@spec evaluate(
  ExDatalog.IR.Constraint.t(),
  ExDatalog.Engine.Binding.t(),
  ExDatalog.Constraint.Context.t()
) :: {:ok, ExDatalog.Engine.Binding.t()} | :filter
```

Evaluates an arithmetic constraint against a binding environment.

Accepts an `IR.Constraint` struct as produced by the compiler. Returns
`{:ok, extended_binding}` when the arithmetic succeeds (result variable
is bound), or `:filter` when division by zero occurs or an input variable
is unbound.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
