You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
9.2KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Properties of the poly_int comparisons (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Properties of the poly_int comparisons (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Properties of the poly_int comparisons (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Comparisons-involving-poly_005fint.html#Comparisons-involving-poly_005fint" rel="up" title="Comparisons involving poly_int">
  30. <link href="Comparing-potentially_002dunordered-poly_005fints.html#Comparing-potentially_002dunordered-poly_005fints" rel="next" title="Comparing potentially-unordered poly_ints">
  31. <link href="Comparison-functions-for-poly_005fint.html#Comparison-functions-for-poly_005fint" rel="prev" title="Comparison functions for poly_int">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Properties-of-the-poly_005fint-comparisons"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Comparing-potentially_002dunordered-poly_005fints.html#Comparing-potentially_002dunordered-poly_005fints" accesskey="n" rel="next">Comparing potentially-unordered <code>poly_int</code>s</a>, Previous: <a href="Comparison-functions-for-poly_005fint.html#Comparison-functions-for-poly_005fint" accesskey="p" rel="prev">Comparison functions for <code>poly_int</code></a>, Up: <a href="Comparisons-involving-poly_005fint.html#Comparisons-involving-poly_005fint" accesskey="u" rel="up">Comparisons involving <code>poly_int</code></a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="Properties-of-the-poly_005fint-comparisons-1"></a>
  68. <h4 class="subsection">10.3.2 Properties of the <code>poly_int</code> comparisons</h4>
  69. <p>All &ldquo;maybe&rdquo; relations except <code>maybe_ne</code> are transitive, so for example:
  70. </p>
  71. <div class="smallexample">
  72. <pre class="smallexample">maybe_lt (<var>a</var>, <var>b</var>) &amp;&amp; maybe_lt (<var>b</var>, <var>c</var>) implies maybe_lt (<var>a</var>, <var>c</var>)
  73. </pre></div>
  74. <p>for all <var>a</var>, <var>b</var> and <var>c</var>. <code>maybe_lt</code>, <code>maybe_gt</code>
  75. and <code>maybe_ne</code> are irreflexive, so for example:
  76. </p>
  77. <div class="smallexample">
  78. <pre class="smallexample">!maybe_lt (<var>a</var>, <var>a</var>)
  79. </pre></div>
  80. <p>is true for all <var>a</var>. <code>maybe_le</code>, <code>maybe_eq</code> and <code>maybe_ge</code>
  81. are reflexive, so for example:
  82. </p>
  83. <div class="smallexample">
  84. <pre class="smallexample">maybe_le (<var>a</var>, <var>a</var>)
  85. </pre></div>
  86. <p>is true for all <var>a</var>. <code>maybe_eq</code> and <code>maybe_ne</code> are symmetric, so:
  87. </p>
  88. <div class="smallexample">
  89. <pre class="smallexample">maybe_eq (<var>a</var>, <var>b</var>) == maybe_eq (<var>b</var>, <var>a</var>)
  90. maybe_ne (<var>a</var>, <var>b</var>) == maybe_ne (<var>b</var>, <var>a</var>)
  91. </pre></div>
  92. <p>for all <var>a</var> and <var>b</var>. In addition:
  93. </p>
  94. <div class="smallexample">
  95. <pre class="smallexample">maybe_le (<var>a</var>, <var>b</var>) == maybe_lt (<var>a</var>, <var>b</var>) || maybe_eq (<var>a</var>, <var>b</var>)
  96. maybe_ge (<var>a</var>, <var>b</var>) == maybe_gt (<var>a</var>, <var>b</var>) || maybe_eq (<var>a</var>, <var>b</var>)
  97. maybe_lt (<var>a</var>, <var>b</var>) == maybe_gt (<var>b</var>, <var>a</var>)
  98. maybe_le (<var>a</var>, <var>b</var>) == maybe_ge (<var>b</var>, <var>a</var>)
  99. </pre></div>
  100. <p>However:
  101. </p>
  102. <div class="smallexample">
  103. <pre class="smallexample">maybe_le (<var>a</var>, <var>b</var>) &amp;&amp; maybe_le (<var>b</var>, <var>a</var>) does not imply !maybe_ne (<var>a</var>, <var>b</var>) [== known_eq (<var>a</var>, <var>b</var>)]
  104. maybe_ge (<var>a</var>, <var>b</var>) &amp;&amp; maybe_ge (<var>b</var>, <var>a</var>) does not imply !maybe_ne (<var>a</var>, <var>b</var>) [== known_eq (<var>a</var>, <var>b</var>)]
  105. </pre></div>
  106. <p>One example is again &lsquo;<samp><var>a</var> == 3 + 4<var>x</var></samp>&rsquo;
  107. and &lsquo;<samp><var>b</var> == 1 + 5<var>x</var></samp>&rsquo;, where &lsquo;<samp>maybe_le (<var>a</var>, <var>b</var>)</samp>&rsquo;,
  108. &lsquo;<samp>maybe_ge (<var>a</var>, <var>b</var>)</samp>&rsquo; and &lsquo;<samp>maybe_ne (<var>a</var>, <var>b</var>)</samp>&rsquo;
  109. all hold. <code>maybe_le</code> and <code>maybe_ge</code> are therefore not antisymetric
  110. and do not form a partial order.
  111. </p>
  112. <p>From the above, it follows that:
  113. </p>
  114. <ul>
  115. <li> All &ldquo;known&rdquo; relations except <code>known_ne</code> are transitive.
  116. </li><li> <code>known_lt</code>, <code>known_ne</code> and <code>known_gt</code> are irreflexive.
  117. </li><li> <code>known_le</code>, <code>known_eq</code> and <code>known_ge</code> are reflexive.
  118. </li></ul>
  119. <p>Also:
  120. </p>
  121. <div class="smallexample">
  122. <pre class="smallexample">known_lt (<var>a</var>, <var>b</var>) == known_gt (<var>b</var>, <var>a</var>)
  123. known_le (<var>a</var>, <var>b</var>) == known_ge (<var>b</var>, <var>a</var>)
  124. known_lt (<var>a</var>, <var>b</var>) implies !known_lt (<var>b</var>, <var>a</var>) [asymmetry]
  125. known_gt (<var>a</var>, <var>b</var>) implies !known_gt (<var>b</var>, <var>a</var>)
  126. known_le (<var>a</var>, <var>b</var>) &amp;&amp; known_le (<var>b</var>, <var>a</var>) == known_eq (<var>a</var>, <var>b</var>) [== !maybe_ne (<var>a</var>, <var>b</var>)]
  127. known_ge (<var>a</var>, <var>b</var>) &amp;&amp; known_ge (<var>b</var>, <var>a</var>) == known_eq (<var>a</var>, <var>b</var>) [== !maybe_ne (<var>a</var>, <var>b</var>)]
  128. </pre></div>
  129. <p><code>known_le</code> and <code>known_ge</code> are therefore antisymmetric and are
  130. partial orders. However:
  131. </p>
  132. <div class="smallexample">
  133. <pre class="smallexample">known_le (<var>a</var>, <var>b</var>) does not imply known_lt (<var>a</var>, <var>b</var>) || known_eq (<var>a</var>, <var>b</var>)
  134. known_ge (<var>a</var>, <var>b</var>) does not imply known_gt (<var>a</var>, <var>b</var>) || known_eq (<var>a</var>, <var>b</var>)
  135. </pre></div>
  136. <p>For example, &lsquo;<samp>known_le (4, 4 + 4<var>x</var>)</samp>&rsquo; holds because the runtime
  137. indeterminate <var>x</var> is a nonnegative integer, but neither
  138. <code>known_lt (4, 4 + 4<var>x</var>)</code> nor <code>known_eq (4, 4 + 4<var>x</var>)</code> hold.
  139. </p>
  140. <hr>
  141. <div class="header">
  142. <p>
  143. Next: <a href="Comparing-potentially_002dunordered-poly_005fints.html#Comparing-potentially_002dunordered-poly_005fints" accesskey="n" rel="next">Comparing potentially-unordered <code>poly_int</code>s</a>, Previous: <a href="Comparison-functions-for-poly_005fint.html#Comparison-functions-for-poly_005fint" accesskey="p" rel="prev">Comparison functions for <code>poly_int</code></a>, Up: <a href="Comparisons-involving-poly_005fint.html#Comparisons-involving-poly_005fint" accesskey="u" rel="up">Comparisons involving <code>poly_int</code></a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  144. </div>
  145. </body>
  146. </html>