bsc-leon-vatthauer/public/Relation.Nullary.Reflects.html

53 lines
14 KiB
HTML
Raw Normal View History

2023-08-19 16:11:22 +02:00
<!DOCTYPE HTML>
<html><head><meta charset="utf-8"><title>Relation.Nullary.Reflects</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">-- Properties of the `Reflects` construct</a>
<a id="148" class="Comment">------------------------------------------------------------------------</a>
<a id="222" class="Symbol">{-#</a> <a id="226" class="Keyword">OPTIONS</a> <a id="234" class="Pragma">--cubical-compatible</a> <a id="255" class="Pragma">--safe</a> <a id="262" class="Symbol">#-}</a>
<a id="267" class="Keyword">module</a> <a id="274" href="Relation.Nullary.Reflects.html" class="Module">Relation.Nullary.Reflects</a> <a id="300" class="Keyword">where</a>
<a id="307" class="Keyword">open</a> <a id="312" class="Keyword">import</a> <a id="319" href="Agda.Builtin.Equality.html" class="Module">Agda.Builtin.Equality</a>
<a id="341" class="Keyword">open</a> <a id="346" class="Keyword">import</a> <a id="353" href="Data.Bool.Base.html" class="Module">Data.Bool.Base</a>
<a id="368" class="Keyword">open</a> <a id="373" class="Keyword">import</a> <a id="380" href="Data.Empty.html" class="Module">Data.Empty</a>
<a id="391" class="Keyword">open</a> <a id="396" class="Keyword">import</a> <a id="403" href="Level.html" class="Module">Level</a>
<a id="409" class="Keyword">open</a> <a id="414" class="Keyword">import</a> <a id="421" href="Relation.Nullary.html" class="Module">Relation.Nullary</a>
<a id="439" class="Keyword">private</a>
<a id="449" class="Keyword">variable</a>
<a id="462" href="Relation.Nullary.Reflects.html#462" class="Generalizable">p</a> <a id="464" class="Symbol">:</a> <a id="466" href="Agda.Primitive.html#591" class="Postulate">Level</a>
<a id="476" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a> <a id="478" class="Symbol">:</a> <a id="480" href="Agda.Primitive.html#320" class="Primitive">Set</a> <a id="484" href="Relation.Nullary.Reflects.html#462" class="Generalizable">p</a>
<a id="487" class="Comment">------------------------------------------------------------------------</a>
<a id="560" class="Comment">-- `Reflects P b` is equivalent to `if b then P else ¬ P`.</a>
<a id="620" class="Comment">-- These lemmas are intended to be used mostly when `b` is a value, so</a>
<a id="691" class="Comment">-- that the `if` expressions have already been evaluated away.</a>
<a id="754" class="Comment">-- In this case, `of` works like the relevant constructor (`ofⁿ` or</a>
<a id="822" class="Comment">-- `ofʸ`), and `invert` strips off the constructor to just give either</a>
<a id="893" class="Comment">-- the proof of `P` or the proof of `¬ P`.</a>
<a id="of"></a><a id="937" href="Relation.Nullary.Reflects.html#937" class="Function">of</a> <a id="940" class="Symbol">:</a> <a id="942" class="Symbol"></a> <a id="944" class="Symbol">{</a><a id="945" href="Relation.Nullary.Reflects.html#945" class="Bound">b</a><a id="946" class="Symbol">}</a> <a id="948" class="Symbol"></a> <a id="950" href="Data.Bool.Base.html#1292" class="Function Operator">if</a> <a id="953" href="Relation.Nullary.Reflects.html#945" class="Bound">b</a> <a id="955" href="Data.Bool.Base.html#1292" class="Function Operator">then</a> <a id="960" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a> <a id="962" href="Data.Bool.Base.html#1292" class="Function Operator">else</a> <a id="967" href="Relation.Nullary.html#665" class="Function Operator">¬</a> <a id="969" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a> <a id="971" class="Symbol"></a> <a id="973" href="Relation.Nullary.html#863" class="Datatype">Reflects</a> <a id="982" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a> <a id="984" href="Relation.Nullary.Reflects.html#945" class="Bound">b</a>
<a id="986" href="Relation.Nullary.Reflects.html#937" class="Function">of</a> <a id="989" class="Symbol">{</a><a id="990" class="Argument">b</a> <a id="992" class="Symbol">=</a> <a id="994" href="Agda.Builtin.Bool.html#175" class="InductiveConstructor">false</a><a id="999" class="Symbol">}</a> <a id="1001" href="Relation.Nullary.Reflects.html#1001" class="Bound">¬p</a> <a id="1004" class="Symbol">=</a> <a id="1006" href="Relation.Nullary.html#948" class="InductiveConstructor">ofⁿ</a> <a id="1010" href="Relation.Nullary.Reflects.html#1001" class="Bound">¬p</a>
<a id="1013" href="Relation.Nullary.Reflects.html#937" class="Function">of</a> <a id="1016" class="Symbol">{</a><a id="1017" class="Argument">b</a> <a id="1019" class="Symbol">=</a> <a id="1021" href="Agda.Builtin.Bool.html#181" class="InductiveConstructor">true</a> <a id="1026" class="Symbol">}</a> <a id="1029" href="Relation.Nullary.Reflects.html#1029" class="Bound">p</a> <a id="1031" class="Symbol">=</a> <a id="1033" href="Relation.Nullary.html#911" class="InductiveConstructor">ofʸ</a> <a id="1037" href="Relation.Nullary.Reflects.html#1029" class="Bound">p</a>
<a id="invert"></a><a id="1040" href="Relation.Nullary.Reflects.html#1040" class="Function">invert</a> <a id="1047" class="Symbol">:</a> <a id="1049" class="Symbol"></a> <a id="1051" class="Symbol">{</a><a id="1052" href="Relation.Nullary.Reflects.html#1052" class="Bound">b</a><a id="1053" class="Symbol">}</a> <a id="1055" class="Symbol"></a> <a id="1057" href="Relation.Nullary.html#863" class="Datatype">Reflects</a> <a id="1066" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a> <a id="1068" href="Relation.Nullary.Reflects.html#1052" class="Bound">b</a> <a id="1070" class="Symbol"></a> <a id="1072" href="Data.Bool.Base.html#1292" class="Function Operator">if</a> <a id="1075" href="Relation.Nullary.Reflects.html#1052" class="Bound">b</a> <a id="1077" href="Data.Bool.Base.html#1292" class="Function Operator">then</a> <a id="1082" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a> <a id="1084" href="Data.Bool.Base.html#1292" class="Function Operator">else</a> <a id="1089" href="Relation.Nullary.html#665" class="Function Operator">¬</a> <a id="1091" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a>
<a id="1093" href="Relation.Nullary.Reflects.html#1040" class="Function">invert</a> <a id="1100" class="Symbol">(</a><a id="1101" href="Relation.Nullary.html#911" class="InductiveConstructor">ofʸ</a> <a id="1106" href="Relation.Nullary.Reflects.html#1106" class="Bound">p</a><a id="1107" class="Symbol">)</a> <a id="1109" class="Symbol">=</a> <a id="1111" href="Relation.Nullary.Reflects.html#1106" class="Bound">p</a>
<a id="1113" href="Relation.Nullary.Reflects.html#1040" class="Function">invert</a> <a id="1120" class="Symbol">(</a><a id="1121" href="Relation.Nullary.html#948" class="InductiveConstructor">ofⁿ</a> <a id="1125" href="Relation.Nullary.Reflects.html#1125" class="Bound">¬p</a><a id="1127" class="Symbol">)</a> <a id="1129" class="Symbol">=</a> <a id="1131" href="Relation.Nullary.Reflects.html#1125" class="Bound">¬p</a>
<a id="1135" class="Comment">------------------------------------------------------------------------</a>
<a id="1208" class="Comment">-- Other lemmas</a>
<a id="fromEquivalence"></a><a id="1225" href="Relation.Nullary.Reflects.html#1225" class="Function">fromEquivalence</a> <a id="1241" class="Symbol">:</a> <a id="1243" class="Symbol"></a> <a id="1245" class="Symbol">{</a><a id="1246" href="Relation.Nullary.Reflects.html#1246" class="Bound">b</a><a id="1247" class="Symbol">}</a> <a id="1249" class="Symbol"></a> <a id="1251" class="Symbol">(</a><a id="1252" href="Data.Bool.Base.html#1460" class="Function">T</a> <a id="1254" href="Relation.Nullary.Reflects.html#1246" class="Bound">b</a> <a id="1256" class="Symbol"></a> <a id="1258" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a><a id="1259" class="Symbol">)</a> <a id="1261" class="Symbol"></a> <a id="1263" class="Symbol">(</a><a id="1264" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a> <a id="1266" class="Symbol"></a> <a id="1268" href="Data.Bool.Base.html#1460" class="Function">T</a> <a id="1270" href="Relation.Nullary.Reflects.html#1246" class="Bound">b</a><a id="1271" class="Symbol">)</a> <a id="1273" class="Symbol"></a> <a id="1275" href="Relation.Nullary.html#863" class="Datatype">Reflects</a> <a id="1284" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a> <a id="1286" href="Relation.Nullary.Reflects.html#1246" class="Bound">b</a>
<a id="1288" href="Relation.Nullary.Reflects.html#1225" class="Function">fromEquivalence</a> <a id="1304" class="Symbol">{</a><a id="1305" class="Argument">b</a> <a id="1307" class="Symbol">=</a> <a id="1309" href="Agda.Builtin.Bool.html#181" class="InductiveConstructor">true</a><a id="1313" class="Symbol">}</a> <a id="1316" href="Relation.Nullary.Reflects.html#1316" class="Bound">sound</a> <a id="1322" href="Relation.Nullary.Reflects.html#1322" class="Bound">complete</a> <a id="1331" class="Symbol">=</a> <a id="1333" href="Relation.Nullary.html#911" class="InductiveConstructor">ofʸ</a> <a id="1337" class="Symbol">(</a><a id="1338" href="Relation.Nullary.Reflects.html#1316" class="Bound">sound</a> <a id="1344" class="Symbol">_)</a>
<a id="1347" href="Relation.Nullary.Reflects.html#1225" class="Function">fromEquivalence</a> <a id="1363" class="Symbol">{</a><a id="1364" class="Argument">b</a> <a id="1366" class="Symbol">=</a> <a id="1368" href="Agda.Builtin.Bool.html#175" class="InductiveConstructor">false</a><a id="1373" class="Symbol">}</a> <a id="1375" href="Relation.Nullary.Reflects.html#1375" class="Bound">sound</a> <a id="1381" href="Relation.Nullary.Reflects.html#1381" class="Bound">complete</a> <a id="1390" class="Symbol">=</a> <a id="1392" href="Relation.Nullary.html#948" class="InductiveConstructor">ofⁿ</a> <a id="1396" href="Relation.Nullary.Reflects.html#1381" class="Bound">complete</a>
<a id="1406" class="Comment">-- `Reflects` is deterministic.</a>
<a id="det"></a><a id="1438" href="Relation.Nullary.Reflects.html#1438" class="Function">det</a> <a id="1442" class="Symbol">:</a> <a id="1444" class="Symbol"></a> <a id="1446" class="Symbol">{</a><a id="1447" href="Relation.Nullary.Reflects.html#1447" class="Bound">b</a> <a id="1449" href="Relation.Nullary.Reflects.html#1449" class="Bound">b</a><a id="1451" class="Symbol">}</a> <a id="1453" class="Symbol"></a> <a id="1455" href="Relation.Nullary.html#863" class="Datatype">Reflects</a> <a id="1464" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a> <a id="1466" href="Relation.Nullary.Reflects.html#1447" class="Bound">b</a> <a id="1468" class="Symbol"></a> <a id="1470" href="Relation.Nullary.html#863" class="Datatype">Reflects</a> <a id="1479" href="Relation.Nullary.Reflects.html#476" class="Generalizable">P</a> <a id="1481" href="Relation.Nullary.Reflects.html#1449" class="Bound">b</a> <a id="1484" class="Symbol"></a> <a id="1486" href="Relation.Nullary.Reflects.html#1447" class="Bound">b</a> <a id="1488" href="Agda.Builtin.Equality.html#133" class="Datatype Operator"></a> <a id="1490" href="Relation.Nullary.Reflects.html#1449" class="Bound">b</a>
<a id="1493" href="Relation.Nullary.Reflects.html#1438" class="Function">det</a> <a id="1497" class="Symbol">(</a><a id="1498" href="Relation.Nullary.html#911" class="InductiveConstructor">ofʸ</a> <a id="1503" href="Relation.Nullary.Reflects.html#1503" class="Bound">p</a><a id="1504" class="Symbol">)</a> <a id="1506" class="Symbol">(</a><a id="1507" href="Relation.Nullary.html#911" class="InductiveConstructor">ofʸ</a> <a id="1512" href="Relation.Nullary.Reflects.html#1512" class="Bound">p</a><a id="1514" class="Symbol">)</a> <a id="1516" class="Symbol">=</a> <a id="1518" href="Agda.Builtin.Equality.html#190" class="InductiveConstructor">refl</a>
<a id="1523" href="Relation.Nullary.Reflects.html#1438" class="Function">det</a> <a id="1527" class="Symbol">(</a><a id="1528" href="Relation.Nullary.html#911" class="InductiveConstructor">ofʸ</a> <a id="1533" href="Relation.Nullary.Reflects.html#1533" class="Bound">p</a><a id="1534" class="Symbol">)</a> <a id="1536" class="Symbol">(</a><a id="1537" href="Relation.Nullary.html#948" class="InductiveConstructor">ofⁿ</a> <a id="1541" href="Relation.Nullary.Reflects.html#1541" class="Bound">¬p</a><a id="1544" class="Symbol">)</a> <a id="1546" class="Symbol">=</a> <a id="1548" href="Data.Empty.html#637" class="Function">⊥-elim</a> <a id="1555" class="Symbol">(</a><a id="1556" href="Relation.Nullary.Reflects.html#1541" class="Bound">¬p</a> <a id="1560" href="Relation.Nullary.Reflects.html#1533" class="Bound">p</a><a id="1561" class="Symbol">)</a>
<a id="1563" href="Relation.Nullary.Reflects.html#1438" class="Function">det</a> <a id="1567" class="Symbol">(</a><a id="1568" href="Relation.Nullary.html#948" class="InductiveConstructor">ofⁿ</a> <a id="1572" href="Relation.Nullary.Reflects.html#1572" class="Bound">¬p</a><a id="1574" class="Symbol">)</a> <a id="1576" class="Symbol">(</a><a id="1577" href="Relation.Nullary.html#911" class="InductiveConstructor">ofʸ</a> <a id="1582" href="Relation.Nullary.Reflects.html#1582" class="Bound">p</a><a id="1584" class="Symbol">)</a> <a id="1586" class="Symbol">=</a> <a id="1588" href="Data.Empty.html#637" class="Function">⊥-elim</a> <a id="1595" class="Symbol">(</a><a id="1596" href="Relation.Nullary.Reflects.html#1572" class="Bound">¬p</a> <a id="1599" href="Relation.Nullary.Reflects.html#1582" class="Bound">p</a><a id="1601" class="Symbol">)</a>
<a id="1603" href="Relation.Nullary.Reflects.html#1438" class="Function">det</a> <a id="1607" class="Symbol">(</a><a id="1608" href="Relation.Nullary.html#948" class="InductiveConstructor">ofⁿ</a> <a id="1612" href="Relation.Nullary.Reflects.html#1612" class="Bound">¬p</a><a id="1614" class="Symbol">)</a> <a id="1616" class="Symbol">(</a><a id="1617" href="Relation.Nullary.html#948" class="InductiveConstructor">ofⁿ</a> <a id="1621" href="Relation.Nullary.Reflects.html#1621" class="Bound">¬p</a><a id="1624" class="Symbol">)</a> <a id="1626" class="Symbol">=</a> <a id="1628" href="Agda.Builtin.Equality.html#190" class="InductiveConstructor">refl</a>
</pre></body></html>