Copyright | (c) Masahiro Sakai 2011-2013 |
---|---|
License | BSD-style |
Maintainer | masahiro.sakai@gmail.com |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Naïve implementation of Fourier-Motzkin Variable Elimination
Reference:
- data Constr
- project :: Var -> [Atom Rational] -> [([Atom Rational], Model Rational -> Model Rational)]
- projectN :: VarSet -> [Atom Rational] -> [([Atom Rational], Model Rational -> Model Rational)]
- eliminateQuantifiers :: Formula (Atom Rational) -> Maybe (Formula (Atom Rational))
- solveFormula :: VarSet -> Formula (Atom Rational) -> SatResult Rational
- solve :: VarSet -> [Atom Rational] -> Maybe (Model Rational)
Primitive constraints
Atomic constraint
Projection
project :: Var -> [Atom Rational] -> [([Atom Rational], Model Rational -> Model Rational)] Source
returns project
x φ[(ψ_1, lift_1), …, (ψ_m, lift_m)]
such that:
⊢_LRA ∀y1, …, yn. (∃x. φ) ↔ (ψ_1 ∨ … ∨ φ_m)
where{y1, …, yn} = FV(φ) \ {x}
, and- if
M ⊧_LRA ψ_i
thenlift_i M ⊧_LRA φ
.
projectN :: VarSet -> [Atom Rational] -> [([Atom Rational], Model Rational -> Model Rational)] Source
returns projectN
{x1,…,xm} φ[(ψ_1, lift_1), …, (ψ_n, lift_n)]
such that:
⊢_LRA ∀y1, …, yp. (∃x. φ) ↔ (ψ_1 ∨ … ∨ φ_n)
where{y1, …, yp} = FV(φ) \ {x1,…,xm}
, and- if
M ⊧_LRA ψ_i
thenlift_i M ⊧_LRA φ
.
Quantifier elimination
eliminateQuantifiers :: Formula (Atom Rational) -> Maybe (Formula (Atom Rational)) Source
Eliminate quantifiers and returns equivalent quantifier-free formula.
returns eliminateQuantifiers
φ(ψ, lift)
such that:
- ψ is a quantifier-free formula and
LRA ⊢ ∀y1, …, yn. φ ↔ ψ
where{y1, …, yn} = FV(φ) ⊇ FV(ψ)
, and - if
M ⊧_LRA ψ
thenlift M ⊧_LRA φ
.
φ may or may not be a closed formula.
Constraint solving
solveFormula :: VarSet -> Formula (Atom Rational) -> SatResult Rational Source
returnssolveFormula
{x1,…,xm} φ
such thatSat
MM ⊧_LRA φ
when suchM
exists,- returns
when suchUnsat
M
does not exists, and - returns
whenUnknown
φ
is beyond LRA.