update isl for support for recent versions of clang
[barvinok.git] / doc / isl.tex
bloba09db7e9bdb7c4eabd62b2258dc1ceb8c9fce103
1 \section{\protect\isl/ interface}
3 \let\llt\prec
4 \let\lle\preccurlyeq
5 \let\lgt\succ
7 \subsection{Library}
9 The \barvinok/ library currently supports only a few
10 functions that interface with the \isl/ library.
11 In time, this interface will grow and is set to replace
12 the \PolyLib/ interface.
13 For more information on the \isl/ data structures, see
14 the \isl/ user manual.
16 \begin{verbatim}
17 __isl_give isl_pw_qpolynomial *isl_basic_set_card(
18 __isl_take isl_basic_set *bset);
19 __isl_give isl_pw_qpolynomial *isl_set_card(__isl_take isl_set *set);
20 __isl_give isl_union_pw_qpolynomial *isl_union_set_card(
21 __isl_take isl_union_set *uset);
22 \end{verbatim}
23 Compute the number of elements in an \ai[\tt]{isl\_basic\_set},
24 \ai[\tt]{isl\_set} or \ai[\tt]{isl\_union\_set}.
25 The resulting \ai[\tt]{isl\_pw\_qpolynomial}
26 or \ai[\tt]{isl\_union\_pw\_qpolynomial} has purely parametric cells.
28 \begin{verbatim}
29 __isl_give isl_pw_qpolynomial *isl_basic_map_card(
30 __isl_take isl_basic_map *bmap);
31 __isl_give isl_pw_qpolynomial *isl_map_card(__isl_take isl_map *map);
32 __isl_give isl_union_pw_qpolynomial *isl_union_map_card(
33 __isl_take isl_union_map *umap);
34 \end{verbatim}
35 Compute a closed form expression for the number of image elements
36 associated to any element in the domain of the given \ai[\tt]{isl\_basic\_map},
37 \ai[\tt]{isl\_map} or \ai[\tt]{isl\_union\_map}.
38 The union of the cells in the resulting \ai[\tt]{isl\_pw\_qpolynomial}
39 is equal to the domain of the input \ai[\tt]{isl\_map}.
41 \begin{verbatim}
42 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sum(
43 __isl_take isl_pw_qpolynomial *pwqp);
44 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sum(
45 __isl_take isl_union_pw_qpolynomial *upwqp);
46 \end{verbatim}
47 Compute the sum of the given piecewise quasipolynomial over
48 all integer points in the domain. The result is a piecewise
49 quasipolynomial that only involves the parameters.
50 If, however, the domain of the piecewise quasipolynomial wraps
51 a relation, then the sum is computed over all integer points
52 in the range of that relation and the domain of the relation
53 becomes the domain of the result.
55 \begin{verbatim}
56 __isl_give isl_pw_qpolynomial *isl_set_apply_pw_qpolynomial(
57 __isl_take isl_set *set, __isl_take isl_pw_qpolynomial *pwqp);
58 __isl_give isl_union_pw_qpolynomial *isl_union_set_apply_union_pw_qpolynomial(
59 __isl_take isl_union_set *uset,
60 __isl_take isl_union_pw_qpolynomial *upwqp);
61 \end{verbatim}
62 Compute the sum of the given piecewise quasipolynomial over
63 all integer points in the intersection of the domain and the given set.
65 \begin{verbatim}
66 __isl_give isl_pw_qpolynomial *isl_map_apply_pw_qpolynomial(
67 __isl_take isl_map *map, __isl_take isl_pw_qpolynomial *pwqp);
68 __isl_give isl_union_pw_qpolynomial *isl_union_map_apply_union_pw_qpolynomial(
69 __isl_take isl_union_map *umap,
70 __isl_take isl_union_pw_qpolynomial *upwqp);
71 \end{verbatim}
72 Compose the given map with the given piecewise quasipolynomial.
73 That is, compute the sum over all elements in the intersection
74 of the range of the map and the domain of the piecewise quasipolynomial
75 as a function of an element in the domain of the map.
77 \subsection{Calculator}
79 The \ai[\tt]{iscc} calculator offers an interface to some
80 of the functionality provided by the \isl/ and \barvinok/
81 libraries.
82 The language used by \ai[\tt]{iscc} is extremely simple. The calculator
83 supports operations on constants and dynamically typed variables and
84 assignments (\ai[\tt]{:=}) to those variables. If the result of an expression
85 is not used inside another expression and not assigned to a variable,
86 then this result is printed on the screen. The operators are overloaded
87 based on the types of the arguments, which may be sets, relations,
88 piecewise quasipolynomials, piecewise quasipolynomial folds, lists,
89 strings or booleans.
90 The supported operations are shown in \autoref{t:iscc}.
91 Note that when an operation requires an argument of a certain
92 type, a binary list with the first element of the required type
93 may also be used instead.
94 For a detailed description of some of the concepts behind \isl/ and \iscc/,
95 refer to \shortciteN{Verdoolaege2016tutorial}.
97 \subsubsection{Sets and Iteration Domains}
99 \begin{figure}
100 \begin{lstlisting}[escapechar=@]{}
101 for (i = 1; i <= n; ++i)
102 for (j = 1; j <= i; ++j)
103 /* S */
104 \end{lstlisting}
105 \caption{A loop nest}
106 \label{f:loop nest}
107 \end{figure}
109 \begin{figure}
110 \begin{tikzpicture}[>=stealth,x=0.7cm,y=-0.7cm]
111 \draw[thick] (1,1)--(5,5)--(1,5)--(1,1);
112 \draw[->] (-0.6,0) to (5.6,0) node[anchor=south east] {$j$};
113 \draw[->] (0,-0.6) to (0,5.6) node[anchor=south east] {$i$};
114 \draw[help lines,step=0.7cm] (-0.6,5.6) grid (5.6,-0.6);
115 \foreach \i in {1,...,5}{
116 \foreach \j in {1,...,\i}{
117 \fill (\j,\i) circle (2pt);
120 \end{tikzpicture}
121 \caption{The iteration domain of the loop nest in \autoref{f:loop nest}}
122 \label{f:iteration domain}
123 \end{figure}
125 Within the polyhedral model for analysis and transformation of
126 static affine programs, the most basic kind of set is the
127 \defindex{iteration domain}.
128 The iteration domain represents the iterations of a statement in a loop nest.
129 Take, for example, the loop nest in \autoref{f:loop nest}
130 and assume first that \lstinline{n} has a fixed value, say 5.
131 The pairs of values of \lstinline{i} and \lstinline{j} for
132 which statement \lstinline{S} is executed are shown graphically
133 in \autoref{f:iteration domain}.
134 Mathematically, this set of pairs can be represented as
136 \{\,
137 (i,j) \in \ZZ^2 \mid 1 \le i \le 5 \wedge 1 \le j \le i
138 \,\}
140 and the \isl/ notation is very similar:
141 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
142 { [i,j] : 1 <= i <= 5 and 1 <= j <= i }
143 \end{lstlisting}
144 In this notation,
145 the coordinates are separated by commas and enclosed in square
146 brackets. This description of the space in which the set lives
147 is followed by a colon and the constraints on the coordinates.
148 Assuming the iterators are incremented by one in every iterations
149 of the loop, a lower and upper bound on each loop iterator
150 can be read off from the initialization and the test.
151 Note that in an \iscc/ set,
152 the coordinates are assumed to be integer by default.
153 For an iteration domain to be representable by such a set,
154 the iterators therefore need to be integers.
156 The constraints of a set need to be affine, i.e., linear plus constant term.
157 These affine constraint may be combined through conjunctions (\texttt{and}),
158 disjunctions (\texttt{or}), projections (\texttt{exists}) and
159 negations (\texttt{not}).
160 Note that the formula is immediately converted
161 into \indac{DNF}, so it may sometimes be more efficient
162 to construct a set from smaller sets by applying
163 basic operations such as intersection ({\tt *}),
164 union ({\tt +}) and difference ({\tt -}).
165 For example, the following square with its diagonal removed,
167 \{\,
168 (i,j) \mid 0 \le i,j \le 10 \wedge \lnot (i = j)
169 \,\}
171 can be constructed as
172 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
173 { [i,j] : 0 <= i,j <= 10 } - { [i,i] }
174 \end{lstlisting}
175 or as
176 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
177 { [i,j] : 0 <= i,j <= 10 and not (i = j) }
178 \end{lstlisting}
179 Note that an occurrence of a relational operator in a set description
180 may define several constraints, one for each pair of arguments.
181 The elements in a list of arguments are separated by a comma.
182 If there are no constraints on the coordinates, i.e., in case of
183 a universe set, the colon may be omitted as well.
184 For example
185 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
186 { [] }
187 \end{lstlisting}
188 represents the entire (unnamed) zero-dimensional space,
189 and should not be confused with
190 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
192 \end{lstlisting}
193 which represents the empty set.
195 Returning to the iteration domain of the loop nest
196 in \autoref{f:loop nest}, we usually do not want to analyze
197 such a program for a specific value of \lstinline{n},
198 but instead for all possible values of \lstinline{n} at once.
199 A generic description of the iteration domain can be obtained
200 through the introduction of a (free) parameter, as in
201 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
202 [n] -> { [i,j] : 1 <= i <= n and 1 <= j <= i }
203 \end{lstlisting}
204 The optional parameters should
205 be declared by placing them in a comma delimited list inside \lstinline![]!
206 (followed by an ``\lstinline!->!'') in front of the main set description.
207 The parameters are global and are identified by their names,
208 so the order inside the list is arbitrary.
209 This should be contrasted to the coordinates of a space, the names of
210 which are only relevant within the description of the set and which
211 are instead identified by their positions.
212 That is,
213 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
214 [n] -> { [i,j] : 1 <= i <= n and 1 <= j <= i }
215 \end{lstlisting}
216 is equal to
217 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
218 [n] -> { [a,b] : 1 <= a <= n and 1 <= b <= a }
219 \end{lstlisting}
220 but it is not equal to
221 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
222 [n] -> { [j,i] : 1 <= i <= n and 1 <= j <= i }
223 \end{lstlisting}
224 (because the order of the coordinates has changed)
226 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
227 [m] -> { [i,j] : 1 <= i <= m and 1 <= j <= i }
228 \end{lstlisting}
229 (because it involves a different parameter).
231 It is sometimes convenient to represent constraints that only
232 involve parameters and that are not tied to any particular space.
233 To construct such a parameter domain, the list of coordinates
234 should simply be omitted. Note that the colon is required
235 in this case, even if there are no constraints.
236 In particular,
237 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
238 { : }
239 \end{lstlisting}
240 represents the universal parameter domain, which is very different
241 from the empty set.
243 To plug in a particular value for a parameter, the user should
244 take the \ai{intersection} (\ai[\tt]{*}) with a parameter domain
245 assigns a particular value to the parameter.
246 For example,
247 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
248 S := [n] -> { [i,j] : 1 <= i <= n and 1 <= j <= i };
249 S * [n] -> { : n = 5 };
250 \end{lstlisting}
251 It should be noted, though, that the result is not the same
252 as simply replacing \lstinline{n} by 5 as the result of the above
253 sequence will still have the global parameter \lstinline{n} set to 5.
254 To avoid this assignment, the user should instead compute
255 the \ai{gist} (\ai[\tt]{\%}) of the original set in the context
256 of setting \lstinline{n} to 5.
257 That is, the result of the sequence below is \lstinline{True}.
258 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
259 S1 := { [i,j] : 1 <= i <= 5 and 1 <= j <= i };
260 S2 := [n] -> { [i,j] : 1 <= i <= n and 1 <= j <= i };
261 (S2 % [n] -> { : n = 5}) = S1;
262 \end{lstlisting}
264 \begin{figure}
265 \begin{lstlisting}[escapechar=@]{}
266 for (i = 1; i <= n; i += 3)
267 /* S */
268 \end{lstlisting}
269 \caption{A loop with non-unit stride}
270 \label{f:stride}
271 \end{figure}
273 If a loop has a non-unit stride as in \autoref{f:stride}
274 then affine constraints on the coordinates and the parameters
275 are not sufficient to represent the iteration domain.
276 What is needed is a way to express that the value of
277 \lstinline{i} is equal to 1 plus 3 times some integer and
278 this is where existentially quantified variables can be used.
279 Existentially quantified variables are introduced by the
280 \ai[\tt]{exists} keyword and followed by a colon.
281 They can only be used within a single disjunct.
282 As an example, the iteration domain of the loop in \autoref{f:stride}
283 can be represented as
284 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
285 [n] -> { [i] : exists a : 1 <= i <= n and i = 1 + 3 a }
286 \end{lstlisting}
288 \begin{figure}
289 \begin{lstlisting}[escapechar=@]{}
290 for (i = 1; i <= n; ++i)
291 if ((i + 1) % 5 <= 2)
292 /* S */
293 \end{lstlisting}
294 \caption{A loop with a modulo condition}
295 \label{f:modulo}
296 \end{figure}
298 Existentially quantified variables are also useful to represent
299 modulo constraints. Consider for example the loop in
300 \autoref{f:modulo}. The iterator values \lstinline!i! for which
301 the statement \lstinline!S! is executed lie between
302 1 and \lstinline!n! and are such that the remainder of
303 \lstinline!i + 1! on division by 5 is less than or equal to 2.
304 The constraint $(i + 1) \bmod 5 \le 2$ can be written
305 as $(i + 1) - 5 \floor{\frac{i+1}5} \le 2$, where
306 $f = \floor{\frac{i+1}5}$ is the greatest integer part of $\frac{i+1}5$.
307 That is, $f$ is the unique integer value satisfying the constraints
308 $5 f \le i + 1$ and $5 f \ge (i+1) - 4$.
309 The iteration domain of the statement in \autoref{f:modulo}
310 can therefore be represented as
311 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
312 [n] -> { [i] : exists f : 1 <= i <= n and (i + 1) - 5 f <= 2 and
313 (i + 1) - 4 <= 5 f <= i + 1 }
314 \end{lstlisting}
315 Since greatest integer parts occur relatively frequently, there is
316 a special notation for them in \isl/ using \lstinline![]!.
317 The above set can therefore also be represented as
318 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
319 [n] -> { [i] : 1 <= i <= n and (i + 1) - 5 * [(i + 1)/5] <= 2 }
320 \end{lstlisting}
321 Actually, since modulos are pretty common too, \isl/ also has
322 a special notation for them and the set can therefore also be respresented as
323 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
324 [n] -> { [i] : 1 <= i <= n and (i + 1) % 5 <= 2 }
325 \end{lstlisting}
326 It should be noted that \lstinline![]! always rounds down
327 (towards $-\infty$), while integer division in C truncates
328 (towards 0). When translating conditions in C containing integer
329 divisions and/or modulos to \isl/ constraints, the user should therefore
330 make sure the sign of the dividend is positive. If not, the integer
331 division needs to be translated differently for positive and negative
332 values.
334 \begin{figure}
335 \begin{lstlisting}[escapechar=@]{}
336 for (i = 0; i < n; ++i)
337 T: t[i] = a[i];
338 for (i = 0; i < n; ++i)
339 for (j = 0; j < n - i; ++j)
340 F: t[j] = f(t[j], t[j+1]);
341 for (i = 0; i < n; ++i)
342 B: b[i] = t[i];
343 \end{lstlisting}
344 \caption{A program with three loop nests}
345 \label{f:three loops}
346 \end{figure}
348 Most programs involve more than one statement.
349 Although it is possible to work with different sets, each
350 representing the iteration domain of a statement,
351 it is usually more convenient to collect all iteration domains
352 in a single set. To be able to differentiate between iterations
353 of different statements with the same values for the iterators,
354 \isl/ allows spaces to be named. The name is placed in front
355 of the \lstinline![]! enclosing the iterators.
356 Consider for example the program in \autoref{f:three loops}.
357 The program contains three statements which have been labeled
358 for convenience.
359 The iteration domain of the first statement (\lstinline!T!)
360 can be represented as
361 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
362 [n] -> { T[i] : 0 <= i < n }
363 \end{lstlisting}
364 The union of all iteration domains can be represented as
365 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
366 [n] -> {
367 T[i] : 0 <= i < n;
368 F[i,j] : 0 <= i < n and 0 <= j < n - i;
369 B[i] : 0 <= i < n
371 \end{lstlisting}
372 The semicolon \lstinline{;} is used to express a disjunction
373 between spaces. This should be contrasted with the \lstinline{or}
374 keyword which expresses a disjunction between conjunctions of constraints.
375 For example, the result of the following \iscc/ statement is
376 \lstinline{True}.
377 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
378 { [i] : i = 3 or i = 5 } = { [3]; [5] };
379 \end{lstlisting}
381 \subsubsection{Maps and Access Relations}
383 A second important concept in the polyhedral model is that
384 of an \defindex{access relation}.
385 An access relation connects iterations of a statement
386 to the array elements accessed by those iterations.
387 Such a binary relation can be represented by a map in \isl/.
388 Maps are defined in similar way to sets,
389 except that the single space is replaced by a pair of spaces separated
390 by \verb!->!.
391 As an example, consider once more the program in \autoref{f:three loops}.
392 In particular, consider the access \lstinline{t[j+1]} in
393 statement \lstinline{F}.
394 The index expression maps the pair of iterations \lstinline{i}
395 and \lstinline{j} to \lstinline{t[j+1]}, i.e., element \lstinline{j+1}
396 of a space with name \lstinline{t}.
397 Ignoring the loop bound constraints, this access relation can
398 be represented as
399 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
400 { F[i,j] -> t[j + 1] }
401 \end{lstlisting}
402 It is however customary to include the constraints on the iterators
403 in the access relation, resulting in
404 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
405 [n] -> { F[i,j] -> t[j + 1] : 0 <= i < n and 0 <= j < n - i }
406 \end{lstlisting}
407 The constraints can be added by intersecting the domains
408 of the access relations with the iteration domains.
409 For example, the following sequence constructs the access
410 relation for all reads in the program.
411 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
412 D := [n] -> {
413 T[i] : 0 <= i < n;
414 F[i,j] : 0 <= i < n and 0 <= j < n - i;
415 B[i] : 0 <= i < n
417 Read := {
418 T[i] -> a[i];
419 F[i,j] -> t[j];
420 F[i,j] -> t[j + 1];
421 B[i] -> t[i]
423 Read := Read * D;
424 \end{lstlisting}
425 In this sequence, the \lstinline{*} operator, when applied
426 to a map and a set, intersects the domain of the map with the set.
428 The notation \lstinline{R(S)} can be used to compute the image
429 of the set \lstinline{S} under the map \lstinline{R}.
430 For example, given the sequence above, \lstinline!Read({F[0,1]})!
431 computes the array elements read in iteration $(0,1)$ of statement
432 \lstinline{F} and is equal to
433 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
434 [n] -> { t[2] : n >= 2; t[1] : n >= 2 }
435 \end{lstlisting}
436 That is, elements 1 and 2 of the \lstinline{t} array are read,
437 provided \lstinline{n} is at least 2.
439 Maps need not be single-valued.
440 As an example, assume that \lstinline{A} is a two-dimensional
441 array of size \lstinline{n} in both dimensions.
442 Iterations \lstinline{i} of
443 a statement \lstinline{S} may pass a pointer to an entire row
444 of \lstinline{A} to a function as in \lstinline{f(A[i])}.
445 Without knowing anything about \lstinline{f}, we would have
446 to assume that this function may access any element of the row.
447 The access relation corresponding to \lstinline{A[i]} is therefore
448 \begin{lstlisting}[columns=flexible,escapechar=@,language=]{}
449 [n] -> { S[i] -> A[i,j] : 0 <= i,j < n }
450 \end{lstlisting}
451 This map associates \lstinline{n} elements of \lstinline{A}
452 to each iteration of \lstinline{S}.
454 \subsubsection{Nested Spaces}
456 Each space may contain a nested pair of spaces. Such nested spaces
457 are extremely useful in more advanced applications.
458 As an example, suppose that during equivalence checking
459 \shortcite{Verdoolaege2009equivalence}
460 of two programs the iterations of \verb!S1! in one program are supposed to
461 produce the same results as the same iterations of \verb!SA! in the other program,
462 which may be described using the following map
463 \begin{verbatim}
464 [n] -> { S1[i] -> SA[i] : 0 <= i <= n }
465 \end{verbatim}
466 If the iterations of \verb!S1! depend on the same iterations
467 of \verb!S2!, i.e., \verb!{S1[i]->S2[i]}!, while those of \verb!SA!
468 depend on the next iteration of \verb!B!, i.e., \verb!{SA[i]->SB[i+1]}!,
469 then we can apply the cross product of these two dependence maps, i.e.,
470 \begin{verbatim}
471 { [S1[i] -> SA[i']] -> [S2[i] -> SB[1+i']] }
472 \end{verbatim}
473 to the original map to find
474 out which iterations of \verb!S2! should correspond to which
475 iterations of \verb!SB!.
477 \subsubsection{Basic Operations}
479 Basic operations on sets and maps include intersection (\ai[\tt]{*}),
480 union (\ai[\tt]{+}), difference (\ai[\tt]{-}), cross product (\ai[\tt]{cross}),
481 sampling (\ai[\tt]{sample}), affine hull (\ai[\tt]{aff}),
482 lexicographic optimization (\ai[\tt]{lexmin} or \ai[\tt]{lexmax}),
483 subset (\ai[\tt]{<=}) and equality (\ai[\tt]{=}) tests,
484 code generation (\ai[\tt]{codegen})
485 and the cardinality (\ai[\tt]{card}).
486 Additional operations on maps include computing domain (\ai[\tt]{dom})
487 and range (\ai[\tt]{ran}), differences between image and domain (\ai[\tt]{deltas}),
488 join (\ai[\tt]{.}), inverse (\ai[\tt]{\^{}-1}) and transitive closure (\ai[\tt]{\^{}+}).
489 The latter may result in an overapproximation.
491 The \ai[\tt]{card} operation computes the number of elements in a set
492 or the number of elements in the image of a domain element of a map.
493 The operation is performed exactly and completely symbolically and
494 the result is a piecewise quasipolynomial, i.e., a subdivision of one
495 or more spaces, with a quasipolynomial associated to each cell in the subdivision.
496 As a trivial example, the result of
497 \begin{verbatim}
498 card { A[i] -> B[j] : 0 <= j <= i }
499 \end{verbatim}
500 is \verb!{ A[i] -> (1+i) : i >= 0 }!.
501 Operations on piecewise quasipolynomials include sum (\ai[\tt]{+})
502 and difference (\ai[\tt]{-}) and the computation of an upper bound over the domain.
503 If the domain contains a pair of nested spaces, then the upper bound is computed over
504 the nested range. As another trivial example, the result of
505 \begin{verbatim}
506 ub{ [[i] -> [j]] -> j^2 : -i <= j <= i }
507 \end{verbatim}
509 \verb!({ [i] -> max(i^2) : i >= 0 }, True)!.
510 The first element in this list is the actual bound in the form
511 of a piecewise quasipolynomial fold,
512 i.e., a maximum of quasipolynomials defined over cells.
513 The second indicates whether the bound is tight, i.e., whether
514 a maximum has been computed.
516 \subsubsection{Advanced Operations}
518 While the basic {\tt card} operation simply counts the number of elements
519 in an affine set, it is also possible to assign a weight to each element
520 of the set and to compute the sum of those weights over all the points in the set.
521 The syntax for this weighted counting is to compute the {\tt sum} of
522 a piecewise quasipolynomial over its domain. As in the case of the {\tt ub}
523 operator, if the domain contains a pair of nested space, the sum is computed
524 over the range. As an example, the result
526 \begin{verbatim}
527 sum{ [[i] -> [j]] -> i*j : 0 <= j <= i }
528 \end{verbatim}
530 \verb|{ [i] -> (1/2*i^2+1/2*i^3) : i >= 0 }|.
532 After the computation of some sum or bound, the result may have to
533 be reformulated in terms of other variables. For example, during
534 inter procedural analysis, a result computed in terms of the formal
535 parameters may have to be reformulated in terms of the actual parameters.
536 {\tt iscc} therefore allows maps and
537 piecewise quasipolynomials or folds to be composed.
538 If the map is multi-valued, then the composition maps each domain element
539 to the sum or upper bound of the values at its image elements.
541 Finally, because of its high-level representation, {\tt iscc} can
542 provide a dependence analysis operation taking only three maps as input,
543 the sink accesses, the potential source accesses and a schedule.
544 The result is a single dependence map.
547 \subsubsection{More Examples}
548 \begin{verbatim}
549 P := [n, m] -> { [i,j] : 0 <= i <= n and i <= j <= m };
550 card P;
552 f := [n,m] -> { [i,j] -> i*j + n*i*i*j : i,j >= 0 and 5i + 27j <= n+m };
553 sum f;
554 s := sum f;
555 s @ [n,m] -> { : 0 <= n,m <= 20 };
557 f := [n] -> { [i] -> 2*n*i - n*n + 3*n - 1/2*i*i - 3/2*i-1 :
558 (exists j : 0 <= i < 4*n-1 and 0 <= j < n and
559 2*n-1 <= i+j <= 4*n-2 and i <= 2*n-1 ) };
560 ub f;
561 u := (ub f)[0];
562 u @ [n] -> { : 0 <= n <= 10 };
564 m := [n] -> { [i,j] -> [i+1,j+1] : 1 <= i,j < n;
565 [i,j] -> [i+1,j-1] : 1 <= i < n and 2 <= j <= n };
566 m^+;
567 (m^+)[0];
569 codegen [N] -> { A[i] -> [i,0] : 0 <= i <= N; B[i] -> [i,1] : 1 <= i <= N };
571 { [k] -> [i] : 1 <= i <= k } . { [n] -> 2 * n : n >= 1 };
573 { [m] -> [c] : 1 <= c <= m } . { [k] -> max((3 * k + k^2)) : k >= 1 };
574 \end{verbatim}
576 \subsubsection{Comparison to other Interactive Polyhedral Tools}
578 Two related interactive polyhedral tools are
579 the Omega calculator \shortcite{Omega_calc}
580 and {\tt SPPoC} \shortcite{Boulet2001SPPoC}.
581 The syntax of {\tt iscc} was very much inspired
582 by that of the Omega calculator. However, the Omega
583 calculator only knows sets and maps. In particular,
584 it does not perform any form of counting. An earlier version
585 of \barvinok/ came with a modified version of
586 the Omega calculator that introduced an operation
587 for counting the number of elements in a set, but it
588 would simply print the result and not allow any further
589 manipulations.
590 {\tt SPPoC} does support counting, but only the basic
591 operation of counting the elements in a set.
592 In particular, it does not support weighted counting,
593 nor the computation of upper bounds.
594 It also only supports (single-valued) functions
595 and not generic relations like the Omega calculator and {\tt iscc}.
596 Internally, {\tt SPPoC} uses {\tt PolyLib}, {\tt PipLib} and {\tt omega}
597 to perform
598 its operations. Although the first two of these libraries may have been
599 state-of-the-art at the time {\tt SPPoC} was created, they are
600 no longer actively maintained and have been largely
601 superseded by more recent libraries.
602 In particular, {\tt PipLib} effectively only supports a single
603 operation, which is now also available in both {\tt isl} and {\tt PPL}.
604 The operations on rational polyhedra in {\tt PolyLib} are also
605 available in {\tt PPL}, usually through a cleaner interface and
606 with a more efficient implementation. As to counting the elements
607 in a parametric polytope, Barvinok's algorithm,
608 implemented in the {\tt barvinok} library, is usually much faster
609 than the algorithm implemented in {\tt PolyLib}
610 \shortcite{Verdoolaege2007parametric}.
611 Furthermore,
612 the ability to work with named and nested spaces and the ability
613 of sets and maps to contain (pairs of) elements from different spaces
614 are not available in the Omega calculator and {\tt SPPoC}.
616 \newpage
617 \tablecaption{{\tt iscc} operations. The variables
618 have the following types,
619 $s$: set,
620 $m$: map,
621 $q$: piecewise quasipolynomial,
622 $f$: piecewise quasipolynomial fold,
623 $t$: schedule (tree),
624 $l$: list,
625 $i$: integer,
626 $b$: boolean,
627 $S$: string,
628 $o$: object of any type
630 \label{t:iscc}
631 \tablehead{
632 \hline
633 Syntax & Meaning
635 \hline
637 \tabletail{
638 \multicolumn{2}{r}{\small\sl continued on next page}
641 \tablelasttail{}
642 \begin{supertabular}{p{0.35\textwidth}p{0.6\textwidth}}
643 $s_2$ := \ai[\tt]{aff} $s_1$ & affine hull of $s_1$
645 $m_2$ := \ai[\tt]{aff} $m_1$ & affine hull of $m_1$
647 $q$ := \ai[\tt]{card} $s$ &
648 number of elements in the set $s$
650 $q$ := \ai[\tt]{card} $m$ &
651 number of elements in the image of a domain element
653 $s_2$ := \ai[\tt]{coalesce} $s_1$ &
654 simplify the representation of set $s_1$ by trying
655 to combine pairs of basic sets into a single
656 basic set
658 $m_2$ := \ai[\tt]{coalesce} $m_1$ &
659 simplify the representation of map $m_1$ by trying
660 to combine pairs of basic maps into a single
661 basic map
663 $q_2$ := \ai[\tt]{coalesce} $q_1$ &
664 simplify the representation of $q_1$ by trying
665 to combine pairs of basic sets in the domain
666 of $q_1$ into a single basic set
668 $f_2$ := \ai[\tt]{coalesce} $f_1$ &
669 simplify the representation of $f_1$ by trying
670 to combine pairs of basic sets in the domain
671 of $f_1$ into a single basic set
673 \ai[\tt]{codegen} $t$ &
674 generate code for the given schedule.
676 \ai[\tt]{codegen} $m$ &
677 generate code for the given schedule.
679 \ai[\tt]{codegen} $m_1$ \ai[\tt]{using} $m_2$ &
680 generate code for the schedule $m_1$ using the options $m_2$.
682 $s_2$ := \ai[\tt]{coefficients} $s_1$ &
683 The set of coefficients of valid constraints for $s_1$
685 $s_2$ := \ai[\tt]{solutions} $s_1$ &
686 The set of elements satisfying the constraints with coefficients in $s_1$
688 $s_3$ := $s_1$ \ai[\tt]{cross} $s_2$ &
689 Cartesian product of $s_1$ and $s_2$
691 $m_3$ := $m_1$ \ai[\tt]{cross} $m_2$ &
692 Cartesian product of $m_1$ and $m_2$
694 $m_3$ := $m_1$ \ai[\tt]{cross\_range} $m_2$ &
695 Cartesian product of the ranges of $m_1$ and $m_2$ for their shared domain
697 $s$ := \ai[\tt]{deltas} $m$ &
698 the set $\{\, y - x \mid x \to y \in m \,\}$
700 $m_2$ := \ai[\tt]{deltas\_map} $m_1$ &
701 the map $\{\, (x \to y) \to y - x \mid x \to y \in m_1 \,\}$
703 $s$ := \ai[\tt]{dom} $m$ &
704 domain of map $m$
706 $s$ := \ai[\tt]{dom} $q$ &
707 domain of piecewise quasipolynomial $q$
709 $s$ := \ai[\tt]{dom} $f$ &
710 domain of piecewise quasipolynomial fold $f$
712 $s$ := \ai[\tt]{dom} $t$ &
713 domain of schedule $t$
715 $s$ := \ai[\tt]{domain} $m$ &
716 domain of map $m$
718 $s$ := \ai[\tt]{domain} $q$ &
719 domain of piecewise quasipolynomial $q$
721 $s$ := \ai[\tt]{domain} $f$ &
722 domain of piecewise quasipolynomial fold $f$
724 $s$ := \ai[\tt]{domain} $t$ &
725 domain of schedule $t$
727 $m_2$ := \ai[\tt]{domain\_map} $m_1$ &
728 a map from a wrapped copy of $m_1$ to the domain of $m_1$
730 $s$ := \ai[\tt]{ran} $m$ &
731 range of map $m$
733 $s$ := \ai[\tt]{range} $m$ &
734 range of map $m$
736 $m_2$ := \ai[\tt]{range\_map} $m_1$ &
737 a map from a wrapped copy of $m_1$ to the range of $m_1$
739 $m$ := \ai[\tt]{identity} $s$ &
740 identity relation on $s$
742 $q$ := \ai[\tt]{lattice\_width} $s$ &
743 lattice width of the set $s$
745 $l$ := \ai[\tt]{lb} $q$ &
746 compute a
747 lower bound on the piecewise quasipolynomial $q$ over
748 all integer points in the domain of $q$
749 and return a list containing the lower bound
750 and a boolean that is true if the lower bound
751 is known to be tight.
752 If the domain of $q$ wraps a map, then the lower
753 bound is computed over all integer points in
754 the range of the wrapped map instead.
756 $s_2$ := \ai[\tt]{lexmin} $s_1$ &
757 lexicographically minimal element of $s_1$
759 $m_2$ := \ai[\tt]{lexmin} $m_1$ &
760 lexicographically minimal image element
762 $s_2$ := \ai[\tt]{lexmax} $s_1$ &
763 lexicographically maximal element of $s_1$
765 $m_2$ := \ai[\tt]{lexmax} $m_1$ &
766 lexicographically maximal image element
768 $s_2$ := \ai[\tt]{lift} $s_1$ &
769 lift $s_1$ to a space with extra dimensions corresponding
770 to the existentially quantified variables in $s_1$ such
771 that \lstinline!domain(unwrap(lift S))! is equal to \lstinline!S!
773 $m$ := \ai[\tt]{map} $t$ &
774 convert schedule $t$ to a map representation
776 $s_2$ := \ai[\tt]{params} $s_1$ &
777 parameter domain of set $s_1$
779 $s$ := \ai[\tt]{params} $m$ &
780 parameter domain of map $m$
782 $l$ := \ai[\tt]{parse\_file} $S$ &
783 parse the file names $S$ and return a list consisting of
784 the iteration domain, the must write access relation,
785 the may write access relation, the read access relation and
786 the original schedule.
787 This operation is only available if \ai[\tt]{pet}
788 support was compiled in.
790 $s_2$ := \ai[\tt]{poly} $s_1$ & polyhedral hull of $s_1$
792 $m_2$ := \ai[\tt]{poly} $m_1$ & polyhedral hull of $m_1$
794 $q_2$ := \ai[\tt]{poly} $q_1$ & polynomial approximation of $q_1$
796 $q_2$ := \ai[\tt]{lpoly} $q_1$ & polynomial underapproximation of $q_1$
798 $q_2$ := \ai[\tt]{upoly} $q_1$ & polynomial overapproximation of $q_1$
800 $l$ := \ai[\tt]{pow} $m$\ &
801 compute an overapproximation of the power
802 of $m$ and return a list containing the overapproximation
803 and a boolean that is true if the overapproximation
804 is known to be exact
806 \ai[\tt]{print} $o$ &
807 print object
809 $o$ := \ai[\tt]{read} {\tt "}{\it filename}{\tt"} &
810 read object from file
812 $s_2$ := \ai[\tt]{sample} $s_1$ &
813 a sample element of the set $s_1$
815 $m_2$ := \ai[\tt]{sample} $m_1$ &
816 a sample element of the map $m_1$
818 $s_2$ := \ai[\tt]{scan} $s_1$ &
819 the set $s_1$ split into individual elements,
820 provided $s_1$ contains a finite number of elements
822 $m_2$ := \ai[\tt]{scan} $m_1$ &
823 the map $m_1$ split into individual elements,
824 provided $m_1$ contains a finite number of elements
826 \ai[\tt]{source} {\tt "}{\it filename}{\tt"} &
827 read commands from file
829 $q_2$ := \ai[\tt]{sum} $q_1$ &
830 sum $q_1$ over all integer points in the domain of $q_1$,
831 or, if the domain of $q_1$ wraps a map, over all integer
832 points in the range of the wrapped map.
834 $S$ := \ai[\tt]{typeof} $o$ &
835 a string representation of the type of $o$
837 $l$ := \ai[\tt]{ub} $q$ &
838 compute an
839 upper bound on the piecewise quasipolynomial $q$ over
840 all integer points in the domain of $q$
841 and return a list containing the upper bound
842 and a boolean that is true if the upper bound
843 is known to be tight.
844 If the domain of $q$ wraps a map, then the upper
845 bound is computed over all integer points in
846 the range of the wrapped map instead.
848 $l$ := \ai[\tt]{vertices} $s$ &
849 a list of vertices of the rational polytope defined by the same constraints
850 as $s$
852 $s$ := \ai[\tt]{wrap} $m$ &
853 wrap the map in a set
855 $m$ := \ai[\tt]{unwrap} $s$ &
856 unwrap the map from the set
858 \ai[\tt]{write} {\tt "}{\it filename}{\tt"} $o$ &
859 write object to file
861 $m_2$ := \ai[\tt]{zip} $m_1$ &
862 the cross product of domain and range of $m_1$, i.e.,
863 $\{\, (\vec w \to \vec y) \to (\vec x \to \vec z)
864 \mid (\vec w \to \vec x) \to (\vec y \to \vec z) \in m_1 \,\}$
866 $m_3$ := \ai[\tt]{any} $m_1$ \ai[\tt]{before} $m_2$ \ai[\tt]{under} $t$ &
867 compute a map from any element $x$ in the domain of $m_1$
868 to any element $y$ in the domain of $m_2$
869 such that their images $m_1(x)$ and $m_2(y)$ overlap
870 and such that $x$ is scheduled before $y$ by $t$.
872 $m_4$ := \ai[\tt]{any} $m_1$ \ai[\tt]{before} $m_2$ \ai[\tt]{under} $m_3$ &
873 same as the previous operation, with the schedule represented by a map.
875 $l$ := \ai[\tt]{last} $m_1$ \ai[\tt]{before} $m_2$ \ai[\tt]{under} $t$ &
876 compute a map that contains for any element $y$ in the domain of $m_2$
877 a mapping from the last element $x$ in the domain of $m_1$
878 (according to the schedule $t$) to $y$
879 such that $m_1(x)$ and $m_2(y)$ overlap
880 and such that $x$ is scheduled before $y$ by $t$.
881 Return a list containing this map and the subset of
882 $m_2$ for which there is no corresponding element in the domain of $m_1$.
884 $l$ := \ai[\tt]{last} $m_1$ \ai[\tt]{before} $m_2$ \ai[\tt]{under} $m_3$ &
885 same as the previous operation, with the schedule represented by a map.
887 $m_4$ := \ai[\tt]{any} $m_1$ \ai[\tt]{last} $m_2$ \ai[\tt]{before} $m_3$
888 \ai[\tt]{under} $t$ &
889 compute a map that contains for any element $y$ in the domain of $m_3$
890 a mapping from the last element $x$ in the domain of $m_2$
891 (according to the schedule $t$) to $y$
892 such that $m_2(x)$ and $m_3(y)$ overlap
893 and such that $x$ is scheduled before $y$ by $t$
894 as well as from any element $z$ in the domain of $m_1$ such that
895 $m_1(z)$ and $m_3(y)$ overlap,
896 $z$ is scheduled before $y$ by $t$
897 and such that there is no $x$ in the domain of $m_2$ with
898 $m_2(x) \cap m_3(y) \ne \emptyset$ and
899 $x$ scheduled between $z$ and $y$ by $t$.
901 $m_5$ := \ai[\tt]{any} $m_1$ \ai[\tt]{last} $m_2$ \ai[\tt]{before} $m_3$
902 \ai[\tt]{under} $m_4$ &
903 same as the previous operation, with the schedule represented by a map.
905 $t$ := \ai[\tt]{schedule} $s$ \ai[\tt]{respecting} $m_1$ \ai[\tt]{minimizing} $m_2$ &
906 compute a schedule for the domains in $s$ that respects all dependences
907 in $m_1$ and tries to minimize the dependences in $m_2$.
909 $b_3$ := $b_1$ \ai{$+$} $b_2$ & or
911 $i_3$ := $i_1$ \ai{$+$} $i_2$ & sum
913 $s_3$ := $s_1$ \ai{$+$} $s_2$ & union
915 $m_3$ := $m_1$ \ai{$+$} $m_2$ & union
917 $q_3$ := $q_1$ \ai{$+$} $q_2$ & sum
919 $f_2$ := $f_1$ \ai{$+$} $q$ & sum
921 $f_2$ := $q$ \ai{$+$} $f_1$ & sum
923 $S_3$ := $S_1$ \ai{$+$} $S_2$ & concatenation
925 $S_2$ := $o$ \ai{$+$} $S_1$ &
926 concatenation of stringification of $o$ and $S_1$
928 $S_2$ := $S_1$ \ai{$+$} $o$ &
929 concatenation of $S_1$ and stringification of $o$
931 $i_3$ := $i_1$ \ai{$-$} $i_2$ & difference
933 $s_3$ := $s_1$ \ai{$-$} $s_2$ & set difference
935 $m_3$ := $m_1$ \ai{$-$} $m_2$ & set difference
937 $m_2$ := $m_1$ \ai{$-$} $s$ & subtract $s$ from the domain of $m_1$
939 $m_2$ := $m_1$ \ai[\tt]{->-} $s$ & subtract $s$ from the range of $m_1$
941 $q_3$ := $q_1$ \ai{$-$} $q_2$ & difference
943 $b_3$ := $b_1$ \ai{$*$} $b_2$ & and
945 $i_3$ := $i_1$ \ai{$*$} $i_2$ & product
947 $s_3$ := $s_1$ \ai{$*$} $s_2$ & intersection
949 $m_3$ := $m_1$ \ai{$*$} $m_2$ & intersection
951 $q_2$ := $i$ \ai{$*$} $q_1$ & product
953 $q_2$ := $q_1$ \ai{$*$} $i$ & product
955 $q_3$ := $q_1$ \ai{$*$} $q_2$ & product
957 $f_2$ := $i$ \ai{$*$} $f_1$ & product
959 $f_2$ := $f_1$ \ai{$*$} $i$ & product
961 $m_2$ := $m_1$ \ai{$*$} $s$ & intersect domain of $m_1$ with $s$
963 $q_2$ := $q_1$ \ai{$*$} $s$ & intersect domain of $q_1$ with $s$
965 $f_2$ := $f_1$ \ai{$*$} $s$ & intersect domain of $f_1$ with $s$
967 $m_2$ := $m_1$ \ai[\tt]{->$*$} $s$ & intersect range of $m_1$ with $s$
969 $s_2$ := $m$($s_1$) & apply map $m$ to set $s_1$
971 $q_2$ := $q_1$($s$) & apply $q_1$ to each element in $s$ and compute
972 the sum of the results
974 $l$ := $f$($s$) & apply $f$ to each element in $s$, compute
975 a bound of the results
976 and return a list containing the bound
977 and a boolean that is true if the bound
978 is known to be tight.
980 $m_3$ := $m_1$ \ai[\tt]{.} $m_2$ & join of $m_1$ and $m_2$
982 $m_3$ := $m_1$ \ai[\tt]{before} $m_2$ & join of $m_1$ and $m_2$
984 $m_3$ := $m_2$($m_1)$ & join of $m_1$ and $m_2$
986 $m_3$ := $m_2$ \ai[\tt]{after} $m_1$ & join of $m_1$ and $m_2$
988 $f_3$ := $f_1$ \ai[\tt]{.} $f_2$ & join of $f_1$ and $f_2$, combining
989 the lists of quasipolynomials over shared domains
991 $q_2$ := $m$ \ai[\tt]{.} $q_1$ & join of $m$ and $q_1$, taking the sum
992 over all elements in the intersection of the range of $m$ and the domain
993 of $q_1$
995 $q_2$ := $m$ \ai[\tt]{before} $q_1$ & $q_2$ := $m$ \ai[\tt]{.} $q_1$
997 $q_2$ := $q_1(m)$ & $q_2$ := $m$ \ai[\tt]{.} $q_1$
999 $q_2$ := $q_1$ \ai[\tt]{after} $m$ & $q_2$ := $m$ \ai[\tt]{.} $q_1$
1001 $l$ := $m$ \ai[\tt]{.} $f$ & join of $m$ and $f$, computing a bound
1002 over all elements in the intersection of the range of $m$ and the domain
1003 of $f$ and returning a list containing the bound
1004 and a boolean that is true if the bound is known to be tight.
1006 $l$ := $m$ \ai[\tt]{before} $f$ & $l$ := $m$ \ai[\tt]{.} $f$
1008 $l$ := $f(m)$ & $l$ := $m$ \ai[\tt]{.} $f$
1010 $l$ := $f$ \ai[\tt]{after} $m$ & $l$ := $m$ \ai[\tt]{.} $f$
1012 $m$ := $s_1$ \ai[\tt]{->} $s_2$ & universal map with domain $s_1$
1013 and range $s_2$
1015 $q_2$ := $q_1$ \ai{@} $s$ &
1016 evaluate the piecewise quasipolynomial $q_1$ in each element
1017 of the set $s$ and return a piecewise quasipolynomial
1018 mapping each of the individual elements to the resulting
1019 constant
1021 $q$ := $f$ \ai{@} $s$ &
1022 evaluate the piecewise quasipolynomial fold $f$ in each element
1023 of the set $s$ and return a piecewise quasipolynomial
1024 mapping each of the individual elements to the resulting
1025 constant
1027 $s_3$ := $s_1$ \ai[\tt]{\%} $s_2$ &
1028 simplify $s_1$ in the context of $s_2$, i.e., compute
1029 the gist of $s_1$ given $s_2$
1031 $m_3$ := $m_1$ \ai[\tt]{\%} $m_2$ &
1032 simplify $m_1$ in the context of $m_2$, i.e., compute
1033 the gist of $m_1$ given $m_2$
1035 $m_2$ := $m_1$ \ai[\tt]{\%} $s$ &
1036 simplify $m_1$ in the context of the domain $s$, i.e., compute
1037 the gist of $m_1$ given domain $s$
1039 $q_2$ := $q_1$ \ai[\tt]{\%} $s$ &
1040 simplify $q_1$ in the context of the domain $s$, i.e., compute
1041 the gist of $q_1$ given $s$
1043 $f_2$ := $f_1$ \ai[\tt]{\%} $s$ &
1044 simplify $f_1$ in the context of the domain $s$, i.e., compute
1045 the gist of $f_1$ given $s$
1047 $m_2$ := $m_1$\ai[\tt]{\^{}}i & the $i$th power of $m_1$;
1048 if $i$ is negative then the result is the ($-i$)th power of the inverse
1049 of $m_1$
1051 $l$ := $m$\ai[\tt]{\^{}+} &
1052 compute an overapproximation of the transitive closure
1053 of $m$ and return a list containing the overapproximation
1054 and a boolean that is true if the overapproximation
1055 is known to be exact
1057 $o$ := $l$[$i$] &
1058 the element at position $i$ in the list $l$
1060 $b$ := $q_1$ \ai[\tt]{==} $q_2$ & is $q_1$ obviously equal to $q_2$?
1062 $b$ := $f_1$ \ai[\tt]{==} $f_2$ & is $f_1$ obviously equal to $f_2$?
1064 $b$ := $s_1$ \ai[\tt]{=} $s_2$ & is $s_1$ equal to $s_2$?
1066 $b$ := $m_1$ \ai[\tt]{=} $m_2$ & is $m_1$ equal to $m_2$?
1068 $b$ := $S_1$ \ai[\tt]{=} $S_2$ & is $S_1$ equal to $S_2$?
1070 $b$ := $s_1$ \ai[\tt]{<=} $s_2$ & is $s_1$ a subset of $s_2$?
1072 $b$ := $m_1$ \ai[\tt]{<=} $m_2$ & is $m_1$ a subset of $m_2$?
1074 $b$ := $s_1$ \ai[\tt]{<} $s_2$ & is $s_1$ a proper subset of $s_2$?
1076 $b$ := $m_1$ \ai[\tt]{<} $m_2$ & is $m_1$ a proper subset of $m_2$?
1078 $b$ := $s_1$ \ai[\tt]{>=} $s_2$ & is $s_1$ a superset of $s_2$?
1080 $b$ := $m_1$ \ai[\tt]{>=} $m_2$ & is $m_1$ a superset of $m_2$?
1082 $b$ := $s_1$ \ai[\tt]{>} $s_2$ & is $s_1$ a proper superset of $s_2$?
1084 $b$ := $m_1$ \ai[\tt]{>} $m_2$ & is $m_1$ a proper superset of $m_2$?
1086 $m$ := $s_1$ \ai[\tt]{<<} $s_2$ & a map from
1087 $s_1$ to $s_2$ of those elements that live in the same space and
1088 such that the elements of $s_1$ are lexicographically strictly smaller
1089 than those of $s_2$.
1091 $m_3$ := $m_1$ \ai[\tt]{<<} $m_2$ & a map from the domain of
1092 $m_1$ to the domain of $m_2$ of those elements such that their images
1093 live in the same space and such that the images of the elements of
1094 $m_1$ are lexicographically strictly smaller than those of $m_2$.
1096 $m$ := $s_1$ \ai[\tt]{<<=} $s_2$ & a map from
1097 $s_1$ to $s_2$ of those elements that live in the same space and
1098 such that the elements of $s_1$ are lexicographically smaller
1099 than those of $s_2$.
1101 $m_3$ := $m_1$ \ai[\tt]{<<=} $m_2$ & a map from the domain of
1102 $m_1$ to the domain of $m_2$ of those elements such that their images
1103 live in the same space and such that the images of the elements of
1104 $m_1$ are lexicographically smaller than those of $m_2$.
1106 $m$ := $s_1$ \ai[\tt]{>>} $s_2$ & a map from
1107 $s_1$ to $s_2$ of those elements that live in the same space and
1108 such that the elements of $s_1$ are lexicographically strictly greater
1109 than those of $s_2$.
1111 $m_3$ := $m_1$ \ai[\tt]{>>} $m_2$ & a map from the domain of
1112 $m_1$ to the domain of $m_2$ of those elements such that their images
1113 live in the same space and such that the images of the elements of
1114 $m_1$ are lexicographically strictly greater than those of $m_2$.
1116 $m$ := $s_1$ \ai[\tt]{>>=} $s_2$ & a map from
1117 $s_1$ to $s_2$ of those elements that live in the same space and
1118 such that the elements of $s_1$ are lexicographically greater
1119 than those of $s_2$.
1121 $m_3$ := $m_1$ \ai[\tt]{>>=} $m_2$ & a map from the domain of
1122 $m_1$ to the domain of $m_2$ of those elements such that their images
1123 live in the same space and such that the images of the elements of
1124 $m_1$ are lexicographically greater than those of $m_2$.
1126 \end{supertabular}