bsc-leon-vatthauer/public/Function.Metric.Structures.html

98 lines
No EOL
22 KiB
HTML

<!DOCTYPE HTML>
<html><head><meta charset="utf-8"><title>Function.Metric.Structures</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">-- Some metric structures (not packed up with sets, operations, etc.)</a>
<a id="176" class="Comment">------------------------------------------------------------------------</a>
<a id="250" class="Comment">-- The contents of this module should usually be accessed via</a>
<a id="312" class="Comment">-- `Function.Metric`.</a>
<a id="335" class="Symbol">{-#</a> <a id="339" class="Keyword">OPTIONS</a> <a id="347" class="Pragma">--cubical-compatible</a> <a id="368" class="Pragma">--safe</a> <a id="375" class="Symbol">#-}</a>
<a id="380" class="Keyword">open</a> <a id="385" class="Keyword">import</a> <a id="392" href="Relation.Binary.html" class="Module">Relation.Binary</a> <a id="408" class="Keyword">hiding</a> <a id="415" class="Symbol">(</a><a id="416" href="Relation.Binary.Definitions.html#1507" class="Function">Symmetric</a><a id="425" class="Symbol">)</a>
<a id="428" class="Keyword">module</a> <a id="435" href="Function.Metric.Structures.html" class="Module">Function.Metric.Structures</a>
<a id="464" class="Symbol">{</a><a id="465" href="Function.Metric.Structures.html#465" class="Bound">a</a> <a id="467" href="Function.Metric.Structures.html#467" class="Bound">i</a> <a id="469" href="Function.Metric.Structures.html#469" class="Bound">ℓ₁</a> <a id="472" href="Function.Metric.Structures.html#472" class="Bound">ℓ₂</a> <a id="475" href="Function.Metric.Structures.html#475" class="Bound">ℓ₃</a><a id="477" class="Symbol">}</a> <a id="479" class="Symbol">{</a><a id="480" href="Function.Metric.Structures.html#480" class="Bound">A</a> <a id="482" class="Symbol">:</a> <a id="484" href="Agda.Primitive.html#320" class="Primitive">Set</a> <a id="488" href="Function.Metric.Structures.html#465" class="Bound">a</a><a id="489" class="Symbol">}</a> <a id="491" class="Symbol">{</a><a id="492" href="Function.Metric.Structures.html#492" class="Bound">I</a> <a id="494" class="Symbol">:</a> <a id="496" href="Agda.Primitive.html#320" class="Primitive">Set</a> <a id="500" href="Function.Metric.Structures.html#467" class="Bound">i</a><a id="501" class="Symbol">}</a>
<a id="505" class="Symbol">(</a><a id="506" href="Function.Metric.Structures.html#506" class="Bound Operator">_≈ₐ_</a> <a id="511" class="Symbol">:</a> <a id="513" href="Relation.Binary.Core.html#891" class="Function">Rel</a> <a id="517" href="Function.Metric.Structures.html#480" class="Bound">A</a> <a id="519" href="Function.Metric.Structures.html#469" class="Bound">ℓ₁</a><a id="521" class="Symbol">)</a> <a id="523" class="Symbol">(</a><a id="524" href="Function.Metric.Structures.html#524" class="Bound Operator">_≈ᵢ_</a> <a id="529" class="Symbol">:</a> <a id="531" href="Relation.Binary.Core.html#891" class="Function">Rel</a> <a id="535" href="Function.Metric.Structures.html#492" class="Bound">I</a> <a id="537" href="Function.Metric.Structures.html#472" class="Bound">ℓ₂</a><a id="539" class="Symbol">)</a> <a id="541" class="Symbol">(</a><a id="542" href="Function.Metric.Structures.html#542" class="Bound Operator">_≤_</a> <a id="546" class="Symbol">:</a> <a id="548" href="Relation.Binary.Core.html#891" class="Function">Rel</a> <a id="552" href="Function.Metric.Structures.html#492" class="Bound">I</a> <a id="554" href="Function.Metric.Structures.html#475" class="Bound">ℓ₃</a><a id="556" class="Symbol">)</a> <a id="558" class="Symbol">(</a><a id="559" href="Function.Metric.Structures.html#559" class="Bound">0#</a> <a id="562" class="Symbol">:</a> <a id="564" href="Function.Metric.Structures.html#492" class="Bound">I</a><a id="565" class="Symbol">)</a> <a id="567" class="Keyword">where</a>
<a id="574" class="Keyword">open</a> <a id="579" class="Keyword">import</a> <a id="586" href="Algebra.Core.html" class="Module">Algebra.Core</a> <a id="599" class="Keyword">using</a> <a id="605" class="Symbol">(</a><a id="606" href="Algebra.Core.html#527" class="Function">Op₂</a><a id="609" class="Symbol">)</a>
<a id="611" class="Keyword">open</a> <a id="616" class="Keyword">import</a> <a id="623" href="Function.Metric.Core.html" class="Module">Function.Metric.Core</a>
<a id="644" class="Keyword">open</a> <a id="649" class="Keyword">import</a> <a id="656" href="Function.Metric.Definitions.html" class="Module">Function.Metric.Definitions</a>
<a id="684" class="Keyword">open</a> <a id="689" class="Keyword">import</a> <a id="696" href="Level.html" class="Module">Level</a> <a id="702" class="Keyword">using</a> <a id="708" class="Symbol">(</a><a id="709" href="Agda.Primitive.html#804" class="Primitive Operator">_⊔_</a><a id="712" class="Symbol">)</a>
<a id="715" class="Comment">------------------------------------------------------------------------</a>
<a id="788" class="Comment">-- Proto-metrics</a>
<a id="806" class="Comment">-- We do not insist that the ordering relation is total as otherwise</a>
<a id="875" class="Comment">-- we would exclude the real numbers.</a>
<a id="914" class="Keyword">record</a> <a id="IsProtoMetric"></a><a id="921" href="Function.Metric.Structures.html#921" class="Record">IsProtoMetric</a> <a id="935" class="Symbol">(</a><a id="936" href="Function.Metric.Structures.html#936" class="Bound">d</a> <a id="938" class="Symbol">:</a> <a id="940" href="Function.Metric.Core.html#451" class="Function">DistanceFunction</a> <a id="957" href="Function.Metric.Structures.html#480" class="Bound">A</a> <a id="959" href="Function.Metric.Structures.html#492" class="Bound">I</a><a id="960" class="Symbol">)</a>
<a id="981" class="Symbol">:</a> <a id="983" href="Agda.Primitive.html#320" class="Primitive">Set</a> <a id="987" class="Symbol">(</a><a id="988" href="Function.Metric.Structures.html#465" class="Bound">a</a> <a id="990" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="992" href="Function.Metric.Structures.html#467" class="Bound">i</a> <a id="994" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="996" href="Function.Metric.Structures.html#469" class="Bound">ℓ₁</a> <a id="999" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="1001" href="Function.Metric.Structures.html#472" class="Bound">ℓ₂</a> <a id="1004" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="1006" href="Function.Metric.Structures.html#475" class="Bound">ℓ₃</a><a id="1008" class="Symbol">)</a> <a id="1010" class="Keyword">where</a>
<a id="1018" class="Keyword">field</a>
<a id="IsProtoMetric.isPartialOrder"></a><a id="1028" href="Function.Metric.Structures.html#1028" class="Field">isPartialOrder</a> <a id="1045" class="Symbol">:</a> <a id="1047" href="Relation.Binary.Structures.html#3183" class="Record">IsPartialOrder</a> <a id="1062" href="Function.Metric.Structures.html#524" class="Bound Operator">_≈ᵢ_</a> <a id="1067" href="Function.Metric.Structures.html#542" class="Bound Operator">_≤_</a>
<a id="IsProtoMetric.≈-isEquivalence"></a><a id="1075" href="Function.Metric.Structures.html#1075" class="Field">≈-isEquivalence</a> <a id="1092" class="Symbol">:</a> <a id="1094" href="Relation.Binary.Structures.html#1531" class="Record">IsEquivalence</a> <a id="1108" href="Function.Metric.Structures.html#506" class="Bound Operator">_≈ₐ_</a>
<a id="IsProtoMetric.cong"></a><a id="1117" href="Function.Metric.Structures.html#1117" class="Field">cong</a> <a id="1134" class="Symbol">:</a> <a id="1136" href="Function.Metric.Definitions.html#819" class="Function">Congruent</a> <a id="1146" href="Function.Metric.Structures.html#506" class="Bound Operator">_≈ₐ_</a> <a id="1151" href="Function.Metric.Structures.html#524" class="Bound Operator">_≈ᵢ_</a> <a id="1156" href="Function.Metric.Structures.html#936" class="Bound">d</a>
<a id="IsProtoMetric.nonNegative"></a><a id="1162" href="Function.Metric.Structures.html#1162" class="Field">nonNegative</a> <a id="1179" class="Symbol">:</a> <a id="1181" href="Function.Metric.Definitions.html#1197" class="Function">NonNegative</a> <a id="1193" href="Function.Metric.Structures.html#542" class="Bound Operator">_≤_</a> <a id="1197" href="Function.Metric.Structures.html#936" class="Bound">d</a> <a id="1199" href="Function.Metric.Structures.html#559" class="Bound">0#</a>
<a id="1205" class="Keyword">open</a> <a id="1210" href="Relation.Binary.Structures.html#3183" class="Module">IsPartialOrder</a> <a id="1225" href="Function.Metric.Structures.html#1028" class="Field">isPartialOrder</a> <a id="1240" class="Keyword">public</a>
<a id="1251" class="Keyword">renaming</a> <a id="1260" class="Symbol">(</a><a id="1261" class="Keyword">module</a> <a id="1268" href="Relation.Binary.Structures.html#2411" class="Module">Eq</a> <a id="1271" class="Symbol">to</a> <a id="1274" class="Module">EqI</a><a id="1277" class="Symbol">)</a>
<a id="1282" class="Keyword">module</a> <a id="IsProtoMetric.EqC"></a><a id="1289" href="Function.Metric.Structures.html#1289" class="Module">EqC</a> <a id="1293" class="Symbol">=</a> <a id="1295" href="Relation.Binary.Structures.html#1531" class="Module">IsEquivalence</a> <a id="1309" href="Function.Metric.Structures.html#1075" class="Field">≈-isEquivalence</a>
<a id="1326" class="Comment">------------------------------------------------------------------------</a>
<a id="1399" class="Comment">-- Pre-metrics</a>
<a id="1415" class="Keyword">record</a> <a id="IsPreMetric"></a><a id="1422" href="Function.Metric.Structures.html#1422" class="Record">IsPreMetric</a> <a id="1434" class="Symbol">(</a><a id="1435" href="Function.Metric.Structures.html#1435" class="Bound">d</a> <a id="1437" class="Symbol">:</a> <a id="1439" href="Function.Metric.Core.html#451" class="Function">DistanceFunction</a> <a id="1456" href="Function.Metric.Structures.html#480" class="Bound">A</a> <a id="1458" href="Function.Metric.Structures.html#492" class="Bound">I</a><a id="1459" class="Symbol">)</a>
<a id="1478" class="Symbol">:</a> <a id="1480" href="Agda.Primitive.html#320" class="Primitive">Set</a> <a id="1484" class="Symbol">(</a><a id="1485" href="Function.Metric.Structures.html#465" class="Bound">a</a> <a id="1487" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="1489" href="Function.Metric.Structures.html#467" class="Bound">i</a> <a id="1491" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="1493" href="Function.Metric.Structures.html#469" class="Bound">ℓ₁</a> <a id="1496" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="1498" href="Function.Metric.Structures.html#472" class="Bound">ℓ₂</a> <a id="1501" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="1503" href="Function.Metric.Structures.html#475" class="Bound">ℓ₃</a><a id="1505" class="Symbol">)</a> <a id="1507" class="Keyword">where</a>
<a id="1515" class="Keyword">field</a>
<a id="IsPreMetric.isProtoMetric"></a><a id="1525" href="Function.Metric.Structures.html#1525" class="Field">isProtoMetric</a> <a id="1539" class="Symbol">:</a> <a id="1541" href="Function.Metric.Structures.html#921" class="Record">IsProtoMetric</a> <a id="1555" href="Function.Metric.Structures.html#1435" class="Bound">d</a>
<a id="IsPreMetric.≈⇒0"></a><a id="1561" href="Function.Metric.Structures.html#1561" class="Field">≈⇒0</a> <a id="1575" class="Symbol">:</a> <a id="1577" href="Function.Metric.Definitions.html#1073" class="Function">Definite</a> <a id="1586" href="Function.Metric.Structures.html#506" class="Bound Operator">_≈ₐ_</a> <a id="1591" href="Function.Metric.Structures.html#524" class="Bound Operator">_≈ᵢ_</a> <a id="1596" href="Function.Metric.Structures.html#1435" class="Bound">d</a> <a id="1598" href="Function.Metric.Structures.html#559" class="Bound">0#</a>
<a id="1604" class="Keyword">open</a> <a id="1609" href="Function.Metric.Structures.html#921" class="Module">IsProtoMetric</a> <a id="1623" href="Function.Metric.Structures.html#1525" class="Field">isProtoMetric</a> <a id="1637" class="Keyword">public</a>
<a id="1645" class="Comment">------------------------------------------------------------------------</a>
<a id="1718" class="Comment">-- Quasi-semi-metrics</a>
<a id="1741" class="Keyword">record</a> <a id="IsQuasiSemiMetric"></a><a id="1748" href="Function.Metric.Structures.html#1748" class="Record">IsQuasiSemiMetric</a> <a id="1766" class="Symbol">(</a><a id="1767" href="Function.Metric.Structures.html#1767" class="Bound">d</a> <a id="1769" class="Symbol">:</a> <a id="1771" href="Function.Metric.Core.html#451" class="Function">DistanceFunction</a> <a id="1788" href="Function.Metric.Structures.html#480" class="Bound">A</a> <a id="1790" href="Function.Metric.Structures.html#492" class="Bound">I</a><a id="1791" class="Symbol">)</a>
<a id="1816" class="Symbol">:</a> <a id="1818" href="Agda.Primitive.html#320" class="Primitive">Set</a> <a id="1822" class="Symbol">(</a><a id="1823" href="Function.Metric.Structures.html#465" class="Bound">a</a> <a id="1825" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="1827" href="Function.Metric.Structures.html#467" class="Bound">i</a> <a id="1829" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="1831" href="Function.Metric.Structures.html#469" class="Bound">ℓ₁</a> <a id="1834" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="1836" href="Function.Metric.Structures.html#472" class="Bound">ℓ₂</a> <a id="1839" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="1841" href="Function.Metric.Structures.html#475" class="Bound">ℓ₃</a><a id="1843" class="Symbol">)</a> <a id="1845" class="Keyword">where</a>
<a id="1853" class="Keyword">field</a>
<a id="IsQuasiSemiMetric.isPreMetric"></a><a id="1863" href="Function.Metric.Structures.html#1863" class="Field">isPreMetric</a> <a id="1875" class="Symbol">:</a> <a id="1877" href="Function.Metric.Structures.html#1422" class="Record">IsPreMetric</a> <a id="1889" href="Function.Metric.Structures.html#1767" class="Bound">d</a>
<a id="IsQuasiSemiMetric.0⇒≈"></a><a id="1895" href="Function.Metric.Structures.html#1895" class="Field">0⇒≈</a> <a id="1907" class="Symbol">:</a> <a id="1909" href="Function.Metric.Definitions.html#939" class="Function">Indiscernable</a> <a id="1923" href="Function.Metric.Structures.html#506" class="Bound Operator">_≈ₐ_</a> <a id="1928" href="Function.Metric.Structures.html#524" class="Bound Operator">_≈ᵢ_</a> <a id="1933" href="Function.Metric.Structures.html#1767" class="Bound">d</a> <a id="1935" href="Function.Metric.Structures.html#559" class="Bound">0#</a>
<a id="1941" class="Keyword">open</a> <a id="1946" href="Function.Metric.Structures.html#1422" class="Module">IsPreMetric</a> <a id="1958" href="Function.Metric.Structures.html#1863" class="Field">isPreMetric</a> <a id="1970" class="Keyword">public</a>
<a id="1978" class="Comment">------------------------------------------------------------------------</a>
<a id="2051" class="Comment">-- Semi-metrics</a>
<a id="2068" class="Keyword">record</a> <a id="IsSemiMetric"></a><a id="2075" href="Function.Metric.Structures.html#2075" class="Record">IsSemiMetric</a> <a id="2088" class="Symbol">(</a><a id="2089" href="Function.Metric.Structures.html#2089" class="Bound">d</a> <a id="2091" class="Symbol">:</a> <a id="2093" href="Function.Metric.Core.html#451" class="Function">DistanceFunction</a> <a id="2110" href="Function.Metric.Structures.html#480" class="Bound">A</a> <a id="2112" href="Function.Metric.Structures.html#492" class="Bound">I</a><a id="2113" class="Symbol">)</a>
<a id="2133" class="Symbol">:</a> <a id="2135" href="Agda.Primitive.html#320" class="Primitive">Set</a> <a id="2139" class="Symbol">(</a><a id="2140" href="Function.Metric.Structures.html#465" class="Bound">a</a> <a id="2142" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="2144" href="Function.Metric.Structures.html#467" class="Bound">i</a> <a id="2146" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="2148" href="Function.Metric.Structures.html#469" class="Bound">ℓ₁</a> <a id="2151" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="2153" href="Function.Metric.Structures.html#472" class="Bound">ℓ₂</a> <a id="2156" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="2158" href="Function.Metric.Structures.html#475" class="Bound">ℓ₃</a><a id="2160" class="Symbol">)</a> <a id="2162" class="Keyword">where</a>
<a id="2170" class="Keyword">field</a>
<a id="IsSemiMetric.isQuasiSemiMetric"></a><a id="2180" href="Function.Metric.Structures.html#2180" class="Field">isQuasiSemiMetric</a> <a id="2198" class="Symbol">:</a> <a id="2200" href="Function.Metric.Structures.html#1748" class="Record">IsQuasiSemiMetric</a> <a id="2218" href="Function.Metric.Structures.html#2089" class="Bound">d</a>
<a id="IsSemiMetric.sym"></a><a id="2224" href="Function.Metric.Structures.html#2224" class="Field">sym</a> <a id="2242" class="Symbol">:</a> <a id="2244" href="Function.Metric.Definitions.html#1300" class="Function">Symmetric</a> <a id="2254" href="Function.Metric.Structures.html#524" class="Bound Operator">_≈ᵢ_</a> <a id="2259" href="Function.Metric.Structures.html#2089" class="Bound">d</a>
<a id="2264" class="Keyword">open</a> <a id="2269" href="Function.Metric.Structures.html#1748" class="Module">IsQuasiSemiMetric</a> <a id="2287" href="Function.Metric.Structures.html#2180" class="Field">isQuasiSemiMetric</a> <a id="2305" class="Keyword">public</a>
<a id="2313" class="Comment">------------------------------------------------------------------------</a>
<a id="2386" class="Comment">-- General metrics</a>
<a id="2406" class="Comment">-- A general metric obeys a generalised form of the triangle inequality.</a>
<a id="2479" class="Comment">-- It can be specialised to a standard metric/ultrametric/inframetric</a>
<a id="2549" class="Comment">-- etc. by providing the correct operator.</a>
<a id="2592" class="Comment">--</a>
<a id="2595" class="Comment">-- Furthermore we do not assume that _∙_ &amp; 0# form a monoid as</a>
<a id="2658" class="Comment">-- associativity does not hold for p-relaxed metrics/p-inframetrics and</a>
<a id="2730" class="Comment">-- the identity laws do not hold for ultrametrics over negative</a>
<a id="2794" class="Comment">-- codomains.</a>
<a id="2808" class="Comment">--</a>
<a id="2811" class="Comment">-- See &quot;Properties of distance spaces with power triangle inequalities&quot;</a>
<a id="2883" class="Comment">-- by Daniel J. Greenhoe, 2016 (arXiv)</a>
<a id="2923" class="Keyword">record</a> <a id="IsGeneralMetric"></a><a id="2930" href="Function.Metric.Structures.html#2930" class="Record">IsGeneralMetric</a> <a id="2946" class="Symbol">(</a><a id="2947" href="Function.Metric.Structures.html#2947" class="Bound Operator">_∙_</a> <a id="2951" class="Symbol">:</a> <a id="2953" href="Algebra.Core.html#527" class="Function">Op₂</a> <a id="2957" href="Function.Metric.Structures.html#492" class="Bound">I</a><a id="2958" class="Symbol">)</a> <a id="2960" class="Symbol">(</a><a id="2961" href="Function.Metric.Structures.html#2961" class="Bound">d</a> <a id="2963" class="Symbol">:</a> <a id="2965" href="Function.Metric.Core.html#451" class="Function">DistanceFunction</a> <a id="2982" href="Function.Metric.Structures.html#480" class="Bound">A</a> <a id="2984" href="Function.Metric.Structures.html#492" class="Bound">I</a><a id="2985" class="Symbol">)</a>
<a id="3008" class="Symbol">:</a> <a id="3010" href="Agda.Primitive.html#320" class="Primitive">Set</a> <a id="3014" class="Symbol">(</a><a id="3015" href="Function.Metric.Structures.html#465" class="Bound">a</a> <a id="3017" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="3019" href="Function.Metric.Structures.html#467" class="Bound">i</a> <a id="3021" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="3023" href="Function.Metric.Structures.html#469" class="Bound">ℓ₁</a> <a id="3026" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="3028" href="Function.Metric.Structures.html#472" class="Bound">ℓ₂</a> <a id="3031" href="Agda.Primitive.html#804" class="Primitive Operator"></a> <a id="3033" href="Function.Metric.Structures.html#475" class="Bound">ℓ₃</a><a id="3035" class="Symbol">)</a> <a id="3037" class="Keyword">where</a>
<a id="3045" class="Keyword">field</a>
<a id="IsGeneralMetric.isSemiMetric"></a><a id="3055" href="Function.Metric.Structures.html#3055" class="Field">isSemiMetric</a> <a id="3068" class="Symbol">:</a> <a id="3070" href="Function.Metric.Structures.html#2075" class="Record">IsSemiMetric</a> <a id="3083" href="Function.Metric.Structures.html#2961" class="Bound">d</a>
<a id="IsGeneralMetric.triangle"></a><a id="3089" href="Function.Metric.Structures.html#3089" class="Field">triangle</a> <a id="3102" class="Symbol">:</a> <a id="3104" href="Function.Metric.Definitions.html#1392" class="Function">TriangleInequality</a> <a id="3123" href="Function.Metric.Structures.html#542" class="Bound Operator">_≤_</a> <a id="3127" href="Function.Metric.Structures.html#2947" class="Bound Operator">_∙_</a> <a id="3131" href="Function.Metric.Structures.html#2961" class="Bound">d</a>
<a id="3136" class="Keyword">open</a> <a id="3141" href="Function.Metric.Structures.html#2075" class="Module">IsSemiMetric</a> <a id="3154" href="Function.Metric.Structures.html#3055" class="Field">isSemiMetric</a> <a id="3167" class="Keyword">public</a>
</pre></body></html>