Expand description
LIA Tactic: Linear Integer Arithmetic by Fourier-Motzkin Elimination
This module implements a decision procedure for linear arithmetic over
rational numbers (with integer semantics handled by crate::omega).
§Algorithm
The lia tactic works in four steps:
- Reification: Convert Syntax terms to
LinearExprrepresentation - Negation: Convert the goal to constraints (validity = negation is unsatisfiable)
- Elimination: Use Fourier-Motzkin to eliminate variables one by one
- Check: Verify the resulting constant constraints are contradictory
§Fourier-Motzkin Elimination
This classical algorithm eliminates variables from a system of linear inequalities. For each variable x:
- Partition constraints into lower bounds (x >= L), upper bounds (x <= U), and independent
- Combine each lower with each upper: L <= U
- The resulting system has one fewer variable
§Rational Arithmetic
The module uses exact rational arithmetic during elimination to avoid precision issues. Rationals are automatically normalized to lowest terms.
§Supported Relations
Lt(less than)Le(less than or equal)Gt(greater than)Ge(greater than or equal)
Structs§
- Constraint
- A linear constraint representing either
expr <= 0orexpr < 0. - Linear
Expr - A linear expression of the form c₀ + c₁x₁ + c₂x₂ + … + cₙxₙ.
- Rational
- Exact rational number for arithmetic during Fourier-Motzkin elimination.
Enums§
- LiaError
- Error during reification to linear expression
Functions§
- extract_
comparison - Extract comparison from goal: (SApp (SApp (SName “Lt”|“Le”|“Gt”|“Ge”) lhs) rhs)
- fourier_
motzkin_ unsat - Check if a constraint set is unsatisfiable using Fourier-Motzkin elimination.
- goal_
to_ negated_ constraint - Convert a goal to constraints for validity checking.
- reify_
linear - Reify a Syntax term to a linear expression.