1
\achapter{Omega: a solver of quantifier-free problems in
3
\aauthor{Pierre Cr�gut}
6
\asection{Description of {\tt omega}}
10
{\tt omega} solves a goal in Presburger arithmetic, i.e. a universally
11
quantified formula made of equations and inequations. Equations may
12
be specified either on the type \verb=nat= of natural numbers or on
13
the type \verb=Z= of binary-encoded integer numbers. Formulas on
14
\verb=nat= are automatically injected into \verb=Z=. The procedure
15
may use any hypothesis of the current proof session to solve the goal.
17
Multiplication is handled by {\tt omega} but only goals where at
18
least one of the two multiplicands of products is a constant are
19
solvable. This is the restriction meant by ``Presburger arithmetic''.
21
If the tactic cannot solve the goal, it fails with an error message.
22
In any case, the computation eventually stops.
24
\asubsection{Arithmetical goals recognized by {\tt omega}}
26
{\tt omega} applied only to quantifier-free formulas built from the
33
on atomic formulas. Atomic formulas are built from the predicates
36
\verb!=, le, lt, gt, ge!
39
on \verb=nat= or from the predicates
42
\verb!=, <, <=, >, >=!
45
on \verb=Z=. In expressions of type \verb=nat=, {\tt omega} recognizes
48
\verb!plus, minus, mult, pred, S, O!
51
and in expressions of type \verb=Z=, {\tt omega} recognizes
54
\verb!+, -, *, Zsucc!, and constants.
57
All expressions of type \verb=nat= or \verb=Z= not built on these
58
operators are considered abstractly as if they
59
were arbitrary variables of type \verb=nat= or \verb=Z=.
61
\asubsection{Messages from {\tt omega}}
64
When {\tt omega} does not solve the goal, one of the following errors
69
\item \errindex{omega can't solve this system}
71
This may happen if your goal is not quantifier-free (if it is
72
universally quantified, try {\tt intros} first; if it contains
73
existentials quantifiers too, {\tt omega} is not strong enough to solve your
74
goal). This may happen also if your goal contains arithmetical
75
operators unknown from {\tt omega}. Finally, your goal may be really
78
\item \errindex{omega: Not a quantifier-free goal}
80
If your goal is universally quantified, you should first apply {\tt
81
intro} as many time as needed.
83
\item \errindex{omega: Unrecognized predicate or connective: {\sl ident}}
85
\item \errindex{omega: Unrecognized atomic proposition: {\sl prop}}
87
\item \errindex{omega: Can't solve a goal with proposition variables}
89
\item \errindex{omega: Unrecognized proposition}
91
\item \errindex{omega: Can't solve a goal with non-linear products}
93
\item \errindex{omega: Can't solve a goal with equality on {\sl type}}
97
%% Ce code est d�branch� pour l'instant
99
% \asubsection{Control over the output}
100
% There are some flags that can be set to get more information on the procedure
103
% \item \verb=Time= to get the time used by the procedure
104
% \item \verb=System= to visualize the normalized systems.
105
% \item \verb=Action= to visualize the actions performed by the OMEGA
106
% procedure (see \ref{technical}).
109
% \comindex{Set omega Time}
110
% \comindex{UnSet omega Time}
111
% \comindex{Switch omega Time}
112
% \comindex{Set omega System}
113
% \comindex{UnSet omega System}
114
% \comindex{Switch omega System}
115
% \comindex{Set omega Action}
116
% \comindex{UnSet omega Action}
117
% \comindex{Switch omega Action}
119
% Use {\tt Set omega {\rm\sl flag}} to set the flag
120
% {\rm\sl flag}. Use {\tt Unset omega {\rm\sl flag}} to unset it and
121
% {\tt Switch omega {\rm\sl flag}} to toggle it.
123
\section{Using {\tt omega}}
125
The {\tt omega} tactic does not belong to the core system. It should be
128
Require Import Omega.
135
Goal forall m n:Z, 1 + 2 * m <> 2 * n.
145
Goal forall z:Z, z > 0 -> 2 * z + 1 > z.
149
% Other examples can be found in \verb+$COQLIB/theories/DEMOS/OMEGA+.
151
\asection{Technical data}
154
\asubsection{Overview of the tactic}
157
\item The goal is negated twice and the first negation is introduced as an
159
\item Hypothesis are decomposed in simple equations or inequations. Multiple
160
goals may result from this phase.
161
\item Equations and inequations over \verb=nat= are translated over
162
\verb=Z=, multiple goals may result from the translation of
164
\item Equations and inequations are normalized.
165
\item Goals are solved by the {\it OMEGA} decision procedure.
166
\item The script of the solution is replayed.
170
\asubsection{Overview of the {\it OMEGA} decision procedure}
172
The {\it OMEGA} decision procedure involved in the {\tt omega} tactic uses
173
a small subset of the decision procedure presented in
176
"The Omega Test: a fast and practical integer programming
177
algorithm for dependence analysis", William Pugh, Communication of the
178
ACM , 1992, p 102-114.
181
Here is an overview, look at the original paper for more information.
185
\item Equations and inequations are normalized by division by the GCD of their
187
\item Equations are eliminated, using the Banerjee test to get a coefficient
189
\item Note that each inequation defines a half space in the space of real value
191
\item Inequations are solved by projecting on the hyperspace
192
defined by cancelling one of the variable. They are partitioned
193
according to the sign of the coefficient of the eliminated
194
variable. Pairs of inequations from different classes define a
195
new edge in the projection.
196
\item Redundant inequations are eliminated or merged in new
197
equations that can be eliminated by the Banerjee test.
198
\item The last two steps are iterated until a contradiction is reached
199
(success) or there is no more variable to eliminate (failure).
203
It may happen that there is a real solution and no integer one. The last
204
steps of the Omega procedure (dark shadow) are not implemented, so the
205
decision procedure is only partial.
210
\item The simplification procedure is very dumb and this results in
211
many redundant cases to explore.
215
\item Certainly other bugs! You can report them to
218
\url{Pierre.Cregut@cnet.francetelecom.fr}
225
%%% TeX-master: "Reference-Manual"