bsc-leon-vatthauer/agda/bsc-thesis/Data.Nat.Base.html

435 lines
99 KiB
HTML
Raw Normal View History

2024-02-09 17:53:52 +01:00
<!DOCTYPE HTML>
<html><head><meta charset="utf-8"><title>Data.Nat.Base</title><link rel="stylesheet" href="Agda.css"></head><body><pre class="Agda"><a id="1" class="Comment">------------------------------------------------------------------------</a>
<a id="74" class="Comment">-- The Agda standard library</a>
<a id="103" class="Comment">--</a>
<a id="106" class="Comment">-- Natural numbers, basic types and operations</a>
<a id="153" class="Comment">------------------------------------------------------------------------</a>
<a id="227" class="Comment">-- See README.Data.Nat for examples of how to use and reason about</a>
<a id="294" class="Comment">-- naturals.</a>
<a id="308" class="Symbol">{-#</a> <a id="312" class="Keyword">OPTIONS</a> <a id="320" class="Pragma">--cubical-compatible</a> <a id="341" class="Pragma">--safe</a> <a id="348" class="Symbol">#-}</a>
<a id="353" class="Keyword">module</a> <a id="360" href="Data.Nat.Base.html" class="Module">Data.Nat.Base</a> <a id="374" class="Keyword">where</a>
<a id="381" class="Keyword">open</a> <a id="386" class="Keyword">import</a> <a id="393" href="Algebra.Bundles.Raw.html" class="Module">Algebra.Bundles.Raw</a> <a id="413" class="Keyword">using</a> <a id="419" class="Symbol">(</a><a id="420" href="Algebra.Bundles.Raw.html#644" class="Record">RawMagma</a><a id="428" class="Symbol">;</a> <a id="430" href="Algebra.Bundles.Raw.html#1105" class="Record">RawMonoid</a><a id="439" class="Symbol">;</a> <a id="441" href="Algebra.Bundles.Raw.html#2222" class="Record">RawNearSemiring</a><a id="456" class="Symbol">;</a> <a id="458" href="Algebra.Bundles.Raw.html#2934" class="Record">RawSemiring</a><a id="469" class="Symbol">)</a>
<a id="471" class="Keyword">open</a> <a id="476" class="Keyword">import</a> <a id="483" href="Algebra.Definitions.RawMagma.html" class="Module">Algebra.Definitions.RawMagma</a> <a id="512" class="Keyword">using</a> <a id="518" class="Symbol">(</a><a id="519" href="Algebra.Definitions.RawMagma.html#1339" class="Record Operator">_ˡ_</a><a id="523" class="Symbol">;</a> <a id="525" href="Algebra.Definitions.RawMagma.html#1388" class="InductiveConstructor Operator">_,_</a><a id="528" class="Symbol">)</a>
<a id="530" class="Keyword">open</a> <a id="535" class="Keyword">import</a> <a id="542" href="Data.Bool.Base.html" class="Module">Data.Bool.Base</a> <a id="557" class="Keyword">using</a> <a id="563" class="Symbol">(</a><a id="564" href="Agda.Builtin.Bool.html#173" class="Datatype">Bool</a><a id="568" class="Symbol">;</a> <a id="570" href="Agda.Builtin.Bool.html#198" class="InductiveConstructor">true</a><a id="574" class="Symbol">;</a> <a id="576" href="Agda.Builtin.Bool.html#192" class="InductiveConstructor">false</a><a id="581" class="Symbol">;</a> <a id="583" href="Data.Bool.Base.html#1348" class="Function">T</a><a id="584" class="Symbol">;</a> <a id="586" href="Data.Bool.Base.html#941" class="Function">not</a><a id="589" class="Symbol">)</a>
<a id="591" class="Keyword">open</a> <a id="596" class="Keyword">import</a> <a id="603" href="Data.Parity.Base.html" class="Module">Data.Parity.Base</a> <a id="620" class="Keyword">using</a> <a id="626" class="Symbol">(</a><a id="627" href="Data.Parity.Base.html#604" class="Datatype">Parity</a><a id="633" class="Symbol">;</a> <a id="635" href="Data.Parity.Base.html#625" class="InductiveConstructor">0</a><a id="637" class="Symbol">;</a> <a id="639" href="Data.Parity.Base.html#639" class="InductiveConstructor">1</a><a id="641" class="Symbol">)</a>
<a id="643" class="Keyword">open</a> <a id="648" class="Keyword">import</a> <a id="655" href="Level.html" class="Module">Level</a> <a id="661" class="Keyword">using</a> <a id="667" class="Symbol">(</a><a id="668" href="Level.html#521" class="Function">0</a><a id="670" class="Symbol">)</a>
<a id="672" class="Keyword">open</a> <a id="677" class="Keyword">import</a> <a id="684" href="Relation.Binary.Core.html" class="Module">Relation.Binary.Core</a> <a id="705" class="Keyword">using</a> <a id="711" class="Symbol">(</a><a id="712" href="Relation.Binary.Core.html#896" class="Function">Rel</a><a id="715" class="Symbol">)</a>
<a id="717" class="Keyword">open</a> <a id="722" class="Keyword">import</a> <a id="729" href="Relation.Binary.PropositionalEquality.Core.html" class="Module">Relation.Binary.PropositionalEquality.Core</a>
<a id="774" class="Keyword">using</a> <a id="780" class="Symbol">(</a><a id="781" href="Agda.Builtin.Equality.html#150" class="Datatype Operator">_≡_</a><a id="784" class="Symbol">;</a> <a id="786" href="Relation.Binary.PropositionalEquality.Core.html#858" class="Function Operator">_≢_</a><a id="789" class="Symbol">;</a> <a id="791" href="Agda.Builtin.Equality.html#207" class="InductiveConstructor">refl</a><a id="795" class="Symbol">)</a>
<a id="797" class="Keyword">open</a> <a id="802" class="Keyword">import</a> <a id="809" href="Relation.Nullary.Negation.Core.html" class="Module">Relation.Nullary.Negation.Core</a> <a id="840" class="Keyword">using</a> <a id="846" class="Symbol">(</a><a id="847" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬_</a><a id="849" class="Symbol">;</a> <a id="851" href="Relation.Nullary.Negation.Core.html#1226" class="Function">contradiction</a><a id="864" class="Symbol">)</a>
<a id="866" class="Keyword">open</a> <a id="871" class="Keyword">import</a> <a id="878" href="Relation.Unary.html" class="Module">Relation.Unary</a> <a id="893" class="Keyword">using</a> <a id="899" class="Symbol">(</a><a id="900" href="Relation.Unary.html#1232" class="Function">Pred</a><a id="904" class="Symbol">)</a>
<a id="907" class="Comment">------------------------------------------------------------------------</a>
<a id="980" class="Comment">-- Types</a>
<a id="990" class="Keyword">open</a> <a id="995" class="Keyword">import</a> <a id="1002" href="Agda.Builtin.Nat.html" class="Module">Agda.Builtin.Nat</a> <a id="1019" class="Keyword">public</a>
<a id="1028" class="Keyword">using</a> <a id="1034" class="Symbol">(</a><a id="1035" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a><a id="1039" class="Symbol">;</a> <a id="1041" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a><a id="1044" class="Symbol">)</a> <a id="1046" class="Keyword">renaming</a> <a id="1055" class="Symbol">(</a><a id="1056" href="Agda.Builtin.Nat.html#203" class="Datatype">Nat</a> <a id="1060" class="Symbol">to</a> <a id="1063" class="Datatype"></a><a id="1064" class="Symbol">)</a>
<a id="1067" class="Comment">--smart constructor</a>
<a id="1087" class="Keyword">pattern</a> <a id="2+"></a><a id="1095" href="Data.Nat.Base.html#1095" class="InductiveConstructor">2+</a> <a id="1098" href="Data.Nat.Base.html#1111" class="Bound">n</a> <a id="1100" class="Symbol">=</a> <a id="1102" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="1106" class="Symbol">(</a><a id="1107" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="1111" href="Data.Nat.Base.html#1111" class="Bound">n</a><a id="1112" class="Symbol">)</a>
<a id="1115" class="Comment">------------------------------------------------------------------------</a>
<a id="1188" class="Comment">-- Boolean equality relation</a>
<a id="1218" class="Keyword">open</a> <a id="1223" class="Keyword">import</a> <a id="1230" href="Agda.Builtin.Nat.html" class="Module">Agda.Builtin.Nat</a> <a id="1247" class="Keyword">public</a>
<a id="1256" class="Keyword">using</a> <a id="1262" class="Symbol">()</a> <a id="1265" class="Keyword">renaming</a> <a id="1274" class="Symbol">(</a><a id="1275" href="Agda.Builtin.Nat.html#631" class="Primitive Operator">_==_</a> <a id="1280" class="Symbol">to</a> <a id="1283" class="Primitive Operator">_≡ᵇ_</a><a id="1287" class="Symbol">)</a>
<a id="1290" class="Comment">------------------------------------------------------------------------</a>
<a id="1363" class="Comment">-- Boolean ordering relation</a>
<a id="1393" class="Keyword">open</a> <a id="1398" class="Keyword">import</a> <a id="1405" href="Agda.Builtin.Nat.html" class="Module">Agda.Builtin.Nat</a> <a id="1422" class="Keyword">public</a>
<a id="1431" class="Keyword">using</a> <a id="1437" class="Symbol">()</a> <a id="1440" class="Keyword">renaming</a> <a id="1449" class="Symbol">(</a><a id="1450" href="Agda.Builtin.Nat.html#757" class="Primitive Operator">_&lt;_</a> <a id="1454" class="Symbol">to</a> <a id="1457" class="Primitive Operator">_&lt;ᵇ_</a><a id="1461" class="Symbol">)</a>
<a id="1464" class="Keyword">infix</a> <a id="1470" class="Number">4</a> <a id="1472" href="Data.Nat.Base.html#1477" class="Function Operator">_≤ᵇ_</a>
<a id="_≤ᵇ_"></a><a id="1477" href="Data.Nat.Base.html#1477" class="Function Operator">_≤ᵇ_</a> <a id="1482" class="Symbol">:</a> <a id="1484" class="Symbol">(</a><a id="1485" href="Data.Nat.Base.html#1485" class="Bound">m</a> <a id="1487" href="Data.Nat.Base.html#1487" class="Bound">n</a> <a id="1489" class="Symbol">:</a> <a id="1491" href="Data.Nat.Base.html#1063" class="Datatype"></a><a id="1492" class="Symbol">)</a> <a id="1494" class="Symbol"></a> <a id="1496" href="Agda.Builtin.Bool.html#173" class="Datatype">Bool</a>
<a id="1501" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="1507" href="Data.Nat.Base.html#1477" class="Function Operator">≤ᵇ</a> <a id="1510" href="Data.Nat.Base.html#1510" class="Bound">n</a> <a id="1512" class="Symbol">=</a> <a id="1514" href="Agda.Builtin.Bool.html#198" class="InductiveConstructor">true</a>
<a id="1519" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="1523" href="Data.Nat.Base.html#1523" class="Bound">m</a> <a id="1525" href="Data.Nat.Base.html#1477" class="Function Operator">≤ᵇ</a> <a id="1528" href="Data.Nat.Base.html#1528" class="Bound">n</a> <a id="1530" class="Symbol">=</a> <a id="1532" href="Data.Nat.Base.html#1523" class="Bound">m</a> <a id="1534" href="Data.Nat.Base.html#1457" class="Primitive Operator">&lt;</a> <a id="1537" href="Data.Nat.Base.html#1528" class="Bound">n</a>
<a id="1540" class="Comment">------------------------------------------------------------------------</a>
<a id="1613" class="Comment">-- Standard ordering relations</a>
<a id="1645" class="Keyword">infix</a> <a id="1651" class="Number">4</a> <a id="1653" href="Data.Nat.Base.html#1691" class="Datatype Operator">_≤_</a> <a id="1657" href="Data.Nat.Base.html#1801" class="Function Operator">_&lt;_</a> <a id="1661" href="Data.Nat.Base.html#2259" class="Function Operator">_≥_</a> <a id="1665" href="Data.Nat.Base.html#2289" class="Function Operator">_&gt;_</a> <a id="1669" href="Data.Nat.Base.html#2319" class="Function Operator">_≰_</a> <a id="1673" href="Data.Nat.Base.html#2351" class="Function Operator">_≮_</a> <a id="1677" href="Data.Nat.Base.html#2383" class="Function Operator">_≱_</a> <a id="1681" href="Data.Nat.Base.html#2415" class="Function Operator">_≯_</a>
<a id="1686" class="Keyword">data</a> <a id="_≤_"></a><a id="1691" href="Data.Nat.Base.html#1691" class="Datatype Operator">_≤_</a> <a id="1695" class="Symbol">:</a> <a id="1697" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="1701" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="1703" href="Level.html#521" class="Function">0</a> <a id="1706" class="Keyword">where</a>
<a id="_≤_.z≤n"></a><a id="1714" href="Data.Nat.Base.html#1714" class="InductiveConstructor">z≤n</a> <a id="1718" class="Symbol">:</a> <a id="1720" class="Symbol"></a> <a id="1722" class="Symbol">{</a><a id="1723" href="Data.Nat.Base.html#1723" class="Bound">n</a><a id="1724" class="Symbol">}</a> <a id="1742" class="Symbol"></a> <a id="1744" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="1750" href="Data.Nat.Base.html#1691" class="Datatype Operator"></a> <a id="1752" href="Data.Nat.Base.html#1723" class="Bound">n</a>
<a id="_≤_.s≤s"></a><a id="1756" href="Data.Nat.Base.html#1756" class="InductiveConstructor">s≤s</a> <a id="1760" class="Symbol">:</a> <a id="1762" class="Symbol"></a> <a id="1764" class="Symbol">{</a><a id="1765" href="Data.Nat.Base.html#1765" class="Bound">m</a> <a id="1767" href="Data.Nat.Base.html#1767" class="Bound">n</a><a id="1768" class="Symbol">}</a> <a id="1770" class="Symbol">(</a><a id="1771" href="Data.Nat.Base.html#1771" class="Bound">m≤n</a> <a id="1775" class="Symbol">:</a> <a id="1777" href="Data.Nat.Base.html#1765" class="Bound">m</a> <a id="1779" href="Data.Nat.Base.html#1691" class="Datatype Operator"></a> <a id="1781" href="Data.Nat.Base.html#1767" class="Bound">n</a><a id="1782" class="Symbol">)</a> <a id="1784" class="Symbol"></a> <a id="1786" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="1790" href="Data.Nat.Base.html#1765" class="Bound">m</a> <a id="1792" href="Data.Nat.Base.html#1691" class="Datatype Operator"></a> <a id="1794" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="1798" href="Data.Nat.Base.html#1767" class="Bound">n</a>
<a id="_&lt;_"></a><a id="1801" href="Data.Nat.Base.html#1801" class="Function Operator">_&lt;_</a> <a id="1805" class="Symbol">:</a> <a id="1807" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="1811" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="1813" href="Level.html#521" class="Function">0</a>
<a id="1816" href="Data.Nat.Base.html#1816" class="Bound">m</a> <a id="1818" href="Data.Nat.Base.html#1801" class="Function Operator">&lt;</a> <a id="1820" href="Data.Nat.Base.html#1820" class="Bound">n</a> <a id="1822" class="Symbol">=</a> <a id="1824" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="1828" href="Data.Nat.Base.html#1816" class="Bound">m</a> <a id="1830" href="Data.Nat.Base.html#1691" class="Datatype Operator"></a> <a id="1832" href="Data.Nat.Base.html#1820" class="Bound">n</a>
<a id="1835" class="Comment">-- Smart constructors of _&lt;_</a>
<a id="1865" class="Keyword">pattern</a> <a id="z&lt;s"></a><a id="1873" href="Data.Nat.Base.html#1873" class="InductiveConstructor">z&lt;s</a> <a id="1881" class="Symbol">{</a><a id="1882" href="Data.Nat.Base.html#1901" class="Bound">n</a><a id="1883" class="Symbol">}</a> <a id="1889" class="Symbol">=</a> <a id="1891" href="Data.Nat.Base.html#1756" class="InductiveConstructor">s≤s</a> <a id="1895" class="Symbol">(</a><a id="1896" href="Data.Nat.Base.html#1714" class="InductiveConstructor">z≤n</a> <a id="1900" class="Symbol">{</a><a id="1901" href="Data.Nat.Base.html#1901" class="Bound">n</a><a id="1902" class="Symbol">})</a>
<a id="1905" class="Keyword">pattern</a> <a id="s&lt;s"></a><a id="1913" href="Data.Nat.Base.html#1913" class="InductiveConstructor">s&lt;s</a> <a id="1917" class="Symbol">{</a><a id="1918" href="Data.Nat.Base.html#1936" class="Bound">m</a><a id="1919" class="Symbol">}</a> <a id="1921" class="Symbol">{</a><a id="1922" href="Data.Nat.Base.html#1940" class="Bound">n</a><a id="1923" class="Symbol">}</a> <a id="1925" href="Data.Nat.Base.html#1943" class="Bound">m&lt;n</a> <a id="1929" class="Symbol">=</a> <a id="1931" href="Data.Nat.Base.html#1756" class="InductiveConstructor">s≤s</a> <a id="1935" class="Symbol">{</a><a id="1936" href="Data.Nat.Base.html#1936" class="Bound">m</a><a id="1937" class="Symbol">}</a> <a id="1939" class="Symbol">{</a><a id="1940" href="Data.Nat.Base.html#1940" class="Bound">n</a><a id="1941" class="Symbol">}</a> <a id="1943" href="Data.Nat.Base.html#1943" class="Bound">m&lt;n</a>
<a id="1947" class="Keyword">pattern</a> <a id="sz&lt;ss"></a><a id="1955" href="Data.Nat.Base.html#1955" class="InductiveConstructor">sz&lt;ss</a> <a id="1963" class="Symbol">{</a><a id="1964" href="Data.Nat.Base.html#1983" class="Bound">n</a><a id="1965" class="Symbol">}</a> <a id="1971" class="Symbol">=</a> <a id="1973" href="Data.Nat.Base.html#1913" class="InductiveConstructor">s&lt;s</a> <a id="1977" class="Symbol">(</a><a id="1978" href="Data.Nat.Base.html#1873" class="InductiveConstructor">z&lt;s</a> <a id="1982" class="Symbol">{</a><a id="1983" href="Data.Nat.Base.html#1983" class="Bound">n</a><a id="1984" class="Symbol">})</a>
<a id="1988" class="Comment">-- Smart destructors of _≤_, _&lt;_</a>
<a id="s≤s⁻¹"></a><a id="2022" href="Data.Nat.Base.html#2022" class="Function">s≤s⁻¹</a> <a id="2028" class="Symbol">:</a> <a id="2030" class="Symbol"></a> <a id="2032" class="Symbol">{</a><a id="2033" href="Data.Nat.Base.html#2033" class="Bound">m</a> <a id="2035" href="Data.Nat.Base.html#2035" class="Bound">n</a><a id="2036" class="Symbol">}</a> <a id="2038" class="Symbol"></a> <a id="2040" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="2044" href="Data.Nat.Base.html#2033" class="Bound">m</a> <a id="2046" href="Data.Nat.Base.html#1691" class="Datatype Operator"></a> <a id="2048" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="2052" href="Data.Nat.Base.html#2035" class="Bound">n</a> <a id="2054" class="Symbol"></a> <a id="2056" href="Data.Nat.Base.html#2033" class="Bound">m</a> <a id="2058" href="Data.Nat.Base.html#1691" class="Datatype Operator"></a> <a id="2060" href="Data.Nat.Base.html#2035" class="Bound">n</a>
<a id="2062" href="Data.Nat.Base.html#2022" class="Function">s≤s⁻¹</a> <a id="2068" class="Symbol">(</a><a id="2069" href="Data.Nat.Base.html#1756" class="InductiveConstructor">s≤s</a> <a id="2073" href="Data.Nat.Base.html#2073" class="Bound">m≤n</a><a id="2076" class="Symbol">)</a> <a id="2078" class="Symbol">=</a> <a id="2080" href="Data.Nat.Base.html#2073" class="Bound">m≤n</a>
<a id="s&lt;s⁻¹"></a><a id="2085" href="Data.Nat.Base.html#2085" class="Function">s&lt;s⁻¹</a> <a id="2091" class="Symbol">:</a> <a id="2093" class="Symbol"></a> <a id="2095" class="Symbol">{</a><a id="2096" href="Data.Nat.Base.html#2096" class="Bound">m</a> <a id="2098" href="Data.Nat.Base.html#2098" class="Bound">n</a><a id="2099" class="Symbol">}</a> <a id="2101" class="Symbol"></a> <a id="2103" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="2107" href="Data.Nat.Base.html#2096" class="Bound">m</a> <a id="2109" href="Data.Nat.Base.html#1801" class="Function Operator">&lt;</a> <a id="2111" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="2115" href="Data.Nat.Base.html#2098" class="Bound">n</a> <a id="2117" class="Symbol"></a> <a id="2119" href="Data.Nat.Base.html#2096" class="Bound">m</a> <a id="2121" href="Data.Nat.Base.html#1801" class="Function Operator">&lt;</a> <a id="2123" href="Data.Nat.Base.html#2098" class="Bound">n</a>
<a id="2125" href="Data.Nat.Base.html#2085" class="Function">s&lt;s⁻¹</a> <a id="2131" class="Symbol">(</a><a id="2132" href="Data.Nat.Base.html#1913" class="InductiveConstructor">s&lt;s</a> <a id="2136" href="Data.Nat.Base.html#2136" class="Bound">m&lt;n</a><a id="2139" class="Symbol">)</a> <a id="2141" class="Symbol">=</a> <a id="2143" href="Data.Nat.Base.html#2136" class="Bound">m&lt;n</a>
<a id="2149" class="Comment">------------------------------------------------------------------------</a>
<a id="2222" class="Comment">-- Other derived ordering relations</a>
<a id="_≥_"></a><a id="2259" href="Data.Nat.Base.html#2259" class="Function Operator">_≥_</a> <a id="2263" class="Symbol">:</a> <a id="2265" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="2269" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="2271" href="Level.html#521" class="Function">0</a>
<a id="2274" href="Data.Nat.Base.html#2274" class="Bound">m</a> <a id="2276" href="Data.Nat.Base.html#2259" class="Function Operator"></a> <a id="2278" href="Data.Nat.Base.html#2278" class="Bound">n</a> <a id="2280" class="Symbol">=</a> <a id="2282" href="Data.Nat.Base.html#2278" class="Bound">n</a> <a id="2284" href="Data.Nat.Base.html#1691" class="Datatype Operator"></a> <a id="2286" href="Data.Nat.Base.html#2274" class="Bound">m</a>
<a id="_&gt;_"></a><a id="2289" href="Data.Nat.Base.html#2289" class="Function Operator">_&gt;_</a> <a id="2293" class="Symbol">:</a> <a id="2295" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="2299" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="2301" href="Level.html#521" class="Function">0</a>
<a id="2304" href="Data.Nat.Base.html#2304" class="Bound">m</a> <a id="2306" href="Data.Nat.Base.html#2289" class="Function Operator">&gt;</a> <a id="2308" href="Data.Nat.Base.html#2308" class="Bound">n</a> <a id="2310" class="Symbol">=</a> <a id="2312" href="Data.Nat.Base.html#2308" class="Bound">n</a> <a id="2314" href="Data.Nat.Base.html#1801" class="Function Operator">&lt;</a> <a id="2316" href="Data.Nat.Base.html#2304" class="Bound">m</a>
<a id="_≰_"></a><a id="2319" href="Data.Nat.Base.html#2319" class="Function Operator">_≰_</a> <a id="2323" class="Symbol">:</a> <a id="2325" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="2329" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="2331" href="Level.html#521" class="Function">0</a>
<a id="2334" href="Data.Nat.Base.html#2334" class="Bound">a</a> <a id="2336" href="Data.Nat.Base.html#2319" class="Function Operator"></a> <a id="2338" href="Data.Nat.Base.html#2338" class="Bound">b</a> <a id="2340" class="Symbol">=</a> <a id="2342" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="2344" href="Data.Nat.Base.html#2334" class="Bound">a</a> <a id="2346" href="Data.Nat.Base.html#1691" class="Datatype Operator"></a> <a id="2348" href="Data.Nat.Base.html#2338" class="Bound">b</a>
<a id="_≮_"></a><a id="2351" href="Data.Nat.Base.html#2351" class="Function Operator">_≮_</a> <a id="2355" class="Symbol">:</a> <a id="2357" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="2361" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="2363" href="Level.html#521" class="Function">0</a>
<a id="2366" href="Data.Nat.Base.html#2366" class="Bound">a</a> <a id="2368" href="Data.Nat.Base.html#2351" class="Function Operator"></a> <a id="2370" href="Data.Nat.Base.html#2370" class="Bound">b</a> <a id="2372" class="Symbol">=</a> <a id="2374" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="2376" href="Data.Nat.Base.html#2366" class="Bound">a</a> <a id="2378" href="Data.Nat.Base.html#1801" class="Function Operator">&lt;</a> <a id="2380" href="Data.Nat.Base.html#2370" class="Bound">b</a>
<a id="_≱_"></a><a id="2383" href="Data.Nat.Base.html#2383" class="Function Operator">_≱_</a> <a id="2387" class="Symbol">:</a> <a id="2389" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="2393" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="2395" href="Level.html#521" class="Function">0</a>
<a id="2398" href="Data.Nat.Base.html#2398" class="Bound">a</a> <a id="2400" href="Data.Nat.Base.html#2383" class="Function Operator"></a> <a id="2402" href="Data.Nat.Base.html#2402" class="Bound">b</a> <a id="2404" class="Symbol">=</a> <a id="2406" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="2408" href="Data.Nat.Base.html#2398" class="Bound">a</a> <a id="2410" href="Data.Nat.Base.html#2259" class="Function Operator"></a> <a id="2412" href="Data.Nat.Base.html#2402" class="Bound">b</a>
<a id="_≯_"></a><a id="2415" href="Data.Nat.Base.html#2415" class="Function Operator">_≯_</a> <a id="2419" class="Symbol">:</a> <a id="2421" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="2425" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="2427" href="Level.html#521" class="Function">0</a>
<a id="2430" href="Data.Nat.Base.html#2430" class="Bound">a</a> <a id="2432" href="Data.Nat.Base.html#2415" class="Function Operator"></a> <a id="2434" href="Data.Nat.Base.html#2434" class="Bound">b</a> <a id="2436" class="Symbol">=</a> <a id="2438" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="2440" href="Data.Nat.Base.html#2430" class="Bound">a</a> <a id="2442" href="Data.Nat.Base.html#2289" class="Function Operator">&gt;</a> <a id="2444" href="Data.Nat.Base.html#2434" class="Bound">b</a>
<a id="2447" class="Comment">------------------------------------------------------------------------</a>
<a id="2520" class="Comment">-- Simple predicates</a>
<a id="2542" class="Comment">-- Defining these predicates in terms of `T` and therefore ultimately</a>
<a id="2612" class="Comment">-- `` and `⊥` allows Agda to automatically infer them for any natural</a>
<a id="2683" class="Comment">-- of the correct form. Consequently in many circumstances this</a>
<a id="2747" class="Comment">-- eliminates the need to explicitly pass a proof when the predicate</a>
<a id="2816" class="Comment">-- argument is either an implicit or an instance argument. See `_/_`</a>
<a id="2885" class="Comment">-- and `_%_` further down this file for examples.</a>
<a id="2935" class="Comment">--</a>
<a id="2938" class="Comment">-- Furthermore, defining these predicates as single-field records</a>
<a id="3004" class="Comment">-- (rather defining them directly as the type of their field) is</a>
<a id="3069" class="Comment">-- necessary as the current version of Agda is far better at</a>
<a id="3130" class="Comment">-- reconstructing meta-variable values for the record parameters.</a>
<a id="3197" class="Comment">-- A predicate saying that a number is not equal to 0.</a>
<a id="3253" class="Keyword">record</a> <a id="NonZero"></a><a id="3260" href="Data.Nat.Base.html#3260" class="Record">NonZero</a> <a id="3268" class="Symbol">(</a><a id="3269" href="Data.Nat.Base.html#3269" class="Bound">n</a> <a id="3271" class="Symbol">:</a> <a id="3273" href="Data.Nat.Base.html#1063" class="Datatype"></a><a id="3274" class="Symbol">)</a> <a id="3276" class="Symbol">:</a> <a id="3278" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="3282" class="Keyword">where</a>
<a id="3290" class="Keyword">field</a>
<a id="NonZero.nonZero"></a><a id="3300" href="Data.Nat.Base.html#3300" class="Field">nonZero</a> <a id="3308" class="Symbol">:</a> <a id="3310" href="Data.Bool.Base.html#1348" class="Function">T</a> <a id="3312" class="Symbol">(</a><a id="3313" href="Data.Bool.Base.html#941" class="Function">not</a> <a id="3317" class="Symbol">(</a><a id="3318" href="Data.Nat.Base.html#3269" class="Bound">n</a> <a id="3320" href="Data.Nat.Base.html#1283" class="Primitive Operator">≡ᵇ</a> <a id="3323" class="Number">0</a><a id="3324" class="Symbol">))</a>
<a id="3328" class="Comment">-- Instances</a>
<a id="3342" class="Keyword">instance</a>
<a id="nonZero"></a><a id="3353" href="Data.Nat.Base.html#3353" class="Function">nonZero</a> <a id="3361" class="Symbol">:</a> <a id="3363" class="Symbol"></a> <a id="3365" class="Symbol">{</a><a id="3366" href="Data.Nat.Base.html#3366" class="Bound">n</a><a id="3367" class="Symbol">}</a> <a id="3369" class="Symbol"></a> <a id="3371" href="Data.Nat.Base.html#3260" class="Record">NonZero</a> <a id="3379" class="Symbol">(</a><a id="3380" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="3384" href="Data.Nat.Base.html#3366" class="Bound">n</a><a id="3385" class="Symbol">)</a>
<a id="3389" href="Data.Nat.Base.html#3353" class="Function">nonZero</a> <a id="3397" class="Symbol">=</a> <a id="3399" class="Symbol">_</a>
<a id="3402" class="Comment">-- Constructors</a>
<a id="≢-nonZero"></a><a id="3419" href="Data.Nat.Base.html#3419" class="Function">≢-nonZero</a> <a id="3429" class="Symbol">:</a> <a id="3431" class="Symbol"></a> <a id="3433" class="Symbol">{</a><a id="3434" href="Data.Nat.Base.html#3434" class="Bound">n</a><a id="3435" class="Symbol">}</a> <a id="3437" class="Symbol"></a> <a id="3439" href="Data.Nat.Base.html#3434" class="Bound">n</a> <a id="3441" href="Relation.Binary.PropositionalEquality.Core.html#858" class="Function Operator"></a> <a id="3443" class="Number">0</a> <a id="3445" class="Symbol"></a> <a id="3447" href="Data.Nat.Base.html#3260" class="Record">NonZero</a> <a id="3455" href="Data.Nat.Base.html#3434" class="Bound">n</a>
<a id="3457" href="Data.Nat.Base.html#3419" class="Function">≢-nonZero</a> <a id="3467" class="Symbol">{</a><a id="3468" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a><a id="3472" class="Symbol">}</a> <a id="3475" href="Data.Nat.Base.html#3475" class="Bound">0≢0</a> <a id="3479" class="Symbol">=</a> <a id="3481" href="Relation.Nullary.Negation.Core.html#1226" class="Function">contradiction</a> <a id="3495" href="Agda.Builtin.Equality.html#207" class="InductiveConstructor">refl</a> <a id="3500" href="Data.Nat.Base.html#3475" class="Bound">0≢0</a>
<a id="3504" href="Data.Nat.Base.html#3419" class="Function">≢-nonZero</a> <a id="3514" class="Symbol">{</a><a id="3515" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="3519" href="Data.Nat.Base.html#3519" class="Bound">n</a><a id="3520" class="Symbol">}</a> <a id="3522" href="Data.Nat.Base.html#3522" class="Bound">n≢0</a> <a id="3526" class="Symbol">=</a> <a id="3528" class="Symbol">_</a>
<a id="&gt;-nonZero"></a><a id="3531" href="Data.Nat.Base.html#3531" class="Function">&gt;-nonZero</a> <a id="3541" class="Symbol">:</a> <a id="3543" class="Symbol"></a> <a id="3545" class="Symbol">{</a><a id="3546" href="Data.Nat.Base.html#3546" class="Bound">n</a><a id="3547" class="Symbol">}</a> <a id="3549" class="Symbol"></a> <a id="3551" href="Data.Nat.Base.html#3546" class="Bound">n</a> <a id="3553" href="Data.Nat.Base.html#2289" class="Function Operator">&gt;</a> <a id="3555" class="Number">0</a> <a id="3557" class="Symbol"></a> <a id="3559" href="Data.Nat.Base.html#3260" class="Record">NonZero</a> <a id="3567" href="Data.Nat.Base.html#3546" class="Bound">n</a>
<a id="3569" href="Data.Nat.Base.html#3531" class="Function">&gt;-nonZero</a> <a id="3579" href="Data.Nat.Base.html#1873" class="InductiveConstructor">z&lt;s</a> <a id="3583" class="Symbol">=</a> <a id="3585" class="Symbol">_</a>
<a id="3588" class="Comment">-- Destructors</a>
<a id="≢-nonZero⁻¹"></a><a id="3604" href="Data.Nat.Base.html#3604" class="Function">≢-nonZero⁻¹</a> <a id="3616" class="Symbol">:</a> <a id="3618" class="Symbol"></a> <a id="3620" href="Data.Nat.Base.html#3620" class="Bound">n</a> <a id="3622" class="Symbol"></a> <a id="3624" class="Symbol">.{{</a><a id="3627" href="Data.Nat.Base.html#3260" class="Record">NonZero</a> <a id="3635" href="Data.Nat.Base.html#3620" class="Bound">n</a><a id="3636" class="Symbol">}}</a> <a id="3639" class="Symbol"></a> <a id="3641" href="Data.Nat.Base.html#3620" class="Bound">n</a> <a id="3643" href="Relation.Binary.PropositionalEquality.Core.html#858" class="Function Operator"></a> <a id="3645" class="Number">0</a>
<a id="3647" href="Data.Nat.Base.html#3604" class="Function">≢-nonZero⁻¹</a> <a id="3659" class="Symbol">(</a><a id="3660" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="3664" href="Data.Nat.Base.html#3664" class="Bound">n</a><a id="3665" class="Symbol">)</a> <a id="3667" class="Symbol">()</a>
<a id="&gt;-nonZero⁻¹"></a><a id="3671" href="Data.Nat.Base.html#3671" class="Function">&gt;-nonZero⁻¹</a> <a id="3683" class="Symbol">:</a> <a id="3685" class="Symbol"></a> <a id="3687" href="Data.Nat.Base.html#3687" class="Bound">n</a> <a id="3689" class="Symbol"></a> <a id="3691" class="Symbol">.{{</a><a id="3694" href="Data.Nat.Base.html#3260" class="Record">NonZero</a> <a id="3702" href="Data.Nat.Base.html#3687" class="Bound">n</a><a id="3703" class="Symbol">}}</a> <a id="3706" class="Symbol"></a> <a id="3708" href="Data.Nat.Base.html#3687" class="Bound">n</a> <a id="3710" href="Data.Nat.Base.html#2289" class="Function Operator">&gt;</a> <a id="3712" class="Number">0</a>
<a id="3714" href="Data.Nat.Base.html#3671" class="Function">&gt;-nonZero⁻¹</a> <a id="3726" class="Symbol">(</a><a id="3727" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="3731" href="Data.Nat.Base.html#3731" class="Bound">n</a><a id="3732" class="Symbol">)</a> <a id="3734" class="Symbol">=</a> <a id="3736" href="Data.Nat.Base.html#1873" class="InductiveConstructor">z&lt;s</a>
<a id="3741" class="Comment">-- The property of being a non-zero, non-unit</a>
<a id="3788" class="Keyword">record</a> <a id="NonTrivial"></a><a id="3795" href="Data.Nat.Base.html#3795" class="Record">NonTrivial</a> <a id="3806" class="Symbol">(</a><a id="3807" href="Data.Nat.Base.html#3807" class="Bound">n</a> <a id="3809" class="Symbol">:</a> <a id="3811" href="Data.Nat.Base.html#1063" class="Datatype"></a><a id="3812" class="Symbol">)</a> <a id="3814" class="Symbol">:</a> <a id="3816" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="3820" class="Keyword">where</a>
<a id="3828" class="Keyword">field</a>
<a id="NonTrivial.nonTrivial"></a><a id="3838" href="Data.Nat.Base.html#3838" class="Field">nonTrivial</a> <a id="3849" class="Symbol">:</a> <a id="3851" href="Data.Bool.Base.html#1348" class="Function">T</a> <a id="3853" class="Symbol">(</a><a id="3854" class="Number">1</a> <a id="3856" href="Data.Nat.Base.html#1457" class="Primitive Operator">&lt;</a> <a id="3859" href="Data.Nat.Base.html#3807" class="Bound">n</a><a id="3860" class="Symbol">)</a>
<a id="3863" class="Comment">-- Instances</a>
<a id="3877" class="Keyword">instance</a>
<a id="nonTrivial"></a><a id="3888" href="Data.Nat.Base.html#3888" class="Function">nonTrivial</a> <a id="3899" class="Symbol">:</a> <a id="3901" class="Symbol"></a> <a id="3903" class="Symbol">{</a><a id="3904" href="Data.Nat.Base.html#3904" class="Bound">n</a><a id="3905" class="Symbol">}</a> <a id="3907" class="Symbol"></a> <a id="3909" href="Data.Nat.Base.html#3795" class="Record">NonTrivial</a> <a id="3920" class="Symbol">(</a><a id="3921" href="Data.Nat.Base.html#1095" class="InductiveConstructor">2+</a> <a id="3924" href="Data.Nat.Base.html#3904" class="Bound">n</a><a id="3925" class="Symbol">)</a>
<a id="3929" href="Data.Nat.Base.html#3888" class="Function">nonTrivial</a> <a id="3940" class="Symbol">=</a> <a id="3942" class="Symbol">_</a>
<a id="3945" class="Comment">-- Constructors</a>
<a id="n&gt;1⇒nonTrivial"></a><a id="3962" href="Data.Nat.Base.html#3962" class="Function">n&gt;1⇒nonTrivial</a> <a id="3977" class="Symbol">:</a> <a id="3979" class="Symbol"></a> <a id="3981" class="Symbol">{</a><a id="3982" href="Data.Nat.Base.html#3982" class="Bound">n</a><a id="3983" class="Symbol">}</a> <a id="3985" class="Symbol"></a> <a id="3987" href="Data.Nat.Base.html#3982" class="Bound">n</a> <a id="3989" href="Data.Nat.Base.html#2289" class="Function Operator">&gt;</a> <a id="3991" class="Number">1</a> <a id="3993" class="Symbol"></a> <a id="3995" href="Data.Nat.Base.html#3795" class="Record">NonTrivial</a> <a id="4006" href="Data.Nat.Base.html#3982" class="Bound">n</a>
<a id="4008" href="Data.Nat.Base.html#3962" class="Function">n&gt;1⇒nonTrivial</a> <a id="4023" href="Data.Nat.Base.html#1955" class="InductiveConstructor">sz&lt;ss</a> <a id="4029" class="Symbol">=</a> <a id="4031" class="Symbol">_</a>
<a id="4034" class="Comment">-- Destructors</a>
<a id="nonTrivial⇒nonZero"></a><a id="4050" href="Data.Nat.Base.html#4050" class="Function">nonTrivial⇒nonZero</a> <a id="4069" class="Symbol">:</a> <a id="4071" class="Symbol"></a> <a id="4073" href="Data.Nat.Base.html#4073" class="Bound">n</a> <a id="4075" class="Symbol"></a> <a id="4077" class="Symbol">.{{</a><a id="4080" href="Data.Nat.Base.html#3795" class="Record">NonTrivial</a> <a id="4091" href="Data.Nat.Base.html#4073" class="Bound">n</a><a id="4092" class="Symbol">}}</a> <a id="4095" class="Symbol"></a> <a id="4097" href="Data.Nat.Base.html#3260" class="Record">NonZero</a> <a id="4105" href="Data.Nat.Base.html#4073" class="Bound">n</a>
<a id="4107" href="Data.Nat.Base.html#4050" class="Function">nonTrivial⇒nonZero</a> <a id="4126" class="Symbol">(</a><a id="4127" href="Data.Nat.Base.html#1095" class="InductiveConstructor">2+</a> <a id="4130" class="Symbol">_)</a> <a id="4133" class="Symbol">=</a> <a id="4135" class="Symbol">_</a>
<a id="nonTrivial⇒n&gt;1"></a><a id="4138" href="Data.Nat.Base.html#4138" class="Function">nonTrivial⇒n&gt;1</a> <a id="4153" class="Symbol">:</a> <a id="4155" class="Symbol"></a> <a id="4157" href="Data.Nat.Base.html#4157" class="Bound">n</a> <a id="4159" class="Symbol"></a> <a id="4161" class="Symbol">.{{</a><a id="4164" href="Data.Nat.Base.html#3795" class="Record">NonTrivial</a> <a id="4175" href="Data.Nat.Base.html#4157" class="Bound">n</a><a id="4176" class="Symbol">}}</a> <a id="4179" class="Symbol"></a> <a id="4181" href="Data.Nat.Base.html#4157" class="Bound">n</a> <a id="4183" href="Data.Nat.Base.html#2289" class="Function Operator">&gt;</a> <a id="4185" class="Number">1</a>
<a id="4187" href="Data.Nat.Base.html#4138" class="Function">nonTrivial⇒n&gt;1</a> <a id="4202" class="Symbol">(</a><a id="4203" href="Data.Nat.Base.html#1095" class="InductiveConstructor">2+</a> <a id="4206" class="Symbol">_)</a> <a id="4209" class="Symbol">=</a> <a id="4211" href="Data.Nat.Base.html#1955" class="InductiveConstructor">sz&lt;ss</a>
<a id="nonTrivial⇒≢1"></a><a id="4218" href="Data.Nat.Base.html#4218" class="Function">nonTrivial⇒≢1</a> <a id="4232" class="Symbol">:</a> <a id="4234" class="Symbol"></a> <a id="4236" class="Symbol">{</a><a id="4237" href="Data.Nat.Base.html#4237" class="Bound">n</a><a id="4238" class="Symbol">}</a> <a id="4240" class="Symbol"></a> <a id="4242" class="Symbol">.{{</a><a id="4245" href="Data.Nat.Base.html#3795" class="Record">NonTrivial</a> <a id="4256" href="Data.Nat.Base.html#4237" class="Bound">n</a><a id="4257" class="Symbol">}}</a> <a id="4260" class="Symbol"></a> <a id="4262" href="Data.Nat.Base.html#4237" class="Bound">n</a> <a id="4264" href="Relation.Binary.PropositionalEquality.Core.html#858" class="Function Operator"></a> <a id="4266" class="Number">1</a>
<a id="4268" href="Data.Nat.Base.html#4218" class="Function">nonTrivial⇒≢1</a> <a id="4282" class="Symbol">{{()}}</a> <a id="4289" href="Agda.Builtin.Equality.html#207" class="InductiveConstructor">refl</a>
<a id="4295" class="Comment">------------------------------------------------------------------------</a>
<a id="4368" class="Comment">-- Raw bundles</a>
<a id="4384" class="Keyword">open</a> <a id="4389" class="Keyword">import</a> <a id="4396" href="Agda.Builtin.Nat.html" class="Module">Agda.Builtin.Nat</a> <a id="4413" class="Keyword">public</a>
<a id="4422" class="Keyword">using</a> <a id="4428" class="Symbol">(</a><a id="4429" href="Agda.Builtin.Nat.html#336" class="Primitive Operator">_+_</a><a id="4432" class="Symbol">;</a> <a id="4434" href="Agda.Builtin.Nat.html#539" class="Primitive Operator">_*_</a><a id="4437" class="Symbol">)</a> <a id="4439" class="Keyword">renaming</a> <a id="4448" class="Symbol">(</a><a id="4449" href="Agda.Builtin.Nat.html#426" class="Primitive Operator">_-_</a> <a id="4453" class="Symbol">to</a> <a id="4456" class="Primitive Operator">_∸_</a><a id="4459" class="Symbol">)</a>
<a id="+-rawMagma"></a><a id="4462" href="Data.Nat.Base.html#4462" class="Function">+-rawMagma</a> <a id="4473" class="Symbol">:</a> <a id="4475" href="Algebra.Bundles.Raw.html#644" class="Record">RawMagma</a> <a id="4484" href="Level.html#521" class="Function">0</a> <a id="4487" href="Level.html#521" class="Function">0</a>
<a id="4490" href="Data.Nat.Base.html#4462" class="Function">+-rawMagma</a> <a id="4501" class="Symbol">=</a> <a id="4503" class="Keyword">record</a>
<a id="4512" class="Symbol">{</a> <a id="4514" href="Algebra.Bundles.Raw.html#745" class="Field Operator">_≈_</a> <a id="4518" class="Symbol">=</a> <a id="4520" href="Agda.Builtin.Equality.html#150" class="Datatype Operator">_≡_</a>
<a id="4526" class="Symbol">;</a> <a id="4528" href="Algebra.Bundles.Raw.html#773" class="Field Operator">_∙_</a> <a id="4532" class="Symbol">=</a> <a id="4534" href="Agda.Builtin.Nat.html#336" class="Primitive Operator">_+_</a>
<a id="4540" class="Symbol">}</a>
<a id="+-0-rawMonoid"></a><a id="4543" href="Data.Nat.Base.html#4543" class="Function">+-0-rawMonoid</a> <a id="4557" class="Symbol">:</a> <a id="4559" href="Algebra.Bundles.Raw.html#1105" class="Record">RawMonoid</a> <a id="4569" href="Level.html#521" class="Function">0</a> <a id="4572" href="Level.html#521" class="Function">0</a>
<a id="4575" href="Data.Nat.Base.html#4543" class="Function">+-0-rawMonoid</a> <a id="4589" class="Symbol">=</a> <a id="4591" class="Keyword">record</a>
<a id="4600" class="Symbol">{</a> <a id="4602" href="Algebra.Bundles.Raw.html#1207" class="Field Operator">_≈_</a> <a id="4606" class="Symbol">=</a> <a id="4608" href="Agda.Builtin.Equality.html#150" class="Datatype Operator">_≡_</a>
<a id="4614" class="Symbol">;</a> <a id="4616" href="Algebra.Bundles.Raw.html#1235" class="Field Operator">_∙_</a> <a id="4620" class="Symbol">=</a> <a id="4622" href="Agda.Builtin.Nat.html#336" class="Primitive Operator">_+_</a>
<a id="4628" class="Symbol">;</a> <a id="4630" href="Algebra.Bundles.Raw.html#1261" class="Field">ε</a> <a id="4634" class="Symbol">=</a> <a id="4636" class="Number">0</a>
<a id="4640" class="Symbol">}</a>
<a id="*-rawMagma"></a><a id="4643" href="Data.Nat.Base.html#4643" class="Function">*-rawMagma</a> <a id="4654" class="Symbol">:</a> <a id="4656" href="Algebra.Bundles.Raw.html#644" class="Record">RawMagma</a> <a id="4665" href="Level.html#521" class="Function">0</a> <a id="4668" href="Level.html#521" class="Function">0</a>
<a id="4671" href="Data.Nat.Base.html#4643" class="Function">*-rawMagma</a> <a id="4682" class="Symbol">=</a> <a id="4684" class="Keyword">record</a>
<a id="4693" class="Symbol">{</a> <a id="4695" href="Algebra.Bundles.Raw.html#745" class="Field Operator">_≈_</a> <a id="4699" class="Symbol">=</a> <a id="4701" href="Agda.Builtin.Equality.html#150" class="Datatype Operator">_≡_</a>
<a id="4707" class="Symbol">;</a> <a id="4709" href="Algebra.Bundles.Raw.html#773" class="Field Operator">_∙_</a> <a id="4713" class="Symbol">=</a> <a id="4715" href="Agda.Builtin.Nat.html#539" class="Primitive Operator">_*_</a>
<a id="4721" class="Symbol">}</a>
<a id="*-1-rawMonoid"></a><a id="4724" href="Data.Nat.Base.html#4724" class="Function">*-1-rawMonoid</a> <a id="4738" class="Symbol">:</a> <a id="4740" href="Algebra.Bundles.Raw.html#1105" class="Record">RawMonoid</a> <a id="4750" href="Level.html#521" class="Function">0</a> <a id="4753" href="Level.html#521" class="Function">0</a>
<a id="4756" href="Data.Nat.Base.html#4724" class="Function">*-1-rawMonoid</a> <a id="4770" class="Symbol">=</a> <a id="4772" class="Keyword">record</a>
<a id="4781" class="Symbol">{</a> <a id="4783" href="Algebra.Bundles.Raw.html#1207" class="Field Operator">_≈_</a> <a id="4787" class="Symbol">=</a> <a id="4789" href="Agda.Builtin.Equality.html#150" class="Datatype Operator">_≡_</a>
<a id="4795" class="Symbol">;</a> <a id="4797" href="Algebra.Bundles.Raw.html#1235" class="Field Operator">_∙_</a> <a id="4801" class="Symbol">=</a> <a id="4803" href="Agda.Builtin.Nat.html#539" class="Primitive Operator">_*_</a>
<a id="4809" class="Symbol">;</a> <a id="4811" href="Algebra.Bundles.Raw.html#1261" class="Field">ε</a> <a id="4813" class="Symbol">=</a> <a id="4815" class="Number">1</a>
<a id="4819" class="Symbol">}</a>
<a id="+-*-rawNearSemiring"></a><a id="4822" href="Data.Nat.Base.html#4822" class="Function">+-*-rawNearSemiring</a> <a id="4842" class="Symbol">:</a> <a id="4844" href="Algebra.Bundles.Raw.html#2222" class="Record">RawNearSemiring</a> <a id="4860" href="Level.html#521" class="Function">0</a> <a id="4863" href="Level.html#521" class="Function">0</a>
<a id="4866" href="Data.Nat.Base.html#4822" class="Function">+-*-rawNearSemiring</a> <a id="4886" class="Symbol">=</a> <a id="4888" class="Keyword">record</a>
<a id="4897" class="Symbol">{</a> <a id="4899" href="Algebra.Bundles.Raw.html#2325" class="Field">Carrier</a> <a id="4907" class="Symbol">=</a> <a id="4909" class="Symbol">_</a>
<a id="4913" class="Symbol">;</a> <a id="4915" href="Algebra.Bundles.Raw.html#2345" class="Field Operator">_≈_</a> <a id="4919" class="Symbol">=</a> <a id="4921" href="Agda.Builtin.Equality.html#150" class="Datatype Operator">_≡_</a>
<a id="4927" class="Symbol">;</a> <a id="4929" href="Algebra.Bundles.Raw.html#2373" class="Field Operator">_+_</a> <a id="4933" class="Symbol">=</a> <a id="4935" href="Agda.Builtin.Nat.html#336" class="Primitive Operator">_+_</a>
<a id="4941" class="Symbol">;</a> <a id="4943" href="Algebra.Bundles.Raw.html#2399" class="Field Operator">_*_</a> <a id="4947" class="Symbol">=</a> <a id="4949" href="Agda.Builtin.Nat.html#539" class="Primitive Operator">_*_</a>
<a id="4955" class="Symbol">;</a> <a id="4957" href="Algebra.Bundles.Raw.html#2425" class="Field">0#</a> <a id="4960" class="Symbol">=</a> <a id="4962" class="Number">0</a>
<a id="4966" class="Symbol">}</a>
<a id="+-*-rawSemiring"></a><a id="4969" href="Data.Nat.Base.html#4969" class="Function">+-*-rawSemiring</a> <a id="4985" class="Symbol">:</a> <a id="4987" href="Algebra.Bundles.Raw.html#2934" class="Record">RawSemiring</a> <a id="4999" href="Level.html#521" class="Function">0</a> <a id="5002" href="Level.html#521" class="Function">0</a>
<a id="5005" href="Data.Nat.Base.html#4969" class="Function">+-*-rawSemiring</a> <a id="5021" class="Symbol">=</a> <a id="5023" class="Keyword">record</a>
<a id="5032" class="Symbol">{</a> <a id="5034" href="Algebra.Bundles.Raw.html#3033" class="Field">Carrier</a> <a id="5042" class="Symbol">=</a> <a id="5044" class="Symbol">_</a>
<a id="5048" class="Symbol">;</a> <a id="5050" href="Algebra.Bundles.Raw.html#3053" class="Field Operator">_≈_</a> <a id="5054" class="Symbol">=</a> <a id="5056" href="Agda.Builtin.Equality.html#150" class="Datatype Operator">_≡_</a>
<a id="5062" class="Symbol">;</a> <a id="5064" href="Algebra.Bundles.Raw.html#3081" class="Field Operator">_+_</a> <a id="5068" class="Symbol">=</a> <a id="5070" href="Agda.Builtin.Nat.html#336" class="Primitive Operator">_+_</a>
<a id="5076" class="Symbol">;</a> <a id="5078" href="Algebra.Bundles.Raw.html#3107" class="Field Operator">_*_</a> <a id="5082" class="Symbol">=</a> <a id="5084" href="Agda.Builtin.Nat.html#539" class="Primitive Operator">_*_</a>
<a id="5090" class="Symbol">;</a> <a id="5092" href="Algebra.Bundles.Raw.html#3133" class="Field">0#</a> <a id="5095" class="Symbol">=</a> <a id="5097" class="Number">0</a>
<a id="5101" class="Symbol">;</a> <a id="5103" href="Algebra.Bundles.Raw.html#3155" class="Field">1#</a> <a id="5106" class="Symbol">=</a> <a id="5108" class="Number">1</a>
<a id="5112" class="Symbol">}</a>
<a id="5115" class="Comment">------------------------------------------------------------------------</a>
<a id="5188" class="Comment">-- Arithmetic</a>
<a id="5203" class="Keyword">open</a> <a id="5208" class="Keyword">import</a> <a id="5215" href="Agda.Builtin.Nat.html" class="Module">Agda.Builtin.Nat</a>
<a id="5234" class="Keyword">using</a> <a id="5240" class="Symbol">(</a><a id="5241" href="Agda.Builtin.Nat.html#1537" class="Primitive">div-helper</a><a id="5251" class="Symbol">;</a> <a id="5253" href="Agda.Builtin.Nat.html#3040" class="Primitive">mod-helper</a><a id="5263" class="Symbol">)</a>
<a id="pred"></a><a id="5266" href="Data.Nat.Base.html#5266" class="Function">pred</a> <a id="5271" class="Symbol">:</a> <a id="5273" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="5275" class="Symbol"></a> <a id="5277" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="5279" href="Data.Nat.Base.html#5266" class="Function">pred</a> <a id="5284" href="Data.Nat.Base.html#5284" class="Bound">n</a> <a id="5286" class="Symbol">=</a> <a id="5288" href="Data.Nat.Base.html#5284" class="Bound">n</a> <a id="5290" href="Data.Nat.Base.html#4456" class="Primitive Operator"></a> <a id="5292" class="Number">1</a>
<a id="5295" class="Keyword">infix</a> <a id="5302" class="Number">8</a> <a id="5304" href="Data.Nat.Base.html#7385" class="Function Operator">_!</a>
<a id="5307" class="Keyword">infixl</a> <a id="5314" class="Number">7</a> <a id="5316" href="Data.Nat.Base.html#5845" class="Function Operator">_⊓_</a> <a id="5320" href="Data.Nat.Base.html#6135" class="Function Operator">_⊓_</a> <a id="5325" href="Data.Nat.Base.html#7096" class="Function Operator">_/_</a> <a id="5329" href="Data.Nat.Base.html#7279" class="Function Operator">_%_</a>
<a id="5333" class="Keyword">infixl</a> <a id="5340" class="Number">6</a> <a id="5342" href="Data.Nat.Base.html#5411" class="Function Operator">_+⋎_</a> <a id="5347" href="Data.Nat.Base.html#5479" class="Function Operator">_⊔_</a> <a id="5351" href="Data.Nat.Base.html#5767" class="Function Operator">_⊔_</a>
<a id="5357" class="Comment">-- Argument-swapping addition. Used by Data.Vec._⋎_.</a>
<a id="_+⋎_"></a><a id="5411" href="Data.Nat.Base.html#5411" class="Function Operator">_+⋎_</a> <a id="5416" class="Symbol">:</a> <a id="5418" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="5420" class="Symbol"></a> <a id="5422" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="5424" class="Symbol"></a> <a id="5426" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="5428" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="5434" href="Data.Nat.Base.html#5411" class="Function Operator">+⋎</a> <a id="5437" href="Data.Nat.Base.html#5437" class="Bound">n</a> <a id="5439" class="Symbol">=</a> <a id="5441" href="Data.Nat.Base.html#5437" class="Bound">n</a>
<a id="5443" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5447" href="Data.Nat.Base.html#5447" class="Bound">m</a> <a id="5449" href="Data.Nat.Base.html#5411" class="Function Operator">+⋎</a> <a id="5452" href="Data.Nat.Base.html#5452" class="Bound">n</a> <a id="5454" class="Symbol">=</a> <a id="5456" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5460" class="Symbol">(</a><a id="5461" href="Data.Nat.Base.html#5452" class="Bound">n</a> <a id="5463" href="Data.Nat.Base.html#5411" class="Function Operator">+⋎</a> <a id="5466" href="Data.Nat.Base.html#5447" class="Bound">m</a><a id="5467" class="Symbol">)</a>
<a id="5470" class="Comment">-- Max.</a>
<a id="_⊔_"></a><a id="5479" href="Data.Nat.Base.html#5479" class="Function Operator">_⊔_</a> <a id="5483" class="Symbol">:</a> <a id="5485" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="5487" class="Symbol"></a> <a id="5489" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="5491" class="Symbol"></a> <a id="5493" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="5495" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="5501" href="Data.Nat.Base.html#5479" class="Function Operator"></a> <a id="5503" href="Data.Nat.Base.html#5503" class="Bound">n</a> <a id="5509" class="Symbol">=</a> <a id="5511" href="Data.Nat.Base.html#5503" class="Bound">n</a>
<a id="5513" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5517" href="Data.Nat.Base.html#5517" class="Bound">m</a> <a id="5519" href="Data.Nat.Base.html#5479" class="Function Operator"></a> <a id="5521" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="5527" class="Symbol">=</a> <a id="5529" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5533" href="Data.Nat.Base.html#5517" class="Bound">m</a>
<a id="5535" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5539" href="Data.Nat.Base.html#5539" class="Bound">m</a> <a id="5541" href="Data.Nat.Base.html#5479" class="Function Operator"></a> <a id="5543" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5547" href="Data.Nat.Base.html#5547" class="Bound">n</a> <a id="5549" class="Symbol">=</a> <a id="5551" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5555" class="Symbol">(</a><a id="5556" href="Data.Nat.Base.html#5539" class="Bound">m</a> <a id="5558" href="Data.Nat.Base.html#5479" class="Function Operator"></a> <a id="5560" href="Data.Nat.Base.html#5547" class="Bound">n</a><a id="5561" class="Symbol">)</a>
<a id="5564" class="Comment">-- Max defined in terms of primitive operations.</a>
<a id="5613" class="Comment">-- This is much faster than `_⊔_` but harder to reason about. For proofs</a>
<a id="5686" class="Comment">-- involving this function, convert it to `_⊔_` with `Data.Nat.Properties.⊔≡⊔‵`.</a>
<a id="_⊔_"></a><a id="5767" href="Data.Nat.Base.html#5767" class="Function Operator">_⊔_</a> <a id="5772" class="Symbol">:</a> <a id="5774" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="5776" class="Symbol"></a> <a id="5778" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="5780" class="Symbol"></a> <a id="5782" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="5784" href="Data.Nat.Base.html#5784" class="Bound">m</a> <a id="5786" href="Data.Nat.Base.html#5767" class="Function Operator">⊔′</a> <a id="5789" href="Data.Nat.Base.html#5789" class="Bound">n</a> <a id="5791" class="Keyword">with</a> <a id="5796" href="Data.Nat.Base.html#5784" class="Bound">m</a> <a id="5798" href="Data.Nat.Base.html#1457" class="Primitive Operator">&lt;</a> <a id="5801" href="Data.Nat.Base.html#5789" class="Bound">n</a>
<a id="5803" class="Symbol">...</a> <a id="5807" class="Symbol">|</a> <a id="5809" href="Agda.Builtin.Bool.html#192" class="InductiveConstructor">false</a> <a id="5815" class="Symbol">=</a> <a id="5817" class="Bound">m</a>
<a id="5819" class="Symbol">...</a> <a id="5823" class="Symbol">|</a> <a id="5825" href="Agda.Builtin.Bool.html#198" class="InductiveConstructor">true</a> <a id="5831" class="Symbol">=</a> <a id="5833" class="Bound">n</a>
<a id="5836" class="Comment">-- Min.</a>
<a id="_⊓_"></a><a id="5845" href="Data.Nat.Base.html#5845" class="Function Operator">_⊓_</a> <a id="5849" class="Symbol">:</a> <a id="5851" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="5853" class="Symbol"></a> <a id="5855" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="5857" class="Symbol"></a> <a id="5859" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="5861" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="5867" href="Data.Nat.Base.html#5845" class="Function Operator"></a> <a id="5869" href="Data.Nat.Base.html#5869" class="Bound">n</a> <a id="5875" class="Symbol">=</a> <a id="5877" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a>
<a id="5882" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5886" href="Data.Nat.Base.html#5886" class="Bound">m</a> <a id="5888" href="Data.Nat.Base.html#5845" class="Function Operator"></a> <a id="5890" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="5896" class="Symbol">=</a> <a id="5898" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a>
<a id="5903" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5907" href="Data.Nat.Base.html#5907" class="Bound">m</a> <a id="5909" href="Data.Nat.Base.html#5845" class="Function Operator"></a> <a id="5911" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5915" href="Data.Nat.Base.html#5915" class="Bound">n</a> <a id="5917" class="Symbol">=</a> <a id="5919" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="5923" class="Symbol">(</a><a id="5924" href="Data.Nat.Base.html#5907" class="Bound">m</a> <a id="5926" href="Data.Nat.Base.html#5845" class="Function Operator"></a> <a id="5928" href="Data.Nat.Base.html#5915" class="Bound">n</a><a id="5929" class="Symbol">)</a>
<a id="5932" class="Comment">-- Min defined in terms of primitive operations.</a>
<a id="5981" class="Comment">-- This is much faster than `_⊓_` but harder to reason about. For proofs</a>
<a id="6054" class="Comment">-- involving this function, convert it to `_⊓_` wtih `Data.Nat.properties.⊓≡⊓′`.</a>
<a id="_⊓_"></a><a id="6135" href="Data.Nat.Base.html#6135" class="Function Operator">_⊓_</a> <a id="6140" class="Symbol">:</a> <a id="6142" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6144" class="Symbol"></a> <a id="6146" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6148" class="Symbol"></a> <a id="6150" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="6152" href="Data.Nat.Base.html#6152" class="Bound">m</a> <a id="6154" href="Data.Nat.Base.html#6135" class="Function Operator">⊓′</a> <a id="6157" href="Data.Nat.Base.html#6157" class="Bound">n</a> <a id="6159" class="Keyword">with</a> <a id="6164" href="Data.Nat.Base.html#6152" class="Bound">m</a> <a id="6166" href="Data.Nat.Base.html#1457" class="Primitive Operator">&lt;</a> <a id="6169" href="Data.Nat.Base.html#6157" class="Bound">n</a>
<a id="6171" class="Symbol">...</a> <a id="6175" class="Symbol">|</a> <a id="6177" href="Agda.Builtin.Bool.html#192" class="InductiveConstructor">false</a> <a id="6183" class="Symbol">=</a> <a id="6185" class="Bound">n</a>
<a id="6187" class="Symbol">...</a> <a id="6191" class="Symbol">|</a> <a id="6193" href="Agda.Builtin.Bool.html#198" class="InductiveConstructor">true</a> <a id="6199" class="Symbol">=</a> <a id="6201" class="Bound">m</a>
<a id="6204" class="Comment">-- Parity</a>
<a id="parity"></a><a id="6215" href="Data.Nat.Base.html#6215" class="Function">parity</a> <a id="6222" class="Symbol">:</a> <a id="6224" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6226" class="Symbol"></a> <a id="6228" href="Data.Parity.Base.html#604" class="Datatype">Parity</a>
<a id="6235" href="Data.Nat.Base.html#6215" class="Function">parity</a> <a id="6242" class="Number">0</a> <a id="6256" class="Symbol">=</a> <a id="6258" href="Data.Parity.Base.html#625" class="InductiveConstructor">0</a>
<a id="6261" href="Data.Nat.Base.html#6215" class="Function">parity</a> <a id="6268" class="Number">1</a> <a id="6282" class="Symbol">=</a> <a id="6284" href="Data.Parity.Base.html#639" class="InductiveConstructor">1</a>
<a id="6287" href="Data.Nat.Base.html#6215" class="Function">parity</a> <a id="6294" class="Symbol">(</a><a id="6295" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="6299" class="Symbol">(</a><a id="6300" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="6304" href="Data.Nat.Base.html#6304" class="Bound">n</a><a id="6305" class="Symbol">))</a> <a id="6308" class="Symbol">=</a> <a id="6310" href="Data.Nat.Base.html#6215" class="Function">parity</a> <a id="6317" href="Data.Nat.Base.html#6304" class="Bound">n</a>
<a id="6320" class="Comment">-- Division by 2, rounded downwards.</a>
<a id="⌊_/2⌋"></a><a id="6358" href="Data.Nat.Base.html#6358" class="Function Operator">⌊_/2⌋</a> <a id="6364" class="Symbol">:</a> <a id="6366" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6368" class="Symbol"></a> <a id="6370" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="6372" href="Data.Nat.Base.html#6358" class="Function Operator"></a> <a id="6374" class="Number">0</a> <a id="6376" href="Data.Nat.Base.html#6358" class="Function Operator">/2⌋</a> <a id="6390" class="Symbol">=</a> <a id="6392" class="Number">0</a>
<a id="6394" href="Data.Nat.Base.html#6358" class="Function Operator"></a> <a id="6396" class="Number">1</a> <a id="6398" href="Data.Nat.Base.html#6358" class="Function Operator">/2⌋</a> <a id="6412" class="Symbol">=</a> <a id="6414" class="Number">0</a>
<a id="6416" href="Data.Nat.Base.html#6358" class="Function Operator"></a> <a id="6418" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="6422" class="Symbol">(</a><a id="6423" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="6427" href="Data.Nat.Base.html#6427" class="Bound">n</a><a id="6428" class="Symbol">)</a> <a id="6430" href="Data.Nat.Base.html#6358" class="Function Operator">/2⌋</a> <a id="6434" class="Symbol">=</a> <a id="6436" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="6440" href="Data.Nat.Base.html#6358" class="Function Operator"></a> <a id="6442" href="Data.Nat.Base.html#6427" class="Bound">n</a> <a id="6444" href="Data.Nat.Base.html#6358" class="Function Operator">/2⌋</a>
<a id="6449" class="Comment">-- Division by 2, rounded upwards.</a>
<a id="⌈_/2⌉"></a><a id="6485" href="Data.Nat.Base.html#6485" class="Function Operator">⌈_/2⌉</a> <a id="6491" class="Symbol">:</a> <a id="6493" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6495" class="Symbol"></a> <a id="6497" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="6499" href="Data.Nat.Base.html#6485" class="Function Operator"></a> <a id="6501" href="Data.Nat.Base.html#6501" class="Bound">n</a> <a id="6503" href="Data.Nat.Base.html#6485" class="Function Operator">/2⌉</a> <a id="6507" class="Symbol">=</a> <a id="6509" href="Data.Nat.Base.html#6358" class="Function Operator"></a> <a id="6511" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="6515" href="Data.Nat.Base.html#6501" class="Bound">n</a> <a id="6517" href="Data.Nat.Base.html#6358" class="Function Operator">/2⌋</a>
<a id="6522" class="Comment">-- Naïve exponentiation</a>
<a id="6547" class="Keyword">infixr</a> <a id="6554" class="Number">8</a> <a id="6556" href="Data.Nat.Base.html#6561" class="Function Operator">_^_</a>
<a id="_^_"></a><a id="6561" href="Data.Nat.Base.html#6561" class="Function Operator">_^_</a> <a id="6565" class="Symbol">:</a> <a id="6567" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6569" class="Symbol"></a> <a id="6571" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6573" class="Symbol"></a> <a id="6575" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="6577" href="Data.Nat.Base.html#6577" class="Bound">x</a> <a id="6579" href="Data.Nat.Base.html#6561" class="Function Operator">^</a> <a id="6581" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="6587" class="Symbol">=</a> <a id="6589" class="Number">1</a>
<a id="6591" href="Data.Nat.Base.html#6591" class="Bound">x</a> <a id="6593" href="Data.Nat.Base.html#6561" class="Function Operator">^</a> <a id="6595" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="6599" href="Data.Nat.Base.html#6599" class="Bound">n</a> <a id="6601" class="Symbol">=</a> <a id="6603" href="Data.Nat.Base.html#6591" class="Bound">x</a> <a id="6605" href="Agda.Builtin.Nat.html#539" class="Primitive Operator">*</a> <a id="6607" href="Data.Nat.Base.html#6591" class="Bound">x</a> <a id="6609" href="Data.Nat.Base.html#6561" class="Function Operator">^</a> <a id="6611" href="Data.Nat.Base.html#6599" class="Bound">n</a>
<a id="6614" class="Comment">-- Distance</a>
<a id="_-_"></a><a id="6627" href="Data.Nat.Base.html#6627" class="Function Operator">_-_</a> <a id="6633" class="Symbol">:</a> <a id="6635" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6637" class="Symbol"></a> <a id="6639" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6641" class="Symbol"></a> <a id="6643" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="6645" href="Data.Nat.Base.html#6627" class="Function Operator"></a> <a id="6647" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="6653" href="Data.Nat.Base.html#6627" class="Function Operator">-</a> <a id="6655" href="Data.Nat.Base.html#6655" class="Bound">y</a> <a id="6661" href="Data.Nat.Base.html#6627" class="Function Operator"></a> <a id="6663" class="Symbol">=</a> <a id="6665" href="Data.Nat.Base.html#6655" class="Bound">y</a>
<a id="6667" href="Data.Nat.Base.html#6627" class="CatchallClause Function Operator"></a><a id="6668" class="CatchallClause"> </a><a id="6669" href="Data.Nat.Base.html#6669" class="CatchallClause Bound">x</a><a id="6670" class="CatchallClause"> </a><a id="6675" href="Data.Nat.Base.html#6627" class="CatchallClause Function Operator">-</a><a id="6676" class="CatchallClause"> </a><a id="6677" href="Agda.Builtin.Nat.html#221" class="CatchallClause InductiveConstructor">zero</a><a id="6681" class="CatchallClause"> </a><a id="6683" href="Data.Nat.Base.html#6627" class="CatchallClause Function Operator"></a> <a id="6685" class="Symbol">=</a> <a id="6687" href="Data.Nat.Base.html#6669" class="Bound">x</a>
<a id="6689" href="Data.Nat.Base.html#6627" class="Function Operator"></a> <a id="6691" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="6695" href="Data.Nat.Base.html#6695" class="Bound">x</a> <a id="6697" href="Data.Nat.Base.html#6627" class="Function Operator">-</a> <a id="6699" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="6703" href="Data.Nat.Base.html#6703" class="Bound">y</a> <a id="6705" href="Data.Nat.Base.html#6627" class="Function Operator"></a> <a id="6707" class="Symbol">=</a> <a id="6709" href="Data.Nat.Base.html#6627" class="Function Operator"></a> <a id="6711" href="Data.Nat.Base.html#6695" class="Bound">x</a> <a id="6713" href="Data.Nat.Base.html#6627" class="Function Operator">-</a> <a id="6715" href="Data.Nat.Base.html#6703" class="Bound">y</a> <a id="6717" href="Data.Nat.Base.html#6627" class="Function Operator"></a>
<a id="6720" class="Comment">-- Distance in terms of primitive operations.</a>
<a id="6766" class="Comment">-- This is much faster than `_-_` but harder to reason about.</a>
<a id="6830" class="Comment">-- For proofs involving this function, convert it to `_-_` with</a>
<a id="6896" class="Comment">-- `Data.Nat.Properties.-∣≡∣-`.</a>
<a id="_-_"></a><a id="6931" href="Data.Nat.Base.html#6931" class="Function Operator">_-_</a> <a id="6938" class="Symbol">:</a> <a id="6940" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6942" class="Symbol"></a> <a id="6944" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="6946" class="Symbol"></a> <a id="6948" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="6950" href="Data.Nat.Base.html#6931" class="Function Operator"></a> <a id="6952" href="Data.Nat.Base.html#6952" class="Bound">x</a> <a id="6954" href="Data.Nat.Base.html#6931" class="Function Operator">-</a> <a id="6956" href="Data.Nat.Base.html#6956" class="Bound">y</a> <a id="6958" href="Data.Nat.Base.html#6931" class="Function Operator"></a> <a id="6961" class="Keyword">with</a> <a id="6966" href="Data.Nat.Base.html#6952" class="Bound">x</a> <a id="6968" href="Data.Nat.Base.html#1457" class="Primitive Operator">&lt;</a> <a id="6971" href="Data.Nat.Base.html#6956" class="Bound">y</a>
<a id="6973" class="Symbol">...</a> <a id="6977" class="Symbol">|</a> <a id="6979" href="Agda.Builtin.Bool.html#192" class="InductiveConstructor">false</a> <a id="6985" class="Symbol">=</a> <a id="6987" class="Bound">x</a> <a id="6989" href="Data.Nat.Base.html#4456" class="Primitive Operator"></a> <a id="6991" class="Bound">y</a>
<a id="6993" class="Symbol">...</a> <a id="6997" class="Symbol">|</a> <a id="6999" href="Agda.Builtin.Bool.html#198" class="InductiveConstructor">true</a> <a id="7005" class="Symbol">=</a> <a id="7007" class="Bound">y</a> <a id="7009" href="Data.Nat.Base.html#4456" class="Primitive Operator"></a> <a id="7011" class="Bound">x</a>
<a id="7014" class="Comment">-- Division</a>
<a id="7026" class="Comment">-- Note properties of these are in `Nat.DivMod` not `Nat.Properties`</a>
<a id="_/_"></a><a id="7096" href="Data.Nat.Base.html#7096" class="Function Operator">_/_</a> <a id="7100" class="Symbol">:</a> <a id="7102" class="Symbol">(</a><a id="7103" href="Data.Nat.Base.html#7103" class="Bound">dividend</a> <a id="7112" href="Data.Nat.Base.html#7112" class="Bound">divisor</a> <a id="7120" class="Symbol">:</a> <a id="7122" href="Data.Nat.Base.html#1063" class="Datatype"></a><a id="7123" class="Symbol">)</a> <a id="7125" class="Symbol">.{{</a><a id="7128" href="Data.Nat.Base.html#7128" class="Bound">_</a> <a id="7130" class="Symbol">:</a> <a id="7132" href="Data.Nat.Base.html#3260" class="Record">NonZero</a> <a id="7140" href="Data.Nat.Base.html#7112" class="Bound">divisor</a><a id="7147" class="Symbol">}}</a> <a id="7150" class="Symbol"></a> <a id="7152" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="7154" href="Data.Nat.Base.html#7154" class="Bound">m</a> <a id="7156" href="Data.Nat.Base.html#7096" class="Function Operator">/</a> <a id="7158" class="Symbol">(</a><a id="7159" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="7163" href="Data.Nat.Base.html#7163" class="Bound">n</a><a id="7164" class="Symbol">)</a> <a id="7166" class="Symbol">=</a> <a id="7168" href="Agda.Builtin.Nat.html#1537" class="Primitive">div-helper</a> <a id="7179" class="Number">0</a> <a id="7181" href="Data.Nat.Base.html#7163" class="Bound">n</a> <a id="7183" href="Data.Nat.Base.html#7154" class="Bound">m</a> <a id="7185" href="Data.Nat.Base.html#7163" class="Bound">n</a>
<a id="7188" class="Comment">-- Remainder/modulus</a>
<a id="7209" class="Comment">-- Note properties of these are in `Nat.DivMod` not `Nat.Properties`</a>
<a id="_%_"></a><a id="7279" href="Data.Nat.Base.html#7279" class="Function Operator">_%_</a> <a id="7283" class="Symbol">:</a> <a id="7285" class="Symbol">(</a><a id="7286" href="Data.Nat.Base.html#7286" class="Bound">dividend</a> <a id="7295" href="Data.Nat.Base.html#7295" class="Bound">divisor</a> <a id="7303" class="Symbol">:</a> <a id="7305" href="Data.Nat.Base.html#1063" class="Datatype"></a><a id="7306" class="Symbol">)</a> <a id="7308" class="Symbol">.{{</a><a id="7311" href="Data.Nat.Base.html#7311" class="Bound">_</a> <a id="7313" class="Symbol">:</a> <a id="7315" href="Data.Nat.Base.html#3260" class="Record">NonZero</a> <a id="7323" href="Data.Nat.Base.html#7295" class="Bound">divisor</a><a id="7330" class="Symbol">}}</a> <a id="7333" class="Symbol"></a> <a id="7335" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="7337" href="Data.Nat.Base.html#7337" class="Bound">m</a> <a id="7339" href="Data.Nat.Base.html#7279" class="Function Operator">%</a> <a id="7341" class="Symbol">(</a><a id="7342" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="7346" href="Data.Nat.Base.html#7346" class="Bound">n</a><a id="7347" class="Symbol">)</a> <a id="7349" class="Symbol">=</a> <a id="7351" href="Agda.Builtin.Nat.html#3040" class="Primitive">mod-helper</a> <a id="7362" class="Number">0</a> <a id="7364" href="Data.Nat.Base.html#7346" class="Bound">n</a> <a id="7366" href="Data.Nat.Base.html#7337" class="Bound">m</a> <a id="7368" href="Data.Nat.Base.html#7346" class="Bound">n</a>
<a id="7371" class="Comment">-- Factorial</a>
<a id="_!"></a><a id="7385" href="Data.Nat.Base.html#7385" class="Function Operator">_!</a> <a id="7388" class="Symbol">:</a> <a id="7390" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="7392" class="Symbol"></a> <a id="7394" href="Data.Nat.Base.html#1063" class="Datatype"></a>
<a id="7396" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="7402" href="Data.Nat.Base.html#7385" class="Function Operator">!</a> <a id="7404" class="Symbol">=</a> <a id="7406" class="Number">1</a>
<a id="7408" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="7412" href="Data.Nat.Base.html#7412" class="Bound">n</a> <a id="7414" href="Data.Nat.Base.html#7385" class="Function Operator">!</a> <a id="7416" class="Symbol">=</a> <a id="7418" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="7422" href="Data.Nat.Base.html#7412" class="Bound">n</a> <a id="7424" href="Agda.Builtin.Nat.html#539" class="Primitive Operator">*</a> <a id="7426" href="Data.Nat.Base.html#7412" class="Bound">n</a> <a id="7428" href="Data.Nat.Base.html#7385" class="Function Operator">!</a>
<a id="7431" class="Comment">------------------------------------------------------------------------</a>
<a id="7504" class="Comment">-- Extensionally equivalent alternative definitions of _≤_/_&lt;_ etc.</a>
<a id="7573" class="Comment">-- _≤_: this definition is more suitable for well-founded induction</a>
<a id="7642" class="Comment">-- (see Data.Nat.Induction)</a>
<a id="7671" class="Keyword">infix</a> <a id="7677" class="Number">4</a> <a id="7679" href="Data.Nat.Base.html#7705" class="Datatype Operator">_≤_</a> <a id="7684" href="Data.Nat.Base.html#7825" class="Function Operator">_&lt;_</a> <a id="7689" href="Data.Nat.Base.html#7973" class="Function Operator">_≥_</a> <a id="7694" href="Data.Nat.Base.html#8006" class="Function Operator">_&gt;_</a>
<a id="7700" class="Keyword">data</a> <a id="_≤_"></a><a id="7705" href="Data.Nat.Base.html#7705" class="Datatype Operator">_≤_</a> <a id="7710" class="Symbol">(</a><a id="7711" href="Data.Nat.Base.html#7711" class="Bound">m</a> <a id="7713" class="Symbol">:</a> <a id="7715" href="Data.Nat.Base.html#1063" class="Datatype"></a><a id="7716" class="Symbol">)</a> <a id="7718" class="Symbol">:</a> <a id="7720" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="7722" class="Symbol"></a> <a id="7724" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="7728" class="Keyword">where</a>
<a id="_≤_.≤′-refl"></a><a id="7736" href="Data.Nat.Base.html#7736" class="InductiveConstructor">≤′-refl</a> <a id="7744" class="Symbol">:</a> <a id="7770" href="Data.Nat.Base.html#7711" class="Bound">m</a> <a id="7772" href="Data.Nat.Base.html#7705" class="Datatype Operator">≤′</a> <a id="7775" href="Data.Nat.Base.html#7711" class="Bound">m</a>
<a id="_≤_.≤′-step"></a><a id="7779" href="Data.Nat.Base.html#7779" class="InductiveConstructor">≤′-step</a> <a id="7787" class="Symbol">:</a> <a id="7789" class="Symbol"></a> <a id="7791" class="Symbol">{</a><a id="7792" href="Data.Nat.Base.html#7792" class="Bound">n</a><a id="7793" class="Symbol">}</a> <a id="7795" class="Symbol">(</a><a id="7796" href="Data.Nat.Base.html#7796" class="Bound">m≤n</a> <a id="7801" class="Symbol">:</a> <a id="7803" href="Data.Nat.Base.html#7711" class="Bound">m</a> <a id="7805" href="Data.Nat.Base.html#7705" class="Datatype Operator">≤′</a> <a id="7808" href="Data.Nat.Base.html#7792" class="Bound">n</a><a id="7809" class="Symbol">)</a> <a id="7811" class="Symbol"></a> <a id="7813" href="Data.Nat.Base.html#7711" class="Bound">m</a> <a id="7815" href="Data.Nat.Base.html#7705" class="Datatype Operator">≤′</a> <a id="7818" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="7822" href="Data.Nat.Base.html#7792" class="Bound">n</a>
<a id="_&lt;_"></a><a id="7825" href="Data.Nat.Base.html#7825" class="Function Operator">_&lt;_</a> <a id="7830" class="Symbol">:</a> <a id="7832" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="7836" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="7838" href="Level.html#521" class="Function">0</a>
<a id="7841" href="Data.Nat.Base.html#7841" class="Bound">m</a> <a id="7843" href="Data.Nat.Base.html#7825" class="Function Operator">&lt;</a> <a id="7846" href="Data.Nat.Base.html#7846" class="Bound">n</a> <a id="7848" class="Symbol">=</a> <a id="7850" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="7854" href="Data.Nat.Base.html#7841" class="Bound">m</a> <a id="7856" href="Data.Nat.Base.html#7705" class="Datatype Operator">≤′</a> <a id="7859" href="Data.Nat.Base.html#7846" class="Bound">n</a>
<a id="7862" class="Comment">-- Smart constructors of _&lt;_</a>
<a id="7893" class="Keyword">pattern</a> <a id="&lt;-base"></a><a id="7901" href="Data.Nat.Base.html#7901" class="InductiveConstructor">&lt;-base</a> <a id="7918" class="Symbol">=</a> <a id="7920" href="Data.Nat.Base.html#7736" class="InductiveConstructor">≤′-refl</a>
<a id="7928" class="Keyword">pattern</a> <a id="&lt;-step"></a><a id="7936" href="Data.Nat.Base.html#7936" class="InductiveConstructor">&lt;-step</a> <a id="7944" class="Symbol">{</a><a id="7945" href="Data.Nat.Base.html#7964" class="Bound">n</a><a id="7946" class="Symbol">}</a> <a id="7948" href="Data.Nat.Base.html#7967" class="Bound">m&lt;n</a> <a id="7953" class="Symbol">=</a> <a id="7955" href="Data.Nat.Base.html#7779" class="InductiveConstructor">≤′-step</a> <a id="7963" class="Symbol">{</a><a id="7964" href="Data.Nat.Base.html#7964" class="Bound">n</a><a id="7965" class="Symbol">}</a> <a id="7967" href="Data.Nat.Base.html#7967" class="Bound">m&lt;n</a>
<a id="_≥_"></a><a id="7973" href="Data.Nat.Base.html#7973" class="Function Operator">_≥_</a> <a id="7978" class="Symbol">:</a> <a id="7980" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="7984" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="7986" href="Level.html#521" class="Function">0</a>
<a id="7989" href="Data.Nat.Base.html#7989" class="Bound">m</a> <a id="7991" href="Data.Nat.Base.html#7973" class="Function Operator">≥′</a> <a id="7994" href="Data.Nat.Base.html#7994" class="Bound">n</a> <a id="7996" class="Symbol">=</a> <a id="7998" href="Data.Nat.Base.html#7994" class="Bound">n</a> <a id="8000" href="Data.Nat.Base.html#7705" class="Datatype Operator">≤′</a> <a id="8003" href="Data.Nat.Base.html#7989" class="Bound">m</a>
<a id="_&gt;_"></a><a id="8006" href="Data.Nat.Base.html#8006" class="Function Operator">_&gt;_</a> <a id="8011" class="Symbol">:</a> <a id="8013" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="8017" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="8019" href="Level.html#521" class="Function">0</a>
<a id="8022" href="Data.Nat.Base.html#8022" class="Bound">m</a> <a id="8024" href="Data.Nat.Base.html#8006" class="Function Operator">&gt;</a> <a id="8027" href="Data.Nat.Base.html#8027" class="Bound">n</a> <a id="8029" class="Symbol">=</a> <a id="8031" href="Data.Nat.Base.html#8027" class="Bound">n</a> <a id="8033" href="Data.Nat.Base.html#7825" class="Function Operator">&lt;</a> <a id="8036" href="Data.Nat.Base.html#8022" class="Bound">m</a>
<a id="8039" class="Comment">-- _≤″_: this definition of _≤_ is used for proof-irrelevant DivMod`</a>
<a id="8109" class="Comment">-- and is a specialised instance of a general algebraic construction</a>
<a id="8179" class="Keyword">infix</a> <a id="8185" class="Number">4</a> <a id="8187" href="Data.Nat.Base.html#8208" class="Function Operator">_≤″_</a> <a id="8192" href="Data.Nat.Base.html#8306" class="Function Operator">_&lt;″_</a> <a id="8197" href="Data.Nat.Base.html#8343" class="Function Operator">_≥″_</a> <a id="8202" href="Data.Nat.Base.html#8376" class="Function Operator">_&gt;″_</a>
<a id="_≤″_"></a><a id="8208" href="Data.Nat.Base.html#8208" class="Function Operator">_≤″_</a> <a id="8213" class="Symbol">:</a> <a id="8215" class="Symbol">(</a><a id="8216" href="Data.Nat.Base.html#8216" class="Bound">m</a> <a id="8218" href="Data.Nat.Base.html#8218" class="Bound">n</a> <a id="8220" class="Symbol">:</a> <a id="8222" href="Data.Nat.Base.html#1063" class="Datatype"></a><a id="8223" class="Symbol">)</a> <a id="8226" class="Symbol"></a> <a id="8228" href="Agda.Primitive.html#388" class="Primitive">Set</a>
<a id="8232" href="Data.Nat.Base.html#8208" class="Function Operator">_≤″_</a> <a id="8237" class="Symbol">=</a> <a id="8239" href="Algebra.Definitions.RawMagma.html#1339" class="Record Operator">_ˡ_</a> <a id="8244" href="Data.Nat.Base.html#4462" class="Function">+-rawMagma</a>
<a id="8256" class="Keyword">pattern</a> <a id="less-than-or-equal"></a><a id="8264" href="Data.Nat.Base.html#8264" class="InductiveConstructor">less-than-or-equal</a> <a id="8283" class="Symbol">{</a><a id="8284" href="Data.Nat.Base.html#8295" class="Bound">k</a><a id="8285" class="Symbol">}</a> <a id="8287" href="Data.Nat.Base.html#8299" class="Bound">proof</a> <a id="8293" class="Symbol">=</a> <a id="8295" href="Data.Nat.Base.html#8295" class="Bound">k</a> <a id="8297" class="InductiveConstructor Operator">,</a> <a id="8299" href="Data.Nat.Base.html#8299" class="Bound">proof</a>
<a id="_&lt;″_"></a><a id="8306" href="Data.Nat.Base.html#8306" class="Function Operator">_&lt;″_</a> <a id="8311" class="Symbol">:</a> <a id="8313" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="8317" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="8319" href="Level.html#521" class="Function">0</a>
<a id="8322" href="Data.Nat.Base.html#8322" class="Bound">m</a> <a id="8324" href="Data.Nat.Base.html#8306" class="Function Operator">&lt;</a> <a id="8327" href="Data.Nat.Base.html#8327" class="Bound">n</a> <a id="8329" class="Symbol">=</a> <a id="8331" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="8335" href="Data.Nat.Base.html#8322" class="Bound">m</a> <a id="8337" href="Data.Nat.Base.html#8208" class="Function Operator">≤″</a> <a id="8340" href="Data.Nat.Base.html#8327" class="Bound">n</a>
<a id="_≥″_"></a><a id="8343" href="Data.Nat.Base.html#8343" class="Function Operator">_≥″_</a> <a id="8348" class="Symbol">:</a> <a id="8350" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="8354" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="8356" href="Level.html#521" class="Function">0</a>
<a id="8359" href="Data.Nat.Base.html#8359" class="Bound">m</a> <a id="8361" href="Data.Nat.Base.html#8343" class="Function Operator">≥″</a> <a id="8364" href="Data.Nat.Base.html#8364" class="Bound">n</a> <a id="8366" class="Symbol">=</a> <a id="8368" href="Data.Nat.Base.html#8364" class="Bound">n</a> <a id="8370" href="Data.Nat.Base.html#8208" class="Function Operator">≤″</a> <a id="8373" href="Data.Nat.Base.html#8359" class="Bound">m</a>
<a id="_&gt;″_"></a><a id="8376" href="Data.Nat.Base.html#8376" class="Function Operator">_&gt;″_</a> <a id="8381" class="Symbol">:</a> <a id="8383" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="8387" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="8389" href="Level.html#521" class="Function">0</a>
<a id="8392" href="Data.Nat.Base.html#8392" class="Bound">m</a> <a id="8394" href="Data.Nat.Base.html#8376" class="Function Operator">&gt;</a> <a id="8397" href="Data.Nat.Base.html#8397" class="Bound">n</a> <a id="8399" class="Symbol">=</a> <a id="8401" href="Data.Nat.Base.html#8397" class="Bound">n</a> <a id="8403" href="Data.Nat.Base.html#8306" class="Function Operator">&lt;</a> <a id="8406" href="Data.Nat.Base.html#8392" class="Bound">m</a>
<a id="8409" class="Comment">-- Smart constructors of _≤″_ and _&lt;″_</a>
<a id="8449" class="Keyword">pattern</a> <a id="≤″-offset"></a><a id="8457" href="Data.Nat.Base.html#8457" class="InductiveConstructor">≤″-offset</a> <a id="8467" href="Data.Nat.Base.html#8495" class="Bound">k</a> <a id="8469" class="Symbol">=</a> <a id="8471" href="Data.Nat.Base.html#8264" class="InductiveConstructor">less-than-or-equal</a> <a id="8490" class="Symbol">{</a><a id="8491" class="Argument">k</a> <a id="8493" class="Symbol">=</a> <a id="8495" href="Data.Nat.Base.html#8495" class="Bound">k</a><a id="8496" class="Symbol">}</a> <a id="8498" href="Agda.Builtin.Equality.html#207" class="InductiveConstructor">refl</a>
<a id="8503" class="Keyword">pattern</a> <a id="&lt;″-offset"></a><a id="8511" href="Data.Nat.Base.html#8511" class="InductiveConstructor">&lt;″-offset</a> <a id="8521" href="Data.Nat.Base.html#8535" class="Bound">k</a> <a id="8523" class="Symbol">=</a> <a id="8525" href="Data.Nat.Base.html#8457" class="InductiveConstructor">≤″-offset</a> <a id="8535" href="Data.Nat.Base.html#8535" class="Bound">k</a>
<a id="8538" class="Comment">-- Smart destructors of _&lt;″_</a>
<a id="s≤″s⁻¹"></a><a id="8568" href="Data.Nat.Base.html#8568" class="Function">s≤″s⁻¹</a> <a id="8575" class="Symbol">:</a> <a id="8577" class="Symbol"></a> <a id="8579" class="Symbol">{</a><a id="8580" href="Data.Nat.Base.html#8580" class="Bound">m</a> <a id="8582" href="Data.Nat.Base.html#8582" class="Bound">n</a><a id="8583" class="Symbol">}</a> <a id="8585" class="Symbol"></a> <a id="8587" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="8591" href="Data.Nat.Base.html#8580" class="Bound">m</a> <a id="8593" href="Data.Nat.Base.html#8208" class="Function Operator">≤″</a> <a id="8596" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="8600" href="Data.Nat.Base.html#8582" class="Bound">n</a> <a id="8602" class="Symbol"></a> <a id="8604" href="Data.Nat.Base.html#8580" class="Bound">m</a> <a id="8606" href="Data.Nat.Base.html#8208" class="Function Operator">≤″</a> <a id="8609" href="Data.Nat.Base.html#8582" class="Bound">n</a>
<a id="8611" href="Data.Nat.Base.html#8568" class="Function">s≤″s⁻¹</a> <a id="8618" class="Symbol">(</a><a id="8619" href="Data.Nat.Base.html#8457" class="InductiveConstructor">≤″-offset</a> <a id="8629" href="Data.Nat.Base.html#8629" class="Bound">k</a><a id="8630" class="Symbol">)</a> <a id="8632" class="Symbol">=</a> <a id="8634" href="Data.Nat.Base.html#8457" class="InductiveConstructor">≤″-offset</a> <a id="8644" href="Data.Nat.Base.html#8629" class="Bound">k</a>
<a id="s&lt;″s⁻¹"></a><a id="8647" href="Data.Nat.Base.html#8647" class="Function">s&lt;″s⁻¹</a> <a id="8654" class="Symbol">:</a> <a id="8656" class="Symbol"></a> <a id="8658" class="Symbol">{</a><a id="8659" href="Data.Nat.Base.html#8659" class="Bound">m</a> <a id="8661" href="Data.Nat.Base.html#8661" class="Bound">n</a><a id="8662" class="Symbol">}</a> <a id="8664" class="Symbol"></a> <a id="8666" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="8670" href="Data.Nat.Base.html#8659" class="Bound">m</a> <a id="8672" href="Data.Nat.Base.html#8306" class="Function Operator">&lt;</a> <a id="8675" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="8679" href="Data.Nat.Base.html#8661" class="Bound">n</a> <a id="8681" class="Symbol"></a> <a id="8683" href="Data.Nat.Base.html#8659" class="Bound">m</a> <a id="8685" href="Data.Nat.Base.html#8306" class="Function Operator">&lt;</a> <a id="8688" href="Data.Nat.Base.html#8661" class="Bound">n</a>
<a id="8690" href="Data.Nat.Base.html#8647" class="Function">s&lt;″s⁻¹</a> <a id="8697" class="Symbol">(</a><a id="8698" href="Data.Nat.Base.html#8511" class="InductiveConstructor">&lt;″-offset</a> <a id="8708" href="Data.Nat.Base.html#8708" class="Bound">k</a><a id="8709" class="Symbol">)</a> <a id="8711" class="Symbol">=</a> <a id="8713" href="Data.Nat.Base.html#8511" class="InductiveConstructor">&lt;″-offset</a> <a id="8723" href="Data.Nat.Base.html#8708" class="Bound">k</a>
<a id="8726" class="Comment">-- _≤‴_: this definition is useful for induction with an upper bound.</a>
<a id="8797" class="Keyword">data</a> <a id="_≤‴_"></a><a id="8802" href="Data.Nat.Base.html#8802" class="Datatype Operator">_≤‴_</a> <a id="8807" class="Symbol">:</a> <a id="8809" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="8811" class="Symbol"></a> <a id="8813" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="8815" class="Symbol"></a> <a id="8817" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="8821" class="Keyword">where</a>
<a id="_≤‴_.≤‴-refl"></a><a id="8829" href="Data.Nat.Base.html#8829" class="InductiveConstructor">≤‴-refl</a> <a id="8837" class="Symbol">:</a> <a id="8839" class="Symbol">∀{</a><a id="8841" href="Data.Nat.Base.html#8841" class="Bound">m</a><a id="8842" class="Symbol">}</a> <a id="8844" class="Symbol"></a> <a id="8846" href="Data.Nat.Base.html#8841" class="Bound">m</a> <a id="8848" href="Data.Nat.Base.html#8802" class="Datatype Operator">≤‴</a> <a id="8851" href="Data.Nat.Base.html#8841" class="Bound">m</a>
<a id="_≤‴_.≤‴-step"></a><a id="8855" href="Data.Nat.Base.html#8855" class="InductiveConstructor">≤‴-step</a> <a id="8863" class="Symbol">:</a> <a id="8865" class="Symbol">∀{</a><a id="8867" href="Data.Nat.Base.html#8867" class="Bound">m</a> <a id="8869" href="Data.Nat.Base.html#8869" class="Bound">n</a><a id="8870" class="Symbol">}</a> <a id="8872" class="Symbol"></a> <a id="8874" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="8878" href="Data.Nat.Base.html#8867" class="Bound">m</a> <a id="8880" href="Data.Nat.Base.html#8802" class="Datatype Operator">≤‴</a> <a id="8883" href="Data.Nat.Base.html#8869" class="Bound">n</a> <a id="8885" class="Symbol"></a> <a id="8887" href="Data.Nat.Base.html#8867" class="Bound">m</a> <a id="8889" href="Data.Nat.Base.html#8802" class="Datatype Operator">≤‴</a> <a id="8892" href="Data.Nat.Base.html#8869" class="Bound">n</a>
<a id="8895" class="Keyword">infix</a> <a id="8901" class="Number">4</a> <a id="8903" href="Data.Nat.Base.html#8802" class="Datatype Operator">_≤‴_</a> <a id="8908" href="Data.Nat.Base.html#8924" class="Function Operator">_&lt;‴_</a> <a id="8913" href="Data.Nat.Base.html#8961" class="Function Operator">_≥‴_</a> <a id="8918" href="Data.Nat.Base.html#8994" class="Function Operator">_&gt;‴_</a>
<a id="_&lt;‴_"></a><a id="8924" href="Data.Nat.Base.html#8924" class="Function Operator">_&lt;‴_</a> <a id="8929" class="Symbol">:</a> <a id="8931" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="8935" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="8937" href="Level.html#521" class="Function">0</a>
<a id="8940" href="Data.Nat.Base.html#8940" class="Bound">m</a> <a id="8942" href="Data.Nat.Base.html#8924" class="Function Operator">&lt;</a> <a id="8945" href="Data.Nat.Base.html#8945" class="Bound">n</a> <a id="8947" class="Symbol">=</a> <a id="8949" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="8953" href="Data.Nat.Base.html#8940" class="Bound">m</a> <a id="8955" href="Data.Nat.Base.html#8802" class="Datatype Operator">≤‴</a> <a id="8958" href="Data.Nat.Base.html#8945" class="Bound">n</a>
<a id="_≥‴_"></a><a id="8961" href="Data.Nat.Base.html#8961" class="Function Operator">_≥‴_</a> <a id="8966" class="Symbol">:</a> <a id="8968" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="8972" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="8974" href="Level.html#521" class="Function">0</a>
<a id="8977" href="Data.Nat.Base.html#8977" class="Bound">m</a> <a id="8979" href="Data.Nat.Base.html#8961" class="Function Operator">≥‴</a> <a id="8982" href="Data.Nat.Base.html#8982" class="Bound">n</a> <a id="8984" class="Symbol">=</a> <a id="8986" href="Data.Nat.Base.html#8982" class="Bound">n</a> <a id="8988" href="Data.Nat.Base.html#8802" class="Datatype Operator">≤‴</a> <a id="8991" href="Data.Nat.Base.html#8977" class="Bound">m</a>
<a id="_&gt;‴_"></a><a id="8994" href="Data.Nat.Base.html#8994" class="Function Operator">_&gt;‴_</a> <a id="8999" class="Symbol">:</a> <a id="9001" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="9005" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="9007" href="Level.html#521" class="Function">0</a>
<a id="9010" href="Data.Nat.Base.html#9010" class="Bound">m</a> <a id="9012" href="Data.Nat.Base.html#8994" class="Function Operator">&gt;</a> <a id="9015" href="Data.Nat.Base.html#9015" class="Bound">n</a> <a id="9017" class="Symbol">=</a> <a id="9019" href="Data.Nat.Base.html#9015" class="Bound">n</a> <a id="9021" href="Data.Nat.Base.html#8924" class="Function Operator">&lt;</a> <a id="9024" href="Data.Nat.Base.html#9010" class="Bound">m</a>
<a id="9027" class="Comment">------------------------------------------------------------------------</a>
<a id="9100" class="Comment">-- A comparison view. Taken from &quot;View from the left&quot;</a>
<a id="9154" class="Comment">-- (McBride/McKinna); details may differ.</a>
<a id="9197" class="Keyword">data</a> <a id="Ordering"></a><a id="9202" href="Data.Nat.Base.html#9202" class="Datatype">Ordering</a> <a id="9211" class="Symbol">:</a> <a id="9213" href="Relation.Binary.Core.html#896" class="Function">Rel</a> <a id="9217" href="Data.Nat.Base.html#1063" class="Datatype"></a> <a id="9219" href="Level.html#521" class="Function">0</a> <a id="9222" class="Keyword">where</a>
<a id="Ordering.less"></a><a id="9230" href="Data.Nat.Base.html#9230" class="InductiveConstructor">less</a> <a id="9238" class="Symbol">:</a> <a id="9240" class="Symbol"></a> <a id="9242" href="Data.Nat.Base.html#9242" class="Bound">m</a> <a id="9244" href="Data.Nat.Base.html#9244" class="Bound">k</a> <a id="9246" class="Symbol"></a> <a id="9248" href="Data.Nat.Base.html#9202" class="Datatype">Ordering</a> <a id="9257" href="Data.Nat.Base.html#9242" class="Bound">m</a> <a id="9259" class="Symbol">(</a><a id="9260" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="9264" class="Symbol">(</a><a id="9265" href="Data.Nat.Base.html#9242" class="Bound">m</a> <a id="9267" href="Agda.Builtin.Nat.html#336" class="Primitive Operator">+</a> <a id="9269" href="Data.Nat.Base.html#9244" class="Bound">k</a><a id="9270" class="Symbol">))</a>
<a id="Ordering.equal"></a><a id="9275" href="Data.Nat.Base.html#9275" class="InductiveConstructor">equal</a> <a id="9283" class="Symbol">:</a> <a id="9285" class="Symbol"></a> <a id="9287" href="Data.Nat.Base.html#9287" class="Bound">m</a> <a id="9291" class="Symbol"></a> <a id="9293" href="Data.Nat.Base.html#9202" class="Datatype">Ordering</a> <a id="9302" href="Data.Nat.Base.html#9287" class="Bound">m</a> <a id="9304" href="Data.Nat.Base.html#9287" class="Bound">m</a>
<a id="Ordering.greater"></a><a id="9308" href="Data.Nat.Base.html#9308" class="InductiveConstructor">greater</a> <a id="9316" class="Symbol">:</a> <a id="9318" class="Symbol"></a> <a id="9320" href="Data.Nat.Base.html#9320" class="Bound">m</a> <a id="9322" href="Data.Nat.Base.html#9322" class="Bound">k</a> <a id="9324" class="Symbol"></a> <a id="9326" href="Data.Nat.Base.html#9202" class="Datatype">Ordering</a> <a id="9335" class="Symbol">(</a><a id="9336" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="9340" class="Symbol">(</a><a id="9341" href="Data.Nat.Base.html#9320" class="Bound">m</a> <a id="9343" href="Agda.Builtin.Nat.html#336" class="Primitive Operator">+</a> <a id="9345" href="Data.Nat.Base.html#9322" class="Bound">k</a><a id="9346" class="Symbol">))</a> <a id="9349" href="Data.Nat.Base.html#9320" class="Bound">m</a>
<a id="compare"></a><a id="9352" href="Data.Nat.Base.html#9352" class="Function">compare</a> <a id="9360" class="Symbol">:</a> <a id="9362" class="Symbol"></a> <a id="9364" href="Data.Nat.Base.html#9364" class="Bound">m</a> <a id="9366" href="Data.Nat.Base.html#9366" class="Bound">n</a> <a id="9368" class="Symbol"></a> <a id="9370" href="Data.Nat.Base.html#9202" class="Datatype">Ordering</a> <a id="9379" href="Data.Nat.Base.html#9364" class="Bound">m</a> <a id="9381" href="Data.Nat.Base.html#9366" class="Bound">n</a>
<a id="9383" href="Data.Nat.Base.html#9352" class="Function">compare</a> <a id="9391" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="9399" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="9407" class="Symbol">=</a> <a id="9409" href="Data.Nat.Base.html#9275" class="InductiveConstructor">equal</a> <a id="9417" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a>
<a id="9422" href="Data.Nat.Base.html#9352" class="Function">compare</a> <a id="9430" class="Symbol">(</a><a id="9431" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="9435" href="Data.Nat.Base.html#9435" class="Bound">m</a><a id="9436" class="Symbol">)</a> <a id="9438" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="9446" class="Symbol">=</a> <a id="9448" href="Data.Nat.Base.html#9308" class="InductiveConstructor">greater</a> <a id="9456" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="9461" href="Data.Nat.Base.html#9435" class="Bound">m</a>
<a id="9463" href="Data.Nat.Base.html#9352" class="Function">compare</a> <a id="9471" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="9479" class="Symbol">(</a><a id="9480" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="9484" href="Data.Nat.Base.html#9484" class="Bound">n</a><a id="9485" class="Symbol">)</a> <a id="9487" class="Symbol">=</a> <a id="9489" href="Data.Nat.Base.html#9230" class="InductiveConstructor">less</a> <a id="9497" href="Agda.Builtin.Nat.html#221" class="InductiveConstructor">zero</a> <a id="9502" href="Data.Nat.Base.html#9484" class="Bound">n</a>
<a id="9504" href="Data.Nat.Base.html#9352" class="Function">compare</a> <a id="9512" class="Symbol">(</a><a id="9513" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="9517" href="Data.Nat.Base.html#9517" class="Bound">m</a><a id="9518" class="Symbol">)</a> <a id="9520" class="Symbol">(</a><a id="9521" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="9525" href="Data.Nat.Base.html#9525" class="Bound">n</a><a id="9526" class="Symbol">)</a> <a id="9528" class="Keyword">with</a> <a id="9533" href="Data.Nat.Base.html#9352" class="Function">compare</a> <a id="9541" href="Data.Nat.Base.html#9517" class="Bound">m</a> <a id="9543" href="Data.Nat.Base.html#9525" class="Bound">n</a>
<a id="9545" class="Symbol">...</a> <a id="9549" class="Symbol">|</a> <a id="9551" href="Data.Nat.Base.html#9230" class="InductiveConstructor">less</a> <a id="9559" href="Data.Nat.Base.html#9559" class="Bound">m</a> <a id="9561" href="Data.Nat.Base.html#9561" class="Bound">k</a> <a id="9563" class="Symbol">=</a> <a id="9565" href="Data.Nat.Base.html#9230" class="InductiveConstructor">less</a> <a id="9570" class="Symbol">(</a><a id="9571" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="9575" href="Data.Nat.Base.html#9559" class="Bound">m</a><a id="9576" class="Symbol">)</a> <a id="9578" href="Data.Nat.Base.html#9561" class="Bound">k</a>
<a id="9580" class="Symbol">...</a> <a id="9584" class="Symbol">|</a> <a id="9586" href="Data.Nat.Base.html#9275" class="InductiveConstructor">equal</a> <a id="9594" href="Data.Nat.Base.html#9594" class="Bound">m</a> <a id="9598" class="Symbol">=</a> <a id="9600" href="Data.Nat.Base.html#9275" class="InductiveConstructor">equal</a> <a id="9606" class="Symbol">(</a><a id="9607" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="9611" href="Data.Nat.Base.html#9594" class="Bound">m</a><a id="9612" class="Symbol">)</a>
<a id="9614" class="Symbol">...</a> <a id="9618" class="Symbol">|</a> <a id="9620" href="Data.Nat.Base.html#9308" class="InductiveConstructor">greater</a> <a id="9628" href="Data.Nat.Base.html#9628" class="Bound">n</a> <a id="9630" href="Data.Nat.Base.html#9630" class="Bound">k</a> <a id="9632" class="Symbol">=</a> <a id="9634" href="Data.Nat.Base.html#9308" class="InductiveConstructor">greater</a> <a id="9642" class="Symbol">(</a><a id="9643" href="Agda.Builtin.Nat.html#234" class="InductiveConstructor">suc</a> <a id="9647" href="Data.Nat.Base.html#9628" class="Bound">n</a><a id="9648" class="Symbol">)</a> <a id="9650" href="Data.Nat.Base.html#9630" class="Bound">k</a>
<a id="9654" class="Comment">------------------------------------------------------------------------</a>
<a id="9727" class="Comment">-- DEPRECATED NAMES</a>
<a id="9747" class="Comment">------------------------------------------------------------------------</a>
<a id="9820" class="Comment">-- Please use the new names as continuing support for the old names is</a>
<a id="9891" class="Comment">-- not guaranteed.</a>
<a id="9911" class="Comment">-- Version 2.0</a>
</pre></body></html>